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
getName( ) const { if ( !name.empty() ) return name; else return description; }
false
false
false
false
false
0
soup_header_g_string_append_param_quoted (GString *string, const char *name, const char *value) { g_return_if_fail (string != NULL); g_return_if_fail (name != NULL); g_return_if_fail (value != NULL); append_param_internal (string, name, value, FALSE); }
false
false
false
false
false
0
clutter_behaviour_rotate_set_direction (ClutterBehaviourRotate *rotate, ClutterRotateDirection direction) { ClutterBehaviourRotatePrivate *priv; g_return_if_fail (CLUTTER_IS_BEHAVIOUR_ROTATE (rotate)); priv = rotate->priv; if (priv->direction != direction) { priv->direction = direction; g_object_notify_by_pspec (G_OBJECT (rotate), obj_props[PROP_DIRECTION]); } }
false
false
false
false
false
0
lookup_header_set(struct ctl_table_root *root, struct nsproxy *namespaces) { struct ctl_table_set *set = &root->default_set; if (root->lookup) set = root->lookup(root, namespaces); return set; }
false
false
false
false
false
0
init(const XmlAttributes &attr) { iImp = new Imp; iImp->iRefCount = 1; iImp->iObjNum = Lex(attr["id"]).getInt(); iImp->iRender = 0; iImp->iWidth = Lex(attr["width"]).getInt(); iImp->iHeight = Lex(attr["height"]).getInt(); iImp->iColorKey = -1; int length = Lex(attr["length"]).getInt(); assert(iImp->iWidth > 0 && iImp->iHeight > 0); String cs = attr["ColorSpace"]; if (cs == "DeviceGray") { iImp->iComponents = 1; iImp->iColorSpace = EDeviceGray; } else if (cs == "DeviceCMYK") { iImp->iComponents = 4; iImp->iColorSpace = EDeviceCMYK; } else { iImp->iComponents = 3; iImp->iColorSpace = EDeviceRGB; } String cc; if (iImp->iColorSpace == EDeviceRGB && attr.has("ColorKey", cc)) { iImp->iColorKey = Lex(cc).getHexNumber(); } String fi = attr["Filter"]; if (fi == "DCTDecode") iImp->iFilter = EDCTDecode; else if (fi == "FlateDecode") iImp->iFilter = EFlateDecode; else iImp->iFilter = EDirect; iImp->iBitsPerComponent = Lex(attr["BitsPerComponent"]).getInt(); if (length == 0) { assert(iImp->iFilter == EDirect); int bitsPerRow = width() * components() * bitsPerComponent(); int bytesPerRow = (bitsPerRow + 7) / 8; length = height() * bytesPerRow; } return length; }
false
false
false
false
false
0
SetupParserExpat() { // Cleanup any old parser. if( oParser != NULL ) CleanupParser(); oParser = OGRCreateExpatXMLParser(); m_poGMLHandler = new GMLExpatHandler( this, oParser ); XML_SetElementHandler(oParser, GMLExpatHandler::startElementCbk, GMLExpatHandler::endElementCbk); XML_SetCharacterDataHandler(oParser, GMLExpatHandler::dataHandlerCbk); XML_SetUserData(oParser, m_poGMLHandler); if (pabyBuf == NULL) pabyBuf = (char*)VSIMalloc(PARSER_BUF_SIZE); if (pabyBuf == NULL) return FALSE; return TRUE; }
false
false
false
false
false
0
gw_db_category_can_removed ( GWDBCategory *category) { if ( category != NULL ) { if ( (gw_db_category_get_nb_disks ( category) == 0) && (gw_db_category_get_nb_files ( category) == 0) ) { return TRUE; } } return FALSE; }
false
false
false
false
false
0
GC_lookup_thread(pthread_t id) { int hv = ((word)id) % THREAD_TABLE_SZ; register GC_thread p = GC_threads[hv]; while (p != 0 && !pthread_equal(p -> id, id)) p = p -> next; return(p); }
false
false
false
false
false
0
add_arc (state_t from_state, state_t to_state, ainsn_t ainsn) { arc_t new_arc; new_arc = find_arc (from_state, to_state, ainsn); if (new_arc != NULL) return; if (first_free_arc == NULL) { #ifndef NDEBUG allocated_arcs_num++; #endif new_arc = XCREATENODE (struct arc); new_arc->to_state = NULL; new_arc->insn = NULL; new_arc->next_out_arc = NULL; } else { new_arc = first_free_arc; first_free_arc = first_free_arc->next_out_arc; } new_arc->to_state = to_state; new_arc->insn = ainsn; ainsn->arc_exists_p = 1; new_arc->next_out_arc = from_state->first_out_arc; from_state->first_out_arc = new_arc; from_state->num_out_arcs++; new_arc->next_arc_marked_by_insn = NULL; }
false
false
false
false
false
0
add2header(const char *p, unsigned l, struct rwmsginfo *msginfo) { if (l + msginfo->headerbuflen > msginfo->headerbufsize) { unsigned ll=(msginfo->headerbufsize + l + 1023) & ~1023; char *buf=courier_malloc(ll); if (msginfo->headerbufsize) memcpy(buf, msginfo->headerbuf, msginfo->headerbufsize); if (msginfo->headerbuf) free(msginfo->headerbuf); msginfo->headerbuf=buf; msginfo->headerbufsize=ll; } memcpy(msginfo->headerbuf+msginfo->headerbuflen, p, l); msginfo->headerbuflen += l; }
false
true
false
false
false
1
insert_wstring(const CORBA::WChar* value) { CHECK_NOT_DESTROYED; if( !value || pd_curr_index != 1 ) throw DynamicAny::DynAny::InvalidValue(); if( pd_member_kind != CORBA::tk_wstring ) throw DynamicAny::DynAny::TypeMismatch(); CORBA::ULong maxlen = pd_member->actualTc()->NP_length(); cdrAnyMemoryStream& buf = writeCurrent(CORBA::tk_wstring); try { buf.marshalWString(value,maxlen); } catch (CORBA::MARSHAL& ex) { if (ex.minor() == MARSHAL_WStringIsTooLong) throw DynamicAny::DynAny::InvalidValue(); else throw; } discriminatorHasChanged(); }
false
false
false
false
false
0
synusb_disconnect(struct usb_interface *intf) { struct synusb *synusb = usb_get_intfdata(intf); struct usb_device *udev = interface_to_usbdev(intf); if (synusb->flags & SYNUSB_IO_ALWAYS) synusb_close(synusb->input); input_unregister_device(synusb->input); usb_free_coherent(udev, SYNUSB_RECV_SIZE, synusb->data, synusb->urb->transfer_dma); usb_free_urb(synusb->urb); kfree(synusb); usb_set_intfdata(intf, NULL); }
false
false
false
false
false
0
goa_utils_parse_email_address (const gchar *email, gchar **out_username, gchar **out_domain) { gchar *at; gchar *dot; if (email == NULL || email[0] == '\0') return FALSE; at = strchr (email, '@'); if (at == NULL || *(at + 1) == '\0') return FALSE; dot = strchr (at + 1, '.'); if (dot == NULL || *(dot + 1) == '\0') return FALSE; if (out_username != NULL) { *out_username = g_strdup (email); (*out_username)[at - email] = '\0'; } if (out_domain != NULL) *out_domain = g_strdup (at + 1); return TRUE; }
false
false
false
false
false
0
canAppend(GR_RenderInfo &ri) const { GR_PangoRenderInfo & RI = (GR_PangoRenderInfo &)ri; GR_CairoPangoItem * pItem1 = (GR_CairoPangoItem *)m_pItem; GR_CairoPangoItem * pItem2 = (GR_CairoPangoItem *)RI.m_pItem; /* Do not merger runs that have not been shapped yet */ if (!pItem1 || !pItem2) return false; /* If the shapping resulted in font substitution we cannot merge */ if (pItem1->m_pi->analysis.font == pItem2->m_pi->analysis.font) return true; return false; }
false
false
false
false
false
0
asn_parse_int(u_char * data, size_t * datalength, u_char * type, long *intp, size_t intsize) { /* * ASN.1 integer ::= 0x02 asnlength byte {byte}* */ static const char *errpre = "parse int"; register u_char *bufp = data; u_long asn_length; register long value = 0; if (intsize != sizeof(long)) { _asn_size_err(errpre, intsize, sizeof(long)); return NULL; } *type = *bufp++; if (*type != ASN_INTEGER) { _asn_type_err(errpre, *type); return NULL; } bufp = asn_parse_length(bufp, &asn_length); if (_asn_parse_length_check (errpre, bufp, data, asn_length, *datalength)) return NULL; if ((size_t) asn_length > intsize) { _asn_length_err(errpre, (size_t) asn_length, intsize); return NULL; } *datalength -= (int) asn_length + (bufp - data); if (*bufp & 0x80) value = -1; /* integer is negative */ DEBUGDUMPSETUP("recv", data, bufp - data + asn_length); while (asn_length--) value = (value << 8) | *bufp++; CHECK_OVERFLOW_S(value,1); DEBUGMSG(("dumpv_recv", " Integer:\t%ld (0x%.2lX)\n", value, value)); *intp = value; return bufp; }
false
false
false
false
false
0
DBInfoFileName (const char *workSpace,const char *infoName) { FILE *inFile; static char fileName [DBDataFileNameLen]; DBInt swap = DBByteOrder () == DBByteOrderLITTLE ? true : false; DBInt notFound = true; ARCDirRecord arcDirRecord; sprintf (fileName,"%s/info/arcdr9",workSpace); if (access (fileName,R_OK) == DBFault) sprintf (fileName,"%s/info/arc.dir",workSpace); if ((inFile = fopen (fileName,"r")) == (FILE *) NULL) { CMmsgPrint (CMmsgSysError, "File Opening Error in: %s %d",__FILE__,__LINE__); return (NULL); } while (arcDirRecord.Read (inFile,swap) == DBSuccess) if ((strcmp (arcDirRecord.GetInternalName (),infoName) == 0) && (arcDirRecord.GetEmptyFlag () == false)) { notFound = false; break; } fclose (inFile); if (notFound) return (NULL); sprintf (fileName,"%s/info/",workSpace); strncpy (fileName + strlen (fileName),arcDirRecord.GetExternalName (),8); return (fileName); }
false
false
false
false
false
0
set_geometry(gint k) { AtomGrid* listOfAtoms = NULL; gint nAtoms = 0; gint j; if(k<0 || k >= animationGrids.numberOfFiles) return FALSE; if(!GeomOrb) return FALSE; if(Ncenters<1) return FALSE; nAtoms = Ncenters; listOfAtoms = g_malloc(nAtoms*sizeof(AtomGrid)); for(j=0;j<nAtoms;j++) { sprintf(listOfAtoms[j].symbol,"%s",GeomOrb[j].Symb); listOfAtoms[j].C[0] = GeomOrb[j].C[0]; listOfAtoms[j].C[1] = GeomOrb[j].C[1]; listOfAtoms[j].C[2] = GeomOrb[j].C[2]; sprintf(listOfAtoms[j].mmType,"%s",listOfAtoms[j].symbol); sprintf(listOfAtoms[j].pdbType,"%s",listOfAtoms[j].symbol); listOfAtoms[j].partialCharge = GeomOrb[j].partialCharge; listOfAtoms[j].variable = GeomOrb[j].variable; listOfAtoms[j].nuclearCharge = GeomOrb[j].nuclearCharge; } return TRUE; }
false
false
false
false
false
0
BackgroundPreviewRequest(OFLibDlg *d,int onefont) { struct ofl_download_urls *du; PreviewThread *newp; int is_image = true; if ( d->show[onefont]->downloading_in_background ) return; if ( getOFLibDir()==NULL ) return; du = OFLibHasImage(d,onefont); if ( du==NULL ) { du = OFLibHasFont(d,onefont); is_image = false; } if ( du==NULL ) return; newp = chunkalloc(sizeof(PreviewThread)); newp->fi = d->show[onefont]; newp->fi->downloading_in_background = true; newp->active = du; newp->is_image = is_image; newp->next = d->active; newp->http_thread_can_do_stuff = &d->http_thread_can_do_stuff; d->active = newp; pthread_create( &newp->preview_thread, NULL, StartPreviewThread, newp); }
false
false
false
false
false
0
InitHashCode (void) /*************************************************************************** * * The hash code for the various pieces standing on the various squares * are initialized here. When a particular piece is move from square A * to square B, the current hashkey is XORed against the hash code for * the A square and B square to give the new hashkey. * ***************************************************************************/ { int color, piece, sq; for (color = white; color <= black; color++) { for (piece = pawn; piece <= king; piece++) { for (sq = 0; sq < 64; sq++) { hashcode[color][piece][sq] = Rand64 (); } } } for (sq = 0; sq < 64; sq++) ephash[sq] = Rand64 (); WKCastlehash = Rand64 (); WQCastlehash = Rand64 (); BKCastlehash = Rand64 (); BQCastlehash = Rand64 (); Sidehash = Rand64 (); }
false
false
false
false
false
0
res_readreply(rb_fde_t *F, void *data) { while (res_read_single_reply(F, data)) ; rb_setselect(F, RB_SELECT_READ, res_readreply, NULL); }
false
false
false
false
false
0
isValid() const { ensureInited(); return d->mEnabled && d->mValid; }
false
false
false
false
false
0
s_write_module_prefs(void *inListItem, void *inData) { eb_PLUGIN_INFO *plugin_info = inListItem; FILE *fp = (FILE *)inData; LList *master_prefs = NULL; LList *current_prefs = NULL; eb_debug(DBG_CORE, "Writing prefs for %s\n", plugin_info->name); fprintf(fp, "\t%s\n", plugin_info->name); master_prefs = GetPref(plugin_info->name); master_prefs = value_pair_remove(master_prefs, "load"); current_prefs = eb_input_to_value_pair(plugin_info->pi.prefs); if (plugin_info->status == PLUGIN_LOADED) current_prefs = value_pair_add(current_prefs, "load", "1"); else current_prefs = value_pair_add(current_prefs, "load", "0"); master_prefs = value_pair_update(master_prefs, current_prefs); SetPref(plugin_info->name, master_prefs); value_pair_print_values(master_prefs, fp, 2); fprintf(fp, "\tend\n"); value_pair_free(current_prefs); }
false
false
false
false
false
0
read_packed_sha1(const unsigned char *sha1, enum object_type *type, unsigned long *size) { struct pack_entry e; if (!find_pack_entry(sha1, &e, NULL)) return NULL; else return cache_or_unpack_entry(e.p, e.offset, size, type, 1); }
false
false
false
false
false
0
cb_launch_entry(GtkWidget *widget, DiskMon *disk) { if (disk->enabled) gkrellm_apply_launcher(&disk->launch_entry, &disk->tooltip_entry, disk->chart->panel, &disk->launch, gkrellm_launch_button_cb); }
false
false
false
false
false
0
memset(void* s, int c, size_t n) { size_t i; char *ss = (char*)s; for (i=0;i<n;i++) ss[i] = c; return s; }
false
false
false
false
false
0
chknargs(fun,n) truc fun; int n; { struct symbol *sptr; char *ss; int k, k1, k2; int ret; int sflg; sptr = symptr(fun); sflg = *FLAGPTR(sptr); if(sflg == sFBINARY || sflg == sSBINARY) { ss = SigString[sptr->cc.yy.ww]; k = (byte)ss[0]; if(k != MAXBYTE && n+1 == k) ret = NARGS_OK; else if(k == MAXBYTE) { k1 = (byte)ss[1]; k2 = (byte)ss[2]; if(n+1 < k1 || (k2 != MAXBYTE && n+1 > k2)) ret = NARGS_FALSE; else ret = NARGS_VAR; } else ret = NARGS_FALSE; } else { /* user defined function */ ret = NARGS_OK; /* vorlaeufig */ } return(ret); }
false
false
false
false
false
0
asd_ascb_alloc_list(struct asd_ha_struct *asd_ha, int *num, gfp_t gfp_flags) { struct asd_ascb *first = NULL; for ( ; *num > 0; --*num) { struct asd_ascb *ascb = asd_ascb_alloc(asd_ha, gfp_flags); if (!ascb) break; else if (!first) first = ascb; else { struct asd_ascb *last = list_entry(first->list.prev, struct asd_ascb, list); list_add_tail(&ascb->list, &first->list); last->scb->header.next_scb = cpu_to_le64(((u64)ascb->dma_scb.dma_handle)); } } return first; }
false
false
false
false
false
0
stv0297_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) { struct stv0297_state *state = fe->demodulator_priv; if (enable) { stv0297_writereg(state, 0x87, 0x78); stv0297_writereg(state, 0x86, 0xc8); } return 0; }
false
false
false
false
false
0
PrintRefLVar ( Expr expr ) { if ( IS_REFLVAR(expr) ) Pr( "%I", (Int)NAME_LVAR( LVAR_REFLVAR(expr) ), 0L ); else Pr( "%I", (Int)NAME_LVAR( (UInt)(ADDR_EXPR(expr)[0]) ), 0L ); }
false
false
false
false
false
0
make_df_info_for_acc_block(Module_table *head) { Module_table *mpt; dataflow_anal(head); for (mpt = head; mpt != NULL; mpt = mpt->next) { if (mpt->kind != MODULE_BLOCKDATA) { make_df_info_for_acc_block_for_blocks(mpt->block_head); } } }
false
false
false
false
false
0
claimeven (struct board *board) { short x1, y1, q1, q2; short sln, *grp, j; for (y1 = 1; y1 < BOARDY; y1 += 2) for (x1 = 0; x1 < BOARDX; x1++) { if (!board->sqused[ELM (x1, y1)]) continue; board->solution[board->sp]->solgroupsnumb = 0; q1 = ELM (x1, y1); q2 = ELM (x1, y1 - 1); if (board->square[q1] == EMPTY && board->square[q2] == EMPTY && board->sqused[q2]) { sln = board->solvable_groups->sqpnt[q1]; grp = board->solvable_groups->square[q1]; for (j = 0; j < sln; j++) if (board->intgp.tgroups[grp[j]] == YES) { if (board->solution[board->sp]->solgroupsnumb == 0) { board->solution[board->sp]->solname = CLAIMEVEN; board->solution[board->sp]->solpoint[0] = q1; board->solution[board->sp]->solpoint[1] = q2; board->solution[board->sp]->sqinv[0] = q1; board->solution[board->sp]->sqinv[1] = q2; board->solution[board->sp]->sqinvnumb = 2; board->instances[CLAIMEVEN]++; } board->solution[board->sp]->solgroups[board->solution[board->sp]-> solgroupsnumb++] = grp[j]; } } if (board->solution[board->sp]->solgroupsnumb > 0) board->sp++; } }
false
false
false
false
false
0
agent_write(struct ast_channel *ast, struct ast_frame *f) { struct agent_pvt *p = ast_channel_tech_pvt(ast); int res = -1; CHECK_FORMATS(ast, p); ast_mutex_lock(&p->lock); if (!p->chan) res = 0; else { if ((f->frametype != AST_FRAME_VOICE) || (f->frametype != AST_FRAME_VIDEO) || (ast_format_cmp(&f->subclass.format, ast_channel_writeformat(p->chan)) != AST_FORMAT_CMP_NOT_EQUAL)) { res = ast_write(p->chan, f); } else { ast_debug(1, "Dropping one incompatible %s frame on '%s' to '%s'\n", f->frametype == AST_FRAME_VOICE ? "audio" : "video", ast_channel_name(ast), ast_channel_name(p->chan)); res = 0; } } CLEANUP(ast, p); ast_mutex_unlock(&p->lock); return res; }
false
false
false
false
false
0
main(int argc, char* argv[]) { Header headfirst; Infoheader headsecond; Single_pixel single_pixel; char* bmp = argv[1]; //"/test/reference.24.bmp"; char* rgb = "../test/output.rgb565.bin"; int byte_border; /* binary opening of the input image file (24bit bmp) */ FILE *infile; infile = fopen(bmp,"rb+"); if(infile==NULL) //file doesnt exist { perror("Opening infile"); exit(EXIT_FAILURE); } /* binary opening of the output image file (rgb565) */ fp_rgb = fopen(rgb, "wb"); //from first header fread(&headfirst,sizeof(headfirst),1,infile); printf("type: %x",headfirst.type[0]); printf(" %x\n",headfirst.type[1]); printf("total size: %u\n",headfirst.size); printf("offset: %u\n",headfirst.offset); //from second header fread(&headsecond,sizeof(headsecond),1,infile); printf("width: %lu\n",headsecond.width); printf("height: %lu\n",headsecond.height); printf("bitcount(color depth): %u\n",headsecond.bitcount); printf("size image (image size): %lu\n",headsecond.sizeimage); //size calculations byte_border = headsecond.sizeimage / 1024; //calculate how many bytes the image size is. printf("image size in bytes: %d\n", byte_border); //BMP pixel array char bmp_24[3]; int i; for(i = 0; i < byte_border / 3; i++) //should loop for byte_border/3, consequently reading all BMP pixels in the image { fread(&single_pixel,sizeof(single_pixel),1,infile); //printf("red: %x\n",single_pixel.red); //printf("green: %x\n",single_pixel.green); //printf("blue: %x\n",single_pixel.blue); bmp_24[0] = single_pixel.red; bmp_24[1] = single_pixel.green; bmp_24[2] = single_pixel.blue; BMP24ToRGB565(bmp_24); } fclose(infile); fclose(fp_rgb); /* TEST PART ---> checking output rgb565 file */ FILE *fp_test; fp_test = fopen(rgb,"rb+"); if(fp_test==NULL) //file doesnt exist { perror("Opening outfile"); exit(EXIT_FAILURE); } unsigned short RGB2Bytes; char rgb565_test[2]; char low; char high; for(i = 0; i< 20 /*(byte_border / 3) * 2 */; i++) //should loop for byte_border/3 *2 , consequently reading all RGB pixels in the image { //fread(&RGB2Bytes,sizeof(RGB2Bytes),1,fp_test); //rgb565_test[0] = LOBYTE(RGB2Bytes); //rgb565_test[1] = HIBYTE(RGB2Bytes); //printf("\n RGB TEST - RGB2Bytes: %d\n", RGB2Bytes); //printf("RGB TEST - rgb565_test[0]: %x\n",rgb565_test[0]); //printf("RGB TEST - rgb565_test[1]: %x\n\n",rgb565_test[1]); fread(&low,sizeof(low),1,fp_test); fread(&high,sizeof(high),1,fp_test); //printf("\nRGB TEST - low: %x\n", low); //printf("RGB TEST - high: %x\n", high); } system("pause"); return 0; }
false
false
false
false
true
1
pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev) { struct pcie_link_state *link_state = pdev->link_state; if (!link_state) return; if (link_state->aspm_support) sysfs_remove_file_from_group(&pdev->dev.kobj, &dev_attr_link_state.attr, power_group); if (link_state->clkpm_capable) sysfs_remove_file_from_group(&pdev->dev.kobj, &dev_attr_clk_ctl.attr, power_group); }
false
false
false
false
false
0
sw_sort_check(Statement *sw_stm) { Quadruple *qpt; for(qpt = sw_stm->qr_head; qpt != NULL; qpt = qpt->next){ if(qpt->ope == OPE_CASE) break; } for(;qpt->op[1] != NULL; qpt = qpt->next){ sw_qr_sort_check(qpt); } for(qpt = sw_stm->qr_head; qpt != NULL; qpt = qpt->next){ if(qpt->ope == OPE_CASE) break; } sw_block_sort_check(qpt); }
false
false
false
false
false
0
pcan_usb_get_serial(struct peak_usb_device *dev, u32 *serial_number) { u8 args[PCAN_USB_CMD_ARGS_LEN]; int err; err = pcan_usb_wait_rsp(dev, 6, 1, args); if (err) { netdev_err(dev->netdev, "getting serial failure: %d\n", err); } else if (serial_number) { __le32 tmp32; memcpy(&tmp32, args, 4); *serial_number = le32_to_cpu(tmp32); } return err; }
false
true
false
false
true
1
heap_adjust(TimerHeap *heap, long index) { Timer *t; Timer *parent; long child_index; /* * We can assume that the heap was fine before this element's * elapse time was changed. There are three cases to deal * with: * - Element's new elapse time is too small; it should be * moved toward the top. * - Element's new elapse time is too large; it should be * moved toward the bottom. * - Element's new elapse time still fits here, we don't * have to do anything. */ gw_assert(index >= 0); gw_assert(index < heap->len); /* Move to top? */ t = heap->tab[index]; parent = heap->tab[index / 2]; if (t->elapses < parent->elapses) { /* This will automatically terminate when it reaches * the top, because in that t == parent. */ do { heap_swap(heap, index, index / 2); index = index / 2; parent = heap->tab[index / 2]; } while (t->elapses < parent->elapses); /* We're done. Return 1 if we changed the top. */ return index == 0; } /* Move to bottom? */ for (; ; ) { child_index = index * 2; if (child_index >= heap->len) return 0; /* Already at bottom */ if (child_index == heap->len - 1) { /* Only one child */ if (heap->tab[child_index]->elapses < t->elapses) heap_swap(heap, index, child_index); break; } /* Find out which child elapses first */ if (heap->tab[child_index + 1]->elapses < heap->tab[child_index]->elapses) { child_index++; } if (heap->tab[child_index]->elapses < t->elapses) { heap_swap(heap, index, child_index); index = child_index; } else { break; } } return 0; }
false
false
false
false
false
0
rsa_is_prime(mp_int *p) { int res; /* run a Fermat test */ res = mpp_fermat(p, 2); if (res != MP_OKAY) { return res; } /* If that passed, run some Miller-Rabin tests */ res = mpp_pprime(p, 2); return res; }
false
false
false
false
false
0
add_component(int col, int row, CL_Component *component, int span) { impl->elements.push_back(new CL_LayoutItem(component)); }
false
false
false
false
false
0
eraseItemFromContentMap(const InventoryItem& item) { if (item.locationOnReceiverX() == -1 || item.locationOnReceiverY() == -1) return; for (int y = 0; y < item.contentHeight(); ++y) { const int map_y = item.locationOnReceiverY() + y; for (int x = 0; x < item.contentWidth(); ++x) { const int map_x = item.locationOnReceiverX() + x; bool val = d_content.elementAtLocation(map_x, map_y) & !item.isSolidAtLocation(x, y); d_content.setElementAtLocation(map_x, map_y, val); } } invalidate(); }
false
false
false
false
false
0
str2int(const char *str) { int a; unsigned long value; char *endptr, buf[11]; strncpy(buf, str, 10); buf[10] = '\0'; a = 2; while ((buf[a] != '\0') && (strchr("0123456789abcdefABCDEF", buf[a]) != NULL)) a++; buf[a] = '\0'; if (a < 3) return -1; value = strtoul(buf, &endptr, 0); if (*endptr == '\0') if ((value >= 0) && (value <= 0xffff)) return value; return -1; }
false
false
false
false
false
0
checkDepth () { XWindowAttributes xwattributes; XGetWindowAttributes (_display, _rootWindow, &xwattributes); _depth = xwattributes.depth; if (_depth != 15 && _depth != 16 && _depth != 24 && _depth != 32) _depth = 24; if (!XMatchVisualInfo (_display, DefaultScreen (_display), _depth, TrueColor, &_XVInfo)) { PTRACE(1, "XVideo\tCould not visual with colordepth of " << _depth << "bits per pixel"); return false; } PTRACE(4, "XVideo\tFound visual with colordepth of " << _depth << "bits per pixel"); return true; }
false
false
false
false
false
0
port_name(int i)const { assert(i >= 0); assert(i < 2); static std::string names[] = {"p", "n"}; return names[i]; }
false
false
false
false
false
0
uea_read_cmv_e4(struct uea_softc *sc, u8 size, u16 group, u16 address, u16 offset, u32 *data) { int ret = uea_cmv_e4(sc, E4_MAKEFUNCTION(E4_MEMACCESS, E4_REQUESTREAD, size), group, address, offset, 0); if (ret < 0) uea_err(INS_TO_USBDEV(sc), "reading cmv failed with error %d\n", ret); else { *data = sc->data; /* size is in 16-bit word quantities */ if (size > 2) *(data + 1) = sc->data1; } return ret; }
false
false
false
false
false
0
get_line(FILE *f, char *buf, unsigned size, int *lineno, const char *file) { int too_long = 0; if (fgets_unlocked(buf, 128, f)) { /* remove newline */ char *ptr = strchr(buf, 0x0a); if (ptr) { if (!too_long) { *ptr = 0; return buf; } // Reset and start with the next line too_long = 0; *lineno = *lineno + 1; } else { // If a line is too long skip it. // Only output 1 warning if (!too_long) audit_msg(LOG_ERR, "Skipping line %d in %s: too long", *lineno, file); too_long = 1; } } return NULL; }
false
false
false
false
false
0
quorem(Bigint *b, Bigint *S) { int n; ULong *bx, *bxe, q, *sx, *sxe; ULLong borrow, carry, y, ys; n= S->wds; if (b->wds < n) return 0; sx= S->p.x; sxe= sx + --n; bx= b->p.x; bxe= bx + n; q= *bxe / (*sxe + 1); /* ensure q <= true quotient */ if (q) { borrow= 0; carry= 0; do { ys= *sx++ * (ULLong)q + carry; carry= ys >> 32; y= *bx - (ys & FFFFFFFF) - borrow; borrow= y >> 32 & (ULong)1; *bx++= (ULong) (y & FFFFFFFF); } while (sx <= sxe); if (!*bxe) { bx= b->p.x; while (--bxe > bx && !*bxe) --n; b->wds= n; } } if (cmp(b, S) >= 0) { q++; borrow= 0; carry= 0; bx= b->p.x; sx= S->p.x; do { ys= *sx++ + carry; carry= ys >> 32; y= *bx - (ys & FFFFFFFF) - borrow; borrow= y >> 32 & (ULong)1; *bx++= (ULong) (y & FFFFFFFF); } while (sx <= sxe); bx= b->p.x; bxe= bx + n; if (!*bxe) { while (--bxe > bx && !*bxe) --n; b->wds= n; } } return q; }
false
false
false
false
false
0
elan_i2c_get_baseline_data(struct i2c_client *client, bool max_baseline, u8 *value) { int error; u8 val[3]; error = elan_i2c_read_cmd(client, max_baseline ? ETP_I2C_MAX_BASELINE_CMD : ETP_I2C_MIN_BASELINE_CMD, val); if (error) return error; *value = le16_to_cpup((__le16 *)val); return 0; }
false
false
false
false
false
0
yywrap(void) { if (found_defaults) { if (freopen(PREFIX, "r", stdin) == NULL) err(2, "%s", PREFIX); yyfile = PREFIX; yyline = 0; found_defaults = 0; return 0; } return 1; }
false
false
false
false
false
0
parseHeaders(const HeaderContainer& headers) { contentLength = 0; contentLoaded = 0; contentType = ""; HeaderContainer::const_iterator it = headers.begin(); HeaderContainer::const_iterator end = headers.end(); for (; it != end; ++it) { std::stringstream ss(*it); std::string descr; if (!std::getline(ss, descr, ':')) continue; if (descr == info->getTypeHeader()) ss >> contentType; if (descr == info->getLengthHeader()) ss >> contentLength; } if (contentLength > contentSize) { delete[] content; content = new uint8_t[contentLength]; contentSize = contentLength; } }
false
false
false
false
false
0
priority_maplist_to_stringlist (GSList *list) { GSList *strlist = NULL, *iter; for (iter = list; iter; iter = g_slist_next (iter)) { PriorityMap *item = iter->data; strlist = g_slist_prepend (strlist, g_strdup_printf ("%d:%d", item->from, item->to)); } return g_slist_reverse (strlist); }
false
false
false
false
false
0
gf_odf_del_ipmp_tool(GF_IPMP_Tool *ipmpt) { if (!ipmpt) return GF_BAD_PARAM; if (ipmpt->tool_url) gf_free(ipmpt->tool_url); gf_free(ipmpt); return GF_OK; }
false
false
false
false
false
0
recv(char* buf, size_t len) { bool ret = this->recv_soft(buf, len); if (ret) this->recv_skip(len); return ret; }
false
false
false
false
false
0
compute_etail() { if (force->pair && force->pair->tail_flag) { double volume = domain->xprd * domain->yprd * domain->zprd; dvalue = force->pair->etail / volume; if (normflag) dvalue /= natoms; } else dvalue = 0.0; }
false
false
false
false
false
0
rocker_port_vlans_del(struct rocker_port *rocker_port, const struct switchdev_obj_port_vlan *vlan) { u16 vid; int err; for (vid = vlan->vid_begin; vid <= vlan->vid_end; vid++) { err = rocker_port_vlan_del(rocker_port, vid, vlan->flags); if (err) return err; } return 0; }
false
false
false
false
false
0
operator() (Ekiga::BookPtr book_) { Evolution::BookPtr book = boost::dynamic_pointer_cast<Evolution::Book> (book_); if (book) { EBook *book_ebook = book->get_ebook (); ESource *book_source = e_book_get_source (book_ebook); #if EDS_CHECK_VERSION(3,5,3) if (e_source_equal (source, book_source)) { #else ESourceGroup *book_group = e_source_peek_group (book_source); if (book_group == group) { #endif book->removed (); found = true; } } return !found; }
false
false
false
false
false
0
ceph_mdsc_destroy(struct ceph_fs_client *fsc) { struct ceph_mds_client *mdsc = fsc->mdsc; dout("mdsc_destroy %p\n", mdsc); ceph_mdsc_stop(mdsc); /* flush out any connection work with references to us */ ceph_msgr_flush(); fsc->mdsc = NULL; kfree(mdsc); dout("mdsc_destroy %p done\n", mdsc); }
false
false
false
false
false
0
getByteArrayFieldValue(JNIEnv *env, jobject obj, const char *fieldName, jfieldID *fieldID, int *size) { jclass objClass = 0; jfieldID objFieldID = 0; jobject byteArrayObj = 0; unsigned char *byteArray = NULL; char *byteArrayCpy = NULL; if (fieldID == NULL) { objClass = (*env)->GetObjectClass(env, obj); if (objClass == 0) { return NULL; } objFieldID = (*env)->GetFieldID(env, objClass, fieldName, "[B"); } else if (*fieldID == 0) { objClass = (*env)->GetObjectClass(env, obj); if (objClass == 0) { return NULL; } objFieldID = *fieldID = (*env)->GetFieldID(env, objClass, fieldName, "[B"); } else { objFieldID = *fieldID; } if (objFieldID == 0) { return NULL; } /* Get the array object */ byteArrayObj = (*env)->GetObjectField(env, obj, objFieldID); if (byteArrayObj == NULL) { return NULL; } /* Determine the size of the array */ *size = (*env)->GetArrayLength(env, byteArrayObj); if (*size == 0) { return NULL; } /* Get and copy the array elements */ byteArray = (jbyte *) (*env)->GetByteArrayElements(env, byteArrayObj, 0); byteArrayCpy = (unsigned char *) AcquireMemory(*size); if (byteArray == NULL) { return NULL; } memcpy(byteArrayCpy, byteArray, *size); (*env)->ReleaseByteArrayElements(env, byteArrayObj, byteArray, JNI_ABORT); return byteArrayCpy; }
false
false
false
false
false
0
objdump_print_symname (bfd *abfd, struct disassemble_info *inf, asymbol *sym) { char *alloc; const char *name; alloc = NULL; name = bfd_asymbol_name (sym); if (do_demangle && name[0] != '\0') { /* Demangle the name. */ alloc = bfd_demangle (abfd, name, DMGL_ANSI | DMGL_PARAMS); if (alloc != NULL) name = alloc; } if (inf != NULL) (*inf->fprintf_func) (inf->stream, "%s", name); else printf ("%s", name); if (alloc != NULL) free (alloc); }
false
false
false
false
false
0
sync_idle_dosync_collectedevents_rsync_exclistpush(gpointer fpath_gp, gpointer flags_gp, gpointer arg_gp) { struct dosync_arg *dosync_arg_p = (struct dosync_arg *)arg_gp; char *fpath = (char *)fpath_gp; FILE *excf = dosync_arg_p->outf; eventinfo_flags_t flags = GPOINTER_TO_INT(flags_gp); // options_t *options_p = dosync_arg_p->options_p; // indexes_t *indexes_p = dosync_arg_p->indexes_p; printf_ddd("Debug3: sync_idle_dosync_collectedevents_rsync_exclistpush(): \"%s\"\n", fpath); size_t fpath_len = strlen(fpath); char *fpathwslash; if(fpath_len>0) { // Prepending with the slash fpathwslash = alloca(fpath_len+2); fpathwslash[0] = '/'; memcpy(&fpathwslash[1], fpath, fpath_len+1); } else { // In this case slash is not required fpathwslash = fpath; } fpathwslash = (char *)rsync_escape(fpathwslash); int ret; if((ret=rsync_outline(excf, fpathwslash, flags))) { printf_e("Error: sync_idle_dosync_collectedevents_rsync_exclistpush(): Got error from rsync_outline(). Exit.\n"); exit(ret); // TODO: replace this with kill(0, ...) } return TRUE; }
false
false
false
false
false
0
vhost_net_ubuf_put(struct vhost_net_ubuf_ref *ubufs) { int r = atomic_sub_return(1, &ubufs->refcount); if (unlikely(!r)) wake_up(&ubufs->wait); return r; }
false
false
false
false
false
0
GetEndColumn() const { i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); if (IsDeadCheck(isolate, "v8::Message::GetEndColumn()")) return kNoColumnInfo; ENTER_V8(isolate); i::HandleScope scope(isolate); i::Handle<i::JSObject> data_obj = Utils::OpenHandle(this); EXCEPTION_PREAMBLE(isolate); i::Handle<i::Object> start_col_obj = CallV8HeapFunction( "GetPositionInLine", data_obj, &has_pending_exception); EXCEPTION_BAILOUT_CHECK(isolate, 0); i::Handle<i::JSMessageObject> message = i::Handle<i::JSMessageObject>::cast(data_obj); int start = message->start_position(); int end = message->end_position(); return static_cast<int>(start_col_obj->Number()) + (end - start); }
false
false
false
false
false
0
flat_edge(graph_t * g, edge_t * e) { elist_append(e, ND_flat_out(agtail(e))); elist_append(e, ND_flat_in(aghead(e))); GD_has_flat_edges(agroot(g)) = GD_has_flat_edges(g) = TRUE; }
false
false
false
false
false
0
saveHypotheses(vector<BaseLearner*>& weakHypotheses) { // save the weak hypotheses one by one. for (int i = 0; i < (int)weakHypotheses.size(); ++i) appendHypothesis(i, weakHypotheses[i]); }
false
false
false
false
false
0
cd_interp_insert (CdInterp *interp, gdouble x, gdouble y) { g_return_if_fail (CD_IS_INTERP (interp)); g_return_if_fail (!interp->priv->prepared); g_array_append_val (interp->priv->x, x); g_array_append_val (interp->priv->y, y); }
false
false
false
false
false
0
_bcp47ToLDMLKey(const char* bcpKey, int32_t bcpKeyLen, char* key, int32_t keyCapacity, UErrorCode *status) { UResourceBundle *rb; char bcpKeyBuf[MAX_BCP47_SUBTAG_LEN]; int32_t resultLen = 0; int32_t i; const char *resKey = NULL; UResourceBundle *keyMap; if (bcpKeyLen < 0) { bcpKeyLen = uprv_strlen(bcpKey); } if (bcpKeyLen >= sizeof(bcpKeyBuf)) { *status = U_ILLEGAL_ARGUMENT_ERROR; return 0; } uprv_memcpy(bcpKeyBuf, bcpKey, bcpKeyLen); bcpKeyBuf[bcpKeyLen] = 0; /* to lower case */ for (i = 0; i < bcpKeyLen; i++) { bcpKeyBuf[i] = uprv_tolower(bcpKeyBuf[i]); } rb = ures_openDirect(NULL, SUPPLEMENTAL, status); ures_getByKey(rb, BCP47MAPPINGS, rb, status); ures_getByKey(rb, "key", rb, status); if (U_FAILURE(*status)) { ures_close(rb); return 0; } keyMap = ures_getNextResource(rb, NULL, status); while (U_SUCCESS(*status)) { const UChar *uBcpKey; char tmpBcpKeyBuf[MAX_BCP47_SUBTAG_LEN]; int32_t tmpBcpKeyLen; uBcpKey = ures_getString(keyMap, &tmpBcpKeyLen, status); if (U_FAILURE(*status)) { break; } u_UCharsToChars(uBcpKey, tmpBcpKeyBuf, tmpBcpKeyLen); tmpBcpKeyBuf[tmpBcpKeyLen] = 0; if (uprv_strcmp(bcpKeyBuf, tmpBcpKeyBuf) == 0) { /* found a matching BCP47 key */ resKey = ures_getKey(keyMap); resultLen = uprv_strlen(resKey); break; } if (!ures_hasNext(rb)) { break; } ures_getNextResource(rb, keyMap, status); } ures_close(keyMap); ures_close(rb); if (U_FAILURE(*status)) { return 0; } if (resKey == NULL) { resKey = bcpKeyBuf; resultLen = bcpKeyLen; } uprv_memcpy(key, resKey, uprv_min(resultLen, keyCapacity)); return u_terminateChars(key, keyCapacity, resultLen, status); }
true
true
false
false
false
1
done(int r) { if (r == QDialog::Rejected) { // TODO: code here // bool yes = Utils::yesNoMessageBox(tr("WARNING! You did not save this user."), // tr("If you continue without saving, changes will be lost." // "Do you really want to close this dialog?"), // "", tr("Data losing")); // if (yes) QDialog::done(r); } else { QDialog::done(r); } }
false
false
false
false
false
0
runPgDump(const char *dbname) { PQExpBuffer connstrbuf = createPQExpBuffer(); PQExpBuffer cmd = createPQExpBuffer(); int ret; appendPQExpBuffer(cmd, "\"%s\" %s", pg_dump_bin, pgdumpopts->data); /* * If we have a filename, use the undocumented plain-append pg_dump * format. */ if (filename) appendPQExpBufferStr(cmd, " -Fa "); else appendPQExpBufferStr(cmd, " -Fp "); /* * Append the database name to the already-constructed stem of connection * string. */ appendPQExpBuffer(connstrbuf, "%s dbname=", connstr); doConnStrQuoting(connstrbuf, dbname); doShellQuoting(cmd, connstrbuf->data); if (verbose) fprintf(stderr, _("%s: running \"%s\"\n"), progname, cmd->data); fflush(stdout); fflush(stderr); ret = system(cmd->data); destroyPQExpBuffer(cmd); destroyPQExpBuffer(connstrbuf); return ret; }
false
false
false
false
true
1
asn1PE_H245IS11172AudioMode_audioLayer (OOCTXT* pctxt, H245IS11172AudioMode_audioLayer* pvalue) { int stat = ASN_OK; /* Encode choice index value */ stat = encodeConsUnsigned (pctxt, pvalue->t - 1, 0, 2); if (stat != ASN_OK) return stat; /* Encode root element data value */ switch (pvalue->t) { /* audioLayer1 */ case 1: /* NULL */ break; /* audioLayer2 */ case 2: /* NULL */ break; /* audioLayer3 */ case 3: /* NULL */ break; default: return ASN_E_INVOPT; } return (stat); }
false
false
false
false
false
0
iommu_request_dm_for_dev(struct device *dev) { struct iommu_domain *dm_domain; struct iommu_group *group; int ret; /* Device must already be in a group before calling this function */ group = iommu_group_get_for_dev(dev); if (IS_ERR(group)) return PTR_ERR(group); mutex_lock(&group->mutex); /* Check if the default domain is already direct mapped */ ret = 0; if (group->default_domain && group->default_domain->type == IOMMU_DOMAIN_IDENTITY) goto out; /* Don't change mappings of existing devices */ ret = -EBUSY; if (iommu_group_device_count(group) != 1) goto out; /* Allocate a direct mapped domain */ ret = -ENOMEM; dm_domain = __iommu_domain_alloc(dev->bus, IOMMU_DOMAIN_IDENTITY); if (!dm_domain) goto out; /* Attach the device to the domain */ ret = __iommu_attach_group(dm_domain, group); if (ret) { iommu_domain_free(dm_domain); goto out; } /* Make the direct mapped domain the default for this group */ if (group->default_domain) iommu_domain_free(group->default_domain); group->default_domain = dm_domain; pr_info("Using direct mapping for device %s\n", dev_name(dev)); ret = 0; out: mutex_unlock(&group->mutex); iommu_group_put(group); return ret; }
false
false
false
false
false
0
bypass_conditional_jumps () { basic_block bb; int changed; rtx setcc; rtx insn; rtx dest; /* Note we start at block 1. */ if (ENTRY_BLOCK_PTR->next_bb == EXIT_BLOCK_PTR) return 0; changed = 0; FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR->next_bb->next_bb, EXIT_BLOCK_PTR, next_bb) { /* Check for more than one predecessor. */ if (bb->pred && bb->pred->pred_next) { setcc = NULL_RTX; for (insn = bb->head; insn != NULL && insn != NEXT_INSN (bb->end); insn = NEXT_INSN (insn)) if (GET_CODE (insn) == INSN) { if (setcc) break; if (GET_CODE (PATTERN (insn)) != SET) break; dest = SET_DEST (PATTERN (insn)); if (REG_P (dest) || CC0_P (dest)) setcc = insn; else break; } else if (GET_CODE (insn) == JUMP_INSN) { if (any_condjump_p (insn) && onlyjump_p (insn)) changed |= bypass_block (bb, setcc, insn); break; } else if (INSN_P (insn)) break; } } /* If we bypassed any register setting insns, we inserted a copy on the redirected edge. These need to be commited. */ if (changed) commit_edge_insertions(); return changed; }
false
false
false
false
false
0
__get_segment_type_4(struct page *page, enum page_type p_type) { if (p_type == DATA) { struct inode *inode = page->mapping->host; if (S_ISDIR(inode->i_mode)) return CURSEG_HOT_DATA; else return CURSEG_COLD_DATA; } else { if (IS_DNODE(page) && is_cold_node(page)) return CURSEG_WARM_NODE; else return CURSEG_COLD_NODE; } }
false
false
false
false
false
0
md5_append(md5_state_t *pms, const md5_byte_t *data, unsigned int nbytes) { const md5_byte_t *p = data; unsigned int left = nbytes; unsigned int offset = (pms->count[0] >> 3) & 63; md5_word_t nbits = (md5_word_t)(nbytes << 3); if (nbytes <= 0) return; /* this special case is handled recursively */ if (nbytes > INT_MAX - offset) { unsigned int overlap; /* handle the append in two steps to prevent overflow */ overlap = 64 - offset; md5_append(pms, data, overlap); md5_append(pms, data + overlap, nbytes - overlap); return; } /* Update the message length. */ pms->count[1] += nbytes >> 29; pms->count[0] += nbits; if (pms->count[0] < nbits) pms->count[1]++; /* Process an initial partial block. */ if (offset) { unsigned int copy = (offset + nbytes > 64 ? 64 - offset : nbytes); memcpy(pms->buf + offset, p, copy); if (offset + copy < 64) return; p += copy; left -= copy; md5_process(pms, pms->buf); } /* Process full blocks. */ for (; left >= 64; p += 64, left -= 64) md5_process(pms, p); /* Process a final partial block. */ if (left) memcpy(pms->buf, p, left); }
false
true
false
false
false
1
showSegments(bool toggle, SegmentSettings seg, QList<QRect>* updateRectList) { int minPixels = (seg.minPoints - 1) * seg.pointSeparation; Segment* segment; for (segment = segments.first(); segment; segment = segments.next()) { // no matter the value of toggle, never show segments that are too short ASSERT_ENGAUGE(segment != 0); if (segment->length() < minPixels) segment->showSegment(false, seg, updateRectList); else segment->showSegment(toggle, seg, updateRectList); } }
false
false
false
false
false
0
build_indexed_triangle_fan_set(GF_Node *node, Drawable3D *stack, GF_TraverseState *tr_state) { MFInt32 fanList; u32 i, nb_fans; X_IndexedTriangleFanSet *itfs = (X_IndexedTriangleFanSet *)node; gf_node_dirty_clear(node, 0); if (!itfs->coord) return; fanList.count = 0; fanList.vals = NULL; nb_fans = 0; for (i=0; i<itfs->index.count; i++) { if (itfs->index.vals[i]==-1) { if (nb_fans>=3) { u32 *out_nb; gf_sg_vrml_mf_append(&fanList, GF_SG_VRML_MFINT32, (void **) &out_nb); *out_nb = nb_fans; } nb_fans = 0; } else { nb_fans++; } } if (nb_fans>=3) { u32 *out_nb; gf_sg_vrml_mf_append(&fanList, GF_SG_VRML_MFINT32, (void **) &out_nb); *out_nb = nb_fans; } BuildTriangleFanSet(stack->mesh, itfs->coord, itfs->color, itfs->texCoord, itfs->normal, &fanList, &itfs->index, itfs->normalPerVertex, itfs->ccw, itfs->solid); gf_sg_vrml_mf_reset(&fanList, GF_SG_VRML_MFINT32); }
false
false
false
false
false
0
gee_concurrent_set_tower_help_marked (GeeConcurrentSetTower* self, GeeConcurrentSetTower* prev_tower, guint8 level) { GeeConcurrentSetTower* _tmp0_ = NULL; guint8 _tmp1_ = 0U; GeeConcurrentSetTower* _tmp2_ = NULL; GeeConcurrentSetTower* _tmp3_ = NULL; guint8 _tmp4_ = 0U; g_return_if_fail (self != NULL); g_return_if_fail (prev_tower != NULL); _tmp0_ = prev_tower; _tmp1_ = level; _tmp2_ = gee_concurrent_set_tower_get_next (self, _tmp1_); _tmp3_ = _tmp2_; _tmp4_ = level; gee_concurrent_set_tower_compare_and_exchange (_tmp0_, self, GEE_CONCURRENT_SET_STATE_FLAGGED, _tmp3_, GEE_CONCURRENT_SET_STATE_NONE, _tmp4_); _gee_concurrent_set_tower_unref0 (_tmp3_); }
false
false
false
false
false
0
getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) { if (propertyName == exec->propertyNames().length) { descriptor.setPropertyDescriptorValues(exec, jsNumber(m_length), m_lengthAttributes); return true; } bool isArrayIndex; unsigned i = propertyName.toArrayIndex(&isArrayIndex); if (isArrayIndex) { ArrayEntity* ent = getArrayEntity(i); if (ent) { descriptor.setPropertyDescriptorValues(exec, ent->value, ent->attributes); return true; } } return JSObject::getOwnPropertyDescriptor(exec, propertyName, descriptor); }
false
false
false
false
false
0
SetName(v8::Handle<v8::String> name) { i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); ENTER_V8(isolate); USE(isolate); i::Handle<i::JSFunction> func = Utils::OpenHandle(this); func->shared()->set_name(*Utils::OpenHandle(*name)); }
false
false
false
false
false
0
create ( void ) throw ( Exception ) { int fd; if ( isOpen() ) { return false; } if ( (fd = ::creat( fileName, S_IRUSR | S_IWUSR)) == -1 ) { reportEvent( 3, "can't create file", fileName, errno); return false; } ::close( fd); return true; }
false
false
false
false
false
0
gnc_html_register_object_handler( const char * classid, GncHTMLObjectCB hand ) { g_return_if_fail( classid != NULL ); if ( gnc_html_object_handlers == NULL ) { gnc_html_object_handlers = g_hash_table_new( g_str_hash, g_str_equal ); } gnc_html_unregister_object_handler( classid ); if ( hand != NULL ) { gchar *lc_id = g_ascii_strdown (classid, -1); g_hash_table_insert( gnc_html_object_handlers, lc_id, hand ); } }
false
false
false
false
false
0
slookup(symbol, file) register char *symbol; register struct inclist *file; { register int first = 0; register int last = file->i_ndefs - 1; if (file) while (last >= first) { /* Fast inline binary search */ register char *s1; register char *s2; register int middle = (first + last) / 2; /* Fast inline strchr() */ s1 = symbol; s2 = file->i_defs[middle]->s_name; while (*s1++ == *s2++) if (s2[-1] == '\0') break; /* If exact match, we're done */ if (*--s1 == *--s2) { return file->i_defs + middle; } /* If symbol > i_defs[middle] ... */ if (*s1 > *s2) { first = middle + 1; } /* else ... */ else { last = middle - 1; } } return(NULL); }
false
false
false
false
false
0
missingInclude(const std::string &filename, unsigned int linenr, const std::string &header, bool userheader) { std::list<ErrorLogger::ErrorMessage::FileLocation> locationList; if (!filename.empty()) { ErrorLogger::ErrorMessage::FileLocation loc; loc.line = linenr; loc.setfile(filename); locationList.push_back(loc); } // If the missing include is a system header then this is // currently a debug-message. const Severity::SeverityType severity = userheader ? Severity::information : Severity::debug; const std::string id = userheader ? "missingInclude" : "debug"; ErrorLogger::ErrorMessage errmsg(locationList, severity, "Include file: \"" + header + "\" not found.", id); errmsg.file0 = file0; _errorLogger->reportErr(errmsg); }
false
false
false
false
false
0
read_max_uid_value(FolderItem *item, guint * pmax_uid) { gchar * path; gchar * file; FILE * f; guint max_uid; size_t r; path = folder_item_get_path(item); file = g_strconcat(path, G_DIR_SEPARATOR_S, MAX_UID_FILE, NULL); g_free(path); f = fopen(file, "r"); g_free(file); if (f == NULL) return; r = fread(&max_uid, sizeof(max_uid), 1, f); if (r == 0) { fclose(f); return; } fclose(f); * pmax_uid = max_uid; }
false
false
false
false
true
1
module_hup_module(CONF_SECTION *cs, module_instance_t *node, time_t when) { void *insthandle = NULL; fr_module_hup_t *mh; if (!node || !node->entry->module->instantiate || ((node->entry->module->type & RLM_TYPE_HUP_SAFE) == 0)) { return 1; } cf_log_module(cs, "Trying to reload module \"%s\"", node->name); if ((node->entry->module->instantiate)(cs, &insthandle) < 0) { cf_log_err(cf_sectiontoitem(cs), "HUP failed for module \"%s\". Using old configuration.", node->name); return 0; } radlog(L_INFO, " Module: Reloaded module \"%s\"", node->name); module_instance_free_old(cs, node, when); /* * Save the old instance handle for later deletion. */ mh = rad_malloc(sizeof(*mh)); mh->mi = node; mh->when = when; mh->insthandle = node->insthandle; mh->next = node->mh; node->mh = mh; node->insthandle = insthandle; /* * FIXME: Set a timeout to come back in 60s, so that * we can pro-actively clean up the old instances. */ return 1; }
false
false
false
false
false
0
xmalloc_fgets_str_len(FILE *file, const char *terminating_string, size_t *maxsz_p) { size_t maxsz; if (!maxsz_p) { maxsz = INT_MAX - 4095; maxsz_p = &maxsz; } return xmalloc_fgets_internal(file, terminating_string, 0, maxsz_p); }
false
false
false
false
false
0
set_program_behaviour(void) { static const char enca_name[] = "enca"; static const char enconv_name[] = "enconv"; static const size_t nenca = sizeof(enca_name) - 1; static const size_t nenconv = sizeof(enconv_name) - 1; if (strncmp(program_name, enca_name, nenca) == 0 && !isalpha(program_name[nenca])) { behaviour = BEHAVE_ENCA; return; } if (strncmp(program_name, enconv_name, nenconv) == 0 && !isalpha(program_name[nenconv])) { behaviour = BEHAVE_ENCONV; return; } }
false
false
false
false
false
0
_ds_del_spamrecord (DSPAM_CTX * CTX, unsigned long long token) { struct _pgsql_drv_storage *s = (struct _pgsql_drv_storage *) CTX->storage; struct passwd *p; char *name; char query[256]; PGresult *result; char tok_buf[30]; if (s->dbh == NULL) { LOGDEBUG ("_ds_del_spamrecord: invalid database handle (NULL)"); return EINVAL; } if (!CTX->group || CTX->flags & DSF_MERGED) { p = _pgsql_drv_getpwnam (CTX, CTX->username); name = CTX->username; } else { p = _pgsql_drv_getpwnam (CTX, CTX->group); name = CTX->group; } if (p == NULL) { LOGDEBUG ("_ds_del_spamrecord: unable to _pgsql_drv_getpwnam(%s)", name); return EINVAL; } snprintf (query, sizeof (query), "DELETE FROM dspam_token_data WHERE uid=%d AND token=%s", (int) p->pw_uid, _pgsql_drv_token_write (s->pg_token_type, token, tok_buf, sizeof(tok_buf)) ); result = PQexec(s->dbh, query); if ( !result || (PQresultStatus(result) != PGRES_COMMAND_OK && PQresultStatus(result) != PGRES_NONFATAL_ERROR) ) { _pgsql_drv_query_error (PQresultErrorMessage(result), query); if (result) PQclear(result); return EFAILURE; } if (result) PQclear(result); return 0; }
true
true
false
false
false
1
operator>>(char& n_) { int c = 0; int len = sizeof (int); XDR xdrs; xdrmem_create (&xdrs, (caddr_t) &c, len, XDR_DECODE); if (read ((char* ) &c, len) == len) { xdr_char (&xdrs, &n_); } else { setstate (Socket::eofbit|Socket::failbit); } xdr_destroy(&xdrs); return *this; }
false
false
false
false
false
0
matches(const QString &name, const QString &id) const { if (serviceName == name && (credentialID == id)) { return true; } if (targets.testFlag(AuthorizationRule::AllUsers) && (serviceName == name)) { return true; } if (targets.testFlag(AuthorizationRule::AllServices) && (credentialID == id)) { return true; } return false; }
false
false
false
false
false
0
drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 request, unsigned int offset, void *buffer, size_t size) { struct drm_dp_aux_msg msg; unsigned int retry; int err = 0; memset(&msg, 0, sizeof(msg)); msg.address = offset; msg.request = request; msg.buffer = buffer; msg.size = size; mutex_lock(&aux->hw_mutex); /* * The specification doesn't give any recommendation on how often to * retry native transactions. We used to retry 7 times like for * aux i2c transactions but real world devices this wasn't * sufficient, bump to 32 which makes Dell 4k monitors happier. */ for (retry = 0; retry < 32; retry++) { err = aux->transfer(aux, &msg); if (err < 0) { if (err == -EBUSY) continue; goto unlock; } switch (msg.reply & DP_AUX_NATIVE_REPLY_MASK) { case DP_AUX_NATIVE_REPLY_ACK: if (err < size) err = -EPROTO; goto unlock; case DP_AUX_NATIVE_REPLY_NACK: err = -EIO; goto unlock; case DP_AUX_NATIVE_REPLY_DEFER: usleep_range(AUX_RETRY_INTERVAL, AUX_RETRY_INTERVAL + 100); break; } } DRM_DEBUG_KMS("too many retries, giving up\n"); err = -EIO; unlock: mutex_unlock(&aux->hw_mutex); return err; }
false
false
false
false
false
0
putline_r210 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src, int j) { int i; guint8 *destline = FRAME_GET_LINE (dest, 0, j); for (i = 0; i < convert->width / 2; i++) { guint32 x = 0; x |= src[i * 4 + 1] << 22; x |= (src[i * 4 + 1] & 0xc0) << 14; x |= src[i * 4 + 2] << 12; x |= (src[i * 4 + 2] & 0xc0) << 10; x |= src[i * 4 + 3] << 2; x |= (src[i * 4 + 3] & 0xc0) >> 6; GST_WRITE_UINT32_BE (destline + i * 4, x); } }
false
false
false
false
false
0
addRead(_fcd filename , fortint filename_len) { integer thisFile; if( DEBUG2 ) { _fcd pfile; copyName(&pfile, filename, filename_len); printf("PBG_addRead: add for reading filename = %s\n", pfile); free(pfile); } thisFile = addFile(filename,filename_len,'r'); pbgindx( thisFile); return thisFile; }
false
false
false
false
false
0
fsl_asrc_dma_prepare_and_submit(struct snd_pcm_substream *substream) { u8 dir = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? OUT : IN; struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_pcm_runtime *runtime = substream->runtime; struct fsl_asrc_pair *pair = runtime->private_data; struct device *dev = rtd->platform->dev; unsigned long flags = DMA_CTRL_ACK; /* Prepare and submit Front-End DMA channel */ if (!substream->runtime->no_period_wakeup) flags |= DMA_PREP_INTERRUPT; pair->pos = 0; pair->desc[!dir] = dmaengine_prep_dma_cyclic( pair->dma_chan[!dir], runtime->dma_addr, snd_pcm_lib_buffer_bytes(substream), snd_pcm_lib_period_bytes(substream), dir == OUT ? DMA_TO_DEVICE : DMA_FROM_DEVICE, flags); if (!pair->desc[!dir]) { dev_err(dev, "failed to prepare slave DMA for Front-End\n"); return -ENOMEM; } pair->desc[!dir]->callback = fsl_asrc_dma_complete; pair->desc[!dir]->callback_param = substream; dmaengine_submit(pair->desc[!dir]); /* Prepare and submit Back-End DMA channel */ pair->desc[dir] = dmaengine_prep_dma_cyclic( pair->dma_chan[dir], 0xffff, 64, 64, DMA_DEV_TO_DEV, 0); if (!pair->desc[dir]) { dev_err(dev, "failed to prepare slave DMA for Back-End\n"); return -ENOMEM; } dmaengine_submit(pair->desc[dir]); return 0; }
false
false
false
false
false
0
release_buffer(struct AVCodecContext* avctx, AVFrame* pic) { if (pic->type == FF_BUFFER_TYPE_USER) { FFVideoDecoder* d = (FFVideoDecoder*) avctx->opaque; d->m_pReleased = (CImage*) pic->opaque; Debug printf("FF: >>>> Released buffer %p %p\n", pic->opaque, pic); memset(pic->data, 0, sizeof(void*) * 4); pic->opaque = NULL; } else { Debug printf(">>>> released default buffer *****************\n"); avcodec_default_release_buffer(avctx, pic); } }
false
false
false
false
false
0
check(ErrorHandler *errh) { // HEADER FORMAT: // USHORT coverageFormat // USHORT glyphCount const uint8_t *data = _str.udata(); if (_str.length() < 6) // NB: prevents empty format-2 tables return errh->error("OTF class def table too small for header"); int classFormat = USHORT_AT(data); int len; if (classFormat == T_LIST) { int count = USHORT_AT(data + 4); len = LIST_HEADERSIZE + count*LIST_RECSIZE; // XXX don't check sorting } else if (classFormat == T_RANGES) { int count = USHORT_AT(data + 2); len = RANGES_HEADERSIZE + count*RANGES_RECSIZE; // XXX don't check sorting } else return errh->error("OTF class def table has unknown format %d", classFormat); if (len > _str.length()) return errh->error("OTF class def table too short"); else { _str = _str.substring(0, len); return 0; } }
false
false
false
false
false
0
ERR_set_error_data(char *data, int flags) { ERR_STATE *es; int i; es=ERR_get_state(); i=es->top; if (i == 0) i=ERR_NUM_ERRORS-1; err_clear_data(es,i); es->err_data[i]=data; es->err_data_flags[i]=flags; }
false
false
false
false
false
0
sell_callback(struct impr_type *pimprove, gpointer data) { GtkWidget *shl; struct city_dialog *pdialog = (struct city_dialog *) data; pdialog->sell_id = improvement_number(pimprove); int price; if (!can_client_issue_orders()) { return; } if (test_player_sell_building_now(client.conn.playing, pdialog->pcity, pimprove) != TR_SUCCESS) { return; } price = impr_sell_gold(pimprove); shl = gtk_message_dialog_new(NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, PL_("Sell %s for %d gold?", "Sell %s for %d gold?", price), city_improvement_name_translation(pdialog->pcity, pimprove), price); setup_dialog(shl, pdialog->shell); pdialog->sell_shell = shl; gtk_window_set_title(GTK_WINDOW(shl), _("Sell It!")); gtk_window_set_position(GTK_WINDOW(shl), GTK_WIN_POS_CENTER_ON_PARENT); g_signal_connect(shl, "response", G_CALLBACK(sell_callback_response), pdialog); gtk_window_present(GTK_WINDOW(shl)); }
false
false
false
false
false
0
cddb_cache_query_init(void) { static int query_cache_init = FALSE; int i; if (!query_cache_init) { for (i = 0; i < sizeof(QUERY_CACHE_SIZE); i++) { query_cache[i].category = CDDB_CAT_INVALID; } query_cache_init = TRUE; } }
false
false
false
false
false
0
mxl111sf_stream_config_bulk(struct usb_data_stream_properties *stream, u8 endpoint) { pr_debug("%s: endpoint=%d size=8192\n", __func__, endpoint); stream->type = USB_BULK; stream->count = 5; stream->endpoint = endpoint; stream->u.bulk.buffersize = 8192; }
false
false
false
false
false
0
totem_pl_parser_add_asf_parser (TotemPlParser *parser, GFile *file, GFile *base_file, TotemPlParseData *parse_data, gpointer data) { TotemPlParserResult retval = TOTEM_PL_PARSER_RESULT_UNHANDLED; char *contents, *ref; gsize size; /* NSC files are handled directly by GStreamer */ if (g_str_has_prefix (data, "[Address]") != FALSE) return TOTEM_PL_PARSER_RESULT_UNHANDLED; if (g_str_has_prefix (data, "ASF ") == FALSE) { return totem_pl_parser_add_asf_reference_parser (parser, file, base_file, parse_data, data); } if (g_file_load_contents (file, NULL, &contents, &size, NULL, NULL) == FALSE) return TOTEM_PL_PARSER_RESULT_ERROR; if (size <= 4) { g_free (contents); return TOTEM_PL_PARSER_RESULT_ERROR; } /* Skip 'ASF ' */ ref = contents + 4; if (g_str_has_prefix (ref, "http") != FALSE) { memcpy(ref, "mmsh", 4); totem_pl_parser_add_one_uri (parser, ref, NULL); retval = TOTEM_PL_PARSER_RESULT_SUCCESS; } g_free (contents); return retval; }
false
true
false
false
false
1
vtos(const std::vector<double>& ds,std::string sep) { return vtos(&*ds.begin(),&*ds.end(),sep); }
false
false
false
false
false
0