VirtualBox

Changeset 30611 in vbox


Ignore:
Timestamp:
Jul 5, 2010 12:53:59 PM (15 years ago)
Author:
vboxsync
Message:

strspace.cpp: Fixed bug in sdbm() resulting in wrong cchString values (+1). Return true when inserting into the collision list, only return false for identical strings.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/string/strspace.cpp

    r28800 r30611  
    8484   this is one of the algorithms used in berkeley db (see sleepycat) and
    8585   elsewhere. */
    86 inline uint32_t sdbm(const char *str, size_t *pcch)
     86DECLINLINE(uint32_t) sdbm(const char *str, size_t *pcch)
    8787{
    8888    uint8_t *pu8 = (uint8_t *)str;
     
    9393        hash = c + (hash << 6) + (hash << 16) - hash;
    9494
    95     *pcch = (uintptr_t)pu8 - (uintptr_t)str;
     95    *pcch = (uintptr_t)pu8 - (uintptr_t)str - 1;
    9696    return hash;
    9797}
     
    120120    pStr->pList = pMatch->pList;
    121121    pMatch->pList = pStr;
    122     return false;
     122    return true;
    123123}
    124124RT_EXPORT_SYMBOL(RTStrSpaceInsert);
Note: See TracChangeset for help on using the changeset viewer.

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