/// short strings are hashed here. GRAEHL_FORCE_INLINE uint64_t farmhash_len_0to16(char const* s, std::size_t len) { if (len >= 8) { uint64_t mul = k_bigprime2 + len * 2; // odd uint64_t a = fetch_uint64(s) + k_bigprime2; uint64_t b = fetch_uint64(s + len - 8); uint64_t c = bit_rotate_right_64(b, 37) * mul + a; uint64_t d = (bit_rotate_right_64(a, 25) + b) * mul; return farmhash_len_16(c, d, mul); } else if (len >= 4) { uint64_t mul = k_bigprime2 + len * 2; // odd uint64_t a = fetch_uint32(s); return farmhash_len_16(len + (a << 3), fetch_uint32(s + len - 4), mul); } else if (len > 0) { uint8_t a = s[0]; uint8_t b = s[len >> 1]; uint8_t c = s[len - 1]; uint32_t y = (uint32_t)a + ((uint32_t)b << 8); uint32_t z = len + ((uint32_t)c << 2); return fast_mixbits(y * k_bigprime2 ^ z * k_bigprime0) * k_bigprime2; } else
Exec_stat MCIdeDmgBuild::exec(MCExecPoint& ep) { Exec_stat t_stat; t_stat = ES_NORMAL; // Clear the result as we return an error there MCresult -> clear(); ///////// if (t_stat == ES_NORMAL) t_stat = m_items -> eval(ep); if (t_stat == ES_NORMAL && ep . getformat() != VF_ARRAY) t_stat = ES_ERROR; MCVariableArray *t_array; if (t_stat == ES_NORMAL) { t_array = ep . getarray() -> get_array(); if (!t_array -> issequence()) t_stat = ES_ERROR; } MCDeployDmgItem *t_items; uint32_t t_item_count; t_items = nil; t_item_count = 0; if (t_stat == ES_NORMAL) { if (MCMemoryNewArray(t_array -> getnfilled(), t_items)) t_item_count = t_array -> getnfilled(); else t_stat = ES_ERROR; } MCExecPoint ep2(ep); if (t_stat == ES_NORMAL) for(uint32_t i = 0; i < t_item_count && t_stat == ES_NORMAL; i++) { MCHashentry *t_element; t_element = t_array -> lookupindex(i + 1, False); if (t_element == nil) t_stat = ES_ERROR; if (t_stat == ES_NORMAL) t_stat = t_element -> value . fetch(ep2); MCVariableValue *t_item_array; if (t_stat == ES_NORMAL) { t_item_array = ep2 . getarray(); if (t_item_array == nil) t_stat = ES_ERROR; } if (t_stat == ES_NORMAL) { t_stat = t_item_array -> fetch_element(ep2, "type"); if (t_stat == ES_NORMAL) { if (ep2 . getsvalue() == "folder") t_items[i] . is_folder = true; else if (ep2 . getsvalue() == "file") t_items[i] . is_folder = false; else t_stat = ES_ERROR; } } if (t_stat == ES_NORMAL) t_stat = fetch_uint32(ep2, t_item_array, "parent", t_items[i] . parent); if (t_stat == ES_NORMAL) t_stat = fetch_cstring(ep2, t_item_array, "name", t_items[i] . name); if (t_stat == ES_NORMAL) t_stat = fetch_opt_uint32(ep2, t_item_array, "owner_id", t_items[i] . owner_id); if (t_stat == ES_NORMAL) t_stat = fetch_opt_uint32(ep2, t_item_array, "group_id", t_items[i] . group_id); if (t_stat == ES_NORMAL) t_stat = fetch_opt_uint32(ep2, t_item_array, "file_mode", t_items[i] . file_mode); if (t_stat == ES_NORMAL) t_stat = fetch_opt_uint32(ep2, t_item_array, "create_date", t_items[i] . create_date); if (t_stat == ES_NORMAL) t_stat = fetch_opt_uint32(ep2, t_item_array, "content_mod_date", t_items[i] . content_mod_date); if (t_stat == ES_NORMAL) t_stat = fetch_opt_uint32(ep2, t_item_array, "attribute_mod_date", t_items[i] . attribute_mod_date); if (t_stat == ES_NORMAL) t_stat = fetch_opt_uint32(ep2, t_item_array, "access_date", t_items[i] . access_date); if (t_stat == ES_NORMAL) t_stat = fetch_opt_uint32(ep2, t_item_array, "backup_date", t_items[i] . backup_date); } ///////// if (t_stat == ES_NORMAL) t_stat = m_filename -> eval(ep); if (t_stat == ES_NORMAL) { MCDeployDmgParameters t_params; t_params . items = t_items; t_params . item_count = t_item_count; t_params . output = (char *)ep . getcstring(); if (!MCDeployDmgBuild(t_params)) t_stat = ES_ERROR; } //////// for(uint32_t i = 0; i < t_item_count; i++) MCCStringFree(t_items[i] . name); MCMemoryDeleteArray(t_items); return ES_NORMAL; }