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
ov9640_prog_dflt(struct i2c_client *client) { int i, ret; for (i = 0; i < ARRAY_SIZE(ov9640_regs_dflt); i++) { ret = ov9640_reg_write(client, ov9640_regs_dflt[i].reg, ov9640_regs_dflt[i].val); if (ret) return ret; } /* wait for the changes to actually happen, 140ms are not enough yet */ mdelay(150); return 0; }
false
false
false
false
false
0
SVC_GetChallenge (void) { int i; int oldest; int oldestTime; oldest = 0; oldestTime = 0x7fffffff; // see if we already have a challenge for this ip for (i = 0 ; i < MAX_CHALLENGES ; i++) { if (NET_CompareBaseAdr (&net_from, &svs.challenges[i].adr)) break; if (svs.challenges[i].time < oldestTime) { oldestTime = svs.challenges[i].time; oldest = i; } } if (i == MAX_CHALLENGES) { // overwrite the oldest svs.challenges[oldest].challenge = rand() & 0x7fff; svs.challenges[oldest].adr = net_from; svs.challenges[oldest].time = curtime; i = oldest; } // send it back Netchan_OutOfBandPrint (NS_SERVER, &net_from, "challenge %i", svs.challenges[i].challenge); }
false
false
false
false
false
0
init_ipxsaparray(void) { register int i; register struct hnamemem *table; for (i = 0; ipxsap_db[i].s != NULL; i++) { int j = htons(ipxsap_db[i].v) & (HASHNAMESIZE-1); table = &ipxsaptable[j]; while (table->name) table = table->nxt; table->name = ipxsap_db[i].s; table->addr = htons(ipxsap_db[i].v); table->nxt = newhnamemem(); } }
false
false
false
false
false
0
fakeCString(const wchar_t *u) { char *s, *t; unsigned int len; if(u == NULL) return NULL; len = uStrLen(u) + 1; t = s = (char*)malloc(len+1); while (*u) { if (*u == (wchar_t)0x2028) *t = '\n'; else if (*u == (wchar_t)0x2029) *t = '\r'; else *t = (char)*u; u++; t++; } *t = 0; return s; }
false
false
false
false
false
0
libmail_kwgDestroy(struct libmail_kwGeneric *g) { struct libmail_kwGenericEntry *p; size_t n; for (n=0; n<sizeof(g->messageHashTable)/sizeof(g->messageHashTable[0]); n++) while ((p=g->messageHashTable[n]) != NULL) { g->messageHashTable[n]=p->next; if (p->filename) free(p->filename); if (p->keywords) libmail_kwmDestroy(p->keywords); free(p); } if (g->messages) free(g->messages); g->messages=NULL; g->nMessages=0; g->messagesValid=0; return libmail_kwhCheck(&g->kwHashTable); }
false
false
false
false
false
0
modeisar(struct BCState *bcs, int mode, int bc) { struct IsdnCardState *cs = bcs->cs; /* Here we are selecting the best datapath for requested mode */ if (bcs->mode == L1_MODE_NULL) { /* New Setup */ bcs->channel = bc; switch (mode) { case L1_MODE_NULL: /* init */ if (!bcs->hw.isar.dpath) /* no init for dpath 0 */ return (0); break; case L1_MODE_TRANS: case L1_MODE_HDLC: /* best is datapath 2 */ if (!test_and_set_bit(ISAR_DP2_USE, &bcs->hw.isar.reg->Flags)) bcs->hw.isar.dpath = 2; else if (!test_and_set_bit(ISAR_DP1_USE, &bcs->hw.isar.reg->Flags)) bcs->hw.isar.dpath = 1; else { printk(KERN_WARNING"isar modeisar both paths in use\n"); return (1); } break; case L1_MODE_V32: case L1_MODE_FAX: /* only datapath 1 */ if (!test_and_set_bit(ISAR_DP1_USE, &bcs->hw.isar.reg->Flags)) bcs->hw.isar.dpath = 1; else { printk(KERN_WARNING"isar modeisar analog functions only with DP1\n"); debugl1(cs, "isar modeisar analog functions only with DP1"); return (1); } break; } } if (cs->debug & L1_DEB_HSCX) debugl1(cs, "isar dp%d mode %d->%d ichan %d", bcs->hw.isar.dpath, bcs->mode, mode, bc); bcs->mode = mode; setup_pump(bcs); setup_iom2(bcs); setup_sart(bcs); if (bcs->mode == L1_MODE_NULL) { /* Clear resources */ if (bcs->hw.isar.dpath == 1) test_and_clear_bit(ISAR_DP1_USE, &bcs->hw.isar.reg->Flags); else if (bcs->hw.isar.dpath == 2) test_and_clear_bit(ISAR_DP2_USE, &bcs->hw.isar.reg->Flags); bcs->hw.isar.dpath = 0; } return (0); }
false
false
false
false
false
0
PyFFi_newLayer(PyObject *noself, PyObject *args) { PyFF_Layer *self = (PyFF_Layer *) PyFFLayer_new(&PyFF_LayerType,NULL,NULL); int i, len; if ( self==NULL ) return( NULL ); len = PyTuple_Size(args); if ( len<1 ) { PyErr_Format(PyExc_TypeError, "Too few arguments"); return( NULL ); } self->is_quadratic = PyInt_AsLong(PyTuple_GetItem(args,0)); if ( PyErr_Occurred()!=NULL ) return( NULL ); self->cntr_cnt = self->cntr_max = len-2; self->contours = PyMem_New(PyFF_Contour *,self->cntr_max); if ( self->contours==NULL ) return( NULL ); for ( i=0; i<len-1; ++i ) { PyObject *obj = PyTuple_GetItem(args,1+i); if ( !PyType_IsSubtype(&PyFF_ContourType,((PyObject *)obj)->ob_type) ) { PyErr_Format(PyExc_TypeError, "Expected FontForge Contours."); return( NULL ); } Py_INCREF(obj); self->contours[i] = (PyFF_Contour *) obj; } return( (PyObject *) self ); }
false
false
false
false
false
0
XGI_DisableBridge(struct xgifb_video_info *xgifb_info, struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo) { unsigned short tempah = 0; if (pVBInfo->VBType & (VB_SIS301B | VB_SIS302B | VB_SIS301LV | VB_SIS302LV | VB_XGI301C)) { tempah = 0x3F; if (!(pVBInfo->VBInfo & (DisableCRT2Display | SetSimuScanMode))) { if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) { if (pVBInfo->VBInfo & SetCRT2ToDualEdge) tempah = 0x7F; /* Disable Channel A */ } } /* disable part4_1f */ xgifb_reg_and(pVBInfo->Part4Port, 0x1F, tempah); if (pVBInfo->VBType & (VB_SIS302LV | VB_XGI301C)) { if (((pVBInfo->VBInfo & (SetCRT2ToLCD | XGI_SetCRT2ToLCDA))) || (XGI_IsLCDON(pVBInfo))) /* LVDS Driver power down */ xgifb_reg_or(pVBInfo->Part4Port, 0x30, 0x80); } if (pVBInfo->VBInfo & (DisableCRT2Display | XGI_SetCRT2ToLCDA | SetSimuScanMode)) XGI_DisplayOff(xgifb_info, HwDeviceExtension, pVBInfo); if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) /* Power down */ xgifb_reg_and(pVBInfo->Part1Port, 0x1e, 0xdf); /* disable TV as primary VGA swap */ xgifb_reg_and(pVBInfo->P3c4, 0x32, 0xdf); if ((pVBInfo->VBInfo & (SetSimuScanMode | SetCRT2ToDualEdge))) xgifb_reg_and(pVBInfo->Part2Port, 0x00, 0xdf); if ((pVBInfo->VBInfo & (DisableCRT2Display | SetSimuScanMode)) || ((!(pVBInfo->VBInfo & XGI_SetCRT2ToLCDA)) && (pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToLCD | SetCRT2ToTV)))) xgifb_reg_or(pVBInfo->Part1Port, 0x00, 0x80); if ((pVBInfo->VBInfo & (DisableCRT2Display | SetSimuScanMode)) || (!(pVBInfo->VBInfo & XGI_SetCRT2ToLCDA)) || (pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToLCD | SetCRT2ToTV))) { /* save Part1 index 0 */ tempah = xgifb_reg_get(pVBInfo->Part1Port, 0x00); /* BTDAC = 1, avoid VB reset */ xgifb_reg_or(pVBInfo->Part1Port, 0x00, 0x10); /* disable CRT2 */ xgifb_reg_and(pVBInfo->Part1Port, 0x1E, 0xDF); /* restore Part1 index 0 */ xgifb_reg_set(pVBInfo->Part1Port, 0x00, tempah); } } else { /* {301} */ if (pVBInfo->VBInfo & (SetCRT2ToLCD | SetCRT2ToTV)) { xgifb_reg_or(pVBInfo->Part1Port, 0x00, 0x80); /* Disable CRT2 */ xgifb_reg_and(pVBInfo->Part1Port, 0x1E, 0xDF); /* Disable TV asPrimary VGA swap */ xgifb_reg_and(pVBInfo->P3c4, 0x32, 0xDF); } if (pVBInfo->VBInfo & (DisableCRT2Display | XGI_SetCRT2ToLCDA | SetSimuScanMode)) XGI_DisplayOff(xgifb_info, HwDeviceExtension, pVBInfo); } }
false
false
false
false
false
0
convert_mono_to_stereo( struct xmms_convert_buffers* buf, void **data, int length, int b16 ) { int i; void *outbuf = convert_get_buffer( &buf->stereo_buffer, length * 2 ); if ( b16 ) { uint16_t *output = outbuf, *input = *data; for ( i = 0; i < length / 2; i++ ) { *output++ = *input; *output++ = *input; input++; } } else { uint8_t *output = outbuf, *input = *data; for ( i = 0; i < length; i++ ) { *output++ = *input; *output++ = *input; input++; } } *data = outbuf; return length * 2; }
false
false
false
false
false
0
SlowReverseLookup(Object* value) { if (HasFastProperties()) { DescriptorArray* descs = map()->instance_descriptors(); for (int i = 0; i < descs->number_of_descriptors(); i++) { if (descs->GetType(i) == FIELD) { if (FastPropertyAt(descs->GetFieldIndex(i)) == value) { return descs->GetKey(i); } } else if (descs->GetType(i) == CONSTANT_FUNCTION) { if (descs->GetConstantFunction(i) == value) { return descs->GetKey(i); } } } return Heap::undefined_value(); } else { return property_dictionary()->SlowReverseLookup(value); } }
false
false
false
false
false
0
getPrintPages(int *from, int *to) const { GtkPageRange *range; int nrange; range = gtk_print_settings_get_page_ranges(_settings, &nrange); if (nrange <= 0) *from = *to = -1; else { *from = range->start; *to = range->end; g_free(range); } }
false
false
false
false
false
0
PI_InterpChanged(GGadget *g, GEvent *e) { if ( e->type==et_controlevent && e->u.control.subtype == et_radiochanged ) { GIData *ci = GDrawGetUserData(GGadgetGetWindow(g)); SplinePoint *cursp = ci->cursp; if ( GGadgetGetCid(g)==CID_Interpolated ) { if ( cursp->nonextcp && cursp->noprevcp ) /* Do Nothing */; else { if ( cursp->nonextcp && cursp->next ) { SplinePoint *n = cursp->next->to; cursp->nextcp.x = rint((n->me.x+cursp->me.x)/2); cursp->nextcp.y = rint((n->me.y+cursp->me.y)/2); n->prevcp = cursp->nextcp; cursp->nonextcp = n->noprevcp = false; } if ( cursp->noprevcp && cursp->prev ) { SplinePoint *p = cursp->prev->from; cursp->prevcp.x = rint((p->me.x+cursp->me.x)/2); cursp->prevcp.y = rint((p->me.y+cursp->me.y)/2); p->nextcp = cursp->prevcp; cursp->noprevcp = p->nonextcp = false; } cursp->me.x = (cursp->nextcp.x + cursp->prevcp.x)/2; cursp->me.y = (cursp->nextcp.y + cursp->prevcp.y)/2; if ( cursp->pointtype==pt_tangent ) { cursp->pointtype = pt_curve; GGadgetSetChecked(GWidgetGetControl(ci->gw,CID_Curve),true); } if ( cursp->next!=NULL ) SplineRefigure(cursp->next); if ( cursp->prev!=NULL ) SplineRefigure(cursp->prev); SplineSetSpirosClear(ci->curspl); CVCharChangedUpdate(&ci->cv->b); } PIFillup(ci,0); } PIShowHide(ci); } return( true ); }
false
false
false
false
false
0
get_xcoords(GtkHex *gh, gint pos, gint *x, gint *y) { gint cx, cy, spaces; if(gh->cpl == 0) return FALSE; cy = pos / gh->cpl; cy -= gh->top_line; if(cy < 0) return FALSE; cx = 2*(pos % gh->cpl); spaces = (pos % gh->cpl) / gh->group_type; cx *= gh->char_width; cy *= gh->char_height; spaces *= gh->char_width; *x = cx + spaces; *y = cy; return TRUE; }
false
false
false
false
false
0
CropString(const kwsys_stl::string& s, size_t max_len) { if (!s.size() || max_len == 0 || max_len >= s.size()) { return s; } kwsys_stl::string n; n.reserve(max_len); size_t middle = max_len / 2; n += s.substr(0, middle); n += s.substr(s.size() - (max_len - middle), kwsys_stl::string::npos); if (max_len > 2) { n[middle] = '.'; if (max_len > 3) { n[middle - 1] = '.'; if (max_len > 4) { n[middle + 1] = '.'; } } } return n; }
false
false
false
false
false
0
xts_done(symmetric_xts *xts) { LTC_ARGCHKVD(xts != NULL); cipher_descriptor[xts->cipher].done(&xts->key1); cipher_descriptor[xts->cipher].done(&xts->key2); }
false
false
false
true
false
1
pfx_add (const char * word, int len, struct affent* ep, int num) { struct affent * aent; int cond; int tlen; unsigned char * cp; int i; char * pp; char tword[MAX_WD_LEN]; for (aent = ep, i = num; i > 0; aent++, i--) { /* now make sure all conditions match */ if ((len + fullstrip > aent->stripl) && (len >= aent->numconds) && ((aent->stripl == 0) || (strncmp(aent->strip, word, aent->stripl) == 0))) { cp = (unsigned char *) word; for (cond = 0; cond < aent->numconds; cond++) { if ((aent->conds[*cp++] & (1 << cond)) == 0) break; } if (cond >= aent->numconds) { /* we have a match so add prefix */ tlen = 0; if (aent->appndl) { strcpy(tword,aent->appnd); tlen += aent->appndl; } pp = tword + tlen; strcpy(pp, (word + aent->stripl)); tlen = tlen + len - aent->stripl; if (numwords < MAX_WORDS) { wlist[numwords].word = mystrdup(tword); wlist[numwords].pallow = 0; numwords++; } } } } }
false
false
false
false
false
0
getPropertySheet(string /*ignored inSessionID*/, string inAlgorithmID)const{ mMutexSessionManager.lock(); CAlgorithm& lAlgorithm(getAlgorithmByType(inAlgorithmID)); CXMLElement* lReturnValue(0); if(lAlgorithm.stringReadAttribute(mrml_const::cui_property_sheet_id).first){ lReturnValue=mPropertySheetList->newPropertySheet(lAlgorithm .stringReadAttribute(mrml_const::cui_property_sheet_id).second); } mMutexSessionManager.unlock(); return lReturnValue; }
false
false
false
false
false
0
flavor_assign_random(byte tval) { int i, j; int flavor_count = 0; int choice; /* Count the random flavors for the given tval */ for (i = 0; i < z_info->flavor_max; i++) { if ((flavor_info[i].tval == tval) && (flavor_info[i].sval == SV_UNKNOWN)) { flavor_count++; } } for (i = 0; i < z_info->k_max; i++) { /* Skip other object types */ if (k_info[i].tval != tval) continue; /* Skip objects that already are flavored */ if (k_info[i].flavor != 0) continue; /* HACK - Ordinary food is "boring" */ if ((tval == TV_FOOD) && (k_info[i].sval < SV_FOOD_MIN_SHROOM)) continue; if (!flavor_count) quit_fmt("Not enough flavors for tval %d.", tval); /* Select a flavor */ choice = randint0(flavor_count); /* Find and store the flavor */ for (j = 0; j < z_info->flavor_max; j++) { /* Skip other tvals */ if (flavor_info[j].tval != tval) continue; /* Skip assigned svals */ if (flavor_info[j].sval != SV_UNKNOWN) continue; if (choice == 0) { /* Store the flavor index */ k_info[i].flavor = j; /* Mark the flavor as used */ flavor_info[j].sval = k_info[i].sval; /* One less flavor to choose from */ flavor_count--; break; } choice--; } } }
false
false
false
false
false
0
authentication_agent_cancel_all_sessions (AuthenticationAgent *agent) { /* cancel all active authentication sessions; use a copy of the list since * callbacks will modify the list */ if (agent->active_sessions != NULL) { GList *l; GList *active_sessions; active_sessions = g_list_copy (agent->active_sessions); for (l = active_sessions; l != NULL; l = l->next) { AuthenticationSession *session = l->data; authentication_session_cancel (session); } g_list_free (active_sessions); } }
false
false
false
false
false
0
plugin_unregister(struct plugin_handle* plugin) { struct chat_history_data* data = (struct chat_history_data*) plugin->ptr; if (data) { list_clear(data->chat_history, &hub_free); list_destroy(data->chat_history); plugin->hub.command_del(plugin, data->command_history_handle); hub_free(data->command_history_handle); hub_free(data); } return 0; }
false
false
false
false
false
0
G_ExitLevel (int dest) { if(dest == 0) dest = gamemap + 1; destmap = dest; riftdest = 0; gameaction = ga_completed; }
false
false
false
false
false
0
internalGetReading(void) { ArTime readingRequested; std::string reading; char buf[1024]; reading = ""; readingRequested.setToNow(); if (!writeLine(myRequestString)) { ArLog::log(ArLog::Terse, "Could not send request distance reading to urg"); return false; } if (!readLine(buf, sizeof(buf), 10000) || strcasecmp(buf, myRequestString) != 0) { ArLog::log(ArLog::Normal, "%s: Did not get distance reading response", getName()); return false; } if (!readLine(buf, sizeof(buf), 10000) || strcasecmp(buf, "0") != 0) { ArLog::log(ArLog::Normal, "%s: Bad status on distance reading response (%c)", getName(), buf[0]); return false; } while (readLine(buf, sizeof(buf), 10000)) { if (strlen(buf) == 0) { myReadingMutex.lock(); myReadingRequested = readingRequested; myReading = reading; myReadingMutex.unlock(); if (myRobot == NULL) sensorInterp(); return true; } else { reading += buf; } } return false; }
false
false
false
false
false
0
_ibar_focused_next_find(void) { IBar *b, *bn = NULL; Eina_List *l; Eina_List *tmpl = NULL; EINA_LIST_FOREACH(ibars, l, b) { if (!b->icons) continue; tmpl = eina_list_sorted_insert (tmpl, EINA_COMPARE_CB(_ibar_cb_sort), b); } if (!tmpl) tmpl = ibars; EINA_LIST_FOREACH(tmpl, l, b) { if (b->focused) { if (l->next) { bn = l->next->data; break; } else { bn = tmpl->data; break; } } } if (tmpl != ibars) eina_list_free(tmpl); return bn; }
false
false
false
false
false
0
create(void const * const buffer, const size_t size) { Memory *mbs=new Memory(); GP<ByteStream> retval=mbs; mbs->init(buffer,size); return retval; }
false
false
false
false
false
0
iks_first_tag (iks *x) { if (x) { x = IKS_TAG_CHILDREN (x); while (x) { if (IKS_TAG == x->type) return x; x = x->next; } } return NULL; }
false
false
false
false
false
0
BuildRepresentation() { // The net effect is to resize the handle if ( this->GetMTime() > this->BuildTime || (this->Renderer && this->Renderer->GetVTKWindow() && this->Renderer->GetVTKWindow()->GetMTime() > this->BuildTime) ) { if ( ! this->Placed ) { this->ValidPick = 1; this->Placed = 1; } this->SizeBounds(); this->Sphere->Update(); this->BuildTime.Modified(); } }
false
false
false
false
false
0
nfs4_xdr_dec_destroy_clientid(struct rpc_rqst *rqstp, struct xdr_stream *xdr, void *res) { struct compound_hdr hdr; int status; status = decode_compound_hdr(xdr, &hdr); if (!status) status = decode_destroy_clientid(xdr, res); return status; }
false
false
false
false
false
0
faulthandler_disable(void) { unsigned int i; fault_handler_t *handler; if (fatal_error.enabled) { fatal_error.enabled = 0; for (i=0; i < faulthandler_nsignals; i++) { handler = &faulthandler_handlers[i]; if (!handler->enabled) continue; #ifdef HAVE_SIGACTION (void)sigaction(handler->signum, &handler->previous, NULL); #else (void)signal(handler->signum, handler->previous); #endif handler->enabled = 0; } } Py_CLEAR(fatal_error.file); }
false
false
false
false
false
0
cell_foreach_range_dep (GnmCell const *cell, GnmDepFunc func, gpointer user) { search_rangedeps_closure_t closure; GHashTable *bucket = cell->base.sheet->deps->range_hash[BUCKET_OF_ROW (cell->pos.row)]; if (bucket != NULL) { closure.col = cell->pos.col; closure.row = cell->pos.row; closure.func = func; closure.user = user; g_hash_table_foreach (bucket, &cb_search_rangedeps, &closure); } }
false
false
false
false
false
0
__ecereMethod___ecereNameSpace__ecere__net__DCOMServerThread_Main(struct __ecereNameSpace__ecere__com__Instance * this) { struct __ecereNameSpace__ecere__net__DCOMServerThread * __ecerePointer___ecereNameSpace__ecere__net__DCOMServerThread = (struct __ecereNameSpace__ecere__net__DCOMServerThread *)(this ? (((char *)this) + __ecereClass___ecereNameSpace__ecere__net__DCOMServerThread->offset) : 0); __ecerePointer___ecereNameSpace__ecere__net__DCOMServerThread->socket->_refCount++; while(__ecerePointer___ecereNameSpace__ecere__net__DCOMServerThread->connected) { __ecereMethod___ecereNameSpace__ecere__net__Socket_ProcessTimeOut(__ecerePointer___ecereNameSpace__ecere__net__DCOMServerThread->socket, 0.01); __ecereMethod___ecereNameSpace__ecere__gui__GuiApplication_Lock(__ecereNameSpace__ecere__gui__guiApp); __ecereMethod___ecereNameSpace__ecere__net__DCOMServerSocket_ProcessCalls(__ecerePointer___ecereNameSpace__ecere__net__DCOMServerThread->socket); __ecereMethod___ecereNameSpace__ecere__gui__GuiApplication_Unlock(__ecereNameSpace__ecere__gui__guiApp); __ecereMethod___ecereNameSpace__ecere__sys__Semaphore_Release(__ecerePointer___ecereNameSpace__ecere__net__DCOMServerThread->semaphore); } (__ecereNameSpace__ecere__com__eInstance_DecRef(__ecerePointer___ecereNameSpace__ecere__net__DCOMServerThread->socket), __ecerePointer___ecereNameSpace__ecere__net__DCOMServerThread->socket = 0); return 0; }
false
false
false
true
false
1
boot(void) { enum { BOOT_NONE, BOOT_A, BOOT_CDROM, BOOT_C, BOOT_D, BOOT_E, BOOT_F, BOOT_LS_ZIP, BOOT_SCSI, }; static const uint8_t seq[][3] = { { BOOT_A, BOOT_C, BOOT_SCSI }, { BOOT_C, BOOT_A, BOOT_SCSI }, { BOOT_C, BOOT_CDROM, BOOT_A }, { BOOT_CDROM, BOOT_C, BOOT_A }, { BOOT_D, BOOT_A, BOOT_SCSI }, { BOOT_E, BOOT_A, BOOT_SCSI }, { BOOT_F, BOOT_A, BOOT_SCSI }, { BOOT_SCSI, BOOT_A, BOOT_C }, { BOOT_SCSI, BOOT_C, BOOT_A }, { BOOT_C, BOOT_NONE, BOOT_NONE }, { BOOT_LS_ZIP, BOOT_C, BOOT_NONE }, }; uint8_t cmos_seq; int bootdev; int i; bprintf("\n\nChecking boot devices ...\n"); cmos_seq = cmos_get(x3c) & 0xf; if (sizeof(seq) / sizeof(seq[0]) <= cmos_seq) { cmos_seq = 0; } bootdev = -1; for (i = 0; i < 3; i++) { uint8_t dev; dev = seq[cmos_seq][i]; if (dev == BOOT_NONE) { /* Nothing... */ } else if (dev == BOOT_A) { /* Try to boot from floppy. */ DEBUGPRINT(3, "Trying to boot from floppy... "); bprintf(" - Floppy: "); bootdev = boot_floppy(); } else if (dev == BOOT_CDROM) { /* Try to boot from cdrom. */ DEBUGPRINT(3, "Trying to boot from cdrom... "); bprintf(" - CDROM: "); bootdev = boot_cdrom(); } else if (dev == BOOT_C) { /* Try to boot from harddisk. */ DEBUGPRINT(3, "Trying to boot from harddisk... "); bprintf(" - Harddisk: "); bootdev = boot_harddisk(); } else if (dev == BOOT_SCSI) { /* Try to boot from external device. */ DEBUGPRINT(3, "Trying to boot from external device... "); bprintf(" - Int 19h: "); bootdev = boot_int19h(); } else { /* FIXME */ bprintf("Unsupported boot entry in CMOS, " "please run setup.\n"); continue; } if (bootdev != -1) { DEBUGPRINT(3, "OK\n"); bprintf("OK\n"); break; } else { DEBUGPRINT(3, "Failed\n"); bprintf("Failed\n"); } } #if 0 /* Switch off A20 gate. */ outb(0, 0x92); #endif if (bootdev == -1) { /* last chance - never returns */ DEBUGPRINT(3, "Trying int18h... \n"); boot_int18h(); } return bootdev; }
false
false
false
false
false
0
cvt_s16_to_native(struct mulaw_priv *data, unsigned char *dst, u16 sample) { sample ^= data->flip; if (data->cvt_endian) sample = swab16(sample); if (data->native_bytes > data->copy_bytes) memset(dst, 0, data->native_bytes); memcpy(dst + data->native_ofs, (char *)&sample + data->copy_ofs, data->copy_bytes); }
false
false
false
false
false
0
CMod_LoadSubmodels (lump_t *l) { dmodel_t *in; cmodel_t *out; int i, j, count; in = (void *)(cmod_base + l->fileofs); if (l->filelen % sizeof(*in)) Com_Error (ERR_DROP, "CMod_LoadSubmodels: funny lump size"); count = l->filelen / sizeof(*in); if (count < 1) Com_Error (ERR_DROP, "Map with no models"); if (count > MAX_MAP_MODELS) Com_Error (ERR_DROP, "Map has too many models"); numcmodels = count; for ( i=0 ; i<count ; i++, in++, out++) { out = &map_cmodels[i]; for (j=0 ; j<3 ; j++) { // spread the mins / maxs by a pixel out->mins[j] = LittleFloat (in->mins[j]) - 1; out->maxs[j] = LittleFloat (in->maxs[j]) + 1; out->origin[j] = LittleFloat (in->origin[j]); } out->headnode = LittleLong (in->headnode); } }
false
false
false
false
false
0
PS_generate_grav1d(ParaSparse *M, int *N, MPI_Comm comm) { int i,j,n; *M = PS_DEFAULT; M->N = *N; M->comm = comm; MPI_Comm_size(M->comm, &(M->size)); MPI_Comm_rank(M->comm, &(M->rank)); M->na = (M->rank) * (*N/(M->size)); if(M->rank == M->size-1) M->nd = *N - M->na; else M->nd = ((M->rank)+1)*(*N/(M->size)) - M->na; for(n = 0; n < M->nd; n++) PS_add_entry(M, n+M->na, n+M->na, -2.0); for(i = 0; i < *N; i++) for(j = 0; j < *N; j++) if(j == i-1 && ((i>=M->na && i<M->na+M->nd) || (j>=M->na && j<M->na+M->nd))) PS_add_entry(M, i, j, 1.0); }
false
false
false
false
false
0
gst_file_src_map_small_region (GstFileSrc * src, off_t offset, gsize size) { GstBuffer *ret; off_t mod; guint pagesize; GST_LOG_OBJECT (src, "attempting to map a small buffer at %" G_GUINT64_FORMAT "+%d", (guint64) offset, (gint) size); pagesize = src->pagesize; mod = offset % pagesize; /* if the offset starts at a non-page boundary, we have to special case */ if (mod != 0) { gsize mapsize; off_t mapbase; GstBuffer *map; mapbase = offset - mod; mapsize = ((size + mod + pagesize - 1) / pagesize) * pagesize; GST_LOG_OBJECT (src, "not on page boundaries, resizing to map to %" G_GUINT64_FORMAT "+%d", (guint64) mapbase, (gint) mapsize); map = gst_file_src_map_region (src, mapbase, mapsize, FALSE); if (map == NULL) return NULL; ret = gst_buffer_create_sub (map, offset - mapbase, size); GST_BUFFER_OFFSET (ret) = GST_BUFFER_OFFSET (map) + offset - mapbase; gst_buffer_unref (map); } else { ret = gst_file_src_map_region (src, offset, size, FALSE); } return ret; }
false
false
false
false
false
0
gst_asf_demux_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) { GstASFDemux *demux; gboolean ret = TRUE; demux = GST_ASF_DEMUX (parent); GST_LOG_OBJECT (demux, "handling %s event", GST_EVENT_TYPE_NAME (event)); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_SEGMENT:{ const GstSegment *segment; gst_event_parse_segment (event, &segment); if (segment->format == GST_FORMAT_BYTES) { if (demux->packet_size && segment->start > demux->data_offset) demux->packet = (segment->start - demux->data_offset) / demux->packet_size; else demux->packet = 0; } else if (segment->format == GST_FORMAT_TIME) { /* do not know packet position, not really a problem */ demux->packet = -1; } else { GST_WARNING_OBJECT (demux, "unsupported newsegment format, ignoring"); gst_event_unref (event); break; } /* record upstream segment for interpolation */ if (segment->format != demux->in_segment.format) gst_segment_init (&demux->in_segment, GST_FORMAT_UNDEFINED); gst_segment_copy_into (segment, &demux->in_segment); /* in either case, clear some state and generate newsegment later on */ GST_OBJECT_LOCK (demux); demux->segment_ts = GST_CLOCK_TIME_NONE; demux->in_gap = GST_CLOCK_TIME_NONE; demux->need_newsegment = TRUE; demux->segment_seqnum = gst_event_get_seqnum (event); gst_asf_demux_reset_stream_state_after_discont (demux); GST_OBJECT_UNLOCK (demux); gst_event_unref (event); break; } case GST_EVENT_EOS:{ GstFlowReturn flow; if (demux->state == GST_ASF_DEMUX_STATE_HEADER) { GST_ELEMENT_ERROR (demux, STREAM, DEMUX, (_("This stream contains no data.")), ("got eos and didn't receive a complete header object")); break; } flow = gst_asf_demux_push_complete_payloads (demux, TRUE); if (flow < GST_FLOW_EOS || flow == GST_FLOW_NOT_LINKED) { GST_ELEMENT_ERROR (demux, STREAM, FAILED, (_("Internal data stream error.")), ("streaming stopped, reason %s", gst_flow_get_name (flow))); break; } GST_OBJECT_LOCK (demux); gst_adapter_clear (demux->adapter); GST_OBJECT_UNLOCK (demux); gst_asf_demux_send_event_unlocked (demux, event); break; } case GST_EVENT_FLUSH_STOP: GST_OBJECT_LOCK (demux); gst_asf_demux_reset_stream_state_after_discont (demux); GST_OBJECT_UNLOCK (demux); gst_asf_demux_send_event_unlocked (demux, event); /* upon activation, latency is no longer introduced, e.g. after seek */ if (demux->activated_streams) demux->latency = 0; break; default: ret = gst_pad_event_default (pad, parent, event); break; } return ret; }
false
false
false
false
false
0
expr_s(Interp &interp, const RefPtr<Expr> &arg, const RefPtr<Obj> &/*data*/) { Val tmp_self=interp.top_scope()->self(); Val tmp_arg=arg->eval_in(interp); if(tmp_self.obj()->is_method("m") && tmp_arg.obj()->is_method("m")) { string var_name=interp.top_scope()->var("v").expr()->str(); const Method &method1=tmp_self.obj()->method("m"); const string &arg_name1=method1.arg_name(); const Method &method2=tmp_arg.obj()->method("m"); RefPtr<Expr> tmp_tree=method1.expr(); RefPtr<Expr> tmp_expr=method2.expr(); if(tmp_tree.get()!=0 && tmp_expr.get()!=0) { RefPtr<Expr> new_tree=tmp_tree->substit(var_name, tmp_expr); Val new_self(tmp_self.i(), tmp_self.obj()->clone()); new_self.obj()->def_method("m", Method(arg_name1, new_tree)); return new_self; } } return interp.nil_val(); }
false
false
false
false
false
0
klp_init_patch(struct klp_patch *patch) { struct klp_object *obj; int ret; if (!patch->objs) return -EINVAL; mutex_lock(&klp_mutex); patch->state = KLP_DISABLED; ret = kobject_init_and_add(&patch->kobj, &klp_ktype_patch, klp_root_kobj, "%s", patch->mod->name); if (ret) goto unlock; klp_for_each_object(patch, obj) { ret = klp_init_object(patch, obj); if (ret) goto free; } list_add_tail(&patch->list, &klp_patches); mutex_unlock(&klp_mutex); return 0; free: klp_free_objects_limited(patch, obj); kobject_put(&patch->kobj); unlock: mutex_unlock(&klp_mutex); return ret; }
false
false
false
false
false
0
IsHardClass(char *sp) /* true if string matches a hardwired class e.g. hpux */ { int i; static char *names[] = { "any","agent","Morning","Afternoon","Evening","Night","Q1","Q2","Q3","Q4", "SuSE","suse","fedora","Ubuntu","lsb_compliant","localhost", NULL }; static char *prefixes[] = { "cfengine_","ipv4", NULL }; for (i = 2; CLASSTEXT[i] != '\0'; i++) { if (strcmp(CLASSTEXT[i],sp) == 0) { return true; } } for (i = 0; i < 7; i++) { if (strcmp(DAY_TEXT[i],sp)==0) { return true; } } for (i = 0; i < 12; i++) { if (strncmp(MONTH_TEXT[i],sp,3) == 0) { return true; } } for (i = 0; names[i] != NULL; i++) { if (strcmp(names[i],sp) == 0) { return true; } } for (i = 0; prefixes[i] != NULL; i++) { if (strncmp(prefixes[i],sp,strlen(prefixes[i])) == 0) { return true; } } if (strncmp(sp,"Min",3) == 0 && isdigit(*(sp+3))) { return true; } if (strncmp(sp,"Hr",2) == 0 && isdigit(*(sp+2))) { return true; } if (strncmp(sp,"Yr",2) == 0 && isdigit(*(sp+2))) { return true; } if (strncmp(sp,"Day",3) == 0 && isdigit(*(sp+3))) { return true; } if (strncmp(sp,"GMT",3) == 0 && *(sp+3) == '_') { return true; } if (strncmp(sp,"Lcycle",strlen("Lcycle")) == 0) { return true; } return(false); }
false
false
false
false
false
0
detect_target_charset(const char *locname) { char *s = NULL; #ifdef HAVE_NL_LANGINFO if (!locname) return NULL; if ((s = setlocale(LC_CTYPE, locname)) == NULL) return NULL; s = enca_strdup(nl_langinfo(CODESET)); if (setlocale(LC_CTYPE, "C") == NULL) { fprintf(stderr, "%s: Cannot set LC_CTYPE to the portable \"C\" locale\n", program_name); exit(EXIT_TROUBLE); } if (options.verbosity_level > 2) fprintf(stderr, "Detected locale native charset: %s\n", s); #endif /* HAVE_NL_LANGINFO */ return s; }
false
false
false
false
false
0
getLastMousePositionRay(TLine3D &ray) const { int x,y; if (getLastMousePosition(x,y)) { m_csAccess3DScene.enter(); m_3Dscene->getViewport("main")->get3DRayForPixelCoord(x,y,ray); m_csAccess3DScene.leave(); return true; } else return false; }
false
false
false
false
false
0
_equalCreateOpClassItem(CreateOpClassItem *a, CreateOpClassItem *b) { COMPARE_SCALAR_FIELD(itemtype); COMPARE_NODE_FIELD(name); COMPARE_NODE_FIELD(args); COMPARE_SCALAR_FIELD(number); COMPARE_NODE_FIELD(order_family); COMPARE_NODE_FIELD(class_args); COMPARE_NODE_FIELD(storedtype); return true; }
false
false
false
false
false
0
cancel(GtkWidget */*widget*/, gpointer data) { DialogWindow *self = (DialogWindow *)data; self->_dialog_result = GTK_RESPONSE_CANCEL; if (self->_args != NULL) self->_args->call_callbacks("ui-dialog-cancel-CB"); self->hide(); }
false
false
false
false
false
0
isa(class_desc* base_class) { for (class_desc* cls = this; cls->n_bases != 0; cls = *cls->bases) { if (cls == base_class) return true; } return false; }
false
false
false
false
false
0
iuu_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old_termios) { const u32 supported_mask = CMSPAR|PARENB|PARODD; struct iuu_private *priv = usb_get_serial_port_data(port); unsigned int cflag = tty->termios.c_cflag; int status; u32 actual; u32 parity; int csize = CS7; int baud; u32 newval = cflag & supported_mask; /* Just use the ospeed. ispeed should be the same. */ baud = tty->termios.c_ospeed; dev_dbg(&port->dev, "%s - enter c_ospeed or baud=%d\n", __func__, baud); /* compute the parity parameter */ parity = 0; if (cflag & CMSPAR) { /* Using mark space */ if (cflag & PARODD) parity |= IUU_PARITY_SPACE; else parity |= IUU_PARITY_MARK; } else if (!(cflag & PARENB)) { parity |= IUU_PARITY_NONE; csize = CS8; } else if (cflag & PARODD) parity |= IUU_PARITY_ODD; else parity |= IUU_PARITY_EVEN; parity |= (cflag & CSTOPB ? IUU_TWO_STOP_BITS : IUU_ONE_STOP_BIT); /* set it */ status = iuu_uart_baud(port, baud * priv->boost / 100, &actual, parity); /* set the termios value to the real one, so the user now what has * changed. We support few fields so its easies to copy the old hw * settings back over and then adjust them */ if (old_termios) tty_termios_copy_hw(&tty->termios, old_termios); if (status != 0) /* Set failed - return old bits */ return; /* Re-encode speed, parity and csize */ tty_encode_baud_rate(tty, baud, baud); tty->termios.c_cflag &= ~(supported_mask|CSIZE); tty->termios.c_cflag |= newval | csize; }
false
false
false
false
false
0
track_change_done (RBPlayerGst *mp, GError *error) { mp->priv->stream_change_pending = FALSE; if (error != NULL) { rb_debug ("track change failed: %s", error->message); return; } rb_debug ("track change finished"); mp->priv->current_track_finishing = FALSE; mp->priv->buffering = FALSE; mp->priv->playing = TRUE; if (mp->priv->playbin_stream_changing == FALSE) { emit_playing_stream_and_tags (mp, mp->priv->track_change); } if (mp->priv->tick_timeout_id == 0) { mp->priv->tick_timeout_id = g_timeout_add (1000 / RB_PLAYER_GST_TICK_HZ, (GSourceFunc) tick_timeout, mp); } if (mp->priv->volume_applied == 0) { GstElement *e; /* if the sink provides volume control, ignore the first * volume setting, allowing the sink to restore its own * volume. */ e = rb_player_gst_find_element_with_property (mp->priv->audio_sink, "volume"); if (e != NULL) { mp->priv->volume_applied = 1; gst_object_unref (e); } if (mp->priv->volume_applied < mp->priv->volume_changed) { rb_debug ("applying initial volume: %f", mp->priv->cur_volume); set_playbin_volume (mp, mp->priv->cur_volume); } mp->priv->volume_applied = mp->priv->volume_changed; } }
false
false
false
false
false
0
spl_filesystem_object_free_storage(void *object TSRMLS_DC) /* {{{ */ { spl_filesystem_object *intern = (spl_filesystem_object*)object; if (intern->oth_handler && intern->oth_handler->dtor) { intern->oth_handler->dtor(intern TSRMLS_CC); } zend_object_std_dtor(&intern->std TSRMLS_CC); if (intern->_path) { efree(intern->_path); } if (intern->file_name) { efree(intern->file_name); } switch(intern->type) { case SPL_FS_INFO: break; case SPL_FS_DIR: if (intern->u.dir.dirp) { php_stream_close(intern->u.dir.dirp); intern->u.dir.dirp = NULL; } if (intern->u.dir.sub_path) { efree(intern->u.dir.sub_path); } break; case SPL_FS_FILE: if (intern->u.file.stream) { if (intern->u.file.zcontext) { /* zend_list_delref(Z_RESVAL_P(intern->zcontext));*/ } if (!intern->u.file.stream->is_persistent) { php_stream_free(intern->u.file.stream, PHP_STREAM_FREE_CLOSE); } else { php_stream_free(intern->u.file.stream, PHP_STREAM_FREE_CLOSE_PERSISTENT); } if (intern->u.file.open_mode) { efree(intern->u.file.open_mode); } if (intern->orig_path) { efree(intern->orig_path); } } spl_filesystem_file_free_line(intern TSRMLS_CC); break; } efree(object); }
false
false
false
false
false
0
modify_access_pattern_one_dim(List *outer_loop_list, int dim, int entry) { Block *bpt; List *li; int lower = 0, upper = 0; int temp = 0; for (li = outer_loop_list; li != NULL; li = li->next) { bpt = (Block *)li->data; temp = modify_access_pattern_one_dim_lower(bpt, dim, entry); if (temp < lower) { lower = temp; } temp = modify_access_pattern_one_dim_upper(bpt, dim, entry); if (temp > upper) { upper = temp; } } return upper - lower; }
false
false
false
false
false
0
xml_strncpy_encode_entity(char *dest, const char *src, int n) { int i=0; if(n < 1) { return(0); } *dest = 0; for(; *src; src++) { if((n - i) < 7) { break; } if(*src == '<') { strcpy(dest + i, "&lt;"); i += 4; continue; } if(*src == '>') { strcpy(dest + i, "&gt;"); i += 4; continue; } if(*src == '&') { strcpy(dest + i, "&amp;"); i += 5; continue; } if(*src == '\'') { strcpy(dest + i, "&apos;"); i += 6; continue; } if(*src == '\"') { strcpy(dest + i, "&quot;"); i += 6; continue; } dest[i++] = *src; } dest[i] = 0; return(i); }
false
false
false
false
false
0
have_data_locks(const struct tdb_context *tdb) { unsigned int i; for (i = 0; i < tdb->num_lockrecs; i++) { if (tdb->lockrecs[i].off >= lock_offset(-1)) return true; } return false; }
false
false
false
false
false
0
load_layers(SFHeader *hdr, SList at) { int i; SFGenLayer *p; if ((hdr->nlayers = SIndex(at)) <= 0) { hdr->nlayers = 0; return; } hdr->layer = (SFGenLayer*)safe_malloc(sizeof(SFGenLayer) * hdr->nlayers); p = hdr->layer; at = SCar(at); for (i = 0; i < hdr->nlayers; i++) { load_lists(p, at); p++; at = SCdr(at); } }
false
false
false
false
false
0
on_web_view_navigation_policy_decision_requested (WebKitWebView *webView, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action, WebKitWebPolicyDecision *policy_decision, gpointer user_data) { GoaOAuth2Provider *provider = GOA_OAUTH2_PROVIDER (user_data); GoaOAuth2ProviderPrivate *priv = provider->priv; GHashTable *key_value_pairs; SoupMessage *message; SoupURI *uri; const gchar *fragment; const gchar *oauth2_error; const gchar *query; const gchar *redirect_uri; const gchar *requested_uri; gint response_id; /* TODO: use oauth2_proxy_extract_access_token() */ requested_uri = webkit_network_request_get_uri (request); redirect_uri = goa_oauth2_provider_get_redirect_uri (provider); if (!g_str_has_prefix (requested_uri, redirect_uri)) goto default_behaviour; message = webkit_network_request_get_message (request); uri = soup_message_get_uri (message); fragment = soup_uri_get_fragment (uri); query = soup_uri_get_query (uri); /* Two cases: * 1) we can either have the access_token and other information * directly in the fragment part of the URI, or * 2) the auth code can be in the query part of the URI, with which * we'll obtain the token later. */ if (fragment != NULL) { /* fragment is encoded into a key/value pairs for the token and * expiration values, using the same syntax as a URL query */ key_value_pairs = soup_form_decode (fragment); /* We might use oauth2_proxy_extract_access_token() here but * we can also extract other information. */ priv->access_token = g_strdup (g_hash_table_lookup (key_value_pairs, "access_token")); if (priv->access_token != NULL) { gchar *expires_in_str = NULL; expires_in_str = g_hash_table_lookup (key_value_pairs, "expires_in"); /* sometimes "expires_in" appears as "expires" */ if (expires_in_str == NULL) expires_in_str = g_hash_table_lookup (key_value_pairs, "expires"); if (expires_in_str != NULL) priv->access_token_expires_in = atoi (expires_in_str); priv->refresh_token = g_strdup (g_hash_table_lookup (key_value_pairs, "refresh_token")); response_id = GTK_RESPONSE_OK; } g_hash_table_unref (key_value_pairs); } if (priv->access_token != NULL) goto ignore_request; if (query != NULL) { key_value_pairs = soup_form_decode (query); priv->authorization_code = g_strdup (g_hash_table_lookup (key_value_pairs, "code")); if (priv->authorization_code != NULL) response_id = GTK_RESPONSE_OK; g_hash_table_unref (key_value_pairs); } if (priv->authorization_code != NULL) goto ignore_request; /* In case we don't find the access_token or auth code, then look * for the error in the query part of the URI. */ key_value_pairs = soup_form_decode (query); oauth2_error = (const gchar *) g_hash_table_lookup (key_value_pairs, "error"); if (g_strcmp0 (oauth2_error, GOA_OAUTH2_ACCESS_DENIED) == 0) response_id = GTK_RESPONSE_CANCEL; else { g_set_error (&priv->error, GOA_ERROR, GOA_ERROR_NOT_AUTHORIZED, _("Authorization response was \"%s\""), oauth2_error); response_id = GTK_RESPONSE_CLOSE; } g_hash_table_unref (key_value_pairs); goto ignore_request; ignore_request: gtk_dialog_response (priv->dialog, response_id); webkit_web_policy_decision_ignore (policy_decision); return TRUE; default_behaviour: return FALSE; }
false
false
false
false
false
0
mono_ArgIterator_IntGetNextArgT (MonoArgIterator *iter, MonoType *type) { guint32 i, arg_size; gint32 align; MonoTypedRef res; MONO_ARCH_SAVE_REGS; i = iter->sig->sentinelpos + iter->next_arg; g_assert (i < iter->sig->param_count); while (i < iter->sig->param_count) { if (!mono_metadata_type_equal (type, iter->sig->params [i])) continue; res.type = iter->sig->params [i]; res.klass = mono_class_from_mono_type (res.type); /* FIXME: endianess issue... */ arg_size = mono_type_stack_size (res.type, &align); #if defined(__arm__) || defined(__mips__) iter->args = (guint8*)(((gsize)iter->args + (align) - 1) & ~(align - 1)); #endif res.value = iter->args; iter->args = (char*)iter->args + arg_size; iter->next_arg++; /* g_print ("returning arg %d, type 0x%02x of size %d at %p\n", i, res.type->type, arg_size, res.value); */ return res; } /* g_print ("arg type 0x%02x not found\n", res.type->type); */ res.type = NULL; res.value = NULL; res.klass = NULL; return res; }
false
false
false
false
false
0
AcpiTbStoreTable ( ACPI_PHYSICAL_ADDRESS Address, ACPI_TABLE_HEADER *Table, UINT32 Length, UINT8 Flags, UINT32 *TableIndex) { ACPI_STATUS Status; ACPI_TABLE_DESC *NewTable; /* Ensure that there is room for the table in the Root Table List */ if (AcpiGbl_RootTableList.CurrentTableCount >= AcpiGbl_RootTableList.MaxTableCount) { Status = AcpiTbResizeRootTableList(); if (ACPI_FAILURE (Status)) { return (Status); } } NewTable = &AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.CurrentTableCount]; /* Initialize added table */ NewTable->Address = Address; NewTable->Pointer = Table; NewTable->Length = Length; NewTable->OwnerId = 0; NewTable->Flags = Flags; ACPI_MOVE_32_TO_32 (&NewTable->Signature, Table->Signature); *TableIndex = AcpiGbl_RootTableList.CurrentTableCount; AcpiGbl_RootTableList.CurrentTableCount++; return (AE_OK); }
false
false
false
false
false
0
makeFrameArray(JNIEnv *env, cpl_frameset *fset) { jobject jFrame = (jobject)0; jobjectArray jFrames = (jobjectArray)0; cpl_frame *frame; jsize ifrm; jsize nfrm; int ok = 1; /* Determine the size of the frameset. */ nfrm = cpl_frameset_get_size(fset); /* Construct an empty array to hold the new Frame objects. */ ok = ok && (jFrames = (*env)->NewObjectArray(env, nfrm, FrameClass, NULL)); /* Populate the array with new Frame objects constructed from the frames * in the frameset. */ ifrm = 0; cpl_frameset_iterator *it = cpl_frameset_iterator_new(fset); while (ok && (frame = cpl_frameset_iterator_get(it))) { ok = ok && (jFrame = makeJavaFrame(env, frame)); if (ok) { (*env)->SetObjectArrayElement(env, jFrames, ifrm++, jFrame); } cpl_frameset_iterator_advance(it, 1); } cpl_frameset_iterator_delete(it); /* Return the array. */ return ok ? jFrames : NULL; }
false
false
false
false
false
0
error(GLEErrorMessage* msg) { const char* file = msg->getFile(); const char* abbrev = msg->getLineAbbrev(); ostringstream output; output << endl; output << ">> " << file << " (" << msg->getLine() << ")"; if (abbrev[0] != 0) { output << " |" << abbrev << "|"; } if (msg->getColumn() != -1) { char number[50]; output << endl; output << ">> "; sprintf(number, "%d", msg->getLine()); int nbspc = strlen(file) + strlen(number) + 4 + msg->getColumn() - msg->getDelta(); for (int i = 0; i < nbspc; i++) { output << " "; } output << "^"; } output << msg->getErrorMsg(); g_message(output.str().c_str()); }
false
false
false
false
false
0
pixLocateBarcodes(PIX *pixs, l_int32 thresh, PIX **ppixb, PIX **ppixm) { BOXA *boxa; PIX *pix8, *pixe, *pixb, *pixm; PROCNAME("pixLocateBarcodes"); if (!pixs) return (BOXA *)ERROR_PTR("pixs not defined", procName, NULL); /* Get an 8 bpp image, no cmap */ if (pixGetDepth(pixs) == 8 && !pixGetColormap(pixs)) pix8 = pixClone(pixs); else pix8 = pixConvertTo8(pixs, 0); /* Get a 1 bpp image of the edges */ pixe = pixSobelEdgeFilter(pix8, L_ALL_EDGES); pixb = pixThresholdToBinary(pixe, thresh); pixInvert(pixb, pixb); pixDestroy(&pix8); pixDestroy(&pixe); pixm = pixGenerateBarcodeMask(pixb, MAX_SPACE_WIDTH, MAX_NOISE_WIDTH, MAX_NOISE_HEIGHT); boxa = pixConnComp(pixm, NULL, 8); if (ppixb) *ppixb = pixb; else pixDestroy(&pixb); if (ppixm) *ppixm = pixm; else pixDestroy(&pixm); return boxa; }
false
false
false
false
false
0
ExpandBilevelRow ( PBYTE pDest, PBYTE pSrc, int nPixels) { BYTE mask, inbyte=0; mask = 0; while (nPixels > 0) { if (mask == 0) { mask = 0x80u; inbyte = *pSrc++; } *pDest++ = inbyte & mask ? 0 : 255; mask >>= 1; nPixels -= 1; } }
false
true
false
false
false
1
gameSetup_destroy(GameSetup *ls) { assert(MAGIC(ls)); if (ls->callback) { ls->callback(ls->packet, NULL); ls->callback = NULL; } if (ls->win) butWin_destroy(ls->win); MAGIC_UNSET(ls); wms_free(ls); }
false
false
false
false
false
0
db_select_int(dbDriver * driver, const char *tab, const char *col, const char *where, int **pval) { int type, more, alloc, count; int *val; char *buf = NULL; const char *sval; dbString stmt; dbCursor cursor; dbColumn *column; dbValue *value; dbTable *table; G_debug(3, "db_select_int()"); if (col == NULL || strlen(col) == 0) { G_warning(_("Missing column name")); return -1; } /* allocate */ alloc = 1000; val = (int *)G_malloc(alloc * sizeof(int)); if (where == NULL || strlen(where) == 0) G_asprintf(&buf, "SELECT %s FROM %s", col, tab); else G_asprintf(&buf, "SELECT %s FROM %s WHERE %s", col, tab, where); G_debug(3, " SQL: %s", buf); db_init_string(&stmt); db_set_string(&stmt, buf); G_free(buf); if (db_open_select_cursor(driver, &stmt, &cursor, DB_SEQUENTIAL) != DB_OK) return (-1); table = db_get_cursor_table(&cursor); column = db_get_table_column(table, 0); /* first column */ if (column == NULL) { return -1; } value = db_get_column_value(column); type = db_get_column_sqltype(column); type = db_sqltype_to_Ctype(type); /* fetch the data */ count = 0; while (1) { if (db_fetch(&cursor, DB_NEXT, &more) != DB_OK) return (-1); if (!more) break; if (count == alloc) { alloc += 1000; val = (int *)G_realloc(val, alloc * sizeof(int)); } switch (type) { case (DB_C_TYPE_INT): val[count] = db_get_value_int(value); break; case (DB_C_TYPE_STRING): sval = db_get_value_string(value); val[count] = atoi(sval); break; case (DB_C_TYPE_DOUBLE): val[count] = (int)db_get_value_double(value); break; default: return (-1); } count++; } db_close_cursor(&cursor); db_free_string(&stmt); qsort((void *)val, count, sizeof(int), cmp); *pval = val; return (count); }
false
false
false
false
true
1
writeWidgetLookSeriesToStream(const String& prefix, OutStream& out_stream) const { // start of file // output xml header XMLSerializer xml(out_stream); // output root element xml.openTag("Falagard"); for (WidgetLookList::const_iterator curr = d_widgetLooks.begin(); curr != d_widgetLooks.end(); ++curr) { if ((*curr).first.compare(0, prefix.length(), prefix) == 0) (*curr).second.writeXMLToStream(xml); } // close the root tags to terminate the file xml.closeTag(); }
false
false
false
false
false
0
serial_open(struct tty_struct *tty, struct file *filp) { struct usb_serial_port *port = tty->driver_data; dev_dbg(tty->dev, "%s\n", __func__); return tty_port_open(&port->port, tty, filp); }
false
false
false
false
false
0
s_doTabDlg(FV_View * pView) { UT_return_val_if_fail(pView, false); XAP_Frame * pFrame = static_cast<XAP_Frame *>(pView->getParentData()); UT_return_val_if_fail(pFrame, false); pFrame->raise(); XAP_DialogFactory * pDialogFactory = static_cast<XAP_DialogFactory *>(pFrame->getDialogFactory()); AP_Dialog_Tab * pDialog = static_cast<AP_Dialog_Tab *>(pDialogFactory->requestDialog(AP_DIALOG_ID_TAB)); if(pDialog) { // setup the callback function, no closure pDialog->setSaveCallback(s_TabSaveCallBack, NULL); // run the dialog pDialog->runModal(pFrame); // get the dialog answer AP_Dialog_Tab::tAnswer answer = pDialog->getAnswer(); switch (answer) { case AP_Dialog_Tab::a_OK: case AP_Dialog_Tab::a_CANCEL: // do nothing break; default: UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN); } pDialogFactory->releaseDialog(pDialog); } else { s_TellNotImplemented(pFrame, "Tabs dialog", __LINE__); } return true; }
false
false
false
false
false
0
DumpFileToXML(std::ostream& fxml, std::string const& fname) { std::ifstream fin(fname.c_str(), std::ios::in | std::ios::binary); std::string line; const char* sep = ""; while(cmSystemTools::GetLineFromStream(fin, line)) { fxml << sep << cmXMLSafe(line).Quotes(false); sep = "\n"; } }
false
false
false
false
false
0
discard_until (character) int character; { int c; while ((c = shell_getc (0)) != EOF && c != character) ; if (c != EOF) shell_ungetc (c); }
false
false
false
false
false
0
goo_canvas_scroll_to_item (GooCanvas *canvas, GooCanvasItem *item) { GooCanvasBounds bounds; gdouble hvalue, vvalue; /* We can't scroll to static items. */ if (goo_canvas_item_get_is_static (item)) return; goo_canvas_item_get_bounds (item, &bounds); goo_canvas_convert_to_pixels (canvas, &bounds.x1, &bounds.y1); goo_canvas_convert_to_pixels (canvas, &bounds.x2, &bounds.y2); canvas->freeze_count++; /* Remember the current adjustment values. */ hvalue = canvas->hadjustment->value; vvalue = canvas->vadjustment->value; /* Update the adjustments so the item is displayed. */ gtk_adjustment_clamp_page (canvas->hadjustment, bounds.x1, bounds.x2); gtk_adjustment_clamp_page (canvas->vadjustment, bounds.y1, bounds.y2); canvas->freeze_count--; /* If the adjustments have changed we need to scroll. */ if (hvalue != canvas->hadjustment->value || vvalue != canvas->vadjustment->value) goo_canvas_adjustment_value_changed (NULL, canvas); }
false
false
false
false
false
0
babysit_signal_handler (int signo) { char b = '\0'; again: if (write (babysit_sigchld_pipe, &b, 1) <= 0) if (errno == EINTR) goto again; }
false
false
false
false
false
0
ParseFile( CString name ) { FreeDoc(); if ( (pDoc = xmlRecoverFile(name.Data())) == 0 ) { return false; } return true; }
false
false
false
false
false
0
operator++() { if (_impl && !_impl->advance()) { if (0 == _impl->deref()) delete _impl; _impl = 0; } return *this; }
false
false
false
false
false
0
twoBodyMEcode(const DecayMode & dm,int & mecode, double & coupling) const { coupling=1.; unsigned int inspin(dm.parent()->iSpin()),outspin,outmes; ParticleMSet::const_iterator pit(dm.products().begin()); bool order; if((**pit).iSpin()%2==0) { order=true; outspin=(**pit).iSpin(); ++pit;outmes=(**pit).iSpin(); } else { order=false; outmes=(**pit).iSpin();++pit; outspin=(**pit).iSpin(); } mecode=-1; if(inspin==2) { if(outspin==2){if(outmes==1){mecode=101;}else{mecode=102;}} else if(outspin==4){if(outmes==1){mecode=103;}else{mecode=104;}} } else if(inspin==4) { if(outspin==2){if(outmes==1){mecode=105;}else{mecode=106;}} else if(outspin==4){if(outmes==1){mecode=107;}else{mecode=108;}} } return order; }
false
false
false
false
false
0
P_FindLowestCeilingSurrounding(sector_t* sec) { int i; line_t* check; sector_t* other; fixed_t height = INT_MAX; for (i=0 ;i < sec->linecount ; i++) { check = sec->lines[i]; other = getNextSector(check,sec); if (!other) continue; if (other->ceilingheight < height) height = other->ceilingheight; } return height; }
false
false
false
false
false
0
bind_credentials_clear( Connection *conn, PRBool lock_conn, PRBool clear_externalcreds ) { if ( lock_conn ) { PR_Lock( conn->c_mutex ); } if ( conn->c_dn != NULL ) { /* a non-anonymous bind has occurred */ reslimit_update_from_entry( conn, NULL ); /* clear resource limits */ if ( conn->c_dn != conn->c_external_dn ) { slapi_ch_free((void**)&conn->c_dn); } conn->c_dn = NULL; } slapi_ch_free((void**)&conn->c_authtype); conn->c_isroot = 0; conn->c_authtype = slapi_ch_strdup(SLAPD_AUTH_NONE); if ( clear_externalcreds ) { slapi_ch_free( (void**)&conn->c_external_dn ); conn->c_external_dn = NULL; conn->c_external_authtype = SLAPD_AUTH_NONE; if ( conn->c_client_cert ) { CERT_DestroyCertificate (conn->c_client_cert); conn->c_client_cert = NULL; } } if ( lock_conn ) { PR_Unlock( conn->c_mutex ); } }
false
false
false
false
false
0
normalize (float *x, float *y, float size) { float length = sqrt ((*x) * (*x) + (*y) * (*y)); if (length == 0) length = 1; *x *= size / length; *y *= size / length; }
false
false
false
false
false
0
read_reg(SLMP_INFO * info, unsigned char Addr) { CALC_REGADDR(); return *RegAddr; }
false
false
false
true
false
1
canvas_makefilename(t_canvas *x, char *file, char *result, int resultsize) { char *dir = canvas_getenv(x)->ce_dir->s_name; if (file[0] == '/' || (file[0] && file[1] == ':') || !*dir) { strncpy(result, file, resultsize); result[resultsize-1] = 0; } else { int nleft; strncpy(result, dir, resultsize); result[resultsize-1] = 0; nleft = resultsize - strlen(result) - 1; if (nleft <= 0) return; strcat(result, "/"); strncat(result, file, nleft); result[resultsize-1] = 0; } }
false
true
false
false
false
1
enumerate_cache_updated_cb (GObject *source_object, GAsyncResult *res, gpointer user_data) { GVfsBackendAfpBrowse *afp_backend = G_VFS_BACKEND_AFP_BROWSE (source_object); GVfsJobEnumerate *job = G_VFS_JOB_ENUMERATE (user_data); GError *err = NULL; guint i; if (!update_cache_finish (afp_backend, res, &err)) { g_vfs_job_failed_from_error (G_VFS_JOB (job), err); g_error_free (err); return; } g_vfs_job_succeeded (G_VFS_JOB (job)); for (i = 0; i < afp_backend->volumes->len; i++) { GVfsAfpVolumeData *vol_data = g_ptr_array_index (afp_backend->volumes, i); GFileInfo *info; info = g_file_info_new (); fill_info (info, vol_data, afp_backend); g_vfs_job_enumerate_add_info (job, info); g_object_unref (info); } g_vfs_job_enumerate_done (job); }
false
false
false
false
false
0
hud_target_last_transmit_level_init() { int i; for ( i = 0; i < MAX_TRANSMIT_TARGETS; i++ ) { Transmit_target_list[i].objnum = -1; Transmit_target_list[i].objsig = -1; } Transmit_target_next_slot = 0; Transmit_target_current_slot = 0; Transmit_target_reset_timer = timestamp(0); }
false
false
false
false
false
0
posix_sched_setaffinity(PyObject *self, PyObject *args) { pid_t pid; int ncpus; size_t setsize; cpu_set_t *mask = NULL; PyObject *iterable, *iterator = NULL, *item; if (!PyArg_ParseTuple(args, _Py_PARSE_PID "O:sched_setaffinity", &pid, &iterable)) return NULL; iterator = PyObject_GetIter(iterable); if (iterator == NULL) return NULL; ncpus = NCPUS_START; setsize = CPU_ALLOC_SIZE(ncpus); mask = CPU_ALLOC(ncpus); if (mask == NULL) { PyErr_NoMemory(); goto error; } CPU_ZERO_S(setsize, mask); while ((item = PyIter_Next(iterator))) { long cpu; if (!PyLong_Check(item)) { PyErr_Format(PyExc_TypeError, "expected an iterator of ints, " "but iterator yielded %R", Py_TYPE(item)); Py_DECREF(item); goto error; } cpu = PyLong_AsLong(item); Py_DECREF(item); if (cpu < 0) { if (!PyErr_Occurred()) PyErr_SetString(PyExc_ValueError, "negative CPU number"); goto error; } if (cpu > INT_MAX - 1) { PyErr_SetString(PyExc_OverflowError, "CPU number too large"); goto error; } if (cpu >= ncpus) { /* Grow CPU mask to fit the CPU number */ int newncpus = ncpus; cpu_set_t *newmask; size_t newsetsize; while (newncpus <= cpu) { if (newncpus > INT_MAX / 2) newncpus = cpu + 1; else newncpus = newncpus * 2; } newmask = CPU_ALLOC(newncpus); if (newmask == NULL) { PyErr_NoMemory(); goto error; } newsetsize = CPU_ALLOC_SIZE(newncpus); CPU_ZERO_S(newsetsize, newmask); memcpy(newmask, mask, setsize); CPU_FREE(mask); setsize = newsetsize; mask = newmask; ncpus = newncpus; } CPU_SET_S(cpu, setsize, mask); } Py_CLEAR(iterator); if (sched_setaffinity(pid, setsize, mask)) { posix_error(); goto error; } CPU_FREE(mask); Py_RETURN_NONE; error: if (mask) CPU_FREE(mask); Py_XDECREF(iterator); return NULL; }
false
false
false
false
false
0
refresh(void) { if (++refreshCounter < bx_options.video.refresh) { return; } refreshCounter = 0; if (force_refresh) { clear_screen = true; forceRefreshLogo(); forceRefreshVidel(); forceRefreshNfvdi(); if (screen) { setDirtyRect(0,0, screen->w, screen->h); } force_refresh = false; } initScreen(); if (clear_screen || bx_options.opengl.enabled) { clearScreen(); clear_screen = false; } /* Render current screen */ switch(numScreen) { case SCREEN_BOOT: /* Wait till GUI or reset is done */ break; case SCREEN_LOGO: refreshLogo(); alphaBlendLogo(true); checkSwitchToVidel(); break; case SCREEN_VIDEL: refreshVidel(); alphaBlendLogo(false); checkSwitchVidelNfvdi(); break; case SCREEN_NFVDI: refreshNfvdi(); checkSwitchVidelNfvdi(); break; } #ifdef SDL_GUI if (!SDLGui_isClosed()) { refreshGui(); } #endif if (do_screenshot) { makeSnapshot(); do_screenshot = false; } refreshScreen(); if ((new_width!=screen->w) || (new_height!=screen->h)) { setVideoMode(new_width, new_height, getBpp()); } }
false
false
false
false
false
0
fimc_is_hw_close_sensor(struct fimc_is *is, unsigned int index) { if (is->sensor_index != index) return; fimc_is_hw_wait_intmsr0_intmsd0(is); mcuctl_write(HIC_CLOSE_SENSOR, is, MCUCTL_REG_ISSR(0)); mcuctl_write(is->sensor_index, is, MCUCTL_REG_ISSR(1)); mcuctl_write(is->sensor_index, is, MCUCTL_REG_ISSR(2)); fimc_is_hw_set_intgr0_gd0(is); }
false
false
false
false
false
0
AddRange(TreeMap *tree,size_t n, void *Data,void *ExtraArgs) { struct Node *p; CompareInfo cInfo; cInfo.ExtraArgs = ExtraArgs; cInfo.ContainerLeft = tree; while (n > 0) { p = iHeap.NewObject(tree->Heap); if (p) { memcpy(p->data ,Data,tree->ElementSize); } else { iError.RaiseError("TreeMap.Add",CONTAINER_ERROR_NOMEMORY); return CONTAINER_ERROR_NOMEMORY; } tree->aux = &cInfo; insert(tree, p, ExtraArgs); tree->aux = NULL; n--; } return 1; }
false
true
false
false
false
1
memmove(void *dest, const void *src, ulong n) { long i; char *d = (char *)dest, *s = (char *)src; /* If src == dest do nothing */ if (dest < src) { for(i = 0; i < n; i++) { d[i] = s[i]; } } else if (dest > src) { for(i = n -1; i >= 0; i--) { d[i] = s[i]; } } return dest; }
false
false
false
false
false
0
find_shortcut(int* ip, const bool require_alt) const { const Fl_Menu_Item* m = this; if (m) for (int ii = 0; m->text; m = next_visible_or_not(m), ii++) { if (m->active()) { if (Fl::test_shortcut(m->shortcut_) || Fl_Widget::test_shortcut(m->text, require_alt)) { if (ip) *ip=ii; return m; } } } return 0; }
false
false
false
false
false
0
mmu_op(uae_u32 opcode, uae_u16 /*extra*/) { if ((opcode & 0xFE0) == 0x0500) { /* PFLUSH instruction */ flush_internals(); } else if ((opcode & 0x0FD8) == 0x548) { /* PTEST instruction */ } else op_illg(opcode); }
false
false
false
false
false
0
processMessage(const std::string& messageText) { Poco::Message message; _pParser->parse(messageText, message); log(message); }
false
false
false
false
false
0
sgen_pin_stats_reset (void) { int i; pin_stats_tree_free (pin_stat_addresses); pin_stat_addresses = NULL; for (i = 0; i < PIN_TYPE_MAX; ++i) pinned_byte_counts [i] = 0; sgen_pointer_queue_clear (&pinned_objects); sgen_hash_table_clean (&pinned_class_hash_table); sgen_hash_table_clean (&global_remset_class_hash_table); }
false
false
false
false
false
0
plugin_init_raspi(void) { /* Check if raspi plugin section exists in config file */ if (cfg_number(Section, "enabled", 0, 0, 1, &plugin_enabled) < 1) { plugin_enabled = 0; } /* Disable plugin unless it is explicitly enabled */ if (plugin_enabled != 1) { info("[raspi] WARNING: Plugin is not enabled! (set 'enabled 1' to enable this plugin)"); return 0; } char checkFile[128]; snprintf(checkFile, sizeof(checkFile), "%s%s", RASPI_TEMP_PATH, RASPI_TEMP_IDFILE); if (strncmp(readStr(checkFile), RASPI_TEMP_ID, strlen(RASPI_TEMP_ID)) != 0) { error("Warning: no raspberry pi thermal sensor found: value of '%s' is '%s', should be '%s'", checkFile, readStr(checkFile), RASPI_TEMP_IDFILE); } snprintf(checkFile, sizeof(checkFile), "%s%s", RASPI_TEMP_PATH, RASPI_TEMP_VALUE); if (0 == access(checkFile, R_OK)) { AddFunction("raspi::cputemp", 0, my_cputemp); } else { error("Error: File '%s' not readable, no temperature sensor found", checkFile); } snprintf(checkFile, sizeof(checkFile), "%s%s", RASPI_FREQ_PATH, RASPI_FREQ_IDFILE); if (strncmp(readStr(checkFile), RASPI_FREQ_ID, strlen(RASPI_FREQ_ID)) != 0) { error("Warning: no raspberry pi frequence sensor found: value of '%s' is '%s', should be '%s'", checkFile, readStr(checkFile), RASPI_FREQ_IDFILE); } snprintf(checkFile, sizeof(checkFile), "%s%s", RASPI_FREQ_PATH, RASPI_FREQ_VALUE); if (0 == access(checkFile, R_OK)) { AddFunction("raspi::cpufreq", 0, my_cpufreq); } else { error("Error: File '%s' not readable, no frequency sensor found", checkFile); } return 0; }
true
true
false
false
true
1
gnome_desktop_thumbnail_factory_load_from_tempfile (GnomeDesktopThumbnailFactory *factory, char **tmpname) { GdkPixbuf *pixbuf; GdkPixbuf *tmp_pixbuf; pixbuf = gdk_pixbuf_new_from_file (*tmpname, NULL); g_unlink (*tmpname); g_free (*tmpname); *tmpname = NULL; if (pixbuf == NULL) return NULL; tmp_pixbuf = gdk_pixbuf_apply_embedded_orientation (pixbuf); g_object_unref (pixbuf); pixbuf = tmp_pixbuf; return pixbuf; }
false
false
false
false
false
0
doremring() { register struct obj *otmp = 0; int Accessories = 0; #define MOREACC(x) if (x) { Accessories++; otmp = x; } MOREACC(uleft); MOREACC(uright); MOREACC(uamul); MOREACC(ublindf); if(!Accessories) { pline("Not wearing any accessories.%s", (iflags.cmdassist && (uarm || uarmc || #ifdef TOURIST uarmu || #endif uarms || uarmh || uarmg || uarmf)) ? " Use 'T' command to take off armor." : ""); return(0); } if (Accessories != 1) otmp = getobj(accessories, "remove"); if(!otmp) return(0); if(!(otmp->owornmask & (W_RING | W_AMUL | W_TOOL))) { You("are not wearing that."); return(0); } reset_remarm(); /* clear takeoff_mask and taking_off */ (void) select_off(otmp); if (!takeoff_mask) return 0; reset_remarm(); /* not used by Ring_/Amulet_/Blindf_off() */ if (otmp == uright || otmp == uleft) { /* Sometimes we want to give the off_msg before removing and * sometimes after; for instance, "you were wearing a moonstone * ring (on right hand)" is desired but "you were wearing a * square amulet (being worn)" is not because of the redundant * "being worn". */ off_msg(otmp); Ring_off(otmp); } else if (otmp == uamul) { Amulet_off(); off_msg(otmp); } else if (otmp == ublindf) { Blindf_off(otmp); /* does its own off_msg */ } else { impossible("removing strange accessory?"); } return(1); }
false
false
false
false
false
0
emitter(const DipoleIndex&) const { assert(flavour()); assert(abs(flavour()->id()) < 6 && flavour()->mass() == ZERO); return flavour(); }
false
false
false
false
false
0
mathmlize(MathStream & os) const { // FIXME These are not quite right, because they do not nest // correctly. A proper fix would presumably involve tracking // the fonts already in effect. std::string variant; docstring const & tag = key_->name; if (tag == "mathnormal" || tag == "mathrm" || tag == "text" || tag == "textnormal" || tag == "textrm" || tag == "textup" || tag == "textmd") variant = "normal"; else if (tag == "frak" || tag == "mathfrak") variant = "fraktur"; else if (tag == "mathbb" || tag == "mathbf" || tag == "textbf") variant = "bold"; else if (tag == "mathcal") variant = "script"; else if (tag == "mathit" || tag == "textsl" || tag == "emph" || tag == "textit") variant = "italic"; else if (tag == "mathsf" || tag == "textsf") variant = "sans-serif"; else if (tag == "mathtt" || tag == "texttt") variant = "monospace"; // no support at present for textipa, textsc, noun if (!variant.empty()) { os << MTag("mstyle", "mathvariant='" + variant + "'") << cell(0) << ETag("mstyle"); } else os << cell(0); }
false
false
false
false
false
0
maki_in_dcc_resume_accept (makiServer* serv, makiUser* user, gchar* remaining, gboolean is_incoming) { gchar* file_name; gsize file_name_len; if (!remaining) { return; } if ((file_name = maki_dcc_send_get_file_name(remaining, &file_name_len)) != NULL) { gchar** args; guint args_len; args = g_strsplit(remaining + file_name_len + 1, " ", 3); args_len = g_strv_length(args); if (args_len >= 2) { guint16 port; goffset position; guint32 token = 0; makiInstance* inst = maki_instance_get_default(); port = g_ascii_strtoull(args[0], NULL, 10); position = g_ascii_strtoull(args[1], NULL, 10); if (args_len > 2) { token = g_ascii_strtoull(args[2], NULL, 10); } if (maki_instance_resume_accept_dcc_send(inst, file_name, port, position, token, is_incoming)) { if (!is_incoming) { if (token > 0) { maki_server_send_printf(serv, "PRIVMSG %s :\001DCC ACCEPT %s %" G_GUINT16_FORMAT " %" G_GUINT64_FORMAT " %" G_GUINT32_FORMAT "\001", maki_user_nick(user), file_name, port, position, token); } else { maki_server_send_printf(serv, "PRIVMSG %s :\001DCC ACCEPT %s %" G_GUINT16_FORMAT " %" G_GUINT64_FORMAT "\001", maki_user_nick(user), file_name, port, position); } } } } g_strfreev(args); g_free(file_name); } }
false
false
false
false
false
0
_k_placeClicked(const QModelIndex &index) { KFilePlacesModel *placesModel = qobject_cast<KFilePlacesModel*>(q->model()); if (placesModel==0) return; lastClickedIndex = QPersistentModelIndex(); if (placesModel->setupNeeded(index)) { QObject::connect(placesModel, SIGNAL(setupDone(QModelIndex,bool)), q, SLOT(_k_storageSetupDone(QModelIndex,bool))); lastClickedIndex = index; placesModel->requestSetup(index); return; } setCurrentIndex(index); }
false
false
false
false
false
0
last32() { pos = end; if(pos > begin) { UChar32 c; UTF_PREV_CHAR(text, begin, pos, c); return c; } else { return DONE; } }
false
false
false
false
false
0
on_navigation_cursor_changed (GtkTreeView *tv, gpointer user_data) { GSQL_TRACE_FUNC; GtkListStore *details = NULL; GtkTreePath *path; GtkTreeViewColumn *column; GtkTreeModel *model; GtkTreeIter iter; GSQLWorkspace *workspace; GSQLNavigation *navigation = user_data; workspace = gsql_session_get_workspace (navigation->private->session); model = gtk_tree_view_get_model (tv); gtk_tree_view_get_cursor (tv, &path, &column); gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, path); gtk_tree_model_get (GTK_TREE_MODEL (model), (GtkTreeIter *) & iter, GSQL_NAV_TREE_DETAILS, &details, -1); gsql_workspace_set_details (workspace, details); }
false
false
false
false
false
0
dumpdatalist(Datalist* list, char* tag) { Bytebuffer* buf = bbNew(); bufdump(list,buf); fprintf(stderr,"%s: %s\n",tag,bbContents(buf)); bbFree(buf); }
false
false
false
false
false
0
omp_check_private (struct gimplify_omp_ctx *ctx, tree decl, bool copyprivate) { splay_tree_node n; do { ctx = ctx->outer_context; if (ctx == NULL) return !(is_global_var (decl) /* References might be private, but might be shared too, when checking for copyprivate, assume they might be private, otherwise assume they might be shared. */ || (!copyprivate && lang_hooks.decls.omp_privatize_by_reference (decl))); n = splay_tree_lookup (ctx->variables, (splay_tree_key) decl); if (n != NULL) return (n->value & GOVD_SHARED) == 0; } while (ctx->region_type == ORT_WORKSHARE); return false; }
false
false
false
false
false
0
_php_stream_rmdir(char *path, int options, php_stream_context *context TSRMLS_DC) { php_stream_wrapper *wrapper = NULL; wrapper = php_stream_locate_url_wrapper(path, NULL, ENFORCE_SAFE_MODE TSRMLS_CC); if (!wrapper || !wrapper->wops || !wrapper->wops->stream_rmdir) { return 0; } return wrapper->wops->stream_rmdir(wrapper, path, options, context TSRMLS_CC); }
false
false
false
false
false
0
rb_gzreader_readlines(int argc, VALUE *argv, VALUE obj) { VALUE str, dst; dst = rb_ary_new(); while (!NIL_P(str = gzreader_gets(argc, argv, obj))) { rb_ary_push(dst, str); } return dst; }
false
false
false
false
false
0
fdilate_2_52(l_uint32 *datad, l_int32 w, l_int32 h, l_int32 wpld, l_uint32 *datas, l_int32 wpls) { l_int32 i; register l_int32 j, pwpls; register l_uint32 *sptr, *dptr; pwpls = (l_uint32)(w + 31) / 32; /* proper wpl of src */ for (i = 0; i < h; i++) { sptr = datas + i * wpls; dptr = datad + i * wpld; for (j = 0; j < pwpls; j++, sptr++, dptr++) { *dptr = ((*(sptr) << 18) | (*(sptr + 1) >> 14)) | ((*(sptr) << 11) | (*(sptr + 1) >> 21)) | ((*(sptr) << 4) | (*(sptr + 1) >> 28)) | ((*(sptr) >> 3) | (*(sptr - 1) << 29)) | ((*(sptr) >> 10) | (*(sptr - 1) << 22)) | ((*(sptr) >> 17) | (*(sptr - 1) << 15)); } } }
false
false
false
false
false
0