* ntohs() won't work, because it converts from bigendian to native byteorder, and the format used in TVision streams is littleendian. Conversion must be done explicitly, by calling readByte() several times, in consecutive statements ! *This enables ncurses mouse support, which was broken (it seemed to depend on gpm in an unhealthy way). *Un*x filenames can easily contain spaces ... Don't trim the filename. *Avoid possible problems with signed/unsigned char comparisons. And functions like toupper must be called with an unsigned char. PR: 71544 Submitted by: Erling Jacobsen <linuxcub@email.dk> Set maintainer back to ports, as libh is now officially a dead project Compile with GCC 3.4 Bump PORTREVISION
41 lines
1 KiB
Text
41 lines
1 KiB
Text
ntohs() won't work, because it converts from bigendian to native
|
|
byteorder, and the format used in TVision streams is littleendian.
|
|
Conversion must be done explicitly, by calling readByte() several
|
|
times, in consecutive statements !
|
|
|
|
|
|
diff -ur -orig/lib/tobjstrm.cc lib/tobjstrm.cc
|
|
--- -orig/lib/tobjstrm.cc Tue Sep 7 17:31:19 2004
|
|
+++ lib/tobjstrm.cc Tue Sep 7 17:34:15 2004
|
|
@@ -295,11 +295,9 @@
|
|
ipstream::readWord()
|
|
{
|
|
/* SS: words are stored in little endian format (LSB first) */
|
|
- ushort val;
|
|
-
|
|
- read((char *)&val, 2);
|
|
- val = ntohs(val);
|
|
- return val;
|
|
+ ushort ret = readByte();
|
|
+ ret = ret | (readByte() << 8);
|
|
+ return ret;
|
|
}
|
|
|
|
/**
|
|
@@ -309,11 +307,11 @@
|
|
ipstream::readLong()
|
|
{
|
|
/* SS: ints are stored in little endian format (LSB first) */
|
|
- ulong val;
|
|
-
|
|
- read((char *)&val, 4);
|
|
- val = ntohl(val);
|
|
- return val;
|
|
+ ulong ret = readByte();
|
|
+ ret = ret | (readByte() << 8);
|
|
+ ret = ret | (readByte() << 16);
|
|
+ ret = ret | (readByte() << 24);
|
|
+ return ret;
|
|
}
|
|
|
|
/**
|