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
gdl_dock_floating_configure_event_cb (GtkWidget *widget, GdkEventConfigure *event, gpointer user_data) { GdlDock *dock; g_return_val_if_fail (user_data != NULL && GDL_IS_DOCK (user_data), TRUE); dock = GDL_DOCK (user_data); dock->priv->float_x = event->x; dock->priv->float_y = event->y; dock->priv->width = event->width; dock->priv->height = event->height; return FALSE; }
false
false
false
false
false
0
eel_remove_arg(int pos) { int i; eel_d_freestring(eel_args + pos); for(i = pos + 1; i < eel_arg_count; ++i) { eel_args[i-1] = eel_args[i]; eel_arg_tokens[i-1] = eel_arg_tokens[i]; } --eel_arg_count; }
false
false
false
false
false
0
updateGP2Source() { PinModule *pmGP2 = &(*m_gpio)[2]; if(option_reg->value.get() & OPTION_REG::T0CS) { printf("OPTION_REG::T0CS forcing GPIO2 as input, TRIS disabled\n"); pmGP2->setControl(m_IN_SignalControl); pmGP2->getPin().newGUIname("T0CS"); } else { cout << "TRIS now controlling gpio2\n"; pmGP2->getPin().newGUIname("gpio2"); pmGP2->setControl(0); } }
false
false
false
false
false
0
cik_enable_mgcg(struct radeon_device *rdev, bool enable) { u32 data, orig, tmp = 0; if (enable && (rdev->cg_flags & RADEON_CG_SUPPORT_GFX_MGCG)) { if (rdev->cg_flags & RADEON_CG_SUPPORT_GFX_MGLS) { if (rdev->cg_flags & RADEON_CG_SUPPORT_GFX_CP_LS) { orig = data = RREG32(CP_MEM_SLP_CNTL); data |= CP_MEM_LS_EN; if (orig != data) WREG32(CP_MEM_SLP_CNTL, data); } } orig = data = RREG32(RLC_CGTT_MGCG_OVERRIDE); data |= 0x00000001; data &= 0xfffffffd; if (orig != data) WREG32(RLC_CGTT_MGCG_OVERRIDE, data); tmp = cik_halt_rlc(rdev); mutex_lock(&rdev->grbm_idx_mutex); cik_select_se_sh(rdev, 0xffffffff, 0xffffffff); WREG32(RLC_SERDES_WR_CU_MASTER_MASK, 0xffffffff); WREG32(RLC_SERDES_WR_NONCU_MASTER_MASK, 0xffffffff); data = BPM_ADDR_MASK | MGCG_OVERRIDE_0; WREG32(RLC_SERDES_WR_CTRL, data); mutex_unlock(&rdev->grbm_idx_mutex); cik_update_rlc(rdev, tmp); if (rdev->cg_flags & RADEON_CG_SUPPORT_GFX_CGTS) { orig = data = RREG32(CGTS_SM_CTRL_REG); data &= ~SM_MODE_MASK; data |= SM_MODE(0x2); data |= SM_MODE_ENABLE; data &= ~CGTS_OVERRIDE; if ((rdev->cg_flags & RADEON_CG_SUPPORT_GFX_MGLS) && (rdev->cg_flags & RADEON_CG_SUPPORT_GFX_CGTS_LS)) data &= ~CGTS_LS_OVERRIDE; data &= ~ON_MONITOR_ADD_MASK; data |= ON_MONITOR_ADD_EN; data |= ON_MONITOR_ADD(0x96); if (orig != data) WREG32(CGTS_SM_CTRL_REG, data); } } else { orig = data = RREG32(RLC_CGTT_MGCG_OVERRIDE); data |= 0x00000003; if (orig != data) WREG32(RLC_CGTT_MGCG_OVERRIDE, data); data = RREG32(RLC_MEM_SLP_CNTL); if (data & RLC_MEM_LS_EN) { data &= ~RLC_MEM_LS_EN; WREG32(RLC_MEM_SLP_CNTL, data); } data = RREG32(CP_MEM_SLP_CNTL); if (data & CP_MEM_LS_EN) { data &= ~CP_MEM_LS_EN; WREG32(CP_MEM_SLP_CNTL, data); } orig = data = RREG32(CGTS_SM_CTRL_REG); data |= CGTS_OVERRIDE | CGTS_LS_OVERRIDE; if (orig != data) WREG32(CGTS_SM_CTRL_REG, data); tmp = cik_halt_rlc(rdev); mutex_lock(&rdev->grbm_idx_mutex); cik_select_se_sh(rdev, 0xffffffff, 0xffffffff); WREG32(RLC_SERDES_WR_CU_MASTER_MASK, 0xffffffff); WREG32(RLC_SERDES_WR_NONCU_MASTER_MASK, 0xffffffff); data = BPM_ADDR_MASK | MGCG_OVERRIDE_1; WREG32(RLC_SERDES_WR_CTRL, data); mutex_unlock(&rdev->grbm_idx_mutex); cik_update_rlc(rdev, tmp); } }
false
false
false
false
false
0
copy_file_to_fd( pfs_file *file, int fd ) { pfs_ssize_t ractual, wactual, offset = 0; char buffer[BUFFER_SIZE]; while(1) { ractual = file->read(buffer,sizeof(buffer),offset); if(ractual<=0) return ractual; wactual = full_pwrite64(fd,buffer,ractual,offset); if(wactual>=0) { offset += wactual; } else { return -1; } } }
false
false
false
false
false
0
single(int i, int j, int itype, int jtype, double rsq, double factor_coul, double factor_lj, double &fforce) { double r2inv,r,egamma,fgamma,prefactor; double fraction,table,forcecoul,phicoul; int itable; r2inv = 1.0/rsq; if (!ncoultablebits || rsq <= tabinnersq) { r = sqrt(rsq); egamma = 1.0 - (r/cut_coul)*force->kspace->gamma(r/cut_coul); fgamma = 1.0 + (rsq/cut_coulsq)*force->kspace->dgamma(r/cut_coul); prefactor = force->qqrd2e * atom->q[i]*atom->q[j]/r; forcecoul = prefactor * fgamma; if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor; } else { union_int_float_t rsq_lookup; rsq_lookup.f = rsq; itable = rsq_lookup.i & ncoulmask; itable >>= ncoulshiftbits; fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable]; table = ftable[itable] + fraction*dftable[itable]; forcecoul = atom->q[i]*atom->q[j] * table; if (factor_coul < 1.0) { table = ctable[itable] + fraction*dctable[itable]; prefactor = atom->q[i]*atom->q[j] * table; forcecoul -= (1.0-factor_coul)*prefactor; } } fforce = forcecoul * r2inv; if (!ncoultablebits || rsq <= tabinnersq) phicoul = prefactor*egamma; else { table = etable[itable] + fraction*detable[itable]; phicoul = atom->q[i]*atom->q[j] * table; } if (factor_coul < 1.0) phicoul -= (1.0-factor_coul)*prefactor; return phicoul; }
false
false
false
false
true
1
main() { int i; for (i = -16; i <= 16; i++) { if (i / q1 != div4[i+16]) return 1; if (i / q2 != divm4[i+16]) return 1; if (i % q1 != mod4[i+16]) return 1; if (i % q2 != modm4[i+16]) return 1; } return 0; }
false
false
false
false
false
0
execute() { unsigned int new_value; if (access) source = cpu_pic->register_bank[register_address]; else if (cpu16->extended_instruction() && register_address < 0x60) source = cpu_pic->registers[register_address + cpu16->ind2.fsr_value]; else source = cpu_pic->registers[register_address]; new_value = (source->get() << 1) | cpu16->status->get_C(); if(destination) source->put(new_value&0xff); // Result goes to source else cpu16->Wput(new_value&0xff); cpu16->status->put_Z_C_N(new_value); cpu16->pc->increment(); }
false
false
false
false
false
0
LoadGP(int w, MovieRecord* mr) { if(w==0) { joy[0] = mr->joysticks[0]; if(FSAttached) joy[2] = mr->joysticks[2]; } else { joy[1] = mr->joysticks[1]; if(FSAttached) joy[3] = mr->joysticks[3]; } }
false
false
false
false
false
0
program_path_allocate(const char *argv0) { filestat_t buf; const char *file = argv0; char filepath[MAX_PATH_LEN + 1]; if (is_running_on_mingw() && !is_strsuffix(argv0, (size_t) -1, ".exe")) { concat_strings(filepath, sizeof filepath, argv0, ".exe", NULL); } else { clamp_strcpy(filepath, sizeof filepath, argv0); } if (-1 == stat(filepath, &buf)) { int saved_errno = errno; file = file_locate_from_path(argv0); if (NULL == file) { errno = saved_errno; s_warning("could not stat() \"%s\": %m", filepath); s_warning("cannot find \"%s\" in PATH, not loading symbols", argv0); goto error; } } if (file != NULL && file != argv0) return deconstify_pointer(file); return h_strdup(filepath); error: if (file != NULL && file != argv0) hfree(deconstify_pointer(file)); return NULL; }
false
false
false
false
false
0
stripsemicolon (TCHAR *s) { if (!s) return; while (_tcslen(s) > 0 && s[_tcslen(s) - 1] == ':') s[_tcslen(s) - 1] = 0; }
false
false
false
false
false
0
sym2_get_signalling(struct Scsi_Host *shost) { struct sym_hcb *np = sym_get_hcb(shost); enum spi_signal_type type; switch (np->scsi_mode) { case SMODE_SE: type = SPI_SIGNAL_SE; break; case SMODE_LVD: type = SPI_SIGNAL_LVD; break; case SMODE_HVD: type = SPI_SIGNAL_HVD; break; default: type = SPI_SIGNAL_UNKNOWN; break; } spi_signalling(shost) = type; }
false
false
false
false
false
0
setGame(KReversiGame *game) { // disconnect signals from previous game if they exist, // we are not interested in them anymore if (m_game) { disconnect(m_game, SIGNAL(boardChanged()), this, SLOT(updateBoard())); disconnect(m_game, SIGNAL(moveFinished()), this, SLOT(gameMoveFinished())); disconnect(m_game, SIGNAL(gameOver()), this, SLOT(gameOver())); disconnect(m_game, SIGNAL(whitePlayerCantMove()), this, SLOT(whitePlayerCantMove())); disconnect(m_game, SIGNAL(blackPlayerCantMove()), this, SLOT(blackPlayerCantMove())); delete m_game; } m_game = game; if (m_game) { connect(m_game, SIGNAL(boardChanged()), this, SLOT(updateBoard())); connect(m_game, SIGNAL(moveFinished()), this, SLOT(gameMoveFinished())); connect(m_game, SIGNAL(gameOver()), this, SLOT(gameOver())); connect(m_game, SIGNAL(whitePlayerCantMove()), this, SLOT(whitePlayerCantMove())); connect(m_game, SIGNAL(blackPlayerCantMove()), this, SLOT(blackPlayerCantMove())); m_game->setDelay(m_delay); } m_hint = KReversiMove(); updateBoard(); }
false
false
false
false
false
0
WriteKeyValue(IEEELittleEndianBinaryFileStream* bofs, uint16_t key, const std::vector<uint8_t>& val) { uint16_t num = static_cast<uint16_t>(std::ceil(static_cast<float>(val.size()) / 4.0f)); bofs->Write(key); bofs->Write(num); for (size_t i = 0 ; i < val.size() ; ++i) bofs->Write(val[i]); bofs->Fill(num * 4 - val.size()); return 4 + num * 4; }
false
false
false
false
false
0
GetNextRawFeature() { if (nNextFID == nRows) return NULL; const void* xlshandle = poDS->GetXLSHandle(); if (xlshandle == NULL) return NULL; freexl_select_active_worksheet(xlshandle, iSheet); OGRFeature* poFeature = new OGRFeature(poFeatureDefn); FreeXL_CellValue sCellValue; for(unsigned short i=0;i<(unsigned short )poFeatureDefn->GetFieldCount(); i++) { if (freexl_get_cell_value(xlshandle, nNextFID, i, &sCellValue) == FREEXL_OK) { switch (sCellValue.type) { case FREEXL_CELL_INT: poFeature->SetField(i, sCellValue.value.int_value); break; case FREEXL_CELL_DOUBLE: poFeature->SetField(i, sCellValue.value.double_value); break; case FREEXL_CELL_TEXT: case FREEXL_CELL_SST_TEXT: poFeature->SetField(i, sCellValue.value.text_value); break; case FREEXL_CELL_DATE: case FREEXL_CELL_DATETIME: case FREEXL_CELL_TIME: poFeature->SetField(i, sCellValue.value.text_value); break; case FREEXL_CELL_NULL: break; default: CPLDebug("XLS", "Unknown cell type = %d", sCellValue.type); break; } } } poFeature->SetFID(nNextFID + 1); nNextFID ++; return poFeature; }
false
false
false
false
false
0
create_filelist(char *file, struct gfs_stat *st, void *arg) { struct flist *a = arg; int i, j, ncopy, src_ncopy = 0, dst_ncopy = 0; char **copy; gfarm_error_t e; e = gfs_replica_list_by_name(file, &ncopy, &copy); if (e != GFARM_ERR_NO_ERROR) return (e); for (i = 0; i < ncopy; ++i) { if ((a->src_hosthash == NULL || gfarm_hash_lookup( a->src_hosthash, copy[i], strlen(copy[i]) + 1)) && gfarm_host_is_in_domain(copy[i], a->src_domain)) { ++src_ncopy; } if ((a->dst_hosthash == NULL || gfarm_hash_lookup( a->dst_hosthash, copy[i], strlen(copy[i]) + 1)) && gfarm_host_is_in_domain(copy[i], a->dst_domain)) { ++dst_ncopy; } } /* * if there is no replica in a set of source nodes or there * are already specified number of replicas in a set of * destination nodes, do not add. */ if (src_ncopy == 0 || dst_ncopy == opt_nrep) { e = GFARM_ERR_NO_ERROR; goto free_copy; } /* add source nodes to srchash to count the number of source nodes */ for (i = 0; i < ncopy; ++i) { char *s = copy[i]; if ((a->src_hosthash == NULL || gfarm_hash_lookup( a->src_hosthash, s, strlen(s) + 1)) && gfarm_host_is_in_domain(s, a->src_domain)) gfarm_hash_enter(a->srchash, s, strlen(s)+1, 0, NULL); } /* add a file info to slist */ for (j = 0; j < opt_nrep - dst_ncopy; ++j) { e = gfarm_list_add_file_info(file, st->st_size, ncopy, copy, 0, &a->slist); if (e != GFARM_ERR_NO_ERROR) goto free_copy; } /* add a file info to dlist if too many file replicas exist */ if (dst_ncopy > opt_nrep) { e = gfarm_list_add_file_info(file, st->st_size, ncopy, copy, dst_ncopy - opt_nrep, &a->dlist); } free_copy: gfarm_strings_free_deeply(ncopy, copy); return (e); }
false
false
false
false
false
0
InsertTetra(vtkIdType id, double r2, double center[3]) { if ( id >= this->Size ) { this->Resize(id+1); } this->Array[id].r2 = r2; this->Array[id].center[0] = center[0]; this->Array[id].center[1] = center[1]; this->Array[id].center[2] = center[2]; if ( id > this->MaxId ) { this->MaxId = id; } }
false
false
false
false
false
0
unparse_ac_parameter_list #ifdef KC_USE_PROTOTYPES (ac_parameter_list kc_p, void (*kc_printer)(char*, uview), uview kc_current_view) #else (kc_p, kc_printer, kc_current_view) ac_parameter_list kc_p; void (*kc_printer)KC__P((char*, uview)); uview kc_current_view; #endif { /*SUPPRESS 622*/ assert_ac_parameter_list(kc_p, "kc_p"); switch((int)kc_current_view) { case (int)view_gen_fnkdecls: { if (( kc_p->prod_sel == sel_Consac_parameter_list) && ( kc_p->u.Consac_parameter_list.ac_parameter_list_1->prod_sel == sel_Nilac_parameter_list)) { #line 7620 "../gen.k" ac_parameter_declaration h = kc_p->u.Consac_parameter_list.ac_parameter_declaration_1; unparse_ac_parameter_declaration(h, kc_printer, kc_current_view); { (*kc_printer)(";", kc_current_view); } } else if (( kc_p->prod_sel == sel_Consac_parameter_list)) { #line 7621 "../gen.k" ac_parameter_declaration h = kc_p->u.Consac_parameter_list.ac_parameter_declaration_1; #line 7621 "../gen.k" ac_parameter_list t = kc_p->u.Consac_parameter_list.ac_parameter_list_1; unparse_ac_parameter_list(t, kc_printer, kc_current_view); { (*kc_printer)("\n", kc_current_view); } unparse_ac_parameter_declaration(h, kc_printer, kc_current_view); { (*kc_printer)(";", kc_current_view); } } else goto kc_unparsing_default; break; } default: kc_unparsing_default: case (int)base_uview: { if (( kc_p->prod_sel == sel_Consac_parameter_list) && ( kc_p->u.Consac_parameter_list.ac_parameter_list_1->prod_sel == sel_Nilac_parameter_list)) { #line 7577 "../gen.k" ac_parameter_declaration h = kc_p->u.Consac_parameter_list.ac_parameter_declaration_1; unparse_ac_parameter_declaration(h, kc_printer, kc_current_view); } else if (( kc_p->prod_sel == sel_Consac_parameter_list)) { #line 7578 "../gen.k" ac_parameter_declaration h = kc_p->u.Consac_parameter_list.ac_parameter_declaration_1; #line 7578 "../gen.k" ac_parameter_list t = kc_p->u.Consac_parameter_list.ac_parameter_list_1; unparse_ac_parameter_list(t, kc_printer, kc_current_view); { (*kc_printer)(", ", kc_current_view); } unparse_ac_parameter_declaration(h, kc_printer, kc_current_view); } else switch((int)kc_p->prod_sel) { case (int)sel_Consac_parameter_list: unparse_ac_parameter_declaration( kc_p->u.Consac_parameter_list.ac_parameter_declaration_1, kc_printer, kc_current_view ); unparse_ac_parameter_list( kc_p->u.Consac_parameter_list.ac_parameter_list_1, kc_printer, kc_current_view ); break; default:;} break; } } }
false
false
false
true
false
1
check_wd_first_through_third_range( git_repository *repo, const char *start, const char *end) { git_iterator *i; const git_index_entry *entry; int idx; static const char *expected[] = { "FIRST", "second", "THIRD", NULL }; cl_git_pass(git_iterator_for_workdir( &i, repo, GIT_ITERATOR_IGNORE_CASE, start, end)); cl_git_pass(git_iterator_current(&entry, i)); for (idx = 0; entry != NULL; ++idx) { cl_assert_equal_s(expected[idx], entry->path); cl_git_pass(git_iterator_advance(&entry, i)); } cl_assert(expected[idx] == NULL); git_iterator_free(i); }
false
false
false
false
false
0
colorval_name (gint colorval) { gint i; for (i = 0; i < NUM_COLORS; i++) if (colorval == color_lookup[i].colorval) return color_lookup[i].name; return "unknown"; }
false
false
false
false
false
0
rb_f_require_relative(VALUE obj, VALUE fname) { VALUE base = rb_current_realfilepath(); if (NIL_P(base)) { rb_raise(rb_eLoadError, "cannot infer basepath"); } base = rb_file_dirname(base); return rb_require_safe(rb_file_absolute_path(fname, base), rb_safe_level()); }
false
false
false
false
false
0
is_invalid(DB_HOST_APP_VERSION& hav) { hav.consecutive_valid = 0; if (hav.max_jobs_per_day > config.daily_result_quota) { hav.max_jobs_per_day--; } }
false
false
false
false
false
0
pxa168_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) { struct pxa168_eth_private *pep = netdev_priv(dev); int err; err = phy_read_status(pep->phy); if (err == 0) err = phy_ethtool_gset(pep->phy, cmd); return err; }
false
false
false
false
false
0
ai_path_type_match(char *p) { int i; for(i = 0; i < Num_ai_path_types; i++) { if(!stricmp(AI_path_types[i], p)) return i; } return -1; }
false
false
false
false
true
1
help_env(void) { char *cp; string_list_ty manpath; string_ty *s; string_list_ty lib; size_t j, k; // // Honour any existing MANPATH setting by appending only. // Read the MANPATH to set the initial path. // cp = getenv("MANPATH"); if (cp) { s = str_from_c(cp); manpath.split(s, ":"); str_free(s); } else { s = str_from_c("/usr/man:/usr/share/man"); manpath.push_back(s); str_free(s); } s = str_from_c(configured_mandir()); manpath.push_back_unique(s); str_free(s); // // Read the AEGIS_PATH environment variable for the list of // places to look for Aegis libraries. // gonzo_report_path(&lib); // // Use the AEGIS_LIB and LANGUAGE (or LANG) environment // variables to know which languages to add. // Default to "en" if not set. // string_list_ty lang; cp = getenv("LANGUAGE"); if (cp) { string_list_ty wl; s = str_from_c(cp); wl.split(s, ":"); str_free(s); lang.push_back_unique(wl); } cp = getenv("LANG"); if (cp) { string_list_ty wl; s = str_from_c(cp); wl.split(s, ":"); str_free(s); lang.push_back_unique(wl); } if (lang.empty()) { s = str_from_c("en"); lang.push_back(s); str_free(s); } // // convolve the lib and lang lists and append them to the manpath // for (j = 0; j < lib.nstrings; ++j) { manpath.push_back_unique(lib.string[j]); for (k = 0; k < lang.nstrings; ++k) { s = os_path_join(lib.string[j], lang.string[k]); manpath.push_back_unique(s); str_free(s); } } // // set the MANPATH environment variable // s = manpath.unsplit(":"); env_set("MANPATH", s->str_text); str_free(s); }
false
false
false
false
false
0
writeEnableDebugger(char *str) { if (strlen(str) == 0) { /* no password, probably impossible? */ writeTagHeader(TAG_ENABLEDEBUGGER, 0); } else { /* password found */ writeTagHeader(TAG_ENABLEDEBUGGER, strlen(str) + 3); flputShort(0); flputString(str); } }
false
false
false
false
false
0
db_str2int(const char* _s, int* _v) { long tmp; if (!_s || !_v) { LM_ERR("Invalid parameter value\n"); return -1; } tmp = strtoul(_s, 0, 10); if ((tmp == ULONG_MAX && errno == ERANGE) || (tmp < INT_MIN) || (tmp > UINT_MAX)) { LM_ERR("Value out of range\n"); return -1; } *_v = (int)tmp; return 0; }
false
false
false
false
false
0
SetNewName( OGRSpatialReference* pOgr, const char* keyName, const char* newName ) { OGR_SRSNode *poNode = pOgr->GetAttrNode( keyName ); OGR_SRSNode *poNodeChild = NULL; if(poNode) poNodeChild = poNode->GetChild(0); if( poNodeChild) poNodeChild->SetValue( newName); }
false
false
false
false
false
0
evas_object_intercept_layer_set_callback_del(Evas_Object *obj, Evas_Object_Intercept_Layer_Set_Cb func) { void *data; MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); return NULL; MAGIC_CHECK_END(); if (!func) return NULL; if (!obj->interceptors) return NULL; obj->interceptors->layer_set.func = NULL; data = obj->interceptors->layer_set.data; obj->interceptors->layer_set.data = NULL; evas_object_intercept_deinit(obj); return data; }
false
false
false
false
false
0
integer_overflow () { if (!skip_evaluation && pedantic) pedwarn ("integer overflow in preprocessor expression"); }
false
false
false
false
false
0
pack_iy(int n) { tagint *image = atom->image; int *mask = atom->mask; int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) buf[n] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX; else buf[n] = 0.0; n += nvalues; } }
false
false
false
false
false
0
L5() {register object *base=vs_base; register object *sup=base+VM5; VC5 vs_check; vs_top=sup; goto TTL; TTL:; V5= ((object)VV[22]); base[0]= (*(LnkLI17))(((object)VV[9]),V5,((object)VV[4]),((object)VV[11])); vs_top=(vs_base=base+0)+1; return; }
false
false
false
false
false
0
pputs_utf8(char *s, int a) { UCS *ucsstr = NULL; if(s && *s){ ucsstr = utf8_to_ucs4_cpystr(s); if(ucsstr){ pputs(ucsstr, a); fs_give((void **) &ucsstr); } } }
false
false
false
false
false
0
__vxge_hw_vpath_xmac_rx_stats_get(struct __vxge_hw_virtualpath *vpath, struct vxge_hw_xmac_vpath_rx_stats *vpath_rx_stats) { u64 *val64; enum vxge_hw_status status = VXGE_HW_OK; int i; u32 offset = VXGE_HW_STATS_VPATH_RX_OFFSET; val64 = (u64 *) vpath_rx_stats; if (vpath->vp_open == VXGE_HW_VP_NOT_OPEN) { status = VXGE_HW_ERR_VPATH_NOT_OPEN; goto exit; } for (i = 0; i < sizeof(struct vxge_hw_xmac_vpath_rx_stats) / 8; i++) { status = __vxge_hw_vpath_stats_access(vpath, VXGE_HW_STATS_OP_READ, offset >> 3, val64); if (status != VXGE_HW_OK) goto exit; offset += 8; val64++; } exit: return status; }
false
false
false
false
false
0
_g_time_val_to_xmp_date (GTimeVal *time_) { time_t secs; struct tm *tm; int offset; char *retval; g_return_val_if_fail (time_->tv_usec >= 0 && time_->tv_usec < G_USEC_PER_SEC, NULL); secs = time_->tv_sec; tm = localtime (&secs); offset = _g_time_get_timezone_offset (tm); retval = g_strdup_printf ("%4d-%02d-%02dT%02d:%02d:%02d%+03d:%02d", tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, offset / 3600, offset % 3600); return retval; }
false
false
false
false
false
0
beiscsi_module_init(void) { int ret; beiscsi_scsi_transport = iscsi_register_transport(&beiscsi_iscsi_transport); if (!beiscsi_scsi_transport) { printk(KERN_ERR "beiscsi_module_init - Unable to register beiscsi transport.\n"); return -ENOMEM; } printk(KERN_INFO "In beiscsi_module_init, tt=%p\n", &beiscsi_iscsi_transport); ret = pci_register_driver(&beiscsi_pci_driver); if (ret) { printk(KERN_ERR "beiscsi_module_init - Unable to register beiscsi pci driver.\n"); goto unregister_iscsi_transport; } return 0; unregister_iscsi_transport: iscsi_unregister_transport(&beiscsi_iscsi_transport); return ret; }
false
false
false
false
false
0
check_transfer_rate(struct request *rq, int size) { struct group *group ; int cbytes, bw; /* LOCK_CONFIG must be done, but this slow things down */ group = rq_to_group(rq); if ( group ) { bw = group->bandwidth; cbytes = MID(bytes); if ( cbytes < bw ) return; /* must sleep a little. */ my_sleep(1); } }
false
false
false
false
false
0
find_lunch(int str, int *lunch) { int pos; int k; ASSERT1(IS_STONE(board[str]), str); ASSERT1(stackp == 0, str); *lunch = NO_MOVE; for (pos = BOARDMIN; pos < BOARDMAX; pos++) { if (board[pos] != OTHER_COLOR(board[str])) continue; for (k = 0; k < 8; k++) { int apos = pos + delta[k]; if (ON_BOARD(apos) && is_same_worm(apos, str)) { if (worm[pos].attack_codes[0] != 0 && !is_ko_point(pos)) { /* * If several adjacent lunches are found, we pick the * juiciest. First maximize cutstone, then minimize liberties. * We can only do this if the worm data is available, * i.e. if stackp==0. */ if (*lunch == NO_MOVE || worm[pos].cutstone > worm[*lunch].cutstone || (worm[pos].cutstone == worm[*lunch].cutstone && worm[pos].liberties < worm[*lunch].liberties)) { *lunch = worm[pos].origin; } } break; } } } if (*lunch != NO_MOVE) return 1; return 0; }
false
false
false
false
false
0
cmp (char const *a, size_t a_len, char const *b, size_t b_len) { if (a_len < b_len) return -1; if (b_len < a_len) return 1; return (strcmp (a, b)); }
false
false
false
false
false
0
tracktab_next(tset) char *tset; { struct tracktab *tp; for(tp = &tracktabs[0]; tp->name; tp++) if (!STRCMP(tp->name, tset)) { tp++; break; } if (!tp->name) tp = &tracktabs[0]; tracktab = tp; return tp->name; }
false
false
false
false
false
0
hx509_peer_info_set_cms_algs(hx509_context context, hx509_peer_info peer, const AlgorithmIdentifier *val, size_t len) { size_t i; free_cms_alg(peer); peer->val = calloc(len, sizeof(*peer->val)); if (peer->val == NULL) { peer->len = 0; hx509_set_error_string(context, 0, ENOMEM, "out of memory"); return ENOMEM; } peer->len = len; for (i = 0; i < len; i++) { int ret; ret = copy_AlgorithmIdentifier(&val[i], &peer->val[i]); if (ret) { hx509_clear_error_string(context); free_cms_alg(peer); return ret; } } return 0; }
false
false
false
false
false
0
i40e_free_asq_bufs(struct i40e_hw *hw) { int i; /* only unmap if the address is non-NULL */ for (i = 0; i < hw->aq.num_asq_entries; i++) if (hw->aq.asq.r.asq_bi[i].pa) i40e_free_dma_mem(hw, &hw->aq.asq.r.asq_bi[i]); /* free the buffer info list */ i40e_free_virt_mem(hw, &hw->aq.asq.cmd_buf); /* free the descriptor memory */ i40e_free_dma_mem(hw, &hw->aq.asq.desc_buf); /* free the dma header */ i40e_free_virt_mem(hw, &hw->aq.asq.dma_head); }
false
false
false
false
false
0
ges_track_remove_element (GESTrack * track, GESTrackElement * object) { GSequenceIter *it; GESTrackPrivate *priv; g_return_val_if_fail (GES_IS_TRACK (track), FALSE); g_return_val_if_fail (GES_IS_TRACK_ELEMENT (object), FALSE); priv = track->priv; GST_DEBUG_OBJECT (track, "Removing %" GST_PTR_FORMAT, object); it = g_hash_table_lookup (priv->trackelements_iter, object); g_sequence_remove (it); resort_and_fill_gaps (track); if (remove_object_internal (track, object) == TRUE) { ges_timeline_element_set_timeline (GES_TIMELINE_ELEMENT (object), NULL); return TRUE; } g_hash_table_insert (track->priv->trackelements_iter, object, g_sequence_insert_sorted (track->priv->trackelements_by_start, object, (GCompareDataFunc) element_start_compare, NULL)); return FALSE; }
false
false
false
false
false
0
has_limbo_value(std::string name) const { CYG_REPORT_FUNCNAMETYPE("CdlToplevel::has_limbo_value", "result %d"); CYG_REPORT_FUNCARG1XV(this); CYG_PRECONDITION_THISC(); CYG_PRECONDITIONC("" != name); bool result = false; if (limbo.find(name) != limbo.end()) { result = true; } CYG_REPORT_RETVAL(result); return result; }
false
false
false
false
false
0
FileSkipWhiteX(FILE *fp) { for (;;) { int c; bool bEof; /* GetChar */ if ((c = fgetc(fp))==EOF) { bEof = TRUE; } else { bEof = FALSE; } if (bEof) return TRUE; if (!isspace(c)) { if (ungetc(c, fp)==EOF) Log(&rLog, LOG_FATAL, "%s" "ungetc failed"); break; } } return FALSE; }
false
false
false
false
true
1
patch(const char *str) { char *p = strchr(egg_version, '+'); if (!p) p = &egg_version[strlen(egg_version)]; sprintf(p, "+%s", str); egg_numver++; sprintf(&egg_xtra[strlen(egg_xtra)], " %s", str); }
false
false
false
false
false
0
remove_dead_dialplan_useage(struct parking_dp_map *old_map, struct parking_dp_map *new_map) { struct parking_dp_context *old_ctx; struct parking_dp_context *new_ctx; struct ast_context *con; int cmp; old_ctx = AST_LIST_FIRST(old_map); new_ctx = AST_LIST_FIRST(new_map); while (new_ctx) { if (!old_ctx) { /* No old contexts left, so no dead stuff can remain. */ return; } cmp = strcmp(old_ctx->context, new_ctx->context); if (cmp < 0) { /* New map does not have old map context. */ con = ast_context_find(old_ctx->context); if (con) { ast_context_destroy(con, registrar); } old_ctx = AST_LIST_NEXT(old_ctx, node); continue; } if (cmp == 0) { /* Old and new map have this context. */ remove_dead_context_usage(old_ctx->context, old_ctx, new_ctx); old_ctx = AST_LIST_NEXT(old_ctx, node); } else { /* Old map does not have new map context. */ } new_ctx = AST_LIST_NEXT(new_ctx, node); } /* Any old contexts left must be dead. */ for (; old_ctx; old_ctx = AST_LIST_NEXT(old_ctx, node)) { con = ast_context_find(old_ctx->context); if (con) { ast_context_destroy(con, registrar); } } }
false
false
false
false
false
0
rfio_getcwd(char *buf, int size) { char *p; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_getcwd()"); if ( rfio_HsmIf_GetCwdType() > 0 ) { /* * HSM file */ TRACE(1, "rfio", "rfio_getcwd: current working directory is an HSM path"); END_TRACE(); rfio_errno = 0; return(rfio_HsmIf_getcwd(buf, size)); } TRACE(1, "rfio", "rfio_getcwd: using local getcwd()"); END_TRACE(); rfio_errno = 0; p = getcwd(buf, size); if ( ! p ) serrno = 0; return(p); }
false
false
false
false
false
0
unpackHtds() { FILE *file, *out; char *filename, outfilename[16]; int fileNo; unsigned long size; hNode *rootNode; int i, id; unsigned char dataByte, dataMask; unsigned char data[20864]; unsigned char magic[4]; id = 0; for (fileNo = 0; fileNo < 2; fileNo++) { filename = fileNo ? "allhtds2" : "allhtds1"; file = fopen(filename, "rb"); if (!file) die("Unable to open %s: %s\n", filename, strerror(errno)); while (!feof(file)) { // Read size of uncompressed MSQ block size = read32(file); if (feof(file)) break; // Read and validate MSQ header fread(magic, 4, 1, file); if (magic[0] != 'm' || magic[1] != 's' || magic[2] != 'q' || magic[3] != fileNo) die ("Invalid file: %s\n", filename); // Read huffman tree dataByte = 0; dataMask = 0; rootNode = readHuffmanNode(file, &dataByte, &dataMask); // Read data memset(data, 0, sizeof(data)); for (i = 0; i < size; i++) { data[i] = readHuffmanByte(file, rootNode, &dataByte, &dataMask); } // Decode data for (i = 0; i < size; i += 16 * 16 / 2) { decodeVXOR(&data[i], 8, 16); } // Write data sprintf(outfilename, "tile%02i", id); out = fopen(outfilename, "wb"); fwrite(data, 1, sizeof(data), out); fclose(out); // Free resources and continue with next tileset freeHuffmanNode(rootNode); id++; } fclose(file); } }
false
false
false
false
true
1
set_sge_param(struct net_device *dev, struct ethtool_ringparam *e) { struct port_info *pi = netdev_priv(dev); struct adapter *adapter = pi->adapter; struct qset_params *q; int i; if (e->rx_pending > MAX_RX_BUFFERS || e->rx_jumbo_pending > MAX_RX_JUMBO_BUFFERS || e->tx_pending > MAX_TXQ_ENTRIES || e->rx_mini_pending > MAX_RSPQ_ENTRIES || e->rx_mini_pending < MIN_RSPQ_ENTRIES || e->rx_pending < MIN_FL_ENTRIES || e->rx_jumbo_pending < MIN_FL_ENTRIES || e->tx_pending < adapter->params.nports * MIN_TXQ_ENTRIES) return -EINVAL; if (adapter->flags & FULL_INIT_DONE) return -EBUSY; q = &adapter->params.sge.qset[pi->first_qset]; for (i = 0; i < pi->nqsets; ++i, ++q) { q->rspq_size = e->rx_mini_pending; q->fl_size = e->rx_pending; q->jumbo_size = e->rx_jumbo_pending; q->txq_size[0] = e->tx_pending; q->txq_size[1] = e->tx_pending; q->txq_size[2] = e->tx_pending; } return 0; }
false
false
false
false
false
0
clear_cards (mword start, mword size) { guint8 *addr = sgen_card_table_get_card_address (start); size_t bytes = sgen_card_table_number_of_cards_in_range (start, size); if (bytes >= CARD_COUNT_IN_BYTES) { memset (sgen_cardtable, 0, CARD_COUNT_IN_BYTES); } else if (addr + bytes > SGEN_CARDTABLE_END) { size_t first_chunk = SGEN_CARDTABLE_END - addr; memset (addr, 0, first_chunk); memset (sgen_cardtable, 0, bytes - first_chunk); } else { memset (addr, 0, bytes); } }
false
false
false
false
false
0
store_remove_link(struct most_aim_obj *aim_obj, struct most_aim_attribute *attr, const char *buf, size_t len) { struct most_c_obj *c; char buffer[STRING_SIZE]; char *mdev; char *mdev_ch; int ret; size_t max_len = min_t(size_t, len + 1, STRING_SIZE); strlcpy(buffer, buf, max_len); strlcpy(aim_obj->remove_link, buf, max_len); ret = split_string(buffer, &mdev, &mdev_ch, NULL); if (ret) return ret; c = get_channel_by_name(mdev, mdev_ch); if (IS_ERR(c)) return -ENODEV; if (c->aim0.ptr == aim_obj->driver) c->aim0.ptr = NULL; if (c->aim1.ptr == aim_obj->driver) c->aim1.ptr = NULL; if (aim_obj->driver->disconnect_channel(c->iface, c->channel_id)) return -EIO; return len; }
true
true
false
false
false
1
putpix(IMAGE *image, unsigned int pix) { if(--(image)->cnt>=0) return (unsigned int)(*(image)->ptr++ = pix); else return iflsbuf(image,pix); }
false
false
false
false
false
0
SDepth(size_t vl, size_t vr) const{ size_t h,k, val; if(vl!=vr){ k = npr->find_RMQ(vl+1, vr, csa, lcp); h = lcp->get_LCP(k, csa); } else{/*for leaf (->v.left==v.right)*/ val = csa->getSA(vl); h = length - val +1; } return h; }
false
false
false
false
false
0
build_denotify(int t, struct dtags *d) { commandlist_t *ret = new_command(t); assert(t == DENOTIFY); if (ret) { ret->u.d.comptag = d->comptag; ret->u.d.relation=d->relation; ret->u.d.pattern = d->pattern; d->pattern = NULL; ret->u.d.priority = d->priority; free_dtags(d); } return ret; }
false
false
false
false
false
0
extract_root_name(const char *path, char *root_name) { int i; for (i = 1; path[i] && path[i] != '/'; i++) root_name[i - 1] = path[i]; root_name[i - 1] = '\0'; return strlen(&path[i]); }
false
false
false
false
false
0
__duplicate_list ( char ** list ) { char ** result = NULL; if ( list ) { size_t size = 1; char ** tmp = list; while ( *tmp++ ) ++size; result = malloc ( size * sizeof ( char * ) ); for ( tmp = result; *list; tmp++ ) *tmp = strdup ( *list++ ); } return result; }
false
false
false
false
false
0
cavan_daemon_stop(struct cavan_daemon_description *desc) { pid_t pid; if (desc == NULL) { pr_red_info("desc == NULL"); return -EINVAL; } if (desc->pidfile) { char buff[1024]; ssize_t readlen; readlen = file_read(desc->pidfile, buff, sizeof(buff)); if (readlen < 0) { pr_red_info("Read file %s failed", desc->pidfile); return readlen; } remove(desc->pidfile); pid = text2value_unsigned(buff, NULL, 10); } else if (desc->command) { pid = process_find_by_cmdline(NULL, desc->command); if (pid < 0) { pr_red_info("process_find_by_cmdline failed"); return pid; } } else { pr_red_info("Please give command pathname or pid filename"); return -EINVAL; } return kill(pid, SIGTERM); }
true
true
false
false
false
1
message_integrity_calc(const quint8 *buf, int size, const QByteArray &key) { QCA::MessageAuthenticationCode hmac("hmac(sha1)", key); QByteArray region = QByteArray::fromRawData((const char *)buf, size); QByteArray result = hmac.process(region).toByteArray(); Q_ASSERT(result.size() == 20); return result; }
false
false
false
false
false
0
_e_fm_ipc_handle_error_response(int id, E_Fm_Op_Type type) { E_Fm_Task *task = _e_fm_ipc_task_get(id); E_Fm_Slave *slave = NULL; if (!task) { slave = _e_fm_ipc_slave_get(id); if (slave) _e_fm_ipc_slave_send(slave, type, NULL, 0); return; } if (type == E_FM_OP_ERROR_RESPONSE_ABORT) { _e_fm_ipc_task_remove(task); } else if (type == E_FM_OP_ERROR_RESPONSE_RETRY) { switch (task->type) { case E_FM_OP_MKDIR: _e_fm_ipc_mkdir_try(task); break; case E_FM_OP_MONITOR_START: _e_fm_ipc_monitor_start_try(task); default: break; } } }
false
false
false
false
false
0
Niall_Reply(char *Buffer,int BufSize) { WORD *Word; /* Clear the buffer. */ Buffer[0]=0; /* Check we have some words to say */ if(WordList==NULL) { Niall_Warning("Corrupted brain (Not initialised)."); Niall_NewDictionary(); return; } if(CountProbs(WordList)==0) { strcpy(Buffer,"I cannot speak yet!"); return; } /* Speak some words of wisdom. */ StringWord(Buffer,BufSize,WordList); Buffer[0]=toupper(Buffer[0]); fprintf(stderr, "speaking 1\n"); safeStrcat(Buffer,BufSize,"."); fprintf(stderr, "speaking 2\n"); }
false
false
false
false
false
0
cp790_error_detect(uint8_t *rdbuf) { /* CP790 */ if (rdbuf[5] == 0xff) { ERROR("No ribbon loaded!\n"); return 1; } else if (rdbuf[4] == 0xff) { ERROR("No paper tray loaded!\n"); return 1; } else if (rdbuf[3]) { if ((rdbuf[3] & 0xf) == 0x02) // 0x12 0x22 ERROR("No paper tray loaded!\n"); else if ((rdbuf[3] & 0xf) == 0x03) // 0x13 0x23 ERROR("Empty paper tray or feed error!\n"); else if (rdbuf[3] == 0x11) ERROR("Paper feed error!\n"); else if (rdbuf[3] == 0x21) ERROR("Ribbon depleted!\n"); else ERROR("Unknown error - %02x\n", rdbuf[3]); return 1; } return 0; }
false
false
false
false
false
0
cpuintrf_init_cpu(int cpunum, int cputype) { char familyname[256]; int j, size; /* fill in the type and interface */ cpu[cpunum].intf = cpuintrf[cputype]; cpu[cpunum].cputype = cputype; /* determine the family index */ strcpy(familyname, cputype_core_file(cputype)); for (j = 0; j < CPU_COUNT; j++) if (!strcmp(familyname, cputype_core_file(j))) { cpu[cpunum].family = j; break; } /* determine the context size */ size = (*cpu[cpunum].intf.get_context)(NULL); if (size == 0) { /* that can't really be true */ //logerror("CPU #%d claims to need no context buffer!\n", cpunum); return 1; } /* allocate a context buffer for the CPU */ cpu[cpunum].context = malloc(size); if (cpu[cpunum].context == NULL) { /* that's really bad :( */ //logerror("CPU #%d failed to allocate context buffer (%d bytes)!\n", cpunum, size); return 1; } /* zap the context buffer */ memset(cpu[cpunum].context, 0, size); /* initialize the CPU and stash the context */ activecpu = cpunum; (*cpu[cpunum].intf.init)(); (*cpu[cpunum].intf.get_context)(cpu[cpunum].context); activecpu = -1; /* clear out the registered CPU for this family */ cpu_active_context[cpu[cpunum].family] = -1; /* make sure the total includes us */ totalcpu = cpunum + 1; return 0; }
false
false
false
false
false
0
lookup(char *line, char *pattern, char **value) { char *p, *v; int len = strlen(pattern); if (!*line) return 0; /* pattern */ if (strncmp(line, pattern, len)) return 0; /* white spaces */ for (p = line + len; isspace(*p); p++); /* separator */ if (*p != ':') return 0; /* white spaces */ for (++p; isspace(*p); p++); /* value */ if (!*p) return 0; v = p; /* end of value */ len = strlen(line) - 1; for (p = line + len; isspace(*(p-1)); p--); *p = '\0'; *value = xstrdup(v); return 1; }
false
false
false
false
false
0
lpfc_bsg_handle_sli_cfg_mbox(struct lpfc_hba *phba, struct fc_bsg_job *job, struct lpfc_dmabuf *dmabuf) { struct lpfc_sli_config_mbox *sli_cfg_mbx; uint32_t subsys; uint32_t opcode; int rc = SLI_CONFIG_NOT_HANDLED; /* state change on new multi-buffer pass-through mailbox command */ phba->mbox_ext_buf_ctx.state = LPFC_BSG_MBOX_HOST; sli_cfg_mbx = (struct lpfc_sli_config_mbox *)dmabuf->virt; if (!bsg_bf_get(lpfc_mbox_hdr_emb, &sli_cfg_mbx->un.sli_config_emb0_subsys.sli_config_hdr)) { subsys = bsg_bf_get(lpfc_emb0_subcmnd_subsys, &sli_cfg_mbx->un.sli_config_emb0_subsys); opcode = bsg_bf_get(lpfc_emb0_subcmnd_opcode, &sli_cfg_mbx->un.sli_config_emb0_subsys); if (subsys == SLI_CONFIG_SUBSYS_FCOE) { switch (opcode) { case FCOE_OPCODE_READ_FCF: case FCOE_OPCODE_GET_DPORT_RESULTS: lpfc_printf_log(phba, KERN_INFO, LOG_LIBDFC, "2957 Handled SLI_CONFIG " "subsys_fcoe, opcode:x%x\n", opcode); rc = lpfc_bsg_sli_cfg_read_cmd_ext(phba, job, nemb_mse, dmabuf); break; case FCOE_OPCODE_ADD_FCF: case FCOE_OPCODE_SET_DPORT_MODE: case LPFC_MBOX_OPCODE_FCOE_LINK_DIAG_STATE: lpfc_printf_log(phba, KERN_INFO, LOG_LIBDFC, "2958 Handled SLI_CONFIG " "subsys_fcoe, opcode:x%x\n", opcode); rc = lpfc_bsg_sli_cfg_write_cmd_ext(phba, job, nemb_mse, dmabuf); break; default: lpfc_printf_log(phba, KERN_INFO, LOG_LIBDFC, "2959 Reject SLI_CONFIG " "subsys_fcoe, opcode:x%x\n", opcode); rc = -EPERM; break; } } else if (subsys == SLI_CONFIG_SUBSYS_COMN) { switch (opcode) { case COMN_OPCODE_GET_CNTL_ADDL_ATTRIBUTES: case COMN_OPCODE_GET_CNTL_ATTRIBUTES: case COMN_OPCODE_GET_PROFILE_CONFIG: lpfc_printf_log(phba, KERN_INFO, LOG_LIBDFC, "3106 Handled SLI_CONFIG " "subsys_comn, opcode:x%x\n", opcode); rc = lpfc_bsg_sli_cfg_read_cmd_ext(phba, job, nemb_mse, dmabuf); break; default: lpfc_printf_log(phba, KERN_INFO, LOG_LIBDFC, "3107 Reject SLI_CONFIG " "subsys_comn, opcode:x%x\n", opcode); rc = -EPERM; break; } } else { lpfc_printf_log(phba, KERN_INFO, LOG_LIBDFC, "2977 Reject SLI_CONFIG " "subsys:x%d, opcode:x%x\n", subsys, opcode); rc = -EPERM; } } else { subsys = bsg_bf_get(lpfc_emb1_subcmnd_subsys, &sli_cfg_mbx->un.sli_config_emb1_subsys); opcode = bsg_bf_get(lpfc_emb1_subcmnd_opcode, &sli_cfg_mbx->un.sli_config_emb1_subsys); if (subsys == SLI_CONFIG_SUBSYS_COMN) { switch (opcode) { case COMN_OPCODE_READ_OBJECT: case COMN_OPCODE_READ_OBJECT_LIST: lpfc_printf_log(phba, KERN_INFO, LOG_LIBDFC, "2960 Handled SLI_CONFIG " "subsys_comn, opcode:x%x\n", opcode); rc = lpfc_bsg_sli_cfg_read_cmd_ext(phba, job, nemb_hbd, dmabuf); break; case COMN_OPCODE_WRITE_OBJECT: lpfc_printf_log(phba, KERN_INFO, LOG_LIBDFC, "2961 Handled SLI_CONFIG " "subsys_comn, opcode:x%x\n", opcode); rc = lpfc_bsg_sli_cfg_write_cmd_ext(phba, job, nemb_hbd, dmabuf); break; default: lpfc_printf_log(phba, KERN_INFO, LOG_LIBDFC, "2962 Not handled SLI_CONFIG " "subsys_comn, opcode:x%x\n", opcode); rc = SLI_CONFIG_NOT_HANDLED; break; } } else { lpfc_printf_log(phba, KERN_INFO, LOG_LIBDFC, "2978 Not handled SLI_CONFIG " "subsys:x%d, opcode:x%x\n", subsys, opcode); rc = SLI_CONFIG_NOT_HANDLED; } } /* state reset on not handled new multi-buffer mailbox command */ if (rc != SLI_CONFIG_HANDLED) phba->mbox_ext_buf_ctx.state = LPFC_BSG_MBOX_IDLE; return rc; }
false
false
false
false
false
0
gst_plugin_finalize (GObject * object) { GstPlugin *plugin = GST_PLUGIN_CAST (object); GST_DEBUG ("finalizing plugin %" GST_PTR_FORMAT, plugin); /* FIXME: make registry add a weak ref instead */ #if 0 GstRegistry *registry = gst_registry_get (); GList *g; for (g = registry->plugins; g; g = g->next) { if (g->data == (gpointer) plugin) { g_warning ("removing plugin that is still in registry"); } } #endif g_free (plugin->filename); g_free (plugin->basename); g_list_foreach (plugin->priv->deps, (GFunc) gst_plugin_ext_dep_free, NULL); g_list_free (plugin->priv->deps); plugin->priv->deps = NULL; if (plugin->priv->cache_data) { gst_structure_free (plugin->priv->cache_data); } G_OBJECT_CLASS (gst_plugin_parent_class)->finalize (object); }
false
false
false
false
false
0
init_logging (int count,...){ _fFatal = stderr; _fError = stderr; _fWarn = stderr; _fInfo = stderr; _fDebug = stderr; va_list ap; int i/*,sum*/; va_start (ap, count); /* Initialize the argument list. */ for (i = 0; i < count; i++){ switch(i){ case 0: _fFatal = va_arg (ap, FILE*); /* Get the next argument value. */ break; case 1: _fError = va_arg (ap, FILE*); /* Get the next argument value. */ break; case 2: _fWarn = va_arg (ap, FILE*); /* Get the next argument value. */ break; case 3: _fInfo = va_arg (ap, FILE*); /* Get the next argument value. */ break; case 4: _fDebug = va_arg (ap, FILE*); /* Get the next argument value. */ break; default: break; } } va_end (ap); /* Clean up. */ }
false
false
false
false
false
0
gnm_style_required_spanflags (GnmStyle const *style) { GnmSpanCalcFlags res = GNM_SPANCALC_SIMPLE; if (gnm_style_is_element_set (style, MSTYLE_CONDITIONS)) /* Note that style->cond_styles may not be set yet */ /* More importantly, even if the conditions are empty we */ /* have to rerender everything since we do not know what changed. */ res |= GNM_SPANCALC_RE_RENDER | GNM_SPANCALC_RESIZE | GNM_SPANCALC_ROW_HEIGHT; else { gboolean const row_height = gnm_style_is_element_set (style, MSTYLE_FONT_SIZE) || gnm_style_is_element_set (style, MSTYLE_WRAP_TEXT) || gnm_style_is_element_set (style, MSTYLE_ROTATION) || gnm_style_is_element_set (style, MSTYLE_FONT_SCRIPT); gboolean const size_change = row_height || gnm_style_is_element_set (style, MSTYLE_FONT_NAME) || gnm_style_is_element_set (style, MSTYLE_FONT_BOLD) || gnm_style_is_element_set (style, MSTYLE_FONT_ITALIC); gboolean const format_change = gnm_style_is_element_set (style, MSTYLE_FORMAT) || gnm_style_is_element_set (style, MSTYLE_INDENT) || gnm_style_is_element_set (style, MSTYLE_ALIGN_H) || gnm_style_is_element_set (style, MSTYLE_ALIGN_V) || gnm_style_is_element_set (style, MSTYLE_FONT_STRIKETHROUGH) || gnm_style_is_element_set (style, MSTYLE_FONT_UNDERLINE) || gnm_style_is_element_set (style, MSTYLE_FONT_COLOR); if (row_height) res |= GNM_SPANCALC_ROW_HEIGHT; if (format_change || size_change) res |= GNM_SPANCALC_RE_RENDER | GNM_SPANCALC_RESIZE; } return res; }
false
false
false
false
false
0
ps30_output(struct svga_shader_emitter *emit, struct tgsi_declaration_semantic semantic, unsigned idx) { switch (semantic.Name) { case TGSI_SEMANTIC_COLOR: if (emit->unit == PIPE_SHADER_FRAGMENT) { if (emit->key.fkey.white_fragments) { /* Used for XOR logicop mode */ emit->output_map[idx] = dst_register( SVGA3DREG_TEMP, emit->nr_hw_temp++ ); emit->temp_color_output[idx] = emit->output_map[idx]; emit->true_color_output[idx] = dst_register(SVGA3DREG_COLOROUT, semantic.Index); } else if (emit->key.fkey.write_color0_to_n_cbufs) { /* We'll write color output [0] to all render targets. * Prepare all the output registers here, but only when the * semantic.Index == 0 so we don't do this more than once. */ if (semantic.Index == 0) { unsigned i; for (i = 0; i < emit->key.fkey.write_color0_to_n_cbufs; i++) { emit->output_map[idx+i] = dst_register(SVGA3DREG_TEMP, emit->nr_hw_temp++); emit->temp_color_output[i] = emit->output_map[idx+i]; emit->true_color_output[i] = dst_register(SVGA3DREG_COLOROUT, i); } } } else { emit->output_map[idx] = dst_register(SVGA3DREG_COLOROUT, semantic.Index); } } else { emit->output_map[idx] = dst_register( SVGA3DREG_COLOROUT, semantic.Index ); } break; case TGSI_SEMANTIC_POSITION: emit->output_map[idx] = dst_register( SVGA3DREG_TEMP, emit->nr_hw_temp++ ); emit->temp_pos = emit->output_map[idx]; emit->true_pos = dst_register( SVGA3DREG_DEPTHOUT, semantic.Index ); break; default: assert(0); /* A wild stab in the dark. */ emit->output_map[idx] = dst_register( SVGA3DREG_COLOROUT, 0 ); break; } return TRUE; }
false
false
false
false
false
0
do_menu (ScreenInfo * s) { if ((bar_hidden >= 0) && (numhidden > 0) && (bar_hidden < numhidden)) { bar_hidden = numhidden; update_tbar (); } else switch (-bar_hidden + MENU_BASE) { case 0: toggle_clickthru (s); break; case 1: toggle_tile_resize (s); break; case 2: toggle_skip_focus (s); break; case 3: toggle_isfloat (current); break; case 4: toggle_istool (current); break; case 5: toggle_issticky (current); break; } }
false
false
false
false
false
0
ethtool_get_default_settings(struct net_device *dev, struct ethtool_cmd *cmd) { struct mlx4_en_priv *priv = netdev_priv(dev); int trans_type; cmd->autoneg = AUTONEG_DISABLE; cmd->supported = SUPPORTED_10000baseT_Full; cmd->advertising = ADVERTISED_10000baseT_Full; trans_type = priv->port_state.transceiver; if (trans_type > 0 && trans_type <= 0xC) { cmd->port = PORT_FIBRE; cmd->transceiver = XCVR_EXTERNAL; cmd->supported |= SUPPORTED_FIBRE; cmd->advertising |= ADVERTISED_FIBRE; } else if (trans_type == 0x80 || trans_type == 0) { cmd->port = PORT_TP; cmd->transceiver = XCVR_INTERNAL; cmd->supported |= SUPPORTED_TP; cmd->advertising |= ADVERTISED_TP; } else { cmd->port = -1; cmd->transceiver = -1; } }
false
false
false
false
false
0
xdr_dis_time(xdrs, objp) XDR *xdrs; dis_time *objp; { if (!xdr_byte_u_long(xdrs, &objp->hour)) { return (FALSE); } if (!xdr_dis_timestamp(xdrs, &objp->rel)) { return (FALSE); } return (TRUE); }
false
false
false
false
false
0
color_from_player(int player) { unsigned long rv = 0; if(player == WHITE) rv = white_piece; else if(player == BLACK) rv = black_piece; else fprintf(stderr, "unknown player %d\n", player); return(rv); }
false
false
false
false
false
0
gst_file_index_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { GstFileIndex *index = GST_FILE_INDEX (object); switch (prop_id) { case ARG_LOCATION: if (index->location) g_free (index->location); index->location = g_value_dup_string (value); if (index->location && !g_hash_table_size (index->id_index)) gst_file_index_load (index); break; } }
false
false
false
false
false
0
init_once(void) { unsigned int i; if (uv_cond_init(&cond)) abort(); if (uv_mutex_init(&mutex)) abort(); ngx_queue_init(&wq); for (i = 0; i < ARRAY_SIZE(threads); i++) if (uv_thread_create(threads + i, worker, NULL)) abort(); initialized = 1; }
false
false
false
false
false
0
attachment_button_dispose (GObject *object) { EAttachmentButtonPrivate *priv; priv = E_ATTACHMENT_BUTTON_GET_PRIVATE (object); if (priv->view != NULL) { g_object_unref (priv->view); priv->view = NULL; } if (priv->attachment != NULL) { g_signal_handler_disconnect ( priv->attachment, priv->reference_handler_id); g_object_unref (priv->attachment); priv->attachment = NULL; } if (priv->expand_button != NULL) { g_object_unref (priv->expand_button); priv->expand_button = NULL; } if (priv->toggle_button != NULL) { g_object_unref (priv->toggle_button); priv->toggle_button = NULL; } if (priv->cell_view != NULL) { g_object_unref (priv->cell_view); priv->cell_view = NULL; } if (priv->popup_menu != NULL) { g_signal_handlers_disconnect_matched ( priv->popup_menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, object); g_object_unref (priv->popup_menu); priv->popup_menu = NULL; } /* Chain up to parent's dispose() method. */ G_OBJECT_CLASS (e_attachment_button_parent_class)->dispose (object); }
false
false
false
false
false
0
SMBencrypt(unsigned char *passwd, const unsigned char *c8, unsigned char *p24) { int rc; unsigned char p14[14], p16[16], p21[21]; memset(p14, '\0', 14); memset(p16, '\0', 16); memset(p21, '\0', 21); memcpy(p14, passwd, 14); rc = E_P16(p14, p16); if (rc) return rc; memcpy(p21, p16, 16); rc = E_P24(p21, c8, p24); return rc; }
false
false
false
false
false
0
SlowGetPointerFromInternalField(int index) { i::Handle<i::JSObject> obj = Utils::OpenHandle(this); i::Object* value = obj->GetInternalField(index); if (value->IsSmi()) { return i::Internals::GetExternalPointerFromSmi(value); } else if (value->IsForeign()) { return reinterpret_cast<void*>(i::Foreign::cast(value)->address()); } else { return NULL; } }
false
false
false
false
false
0
quiesce_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc) { quiesce_priv_t *priv = NULL; call_stub_t *stub = NULL; priv = this->private; if (priv->pass_through) { STACK_WIND (frame, default_unlink_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->unlink, loc); return 0; } stub = fop_unlink_stub (frame, default_unlink_resume, loc); if (!stub) { STACK_UNWIND_STRICT (unlink, frame, -1, ENOMEM, NULL, NULL); return 0; } gf_quiesce_enqueue (this, stub); return 0; }
false
false
false
false
false
0
create_regexp(const char *regstr, int options) { regex_t *exp; int errcode; int msgsize; char *errmsg; if((exp = (regex_t *) malloc(sizeof(regex_t)))) { if((errcode = regcomp(exp, regstr, (options & JG_IGNORE_CASE) ? REG_ICASE : 0))) { fprintf(stderr, "regcomp of regex failed,\n"); if((errmsg = (char *) malloc(msgsize = regerror(errcode, exp, NULL, 0) + 1))) { regerror(errcode, exp, errmsg, msgsize); fprintf(stderr, "Error: %s\n", errmsg); free(exp); free(errmsg); exit(EXIT_FAILURE); } else { fprintf(stderr, "Malloc of errmsg failed.\n"); fprintf(stderr, "Error: %s\n", strerror(errno)); free(exp); exit(EXIT_FAILURE); } } } else { fprintf(stderr, "Malloc of regex failed,\n"); fprintf(stderr, "Error: %s\n", strerror(errno)); exit(EXIT_FAILURE); } return exp; }
false
false
false
false
false
0
static_initialize() { // function called to initialize static globals if (!null_memo) { #if CLICK_DMALLOC CLICK_DMALLOC_REG("str0"); #endif null_memo = new Memo; null_memo->_refcount++; permanent_memo = new Memo; permanent_memo->_refcount++; // use a separate string for oom_memo's data, so we can distinguish // the pointer oom_memo = new Memo; oom_memo->_refcount++; oom_memo->_real_data = const_cast<char*>(&oom_string_data); null_string_p = new String; oom_string_p = new String(&oom_string_data, 0, oom_memo); #if CLICK_DMALLOC CLICK_DMALLOC_REG("????"); #endif } }
false
false
false
false
false
0
OnPaint(wxPaintEvent &event) { wxPaintDC dc(this); dc.SetMapMode(wxMM_TEXT); // paint the background image dc.DrawBitmap(*m_background, 0, 0); // paint the header: Barry logo m_barry_logo->Draw(dc); // paint the header: NetDirect logo // m_netdirect_logo->Draw(dc); // paint the header: text auto_ptr<wxFont> font( wxFont::New(14, wxFONTFAMILY_SWISS, wxFONTFLAG_ANTIALIASED, _T("Luxi Sans")) ); dc.SetFont( *font ); dc.SetTextForeground( wxColour(0xd2, 0xaf, 0x0b) ); dc.SetTextBackground( wxColour(0, 0, 0, wxALPHA_TRANSPARENT) ); long width, height, descent; wxString header = _W("Barry Desktop Control Panel"); if( m_current_mode ) header = m_current_mode->GetTitleText(); dc.GetTextExtent(header, &width, &height, &descent); int x = (m_width - width) / 2; int y = (MAIN_HEADER_OFFSET - height) / 2; dc.DrawText(header, x, y); // let the mode do its thing if( m_current_mode ) m_current_mode->OnPaint(dc); }
false
false
false
false
false
0
transfer(unsigned long long int n) { if (disabled) { last_time = time(NULL); return true; } time_t t = time(NULL); time_t dt = t - last_time; Nall += n; if (dt > T) N = (n * dt) / T; else N = (N * (T - dt)) / T + n; if ((t - first_time) >= T * 3) { /* make decision only after statistics settles */ /* check for speed */ if (N < (T * min_speed)) if (first_speed_failure != 0) { if (t > (first_speed_failure + min_speed_time)) min_speed_failed = true; } else first_speed_failure = t; else first_speed_failure = 0; /* check for avearge speed */ if ((min_average_speed * (t - first_time)) > Nall) min_average_speed_failed = true; /* check for inactivity time */ if (t > (last_activity_time + max_inactivity_time)) max_inactivity_time_failed = true; } if (n > 0) last_activity_time = t; last_time = t; if (be_verbose) /* statistics to screen */ if ((t - last_printed) >= 1) { print_statistics(stderr, t); last_printed = t; } return !(min_speed_failed || min_average_speed_failed || max_inactivity_time_failed); }
false
false
false
false
false
0
load_metadata_backend (void) { static gsize backend_chosen = 0; if (g_once_init_enter (&backend_chosen)) { gchar **environment = g_get_environ (); const gchar *backend = g_environ_getenv (environment, "GUPNP_DLNA_METADATA_BACKEND"); const gchar *backend_dir = g_environ_getenv (environment, "GUPNP_DLNA_METADATA_BACKEND_DIR"); GModule *module; gchar *module_path; gpointer get_default_extractor = NULL; gsize loaded = 0; if (!backend) backend = GUPNP_DLNA_DEFAULT_METADATA_BACKEND; if (!backend_dir) backend_dir = GUPNP_DLNA_DEFAULT_METADATA_BACKEND_DIR; module_path = g_module_build_path (backend_dir, backend); module = g_module_open (module_path, G_MODULE_BIND_MASK); if (!module) { g_warning ("Could not load open metadata backend '%s'.", module_path); goto fail; } if (!g_module_symbol (module, GET_DEFAULT_EXTRACTOR_SYMBOL, &get_default_extractor)) { g_warning ("Could not find '" GET_DEFAULT_EXTRACTOR_SYMBOL "' symbol in '%s'.", module_path); goto fail; } if (!get_default_extractor) { g_warning ("'" GET_DEFAULT_EXTRACTOR_SYMBOL "' symbol in '%s' is invalid.", module_path); goto fail; } g_module_make_resident (module); metadata_backend.module = module; metadata_backend.get_default_extractor = get_default_extractor; module = NULL; loaded = 1; fail: g_free (module_path); if (module) g_module_close (module); g_strfreev (environment); g_once_init_leave (&backend_chosen, loaded); } return (backend_chosen != 0); }
false
false
false
false
false
0
ves_icall_MonoMethod_get_base_method (MonoReflectionMethod *m, gboolean definition) { MonoClass *klass, *parent; MonoMethod *method = m->method; MonoMethod *result = NULL; int slot; MONO_ARCH_SAVE_REGS; if (method->klass == NULL) return m; if (!(method->flags & METHOD_ATTRIBUTE_VIRTUAL) || MONO_CLASS_IS_INTERFACE (method->klass) || method->flags & METHOD_ATTRIBUTE_NEW_SLOT) return m; slot = mono_method_get_vtable_slot (method); if (slot == -1) return m; klass = method->klass; if (klass->generic_class) klass = klass->generic_class->container_class; if (definition) { /* At the end of the loop, klass points to the eldest class that has this virtual function slot. */ for (parent = klass->parent; parent != NULL; parent = parent->parent) { mono_class_setup_vtable (parent); if (parent->vtable_size <= slot) break; klass = parent; } } else { klass = klass->parent; if (!klass) return m; } if (klass == method->klass) return m; /*This is possible if definition == FALSE. * Do it here to be really sure we don't read invalid memory. */ if (slot >= klass->vtable_size) return m; mono_class_setup_vtable (klass); result = klass->vtable [slot]; if (result == NULL) { /* It is an abstract method */ gpointer iter = NULL; while ((result = mono_class_get_methods (klass, &iter))) if (result->slot == slot) break; } if (result == NULL) return m; return mono_method_get_object (mono_domain_get (), result, NULL); }
false
false
false
false
false
0
Clean(CommandLine &CmdL) { if (CmdL.FileSize() != 2) return ShowHelp(CmdL); // Read the configuration file. Configuration Setup; if (ReadConfigFile(Setup,CmdL.FileList[1],true) == false) return false; vector<PackageMap> PkgList; LoadTree(PkgList,Setup); LoadBinDir(PkgList,Setup); // Sort by cache DB to improve IO locality. stable_sort(PkgList.begin(),PkgList.end(),PackageMap::DBCompare()); string CacheDir = Setup.FindDir("Dir::CacheDir"); for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); ) { c0out << I->BinCacheDB << endl; CacheDB DB(flCombine(CacheDir,I->BinCacheDB)); if (DB.Clean() == false) _error->DumpErrors(); string CacheDB = I->BinCacheDB; for (; I != PkgList.end() && I->BinCacheDB == CacheDB; ++I); } return true; }
false
false
false
false
false
0
blockSeqCodeCopy(MethodBlock *mb, TestCodeBlock *block, BasicBlock *start, int ins_start, BasicBlock *end, int ins_end) { char *code_pntr = (char *)(block + 1); BasicBlock *patchers, *ext_patchers = NULL; Instruction *ins_start_pntr = &start->start[ins_start]; char *map[end->start - start->start - ins_start + ins_end + 1]; block->patchers = NULL; if(start == end) code_pntr = insSeqCodeCopy(code_pntr, ins_start_pntr, map, &block->patchers, start, ins_start, ins_end - ins_start + 1); else { code_pntr = insSeqCodeCopy(code_pntr, ins_start_pntr, map, &block->patchers, start, ins_start, start->length - ins_start); for(start = start->next; start != end; start = start->next) code_pntr = insSeqCodeCopy(code_pntr, ins_start_pntr, map, &block->patchers, start, 0, start->length); code_pntr = insSeqCodeCopy(code_pntr, ins_start_pntr, map, &block->patchers, end, 0, ins_end + 1); } for(patchers = block->patchers; patchers != NULL;) { Instruction *target = patchers->start[patchers->length - 1].operand.pntr; BasicBlock *next = patchers->u.patch.next; if(target >= ins_start_pntr && target <= end->start) { if(GEN_REL_JMP(map[target - ins_start_pntr], patchers->u.patch.addr, goto_len)) { TRACE("Patched branch within block\n"); } } else { inlineProfiledBlock(target, mb, TRUE); patchers->u.patch.next = ext_patchers; ext_patchers = patchers; } patchers = next; } block->patchers = ext_patchers; return code_pntr; }
false
false
false
false
false
0
soc_pcm_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg) { struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_platform *platform = rtd->platform; if (platform->driver->ops && platform->driver->ops->ioctl) return platform->driver->ops->ioctl(substream, cmd, arg); return snd_pcm_lib_ioctl(substream, cmd, arg); }
false
false
false
false
false
0
free_script_list (script_t * script) { script_t *next; while (script) { next = script->next; if (script->name) free (script->name); if (script->buf) free (script->buf); free (script); script = next; } }
false
false
false
false
false
0
sig_left() { if (!first) return (0); unsigned n=alarm(0); return (n ? n <= first->set_interval ? first->set_interval - n:0:0); }
false
false
false
false
false
0
setPolyFlags(dtPolyRef ref, unsigned short flags) { unsigned int salt, it, ip; decodePolyId(ref, salt, it, ip); if (it >= (unsigned int)m_maxTiles) return DT_FAILURE; if (m_tiles[it].salt != salt || m_tiles[it].header == 0) return DT_FAILURE; dtMeshTile* tile = &m_tiles[it]; if (ip >= (unsigned int)tile->header->polyCount) return DT_FAILURE; dtPoly* poly = &tile->polys[ip]; // Change flags. poly->flags = flags; return DT_SUCCESS; }
false
false
false
false
false
0
eappeap_failure(EAP_HANDLER *handler, tls_session_t *tls_session) { uint8_t tlv_packet[11]; REQUEST *request = handler->request; RDEBUG2("FAILURE"); tlv_packet[0] = PW_EAP_REQUEST; tlv_packet[1] = handler->eap_ds->response->id +1; tlv_packet[2] = 0; tlv_packet[3] = 11; /* length of this packet */ tlv_packet[4] = PW_EAP_TLV; tlv_packet[5] = 0x80; tlv_packet[6] = EAP_TLV_ACK_RESULT; tlv_packet[7] = 0; tlv_packet[8] = 2; /* length of the data portion */ tlv_packet[9] = 0; tlv_packet[10] = EAP_TLV_FAILURE; (tls_session->record_plus)(&tls_session->clean_in, tlv_packet, 11); /* * FIXME: Check the return code. */ tls_handshake_send(request, tls_session); return 1; }
false
false
false
false
false
0
collection_save_private(CollectionData *cd, const gchar *path) { SecureSaveInfo *ssi; GList *work; gchar *pathl; if (!path && !cd->path) return FALSE; if (!path) { path = cd->path; } pathl = path_from_utf8(path); ssi = secure_open(pathl); g_free(pathl); if (!ssi) { log_printf(_("failed to open collection (write) \"%s\"\n"), path); return FALSE; } secure_fprintf(ssi, "%s collection\n", GQ_COLLECTION_MARKER); secure_fprintf(ssi, "#created with %s version %s\n", GQ_APPNAME, VERSION); collection_update_geometry(cd); if (cd->window_read) { secure_fprintf(ssi, "#geometry: %d %d %d %d\n", cd->window_x, cd->window_y, cd->window_w, cd->window_h); } work = cd->list; while (work && secsave_errno == SS_ERR_NONE) { CollectInfo *ci = work->data; secure_fprintf(ssi, "\"%s\"\n", ci->fd->path); work = work->next; } secure_fprintf(ssi, "#end\n"); if (secure_close(ssi)) { log_printf(_("error saving collection file: %s\nerror: %s\n"), path, secsave_strerror(secsave_errno)); return FALSE; } if (!cd->path || strcmp(path, cd->path) != 0) { gchar *buf = cd->path; cd->path = g_strdup(path); path = cd->path; g_free(buf); g_free(cd->name); cd->name = g_strdup(filename_from_path(cd->path)); collection_path_changed(cd); } cd->changed = FALSE; return TRUE; }
false
false
false
false
false
0
rtp_source_timeout (RTPSource * src, GstClockTime current_time, GstClockTime collision_timeout, GstClockTime feedback_retention_window) { GList *item; GstRTCPPacket *pkt; item = g_list_first (src->conflicting_addresses); while (item) { RTPConflictingAddress *known_conflict = item->data; GList *next_item = g_list_next (item); if (known_conflict->time < current_time - collision_timeout) { gchar *buf; src->conflicting_addresses = g_list_delete_link (src->conflicting_addresses, item); buf = __g_socket_address_to_string (known_conflict->address); GST_DEBUG ("collision %p timed out: %s", known_conflict, buf); g_free (buf); g_object_unref (known_conflict->address); g_free (known_conflict); } item = next_item; } /* Time out AVPF packets that are older than the desired length */ while ((pkt = g_queue_peek_tail (src->retained_feedback)) && GST_BUFFER_TIMESTAMP (pkt) < feedback_retention_window) gst_buffer_unref (g_queue_pop_tail (src->retained_feedback)); }
false
false
false
false
false
0
vacuum_one_database(const char *dbname, bool full, bool verbose, bool analyze, const char *table, const char *host, const char *port, const char *username, bool password, const char *progname, bool echo, bool quiet) { PQExpBufferData sql; PGconn *conn; PGresult *result; initPQExpBuffer(&sql); appendPQExpBuffer(&sql, "VACUUM"); if (full) appendPQExpBuffer(&sql, " FULL"); if (verbose) appendPQExpBuffer(&sql, " VERBOSE"); if (analyze) appendPQExpBuffer(&sql, " ANALYZE"); if (table) appendPQExpBuffer(&sql, " %s", table); appendPQExpBuffer(&sql, ";\n"); conn = connectDatabase(dbname, host, port, username, password, progname); if (echo) printf("%s", sql.data); result = PQexec(conn, sql.data); if (PQresultStatus(result) != PGRES_COMMAND_OK) { if (table) fprintf(stderr, _("%s: vacuuming of table \"%s\" in database \"%s\" failed: %s"), progname, table, dbname, PQerrorMessage(conn)); else fprintf(stderr, _("%s: vacuuming of database \"%s\" failed: %s"), progname, dbname, PQerrorMessage(conn)); PQfinish(conn); exit(1); } PQclear(result); PQfinish(conn); termPQExpBuffer(&sql); if (!quiet) { puts("VACUUM"); fflush(stdout); } }
false
false
false
false
false
0
test_model(Affine_Model_Type type, C4_Score expected_score){ register C4_Model *affine = Affine_create(type, Alphabet_Type_PROTEIN, Alphabet_Type_PROTEIN, FALSE); /**/ register C4_Score score; register Alignment *alignment; register gchar *name = NULL; register Optimal *optimal; register Alphabet *alphabet = Alphabet_create(Alphabet_Type_PROTEIN, FALSE); register Sequence *query = Sequence_create("qy", NULL, "MEEPQSDPSVEPPLSQETFSDLWKLL", 0, Sequence_Strand_UNKNOWN, alphabet), *target = Sequence_create("tg", NULL, "PENNVLSPLPSQAMDDLMLSPDDIEQWFTEDPGP" "EHSCETFDIWKWCPIECDFLNVISEPNEPIPSQ", 0, Sequence_Strand_UNKNOWN, alphabet); register Affine_Data *ad = Affine_Data_create(query, target, FALSE); /* "TVPEPIVTEPTTITEPEVPEKEEPKAEVEKTKKAKGSKPKKASKPRNPA" "SHPTYEEMIKDAIVSLKEKNGSSQYAIA", "VVEEQAAPETVKDEANPPAKSGKAKKETKAKKPAAPRKRSATPTHPPYF" "EMIKDAIVTLKERTGSSQHAIT", */ /* Paracelsus challenge sequences: */ /* "MTYKLILNGKTLKGETTTEAVDAATAEKVFKQYANDNGVDGEWTYDDATKTFTVTE", "MTKKAILALNTAKFLRTQAAVLAAKLEKLGAQEANDNAVDLEDTADDLYKTLLVLA", */ Region region; /**/ switch(type){ case Affine_Model_Type_GLOBAL: name = "global affine"; break; case Affine_Model_Type_BESTFIT: name = "bestfit affine"; break; case Affine_Model_Type_LOCAL: name = "local affine"; break; case Affine_Model_Type_OVERLAP: name = "overlap affine"; break; default: g_error("Model Type not supported [%d]", type); break; } optimal = Optimal_create(affine, NULL, Optimal_Type_SCORE|Optimal_Type_PATH, FALSE); /**/ Region_init_static(&region, 0, 0, ad->ud.query->len, ad->ud.target->len); score = Optimal_find_score(optimal, &region, ad, NULL); g_message("Score for [%s] [%d]", name, score); g_assert(score == expected_score); /**/ alignment = Optimal_find_path(optimal, &region, ad, C4_IMPOSSIBLY_LOW_SCORE, NULL); g_message("Alignment score is [%d]", alignment->score); Alignment_display(alignment, query, target, Affine_Data_get_dna_submat(ad), Affine_Data_get_protein_submat(ad), NULL, stdout); Alignment_display_vulgar(alignment, query, target, stdout); g_assert(score == alignment->score); /**/ C4_Model_destroy(affine); Alignment_destroy(alignment); Optimal_destroy(optimal); Affine_Data_destroy(ad); Sequence_destroy(query); Sequence_destroy(target); Alphabet_destroy(alphabet); return; }
false
false
false
false
false
0
CommaSeparateAndAddOccurrence(Option *Handler, unsigned pos, StringRef ArgName, StringRef Value, bool MultiArg = false) { // Check to see if this option accepts a comma separated list of values. If // it does, we have to split up the value into multiple values. if (Handler->getMiscFlags() & CommaSeparated) { StringRef Val(Value); StringRef::size_type Pos = Val.find(','); while (Pos != StringRef::npos) { // Process the portion before the comma. if (Handler->addOccurrence(pos, ArgName, Val.substr(0, Pos), MultiArg)) return true; // Erase the portion before the comma, AND the comma. Val = Val.substr(Pos + 1); Value.substr(Pos + 1); // Increment the original value pointer as well. // Check for another comma. Pos = Val.find(','); } Value = Val; } if (Handler->addOccurrence(pos, ArgName, Value, MultiArg)) return true; return false; }
false
false
false
false
false
0
AssembleOutputPoints( vtkIdType timeStep, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output ) { (void)timeStep; vtkPoints* pts = output->GetPoints(); if ( ! pts ) { pts = vtkPoints::New(); output->SetPoints( pts ); pts->FastDelete(); } else { pts->Reset(); } int ts = -1; // If we don't have displacements, only cache the array under one key. if ( this->ApplyDisplacements && this->FindDisplacementVectors( timeStep ) ) { // Otherwise, each time step's array will be different. ts = timeStep; } vtkDataArray* arr = this->GetCacheOrRead( vtkExodusIICacheKey( ts, vtkExodusIIReader::NODAL_COORDS, 0, 0 ) ); if ( ! arr ) { vtkErrorMacro( "Unable to read points from file." ); return 0; } if ( this->SqueezePoints ) { pts->SetNumberOfPoints( bsinfop->NextSqueezePoint ); std::map<vtkIdType,vtkIdType>::iterator it; for ( it = bsinfop->PointMap.begin(); it != bsinfop->PointMap.end(); ++ it ) { pts->SetPoint( it->second, arr->GetTuple( it->first ) ); } } else { pts->SetData( arr ); } return 1; }
false
false
false
false
false
0
PeerListInquire(const Request &request) { QHash<QByteArray, QUrl> id_to_addr; const Id &my_id = GetConnectionManager()->GetId(); const ConnectionTable &ct = GetConnectionManager()->GetConnectionTable(); foreach(const QSharedPointer<Connection> &con, ct.GetConnections()) { if(con->GetRemoteId() == my_id) { continue; } QUrl url = con->GetEdge()->GetRemotePersistentAddress().GetUrl(); QByteArray id = con->GetRemoteId().GetByteArray(); id_to_addr[id] = url; } QByteArray plm; QDataStream out_stream(&plm, QIODevice::WriteOnly); out_stream << id_to_addr; request.Respond(plm); }
false
false
false
false
false
0
readnumf(num) char *num; /* read integer from string without advancing character pointer */ { int t; char* p; p =num; if (!isdigit(*p)) { event_error("Missing Number"); }; t = 0; while (((int)*p >= '0') && ((int)*p <= '9')) { t = t * 10 + (int) *p - '0'; p = p + 1; }; return (t); }
false
false
false
false
false
0