gwoplock / coldbrew

A C based package manger for Mac OS X
GNU General Public License v3.0
7 stars 0 forks source link

hashmap resize has grabage values #12

Closed gwoplock closed 6 years ago

gwoplock commented 6 years ago

When the hashmap (string->int) resizes there are sometimes garbage values in the map array

gwoplock commented 6 years ago

after further testing it seems to be in the add function. see output from testing below:

/Users/garrettbattaglia/Documents/dev/coldbrew/cmake-build-debug/coldbrew this is a test command line args I hope this works the way it should work but for some reason i dont thinki it will 0: will -> 1 1: i -> 1 2: (null) -> 0 3: dont -> 1 4: hope -> 1 5: but -> 2 6: line -> 1 7: (null) -> 0 8: this -> 3 9: (null) -> 0 10: test -> 1 11: the -> 1 12: some -> 1 13: (null) -> 0 14: (null) -> 0 15: (null) -> 0 16: is -> 1 17: it -> 2 18: (null) -> 0 19: way -> 2 20: works -> -449127600 21: for -> 32767 22: (null) -> 0 23: work -> 1 24: (null) -> 0 25: (null) -> 0

testcode:

int main(int argc, char **argv)
{
     parseCommandLine(argc-1, argv +1);
     for (int i = 0; i < command_line_args->size; i++) {
        printf("%i: %s -> %i\n", i, command_line_args->key[i], command_line_args->map[i]);
    }
}
gwoplock commented 6 years ago

hash should have been unsigned... fixed in commit 93f7622.