VirtualBox

忽略:
時間撮記:
2010-2-15 上午03:33:33 (15 年 以前)
作者:
vboxsync
訊息:

Runtime: win.amd64 warnings.

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Runtime/common/checksum/crc32-zlib.cpp

    r21920 r26525  
    4040/** @todo Check if we can't just use the zlib code directly here. */
    4141
     42/**
     43 * Deal with blocks that are too big for the uInt type.
     44 */
     45static 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
    4258RTDECL(uint32_t) RTCrc32(const void *pv, register size_t cb)
    4359{
    4460    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;
    4666}
    4767RT_EXPORT_SYMBOL(RTCrc32);
     
    5777RTDECL(uint32_t) RTCrc32Process(uint32_t uCRC32, const void *pv, size_t cb)
    5878{
    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;
    6084}
    6185RT_EXPORT_SYMBOL(RTCrc32Process);
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette