* Add a new entry to the hash table. */
| 143 | * Add a new entry to the hash table. |
| 144 | */ |
| 145 | static int32_t AddToHash(ZipString* hash_table, const uint64_t hash_table_size, |
| 146 | const ZipString& name) { |
| 147 | const uint64_t hash = ComputeHash(name); |
| 148 | uint32_t ent = hash & (hash_table_size - 1); |
| 149 | |
| 150 | /* |
| 151 | * We over-allocated the table, so we're guaranteed to find an empty slot. |
| 152 | * Further, we guarantee that the hashtable size is not 0. |
| 153 | */ |
| 154 | while (hash_table[ent].name != NULL) { |
| 155 | if (hash_table[ent] == name) { |
| 156 | // We've found a duplicate entry. We don't accept it |
| 157 | //chensenhua ALOGW("Zip: Found duplicate entry %.*s", name.name_length, name.name); |
| 158 | return kDuplicateEntry; |
| 159 | } |
| 160 | ent = (ent + 1) & (hash_table_size - 1); |
| 161 | } |
| 162 | |
| 163 | hash_table[ent].name = name.name; |
| 164 | hash_table[ent].name_length = name.name_length; |
| 165 | return 0; |
| 166 | } |
| 167 | |
| 168 | static int32_t MapCentralDirectory0(const char* debug_file_name, ZipArchive* archive, |
| 169 | off64_t file_length, off64_t read_amount, uint8_t* scan_buffer) { |
no test coverage detected