Fix: build the client on LP64 after the compression switch
0e20e0b started passing a local unsigned long to CompressData(), whose
length parameter is ULONG& (typedef unsigned int). The two types are
identical on Windows, so the Windows builds never noticed, but on LP64
(Linux x86_64, Android arm64/x86_64) unsigned long is 64 bit and the
reference cannot bind, so IOCPClient.cpp fails to compile. This has
blocked the Linux and Android native builds since then; the tracked
linux/ghost predates the change, which is why it went unnoticed.
Declare the length as ULONG and cast compressBound/ZSTD_compressBound
accordingly. Packet lengths are bounded by the wire protocol and the
type is byte-for-byte the same as before on Windows.
Verified: the Linux Release build (WSL, out-of-source) compiles with
both the zstd 1.5.7 and 1.6.0 headers; the Android debug APK builds for
arm64-v8a and armeabi-v7a with IOCPClient.cpp actually recompiled.
Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
f618fbdc8b
commit
da6185ba5e
1 file changed
+6
-4
@@ -1156,12 +1156,14 @@ BOOL IOCPClient::OnServerSending(const char* szBuffer, ULONG ulOriginalLength, P
|
||||
// 线缆压缩:运行期选择 zlib / zstd(默认 zstd)。zlib 用 compressBound 而不是
|
||||
// 1.001n+12 —— 后者对小于约 1KB 的包会比 compressBound 少 1 字节,导致
|
||||
// compress() 返回 Z_BUF_ERROR、小包(心跳 ACK、控制命令)被静默丢弃。
|
||||
// 用 ULONG(32 位)而不是 unsigned long:LP64 下 unsigned long 是 64 位,
|
||||
// 绑不到 CompressData 的 ULONG&,Linux/Android arm64 会直接编译失败。
|
||||
#if CLIENT_HAS_ZLIB
|
||||
unsigned long ulCompressedLength = m_useZlib
|
||||
? (unsigned long)compressBound(ulOriginalLength)
|
||||
: (unsigned long)ZSTD_compressBound(ulOriginalLength);
|
||||
ULONG ulCompressedLength = m_useZlib
|
||||
? (ULONG)compressBound(ulOriginalLength)
|
||||
: (ULONG)ZSTD_compressBound(ulOriginalLength);
|
||||
#else
|
||||
unsigned long ulCompressedLength = (unsigned long)ZSTD_compressBound(ulOriginalLength);
|
||||
ULONG ulCompressedLength = (ULONG)ZSTD_compressBound(ulOriginalLength);
|
||||
#endif
|
||||
BYTE buf[1024];
|
||||
LPBYTE CompressedBuffer = ulCompressedLength>1024 ? new BYTE[ulCompressedLength] : buf;
|
||||
|
||||
Reference in new issue
Block a user