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
serial_loop(WORKER_INFO *info, struct cfg_s *cfg, const ESL_GETOPTS *go) { P7_BUILDER *bld = NULL; ESL_MSA *msa = NULL; ESL_SQ *sq = NULL; ESL_MSA *postmsa = NULL; ESL_MSA **postmsa_ptr = (cfg->postmsafile != NULL) ? &postmsa : NULL; P7_HMM *hmm = NULL; char errmsg[eslERRBUFSIZE]; int status; double entropy; cfg->nali = 0; while ((status = eslx_msafile_Read(cfg->afp, &msa)) != eslEOF) { if (status != eslOK) eslx_msafile_ReadFailure(cfg->afp, status); cfg->nali++; if ((status = set_msa_name(cfg, errmsg, msa)) != eslOK) p7_Fail("%s\n", errmsg); /* cfg->nnamed gets incremented in this call */ /* bg new-HMM trarr gm om */ if ( msa->nseq == 1 && esl_opt_IsUsed(go, "--singlemx")) { if ((status = esl_sq_FetchFromMSA(msa, 0, &sq)) != eslOK) p7_Fail("build failed: %s", bld->errbuf); if ((status = p7_SingleBuilder(info->bld, sq, info->bg, &hmm, NULL, NULL, NULL)) != eslOK) p7_Fail("build failed: %s", bld->errbuf); esl_sq_Destroy(sq); sq = NULL; hmm->eff_nseq = 1; } else { if ((status = p7_Builder(info->bld, msa, info->bg, &hmm, NULL, NULL, NULL, postmsa_ptr)) != eslOK) p7_Fail("build failed: %s", bld->errbuf); } entropy = p7_MeanMatchRelativeEntropy(hmm, info->bg); if ((status = output_result(cfg, errmsg, cfg->nali, msa, hmm, postmsa, entropy)) != eslOK) p7_Fail(errmsg); p7_hmm_Destroy(hmm); esl_msa_Destroy(msa); esl_msa_Destroy(postmsa); } }
true
true
false
false
false
1
cx18_s_input(struct file *file, void *fh, unsigned int inp) { struct cx18_open_id *id = fh2id(fh); struct cx18 *cx = id->cx; v4l2_std_id std = V4L2_STD_ALL; const struct cx18_card_video_input *card_input = cx->card->video_inputs + inp; if (inp >= cx->nof_inputs) return -EINVAL; if (inp == cx->active_input) { CX18_DEBUG_INFO("Input unchanged\n"); return 0; } CX18_DEBUG_INFO("Changing input from %d to %d\n", cx->active_input, inp); cx->active_input = inp; /* Set the audio input to whatever is appropriate for the input type. */ cx->audio_input = cx->card->video_inputs[inp].audio_index; if (card_input->video_type == V4L2_INPUT_TYPE_TUNER) std = cx->tuner_std; cx->streams[CX18_ENC_STREAM_TYPE_MPG].video_dev.tvnorms = std; cx->streams[CX18_ENC_STREAM_TYPE_YUV].video_dev.tvnorms = std; cx->streams[CX18_ENC_STREAM_TYPE_VBI].video_dev.tvnorms = std; /* prevent others from messing with the streams until we're finished changing inputs. */ cx18_mute(cx); cx18_video_set_io(cx); cx18_audio_set_io(cx); cx18_unmute(cx); return 0; }
false
false
false
false
false
0
rb_obj_cmp(VALUE obj1, VALUE obj2) { if (obj1 == obj2 || rb_equal(obj1, obj2)) return INT2FIX(0); return Qnil; }
false
false
false
false
false
0
get_srch_cells(long grid1_add, long nbins, int *bin_addr1, int *bin_addr2, restr_t *grid1_bound_box, restr_t *grid2_bound_box, long grid2_size, int *srch_add) { long num_srch_cells; /* num cells in restricted search arrays */ long min_add; /* addresses for restricting search of */ long max_add; /* destination grid */ long n, n2; /* generic counters */ long grid2_add; /* current linear address for grid2 cell */ long grid1_addm4, grid2_addm4; int lmask; restr_t bound_box_lat1, bound_box_lat2, bound_box_lon1, bound_box_lon2; /* Restrict searches first using search bins */ min_add = grid2_size - 1; max_add = 0; for ( n = 0; n < nbins; ++n ) { n2 = n<<1; if ( grid1_add >= bin_addr1[n2] && grid1_add <= bin_addr1[n2+1] ) { if ( bin_addr2[n2 ] < min_add ) min_add = bin_addr2[n2 ]; if ( bin_addr2[n2+1] > max_add ) max_add = bin_addr2[n2+1]; } } /* Further restrict searches using bounding boxes */ grid1_addm4 = grid1_add<<2; bound_box_lat1 = grid1_bound_box[grid1_addm4 ]; bound_box_lat2 = grid1_bound_box[grid1_addm4+1]; bound_box_lon1 = grid1_bound_box[grid1_addm4+2]; bound_box_lon2 = grid1_bound_box[grid1_addm4+3]; num_srch_cells = 0; for ( grid2_add = min_add; grid2_add <= max_add; ++grid2_add ) { grid2_addm4 = grid2_add<<2; lmask = (grid2_bound_box[grid2_addm4 ] <= bound_box_lat2) && (grid2_bound_box[grid2_addm4+1] >= bound_box_lat1) && (grid2_bound_box[grid2_addm4+2] <= bound_box_lon2) && (grid2_bound_box[grid2_addm4+3] >= bound_box_lon1); if ( lmask ) { srch_add[num_srch_cells] = grid2_add; num_srch_cells++; } } return (num_srch_cells); }
false
false
false
false
false
0
extract_relations (block_data_t *data, poly_group_t *pg, poly_t *p, nsieve_t *ns, int block_start){ /* The sieve now contains estimates of the size (in bits) of the unfactored portion of the * polynomial values. We scan the sieve for values less than this cutoff, and trial divide * the ones that pass the test. */ mpz_t temp; mpz_init (temp); poly(temp, p, block_start + BLOCKSIZE/2); mpz_abs(temp, temp); uint8_t logQ = (uint8_t) mpz_sizeinbase (temp, 2); int cutoff = (int) (fast_log(ns->lp_bound) * ns->T); /* To accelerate the sieve scanning for promising values, instead of comparing each 8-bit entry * one at a time, we instead look at 64 bits at a time. We are looking for sieve values such that * sieve[x] > logQ - cutoff. We can use as a first approximation to this the test that * sieve[x] > S, where S is the smallest power of 2 larger than (logQ - cutoff). Create an 8-bit * mask - say S is 32 - the mask is 11100000. Then if you AND the mask with any sieve value, and * the result is nonzero, it cannot possibly be below the cutoff. Make 8 copies of the mask, put * it in a 64-bit int, cast the pointer to the sieve block, and do this AND on 64-bit chunks (8 * sieve locations at a time). Since it will be relatively rare for a value to pass the cutoff, * most of the time this test will immediately reject all 8 values. If it doesn't, test each one * against the cutoff individually. */ uint64_t *chunk = (uint64_t *) data->sieve; uint32_t nchunks = BLOCKSIZE/8; uint8_t maskchar = 1; // this is the 8-bit version of the mask while (maskchar < logQ - cutoff){ maskchar *= 2; } maskchar /= 2; maskchar = ~ (maskchar - 1); uint64_t mask = maskchar; for (int i=0; i<8; i++){ // make 8 copies of it mask = (mask << 8) | maskchar; } // now loop over the sieve, a chunk at a time for (int i=0; i < nchunks; i++){ if (mask & chunk[i]){ // then some value *might* have passed the test for (int j=0; j<8; j++){ if (logQ - data->sieve[i*8+j] < cutoff){ // check them all poly (temp, p, block_start + i*8 + j); construct_relation (temp, block_start + i*8 + j, p, ns); } } } } mpz_clear (temp); }
false
false
false
false
false
0
bfa_lps_sm_loginwait(struct bfa_lps_s *lps, enum bfa_lps_event event) { bfa_trc(lps->bfa, lps->bfa_tag); bfa_trc(lps->bfa, event); switch (event) { case BFA_LPS_SM_RESUME: bfa_sm_set_state(lps, bfa_lps_sm_login); bfa_lps_send_login(lps); break; case BFA_LPS_SM_OFFLINE: case BFA_LPS_SM_DELETE: bfa_sm_set_state(lps, bfa_lps_sm_init); bfa_reqq_wcancel(&lps->wqe); break; case BFA_LPS_SM_RX_CVL: /* * Login was not even sent out; so when getting out * of this state, it will appear like a login retry * after Clear virtual link */ break; default: bfa_sm_fault(lps->bfa, event); } }
false
false
false
false
false
0
BSP_AddToVBOAccum (int first_vert, int last_vert) { vbobatch_t *batch = first_vbobatch->next, *prev = first_vbobatch; vbobatch_t *new; if (!batch) { batch = first_vbobatch->next = vbobatch_buffer; batch->first_vert = first_vert; batch->last_vert = last_vert; num_vbo_batches++; return; } // This is optimal. Because of the way the surface linked lists are built // by BSP_AddToTextureChain, they are usually in reverse order, so it's // best to start toward the beginning of the list of VBO batches where // you're more likely to merge something. while (batch->next && batch->next->first_vert < first_vert) { prev = batch; batch = batch->next; } if (batch->first_vert > last_vert) { new = &vbobatch_buffer[num_vbo_batches++]; new->next = batch; prev->next = new; new->first_vert = first_vert; new->last_vert = last_vert; } else if (batch->last_vert == first_vert) { batch->last_vert = last_vert; if (batch->next && batch->next->first_vert == last_vert) { // This is the special case where the new surface bridges the gap // between two existing batches, allowing us to merge them into // the first one. This is the only case where we actually remove a // batch instead of growing one or adding one. batch->last_vert = batch->next->last_vert; if (batch->next == &vbobatch_buffer[num_vbo_batches-1]) num_vbo_batches--; batch->next = batch->next->next; } return; //no need to check for maximum batch count being hit } else if (batch->next && batch->next->first_vert == last_vert) { batch->next->first_vert = first_vert; return; //no need to check for maximum batch count being hit } else if (batch->first_vert == last_vert) { batch->first_vert = first_vert; return; //no need to check for maximum batch count being hit } else //if (batch->last_vert < first_vert) { new = &vbobatch_buffer[num_vbo_batches++]; new->next = batch->next; batch->next = new; new->first_vert = first_vert; new->last_vert = last_vert; } //running out of space if (num_vbo_batches == MAX_VBO_BATCHES) { /* Com_Printf ("MUSTFLUSH\n");*/ BSP_FlushVBOAccum (); } }
false
false
false
false
false
0
_e_mod_illume_config_policy_list_changed(void *data) { if (_e_illume_cfg->policy.name) eina_stringshare_del(_e_illume_cfg->policy.name); if (_policy_name) _e_illume_cfg->policy.name = eina_stringshare_add(_policy_name); if (_policy_change_timer) ecore_timer_del(_policy_change_timer); _policy_change_timer = ecore_timer_add(0.5, _e_mod_illume_config_policy_change_timeout, data); }
false
false
false
false
false
0
insert_sorted (signed char *array, int value) { for (int j=0; j<MAX_SPANS_PER_LINE; j++) { if (array[j] == EMPTY_SCAN_SLOT) { array[j] = value; return; } if (array[j] > value) { for (int k=MAX_SPANS_PER_LINE -1; k >= j+1; k--) array[k] = array[k-1]; array[j] = value; return; } } }
true
true
false
false
false
1
cleanup_data_fields(GwyDataField **dfields, gint no_of_channels) { gint i; for (i = 0; i < no_of_channels; i++) gwy_object_unref(dfields[i]); g_free(dfields); }
false
false
false
false
false
0
canvas_put_text(struct canvas *pcanvas, int canvas_x, int canvas_y, enum client_font font, struct color *pcolor, const char *text) { cairo_t *cr; if (!layout) { layout = pango_layout_new(gdk_pango_context_get_for_screen(gdk_screen_get_default())); } if (!pcanvas->drawable) { cr = cairo_create(pcanvas->surface); } else { cr = pcanvas->drawable; } if (pcanvas->drawable) { cairo_save(cr); } pango_layout_set_font_description(layout, FONT(font)); pango_layout_set_text(layout, text, -1); if (fonts[font].shadowed) { cairo_set_source_rgb(cr, 0, 0, 0); cairo_move_to(cr, canvas_x + 1, canvas_y + 1); pango_cairo_show_layout (cr, layout); } cairo_move_to(cr, canvas_x, canvas_y); gdk_cairo_set_source_rgba(cr, &pcolor->color); pango_cairo_show_layout(cr, layout); if (!pcanvas->drawable) { cairo_destroy(cr); } else { cairo_restore(cr); } }
false
false
false
false
false
0
new_cmd(char **argv) { if ((matches(*argv, "change") == 0) || (matches(*argv, "replace") == 0)|| (matches(*argv, "delete") == 0)|| (matches(*argv, "add") == 0)) return 1; return 0; }
false
false
false
false
false
0
jbg_enc_free(struct jbg_enc_state *s) { unsigned long stripe; int layer, plane; #ifdef DEBUG fprintf(stderr, "jbg_enc_free(%p)\n", (void *) s); #endif /* clear buffers for SDEs */ if (s->sde) { for (stripe = 0; stripe < s->stripes; stripe++) { for (layer = 0; layer < s->d + 1; layer++) { for (plane = 0; plane < s->planes; plane++) if (s->sde[stripe][layer][plane] != SDE_DONE && s->sde[stripe][layer][plane] != SDE_TODO) jbg_buf_free(&s->sde[stripe][layer][plane]); checked_free(s->sde[stripe][layer]); } checked_free(s->sde[stripe]); } checked_free(s->sde); } /* clear free_list */ jbg_buf_free(&s->free_list); /* clear memory for arithmetic encoder states */ checked_free(s->s); /* clear memory for differential-layer typical prediction buffer */ checked_free(s->tp); /* clear memory for adaptive template pixel offsets */ checked_free(s->tx); /* clear lowres image buffers */ if (s->lhp[1]) { for (plane = 0; plane < s->planes; plane++) checked_free(s->lhp[1][plane]); checked_free(s->lhp[1]); } /* clear buffer for index of highres image in lhp */ checked_free(s->highres); return; }
false
false
false
false
false
0
set_max(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct lm95241_data *data = dev_get_drvdata(dev); long val; if (kstrtol(buf, 10, &val) < 0) return -EINVAL; if (val >= 256000) return -EINVAL; mutex_lock(&data->update_lock); if (val <= 127000) data->config |= to_sensor_dev_attr(attr)->index; else data->config &= ~to_sensor_dev_attr(attr)->index; data->valid = 0; i2c_smbus_write_byte_data(data->client, LM95241_REG_RW_CONFIG, data->config); mutex_unlock(&data->update_lock); return count; }
false
false
false
false
false
0
pixaAddTextline(PIXA *pixas, L_BMF *bmf, SARRAY *sa, l_uint32 val, l_int32 location) { char *textstr; l_int32 i, n, nstr; PIX *pix1, *pix2; PIXA *pixad; PROCNAME("pixaAddTextline"); if (!pixas) return (PIXA *)ERROR_PTR("pixas not defined", procName, NULL); if (!bmf) return (PIXA *)ERROR_PTR("bmf not defined", procName, NULL); if (location != L_ADD_ABOVE && location != L_ADD_BELOW && location != L_ADD_LEFT && location != L_ADD_RIGHT) return (PIXA *)ERROR_PTR("invalid location", procName, NULL); n = pixaGetCount(pixas); pixad = pixaCreate(n); nstr = (sa) ? sarrayGetCount(sa) : 0; if (nstr > 0 && nstr < n) L_WARNING("There are %d strings and %d pix\n", procName, nstr, n); for (i = 0; i < n; i++) { pix1 = pixaGetPix(pixas, i, L_CLONE); if (i < nstr) textstr = sarrayGetString(sa, i, L_NOCOPY); else textstr = pixGetText(pix1); pix2 = pixAddSingleTextline(pix1, bmf, textstr, val, location); pixaAddPix(pixad, pix2, L_INSERT); pixDestroy(&pix1); } return pixad; }
false
false
false
false
false
0
is_rename_target( git_diff *diff, const git_diff_find_options *opts, size_t delta_idx, void **cache) { git_diff_delta *delta = GIT_VECTOR_GET(&diff->deltas, delta_idx); /* skip things that aren't plain blobs */ if (!GIT_MODE_ISBLOB(delta->new_file.mode)) return false; /* only consider ADDED, RENAMED, COPIED, and split MODIFIED as * targets; maybe include UNTRACKED and IGNORED if requested. */ switch (delta->status) { case GIT_DELTA_UNMODIFIED: case GIT_DELTA_DELETED: return false; case GIT_DELTA_MODIFIED: if (!FLAG_SET(opts, GIT_DIFF_FIND_REWRITES) && !FLAG_SET(opts, GIT_DIFF_FIND_RENAMES_FROM_REWRITES)) return false; if (calc_self_similarity(diff, opts, delta_idx, cache) < 0) return false; if (FLAG_SET(opts, GIT_DIFF_BREAK_REWRITES) && delta->similarity < opts->break_rewrite_threshold) { delta->flags |= GIT_DIFF_FLAG__TO_SPLIT; break; } if (FLAG_SET(opts, GIT_DIFF_FIND_RENAMES_FROM_REWRITES) && delta->similarity < opts->rename_from_rewrite_threshold) break; return false; case GIT_DELTA_UNTRACKED: if (!FLAG_SET(opts, GIT_DIFF_FIND_FOR_UNTRACKED)) return false; break; case GIT_DELTA_IGNORED: return false; default: /* all other status values should be checked */ break; } delta->flags |= GIT_DIFF_FLAG__IS_RENAME_TARGET; return true; }
false
false
false
true
false
1
check_sel_direction(char *dir, char *label, char *sel, int len) { int db = 0, ok = 1; if (debug_sel) { db = 1; } if (sel_direction) { if (strstr(sel_direction, "debug")) { db = 1; } if (strcmp(sel_direction, "debug")) { if (strstr(sel_direction, dir) == NULL) { ok = 0; } } } if (db) { char str[40]; int n = 40; strncpy(str, sel, n); str[n-1] = '\0'; if (len < n) { str[len] = '\0'; } rfbLog("%s: '%s'\n", label, str); if (ok) { rfbLog("%s: %s-ing it.\n", label, dir); } else { rfbLog("%s: NOT %s-ing it.\n", label, dir); } } return ok; }
false
false
false
false
false
0
cb_param(const char *name, const char *value, void *void_arg) { mail::Header::mime *a=(mail::Header::mime *)void_arg; string n=name; mail::upper(n); if (!a->parameters.exists(name)) a->parameters.set_simple(name, value); }
false
false
false
false
false
0
H5FD_locate_signature(H5FD_t *file, const H5P_genplist_t *dxpl, haddr_t *sig_addr) { haddr_t addr, eoa; uint8_t buf[H5F_SIGNATURE_LEN]; unsigned n, maxpow; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Find the least N such that 2^N is larger than the file size */ if(HADDR_UNDEF == (addr = H5FD_get_eof(file)) || HADDR_UNDEF == (eoa = H5FD_get_eoa(file, H5FD_MEM_SUPER))) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to obtain EOF/EOA value") for(maxpow = 0; addr; maxpow++) addr >>= 1; maxpow = MAX(maxpow, 9); /* * Search for the file signature at format address zero followed by * powers of two larger than 9. */ for(n = 8; n < maxpow; n++) { addr = (8 == n) ? 0 : (haddr_t)1 << n; if(H5FD_set_eoa(file, H5FD_MEM_SUPER, addr + H5F_SIGNATURE_LEN) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to set EOA value for file signature") if(H5FD_read(file, dxpl, H5FD_MEM_SUPER, addr, (size_t)H5F_SIGNATURE_LEN, buf) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to read file signature") if(!HDmemcmp(buf, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN)) break; } /* end for */ /* * If the signature was not found then reset the EOA value and return * HADDR_UNDEF. */ if(n >= maxpow) { if(H5FD_set_eoa(file, H5FD_MEM_SUPER, eoa) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to reset EOA value") *sig_addr = HADDR_UNDEF; } /* end if */ else /* Set return value */ *sig_addr = addr; done: FUNC_LEAVE_NOAPI(ret_value) }
false
false
false
false
false
0
se_PauseGameTimer(bool p){ if (se_mainGameTimer && sn_GetNetState()!=nCLIENT) se_mainGameTimer->pause(p); }
false
false
false
false
false
0
unity_tester_series_preview_renderer_update_child_preview (UnityTesterSeriesPreviewRenderer* self, UnityProtocolPreview* child_preview) { UnityProtocolPreview* _tmp0_ = NULL; UnityProtocolPreview* _tmp1_ = NULL; UnityProtocolPreview* _tmp2_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (child_preview != NULL); _tmp0_ = unity_tester_preview_renderer_get_preview ((UnityTesterPreviewRenderer*) self); _tmp1_ = _tmp0_; _tmp2_ = child_preview; unity_protocol_series_preview_set_child_preview (G_TYPE_CHECK_INSTANCE_TYPE (_tmp1_, UNITY_PROTOCOL_TYPE_SERIES_PREVIEW) ? ((UnityProtocolSeriesPreview*) _tmp1_) : NULL, _tmp2_); }
false
false
false
false
false
0
del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev) { PRINT_D(HOSTAPD_DBG, "Deleting virtual interface\n"); return 0; }
false
false
false
false
false
0
readConfFile(char *conffile, struct arguments *parser) { char *data; char *key; FILE *conf; size_t size; int c, n, u, l, d, e; n = u = l = d = e = -2; c = 1; data = malloc(MAXLINE + 1); size = MAXLINE - 1; conf = fopen(conffile, "r"); if (!conf) { fprintf(stderr, "Unable to open %s\n", conffile); return(-1); } else { while ((getline(&data, &size, conf)) != -1) { if (data == NULL) break; /* Strip the conffile from the newlines and the ';' */ data = strsep(&data, "\n;"); key = strsep(&data,"="); if (!strcmp(key, "COUNT")) c=atoi(data); if (!strcmp(key,"DIGIT")) d=atoi(data); if (!strcmp(key,"LOWER")) l=atoi(data); if (!strcmp(key,"UPPER")) u=atoi(data); if (!strcmp(key,"EXTRA")) e=atoi(data); if (!strcmp(key,"LENGTH")) n=atoi(data); /* Use this seed option in the config file with care */ if (!strcmp(key,"SEED")) { parser->seed=atoi(data); verbose("seed = %d\n",parser->seed); } } fclose(conf); parser->count=c; parser->lower=l; parser->upper=u; parser->digits=d; parser->extras=e; parser->length=n; return(0); } }
false
false
false
false
false
0
degrees_to_dms_pr(char *lb, double deg, int prec) { int d1, d2, d3, d4; char fbuf[32]; if (prec > 9) prec = 9; if (prec < 0) prec = 0; if (deg > 0) deg += precs[prec] / 7200; else deg -= precs[prec] / 7200; // d3_printf("format is %s\n", fbuf); if (deg >= 0.0) { d1 = floor (deg); deg = (deg - d1) * 60.0; d2 = floor (deg); deg = ((deg - d2) * 60.0); d3 = floor(deg); if (prec == 0) sprintf(lb, "%02d:%02d:%02d", d1, d2, d3); else { deg = ((deg - d3) / precs[prec]); d4 = floor(deg); sprintf(fbuf, "%%02d:%%02d:%%02d.%%0%dd", prec); sprintf(lb, fbuf, d1, d2, d3, d4); } } else { deg = -deg; d1 = floor (deg); deg = (deg - d1) * 60.0; d2 = floor (deg); deg = ((deg - d2) * 60.0); d3 = floor(deg); if (prec == 0) sprintf(lb, "-%02d:%02d:%02d", d1, d2, d3); else { deg = ((deg - d3) / precs[prec]); d4 = floor(deg); sprintf(fbuf, "-%%02d:%%02d:%%02d.%%0%dd", prec); sprintf(lb, fbuf, d1, d2, d3, d4); } } // d3_printf("into %s\n", lb); }
false
false
false
false
false
0
test_authenticate_compat (Test *test, gconstpointer unused) { GckUriData *uri_data; GError *error = NULL; GckEnumerator *en; GckObject *obj; gulong sig; sig = g_signal_connect (test->modules->data, "authenticate-slot", G_CALLBACK (on_authenticate_token), GUINT_TO_POINTER (35)); uri_data = gck_uri_data_new (); en = _gck_enumerator_new_for_modules (test->modules, GCK_SESSION_LOGIN_USER, uri_data); g_assert (GCK_IS_ENUMERATOR (en)); g_object_add_weak_pointer (G_OBJECT (en), (gpointer *)&en); obj = gck_enumerator_next (en, NULL, &error); g_assert (GCK_IS_OBJECT (obj)); g_object_add_weak_pointer (G_OBJECT (obj), (gpointer *)&obj); g_object_unref (obj); g_object_unref (en); g_signal_handler_disconnect (test->modules->data, sig); g_assert (obj == NULL); g_assert (en == NULL); }
false
false
false
false
false
0
getframebits(const lame_global_flags * gfp) { lame_internal_flags const *const gfc = gfp->internal_flags; int bit_rate; /* get bitrate in kbps [?] */ if (gfc->bitrate_index) bit_rate = bitrate_table[gfp->version][gfc->bitrate_index]; else bit_rate = gfp->brate; /*assert(bit_rate <= 550); */ assert(8 <= bit_rate && bit_rate <= 640); /* main encoding routine toggles padding on and off */ /* one Layer3 Slot consists of 8 bits */ return 8 * ((gfp->version + 1) * 72000 * bit_rate / gfp->out_samplerate + gfc->padding); }
false
false
false
false
false
0
_match_list(const char *exec, const char *const *argv, const char *pidfile) { RC_STRINGLIST *match = rc_stringlist_new(); int i = 0; size_t l; char *m; if (exec) { l = strlen(exec) + 6; m = xmalloc(sizeof(char) * l); snprintf(m, l, "exec=%s", exec); rc_stringlist_add(match, m); free(m); } while (argv && argv[i]) { l = strlen(*argv) + strlen("argv_=") + 16; m = xmalloc(sizeof(char) * l); snprintf(m, l, "argv_0=%s", argv[i++]); rc_stringlist_add(match, m); free(m); } if (pidfile) { l = strlen(pidfile) + 9; m = xmalloc(sizeof(char) * l); snprintf(m, l, "pidfile=%s", pidfile); rc_stringlist_add(match, m); free(m); } return match; }
false
false
false
false
false
0
from_n_nary(C_char *str, int base, double *r) { double n = 0; C_char *ptr = str; while(*ptr != '\0') { int c = C_tolower((int)(*(ptr++))); if(c < '0') return 0; else if(c >= '0' + base) { if(base < 10) return 0; else if(c < 'a') return 0; else if(c >= 'a' + base - 10) return 0; else n = n * base + c - 'a' + 10; } else n = n * base + c - '0'; } *r = n; return 1; }
false
false
false
false
false
0
protect( const Functor &functor, const ProtectorContext &context ) { try { return functor(); } catch ( Exception &failure ) { reportFailure( context, failure ); } catch ( std::exception &e ) { std::string shortDescription( "uncaught exception of type " ); #if CPPUNIT_USE_TYPEINFO_NAME shortDescription += TypeInfoHelper::getClassName( typeid(e) ); #else shortDescription += "std::exception (or derived)."; #endif Message message( shortDescription, e.what() ); reportError( context, message ); } catch ( ... ) { reportError( context, Message( "uncaught exception of unknown type") ); } return false; }
false
false
false
false
false
0
Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) { if ((lenMixed == 1) && (sizeFolded > 0)) { folded[0] = mapping[static_cast<unsigned char>(mixed[0])]; return 1; } else { gchar *mapped = g_utf8_casefold(mixed, lenMixed); size_t lenMapped = strlen(mapped); if (lenMapped < sizeFolded) { memcpy(folded, mapped, lenMapped); } else { lenMapped = 0; } g_free(mapped); return lenMapped; } } }
false
false
false
false
false
0
printBetting( const Game *game, const State *state, const int maxLen, char *string ) { int i, a, c, r; c = 0; for( i = 0; i <= state->round; ++i ) { /* print state separator */ if( i != 0 ) { if( c >= maxLen ) { return -1; } string[ c ] = '/'; ++c; } /* print betting for round */ for( a = 0; a < state->numActions[ i ]; ++a ) { r = printAction( game, &state->action[ i ][ a ], maxLen - c, &string[ c ] ); if( r < 0 ) { return -1; } c += r; } } if( c >= maxLen ) { return -1; } string[ c ] = 0; return c; }
false
false
false
false
false
0
_clear_cover_transitions(GList *covers) { GList *iter = covers; while (iter) { ClarityCover *ccover = iter->data; clutter_actor_remove_all_transitions(CLUTTER_ACTOR(ccover)); iter = iter->next; } }
false
false
false
false
false
0
abort_conflicting_lock_requests(void) { MDL_ticket *ticket; MDL_lock::Ticket_iterator it; mysql_prlock_wrlock(&m_rwlock); it.init(m_granted); while ((ticket= it++)) if (ticket->get_abort_conflicting_lock_requests()) break; if (ticket) { it.init(m_waiting); while ((ticket= it++)) ticket->get_ctx()->m_wait.set_status(MDL_wait::ABORTED); } mysql_prlock_unlock(&m_rwlock); }
false
false
false
false
false
0
add_frame(uint32_t pc_, uint16_t *sp_, uint8_t nlocals, uint8_t nargs, uint16_t where) { ZASSERT(fp != TOP_OF_FRAMES, "call stack too deep: %ld", NFRAMES + 1); fp->pc = pc_; fp->sp = sp_; fp->nlocals = nlocals; fp->nargs = nargs; fp->where = where; fp++; }
false
false
false
false
false
0
elm_segment_control_item_label_get(const Evas_Object *obj, int idx) { Elm_Segment_Item *it; ELM_SEGMENT_CONTROL_CHECK(obj) NULL; it = _item_find(obj, idx); if (it) return it->label; return NULL; }
false
false
false
false
false
0
pack_if(action* a,buffer *b) { grib_int_t val1 = a->reference->value; grib_int_t val2 = atol(a->ksec1); if(a->test(val1,val2)) encode(a->next,b); return a->end->next; }
false
false
false
false
false
0
do_slotempty(void) { int n; struct doslot *pdos; /* * Find a slot that is empty and not reserved (due to frecvfront()). */ for (n = DOSLOTCNT, pdos = doslots; (n > 0) && ((pdos->dos_link != NOTLINKID) || (pdos->dos_flags & DORESERVED)); --n, ++pdos); if (n <= 0) return(0); pdos->dos_flags = DORESERVED; return(pdos); }
false
false
false
false
false
0
direct_gettid( void ) { pid_t tid = -1; #if DIRECT_BUILD_GETTID && defined(__NR_gettid) /* present on linux >= 2.4.20 */ tid = syscall(__NR_gettid); #endif if (tid < 0) tid = getpid(); return tid; }
false
false
false
false
false
0
gst_ogg_mux_make_fisbone (GstOggMux * mux, ogg_stream_state * os, GstOggPadData * pad) { GstByteWriter bw; gboolean handled = TRUE; GST_DEBUG_OBJECT (mux, "Creating %s fisbone for serial %08x", gst_ogg_stream_get_media_type (&pad->map), pad->map.serialno); gst_byte_writer_init (&bw); handled &= gst_byte_writer_put_string_utf8 (&bw, "fisbone"); handled &= gst_byte_writer_put_int32_le (&bw, 44); /* offset to message headers */ handled &= gst_byte_writer_put_uint32_le (&bw, pad->map.serialno); handled &= gst_byte_writer_put_uint32_le (&bw, pad->map.n_header_packets); handled &= gst_byte_writer_put_uint64_le (&bw, pad->map.granulerate_n); handled &= gst_byte_writer_put_uint64_le (&bw, pad->map.granulerate_d); handled &= gst_byte_writer_put_uint64_le (&bw, 0); /* base granule */ handled &= gst_byte_writer_put_uint32_le (&bw, pad->map.preroll); handled &= gst_byte_writer_put_uint8 (&bw, pad->map.granuleshift); handled &= gst_byte_writer_fill (&bw, 0, 3); /* padding */ /* message header fields - MIME type for now */ gst_ogg_mux_add_fisbone_message_header (mux, &bw, "Content-Type", gst_ogg_stream_get_media_type (&pad->map)); gst_ogg_mux_add_fisbone_message_header (mux, &bw, "Role", gst_ogg_mux_get_default_role (pad)); gst_ogg_mux_add_fisbone_message_header_from_tags (mux, &bw, "Language", GST_TAG_LANGUAGE_CODE, pad->tags); gst_ogg_mux_add_fisbone_message_header_from_tags (mux, &bw, "Title", GST_TAG_TITLE, pad->tags); if (G_UNLIKELY (!handled)) GST_WARNING_OBJECT (mux, "Error writing fishbon"); gst_ogg_mux_submit_skeleton_header_packet (mux, os, gst_byte_writer_reset_and_get_buffer (&bw), 0, 0); }
false
false
false
false
false
0
on_whole_project_toggled(GtkToggleButton* project, CVSPlugin *plugin) { GtkEntry* fileentry = g_object_get_data (G_OBJECT (project), "fileentry"); if (gtk_toggle_button_get_active(project) && plugin->project_root_dir) { gtk_entry_set_text (fileentry, plugin->project_root_dir); gtk_widget_set_sensitive(GTK_WIDGET(fileentry), FALSE); } else gtk_widget_set_sensitive(GTK_WIDGET(fileentry), TRUE); }
false
false
false
false
false
0
lm_loopLog(void* param) { CALastMix* pLastMix=(CALastMix*)param; pLastMix->m_bRunLog=true; UINT32 countLog=0; UINT8 buff[256]; while(pLastMix->m_bRunLog) { if((countLog%10)==0) { logMemoryUsage(); } if(countLog==0) { CAMsg::printMsg(LOG_DEBUG,"Uploaded Packets: %u\n",pLastMix->m_logUploadedPackets); CAMsg::printMsg(LOG_DEBUG,"Downloaded Packets: %u\n",pLastMix->m_logDownloadedPackets); print64(buff,(UINT64&)pLastMix->m_logUploadedBytes); CAMsg::printMsg(LOG_DEBUG,"Uploaded Bytes : %s\n",buff); print64(buff,(UINT64&)pLastMix->m_logDownloadedBytes); CAMsg::printMsg(LOG_DEBUG,"Downloaded Bytes : %s\n",buff); countLog=30; } sSleep(30); countLog--; } THREAD_RETURN_SUCCESS; }
false
false
false
false
false
0
select_info( const CORE::DATA_INFO_LIST& list_info ) { get_selection()->unselect_all(); CORE::DATA_INFO_LIST::const_iterator it = list_info.begin(); for( ; it != list_info.end(); ++it ){ Gtk::TreePath path( ( *it ).path ); get_selection()->select( path ); } }
false
false
false
false
false
0
make_node_dirty(struct ubifs_info *c, int node_type, int node_num, int lnum, int offs) { switch (node_type) { case UBIFS_LPT_NNODE: return make_nnode_dirty(c, node_num, lnum, offs); case UBIFS_LPT_PNODE: return make_pnode_dirty(c, node_num, lnum, offs); case UBIFS_LPT_LTAB: return make_ltab_dirty(c, lnum, offs); case UBIFS_LPT_LSAVE: return make_lsave_dirty(c, lnum, offs); } return -EINVAL; }
false
false
false
false
false
0
isl_args_set_defaults(struct isl_args *args, void *opt) { int i; for (i = 0; args->args[i].type != isl_arg_end; ++i) { switch (args->args[i].type) { case isl_arg_choice: set_default_choice(&args->args[i], opt); break; case isl_arg_flags: set_default_flags(&args->args[i], opt); break; case isl_arg_bool: set_default_bool(&args->args[i], opt); break; case isl_arg_child: set_default_child(&args->args[i], opt); break; case isl_arg_user: set_default_user(&args->args[i], opt); break; case isl_arg_int: set_default_int(&args->args[i], opt); break; case isl_arg_long: set_default_long(&args->args[i], opt); break; case isl_arg_ulong: set_default_ulong(&args->args[i], opt); break; case isl_arg_arg: case isl_arg_str: set_default_str(&args->args[i], opt); break; case isl_arg_str_list: set_default_str_list(&args->args[i], opt); break; case isl_arg_alias: case isl_arg_footer: case isl_arg_version: case isl_arg_end: break; } } }
false
false
false
false
false
0
dbdatlen(DBPROCESS * dbproc, int column) { DBINT len; TDSCOLUMN *colinfo; tdsdump_log(TDS_DBG_FUNC, "dbdatlen(%p, %d)\n", dbproc, column); CHECK_PARAMETER(dbproc, SYBENULL, -1); colinfo = dbcolptr(dbproc, column); if (!colinfo) return -1; len = (colinfo->column_cur_size < 0)? 0 : colinfo->column_cur_size; tdsdump_log(TDS_DBG_FUNC, "dbdatlen() type = %d, len= %d\n", colinfo->column_type, len); return len; }
false
false
false
false
false
0
log_done(void) { /* * Handle possible recursion: * log_*() -> ... -> pexit() -> ... -> log_done() */ if (in_logger) return; in_logger = 1; log_file_done(&log, !options.fork); log_file_done(&pot, 1); in_logger = 0; }
false
false
false
false
false
0
preen(char *s) { char buffer[128]; char *suffixes[] = {"n", "v", "a", "t"}; int i; for (i=0; i<4; i++) { strcpy(buffer, s); strcat(buffer, suffixes[i]); add_deletion(buffer); } }
true
true
false
false
false
1
gt215_hda_eld(NV50_DISP_MTHD_V1) { struct nvkm_device *device = disp->base.engine.subdev.device; union { struct nv50_disp_sor_hda_eld_v0 v0; } *args = data; const u32 soff = outp->or * 0x800; int ret, i; nvif_ioctl(object, "disp sor hda eld size %d\n", size); if (nvif_unpack(args->v0, 0, 0, true)) { nvif_ioctl(object, "disp sor hda eld vers %d\n", args->v0.version); if (size > 0x60) return -E2BIG; } else return ret; if (size && args->v0.data[0]) { if (outp->info.type == DCB_OUTPUT_DP) { nvkm_mask(device, 0x61c1e0 + soff, 0x8000000d, 0x80000001); nvkm_msec(device, 2000, u32 tmp = nvkm_rd32(device, 0x61c1e0 + soff); if (!(tmp & 0x80000000)) break; ); } for (i = 0; i < size; i++) nvkm_wr32(device, 0x61c440 + soff, (i << 8) | args->v0.data[i]); for (; i < 0x60; i++) nvkm_wr32(device, 0x61c440 + soff, (i << 8)); nvkm_mask(device, 0x61c448 + soff, 0x80000003, 0x80000003); } else { if (outp->info.type == DCB_OUTPUT_DP) { nvkm_mask(device, 0x61c1e0 + soff, 0x80000001, 0x80000000); nvkm_msec(device, 2000, u32 tmp = nvkm_rd32(device, 0x61c1e0 + soff); if (!(tmp & 0x80000000)) break; ); } nvkm_mask(device, 0x61c448 + soff, 0x80000003, 0x80000000 | !!size); } return 0; }
false
false
false
false
false
0
rt5631_hifi_pcm_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { struct snd_soc_codec *codec = dai->codec; struct rt5631_priv *rt5631 = snd_soc_codec_get_drvdata(codec); int timesofbclk = 32, coeff; unsigned int iface = 0; dev_dbg(codec->dev, "enter %s\n", __func__); rt5631->bclk_rate = snd_soc_params_to_bclk(params); if (rt5631->bclk_rate < 0) { dev_err(codec->dev, "Fail to get BCLK rate\n"); return rt5631->bclk_rate; } rt5631->rx_rate = params_rate(params); if (rt5631->master) coeff = get_coeff(rt5631->sysclk, rt5631->rx_rate, rt5631->bclk_rate / rt5631->rx_rate); else coeff = get_coeff(rt5631->sysclk, rt5631->rx_rate, timesofbclk); if (coeff < 0) { dev_err(codec->dev, "Fail to get coeff\n"); return coeff; } switch (params_width(params)) { case 16: break; case 20: iface |= RT5631_SDP_I2S_DL_20; break; case 24: iface |= RT5631_SDP_I2S_DL_24; break; case 8: iface |= RT5631_SDP_I2S_DL_8; break; default: return -EINVAL; } snd_soc_update_bits(codec, RT5631_SDP_CTRL, RT5631_SDP_I2S_DL_MASK, iface); snd_soc_write(codec, RT5631_STEREO_AD_DA_CLK_CTRL, coeff_div[coeff].reg_val); return 0; }
false
false
false
false
false
0
EnvisatFile_SetKeyValueAsDouble( EnvisatFile *self, EnvisatFile_HeaderFlag mph_or_sph, const char *key, double value ) { char format[32], string_value[128]; const char *prototype_value; int length; prototype_value = EnvisatFile_GetKeyValueAsString( self, mph_or_sph, key, NULL); if( prototype_value == NULL ) { char error_buf[2048]; sprintf( error_buf, "Unable to set header field \"%s\", field not found.", key ); SendError( error_buf ); return FAILURE; } length = strlen(prototype_value); if( prototype_value[length-4] == 'E' ) { sprintf( format, "%%+%dE", length-4 ); sprintf( string_value, format, value ); } else { int decimals = 0, i; for( i = length-1; i > 0; i-- ) { if( prototype_value[i] == '.' ) break; decimals++; } sprintf( format, "%%+0%d.%df", length, decimals ); sprintf( string_value, format, value ); if( (int)strlen(string_value) > length ) string_value[length] = '\0'; } return EnvisatFile_SetKeyValueAsString( self, mph_or_sph, key, string_value ); }
true
true
false
false
true
1
getNumPoints(uint64_t max_id) const { size_t retval = 0; for (ScanGraph::const_iterator it = this->begin(); it != this->end(); it++) { retval += (*it)->scan->size(); if ((max_id > 0) && ((*it)->id == max_id)) break; } return retval; }
false
false
false
false
false
0
eval_trap_action(interp,sig,trap,oldcode) Tcl_Interp *interp; int sig; struct trap *trap; int oldcode; { int code_flag; int newcode; Tcl_Obj *eip; /* errorInfo */ Tcl_Obj *ecp; /* errorCode */ Tcl_Obj *irp; /* interp's result */ expDiagLogU("async event handler: Tcl_Eval("); expDiagLogU(trap->action); expDiagLogU(")\r\n"); /* save to prevent user from redefining trap->code while trap */ /* is executing */ code_flag = trap->code; if (!code_flag) { /* * save return values */ eip = Tcl_GetVar2Ex(interp,"errorInfo","",TCL_GLOBAL_ONLY); if (eip) eip = Tcl_DuplicateObj(eip); ecp = Tcl_GetVar2Ex(interp,"errorCode","",TCL_GLOBAL_ONLY); if (ecp) ecp = Tcl_DuplicateObj(ecp); irp = Tcl_GetObjResult(interp); if (irp) irp = Tcl_DuplicateObj(irp); } newcode = Tcl_GlobalEval(interp,trap->action); /* * if new code is to be ignored (usual case - see "else" below) * allow only OK/RETURN from trap, otherwise complain */ if (code_flag) { expDiagLog("return value = %d for trap %s, action ",newcode,signal_to_string(sig)); expDiagLogU(trap->action); expDiagLogU("\r\n"); if (0 != strcmp(Tcl_GetStringResult(interp),"")) { /* * Check errorinfo and see if it contains -nostack. * This shouldn't be necessary, but John changed the * top level interp so that it distorts arbitrary * return values into TCL_ERROR, so by the time we * get back, we'll have lost the value of errorInfo */ eip = Tcl_GetVar2Ex(interp,"errorInfo","",TCL_GLOBAL_ONLY); if (eip) { exp_nostack_dump = (0 == strncmp("-nostack",Tcl_GetString(eip),8)); } } } else if (newcode != TCL_OK && newcode != TCL_RETURN) { if (newcode != TCL_ERROR) { exp_error(interp,"return value = %d for trap %s, action %s\r\n",newcode,signal_to_string(sig),trap->action); } Tcl_BackgroundError(interp); } if (!code_flag) { /* * restore values */ Tcl_ResetResult(interp); /* turns off Tcl's internal */ /* flags: ERR_IN_PROGRESS, ERROR_CODE_SET */ /* This also wipes clean errorInfo/Code/result which is why */ /* all the calls to Tcl_Dup earlier */ if (eip) { /* odd that Tcl doesn't have a call that does all this at once */ int len; char *s = Tcl_GetStringFromObj(eip,&len); Tcl_AddObjErrorInfo(interp,s,len); Tcl_DecrRefCount(eip); /* we never incr'd it, but the code allows this */ } else { Tcl_UnsetVar(interp,"errorInfo",0); } /* restore errorCode. Note that Tcl_AddErrorInfo (above) */ /* resets it to NONE. If the previous value is NONE, it's */ /* important to avoid calling Tcl_SetErrorCode since this */ /* with cause Tcl to set its internal ERROR_CODE_SET flag. */ if (ecp) { if (!streq("NONE",Tcl_GetString(ecp))) Tcl_SetErrorCode(interp,ecp); /* we're just passing on the errorcode obj */ /* presumably, Tcl will incr ref count */ } else { Tcl_UnsetVar(interp,"errorCode",0); } newcode = oldcode; /* note that since newcode gets overwritten here by old code */ /* it is possible to return in the middle of a trap by using */ /* "return" (or "continue" for that matter)! */ } return newcode; }
false
false
false
false
false
0
cc_generic_agent_stop_offer_timer(struct ast_cc_agent *agent) { struct cc_generic_agent_pvt *generic_pvt = agent->private_data; if (generic_pvt->offer_timer_id != -1) { if (!ast_sched_del(cc_sched_context, generic_pvt->offer_timer_id)) { cc_unref(agent, "Remove scheduler's reference to the agent"); } generic_pvt->offer_timer_id = -1; } return 0; }
false
false
false
false
false
0
map_set_region(map_t *map, int x, int y) { int new_tile_region = REGION_NONE; tile_t *tile = MAP_TILE(map, x, y); for (int d = 0; d < 4; d++) { tile_t *ntile = tile + map->dir[d]; if (ntile->region == REGION_NONE) continue; if (new_tile_region != REGION_NONE && new_tile_region != ntile->region) { map_changeregion(map, ntile->region, new_tile_region); } else { new_tile_region = ntile->region; } } if (new_tile_region == REGION_NONE) new_tile_region = map->next_region++; tile->region = new_tile_region; }
false
false
false
false
false
0
happen_line_conflict(int assign_dlg, int pre_dlg, int dlg_num, int cuff) { if (pre_dlg == 1) if (assign_dlg == dlg_num || assign_dlg == pre_dlg + 1) return TRUE; if (pre_dlg == dlg_num) if (assign_dlg == 1 || assign_dlg == dlg_num - 1) return TRUE; if (pre_dlg < assign_dlg) { if (abs(assign_dlg - pre_dlg) >= cuff) return FALSE; } return FALSE; }
false
false
false
false
false
0
isAtEnd() const { return m_currentItem >= 0 && m_history.size() - 1; }
false
false
false
false
false
0
mymunmap (MMAP *m) { if (munmap(m->addr,m->len)==-1) { perror("munmap 1:"); } close(m->fd); return 0; }
false
false
false
false
false
0
main(int argc, char *argv[]) { GOptionContext *context; GError *error = NULL; struct sigaction sa; int index = 0; context = g_option_context_new(NULL); g_option_context_add_main_entries(context, options, NULL); if (g_option_context_parse(context, &argc, &argv, &error) == FALSE) { if (error != NULL) { g_printerr("%s\n", error->message); g_error_free(error); } else g_printerr("An unknown error occurred\n"); exit(1); } g_option_context_free(context); resolv = g_resolv_new(index); if (resolv == NULL) { g_printerr("Failed to create resolver\n"); return 1; } if (option_debug == TRUE) g_resolv_set_debug(resolv, resolv_debug, "RESOLV"); main_loop = g_main_loop_new(NULL, FALSE); if (argc > 1) { int i; for (i = 1; i < argc; i++) g_resolv_add_nameserver(resolv, argv[i], 53, 0); } else g_resolv_add_nameserver(resolv, "127.0.0.1", 53, 0); timer = g_timer_new(); start_wpad(option_search); g_free(option_search); memset(&sa, 0, sizeof(sa)); sa.sa_handler = sig_term; sigaction(SIGINT, &sa, NULL); sigaction(SIGTERM, &sa, NULL); g_main_loop_run(main_loop); g_timer_destroy(timer); g_resolv_unref(resolv); g_main_loop_unref(main_loop); return 0; }
false
false
false
false
false
0
partno(struct mail_bodystruct *body, struct mail_bodystruct *end_body) { PART *part; int num = 0; char tmp[64], *p = NULL; if(body && body->type == TYPEMULTIPART) { part = body->nested.part; /* first body part */ do { /* for each part */ num++; if(&part->body == end_body || (p = partno(&part->body, end_body))){ snprintf(tmp, sizeof(tmp), "%d%s%.*s", num, (p) ? "." : "", sizeof(tmp)-10, (p) ? p : ""); tmp[sizeof(tmp)-1] = '\0'; if(p) fs_give((void **)&p); return(cpystr(tmp)); } } while ((part = part->next) != NULL); /* until done */ return(NULL); } else if(body && body->type == TYPEMESSAGE && body->subtype && !strucmp(body->subtype, "rfc822")){ return(partno(body->nested.msg->body, end_body)); } return((body == end_body) ? cpystr("1") : NULL); }
true
true
false
false
false
1
gst_flac_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame) { GstFlacParse *flacparse = GST_FLAC_PARSE (parse); /* Push tags */ if (flacparse->tags) { gst_element_found_tags (GST_ELEMENT (flacparse), flacparse->tags); flacparse->tags = NULL; } frame->flags |= GST_BASE_PARSE_FRAME_FLAG_CLIP; return GST_FLOW_OK; }
false
false
false
false
false
0
extractItems(const char *filesPath, const Package &listPkg, char outType) { const Item *pItem; int32_t i; for(pItem=listPkg.items, i=0; i<listPkg.itemCount; ++pItem, ++i) { extractItems(filesPath, pItem->name, outType); } }
false
false
false
false
false
0
_gth_image_free_data (GthImage *self) { switch (self->priv->format) { case GTH_IMAGE_FORMAT_CAIRO_SURFACE: cairo_surface_destroy (self->priv->data.surface); self->priv->data.surface = NULL; break; case GTH_IMAGE_FORMAT_GDK_PIXBUF: _g_object_unref (self->priv->data.pixbuf); self->priv->data.pixbuf = NULL; break; case GTH_IMAGE_FORMAT_GDK_PIXBUF_ANIMATION: _g_object_unref (self->priv->data.pixbuf_animation); self->priv->data.pixbuf_animation = NULL; break; default: break; } }
false
false
false
false
false
0
SECU_StripTagAndLength(SECItem *i) { unsigned int start; if (!i || !i->data || i->len < 2) { /* must be at least tag and length */ return SECFailure; } start = ((i->data[1] & 0x80) ? (i->data[1] & 0x7f) + 2 : 2); if (i->len < start) { return SECFailure; } i->data += start; i->len -= start; return SECSuccess; }
false
false
false
false
false
0
add_ipoint1(struct seg_intersection_list *il, int with, double dist, int ip) { struct seg_intersection *s; if (il->count == il->allocated) { il->allocated += 4; il->a = G_realloc(il->a, (il->allocated) * sizeof(struct seg_intersection)); } s = &(il->a[il->count]); s->with = with; s->ip = ip; s->dist = dist; il->count++; return; }
false
false
false
false
false
0
InSubTree() { if (this->PassSelf || this->IsDoneWithTraversal()) { return false; } if (!this->ChildIterator) { return false; } if (this->ChildIterator->PassSelf) { return false; } return true; }
false
false
false
false
false
0
BO_AddrToCodeObjTag (Word_t pc) { bigobj_region_t *region; aid_t aid; aid = ADDR_TO_PAGEID(BIBOP, pc); if (IS_BIGOBJ_AID(aid)) { int indx = BIBOP_ADDR_TO_INDEX(pc); while (!BO_IS_HDR(aid)) aid = BIBOP[--indx]; region = (bigobj_region_t *)BIBOP_INDEX_TO_ADDR(indx); return BO_GetCodeObjTag (ADDR_TO_BODESC(region, pc)); } else return NIL(Byte_t *); }
false
false
false
false
false
0
get_highest_rate_idx(u32 mask) { int i; unsigned char rate_idx = 0; for (i = 27; i >= 0; i--) { if (mask & BIT(i)) { rate_idx = i; break; } } return rate_idx; }
false
false
false
false
false
0
gst_video_encoder_get_oldest_frame (GstVideoEncoder * encoder) { GstVideoCodecFrame *frame = NULL; GST_VIDEO_ENCODER_STREAM_LOCK (encoder); if (encoder->priv->frames) frame = gst_video_codec_frame_ref (encoder->priv->frames->data); GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder); return (GstVideoCodecFrame *) frame; }
false
false
false
false
false
0
vcpu_mmio_read(struct kvm_vcpu *vcpu, gpa_t addr, int len, void *v) { int handled = 0; int n; do { n = min(len, 8); if (!(vcpu->arch.apic && !kvm_iodevice_read(vcpu, &vcpu->arch.apic->dev, addr, n, v)) && kvm_io_bus_read(vcpu, KVM_MMIO_BUS, addr, n, v)) break; trace_kvm_mmio(KVM_TRACE_MMIO_READ, n, addr, v); handled += n; addr += n; len -= n; v += n; } while (len); return handled; }
false
false
false
false
false
0
icg_show_gui (GnmIOContextGtk *icg) { GtkBox *box; GtkWidget *frame; box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 0)); if (icg->show_splash) { GdkPixbuf *pixbuf = go_gdk_pixbuf_load_from_file ("res:gnm:pixmaps/gnumeric_splash_1.4.png"); gtk_box_pack_start (box, gtk_image_new_from_pixbuf (pixbuf), TRUE, FALSE, 0); g_object_unref (pixbuf); } /* Don't show this unless we need it. */ if (icg->files_total > 1) { double f = icg->files_done / (double)icg->files_total; icg->file_bar = GTK_PROGRESS_BAR (g_object_new (GTK_TYPE_PROGRESS_BAR, "text", "Files", "show-text", TRUE, "fraction", f, "inverted", FALSE, NULL)); gtk_box_pack_start (box, GTK_WIDGET (icg->file_bar), FALSE, FALSE, 0); } icg->work_bar = GTK_PROGRESS_BAR (g_object_new (GTK_TYPE_PROGRESS_BAR, "inverted", FALSE, "text", icg->progress_msg, "show-text", TRUE, "fraction", icg->progress, NULL)); gtk_box_pack_start (box, GTK_WIDGET (icg->work_bar), FALSE, FALSE, 0); icg->window = GTK_WINDOW (gtk_window_new (GTK_WINDOW_TOPLEVEL)); gtk_window_set_type_hint (GTK_WINDOW (icg->window), GDK_WINDOW_TYPE_HINT_SPLASHSCREEN); g_signal_connect (G_OBJECT (icg->window), "button_release_event", G_CALLBACK (cb_hide_splash), NULL); g_signal_connect (G_OBJECT (icg->window), "destroy", G_CALLBACK (cb_icg_window_destroyed), icg); frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT); gtk_container_add (GTK_CONTAINER (frame), GTK_WIDGET (box)); gtk_container_add (GTK_CONTAINER (icg->window), frame); g_signal_connect (G_OBJECT (icg->window), "realize", G_CALLBACK (cb_realize), NULL); if (icg->parent_window) gnm_io_context_gtk_set_transient_for (icg, icg->parent_window); gtk_widget_show_all (GTK_WIDGET (icg->window)); }
false
false
false
false
false
0
xputs(str) const char *str; { int len; len=xfputs(str, stdout); if (len<0) return EOF; putchar('\n'); return len+1; }
false
false
false
false
false
0
__indirect_glDeleteLists(GLuint list, GLsizei range) { struct glx_context * const gc = __glXGetCurrentContext(); Display * const dpy = gc->currentDpy; #ifndef USE_XCB const GLuint cmdlen = 8; #endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); (void) __glXFlushRenderBuffer(gc, gc->pc); xcb_glx_delete_lists(c, gc->currentContextTag, list, range); #else GLubyte const * pc = __glXSetupSingleRequest(gc, X_GLsop_DeleteLists, cmdlen); (void) memcpy((void *)(pc + 0), (void *)(&list), 4); (void) memcpy((void *)(pc + 4), (void *)(&range), 4); UnlockDisplay(dpy); SyncHandle(); #endif /* USE_XCB */ } return; }
false
true
false
false
false
1
del_ipv6_address ( struct net_device *netdev ) { struct ipv6_miniroute *miniroute; list_for_each_entry ( miniroute, &miniroutes, list ) { if ( miniroute->netdev == netdev ) { del_ipv6_miniroute ( miniroute ); break; } } }
false
false
false
false
false
0
apds990x_prox_threshold_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) { struct apds990x_chip *chip = dev_get_drvdata(dev); unsigned long value; int ret; ret = kstrtoul(buf, 0, &value); if (ret) return ret; if ((value > APDS_RANGE) || (value == 0) || (value < APDS_PROX_HYSTERESIS)) return -EINVAL; mutex_lock(&chip->mutex); chip->prox_thres = value; apds990x_force_p_refresh(chip); mutex_unlock(&chip->mutex); return len; }
false
false
false
false
false
0
on_shell_value_changed (TextEditor *te, const char *name) { g_return_if_fail (name != NULL); if ((strcmp (name, TEXT_EDITOR_PROJECT_TYPE_LIST) == 0) || (strcmp (name, TEXT_EDITOR_SYSTEM_TYPE_LIST) == 0)) { /* Type names list has changed, so refresh highlight */ text_editor_hilite (te, te->force_pref); } }
false
false
false
false
false
0
zremove_obj(void) { check_zero(0, 0); remove_obj(zargs[0]); }
false
false
false
false
false
0
cmp_member (Sym *left, Sym *right) { double left_time = left->cg.prop.self + left->cg.prop.child; double right_time = right->cg.prop.self + right->cg.prop.child; unsigned long left_calls = left->ncalls + left->cg.self_calls; unsigned long right_calls = right->ncalls + right->cg.self_calls; if (left_time > right_time) return GREATERTHAN; if (left_time < right_time) return LESSTHAN; if (left_calls > right_calls) return GREATERTHAN; if (left_calls < right_calls) return LESSTHAN; return EQUALTO; }
false
false
false
false
false
0
netio_bridge_handle_cfg_line(netio_bridge_t *t,char *str) { char *tokens[NETIO_BRIDGE_MAX_TOKENS]; int count; if ((count = m_strsplit(str,':',tokens,NETIO_BRIDGE_MAX_TOKENS)) <= 2) return(-1); return(netio_bridge_cfg_create_if(t,tokens,count)); }
false
false
false
false
false
0
hidinput_input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) { struct hid_device *hid = input_get_drvdata(dev); struct hid_field *field; int offset; if (type == EV_FF) return input_ff_event(dev, type, code, value); if (type != EV_LED) return -1; if ((offset = hidinput_find_field(hid, type, code, &field)) == -1) { hid_warn(dev, "event field not found\n"); return -1; } hid_set_field(field, offset, value); schedule_work(&hid->led_work); return 0; }
false
false
false
false
false
0
cond_bubble (FttCell * cell, gpointer data) { CondData * p = data; FttVector pos; ftt_cell_pos (cell, &pos); gdouble radeq; gdouble size = ftt_cell_size (cell)/2.; #if FTT_2D radeq = size*sqrt(2.); #else radeq = size*sqrt(3.); #endif /* 3D */ if (ftt_vector_distance (&pos, p->pos) - radeq <= p->distance) return TRUE; /* Check also if the bubble is inside the cell*/ if (p->pos->x > pos.x + size || p->pos->x < pos.x - size || p->pos->y > pos.y + size || p->pos->y < pos.y - size #if !FTT_2D || p->pos->z > pos.z + size || p->pos->z < pos.z - size #endif ) return FALSE; return TRUE; }
false
false
false
false
false
0
compressSubDir(QuaZip* zip, QString dir, QString origDir, bool recursive) { // zip: oggetto dove aggiungere il file // dir: cartella reale corrente // origDir: cartella reale originale // (path(dir)-path(origDir)) = path interno all'oggetto zip // Controllo l'apertura dello zip if(!zip) { return false; } if(zip->getMode() != QuaZip::mdCreate && zip->getMode() != QuaZip::mdAppend && zip->getMode() != QuaZip::mdAdd) { return false; } // Controllo la cartella QDir directory(dir); if(!directory.exists()) { return false; } // Se comprimo anche le sotto cartelle if(recursive) { // Per ogni sotto cartella QFileInfoList files = directory.entryInfoList(QDir::AllDirs | QDir::NoDotAndDotDot); Q_FOREACH(QFileInfo file, files) { // Comprimo la sotto cartella if(!compressSubDir(zip, file.absoluteFilePath(), origDir, recursive)) { return false; } } } // Per ogni file nella cartella QFileInfoList files = directory.entryInfoList(QDir::Files); QDir origDirectory(origDir); Q_FOREACH(QFileInfo file, files) { // Se non e un file o e il file compresso che sto creando if(!file.isFile() || file.absoluteFilePath() == zip->getZipName()) { continue; } // Creo il nome relativo da usare all'interno del file compresso QString filename = origDirectory.relativeFilePath(file.absoluteFilePath()); // Comprimo il file if(!compressFile(zip, file.absoluteFilePath(), filename)) { return false; } } return true; }
false
false
false
false
false
0
isAbsPath(MprFileSystem *fs, cchar *path) { char *cp, *endDrive; mprAssert(fs); mprAssert(path); if (path == NULL || *path == '\0') { return 0; } if (fs->hasDriveSpecs) { if ((cp = firstSep(fs, path)) != 0) { if ((endDrive = strchr(path, ':')) != 0) { if (&endDrive[1] == cp) { return 1; } } if (cp == path) { return 1; } } } else { if (isSep(fs, path[0])) { return 1; } } return 0; }
false
false
false
true
false
1
ftltime(u_int32 sys, u_int32 secs, u_int32 nsecs, u_int32 t) { u_int32 sys_s, sys_m; struct fttime ftt; /* sysUpTime is in milliseconds, convert to seconds/milliseconds */ sys_s = sys / 1000; sys_m = sys % 1000; /* unix seconds/nanoseconds to seconds/milliseconds */ ftt.secs = secs; ftt.msecs = nsecs / 1000000L; /* subtract sysUpTime from unix seconds */ ftt.secs -= sys_s; /* borrow a second? */ if (sys_m > ftt.msecs) { -- ftt.secs; ftt.msecs += 1000; } ftt.msecs -= sys_m; /* add offset which is in milliseconds */ ftt.secs += t / 1000; ftt.msecs += t % 1000; /* fix if milliseconds >= 1000 */ if (ftt.msecs >= 1000) { ftt.msecs -= 1000; ftt.secs += 1; } return ftt; }
false
false
false
false
false
0
unlock_activate_stack (GnlComposition * comp, GNode * node, gboolean change_state, GstState state) { GNode *child; GST_LOG_OBJECT (comp, "object:%s", GST_ELEMENT_NAME ((GstElement *) (node->data))); gst_element_set_locked_state ((GstElement *) (node->data), FALSE); if (change_state) gst_element_set_state (GST_ELEMENT (node->data), state); for (child = node->children; child; child = child->next) unlock_activate_stack (comp, child, change_state, state); }
false
false
false
false
false
0
HBF_GetBitmapBoundingBox(HBF_Handle handle, unsigned int *width, unsigned int *height, int *xDisplacement, int *yDisplacement) { if (width != NULL) *width = hbfBitmapBBox(handle)->hbf_width; if (height != NULL) *height = hbfBitmapBBox(handle)->hbf_height; if (xDisplacement != NULL) *xDisplacement = hbfBitmapBBox(handle)->hbf_xDisplacement; if (yDisplacement != NULL) *yDisplacement = hbfBitmapBBox(handle)->hbf_yDisplacement; return 0; }
false
false
false
false
false
0
gupnp_dlna_value_new_ranged (GUPnPDLNAValueType *type, const gchar *min, const gchar *max) { GUPnPDLNAValueRange *range; g_return_val_if_fail (type != NULL, NULL); g_return_val_if_fail (min != NULL, NULL); g_return_val_if_fail (max != NULL, NULL); range = g_slice_new (GUPnPDLNAValueRange); range->base.vtable = &range_vtable; if (!gupnp_dlna_value_type_init (type, &range->min, min)) { g_slice_free (GUPnPDLNAValueRange, range); range = NULL; } if (range && !gupnp_dlna_value_type_init (type, &range->max, max)) { gupnp_dlna_value_type_clean (type, &range->min); g_slice_free (GUPnPDLNAValueRange, range); range = NULL; } if (range && !gupnp_dlna_value_type_verify_range (type, &range->min, &range->max)) { gupnp_dlna_value_type_clean (type, &range->min); gupnp_dlna_value_type_clean (type, &range->max); g_slice_free (GUPnPDLNAValueRange, range); range = NULL; } return (GUPnPDLNAValue *) range; }
false
false
false
false
false
0
socache_shmcb_store(ap_socache_instance_t *ctx, server_rec *s, const unsigned char *id, unsigned int idlen, apr_time_t expiry, unsigned char *encoded, unsigned int len_encoded, apr_pool_t *p) { SHMCBHeader *header = ctx->header; SHMCBSubcache *subcache = SHMCB_MASK(header, id); int tryreplace; ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(00831) "socache_shmcb_store (0x%02x -> subcache %d)", SHMCB_MASK_DBG(header, id)); /* XXX: Says who? Why shouldn't this be acceptable, or padded if not? */ if (idlen < 4) { ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, APLOGNO(00832) "unusably short id provided " "(%u bytes)", idlen); return APR_EINVAL; } tryreplace = shmcb_subcache_remove(s, header, subcache, id, idlen); if (shmcb_subcache_store(s, header, subcache, encoded, len_encoded, id, idlen, expiry)) { ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, APLOGNO(00833) "can't store an socache entry!"); return APR_ENOSPC; } if (tryreplace == 0) { header->stat_replaced++; } else { header->stat_stores++; } ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(00834) "leaving socache_shmcb_store successfully"); return APR_SUCCESS; }
false
false
false
false
false
0
sisfb_setupvbblankflags(struct sis_video_info *ivideo, u32 *vcount, u32 *hcount) { u8 idx, reg1, reg2, reg3, reg4; u32 ret = 0; (*vcount) = (*hcount) = 0; if((ivideo->currentvbflags & VB_DISPTYPE_DISP2) && (!(sisfb_bridgeisslave(ivideo)))) { ret |= (FB_VBLANK_HAVE_VSYNC | FB_VBLANK_HAVE_HBLANK | FB_VBLANK_HAVE_VBLANK | FB_VBLANK_HAVE_VCOUNT | FB_VBLANK_HAVE_HCOUNT); switch(ivideo->sisvga_engine) { case SIS_300_VGA: idx = 0x25; break; default: case SIS_315_VGA: idx = 0x30; break; } reg1 = SiS_GetReg(SISPART1, (idx+0)); /* 30 */ reg2 = SiS_GetReg(SISPART1, (idx+1)); /* 31 */ reg3 = SiS_GetReg(SISPART1, (idx+2)); /* 32 */ reg4 = SiS_GetReg(SISPART1, (idx+3)); /* 33 */ if(reg1 & 0x01) ret |= FB_VBLANK_VBLANKING; if(reg1 & 0x02) ret |= FB_VBLANK_VSYNCING; if(reg4 & 0x80) ret |= FB_VBLANK_HBLANKING; (*vcount) = reg3 | ((reg4 & 0x70) << 4); (*hcount) = reg2 | ((reg4 & 0x0f) << 8); } else if(sisfballowretracecrt1(ivideo)) { ret |= (FB_VBLANK_HAVE_VSYNC | FB_VBLANK_HAVE_VBLANK | FB_VBLANK_HAVE_VCOUNT | FB_VBLANK_HAVE_HCOUNT); reg1 = SiS_GetRegByte(SISINPSTAT); if(reg1 & 0x08) ret |= FB_VBLANK_VSYNCING; if(reg1 & 0x01) ret |= FB_VBLANK_VBLANKING; reg1 = SiS_GetReg(SISCR, 0x20); reg1 = SiS_GetReg(SISCR, 0x1b); reg2 = SiS_GetReg(SISCR, 0x1c); reg3 = SiS_GetReg(SISCR, 0x1d); (*vcount) = reg2 | ((reg3 & 0x07) << 8); (*hcount) = (reg1 | ((reg3 & 0x10) << 4)) << 3; } return ret; }
false
false
false
false
false
0
gs_list_free(GS_LIST **list) { size_t list_size=(*list)->size,i; //free tous les pointeurs dans la liste i=0; while(i<list_size) { FREE((*list)->ptr[i]); i++; } //free la liste FREE((*list)->ptr); //mets null *list=NULL; }
false
true
false
false
true
1
qla24xx_unprotect_flash(scsi_qla_host_t *vha) { struct qla_hw_data *ha = vha->hw; struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; if (ha->flags.fac_supported) return qla81xx_fac_do_write_enable(vha, 1); /* Enable flash write. */ WRT_REG_DWORD(&reg->ctrl_status, RD_REG_DWORD(&reg->ctrl_status) | CSRX_FLASH_ENABLE); RD_REG_DWORD(&reg->ctrl_status); /* PCI Posting. */ if (!ha->fdt_wrt_disable) goto done; /* Disable flash write-protection, first clear SR protection bit */ qla24xx_write_flash_dword(ha, flash_conf_addr(ha, 0x101), 0); /* Then write zero again to clear remaining SR bits.*/ qla24xx_write_flash_dword(ha, flash_conf_addr(ha, 0x101), 0); done: return QLA_SUCCESS; }
false
false
false
false
false
0
m_jupe(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { if (parc < 2) return jupe_list(sptr, 0); return jupe_list(sptr, parv[1]); }
false
false
false
false
false
0
ekg_user_init(ekg_userObj *self, PyObject *args, PyObject *kwds) { PyObject * name; PyObject * session; static char *kwlist[] = {"name", "session", NULL}; if (! PyArg_ParseTupleAndKeywords(args, kwds, "ss", kwlist, &name, &session)) return -1; self->name = PyString_AsString(name); self->session = PyString_AsString(session); return 0; }
false
false
false
false
false
0
status_request(struct view *view, enum request request, struct line *line) { struct status *status = line->data; switch (request) { case REQ_STATUS_UPDATE: if (!status_update(view)) return REQ_NONE; break; case REQ_STATUS_MERGE: if (!status || status->status != 'U') { report("Merging only possible for files with unmerged status ('U')."); return REQ_NONE; } open_mergetool(status->new.name); break; case REQ_EDIT: if (!status) return request; open_editor(status->status != '?', status->new.name); break; case REQ_VIEW_BLAME: if (status) { string_copy(opt_file, status->new.name); opt_ref[0] = 0; } return request; case REQ_ENTER: /* After returning the status view has been split to * show the stage view. No further reloading is * necessary. */ status_enter(view, line); return REQ_NONE; case REQ_REFRESH: /* Simply reload the view. */ break; default: return request; } open_view(view, REQ_VIEW_STATUS, OPEN_RELOAD); return REQ_NONE; }
false
false
false
false
false
0
transmit_window_size(void) { Sock *sock; for (sock = hsock; sock; sock = sock->next) if (TELOPT(sock, us, TN_NAWS)) do_naws(sock); }
false
false
false
false
false
0
min(float a, float b, float c) { float ret_val; if(a < b) { ret_val = a; } else { ret_val = b; } if (ret_val < c) { return ret_val; } return c; }
false
false
false
false
false
0
GetAppendBuffer(int32_t min_capacity, int32_t desired_capacity_hint, char *scratch, int32_t scratch_capacity, int32_t *result_capacity) { if (min_capacity < 1 || scratch_capacity < min_capacity) { *result_capacity = 0; return NULL; } int32_t available = capacity_ - appended_; if (available >= min_capacity) { *result_capacity = available; return buffer_ + appended_; } else if (Resize(desired_capacity_hint, appended_)) { *result_capacity = capacity_ - appended_; return buffer_ + appended_; } else { *result_capacity = scratch_capacity; return scratch; } }
false
false
false
false
false
0
_gth_file_list_get_visibles (GthFileList *file_list) { if (file_list->priv->visibility_changed) { _g_object_list_unref (file_list->priv->visibles); file_list->priv->visibles = gth_file_store_get_visibles ((GthFileStore *) gth_file_view_get_model (GTH_FILE_VIEW (file_list->priv->view))); file_list->priv->visibility_changed = FALSE; file_list->priv->thumbnailer_state.phase = THUMBNAILER_PHASE_INITIALIZE; } return file_list->priv->visibles; }
false
false
false
false
false
0
Cudd_BiasedUnderApprox( DdManager *dd /* manager */, DdNode *f /* function to be subset */, DdNode *b /* bias function */, int numVars /* number of variables in the support of f */, int threshold /* when to stop approximation */, double quality1 /* minimum improvement for accepted changes when b=1 */, double quality0 /* minimum improvement for accepted changes when b=0 */) { DdNode *subset; do { dd->reordered = 0; subset = cuddBiasedUnderApprox(dd, f, b, numVars, threshold, quality1, quality0); } while (dd->reordered == 1); return(subset); }
false
false
false
false
false
0
dev_c3600_nm_4t_unset_nio(vm_instance_t *vm,struct cisco_card *card, u_int port_id) { struct mueslix_data *d = card->drv_info; if (!d || (port_id >= MUESLIX_NR_CHANNELS)) return(-1); return(dev_mueslix_unset_nio(d,port_id)); }
false
false
false
false
false
0
PyVTKTemplate_HasKey(PyObject *ob, PyObject *args) { PyObject *key = NULL; if (PyArg_ParseTuple(args, (char *)"O:has_key", &key)) { ob = ((PyVTKTemplate *)ob)->dict; return PyObject_CallMethod(ob, (char *)"has_key", (char *)"(O)", key); } return NULL; }
false
false
false
false
false
0