void MFNHashFileSaltedProtobuf_SaltedHash::MergeFrom(const MFNHashFileSaltedProtobuf_SaltedHash& from) { GOOGLE_CHECK_NE(&from, this); if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (from.has_hash()) { set_hash(from.hash()); } if (from.has_salt()) { set_salt(from.salt()); } if (from.has_iteration_count()) { set_iteration_count(from.iteration_count()); } if (from.has_other_data_1()) { set_other_data_1(from.other_data_1()); } if (from.has_other_data_2()) { set_other_data_2(from.other_data_2()); } if (from.has_other_data_3()) { set_other_data_3(from.other_data_3()); } if (from.has_other_data_4()) { set_other_data_4(from.other_data_4()); } if (from.has_other_data_5()) { set_other_data_5(from.other_data_5()); } } mutable_unknown_fields()->MergeFrom(from.unknown_fields()); }
void ArchiveWriter::add_files(const std::vector<FileQueueElement> &files){ zekvok_assert(this->state == State::Initial); this->state = State::FilesWritten; boost::iostreams::stream<ByteCounterOutputFilter> counter(*this->nested_stream, &this->initial_fso_offset); std::ostream *stream = &counter; std::shared_ptr<std::ostream> crypto; if (this->keypair){ crypto = CryptoOutputFilter::create(default_crypto_algorithm, *stream, &this->keys->get_key(this->archive_key_index), &this->keys->get_iv(this->archive_key_index)); this->archive_key_index++; stream = crypto.get(); } bool mt = true; boost::iostreams::stream<LzmaOutputFilter> lzma(*stream, &mt, 1); for (auto &fqe : files){ std::uint64_t size; auto fso = fqe.fso; std::wcout << fso->get_unmapped_path() << std::endl; auto stream = fso->open_for_exclusive_read(size); this->stream_ids.push_back(fqe.stream_id); this->stream_sizes.push_back(size); sha256_digest digest; { boost::iostreams::stream<HashInputFilter> hash(*stream, new CryptoPP::SHA256); if (size) lzma << hash.rdbuf(); hash->get_result(digest.data(), digest.size()); } fso->set_hash(digest); this->any_file = true; } }
t_bool parsing(t_htable *table, char *print_buf) { char *line; char *prev; prev = NULL; while (get_line(&line)) { if (!prev && !*line && prev != (char *)(unsigned long)-42) { prev = (char *)(unsigned long)-42; free(line); } else if (!prev) prev = line; else if (prev == (char *)(unsigned long)-42) handle_search(table, line, print_buf); else { set_hash(table, prev, line); prev = NULL; } } return (TRUE); }
void alias_command(const char *arg, struct session *ses) { char left[BUFFER_SIZE], right[BUFFER_SIZE], *ch; arg = get_arg_in_braces(arg, left, 0); arg = get_arg_in_braces(arg, right, 1); if (*left && *right) { if ((ch=strchr(left, ' '))) { tintin_eprintf(ses, "#ERROR: aliases cannot contain spaces! Bad alias: {%s}", left); if (ch==left) return; *ch=0; tintin_printf(ses, "#Converted offending alias to {%s}.", left); } set_hash(ses->aliases, left, right); if (ses->mesvar[MSG_ALIAS]) tintin_printf(ses, "#Ok. {%s} aliases {%s}.", left, right); alnum++; return; } show_hashlist(ses, ses->aliases, left, "#Defined aliases:", "#No match(es) found for {%s}."); }
void bench() { int i; int t[3]; double nps; /* setting the position to a non-initial position confuses the opening book code. */ close_book(); for (i = 0; i < 64; ++i) { color[i] = bench_color[i]; piece[i] = bench_piece[i]; } side = LIGHT; xside = DARK; castle = 0; ep = -1; fifty = 0; ply = 0; hply = 0; set_hash(); print_board(); max_time = 1 << 25; max_depth = 5; for (i = 0; i < 3; ++i) { think(1); t[i] = get_ms() - start_time; printf("Time: %d ms\n", t[i]); } if (t[1] < t[0]) t[0] = t[1]; if (t[2] < t[0]) t[0] = t[2]; printf("\n"); printf("Nodes: %d\n", nodes); printf("Best time: %d ms\n", t[0]); if (!ftime_ok) { printf("\n"); printf("Your compiler's ftime() function is apparently only accurate\n"); printf("to the second. Please change the get_ms() function in main.c\n"); printf("to make it more accurate.\n"); printf("\n"); return; } if (t[0] == 0) { printf("(invalid)\n"); return; } nps = (double)nodes / (double)t[0]; nps *= 1000.0; /* Score: 1.000 = my Athlon XP 2000+ */ printf("Nodes per second: %d (Score: %.3f)\n", (int)nps, (float)nps/243169.0); init_board(); open_book(); gen(); }
void increment_cost(char* name, char* vertex_name, hash_table_t* rep, int* cost, char** conflict_vt){ if (name == NULL){ set_hash(rep, vertex_name, vertex_name); if (conflict_vt != NULL) conflict_vt[*cost] = vertex_name; *cost += 1; } }
// initialize the first and last passwords to try bool set_options(uint32_t thd_cnt, std::string h, std::string s, std::string s_pwd, std::string e_pwd) { // we don't want thread count to exceed number of cpu available thread_cnt = (thd_cnt!=0 && thd_cnt<cpu_cnt) ? thd_cnt : thread_cnt; start_pwd = s_pwd; end_pwd = e_pwd; // convert hash to binary if(!set_hash(h, hash.b)) return false; // initialize alphabet std::transform(s.begin(), s.end(), s.begin(), [](uint8_t c) -> uint8_t {return toupper(c);}); std::sort(s.begin(),s.end()); s.erase(std::unique(s.begin(),s.end()),s.end()); // use default if none provided alphabet = s.empty() ? "ABCDEFGHIJKLMNOPQRSTUVWXYZ" : s; // if no start password, set to first character in alphabet if(start_pwd.empty() || start_pwd.length() > MAX_PWD) { start_pwd.clear(); start_pwd.push_back(alphabet.front()); } // if no end password, set to last character in alphabet if(end_pwd.empty() || end_pwd.length() > MAX_PWD) { end_pwd.clear(); for(int i=0; i<MAX_PWD; i++) { end_pwd.push_back(alphabet.back()); } } // set start combination start_cbn = pwd2cbn(start_pwd); if(start_cbn==0) return false; // set end combination end_cbn = pwd2cbn(end_pwd); if(end_cbn==0) return false; // ensure start doesn't exceed end if(start_cbn > end_cbn) return false; // subtract one from start start_cbn--; // set the total total_cbn = (end_cbn - start_cbn); // ensure thread_cnt doesn't exceed total_cbn if (total_cbn < 10000) thread_cnt=1; return true; }
void solid_set_namespace(solid_object *ns, solid_object *name, solid_object *o) { if (ns->type != T_INSTANCE) { debug("ns->type: %d", ns->type); log_err("Namespace is not an instance"); exit(1); } else { hash_map *h = (hash_map *) ns->data; set_hash(h, solid_get_str_value(name), (void *) o); } }
void lat_asignar_contexto_objeto(lat_objeto* ns, lat_objeto* name, lat_objeto* o) { if (ns->type != T_INSTANCE) { debug("ns->type: %d", ns->type); lat_registrar_error("Namespace no es una instancia"); } else { hash_map* h = ns->data.instance; set_hash(h, lat_obtener_cadena(name), (void*)o); } }
void init_phone_book(void) { int i; for(i=0 ; i<MAX_PHONE_BOOK_CNT; i++) pb[i].pNext = &pb[i+1]; pb[MAX_PHONE_BOOK_CNT-1].pNext = NULL; //first name in position of 1/3 array strcpy(pb[MAX_PHONE_BOOK_CNT/3].LastName, PHONE_BOOK_NAME_1); set_hash(PHONE_BOOK_NAME_1, &pb[MAX_PHONE_BOOK_CNT/3]); //first name in position of 2/3 array strcpy(pb[MAX_PHONE_BOOK_CNT*2/3].LastName, PHONE_BOOK_NAME_2); set_hash(PHONE_BOOK_NAME_2, &pb[MAX_PHONE_BOOK_CNT*2/3]); //first name in position of end array strcpy(pb[MAX_PHONE_BOOK_CNT-1].LastName, PHONE_BOOK_NAME_3); set_hash(PHONE_BOOK_NAME_3, &pb[MAX_PHONE_BOOK_CNT-1]); }
/** Constructor */ LocalizerControlInterface::LocalizerControlInterface() : Interface() { data_size = sizeof(LocalizerControlInterface_data_t); data_ptr = malloc(data_size); data = (LocalizerControlInterface_data_t *)data_ptr; data_ts = (interface_data_ts_t *)data_ptr; memset(data_ptr, 0, data_size); add_fieldinfo(IFT_STRING, "map_name", 30, data->map_name); add_messageinfo("ResetMessage"); unsigned char tmp_hash[] = {0xa4, 0xe8, 0x69, 0x11, 0x29, 0x30, 0xf2, 0xcb, 0xe5, 0xf4, 00, 0x35, 0x19, 0x58, 0x54, 0xfb}; set_hash(tmp_hash); }
/** Constructor */ LocalizationInterface::LocalizationInterface() : Interface() { data_size = sizeof(LocalizationInterface_data_t); data_ptr = malloc(data_size); data = (LocalizationInterface_data_t *)data_ptr; data_ts = (interface_data_ts_t *)data_ptr; memset(data_ptr, 0, data_size); add_fieldinfo(IFT_STRING, "map", 64, data->map); add_messageinfo("SetInitialPoseMessage"); unsigned char tmp_hash[] = {0x7f, 0x9, 0xec, 0xd1, 00, 0x3f, 0x3, 0xb7, 0x95, 0xce, 0xe, 0x1d, 0x6f, 0x48, 0x6c, 0xad}; set_hash(tmp_hash); }
void set_option(char *line) { char name[64]; char value[64]; char *find_value; strip(line); if( strlen(line) > 64 ) return; strcpy(name, line+15); find_value = strstr(line, " value "); if(find_value) { strcpy(value, find_value+7); name[strlen(line+15)-strlen(value)-7] = '\0'; } else { value[0] = '\0'; } if(strcmp(name, "Personality") == 0) { set_personality_name( value ); } else if(strcmp(name, "Min Time") == 0) { set_min_time( value ); } else if(strcmp(name, "Max Time") == 0) { set_max_time( value ); } else if(strcmp(name, "Hash") == 0) { set_hash( value ); } /* setoption name <id> [value <x>] this is sent to the engine when the user wants to change the internal parameters of the engine. For the "button" type no value is needed. One string will be sent for each parameter and this will only be sent when the engine is waiting. The name and value of the option in <id> should not be case sensitive and can inlude spaces. The substrings "value" and "name" should be avoided in <id> and <x> to allow unambiguous parsing, for example do not use <name> = "draw value". Here are some strings for the example below: "setoption name Nullmove value true\n" "setoption name Selectivity value 3\n" "setoption name Style value Risky\n" "setoption name Clear Hash\n" "setoption name NalimovPath value c:\chess\tb\4;c:\chess\tb\5\n" */ }
/** Constructor */ Laser720Interface::Laser720Interface() : Interface() { data_size = sizeof(Laser720Interface_data_t); data_ptr = malloc(data_size); data = (Laser720Interface_data_t *)data_ptr; data_ts = (interface_data_ts_t *)data_ptr; memset(data_ptr, 0, data_size); add_fieldinfo(IFT_STRING, "frame", 32, data->frame); add_fieldinfo(IFT_FLOAT, "distances", 720, &data->distances); add_fieldinfo(IFT_BOOL, "clockwise_angle", 1, &data->clockwise_angle); unsigned char tmp_hash[] = {0xca, 0x5e, 0xf1, 0x60, 0x74, 0x77, 0x8d, 0x9b, 0x5c, 0x81, 0x53, 0x5f, 0xc1, 0xf6, 0x89, 0x69}; set_hash(tmp_hash); }
/** Constructor */ Laser1080Interface::Laser1080Interface() : Interface() { data_size = sizeof(Laser1080Interface_data_t); data_ptr = malloc(data_size); data = (Laser1080Interface_data_t *)data_ptr; data_ts = (interface_data_ts_t *)data_ptr; memset(data_ptr, 0, data_size); add_fieldinfo(IFT_STRING, "frame", 32, data->frame); add_fieldinfo(IFT_FLOAT, "distances", 1080, &data->distances); add_fieldinfo(IFT_BOOL, "clockwise_angle", 1, &data->clockwise_angle); unsigned char tmp_hash[] = {0xa7, 0xab, 0x1f, 0x20, 0xdb, 0x24, 0xf9, 0x1b, 0x4e, 0xd6, 0x8b, 0xfa, 0x65, 0x25, 0xe5, 0x22}; set_hash(tmp_hash); }
/** Constructor */ NavPathInterface::NavPathInterface() : Interface() { data_size = sizeof(NavPathInterface_data_t); data_ptr = malloc(data_size); data = (NavPathInterface_data_t *)data_ptr; data_ts = (interface_data_ts_t *)data_ptr; memset(data_ptr, 0, data_size); add_fieldinfo(IFT_STRING, "path_node_1", 64, data->path_node_1); add_fieldinfo(IFT_STRING, "path_node_2", 64, data->path_node_2); add_fieldinfo(IFT_STRING, "path_node_3", 64, data->path_node_3); add_fieldinfo(IFT_STRING, "path_node_4", 64, data->path_node_4); add_fieldinfo(IFT_STRING, "path_node_5", 64, data->path_node_5); add_fieldinfo(IFT_STRING, "path_node_6", 64, data->path_node_6); add_fieldinfo(IFT_STRING, "path_node_7", 64, data->path_node_7); add_fieldinfo(IFT_STRING, "path_node_8", 64, data->path_node_8); add_fieldinfo(IFT_STRING, "path_node_9", 64, data->path_node_9); add_fieldinfo(IFT_STRING, "path_node_10", 64, data->path_node_10); add_fieldinfo(IFT_STRING, "path_node_11", 64, data->path_node_11); add_fieldinfo(IFT_STRING, "path_node_12", 64, data->path_node_12); add_fieldinfo(IFT_STRING, "path_node_13", 64, data->path_node_13); add_fieldinfo(IFT_STRING, "path_node_14", 64, data->path_node_14); add_fieldinfo(IFT_STRING, "path_node_15", 64, data->path_node_15); add_fieldinfo(IFT_STRING, "path_node_16", 64, data->path_node_16); add_fieldinfo(IFT_STRING, "path_node_17", 64, data->path_node_17); add_fieldinfo(IFT_STRING, "path_node_18", 64, data->path_node_18); add_fieldinfo(IFT_STRING, "path_node_19", 64, data->path_node_19); add_fieldinfo(IFT_STRING, "path_node_20", 64, data->path_node_20); add_fieldinfo(IFT_STRING, "path_node_21", 64, data->path_node_21); add_fieldinfo(IFT_STRING, "path_node_22", 64, data->path_node_22); add_fieldinfo(IFT_STRING, "path_node_23", 64, data->path_node_23); add_fieldinfo(IFT_STRING, "path_node_24", 64, data->path_node_24); add_fieldinfo(IFT_STRING, "path_node_25", 64, data->path_node_25); add_fieldinfo(IFT_STRING, "path_node_26", 64, data->path_node_26); add_fieldinfo(IFT_STRING, "path_node_27", 64, data->path_node_27); add_fieldinfo(IFT_STRING, "path_node_28", 64, data->path_node_28); add_fieldinfo(IFT_STRING, "path_node_29", 64, data->path_node_29); add_fieldinfo(IFT_STRING, "path_node_30", 64, data->path_node_30); add_fieldinfo(IFT_STRING, "path_node_31", 64, data->path_node_31); add_fieldinfo(IFT_STRING, "path_node_32", 64, data->path_node_32); add_fieldinfo(IFT_STRING, "path_node_33", 64, data->path_node_33); add_fieldinfo(IFT_STRING, "path_node_34", 64, data->path_node_34); add_fieldinfo(IFT_STRING, "path_node_35", 64, data->path_node_35); add_fieldinfo(IFT_STRING, "path_node_36", 64, data->path_node_36); add_fieldinfo(IFT_STRING, "path_node_37", 64, data->path_node_37); add_fieldinfo(IFT_STRING, "path_node_38", 64, data->path_node_38); add_fieldinfo(IFT_STRING, "path_node_39", 64, data->path_node_39); add_fieldinfo(IFT_STRING, "path_node_40", 64, data->path_node_40); add_fieldinfo(IFT_UINT32, "path_length", 1, &data->path_length); unsigned char tmp_hash[] = {0x9d, 0xe, 0xdb, 0x61, 0x65, 0x94, 0x3d, 0x7a, 0x87, 0x95, 0x8f, 0x85, 0x87, 0xa4, 0x5f, 0x61}; set_hash(tmp_hash); }
/** Constructor */ TransformInterface::TransformInterface() : Interface() { data_size = sizeof(TransformInterface_data_t); data_ptr = malloc(data_size); data = (TransformInterface_data_t *)data_ptr; data_ts = (interface_data_ts_t *)data_ptr; memset(data_ptr, 0, data_size); add_fieldinfo(IFT_STRING, "frame", 64, data->frame); add_fieldinfo(IFT_STRING, "child_frame", 64, data->child_frame); add_fieldinfo(IFT_DOUBLE, "translation", 3, &data->translation); add_fieldinfo(IFT_DOUBLE, "rotation", 4, &data->rotation); unsigned char tmp_hash[] = {0xfd, 0xf6, 0x19, 0x45, 0x14, 0xa9, 0x28, 0xd2, 0xfd, 0x73, 0xd8, 0xc9, 0xf5, 0xc8, 0x55, 0x2}; set_hash(tmp_hash); }
/** Constructor */ TransformInterface::TransformInterface() : Interface() { data_size = sizeof(TransformInterface_data_t); data_ptr = malloc(data_size); data = (TransformInterface_data_t *)data_ptr; data_ts = (interface_data_ts_t *)data_ptr; memset(data_ptr, 0, data_size); add_fieldinfo(IFT_STRING, "frame", 64, data->frame); add_fieldinfo(IFT_STRING, "child_frame", 64, data->child_frame); add_fieldinfo(IFT_BOOL, "static_transform", 1, &data->static_transform); add_fieldinfo(IFT_DOUBLE, "translation", 3, &data->translation); add_fieldinfo(IFT_DOUBLE, "rotation", 4, &data->rotation); unsigned char tmp_hash[] = {0xb6, 0xb0, 0xd3, 0x96, 0xda, 0x61, 0xdd, 0xd3, 0x6, 0x9e, 0x66, 0x4d, 0x14, 0x54, 0x5e, 0xfb}; set_hash(tmp_hash); }
/** Constructor */ SpeechSynthInterface::SpeechSynthInterface() : Interface() { data_size = sizeof(SpeechSynthInterface_data_t); data_ptr = malloc(data_size); data = (SpeechSynthInterface_data_t *)data_ptr; data_ts = (interface_data_ts_t *)data_ptr; memset(data_ptr, 0, data_size); add_fieldinfo(IFT_STRING, "text", 1024, data->text); add_fieldinfo(IFT_UINT32, "msgid", 1, &data->msgid); add_fieldinfo(IFT_BOOL, "final", 1, &data->final); add_fieldinfo(IFT_FLOAT, "duration", 1, &data->duration); add_messageinfo("SayMessage"); unsigned char tmp_hash[] = {0x28, 0x11, 0x46, 0x87, 0xb1, 0x65, 0x92, 0x96, 0xe6, 0x6e, 0x18, 0x8a, 0xdc, 0x8, 0xb0, 0x69}; set_hash(tmp_hash); }
/** Constructor */ Position2DTrackInterface::Position2DTrackInterface() : Interface() { data_size = sizeof(Position2DTrackInterface_data_t); data_ptr = malloc(data_size); data = (Position2DTrackInterface_data_t *)data_ptr; data_ts = (interface_data_ts_t *)data_ptr; memset(data_ptr, 0, data_size); add_fieldinfo(IFT_FLOAT, "track_x_positions", 30, &data->track_x_positions); add_fieldinfo(IFT_FLOAT, "track_y_positions", 30, &data->track_y_positions); add_fieldinfo(IFT_INT32, "track_timestamps", 30, &data->track_timestamps); add_fieldinfo(IFT_BOOL, "valid", 1, &data->valid); add_fieldinfo(IFT_UINT32, "length", 1, &data->length); add_fieldinfo(IFT_UINT32, "track_id", 1, &data->track_id); unsigned char tmp_hash[] = {0xcd, 0xb8, 0x68, 0x14, 0xff, 0x3, 0xe4, 0xc4, 0x20, 0x43, 0x44, 0xb8, 0x86, 0x87, 0xa3, 0x4c}; set_hash(tmp_hash); }
/** Constructor */ SpeechRecognitionInterface::SpeechRecognitionInterface() : Interface() { data_size = sizeof(SpeechRecognitionInterface_data_t); data_ptr = malloc(data_size); data = (SpeechRecognitionInterface_data_t *)data_ptr; data_ts = (interface_data_ts_t *)data_ptr; memset(data_ptr, 0, data_size); add_fieldinfo(IFT_STRING, "text", 1024, data->text); add_fieldinfo(IFT_UINT32, "counter", 1, &data->counter); add_fieldinfo(IFT_BOOL, "processing", 1, &data->processing); add_fieldinfo(IFT_BOOL, "enabled", 1, &data->enabled); add_messageinfo("ResetMessage"); add_messageinfo("SetEnabledMessage"); unsigned char tmp_hash[] = {0x8f, 0x5c, 0xd, 0x42, 0x1b, 0x22, 0x75, 0x3d, 0x50, 0x66, 0x70, 0x8, 0x1f, 0x47, 0xa7, 0xfd}; set_hash(tmp_hash); }
/** Constructor */ SkillerDebugInterface::SkillerDebugInterface() : Interface() { data_size = sizeof(SkillerDebugInterface_data_t); data_ptr = malloc(data_size); data = (SkillerDebugInterface_data_t *)data_ptr; data_ts = (interface_data_ts_t *)data_ptr; memset(data_ptr, 0, data_size); add_fieldinfo(IFT_STRING, "graph_fsm", 32, data->graph_fsm); add_fieldinfo(IFT_STRING, "graph", 8192, data->graph); add_fieldinfo(IFT_ENUM, "graph_dir", 1, &data->graph_dir, "GraphDirectionEnum"); add_fieldinfo(IFT_BOOL, "graph_colored", 1, &data->graph_colored); add_messageinfo("SetGraphMessage"); add_messageinfo("SetGraphDirectionMessage"); add_messageinfo("SetGraphColoredMessage"); unsigned char tmp_hash[] = {0xcf, 0x3d, 0x2f, 0xf8, 0x80, 0x6e, 0x8f, 0xf4, 0x81, 0xa6, 0x7f, 0xd9, 0xb0, 0x29, 0xfc, 0x62}; set_hash(tmp_hash); }
projectile *build_projectile_prototype(char *name, double speed, int w, int h, int longevity, int dmg) { projectile *p = malloc(sizeof(projectile)); p->w = w; p->h = h; p->speed = speed; p->longevity = longevity; p->dmg = dmg; p->x = p->y = p->xv = p->yv = 0; p->rotation = 0; p->spawned_by = NULL; set_hash(PROJECTILE_PROTOTYPES, name, (void *) p); return p; }
/** Constructor */ BatteryInterface::BatteryInterface() : Interface() { data_size = sizeof(BatteryInterface_data_t); data_ptr = malloc(data_size); data = (BatteryInterface_data_t *)data_ptr; data_ts = (interface_data_ts_t *)data_ptr; memset(data_ptr, 0, data_size); add_fieldinfo(IFT_UINT32, "current", 1, &data->current); add_fieldinfo(IFT_UINT32, "voltage", 1, &data->voltage); add_fieldinfo(IFT_UINT32, "temperature", 1, &data->temperature); add_fieldinfo(IFT_FLOAT, "absolute_soc", 1, &data->absolute_soc); add_fieldinfo(IFT_FLOAT, "relative_soc", 1, &data->relative_soc); add_messageinfo("PushButtonMessage"); add_messageinfo("SleepMessage"); unsigned char tmp_hash[] = {0x28, 0xb6, 0xbe, 0xe7, 0xf1, 0x47, 0x2, 0x12, 0x1d, 0xe3, 0x7c, 0x14, 0xe9, 0x1f, 0x24, 0x4d}; set_hash(tmp_hash); }
static void choose_hash_function (reiserfs_filsys_t fs) { unsigned long max; int hash_code; int i; max = 0; hash_code = func2code (0); for (i = 0; i < stats (fs)->hash_amount; i ++) { /* remember hash whihc got more hits */ if (stats (fs)->hash_hits [i] > max) { hash_code = i; max = stats (fs)->hash_hits [i]; } if (stats (fs)->hash_hits [i]) fsck_log ("%s got %lu hits\n", code2name (i), stats (fs)->hash_hits [i]); } if (max == 0) { /* no names were found. take either super block value or default */ reiserfs_hash (fs) = code2func (rs_hash (fs->s_rs)); if (!reiserfs_hash (fs)) reiserfs_hash (fs) = code2func (DEFAULT_HASH); return; } /* compare the most appropriate hash with the hash set in super block */ if (hash_code != rs_hash (fs->s_rs)) { fsck_progress ("Selected hash (%s) does not match to one set in super block (%s).\n", code2name (hash_code), code2name (rs_hash (fs->s_rs))); /* if (!fsck_user_confirmed (fs, "Overwrite?(Yes)", "Yes", 1)) { fsck_progress ("Not confirmed\n"); exit (4); } */ set_hash (fs->s_rs, hash_code); } else { fsck_progress ("\t%s hash is selected\n", code2name (hash_code)); } reiserfs_hash (fs) = code2func (hash_code); }
/** Constructor */ KickerInterface::KickerInterface() : Interface() { data_size = sizeof(KickerInterface_data_t); data_ptr = malloc(data_size); data = (KickerInterface_data_t *)data_ptr; data_ts = (interface_data_ts_t *)data_ptr; memset(data_ptr, 0, data_size); add_fieldinfo(IFT_INT32, "num_kicks_left", 1, &data->num_kicks_left); add_fieldinfo(IFT_INT32, "num_kicks_center", 1, &data->num_kicks_center); add_fieldinfo(IFT_INT32, "num_kicks_right", 1, &data->num_kicks_right); add_fieldinfo(IFT_ENUM, "guide_ball_side", 1, &data->guide_ball_side, "GuideBallSideEnum"); add_fieldinfo(IFT_UINT32, "current_intensity", 1, &data->current_intensity); add_messageinfo("KickMessage"); add_messageinfo("ResetCounterMessage"); add_messageinfo("GuideBallMessage"); unsigned char tmp_hash[] = {0x96, 0x3d, 0x55, 0x60, 0xfd, 0x65, 0xf2, 0xfa, 0xa8, 0xfa, 0xfc, 0xaa, 0xb6, 0xfc, 0xc2, 0x81}; set_hash(tmp_hash); }
result_t Url::format(v8::Local<v8::Object> args) { clear(); Isolate* isolate = holder(); exlib::string str; v8::Local<v8::Value> v; if (getString(isolate, args, "protocol", str)) set_protocol(str); if (getString(isolate, args, "username", str)) set_username(str); if (getString(isolate, args, "password", str)) set_password(str); if (getString(isolate, args, "host", str)) set_host(str); if (getString(isolate, args, "port", str)) set_port(str); if (getString(isolate, args, "hostname", str)) set_hostname(str); if (getString(isolate, args, "pathname", str)) set_pathname(str); v = args->Get(holder()->NewString("query")); if (!IsEmpty(v)) set_query(v); if (getString(isolate, args, "hash", str)) set_hash(str); if (m_slashes && m_protocol.compare("file:") && m_hostname.length() == 0) m_slashes = false; v = args->Get(holder()->NewString("slashes")); if (!IsEmpty(v)) set_slashes(v->BooleanValue()); return 0; }
/** Constructor */ RobotinoSensorInterface::RobotinoSensorInterface() : Interface() { data_size = sizeof(RobotinoSensorInterface_data_t); data_ptr = malloc(data_size); data = (RobotinoSensorInterface_data_t *)data_ptr; data_ts = (interface_data_ts_t *)data_ptr; memset(data_ptr, 0, data_size); add_fieldinfo(IFT_FLOAT, "mot_velocity", 3, &data->mot_velocity); add_fieldinfo(IFT_INT32, "mot_position", 3, &data->mot_position); add_fieldinfo(IFT_FLOAT, "mot_current", 3, &data->mot_current); add_fieldinfo(IFT_BOOL, "bumper", 1, &data->bumper); add_fieldinfo(IFT_FLOAT, "distance", 9, &data->distance); add_fieldinfo(IFT_BOOL, "digital_in", 8, &data->digital_in); add_fieldinfo(IFT_FLOAT, "analog_in", 8, &data->analog_in); add_fieldinfo(IFT_BOOL, "bumper_estop_enabled", 1, &data->bumper_estop_enabled); add_messageinfo("SetBumperEStopEnabledMessage"); unsigned char tmp_hash[] = {0x3f, 0x22, 0xb4, 0xc5, 0xe8, 0x9c, 0xd9, 0xa8, 0x90, 0x80, 0x23, 0xb2, 0x55, 0xed, 0xfd, 0x52}; set_hash(tmp_hash); }
/** Constructor */ SwitchInterface::SwitchInterface() : Interface() { data_size = sizeof(SwitchInterface_data_t); data_ptr = malloc(data_size); data = (SwitchInterface_data_t *)data_ptr; data_ts = (interface_data_ts_t *)data_ptr; memset(data_ptr, 0, data_size); add_fieldinfo(IFT_BOOL, "enabled", 1, &data->enabled); add_fieldinfo(IFT_FLOAT, "value", 1, &data->value); add_fieldinfo(IFT_FLOAT, "history", 1, &data->history); add_fieldinfo(IFT_UINT32, "short_activations", 1, &data->short_activations); add_fieldinfo(IFT_UINT32, "long_activations", 1, &data->long_activations); add_fieldinfo(IFT_UINT32, "activation_count", 1, &data->activation_count); add_messageinfo("SetMessage"); add_messageinfo("EnableSwitchMessage"); add_messageinfo("DisableSwitchMessage"); add_messageinfo("EnableDurationMessage"); unsigned char tmp_hash[] = {0xa7, 0xa4, 0xc, 0x19, 0x66, 0xa4, 0x87, 0x6b, 0xa9, 0x32, 0x95, 0x40, 0xc7, 0x82, 0x75, 0x6d}; set_hash(tmp_hash); }
hash_map *copy_hash(hash_map *m) { hash_map *ret = make_hash_map(); int i; for (i = 0; i < 256; i++) { list_node *c = m->buckets[i]; if (c != NULL) { for (; c->next != NULL; c = c->next) { if (c->data != NULL) { set_hash(ret, ((hash_val *)c->data)->key, ((hash_val *)c->data)->val); } } } } return ret; }