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
cib_process_erase(const char *op, int options, const char *section, xmlNode * req, xmlNode * input, xmlNode * existing_cib, xmlNode ** result_cib, xmlNode ** answer) { int result = pcmk_ok; crm_trace("Processing \"%s\" event", op); *answer = NULL; free_xml(*result_cib); *result_cib = createEmptyCib(); copy_in_properties(*result_cib, existing_cib); cib_update_counter(*result_cib, XML_ATTR_GENERATION, FALSE); return result; }
false
false
false
false
false
0
f15h_mc0_mce(u16 ec, u8 xec) { bool ret = true; if (MEM_ERROR(ec)) { switch (xec) { case 0x0: pr_cont("Data Array access error.\n"); break; case 0x1: pr_cont("UC error during a linefill from L2/NB.\n"); break; case 0x2: case 0x11: pr_cont("STQ access error.\n"); break; case 0x3: pr_cont("SCB access error.\n"); break; case 0x10: pr_cont("Tag error.\n"); break; case 0x12: pr_cont("LDQ access error.\n"); break; default: ret = false; } } else if (BUS_ERROR(ec)) { if (!xec) pr_cont("System Read Data Error.\n"); else pr_cont(" Internal error condition type %d.\n", xec); } else if (INT_ERROR(ec)) { if (xec <= 0x1f) pr_cont("Hardware Assert.\n"); else ret = false; } else ret = false; return ret; }
false
false
false
false
false
0
iegDefTime(int *pdb, int date, int time, int taxisID) { int year, month, day, hour, minute, second; int timetype = -1; if ( taxisID != -1 ) timetype = taxisInqType(taxisID); if ( timetype == TAXIS_ABSOLUTE || timetype == TAXIS_RELATIVE ) { cdiDecodeDate(date, &year, &month, &day); cdiDecodeTime(time, &hour, &minute, &second); IEG_P_Year(pdb) = year; IEG_P_Month(pdb) = month; IEG_P_Day(pdb) = day; IEG_P_Hour(pdb) = hour; IEG_P_Minute(pdb) = minute; pdb[15] = 1; pdb[16] = 0; pdb[17] = 0; pdb[18] = 10; pdb[36] = 1; } pdb[5] = 128; }
false
false
false
false
false
0
mem_init(struct mem_t *mem) /* memory space to initialize */ { int i; /* initialize the first level page table to all empty */ for (i=0; i < MEM_PTAB_SIZE; i++) mem->ptab[i] = NULL; mem->page_count = 0; mem->ptab_misses = 0; mem->ptab_accesses = 0; }
false
false
false
false
false
0
e_smart_monitor_layout_set(Evas_Object *obj, Evas_Object *layout) { E_Smart_Data *sd; /* try to get the objects smart data */ if (!(sd = evas_object_smart_data_get(obj))) return; /* set this monitor's layout reference */ sd->layout.obj = layout; /* get out if this is not a valid layout */ if (!layout) return; /* get the layout's virtual size */ e_layout_virtual_size_get(layout, &sd->layout.vw, &sd->layout.vh); /* setup callback to be notified when this layout moves */ evas_object_event_callback_add(layout, EVAS_CALLBACK_MOVE, _e_smart_monitor_layout_cb_move, sd); }
false
false
false
false
false
0
__ram_getno(dbc, key, rep, can_create) DBC *dbc; const DBT *key; db_recno_t *rep; int can_create; { DB *dbp; db_recno_t recno; dbp = dbc->dbp; /* If passed an empty DBT from Java, key->data may be NULL */ if (key->size != sizeof(db_recno_t)) { __db_errx(dbp->env, DB_STR("1001", "illegal record number size")); return (EINVAL); } /* Check the user's record number. */ if ((recno = *(db_recno_t *)key->data) == 0) { __db_errx(dbp->env, DB_STR("1002", "illegal record number of 0")); return (EINVAL); } if (rep != NULL) *rep = recno; /* * Btree can neither create records nor read them in. Recno can * do both, see if we can find the record. */ return (dbc->dbtype == DB_RECNO ? __ram_update(dbc, recno, can_create) : 0); }
false
false
false
false
false
0
move_left (Client * c) { if (c && c->isnotile) { if (c->screen->bigmr[c->screen->desktop]) c->x -= (DisplayWidth (dpy, c->screen->num) / 20); else c->x--; if (c->x < 0) c->x = 0; XMoveWindow (dpy, c->parent, c->x, c->y); sendconfig (c); } }
false
false
false
false
false
0
rgb_foreground(struct vc_data *vc, struct rgb c) { u8 hue, max = c.r; if (c.g > max) max = c.g; if (c.b > max) max = c.b; hue = (c.r > max/2 ? 4 : 0) | (c.g > max/2 ? 2 : 0) | (c.b > max/2 ? 1 : 0); if (hue == 7 && max <= 0x55) hue = 0, vc->vc_intensity = 2; else vc->vc_intensity = (max > 0xaa) + 1; vc->vc_color = (vc->vc_color & 0xf0) | hue; }
false
false
false
false
false
0
vf610_adc_read_data(struct vf610_adc *info) { int result; result = readl(info->regs + VF610_REG_ADC_R0); switch (info->adc_feature.res_mode) { case 8: result &= 0xFF; break; case 10: result &= 0x3FF; break; case 12: result &= 0xFFF; break; default: break; } return result; }
false
false
false
false
false
0
testgetAbsoluteFilename(io::IFileSystem* fs) { bool result=true; io::path apath = fs->getAbsolutePath("media"); io::path cwd = fs->getWorkingDirectory(); if (apath!=(cwd+"/media")) { logTestString("getAbsolutePath failed on existing dir %s\n", apath.c_str()); result = false; } apath = fs->getAbsolutePath("../media/"); core::deletePathFromPath(cwd, 1); if (apath!=(cwd+"media/")) { logTestString("getAbsolutePath failed on dir with postfix / %s\n", apath.c_str()); result = false; } apath = fs->getAbsolutePath ("../nothere.txt"); // file does not exist if (apath!=(cwd+"nothere.txt")) { logTestString("getAbsolutePath failed on non-existing file %s\n", apath.c_str()); result = false; } return result; }
false
false
false
false
false
0
parse_byte_size(const std::string& str, uint64_t& bytes, bool extended) { // E.g. "500,107,862,016" bytes or "80'060'424'192 bytes" or "80 026 361 856 bytes". // French locale inserts 0xA0 as a separator (non-breaking space, _not_ a valid utf8 char). // Added '.'-separated too, just in case. // Smartctl uses system locale's thousands_sep explicitly. // When launching smartctl, we use LANG=C for it, but it works only on POSIX. // Also, loading smartctl output files from different locales doesn't really work. // debug_out_dump("app", "Size reported as: " << str << "\n"); std::vector<std::string> to_replace; to_replace.push_back(" "); to_replace.push_back("'"); to_replace.push_back(","); to_replace.push_back("."); to_replace.push_back(std::string(1, 0xa0)); #ifdef _WIN32 // if current locale is C, then probably we didn't change it at application // startup, so set it now (temporarily). Otherwise, just use the current locale's // thousands separator. { std::string old_locale = hz::locale_c_get(); hz::ScopedCLocale loc("", old_locale == "C"); // set system locale if the current one is C struct lconv* lc = std::localeconv(); if (lc && lc->thousands_sep && *(lc->thousands_sep)) { to_replace.push_back(lc->thousands_sep); } } // the locale is restored here #endif to_replace.push_back("bytes"); std::string s = hz::string_replace_array_copy(hz::string_trim_copy(str), to_replace, ""); uint64_t v = 0; if (hz::string_is_numeric(s, v, false)) { bytes = v; return hz::format_size(v, true) + (extended ? " [" + hz::format_size(v, false) + ", " + hz::number_to_string(v) + " bytes]" : ""); } return std::string(); }
false
false
false
false
false
0
flmBackgroundIndexGet( FFILE * pFile, FLMUINT uiIndexNum, FLMBOOL bMutexLocked, FLMUINT * puiThreadId) { RCODE rc = FERR_OK; IF_Thread * pThread; FLMUINT uiThreadId; F_BKGND_IX * pBackgroundIx = NULL; if( !bMutexLocked) { f_mutexLock( gv_FlmSysData.hShareMutex); } uiThreadId = 0; for( ;;) { if( RC_BAD( rc = gv_FlmSysData.pThreadMgr->getNextGroupThread( &pThread, gv_uiBackIxThrdGroup, &uiThreadId))) { if( rc == FERR_NOT_FOUND) { rc = FERR_OK; break; } else { flmAssert( 0); } } if( pThread->getThreadAppId()) { F_BKGND_IX * pTmpIx = NULL; pTmpIx = (F_BKGND_IX *)pThread->getParm1(); if( pTmpIx->indexStatus.uiIndexNum == uiIndexNum && pTmpIx->pFile == pFile) { flmAssert( pThread->getThreadAppId() == uiIndexNum); pBackgroundIx = pTmpIx; pThread->Release(); if( puiThreadId) { *puiThreadId = uiThreadId; } break; } } pThread->Release(); } if( !bMutexLocked) { f_mutexUnlock( gv_FlmSysData.hShareMutex); } return( pBackgroundIx); }
false
false
false
false
false
0
dump_runq(void) { int i; ulong next, runqueue_head; long offs; int qlen, cnt; ulong *tlist; struct task_context *tc; if (VALID_MEMBER(rq_cfs)) { dump_CFS_runqueues(); return; } if (VALID_MEMBER(runqueue_arrays)) { dump_runqueues(); return; } offs = runqueue_head = 0; qlen = 1000; start_again: tlist = (ulong *)GETBUF(qlen * sizeof(void *)); if (symbol_exists("runqueue_head")) { next = runqueue_head = symbol_value("runqueue_head"); offs = 0; } else if (VALID_MEMBER(task_struct_next_run)) { offs = OFFSET(task_struct_next_run); next = runqueue_head = symbol_value("init_task_union"); } else error(FATAL, "cannot determine run queue structures\n"); cnt = 0; do { if (cnt == qlen) { FREEBUF(tlist); qlen += 1000; goto start_again; } tlist[cnt++] = next; readmem(next+offs, KVADDR, &next, sizeof(void *), "run queue entry", FAULT_ON_ERROR); if (next == runqueue_head) break; } while (next); for (i = 0; i < cnt; i++) { if (tlist[i] == runqueue_head) continue; if (!(tc = task_to_context(VIRTPAGEBASE(tlist[i])))) { fprintf(fp, "PID: ? TASK: %lx CPU: ? COMMAND: ?\n", tlist[i]); continue; } if (!is_idle_thread(tc->task)) print_task_header(fp, tc, 0); } }
false
false
false
false
true
1
adp5520_led_probe(struct platform_device *pdev) { struct adp5520_leds_platform_data *pdata = dev_get_platdata(&pdev->dev); struct adp5520_led *led, *led_dat; struct led_info *cur_led; int ret, i; if (pdata == NULL) { dev_err(&pdev->dev, "missing platform data\n"); return -ENODEV; } if (pdata->num_leds > ADP5520_01_MAXLEDS) { dev_err(&pdev->dev, "can't handle more than %d LEDS\n", ADP5520_01_MAXLEDS); return -EFAULT; } led = devm_kzalloc(&pdev->dev, sizeof(*led) * pdata->num_leds, GFP_KERNEL); if (!led) return -ENOMEM; ret = adp5520_led_prepare(pdev); if (ret) { dev_err(&pdev->dev, "failed to write\n"); return ret; } for (i = 0; i < pdata->num_leds; ++i) { cur_led = &pdata->leds[i]; led_dat = &led[i]; led_dat->cdev.name = cur_led->name; led_dat->cdev.default_trigger = cur_led->default_trigger; led_dat->cdev.brightness_set = adp5520_led_set; led_dat->cdev.brightness = LED_OFF; if (cur_led->flags & ADP5520_FLAG_LED_MASK) led_dat->flags = cur_led->flags; else led_dat->flags = i + 1; led_dat->id = led_dat->flags & ADP5520_FLAG_LED_MASK; led_dat->master = pdev->dev.parent; led_dat->new_brightness = LED_OFF; INIT_WORK(&led_dat->work, adp5520_led_work); ret = led_classdev_register(led_dat->master, &led_dat->cdev); if (ret) { dev_err(&pdev->dev, "failed to register LED %d\n", led_dat->id); goto err; } ret = adp5520_led_setup(led_dat); if (ret) { dev_err(&pdev->dev, "failed to write\n"); i++; goto err; } } platform_set_drvdata(pdev, led); return 0; err: if (i > 0) { for (i = i - 1; i >= 0; i--) { led_classdev_unregister(&led[i].cdev); cancel_work_sync(&led[i].work); } } return ret; }
false
false
false
false
false
0
PerformPortalFetch(FetchStmt *stmt, DestReceiver *dest, char *completionTag) { Portal portal; long nprocessed; /* * Disallow empty-string cursor name (conflicts with protocol-level * unnamed portal). */ if (!stmt->portalname || stmt->portalname[0] == '\0') ereport(ERROR, (errcode(ERRCODE_INVALID_CURSOR_NAME), errmsg("invalid cursor name: must not be empty"))); /* get the portal from the portal name */ portal = GetPortalByName(stmt->portalname); if (!PortalIsValid(portal)) { ereport(ERROR, (errcode(ERRCODE_UNDEFINED_CURSOR), errmsg("cursor \"%s\" does not exist", stmt->portalname))); return; /* keep compiler happy */ } /* Adjust dest if needed. MOVE wants destination DestNone */ if (stmt->ismove) dest = None_Receiver; /* Do it */ nprocessed = PortalRunFetch(portal, stmt->direction, stmt->howMany, dest); /* Return command status if wanted */ if (completionTag) snprintf(completionTag, COMPLETION_TAG_BUFSIZE, "%s %ld", stmt->ismove ? "MOVE" : "FETCH", nprocessed); }
false
false
false
false
false
0
parseBitfield(SmallVectorImpl<MCParsedAsmOperand*> &Operands) { SMLoc S = Parser.getTok().getLoc(); // The bitfield descriptor is really two operands, the LSB and the width. if (Parser.getTok().isNot(AsmToken::Hash)) { Error(Parser.getTok().getLoc(), "'#' expected"); return MatchOperand_ParseFail; } Parser.Lex(); // Eat hash token. const MCExpr *LSBExpr; SMLoc E = Parser.getTok().getLoc(); if (getParser().ParseExpression(LSBExpr)) { Error(E, "malformed immediate expression"); return MatchOperand_ParseFail; } const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(LSBExpr); if (!CE) { Error(E, "'lsb' operand must be an immediate"); return MatchOperand_ParseFail; } int64_t LSB = CE->getValue(); // The LSB must be in the range [0,31] if (LSB < 0 || LSB > 31) { Error(E, "'lsb' operand must be in the range [0,31]"); return MatchOperand_ParseFail; } E = Parser.getTok().getLoc(); // Expect another immediate operand. if (Parser.getTok().isNot(AsmToken::Comma)) { Error(Parser.getTok().getLoc(), "too few operands"); return MatchOperand_ParseFail; } Parser.Lex(); // Eat hash token. if (Parser.getTok().isNot(AsmToken::Hash)) { Error(Parser.getTok().getLoc(), "'#' expected"); return MatchOperand_ParseFail; } Parser.Lex(); // Eat hash token. const MCExpr *WidthExpr; if (getParser().ParseExpression(WidthExpr)) { Error(E, "malformed immediate expression"); return MatchOperand_ParseFail; } CE = dyn_cast<MCConstantExpr>(WidthExpr); if (!CE) { Error(E, "'width' operand must be an immediate"); return MatchOperand_ParseFail; } int64_t Width = CE->getValue(); // The LSB must be in the range [1,32-lsb] if (Width < 1 || Width > 32 - LSB) { Error(E, "'width' operand must be in the range [1,32-lsb]"); return MatchOperand_ParseFail; } E = Parser.getTok().getLoc(); Operands.push_back(ARMOperand::CreateBitfield(LSB, Width, S, E)); return MatchOperand_Success; }
false
false
false
false
false
0
brasero_track_data_get_size (BraseroTrack *track, goffset *blocks, goffset *block_size) { BraseroTrackDataPrivate *priv; priv = BRASERO_TRACK_DATA_PRIVATE (track); if (*block_size) *block_size = 2048; if (*blocks) *blocks = priv->data_blocks; return BRASERO_BURN_OK; }
false
false
false
false
false
0
clickdl_load_requirement(String name, const Vector<ArchiveElement> *archive, ErrorHandler *errh) { ClickProvision *p = find_provision(name, 1); if (!p || p->loaded) return; ContextErrorHandler cerrh(errh, "While loading package %<%s%>:", name.c_str()); bool tmpdir_populated = false; #ifdef CLICK_TOOL String suffix = ".to", cxx_suffix = ".t.cc", target = "tool"; #else String suffix = ".uo", cxx_suffix = ".u.cc", target = "userlevel"; #endif String package; // check archive const ArchiveElement *ae = 0; if (archive && (ae = ArchiveElement::find(*archive, name + suffix))) { if (!check_tmpdir(*archive, false, tmpdir_populated, &cerrh)) return; package = *tmpdir + "/" + name + suffix; FILE *f = fopen(package.c_str(), "wb"); if (!f) { cerrh.error("cannot open %<%s%>: %s", package.c_str(), strerror(errno)); package = String(); } else { ignore_result(fwrite(ae->data.data(), 1, ae->data.length(), f)); fclose(f); } } else if (archive && (ae = ArchiveElement::find(*archive, name + cxx_suffix))) package = click_compile_archive_file(*archive, ae, name, target, true, tmpdir_populated, &cerrh); else if (archive && (ae = ArchiveElement::find(*archive, name + ".cc"))) package = click_compile_archive_file(*archive, ae, name, target, true, tmpdir_populated, &cerrh); else { // search path package = clickpath_find_file(name + suffix, "lib", CLICK_LIBDIR); if (!package) package = clickpath_find_file(name + ".o", "lib", CLICK_LIBDIR); if (!package) cerrh.error("can't find required package %<%s%s%>\nin CLICKPATH or %<%s%>", name.c_str(), suffix.c_str(), CLICK_LIBDIR); } p->loaded = true; if (package) clickdl_load_package(package, &cerrh); }
false
false
false
false
false
0
crush_destroy(struct crush_map *map) { /* buckets */ if (map->buckets) { __s32 b; for (b = 0; b < map->max_buckets; b++) { if (map->buckets[b] == NULL) continue; crush_destroy_bucket(map->buckets[b]); } kfree(map->buckets); } /* rules */ if (map->rules) { __u32 b; for (b = 0; b < map->max_rules; b++) crush_destroy_rule(map->rules[b]); kfree(map->rules); } kfree(map->choose_tries); kfree(map); }
false
false
false
false
false
0
check_is_multi(const char *mapent) { const char *p = mapent; int multi = 0; int not_first_chunk = 0; if (!p) { logerr(MODPREFIX "unexpected NULL map entry pointer"); return 0; } if (*p == '"') p++; /* If first character is "/" it's a multi-mount */ if (*p == '/') return 1; while (*p) { p = skipspace(p); /* * After the first chunk there can be additional * locations (possibly not multi) or possibly an * options string if the first entry includes the * optional '/' (is multi). Following this any * path that begins with '/' indicates a mutil-mount * entry. */ if (not_first_chunk) { if (*p == '"') p++; if (*p == '/' || *p == '-') { multi = 1; break; } } while (*p == '-') { p += chunklen(p, 0); p = skipspace(p); } /* * Expect either a path or location * after which it's a multi mount. */ p += chunklen(p, check_colon(p)); not_first_chunk++; } return multi; }
false
false
false
false
false
0
rev_commit_locate_date (rev_ref *branch, time_t date) { rev_commit *commit; for (commit = branch->commit; commit; commit = commit->parent) { if (time_compare (commit->date, date) <= 0) return commit; } return NULL; }
false
false
false
false
false
0
au_update_figen(struct file *file) { atomic_set(&au_fi(file)->fi_generation, au_digen(file->f_path.dentry)); /* smp_mb(); */ /* atomic_set */ }
false
false
false
false
false
0
opclass_is_btree(Oid opclass) { HeapTuple tp; Form_pg_opclass cla_tup; bool result; tp = SearchSysCache(CLAOID, ObjectIdGetDatum(opclass), 0, 0, 0); if (!HeapTupleIsValid(tp)) elog(ERROR, "cache lookup failed for opclass %u", opclass); cla_tup = (Form_pg_opclass) GETSTRUCT(tp); result = (cla_tup->opcamid == BTREE_AM_OID); ReleaseSysCache(tp); return result; }
false
false
false
true
false
1
qlcnic_83xx_poll_for_mbx_completion(struct qlcnic_adapter *adapter, struct qlcnic_cmd_args *cmd) { struct qlcnic_hardware_context *ahw = adapter->ahw; int opcode = LSW(cmd->req.arg[0]); unsigned long max_loops; max_loops = cmd->total_cmds * QLC_83XX_MBX_CMD_LOOP; for (; max_loops; max_loops--) { if (atomic_read(&cmd->rsp_status) == QLC_83XX_MBX_RESPONSE_ARRIVED) return; udelay(1); } dev_err(&adapter->pdev->dev, "%s: Mailbox command timed out, cmd_op=0x%x, cmd_type=0x%x, pci_func=0x%x, op_mode=0x%x\n", __func__, opcode, cmd->type, ahw->pci_func, ahw->op_mode); flush_workqueue(ahw->mailbox->work_q); return; }
false
false
false
false
false
0
avatar_cache_tests_test_store_avatar_overwrite (AvatarCacheTests* self) { GLoadableIcon* _tmp0_ = NULL; GLoadableIcon* _tmp1_ = NULL; GLoadableIcon* avatar = NULL; GLoadableIcon* _tmp2_ = NULL; GLoadableIcon* _tmp3_ = NULL; #line 204 "/home/treitter/collabora/folks/tests/folks/avatar-cache.vala" g_return_if_fail (self != NULL); #line 207 "/home/treitter/collabora/folks/tests/folks/avatar-cache.vala" _tmp0_ = self->priv->_avatar; #line 207 "/home/treitter/collabora/folks/tests/folks/avatar-cache.vala" _avatar_cache_tests_assert_store_avatar (self, "test-store-avatar-ow-id", _tmp0_); #line 208 "/home/treitter/collabora/folks/tests/folks/avatar-cache.vala" _tmp1_ = self->priv->_avatar; #line 208 "/home/treitter/collabora/folks/tests/folks/avatar-cache.vala" _avatar_cache_tests_assert_store_avatar (self, "test-store-avatar-ow-id", _tmp1_); #line 211 "/home/treitter/collabora/folks/tests/folks/avatar-cache.vala" _tmp2_ = _avatar_cache_tests_assert_load_avatar (self, "test-store-avatar-ow-id"); #line 211 "/home/treitter/collabora/folks/tests/folks/avatar-cache.vala" avatar = _tmp2_; #line 214 "/home/treitter/collabora/folks/tests/folks/avatar-cache.vala" _vala_assert (avatar != NULL, "avatar != null"); #line 215 "/home/treitter/collabora/folks/tests/folks/avatar-cache.vala" _vala_assert (G_TYPE_CHECK_INSTANCE_TYPE (avatar, g_loadable_icon_get_type ()), "avatar is LoadableIcon"); #line 216 "/home/treitter/collabora/folks/tests/folks/avatar-cache.vala" _tmp3_ = self->priv->_avatar; #line 216 "/home/treitter/collabora/folks/tests/folks/avatar-cache.vala" _avatar_cache_tests_assert_avatars_equal (self, _tmp3_, avatar); #line 204 "/home/treitter/collabora/folks/tests/folks/avatar-cache.vala" _g_object_unref0 (avatar); #line 976 "avatar-cache.c" }
false
false
false
false
false
0
diff_print_oid_range(diff_print_info *pi, const git_diff_delta *delta) { git_buf *out = pi->buf; char start_oid[GIT_OID_HEXSZ+1], end_oid[GIT_OID_HEXSZ+1]; git_oid_tostr(start_oid, pi->oid_strlen, &delta->old_file.oid); git_oid_tostr(end_oid, pi->oid_strlen, &delta->new_file.oid); /* TODO: Match git diff more closely */ if (delta->old_file.mode == delta->new_file.mode) { git_buf_printf(out, "index %s..%s %o\n", start_oid, end_oid, delta->old_file.mode); } else { if (delta->old_file.mode == 0) { git_buf_printf(out, "new file mode %o\n", delta->new_file.mode); } else if (delta->new_file.mode == 0) { git_buf_printf(out, "deleted file mode %o\n", delta->old_file.mode); } else { git_buf_printf(out, "old mode %o\n", delta->old_file.mode); git_buf_printf(out, "new mode %o\n", delta->new_file.mode); } git_buf_printf(out, "index %s..%s\n", start_oid, end_oid); } if (git_buf_oom(out)) return -1; return 0; }
false
false
false
false
false
0
Conf_AcceptCommand(const char *line, bool & breakflag) { char cmd[MAX_LINE_LENGTH]; const char *args; const char *space = strchr(line, ' '); if (!space) { args = ""; } else { args = space + 1; } strlcpy(cmd, line, space-line+1); Configuration::strings_t::iterator s; Configuration::numbers_t::iterator n; Configuration::commands_t::iterator c; if ((n = conf.numbers.find(cmd)) != conf.numbers.end()) { n->second = atoi(args); } else if ((s = conf.strings.find(cmd)) != conf.strings.end()) { s->second = std::string(args); } else if ((c = conf.commands.find(cmd)) != conf.commands.end()) { Conf_Cmdcallback_f callbackfnc = c->second; callbackfnc(args, breakflag); } else { printf("Unrecognized command \"%s\"\n", cmd); } }
false
false
false
false
false
0
recalculate_font_sizes(GtkTextTag *tag, gpointer imhtml) { if (strncmp(tag->name, "FONT SIZE ", 10) == 0) { GtkTextAttributes *attr = gtk_text_view_get_default_attributes(GTK_TEXT_VIEW(imhtml)); int size; size = strtol(tag->name + 10, NULL, 10); g_object_set(G_OBJECT(tag), "size", (gint) (pango_font_description_get_size(attr->font) * (double) _point_sizes[size-1]), NULL); } }
false
false
false
false
false
0
AddToPtrTable(JSContext *cx, JSPtrTable *table, const JSPtrTableInfo *info, void *ptr) { size_t count, capacity; void **array; count = table->count; capacity = PtrTableCapacity(count, info); if (count == capacity) { if (capacity < info->minCapacity) { JS_ASSERT(capacity == 0); JS_ASSERT(!table->array); capacity = info->minCapacity; } else { /* * Simplify the overflow detection assuming pointer is bigger * than byte. */ JS_STATIC_ASSERT(2 <= sizeof table->array[0]); capacity = (capacity < info->linearGrowthThreshold) ? 2 * capacity : capacity + info->linearGrowthThreshold; if (capacity > (size_t)-1 / sizeof table->array[0]) goto bad; } array = (void **) js_realloc(table->array, capacity * sizeof table->array[0]); if (!array) goto bad; #ifdef DEBUG memset(array + count, JS_FREE_PATTERN, (capacity - count) * sizeof table->array[0]); #endif table->array = array; } table->array[count] = ptr; table->count = count + 1; return JS_TRUE; bad: JS_ReportOutOfMemory(cx); return JS_FALSE; }
false
false
false
false
true
1
add_paths_to_joinrel(PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *outerrel, RelOptInfo *innerrel, JoinType jointype, List *restrictlist) { List *mergeclause_list = NIL; /* * Find potential mergejoin clauses. We can skip this if we are not * interested in doing a mergejoin. However, mergejoin is currently our * only way of implementing full outer joins, so override mergejoin * disable if it's a full join. */ if (enable_mergejoin || jointype == JOIN_FULL) mergeclause_list = select_mergejoin_clauses(joinrel, outerrel, innerrel, restrictlist, jointype); /* * 1. Consider mergejoin paths where both relations must be explicitly * sorted. */ sort_inner_and_outer(root, joinrel, outerrel, innerrel, restrictlist, mergeclause_list, jointype); /* * 2. Consider paths where the outer relation need not be explicitly * sorted. This includes both nestloops and mergejoins where the outer * path is already ordered. */ match_unsorted_outer(root, joinrel, outerrel, innerrel, restrictlist, mergeclause_list, jointype); #ifdef NOT_USED /* * 3. Consider paths where the inner relation need not be explicitly * sorted. This includes mergejoins only (nestloops were already built in * match_unsorted_outer). * * Diked out as redundant 2/13/2000 -- tgl. There isn't any really * significant difference between the inner and outer side of a mergejoin, * so match_unsorted_inner creates no paths that aren't equivalent to * those made by match_unsorted_outer when add_paths_to_joinrel() is * invoked with the two rels given in the other order. */ match_unsorted_inner(root, joinrel, outerrel, innerrel, restrictlist, mergeclause_list, jointype); #endif /* * 4. Consider paths where both outer and inner relations must be hashed * before being joined. */ if (enable_hashjoin) hash_inner_and_outer(root, joinrel, outerrel, innerrel, restrictlist, jointype); }
false
false
false
false
false
0
doUpdate() { ObserverLocker lock(&updateLockM); if (updateLockM == 1) update(); }
false
false
false
false
false
0
DecodeGPRwithAPSRRegisterClass(MCInst &Inst, unsigned RegNo, uint64_t Address, const void *Decoder) { DecodeStatus S = MCDisassembler::Success; if (RegNo == 15) { Inst.addOperand(MCOperand::createReg(ARM::APSR_NZCV)); return MCDisassembler::Success; } Check(S, DecodeGPRRegisterClass(Inst, RegNo, Address, Decoder)); return S; }
false
false
false
false
false
0
UnpackWPGRaster(Image *image,int bpp) { int x, y, i; unsigned char bbuf, *BImgBuff, RunCount; long ldblk; x=0; y=0; ldblk=(long) ((bpp*image->columns+7)/8); BImgBuff=MagickAllocateMemory(unsigned char *,(size_t) ldblk); if(BImgBuff==NULL) return(-2); while(y<(long) image->rows) { bbuf=ReadBlobByte(image); RunCount=bbuf & 0x7F; if(bbuf & 0x80) { if(RunCount) /* repeat next byte runcount * */ { bbuf=ReadBlobByte(image); for(i=0;i<(int) RunCount;i++) InsertByte(bbuf); } else { /* read next byte as RunCount; repeat 0xFF runcount* */ RunCount=ReadBlobByte(image); for(i=0;i<(int) RunCount;i++) InsertByte(0xFF); } } else { if(RunCount) /* next runcount byte are readed directly */ { for(i=0;i < (int) RunCount;i++) { bbuf=ReadBlobByte(image); InsertByte(bbuf); } } else { /* repeat previous line runcount* */ RunCount=ReadBlobByte(image); if(x) { /* attempt to duplicate row from x position: */ /* I do not know what to do here */ MagickFreeMemory(BImgBuff); return(-3); } for(i=0;i < (int) RunCount;i++) { x=0; y++; /* Here I need to duplicate previous row RUNCOUNT* */ if(y<2) continue; if(y>(long) image->rows) { MagickFreeMemory(BImgBuff); return(-4); } (void) InsertRow(BImgBuff,y-1,image,bpp); } } } } MagickFreeMemory(BImgBuff); return(0); }
false
false
false
false
false
0
exporthtml_process( ExportHtmlCtl *ctl, AddressCache *cache ) { ItemFolder *rootFolder; FILE *htmlFile; time_t tt; gchar *dsName; static gchar *title; gchar buf[512]; htmlFile = g_fopen( ctl->path, "wb" ); if( ! htmlFile ) { /* Cannot open file */ g_print( "Cannot open file for write\n" ); ctl->retVal = MGU_OPEN_FILE; return; } title = _( "Claws Mail Address Book" ); rootFolder = cache->rootFolder; dsName = cache->name; exporthtml_fmt_header( ctl, htmlFile, title ); fprintf( htmlFile, "<body>\n" ); fprintf( htmlFile, "<h1>%s</h1>\n", title ); fprintf( htmlFile, "<p class=\"fmt-folder\">" ); fprintf( htmlFile, "%s: ", _( "Address Book" ) ); fprintf( htmlFile, "%s", dsName ); fprintf( htmlFile, "</p>\n" ); exporthtml_fmt_folder( ctl, htmlFile, rootFolder ); tt = time( NULL ); fprintf( htmlFile, "<p>%s</p>\n", ctime_r( &tt, buf ) ); fprintf( htmlFile, "<hr width=\"100%%\">\n" ); fprintf( htmlFile, "</body>\n" ); fprintf( htmlFile, "</html>\n" ); fclose( htmlFile ); ctl->retVal = MGU_SUCCESS; /* Create stylesheet files */ exporthtml_create_css_files( ctl ); }
false
false
false
false
false
0
eap_sim_getchalans(VALUE_PAIR *vps, int chalno, struct eap_sim_server_state *ess) { VALUE_PAIR *vp; rad_assert(chalno >= 0 && chalno < 3); vp = pairfind(vps, ATTRIBUTE_EAP_SIM_RAND1+chalno, 0); if(vp == NULL) { /* bad, we can't find stuff! */ DEBUG2(" eap-sim can not find sim-challenge%d",chalno+1); return 0; } if(vp->length != EAPSIM_RAND_SIZE) { DEBUG2(" eap-sim chal%d is not 8-bytes: %d", chalno+1, (int) vp->length); return 0; } memcpy(ess->keys.rand[chalno], vp->vp_strvalue, EAPSIM_RAND_SIZE); vp = pairfind(vps, ATTRIBUTE_EAP_SIM_SRES1+chalno, 0); if(vp == NULL) { /* bad, we can't find stuff! */ DEBUG2(" eap-sim can not find sim-sres%d",chalno+1); return 0; } if(vp->length != EAPSIM_SRES_SIZE) { DEBUG2(" eap-sim sres%d is not 16-bytes: %d", chalno+1, (int) vp->length); return 0; } memcpy(ess->keys.sres[chalno], vp->vp_strvalue, EAPSIM_SRES_SIZE); vp = pairfind(vps, ATTRIBUTE_EAP_SIM_KC1+chalno, 0); if(vp == NULL) { /* bad, we can't find stuff! */ DEBUG2(" eap-sim can not find sim-kc%d",chalno+1); return 0; } if(vp->length != EAPSIM_Kc_SIZE) { DEBUG2(" eap-sim kc%d is not 8-bytes: %d", chalno+1, (int) vp->length); return 0; } memcpy(ess->keys.Kc[chalno], vp->vp_strvalue, EAPSIM_Kc_SIZE); return 1; }
false
false
false
false
false
0
copy_args_expanding_macros (int argc, char *argv[], char *av[], int max_ac) { int i, ac = 0, rc; char * arg; char * p; char env_name[50]; /* expand macros */ for (i = 0; i < argc; i++) { arg = argv[i]; if (strncmp (arg, "--", 2) != 0 || arg[2] == 0) { av[ac++] = arg; continue; } sprintf (env_name, "NDMJOB_%s", arg+2); if ((p = getenv (env_name)) != 0) { ac += snarf_macro (&av[ac], p); continue; } rc = lookup_and_snarf (&av[ac], arg+2); if (rc < 0) { error_byebye ("bad arg macro --%s", arg+2); } ac += rc; } av[ac] = 0; return ac; }
true
true
false
false
true
1
SortAndPrune(PhraseDictionaryNodeSCFG &rootNode) { if (GetTableLimit()) { rootNode.Sort(GetTableLimit()); } }
false
false
false
false
false
0
input_ref (struct lto_input_block *ib, struct cgraph_node *refering_node, struct varpool_node *refering_varpool_node, VEC(cgraph_node_ptr, heap) *nodes, VEC(varpool_node_ptr, heap) *varpool_nodes) { struct cgraph_node *node = NULL; struct varpool_node *varpool_node = NULL; struct bitpack_d bp; enum ipa_ref_type type; enum ipa_ref_use use; bp = lto_input_bitpack (ib); type = (enum ipa_ref_type) bp_unpack_value (&bp, 1); use = (enum ipa_ref_use) bp_unpack_value (&bp, 2); if (type == IPA_REF_CGRAPH) node = VEC_index (cgraph_node_ptr, nodes, lto_input_sleb128 (ib)); else varpool_node = VEC_index (varpool_node_ptr, varpool_nodes, lto_input_sleb128 (ib)); ipa_record_reference (refering_node, refering_varpool_node, node, varpool_node, use, NULL); }
false
false
false
false
false
0
split_and_trim(char *str, char split_char) { int start = 0; unsigned int start_ind = 0; char c = -1; int i; for(i=0; i<split_result_num; i++) free(split_result_frags[i]); split_result_num = 0; while(c != 0) { c = str[start++]; if(c == split_char || c == 0) { char *new_string, *result; int result_size; str[start-1] = 0; result = trim(&str[start_ind]); result_size = strlen(result) + 1; new_string = malloc(sizeof(*new_string) * result_size); memcpy(new_string, result, result_size); split_result_frags = util_grow_buffer_to_size(split_result_frags, &_split_result_frags_cap, split_result_num+1, sizeof(*split_result_frags)); split_result_frags[split_result_num] = new_string; split_result_num++; start_ind = start; } } }
false
false
false
false
false
0
dessertSysifTable_container_init(netsnmp_container ** container_ptr_ptr, netsnmp_cache * cache) { DEBUGMSGTL(("verbose:dessertSysifTable:dessertSysifTable_container_init", "called\n")); dessert_debug("dessertSysifTable_container_load called"); if (NULL == container_ptr_ptr) { snmp_log(LOG_ERR, "bad container param to dessertSysifTable_container_init\n"); return; } /* * For advanced users, you can use a custom container. If you * do not create one, one will be created for you. */ *container_ptr_ptr = NULL; if (NULL == cache) { snmp_log(LOG_ERR, "bad cache param to dessertSysifTable_container_init\n"); return; } /* * TODO:345:A: Set up dessertSysifTable cache properties. * * Also for advanced users, you can set parameters for the * cache. Do not change the magic pointer, as it is used * by the MFD helper. To completely disable caching, set * cache->enabled to 0. */ cache->timeout = DESSERTSYSIFTABLE_CACHE_TIMEOUT; /* seconds */ }
false
false
false
false
false
0
pdcnew_cable_detect(ide_hwif_t *hwif) { if (get_indexed_reg(hwif, 0x0b) & 0x04) return ATA_CBL_PATA40; else return ATA_CBL_PATA80; }
false
false
false
false
false
0
nfsd4_check_legacy_client(struct nfs4_client *clp) { int status; char dname[HEXDIR_LEN]; struct nfs4_client_reclaim *crp; struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id); /* did we already find that this client is stable? */ if (test_bit(NFSD4_CLIENT_STABLE, &clp->cl_flags)) return 0; status = nfs4_make_rec_clidname(dname, &clp->cl_name); if (status) { legacy_recdir_name_error(clp, status); return status; } /* look for it in the reclaim hashtable otherwise */ crp = nfsd4_find_reclaim_client(dname, nn); if (crp) { set_bit(NFSD4_CLIENT_STABLE, &clp->cl_flags); crp->cr_clp = clp; return 0; } return -ENOENT; }
false
false
false
false
false
0
add_lists(ITEM *s1, ITEM *s2) { ITEM *p, *p0; int i, n1, n2; n1 = count_items(s1); n2 = count_items(s2); p = p0 = (ITEM *)checked_alloc(n1+n2+1,4); for(i=0; i<n2; i++) *p++ = *(s2+i); for(i=0; i<n1; i++) *p++ = *(s1+i); *p = 0; mem_free(s1); mem_free(s2); return p0; }
false
false
false
true
false
1
Gal_pnl_get_params(unsigned long flags, PPnl_PanelParams pParam) { GAL_PNLPARAMS pStat; INIT_GAL(&pStat); pStat.dwSubfunction = GALFN_PNLGETPARAMS; direct_memcpy(&(pStat.PanelParams), pParam, sizeof(Pnl_PanelParams)); pStat.PanelParams.Flags = flags; if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &pStat)) return 0; else { direct_memcpy(pParam, &(pStat.PanelParams), sizeof(Pnl_PanelParams)); return 1; } }
false
false
false
false
false
0
DetachAll() // ---------------------------------------------------------------------------- { // delete all handlers LOGIT(wxT("cbDS:DetachAll - detaching all [%lu] targets"), static_cast<unsigned long>(m_WindowPtrs.GetCount()) ); // Detach from memorized windows and remove event handlers while( m_WindowPtrs.GetCount() ) { wxWindow* pw = (wxWindow*)m_WindowPtrs.Item(0); Detach(pw); }//elihw m_WindowPtrs.Empty(); // say no windows attached m_bNotebooksAttached = false; //-m_pSearchResultsWindow = 0; return; }
false
false
false
false
false
0
static_ok (GtkWidget *widget, void *data) { gamgi_window *window = GAMGI_CAST_WINDOW data; GtkWidget *dialog = window->dialog0; GtkWidget* button; /********************************************* * modify data: execute global or local task * *********************************************/ button = (GtkWidget *) g_object_get_data (G_OBJECT (dialog), "button_list"); if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)) == TRUE) static_ok_global (window); else static_ok_local (window); /*************** * free memory * ***************/ free (cache.contents); }
false
false
false
false
false
0
r8152b_init(struct r8152 *tp) { u32 ocp_data; if (test_bit(RTL8152_UNPLUG, &tp->flags)) return; r8152_aldps_en(tp, false); if (tp->version == RTL_VER_01) { ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_LED_FEATURE); ocp_data &= ~LED_MODE_MASK; ocp_write_word(tp, MCU_TYPE_PLA, PLA_LED_FEATURE, ocp_data); } r8152_power_cut_en(tp, false); ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_PHY_PWR); ocp_data |= TX_10M_IDLE_EN | PFM_PWM_SWITCH; ocp_write_word(tp, MCU_TYPE_PLA, PLA_PHY_PWR, ocp_data); ocp_data = ocp_read_dword(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL); ocp_data &= ~MCU_CLK_RATIO_MASK; ocp_data |= MCU_CLK_RATIO | D3_CLK_GATED_EN; ocp_write_dword(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL, ocp_data); ocp_data = GPHY_STS_MSK | SPEED_DOWN_MSK | SPDWN_RXDV_MSK | SPDWN_LINKCHG_MSK; ocp_write_word(tp, MCU_TYPE_PLA, PLA_GPHY_INTR_IMR, ocp_data); r8152b_enable_eee(tp); r8152_aldps_en(tp, true); r8152b_enable_fc(tp); rtl_tally_reset(tp); /* enable rx aggregation */ ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_USB_CTRL); ocp_data &= ~(RX_AGG_DISABLE | RX_ZERO_EN); ocp_write_word(tp, MCU_TYPE_USB, USB_USB_CTRL, ocp_data); }
false
false
false
false
false
0
get_xpath_object(const char *xpath, xmlNode * xml_obj, int error_level) { int max; xmlNode *result = NULL; xmlXPathObjectPtr xpathObj = NULL; char *nodePath = NULL; char *matchNodePath = NULL; if (xpath == NULL) { return xml_obj; /* or return NULL? */ } xpathObj = xpath_search(xml_obj, xpath); nodePath = (char *)xmlGetNodePath(xml_obj); max = numXpathResults(xpathObj); if (max < 1) { do_crm_log(error_level, "No match for %s in %s", xpath, crm_str(nodePath)); crm_log_xml_explicit(xml_obj, "Unexpected Input"); } else if (max > 1) { int lpc = 0; do_crm_log(error_level, "Too many matches for %s in %s", xpath, crm_str(nodePath)); for (lpc = 0; lpc < max; lpc++) { xmlNode *match = getXpathResult(xpathObj, lpc); CRM_CHECK(match != NULL, continue); matchNodePath = (char *)xmlGetNodePath(match); do_crm_log(error_level, "%s[%d] = %s", xpath, lpc, crm_str(matchNodePath)); free(matchNodePath); } crm_log_xml_explicit(xml_obj, "Bad Input"); } else { result = getXpathResult(xpathObj, 0); } freeXpathObject(xpathObj); free(nodePath); return result; }
false
false
false
false
false
0
gst_pad_set_offset (GstPad * pad, gint64 offset) { PadEvent *ev; g_return_if_fail (GST_IS_PAD (pad)); GST_OBJECT_LOCK (pad); /* if nothing changed, do nothing */ if (pad->offset == offset) goto done; pad->offset = offset; GST_DEBUG_OBJECT (pad, "changed offset to %" G_GINT64_FORMAT, offset); /* sinkpads will apply their offset the next time a segment * event is received. */ if (GST_PAD_IS_SINK (pad)) goto done; /* resend the last segment event on next buffer push */ if ((ev = find_event_by_type (pad, GST_EVENT_SEGMENT, 0))) { ev->received = FALSE; GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PENDING_EVENTS); } done: GST_OBJECT_UNLOCK (pad); }
false
false
false
false
false
0
conv_rgb8_rgbaF (unsigned char *src, unsigned char *dst, long samples) { long n = samples; while (n--) { (*(float *) dst) = table_8g_F[*(unsigned char *) src]; dst += 4; src += 1; (*(float *) dst) = table_8g_F[*(unsigned char *) src]; dst += 4; src += 1; (*(float *) dst) = table_8g_F[*(unsigned char *) src]; dst += 4; src += 1; (*(float *) dst) = 1.0; dst += 4; } return samples; }
false
false
false
false
false
0
gst_rtsp_message_init (GstRTSPMessage * msg) { g_return_val_if_fail (msg != NULL, GST_RTSP_EINVAL); gst_rtsp_message_unset (msg); msg->type = GST_RTSP_MESSAGE_INVALID; msg->hdr_fields = g_array_new (FALSE, FALSE, sizeof (RTSPKeyValue)); return GST_RTSP_OK; }
false
false
false
false
false
0
CommitTransaction() { if (!m_pAsyncConn) return false; //check if we have pending transaction if(!m_TransStorage->get()) return false; //if async execution is not available if(!m_bAllowAsyncTransactions) return CommitTransactionDirect(); //add SqlTransaction to the async queue m_threadBody->Delay(m_TransStorage->detach()); return true; }
false
false
false
false
false
0
extractMappedBlocksFromModule(const std::vector<BasicBlock *> &BBs, Module *M) { SmallString<128> Filename; int FD; std::error_code EC = sys::fs::createUniqueFile( OutputPrefix + "-extractblocks%%%%%%%", FD, Filename); if (EC) { outs() << "*** Basic Block extraction failed!\n"; errs() << "Error creating temporary file: " << EC.message() << "\n"; EmitProgressBitcode(M, "basicblockextractfail", true); return nullptr; } sys::RemoveFileOnSignal(Filename); tool_output_file BlocksToNotExtractFile(Filename.c_str(), FD); for (std::vector<BasicBlock*>::const_iterator I = BBs.begin(), E = BBs.end(); I != E; ++I) { BasicBlock *BB = *I; // If the BB doesn't have a name, give it one so we have something to key // off of. if (!BB->hasName()) BB->setName("tmpbb"); BlocksToNotExtractFile.os() << BB->getParent()->getName() << " " << BB->getName() << "\n"; } BlocksToNotExtractFile.os().close(); if (BlocksToNotExtractFile.os().has_error()) { errs() << "Error writing list of blocks to not extract\n"; EmitProgressBitcode(M, "basicblockextractfail", true); BlocksToNotExtractFile.os().clear_error(); return nullptr; } BlocksToNotExtractFile.keep(); std::string uniqueFN = "--extract-blocks-file="; uniqueFN += Filename.str(); const char *ExtraArg = uniqueFN.c_str(); std::vector<std::string> PI; PI.push_back("extract-blocks"); std::unique_ptr<Module> Ret = runPassesOn(M, PI, false, 1, &ExtraArg); sys::fs::remove(Filename.c_str()); if (!Ret) { outs() << "*** Basic Block extraction failed, please report a bug!\n"; EmitProgressBitcode(M, "basicblockextractfail", true); } return Ret; }
false
false
false
false
false
0
fi_gui_files_sort_restore(void) { #if GTK_CHECK_VERSION(2,6,0) g_return_if_fail(files_sort_depth > 0); files_sort_depth--; if (0 == files_sort_depth) { if (GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID != files_sort_column) { gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(store_files), files_sort_column, files_sort_order); } } #endif /* Gtk+ => 2.6.0 */ }
false
false
false
false
false
0
init_framework(sge_gdi_ctx_class_t *ctx, bdb_info *info) { int ret = EXIT_FAILURE; lList *answer_list = NULL; lListElem *spooling_context = NULL; const char *spooling_method = ctx->get_spooling_method(ctx); const char *spooling_lib = ctx->get_spooling_lib(ctx); const char *spooling_params = ctx->get_spooling_params(ctx); DENTER(TOP_LAYER, "init_framework"); #ifdef HP1164 sge_set_admin_username("none", NULL); #endif /* create spooling context */ spooling_context = spool_create_dynamic_context(&answer_list, spooling_method, spooling_lib, spooling_params); answer_list_output(&answer_list); if (!strcmp(bootstrap_get_spooling_method(),"classic")) { CRITICAL((SGE_EVENT, MSG_SPOOLDEFAULTS_CANTHANDLECLASSICSPOOLING)); } else if (spooling_context == NULL) { CRITICAL((SGE_EVENT, MSG_SPOOLDEFAULTS_CANNOTCREATECONTEXT)); } else { spool_set_default_context(spooling_context); spool_set_option(&answer_list, spooling_context, "recover=false"); answer_list_output(&answer_list); /* initialize spooling context */ if (!spool_startup_context(&answer_list, spooling_context, true)) { CRITICAL((SGE_EVENT, MSG_SPOOLDEFAULTS_CANNOTSTARTUPCONTEXT)); } else { /* search the berkeley db info - take it from any object type, * berkeleydb spools all objects using the same rule. */ lListElem *type = spool_context_search_type(spooling_context, SGE_TYPE_JOB); lListElem *rule = spool_type_search_default_rule(type); *info = (bdb_info)lGetRef(rule, SPR_clientdata); ret = EXIT_SUCCESS; } answer_list_output(&answer_list); } DRETURN(ret); }
false
false
false
false
false
0
_nc_printf_string(const char *fmt, va_list ap) { char *result = 0; if (fmt != 0) { #if USE_SAFE_SPRINTF int len = _nc_printf_length(fmt, ap); if ((int) my_length < len + 1) { my_length = 2 * (len + 1); my_buffer = typeRealloc(char, my_length, my_buffer); } if (my_buffer != 0) { *my_buffer = '\0'; if (len >= 0) { vsprintf(my_buffer, fmt, ap); } result = my_buffer; } #else #define MyCols _nc_globals.safeprint_cols #define MyRows _nc_globals.safeprint_rows if (screen_lines > MyRows || screen_columns > MyCols) { if (screen_lines > MyRows) MyRows = screen_lines; if (screen_columns > MyCols) MyCols = screen_columns; my_length = (MyRows * (MyCols + 1)) + 1; my_buffer = typeRealloc(char, my_length, my_buffer); } if (my_buffer != 0) { # if HAVE_VSNPRINTF vsnprintf(my_buffer, my_length, fmt, ap); /* GNU extension */ # else vsprintf(my_buffer, fmt, ap); /* ANSI */ # endif result = my_buffer; } #endif } else if (my_buffer != 0) { /* see _nc_freeall() */ free(my_buffer); my_buffer = 0; my_length = 0; } return result; }
false
false
false
false
false
0
active_next(struct hashdir *hd, struct item *item) { if (item == NULL) { return &hd->items[1]; } item ++; if (item <= &hd->items[hd->items_cnt]) { return item; } return NULL; }
false
false
false
false
false
0
map_smb2_to_linux_error(char *buf, bool log_err) { struct smb2_sync_hdr *shdr = get_sync_hdr(buf); unsigned int i; int rc = -EIO; __le32 smb2err = shdr->Status; if (smb2err == 0) return 0; /* mask facility */ if (log_err && (smb2err != STATUS_MORE_PROCESSING_REQUIRED) && (smb2err != STATUS_END_OF_FILE)) smb2_print_status(smb2err); else if (cifsFYI & CIFS_RC) smb2_print_status(smb2err); for (i = 0; i < sizeof(smb2_error_map_table) / sizeof(struct status_to_posix_error); i++) { if (smb2_error_map_table[i].smb2_status == smb2err) { rc = smb2_error_map_table[i].posix_error; break; } } /* on error mapping not found - return EIO */ cifs_dbg(FYI, "Mapping SMB2 status code %d to POSIX err %d\n", smb2err, rc); return rc; }
false
false
false
false
false
0
GenerateCFile(const std::string &OutputFile, const std::string &InputFile, const sys::Path &llc, std::string& ErrMsg) { // Run LLC to convert the bitcode file into C. std::vector<const char*> args; args.push_back(llc.c_str()); args.push_back("-march=c"); args.push_back("-o"); args.push_back(OutputFile.c_str()); args.push_back(InputFile.c_str()); args.push_back(0); if (Verbose) { errs() << "Generating C Source With: \n"; PrintCommand(args); } return sys::Program::ExecuteAndWait(llc, &args[0], 0, 0, 0, 0, &ErrMsg); }
false
false
false
false
false
0
PyFFContour_ClearSpiros(PyFF_Contour *self) { if ( self->spiro_cnt!=0 ) free(self->spiros); self->spiros = NULL; self->spiro_cnt = 0; free(self->name); }
false
false
false
false
false
0
udi_unpack_tracks( disk_t *d ) { int i, tlen, clen, ttyp; libspectrum_byte *tmp; libspectrum_byte mask[] = { 0xff, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe }; for( i = 0; i < d->sides * d->cylinders; i++ ) { DISK_SET_TRACK_IDX( d, i ); tmp = d->track; ttyp = tmp[-1]; tlen = tmp[-3] + 256 * tmp[-2]; clen = DISK_CLEN( tlen ); tmp += tlen; if( ttyp & 0x80 ) tmp += clen; if( ttyp & 0x02 ) tmp += clen; if( ( ttyp & 0x80 ) ) { /* copy WEAK marks*/ if( tmp != d->weak ) memcpy( d->weak, tmp, clen ); tmp -= clen; } else { /* clear WEAK marks*/ memset( d->weak, 0, clen ); } if( ttyp & 0x02 ) { /* copy FM marks */ if( tmp != d->fm ) memcpy( d->fm, tmp, clen ); tmp -= clen; } else { /* set/clear FM marks*/ memset( d->fm, ttyp & 0x01 ? 0xff : 0, clen ); if( tlen % 8 ) { /* adjust last byte */ d->fm[clen - 1] &= mask[ tlen % 8 ]; } } /* copy clock if needed */ if( tmp != d->clocks ) memcpy( d->clocks, tmp, clen ); } }
false
true
false
false
false
1
gsc_search(struct cat_star *cst[], struct catalog *cat, double ra, double dec, double radius, int n) { int *regs, *ids; float *ras, *decs, *mags; int n_gsc, i, j; struct cat_star *cats; struct cat_star *tc; // d3_printf("gsc search\n"); regs = malloc(CAT_GET_SIZE * sizeof(int)); ids = malloc(CAT_GET_SIZE * sizeof(int)); ras = malloc(CAT_GET_SIZE * sizeof(float)); decs = malloc(CAT_GET_SIZE * sizeof(float)); mags = malloc(CAT_GET_SIZE * sizeof(float)); tc = calloc(CAT_GET_SIZE, sizeof(struct cat_star)); // d3_printf("getgsc\n"); n_gsc = getgsc(ra, dec, radius, gsc_max_mag(radius), regs, ids, ras, decs, mags, CAT_GET_SIZE, P_STR(FILE_GSC_PATH)); // n_gsc = 0; // d3_printf("got %d from gsc in a %.1f' radius, maxmag is %.1f\n", // n_gsc, radius, gsc_max_mag(radius)); // d3_printf("ra:%.4f, dec:%.4f\n", ra, dec); /* remove duplicates */ for(i=1, j=0; i<n_gsc; i++) { while((regs[i] == regs[i-1]) && (ids[i] == ids[i-1])) i++; tc[j].ra = ras[i]; tc[j].dec = decs[i]; tc[j].mag = mags[i]; sprintf(tc[j].name, "%04d-%04d", regs[i], ids[i]); j++; } n_gsc = j; /* and sort on magnitudes */ qsort(tc, n_gsc, sizeof(struct cat_star), mag_comp_fn); /* TBD */ /* make cat_stars */ for (i = 0; i < n_gsc && i < n; i++) { cats = cat_star_new(); cats->ra = tc[i].ra; cats->dec = tc[i].dec; cats->perr = BIG_ERR; cats->equinox = 2000.0; cats->mag = tc[i].mag; strcpy(cats->name, tc[i].name); cats->flags = CAT_STAR_TYPE_SREF | CAT_ASTROMET; if (-1 == asprintf(&cats->comments, "p=G ")) cats->comments = NULL; cst[i] = cats; } free(regs); free(ids); free(ras); free(decs); free(mags); free(tc); return i; }
false
true
false
false
false
1
http_PutResponse(struct worker *w, int fd, const struct http *to, const char *response) { http_PutField(w, fd, to, HTTP_HDR_RESPONSE, response); if (to->hd[HTTP_HDR_RESPONSE].b == NULL) http_SetH(to, HTTP_HDR_RESPONSE, "Lost Response"); Tcheck(to->hd[HTTP_HDR_RESPONSE]); }
false
false
false
false
false
0
glusterd_import_bricks (dict_t *vols, int32_t vol_count, glusterd_volinfo_t *new_volinfo) { int ret = -1; int brick_count = 1; glusterd_brickinfo_t *new_brickinfo = NULL; GF_ASSERT (vols); GF_ASSERT (vol_count >= 0); GF_ASSERT (new_volinfo); while (brick_count <= new_volinfo->brick_count) { ret = glusterd_import_new_brick (vols, vol_count, brick_count, &new_brickinfo); if (ret) goto out; list_add_tail (&new_brickinfo->brick_list, &new_volinfo->bricks); brick_count++; } ret = 0; out: gf_log ("", GF_LOG_DEBUG, "Returning with %d", ret); return ret; }
false
false
false
false
false
0
GradientPredictDirect(const uint8_t* const row, const uint8_t* const top, uint8_t* const out, int length) { const int max_pos = length & ~7; int i; const __m128i zero = _mm_setzero_si128(); for (i = 0; i < max_pos; i += 8) { const __m128i A0 = _mm_loadl_epi64((const __m128i*)&row[i - 1]); const __m128i B0 = _mm_loadl_epi64((const __m128i*)&top[i]); const __m128i C0 = _mm_loadl_epi64((const __m128i*)&top[i - 1]); const __m128i D = _mm_loadl_epi64((const __m128i*)&row[i]); const __m128i A1 = _mm_unpacklo_epi8(A0, zero); const __m128i B1 = _mm_unpacklo_epi8(B0, zero); const __m128i C1 = _mm_unpacklo_epi8(C0, zero); const __m128i E = _mm_add_epi16(A1, B1); const __m128i F = _mm_sub_epi16(E, C1); const __m128i G = _mm_packus_epi16(F, zero); const __m128i H = _mm_sub_epi8(D, G); _mm_storel_epi64((__m128i*)(out + i), H); } for (; i < length; ++i) { out[i] = row[i] - GradientPredictorC(row[i - 1], top[i], top[i - 1]); } }
false
false
false
false
false
0
button_receive (GtkWidget *widget, gpointer data) { GList *selection; gchar *nr; gchar *fname; const gchar *dir; dir = gtk_entry_get_text (GTK_ENTRY(((struct s_main_data *) data)->rdirinput)); gtk_clist_freeze (GTK_CLIST(((struct s_main_data *) data)->receiver)); while ((selection = GTK_CLIST(((struct s_main_data *) data)->receiver)->selection)) { gtk_clist_get_text (GTK_CLIST(((struct s_main_data *) data)->receiver), (int)selection->data, 4, &nr); gtk_clist_get_text (GTK_CLIST(((struct s_main_data *) data)->receiver), (int)selection->data, 1, &fname); if (receive_file (nr, dir, fname)) gtk_clist_remove (GTK_CLIST(((struct s_main_data *)data)->receiver), (int)selection->data); else gtk_clist_unselect_row (GTK_CLIST(((struct s_main_data *)data)->receiver), (int)selection->data, 0); } gtk_clist_thaw (GTK_CLIST(((struct s_main_data *) data)->receiver)); }
false
false
false
false
false
0
_nrrdReadNrrdParse_content(FILE *file, Nrrd *nrrd, NrrdIoState *nio, int useBiff) { static const char me[]="_nrrdReadNrrdParse_content"; char *info; AIR_UNUSED(file); info = nio->line + nio->pos; if (strlen(info) && !(nrrd->content = airStrdup(info))) { biffMaybeAddf(useBiff, NRRD, "%s: couldn't strdup() content", me); return 1; } return 0; }
false
false
false
false
false
0
removed(dns_zone_t *zone, void *uap) { const char *type; if (dns_zone_getview(zone) != uap) return (ISC_R_SUCCESS); switch (dns_zone_gettype(zone)) { case dns_zone_master: type = "master"; break; case dns_zone_slave: type = "slave"; break; case dns_zone_stub: type = "stub"; break; case dns_zone_staticstub: type = "static-stub"; break; case dns_zone_redirect: type = "redirect"; break; default: type = "other"; break; } dns_zone_log(zone, ISC_LOG_INFO, "(%s) removed", type); return (ISC_R_SUCCESS); }
false
false
false
false
false
0
text_editor_set_line_marker (TextEditor *te, glong line) { g_return_if_fail (te != NULL); g_return_if_fail(IS_SCINTILLA (te->scintilla) == TRUE); // FIXME: anjuta_delete_all_marker (TEXT_EDITOR_LINEMARKER); text_editor_delete_marker_all (te, TEXT_EDITOR_LINEMARKER); text_editor_set_marker (te, line, TEXT_EDITOR_LINEMARKER); }
false
false
false
false
false
0
warn_uninitialized_vars (bool warn_possibly_uninitialized) { gimple_stmt_iterator gsi; basic_block bb; FOR_EACH_BB (bb) { bool always_executed = dominated_by_p (CDI_POST_DOMINATORS, single_succ (ENTRY_BLOCK_PTR), bb); for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { gimple stmt = gsi_stmt (gsi); use_operand_p use_p; ssa_op_iter op_iter; tree use; if (is_gimple_debug (stmt)) continue; /* We only do data flow with SSA_NAMEs, so that's all we can warn about. */ FOR_EACH_SSA_USE_OPERAND (use_p, stmt, op_iter, SSA_OP_USE) { use = USE_FROM_PTR (use_p); if (always_executed) warn_uninit (OPT_Wuninitialized, use, SSA_NAME_VAR (use), SSA_NAME_VAR (use), "%qD is used uninitialized in this function", stmt); else if (warn_possibly_uninitialized) warn_uninit (OPT_Wmaybe_uninitialized, use, SSA_NAME_VAR (use), SSA_NAME_VAR (use), "%qD may be used uninitialized in this function", stmt); } /* For memory the only cheap thing we can do is see if we have a use of the default def of the virtual operand. ??? Note that at -O0 we do not have virtual operands. ??? Not so cheap would be to use the alias oracle via walk_aliased_vdefs, if we don't find any aliasing vdef warn as is-used-uninitialized, if we don't find an aliasing vdef that kills our use (stmt_kills_ref_p), warn as may-be-used-uninitialized. But this walk is quadratic and so must be limited which means we would miss warning opportunities. */ use = gimple_vuse (stmt); if (use && gimple_assign_single_p (stmt) && !gimple_vdef (stmt) && SSA_NAME_IS_DEFAULT_DEF (use)) { tree rhs = gimple_assign_rhs1 (stmt); tree base = get_base_address (rhs); /* Do not warn if it can be initialized outside this function. */ if (TREE_CODE (base) != VAR_DECL || DECL_HARD_REGISTER (base) || is_global_var (base)) continue; if (always_executed) warn_uninit (OPT_Wuninitialized, use, gimple_assign_rhs1 (stmt), base, "%qE is used uninitialized in this function", stmt); else if (warn_possibly_uninitialized) warn_uninit (OPT_Wmaybe_uninitialized, use, gimple_assign_rhs1 (stmt), base, "%qE may be used uninitialized in this function", stmt); } } } return 0; }
false
false
false
false
false
0
ap_abstract0_sat_lincons(ap_manager_t* man, ap_abstract0_t* a, ap_lincons0_t* lincons) { if (ap_abstract0_checkman1(AP_FUNID_SAT_LINCONS,man,a) && ap_abstract0_check_linexpr(AP_FUNID_SAT_LINCONS,man,_ap_abstract0_dimension(a),lincons->linexpr0) ){ bool (*ptr)(ap_manager_t*,...) = man->funptr[AP_FUNID_SAT_LINCONS]; return ptr(man,a->value,lincons); } else { man->result.flag_exact = false; return false; } }
false
false
false
false
false
0
gsd_ldsm_dialog_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { GsdLdsmDialog *self; g_return_if_fail (GSD_IS_LDSM_DIALOG (object)); self = GSD_LDSM_DIALOG (object); switch (prop_id) { case PROP_OTHER_USABLE_PARTITIONS: self->priv->other_usable_partitions = g_value_get_boolean (value); break; case PROP_OTHER_PARTITIONS: self->priv->other_partitions = g_value_get_boolean (value); break; case PROP_HAS_TRASH: self->priv->has_trash = g_value_get_boolean (value); break; case PROP_SPACE_REMAINING: self->priv->space_remaining = g_value_get_int64 (value); break; case PROP_PARTITION_NAME: self->priv->partition_name = g_value_dup_string (value); break; case PROP_MOUNT_PATH: self->priv->mount_path = g_value_dup_string (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
false
false
false
false
false
0
ecore_con_ssl_client_upgrade(Ecore_Con_Client *cl, Ecore_Con_Type ssl_type) { if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT)) { ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, __func__); return EINA_FALSE; } #if _ECORE_CON_SSL_AVAILABLE == 0 return EINA_FALSE; #endif if (!cl->host_server->ssl_prepared) { if (ecore_con_ssl_server_prepare(cl->host_server, ssl_type)) return EINA_FALSE; } if (!cl->host_server->use_cert) cl->host_server->type |= ssl_type; cl->upgrade = EINA_TRUE; cl->host_server->upgrade = EINA_TRUE; cl->handshaking = EINA_TRUE; cl->ssl_state = ECORE_CON_SSL_STATE_INIT; return SSL_SUFFIX(_ecore_con_ssl_client_init) (cl); }
false
false
false
false
false
0
make_mime(const char* to, const char* from, const char* subject, const char* text_message, const char* method, const char* ical_message) { size_t size = strlen(to)+strlen(from)+strlen(subject)+ strlen(text_message)+ strlen(ical_message)+TMPSIZE; char mime_part_1[TMPSIZE]; char mime_part_2[TMPSIZE]; char content_id[TMPSIZE]; char boundary[TMPSIZE]; struct utsname uts; char* m; if ((m = malloc(sizeof(char)*size)) == 0){ fprintf(stderr,"%s: Can't allocate memory: %s\n",program_name,strerror(errno)); exit(1); } uname(&uts); srand(time(0)<<getpid()); sprintf(content_id,"%d-%d@%s",(int)time(0),rand(),uts.nodename); sprintf(boundary,"%d-%d-%s",(int)time(0),rand(),uts.nodename); sprintf(mime_part_1,"Content-ID: %s\n\ Content-type: text/plain\n\ Content-Description: Text description of error message\n\n\ %s\n\n--%s", content_id,text_message,boundary); if(ical_message != 0 && method != 0){ sprintf(mime_part_2,"Content-ID: %s\n\ Content-type: text/calendar; method=%s\n\ Content-Description: iCal component reply\n\n\ %s\n\n--%s--", content_id,method,ical_message,boundary); } sprintf(m,"To: %s\n\ From: %s\n\ Subject: %s\n\ MIME-Version: 1.0\n\ Content-ID: %s\n\ Content-Type: multipart/mixed; boundary=\"%s\"\n\ \n\ This is a multimedia message in MIME format\n\ \n\ --%s\n\ %s\n\ ", to,from,subject,content_id,boundary,boundary, mime_part_1); if(ical_message != 0 && method != 0){ strcat(m, mime_part_2); } else { strcat(m,"--\n"); } return m; }
true
true
false
false
true
1
_k_slotResult( KJob *job ) { if (job == m_job) { m_job = 0L; } }
false
false
false
false
false
0
S_isFOO_lc(pTHX_ const U8 classnum, const U8 character) { /* Returns a boolean as to whether or not 'character' is a member of the * Posix character class given by 'classnum' that should be equivalent to a * value in the typedef '_char_class_number'. * * Ideally this could be replaced by a just an array of function pointers * to the C library functions that implement the macros this calls. * However, to compile, the precise function signatures are required, and * these may vary from platform to to platform. To avoid having to figure * out what those all are on each platform, I (khw) am using this method, * which adds an extra layer of function call overhead (unless the C * optimizer strips it away). But we don't particularly care about * performance with locales anyway. */ switch ((_char_class_number) classnum) { case _CC_ENUM_ALPHANUMERIC: return isALPHANUMERIC_LC(character); case _CC_ENUM_ALPHA: return isALPHA_LC(character); case _CC_ENUM_ASCII: return isASCII_LC(character); case _CC_ENUM_BLANK: return isBLANK_LC(character); case _CC_ENUM_CASED: return isLOWER_LC(character) || isUPPER_LC(character); case _CC_ENUM_CNTRL: return isCNTRL_LC(character); case _CC_ENUM_DIGIT: return isDIGIT_LC(character); case _CC_ENUM_GRAPH: return isGRAPH_LC(character); case _CC_ENUM_LOWER: return isLOWER_LC(character); case _CC_ENUM_PRINT: return isPRINT_LC(character); case _CC_ENUM_PSXSPC: return isPSXSPC_LC(character); case _CC_ENUM_PUNCT: return isPUNCT_LC(character); case _CC_ENUM_SPACE: return isSPACE_LC(character); case _CC_ENUM_UPPER: return isUPPER_LC(character); case _CC_ENUM_WORDCHAR: return isWORDCHAR_LC(character); case _CC_ENUM_XDIGIT: return isXDIGIT_LC(character); default: /* VERTSPACE should never occur in locales */ Perl_croak(aTHX_ "panic: isFOO_lc() has an unexpected character class '%d'", classnum); } assert(0); /* NOTREACHED */ return FALSE; }
false
false
false
false
false
0
iwl_mvm_scan_fits(struct iwl_mvm *mvm, int n_ssids, struct ieee80211_scan_ies *ies, int n_channels) { return ((n_ssids <= PROBE_OPTION_MAX) && (n_channels <= mvm->fw->ucode_capa.n_scan_channels) & (ies->common_ie_len + ies->len[NL80211_BAND_2GHZ] + ies->len[NL80211_BAND_5GHZ] <= iwl_mvm_max_scan_ie_fw_cmd_room(mvm))); }
false
false
false
false
false
0
validate_pad_name(const char *s, void *ctx) { char *tmp; status_begin_reporting(); tmp = expand(s, NULL); if (!tmp) return 0; free(tmp); return 1; }
false
false
false
false
false
0
plP_checkdriverinit( char *names) { char *buff; char *tok=NULL; PLINT ret=0; /* set up return code to 0, the value if no devices match*/ buff=(char *)malloc((size_t) PL_NSTREAMS*8); /* Allocate enough memory for 8 characters for each possible stream */ if (buff!=NULL) { memset(buff,0,PL_NSTREAMS*8); /* Make sure we clear it */ plP_getinitdriverlist(buff); /* Get the list of initialised devices */ for (tok = strtok(buff, " ,"); /* Check each device against the "name" */ tok; tok=strtok(0, " ,")) /* supplied to the subroutine */ { if (strstr(names,tok)!=NULL) /* Check to see if the device has been initialised */ { ret++; /* Bump the return code if it has */ } } free(buff); /* Clear up that memory we allocated */ } else ret=-1; /* Error flag */ return(ret); }
false
false
false
false
false
0
pcb(V v,I d,I i,I p){I a;if(!(Sf&&v->p))R d;if(dbg_tpcb)cbtrc(v,1); R a=(I)af4((A)v->p,v->q,d,i,p,v),dc((A)d),a;}
false
false
false
false
false
0
Perl_ck_subr(pTHX_ OP *o) { OP *aop, *cvop; CV *cv; GV *namegv; PERL_ARGS_ASSERT_CK_SUBR; aop = cUNOPx(o)->op_first; if (!aop->op_sibling) aop = cUNOPx(aop)->op_first; aop = aop->op_sibling; for (cvop = aop; cvop->op_sibling; cvop = cvop->op_sibling) ; cv = rv2cv_op_cv(cvop, RV2CVOPCV_MARK_EARLY); namegv = cv ? (GV*)rv2cv_op_cv(cvop, RV2CVOPCV_RETURN_NAME_GV) : NULL; o->op_private &= ~1; o->op_private |= OPpENTERSUB_HASTARG; o->op_private |= (PL_hints & HINT_STRICT_REFS); if (PERLDB_SUB && PL_curstash != PL_debstash) o->op_private |= OPpENTERSUB_DB; if (cvop->op_type == OP_RV2CV) { o->op_private |= (cvop->op_private & OPpENTERSUB_AMPER); op_null(cvop); } else if (cvop->op_type == OP_METHOD || cvop->op_type == OP_METHOD_NAMED) { if (aop->op_type == OP_CONST) aop->op_private &= ~OPpCONST_STRICT; else if (aop->op_type == OP_LIST) { OP * const sib = ((UNOP*)aop)->op_first->op_sibling; if (sib && sib->op_type == OP_CONST) sib->op_private &= ~OPpCONST_STRICT; } } if (!cv) { return ck_entersub_args_list(o); } else { Perl_call_checker ckfun; SV *ckobj; cv_get_call_checker(cv, &ckfun, &ckobj); if (!namegv) { /* expletive! */ /* XXX The call checker API is public. And it guarantees that a GV will be provided with the right name. So we have to create a GV. But it is still not correct, as its stringification will include the package. What we really need is a new call checker API that accepts a GV or string (or GV or CV). */ HEK * const hek = CvNAME_HEK(cv); /* After a syntax error in a lexical sub, the cv that rv2cv_op_cv returns may be a nameless stub. */ if (!hek) return ck_entersub_args_list(o);; namegv = (GV *)sv_newmortal(); gv_init_pvn(namegv, PL_curstash, HEK_KEY(hek), HEK_LEN(hek), SVf_UTF8 * !!HEK_UTF8(hek)); } return ckfun(aTHX_ o, namegv, ckobj); } }
false
false
false
false
false
0
dither_to_matrix(UINT32 color, UINT16 *matrix) { UINT32 rawr = (((color >> 16) & 0xff) * 0xf8*2) / 0xff; UINT32 rawg = (((color >> 8) & 0xff) * 0xfc*2) / 0xff; UINT32 rawb = ((color & 0xff) * 0xf8*2) / 0xff; int i; for (i = 0; i < 16; i++) { UINT32 dither = fbz_dither_matrix[i]; UINT32 newr = rawr + dither; UINT32 newg = rawg + dither/2; UINT32 newb = rawb + dither; matrix[i] = ((newr >> 4) << 11) | ((newg >> 3) << 5) | (newb >> 4); } }
false
false
false
false
false
0
buffer_is_equal_right_len(buffer *b1, buffer *b2, size_t len) { /* no, len -> equal */ if (len == 0) return 1; /* len > 0, but empty buffers -> not equal */ if (b1->used == 0 || b2->used == 0) return 0; /* buffers too small -> not equal */ if (b1->used - 1 < len || b1->used - 1 < len) return 0; if (0 == strncmp(b1->ptr + b1->used - 1 - len, b2->ptr + b2->used - 1 - len, len)) { return 1; } return 0; }
false
false
false
false
true
1
historydisp() { int k; k = SYMbind2(historsym); if(k >= 1 && k <= 3) k++; else if(k >= 'a' || k <= 'c') k = 'a' - k - 1; else k = 2; previnput(k); }
false
false
false
false
false
0
abraca_rating_entry_real_leave_notify_event (GtkWidget* base, GdkEventCrossing* ev) { AbracaRatingEntry * self; gboolean result = FALSE; self = (AbracaRatingEntry*) base; g_return_val_if_fail (ev != NULL, FALSE); _g_free0 (self->priv->_volatile_rating); self->priv->_volatile_rating = NULL; gtk_widget_queue_draw ((GtkWidget*) self); result = FALSE; return result; }
false
false
false
false
false
0
Nget_first_exag_cmd(Nv_data * data, Tcl_Interp * interp, /* Current interpreter. */ int argc, char **argv) { float exag, texag; int nsurfs, i, *surf_list; char buf[128]; surf_list = GS_get_surf_list(&nsurfs); exag = 0.0; for (i = 0; i < nsurfs; i++) { if (GS_get_exag_guess(surf_list[i], &texag) > -1) { if (texag) exag = (texag > exag) ? texag : exag; } } if (exag == 0.0) exag = 1.0; sprintf(buf, "%f", exag); if (nsurfs) free(surf_list); Tcl_SetResult(interp, buf, TCL_VOLATILE); return TCL_OK; }
false
false
false
false
false
0
err(const char *fmt, ...) { va_list ap; va_start(ap, fmt); if (!suppress) { maybe_print_location(); fprintf(stderr, "error: "); vfprintf(stderr, fmt, ap); fprintf(stderr, "\n"); maybe_print_debug_tip(); err_count++; } va_end(ap); }
false
false
false
false
true
1
completeregularpath(path * P, edge_t * first, edge_t * last, pathend_t * tendp, pathend_t * hendp, boxf * boxes, int boxn, int flag) { edge_t *uleft, *uright, *lleft, *lright; int i, fb, lb; splines *spl; pointf *pp; int pn; fb = lb = -1; uleft = uright = NULL; uleft = top_bound(first, -1), uright = top_bound(first, 1); if (uleft) { if (!(spl = getsplinepoints(uleft))) return; pp = spl->list[0].list; pn = spl->list[0].size; } if (uright) { if (!(spl = getsplinepoints(uright))) return; pp = spl->list[0].list; pn = spl->list[0].size; } lleft = lright = NULL; lleft = bot_bound(last, -1), lright = bot_bound(last, 1); if (lleft) { if (!(spl = getsplinepoints(lleft))) return; pp = spl->list[spl->size - 1].list; pn = spl->list[spl->size - 1].size; } if (lright) { if (!(spl = getsplinepoints(lright))) return; pp = spl->list[spl->size - 1].list; pn = spl->list[spl->size - 1].size; } for (i = 0; i < tendp->boxn; i++) add_box(P, tendp->boxes[i]); fb = P->nbox + 1; lb = fb + boxn - 3; for (i = 0; i < boxn; i++) add_box(P, boxes[i]); for (i = hendp->boxn - 1; i >= 0; i--) add_box(P, hendp->boxes[i]); adjustregularpath(P, fb, lb); }
false
false
false
false
false
0
main(void){ register RangeTree *rt = RangeTree_create(); gint total = 0; RangeTree_add(rt, 3, 5, NULL); /* within */ RangeTree_add(rt, 5, 8, NULL); RangeTree_add(rt, 5, 5, NULL); /* within */ RangeTree_add(rt, 2, 1, NULL); RangeTree_add(rt, 9, 5, NULL); RangeTree_add(rt, 7, 3, NULL); /* within */ RangeTree_add(rt, 3, 9, NULL); RangeTree_add(rt, 6, 6, NULL); /* within */ /**/ RangeTree_find(rt, 3, 5, 3, 5, test_rtrf, &total); g_message("total is [%d] (expect 4)", total); g_assert(total == 4); /**/ total = 0; RangeTree_find(rt, 5, 1, 5, 1, test_rtrf, &total); g_message("total is [%d] (expect 1)", total); g_assert(total == 1); /**/ RangeTree_destroy(rt, NULL, NULL); return 0; }
false
false
false
false
false
0
popLastInStatementIndent() { assert(!inStatementIndentStackSizeStack->empty()); int previousIndentStackSize = inStatementIndentStackSizeStack->back(); if (inStatementIndentStackSizeStack->size() > 1) inStatementIndentStackSizeStack->pop_back(); while (previousIndentStackSize < (int) inStatementIndentStack->size()) inStatementIndentStack->pop_back(); }
false
false
false
false
false
0
radeon_pm_in_vbl(struct radeon_device *rdev) { int crtc, vpos, hpos, vbl_status; bool in_vbl = true; /* Iterate over all active crtc's. All crtc's must be in vblank, * otherwise return in_vbl == false. */ for (crtc = 0; (crtc < rdev->num_crtc) && in_vbl; crtc++) { if (rdev->pm.active_crtcs & (1 << crtc)) { vbl_status = radeon_get_crtc_scanoutpos(rdev->ddev, crtc, USE_REAL_VBLANKSTART, &vpos, &hpos, NULL, NULL, &rdev->mode_info.crtcs[crtc]->base.hwmode); if ((vbl_status & DRM_SCANOUTPOS_VALID) && !(vbl_status & DRM_SCANOUTPOS_IN_VBLANK)) in_vbl = false; } } return in_vbl; }
false
false
false
false
false
0
gnac_profiles_utils_get_values_checked_slider_and_set(BasicFormatInfo *bfi, ...) { va_list ap; va_start(ap, bfi); const gchar *name = va_arg(ap, const gchar *); while (name) { const gchar *checkbox_name = va_arg(ap, const gchar *); gdouble *value = va_arg(ap, gdouble *); GtkWidget *widget = gnac_profiles_utils_get_widget(bfi, checkbox_name); if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) { widget = gnac_profiles_utils_get_widget(bfi, name); *value = gtk_range_get_value(GTK_RANGE(widget)); } name = va_arg(ap, const gchar *); } va_end(ap); }
false
false
false
false
false
0
foldedCount(win, lnum, infop) win_T *win; linenr_T lnum; foldinfo_T *infop; { linenr_T last; if (hasFoldingWin(win, lnum, NULL, &last, FALSE, infop)) return (long)(last - lnum + 1); return 0; }
false
false
false
false
false
0
reference_path_available( refdb_fs_backend *backend, const char *new_ref, const char* old_ref, int force) { struct packref *this_ref; if (packed_load(backend) < 0) return -1; if (!force) { int exists; if (refdb_fs_backend__exists(&exists, (git_refdb_backend *)backend, new_ref) < 0) return -1; if (exists) { giterr_set(GITERR_REFERENCE, "Failed to write reference '%s': a reference with " " that name already exists.", new_ref); return GIT_EEXISTS; } } git_strmap_foreach_value(backend->refcache.packfile, this_ref, { if (!ref_is_available(old_ref, new_ref, this_ref->name)) { giterr_set(GITERR_REFERENCE, "The path to reference '%s' collides with an existing one", new_ref); return -1; } }); return 0; }
false
false
false
false
false
0
netsnmp_access_udp_endpoint_entry_free(netsnmp_udp_endpoint_entry * entry) { DEBUGMSGTL(("access:udp_endpoint:entry", "free\n")); if (NULL == entry) return; /* * SNMP_FREE not needed, for any of these, * since the whole entry is about to be freed */ free(entry); }
false
false
false
false
false
0
ossl_ec_key_dh_compute_key(VALUE self, VALUE pubkey) { EC_KEY *ec; EC_POINT *point; int buf_len; VALUE str; Require_EC_KEY(self, ec); SafeRequire_EC_POINT(pubkey, point); /* BUG: need a way to figure out the maximum string size */ buf_len = 1024; str = rb_str_new(0, buf_len); /* BUG: take KDF as a block */ buf_len = ECDH_compute_key(RSTRING_PTR(str), buf_len, point, ec, NULL); if (buf_len < 0) ossl_raise(eECError, "ECDH_compute_key"); rb_str_resize(str, buf_len); return str; }
false
false
false
false
false
0
login_session(struct node_rec *rec) { iscsiadm_req_t req; iscsiadm_rsp_t rsp; int rc, retries = 0; /* * For root boot we cannot change this so increase to account * for boot using static setup. */ rec->session.initial_login_retry_max = 30; /* we cannot answer so turn off */ rec->conn[0].timeo.noop_out_interval = 0; rec->conn[0].timeo.noop_out_timeout = 0; printf("%s: Logging into %s %s:%d,%d\n", program_name, rec->name, rec->conn[0].address, rec->conn[0].port, rec->tpgt); memset(&req, 0, sizeof(req)); req.command = MGMT_IPC_SESSION_LOGIN; memcpy(&req.u.session.rec, rec, sizeof(*rec)); retry: rc = iscsid_exec_req(&req, &rsp, 0); /* * handle race where iscsid proc is starting up while we are * trying to connect. */ if (rc == ISCSI_ERR_ISCSID_NOTCONN && retries < 30) { retries++; sleep(1); goto retry; } else if (rc) iscsi_err_print_msg(rc); return rc; }
false
false
false
false
false
0
def_tag_name(HSCPRC * hp, BOOL * start_tag) { STRPTR nw = NULL; HSCTAG *tag = NULL; DLLIST *taglist = hp->deftag; /* get tag name */ nw = infget_tagid(hp); /* create new tag */ if (nw) { *start_tag = (BOOL) (strcmp(nw, "/")); if (!(*start_tag)) { /* add closing tag */ nw = infget_tagid(hp); if (nw) { tag = find_strtag(taglist, nw); if (tag) { if ((tag->option & HT_CLOSE) || (tag->option & HT_CONTENT)) { /* tried to redefine end tag */ tag = NULL; hsc_message(hp, MSG_REDEFINE_ENDTAG, "redefined %c", nw); } else { /* mark macro as a container */ tag->option |= HT_CLOSE; } } else { /* tried to define end tag without previous start tag */ tag = NULL; hsc_message(hp, MSG_DEFTAG_NO_OPEN, "no start tag for %c", nw); } } /* err_eof already called in infget_tagid() */ } else { tag = find_strtag(taglist, nw); if (tag) { /* find tag-node in list to delete it * NOTE: this is rather stupid, 'cause the list * has to be searched twice this way; but who cares? */ DLNODE *nd = find_dlnode(hp->deftag->first, (APTR) nw, cmp_strtag); /* new tag/macro replaces old tag/macro */ tag->occured = FALSE; hsc_message(hp, MSG_REDEFINE_TAG, "redefined %T", tag); del_dlnode(hp->deftag, nd); } /* create a new opening tag */ tag = app_tag(taglist, nw); } } /* err_eof already called in infget_tagid() */ return (tag); }
false
false
false
false
false
0
L43() {register object *base=vs_base; register object *sup=base+VM43; VC43 vs_check; {object V162; object V163; object V164; V162=(base[0]); V163=(base[1]); V164=(base[2]); vs_top=sup; goto TTL; TTL:; base[3]= ((object)VV[11]); base[4]= (V164); vs_top=(vs_base=base+3)+2; (void) (*Lnk78)(); vs_top=sup; V165= vs_base[0]; base[3]= ((object)VV[16]); base[4]= (V164); vs_top=(vs_base=base+3)+2; (void) (*Lnk69)(); vs_top=sup; V166= vs_base[0]; base[3]= ((object)VV[17]); base[4]= (V164); vs_top=(vs_base=base+3)+2; (void) (*Lnk69)(); vs_top=sup; V167= vs_base[0]; base[3]= list(5,V165,(V162),V166,V167,(V163)); vs_top=(vs_base=base+3)+1; return; } }
false
false
false
false
false
0
up_device_kind_from_string (const gchar *type) { if (type == NULL) return UP_DEVICE_KIND_UNKNOWN; if (g_strcmp0 (type, "line-power") == 0) return UP_DEVICE_KIND_LINE_POWER; if (g_strcmp0 (type, "battery") == 0) return UP_DEVICE_KIND_BATTERY; if (g_strcmp0 (type, "ups") == 0) return UP_DEVICE_KIND_UPS; if (g_strcmp0 (type, "monitor") == 0) return UP_DEVICE_KIND_MONITOR; if (g_strcmp0 (type, "mouse") == 0) return UP_DEVICE_KIND_MOUSE; if (g_strcmp0 (type, "keyboard") == 0) return UP_DEVICE_KIND_KEYBOARD; if (g_strcmp0 (type, "pda") == 0) return UP_DEVICE_KIND_PDA; if (g_strcmp0 (type, "phone") == 0) return UP_DEVICE_KIND_PHONE; if (g_strcmp0 (type, "media-player") == 0) return UP_DEVICE_KIND_MEDIA_PLAYER; if (g_strcmp0 (type, "tablet") == 0) return UP_DEVICE_KIND_TABLET; return UP_DEVICE_KIND_UNKNOWN; }
false
false
false
false
false
0