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
DumpLinkeditDataCommand(MachOObject &Obj, const MachOObject::LoadCommandInfo &LCI) { InMemoryStruct<macho::LinkeditDataLoadCommand> LLC; Obj.ReadLinkeditDataLoadCommand(LCI, LLC); if (!LLC) return Error("unable to read segment load command"); outs() << " ('dataoff', " << LLC->DataOffset << ")\n" << " ('datasize', " << LLC->DataSize << ")\n" << " ('_addresses', [\n"; SmallVector<uint64_t, 8> Addresses; Obj.ReadULEB128s(LLC->DataOffset, Addresses); for (unsigned i = 0, e = Addresses.size(); i != e; ++i) outs() << " # Address " << i << '\n' << " ('address', " << format("0x%x", Addresses[i]) << "),\n"; outs() << " ])\n"; return 0; }
false
false
false
false
false
0
sort_user_dec(void *v1, void *v2) { slurmdb_report_user_rec_t *user_a; slurmdb_report_user_rec_t *user_b; int diff; diff = 0; user_a = *(slurmdb_report_user_rec_t **)v1; user_b = *(slurmdb_report_user_rec_t **)v2; if (sort_flag == SLURMDB_REPORT_SORT_TIME) { if (user_a->cpu_secs > user_b->cpu_secs) return -1; else if (user_a->cpu_secs < user_b->cpu_secs) return 1; } if (!user_a->name || !user_b->name) return 0; diff = strcmp(user_a->name, user_b->name); if (diff > 0) return 1; else if (diff < 0) return -1; return 0; }
false
false
false
false
false
0
playlist() { return Playlist::ModelStack::instance()->groupingProxy(); }
false
false
false
false
false
0
alloc_rpf (unsigned mantissa, fiasco_rpf_range_e range) /* * Reduced precision format constructor. * Allocate memory for the rpf_t structure. * Number of mantissa bits is given by `mantissa'. * The range of the real values is in the interval [-`range', +`range']. * In case of invalid parameters, a structure with default values is * returned. * * Return value * pointer to the new rpf structure */ { rpf_t *rpf = fiasco_calloc (1, sizeof (rpf_t)); if (mantissa < 2) { warning (_("Size of RPF mantissa has to be in the interval [2,8]. " "Using minimum value 2.\n")); mantissa = 2; } else if (mantissa > 8) { warning (_("Size of RPF mantissa has to be in the interval [2,8]. " "Using maximum value 8.\n")); mantissa = 2; } rpf->mantissa_bits = mantissa; rpf->range_e = range; switch (range) { case FIASCO_RPF_RANGE_0_75: rpf->range = 0.75; break; case FIASCO_RPF_RANGE_1_50: rpf->range = 1.50; break; case FIASCO_RPF_RANGE_2_00: rpf->range = 2.00; break; case FIASCO_RPF_RANGE_1_00: rpf->range = 1.00; break; default: warning (_("Invalid RPF range specified. Using default value 1.0.")); rpf->range = 1.00; rpf->range_e = FIASCO_RPF_RANGE_1_00; break; } return rpf; }
false
false
false
false
false
0
copy_rtx_for_iterators (rtx original) { const char *format_ptr; int i, j; rtx x; if (original == 0) return original; /* Create a shallow copy of ORIGINAL. */ x = rtx_alloc (GET_CODE (original)); memcpy (x, original, RTX_CODE_SIZE (GET_CODE (original))); /* Change each string and recursively change each rtx. */ format_ptr = GET_RTX_FORMAT (GET_CODE (original)); for (i = 0; format_ptr[i] != 0; i++) switch (format_ptr[i]) { case 'T': XTMPL (x, i) = apply_iterator_to_string (XTMPL (x, i)); break; case 'S': case 's': XSTR (x, i) = apply_iterator_to_string (XSTR (x, i)); break; case 'e': XEXP (x, i) = copy_rtx_for_iterators (XEXP (x, i)); break; case 'V': case 'E': if (XVEC (original, i)) { XVEC (x, i) = rtvec_alloc (XVECLEN (original, i)); for (j = 0; j < XVECLEN (x, i); j++) XVECEXP (x, i, j) = copy_rtx_for_iterators (XVECEXP (original, i, j)); } break; default: break; } return x; }
false
false
false
false
true
1
client_get_area(ObClient *self) { XWindowAttributes wattrib; Status ret; ret = XGetWindowAttributes(obt_display, self->window, &wattrib); g_assert(ret != BadWindow); RECT_SET(self->area, wattrib.x, wattrib.y, wattrib.width, wattrib.height); POINT_SET(self->root_pos, wattrib.x, wattrib.y); self->border_width = wattrib.border_width; ob_debug("client area: %d %d %d %d bw %d", wattrib.x, wattrib.y, wattrib.width, wattrib.height, wattrib.border_width); }
false
false
false
false
false
0
alloc_raid_set(struct lib_context *lc, const char *who) { struct raid_set *ret; if ((ret = dbg_malloc(sizeof(*ret)))) { INIT_LIST_HEAD(&ret->list); INIT_LIST_HEAD(&ret->sets); INIT_LIST_HEAD(&ret->devs); ret->status = s_setup; ret->type = t_undef; } else log_alloc_err(lc, who); return ret; }
false
false
false
false
false
0
pcm512x_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { struct regmap *regmap; struct regmap_config config = pcm512x_regmap; /* msb needs to be set to enable auto-increment of addresses */ config.read_flag_mask = 0x80; config.write_flag_mask = 0x80; regmap = devm_regmap_init_i2c(i2c, &config); if (IS_ERR(regmap)) return PTR_ERR(regmap); return pcm512x_probe(&i2c->dev, regmap); }
false
false
false
false
false
0
jack_port_type_buffer_size (jack_port_type_info_t* port_type_info, jack_nframes_t nframes) { if( port_type_info->buffer_scale_factor < 0 ) { return port_type_info->buffer_size; } return port_type_info->buffer_scale_factor * sizeof (jack_default_audio_sample_t) * nframes; }
false
false
false
false
false
0
__mcam_cam_reset(struct mcam_camera *cam) { return sensor_call(cam, core, reset, 0); }
false
false
false
false
false
0
INFTL_trydeletechain(struct INFTLrecord *inftl, unsigned thisVUC) { struct mtd_info *mtd = inftl->mbd.mtd; unsigned char BlockUsed[MAX_SECTORS_PER_UNIT]; unsigned char BlockDeleted[MAX_SECTORS_PER_UNIT]; unsigned int thisEUN, status; int block, silly; struct inftl_bci bci; size_t retlen; pr_debug("INFTL: INFTL_trydeletechain(inftl=%p," "thisVUC=%d)\n", inftl, thisVUC); memset(BlockUsed, 0, sizeof(BlockUsed)); memset(BlockDeleted, 0, sizeof(BlockDeleted)); thisEUN = inftl->VUtable[thisVUC]; if (thisEUN == BLOCK_NIL) { printk(KERN_WARNING "INFTL: trying to delete non-existent " "Virtual Unit Chain %d!\n", thisVUC); return; } /* * Scan through the Erase Units to determine whether any data is in * each of the 512-byte blocks within the Chain. */ silly = MAX_LOOPS; while (thisEUN < inftl->nb_blocks) { for (block = 0; block < inftl->EraseSize/SECTORSIZE; block++) { if (BlockUsed[block] || BlockDeleted[block]) continue; if (inftl_read_oob(mtd, (thisEUN * inftl->EraseSize) + (block * SECTORSIZE), 8 , &retlen, (char *)&bci) < 0) status = SECTOR_IGNORE; else status = bci.Status | bci.Status1; switch(status) { case SECTOR_FREE: case SECTOR_IGNORE: break; case SECTOR_USED: BlockUsed[block] = 1; continue; case SECTOR_DELETED: BlockDeleted[block] = 1; continue; default: printk(KERN_WARNING "INFTL: unknown status " "for block %d in EUN %d: 0x%x\n", block, thisEUN, status); } } if (!silly--) { printk(KERN_WARNING "INFTL: infinite loop in Virtual " "Unit Chain 0x%x\n", thisVUC); return; } thisEUN = inftl->PUtable[thisEUN]; } for (block = 0; block < inftl->EraseSize/SECTORSIZE; block++) if (BlockUsed[block]) return; /* * For each block in the chain free it and make it available * for future use. Erase from the oldest unit first. */ pr_debug("INFTL: deleting empty VUC %d\n", thisVUC); for (;;) { u16 *prevEUN = &inftl->VUtable[thisVUC]; thisEUN = *prevEUN; /* If the chain is all gone already, we're done */ if (thisEUN == BLOCK_NIL) { pr_debug("INFTL: Empty VUC %d for deletion was already absent\n", thisEUN); return; } /* Find oldest unit in chain. */ while (inftl->PUtable[thisEUN] != BLOCK_NIL) { BUG_ON(thisEUN >= inftl->nb_blocks); prevEUN = &inftl->PUtable[thisEUN]; thisEUN = *prevEUN; } pr_debug("Deleting EUN %d from VUC %d\n", thisEUN, thisVUC); if (INFTL_formatblock(inftl, thisEUN) < 0) { /* * Could not erase : mark block as reserved. */ inftl->PUtable[thisEUN] = BLOCK_RESERVED; } else { /* Correctly erased : mark it as free */ inftl->PUtable[thisEUN] = BLOCK_FREE; inftl->numfreeEUNs++; } /* Now sort out whatever was pointing to it... */ *prevEUN = BLOCK_NIL; /* Ideally we'd actually be responsive to new requests while we're doing this -- if there's free space why should others be made to wait? */ cond_resched(); } inftl->VUtable[thisVUC] = BLOCK_NIL; }
true
true
false
false
false
1
get_rel_oids(Oid relid, const RangeVar *vacrel, const char *stmttype) { List *oid_list = NIL; MemoryContext oldcontext; /* OID supplied by VACUUM's caller? */ if (OidIsValid(relid)) { oldcontext = MemoryContextSwitchTo(vac_context); oid_list = lappend_oid(oid_list, relid); MemoryContextSwitchTo(oldcontext); } else if (vacrel) { /* Process a specific relation */ Oid relid; relid = RangeVarGetRelid(vacrel, false); /* Make a relation list entry for this guy */ oldcontext = MemoryContextSwitchTo(vac_context); oid_list = lappend_oid(oid_list, relid); MemoryContextSwitchTo(oldcontext); } else { /* Process all plain relations listed in pg_class */ Relation pgclass; HeapScanDesc scan; HeapTuple tuple; ScanKeyData key; ScanKeyInit(&key, Anum_pg_class_relkind, BTEqualStrategyNumber, F_CHAREQ, CharGetDatum(RELKIND_RELATION)); pgclass = heap_open(RelationRelationId, AccessShareLock); scan = heap_beginscan(pgclass, SnapshotNow, 1, &key); while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL) { /* Make a relation list entry for this guy */ oldcontext = MemoryContextSwitchTo(vac_context); oid_list = lappend_oid(oid_list, HeapTupleGetOid(tuple)); MemoryContextSwitchTo(oldcontext); } heap_endscan(scan); heap_close(pgclass, AccessShareLock); } return oid_list; }
false
false
false
false
false
0
detach(){ FXShell::detach(); if(icon) icon->detach(); if(miniIcon) miniIcon->detach(); }
false
false
false
false
false
0
flex_regcomp(regex_t *preg, const char *regex, int cflags) { int err; memset (preg, 0, sizeof (regex_t)); if ((err = regcomp (preg, regex, cflags)) != 0) { const int errbuf_sz = 200; char *errbuf, *rxerr; errbuf = (char*)flex_alloc(errbuf_sz *sizeof(char)); if (!errbuf) flexfatal(_("Unable to allocate buffer to report regcomp")); rxerr = (char*)flex_alloc(errbuf_sz *sizeof(char)); if (!rxerr) flexfatal(_("Unable to allocate buffer for regerror")); regerror (err, preg, rxerr, errbuf_sz); snprintf (errbuf, errbuf_sz, "regcomp for \"%s\" failed: %s", regex, rxerr); flexfatal (errbuf); free(errbuf); free(rxerr); } }
false
false
false
false
false
0
updateConfigFilesIfNeeded(const std::string& rc_file) { const int CONFIG_VERSION = 13; // TODO: move this to 'defaults.hh' or 'config.h' FbTk::ResourceManager r_mgr(rc_file.c_str(), false); FbTk::Resource<int> c_version(r_mgr, 0, "session.configVersion", "Session.ConfigVersion"); if (!r_mgr.load(rc_file.c_str())) { _FB_USES_NLS; cerr << _FB_CONSOLETEXT(Fluxbox, CantLoadRCFile, "Failed to load database", "") << ": " << rc_file << endl; return; } if (*c_version < CONFIG_VERSION) { fbdbg << "updating config files from version " << *c_version << " to " << CONFIG_VERSION << endl; string commandargs = realProgramName("fluxbox-update_configs"); commandargs += " -rc " + rc_file; if (system(commandargs.c_str())) { fbdbg << "running '" << commandargs << "' failed." << endl; } #ifdef HAVE_SYNC sync(); #endif // HAVE_SYNC } }
false
false
false
false
false
0
set_link_ipg(struct hfi1_pportdata *ppd) { struct hfi1_devdata *dd = ppd->dd; struct cc_state *cc_state; int i; u16 cce, ccti_limit, max_ccti = 0; u16 shift, mult; u64 src; u32 current_egress_rate; /* Mbits /sec */ u32 max_pkt_time; /* * max_pkt_time is the maximum packet egress time in units * of the fabric clock period 1/(805 MHz). */ cc_state = get_cc_state(ppd); if (cc_state == NULL) /* * This should _never_ happen - rcu_read_lock() is held, * and set_link_ipg() should not be called if cc_state * is NULL. */ return; for (i = 0; i < OPA_MAX_SLS; i++) { u16 ccti = ppd->cca_timer[i].ccti; if (ccti > max_ccti) max_ccti = ccti; } ccti_limit = cc_state->cct.ccti_limit; if (max_ccti > ccti_limit) max_ccti = ccti_limit; cce = cc_state->cct.entries[max_ccti].entry; shift = (cce & 0xc000) >> 14; mult = (cce & 0x3fff); current_egress_rate = active_egress_rate(ppd); max_pkt_time = egress_cycles(ppd->ibmaxlen, current_egress_rate); src = (max_pkt_time >> shift) * mult; src &= SEND_STATIC_RATE_CONTROL_CSR_SRC_RELOAD_SMASK; src <<= SEND_STATIC_RATE_CONTROL_CSR_SRC_RELOAD_SHIFT; write_csr(dd, SEND_STATIC_RATE_CONTROL, src); }
false
false
false
false
false
0
remap_colors( int num, int addr, int data ) { /* this is the protection. color codes are shuffled around */ /* the ones with value 0xff are unknown */ if ( addr >= 0x3f00 ) { int newdata = remapped_colortable[ data & 0x3f ]; if ( newdata != 0xff ) data = newdata; #ifdef MAME_DEBUG else usrintf_showmessage( "Unmatched color %02x, at address %04x", data & 0x3f, addr ); #endif } return data; }
false
false
false
false
false
0
command_from(const char *cmd) { STACK_CONTEXT *sc = GB_DEBUG.GetStack(0); //STACK_get_current(); if (sc && sc->pc) { GB.Signal(GB_SIGNAL_DEBUG_FORWARD, 0); DEBUG_info.stop = TRUE; DEBUG_info.leave = FALSE; DEBUG_info.fp = sc->fp; DEBUG_info.bp = sc->bp; } else { GB.Signal(GB_SIGNAL_DEBUG_FORWARD, 0); DEBUG_info.stop = TRUE; DEBUG_info.leave = TRUE; DEBUG_info.fp = FP; DEBUG_info.bp = BP; } }
false
false
false
false
false
0
cpl_propertylist_load(const char *name, cpl_size position) { cxint status = 0; cpl_propertylist *self; cpl_error_code code; fitsfile *file = NULL; if (name == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } if ((position < 0) || (position > CX_MAXINT)) { cpl_error_set_(CPL_ERROR_ILLEGAL_INPUT); return NULL; } if (cpl_io_fits_open_diskfile(&file, name, READONLY, &status)) { (void)cpl_error_set_fits(status == FILE_NOT_OPENED ? CPL_ERROR_FILE_IO : CPL_ERROR_BAD_FILE_FORMAT, status, fits_open_diskfile, "filename='%s', " "position=%d", name, (cxint)position); return NULL; } self = cpl_propertylist_new(); code = _cpl_propertylist_fill_from_fits(self, file, (cxint)position, NULL, NULL); if (cpl_io_fits_close_file(file, &status)) { code = cpl_error_set_fits(CPL_ERROR_BAD_FILE_FORMAT, status, fits_close_file, "filename='%s', " "position=%d", name, (cxint)position); } else if (code) { /* * Propagate error */ cpl_error_set_where_(); } if (code) { cpl_propertylist_delete(self); self = NULL; } return self; }
false
false
false
false
false
0
on_tree_view_staged_drag_data_received (GtkWidget *widget, GdkDragContext *drag_context, gint x, gint y, GtkSelectionData *data, guint info, guint time, GitgCommitView *view) { /* Stage all the files dropped on this */ gchar **uris = gtk_selection_data_get_uris (data); gchar **uri; for (uri = uris; *uri; ++uri) { GFile *file = g_file_new_for_uri (*uri); GitgChangedFile *f; f = gitg_commit_find_changed_file (view->priv->commit, file); if (f && (gitg_changed_file_get_changes (f) & GITG_CHANGED_FILE_CHANGES_UNSTAGED)) { gitg_commit_stage (view->priv->commit, f, NULL, NULL); } g_object_unref (f); g_object_unref (file); } }
false
false
false
false
false
0
gwy_data_field_number_grains(GwyDataField *mask_field, gint *grains) { const gdouble *data; gint xres, yres, i, j, grain_id, max_id, id; gint *m, *mm; xres = mask_field->xres; yres = mask_field->yres; data = mask_field->data; /* The max number of grains, reached with checkerboard pattern */ m = g_new0(gint, (xres*yres + 1)/2 + 1); /* Number grains with simple unidirectional grain number propagation, * updating map m for later full grain join */ max_id = 0; /* Special-case first row for which no top row exist to avoid testing * i > 0 below */ grain_id = 0; for (j = 0; j < xres; j++) { if (data[j] > 0.0) { if (!grain_id) { grain_id = ++max_id; m[grain_id] = grain_id; } grains[j] = grain_id; } else grain_id = 0; } /* The rest of rows */ for (i = 1; i < yres; i++) { grain_id = 0; for (j = 0; j < xres; j++) { if (data[i*xres + j] > 0.0) { /* Grain number is kept from left neighbour unless it does * not exist (a new number is assigned) or a join with top * neighbour occurs (m is updated) */ if ((id = grains[(i - 1)*xres + j])) { if (!grain_id) grain_id = id; else if (id != grain_id) { resolve_grain_map(m, id, grain_id); grain_id = m[id]; } } if (!grain_id) { grain_id = ++max_id; m[grain_id] = grain_id; } grains[i*xres + j] = grain_id; } else grain_id = 0; } } /* Resolve remianing grain number links in map */ for (i = 1; i <= max_id; i++) m[i] = m[m[i]]; /* Compactify grain numbers */ mm = g_new0(gint, max_id + 1); id = 0; for (i = 1; i <= max_id; i++) { if (!mm[m[i]]) { id++; mm[m[i]] = id; } m[i] = mm[m[i]]; } g_free(mm); /* Renumber grains (we make use of the fact m[0] = 0) */ for (i = 0; i < xres*yres; i++) grains[i] = m[grains[i]]; g_free(m); return id; }
false
false
false
false
false
0
clearPaths() { // Iterate and clean up all allocated data ListIterator<PathReference*> it; it.begin(references_); while(!it.atLast()) { deAllocateReference(*it); delete *it; ++it; } // Paranoia? it.begin(newReferences_); while(!it.atLast()) { deAllocateReference(*it); delete *it; ++it; } references_.clear(); newReferences_.clear(); targetUpdated_ = true; }
false
false
false
false
false
0
primary_expression(int mode, Value * v) { if (text_sy == '(') { next_sy(); expression(mode, v); if (text_sy != ')') error(ERR_INV_EXPRESSION, "Missing ')'"); next_sy(); } else if (text_sy == SY_VAL) { if (mode != MODE_SKIP) *v = text_val; next_sy(); } else if (text_sy == SY_ID) { if (mode != MODE_SKIP) { int sym_class = identifier((char *)text_val.value, v); if (sym_class == SYM_CLASS_UNKNOWN) error(errno, "Undefined identifier '%s'", text_val.value); if (sym_class == SYM_CLASS_TYPE) error(ERR_INV_EXPRESSION, "Illegal usage of type '%s'", text_val.value); } next_sy(); } else { error(ERR_INV_EXPRESSION, "Syntax error"); } }
false
false
false
false
false
0
opal_compress_gzip_decompress_nb(char * cname, char **fname, pid_t *child_pid) { char * cmd = NULL; char **argv = NULL; char * dir_cname = NULL; pid_t loc_pid = 0; int status; bool is_tar; if( 0 == strncmp(&(cname[strlen(cname)-7]), ".tar.gz", strlen(".tar.gz")) ) { is_tar = true; } *fname = strdup(cname); if( is_tar ) { /* Strip off '.tar.gz' */ (*fname)[strlen(cname)-7] = '\0'; } else { /* Strip off '.gz' */ (*fname)[strlen(cname)-3] = '\0'; } opal_output_verbose(10, mca_compress_gzip_component.super.output_handle, "compress:gzip: decompress_nb(%s -> [%s])", cname, *fname); *child_pid = fork(); if( *child_pid == 0 ) { /* Child */ dir_cname = opal_dirname(cname); chdir(dir_cname); /* Fork(gunzip) */ loc_pid = fork(); if( loc_pid == 0 ) { /* Child */ asprintf(&cmd, "gunzip %s", cname); opal_output_verbose(10, mca_compress_gzip_component.super.output_handle, "compress:gzip: decompress_nb() command [%s]", cmd); argv = opal_argv_split(cmd, ' '); status = execvp(argv[0], argv); opal_output(0, "compress:gzip: decompress_nb: Failed to exec child [%s] status = %d\n", cmd, status); exit(OPAL_ERROR); } else if( loc_pid > 0 ) { /* Parent */ waitpid(loc_pid, &status, 0); if( !WIFEXITED(status) ) { opal_output(0, "compress:gzip: decompress_nb: Failed to bunzip the file [%s] status = %d\n", cname, status); exit(OPAL_ERROR); } } else { exit(OPAL_ERROR); } /* tar_decompress */ if( is_tar ) { /* Strip off '.gz' leaving just '.tar' */ cname[strlen(cname)-3] = '\0'; opal_compress_base_tar_extract(&cname); } /* Once this child is done, then directly exit */ exit(OPAL_SUCCESS); } else if( *child_pid > 0 ) { ; } else { return OPAL_ERROR; } if( NULL != cmd ) { free(cmd); cmd = NULL; } return OPAL_SUCCESS; }
false
false
false
false
true
1
Download(const std::string &filename, std::string url, IO_MODE outputMode, curl_progress_callback fprogress, void * fprogress_data, const char* authentication) { std::string URL = url; if(!m_ServerUrl.empty()) { URL = m_ServerUrl + URL; } m_OutputMode = outputMode; // prepare output switch(m_OutputMode) { case BUFFER : ResetOutputBuffer(); break; case FILE : this->output_filestream = new std::ofstream; this->output_filestream->open(filename.c_str(), std::ios::binary); if(!this->output_filestream->is_open()) { std::cerr << "Cannot open local file for writing: " << filename.c_str() << std::endl; return false; } break; } curl_easy_reset(m_cURL); this->SetCurlOptions(URL.c_str(), authentication); curl_easy_setopt(m_cURL, CURLOPT_HTTPGET, 1); curl_easy_setopt(m_cURL, CURLOPT_PROGRESSDATA, fprogress_data == NULL ? this->fprogress_data : fprogress_data); curl_easy_setopt(m_cURL, CURLOPT_PROGRESSFUNCTION, fprogress == NULL ? this->fprogress : fprogress); bool success = this->PerformCurl(); switch(m_OutputMode) { case BUFFER : break; case FILE : this->output_filestream->close(); this->output_filestream = NULL; break; } return success; }
false
false
false
false
false
0
vn_nary_may_trap (vn_nary_op_t nary) { tree type; tree rhs2 = NULL_TREE; bool honor_nans = false; bool honor_snans = false; bool fp_operation = false; bool honor_trapv = false; bool handled, ret; unsigned i; if (TREE_CODE_CLASS (nary->opcode) == tcc_comparison || TREE_CODE_CLASS (nary->opcode) == tcc_unary || TREE_CODE_CLASS (nary->opcode) == tcc_binary) { type = nary->type; fp_operation = FLOAT_TYPE_P (type); if (fp_operation) { honor_nans = flag_trapping_math && !flag_finite_math_only; honor_snans = flag_signaling_nans != 0; } else if (INTEGRAL_TYPE_P (type) && TYPE_OVERFLOW_TRAPS (type)) honor_trapv = true; } if (nary->length >= 2) rhs2 = nary->op[1]; ret = operation_could_trap_helper_p (nary->opcode, fp_operation, honor_trapv, honor_nans, honor_snans, rhs2, &handled); if (handled && ret) return true; for (i = 0; i < nary->length; ++i) if (tree_could_trap_p (nary->op[i])) return true; return false; }
false
false
false
false
true
1
direntry_remove(struct dinode *parent_inoptr, uint32_t child_inonum) { int rd_rc = FSCK_OK; UniChar uniname[JFS_NAME_MAX]; int uniname_length; struct component_name uniname_struct; rd_rc = direntry_get_objnam(parent_inoptr->di_number, child_inonum, &uniname_length, &(uniname[0])); if (rd_rc == FSCK_OK) { uniname_struct.namlen = uniname_length; uniname_struct.name = &(uniname[0]); rd_rc = fsck_dtDelete(parent_inoptr, &uniname_struct, &child_inonum); if (rd_rc == FSCK_OK) { rd_rc = inode_put(parent_inoptr); } else { fsck_send_msg(fsck_INTERNALERROR, FSCK_INTERNAL_ERROR_61, rd_rc, child_inonum, parent_inoptr->di_number); rd_rc = FSCK_INTERNAL_ERROR_61; } } else { fsck_send_msg(fsck_INTERNALERROR, FSCK_INTERNAL_ERROR_62, rd_rc, child_inonum, parent_inoptr->di_number); rd_rc = FSCK_INTERNAL_ERROR_62; } return (rd_rc); }
false
false
false
false
false
0
Vect_select_areas_by_box(struct Map_info *Map, BOUND_BOX * Box, struct ilist *list) { int i; G_debug(3, "Vect_select_areas_by_box()"); G_debug(3, "Box(N,S,E,W,T,B): %e, %e, %e, %e, %e, %e", Box->N, Box->S, Box->E, Box->W, Box->T, Box->B); if (!(Map->plus.Spidx_built)) { G_debug(3, "Building spatial index."); Vect_build_sidx_from_topo(Map); } dig_select_areas(&(Map->plus), Box, list); G_debug(3, " %d areas selected", list->n_values); for (i = 0; i < list->n_values; i++) { G_debug(3, " area = %d pointer to area structure = %lx", list->value[i], (unsigned long)Map->plus.Area[list->value[i]]); } return list->n_values; }
false
false
false
false
false
0
ar5523_get_capability(struct ar5523 *ar, u32 cap, u32 *val) { int error; __be32 cap_be, val_be; cap_be = cpu_to_be32(cap); error = ar5523_cmd_read(ar, WDCMSG_TARGET_GET_CAPABILITY, &cap_be, sizeof(cap_be), &val_be, sizeof(__be32), AR5523_CMD_FLAG_MAGIC); if (error != 0) { ar5523_err(ar, "could not read capability %u\n", cap); return error; } *val = be32_to_cpu(val_be); return error; }
false
false
false
false
false
0
jl_prepare_ast(jl_lambda_info_t *li, jl_tuple_t *sparams) { jl_tuple_t *spenv = NULL; jl_value_t *l_ast = li->ast; if (l_ast == NULL) return NULL; jl_value_t *ast = l_ast; JL_GC_PUSH(&spenv, &ast); if (jl_is_tuple(ast)) ast = jl_uncompress_ast((jl_tuple_t*)ast); spenv = jl_tuple_tvars_to_symbols(sparams); ast = copy_ast(ast, sparams); eval_decl_types(jl_lam_vinfo((jl_expr_t*)ast), spenv); eval_decl_types(jl_lam_capt((jl_expr_t*)ast), spenv); JL_GC_POP(); return ast; }
false
false
false
false
false
0
tda827xa_sleep(struct dvb_frontend *fe) { struct tda827x_priv *priv = fe->tuner_priv; static u8 buf[] = { 0x30, 0x90 }; struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0, .buf = buf, .len = sizeof(buf) }; dprintk("%s:\n", __func__); tuner_transfer(fe, &msg, 1); if (priv->cfg && priv->cfg->sleep) priv->cfg->sleep(fe); return 0; }
false
false
false
false
false
0
camlidl_environment_ap_environment_var_of_dim( value _v_e, value _v_dim) { ap_environment_ptr e; /*in*/ ap_dim_t dim; /*in*/ ap_var_t _res; value _vres; struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL }; camlidl_ctx _ctx = &_ctxs; camlidl_ml2c_environment_ap_environment_ptr(_v_e, &e, _ctx); camlidl_ml2c_dim_ap_dim_t(_v_dim, &dim, _ctx); /* begin user-supplied calling sequence */ if (dim>=e->intdim+e->realdim){ caml_failwith("Environment.var_of_dim: dim out of range w.r.t. the environment"); } _res = ap_var_operations->copy(e->var_of_dim[dim]); /* end user-supplied calling sequence */ _vres = camlidl_c2ml_var_ap_var_t(&_res, _ctx); camlidl_free(_ctx); return _vres; }
false
false
false
false
false
0
get_max_para_of_seq_blocks( Block *bpt, Hmdf_information *hmdf_info_list, Module_hmdf_information *module_hmdf_info_list ) { int inner_max_para; Block *inner_bpt; Hmdf_information *inner_hmdf_info; inner_max_para = 1; for( inner_bpt = bpt->inner; inner_bpt; inner_bpt = inner_bpt->next ){ if( inner_bpt->kind == SB || inner_bpt->kind == RB || (inner_bpt->kind == LOOP && (!(inner_bpt->change_flg) || inner_bpt->change_kind == LOOP)) ){ inner_hmdf_info = scan_hmdf_info_all_module( inner_bpt, hmdf_info_list, module_hmdf_info_list ); if( inner_hmdf_info != NULL && inner_hmdf_info->max_para > inner_max_para ){ inner_max_para = inner_hmdf_info->max_para; } } } return( inner_max_para ); }
false
false
false
false
false
0
cf(const NEWMAT::ColumnVector& p)const{ //cout<<"CF"<<endl; //OUT(p.t()); double cfv = 0.0; double err; float _a = std::abs(p(2)); float _b = std::abs(p(3)); //////////////////////////////////// ColumnVector fs(nfib); Matrix x(nfib,3); float sumf=0; for(int k=1;k<=nfib;k++){ int kk = 4+3*(k-1); fs(k) = x2f(p(kk)); sumf += fs(k); x(k,1) = sin(p(kk+1))*cos(p(kk+2)); x(k,2) = sin(p(kk+1))*sin(p(kk+2)); x(k,3) = cos(p(kk+1)); } //////////////////////////////////// for(int i=1;i<=Y.Nrows();i++){ err = 0.0; for(int k=1;k<=nfib;k++){ err += fs(k)*anisoterm(i,_a,_b,x.Row(k).t()); } if (m_include_f0){ float temp_f0=x2f(p(nparams)); err = (std::abs(p(1))*(temp_f0+(1-sumf-temp_f0)*isoterm(i,_a,_b)+err) - Y(i)); } else err = (std::abs(p(1))*((1-sumf)*isoterm(i,_a,_b)+err) - Y(i)); cfv += err*err; } //OUT(cfv); //cout<<"----"<<endl; return(cfv); }
false
false
false
false
false
0
animate_fade(gpointer ptr){ Gameboard *g = (Gameboard *)ptr; fade_state *f = &g->fade; f->count--; if(f->count>0){ fade_list *l = f->head; while(l){ invalidate_vertex(g,l->v); l=l->next; } return 1; } fade_cancel(g); return 0; }
false
false
false
false
false
0
aln_init(glam2_aln *aln, int seq_num, int max_width, int alph_size) { int i; aln->seq_num = seq_num; XMALLOC(aln->cols, max_width); for (i = 0; i < max_width; ++i) col_init(&aln->cols[i], seq_num, alph_size); XMALLOC(aln->strands, seq_num); XMALLOC(aln->insert_counts, max_width); /* back is unused */ }
false
false
false
false
false
0
__Pyx_SetVtable(PyObject *dict, void *vtable) { #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) PyObject *ob = PyCapsule_New(vtable, 0, 0); #else PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); #endif if (!ob) goto bad; if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) goto bad; Py_DECREF(ob); return 0; bad: Py_XDECREF(ob); return -1; }
false
false
false
false
false
0
show (bool only_valids) { if (pr == NULL) return; for (int j = 0; j < n_decls; j++) { if (!only_valids || decls[j].state == valid) { if (only_valids) pr->info ("%: %n", decls[j].d, decls[j].d); else pr->info ("%: %n (%s %d)", decls[j].d, decls[j].d, item_state[decls[j].state], decls[j].cost); } } }
false
false
false
false
false
0
m2bus_serial_open(struct gn_statemachine *state) { int type; if (!state) return false; if (state->config.connection_type == GN_CT_TCP) type = GN_CT_TCP; else type = GN_CT_Serial; /* Open device. */ if (!device_open(state->config.port_device, true, false, false, type, state)) { perror(_("Couldn't open M2BUS device")); return false; } device_changespeed(9600, state); device_setdtrrts(0, 1, state); return true; }
false
false
false
false
false
0
GetHeight(float x, float y, float z) const { float staticHeight = m_TerrainData->GetHeightStatic(x, y, z); // Get Dynamic Height around static Height (if valid) float dynSearchHeight = 2.0f + (z < staticHeight ? staticHeight : z); return std::max<float>(staticHeight, m_dyn_tree.getHeight(x, y, dynSearchHeight, dynSearchHeight - staticHeight)); }
false
false
false
false
false
0
exporthtml_fmt_fullname( ExportHtmlCtl *ctl, gchar *buf, const ItemPerson *person ) { gboolean flag; if( ctl->nameFormat == EXPORT_HTML_LAST_FIRST ) { flag = FALSE; if( person->lastName ) { if( *person->lastName ) { strcat( buf, " " ); strcat( buf, person->lastName ); flag = TRUE; } } if( person->firstName ) { if( *person->firstName ) { if( flag ) { strcat( buf, ", " ); } strcat( buf, person->firstName ); } } } else { if( person->firstName ) { if( *person->firstName ) { strcat( buf, person->firstName ); } } if( person->lastName ) { if( *person->lastName ) { strcat( buf, " " ); strcat( buf, person->lastName ); } } } g_strstrip( buf ); flag = FALSE; if( *buf ) flag = TRUE; if( person->nickName ) { if( strlen( person->nickName ) ) { if( flag ) { strcat( buf, " (" ); } strcat( buf, person->nickName ); if( flag ) { strcat( buf, ")" ); } } } g_strstrip( buf ); }
false
false
false
false
false
0
gl_field_button_menu_set_keys (glFieldButtonMenu *this, GList *key_list) { GList *p; GtkWidget *menu_item; gchar *key; gint i, i_row, i_col; gl_debug (DEBUG_FIELD_BUTTON, "START"); /* * Remove all old menu items. */ for ( p = this->priv->menu_items; p != NULL; p = p->next ) { menu_item = GTK_WIDGET (p->data); key = g_object_get_data (G_OBJECT (menu_item), "key"); g_free (key); gtk_container_remove (GTK_CONTAINER (this), menu_item); } g_list_free (this->priv->menu_items); this->priv->menu_items = NULL; gtk_widget_unrealize (GTK_WIDGET (this)); /* Start over with new Gdk resources. */ /* * Add new menu items. */ for ( p = key_list, i = 0; p != NULL; p = p->next, i++ ) { if ( p->data && strlen (p->data) ) { gl_debug (DEBUG_FIELD_BUTTON, "Adding key: %s", p->data); menu_item = gtk_menu_item_new_with_label (p->data); gtk_widget_show (menu_item); g_object_set_data (G_OBJECT (menu_item), "key", g_strdup (p->data)); g_signal_connect (G_OBJECT (menu_item), "activate", G_CALLBACK (activate_cb), this); this->priv->menu_items = g_list_append (this->priv->menu_items, menu_item); i_row = i % MAX_MENU_ROWS; i_col = i / MAX_MENU_ROWS; gtk_menu_attach (GTK_MENU (this), menu_item, i_col, i_col+1, i_row, i_row+1); } } gl_debug (DEBUG_FIELD_BUTTON, "END"); }
false
false
false
false
false
0
dio_ReadUnit(DIO_UnitDescriptor * Unit, DIO_EntryCallBack CallBack) { memset(Unit, 0, sizeof(DIO_UnitDescriptor)); sUnit = Unit; sUnit->mFile = sSection->file; sUnit->mSection = sSection; sUnit->mUnitOffs = dio_GetPos(); sUnit->m64bit = 0; if (strcmp(sSection->name, ".debug") != 0) { ELF_Section * Sect = NULL; sUnit->mUnitSize = dio_ReadU4(); if (sUnit->mUnitSize == 0xffffffffu) { sUnit->m64bit = 1; sUnit->mUnitSize = dio_ReadU8(); sUnit->mUnitSize += 12; } else { sUnit->mUnitSize += 4; } sUnit->mVersion = dio_ReadU2(); sUnit->mAbbrevTableOffs = (U4_T)dio_ReadAddressX(&Sect, 4); sUnit->mAddressSize = dio_ReadU1(); dio_FindAbbrevTable(); } else { sUnit->mVersion = 1; sUnit->mAddressSize = 4; } while (sUnit->mUnitSize == 0 || dio_GetPos() < sUnit->mUnitOffs + sUnit->mUnitSize) { dio_ReadEntry(CallBack); } sUnit = NULL; }
false
false
false
false
false
0
add_numeric_col_info_to_list( const GncSqlBackend* be, const GncSqlColumnTableEntry* table_row, GList** pList ) { GncSqlColumnInfo* info; gchar* buf; const GncSqlColumnTableEntry* subtable_row; g_return_if_fail( be != NULL ); g_return_if_fail( table_row != NULL ); g_return_if_fail( pList != NULL ); for ( subtable_row = numeric_col_table; subtable_row->col_name != NULL; subtable_row++ ) { buf = g_strdup_printf( "%s_%s", table_row->col_name, subtable_row->col_name ); info = g_new0( GncSqlColumnInfo, 1 ); g_assert( info != NULL ); info->name = buf; info->type = BCT_INT64; info->is_primary_key = ((table_row->flags & COL_PKEY) != 0) ? TRUE : FALSE; info->null_allowed = ((table_row->flags & COL_NNUL) != 0) ? FALSE : TRUE; info->is_unicode = FALSE; *pList = g_list_append( *pList, info ); } }
false
false
false
false
false
0
isInLineSection( const TaggedLineString* line, const vector<std::size_t>& sectionIndex, const TaggedLineSegment* seg) { // not in this line if (seg->getParent() != line->getParent()) return false; std::size_t segIndex = seg->getIndex(); if (segIndex >= sectionIndex[0] && segIndex < sectionIndex[1]) return true; return false; }
false
false
false
false
false
0
sigbuffer_make_room (SigBuffer *buf, int size) { if (buf->end - buf->p < size) { int new_size = buf->end - buf->buf + size + 32; char *p = g_realloc (buf->buf, new_size); size = buf->p - buf->buf; buf->buf = p; buf->p = p + size; buf->end = buf->buf + new_size; } }
false
false
false
false
false
0
apply(CEGUI::PropertySet& target) const { CEGUI_TRY { target.setProperty(d_propertyName, d_propertyValue); } // allow 'missing' properties CEGUI_CATCH (UnknownObjectException&) {} }
false
false
false
false
false
0
gfs2_log_flush_bio(struct gfs2_sbd *sdp, int rw) { if (sdp->sd_log_bio) { atomic_inc(&sdp->sd_log_in_flight); submit_bio(rw, sdp->sd_log_bio); sdp->sd_log_bio = NULL; } }
false
false
false
false
false
0
_rl_nsearch_dosearch (cxt) _rl_search_cxt *cxt; { rl_mark = cxt->save_mark; /* If rl_point == 0, we want to re-use the previous search string and start from the saved history position. If there's no previous search string, punt. */ if (rl_point == 0) { if (noninc_search_string == 0) { rl_ding (); rl_restore_prompt (); RL_UNSETSTATE (RL_STATE_NSEARCH); return -1; } } else { /* We want to start the search from the current history position. */ noninc_history_pos = cxt->save_line; FREE (noninc_search_string); noninc_search_string = savestring (rl_line_buffer); /* If we don't want the subsequent undo list generated by the search matching a history line to include the contents of the search string, we need to clear rl_line_buffer here. For now, we just clear the undo list generated by reading the search string. (If the search fails, the old undo list will be restored by rl_maybe_unsave_line.) */ rl_free_undo_list (); } rl_restore_prompt (); return (noninc_dosearch (noninc_search_string, cxt->direction)); }
false
false
false
false
false
0
setInitialStateToUnicodeKR(UConverter* /*converter*/, UConverterDataISO2022 *myConverterData){ if(myConverterData->version == 1) { UConverter *cnv = myConverterData->currentConverter; cnv->toUnicodeStatus=0; /* offset */ cnv->mode=0; /* state */ cnv->toULength=0; /* byteIndex */ } }
false
false
false
false
false
0
ar5523_submit_rx_cmd(struct ar5523 *ar) { int error; usb_fill_bulk_urb(ar->rx_cmd_urb, ar->dev, ar5523_cmd_rx_pipe(ar->dev), ar->rx_cmd_buf, AR5523_MAX_RXCMDSZ, ar5523_cmd_rx_cb, ar); ar->rx_cmd_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; error = usb_submit_urb(ar->rx_cmd_urb, GFP_ATOMIC); if (error) { if (error != -ENODEV) ar5523_err(ar, "error %d when submitting rx urb\n", error); return error; } return 0; }
false
false
false
false
false
0
ath5k_hw_gainf_calibrate(struct ath5k_hw *ah) { u32 data, type; struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; if (ah->ah_rf_banks == NULL || ah->ah_gain.g_state == AR5K_RFGAIN_INACTIVE) return AR5K_RFGAIN_INACTIVE; /* No check requested, either engine is inactive * or an adjustment is already requested */ if (ah->ah_gain.g_state != AR5K_RFGAIN_READ_REQUESTED) goto done; /* Read the PAPD (Peak to Average Power Detector) * register */ data = ath5k_hw_reg_read(ah, AR5K_PHY_PAPD_PROBE); /* No probe is scheduled, read gain_F measurement */ if (!(data & AR5K_PHY_PAPD_PROBE_TX_NEXT)) { ah->ah_gain.g_current = data >> AR5K_PHY_PAPD_PROBE_GAINF_S; type = AR5K_REG_MS(data, AR5K_PHY_PAPD_PROBE_TYPE); /* If tx packet is CCK correct the gain_F measurement * by cck ofdm gain delta */ if (type == AR5K_PHY_PAPD_PROBE_TYPE_CCK) { if (ah->ah_radio_5ghz_revision >= AR5K_SREV_RAD_5112A) ah->ah_gain.g_current += ee->ee_cck_ofdm_gain_delta; else ah->ah_gain.g_current += AR5K_GAIN_CCK_PROBE_CORR; } /* Further correct gain_F measurement for * RF5112A radios */ if (ah->ah_radio_5ghz_revision >= AR5K_SREV_RAD_5112A) { ath5k_hw_rf_gainf_corr(ah); ah->ah_gain.g_current = ah->ah_gain.g_current >= ah->ah_gain.g_f_corr ? (ah->ah_gain.g_current-ah->ah_gain.g_f_corr) : 0; } /* Check if measurement is ok and if we need * to adjust gain, schedule a gain adjustment, * else switch back to the acive state */ if (ath5k_hw_rf_check_gainf_readback(ah) && AR5K_GAIN_CHECK_ADJUST(&ah->ah_gain) && ath5k_hw_rf_gainf_adjust(ah)) { ah->ah_gain.g_state = AR5K_RFGAIN_NEED_CHANGE; } else { ah->ah_gain.g_state = AR5K_RFGAIN_ACTIVE; } } done: return ah->ah_gain.g_state; }
false
false
false
false
false
0
computeCubicForces(VibCorrections* vibCorrections) { gdouble deriv0; /* nul on well */ gdouble derivP; gdouble derivM; gint nf = vibCorrections->numberOfFrequences; gdouble f = 2*vibCorrections->delta*sqrt(AMU_TO_AU); gdouble f2 = vibCorrections->delta*vibCorrections->delta*AMU_TO_AU; gint i,j; if(nf<1) return; for(i=0;i<nf;i++) { gdouble f2m = 1/(f2*vibCorrections->mass[i]); for(j=0;j<nf;j++) { gdouble fm = 1/(f*sqrt(vibCorrections->mass[j])); deriv0 =(vibCorrections->energies[0][2*j+1]-vibCorrections->energies[0][2*j+2])*fm; derivP =(vibCorrections->energies[2*i+1][2*j+1]-vibCorrections->energies[2*i+1][2*j+2])*fm; derivM =(vibCorrections->energies[2*i+2][2*j+1]-vibCorrections->energies[2*i+2][2*j+2])*fm; vibCorrections->F[i][j] = (derivP+derivM-2*deriv0)*f2m; } } }
false
false
false
false
false
0
comWriteTable(AjPFile fp,const char *name, const EmbPComUjwin RUj,const EmbPComUjwin MedUj, const EmbPComUjwin SDUj, const EmbPComUjwin RatUj, ajint Nwin, ajint jmin, ajint jmax) { ajint i; ajint j; ajint k; ajFmtPrintF(fp,"\n"); ajFmtPrintF(fp,"Sequence: %s \n\n",name); for(j=jmin;j<=jmax;j++) ajFmtPrintF(fp,"%11s%-1d ","U",j); for(j=jmin;j<=jmax;j++) ajFmtPrintF(fp,"%5s%-1d","R",j); ajFmtPrintF(fp,"\n"); ajFmtPrintF(fp,"--------------------------------------------" "-----------------------------------------------" "----------------\n"); for(i=0;i<Nwin;i++) { ajFmtPrintF(fp,"w%-2d ",i+1); for(k=0;k<jmax-jmin+1;k++) ajFmtPrintF(fp,"%4d %5.2f+/-%-5.2f", (ajint)(RUj[i].Ujwin[k]),MedUj[i].Ujwin[k], SDUj[i].Ujwin[k]); for(k=0;k<jmax-jmin+1;k++) ajFmtPrintF(fp,"%5.2f ",RatUj[i].Ujwin[k]); ajFmtPrintF(fp,"\n"); ajFmtPrintF(fp,"\n"); } return; }
false
false
false
false
false
0
init_search (ETable *e_table) { if (e_table->search != NULL) return; e_table->search = e_table_search_new (); e_table->search_search_id = g_signal_connect ( e_table->search, "search", G_CALLBACK (et_search_search), e_table); e_table->search_accept_id = g_signal_connect ( e_table->search, "accept", G_CALLBACK (et_search_accept), e_table); }
false
false
false
false
false
0
xmlrpc_server_info_copy(xmlrpc_env *env, xmlrpc_server_info *aserver) { xmlrpc_server_info *server; char *url_copy, *auth_copy; XMLRPC_ASSERT_ENV_OK(env); XMLRPC_ASSERT_PTR_OK(aserver); /* Error-handling preconditions. */ url_copy = NULL; auth_copy = NULL; /* Allocate our memory blocks. */ server = (xmlrpc_server_info*) malloc(sizeof(xmlrpc_server_info)); XMLRPC_FAIL_IF_NULL(server, env, XMLRPC_INTERNAL_ERROR, "Couldn't allocate memory for xmlrpc_server_info"); url_copy = (char*) malloc(strlen(aserver->_server_url) + 1); XMLRPC_FAIL_IF_NULL(url_copy, env, XMLRPC_INTERNAL_ERROR, "Couldn't allocate memory for server URL"); auth_copy = (char*) malloc(strlen(aserver->_http_basic_auth) + 1); XMLRPC_FAIL_IF_NULL(auth_copy, env, XMLRPC_INTERNAL_ERROR, "Couldn't allocate memory for authentication info"); /* Build our object. */ strcpy(url_copy, aserver->_server_url); server->_server_url = url_copy; strcpy(auth_copy, aserver->_http_basic_auth); server->_http_basic_auth = auth_copy; cleanup: if (env->fault_occurred) { if (url_copy) free(url_copy); if (auth_copy) free(auth_copy); if (server) free(server); return NULL; } return server; }
false
false
false
true
true
1
mapper9_latch( offs_t offset ) { if( (offset & 0x1ff0) == 0x0fd0 && MMC2_bank_latch[0] != 0xfd ) { MMC2_bank_latch[0] = 0xfd; ppu2c03b_set_videorom_bank( 0, 0, 4, MMC2_bank[0], 256 ); } else if( (offset & 0x1ff0) == 0x0fe0 && MMC2_bank_latch[0] != 0xfe ) { MMC2_bank_latch[0] = 0xfe; ppu2c03b_set_videorom_bank( 0, 0, 4, MMC2_bank[1], 256 ); } else if( (offset & 0x1ff0) == 0x1fd0 && MMC2_bank_latch[1] != 0xfd ) { MMC2_bank_latch[1] = 0xfd; ppu2c03b_set_videorom_bank( 0, 4, 4, MMC2_bank[2], 256 ); } else if( (offset & 0x1ff0) == 0x1fe0 && MMC2_bank_latch[1] != 0xfe ) { MMC2_bank_latch[1] = 0xfe; ppu2c03b_set_videorom_bank( 0, 4, 4, MMC2_bank[3], 256 ); } }
false
false
false
false
false
0
TableListStore () : Gtk::ListStore (TableListColumns::get ()), cols (TableListColumns::get ()) { set_sort_func (cols.group, sigc::bind (sigc::mem_fun (*this, &TableListStore::on_value_sort<Int>), cols.group)); set_sort_func (cols.period, sigc::bind (sigc::mem_fun (*this, &TableListStore::on_value_sort<Int>), cols.period)); set_sort_func (cols.block, sigc::bind (sigc::mem_fun (*this, &TableListStore::on_value_sort<Block>), cols.block)); CONST_FOREACH (Table, get_table (), el) { Gtk::TreeIter j = append (); j->set_value (cols.el, *el); j->set_value (cols.number, (*el)->number); j->set_value (cols.symbol, (*el)->symbol); color color = (*el)->get_property (P_COLOR).get_color (); j->set_value (cols.color, allocate (color)); j->set_value (cols.compliment, allocate (color.get_compliment ())); j->set_value (cols.name, (*el)->get_property (P_NAME).get_string ()); j->set_value (cols.group, (*el)->get_property (P_GROUP)); j->set_value (cols.period, (*el)->get_property (P_PERIOD)); j->set_value (cols.block, (*el)->get_property (P_BLOCK)); } }
false
false
false
false
false
0
rightmostPosition(bool includeOverflowInterior, bool includeSelf) const { int right = includeSelf && m_height > 0 ? m_width : 0; if (!includeOverflowInterior && hasOverflowClip()) return right; // FIXME: Come up with a way to use the layer tree to avoid visiting all the kids. // For now, we have to descend into all the children, since we may have a huge abs div inside // a tiny rel div buried somewhere deep in our child tree. In this case we have to get to // the abs div. for (RenderObject *c = firstChild(); c; c = c->nextSibling()) { if (!c->isFloatingOrPositioned() && !c->isText() && !c->isInlineFlow()) { int rp = c->xPos() + c->rightmostPosition(false); right = qMax(right, rp); } } if (includeSelf && isRelPositioned()) { int y = 0; relativePositionOffset(right, y); } return right; }
false
false
false
false
false
0
receiveEvent(MSEvent& event_) { if (event_.type()==AplusEvent::symbol()) { if (dbg_tmstk) cout<<"Received UpdateEvent in AplusTreeView" <<endl; AplusEvent *ave=(AplusEvent *)&event_; V v =((AplusModel *)model())->aplusVar(); A index=ave->index(); A pick =ave->pick(); I ravel=ave->ravel();; update(v,index,pick,ravel); } else if (event_.type()==AplusVerifyEvent::symbol()) { if (dbg_tmstk) cout<<"Received VerifyEvent in AplusTreeView" <<endl; AplusVerifyEvent *ave=(AplusVerifyEvent *) &event_; ave->result(verifyData(ave->aplusVar(),ave->a())); } else { MSTreeView<AplusTreeItem>::receiveEvent(event_); } }
false
false
false
false
false
0
normalize( const QString &raw ) { const QRegExp spaceRegExp = QRegExp( "\\s" ); return raw.toLower().remove( spaceRegExp ).normalized( QString::NormalizationForm_KC ); }
false
false
false
false
false
0
collect_locales_from_locale_file (const char *locale_file) { FILE *langlist; char curline[256]; char *getsret; if (locale_file == NULL) return; langlist = fopen (locale_file, "r"); if (langlist == NULL) return; for (;;) { char *name; char *lang; char **lang_list; int i; getsret = fgets (curline, sizeof (curline), langlist); if (getsret == NULL) break; if (curline[0] <= ' ' || curline[0] == '#') continue; name = strtok (curline, " \t\r\n"); if (name == NULL) continue; lang = strtok (NULL, " \t\r\n"); if (lang == NULL) continue; lang_list = g_strsplit (lang, ",", -1); if (lang_list == NULL) continue; lang = NULL; for (i = 0; lang_list[i] != NULL; i++) { if (add_locale (lang_list[i], FALSE)) { break; } } g_strfreev (lang_list); } fclose (langlist); }
false
false
false
false
false
0
__pyx_pf_6Cython_8Compiler_7Visitor_15CythonTransform_4visit_CompilerDirectivesNode(struct __pyx_obj_6Cython_8Compiler_7Visitor_CythonTransform *__pyx_v_self, PyObject *__pyx_v_node) { PyObject *__pyx_v_old = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("visit_CompilerDirectivesNode", 0); /* "Cython/Compiler/Visitor.py":282 * * def visit_CompilerDirectivesNode(self, node): * old = self.current_directives # <<<<<<<<<<<<<< * self.current_directives = node.directives * self.visitchildren(node) */ __pyx_t_1 = __pyx_v_self->current_directives; __Pyx_INCREF(__pyx_t_1); __pyx_v_old = __pyx_t_1; __pyx_t_1 = 0; /* "Cython/Compiler/Visitor.py":283 * def visit_CompilerDirectivesNode(self, node): * old = self.current_directives * self.current_directives = node.directives # <<<<<<<<<<<<<< * self.visitchildren(node) * self.current_directives = old */ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_node, __pyx_n_s_directives); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->current_directives); __Pyx_DECREF(__pyx_v_self->current_directives); __pyx_v_self->current_directives = __pyx_t_1; __pyx_t_1 = 0; /* "Cython/Compiler/Visitor.py":284 * old = self.current_directives * self.current_directives = node.directives * self.visitchildren(node) # <<<<<<<<<<<<<< * self.current_directives = old * return node */ __pyx_t_1 = ((struct __pyx_vtabstruct_6Cython_8Compiler_7Visitor_CythonTransform *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.visitchildren(((struct __pyx_obj_6Cython_8Compiler_7Visitor_TreeVisitor *)__pyx_v_self), __pyx_v_node, 0, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "Cython/Compiler/Visitor.py":285 * self.current_directives = node.directives * self.visitchildren(node) * self.current_directives = old # <<<<<<<<<<<<<< * return node * */ __Pyx_INCREF(__pyx_v_old); __Pyx_GIVEREF(__pyx_v_old); __Pyx_GOTREF(__pyx_v_self->current_directives); __Pyx_DECREF(__pyx_v_self->current_directives); __pyx_v_self->current_directives = __pyx_v_old; /* "Cython/Compiler/Visitor.py":286 * self.visitchildren(node) * self.current_directives = old * return node # <<<<<<<<<<<<<< * * def visit_Node(self, node): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_node); __pyx_r = __pyx_v_node; goto __pyx_L0; /* "Cython/Compiler/Visitor.py":281 * return super(CythonTransform, self).__call__(node) * * def visit_CompilerDirectivesNode(self, node): # <<<<<<<<<<<<<< * old = self.current_directives * self.current_directives = node.directives */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("Cython.Compiler.Visitor.CythonTransform.visit_CompilerDirectivesNode", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_old); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
false
false
false
false
false
0
vee_store_rename_folder_sync (CamelStore *store, const gchar *old, const gchar *new, GCancellable *cancellable, GError **error) { CamelFolder *folder, *oldfolder; gchar *p, *name; gsize name_len; d (printf ("vee rename folder '%s' '%s'\n", old, new)); if (strcmp (old, CAMEL_UNMATCHED_NAME) == 0) { g_set_error ( error, CAMEL_STORE_ERROR, CAMEL_STORE_ERROR_NO_FOLDER, _("Cannot rename folder: %s: Invalid operation"), old); return FALSE; } /* See if it exists, for vfolders, all folders are in the folders hash */ oldfolder = camel_object_bag_get (store->folders, old); if (oldfolder == NULL) { g_set_error ( error, CAMEL_STORE_ERROR, CAMEL_STORE_ERROR_NO_FOLDER, _("Cannot rename folder: %s: No such folder"), old); return FALSE; } /* Check that new parents exist, if not, create dummy ones */ name_len = strlen (new) + 1; name = alloca (name_len); g_strlcpy (name, new, name_len); p = name; while ( (p = strchr (p, '/'))) { *p = 0; folder = camel_object_bag_reserve (store->folders, name); if (folder == NULL) { /* create a dummy vFolder for this, makes get_folder_info simpler */ folder = camel_vee_folder_new (store, name, ((CamelVeeFolder *) oldfolder)->flags); camel_object_bag_add (store->folders, name, folder); change_folder (store, name, CHANGE_ADD | CHANGE_NOSELECT, 0); /* FIXME: this sort of leaks folder, nobody owns a ref to it but us */ } else { g_object_unref (folder); } *p++='/'; } g_object_unref (oldfolder); return TRUE; }
false
false
false
false
false
0
gst_mpegts_find_descriptor (GPtrArray * descriptors, guint8 tag) { guint i, nb_desc; g_return_val_if_fail (descriptors != NULL, NULL); nb_desc = descriptors->len; for (i = 0; i < nb_desc; i++) { GstMpegTsDescriptor *desc = g_ptr_array_index (descriptors, i); if (desc->tag == tag) return (const GstMpegTsDescriptor *) desc; } return NULL; }
false
false
false
false
false
0
hfield_append(header_field_t *h, const char *text) { header_field_check(h); if (!h->lines) { h->lines = slist_new(); } slist_append(h->lines, h_strdup(text)); }
false
false
false
false
false
0
ata_scsi_hotplug(struct work_struct *work) { struct ata_port *ap = container_of(work, struct ata_port, hotplug_task.work); int i; if (ap->pflags & ATA_PFLAG_UNLOADING) { DPRINTK("ENTER/EXIT - unloading\n"); return; } /* * XXX - UGLY HACK * * The block layer suspend/resume path is fundamentally broken due * to freezable kthreads and workqueue and may deadlock if a block * device gets removed while resume is in progress. I don't know * what the solution is short of removing freezable kthreads and * workqueues altogether. * * The following is an ugly hack to avoid kicking off device * removal while freezer is active. This is a joke but does avoid * this particular deadlock scenario. * * https://bugzilla.kernel.org/show_bug.cgi?id=62801 * http://marc.info/?l=linux-kernel&m=138695698516487 */ #ifdef CONFIG_FREEZER while (pm_freezing) msleep(10); #endif DPRINTK("ENTER\n"); mutex_lock(&ap->scsi_scan_mutex); /* Unplug detached devices. We cannot use link iterator here * because PMP links have to be scanned even if PMP is * currently not attached. Iterate manually. */ ata_scsi_handle_link_detach(&ap->link); if (ap->pmp_link) for (i = 0; i < SATA_PMP_MAX_PORTS; i++) ata_scsi_handle_link_detach(&ap->pmp_link[i]); /* scan for new ones */ ata_scsi_scan_host(ap, 0); mutex_unlock(&ap->scsi_scan_mutex); DPRINTK("EXIT\n"); }
false
false
false
false
false
0
check_suggestions(su, gap) suginfo_T *su; garray_T *gap; /* either su_ga or su_sga */ { suggest_T *stp; int i; char_u longword[MAXWLEN + 1]; int len; hlf_T attr; stp = &SUG(*gap, 0); for (i = gap->ga_len - 1; i >= 0; --i) { /* Need to append what follows to check for "the the". */ vim_strncpy(longword, stp[i].st_word, MAXWLEN); len = stp[i].st_wordlen; vim_strncpy(longword + len, su->su_badptr + stp[i].st_orglen, MAXWLEN - len); attr = HLF_COUNT; (void)spell_check(curwin, longword, &attr, NULL, FALSE); if (attr != HLF_COUNT) { /* Remove this entry. */ vim_free(stp[i].st_word); --gap->ga_len; if (i < gap->ga_len) mch_memmove(stp + i, stp + i + 1, sizeof(suggest_T) * (gap->ga_len - i)); } } }
false
false
false
false
false
0
pack_state_update(opal_buffer_t *alert, orte_job_t *jobdat) { int rc, i; orte_proc_t *child; orte_vpid_t null=ORTE_VPID_INVALID; /* pack the jobid */ if (ORTE_SUCCESS != (rc = opal_dss.pack(alert, &jobdat->jobid, 1, ORTE_JOBID))) { ORTE_ERROR_LOG(rc); return rc; } for (i=0; i < orte_local_children->size; i++) { if (NULL == (child = (orte_proc_t*)opal_pointer_array_get_item(orte_local_children, i))) { continue; } /* if this child is part of the job... */ if (child->name.jobid == jobdat->jobid) { if (ORTE_SUCCESS != (rc = pack_state_for_proc(alert, child))) { ORTE_ERROR_LOG(rc); return rc; } } } /* flag that this job is complete so the receiver can know */ if (ORTE_SUCCESS != (rc = opal_dss.pack(alert, &null, 1, ORTE_VPID))) { ORTE_ERROR_LOG(rc); return rc; } return ORTE_SUCCESS; }
false
false
false
false
false
0
getTimeoutSetting(mail::loginInfo &loginInfo, const char *name, time_t defaultValue, time_t minValue, time_t maxValue) { map<string, string>::iterator p=loginInfo.options.find(name); if (p != loginInfo.options.end()) { istringstream i(p->second); i >> defaultValue; } if (defaultValue < minValue) defaultValue=minValue; if (defaultValue > maxValue) defaultValue=maxValue; return defaultValue; }
false
false
false
false
false
0
gyrus_session_on_entry_changed (GtkEditable *editable, gpointer user_data) { GtkWidget *widget = GTK_WIDGET (user_data); gboolean sensitive = gyrus_gtk_entry_has_text (GTK_ENTRY (entry_name)) && gyrus_gtk_entry_has_text (GTK_ENTRY (entry_host)) && /* gyrus_gtk_entry_has_text (GTK_ENTRY (entry_passwd) && */ gyrus_gtk_entry_has_text (GTK_ENTRY (entry_user)); gtk_widget_set_sensitive (widget, sensitive); }
false
false
false
false
false
0
load_config(void) { struct ast_config *cfg; struct ast_variable *var; struct ast_flags config_flags = { 0 }; int res = 0; cfg = ast_config_load(CONFIG, config_flags); if (!cfg || cfg == CONFIG_STATUS_FILEINVALID) { ast_log(LOG_ERROR, "Unable to load " CONFIG ". Not logging custom CSV CDRs.\n"); return -1; } var = ast_variable_browse(cfg, "mappings"); while (var) { if (!ast_strlen_zero(var->name) && !ast_strlen_zero(var->value)) { struct cdr_config *sink = ast_calloc_with_stringfields(1, struct cdr_config, 1024); if (!sink) { ast_log(LOG_ERROR, "Unable to allocate memory for configuration settings.\n"); res = -2; break; } ast_string_field_build(sink, format, "%s\n", var->value); ast_string_field_build(sink, filename, "%s/%s/%s", ast_config_AST_LOG_DIR, name, var->name); ast_mutex_init(&sink->lock); AST_RWLIST_INSERT_TAIL(&sinks, sink, list); } else { ast_log(LOG_NOTICE, "Mapping must have both a filename and a format at line %d\n", var->lineno); } var = var->next; } ast_config_destroy(cfg); return res; }
false
false
false
false
false
0
rpcsvc_transport_peer_check_name (dict_t *options, char *volname, rpc_transport_t *trans) { int ret = RPCSVC_AUTH_REJECT; int aret = RPCSVC_AUTH_REJECT; int rjret = RPCSVC_AUTH_REJECT; char clstr[RPCSVC_PEER_STRLEN]; char *hostname = NULL; if (!trans) return ret; ret = rpcsvc_transport_peername (trans, clstr, RPCSVC_PEER_STRLEN); if (ret != 0) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "Failed to get remote addr: " "%s", gai_strerror (ret)); ret = RPCSVC_AUTH_REJECT; goto err; } ret = gf_get_hostname_from_ip (clstr, &hostname); if (!ret) ret = dict_set_dynstr (options, "fqdn", hostname); aret = rpcsvc_transport_peer_check_allow (options, volname, clstr); rjret = rpcsvc_transport_peer_check_reject (options, volname, clstr); ret = rpcsvc_combine_allow_reject_volume_check (aret, rjret); err: return ret; }
true
true
false
false
false
1
parse(int argc, char *argv[]) { int opt; while ((opt = getopt(argc, argv, "i:c:n:muh?")) != -1) { switch (opt) { case 'i': iter = atoi(optarg); break; case 'c': num_contexts = atoi(optarg); break; case 'm': multiple_fds = 1; break; case 'u': uncontexted = 1; break; case 'h': case '?': default: exit(EXIT_SUCCESS); break; } } }
false
true
false
false
true
1
ReadFooters(const QByteArray &conn_id, const QByteArray &payload) { QByteArray sig, contents; SocksHostAddress name; QDataStream stream(payload); stream >> sig; name = SocksHostAddress(stream); stream >> contents; return QSharedPointer<UdpRequestPacket>(new UdpRequestPacket(conn_id, sig, name, contents)); }
false
false
false
false
false
0
icell_get_char(IAnjutaEditorCell* icell, gint index, GError** e) { SourceviewCell* cell = SOURCEVIEW_CELL(icell); GtkTextIter iter; sourceview_cell_get_iter (cell, &iter); gunichar c = gtk_text_iter_get_char (&iter); gchar* outbuf = g_new0(gchar, 6); gint len = g_unichar_to_utf8 (c, outbuf); gchar retval; if (index < len) retval = outbuf[index]; else retval = 0; g_free (outbuf); return retval; }
false
false
false
false
false
0
cfg_doc_kv_tuple(cfg_printer_t *pctx, const cfg_type_t *type) { const cfg_tuplefielddef_t *fields, *f; fields = type->of; for (f = fields; f->name != NULL; f++) { if (f != fields) { cfg_print_chars(pctx, " [ ", 3); cfg_print_cstr(pctx, f->name); if (f->type->doc != cfg_doc_void) cfg_print_chars(pctx, " ", 1); } cfg_doc_obj(pctx, f->type); if (f != fields) cfg_print_chars(pctx, " ]", 2); } }
false
false
false
false
false
0
request_post_load_init(vm_obj_id_t obj) { CVmHashEntryPLI *entry; /* check for an existing entry - if there's not one already, add one */ entry = (CVmHashEntryPLI *) post_load_init_table_->find((char *)&obj, sizeof(obj)); if (entry == 0) { /* it's not there yet - add a new entry */ post_load_init_table_->add(new CVmHashEntryPLI(obj)); /* mark the object as having requested post-load initialization */ get_entry(obj)->requested_post_load_init_ = TRUE; } }
false
false
false
false
false
0
syn_stack_alloc() { long len; synstate_T *to, *from; synstate_T *sstp; len = syn_buf->b_ml.ml_line_count / SST_DIST + Rows * 2; if (len < SST_MIN_ENTRIES) len = SST_MIN_ENTRIES; else if (len > SST_MAX_ENTRIES) len = SST_MAX_ENTRIES; if (syn_block->b_sst_len > len * 2 || syn_block->b_sst_len < len) { /* Allocate 50% too much, to avoid reallocating too often. */ len = syn_buf->b_ml.ml_line_count; len = (len + len / 2) / SST_DIST + Rows * 2; if (len < SST_MIN_ENTRIES) len = SST_MIN_ENTRIES; else if (len > SST_MAX_ENTRIES) len = SST_MAX_ENTRIES; if (syn_block->b_sst_array != NULL) { /* When shrinking the array, cleanup the existing stack. * Make sure that all valid entries fit in the new array. */ while (syn_block->b_sst_len - syn_block->b_sst_freecount + 2 > len && syn_stack_cleanup()) ; if (len < syn_block->b_sst_len - syn_block->b_sst_freecount + 2) len = syn_block->b_sst_len - syn_block->b_sst_freecount + 2; } sstp = (synstate_T *)alloc_clear((unsigned)(len * sizeof(synstate_T))); if (sstp == NULL) /* out of memory! */ return; to = sstp - 1; if (syn_block->b_sst_array != NULL) { /* Move the states from the old array to the new one. */ for (from = syn_block->b_sst_first; from != NULL; from = from->sst_next) { ++to; *to = *from; to->sst_next = to + 1; } } if (to != sstp - 1) { to->sst_next = NULL; syn_block->b_sst_first = sstp; syn_block->b_sst_freecount = len - (int)(to - sstp) - 1; } else { syn_block->b_sst_first = NULL; syn_block->b_sst_freecount = len; } /* Create the list of free entries. */ syn_block->b_sst_firstfree = to + 1; while (++to < sstp + len) to->sst_next = to + 1; (sstp + len - 1)->sst_next = NULL; vim_free(syn_block->b_sst_array); syn_block->b_sst_array = sstp; syn_block->b_sst_len = len; } }
false
false
false
false
false
0
gw_menu_action_expand_disks_click ( GtkMenuItem *m, GtkWindow *w) { GtkCTree *tree = NULL; GtkCTreeNode *root = NULL; GtkCTreeNode *child = NULL; gboolean result = FALSE; #ifdef GW_DEBUG_GUI_CALLBACK_COMPONENT g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__); #endif if ( w != NULL ) { if ( (root = gw_gui_manager_main_interface_get_tree_root ( )) != NULL ) { if ( (tree = gw_gui_manager_main_interface_get_tree ( )) != NULL ) { gtk_clist_freeze ( GTK_CLIST ( tree)); child = GTK_CTREE_ROW ( root)->children; while ( child != NULL ) { gtk_ctree_collapse_recursive ( tree, child); child = GTK_CTREE_ROW ( child)->sibling; } gtk_ctree_expand_to_depth ( tree, root, 1); gtk_clist_thaw ( GTK_CLIST ( tree)); result = TRUE; } } } return result; }
false
false
false
false
false
0
java_lang_VMClass_getDeclaredMethods(jobject clazz, jboolean public_only) { struct vm_class *vmc; int count; vmc = vm_object_to_vm_class(clazz); if (!vmc) return NULL; if (vm_class_is_primitive_class(vmc) || vm_class_is_array_class(vmc)) return vm_object_alloc_array(vm_array_of_java_lang_reflect_Method, 0); count = 0; for (int i = 0; i < vmc->class->methods_count; i++) { struct vm_method *vmm = &vmc->methods[i]; if (public_only && !vm_method_is_public(vmm)) continue; if (vm_method_is_special(vmm)) continue; count ++; } struct vm_object *array = vm_object_alloc_array(vm_array_of_java_lang_reflect_Method, count); if (!array) return rethrow_exception(); int index = 0; for (int i = 0; i < vmc->class->methods_count; i++) { struct vm_method *vmm = &vmc->methods[i]; if (public_only && !vm_method_is_public(vmm)) continue; if (vm_method_is_special(vmm)) continue; array_set_field_ptr(array, index++, vm_method_to_java_lang_reflect_method(vmm, clazz, i)); } return array; }
false
false
false
false
false
0
rgb2cmyk(double r, double g, double b, double *c, double *m, double *y, double *k) { *c = 1.0 - r; *m = 1.0 - g; *y = 1.0 - b; *k = *c < *m ? *c : *m; *k = *y < *k ? *y : *k; *c -= *k; *m -= *k; *y -= *k; }
false
false
false
false
false
0
print_stats(isc_time_t *timer_start, isc_time_t *timer_finish, isc_time_t *sign_start, isc_time_t *sign_finish) { isc_uint64_t time_us; /* Time in microseconds */ isc_uint64_t time_ms; /* Time in milliseconds */ isc_uint64_t sig_ms; /* Signatures per millisecond */ FILE *out = output_stdout ? stderr : stdout; fprintf(out, "Signatures generated: %10d\n", nsigned); fprintf(out, "Signatures retained: %10d\n", nretained); fprintf(out, "Signatures dropped: %10d\n", ndropped); fprintf(out, "Signatures successfully verified: %10d\n", nverified); fprintf(out, "Signatures unsuccessfully " "verified: %10d\n", nverifyfailed); time_us = isc_time_microdiff(sign_finish, sign_start); time_ms = time_us / 1000; fprintf(out, "Signing time in seconds: %7u.%03u\n", (unsigned int) (time_ms / 1000), (unsigned int) (time_ms % 1000)); if (time_us > 0) { sig_ms = ((isc_uint64_t)nsigned * 1000000000) / time_us; fprintf(out, "Signatures per second: %7u.%03u\n", (unsigned int) sig_ms / 1000, (unsigned int) sig_ms % 1000); } time_us = isc_time_microdiff(timer_finish, timer_start); time_ms = time_us / 1000; fprintf(out, "Runtime in seconds: %7u.%03u\n", (unsigned int) (time_ms / 1000), (unsigned int) (time_ms % 1000)); }
false
false
false
false
false
0
gtkliststore_gtk_list_store_set_column_types(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_) { ScmObj list_store_scm; GtkListStore* list_store; ScmObj types_scm; ScmObj types; ScmObj SCM_SUBRARGS[2]; int SCM_i; SCM_ENTER_SUBR("gtk-list-store-set-column-types"); for (SCM_i=0; SCM_i<2; SCM_i++) { SCM_SUBRARGS[SCM_i] = SCM_ARGREF(SCM_i); } list_store_scm = SCM_SUBRARGS[0]; if (!SCM_GTK_LIST_STORE_P(list_store_scm)) Scm_Error("<gtk-list-store> required, but got %S", list_store_scm); list_store = SCM_GTK_LIST_STORE(list_store_scm); types_scm = SCM_SUBRARGS[1]; types = (types_scm); { GType gtypes_static[32], *gtypes = gtypes_static; int len; if ((len = Scm_Length(types)) < 0) { if (SCM_VECTORP(types)) { len = SCM_VECTOR_SIZE(types); } else { Scm_Error("list or vector of <class> required, but got %S", types); } } if (len > 32) gtypes = SCM_NEW_ATOMIC2(GType*, len*sizeof(GType)); Scm_ClassListToGtkTypeList(SCM_OBJ(types), gtypes); gtk_list_store_set_column_types(list_store, len, gtypes); SCM_RETURN(SCM_UNDEFINED); } }
false
false
false
false
false
0
gnm_conf_get_print_settings (void) { GtkPrintSettings *settings = gtk_print_settings_new (); GSList *list = gnm_conf_get_printsetup_gtk_setting (); while (list && list->next) { /* For historical reasons, value comes before key. */ const char *value = list->data; const char *key = list->next->data; list = list->next->next; gtk_print_settings_set (settings, key, value); } return settings; }
false
false
false
false
false
0
main(int argc, char **argv) { options_type tOptions; const char *szWordfile; int iFirst, iIndex, iGoodCount; BOOL bUsage, bMultiple, bUseTXT, bUseXML; if (argc <= 0) { return EXIT_FAILURE; } szTask = szBasename(argv[0]); if (argc <= 1) { iFirst = 1; bUsage = TRUE; } else { iFirst = iReadOptions(argc, argv); bUsage = iFirst <= 0; } if (bUsage) { vUsage(); return iFirst < 0 ? EXIT_FAILURE : EXIT_SUCCESS; } #if defined(N_PLAT_NLM) && !defined(_VA_LIST) nwinit(); #endif /* N_PLAT_NLM && !_VA_LIST */ vGetOptions(&tOptions); #if !defined(__dos) if (is_locale_utf8()) { #if defined(__STDC_ISO_10646__) /* * If the user wants UTF-8 and the envirionment variables * support UTF-8, than set the locale accordingly */ if (tOptions.eEncoding == encoding_utf_8) { if (setlocale(LC_CTYPE, "") == NULL) { werr(1, "Can't set the UTF-8 locale! " "Check LANG, LC_CTYPE, LC_ALL."); } DBG_MSG("The UTF-8 locale has been set"); } else { (void)setlocale(LC_CTYPE, "C"); } #endif /* __STDC_ISO_10646__ */ } else { if (setlocale(LC_CTYPE, "") == NULL) { werr(0, "Can't set the locale! Will use defaults"); (void)setlocale(LC_CTYPE, "C"); } DBG_MSG("The locale has been set"); } #endif /* !__dos */ bMultiple = argc - iFirst > 1; bUseTXT = tOptions.eConversionType == conversion_text || tOptions.eConversionType == conversion_fmt_text; bUseXML = tOptions.eConversionType == conversion_xml; iGoodCount = 0; #if defined(__dos) if (tOptions.eConversionType == conversion_pdf) { /* PDF must be written as a binary stream */ setmode(fileno(stdout), O_BINARY); } #endif /* __dos */ if (bUseXML) { fprintf(stdout, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" "<!DOCTYPE %s PUBLIC \"-//OASIS//DTD DocBook XML V4.1.2//EN\"\n" "\t\"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd\">\n", bMultiple ? "set" : "book"); if (bMultiple) { fprintf(stdout, "<set>\n"); } } for (iIndex = iFirst; iIndex < argc; iIndex++) { if (bMultiple && bUseTXT) { szWordfile = szBasename(argv[iIndex]); fprintf(stdout, "::::::::::::::\n"); fprintf(stdout, "%s\n", szWordfile); fprintf(stdout, "::::::::::::::\n"); } if (bProcessFile(argv[iIndex])) { iGoodCount++; } } if (bMultiple && bUseXML) { fprintf(stdout, "</set>\n"); } DBG_DEC(iGoodCount); return iGoodCount <= 0 ? EXIT_FAILURE : EXIT_SUCCESS; }
false
false
false
false
false
0
adjvar2local(void) { const Module_table* m; Var_table* v; for (m = module_head; m != NULL; m = m->next) { for (v = m->var_head; v != NULL; v = v->next) { if (v->name != NULL && v->name[0] == '$' && strncmp(v->name, "$ADJ", 4) == 0) { v->kind = MEM_LM; } } } }
false
false
false
false
false
0
TagsAdd(const char *FileName) { int *NewT; int NewF; if (!AllocMem(FileName, strlen(FileName) + 1, &NewF)) return 0; if (!(NewT = (int *)realloc((void *)TagFiles, (TagFileCount + 1) * sizeof(int)))) return 0; TagFiles = NewT; TagFiles[TagFileCount++] = NewF; return 1; }
false
false
false
false
false
0
print_object(object * obj, int level, dimeModel & model, const char * layername) { int i; const dimeLayer * layer = model.getLayer(layername); for (i = 0; i < obj->npoly; i++) { print_triangle(&obj->poly[i], model, layer); } }
false
false
false
false
false
0
e_flowlayout_pack_start(Evas_Object *obj, Evas_Object *child) { E_Smart_Data *sd; if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERR(0); sd = evas_object_smart_data_get(obj); if (!sd) return 0; _e_flowlayout_smart_adopt(sd, child); sd->items = eina_list_prepend(sd->items, child); sd->changed = 1; if (sd->frozen <= 0) _e_flowlayout_smart_reconfigure(sd); return 0; }
false
false
false
false
false
0
count_nul_characters() const { size_t result = 0; const char *cp = buffer; const char *ep = cp + length; while (cp < ep) { if (!*cp) ++result; ++cp; } return result; }
false
false
false
false
false
0
SetAlive(CContact *contact) { wxASSERT(contact != NULL); // Check if we already have a contact with this ID in the list. CContact *test = GetContact(contact->GetClientID()); wxASSERT(contact == test); if (test) { // Mark contact as being alive. test->UpdateType(); // Move to the end of the list PushToBottom(test); } }
false
false
false
false
false
0
mono_error_convert_to_exception (MonoError *target_error) { MonoError error; MonoException *ex; if (mono_error_ok (target_error)) return NULL; ex = mono_error_prepare_exception (target_error, &error); if (!mono_error_ok (&error)) { MonoError second_chance; /*Try to produce the exception for the second error. FIXME maybe we should log about the original one*/ ex = mono_error_prepare_exception (&error, &second_chance); g_assert (mono_error_ok (&second_chance)); /*We can't reasonable handle double faults, maybe later.*/ mono_error_cleanup (&error); } mono_error_cleanup (target_error); return ex; }
false
false
false
false
false
0
make_fifo(char *dir) { if (mkfifo(dir, leaf_mode)) { /* * We failed, remove the directory we created. */ fprintf(stderr, "%s: ", progname); perror(dir); return -1; } return 0; }
false
false
false
false
false
0
sci_controller_link_up(struct isci_host *ihost, struct isci_port *iport, struct isci_phy *iphy) { switch (ihost->sm.current_state_id) { case SCIC_STARTING: sci_del_timer(&ihost->phy_timer); ihost->phy_startup_timer_pending = false; ihost->port_agent.link_up_handler(ihost, &ihost->port_agent, iport, iphy); sci_controller_start_next_phy(ihost); break; case SCIC_READY: ihost->port_agent.link_up_handler(ihost, &ihost->port_agent, iport, iphy); break; default: dev_dbg(&ihost->pdev->dev, "%s: SCIC Controller linkup event from phy %d in " "unexpected state %d\n", __func__, iphy->phy_index, ihost->sm.current_state_id); } }
false
false
false
false
false
0
dump_doc_list_present_bits(SquatIndex* index, SquatWordTableLeafDocs* docs) { int start_present = docs->first_valid_entry; int end_present = docs->last_valid_entry; char* buf; int present_count; /* If the leaf is empty, we should never get here! */ assert(start_present <= end_present); /* if it's a singleton < 32, then we can't use the one-byte representation because it would be mistaken for a starting byte */ if (end_present == start_present && end_present >= 32) { if ((buf = prepare_buffered_write(&index->out, 1)) == NULL) { return SQUAT_ERR; } else { *buf++ = (char)end_present; present_count = 1; } } else { int first_byte = start_present >> 3; int byte_count = (end_present >> 3) - first_byte + 1; if ((buf = prepare_buffered_write(&index->out, 2 + byte_count)) == NULL) { return SQUAT_ERR; } else { int i; *buf++ = (char)first_byte; *buf++ = (char)byte_count - 1; memset(buf, 0, byte_count); present_count = 0; for (i = start_present; i <= end_present; i++) { if (docs->docs[i] != NULL) { present_count++; buf[(i >> 3) - first_byte] |= 1 << (i & 7); } } buf += byte_count; } } complete_buffered_write(&index->out, buf); return SQUAT_OK; }
false
false
false
false
false
0
equinox_style_draw_arrow (GtkStyle * style, GdkWindow * window, GtkStateType state_type, GtkShadowType shadow, GdkRectangle * area, GtkWidget * widget, const gchar * detail, GtkArrowType arrow_type, gboolean fill, gint x, gint y, gint width, gint height) { EquinoxStyle *equinox_style = EQUINOX_STYLE (style); EquinoxColors *colors = &equinox_style->colors; cairo_t *cr = equinox_begin_paint (window, area); CHECK_ARGS SANITIZE_SIZE WidgetParameters params; ArrowParameters arrow; equinox_set_widget_parameters (widget, style, state_type, &params); arrow.type = EQX_ARROW_NORMAL; params.state_type = (EquinoxStateType) state_type; arrow.direction = (EquinoxDirection) arrow_type; if (arrow_type == (GtkArrowType) 4) { cairo_destroy (cr); return; } if (widget && widget->parent && widget->parent->parent && widget->parent->parent->parent && GTK_IS_COMBO_BOX (widget->parent->parent->parent) && !(GTK_IS_COMBO_BOX_ENTRY (widget->parent->parent->parent))) x += 1; if (arrow.direction == EQX_DIRECTION_RIGHT) y += 1; else if (arrow.direction == EQX_DIRECTION_UP) x -= 1; if (DETAIL ("arrow")) { arrow.type = EQX_ARROW_COMBO; } else if ((DETAIL ("hscrollbar") || DETAIL ("vscrollbar"))) { arrow.type = EQX_ARROW_SCROLL; if (DETAIL ("vscrollbar")) { x++; width++; } else height++; } else if (DETAIL ("spinbutton")) { arrow.type = EQX_ARROW_SPINBUTTON; x += 2; if (arrow.direction == EQX_DIRECTION_UP) y += 1; } equinox_draw_arrow (cr, colors, &params, &arrow, x, y, width, height); cairo_destroy (cr); }
false
false
false
false
false
0
drawruntime (const char *upsrunts, const char *lowbatts) { gdImagePtr im; char utiltxt[16]; int uoutpos, lowbattpos; double upsrunt; double lowbatt; int step, maxt; upsrunt = strtod(upsrunts, NULL); lowbatt = strtod(lowbatts, NULL); im = InitImage(); step = (int)(upsrunt + 4) / 5; if (step <= 0) step = 1; /* make sure we have a positive step */ DrawText(im, 0, step); maxt = step * 5; uoutpos = 300 - (int)(upsrunt * 300 ) / maxt; lowbattpos = 300 - (int)(lowbatt * 300) / maxt; gdImageFilledRectangle(im, 50, lowbattpos, 150, 300, red); gdImageFilledRectangle(im, 75, uoutpos, 125, 300, black); (void) snprintf(utiltxt, sizeof(utiltxt), "%.1f mins", upsrunt); gdImageString(im, gdFontLarge, 65, 320, (unsigned char *)utiltxt, black); TermImage(im); }
false
false
false
false
false
0
copy_valid_id_string(struct snd_card *card, const char *src, const char *nid) { char *id = card->id; while (*nid && !isalnum(*nid)) nid++; if (isdigit(*nid)) *id++ = isalpha(*src) ? *src : 'D'; while (*nid && (size_t)(id - card->id) < sizeof(card->id) - 1) { if (isalnum(*nid)) *id++ = *nid; nid++; } *id = 0; }
false
false
false
false
false
0
param(std::string name, bool init) { OpParam par; par._name = name; par._gimpType.type = GIMP_PDB_INT32; par._gimpType.data.d_int32 = init ? 1 : 0; par._guiType = OpParam::Toggle; _params.push_back(par); }
false
false
false
false
false
0