TeamSpeak-3-Java-API
TeamSpeak-3-Java-API copied to clipboard
negative icon id
For some icons i get negative ids, e.g via ServerGroup.getIconId() So i'm not able to download the icon file in this cases. I'm running on 64bit-jvm.
I found out that i can fix those ids by adding (1 << 32).
May there are internally some problems with handling icon ids. One reason could be that the long ids are threated as integers at some point.
The icon ID is a 32-bit unsigned integer. Java doesn't have unsigned integers, so you may end up with negative icon IDs.
However, this problem is not restricted to our API, either. The server query sometimes sends the icon ID as an unsigned integer, and sometimes as a signed integer. In some places, like the permissions system, TS3 expects a signed integer, and in others, like the file system, they expect unsigned integers.
But I agree, as a user you shouldn't have to deal with those kinds of problems. We might just convert everything to a Java int
and do the required signed <-> unsigned conversions internally.
As temporary solution im fixing it like this:
public static long getUnsignedInt(int x) { return x & 0x00000000ffffffffL; }
Maybe I'll create PR tomorrow...