Bill Pringlemeir wrote: > On 19 Feb 2007, [EMAIL PROTECTED] wrote: > Do you have a PPC? I don't think that "char" and "unsigned char" have > problems like on an ARM.
What do you mean? > But anyways, I have some splint output below, in case it is helpful to > anyone... I don't find these too helpful, also because splint does not seem to parse C very well. > utf8.c:177:14: Operands of < have incompatible types (guint, arbitrary > unsigned > integral type): i < (sizeof((utf8_cd_tab)) / sizeof(((utf8_cd_tab)[0]))) It's not an "arbitrary" type, it's size_t. A real compiler like GCC could even prove that the left operand fits into an unsigned integer, so there's no point to warn. > utf8.c:270:58: Initializer block for utf8len has 256 elements, but declared as > guint8 [0]: This is plain wrong. "(size_t)(guchar)-1 + 1" is not 0. It's ((size_t)UCHAR_MAX) + 1. The casts have a higher precedence than '+'.The trailing elements fill be zero-filled. Of course, typically there will be no trailing elements because nobody uses gtk-gnutella on a machine that has more than 8 bits in a byte. > utf8.c:364:9: Return value type int does not match declared type guint: > uc < 0x80U ? 1 : uc < 0x800 ? 2 : uc < 0x10000 ? 3 : 4 Well that's how C works. It's implicitely promoted to unsigned int. One could change 1 to 1U and so on. Explicit casts should be avoided whenever possible because they cause worse trouble and once the cast is in place, no compiler in the world is going to warn about it anymore even if the cast is wrong. > utf8.c:409:6: Operands of <= have incompatible types (guint, size_t): > len <= size There's nothing incompatible about them. > utf8.c:413:4: Assignment of guint32 to gchar: buf[i] = (uc | 0x80) & 0xbf Obviously the values will be in the range 0..0xbf which definitely fits into a char. > utf8.c:416:3: Assignment of guint32 to gchar: buf[0] = uc | utf8len_mark[len] Implicit truncation to char which is correct. > utf8.c:997:9: Return value type int does not match declared type size_t: > s - src It's not int but ptrdiff_t. Could be the same types but if someone actually put (int) there, good luck finding the bug on a 64-bit arch in code where you actually do use very large memory objects. There are just to many false positives to make it worthwhile. -- Christian ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Gtk-gnutella-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gtk-gnutella-devel
