MCPcopy Create free account
hub / github.com/CodingGay/BlackDex / AddToHash

Function AddToHash

Bcore/src/main/cpp/ziparchive/zip_archive.cc:145–166  ·  view source on GitHub ↗

* Add a new entry to the hash table. */

Source from the content-addressed store, hash-verified

143 * Add a new entry to the hash table.
144 */
145static 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
168static int32_t MapCentralDirectory0(const char* debug_file_name, ZipArchive* archive,
169 off64_t file_length, off64_t read_amount, uint8_t* scan_buffer) {

Callers 1

ParseZipArchiveFunction · 0.85

Calls 1

ComputeHashFunction · 0.85

Tested by

no test coverage detected