[71960] trunk/dports/devel/libhsplasma
ryandesign at macports.org
ryandesign at macports.org
Tue Sep 28 05:58:37 PDT 2010
Revision: 71960
http://trac.macports.org/changeset/71960
Author: ryandesign at macports.org
Date: 2010-09-28 05:58:35 -0700 (Tue, 28 Sep 2010)
Log Message:
-----------
libhsplasma: add some fixes for endian issues in networking code on PowerPC
Modified Paths:
--------------
trunk/dports/devel/libhsplasma/Portfile
Added Paths:
-----------
trunk/dports/devel/libhsplasma/files/patch-endian.diff
Modified: trunk/dports/devel/libhsplasma/Portfile
===================================================================
--- trunk/dports/devel/libhsplasma/Portfile 2010-09-28 12:45:40 UTC (rev 71959)
+++ trunk/dports/devel/libhsplasma/Portfile 2010-09-28 12:58:35 UTC (rev 71960)
@@ -28,7 +28,8 @@
port:openssl \
port:python26
-patchfiles patch-commdebug.diff
+patchfiles patch-commdebug.diff \
+ patch-endian.diff
configure.args-append -DDISABLE_PYTHON:BOOL=OFF \
-DPYTHON_INCLUDE_DIR:PATH=${frameworks_dir}/Python.framework/Versions/2.6/Headers \
Added: trunk/dports/devel/libhsplasma/files/patch-endian.diff
===================================================================
--- trunk/dports/devel/libhsplasma/files/patch-endian.diff (rev 0)
+++ trunk/dports/devel/libhsplasma/files/patch-endian.diff 2010-09-28 12:58:35 UTC (rev 71960)
@@ -0,0 +1,341 @@
+--- core/Sys/plUuid.cpp.orig 2010-09-26 23:16:46.000000000 -0500
++++ core/Sys/plUuid.cpp 2010-09-27 07:17:36.000000000 -0500
+@@ -69,6 +69,9 @@
+ fData1 = *(unsigned int* )(buffer );
+ fData2 = *(unsigned short*)(buffer + 4);
+ fData3 = *(unsigned short*)(buffer + 6);
++ fData1 = LESWAP32(fData1);
++ fData2 = LESWAP16(fData2);
++ fData3 = LESWAP16(fData3);
+ memcpy(fData4, buffer + 8, 8);
+ }
+
+@@ -80,9 +83,9 @@
+ }
+
+ void plUuid::write(unsigned char* buffer) const {
+- *(unsigned int* )(buffer ) = fData1;
+- *(unsigned short*)(buffer + 4) = fData2;
+- *(unsigned short*)(buffer + 6) = fData3;
++ *(unsigned int* )(buffer ) = LESWAP32(fData1);
++ *(unsigned short*)(buffer + 4) = LESWAP16(fData2);
++ *(unsigned short*)(buffer + 6) = LESWAP16(fData3);
+ memcpy(buffer + 8, fData4, 8);
+ }
+
+--- net/auth/pnAuthClient.cpp.orig 2010-09-26 23:16:46.000000000 -0500
++++ net/auth/pnAuthClient.cpp 2010-09-27 07:17:36.000000000 -0500
+@@ -66,6 +66,7 @@
+ }
+
+ fSock->recv(&msgId, sizeof(hsUint16));
++ msgId = LESWAP16(msgId);
+ const pnNetMsg* msgDesc = GET_Auth2Cli(msgId);
+ if (msgDesc == NULL) {
+ plDebug::Error("Got invalid message ID (%u)", msgId);
+@@ -381,13 +382,13 @@
+ hsUbyte connectHeader[51]; // ConnectHeader + AuthConnectHeader
+ /* Begin ConnectHeader */
+ *(hsUbyte* )(connectHeader ) = kConnTypeCliToAuth;
+- *(hsUint16*)(connectHeader + 1) = 31;
+- *(hsUint32*)(connectHeader + 3) = fBuildId;
+- *(hsUint32*)(connectHeader + 7) = fBuildType;
+- *(hsUint32*)(connectHeader + 11) = fBranchId;
++ *(hsUint16*)(connectHeader + 1) = LESWAP16(31);
++ *(hsUint32*)(connectHeader + 3) = LESWAP32(fBuildId);
++ *(hsUint32*)(connectHeader + 7) = LESWAP32(fBuildType);
++ *(hsUint32*)(connectHeader + 11) = LESWAP32(fBranchId);
+ fProductId.write(connectHeader + 15);
+ /* Begin AuthConnectHeader */
+- *(hsUint32*)(connectHeader + 31) = 20;
++ *(hsUint32*)(connectHeader + 31) = LESWAP32(20);
+ memset(connectHeader + 35, 0, 16);
+ fSock->send(connectHeader, 51);
+
+@@ -435,6 +436,7 @@
+ } else if (msg == kNetCliSrv2CliError) {
+ hsUint32 errorCode;
+ fSock->recv(&errorCode, sizeof(hsUint32));
++ errorCode = LESWAP32(errorCode);
+ delete fSock;
+ fSock = NULL;
+ plDebug::Error("Error connecting to Auth server: %s",
+--- net/crypt/pnRC4.cpp.orig 2010-09-26 23:16:46.000000000 -0500
++++ net/crypt/pnRC4.cpp 2010-09-27 07:17:36.000000000 -0500
+@@ -107,11 +107,11 @@
+ } else if (size == 2) {
+ hsUint16 v;
+ sock->recv(&v, sizeof(hsUint16));
+- data.fUint = v;
++ data.fUint = LESWAP16(v);
+ } else if (size == 4) {
+ hsUint32 v;
+ sock->recv(&v, sizeof(hsUint32));
+- data.fUint = v;
++ data.fUint = LESWAP32(v);
+ }
+
+ #ifdef COMMDEBUG
+@@ -154,10 +154,10 @@
+ *(hsUbyte*)buf = (hsUbyte)data.fUint;
+ buf += sizeof(hsUbyte);
+ } else if (size == 2) {
+- *(hsUint16*)buf = (hsUint16)data.fUint;
++ *(hsUint16*)buf = (hsUint16)LESWAP16(data.fUint);
+ buf += sizeof(hsUint16);
+ } else if (size == 4) {
+- *(hsUint32*)buf = data.fUint;
++ *(hsUint32*)buf = LESWAP32(data.fUint);
+ buf += sizeof(hsUint32);
+ }
+
+@@ -208,7 +208,7 @@
+ size_t bufSize = sizeof(hsUint16) + NCMessageSize(data, msg);
+ unsigned char* buffer = new unsigned char[bufSize];
+ unsigned char* bp = buffer;
+- *(hsUint16*)bp = msg->fMsgId;
++ *(hsUint16*)bp = LESWAP16(msg->fMsgId);
+ bp += sizeof(hsUint16);
+
+ unsigned int size = 0;
+@@ -223,9 +223,13 @@
+ case kFieldString:
+ {
+ hsUint16 len = plwcslen(data[i].fString);
+- *(hsUint16*)bp = len;
++ *(hsUint16*)bp = LESWAP16(len);
+ bp += sizeof(hsUint16);
+ memcpy(bp, data[i].fString, len * sizeof(pl_wchar_t));
++#ifdef WORDS_BIGENDIAN
++ for (size_t j=0; j<len; j++)
++ bp[j] = LESWAP16(bp[j]);
++#endif
+ bp += len * sizeof(pl_wchar_t);
+ #ifdef COMMDEBUG
+ plDebug::Debug(" -> Str: %s", plString(data[i].fString, len).cstr());
+@@ -235,7 +239,7 @@
+ case kFieldVarCount:
+ size = field->fSize;
+ count = data[i].fUint;
+- *(hsUint32*)bp = count;
++ *(hsUint32*)bp = LESWAP32(count);
+ bp += sizeof(hsUint32);
+ #ifdef COMMDEBUG
+ plDebug::Debug(" -> Count: %d", count);
+@@ -309,8 +313,13 @@
+ {
+ hsUint16 len;
+ recv(&len, sizeof(hsUint16));
++ len = LESWAP16(len);
+ pl_wchar_t* str = new pl_wchar_t[len + 1];
+ recv(str, len * sizeof(pl_wchar_t));
++#ifdef WORDS_BIGENDIAN
++ for (size_t j=0; j<len; j++)
++ str[j] = LESWAP16(str[j]);
++#endif
+ str[len] = 0;
+ data[i].fString = str;
+ #ifdef COMMDEBUG
+@@ -321,7 +330,7 @@
+ case kFieldVarCount:
+ size = field->fSize;
+ recv(&count, sizeof(hsUint32));
+- data[i].fUint = count;
++ data[i].fUint = LESWAP32(count);
+ #ifdef COMMDEBUG
+ plDebug::Debug(" <- Count: %d", count);
+ #endif
+--- net/file/pnFileClient.cpp.orig 2010-09-26 23:16:46.000000000 -0500
++++ net/file/pnFileClient.cpp 2010-09-27 07:17:36.000000000 -0500
+@@ -116,6 +116,8 @@
+
+ fSock->recv(&header.fMsgSize, sizeof(header.fMsgSize));
+ fSock->recv(&header.fMsgId, sizeof(header.fMsgId));
++ header.fMsgSize = LESWAP32(header.fMsgSize);
++ header.fMsgId = LESWAP32(header.fMsgId);
+ hsUbyte* msgbuf = new hsUbyte[header.fMsgSize - 8];
+ fSock->recv(msgbuf, header.fMsgSize - 8);
+
+@@ -238,13 +240,13 @@
+ hsUbyte connectHeader[43]; // ConnectHeader + FileConnectHeader
+ /* Begin ConnectHeader */
+ *(hsUbyte* )(connectHeader ) = kConnTypeCliToFile;
+- *(hsUint16*)(connectHeader + 1) = 31;
++ *(hsUint16*)(connectHeader + 1) = LESWAP16(31);
+ *(hsUint32*)(connectHeader + 3) = 0;
+- *(hsUint32*)(connectHeader + 7) = fBuildType;
+- *(hsUint32*)(connectHeader + 11) = fBranchId;
++ *(hsUint32*)(connectHeader + 7) = LESWAP32(fBuildType);
++ *(hsUint32*)(connectHeader + 11) = LESWAP32(fBranchId);
+ fProductId.write(connectHeader + 15);
+ /* Begin FileConnectHeader */
+- *(hsUint32*)(connectHeader + 31) = 12;
++ *(hsUint32*)(connectHeader + 31) = LESWAP32(12);
+ *(hsUint32*)(connectHeader + 35) = 0;
+ *(hsUint32*)(connectHeader + 39) = 0;
+ fSock->send(connectHeader, 43);
+@@ -264,9 +266,9 @@
+ void pnFileClient::sendPingRequest(hsUint32 pingTimeMs)
+ {
+ hsUbyte msgbuf[12];
+- *(hsUint32*)(msgbuf ) = 12; // Msg size
+- *(hsUint32*)(msgbuf + 4) = kCli2File_PingRequest; // Msg ID
+- *(hsUint32*)(msgbuf + 8) = pingTimeMs; // Ping time
++ *(hsUint32*)(msgbuf ) = LESWAP32(12); // Msg size
++ *(hsUint32*)(msgbuf + 4) = LESWAP32(kCli2File_PingRequest); // Msg ID
++ *(hsUint32*)(msgbuf + 8) = LESWAP32(pingTimeMs); // Ping time
+ fSock->send(msgbuf, 12);
+ }
+
+@@ -274,9 +276,9 @@
+ {
+ hsUint32 transId = nextTransId();
+ hsUbyte msgbuf[12];
+- *(hsUint32*)(msgbuf ) = 12; // Msg size
+- *(hsUint32*)(msgbuf + 4) = kCli2File_BuildIdRequest; // Msg ID
+- *(hsUint32*)(msgbuf + 8) = transId; // Trans ID
++ *(hsUint32*)(msgbuf ) = LESWAP32(12); // Msg size
++ *(hsUint32*)(msgbuf + 4) = LESWAP32(kCli2File_BuildIdRequest); // Msg ID
++ *(hsUint32*)(msgbuf + 8) = LESWAP32(transId); // Trans ID
+ fSock->send(msgbuf, 12);
+ return transId;
+ }
+@@ -288,12 +290,12 @@
+
+ hsUint32 transId = nextTransId();
+ hsUbyte msgbuf[536];
+- *(hsUint32*)(msgbuf ) = 536; // Msg size
+- *(hsUint32*)(msgbuf + 4) = kCli2File_ManifestRequest; // Msg ID
+- *(hsUint32*)(msgbuf + 8) = transId; // Trans ID
++ *(hsUint32*)(msgbuf ) = LESWAP32(536); // Msg size
++ *(hsUint32*)(msgbuf + 4) = LESWAP32(kCli2File_ManifestRequest); // Msg ID
++ *(hsUint32*)(msgbuf + 8) = LESWAP32(transId); // Trans ID
+ memcpy(msgbuf + 12, wgroup.data(), (len >= 260 ? 259 : len) * sizeof(pl_wchar_t));
+- *(pl_wchar_t*)(msgbuf + 530) = 0; // Nul terminator
+- *(hsUint32*)(msgbuf + 532) = buildId; // Build ID
++ *(pl_wchar_t*)(msgbuf + 530) = 0; // Nul terminator
++ *(hsUint32*)(msgbuf + 532) = LESWAP32(buildId); // Build ID
+ fSock->send(msgbuf, 536);
+ return transId;
+ }
+@@ -305,12 +307,12 @@
+
+ hsUint32 transId = nextTransId();
+ hsUbyte msgbuf[536];
+- *(hsUint32*)(msgbuf ) = 536; // Msg size
+- *(hsUint32*)(msgbuf + 4) = kCli2File_FileDownloadRequest; // Msg ID
+- *(hsUint32*)(msgbuf + 8) = transId; // Trans ID
++ *(hsUint32*)(msgbuf ) = LESWAP32(536); // Msg size
++ *(hsUint32*)(msgbuf + 4) = LESWAP32(kCli2File_FileDownloadRequest); // Msg ID
++ *(hsUint32*)(msgbuf + 8) = LESWAP32(transId); // Trans ID
+ memcpy(msgbuf + 12, wfilename.data(), (len >= 260 ? 259 : len) * sizeof(pl_wchar_t));
+- *(pl_wchar_t*)(msgbuf + 530) = 0; // Nul terminator
+- *(hsUint32*)(msgbuf + 532) = buildId; // Build ID
++ *(pl_wchar_t*)(msgbuf + 530) = 0; // Nul terminator
++ *(hsUint32*)(msgbuf + 532) = LESWAP32(buildId); // Build ID
+ fSock->send(msgbuf, 536);
+ return transId;
+ }
+@@ -318,20 +320,20 @@
+ void pnFileClient::sendManifestEntryAck(hsUint32 transId, hsUint32 readerId)
+ {
+ hsUbyte msgbuf[16];
+- *(hsUint32*)(msgbuf ) = 16; // Msg size
+- *(hsUint32*)(msgbuf + 4) = kCli2File_ManifestEntryAck; // Msg ID
+- *(hsUint32*)(msgbuf + 8) = transId; // Trans ID
+- *(hsUint32*)(msgbuf + 12) = readerId; // Reader ID
++ *(hsUint32*)(msgbuf ) = LESWAP32(16); // Msg size
++ *(hsUint32*)(msgbuf + 4) = LESWAP32(kCli2File_ManifestEntryAck); // Msg ID
++ *(hsUint32*)(msgbuf + 8) = LESWAP32(transId); // Trans ID
++ *(hsUint32*)(msgbuf + 12) = LESWAP32(readerId); // Reader ID
+ fSock->send(msgbuf, 16);
+ }
+
+ void pnFileClient::sendFileDownloadChunkAck(hsUint32 transId, hsUint32 readerId)
+ {
+ hsUbyte msgbuf[16];
+- *(hsUint32*)(msgbuf ) = 16; // Msg size
+- *(hsUint32*)(msgbuf + 4) = kCli2File_FileDownloadChunkAck; // Msg ID
+- *(hsUint32*)(msgbuf + 8) = transId; // Trans ID
+- *(hsUint32*)(msgbuf + 12) = readerId; // Reader ID
++ *(hsUint32*)(msgbuf ) = LESWAP32(16); // Msg size
++ *(hsUint32*)(msgbuf + 4) = LESWAP32(kCli2File_FileDownloadChunkAck); // Msg ID
++ *(hsUint32*)(msgbuf + 8) = LESWAP32(transId); // Trans ID
++ *(hsUint32*)(msgbuf + 12) = LESWAP32(readerId); // Reader ID
+ fSock->send(msgbuf, 16);
+ }
+
+--- net/game/pnGameClient.cpp.orig 2010-09-26 23:16:46.000000000 -0500
++++ net/game/pnGameClient.cpp 2010-09-27 07:17:36.000000000 -0500
+@@ -36,6 +36,7 @@
+ }
+
+ fSock->recv(&msgId, sizeof(hsUint16));
++ msgId = LESWAP16(msgId);
+ const pnNetMsg* msgDesc = GET_Game2Cli(msgId);
+ if (msgDesc == NULL) {
+ plDebug::Error("Got invalid message ID (%u)", msgId);
+@@ -153,13 +154,13 @@
+ hsUbyte connectHeader[67]; // ConnectHeader + GameConnectHeader
+ /* Begin ConnectHeader */
+ *(hsUbyte* )(connectHeader ) = kConnTypeCliToGame;
+- *(hsUint16*)(connectHeader + 1) = 31;
+- *(hsUint32*)(connectHeader + 3) = fBuildId;
+- *(hsUint32*)(connectHeader + 7) = fBuildType;
+- *(hsUint32*)(connectHeader + 11) = fBranchId;
++ *(hsUint16*)(connectHeader + 1) = LESWAP16(31);
++ *(hsUint32*)(connectHeader + 3) = LESWAP32(fBuildId);
++ *(hsUint32*)(connectHeader + 7) = LESWAP32(fBuildType);
++ *(hsUint32*)(connectHeader + 11) = LESWAP32(fBranchId);
+ fProductId.write(connectHeader + 15);
+ /* Begin GameConnectHeader */
+- *(hsUint32*)(connectHeader + 31) = 36;
++ *(hsUint32*)(connectHeader + 31) = LESWAP32(36);
+ fAccountId.write(connectHeader + 35);
+ fAgeId.write(connectHeader + 51);
+ fSock->send(connectHeader, 67);
+@@ -208,6 +209,7 @@
+ } else if (msg == kNetCliSrv2CliError) {
+ hsUint32 errorCode;
+ fSock->recv(&errorCode, sizeof(hsUint32));
++ errorCode = LESWAP32(errorCode);
+ delete fSock;
+ fSock = NULL;
+ plDebug::Error("Error connecting to Game server: %s",
+--- net/gate/pnGateKeeperClient.cpp.orig 2010-09-26 23:16:46.000000000 -0500
++++ net/gate/pnGateKeeperClient.cpp 2010-09-27 07:17:36.000000000 -0500
+@@ -35,6 +35,7 @@
+ }
+
+ fSock->recv(&msgId, sizeof(hsUint16));
++ msgId = LESWAP16(msgId);
+ const pnNetMsg* msgDesc = GET_GateKeeper2Cli(msgId);
+ if (msgDesc == NULL) {
+ plDebug::Error("Got invalid message ID (%u)", msgId);
+@@ -122,13 +123,13 @@
+ hsUbyte connectHeader[51]; // ConnectHeader + GateKeeperConnectHeader
+ /* Begin ConnectHeader */
+ *(hsUbyte* )(connectHeader ) = kConnTypeCliToGateKeeper;
+- *(hsUint16*)(connectHeader + 1) = 31;
+- *(hsUint32*)(connectHeader + 3) = fBuildId;
+- *(hsUint32*)(connectHeader + 7) = fBuildType;
+- *(hsUint32*)(connectHeader + 11) = fBranchId;
++ *(hsUint16*)(connectHeader + 1) = LESWAP16(31);
++ *(hsUint32*)(connectHeader + 3) = LESWAP32(fBuildId);
++ *(hsUint32*)(connectHeader + 7) = LESWAP32(fBuildType);
++ *(hsUint32*)(connectHeader + 11) = LESWAP32(fBranchId);
+ fProductId.write(connectHeader + 15);
+ /* Begin GateKeeperConnectHeader */
+- *(hsUint32*)(connectHeader + 31) = 20;
++ *(hsUint32*)(connectHeader + 31) = LESWAP32(20);
+ memset(connectHeader + 35, 0, 16);
+ fSock->send(connectHeader, 51);
+
+@@ -176,6 +177,7 @@
+ } else if (msg == kNetCliSrv2CliError) {
+ hsUint32 errorCode;
+ fSock->recv(&errorCode, sizeof(hsUint32));
++ errorCode = LESWAP32(errorCode);
+ delete fSock;
+ fSock = NULL;
+ plDebug::Error("Error connecting to GateKeeper server: %s",
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100928/ecd59328/attachment-0001.html>
More information about the macports-changes
mailing list