- 時間撮記:
- 2010-2-15 上午03:33:33 (15 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Runtime/common/checksum/crc32-zlib.cpp
r21920 r26525 40 40 /** @todo Check if we can't just use the zlib code directly here. */ 41 41 42 /** 43 * Deal with blocks that are too big for the uInt type. 44 */ 45 static uint32_t rtCrc32ProcessTooBig(uint32_t uCRC32, const void *pv, size_t cb) 46 { 47 const Bytef *pb = (const Bytef *)pv; 48 do 49 { 50 uInt const cbChunk = cb <= ~(uInt)0 ? (uInt)cb : ~(uInt)0; 51 uCRC32 = crc32(uCRC32, pb, cbChunk); 52 pb += cbChunk; 53 cb -= cbChunk; 54 } while (!cb); 55 return uCRC32; 56 } 57 42 58 RTDECL(uint32_t) RTCrc32(const void *pv, register size_t cb) 43 59 { 44 60 uint32_t uCrc = crc32(0, NULL, 0); 45 return crc32(uCrc, (const Bytef *)pv, cb); 61 if (RT_UNLIKELY((uInt)cb == cb)) 62 uCrc = crc32(uCrc, (const Bytef *)pv, (uInt)cb); 63 else 64 uCrc = rtCrc32ProcessTooBig(uCrc, pv, cb); 65 return uCrc; 46 66 } 47 67 RT_EXPORT_SYMBOL(RTCrc32); … … 57 77 RTDECL(uint32_t) RTCrc32Process(uint32_t uCRC32, const void *pv, size_t cb) 58 78 { 59 return crc32(uCRC32, (const Bytef *)pv, cb); 79 if (RT_UNLIKELY((uInt)cb == cb)) 80 uCRC32 = crc32(uCRC32, (const Bytef *)pv, (uInt)cb); 81 else 82 uCRC32 = rtCrc32ProcessTooBig(uCRC32, pv, cb); 83 return uCRC32; 60 84 } 61 85 RT_EXPORT_SYMBOL(RTCrc32Process);
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器