Archived

This forum has been archived. Please start a new discussion on GitHub.

Patch for slice2java, v1.5.1

slice2java in v1.5.1 and earlier generates incorrect constant definitions for byte constants. Please apply the following patch to slice2java/Gen.cpp to fix this.

Cheers,

Michi.

diff -r1.151 Gen.cpp
2241c2241,2246
< out << p->value() << " -128"; // Slice byte runs from 0-255, Java byte runs from -128 - 127.
---
> int i = atoi(p->value().c_str());
> if(i > 127)
> {
> i -= 256;
> }
> out << i; // Slice byte runs from 0-255, Java byte runs from -128 - 127.