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
main(int argc, char* argv[]) { if (argc != 2) { printf("uso: %s <input_file>. Try again!\n", argv[0]); exit(-1); } yyin = fopen(argv[1], "r"); if (!yyin) { printf("Uso: %s <input_file>. Could not find %s. Try again!\n", argv[0], argv[1]); exit(-1); } progname = argv[0]; if (!yyparse()) printf("OKAY.\n"); else printf("ERROR.\n"); return(0); }
false
false
false
false
true
1
new_bytes(struct ring_buffer *rbuf, gpointer user_data) { GAtHDLC *hdlc = user_data; unsigned int len = ring_buffer_len(rbuf); unsigned int wrap = ring_buffer_len_no_wrap(rbuf); unsigned char *buf = ring_buffer_read_ptr(rbuf, 0); unsigned int pos = 0; hdlc_record(hdlc->record_fd, TRUE, buf, wrap); hdlc->in_read_handler = TRUE; while (pos < len) { if (hdlc->decode_escape == TRUE) { unsigned char val = *buf ^ HDLC_TRANS; hdlc->decode_buffer[hdlc->decode_offset++] = val; hdlc->decode_fcs = HDLC_FCS(hdlc->decode_fcs, val); hdlc->decode_escape = FALSE; } else if (*buf == HDLC_ESCAPE) { hdlc->decode_escape = TRUE; } else if (*buf == HDLC_FLAG) { if (hdlc->receive_func && hdlc->decode_offset > 2 && hdlc->decode_fcs == HDLC_GOODFCS) { hdlc->receive_func(hdlc->decode_buffer, hdlc->decode_offset - 2, hdlc->receive_data); if (hdlc->destroyed) goto out; } hdlc->decode_fcs = HDLC_INITFCS; hdlc->decode_offset = 0; } else if (*buf >= 0x20 || (hdlc->recv_accm & (1 << *buf)) == 0) { hdlc->decode_buffer[hdlc->decode_offset++] = *buf; hdlc->decode_fcs = HDLC_FCS(hdlc->decode_fcs, *buf); } buf++; pos++; if (pos == wrap) { buf = ring_buffer_read_ptr(rbuf, pos); hdlc_record(hdlc->record_fd, TRUE, buf, len - wrap); } } ring_buffer_drain(rbuf, pos); out: hdlc->in_read_handler = FALSE; if (hdlc->destroyed) g_free(hdlc); }
false
false
false
false
false
0
vfp_esi_bytes(struct sess *sp, struct http_conn *htc, ssize_t bytes) { int i; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); AN(sp->wrk->vep); if (sp->wrk->is_gzip && sp->wrk->do_gunzip) i = vfp_esi_bytes_gu(sp, htc, bytes); else if (sp->wrk->is_gunzip && sp->wrk->do_gzip) i = vfp_esi_bytes_ug(sp, htc, bytes); else if (sp->wrk->is_gzip) i = vfp_esi_bytes_gg(sp, htc, bytes); else i = vfp_esi_bytes_uu(sp, htc, bytes); AN(sp->wrk->vep); return (i); }
false
false
false
true
false
1
drawDealRowOrRedeal() { stop(); if ( isCardAnimationRunning() ) { m_newCardsQueued = true; return; } m_newCardsQueued = false; newCards(); }
false
false
false
false
false
0
Ingroupstate(long i) { /* the ingroup state for the i-th character */ boolean outstate; if (noroot) { outstate = Data[0]->vec[i - 1]; return (!outstate); } if (ancvar) outstate = ancone[i - 1]; else outstate = Data[outgrno - 1]->vec[i - 1]; return (!outstate); }
false
false
false
false
false
0
vsum(v) vari *v; { int i; double z; z = 0.0; for (i=0; i<vlength(v); i++) z += vitem(v,i); return(z); }
false
false
false
false
false
0
lookup (int *nhits, T this, Shortoligomer_T masked) { #ifdef DEBUG char *aa, *nt; #endif if ((*nhits = this->counts[masked]) >= 1) { #ifdef PMAP debug(aa = aaindex_aa(masked,this->indexsize_aa); printf("masked %s => %d entries: %u...%u\n", aa,*nhits,this->positions[masked][0],this->positions[masked][*nhits-1]); FREE(aa)); #else debug(nt = shortoligo_nt(masked,this->indexsize); printf("masked %s => %d entries: %u...%u\n", nt,*nhits,this->positions[masked][0],this->positions[masked][*nhits-1]); FREE(nt)); #endif return this->positions[masked]; } else { #ifdef PMAP debug(aa = aaindex_aa(masked,this->indexsize_aa); printf("masked %s not found\n",aa); FREE(aa)); #else debug(nt = shortoligo_nt(masked,this->indexsize); printf("masked %s not found\n",nt); FREE(nt)); #endif /* Warning: *nhits might be -1 here, but shouldn't affect anything */ return NULL; } }
false
false
false
false
false
0
typedefHandler(Node *n) { /* since this is a recurring issue, we are going to remember the typedef pointer, if already it is not a pointer or reference, as in typedef void NT; int func(NT *p); see director_basic.i for example. */ SwigType *name = Getattr(n, "name"); SwigType *decl = Getattr(n, "decl"); if (!SwigType_ispointer(decl) && !SwigType_isreference(decl)) { SwigType *pname = Copy(name); SwigType_add_pointer(pname); SwigType_remember(pname); Delete(pname); } return SWIG_OK; }
false
false
false
false
false
0
log_in_clicked (GtkWidget *button, gpointer user_data) { BishoPaneOauth *pane = BISHO_PANE_OAUTH (user_data); BishoPaneOauthPrivate *priv = pane->priv; ServiceInfo *info = BISHO_PANE (pane)->info; GError *error = NULL; if (oauth_proxy_request_token_async (OAUTH_PROXY (priv->proxy), priv->request_token_function, priv->callback, request_token_cb, NULL, pane, &error)) { update_widgets (pane, WORKING); } else { update_widgets (pane, LOGGED_OUT); g_message ("Error from %s: %s", info->name, error->message); bisho_pane_set_banner_error (BISHO_PANE (pane), error); g_error_free (error); return; } }
false
false
false
false
false
0
i40e_vc_config_irq_map_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) { struct i40e_virtchnl_irq_map_info *irqmap_info = (struct i40e_virtchnl_irq_map_info *)msg; struct i40e_virtchnl_vector_map *map; u16 vsi_id, vsi_queue_id, vector_id; i40e_status aq_ret = 0; unsigned long tempmap; int i; if (!test_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states)) { aq_ret = I40E_ERR_PARAM; goto error_param; } for (i = 0; i < irqmap_info->num_vectors; i++) { map = &irqmap_info->vecmap[i]; vector_id = map->vector_id; vsi_id = map->vsi_id; /* validate msg params */ if (!i40e_vc_isvalid_vector_id(vf, vector_id) || !i40e_vc_isvalid_vsi_id(vf, vsi_id)) { aq_ret = I40E_ERR_PARAM; goto error_param; } /* lookout for the invalid queue index */ tempmap = map->rxq_map; for_each_set_bit(vsi_queue_id, &tempmap, I40E_MAX_VSI_QP) { if (!i40e_vc_isvalid_queue_id(vf, vsi_id, vsi_queue_id)) { aq_ret = I40E_ERR_PARAM; goto error_param; } } tempmap = map->txq_map; for_each_set_bit(vsi_queue_id, &tempmap, I40E_MAX_VSI_QP) { if (!i40e_vc_isvalid_queue_id(vf, vsi_id, vsi_queue_id)) { aq_ret = I40E_ERR_PARAM; goto error_param; } } i40e_config_irq_link_list(vf, vsi_id, map); } error_param: /* send the response to the VF */ return i40e_vc_send_resp_to_vf(vf, I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP, aq_ret); }
false
false
false
false
false
0
field_list(DB_DATABASE * db, const char *table, char ***fields) { const char *query = "PRAGMA table_info('&1')"; int i, n; Dataset *res; if (do_query(db, "Unable to get fields: &1", &res, query, 1, table)) { return -1; } result_set *r = (result_set *) res->getExecRes(); n = r->records.size(); if (fields) /* (BM) see the function commentary */ { GB.NewArray(fields, sizeof(char *), n); for (i = 0; i < n; i++) { (*fields)[i] = GB.NewZeroString(r->records[i][1].get_asString().data()); } } res->close(); return n; }
false
false
false
false
false
0
base_name(const char *file) { const char *cp1; const char *cp2; cp1 = strrchr(file, '/'); if (cp1) ++cp1; else cp1 = file; cp2 = strrchr(cp1, '.'); if (!cp2) cp2 = cp1 + strlen(cp1); if (cp2 > cp1 + 6) return str_n_from_c(cp1, 6); return str_n_from_c(cp1, cp2 - cp1); }
false
false
false
false
false
0
loadFromConfigFile( const mrpt::utils::CConfigFileBase &iniFile, const std::string &section) { MRPT_LOAD_CONFIG_VAR_CAST(likelihoodMethod, int, TLikelihoodMethod, iniFile, section); enableLikelihoodCache = iniFile.read_bool(section,"enableLikelihoodCache",enableLikelihoodCache); LF_stdHit = iniFile.read_float(section,"LF_stdHit",LF_stdHit); LF_zHit = iniFile.read_float(section,"LF_zHit",LF_zHit); LF_zRandom = iniFile.read_float(section,"LF_zRandom",LF_zRandom); LF_maxRange = iniFile.read_float(section,"LF_maxRange",LF_maxRange); LF_decimation = iniFile.read_int(section,"LF_decimation",LF_decimation); LF_maxCorrsDistance = iniFile.read_float(section,"LF_maxCorrsDistance",LF_maxCorrsDistance); LF_useSquareDist = iniFile.read_bool(section,"LF_useSquareDist",LF_useSquareDist); LF_alternateAverageMethod = iniFile.read_bool(section,"LF_alternateAverageMethod",LF_alternateAverageMethod); MI_exponent = iniFile.read_float(section,"MI_exponent",MI_exponent); MI_skip_rays = iniFile.read_int(section,"MI_skip_rays",MI_skip_rays); MI_ratio_max_distance = iniFile.read_float(section,"MI_ratio_max_distance",MI_ratio_max_distance); rayTracing_useDistanceFilter = iniFile.read_bool(section,"rayTracing_useDistanceFilter",rayTracing_useDistanceFilter); rayTracing_stdHit = iniFile.read_float(section,"rayTracing_stdHit",rayTracing_stdHit); consensus_takeEachRange = iniFile.read_int(section,"consensus_takeEachRange",consensus_takeEachRange); consensus_pow = iniFile.read_float(section,"consensus_pow",consensus_pow); iniFile.read_vector(section,"OWA_weights",OWA_weights,OWA_weights); }
false
false
false
false
false
0
deleteSubAndPurgeFile(const unsigned long num) { DcmDirectoryRecord *subDirRec = OFstatic_cast(DcmDirectoryRecord *, lowerLevelList->remove(num)); errorFlag = lowerLevelList->error(); if (subDirRec != NULL) { DcmDirectoryRecord *localSubRefMRDR = subDirRec->getReferencedMRDR(); if (localSubRefMRDR != NULL) { // file is referenced (indirect) localSubRefMRDR->decreaseRefNum(); } else // remove file directly errorFlag = subDirRec->purgeReferencedFile(); DCMDATA_DEBUG("DcmDirectoryRecord::deleteSubAndPurgeFile() now purging lower records:"); while (subDirRec->cardSub() > 0) // remove all sub sub records subDirRec->deleteSubAndPurgeFile(OFstatic_cast(unsigned long, 0)); delete subDirRec; // remove sub directory record } return errorFlag; }
false
false
false
false
false
0
find_formats (void) { unsigned int i; for (i = 0; i < NUM_RTX_CODE; i++) { const char **f; if (special_format (defs[i].format)) continue; for (f = formats; *f; f++) if (! strcmp (*f, defs[i].format)) break; if (*f == 0) *f = defs[i].format; } }
false
false
false
false
false
0
CmdBox(int code) /****************************************************************************** purpose: converts the LaTeX \box-commands into an similar Rtf-style ******************************************************************************/ { char BoxName[7][10] = { "hbox", "vbox", "mbox", "fbox", "parbox", "makebox", "framebox" }; int mode = getTexMode(); diagnostics(4, "Entering CmdBox() [%s]", BoxName[code - 1]); /* if (g_processing_fields) g_processing_fields++; hack to stop fields within fields */ if (code == BOX_HBOX || code == BOX_MBOX) changeTexMode(MODE_RESTRICTED_HORIZONTAL); if (code == BOX_PARBOX) { char *position, *width; position = getBracketParam(); width = getBraceParam(); if (position) free(position); free(width); } if (code == BOX_MAKEBOX || code == BOX_FRAMEBOX) { char *position, *width; position = getBracketParam(); width = getBracketParam(); if (position) free(position); if (width) free(width); } diagnostics(4, "Entering Convert() from CmdBox"); Convert(); diagnostics(4, "Exiting Convert() from CmdBox"); /* if (g_processing_fields) g_processing_fields--;*/ if (code == BOX_VBOX) { CmdEndParagraph(0); CmdIndent(INDENT_INHIBIT); } else { changeTexMode(mode); } diagnostics(4, "Exited CmdBox() [%s]", BoxName[code - 1]); }
false
false
false
false
false
0
ShowFileDetailDialog(long index) { // Make list of part files in control std::vector<CPartFile *> files; int nrItems = GetItemCount(); files.reserve(nrItems); for (int i = 0; i < nrItems; i++) { // ADUNANZA BEGIN // backport #if 0 files.push_back(((FileCtrlItem_Struct*)GetItemData(i))->GetFile()); #else files.push_back(reinterpret_cast<FileCtrlItem_Struct*>(GetItemData(i))->GetFile()); #endif // ADUNANZA END } bool autosort = thePrefs::AutoSortDownload(false); CFileDetailDialog(this, files, index).ShowModal(); thePrefs::AutoSortDownload(autosort); }
false
false
false
false
false
0
i40evf_allocate_virt_mem_d(struct i40e_hw *hw, struct i40e_virt_mem *mem, u32 size) { if (!mem) return I40E_ERR_PARAM; mem->size = size; mem->va = kzalloc(size, GFP_KERNEL); if (mem->va) return 0; else return I40E_ERR_NO_MEMORY; }
false
false
false
false
false
0
dBodySetFiniteRotationMode (dBodyID b, int mode) { dAASSERT (b); b->flags &= ~(dxBodyFlagFiniteRotation | dxBodyFlagFiniteRotationAxis); if (mode) { b->flags |= dxBodyFlagFiniteRotation; if (b->finite_rot_axis[0] != 0 || b->finite_rot_axis[1] != 0 || b->finite_rot_axis[2] != 0) { b->flags |= dxBodyFlagFiniteRotationAxis; } } }
false
false
false
false
false
0
tick() { checkCollisions(); foreach( KBounceBall* ball, m_balls ) { ball->goForward(); } foreach( KBounceWall* wall, m_walls ) { wall->goForward(); } foreach( KBounceBall* ball, m_balls ) { ball->update(); } foreach( KBounceWall* wall, m_walls ) { wall->update(); } }
false
false
false
false
false
0
getBuildingHeight( const BuildingType* type ) { int miny = maxint; int maxy = minint; for ( int y = 0; y < 6; ++y ) for ( int x = 0; x < 4; ++x ) if ( type->fieldExists( BuildingType::LocalCoordinate( x, y ))) { miny = min( miny, y ); maxy = max( maxy, y ); } return (maxy - miny) * fielddisty + fieldsizey; }
false
false
false
false
false
0
funcname_signature_string(const char *funcname, int nargs, const Oid *argtypes) { StringInfoData argbuf; int i; initStringInfo(&argbuf); appendStringInfo(&argbuf, "%s(", funcname); for (i = 0; i < nargs; i++) { if (i) appendStringInfoString(&argbuf, ", "); appendStringInfoString(&argbuf, format_type_be(argtypes[i])); } appendStringInfoChar(&argbuf, ')'); return argbuf.data; /* return palloc'd string buffer */ }
false
false
false
false
true
1
control_init(struct audio_device *dev, uint16_t uuid16) { struct control *control; if (!g_dbus_register_interface(dev->conn, dev->path, AUDIO_CONTROL_INTERFACE, control_methods, control_signals, NULL, dev, path_unregister)) return NULL; DBG("Registered interface %s on path %s", AUDIO_CONTROL_INTERFACE, dev->path); control = g_new0(struct control, 1); control->dev = dev; control_update(control, uuid16); if (!avctp_id) avctp_id = avctp_add_state_cb(state_changed, NULL); return control; }
false
false
false
false
false
0
audio_convert_get_func_index (AudioConvertCtx * ctx, const GstAudioFormatInfo * fmt) { gint index = 0; if (GST_AUDIO_FORMAT_INFO_IS_INTEGER (fmt)) { index += (GST_AUDIO_FORMAT_INFO_WIDTH (fmt) / 8 - 1) * 4; index += GST_AUDIO_FORMAT_INFO_IS_LITTLE_ENDIAN (fmt) ? 0 : 2; index += GST_AUDIO_FORMAT_INFO_IS_SIGNED (fmt) ? 1 : 0; index += (ctx->ns == NOISE_SHAPING_NONE) ? 0 : 24; } else { /* this is float/double */ index = 16; index += (GST_AUDIO_FORMAT_INFO_WIDTH (fmt) == 32) ? 0 : 2; index += GST_AUDIO_FORMAT_INFO_IS_LITTLE_ENDIAN (fmt) ? 0 : 1; index += (DOUBLE_INTERMEDIATE_FORMAT (ctx)) ? 4 : 0; } return index; }
false
false
false
false
false
0
setSelectedRowFrom(const char *pString_) { if (MSView::model()!=0&&pString_!=0) { unsigned index=list().indexOf(pString_); if (index<list().length()) selectedRow(index); comboBox()->replaceEditableText(selection()); selectEditableText(); } }
false
false
false
false
false
0
rtw_get_wps_attr(u8 *wps_ie, uint wps_ielen, u16 target_attr_id, u8 *buf_attr, u32 *len_attr) { u8 *attr_ptr = NULL; u8 *target_attr_ptr = NULL; u8 wps_oui[4] = {0x00, 0x50, 0xF2, 0x04}; if (len_attr) *len_attr = 0; if ((wps_ie[0] != _VENDOR_SPECIFIC_IE_) || (memcmp(wps_ie + 2, wps_oui, 4))) return attr_ptr; /* 6 = 1(Element ID) + 1(Length) + 4(WPS OUI) */ attr_ptr = wps_ie + 6; /* goto first attr */ while (attr_ptr - wps_ie < wps_ielen) { /* 4 = 2(Attribute ID) + 2(Length) */ u16 attr_id = get_unaligned_be16(attr_ptr); u16 attr_data_len = get_unaligned_be16(attr_ptr + 2); u16 attr_len = attr_data_len + 4; if (attr_id == target_attr_id) { target_attr_ptr = attr_ptr; if (buf_attr) memcpy(buf_attr, attr_ptr, attr_len); if (len_attr) *len_attr = attr_len; break; } else { attr_ptr += attr_len; /* goto next */ } } return target_attr_ptr; }
false
false
false
false
false
0
gamgi_gtk_direction_create_node (gamgi_bool node, gamgi_window *window) { GtkWidget *dialog = window->dialog0; GtkWidget *entry_o1, *entry_o2, *entry_o3; GtkWidget *label_o1, *label_o2, *label_o3, *label_o4; GtkWidget *combo; char token[GAMGI_ENGINE_TOKEN]; entry_o1 = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_o1"); entry_o2 = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_o2"); entry_o3 = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "entry_o3"); label_o1 = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "label_o1"); label_o2 = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "label_o2"); label_o3 = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "label_o3"); label_o4 = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "label_o4"); /******************************************* * the o4 combo box should be 000 when * * Node is started and when Node is closed * *******************************************/ combo = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "combo_o4"); gtk_combo_box_set_active (GTK_COMBO_BOX (combo), FALSE); /**************************************** * enable when Cell and Node are chosen * ****************************************/ if (node == TRUE) { gtk_widget_set_sensitive (combo, TRUE); gtk_widget_set_sensitive (entry_o1, TRUE); gtk_widget_set_sensitive (entry_o2, TRUE); gtk_widget_set_sensitive (entry_o3, TRUE); gtk_widget_set_sensitive (label_o1, TRUE); gtk_widget_set_sensitive (label_o2, TRUE); gtk_widget_set_sensitive (label_o3, TRUE); gtk_widget_set_sensitive (label_o4, TRUE); sprintf (token, "%d", GAMGI_PHYS_NODE_O1); gtk_entry_set_text (GTK_ENTRY (entry_o1), token); sprintf (token, "%d", GAMGI_PHYS_NODE_O2); gtk_entry_set_text (GTK_ENTRY (entry_o2), token); sprintf (token, "%d", GAMGI_PHYS_NODE_O3); gtk_entry_set_text (GTK_ENTRY (entry_o3), token); } else { gtk_widget_set_sensitive (combo, FALSE); gtk_entry_set_text (GTK_ENTRY (entry_o1), ""); gtk_entry_set_text (GTK_ENTRY (entry_o2), ""); gtk_entry_set_text (GTK_ENTRY (entry_o3), ""); gtk_widget_set_sensitive (entry_o1, FALSE); gtk_widget_set_sensitive (entry_o2, FALSE); gtk_widget_set_sensitive (entry_o3, FALSE); gtk_widget_set_sensitive (label_o1, FALSE); gtk_widget_set_sensitive (label_o2, FALSE); gtk_widget_set_sensitive (label_o3, FALSE); gtk_widget_set_sensitive (label_o4, FALSE); } }
true
true
false
false
false
1
LI34__BREAK_FORWARD_SEARCH_STACK__top(V270) object V270; { VMB34 VMS34 VMV34 goto TTL; TTL:; {register object V271; V271= Cnil; V271= coerce_to_string((V270)); {register object V272; register object V273; V272= one_plus((((object)VV[73])->s.s_dbind)); base[0]= (V272); vs_top=(vs_base=base+0)+1; (void) (*Lnk217)(); vs_top=sup; V273= vs_base[0]; goto T1106; T1106:; if(!(immnum_gt((V272),(((object)VV[72])->s.s_dbind)))){ goto T1107;} base[0]= (((object)VV[81])->s.s_dbind); base[1]= ((object)VV[151]); base[2]= (V271); vs_top=(vs_base=base+0)+3; Lformat(); vs_top=sup; {object V274 = vs_base[0]; VMR34(V274)} goto T1107; T1107:; if(((*(LnkLI216))((V272)))==Cnil){ goto T1114;} V275= symbol_name((V273)); V276= (((object)VV[246])->s.s_gfdef); if(((VFUN_NARGS=4,(*(LnkLI245))((V271),/* INLINE-ARGS */V275,((object)VV[137]),V276)))==Cnil){ goto T1114;} base[0]= (V272); vs_top=(vs_base=base+0)+1; (void) (*Lnk247)(); vs_top=sup; {object V277 = Cnil; VMR34(V277)} goto T1114; T1114:; V272= one_plus((V272)); base[0]= (V272); vs_top=(vs_base=base+0)+1; (void) (*Lnk217)(); vs_top=sup; V273= vs_base[0]; goto T1106;}} base[0]=base[0]; return Cnil; }
false
false
false
false
false
0
peekbytecode_(hscriptlet *r, int *level) { if (r->it == r->s->it_codes) return empty_tc; bytecode code = &r->s->codes[r->it]; r->level = code->level; return code->tc; }
false
false
false
false
false
0
linear(Home home, const IntVarArgs& x, IntRelType irt, IntVar y, IntConLevel icl) { if (home.failed()) return; Region re(home); Linear::Term<IntView>* t = re.alloc<Linear::Term<IntView> >(x.size()+1); for (int i = x.size(); i--; ) { t[i].a=1; t[i].x=x[i]; } int min, max; estimate(t,x.size(),0,min,max); IntView v(y); switch (irt) { case IRT_EQ: GECODE_ME_FAIL(v.gq(home,min)); GECODE_ME_FAIL(v.lq(home,max)); break; case IRT_GQ: GECODE_ME_FAIL(v.lq(home,max)); break; case IRT_LQ: GECODE_ME_FAIL(v.gq(home,min)); break; default: ; } if (home.failed()) return; t[x.size()].a=-1; t[x.size()].x=y; Linear::post(home,t,x.size()+1,irt,0,icl); }
false
false
false
false
false
0
Coalesce(wxString& s) { std::pair<tree::iterator, bool> r = tree_.insert(std::make_pair(s, backref_holder())); tree::iterator& it = r.first; if( !r.second ) { s = it->first; backref* bref = reinterpret_cast<backref*>(it->second.b_); lru_.splice( lru_.end(), lru_, bref->it_ ); bref->it_ = --lru_.end(); } else { size_ += s.size() * sizeof(wxChar) + GetOverhead(); while (size_ > GetCapacity() && !lru_.empty()) { size_ -= GetOverhead() + lru_.front()->first.size() * sizeof(wxChar); tree_.erase( lru_.front() ); lru_.pop_front(); } tree::iterator it = tree_.insert(std::make_pair(s, backref_holder())).first; lru_.push_back(it); it->second.b_ = new backref(--lru_.end()); } }
false
false
false
false
false
0
counted_noun_ending_en(int num) { if (num == 1 || num == -1) { return ""; } else { return "s"; } }
false
false
false
false
false
0
getListOfPlatforms() { vector<string> vs; for (map<string,Resources*>::iterator i1=platform_res.begin(); i1!=platform_res.end(); ++i1) { vs.push_back( (*i1).first ); } return vs; }
false
false
false
false
false
0
smk_bu_credfile(const struct cred *cred, struct file *file, int mode, int rc) { struct task_smack *tsp = cred->security; struct smack_known *sskp = tsp->smk_task; struct inode *inode = file->f_inode; struct inode_smack *isp = inode->i_security; char acc[SMK_NUM_ACCESS_TYPE + 1]; if (isp->smk_flags & SMK_INODE_IMPURE) pr_info("Smack Unconfined Corruption: inode=(%s %ld) %s\n", inode->i_sb->s_id, inode->i_ino, current->comm); if (rc <= 0) return rc; if (rc > SMACK_UNCONFINED_OBJECT) rc = 0; smk_bu_mode(mode, acc); pr_info("Smack %s: (%s %s %s) file=(%s %ld %pD) %s\n", smk_bu_mess[rc], sskp->smk_known, smk_of_inode(inode)->smk_known, acc, inode->i_sb->s_id, inode->i_ino, file, current->comm); return 0; }
true
true
false
false
false
1
up_date_jikouho () { register int no_of_kouho, i; int jishono, serial; jishono = (bun.klist)[current_bun_no].jishono; serial = (bun.klist)[current_bun_no].serial; no_of_kouho = jl_zenkouho_suu (buf); for (i = 0; i < no_of_kouho; i++) { if (jishono == buf->bun[current_bun_no]->dic_no && serial == buf->bun[current_bun_no]->entry) return (0); if (jl_next (buf) < 0) return (-1); } wnn_errorno = WNN_WORD_NO_EXIST; return (-1); }
false
false
false
false
false
0
anjuta_bookmarks_remove (AnjutaBookmarks* bookmarks) { AnjutaBookmarksPrivate* priv = BOOKMARKS_GET_PRIVATE(bookmarks); GtkTreeSelection* selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(priv->tree)); GList* selected = gtk_tree_selection_get_selected_rows (selection, NULL); GList* node; GList* refs = NULL; GtkTreePath* first_path = NULL; for (node = selected; node != NULL; node = g_list_next (node)) { GtkTreeRowReference* ref = gtk_tree_row_reference_new (priv->model, node->data); refs = g_list_append (refs, ref); } g_list_foreach (selected, (GFunc)gtk_tree_path_free, NULL); g_list_free (selected); for (node = refs; node != NULL; node = g_list_next (node)) { GFile* file; gint line; IAnjutaEditor* editor; GtkTreeIter iter; GtkTreeRowReference* ref = node->data; GtkTreePath* path = gtk_tree_row_reference_get_path(ref); gtk_tree_model_get_iter (priv->model, &iter, path); if (!first_path) { first_path = path; } else { gtk_tree_path_free (path); } gtk_tree_model_get (priv->model, &iter, COLUMN_FILE, &file, COLUMN_LINE, &line, -1); editor = IANJUTA_EDITOR(anjuta_docman_get_document_for_file (ANJUTA_DOCMAN(priv->docman->docman), file)); if (editor) { if (ianjuta_markable_is_marker_set (IANJUTA_MARKABLE(editor), line, IANJUTA_MARKABLE_BOOKMARK, NULL)) { ianjuta_markable_unmark (IANJUTA_MARKABLE(editor), line, IANJUTA_MARKABLE_BOOKMARK, NULL); } } g_object_unref (file); gtk_list_store_remove (GTK_LIST_STORE (priv->model), &iter); } anjuta_bookmarks_check_selection (bookmarks, first_path); if (first_path) gtk_tree_path_free (first_path); g_list_foreach (refs, (GFunc)gtk_tree_row_reference_free, NULL); g_list_free (refs); }
false
false
false
false
false
0
alt_eval (CSPARSE *parse, CSTREE *node, CSTREE **next) { NEOERR *err = STATUS_OK; CSARG val; int eval_true = 1; err = eval_expr(parse, &(node->arg1), &val); if (err) return nerr_pass(err); eval_true = arg_eval_bool(parse, &val); if (eval_true) { if (val.op_type & (CS_TYPE_NUM | CS_TYPE_VAR_NUM)) { char buf[256]; long int n_val; n_val = arg_eval_num (parse, &val); snprintf (buf, sizeof(buf), "%ld", n_val); err = parse->output_cb (parse->output_ctx, buf); } else { char *s = arg_eval (parse, &val); /* Do we set it to blank if s == NULL? */ if (s) { err = parse->output_cb (parse->output_ctx, s); } } } if (val.alloc) free(val.s); if (eval_true == 0) { err = render_node (parse, node->case_0); } *next = node->next; return nerr_pass(err); }
false
false
false
false
false
0
CDB___ham_c_destroy(dbc) DBC *dbc; { HASH_CURSOR *hcp; hcp = (HASH_CURSOR *)dbc->internal; if (hcp->split_buf != NULL) CDB___os_free(hcp->split_buf, dbc->dbp->pgsize); CDB___os_free(hcp, sizeof(HASH_CURSOR)); return (0); }
false
false
false
false
false
0
StreamReadBufferAsBinary(std::istream & file, void *_buffer) { itkDebugMacro(<< "StreamingReadBufferAsBinary called"); char *buffer = static_cast< char * >( _buffer ); // Offset into file std::streampos dataPos = this->GetDataPosition(); itkDebugStatement( const std::streamsize sizeOfRegion = static_cast< std::streamsize >( m_IORegion.GetNumberOfPixels() ) * this->GetPixelSize(); ); // compute the number of continuous bytes to be read std::streamsize sizeOfChunk = 1; unsigned int movingDirection = 0; do { sizeOfChunk *= m_IORegion.GetSize(movingDirection); ++movingDirection; } while ( movingDirection < m_IORegion.GetImageDimension() && m_IORegion.GetSize(movingDirection - 1) == this->GetDimensions(movingDirection - 1) ); sizeOfChunk *= this->GetPixelSize(); ImageIORegion::IndexType currentIndex = m_IORegion.GetIndex(); while ( m_IORegion.IsInside(currentIndex) ) { // calculate the position to seek to in the file std::streampos seekPos = 0; SizeValueType subDimensionQuantity = 1; for ( unsigned int i = 0; i < m_IORegion.GetImageDimension(); ++i ) { seekPos = seekPos + static_cast< std::streamoff >( subDimensionQuantity * this->GetPixelSize() * currentIndex[i] ); subDimensionQuantity *= this->GetDimensions(i); } itkDebugMacro( << "Reading " << sizeOfChunk << " of " << sizeOfRegion << " bytes for " << m_FileName << " at " << dataPos + seekPos << " position in file"); file.seekg(dataPos + seekPos, std::ios::beg); if ( ! this->ReadBufferAsBinary(file, buffer, sizeOfChunk) ) { itkExceptionMacro( "Error reading in ReadBufferAsBinary!" ); } // increment the buffer pointer buffer += sizeOfChunk; if ( file.fail() ) { itkExceptionMacro(<< "Fail reading"); } if ( movingDirection == m_IORegion.GetImageDimension() ) { break; } // increment index to next chunk ++currentIndex[movingDirection]; for ( unsigned int i = movingDirection; i < m_IORegion.GetImageDimension() - 1; ++i ) { // when reaching the end of the moving index dimension carry to // higher dimensions if ( static_cast< ImageIORegion::SizeValueType >( currentIndex[i] - m_IORegion.GetIndex(i) ) >= m_IORegion.GetSize(i) ) { currentIndex[i] = m_IORegion.GetIndex(i); ++currentIndex[i + 1]; } } } return true; }
false
false
false
false
false
0
Iremove (int argc, lvar_t *argv) { Tobj tblo, keyo; if (argc == 2) tblo = argv[1].o, keyo = argv[0].o; else tblo = root, keyo = argv[0].o; if (T_ISTABLE (tblo) && (T_ISNUMBER (keyo) || T_ISSTRING (keyo))) Tdelo (tblo, keyo); return L_SUCCESS; }
false
false
false
false
false
0
strdup_escape(const char *str) { const char *input = str; char *p, *ret; int escapes; if (!strlen(str)) return NULL; escapes = 0; while ((input = strpbrk(input, "\\\"")) != NULL) { escapes++; input++; } p = ret = malloc(strlen(str) + escapes + 1); while (*str) { if (*str == '\\' || *str == '\"') *p++ = '\\'; *p++ = *str++; } *p = '\0'; return ret; }
false
false
false
false
false
0
s_compare (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer /*userdata*/) { GtkTreePath *path; gint depth, row1, row2, res; gchar *style1, *style2; path = gtk_tree_model_get_path(model, a); depth = gtk_tree_path_get_depth(path); if (depth == 1) { gtk_tree_model_get(model, a, 1, &row1, -1); gtk_tree_model_get(model, b, 1, &row2, -1); res = row1 - row2; } else { gtk_tree_model_get(model, a, 0, &style1, -1); gtk_tree_model_get(model, b, 0, &style2, -1); res = g_utf8_collate(style1, style2); g_free(style1); g_free(style2); } gtk_tree_path_free(path); return res; }
false
false
false
false
false
0
z_save( int argc, zword_t table, zword_t bytes, zword_t name ) { char new_name[Z_FILENAME_MAX + Z_PATHNAME_MAX + 1]; char default_name[Z_FILENAME_MAX + Z_PATHNAME_MAX + 1]; FILE *afp; #if defined BUFFER_FILES char afpbuffer[BUFSIZ]; #endif int status = 0; if ( argc == 3 ) { get_default_name( default_name, name ); if ( get_file_name( new_name, default_name, GAME_SAVE_AUX ) != 0 ) { goto finished; } if ( ( afp = fopen( new_name, "wb" ) ) == NULL ) { goto finished; } #if defined BUFFER_FILES setbuf( afp, afpbuffer ); #endif status = fwrite( datap + table, bytes, 1, afp ); fclose( afp ); if ( status != 0 ) { strcpy( auxilary_name, default_name ); } status = !status; } else { /* Get the file name */ status = 1; if ( get_file_name( new_name, save_name, GAME_SAVE ) == 0 ) { /* Do a save operation */ if ( save_restore( new_name, GAME_SAVE ) == 0 ) { /* Cleanup file */ file_cleanup( new_name, GAME_SAVE ); /* Save the new name as the default file name */ strcpy( save_name, new_name ); /* Indicate success */ status = 0; } } } finished: /* Return result of save to Z-code */ if ( h_type < V4 ) { conditional_jump( status == 0 ); } else { store_operand( (zword_t)(( status == 0 ) ? 1 : 0) ); } return ( status ); }
false
false
false
false
false
0
prt_get_cpl() { if (prt_use_number()) { prt_number_width = PRINT_NUMBER_WIDTH * prt_char_width; #ifdef FEAT_MBYTE /* If we are outputting multi-byte characters then line numbers will be * printed with half width characters */ if (prt_out_mbyte) prt_number_width /= 2; #endif prt_left_margin += prt_number_width; } else prt_number_width = 0.0; return (int)((prt_right_margin - prt_left_margin) / prt_char_width); }
false
false
false
false
false
0
s_pack_into(PyObject *self, PyObject *args) { PyStructObject *soself; Py_buffer buffer; Py_ssize_t offset; /* Validate arguments. +1 is for the first arg as buffer. */ soself = (PyStructObject *)self; assert(PyStruct_Check(self)); assert(soself->s_codes != NULL); if (PyTuple_GET_SIZE(args) != (soself->s_len + 2)) { if (PyTuple_GET_SIZE(args) == 0) { PyErr_Format(StructError, "pack_into expected buffer argument"); } else if (PyTuple_GET_SIZE(args) == 1) { PyErr_Format(StructError, "pack_into expected offset argument"); } else { PyErr_Format(StructError, "pack_into expected %zd items for packing (got %zd)", soself->s_len, (PyTuple_GET_SIZE(args) - 2)); } return NULL; } /* Extract a writable memory buffer from the first argument */ if (!PyArg_Parse(PyTuple_GET_ITEM(args, 0), "w*", &buffer)) return NULL; assert(buffer.len >= 0); /* Extract the offset from the first argument */ offset = PyNumber_AsSsize_t(PyTuple_GET_ITEM(args, 1), PyExc_IndexError); if (offset == -1 && PyErr_Occurred()) { PyBuffer_Release(&buffer); return NULL; } /* Support negative offsets. */ if (offset < 0) offset += buffer.len; /* Check boundaries */ if (offset < 0 || (buffer.len - offset) < soself->s_size) { PyErr_Format(StructError, "pack_into requires a buffer of at least %zd bytes", soself->s_size); PyBuffer_Release(&buffer); return NULL; } /* Call the guts */ if (s_pack_internal(soself, args, 2, (char*)buffer.buf + offset) != 0) { PyBuffer_Release(&buffer); return NULL; } PyBuffer_Release(&buffer); Py_RETURN_NONE; }
false
false
false
false
true
1
PanEndMode(void *data) { PanData pdata = (PanData)data; if (pdata) { if (pdata->args) DXDelete(pdata->args); if (pdata->obj) DXDelete(pdata->obj); } DXFree(data); }
false
false
false
false
false
0
next_name(const char *names, unsigned *len) { names += *len; if (names[0] == ' ' || names[0] == '=' || names[0] == '\0') return NULL; return first_name(names + 1, len); }
false
false
false
false
false
0
freadHeaderPnm(FILE *fp, PIX **ppix, l_int32 *pwidth, l_int32 *pheight, l_int32 *pdepth, l_int32 *ptype, l_int32 *pbpc, l_int32 *pcpp) { l_int32 w, h, d, type; l_int32 maxval; PROCNAME("freadHeaderPnm"); if (!fp) return ERROR_INT("fp not defined", procName, 1); if (!pwidth || !pheight || !pdepth || !ptype) return ERROR_INT("input ptr(s) not defined", procName, 1); fscanf(fp, "P%d\n", &type); if (type < 1 || type > 6) return ERROR_INT("invalid pnm file", procName, 1); if (pnmSkipCommentLines(fp)) return ERROR_INT("no data in file", procName, 1); fscanf(fp, "%d %d\n", &w, &h); if (w <= 0 || h <= 0 || w > MAX_PNM_WIDTH || h > MAX_PNM_HEIGHT) return ERROR_INT("invalid sizes", procName, 1); /* Get depth of pix */ if (type == 1 || type == 4) d = 1; else if (type == 2 || type == 5) { fscanf(fp, "%d\n", &maxval); if (maxval == 3) d = 2; else if (maxval == 15) d = 4; else if (maxval == 255) d = 8; else if (maxval == 0xffff) d = 16; else { fprintf(stderr, "maxval = %d\n", maxval); return ERROR_INT("invalid maxval", procName, 1); } } else { /* type == 3 || type == 6; this is rgb */ fscanf(fp, "%d\n", &maxval); if (maxval != 255) L_WARNING_INT("unexpected maxval = %d", procName, maxval); d = 32; } *pwidth = w; *pheight = h; *pdepth = d; *ptype = type; if (pbpc) *pbpc = (d == 32) ? 8 : d; if (pcpp) *pcpp = (d == 32) ? 3 : 1; if (!ppix) return 0; if ((*ppix = pixCreate(w, h, d)) == NULL) return ERROR_INT( "pix not made", procName, 1); return 0; }
false
false
false
false
false
0
mmc_audio_read_subchannel (CdIo_t *p_cdio, cdio_subchannel_t *p_subchannel) { mmc_cdb_t cdb; driver_return_code_t i_rc; cdio_mmc_subchannel_t mmc_subchannel; if (!p_cdio) return DRIVER_OP_UNINIT; memset(&mmc_subchannel, 0, sizeof(mmc_subchannel)); mmc_subchannel.format = CDIO_CDROM_MSF; memset(&cdb, 0, sizeof(mmc_cdb_t)); CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_READ_SUBCHANNEL); CDIO_MMC_SET_READ_LENGTH8(cdb.field, sizeof(cdio_mmc_subchannel_t)); cdb.field[1] = CDIO_CDROM_MSF; cdb.field[2] = 0x40; /* subq */ cdb.field[3] = CDIO_SUBCHANNEL_CURRENT_POSITION; cdb.field[6] = 0; /* track number (only in isrc mode, ignored) */ i_rc = mmc_run_cmd(p_cdio, mmc_timeout_ms, &cdb, SCSI_MMC_DATA_READ, sizeof(cdio_mmc_subchannel_t), &mmc_subchannel); if (DRIVER_OP_SUCCESS == i_rc) { p_subchannel->format = mmc_subchannel.format; p_subchannel->audio_status = mmc_subchannel.audio_status; p_subchannel->address = mmc_subchannel.address; p_subchannel->control = mmc_subchannel.control; p_subchannel->track = mmc_subchannel.track; p_subchannel->index = mmc_subchannel.index; p_subchannel->abs_addr.m = cdio_to_bcd8(mmc_subchannel.abs_addr[1]); p_subchannel->abs_addr.s = cdio_to_bcd8(mmc_subchannel.abs_addr[2]); p_subchannel->abs_addr.f = cdio_to_bcd8(mmc_subchannel.abs_addr[3]); p_subchannel->rel_addr.m = cdio_to_bcd8(mmc_subchannel.rel_addr[1]); p_subchannel->rel_addr.s = cdio_to_bcd8(mmc_subchannel.rel_addr[2]); p_subchannel->rel_addr.f = cdio_to_bcd8(mmc_subchannel.rel_addr[3]); } return i_rc; }
false
false
false
false
false
0
_youtube_query_open_view (SwQueryIface *self, const gchar *query, GHashTable *params, DBusGMethodInvocation *context) { SwServiceYoutubePrivate *priv = GET_PRIVATE (self); SwItemView *item_view; const gchar *object_path; if (!_check_query_validity (query)) { dbus_g_method_return_error (context, g_error_new (SW_SERVICE_ERROR, SW_SERVICE_ERROR_INVALID_QUERY, "Query '%s' is invalid", query)); return; } item_view = g_object_new (SW_TYPE_YOUTUBE_ITEM_VIEW, "proxy", priv->proxy, "developer_key", priv->developer_key, "service", self, "query", query, "params", params, NULL); /* Ensure the object gets disposed when the client goes away */ sw_client_monitor_add (dbus_g_method_get_sender (context), (GObject *)item_view); object_path = sw_item_view_get_object_path (item_view); sw_query_iface_return_from_open_view (context, object_path); }
false
false
false
false
false
0
jswrap_object_getOwnPropertyDescriptor(JsVar *parent, JsVar *name) { if (!jswrap_object_hasOwnProperty(parent, name)) return 0; JsVar *propName = jsvAsArrayIndex(name); JsVar *varName = jspGetVarNamedField(parent, propName, true); jsvUnLock(propName); assert(varName); // we had it! (apparently) if (!varName) return 0; JsVar *obj = jsvNewWithFlags(JSV_OBJECT); if (!obj) { jsvUnLock(varName); return 0; } //jsvTrace(varName, 5); JsVar *var = jsvSkipName(varName); bool isBuiltIn = jsvIsNewChild(varName); JsvIsInternalChecker checkerFunction = jsvGetInternalFunctionCheckerFor(parent); jsvObjectSetChild(obj, "value", var); jsvUnLock(jsvObjectSetChild(obj, "writable", jsvNewFromBool(true))); jsvUnLock(jsvObjectSetChild(obj, "enumerable", jsvNewFromBool(!checkerFunction || !checkerFunction(varName)))); jsvUnLock(jsvObjectSetChild(obj, "configurable", jsvNewFromBool(!isBuiltIn))); jsvUnLock(var); jsvUnLock(varName); return obj; }
false
false
false
false
false
0
L33() {register object *base=vs_base; register object *sup=base+VM33; VC33 vs_reserve(VM33); check_arg(2);vs_top=sup; {object V297=base[0]->c.c_cdr; if(endp(V297))invalid_macro_call(); base[2]= (V297->c.c_car); V297=V297->c.c_cdr; if(endp(V297))invalid_macro_call(); base[3]= (V297->c.c_car); V297=V297->c.c_cdr; if(!endp(V297))invalid_macro_call();} V298= list(3,((object)VV[115]),base[2],base[3]); base[4]= list(2,((object)VV[113]),list(8,((object)VV[114]),/* INLINE-ARGS */V298,make_cons(base[2],Cnil),((object)VV[116]),((object)VV[117]),base[2],((object)VV[118]),base[3])); vs_top=(vs_base=base+4)+1; return; }
false
false
false
false
false
0
Initialise() { //ScintillaBase::Initialise(); #if wxUSE_DRAG_AND_DROP dropTarget = new wxSCIDropTarget; dropTarget->SetScintilla(this); sci->SetDropTarget(dropTarget); /* C::B begin */ dragRectangle = false; /* C::B end */ #endif // wxUSE_DRAG_AND_DROP vs.extraFontFlag = true; // UseAntiAliasing }
false
false
false
false
false
0
func_pbkdf2(Lex_state *e, int nargs, Arglist *arglist, Expr_result *result) { int pwdlen, saltlen; unsigned int count, dklen; unsigned char *pwd, *salt; unsigned char *kdf2; size_t len; Arglist *x; x = arglist; len = x->result->value.val.bval.len; if (len == 0) { seterr_e(e, result, "Invalid password argument in 'pbkdf2' function"); return(-1); } pwd = (unsigned char *) x->result->value.val.bval.data; pwdlen = (int) len; /* XXX */ x = x->next; len = x->result->value.val.bval.len; if (len == 0) { seterr_e(e, result, "Invalid salt argument in 'pbkdf2' function"); return(-1); } salt = (unsigned char *) x->result->value.val.bval.data; saltlen = (int) len; /* XXX */ x = x->next; count = (unsigned int) x->result->value.val.intval; x = x->next; dklen = (unsigned int) x->result->value.val.intval; kdf2 = crypto_pbkdf2(pwd, pwdlen, salt, saltlen, count, dklen); if (kdf2 == NULL) { seterr_e(e, result, ds_xprintf("Key derivation failed")); return(-1); } result->value.token = T_BSTRING; result->value.val.bval.data = kdf2; result->value.val.bval.len = dklen; return(0); }
false
false
false
false
false
0
repulsive(Param *param, double rsq, double &fforce, int eflag, double &eng) { double r,tmp_fc,tmp_fc_d,tmp_exp; // Tersoff repulsive portion r = sqrt(rsq); tmp_fc = ters_fc(r,param); tmp_fc_d = ters_fc_d(r,param); tmp_exp = exp(-param->lam1 * r); double fforce_ters = param->biga * tmp_exp * (tmp_fc_d - tmp_fc*param->lam1); double eng_ters = tmp_fc * param->biga * tmp_exp; // ZBL repulsive portion double esq = square(global_e); double a_ij = (0.8854*global_a_0) / (pow(param->Z_i,0.23) + pow(param->Z_j,0.23)); double premult = (param->Z_i * param->Z_j * esq)/(4.0*MY_PI*global_epsilon_0); double r_ov_a = r/a_ij; double phi = 0.1818*exp(-3.2*r_ov_a) + 0.5099*exp(-0.9423*r_ov_a) + 0.2802*exp(-0.4029*r_ov_a) + 0.02817*exp(-0.2016*r_ov_a); double dphi = (1.0/a_ij) * (-3.2*0.1818*exp(-3.2*r_ov_a) - 0.9423*0.5099*exp(-0.9423*r_ov_a) - 0.4029*0.2802*exp(-0.4029*r_ov_a) - 0.2016*0.02817*exp(-0.2016*r_ov_a)); double fforce_ZBL = premult*-rsq* phi + premult/r*dphi; double eng_ZBL = premult/r*phi; // combine two parts with smoothing by Fermi-like function fforce = -(-F_fermi_d(r,param->ZBLexpscale,param->ZBLcut) * eng_ZBL + (1.0 - F_fermi(r,param->ZBLexpscale,param->ZBLcut))*fforce_ZBL + F_fermi_d(r,param->ZBLexpscale,param->ZBLcut)*eng_ters + F_fermi(r,param->ZBLexpscale,param->ZBLcut)*fforce_ters) / r; if (eflag) eng = (1.0 - F_fermi(r,param->ZBLexpscale,param->ZBLcut))*eng_ZBL + F_fermi(r,param->ZBLexpscale,param->ZBLcut)*eng_ters; }
false
false
false
false
false
0
print_rec(FILE *out, struct tree *start, const char *ppath, int pr_hidden) { int r; char *path = NULL; list_for_each(tree, start) { if (TREE_HIDDEN(tree) && ! pr_hidden) continue; path = path_expand(tree, ppath); if (path == NULL) goto error; r = print_one(out, path, tree->value); if (r < 0) goto error; r = print_rec(out, tree->children, path, pr_hidden); free(path); path = NULL; if (r < 0) goto error; } return 0; error: free(path); return -1; }
false
false
false
false
false
0
init_tstats_procfs(void) { struct proc_dir_entry *pe; pe = proc_create("timer_stats", 0644, NULL, &tstats_fops); if (!pe) return -ENOMEM; return 0; }
false
false
false
false
false
0
space_edit_invert_axis(GtkWidget * button, gpointer data) { AmitkSpaceEdit * space_edit = data; AmitkAxis i_axis; AmitkPoint center; /* first double check that we really want to do this */ if (!space_edit_prompt(space_edit, _("Do you really wish to invert?\nThis will flip left/right relationships"))) return; i_axis = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(button), "axis")); /* shift the coord frame to the center of rotation, and save the old offset */ if (AMITK_IS_VOLUME(space_edit->object)) center = amitk_volume_get_center(AMITK_VOLUME(space_edit->object)); else if (AMITK_IS_STUDY(space_edit->object)) center = AMITK_STUDY_VIEW_CENTER(space_edit->object); else center = AMITK_SPACE_OFFSET(space_edit->object); /* invert the axis */ amitk_space_invert_axis(AMITK_SPACE(space_edit->object), i_axis, center); return; }
false
false
false
false
false
0
glfs_io_async_task (void *data) { struct glfs_io *gio = data; ssize_t ret = 0; switch (gio->op) { case GF_FOP_WRITE: ret = glfs_pwritev (gio->glfd, gio->iov, gio->count, gio->offset, gio->flags); break; case GF_FOP_FTRUNCATE: ret = glfs_ftruncate (gio->glfd, gio->offset); break; case GF_FOP_FSYNC: if (gio->flags) ret = glfs_fdatasync (gio->glfd); else ret = glfs_fsync (gio->glfd); break; } return (int) ret; }
false
false
false
false
false
0
ReadFlagsFromString(const string& flagfilecontents, const char* /*prog_name*/, // TODO(csilvers): nix this bool errors_are_fatal) { FlagRegistry* const registry = FlagRegistry::GlobalRegistry(); FlagSaverImpl saved_states(registry); saved_states.SaveFromRegistry(); CommandLineFlagParser parser(registry); registry->Lock(); parser.ProcessOptionsFromStringLocked(flagfilecontents, SET_FLAGS_VALUE); registry->Unlock(); // Should we handle --help and such when reading flags from a string? Sure. HandleCommandLineHelpFlags(); if (parser.ReportErrors()) { // Error. Restore all global flags to their previous values. if (errors_are_fatal) gflags_exitfunc(1); saved_states.RestoreToRegistry(); return false; } return true; }
false
false
false
false
false
0
e_ews_connection_get_oal_detail_sync (EEwsConnection *cnc, const gchar *oal_id, const gchar *oal_element, const gchar *old_etag, GSList **elements, gchar **etag, GCancellable *cancellable, GError **error) { EAsyncClosure *closure; GAsyncResult *result; gboolean success; g_return_val_if_fail (E_IS_EWS_CONNECTION (cnc), FALSE); closure = e_async_closure_new (); e_ews_connection_get_oal_detail ( cnc, oal_id, oal_element, old_etag, cancellable, e_async_closure_callback, closure); result = e_async_closure_wait (closure); success = e_ews_connection_get_oal_detail_finish ( cnc, result, elements, etag, error); e_async_closure_free (closure); return success; }
false
false
false
false
false
0
p12u_ucs2_ascii_conversion_function(PRBool toUnicode, unsigned char* inBuf, unsigned int inBufLen, unsigned char* outBuf, unsigned int maxOutBufLen, unsigned int* outBufLen, PRBool swapBytes) { SECItem it; SECItem *dup = NULL; PRBool ret; it.data = inBuf; it.len = inBufLen; dup = SECITEM_DupItem(&it); // If converting Unicode to ASCII, swap bytes before conversion as neccessary. if (!toUnicode && swapBytes) { if (p12u_SwapUnicodeBytes(dup) != SECSuccess) { SECITEM_ZfreeItem(dup, PR_TRUE); return PR_FALSE; } } // Perform the conversion. ret = PORT_UCS2_UTF8Conversion(toUnicode, dup->data, dup->len, outBuf, maxOutBufLen, outBufLen); if (dup) SECITEM_ZfreeItem(dup, PR_TRUE); return ret; }
false
false
false
false
false
0
__add_keyed_refs(struct btrfs_fs_info *fs_info, struct btrfs_path *path, u64 bytenr, int info_level, struct list_head *prefs, u64 inum) { struct btrfs_root *extent_root = fs_info->extent_root; int ret; int slot; struct extent_buffer *leaf; struct btrfs_key key; while (1) { ret = btrfs_next_item(extent_root, path); if (ret < 0) break; if (ret) { ret = 0; break; } slot = path->slots[0]; leaf = path->nodes[0]; btrfs_item_key_to_cpu(leaf, &key, slot); if (key.objectid != bytenr) break; if (key.type < BTRFS_TREE_BLOCK_REF_KEY) continue; if (key.type > BTRFS_SHARED_DATA_REF_KEY) break; switch (key.type) { case BTRFS_SHARED_BLOCK_REF_KEY: ret = __add_prelim_ref(prefs, 0, NULL, info_level + 1, key.offset, bytenr, 1, GFP_NOFS); break; case BTRFS_SHARED_DATA_REF_KEY: { struct btrfs_shared_data_ref *sdref; int count; sdref = btrfs_item_ptr(leaf, slot, struct btrfs_shared_data_ref); count = btrfs_shared_data_ref_count(leaf, sdref); ret = __add_prelim_ref(prefs, 0, NULL, 0, key.offset, bytenr, count, GFP_NOFS); break; } case BTRFS_TREE_BLOCK_REF_KEY: ret = __add_prelim_ref(prefs, key.offset, NULL, info_level + 1, 0, bytenr, 1, GFP_NOFS); break; case BTRFS_EXTENT_DATA_REF_KEY: { struct btrfs_extent_data_ref *dref; int count; u64 root; dref = btrfs_item_ptr(leaf, slot, struct btrfs_extent_data_ref); count = btrfs_extent_data_ref_count(leaf, dref); key.objectid = btrfs_extent_data_ref_objectid(leaf, dref); key.type = BTRFS_EXTENT_DATA_KEY; key.offset = btrfs_extent_data_ref_offset(leaf, dref); if (inum && key.objectid != inum) { ret = BACKREF_FOUND_SHARED; break; } root = btrfs_extent_data_ref_root(leaf, dref); ret = __add_prelim_ref(prefs, root, &key, 0, 0, bytenr, count, GFP_NOFS); break; } default: WARN_ON(1); } if (ret) return ret; } return ret; }
false
false
false
false
false
0
init_missions() { #define MISSION(name, goal, diff, val, urgent, place, start, end, fail) \ id++; mission_types.push_back( \ mission_type(id, name, goal, diff, val, urgent, place, start, end, fail) ) #define ORIGINS(...) setvector(mission_types[id].origins, __VA_ARGS__) #define ITEM(itid) mission_types[id].item_id = itid // DEADLINE defines the low and high end time limits, in hours // Omitting DEADLINE means the mission never times out #define DEADLINE(low, high) mission_types[id].deadline_low = low * 600;\ mission_types[id].deadline_high = high * 600 //#define NPCS (...) setvector(missions[id].npc // The order of missions should match enum mission_id in mission.h int id = -1; MISSION("Null mission", MGOAL_NULL, 0, 0, false, &mission_place::never, &mission_start::standard, &mission_end::standard, &mission_fail::standard); MISSION("Find Antibiotics", MGOAL_FIND_ITEM, 2, 1500, true, &mission_place::always, &mission_start::infect_npc, &mission_end::heal_infection, &mission_fail::kill_npc); ORIGINS(ORIGIN_OPENER_NPC, NULL); ITEM(itm_antibiotics); DEADLINE(24, 48); // 1 - 2 days MISSION("Retrieve Software", MGOAL_FIND_ANY_ITEM, 2, 800, false, &mission_place::near_town, &mission_start::place_npc_software, &mission_end::standard, &mission_fail::standard); ORIGINS(ORIGIN_OPENER_NPC, NULL); MISSION("Analyze Zombie Blood", MGOAL_FIND_ITEM, 8, 2500, false, &mission_place::always, &mission_start::reveal_hospital, &mission_end::standard, &mission_fail::standard); ORIGINS(ORIGIN_SECONDARY); ITEM(itm_software_blood_data); MISSION("Find Lost Dog", MGOAL_FIND_MONSTER, 3, 1000, false, &mission_place::near_town, &mission_start::place_dog, &mission_end::standard, &mission_fail::standard); ORIGINS(ORIGIN_OPENER_NPC, NULL); MISSION("Kill Zombie Mom", MGOAL_KILL_MONSTER, 5, 1200, true, &mission_place::near_town, &mission_start::place_zombie_mom, &mission_end::standard, &mission_fail::standard); ORIGINS(ORIGIN_OPENER_NPC, NULL); }
false
false
false
false
false
0
nfs_entry_loc_fill (inode_table_t *itable, uuid_t pargfid, char *entry, loc_t *loc, int how) { inode_t *parent = NULL; inode_t *entryinode = NULL; int ret = -3; char *resolvedpath = NULL; int pret = -3; if ((!itable) || (!entry) || (!loc)) return ret; parent = inode_find (itable, pargfid); ret = -1; /* Will need hard resolution now */ if (!parent) goto err; ret = -2; entryinode = inode_grep (itable, parent, entry); if (!entryinode) { if (how == NFS_RESOLVE_CREATE) { /* Even though we'll create the inode and the loc for * a missing inode, we still need to return -2 so * that the caller can use the filled loc to call * lookup. */ entryinode = inode_new (itable); /* Cannot change ret because that must * continue to have -2. */ pret = nfs_parent_inode_loc_fill (parent, entryinode, entry, loc); /* Only if parent loc fill fails, should we notify error * through ret, otherwise, we still need to force a * lookup by returning -2. */ if (pret < 0) ret = -3; } goto err; } ret = inode_path (parent, entry, &resolvedpath); if (ret < 0) { gf_log (GF_NFS, GF_LOG_ERROR, "path resolution failed %s", resolvedpath); ret = -3; goto err; } ret = nfs_loc_fill (loc, entryinode, parent, resolvedpath); if (ret < 0) { gf_log (GF_NFS, GF_LOG_ERROR, "loc_fill failed %s", resolvedpath); ret = -3; } err: if (parent) inode_unref (parent); if (entryinode) inode_unref (entryinode); if (resolvedpath) GF_FREE (resolvedpath); return ret; }
false
false
false
false
false
0
serialize_uint8(FILE *fp, uint8_t* val, int is_storing) { if (is_storing) { return (fwrite(val, sizeof(uint8_t), 1, fp) == 1) ? 0 : 1; } else { return (fread(val, sizeof(uint8_t), 1, fp) == 1) ? 0 : 1; } }
false
false
false
false
false
0
is_redhat_agent(const char *agent) { int rc = 0; struct stat prop; char buffer[FILENAME_MAX + 1]; snprintf(buffer, FILENAME_MAX, "%s/%s", RH_STONITH_DIR, agent); rc = stat(buffer, &prop); if (rc >= 0 && S_ISREG(prop.st_mode)) { return TRUE; } return FALSE; }
true
true
false
false
false
1
dblhashGrow(dblhash_ *h) { int i; record_ *old_recs, *new_recs; unsigned int old_recs_length; Debug("Growing Hash %p", h); ReturnErrIf(h->size_index == (sizes_count - 1)); old_recs_length = sizes[h->size_index]; old_recs = h->records; new_recs = calloc(sizes[++h->size_index], sizeof(record_)); ReturnErrIf(new_recs == NULL); h->records = new_recs; h->records_count = 0; /* rehash table */ for (i=0; i < old_recs_length; i++) { if (old_recs[i].hash && old_recs[i].key) { ReturnErrIf(dblhashAdd(h, old_recs[i].key, old_recs[i].freeMem, old_recs[i].value)); } } free(old_recs); return 0; }
false
false
false
false
false
0
iax2_start_transfer(unsigned short callno0, unsigned short callno1, int mediaonly) { int res; struct iax_ie_data ied0; struct iax_ie_data ied1; unsigned int transferid = (unsigned int)ast_random(); if (IAX_CALLENCRYPTED(iaxs[callno0]) || IAX_CALLENCRYPTED(iaxs[callno1])) { ast_debug(1, "transfers are not supported for encrypted calls at this time\n"); ast_set_flag64(iaxs[callno0], IAX_NOTRANSFER); ast_set_flag64(iaxs[callno1], IAX_NOTRANSFER); return 0; } memset(&ied0, 0, sizeof(ied0)); iax_ie_append_addr(&ied0, IAX_IE_APPARENT_ADDR, &iaxs[callno1]->addr); iax_ie_append_short(&ied0, IAX_IE_CALLNO, iaxs[callno1]->peercallno); iax_ie_append_int(&ied0, IAX_IE_TRANSFERID, transferid); memset(&ied1, 0, sizeof(ied1)); iax_ie_append_addr(&ied1, IAX_IE_APPARENT_ADDR, &iaxs[callno0]->addr); iax_ie_append_short(&ied1, IAX_IE_CALLNO, iaxs[callno0]->peercallno); iax_ie_append_int(&ied1, IAX_IE_TRANSFERID, transferid); res = send_command(iaxs[callno0], AST_FRAME_IAX, IAX_COMMAND_TXREQ, 0, ied0.buf, ied0.pos, -1); if (res) return -1; res = send_command(iaxs[callno1], AST_FRAME_IAX, IAX_COMMAND_TXREQ, 0, ied1.buf, ied1.pos, -1); if (res) return -1; iaxs[callno0]->transferring = mediaonly ? TRANSFER_MBEGIN : TRANSFER_BEGIN; iaxs[callno1]->transferring = mediaonly ? TRANSFER_MBEGIN : TRANSFER_BEGIN; return 0; }
false
false
false
false
false
0
_bfd_elf_write_object_contents (bfd *abfd) { const struct elf_backend_data *bed = get_elf_backend_data (abfd); Elf_Internal_Shdr **i_shdrp; bfd_boolean failed; unsigned int count, num_sec; if (! abfd->output_has_begun && ! _bfd_elf_compute_section_file_positions (abfd, NULL)) return FALSE; i_shdrp = elf_elfsections (abfd); failed = FALSE; bfd_map_over_sections (abfd, bed->s->write_relocs, &failed); if (failed) return FALSE; _bfd_elf_assign_file_positions_for_relocs (abfd); /* After writing the headers, we need to write the sections too... */ num_sec = elf_numsections (abfd); for (count = 1; count < num_sec; count++) { if (bed->elf_backend_section_processing) (*bed->elf_backend_section_processing) (abfd, i_shdrp[count]); if (i_shdrp[count]->contents) { bfd_size_type amt = i_shdrp[count]->sh_size; if (bfd_seek (abfd, i_shdrp[count]->sh_offset, SEEK_SET) != 0 || bfd_bwrite (i_shdrp[count]->contents, amt, abfd) != amt) return FALSE; } } /* Write out the section header names. */ if (elf_shstrtab (abfd) != NULL && (bfd_seek (abfd, elf_tdata (abfd)->shstrtab_hdr.sh_offset, SEEK_SET) != 0 || !_bfd_elf_strtab_emit (abfd, elf_shstrtab (abfd)))) return FALSE; if (bed->elf_backend_final_write_processing) (*bed->elf_backend_final_write_processing) (abfd, elf_tdata (abfd)->linker); if (!bed->s->write_shdrs_and_ehdr (abfd)) return FALSE; /* This is last since write_shdrs_and_ehdr can touch i_shdrp[0]. */ if (elf_tdata (abfd)->after_write_object_contents) return (*elf_tdata (abfd)->after_write_object_contents) (abfd); return TRUE; }
false
false
false
false
false
0
bd2802_show_adv_conf(struct device *dev, struct device_attribute *attr, char *buf) { struct bd2802_led *led = i2c_get_clientdata(to_i2c_client(dev)); ssize_t ret; down_read(&led->rwsem); if (led->adf_on) ret = sprintf(buf, "on\n"); else ret = sprintf(buf, "off\n"); up_read(&led->rwsem); return ret; }
false
false
false
false
false
0
via_clock_init(struct via_clock *clock, int gfx_chip) { switch (gfx_chip) { case UNICHROME_CLE266: case UNICHROME_K400: clock->set_primary_clock_state = dummy_set_clock_state; clock->set_primary_clock_source = dummy_set_clock_source; clock->set_primary_pll_state = dummy_set_pll_state; clock->set_primary_pll = cle266_set_primary_pll; clock->set_secondary_clock_state = dummy_set_clock_state; clock->set_secondary_clock_source = dummy_set_clock_source; clock->set_secondary_pll_state = dummy_set_pll_state; clock->set_secondary_pll = cle266_set_secondary_pll; clock->set_engine_pll_state = dummy_set_pll_state; clock->set_engine_pll = dummy_set_pll; break; case UNICHROME_K800: case UNICHROME_PM800: case UNICHROME_CN700: case UNICHROME_CX700: case UNICHROME_CN750: case UNICHROME_K8M890: case UNICHROME_P4M890: case UNICHROME_P4M900: case UNICHROME_VX800: clock->set_primary_clock_state = set_primary_clock_state; clock->set_primary_clock_source = set_primary_clock_source; clock->set_primary_pll_state = set_primary_pll_state; clock->set_primary_pll = k800_set_primary_pll; clock->set_secondary_clock_state = set_secondary_clock_state; clock->set_secondary_clock_source = set_secondary_clock_source; clock->set_secondary_pll_state = set_secondary_pll_state; clock->set_secondary_pll = k800_set_secondary_pll; clock->set_engine_pll_state = set_engine_pll_state; clock->set_engine_pll = k800_set_engine_pll; break; case UNICHROME_VX855: case UNICHROME_VX900: clock->set_primary_clock_state = set_primary_clock_state; clock->set_primary_clock_source = set_primary_clock_source; clock->set_primary_pll_state = set_primary_pll_state; clock->set_primary_pll = vx855_set_primary_pll; clock->set_secondary_clock_state = set_secondary_clock_state; clock->set_secondary_clock_source = set_secondary_clock_source; clock->set_secondary_pll_state = set_secondary_pll_state; clock->set_secondary_pll = vx855_set_secondary_pll; clock->set_engine_pll_state = set_engine_pll_state; clock->set_engine_pll = vx855_set_engine_pll; break; } if (machine_is_olpc()) { /* The OLPC XO-1.5 cannot suspend/resume reliably if the * IGA1/IGA2 clocks are set as on or off (memory rot * occasionally happens during suspend under such * configurations). * * The only known stable scenario is to leave this bits as-is, * which in their default states are documented to enable the * clock only when it is needed. */ clock->set_primary_clock_state = noop_set_clock_state; clock->set_secondary_clock_state = noop_set_clock_state; } }
false
false
false
false
false
0
rewrite() { if (HtURLRewriter::instance()->replace(_url) > 0) parse(_url.get()); }
false
false
false
false
false
0
getADFTypeFromDesc(VimosDescriptor *desc) { const char modName[] = "getADFTypeFromDesc"; VimosDescriptor *tDesc; tDesc = findDescriptor(desc, "ESO INS ADF TYPE"); if (tDesc == NULL) { cpl_msg_error(modName, "Cannot find descriptor %s", "ESO INS ADF TYPE"); return(VM_ADF_TYPE_UDF); } else { if (!strncmp("MOS", tDesc->descValue->s, 3)) { return(VM_ADF_TYPE_MOS); } if (!strncmp("IFU", tDesc->descValue->s, 3)) { return(VM_ADF_TYPE_IFU); } if (!strncmp("IMAGE", tDesc->descValue->s, 5)) { return(VM_ADF_TYPE_IMA); } } return(VM_ADF_TYPE_UDF); }
false
false
false
false
false
0
sys_linkat(struct tcb *tcp) { if (entering(tcp)) { print_dirfd(tcp->u_arg[0]); printpath(tcp, tcp->u_arg[1]); tprintf(", "); print_dirfd(tcp->u_arg[2]); printpath(tcp, tcp->u_arg[3]); tprintf(", %ld", tcp->u_arg[4]); } return 0; }
false
false
false
false
false
0
_F_mpz_promote(F_mpz_t f) { if (!COEFF_IS_MPZ(*f)) *f = _F_mpz_new_mpz(); // f is small so promote it first // if f is large already, just return the pointer return F_mpz_arr + COEFF_TO_OFF(*f); }
false
false
false
false
false
0
bf_deletelfn(bloomfilter_t *bf, char *lfn) { int i; u_int h; for (i = 0; i < bf->numhash; i++) { h = bfhash(lfn, shifts[i]); bfclearbit(bf, h); } bf->flags |= BF_NEEDUPDATE; }
false
false
false
false
false
0
brasero_track_data_get_file_num (BraseroTrackData *track, guint64 *file_num) { BraseroTrackDataClass *klass; g_return_val_if_fail (BRASERO_IS_TRACK_DATA (track), 0); klass = BRASERO_TRACK_DATA_GET_CLASS (track); if (file_num) *file_num = klass->get_file_num (track); return BRASERO_BURN_OK; }
false
false
false
true
false
1
move_value_simple(int move, const board_t * board, int trans_killer) { int value; ASSERT(move_is_ok(move)); ASSERT(board!=NULL); ASSERT(trans_killer==MoveNone||move_is_ok(trans_killer)); if (false) { } else if (move == trans_killer) { // transposition table killer value = TransScore; } else if (MOVE_IS_TACTICAL(move,board)) { // capture or promote value = GoodScore + mvv_lva(move,board); } else { // quiet move value = quiet_move_value(move,board); } return value; }
false
false
false
false
false
0
get_scheme_name(dynalogin_scheme_t scheme) { int scheme_count; for(scheme_count = 0; scheme_names[scheme_count] != NULL; scheme_count++) if(scheme == scheme_count) return scheme_names[scheme]; return NULL; }
false
false
false
false
true
1
Finalize() { uint32 length = 0; HMAC_Final(&m_ctx, (uint8*)m_digest, &length); MANGOS_ASSERT(length == SHA_DIGEST_LENGTH); }
false
false
false
false
false
0
ini_comment_print(struct ini_comment *ic, FILE *file) { int len; int i; struct simplebuffer *sb = NULL; TRACE_FLOW_ENTRY(); if (!file) { TRACE_ERROR_NUMBER("Invalid file argument", EINVAL); return; } if (ic) { len = ref_array_len(ic->ra); for (i = 0; i < len; i++) { ref_array_get(ic->ra, i, (void *)(&sb)); fprintf(file, "%s\n", simplebuffer_get_buf(sb)); } } TRACE_FLOW_EXIT(); }
false
false
false
false
false
0
find_hoare_inexact (double *a, double p, double xmin, double xmax, double frac, int n, int nl, int nh) { double tmp, high, low; int i; if (p < 0.5) { high = find_hoare(a, n, nh); tmp = xmin; for (i=0; i<nh; i++) { if (a[i] > tmp) { tmp = a[i]; } } low = tmp; } else { low = find_hoare(a, n, nl); tmp = xmax; for (i=nh; i<n; i++) { if (a[i] < tmp) { tmp = a[i]; } } high = tmp; } return low + frac * (high - low); }
false
false
false
false
false
0
PrintSelf(ostream& os, vtkIndent indent) { this->Superclass::PrintSelf(os, indent); os << indent << "InputFieldType: " << this->InputFieldType << endl; os << indent << "OutputType: " << this->OutputType << endl; os << indent << "MatchAnyValues: " << (this->MatchAnyValues ? "true" : "false") << endl; os << indent << "ArrayNames: " << (this->ArrayNames ? "" : "(null)") << endl; if (this->ArrayNames) { this->ArrayNames->PrintSelf(os, indent.GetNextIndent()); } }
false
false
false
false
false
0
remove(LoadInst *LI) { uint64_t Size = AA.getTypeStoreSize(LI->getType()); const MDNode *TBAAInfo = LI->getMetadata(LLVMContext::MD_tbaa); AliasSet *AS = findAliasSetForPointer(LI->getOperand(0), Size, TBAAInfo); if (!AS) return false; remove(*AS); return true; }
false
false
false
false
false
0
createBack(SDL_Surface ** back_surface) { int x, y; SDL_Rect pos; SDL_Surface *img = images[img_back]->image; if(!(*back_surface = SDL_CreateRGBSurface(SDL_HWSURFACE, screen->w + img->w, screen->h + img->h, screen->format->BitsPerPixel, 0, 0, 0, 0))) { fprintf(stderr, "Error creating surm_face: %s\n", SDL_GetError()); fflush(stderr); return; } /* for(y = 0; y < screen->h / TILE_H; y+=img->w/TILE_H) { for(x = 0; x < screen->w / TILE_W; x+=img->h/TILE_W) { pos.x = x * TILE_W; pos.y = y * TILE_H; pos.w = img->w; pos.h = img->h; SDL_BlitSurface(img, NULL, *back_surface, &pos); } } */ for(y = 0; y < (*back_surface)->h; y += img->h) { for(x = 0; x < (*back_surface)->w; x += img->w) { pos.x = x; pos.y = y; pos.w = img->w; pos.h = img->h; SDL_BlitSurface(img, NULL, *back_surface, &pos); } } }
false
false
false
false
false
0
caml_extunix_linkat(value v_olddirfd, value v_oldname, value v_newdirfd, value v_newname, value v_flags) { CAMLparam5(v_olddirfd, v_oldname, v_newdirfd, v_newname, v_flags); int ret = 0; int flags = caml_convert_flag_list(v_flags, at_flags_table); flags &= AT_SYMLINK_FOLLOW; /* only allowed flag here */ ret = linkat(Int_val(v_olddirfd), String_val(v_oldname), Int_val(v_newdirfd), String_val(v_newname), flags); if (ret != 0) uerror("linkat", v_oldname); CAMLreturn(Val_unit); }
false
false
false
false
false
0
RunProcess( std::vector<const char*> args) { std::string buffer = ""; // Run the application kwsysProcess* gp = kwsysProcess_New(); kwsysProcess_SetCommand(gp, &*args.begin()); kwsysProcess_SetOption(gp, kwsysProcess_Option_HideWindow, 1); kwsysProcess_Execute(gp); char* data = NULL; int length; double timeout = 255; int pipe; // pipe id as returned by kwsysProcess_WaitForData() while ((static_cast<void>( pipe = kwsysProcess_WaitForData(gp, &data, &length, &timeout)), (pipe == kwsysProcess_Pipe_STDOUT || pipe == kwsysProcess_Pipe_STDERR))) // wait for 1s { buffer.append(data, length); } kwsysProcess_WaitForExit(gp, 0); int result = 0; switch (kwsysProcess_GetState(gp)) { case kwsysProcess_State_Exited: { result = kwsysProcess_GetExitValue(gp); } break; case kwsysProcess_State_Error: { std::cerr << "Error: Could not run " << args[0] << ":\n"; std::cerr << kwsysProcess_GetErrorString(gp) << "\n"; } break; case kwsysProcess_State_Exception: { std::cerr << "Error: " << args[0] << " terminated with an exception: " << kwsysProcess_GetExceptionString(gp) << "\n"; } break; case kwsysProcess_State_Starting: case kwsysProcess_State_Executing: case kwsysProcess_State_Expired: case kwsysProcess_State_Killed: { // Should not get here. std::cerr << "Unexpected ending state after running " << args[0] << std::endl; } break; } kwsysProcess_Delete(gp); if (result) { std::cerr << "Error " << args[0] << " returned :" << result << "\n"; } return buffer; }
false
false
false
false
false
0
drmGetContextFlags(int fd, drm_context_t context, drm_context_tFlagsPtr flags) { drm_ctx_t ctx; memclear(ctx); ctx.handle = context; if (drmIoctl(fd, DRM_IOCTL_GET_CTX, &ctx)) return -errno; *flags = 0; if (ctx.flags & _DRM_CONTEXT_PRESERVED) *flags |= DRM_CONTEXT_PRESERVED; if (ctx.flags & _DRM_CONTEXT_2DONLY) *flags |= DRM_CONTEXT_2DONLY; return 0; }
false
false
false
false
false
0
default_development_directory(project_ty *pp) { // // To cope with automounters, directories are stored as given, // or are derived from the home directory in the passwd file. // Within aegis, pathnames have their symbolic links resolved, // and any comparison of paths is done on this "system idea" // of the pathname. // uconf_ty *ucp = uconf_get(); nstring path(ucp->default_development_directory); if (path.empty()) { path = nstring(project_default_development_directory_get(pp)); if (path.empty()) path = get_home(); } else { if (path[0] != '/') path = os_path_join(get_home(), path); } return path; }
false
false
false
false
false
0
explode(int x, int y) { if(explo_time == 56) manage.noise_out(1000); else if(explo_time > 64) return; int d = 4096 - (64 - explo_time)*(64 - explo_time); int i; for(i = 0; i < 2; ++i) { int dx = (int)(pubrand.get(6)) - 32; int dy = (int)(pubrand.get(6)) - 32; int vx = dx * (4096 - d) >> 8; int vy = dy * (4096 - d) >> 8; dx = dx * d >> 12; dy = dy * d >> 12; enemies.make(enemies.randexp(), x + dx, y + dy, vx, vy, explo_time >> 4); } ++explo_time; }
false
false
false
false
false
0
__fscache_relinquish_cookie(struct fscache_cookie *cookie, bool retire) { fscache_stat(&fscache_n_relinquishes); if (retire) fscache_stat(&fscache_n_relinquishes_retire); if (!cookie) { fscache_stat(&fscache_n_relinquishes_null); _leave(" [no cookie]"); return; } _enter("%p{%s,%p,%d},%d", cookie, cookie->def->name, cookie->netfs_data, atomic_read(&cookie->n_active), retire); /* No further netfs-accessing operations on this cookie permitted */ set_bit(FSCACHE_COOKIE_RELINQUISHED, &cookie->flags); __fscache_disable_cookie(cookie, retire); /* Clear pointers back to the netfs */ cookie->netfs_data = NULL; cookie->def = NULL; BUG_ON(cookie->stores.rnode); if (cookie->parent) { ASSERTCMP(atomic_read(&cookie->parent->usage), >, 0); ASSERTCMP(atomic_read(&cookie->parent->n_children), >, 0); atomic_dec(&cookie->parent->n_children); } /* Dispose of the netfs's link to the cookie */ ASSERTCMP(atomic_read(&cookie->usage), >, 0); fscache_cookie_put(cookie); _leave(""); }
false
false
false
false
false
0
isc_hex_tobuffer(isc_lex_t *lexer, isc_buffer_t *target, int length) { hex_decode_ctx_t ctx; isc_textregion_t *tr; isc_token_t token; isc_boolean_t eol; hex_decode_init(&ctx, length, target); while (ctx.length != 0) { unsigned int i; if (length > 0) eol = ISC_FALSE; else eol = ISC_TRUE; RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, eol)); if (token.type != isc_tokentype_string) break; tr = &token.value.as_textregion; for (i = 0; i < tr->length; i++) RETERR(hex_decode_char(&ctx, tr->base[i])); } if (ctx.length < 0) isc_lex_ungettoken(lexer, &token); RETERR(hex_decode_finish(&ctx)); return (ISC_R_SUCCESS); }
false
false
false
false
false
0
e_sexp_add_variable (ESExp *f, gint scope, gchar *name, ESExpTerm *value) { struct _ESExpSymbol *s; g_return_if_fail (IS_E_SEXP (f)); g_return_if_fail (name != NULL); s = g_malloc0 (sizeof (*s)); s->name = g_strdup (name); s->type = ESEXP_TERM_VAR; s->data = value; g_scanner_scope_add_symbol (f->scanner, scope, s->name, s); }
false
false
false
false
false
0
opt_med7(float *p) { PIX_SORT(p[0], p[5]) ; PIX_SORT(p[0], p[3]) ; PIX_SORT(p[1], p[6]) ; PIX_SORT(p[2], p[4]) ; PIX_SORT(p[0], p[1]) ; PIX_SORT(p[3], p[5]) ; PIX_SORT(p[2], p[6]) ; PIX_SORT(p[2], p[3]) ; PIX_SORT(p[3], p[6]) ; PIX_SORT(p[4], p[5]) ; PIX_SORT(p[1], p[4]) ; PIX_SORT(p[1], p[3]) ; PIX_SORT(p[3], p[4]) ; return (p[3]) ; }
false
false
false
false
false
0
e132xs_mulu(void) { UINT32 op1, op2, low_order, high_order; UINT64 double_word; op1 = op2 = 0; //PC or SR aren't denoted, else result is undefined if( (S_CODE == PC_CODE && !S_BIT) || (S_CODE == SR_CODE && !S_BIT) || (D_CODE == PC_CODE && !D_BIT) || (D_CODE == SR_CODE && !D_BIT) ) { verboselog( 1, "Denoted PC or SR in MULU instruction @ x\n", PC ); } else { if( S_BIT ) { op1 = GET_L_REG(S_CODE); } else { op1 = GET_G_REG(S_CODE); } if( D_BIT ) { op2 = GET_L_REG(D_CODE); } else { op2 = GET_G_REG(D_CODE); } double_word = (op1 * op2); low_order = double_word & 0x00000000ffffffff; high_order = (double_word & 0xffffffff00000000) >> 32; SET_RD(high_order, NOINC); SET_RD(low_order, INC); SET_Z((double_word == 0 ? 1: 0)); SET_N(SIGN_BIT(high_order)); //sign // SET_V(); //undefined // SET_C(); //undefined } if( op1 <= 0xffff && op2 <= 0xffff ) e132xs_ICount -= 4; else e132xs_ICount -= 6; }
false
false
false
false
false
0
reserve_partition(char *partition, struct sync_folder_list *replica_folders, struct sync_msgid_list *part_list) { const char *cmd = "RESERVE"; struct sync_msgid *msgid; struct sync_folder *folder; struct dlist *kl; struct dlist *kin = NULL; struct dlist *ki; int r; if (!part_list->count) return 0; /* nothing to reserve */ if (!replica_folders->head) return 0; /* nowhere to reserve */ kl = dlist_new(cmd); dlist_atom(kl, "PARTITION", partition); ki = dlist_list(kl, "MBOXNAME"); for (folder = replica_folders->head; folder; folder = folder->next) dlist_atom(ki, "MBOXNAME", folder->name); ki = dlist_list(kl, "GUID"); for (msgid = part_list->head; msgid; msgid = msgid->next) { dlist_atom(ki, "GUID", message_guid_encode(&msgid->guid)); msgid->mark = 1; part_list->marked++; } sync_send_apply(kl, sync_out); dlist_free(&kl); r = sync_parse_response(cmd, sync_in, &kin); if (r) return r; r = mark_missing(kin, part_list); dlist_free(&kin); return r; }
false
false
false
false
false
0
connman_dbus_property_changed_dict(const char *path, const char *interface, const char *key, connman_dbus_append_cb_t function, void *user_data) { DBusMessage *signal; DBusMessageIter iter; if (path == NULL) return FALSE; signal = dbus_message_new_signal(path, interface, "PropertyChanged"); if (signal == NULL) return FALSE; dbus_message_iter_init_append(signal, &iter); connman_dbus_property_append_dict(&iter, key, function, user_data); g_dbus_send_message(connection, signal); return TRUE; }
false
false
false
false
false
0
ocopen(OCstate** statep, const char* url) { int stat = OC_NOERR; OCstate * state = NULL; OCURI* tmpurl; CURL* curl = NULL; /* curl handle*/ if(!ocuriparse(url,&tmpurl)) {OCTHROWCHK(stat=OC_EBADURL); goto fail;} stat = occurlopen(&curl); if(stat != OC_NOERR) {OCTHROWCHK(stat); goto fail;} state = (OCstate*)ocmalloc(sizeof(OCstate)); /* ocmalloc zeros memory*/ if(state == NULL) {OCTHROWCHK(stat=OC_ENOMEM); goto fail;} /* Setup DAP state*/ state->magic = OCMAGIC; state->curl = curl; state->trees = oclistnew(); state->contentlist = NULL; state->uri = tmpurl; if(!ocuridecodeparams(state->uri)) { oc_log(LOGWARN,"Could not parse client parameters"); } state->packet = ocbytesnew(); ocbytessetalloc(state->packet,DFALTPACKETSIZE); /*initial reasonable size*/ /* set curl properties for this link */ ocsetcurlproperties(state); if(statep) *statep = state; return OCTHROW(stat); fail: ocurifree(tmpurl); if(state != NULL) ocfree(state); if(curl != NULL) occurlclose(curl); return OCTHROW(stat); }
false
false
false
false
false
0
hud_page_in() { // Go through all hud gauges to page them in int i; size_t j, num_gauges = 0; for (i = 0; i < Num_ship_classes; i++) { if(Ship_info[i].hud_enabled) { if(Ship_info[i].hud_gauges.size() > 0) { num_gauges = Ship_info[i].hud_gauges.size(); for(j = 0; j < num_gauges; j++) { Ship_info[i].hud_gauges[j]->pageIn(); } } } } num_gauges = default_hud_gauges.size(); for(j = 0; j < num_gauges; j++) { default_hud_gauges[j]->pageIn(); } }
false
false
false
false
false
0