functionSource
stringlengths
20
97.4k
CWE-119
bool
2 classes
CWE-120
bool
2 classes
CWE-469
bool
2 classes
CWE-476
bool
2 classes
CWE-other
bool
2 classes
combine
int64
0
1
MinItem(struct icon_info *head) { struct icon_info *tmp, *i_min; if (head == NULL) return NULL; i_min = head; tmp = head->next; while (tmp != NULL){ if (strcmp(i_min->name, tmp->name) > 0) i_min = tmp; tmp = tmp->next; } return i_min; }
false
false
false
false
false
0
esl_sq_FetchFromMSA(const ESL_MSA *msa, int which, ESL_SQ **ret_sq) { ESL_SQ *sq = NULL; char *acc = NULL; char *desc = NULL; char *ss = NULL; char *gapchars = "-_.~"; /* hardcoded for now; only affects text mode, not digital */ int status; if (which >= msa->nseq || which < 0) return eslEOD; /* watch out for optional msa annotations being totally NULL */ if (msa->sqacc != NULL) acc = msa->sqacc[which]; if (msa->sqdesc != NULL) desc = msa->sqdesc[which]; if (msa->ss != NULL) ss = msa->ss[which]; if (! (msa->flags & eslMSA_DIGITAL)) /* text mode MSA to text mode sequence */ { if ((sq = esl_sq_CreateFrom(msa->sqname[which], msa->aseq[which], desc, acc, ss)) == NULL) goto ERROR; if (sq->ss != NULL) esl_strdealign(sq->ss, sq->seq, gapchars, NULL); esl_strdealign(sq->seq, sq->seq, gapchars, &(sq->n)); } #ifdef eslAUGMENT_ALPHABET else /* digital mode MSA to digital mode sequence */ { if ((sq = esl_sq_CreateDigitalFrom(msa->abc, msa->sqname[which], msa->ax[which], msa->alen, desc, acc, ss)) == NULL) goto ERROR; if (sq->ss != NULL) esl_abc_CDealign(sq->abc, sq->ss+1, sq->dsq, NULL); esl_abc_XDealign(sq->abc, sq->dsq, sq->dsq, &(sq->n)); } #endif if ((status = esl_sq_SetSource(sq, msa->name)) != eslOK) goto ERROR; sq->start = 1; sq->end = sq->n; sq->L = sq->n; sq->C = 0; sq->W = sq->n; *ret_sq = sq; return eslOK; ERROR: esl_sq_Destroy(sq); *ret_sq = NULL; return eslEMEM; }
false
false
false
false
false
0
same_page(struct http_sig* sig1, struct http_sig* sig2) { u32 i, bucket_fail = 0; s32 total_diff = 0; u32 total_scale = 0; /* Different response codes: different page */ if (sig1->code != sig2->code) return 0; /* One has text and the other hasnt: different page */ if (sig1->has_text != sig2->has_text) return 0; for (i=0;i<FP_SIZE;i++) { s32 diff = sig1->data[i] - sig2->data[i]; u32 scale = sig1->data[i] + sig2->data[i]; if (abs(diff) > 1 + (scale * FP_T_REL / 100) || abs(diff) > FP_T_ABS) if (++bucket_fail > FP_B_FAIL) return 0; total_diff += diff; total_scale += scale; } if (abs(total_diff) > 1 + (total_scale * FP_T_REL / 100)) return 0; return 1; }
false
false
false
false
false
0
prune_packed_objects(int opts) { int i; static char pathname[PATH_MAX]; const char *dir = get_object_directory(); int len = strlen(dir); if (len > PATH_MAX - 42) die("impossible object directory"); memcpy(pathname, dir, len); if (len && pathname[len-1] != '/') pathname[len++] = '/'; for (i = 0; i < 256; i++) { DIR *d; sprintf(pathname + len, "%02x/", i); d = opendir(pathname); if (opts == VERBOSE && (d || i == 255)) fprintf(stderr, "Removing unused objects %d%%...\015", ((i+1) * 100) / 256); if (!d) continue; prune_dir(i, d, pathname, len + 3, opts); closedir(d); } if (opts == VERBOSE) fprintf(stderr, "\nDone.\n"); }
false
false
false
false
false
0
opal_progress_set_event_poll_rate(int polltime) { OPAL_OUTPUT((debug_output, "progress: progress_set_event_poll_rate(%d)", polltime)); #if OPAL_PROGRESS_USE_TIMERS event_progress_delta = 0; # if OPAL_TIMER_USEC_NATIVE event_progress_last_time = opal_timer_base_get_usec(); # else event_progress_last_time = opal_timer_base_get_cycles(); # endif #else event_progress_counter = event_progress_delta = 0; #endif if (polltime == 0) { #if OPAL_PROGRESS_USE_TIMERS /* user specified as never tick - tick once per minute */ event_progress_delta = 60 * 1000000; #else /* user specified as never tick - don't count often */ event_progress_delta = INT_MAX; #endif } else { #if OPAL_PROGRESS_USE_TIMERS event_progress_delta = polltime; #else /* subtract one so that we can do post-fix subtraction in the inner loop and go faster */ event_progress_delta = polltime - 1; #endif } #if OPAL_PROGRESS_USE_TIMERS && !OPAL_TIMER_USEC_NATIVE /* going to use cycles for counter. Adjust specified usec into cycles */ event_progress_delta = event_progress_delta * opal_timer_base_get_freq() / 1000000; #endif }
false
false
false
false
false
0
encodeInstruction(const MCInst &MI, raw_ostream &OS, SmallVectorImpl<MCFixup> &Fixups, const MCSubtargetInfo &STI) const { uint64_t Bits = getBinaryCodeForInstr(MI, Fixups, STI); unsigned Size = MCII.get(MI.getOpcode()).getSize(); // Big-endian insertion of Size bytes. unsigned ShiftValue = (Size * 8) - 8; for (unsigned I = 0; I != Size; ++I) { OS << uint8_t(Bits >> ShiftValue); ShiftValue -= 8; } }
false
false
false
false
false
0
update_expected_bandwidth(void) { uint64_t expected; const or_options_t *options= get_options(); uint64_t max_configured = (options->RelayBandwidthRate > 0 ? options->RelayBandwidthRate : options->BandwidthRate) * 60; #define MIN_TIME_FOR_MEASUREMENT (1800) if (soft_limit_hit_at > interval_start_time && n_bytes_at_soft_limit && (soft_limit_hit_at - interval_start_time) > MIN_TIME_FOR_MEASUREMENT) { /* If we hit our soft limit last time, only count the bytes up to that * time. This is a better predictor of our actual bandwidth than * considering the entirety of the last interval, since we likely started * using bytes very slowly once we hit our soft limit. */ expected = n_bytes_at_soft_limit / (soft_limit_hit_at - interval_start_time); expected /= 60; } else if (n_seconds_active_in_interval >= MIN_TIME_FOR_MEASUREMENT) { /* Otherwise, we either measured enough time in the last interval but * never hit our soft limit, or we're using a state file from a Tor that * doesn't know to store soft-limit info. Just take rate at which * we were reading/writing in the last interval as our expected rate. */ uint64_t used = MAX(n_bytes_written_in_interval, n_bytes_read_in_interval); expected = used / (n_seconds_active_in_interval / 60); } else { /* If we haven't gotten enough data last interval, set 'expected' * to 0. This will set our wakeup to the start of the interval. * Next interval, we'll choose our starting time based on how much * we sent this interval. */ expected = 0; } if (expected > max_configured) expected = max_configured; expected_bandwidth_usage = expected; }
false
false
false
false
false
0
bgav_h264_sps_dump(bgav_h264_sps_t * sps) { int i; bgav_dprintf("SPS:\n"); bgav_dprintf(" profile_idc: %d\n", sps->profile_idc); bgav_dprintf(" constraint_set0_flag: %d\n", sps->constraint_set0_flag); bgav_dprintf(" constraint_set1_flag: %d\n", sps->constraint_set1_flag); bgav_dprintf(" constraint_set2_flag: %d\n", sps->constraint_set2_flag); bgav_dprintf(" constraint_set3_flag: %d\n", sps->constraint_set3_flag); bgav_dprintf(" level_idc: %d\n", sps->level_idc); bgav_dprintf(" seq_parameter_set_id: %d\n", sps->seq_parameter_set_id); if(sps->profile_idc == 100 || sps->profile_idc == 110 || sps->profile_idc == 122 || sps->profile_idc == 244 || sps->profile_idc == 44 || sps->profile_idc == 83 || sps->profile_idc == 86 ) { bgav_dprintf(" chroma_format_idc: %d\n", sps->chroma_format_idc); if(sps->chroma_format_idc == 3) bgav_dprintf(" separate_colour_plane_flag: %d\n", sps->separate_colour_plane_flag); bgav_dprintf(" bit_depth_luma_minus8: %d\n", sps->bit_depth_luma_minus8); bgav_dprintf(" bit_depth_chroma_minus8: %d\n", sps->bit_depth_chroma_minus8); bgav_dprintf(" qpprime_y_zero_transform_bypass_flag: %d\n", sps->qpprime_y_zero_transform_bypass_flag); bgav_dprintf(" seq_scaling_matrix_present_flag: %d\n", sps->seq_scaling_matrix_present_flag); } bgav_dprintf(" log2_max_frame_num_minus4: %d\n", sps->log2_max_frame_num_minus4); bgav_dprintf(" pic_order_cnt_type: %d\n", sps->pic_order_cnt_type); if( sps->pic_order_cnt_type == 0 ) bgav_dprintf(" log2_max_pic_order_cnt_lsb_minus4: %d\n", sps->log2_max_pic_order_cnt_lsb_minus4); else if(sps->pic_order_cnt_type == 1) { bgav_dprintf(" delta_pic_order_always_zero_flag: %d\n", sps->delta_pic_order_always_zero_flag); bgav_dprintf(" offset_for_non_ref_pic: %d\n", sps->offset_for_non_ref_pic); bgav_dprintf(" offset_for_top_to_bottom_field: %d\n", sps->offset_for_top_to_bottom_field); bgav_dprintf(" num_ref_frames_in_pic_order_cnt_cycle: %d\n", sps->num_ref_frames_in_pic_order_cnt_cycle); for(i = 0; i < sps->num_ref_frames_in_pic_order_cnt_cycle; i++) { bgav_dprintf(" offset_for_ref_frame[%d]: %d\n", i, sps->offset_for_ref_frame[i]); } } bgav_dprintf(" num_ref_frames: %d\n", sps->num_ref_frames); bgav_dprintf(" gaps_in_frame_num_value_allowed_flag: %d\n", sps->gaps_in_frame_num_value_allowed_flag); bgav_dprintf(" pic_width_in_mbs_minus1: %d\n", sps->pic_width_in_mbs_minus1); bgav_dprintf(" pic_height_in_map_units_minus1: %d\n", sps->pic_height_in_map_units_minus1); bgav_dprintf(" frame_mbs_only_flag: %d\n", sps->frame_mbs_only_flag); if( !sps->frame_mbs_only_flag ) bgav_dprintf(" mb_adaptive_frame_field_flag: %d\n", sps->mb_adaptive_frame_field_flag); bgav_dprintf(" direct_8x8_inference_flag: %d\n", sps->direct_8x8_inference_flag); bgav_dprintf(" frame_cropping_flag: %d\n", sps->frame_cropping_flag); if( sps->frame_cropping_flag ) { bgav_dprintf(" frame_crop_left_offset: %d\n", sps->frame_crop_left_offset); bgav_dprintf(" frame_crop_right_offset: %d\n", sps->frame_crop_right_offset); bgav_dprintf(" frame_crop_top_offset: %d\n", sps->frame_crop_top_offset); bgav_dprintf(" frame_crop_bottom_offset: %d\n", sps->frame_crop_bottom_offset); } bgav_dprintf(" vui_parameters_present_flag: %d\n", sps->vui_parameters_present_flag); if(sps->vui_parameters_present_flag) vui_dump(&sps->vui); }
false
false
false
false
false
0
azx_interrupt(int irq, void *dev_id) { struct azx *chip = dev_id; struct hdac_bus *bus = azx_bus(chip); u32 status; #ifdef CONFIG_PM if (azx_has_pm_runtime(chip)) if (!pm_runtime_active(chip->card->dev)) return IRQ_NONE; #endif spin_lock(&bus->reg_lock); if (chip->disabled) { spin_unlock(&bus->reg_lock); return IRQ_NONE; } status = azx_readl(chip, INTSTS); if (status == 0 || status == 0xffffffff) { spin_unlock(&bus->reg_lock); return IRQ_NONE; } snd_hdac_bus_handle_stream_irq(bus, status, stream_update); /* clear rirb int */ status = azx_readb(chip, RIRBSTS); if (status & RIRB_INT_MASK) { if (status & RIRB_INT_RESPONSE) { if (chip->driver_caps & AZX_DCAPS_CTX_WORKAROUND) udelay(80); snd_hdac_bus_update_rirb(bus); } azx_writeb(chip, RIRBSTS, RIRB_INT_MASK); } spin_unlock(&bus->reg_lock); return IRQ_HANDLED; }
false
false
false
false
false
0
sht15_remove(struct platform_device *pdev) { struct sht15_data *data = platform_get_drvdata(pdev); /* * Make sure any reads from the device are done and * prevent new ones beginning */ mutex_lock(&data->read_lock); if (sht15_soft_reset(data)) { mutex_unlock(&data->read_lock); return -EFAULT; } hwmon_device_unregister(data->hwmon_dev); sysfs_remove_group(&pdev->dev.kobj, &sht15_attr_group); if (!IS_ERR(data->reg)) { regulator_unregister_notifier(data->reg, &data->nb); regulator_disable(data->reg); } mutex_unlock(&data->read_lock); return 0; }
false
false
false
false
false
0
asyncConnect(void) { if (myState == STATE_CONNECTED) { ArLog::log(ArLog::Terse, "%s: already connected to laser.", getName()); return false; } if (!finishParams()) return false; if (!myUseSim && myConn == NULL) { ArLog::log(ArLog::Terse, "%s: Invalid device connection, cannot connect.", getName()); return false; // Nobody ever set the device connection. } myStartConnect = true; return true; }
false
false
false
false
false
0
write_var_list_for_nt_elem_dec( fsbe_context *cx, Module_table *module, Nt_elem *nt_elem ) { int max_var = get_max_var_entry(module->var_head); int max_arr = get_max_array_entry(module->array_head); IntSet scalar_list, array_list; construct_IntSet(scalar_list, max_var+1); construct_IntSet(array_list, max_arr+1); get_var_list_for_nt_elem(nt_elem, scalar_list, array_list); write_var_dec_list_IntSet(cx, module, scalar_list, array_list); destruct_IntSet(scalar_list); destruct_IntSet(array_list); }
false
false
false
false
false
0
xdll_close (int allflag) /*! Return Value: 0 (FUNCOK) if close OK, -1 (FUNCBAD) if error. Parameters: Type Name IO Description ------------ ----------- -- ----------- */ #ifdef DOC int allflag ;/* I allflag true, close all lists */ /* false, close list spec'd by id */ #endif /*! Description: This closes an already opened list structure. The user must have already free'd any alloc'd pointers in his structures before calling this routine. Improvements: - Add a free function parameter to be used to call user structure free. See also: xdll_open(), xdll_use() Example: See end of example in xdll_open (). !*/ { int i; if (!allflag) CHECKUSE; /* make sure one is in use */ for (i=0, xdllist_curr=xdllist_beg; i<nxdlls; i++,xdllist_curr++) { if ( allflag || i==xdllist_in_use_id ) /* see if closing all of them or just xdllist_in_use_id */ xdllist_curr->size = 0; /* free entry entry */ } xdllist_in_use_id = -1; /* set list in use to no list */ return (FUNCOK); /* OK return */ error_return: /* return an error code */ return (FUNCBAD); }
false
false
false
false
false
0
startElementBoundedBy(const char *pszName, int nLenName, void* attr ) { if ( m_nDepth == 2 && strcmp(pszName, "Envelope") == 0 ) { char* pszGlobalSRSName = GetAttributeValue(attr, "srsName"); m_poReader->SetGlobalSRSName(pszGlobalSRSName); CPLFree(pszGlobalSRSName); } return OGRERR_NONE; }
false
false
false
false
false
0
gf_sg_script_event_in(GF_Node *node, GF_FieldInfo *in_field) { GF_ScriptPriv *priv = (GF_ScriptPriv *)node->sgprivate->UserPrivate; if (priv->JS_EventIn) priv->JS_EventIn(node, in_field); }
false
false
false
false
false
0
compute_number_of_lines (const gchar *text) { const gchar *p; gint len; gint nb_of_lines = 1; if (text == NULL) { return 0; } len = strlen (text); p = text; while (len > 0) { gint delimiter; gint next_paragraph; pango_find_paragraph_boundary (p, len, &delimiter, &next_paragraph); if (delimiter == next_paragraph) { /* not found */ break; } p += next_paragraph; len -= next_paragraph; nb_of_lines++; } return nb_of_lines; }
false
false
false
false
false
0
run_ddg_http_request(const char* query, ResponseData * data) { const int MAX_URL_LEN = 2048 * sizeof(char); CURL *curl; CURLcode res; int returnCode; char *escaped_query; char url[MAX_URL_LEN]; memset(url, 0, MAX_URL_LEN); curl_global_init(CURL_GLOBAL_ALL); curl = curl_easy_init(); if (curl) { escaped_query = curl_easy_escape(curl, query, strlen(query)); snprintf(url, MAX_URL_LEN, "http://api.duckduckgo.com/?q=%s&format=json", escaped_query); curl_free(escaped_query); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, data); curl_easy_setopt(curl, CURLOPT_URL, url); res = curl_easy_perform(curl); if (res == CURLE_OK) { returnCode = 1; } else { returnCode = 0; fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res)); } curl_easy_cleanup(curl); } else { returnCode = 0; fprintf(stderr, "curl_easy_init() failed\n"); } curl_global_cleanup(); return returnCode; }
false
false
false
false
false
0
ui_arena_draw(UIArena *arena) { gint i, j; if(!arena->priv->map) return; for (j = 0; j < arena->priv->map_size->num_rows; j++) { for (i = 0; i < arena->priv->map_size->num_cols; i++) { switch(MAP_GET_OBJECT(arena->priv->map, i, j)) { case '\0': put_tile(arena, arena->priv->wall, i * TILE_SIZE, j * TILE_SIZE); break; case SPACE: put_tile(arena, arena->priv->space, i * TILE_SIZE, j * TILE_SIZE); break; case FOOD: put_tile(arena, arena->priv->food, i * TILE_SIZE, j * TILE_SIZE); break; case PRIZE: put_tile(arena, arena->priv->prize, i * TILE_SIZE, j * TILE_SIZE); break; case WALL: put_tile(arena, arena->priv->wall, i * TILE_SIZE, j * TILE_SIZE); break; case BADDIE: put_tile(arena, arena->priv->baddie, i * TILE_SIZE, j * TILE_SIZE); break; case ROBOT: put_tile(arena, arena->priv->robotPix, i * TILE_SIZE, j * TILE_SIZE); break; default: put_tile(arena, arena->priv->wall, i * TILE_SIZE, j * TILE_SIZE); break; } } } gtk_widget_queue_draw_area(GTK_WIDGET(arena), 0, 0, arena->priv->width, arena->priv->height); }
false
false
false
false
false
0
module_do_insmod_dep(const struct kmod_list *deps, unsigned int flags, struct probe_insert_cb *cb, struct kmod_list *rec, unsigned int reccount) { const struct kmod_list *d; int err = 0; if (module_dep_has_loop(deps, rec, reccount)) return -ELOOP; kmod_list_foreach(d, deps) { struct kmod_module *dm = d->data; struct kmod_list *tmp; tmp = kmod_list_append(rec, dm); if (tmp == NULL) return -ENOMEM; rec = tmp; err = module_probe_insert_module(dm, flags, NULL, cb, rec, reccount + 1); rec = kmod_list_remove_n_latest(rec, 1); RET_CHECK_NOLOOP_OR_FAIL(err, flags, finish); } finish: return err; }
false
true
false
false
false
1
gw_categories_edit_box_update_click ( GtkWidget *bt, GtkWindow *w) { GWDBCategory *category = NULL; gint result = -1; #ifdef GW_DEBUG_GUI_COMPONENT g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__); #endif if ( w != NULL ) { if ( (category = gw_categories_edit_box_get_category ( w)) != NULL ) { gw_categories_edit_box_set_category_name ( w, gw_db_category_get_name ( category)); gw_categories_edit_box_set_category_description ( w, gw_db_category_get_description ( category)); gw_categories_edit_box_set_update_state ( w); result = 0; } } return result; }
false
false
false
false
false
0
settings_window_help(GtkWidget *widget, GdkEventKey *event, gpointer user_data) { START_FUNC #ifdef ENABLE_HELP GError *error=NULL; if (event->keyval==GDK_KEY_F1) { gtk_show_uri(NULL, "ghelp:florence?config", gtk_get_current_event_time(), &error); if (error) flo_error(_("Unable to open %s: %s"), "ghelp:florence?config", error->message); } #endif END_FUNC }
false
false
false
false
false
0
qib_6120_hdrqempty(struct qib_ctxtdata *rcd) { u32 head, tail; head = qib_read_ureg32(rcd->dd, ur_rcvhdrhead, rcd->ctxt); if (rcd->rcvhdrtail_kvaddr) tail = qib_get_rcvhdrtail(rcd); else tail = qib_read_ureg32(rcd->dd, ur_rcvhdrtail, rcd->ctxt); return head == tail; }
false
false
false
false
false
0
table_attach (GtkWidget * table, GtkWidget * child, gint pos, gint row) { gtk_grid_attach (GTK_GRID (table), child, pos, row, 1, 1); if (pos) gtk_widget_set_hexpand (child, TRUE); }
false
false
false
false
false
0
wrap_new(GObject* object) { return new Atk::NoOpObject((AtkNoOpObject*) object); }
false
false
false
false
false
0
quick_open_dialog_tree_sort_func(GtkTreeModel* model, GtkTreeIter* a, GtkTreeIter* b, gpointer user_data) { gboolean is_separator; gboolean is_document1, is_document2; char* title1, *title2; gboolean res; gtk_tree_model_get(model, a, COLUMN_IS_SEPARATOR, &is_separator, -1); /* a is separator. */ if (is_separator) { gtk_tree_model_get(model, b, COLUMN_IS_DOCUMENT, &is_document2, -1); if (is_document2) return 1; else return -1; } gtk_tree_model_get(model, b, COLUMN_IS_SEPARATOR, &is_separator, -1); /* b is separator. */ if (is_separator) { gtk_tree_model_get(model, a, COLUMN_IS_DOCUMENT, &is_document1, -1); if (is_document1) return -1; else return 1; } gtk_tree_model_get(model, a, COLUMN_IS_DOCUMENT, &is_document1, -1); gtk_tree_model_get(model, b, COLUMN_IS_DOCUMENT, &is_document2, -1); if (is_document1 && !is_document2) return -1; if (!is_document1 && is_document2) return 1; gtk_tree_model_get(model, a, COLUMN_TITLE, &title1, -1); gtk_tree_model_get(model, b, COLUMN_TITLE, &title2, -1); res = strcmp(title1, title2); g_free(title1); g_free(title2); return res; }
false
false
false
false
false
0
save_BindSampler(GLuint unit, GLuint sampler) { Node *n; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = alloc_instruction(ctx, OPCODE_BIND_SAMPLER, 2); if (n) { n[1].ui = unit; n[2].ui = sampler; } if (ctx->ExecuteFlag) { CALL_BindSampler(ctx->Exec, (unit, sampler)); } }
false
false
false
false
false
0
tree_parse_buffer(git_tree *tree, const char *buffer, const char *buffer_end) { if (git_vector_init(&tree->entries, DEFAULT_TREE_SIZE, entry_sort_cmp) < 0) return -1; while (buffer < buffer_end) { git_tree_entry *entry; int attr; if (git__strtol32(&attr, buffer, &buffer, 8) < 0 || !buffer || !valid_filemode(attr)) return tree_error("Failed to parse tree. Can't parse filemode"); if (*buffer++ != ' ') return tree_error("Failed to parse tree. Object is corrupted"); if (memchr(buffer, 0, buffer_end - buffer) == NULL) return tree_error("Failed to parse tree. Object is corrupted"); /** Allocate the entry and store it in the entries vector */ { entry = alloc_entry(buffer); GITERR_CHECK_ALLOC(entry); if (git_vector_insert(&tree->entries, entry) < 0) return -1; entry->attr = attr; } while (buffer < buffer_end && *buffer != 0) buffer++; buffer++; git_oid_fromraw(&entry->oid, (const unsigned char *)buffer); buffer += GIT_OID_RAWSZ; } return 0; }
false
false
false
false
false
0
cbf_get_gain (cbf_handle handle, unsigned int element_number, double *gain, double *gain_esd) { const char *array_id; cbf_failnez (cbf_get_array_id (handle, element_number, &array_id)); /* Get the gain */ cbf_failnez (cbf_find_category (handle, "array_intensities")) cbf_failnez (cbf_find_column (handle, "array_id")) cbf_failnez (cbf_find_row (handle, array_id)) cbf_failnez (cbf_find_column (handle, "gain")) cbf_failnez (cbf_get_doublevalue (handle, gain)) cbf_failnez (cbf_find_column (handle, "gain_esd")) cbf_failnez (cbf_get_doublevalue (handle, gain_esd)) return 0; }
false
false
false
false
false
0
prepare_packet(struct cros_ec_device *ec_dev, struct cros_ec_command *msg) { struct ec_host_request *request; u8 *out; int i; u8 csum = 0; BUG_ON(ec_dev->proto_version != EC_HOST_REQUEST_VERSION); BUG_ON(msg->outsize + sizeof(*request) > ec_dev->dout_size); out = ec_dev->dout; request = (struct ec_host_request *)out; request->struct_version = EC_HOST_REQUEST_VERSION; request->checksum = 0; request->command = msg->command; request->command_version = msg->version; request->reserved = 0; request->data_len = msg->outsize; for (i = 0; i < sizeof(*request); i++) csum += out[i]; /* Copy data and update checksum */ memcpy(out + sizeof(*request), msg->data, msg->outsize); for (i = 0; i < msg->outsize; i++) csum += msg->data[i]; request->checksum = -csum; return sizeof(*request) + msg->outsize; }
false
false
false
false
false
0
nautilus_file_is_mime_type (NautilusFile *file, const char *mime_type) { g_return_val_if_fail (NAUTILUS_IS_FILE (file), FALSE); g_return_val_if_fail (mime_type != NULL, FALSE); if (file->details->mime_type == NULL) { return FALSE; } return g_content_type_is_a (eel_ref_str_peek (file->details->mime_type), mime_type); }
false
false
false
false
false
0
OnDisassoc(struct adapter *padapter, struct recv_frame *precv_frame) { u16 reason; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); u8 *pframe = precv_frame->rx_data; struct wlan_bssid_ex *pnetwork = &(pmlmeinfo->network); /* check A3 */ if (memcmp(GetAddr3Ptr(pframe), pnetwork->MacAddress, ETH_ALEN)) return _SUCCESS; reason = le16_to_cpu(*(__le16 *)(pframe + WLAN_HDR_A3_LEN)); DBG_88E("%s Reason code(%d)\n", __func__, reason); #ifdef CONFIG_88EU_AP_MODE if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { struct sta_info *psta; struct sta_priv *pstapriv = &padapter->stapriv; DBG_88E_LEVEL(_drv_always_, "ap recv disassoc reason code(%d) sta:%pM\n", reason, GetAddr2Ptr(pframe)); psta = rtw_get_stainfo(pstapriv, GetAddr2Ptr(pframe)); if (psta) { u8 updated = 0; spin_lock_bh(&pstapriv->asoc_list_lock); if (!list_empty(&psta->asoc_list)) { list_del_init(&psta->asoc_list); pstapriv->asoc_list_cnt--; updated = ap_free_sta(padapter, psta, false, reason); } spin_unlock_bh(&pstapriv->asoc_list_lock); associated_clients_update(padapter, updated); } return _SUCCESS; } else #endif { DBG_88E_LEVEL(_drv_always_, "ap recv disassoc reason code(%d) sta:%pM\n", reason, GetAddr3Ptr(pframe)); receive_disconnect(padapter, GetAddr3Ptr(pframe), reason); } pmlmepriv->LinkDetectInfo.bBusyTraffic = false; return _SUCCESS; }
false
false
false
false
false
0
method_D5(const int *account, int *weight) { if ( account[2] == 9 && account[3] == 9 ) { // variant 1: like method_06, but with different weight number2Array("0087654320", weight); return algo01(11, weight, false, 10, account); } else { number2Array("0007654320", weight); // variant 2: like method_06, but with different weight if (AccountNumberCheck::OK == algo01(11, weight, false, 10, account) ) return AccountNumberCheck::OK; // variant 3 if (AccountNumberCheck::OK == algo02(7, weight, 10, account, 3, 8) ) return AccountNumberCheck::OK; // variant 4 return algo02(10, weight, 10, account, 3, 8); } }
false
false
false
false
false
0
view_window_get_fd_list(ViewWindow *vw) { GList *list = NULL; ImageWindow *imd = view_window_active_image(vw); if (imd) { FileData *fd = image_get_fd(imd); if (fd) list = g_list_append(NULL, file_data_ref(fd)); } return list; }
false
false
false
false
false
0
GetScratchPad(SQInteger size) { SQInteger newsize; if(size>0) { if(_scratchpadsize < size) { newsize = size + (size>>1); _scratchpad = (SQChar *)SQ_REALLOC(_scratchpad,_scratchpadsize,newsize); _scratchpadsize = newsize; }else if(_scratchpadsize >= (size<<5)) { newsize = _scratchpadsize >> 1; _scratchpad = (SQChar *)SQ_REALLOC(_scratchpad,_scratchpadsize,newsize); _scratchpadsize = newsize; } } return _scratchpad; }
false
false
false
false
false
0
pageset_set_high(struct per_cpu_pageset *p, unsigned long high) { unsigned long batch = max(1UL, high / 4); if ((high / 4) > (PAGE_SHIFT * 8)) batch = PAGE_SHIFT * 8; pageset_update(&p->pcp, high, batch); }
false
false
false
false
false
0
ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal (SOCKET sock, gint32 af, gint32 *error) { gchar *sa; socklen_t salen; int ret; MonoObject *result; *error = 0; salen = get_sockaddr_size (convert_family ((MonoAddressFamily)af)); if (salen == 0) { *error = WSAEAFNOSUPPORT; return NULL; } sa = (salen <= 128) ? (gchar *)alloca (salen) : (gchar *)g_malloc0 (salen); MONO_PREPARE_BLOCKING; ret = _wapi_getsockname (sock, (struct sockaddr *)sa, &salen); MONO_FINISH_BLOCKING; if(ret==SOCKET_ERROR) { *error = WSAGetLastError (); if (salen > 128) g_free (sa); return(NULL); } LOGDEBUG (g_message("%s: bound to %s port %d", __func__, inet_ntoa(((struct sockaddr_in *)&sa)->sin_addr), ntohs(((struct sockaddr_in *)&sa)->sin_port))); result = create_object_from_sockaddr((struct sockaddr *)sa, salen, error); if (salen > 128) g_free (sa); return result; }
false
false
false
false
false
0
Find(char charToFind, uint32_t startPos) { // Check if char to find is null, in that case, return -1 straight away if(charToFind == '\0') return -1; // Create temporary C-style string for charToFind, // because strstr() requires the string to find to be null-terminated char stringToFind[2] = {0}; stringToFind[0] = charToFind; return this->Find(stringToFind, startPos); /* // Search for character using C std library call strstr() char * ptrToFirstOccurance = strstr(this->cStringPtr, stringToFind); if(ptrToFirstOccurance == nullptr) return -1; else { // Return offset of pointer to matched string from start of searched-in string, // this will be the index return ptrToFirstOccurance - this->cStringPtr; }*/ }
false
false
false
false
false
0
evd_connection_setup_streams (EvdConnection *self) { EvdStreamThrottle *input_throttle; EvdStreamThrottle *output_throttle; /* socket input stream */ self->priv->socket_input_stream = evd_socket_input_stream_new (self->priv->socket); g_signal_connect (self->priv->socket_input_stream, "drained", G_CALLBACK (evd_connection_socket_input_stream_drained), self); /* socket output stream */ self->priv->socket_output_stream = evd_socket_output_stream_new (self->priv->socket); g_signal_connect (self->priv->socket_output_stream, "filled", G_CALLBACK (evd_connection_socket_output_stream_filled), self); /* throttled input stream */ input_throttle = evd_io_stream_get_input_throttle (EVD_IO_STREAM (self)); self->priv->throt_input_stream = evd_throttled_input_stream_new ( G_INPUT_STREAM (self->priv->socket_input_stream)); evd_throttled_input_stream_add_throttle (self->priv->throt_input_stream, input_throttle); g_signal_connect (self->priv->throt_input_stream, "delay-read", G_CALLBACK (evd_connection_delay_read), self); /* throttled output stream */ output_throttle = evd_io_stream_get_output_throttle (EVD_IO_STREAM (self)); self->priv->throt_output_stream = evd_throttled_output_stream_new ( G_OUTPUT_STREAM (self->priv->socket_output_stream)); evd_throttled_output_stream_add_throttle (self->priv->throt_output_stream, output_throttle); g_signal_connect (self->priv->throt_output_stream, "delay-write", G_CALLBACK (evd_connection_delay_write), self); if (self->priv->group != NULL) { EvdStreamThrottle *input_throttle; EvdStreamThrottle *output_throttle; g_object_get (self->priv->group, "input-throttle", &input_throttle, "output-throttle", &output_throttle, NULL); evd_throttled_input_stream_add_throttle (self->priv->throt_input_stream, input_throttle); evd_throttled_output_stream_add_throttle (self->priv->throt_output_stream, output_throttle); g_object_unref (input_throttle); g_object_unref (output_throttle); } /* buffered input stream */ self->priv->buf_input_stream = evd_buffered_input_stream_new (G_INPUT_STREAM (self->priv->throt_input_stream)); /* buffered output stream */ self->priv->buf_output_stream = evd_buffered_output_stream_new (G_OUTPUT_STREAM (self->priv->throt_output_stream)); if (evd_socket_get_status (self->priv->socket) != EVD_SOCKET_STATE_CONNECTED) { self->priv->connected = FALSE; evd_buffered_input_stream_freeze (self->priv->buf_input_stream); } else { self->priv->connected = TRUE; } evd_buffered_output_stream_set_auto_flush (self->priv->buf_output_stream, self->priv->connected); }
false
false
false
false
false
0
paintEvent(QPaintEvent *) { hOutDebug(5,"Gauge paint" << std::endl); QPainter painter(this); painter.setPen(mPenColor); painter.drawArc(0,10,120,120,30*16,120*16); painter.translate(60,70); painter.rotate(30.0); for (int angle=30; angle<=150; angle+=10) { painter.drawLine(-65,0,-60,0); painter.rotate(10.0); } painter.rotate(-160.0); mPrevAngle = 30.0; double angle = 30.0 ; if (mHwm > 0.0) angle = 30 + (mValue/mHwm*120); hOutDebug(5,"angle="<<angle << " hwm=" << mHwm << std::endl); painter.rotate(angle); painter.drawLine(-50,0,-20,0); }
false
false
false
false
false
0
img_i2c_complete_transaction(struct img_i2c *i2c, int status) { img_i2c_switch_mode(i2c, MODE_INACTIVE); if (status) { i2c->msg_status = status; img_i2c_transaction_halt(i2c, false); } complete(&i2c->msg_complete); }
false
false
false
false
false
0
flowToSeq(int *pnSeqLength, double *adFlows, int nLength) { char *szSeq = (char *) malloc(MAX_SEQUENCE_LENGTH*sizeof(char)); int i = 0; int nCount = 0; if(!szSeq) goto memoryError; for(i = nOffSet; i < nLength; i++){ char cBase = szFlows[i % 4]; int s = 0, nS = (int) floor(adFlows[i] + 0.5); while(s < nS){ szSeq[nCount] = cBase; s++; nCount++; } } (*pnSeqLength) = nCount; return szSeq; memoryError: fprintf(stderr, "Failed allocating memory in flowToSeq\n"); fflush(stderr); exit(EXIT_FAILURE); }
false
false
false
false
false
0
valueize_shared_reference_ops_from_call (gimple call) { if (!call) return NULL; VEC_truncate (vn_reference_op_s, shared_lookup_references, 0); copy_reference_ops_from_call (call, &shared_lookup_references); shared_lookup_references = valueize_refs (shared_lookup_references); return shared_lookup_references; }
false
false
false
false
false
0
test_string() { eastl::string str; str += "testing "; str += "simple "; str += "string "; str += "concat"; EASTL_ASSERT(str == "testing simple string concat"); str.sprintf("%d", 20); EASTL_ASSERT(str == "20"); }
false
false
false
false
false
0
find_used_clusters(const struct exfat* ef, cluster_t* a, cluster_t* b) { const cluster_t end = le32_to_cpu(ef->sb->cluster_count); /* find first used cluster */ for (*a = *b + 1; *a < end; (*a)++) if (BMAP_GET(ef->cmap.chunk, *a - EXFAT_FIRST_DATA_CLUSTER)) break; if (*a >= end) return 1; /* find last contiguous used cluster */ for (*b = *a; *b < end; (*b)++) if (BMAP_GET(ef->cmap.chunk, *b - EXFAT_FIRST_DATA_CLUSTER) == 0) { (*b)--; break; } return 0; }
false
false
false
false
false
0
word_monitor_set(int index, unsigned int value) { WordMonitor* monitor = WordMonitor::Instance(); if(monitor) monitor->Set(index, value); }
false
false
false
false
false
0
soap_in__wsse__UsernameToken(struct soap *soap, const char *tag, struct _wsse__UsernameToken *a, const char *type) { size_t soap_flag_Username = 1; size_t soap_flag_Password = 1; size_t soap_flag_Nonce = 1; size_t soap_flag_wsu__Created = 1; if (soap_element_begin_in(soap, tag, 0, type)) return NULL; a = (struct _wsse__UsernameToken *)soap_id_enter(soap, soap->id, a, SOAP_TYPE__wsse__UsernameToken, sizeof(struct _wsse__UsernameToken), 0, NULL, NULL, NULL); if (!a) return NULL; soap_default__wsse__UsernameToken(soap, a); if (soap_s2string(soap, soap_attr_value(soap, "wsu:Id", 0), &a->wsu__Id, 0, -1)) return NULL; if (soap->body && !*soap->href) { for (;;) { soap->error = SOAP_TAG_MISMATCH; if (soap_flag_Username && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) if (soap_in_string(soap, "wsse:Username", &a->Username, "xsd:string")) { soap_flag_Username--; continue; } if (soap_flag_Password && soap->error == SOAP_TAG_MISMATCH) if (soap_in_PointerTo_wsse__Password(soap, "wsse:Password", &a->Password, "")) { soap_flag_Password--; continue; } if (soap_flag_Nonce && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) if (soap_in_string(soap, "wsse:Nonce", &a->Nonce, "xsd:string")) { soap_flag_Nonce--; continue; } if (soap_flag_wsu__Created && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) if (soap_in_string(soap, "wsu:Created", &a->wsu__Created, "xsd:string")) { soap_flag_wsu__Created--; continue; } if (soap->error == SOAP_TAG_MISMATCH) soap->error = soap_ignore_element(soap); if (soap->error == SOAP_NO_TAG) break; if (soap->error) return NULL; } if (soap_element_end_in(soap, tag)) return NULL; } else { a = (struct _wsse__UsernameToken *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE__wsse__UsernameToken, 0, sizeof(struct _wsse__UsernameToken), 0, NULL); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } return a; }
false
false
false
false
false
0
check_integer(HSCPRC * hp, HSCATTR * dest, STRPTR value) { BOOL ok = FALSE; int i = 0; if ((value[0] == '+') || (value[0] == '-')) i = 1; if (strlen(value) - i) { ok = TRUE; while (value[i] && ok) { if (!isdigit(value[i])) ok = FALSE; else i++; } } if (!ok) { /* illegal integer value */ hsc_message(hp, MSG_ILLG_NUM, "illegal numeric value %q for %A", value, dest); } }
false
false
false
false
false
0
Indent_REXX(EBuffer *B, int Line, int PosCursor) { int I; hsState *StateMap = NULL; int StateLen = 0; int OI; OI = I = B->LineIndented(Line); if (I != 0) B->IndentLine(Line, 0); if (B->GetMap(Line, &StateLen, &StateMap) == 0) return 0; if (StateLen > 0) { // line is not empty if (StateMap[0] == hsREXX_Comment) { I = IndentComment(B, Line, StateLen, StateMap); } else { I = IndentNormal(B, Line, StateLen, StateMap); } } else { I = IndentNormal(B, Line, 0, NULL); } if (StateMap) free(StateMap); if (I >= 0) B->IndentLine(Line, I); else I = 0; if (PosCursor == 1) { int X = B->CP.Col; X = X - OI + I; if (X < I) X = I; if (X < 0) X = 0; if (X > B->LineLen(Line)) { X = B->LineLen(Line); if (X < I) X = I; } if (B->SetPosR(X, Line) == 0) return 0; } else if (PosCursor == 2) { if (B->SetPosR(I, Line) == 0) return 0; } return 1; }
false
false
false
false
false
0
init_next_round( ServerGame *game ) { game->cur_round++; game->cur_level = game->cur_round / game->rounds_per_level; game_init( game->game, game->set->levels[game->cur_level] ); /* send level and wait for ready */ game->state = SERVER_AWAIT_READY; game->ready[0] = game->ready[1] = 0; send_level( game->set->levels[game->cur_level], game->users[0], PADDLE_BOTTOM ); if ( !game->users[1]->bot ) send_level( game->set->levels[game->cur_level], game->users[1], PADDLE_TOP ); else game->ready[1] = 1; /* bot is always the challenged one */ /* set up bot top paddle if any */ if ( game->users[1]->bot ) game->game->paddles[PADDLE_TOP]->bot_vx = 0.001 * game->users[1]->bot_level; }
false
false
false
false
false
0
airFPPartsToVal_f(unsigned int sign, unsigned int expo, unsigned int mant) { _airFloatEndianLittle flit; _airFloatEndianBig fbig; FP_SET_F(flit, fbig, sign, expo, mant); return (airEndianLittle == airMyEndian() ? flit.v : fbig.v); }
false
false
false
false
false
0
is_interactive(void) { CYG_REPORT_FUNCNAMETYPE("Cdl::is_interactive", "interactive %d"); CYG_REPORT_RETVAL(interactive); return interactive; }
false
false
false
false
false
0
close_disk_cache(int fd) { struct key_disk_cache *tmp, *tmp_next; if (key_disk_cache_head == NULL) return 0; MUTEX_LOCK(disk_cache_lock); tmp = key_disk_cache_head; do { tmp_next = tmp->next; free(tmp); tmp = tmp_next; } while (tmp); MUTEX_UNLOCK(disk_cache_lock); return 0; }
false
false
false
false
false
0
aesc_encrypt(const uint8_t plain_text[], uint8_t cipher_text[], const uint8_t key_sched[]) { uint8_t state[16]; unsigned int i; aes_first_addroundkey(state, plain_text, key_sched); for (i = 1; i < 10; ++i) { aes_subbyte_shiftrows_mixcols(state); aes_addroundkey(state, key_sched + i * 16); } aes_subbytes_shiftrows(state); aes_last_addroundkey(cipher_text, state, key_sched + 10 * 16); }
false
false
false
false
false
0
xgbe_tx_timer(unsigned long data) { struct xgbe_channel *channel = (struct xgbe_channel *)data; struct xgbe_prv_data *pdata = channel->pdata; struct napi_struct *napi; DBGPR("-->xgbe_tx_timer\n"); napi = (pdata->per_channel_irq) ? &channel->napi : &pdata->napi; if (napi_schedule_prep(napi)) { /* Disable Tx and Rx interrupts */ if (pdata->per_channel_irq) disable_irq_nosync(channel->dma_irq); else xgbe_disable_rx_tx_ints(pdata); /* Turn on polling */ __napi_schedule(napi); } channel->tx_timer_active = 0; DBGPR("<--xgbe_tx_timer\n"); }
false
false
false
false
false
0
Init() { static ClassDocumentation<BaryonWidthGenerator> documentation ("The BaryonWidthGenerator class is designed for the calculation of the" " running width for baryons."); static RefVector<BaryonWidthGenerator,Baryon1MesonDecayerBase> interfaceBaryonDecayers ("BaryonDecayers", "Pointers to the baryon decayers to get the couplings", &BaryonWidthGenerator::_baryondecayers, -1, false, false, true, true, false); static ParVector<BaryonWidthGenerator,int> interfaceModeLocation ("ModeLocation", "The location of the mode in the decayer", &BaryonWidthGenerator::_modeloc, 0, -1, 0, 0, false, false, false); }
false
false
false
false
false
0
mono_test_marshal_delegate (SimpleDelegate delegate) { void *sp1, *sp2; /* Check that the delegate wrapper is stdcall */ delegate (2); sp1 = get_sp (); delegate (2); sp2 = get_sp (); if (is_get_sp_reliable()) g_assert (sp1 == sp2); return delegate (2); }
false
false
false
false
false
0
start_unit (void *arg) { pthread_t t; int k; BYTE_T stack_offset; NODE_T *p; (void) arg; LOCK_THREAD; t = pthread_self (); GET_THREAD_INDEX (k, t); THREAD_STACK_OFFSET (&context[k]) = (BYTE_T *) (&stack_offset - stack_direction (&stack_offset) * STACK_USED (&context[k])); restore_stacks (t); p = (NODE_T *) (UNIT (&context[k])); EXECUTE_UNIT_TRACE (p); genie_abend_thread (); return ((void *) NULL); }
false
false
false
false
false
0
bench_signer(private_crypto_tester_t *this, integrity_algorithm_t alg, signer_constructor_t create) { signer_t *signer; signer = create(alg); if (signer) { char key[signer->get_key_size(signer)]; char mac[signer->get_block_size(signer)]; chunk_t buf; struct timespec start; u_int runs; memset(key, 0x12, sizeof(key)); if (!signer->set_key(signer, chunk_from_thing(key))) { return 0; } buf = chunk_alloc(this->bench_size); memset(buf.ptr, 0x34, buf.len); runs = 0; start_timing(&start); while (end_timing(&start) < this->bench_time) { if (signer->get_signature(signer, buf, mac)) { runs++; } if (signer->verify_signature(signer, buf, chunk_from_thing(mac))) { runs++; } } free(buf.ptr); signer->destroy(signer); return runs; } return 0; }
true
true
false
false
false
1
gst_audio_sink_ring_buffer_stop (GstAudioRingBuffer * buf) { GstAudioSink *sink; GstAudioSinkClass *csink; sink = GST_AUDIO_SINK (GST_OBJECT_PARENT (buf)); csink = GST_AUDIO_SINK_GET_CLASS (sink); /* unblock any pending writes to the audio device */ if (csink->reset) { GST_DEBUG_OBJECT (sink, "reset..."); csink->reset (sink); GST_DEBUG_OBJECT (sink, "reset done"); } #if 0 if (abuf->running) { GST_DEBUG_OBJECT (sink, "stop, waiting..."); GST_AUDIO_SINK_RING_BUFFER_WAIT (buf); GST_DEBUG_OBJECT (sink, "stopped"); } #endif return TRUE; }
false
false
false
false
false
0
select(unsigned long timeout) { // static buffer speeds things up const int maxBufsize = 4096; int bufsize=maxBufsize; static char buf[maxBufsize]; SPtr<TIPv6Addr> peer (new TIPv6Addr()); int sockid; int msgtype; // read data sockid = TIfaceMgr::select(timeout,buf,bufsize,peer); if (sockid>0) { if (bufsize<4) { Log(Warning) << "Received message is too short (" << bufsize << ") bytes." << LogEnd; return 0; //NULL } // check message type msgtype = buf[0]; //SPtr<TMsg> ptr; SPtr<TSrvIfaceIface> ptrIface; // get interface ptrIface = (Ptr*)this->getIfaceBySocket(sockid); Log(Debug) << "Received " << bufsize << " bytes on interface " << ptrIface->getName() << "/" << ptrIface->getID() << " (socket=" << sockid << ", addr=" << *peer << "." << ")." << LogEnd; // create specific message object SPtr<TSrvMsg> ptr; switch (msgtype) { case SOLICIT_MSG: case REQUEST_MSG: case CONFIRM_MSG: case RENEW_MSG: case REBIND_MSG: case RELEASE_MSG: case DECLINE_MSG: case INFORMATION_REQUEST_MSG: case LEASEQUERY_MSG: { ptr = decodeMsg(ptrIface, peer, buf, bufsize); if (!ptr->validateReplayDetection() || !ptr->validateAuthInfo(buf, bufsize)) { Log(Error) << "Auth: Authorization failed, message dropped." << LogEnd; return 0; } return ptr; } case RELAY_FORW_MSG: { ptr = this->decodeRelayForw(ptrIface, peer, buf, bufsize); if (!ptr) return 0; if (!ptr->validateReplayDetection() || !ptr->validateAuthInfo(buf, bufsize)) { Log(Error) << "Auth: validation failed, message dropped." << LogEnd; return 0; } } return ptr; case ADVERTISE_MSG: case REPLY_MSG: case RECONFIGURE_MSG: case RELAY_REPL_MSG: case LEASEQUERY_REPLY_MSG: Log(Warning) << "Illegal message type " << msgtype << " received." << LogEnd; return 0; //NULL; default: Log(Warning) << "Message type " << msgtype << " not supported. Ignoring." << LogEnd; return 0; //NULL } } else { return 0; //NULL } }
false
false
false
false
false
0
ConvertPathtype(xe,ye,xb,yb,width,togds) int *xe,*ye; /* coordinate of endpoint */ int xb,yb; /* coordinate of previous or next point in path */ int width; /* path width */ int togds; { double angle; double deltaX,deltaY; if (width == 0) return; if (width < 0) width = -width; width /= 2; if (togds) { if (*xe == xb) { if (*ye > yb) *ye += width; else *ye -= width; } else if (*ye == yb) { if (*xe > xb) *xe += width; else *xe -= width; } else { deltaX = (double)(*xe - xb); deltaY = (double)(*ye - yb); angle = atan2(deltaY,deltaX); deltaX = (double)(width) * cos(angle); deltaY = (double)(width) * sin(angle); *xe += (int)(deltaX); *ye += (int)(deltaY); } } else { if (*xe == xb) { if (*ye > yb) *ye -= width; else *ye += width; } else if (*ye == yb) { if (*xe > xb) *xe -= width; else *xe += width; } else { deltaX = (double)(*xe - xb); deltaY = (double)(*ye - yb); angle = atan2(deltaY,deltaX); deltaX = (double)(width) * cos(angle); deltaY = (double)(width) * sin(angle); *xe -= (int)(deltaX); *ye -= (int)(deltaY); } } }
false
false
false
false
false
0
manual_ipv6_set(struct connman_network *network, struct connman_ipconfig *ipconfig_ipv6) { struct connman_service *service; int err; DBG("network %p ipv6 %p", network, ipconfig_ipv6); service = connman_service_lookup_from_network(network); if (service == NULL) return -EINVAL; if (__connman_ipconfig_get_local(ipconfig_ipv6) == NULL) __connman_service_read_ip6config(service); __connman_ipconfig_enable_ipv6(ipconfig_ipv6); err = __connman_ipconfig_address_add(ipconfig_ipv6); if (err < 0) { connman_network_set_error(network, CONNMAN_NETWORK_ERROR_CONFIGURE_FAIL); return err; } err = __connman_ipconfig_gateway_add(ipconfig_ipv6); if (err < 0) return err; __connman_connection_gateway_activate(service, CONNMAN_IPCONFIG_TYPE_IPV6); __connman_device_set_network(network->device, network); connman_device_set_disconnected(network->device, FALSE); network->connecting = FALSE; return 0; }
false
false
false
false
false
0
gnc_formula_cell_direct_update( BasicCell *bcell, int *cursor_position, int *start_selection, int *end_selection, void *gui_data ) { FormulaCell *cell = (FormulaCell *)bcell; GdkEventKey *event = gui_data; struct lconv *lc; gboolean is_return; if (event->type != GDK_KEY_PRESS) return FALSE; lc = gnc_localeconv (); is_return = FALSE; /* FIXME!! This code is almost identical (except for GDK_KP_Enter * handling) to pricecell-gnome.c:gnc_price_cell_direct_update. I write * this after fixing a bug where one copy was kept up to date, and the * other not. So, fix this. */ #ifdef G_OS_WIN32 /* gdk never sends GDK_KP_Decimal on win32. See #486658 */ if (event->hardware_keycode == VK_DECIMAL) event->keyval = GDK_KP_Decimal; #endif switch (event->keyval) { case GDK_KEY_Return: if (!(event->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK | GDK_SHIFT_MASK))) is_return = TRUE; /* FALL THROUGH */ case GDK_KEY_KP_Enter: { gnc_formula_cell_set_value( cell, cell->cell.value ); /* If it's not a plain return, stay put. This * allows a 'calculator' style operation using * keypad enter where you can keep entering more * items to add, say. */ return !is_return; } case GDK_KEY_KP_Decimal: break; default: return FALSE; } gnc_basic_cell_insert_decimal(bcell, cell->print_info.monetary ? lc->mon_decimal_point[0] : lc->decimal_point[0], cursor_position, start_selection, end_selection); return TRUE; }
false
false
false
false
false
0
event_cb (GIOChannel *source, GIOCondition condition, RfkillGlib *rfkill) { GList *events; events = NULL; if (condition & G_IO_IN) { GIOStatus status; struct rfkill_event event; gsize read; status = g_io_channel_read_chars (source, (char *) &event, sizeof(event), &read, NULL); while (status == G_IO_STATUS_NORMAL && read == sizeof(event)) { struct rfkill_event *event_ptr; print_event (&event); event_ptr = g_memdup (&event, sizeof(event)); events = g_list_prepend (events, event_ptr); status = g_io_channel_read_chars (source, (char *) &event, sizeof(event), &read, NULL); } events = g_list_reverse (events); } else { g_debug ("something else happened"); return FALSE; } emit_changed_signal_and_free (rfkill, events); return TRUE; }
false
false
false
false
false
0
on_button_pressed_repeat (InputPadGtkButton *button, gpointer data) { guint keysym; g_return_if_fail (INPUT_PAD_IS_GTK_BUTTON (button)); keysym = input_pad_gtk_button_get_keysym (button); if ((keysym == XK_Control_L) || (keysym == XK_Control_R) || (keysym == XK_Alt_L) || (keysym == XK_Alt_L) || (keysym == XK_Shift_L) || (keysym == XK_Shift_R) || (keysym == XK_Num_Lock) || FALSE) { return; } on_button_pressed (GTK_BUTTON (button), data); }
false
false
false
false
false
0
XML(const char *indent) const { if (IsDefault()) return ""; char *value = g_markup_escape_text(StringValue(), -1); std::string str = (std::string)indent + "<" + Name() + ">" + value + "</" + Name() + ">\n"; g_free(value); return str; }
false
false
false
false
false
0
detectConflict(Instruction *cst, int s) { Value *v = cst->getSrc(s); // current register allocation can't handle it if a value participates in // multiple constraints for (Value::UseIterator it = v->uses.begin(); it != v->uses.end(); ++it) { if (cst != (*it)->getInsn()) return true; } // can start at s + 1 because detectConflict is called on all sources for (int c = s + 1; cst->srcExists(c); ++c) if (v == cst->getSrc(c)) return true; Instruction *defi = v->getInsn(); return (!defi || defi->constrainedDefs()); }
false
false
false
false
false
0
edsf_persona_store_instance_init (EdsfPersonaStore * self) { gchar** _tmp0_ = NULL; GeeLinkedList* _tmp1_ = NULL; self->priv = EDSF_PERSONA_STORE_GET_PRIVATE (self); g_static_rec_mutex_init (&self->priv->__lock__personas); self->priv->_is_prepared = FALSE; self->priv->_prepare_pending = FALSE; self->priv->_is_quiescent = FALSE; self->priv->_pending_personas = NULL; self->priv->_addressbook = NULL; self->priv->_ebookview = NULL; self->priv->_source_registry = NULL; _tmp0_ = g_new0 (gchar*, 0 + 1); self->priv->_always_writeable_properties = _tmp0_; self->priv->_always_writeable_properties_length1 = 0; self->priv->__always_writeable_properties_size_ = self->priv->_always_writeable_properties_length1; self->priv->_open_address_book_error = NULL; self->priv->_open_address_book_callback = NULL; _tmp1_ = gee_linked_list_new (EDSF_PERSONA_STORE_TYPE_IDLE_TASK, (GBoxedCopyFunc) edsf_persona_store_idle_task_ref, edsf_persona_store_idle_task_unref, NULL, NULL, NULL); self->priv->_idle_tasks = (GeeQueue*) _tmp1_; self->priv->_idle_handle = (guint) 0; }
false
false
false
false
false
0
drm_lspcon_get_mode(struct i2c_adapter *adapter, enum drm_lspcon_mode *mode) { u8 data; int ret = 0; if (!mode) { DRM_ERROR("NULL input\n"); return -EINVAL; } /* Read Status: i2c over aux */ ret = drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_LSPCON_CURRENT_MODE, &data, sizeof(data)); if (ret < 0) { DRM_ERROR("LSPCON read(0x80, 0x41) failed\n"); return -EFAULT; } if (data & DP_DUAL_MODE_LSPCON_MODE_PCON) *mode = DRM_LSPCON_MODE_PCON; else *mode = DRM_LSPCON_MODE_LS; return 0; }
false
false
false
false
false
0
make_mortal_sv(const unsigned char *src, int type) { STRLEN len; char result[33]; char *ret; switch (type) { case F_BIN: ret = (char*)src; len = 16; break; case F_HEX: ret = hex_16(src, result); len = 32; break; case F_B64: ret = base64_16(src, result); len = 22; break; default: croak("Bad convertion type (%d)", type); break; } return sv_2mortal(newSVpv(ret,len)); }
false
false
false
false
false
0
CombineCmd(int i) const { return i>=count()-1 ? Combine(i) : CombineQuoted(i); }
false
false
false
false
false
0
transfer_variables_to_widgets() { for(type_mapWidgetsToVariables::iterator iter = m_mapWidgetsToVariables.begin(); iter != m_mapWidgetsToVariables.end(); ++iter) { transfer_one_widget(iter->first, false); //false = to_widget. } }
false
false
false
false
false
0
cm_prefs_populate_unique_id(void) { static int populate = -1; if (populate == -1) { const char *val; val = cm_prefs_config("selfsign", "populate_unique_id"); if (val == NULL) { val = CM_DEFAULT_POPULATE_UNIQUE_ID; } if (val != NULL) { populate = cm_prefs_yesno(val); } } return populate != -1 ? populate : 0; }
false
false
false
false
false
0
stopStream() { verifyStream(); if (stream_.state == STREAM_STOPPED) return; // Change the state before the lock to improve shutdown response // when using a callback. stream_.state = STREAM_STOPPED; MUTEX_LOCK(&stream_.mutex); int err; int *handle = (int *) stream_.apiHandle; if (stream_.mode == OUTPUT || stream_.mode == DUPLEX) { err = ioctl(handle[0], SNDCTL_DSP_POST, 0); //err = ioctl(handle[0], SNDCTL_DSP_SYNC, 0); if (err < -1) { sprintf(message_, "RtApiOss: error stopping device (%s).", devices_[stream_.device[0]].name.c_str()); error(RtError::DRIVER_ERROR); } } else { err = ioctl(handle[1], SNDCTL_DSP_POST, 0); //err = ioctl(handle[1], SNDCTL_DSP_SYNC, 0); if (err < -1) { sprintf(message_, "RtApiOss: error stopping device (%s).", devices_[stream_.device[1]].name.c_str()); error(RtError::DRIVER_ERROR); } } MUTEX_UNLOCK(&stream_.mutex); }
false
false
false
false
false
0
rfbInitSockets(rfbScreenInfoPtr rfbScreen) { in_addr_t iface = rfbScreen->listenInterface; if (rfbScreen->socketState!=RFB_SOCKET_INIT) return; rfbScreen->socketState = RFB_SOCKET_READY; if (rfbScreen->inetdSock != -1) { const int one = 1; if(!rfbSetNonBlocking(rfbScreen->inetdSock)) return; if (setsockopt(rfbScreen->inetdSock, IPPROTO_TCP, TCP_NODELAY, (char *)&one, sizeof(one)) < 0) { rfbLogPerror("setsockopt"); return; } FD_ZERO(&(rfbScreen->allFds)); FD_SET(rfbScreen->inetdSock, &(rfbScreen->allFds)); rfbScreen->maxFd = rfbScreen->inetdSock; return; } if(rfbScreen->autoPort) { int i; rfbLog("Autoprobing TCP port \n"); for (i = 5900; i < 6000; i++) { if ((rfbScreen->listenSock = rfbListenOnTCPPort(i, iface)) >= 0) { rfbScreen->port = i; break; } } if (i >= 6000) { rfbLogPerror("Failure autoprobing"); return; } rfbLog("Autoprobing selected port %d\n", rfbScreen->port); FD_ZERO(&(rfbScreen->allFds)); FD_SET(rfbScreen->listenSock, &(rfbScreen->allFds)); rfbScreen->maxFd = rfbScreen->listenSock; } else if(rfbScreen->port>0) { rfbLog("Listening for VNC connections on TCP port %d\n", rfbScreen->port); if ((rfbScreen->listenSock = rfbListenOnTCPPort(rfbScreen->port, iface)) < 0) { rfbLogPerror("ListenOnTCPPort"); return; } FD_ZERO(&(rfbScreen->allFds)); FD_SET(rfbScreen->listenSock, &(rfbScreen->allFds)); rfbScreen->maxFd = rfbScreen->listenSock; } if (rfbScreen->udpPort != 0) { rfbLog("rfbInitSockets: listening for input on UDP port %d\n",rfbScreen->udpPort); if ((rfbScreen->udpSock = rfbListenOnUDPPort(rfbScreen->udpPort, iface)) < 0) { rfbLogPerror("ListenOnUDPPort"); return; } FD_SET(rfbScreen->udpSock, &(rfbScreen->allFds)); rfbScreen->maxFd = max((int)rfbScreen->udpSock,rfbScreen->maxFd); } }
false
false
false
false
false
0
pdc_pata_cable_detect(struct ata_port *ap) { u8 tmp; void __iomem *ata_mmio = ap->ioaddr.cmd_addr; tmp = readb(ata_mmio + PDC_CTLSTAT + 3); if (tmp & 0x01) return ATA_CBL_PATA40; return ATA_CBL_PATA80; }
false
false
false
false
false
0
lazy_cleanup_index(Relation indrel, IndexBulkDeleteResult *stats, LVRelStats *vacrelstats) { IndexVacuumInfo ivinfo; PGRUsage ru0; pg_rusage_init(&ru0); ivinfo.index = indrel; ivinfo.vacuum_full = false; ivinfo.message_level = elevel; ivinfo.num_heap_tuples = vacrelstats->rel_tuples; stats = index_vacuum_cleanup(&ivinfo, stats); if (!stats) return; /* now update statistics in pg_class */ vac_update_relstats(RelationGetRelid(indrel), stats->num_pages, stats->num_index_tuples, false, InvalidTransactionId); ereport(elevel, (errmsg("index \"%s\" now contains %.0f row versions in %u pages", RelationGetRelationName(indrel), stats->num_index_tuples, stats->num_pages), errdetail("%.0f index row versions were removed.\n" "%u index pages have been deleted, %u are currently reusable.\n" "%s.", stats->tuples_removed, stats->pages_deleted, stats->pages_free, pg_rusage_show(&ru0)))); pfree(stats); }
false
false
false
false
false
0
step() { if (_data.done()) { gtk_label_set_text(GTK_LABEL(_messageText), _("-- done --")); setBusy(false); return false; } gtk_label_set_text(GTK_LABEL(_messageText), _data.current().fullPath().c_str()); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(_progress), _data.progress()); _data.step(); return true; }
false
false
false
false
false
0
Compare_files(const void *e1, const void *e2) { if ((*(file_list**) e1)->time > (*(file_list**) e2)->time) return 1; else if ((*(file_list**) e1)->time < (*(file_list**) e2)->time) return(UNKNOWN); return 0; }
false
false
false
false
false
0
igb_maybe_stop_tx(struct igb_ring *tx_ring, const u16 size) { if (igb_desc_unused(tx_ring) >= size) return 0; return __igb_maybe_stop_tx(tx_ring, size); }
false
false
false
false
false
0
amdgpu_fence_driver_fini(struct amdgpu_device *adev) { int i, r; if (atomic_dec_and_test(&amdgpu_fence_slab_ref)) kmem_cache_destroy(amdgpu_fence_slab); mutex_lock(&adev->ring_lock); for (i = 0; i < AMDGPU_MAX_RINGS; i++) { struct amdgpu_ring *ring = adev->rings[i]; if (!ring || !ring->fence_drv.initialized) continue; r = amdgpu_fence_wait_empty(ring); if (r) { /* no need to trigger GPU reset as we are unloading */ amdgpu_fence_driver_force_completion(adev); } wake_up_all(&ring->fence_drv.fence_queue); amdgpu_irq_put(adev, ring->fence_drv.irq_src, ring->fence_drv.irq_type); amd_sched_fini(&ring->sched); del_timer_sync(&ring->fence_drv.fallback_timer); ring->fence_drv.initialized = false; } mutex_unlock(&adev->ring_lock); }
false
false
false
false
false
0
string_compare (char *string1, char *string2) { int count = 0; int compare = 0; if (!string1) { if (!string2) return 0; else return 1; } else if (!string2) return -1; while (string1[count] && string2[count]) { if (isdigit (string1[count]) && isdigit (string2[count])) compare = num_compare (&string1[count], &string2[count]); else compare = char_compare (string1[count], string2[count]); if (compare != 0) return compare; count++; } return char_compare (string1[count], string2[count]); }
false
false
false
false
false
0
L41__WINDOW_SET_LINE_ATTR__dwtrans() {register object *base=vs_base; register object *sup=base+VM41; VC41 vs_check; {object V105; object V106; object V107; object V108; object V109; V105=(base[0]); V106=(base[1]); vs_base=vs_base+2; if(vs_base>=vs_top){vs_top=sup;goto T500;} V107=(base[2]); vs_base++; if(vs_base>=vs_top){vs_top=sup;goto T501;} V108=(base[3]); vs_base++; if(vs_base>=vs_top){vs_top=sup;goto T502;} V109=(base[4]); vs_top=sup; goto T503; goto T500; T500:; V107= Cnil; goto T501; T501:; V108= Cnil; goto T502; T502:; V109= Cnil; goto T503; T503:; base[5]= (((object)VV[5])->s.s_dbind); base[6]= CMPcaddr((V105)); if((V106)!=Cnil){ base[7]= (V106); goto T509;} base[7]= small_fixnum(1); goto T509; T509:; if((V107)!=Cnil){ base[8]= (V107); goto T510;} base[8]= small_fixnum(0); goto T510; T510:; if((V108)!=Cnil){ base[9]= (V108); goto T511;} base[9]= small_fixnum(1); goto T511; T511:; if((V109)!=Cnil){ base[10]= (V109); goto T512;} base[10]= small_fixnum(0); goto T512; T512:; vs_top=(vs_base=base+5)+6; (void) (*Lnk201)(); return; } }
false
false
false
false
false
0
addblanks () { register int i; unsigned char uc; for (i = 0; i < SYNSIZE; i++) { uc = i; /* Since we don't call setlocale(), this defaults to the "C" locale, and the default blank characters will be space and tab. */ if (isblank (uc)) lsyntax[uc] |= CBLANK; } }
false
false
false
false
false
0
items_inserted (EReflowModel *model, gint position, gint count, EReflow *reflow) { gint i, oldcount; if (position < 0 || position > reflow->count) return; oldcount = reflow->count; reflow->count += count; if (reflow->count > reflow->allocated_count) { while (reflow->count > reflow->allocated_count) reflow->allocated_count += 256; reflow->heights = g_renew (int, reflow->heights, reflow->allocated_count); reflow->items = g_renew (GnomeCanvasItem *, reflow->items, reflow->allocated_count); } memmove (reflow->heights + position + count, reflow->heights + position, (reflow->count - position - count) * sizeof (gint)); memmove (reflow->items + position + count, reflow->items + position, (reflow->count - position - count) * sizeof (GnomeCanvasItem *)); for (i = position; i < position + count; i++) { reflow->items[i] = NULL; reflow->heights[i] = e_reflow_model_height (reflow->model, i, GNOME_CANVAS_GROUP (reflow)); } e_selection_model_simple_set_row_count (E_SELECTION_MODEL_SIMPLE (reflow->selection), reflow->count); if (position == oldcount) e_sorter_array_append (reflow->sorter, count); else e_sorter_array_set_count (reflow->sorter, reflow->count); for (i = position; i < position + count; i++) { gint sorted = e_sorter_model_to_sorted (E_SORTER (reflow->sorter), i); gint c; for (c = reflow->column_count - 1; c >= 0; c--) { gint start_of_column = reflow->columns[c]; if (start_of_column <= sorted) { if (reflow->reflow_from_column == -1 || reflow->reflow_from_column > c) { reflow->reflow_from_column = c; } break; } } } reflow->need_reflow_columns = TRUE; set_empty (reflow); e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (reflow)); }
false
false
false
false
false
0
__ecereMethod___ecereNameSpace__ecere__gui__controls__EditBox_Record(struct __ecereNameSpace__ecere__com__Instance * this, struct __ecereNameSpace__ecere__gui__controls__UndoAction * action) { struct __ecereNameSpace__ecere__gui__controls__EditBox * __ecerePointer___ecereNameSpace__ecere__gui__controls__EditBox = (struct __ecereNameSpace__ecere__gui__controls__EditBox *)(this ? (((char *)this) + __ecereClass___ecereNameSpace__ecere__gui__controls__EditBox->offset) : 0); if(!((struct __ecereNameSpace__ecere__gui__controls__UndoBuffer *)(((char *)__ecerePointer___ecereNameSpace__ecere__gui__controls__EditBox->undoBuffer + __ecereClass___ecereNameSpace__ecere__gui__controls__UndoBuffer->offset)))->dontRecord) { __ecereMethod___ecereNameSpace__ecere__gui__controls__UndoBuffer_Record(__ecerePointer___ecereNameSpace__ecere__gui__controls__EditBox->undoBuffer, action); __ecereProp___ecereNameSpace__ecere__gui__controls__MenuItem_Set_disabled(__ecerePointer___ecereNameSpace__ecere__gui__controls__EditBox->itemEditUndo, ((struct __ecereNameSpace__ecere__gui__controls__UndoBuffer *)(((char *)__ecerePointer___ecereNameSpace__ecere__gui__controls__EditBox->undoBuffer + __ecereClass___ecereNameSpace__ecere__gui__controls__UndoBuffer->offset)))->curAction == 0); __ecereProp___ecereNameSpace__ecere__gui__controls__MenuItem_Set_disabled(__ecerePointer___ecereNameSpace__ecere__gui__controls__EditBox->itemEditRedo, ((struct __ecereNameSpace__ecere__gui__controls__UndoBuffer *)(((char *)__ecerePointer___ecereNameSpace__ecere__gui__controls__EditBox->undoBuffer + __ecereClass___ecereNameSpace__ecere__gui__controls__UndoBuffer->offset)))->curAction == ((struct __ecereNameSpace__ecere__gui__controls__UndoBuffer *)(((char *)__ecerePointer___ecereNameSpace__ecere__gui__controls__EditBox->undoBuffer + __ecereClass___ecereNameSpace__ecere__gui__controls__UndoBuffer->offset)))->count); } }
false
false
false
false
false
0
drawRow(int row_,int col_,const char *str_,int len_, int index_,MSBoolean bold_,BlinkPhase phase_,MSBoolean underline_) { if (str_!=0) { int y=computeYCoord(row_); int x=computeXCoord(row_,col_>=0?col_:0); int tw=len_*charWidth(); int lastRowAdjustment=(matrix().rows()-1==row_)?1:0; int lastColAdjustment=(matrix().columns()==col_+len_)?1:0; ColorCell *cc=colorCell(index_); unsigned long fg; unsigned long bg; if (cc!=0) { fg=cc->fg(); bg=cc->bg(); } else { fg=foreground(); bg=background(); } if (phase_==Reverse) { XSetForeground(display(),textGC(),fg); XSetBackground(display(),textGC(),bg); } else { XSetForeground(display(),textGC(),bg); XSetBackground(display(),textGC(),fg); } XFillRectangle(display(),window(),textGC(),x,y-textAscent(), tw+lastColAdjustment,textHeight()+lastRowAdjustment); if (phase_==Reverse) { XSetForeground(display(),textGC(),bg); XSetBackground(display(),textGC(),fg); } else { XSetForeground(display(),textGC(),fg); XSetBackground(display(),textGC(),bg); } Font fid=(bold_==MSTrue&&boldFontID()!=0)?boldFontID():font(); XSetFont(display(),textGC(),fid); const XFontStruct *fs=server()->fontStruct(fid); XDrawString(display(),window(),textGC(),fs,x,y,str_,len_); if (bold_==MSTrue&&boldFontID()==0) XDrawString(display(),window(),textGC(),fs,x+1,y,str_,len_); if (underline_==MSTrue) { XDrawLine(display(),window(),textGC(),x,y+textDescent()-1,x+tw-1,y+textDescent()-1); } } }
false
false
false
false
false
0
sizer_expose_cb(GtkWidget *widget, GdkEventExpose *event, gpointer data) { SizerData *sd = data; GdkRectangle clip; GtkOrientation orientation; GtkStateType state; gdk_region_get_clipbox(event->region, &clip); if (sd->position & SIZER_POS_LEFT || sd->position & SIZER_POS_RIGHT) { orientation = GTK_ORIENTATION_VERTICAL; } else { orientation = GTK_ORIENTATION_HORIZONTAL; } if (sd->handle_prelit) { state = GTK_STATE_PRELIGHT; } else { state = widget->state; } gtk_paint_handle(widget->style, widget->window, state, GTK_SHADOW_NONE, &clip, widget, "paned", 0, 0, widget->allocation.width, widget->allocation.height, orientation); return TRUE; }
false
false
false
false
false
0
rb_spawn_glusterfs_client (glusterd_volinfo_t *volinfo, glusterd_brickinfo_t *brickinfo) { glusterd_conf_t *priv = NULL; char cmd_str[8192] = {0,}; runner_t runner = {0,}; struct stat buf; int ret = -1; priv = THIS->private; runinit (&runner); runner_add_arg (&runner, SBIN_DIR"/glusterfs"); runner_argprintf (&runner, "-f" "%s/vols/%s/"RB_CLIENTVOL_FILENAME, priv->workdir, volinfo->volname); runner_argprintf (&runner, "%s/vols/%s/"RB_CLIENT_MOUNTPOINT, priv->workdir, volinfo->volname); if (volinfo->memory_accounting) runner_add_arg (&runner, "--mem-accounting"); ret = runner_run (&runner); if (ret) { gf_log ("", GF_LOG_DEBUG, "Could not start glusterfs"); goto out; } gf_log ("", GF_LOG_DEBUG, "Successfully started glusterfs: brick=%s:%s", brickinfo->hostname, brickinfo->path); memset (cmd_str, 0, sizeof (cmd_str)); snprintf (cmd_str, 4096, "%s/vols/%s/%s", priv->workdir, volinfo->volname, RB_CLIENT_MOUNTPOINT); ret = stat (cmd_str, &buf); if (ret) { gf_log ("", GF_LOG_DEBUG, "stat on mountpoint failed"); goto out; } gf_log ("", GF_LOG_DEBUG, "stat on mountpoint succeeded"); ret = 0; out: return ret; }
true
true
false
false
false
1
handle_branch2(struct ieee80211_hw *hw, u16 arraylen, u32 *array_table) { struct rtl_priv *rtlpriv = rtl_priv(hw); u32 v1; u32 v2; int i; for (i = 0; i < arraylen; i = i + 2) { v1 = array_table[i]; v2 = array_table[i+1]; if (v1 < 0xCDCDCDCD) { rtl_set_bbreg(hw, array_table[i], MASKDWORD, array_table[i + 1]); udelay(1); continue; } else { /*This line is the start line of branch.*/ /* to protect READ_NEXT_PAIR not overrun */ if (i >= arraylen - 2) break; if (!_rtl88e_check_condition(hw, array_table[i])) { /*Discard the following (offset, data) pairs*/ READ_NEXT_PAIR(v1, v2, i); while (v2 != 0xDEAD && v2 != 0xCDEF && v2 != 0xCDCD && i < arraylen - 2) READ_NEXT_PAIR(v1, v2, i); i -= 2; /* prevent from for-loop += 2*/ } else { /* Configure matched pairs and skip * to end of if-else. */ READ_NEXT_PAIR(v1, v2, i); while (v2 != 0xDEAD && v2 != 0xCDEF && v2 != 0xCDCD && i < arraylen - 2) { rtl_set_bbreg(hw, array_table[i], MASKDWORD, array_table[i + 1]); udelay(1); READ_NEXT_PAIR(v1, v2, i); } while (v2 != 0xDEAD && i < arraylen - 2) READ_NEXT_PAIR(v1, v2, i); } } RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "The agctab_array_table[0] is %x Rtl818EEPHY_REGArray[1] is %x\n", array_table[i], array_table[i + 1]); } }
false
false
false
false
false
0
bestDestinationPileUnderCards() { QSet<KCardPile*> targets; foreach ( QGraphicsItem * item, q->collidingItems( cardsBeingDragged.first(), Qt::IntersectsItemBoundingRect ) ) { KCardPile * p = qgraphicsitem_cast<KCardPile*>( item ); if ( !p ) { KCard * c = qgraphicsitem_cast<KCard*>( item ); if ( c ) p = c->pile(); } if ( p ) targets << p; } KCardPile * bestTarget = 0; qreal bestArea = 1; foreach ( KCardPile * p, targets ) { if ( p != cardsBeingDragged.first()->pile() && q->allowedToAdd( p, cardsBeingDragged ) ) { QRectF targetRect = p->sceneBoundingRect(); foreach ( KCard *c, p->cards() ) targetRect |= c->sceneBoundingRect(); QRectF intersection = targetRect & cardsBeingDragged.first()->sceneBoundingRect(); qreal area = intersection.width() * intersection.height(); if ( area > bestArea ) { bestTarget = p; bestArea = area; } } } return bestTarget; }
false
false
false
false
false
0
anjuta_window_set_geometry (AnjutaWindow *win, const gchar *geometry) { gint width, height, posx, posy; gboolean geometry_set = FALSE; if (geometry && strlen (geometry) > 0) { DEBUG_PRINT ("Setting geometry: %s", geometry); if (sscanf (geometry, "%dx%d+%d+%d", &width, &height, &posx, &posy) == 4) { if (gtk_widget_get_realized (GTK_WIDGET (win))) { gtk_window_resize (GTK_WINDOW (win), width, height); } else { gtk_window_set_default_size (GTK_WINDOW (win), width, height); gtk_window_move (GTK_WINDOW (win), posx, posy); } geometry_set = TRUE; } else { g_warning ("Failed to parse geometry: %s", geometry); } } if (!geometry_set) { posx = 10; posy = 10; width = gdk_screen_width () - 10; height = gdk_screen_height () - 25; width = (width < 790)? width : 790; height = (height < 575)? width : 575; if (gtk_widget_get_realized (GTK_WIDGET (win)) == FALSE) { gtk_window_set_default_size (GTK_WINDOW (win), width, height); gtk_window_move (GTK_WINDOW (win), posx, posy); } } }
false
false
false
false
false
0
init_mteTriggerExistenceTable(void) { static oid mteTExistTable_oid[] = { 1, 3, 6, 1, 2, 1, 88, 1, 2, 4 }; size_t mteTExistTable_oid_len = OID_LENGTH(mteTExistTable_oid); netsnmp_handler_registration *reg; /* * Ensure the (combined) table container is available... */ init_trigger_table_data(); /* * ... then set up the MIB interface to the mteTriggerExistenceTable slice */ #ifndef NETSNMP_NO_WRITE_SUPPORT reg = netsnmp_create_handler_registration("mteTriggerExistenceTable", mteTriggerExistenceTable_handler, mteTExistTable_oid, mteTExistTable_oid_len, HANDLER_CAN_RWRITE); #else /* !NETSNMP_NO_WRITE_SUPPORT */ reg = netsnmp_create_handler_registration("mteTriggerExistenceTable", mteTriggerExistenceTable_handler, mteTExistTable_oid, mteTExistTable_oid_len, HANDLER_CAN_RONLY); #endif /* !NETSNMP_NO_WRITE_SUPPORT */ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info); netsnmp_table_helper_add_indexes(table_info, ASN_OCTET_STR, /* index: mteOwner */ /* index: mteTriggerName */ ASN_PRIV_IMPLIED_OCTET_STR, 0); table_info->min_column = COLUMN_MTETRIGGEREXISTENCETEST; table_info->max_column = COLUMN_MTETRIGGEREXISTENCEEVENT; /* Register this using the (common) trigger_table_data container */ netsnmp_tdata_register(reg, trigger_table_data, table_info); netsnmp_handler_owns_table_info(reg->handler->next); DEBUGMSGTL(("disman:event:init", "Trigger Exist Table\n")); }
false
false
false
false
false
0
lt_symbol_add(struct lt_trace *lt, const char *name, unsigned int rows, int msb, int lsb, int flags) { struct lt_symbol *s; int len; int flagcnt; if((!lt)||(lt->sorted_facs)) return(NULL); flagcnt = ((flags&LT_SYM_F_INTEGER)!=0) + ((flags&LT_SYM_F_DOUBLE)!=0) + ((flags&LT_SYM_F_STRING)!=0); if((flagcnt>1)||(!lt)||(!name)||(lt_symfind(lt, name))) return (NULL); if(flags&LT_SYM_F_DOUBLE) lt->double_used = 1; s=lt_symadd(lt, name, lt_hash(name)); s->rows = rows; s->flags = flags&(~LT_SYM_F_ALIAS); /* aliasing makes no sense here.. */ if(!flagcnt) { s->msb = msb; s->lsb = lsb; s->len = (msb<lsb) ? (lsb-msb+1) : (msb-lsb+1); if((s->len==1)&&(s->rows==0)) s->clk_prevtrans = ULLDescriptor(~0); } s->symchain = lt->symchain; lt->symchain = s; lt->numfacs++; if((len=strlen(name)) > lt->longestname) lt->longestname = len; lt->numfacbytes += (len+1); return(s); }
false
false
false
false
false
0
PerlIOStdio_fill(pTHX_ PerlIO *f) { FILE * stdio; int c; PERL_UNUSED_CONTEXT; if (PerlIO_lockcnt(f)) /* in use: abort ungracefully */ return -1; stdio = PerlIOSelf(f, PerlIOStdio)->stdio; /* * fflush()ing read-only streams can cause trouble on some stdio-s */ if ((PerlIOBase(f)->flags & PERLIO_F_CANWRITE)) { if (PerlSIO_fflush(stdio) != 0) return EOF; } for (;;) { c = PerlSIO_fgetc(stdio); if (c != EOF) break; if (! PerlSIO_ferror(stdio) || errno != EINTR) return EOF; if (PL_sig_pending && S_perlio_async_run(aTHX_ f)) return -1; SETERRNO(0,0); } #if (defined(STDIO_PTR_LVALUE) && (defined(STDIO_CNT_LVALUE) || defined(STDIO_PTR_LVAL_SETS_CNT))) #ifdef STDIO_BUFFER_WRITABLE if (PerlIO_fast_gets(f) && PerlIO_has_base(f)) { /* Fake ungetc() to the real buffer in case system's ungetc goes elsewhere */ STDCHAR *base = (STDCHAR*)PerlSIO_get_base(stdio); SSize_t cnt = PerlSIO_get_cnt(stdio); STDCHAR *ptr = (STDCHAR*)PerlSIO_get_ptr(stdio); if (ptr == base+1) { *--ptr = (STDCHAR) c; PerlIOStdio_set_ptrcnt(aTHX_ f,ptr,cnt+1); if (PerlSIO_feof(stdio)) PerlSIO_clearerr(stdio); return 0; } } else #endif if (PerlIO_has_cntptr(f)) { STDCHAR ch = c; if (PerlIOStdio_unread(aTHX_ f,&ch,1) == 1) { return 0; } } #endif #if defined(VMS) /* An ungetc()d char is handled separately from the regular * buffer, so we stuff it in the buffer ourselves. * Should never get called as should hit code above */ *(--((*stdio)->_ptr)) = (unsigned char) c; (*stdio)->_cnt++; #else /* If buffer snoop scheme above fails fall back to using ungetc(). */ if (PerlSIO_ungetc(c, stdio) != c) return EOF; #endif return 0; }
false
false
false
false
false
0
cp_unparse_milliseconds(uint32_t ms) { if (ms && ms < 1000) return String(ms) + "ms"; else return cp_unparse_real10(ms, 3) + "s"; }
false
false
false
false
false
0
Int32_To_Float32( void *destinationBuffer, signed int destinationStride, void *sourceBuffer, signed int sourceStride, unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator ) { PaInt32 *src = (PaInt32*)sourceBuffer; float *dest = (float*)destinationBuffer; (void)ditherGenerator; /* unused parameter */ while( count-- ) { *dest = (float) ((double)*src * const_1_div_2147483648_); src += sourceStride; dest += destinationStride; } }
false
false
false
false
false
0
processOptions(SPtr<TSrvMsg> clientMsg, bool quiet) { SPtr<TOpt> opt; SPtr<TIPv6Addr> clntAddr = PeerAddr; // --- process this message --- clientMsg->firstOption(); while ( opt = clientMsg->getOption()) { switch (opt->getOptType()) { case OPTION_IA_NA : { processIA_NA((Ptr*)clientMsg, (Ptr*) opt); break; } case OPTION_IA_TA: { processIA_TA((Ptr*)clientMsg, (Ptr*) opt); break; } case OPTION_IA_PD: { processIA_PD((Ptr*)clientMsg, (Ptr*) opt); break; } case OPTION_AUTH : { ORO->addOption(OPTION_AUTH); break; } case OPTION_FQDN : { // skip processing for now (we need to process all IA_NA/IA_TA first) break; } case OPTION_VENDOR_OPTS: { SPtr<TOptVendorData> v = (Ptr*) opt; appendVendorSpec(ClientDUID, Iface, v->getVendor(), ORO); break; } case OPTION_AAAAUTH: { Log(Debug) << "Auth: Option AAAAuthentication received." << LogEnd; break; } case OPTION_PREFERENCE: case OPTION_UNICAST: case OPTION_SERVERID: case OPTION_RELAY_MSG: case OPTION_INTERFACE_ID: case OPTION_STATUS_CODE : { Log(Warning) << "Invalid option (" << opt->getOptType() << ") received. Client is not supposed to send it. Option ignored." << LogEnd; break; } // options not yet supported case OPTION_USER_CLASS : case OPTION_VENDOR_CLASS: case OPTION_RECONF_MSG : case OPTION_RECONF_ACCEPT: { Log(Debug) << "Option " << opt->getOptType() << " is not supported." << LogEnd; break; } default: { handleDefaultOption(opt); break; } } // end of switch } // end of while // process FQDN afer all addresses are processed opt = clientMsg->getOption(OPTION_FQDN); if (opt) { processFQDN((Ptr*)clientMsg, (Ptr*) opt); } }
false
false
false
false
false
0
dec_register_pressure (enum reg_class cover_class, int nregs) { int i; unsigned int j; enum reg_class cl; bool set_p = false; for (i = 0; (cl = ira_reg_class_super_classes[cover_class][i]) != LIM_REG_CLASSES; i++) { curr_reg_pressure[cl] -= nregs; ira_assert (curr_reg_pressure[cl] >= 0); if (high_pressure_start_point[cl] >= 0 && curr_reg_pressure[cl] <= ira_available_class_regs[cl]) set_p = true; } if (set_p) { EXECUTE_IF_SET_IN_SPARSESET (objects_live, j) update_allocno_pressure_excess_length (ira_object_id_map[j]); for (i = 0; (cl = ira_reg_class_super_classes[cover_class][i]) != LIM_REG_CLASSES; i++) if (high_pressure_start_point[cl] >= 0 && curr_reg_pressure[cl] <= ira_available_class_regs[cl]) high_pressure_start_point[cl] = -1; } }
false
false
false
false
false
0
RotBond_count(OBMol & mol) { unsigned int count=0; for (OBBondIterator it=mol.BeginBonds(); it!=mol.EndBonds(); it++) { if (IsRotBond_PDBQT((*it))) {count++;} } return count; }
false
false
false
false
false
0