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
addHdr(HttpConn *conn, cchar *key, cchar *value) { mprAssert(key && *key); mprAssert(value); mprAddKey(conn->tx->headers, key, value); }
false
false
false
false
false
0
parse_signal(const char *sig) { typedef struct signalpair { const char *name; int signal; } SIGNALPAIR; static const SIGNALPAIR signallist[] = { { "ABRT", SIGABRT }, { "ALRM", SIGALRM }, { "FPE", SIGFPE }, { "HUP", SIGHUP }, { "ILL", SIGILL }, { "INT", SIGINT }, { "KILL", SIGKILL }, { "PIPE", SIGPIPE }, { "QUIT", SIGQUIT }, { "SEGV", SIGSEGV }, { "TERM", SIGTERM }, { "USR1", SIGUSR1 }, { "USR2", SIGUSR2 }, { "CHLD", SIGCHLD }, { "CONT", SIGCONT }, { "STOP", SIGSTOP }, { "TSTP", SIGTSTP }, { "TTIN", SIGTTIN }, { "TTOU", SIGTTOU }, { "NULL", 0 }, }; unsigned int i = 0; const char *s; if (!sig || *sig == '\0') return -1; if (sscanf(sig, "%u", &i) == 1) { if (i < NSIG) return i; eerrorx("%s: `%s' is not a valid signal", applet, sig); } if (strncmp(sig, "SIG", 3) == 0) s = sig + 3; else s = NULL; for (i = 0; i < ARRAY_SIZE(signallist); ++i) if (strcmp(sig, signallist[i].name) == 0 || (s && strcmp(s, signallist[i].name) == 0)) return signallist[i].signal; eerrorx("%s: `%s' is not a valid signal", applet, sig); /* NOTREACHED */ }
false
false
false
false
false
0
PKIX_PL_HashTable_Lookup( PKIX_PL_HashTable *ht, PKIX_PL_Object *key, PKIX_PL_Object **pResult, void *plContext) { PKIX_PL_Mutex *lockedMutex = NULL; PKIX_UInt32 hashCode; PKIX_PL_EqualsCallback keyComp; PKIX_PL_Object *result = NULL; PKIX_ENTER(HASHTABLE, "PKIX_PL_HashTable_Lookup"); #if !defined(PKIX_OBJECT_LEAK_TEST) PKIX_NULLCHECK_THREE(ht, key, pResult); #else PKIX_NULLCHECK_TWO(key, pResult); if (ht == NULL) { PKIX_RETURN(HASHTABLE); } #endif PKIX_CHECK(PKIX_PL_Object_Hashcode(key, &hashCode, plContext), PKIX_OBJECTHASHCODEFAILED); PKIX_CHECK(pkix_pl_Object_RetrieveEqualsCallback (key, &keyComp, plContext), PKIX_OBJECTRETRIEVEEQUALSCALLBACKFAILED); PKIX_MUTEX_LOCK(ht->tableLock); /* Lookup in primitive hashtable */ PKIX_CHECK(pkix_pl_PrimHashTable_Lookup (ht->primHash, (void *)key, hashCode, keyComp, (void **)&result, plContext), PKIX_PRIMHASHTABLELOOKUPFAILED); PKIX_INCREF(result); PKIX_MUTEX_UNLOCK(ht->tableLock); *pResult = result; cleanup: PKIX_MUTEX_UNLOCK(ht->tableLock); PKIX_RETURN(HASHTABLE); }
false
false
false
false
false
0
GetLineIndentInSpaces(int line) const { cbStyledTextCtrl* control = GetControl(); int currLine = (line == -1) ? control->LineFromPosition(control->GetCurrentPos()) : line; wxString text = control->GetLine(currLine); unsigned int len = text.Length(); int spaceCount = 0; for (unsigned int i = 0; i < len; ++i) { if (text[i] == _T(' ')) { ++spaceCount; } else if (text[i] == _T('\t')) { spaceCount += control->GetTabWidth(); } else { break; } } return spaceCount; }
false
false
false
false
false
0
visit_enter(ir_call *call) { /* At global scope this->current will be NULL. Since there is no way to * call global scope, it can never be part of a cycle. Don't bother * adding calls from global scope to the graph. */ if (this->current == NULL) return visit_continue; function *const target = this->get_function(call->callee); /* Create a link from the caller to the callee. */ call_node *node = new(mem_ctx) call_node; node->func = target; this->current->callees.push_tail(node); /* Create a link from the callee to the caller. */ node = new(mem_ctx) call_node; node->func = this->current; target->callers.push_tail(node); return visit_continue; }
false
false
false
false
false
0
rtl_disable(struct r8152 *tp) { u32 ocp_data; int i; if (test_bit(RTL8152_UNPLUG, &tp->flags)) { rtl_drop_queued_tx(tp); return; } ocp_data = ocp_read_dword(tp, MCU_TYPE_PLA, PLA_RCR); ocp_data &= ~RCR_ACPT_ALL; ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, ocp_data); rtl_drop_queued_tx(tp); for (i = 0; i < RTL8152_MAX_TX; i++) usb_kill_urb(tp->tx_info[i].urb); rxdy_gated_en(tp, true); for (i = 0; i < 1000; i++) { ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); if ((ocp_data & FIFO_EMPTY) == FIFO_EMPTY) break; usleep_range(1000, 2000); } for (i = 0; i < 1000; i++) { if (ocp_read_word(tp, MCU_TYPE_PLA, PLA_TCR0) & TCR0_TX_EMPTY) break; usleep_range(1000, 2000); } rtl_stop_rx(tp); rtl8152_nic_reset(tp); }
false
false
false
false
false
0
ColouriseComment(StyleContext& sc, bool& /*apostropheStartsAttribute*/) { // Apostrophe meaning is not changed, but the parameter is present for uniformity sc.SetState(SCE_ADA_COMMENTLINE); while (!sc.atLineEnd) { sc.Forward(); } }
false
false
false
false
false
0
memcmp_extent_buffer(struct extent_buffer *eb, const void *ptrv, unsigned long start, unsigned long len) { size_t cur; size_t offset; struct page *page; char *kaddr; char *ptr = (char *)ptrv; size_t start_offset = eb->start & ((u64)PAGE_CACHE_SIZE - 1); unsigned long i = (start_offset + start) >> PAGE_CACHE_SHIFT; int ret = 0; WARN_ON(start > eb->len); WARN_ON(start + len > eb->start + eb->len); offset = (start_offset + start) & (PAGE_CACHE_SIZE - 1); while (len > 0) { page = eb->pages[i]; cur = min(len, (PAGE_CACHE_SIZE - offset)); kaddr = page_address(page); ret = memcmp(ptr, kaddr + offset, cur); if (ret) break; ptr += cur; len -= cur; offset = 0; i++; } return ret; }
false
false
false
false
false
0
infd_session_proxy_is_subscribed(InfdSessionProxy* proxy, InfXmlConnection* connection) { g_return_val_if_fail(INFD_IS_SESSION_PROXY(proxy), FALSE); g_return_val_if_fail(INF_IS_XML_CONNECTION(connection), FALSE); if(infd_session_proxy_find_subscription(proxy, connection) == NULL) return FALSE; return TRUE; }
false
false
false
false
false
0
_mesa_hash_table_search(struct hash_table *ht, uint32_t hash, const void *key) { uint32_t start_hash_address = hash % ht->size; uint32_t hash_address = start_hash_address; do { uint32_t double_hash; struct hash_entry *entry = ht->table + hash_address; if (entry_is_free(entry)) { return NULL; } else if (entry_is_present(ht, entry) && entry->hash == hash) { if (ht->key_equals_function(key, entry->key)) { return entry; } } double_hash = 1 + hash % ht->rehash; hash_address = (hash_address + double_hash) % ht->size; } while (hash_address != start_hash_address); return NULL; }
false
false
false
false
false
0
sony_nc_battery_care_health_show(struct device *dev, struct device_attribute *attr, char *buffer) { ssize_t count = 0; unsigned int health; if (sony_call_snc_handle(bcare_ctl->handle, 0x0200, &health)) return -EIO; count = snprintf(buffer, PAGE_SIZE, "%d\n", health & 0xff); return count; }
false
false
false
false
false
0
length_of_encoded_string(ulonglong len) { /* The prefix length is a 1-, 2-, 3-, or 8-byte integer that represents the length of the string in bytes. See net_store_length for details. */ if (len < 251ULL) len+= 1; else if (len < 65536ULL) len+= 3; else if (len < 16777216ULL) len+= 4; else len+= 9; return len; }
false
false
false
false
false
0
sheet_redraw_region (Sheet const *sheet, int start_col, int start_row, int end_col, int end_row) { GnmRange bound; g_return_if_fail (IS_SHEET (sheet)); /* * Getting the bounding box causes row respans to be done if * needed. That can be expensive, so just redraw the whole * sheet if the row count is too big. */ if (end_row - start_row > 500) { sheet_redraw_all (sheet, FALSE); return; } /* We potentially do a lot of recalcs as part of this, so make sure stuff that caches sub-computations see the whole thing instead of clearing between cells. */ gnm_app_recalc_start (); sheet_range_bounding_box (sheet, range_init (&bound, start_col, start_row, end_col, end_row)); SHEET_FOREACH_CONTROL (sheet, view, control, sc_redraw_range (control, &bound);); gnm_app_recalc_finish (); }
false
false
false
false
false
0
re_comp_w(regexp** rpp, const CHAR_TYPE* exp) { register CHAR_TYPE *scan; int flags; struct comp co; int error = 0; if(!rpp) FAIL("Invalid out regexp pointer", REGEXP_BADARG); { register regexp* r; if (exp == NULL) FAIL("Invalid expression", REGEXP_BADARG); /* First pass: determine size, legality. */ co.regparse = (CHAR_TYPE *)exp; co.regnpar = 1; co.regsize = 0L; co.regdummy[0] = NOTHING; co.regdummy[1] = co.regdummy[2] = 0; co.regcode = co.regdummy; regc(&co, MAGIC); if (reg(&co, 0, &flags, &error) == NULL) return error; /* Small enough for pointer-storage convention? */ if (co.regsize >= 0x7fffL) /* Probably could be 0xffffL. */ FAIL("regexp too big", REGEXP_ESIZE); /* Allocate space. */ r = (regexp *)re_malloc(sizeof(regexp) + (size_t)co.regsize*sizeof(CHAR_TYPE)); if (r == NULL) FAIL("out of space", REGEXP_ESPACE); /* Second pass: emit code. */ co.regparse = (CHAR_TYPE *)exp; co.regnpar = 1; co.regcode = r->program; regc(&co, MAGIC); if(reg(&co, 0, &flags, &error) == NULL) { re_cfree(r); return error; } /* Dig out information for optimizations. */ r->regstart = LIT('\0'); /* Worst-case defaults. */ r->reganch = 0; r->regmust = NULL; r->regmlen = 0; scan = r->program+1; /* First BRANCH. */ if (OP(regnext(scan)) == END) { /* Only one top-level choice. */ scan = OPERAND(scan); /* Starting-point info. */ if (OP(scan) == EXACTLY) r->regstart = *OPERAND(scan); else if (OP(scan) == BOL) r->reganch = 1; /* * If there's something expensive in the r.e., find the * longest literal string that must appear and make it the * regmust. Resolve ties in favor of later strings, since * the regstart check works with the beginning of the r.e. * and avoiding duplication strengthens checking. Not a * strong reason, but sufficient in the absence of others. */ if (flags&SPSTART) { register CHAR_TYPE *longest = NULL; register size_t len = 0; for (; scan != NULL; scan = regnext(scan)) if (OP(scan) == EXACTLY && cstrlen(OPERAND(scan)) >= len) { longest = OPERAND(scan); len = cstrlen(OPERAND(scan)); } r->regmust = longest; r->regmlen = (int)len; } } r->regnsubexp = co.regnpar; *rpp = r; return 0; } }
false
false
false
false
false
0
nokia_isi_isi_unsolicited_handler_construct (GType object_type, FsoGsmModem* modem) { NokiaIsiIsiUnsolicitedHandler * self = NULL; FsoGsmModem* _tmp0_ = NULL; FsoGsmModem* _tmp1_ = NULL; GIsiCommModemAccess* _tmp2_ = NULL; GIsiCommNetwork* _tmp3_ = NULL; GIsiCommModemAccess* _tmp4_ = NULL; GIsiCommNetwork* _tmp5_ = NULL; GIsiCommModemAccess* _tmp6_ = NULL; GIsiCommCall* _tmp7_ = NULL; g_return_val_if_fail (modem != NULL, NULL); self = (NokiaIsiIsiUnsolicitedHandler*) fso_framework_abstract_object_construct (object_type); _tmp0_ = modem; _tmp1_ = _g_object_ref0 (_tmp0_); _g_object_unref0 (self->priv->modem); self->priv->modem = _tmp1_; _tmp2_ = nokia_isi_isimodem; _tmp3_ = _tmp2_->net; g_signal_connect_object (_tmp3_, "signal-strength", (GCallback) _nokia_isi_isi_unsolicited_handler_onSignalStrengthUpdate_gisi_comm_network_signal_strength, self, 0); _tmp4_ = nokia_isi_isimodem; _tmp5_ = _tmp4_->net; g_signal_connect_object (_tmp5_, "registration-status", (GCallback) _nokia_isi_isi_unsolicited_handler_onRegistrationStatusUpdate_gisi_comm_network_registration_status, self, 0); _tmp6_ = nokia_isi_isimodem; _tmp7_ = _tmp6_->call; g_signal_connect_object (_tmp7_, "status-changed", (GCallback) _nokia_isi_isi_unsolicited_handler_onCallStatusUpdate_gisi_comm_call_status_changed, self, 0); return self; }
false
false
false
false
false
0
reload_rules_cmd(int fd, const char* cmd) { ios_detach_global_handler(); if(reload_rules(sensor) < 0) { char message[] = "Malformed rule file. Correct it and reload rules again\n"; write(fd, message, strlen(message)); } else { fprint_rules(fd); ios_attach_global_handler(process_data); } return 1; }
false
false
false
false
false
0
_Py_bytes_capitalize(char *result, char *s, Py_ssize_t len) { Py_ssize_t i; /* newobj = PyString_FromStringAndSize(NULL, len); if (newobj == NULL) return NULL; s_new = PyString_AsString(newobj); */ if (0 < len) { int c = Py_CHARMASK(*s++); if (Py_ISLOWER(c)) *result = Py_TOUPPER(c); else *result = c; result++; } for (i = 1; i < len; i++) { int c = Py_CHARMASK(*s++); if (Py_ISUPPER(c)) *result = Py_TOLOWER(c); else *result = c; result++; } }
false
false
false
false
false
0
crush_hash32_rjenkins1(__u32 a) { __u32 hash = crush_hash_seed ^ a; __u32 b = a; __u32 x = 231232; __u32 y = 1232; crush_hashmix(b, x, hash); crush_hashmix(y, a, hash); return hash; }
false
false
false
false
false
0
intr2 (int sig _GL_UNUSED_PARAMETER) { if (localchars) { #ifdef KLUDGELINEMODE if (kludgelinemode) sendbrk (); else #endif sendabort (); return; } }
false
false
false
false
false
0
es_func_fp_write (void *cookie, const void *buffer, size_t size) { estream_cookie_fp_t file_cookie = cookie; size_t bytes_written; if (file_cookie->fp) bytes_written = fwrite (buffer, 1, size, file_cookie->fp); else bytes_written = size; /* Successfully written to the bit bucket. */ if (bytes_written != size) return -1; return bytes_written; }
false
false
false
false
false
0
t3_get_tp_version(struct adapter *adapter, u32 *vers) { int ret; /* Get version loaded in SRAM */ t3_write_reg(adapter, A_TP_EMBED_OP_FIELD0, 0); ret = t3_wait_op_done(adapter, A_TP_EMBED_OP_FIELD0, 1, 1, 5, 1); if (ret) return ret; *vers = t3_read_reg(adapter, A_TP_EMBED_OP_FIELD1); return 0; }
false
false
false
false
false
0
Keyak_ProcessAssociatedData(Keccak_DuplexInstance* duplex, const unsigned char *data, unsigned int dataSizeInBytes, int last, int bodyFollows) { unsigned int rhoInBytes = (duplex->rate-4)/8; while(dataSizeInBytes > 0) { unsigned int localSize; if (Keccak_DuplexGetInputIndex(duplex) == rhoInBytes) Keccak_Duplexing(duplex, 0, 0, 0, 0, 0x04); // 00 localSize = dataSizeInBytes; if (localSize > (rhoInBytes - Keccak_DuplexGetInputIndex(duplex))) localSize = rhoInBytes - Keccak_DuplexGetInputIndex(duplex); Keccak_DuplexingFeedPartialInput(duplex, data, localSize); data += localSize; dataSizeInBytes -= localSize; } if (last) { if (bodyFollows) Keccak_Duplexing(duplex, 0, 0, 0, 0, 0x06); // 01 else Keccak_Duplexing(duplex, 0, 0, 0, 0, 0x05); // 10 } }
false
false
false
false
false
0
set_vclk(struct tridentfb_par *par, unsigned long freq) { int m, n, k; unsigned long fi, d, di; unsigned char best_m = 0, best_n = 0, best_k = 0; unsigned char hi, lo; unsigned char shift = !is_oldclock(par->chip_id) ? 2 : 1; d = 20000; for (k = shift; k >= 0; k--) for (m = 1; m < 32; m++) { n = ((m + 2) << shift) - 8; for (n = (n < 0 ? 0 : n); n < 122; n++) { fi = ((14318l * (n + 8)) / (m + 2)) >> k; di = abs(fi - freq); if (di < d || (di == d && k == best_k)) { d = di; best_n = n; best_m = m; best_k = k; } if (fi > freq) break; } } if (is_oldclock(par->chip_id)) { lo = best_n | (best_m << 7); hi = (best_m >> 1) | (best_k << 4); } else { lo = best_n; hi = best_m | (best_k << 6); } if (is3Dchip(par->chip_id)) { vga_mm_wseq(par->io_virt, ClockHigh, hi); vga_mm_wseq(par->io_virt, ClockLow, lo); } else { t_outb(par, lo, 0x43C8); t_outb(par, hi, 0x43C9); } debug("VCLK = %X %X\n", hi, lo); }
false
false
false
false
false
0
_cupsSNMPDefaultCommunity(void) { cups_file_t *fp; /* snmp.conf file */ char line[1024], /* Line from file */ *value; /* Value from file */ int linenum; /* Line number in file */ _cups_globals_t *cg = _cupsGlobals(); /* Global data */ DEBUG_puts("4_cupsSNMPDefaultCommunity()"); if (!cg->snmp_community[0]) { strlcpy(cg->snmp_community, "public", sizeof(cg->snmp_community)); snprintf(line, sizeof(line), "%s/snmp.conf", cg->cups_serverroot); if ((fp = cupsFileOpen(line, "r")) != NULL) { linenum = 0; while (cupsFileGetConf(fp, line, sizeof(line), &value, &linenum)) if (!_cups_strcasecmp(line, "Community") && value) { strlcpy(cg->snmp_community, value, sizeof(cg->snmp_community)); break; } cupsFileClose(fp); } } DEBUG_printf(("5_cupsSNMPDefaultCommunity: Returning \"%s\"", cg->snmp_community)); return (cg->snmp_community); }
false
false
false
false
false
0
getLocalizedCountry(const UnicodeString &countryCode, const Locale &locale, UnicodeString &displayCountry) { // We do not want to use display country names only from the target language bundle // Note: we should do this in better way. displayCountry.remove(); int32_t ccLen = countryCode.length(); if (ccLen > 0 && ccLen < ULOC_COUNTRY_CAPACITY) { UErrorCode status = U_ZERO_ERROR; UResourceBundle *localeBundle = ures_open(NULL, locale.getName(), &status); if (U_SUCCESS(status)) { const char *bundleLocStr = ures_getLocale(localeBundle, &status); if (U_SUCCESS(status) && uprv_strlen(bundleLocStr) > 0) { Locale bundleLoc(bundleLocStr); if (uprv_strcmp(bundleLocStr, "root") != 0 && uprv_strcmp(bundleLoc.getLanguage(), locale.getLanguage()) == 0) { // Create a fake locale strings char tmpLocStr[ULOC_COUNTRY_CAPACITY + 3]; uprv_strcpy(tmpLocStr, "xx_"); u_UCharsToChars(countryCode.getBuffer(), &tmpLocStr[3], ccLen); tmpLocStr[3 + ccLen] = 0; Locale tmpLoc(tmpLocStr); tmpLoc.getDisplayCountry(locale, displayCountry); } } } ures_close(localeBundle); } if (displayCountry.isEmpty()) { // Use the country code as the fallback displayCountry.setTo(countryCode); } return displayCountry; }
false
false
false
false
false
0
property_editor_handle_object_created(struct property_editor *pe, int tag, int object_id) { enum editor_object_type objtype; struct property_page *pp; for (objtype = 0; objtype < NUM_OBJTYPES; objtype++) { if (objtype_is_conserved(objtype)) { continue; } pp = property_editor_get_page(pe, objtype); property_page_object_created(pp, tag, object_id); } }
false
false
false
false
false
0
transchar_byte(c) int c; { if (enc_utf8 && c >= 0x80) { transchar_nonprint(transchar_buf, c); return transchar_buf; } return transchar(c); }
false
false
false
false
false
0
getnumlimit (Header *h, const char **fmt, int df) { int sz = getnum(fmt, df); if (sz > MAXINTSIZE || sz <= 0) luaL_error(h->L, "integral size (%d) out of limits [1,%d]", sz, MAXINTSIZE); return sz; }
false
false
false
false
false
0
_gen_job_prio(struct job_record *job_ptr) { uint32_t job_prio; if (job_ptr->part_ptr) job_prio = job_ptr->part_ptr->priority << 16; else job_prio = 0; if (job_ptr->node_cnt >= 0xffff) job_prio += 0xffff; else job_prio += job_ptr->node_cnt; return job_prio; }
false
false
false
false
false
0
gnm_soc_user_config (SheetObject *so, SheetControl *sc) { SheetObjectComponent *soc = SHEET_OBJECT_COMPONENT (so); GtkWidget *w; GOComponent *new_comp; g_return_if_fail (soc && soc->component); go_component_set_command_context (soc->component, GO_CMD_CONTEXT (scg_wbcg (SHEET_CONTROL_GUI (sc)))); new_comp = go_component_duplicate (soc->component); go_component_set_command_context (new_comp, GO_CMD_CONTEXT (scg_wbcg (SHEET_CONTROL_GUI (sc)))); w = (GtkWidget *) go_component_edit (new_comp); go_component_set_command_context (soc->component, NULL); if (w) { gnm_soc_user_config_t *data = g_new0 (gnm_soc_user_config_t, 1); data->so = so; data->component = new_comp; data->wbc = WORKBOOK_CONTROL (scg_wbcg (SHEET_CONTROL_GUI (sc))); data->signal = g_signal_connect (new_comp, "changed", G_CALLBACK (component_changed_cb), data); g_object_set_data_full (G_OBJECT (w), "editor", data, (GDestroyNotify) destroy_cb); wbc_gtk_attach_guru (scg_wbcg (SHEET_CONTROL_GUI (sc)), w); } }
false
false
false
false
false
0
startfile() /* called at the beginning of an abc tune by event_refno */ /* This sets up all the default values */ { int j; if (verbose) { printf("scanning tune\n"); }; /* set up defaults */ sf = 0; mi = 0; setmap(0, global.basemap, global.basemul); copymap(&global); global.octaveshift = 0; voicecount = 0; head = NULL; v = NULL; time_num = 4; time_denom = 4; timesigset = 0; barchecking = 1; global.default_length = -1; event_tempo(120, 1, 4, 0,NULL, NULL); notes = 0; ntexts = 0; gfact_num = 1; gfact_denom = 3; global_transpose = 0; hornpipe = 0; karaoke = 0; retain_accidentals = 1; ratio_a = 2; ratio_b = 4; wcount = 0; parts = -1; middle_c = 60; for (j=0; j<26; j++) { part_start[j] = -1; }; headerpartlabel = 0; additive = 1; initvstring(&part); }
false
false
false
false
false
0
numaEvalBestHaarParameters(NUMA *nas, l_float32 relweight, l_int32 nwidth, l_int32 nshift, l_float32 minwidth, l_float32 maxwidth, l_float32 *pbestwidth, l_float32 *pbestshift, l_float32 *pbestscore) { l_int32 i, j; l_float32 delwidth, delshift, width, shift, score; l_float32 bestwidth, bestshift, bestscore; PROCNAME("numaEvalBestHaarParameters"); if (!nas) return ERROR_INT("nas not defined", procName, 1); if (!pbestwidth || !pbestshift) return ERROR_INT("&bestwidth and &bestshift not defined", procName, 1); bestscore = 0.0; delwidth = (maxwidth - minwidth) / (nwidth - 1.0); for (i = 0; i < nwidth; i++) { width = minwidth + delwidth * i; delshift = width / (l_float32)(nshift); for (j = 0; j < nshift; j++) { shift = j * delshift; numaEvalHaarSum(nas, width, shift, relweight, &score); if (score > bestscore) { bestscore = score; bestwidth = width; bestshift = shift; #if DEBUG_FREQUENCY fprintf(stderr, "width = %7.3f, shift = %7.3f, score = %7.3f\n", width, shift, score); #endif /* DEBUG_FREQUENCY */ } } } *pbestwidth = bestwidth; *pbestshift = bestshift; if (pbestscore) *pbestscore = bestscore; return 0; }
false
false
false
false
true
1
_ibar_icon_signal_emit(IBar_Icon *ic, char *sig, char *src) { if (ic->o_holder) edje_object_signal_emit(ic->o_holder, sig, src); if (ic->o_icon) edje_object_signal_emit(ic->o_icon, sig, src); if (ic->o_holder2) edje_object_signal_emit(ic->o_holder2, sig, src); if (ic->o_icon2) edje_object_signal_emit(ic->o_icon2, sig, src); }
false
false
false
false
false
0
mmap64 (void *addr, size_t length, int prot, int flags, int fd, off64_t offset) { WRAPPER_EXECUTION_DISABLE_CKPT(); void *retval = _real_mmap64(addr, length, prot, flags, fd, offset); WRAPPER_EXECUTION_ENABLE_CKPT(); return retval; }
false
false
false
false
false
0
mono_custom_attrs_from_assembly (MonoAssembly *assembly) { guint32 idx; if (assembly->image->dynamic) return lookup_custom_attr (assembly->image, assembly); idx = 1; /* there is only one assembly */ idx <<= MONO_CUSTOM_ATTR_BITS; idx |= MONO_CUSTOM_ATTR_ASSEMBLY; return mono_custom_attrs_from_index (assembly->image, idx); }
false
false
false
false
false
0
rtf_object_begin(struct rtf_state* state,cli_ctx* ctx,const char* tmpdir) { struct rtf_object_data* data = cli_malloc(sizeof(*data)); if(!data) { cli_errmsg("rtf_object_begin: Unable to allocate memory for object data\n"); return CL_EMEM; } data->fd = -1; data->partial = 0; data->has_partial = 0; data->bread = 0; data->internal_state = WAIT_MAGIC; data->tmpdir = tmpdir; data->ctx = ctx; data->name = NULL; data->desc_name = NULL; state->cb_data = data; return 0; }
false
false
false
false
false
0
updateFromElement() { int ml = element()->maxLength(); if ( ml < 0 ) ml = 32767; if ( widget()->maxLength() != ml ) { widget()->setMaxLength( ml ); } if (element()->value().string() != widget()->text()) { m_blockElementUpdates = true; // Do not block signals here (#188374) int pos = widget()->cursorPosition(); widget()->setText(element()->value().string()); widget()->setCursorPosition(pos); m_blockElementUpdates = false; } widget()->setReadOnly(element()->readOnly()); widget()->setClickMessage(element()->placeholder().string().remove(QLatin1Char('\n')).remove(QLatin1Char('\r'))); RenderFormElement::updateFromElement(); }
false
false
false
false
false
0
AllocateEdgeHashEntryPool() { if ( freeEntryindex == 0 ) { vtkTableBasedClipperEdgeHashEntry * newlist = new vtkTableBasedClipperEdgeHashEntry[ POOL_SIZE ]; edgeHashEntrypool.push_back( newlist ); for ( int i = 0; i < POOL_SIZE; i ++ ) { freeEntrylist[i] = &( newlist[i] ); } freeEntryindex = POOL_SIZE; } }
false
false
false
false
false
0
pango_fontmap_pango_font_map_load_fontset(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_) { ScmObj fontmap_scm; PangoFontMap* fontmap; ScmObj context_scm; PangoContext* context; ScmObj desc_scm; PangoFontDescription* desc; ScmObj language_scm; PangoLanguage* language; ScmObj SCM_SUBRARGS[4]; int SCM_i; SCM_ENTER_SUBR("pango-font-map-load-fontset"); for (SCM_i=0; SCM_i<4; SCM_i++) { SCM_SUBRARGS[SCM_i] = SCM_ARGREF(SCM_i); } fontmap_scm = SCM_SUBRARGS[0]; if (!SCM_PANGO_FONT_MAP_P(fontmap_scm)) Scm_Error("<pango-font-map> required, but got %S", fontmap_scm); fontmap = SCM_PANGO_FONT_MAP(fontmap_scm); context_scm = SCM_SUBRARGS[1]; if (!SCM_PANGO_CONTEXT_P(context_scm)) Scm_Error("<pango-context> required, but got %S", context_scm); context = SCM_PANGO_CONTEXT(context_scm); desc_scm = SCM_SUBRARGS[2]; if (!SCM_PANGO_FONT_DESCRIPTION_P(desc_scm)) Scm_Error("<pango-font-description> required, but got %S", desc_scm); desc = SCM_PANGO_FONT_DESCRIPTION(desc_scm); language_scm = SCM_SUBRARGS[3]; if (!SCM_PANGO_LANGUAGE_P(language_scm)) Scm_Error("<pango-language> required, but got %S", language_scm); language = SCM_PANGO_LANGUAGE(language_scm); { { PangoFontset* SCM_RESULT; SCM_RESULT = pango_font_map_load_fontset(fontmap, context, desc, language); SCM_RETURN(SCM_MAKE_PANGO_FONTSET(SCM_RESULT)); } } }
false
false
false
false
false
0
qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) { if (_c == QMetaObject::InvokeMetaMethod) { Q_ASSERT(staticMetaObject.cast(_o)); GenerateMultipleThread *_t = static_cast<GenerateMultipleThread *>(_o); switch (_id) { case 0: _t->timetableStarted((*reinterpret_cast< int(*)>(_a[1]))); break; case 1: _t->timetableGenerated((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< const QString(*)>(_a[2])),(*reinterpret_cast< bool(*)>(_a[3]))); break; case 2: _t->finished(); break; default: ; } } }
false
false
false
false
false
0
pop_best_coalesce (coalesce_list_p cl, int *p1, int *p2) { coalesce_pair_p node; int ret; if (cl->sorted == NULL) return pop_cost_one_pair (cl, p1, p2); if (cl->num_sorted == 0) return pop_cost_one_pair (cl, p1, p2); node = cl->sorted[--(cl->num_sorted)]; *p1 = node->first_element; *p2 = node->second_element; ret = node->cost; free (node); return ret; }
false
false
false
false
false
0
em28xx_attach_xc3028(u8 addr, struct em28xx *dev) { struct dvb_frontend *fe; struct xc2028_config cfg; struct xc2028_ctrl ctl; memset(&cfg, 0, sizeof(cfg)); cfg.i2c_adap = &dev->i2c_adap[dev->def_i2c_bus]; cfg.i2c_addr = addr; memset(&ctl, 0, sizeof(ctl)); em28xx_setup_xc3028(dev, &ctl); cfg.ctrl = &ctl; if (!dev->dvb->fe[0]) { em28xx_errdev("/2: dvb frontend not attached. " "Can't attach xc3028\n"); return -EINVAL; } fe = dvb_attach(xc2028_attach, dev->dvb->fe[0], &cfg); if (!fe) { em28xx_errdev("/2: xc3028 attach failed\n"); dvb_frontend_detach(dev->dvb->fe[0]); dev->dvb->fe[0] = NULL; return -EINVAL; } em28xx_info("%s/2: xc3028 attached\n", dev->name); return 0; }
false
false
false
false
false
0
utf8_string(gchar *string) { gchar *utf8 = NULL; if ( g_utf8_validate(string, -1, NULL) || (utf8 = g_locale_to_utf8(string, -1, NULL, NULL, NULL)) == NULL ) utf8 = g_strdup(string); return utf8; }
false
false
false
false
false
0
test_remove_level2_2internal_merge_left(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ hsize_t rrecord; /* Record to remove from tree */ hsize_t nrec; /* Number of records in B-tree */ haddr_t root_addr; /* Address of root of B-tree created */ H5B2_node_info_test_t ninfo; /* B-tree node info */ unsigned u; /* Local index variable */ TESTING("B-tree remove: merge 2 internal nodes to 1 in level-2 B-tree (l->r)"); /* Create the file for the test */ if(create_file(&file, &f, fapl) < 0) TEST_ERROR /* Create the v2 B-tree & get its address */ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) TEST_ERROR /* Create level-2 B-tree with 3 internal nodes */ for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 59) + 1); u++) { record = u; if(H5B2_insert(bt2, dxpl, &record) < 0) FAIL_STACK_ERROR } /* end for */ /* Check record values in root of B-tree */ record = 1889; /* Left record in root node */ if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) TEST_ERROR ninfo.depth = 2; ninfo.nrec = 2; record = 2834; /* Right record in root node */ if(check_node_info(bt2, dxpl, record, &ninfo) < 0) TEST_ERROR /* Query the number of records in the B-tree */ if(H5B2_get_nrec(bt2, &nrec) < 0) FAIL_STACK_ERROR /* Make certain that the # of records is correct */ if(nrec != ((INSERT_SPLIT_ROOT_NREC * 59) + 1)) TEST_ERROR /* Query the address of the root node in the B-tree */ if(H5B2_get_root_addr_test(bt2, &root_addr) < 0) FAIL_STACK_ERROR /* Make certain that the address of the root node is defined */ if(!H5F_addr_defined(root_addr)) TEST_ERROR /* Check for closing & re-opening the B-tree */ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) TEST_ERROR /* Attempt to remove records from a level-2 B-tree to force 2 internal nodes to merge */ for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 21) + 15); u++) { record = u; rrecord = HSIZET_MAX; if(H5B2_remove(bt2, dxpl, &record, remove_cb, &rrecord) < 0) FAIL_STACK_ERROR /* Make certain that the record value is correct */ if(rrecord != u) TEST_ERROR /* Query the number of records in the B-tree */ if(H5B2_get_nrec(bt2, &nrec) < 0) FAIL_STACK_ERROR /* Make certain that the # of records is correct */ if(nrec != (((INSERT_SPLIT_ROOT_NREC * 59) + 1) - (u + 1))) TEST_ERROR } /* end for */ /* Check status of B-tree */ ninfo.depth = 2; ninfo.nrec = 1; record = 2834; /* Middle record in root node */ if(check_node_info(bt2, dxpl, record, &ninfo) < 0) TEST_ERROR /* Close the v2 B-tree */ if(H5B2_close(bt2, dxpl) < 0) FAIL_STACK_ERROR bt2 = NULL; /* Close file */ if(H5Fclose(file) < 0) TEST_ERROR PASSED(); return 0; error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2, dxpl); H5Fclose(file); } H5E_END_TRY; return 1; }
false
false
false
false
false
0
alloc_key(struct ssh_cipher_struct *cipher) { cipher->key = malloc(cipher->keylen); if (cipher->key == NULL) { return -1; } return 0; }
false
false
false
false
false
0
setattr_chown(struct inode *inode, struct iattr *attr) { struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_sbd *sdp = GFS2_SB(inode); kuid_t ouid, nuid; kgid_t ogid, ngid; int error; struct gfs2_alloc_parms ap; ouid = inode->i_uid; ogid = inode->i_gid; nuid = attr->ia_uid; ngid = attr->ia_gid; if (!(attr->ia_valid & ATTR_UID) || uid_eq(ouid, nuid)) ouid = nuid = NO_UID_QUOTA_CHANGE; if (!(attr->ia_valid & ATTR_GID) || gid_eq(ogid, ngid)) ogid = ngid = NO_GID_QUOTA_CHANGE; error = get_write_access(inode); if (error) return error; error = gfs2_rs_alloc(ip); if (error) goto out; error = gfs2_rindex_update(sdp); if (error) goto out; error = gfs2_quota_lock(ip, nuid, ngid); if (error) goto out; ap.target = gfs2_get_inode_blocks(&ip->i_inode); if (!uid_eq(ouid, NO_UID_QUOTA_CHANGE) || !gid_eq(ogid, NO_GID_QUOTA_CHANGE)) { error = gfs2_quota_check(ip, nuid, ngid, &ap); if (error) goto out_gunlock_q; } error = gfs2_trans_begin(sdp, RES_DINODE + 2 * RES_QUOTA, 0); if (error) goto out_gunlock_q; error = gfs2_setattr_simple(inode, attr); if (error) goto out_end_trans; if (!uid_eq(ouid, NO_UID_QUOTA_CHANGE) || !gid_eq(ogid, NO_GID_QUOTA_CHANGE)) { gfs2_quota_change(ip, -(s64)ap.target, ouid, ogid); gfs2_quota_change(ip, ap.target, nuid, ngid); } out_end_trans: gfs2_trans_end(sdp); out_gunlock_q: gfs2_quota_unlock(ip); out: put_write_access(inode); return error; }
false
false
false
false
false
0
set_powered(struct connman_technology *technology, DBusMessage *msg, connman_bool_t powered) { DBusMessage *reply = NULL; int err = 0; if (technology->rfkill_driven && technology->hardblocked == TRUE) { err = -EACCES; goto make_reply; } if (powered == TRUE) err = technology_enable(technology); else err = technology_disable(technology); if (err != -EBUSY) { technology->enable_persistent = powered; technology_save(technology); } make_reply: if (err == -EINPROGRESS) { technology->pending_reply = dbus_message_ref(msg); technology->pending_timeout = g_timeout_add_seconds(10, technology_pending_reply, technology); } else if (err == -EALREADY) { if (powered == TRUE) reply = __connman_error_already_enabled(msg); else reply = __connman_error_already_disabled(msg); } else if (err < 0) reply = __connman_error_failed(msg, -err); else reply = g_dbus_create_reply(msg, DBUS_TYPE_INVALID); return reply; }
false
false
false
false
false
0
areInputsLegal() { bool inputsAreValid = true; if( demandFile.size() == 0 ) { std::cerr << "NULL demand file" << std::endl; inputsAreValid = false; } if(weatherFileNames.size() == 0 ) { std::cerr << "No weather files" << std::endl; inputsAreValid = false; } for( std::vector<std::string>::iterator sIter = weatherFileNames.begin(); sIter != weatherFileNames.end(); ++sIter) { if( sIter->size() == 0) { std::cerr << "Null weather file" << std::endl; inputsAreValid = false; } } if( cellWidth < .0001 ) { std::cerr << "Invalid cellWidth, it is < .0001" << std::endl; inputsAreValid = false; } if( deviationThreshold < 0 || deviationThreshold > 1) { std::cerr << "Deviation threshold not in [0,1], it is: "; std::cerr << deviationThreshold << std::endl; inputsAreValid = false; } if( nodeEdgeThreshold < 0 || nodeEdgeThreshold > 1) { std::cerr << "Node edge threshold not in [0,1], it is: "; std::cerr << nodeEdgeThreshold << std::endl; inputsAreValid = false; } if( laneWidth < 0 ) { std::cerr << "Warning: Lane Width is negative, so it is being read from demand files " << std::endl; } return inputsAreValid; }
false
false
false
false
false
0
cell(idx_type) { static MathData dummyCell(&buffer()); LYXERR0("I don't have any cell"); return dummyCell; }
false
false
false
false
false
0
paint(QPainter* p, const QRect& r) { p->drawPixmap(r.topLeft(), m_tiles[TopLeftCorner]); if (r.width() - 16 > 0) { p->drawTiledPixmap(r.x() + 8, r.y(), r.width() - 16, 8, m_tiles[TopSide]); } p->drawPixmap(r.right() - 8 + 1, r.y(), m_tiles[TopRightCorner]); if (r.height() - 16 > 0) { p->drawTiledPixmap(r.x(), r.y() + 8, 8, r.height() - 16, m_tiles[LeftSide]); p->drawTiledPixmap(r.right() - 8 + 1, r.y() + 8, 8, r.height() - 16, m_tiles[RightSide]); } p->drawPixmap(r.x(), r.bottom() - 8 + 1, m_tiles[BottomLeftCorner]); if (r.width() - 16 > 0) { p->drawTiledPixmap(r.x() + 8, r.bottom() - 8 + 1, r.width() - 16, 8, m_tiles[BottomSide]); } p->drawPixmap(r.right() - 8 + 1, r.bottom() - 8 + 1, m_tiles[BottomRightCorner]); const QRect contentRect = r.adjusted(LeftMargin + 1, TopMargin + 1, -(RightMargin + 1), -(BottomMargin + 1)); p->fillRect(contentRect, Qt::transparent); }
false
false
false
false
false
0
open64_w(const char *path, int oflag, int mode) { int fd = open64(path, oflag, mode); if (fd == -1) return -1; /* If the open succeeded, the file might still be a directory */ { int st_mode; if (sysFfileMode(fd, &st_mode) != -1) { if ((st_mode & S_IFMT) == S_IFDIR) { errno = EISDIR; close(fd); return -1; } } else { close(fd); return -1; } } /* * 32-bit Solaris systems suffer from: * * - an historical default soft limit of 256 per-process file * descriptors that is too low for many Java programs. * * - a design flaw where file descriptors created using stdio * fopen must be less than 256, _even_ when the first limit above * has been raised. This can cause calls to fopen (but not calls to * open, for example) to fail mysteriously, perhaps in 3rd party * native code (although the JDK itself uses fopen). One can hardly * criticize them for using this most standard of all functions. * * We attempt to make everything work anyways by: * * - raising the soft limit on per-process file descriptors beyond * 256 (done by hotspot) * * - As of Solaris 10u4, we can request that Solaris raise the 256 * stdio fopen limit by calling function enable_extended_FILE_stdio, * (also done by hotspot). We check for its availability. * * - If we are stuck on an old (pre 10u4) Solaris system, we can * workaround the bug by remapping non-stdio file descriptors below * 256 to ones beyond 256, which is done below. * * See: * 1085341: 32-bit stdio routines should support file descriptors >255 * 6533291: Work around 32-bit Solaris stdio limit of 256 open files * 6431278: Netbeans crash on 32 bit Solaris: need to call * enable_extended_FILE_stdio() in VM initialisation * Giri Mandalika's blog * http://technopark02.blogspot.com/2005_05_01_archive.html */ #if defined(__solaris__) && defined(_ILP32) { static int needToWorkAroundBug1085341 = -1; if (needToWorkAroundBug1085341) { if (needToWorkAroundBug1085341 == -1) needToWorkAroundBug1085341 = (dlsym(RTLD_DEFAULT, "enable_extended_FILE_stdio") == NULL); if (needToWorkAroundBug1085341 && fd < 256) { int newfd = fcntl(fd, F_DUPFD, 256); if (newfd != -1) { close(fd); fd = newfd; } } } } #endif /* 32-bit Solaris */ /* * All file descriptors that are opened in the JVM and not * specifically destined for a subprocess should have the * close-on-exec flag set. If we don't set it, then careless 3rd * party native code might fork and exec without closing all * appropriate file descriptors (e.g. as we do in closeDescriptors in * UNIXProcess.c), and this in turn might: * * - cause end-of-file to fail to be detected on some file * descriptors, resulting in mysterious hangs, or * * - might cause an fopen in the subprocess to fail on a system * suffering from bug 1085341. * * (Yes, the default setting of the close-on-exec flag is a Unix * design flaw) * * See: * 1085341: 32-bit stdio routines should support file descriptors >255 * 4843136: (process) pipe file descriptor from Runtime.exec not being closed * 6339493: (process) Runtime.exec does not close all file descriptors on Solaris 9 */ #ifdef FD_CLOEXEC { int flags = fcntl(fd, F_GETFD); if (flags != -1) fcntl(fd, F_SETFD, flags | FD_CLOEXEC); } #endif return fd; }
false
false
false
false
false
0
main(int argc, char** argv) { g_progname = argv[0]; const char* ebuf = kc::getenv("KTRNDSEED"); g_randseed = ebuf ? (uint32_t)kc::atoi(ebuf) : (uint32_t)(kc::time() * 1000); mysrand(g_randseed); g_memusage = memusage(); kc::setstdiobin(); if (argc < 2) usage(); int32_t rv = 0; if (!std::strcmp(argv[1], "http")) { rv = runhttp(argc, argv); } else if (!std::strcmp(argv[1], "rpc")) { rv = runrpc(argc, argv); } else if (!std::strcmp(argv[1], "ulog")) { rv = runulog(argc, argv); } else { usage(); } if (rv != 0) { oprintf("FAILED: KTRNDSEED=%u PID=%ld", g_randseed, (long)kc::getpid()); for (int32_t i = 0; i < argc; i++) { oprintf(" %s", argv[i]); } oprintf("\n\n"); } return rv; }
false
false
false
false
false
0
intel_crc_pmic_update_aux(struct regmap *regmap, int reg, int raw) { return regmap_write(regmap, reg, raw) || regmap_update_bits(regmap, reg - 1, 0x3, raw >> 8) ? -EIO : 0; }
false
false
false
false
false
0
g15_recv(int sock, char *buf, unsigned int len) { int total = 0; int retval = 0; int bytesleft = len; struct pollfd pfd[1]; while(total < len && !leaving) { memset(pfd,0,sizeof(pfd)); pfd[0].fd = sock; pfd[0].events = POLLIN; if(poll(pfd,1,500)>0){ if(pfd[0].revents & POLLIN) { retval = recv(sock, buf+total, bytesleft, 0); if (retval < 1) { break; } total += retval; bytesleft -= retval; } } } return total; }
false
false
false
false
false
0
_unpack_will_run_response_msg(will_run_response_msg_t ** msg_ptr, Buf buffer, uint16_t protocol_version) { will_run_response_msg_t *msg; uint32_t count, i, uint32_tmp, *job_id_ptr; msg = xmalloc(sizeof(will_run_response_msg_t)); safe_unpack32(&msg->job_id, buffer); safe_unpack32(&msg->proc_cnt, buffer); safe_unpack_time(&msg->start_time, buffer); safe_unpackstr_xmalloc(&msg->node_list, &uint32_tmp, buffer); safe_unpack32(&count, buffer); if (count && (count != NO_VAL)) { msg->preemptee_job_id = list_create(_pre_list_del); for (i=0; i<count; i++) { safe_unpack32(&uint32_tmp, buffer); job_id_ptr = xmalloc(sizeof(uint32_t)); job_id_ptr[0] = uint32_tmp; list_append(msg->preemptee_job_id, job_id_ptr); } } *msg_ptr = msg; return SLURM_SUCCESS; unpack_error: slurm_free_will_run_response_msg(msg); *msg_ptr = NULL; return SLURM_ERROR; }
false
false
false
false
false
0
start_filter(const char *prog, pid_t *pidptr) { pid_t p; int pipefd[2]; /* Prepare an empty directory for the filter. */ rmdir_contents(SUBTMPDIR); mkdir(SUBTMPDIR, 0700); if (pipe(pipefd) < 0) { perror("pipe"); return (-1); } p=fork(); if (p < 0) { close(pipefd[0]); close(pipefd[1]); perror("fork"); return (-1); } if (p == 0) { close(0); if (dup(pipefd[0]) < 0) { perror("dup"); exit(1); } close(pipefd[0]); close(pipefd[1]); execl(prog, prog, SUBTMPDIR, (char *)NULL); perror(prog); exit(1); } *pidptr=p; close(pipefd[0]); return (pipefd[1]); }
false
false
false
false
true
1
aci(char *p) { int j; for (j=0; j<6; j++) if (!ISHAL(*(p+j))) break; if (*(p+j) == 'i') return(TRUE); else return(FALSE); }
false
false
false
false
false
0
ast_aoc_s_add_rate_volume(struct ast_aoc_decoded *decoded, enum ast_aoc_s_charged_item charged_item, enum ast_aoc_volume_unit volume_unit, unsigned int amount, enum ast_aoc_currency_multiplier multiplier, const char *currency_name) { struct ast_aoc_s_entry entry = { 0, }; entry.charged_item = charged_item; entry.rate_type = AST_AOC_RATE_TYPE_VOLUME; entry.rate.volume.multiplier = multiplier; entry.rate.volume.amount = amount; entry.rate.volume.volume_unit = volume_unit; if (!ast_strlen_zero(currency_name)) { ast_copy_string(entry.rate.volume.currency_name, currency_name, sizeof(entry.rate.volume.currency_name)); } return aoc_s_add_entry(decoded, &entry); }
false
false
false
false
false
0
pdf_image_plane_data_alt(gx_image_enum_common_t * info, const gx_image_plane_t * planes, int height, int *rows_used, int alt_writer_index) { pdf_image_enum *pie = (pdf_image_enum *) info; int h = height; int y; /****** DOESN'T HANDLE IMAGES WITH VARYING WIDTH PER PLANE ******/ uint width_bits = pie->width * pie->plane_depths[0]; /****** DOESN'T HANDLE NON-ZERO data_x CORRECTLY ******/ uint bcount = (width_bits + 7) >> 3; uint ignore; int nplanes = pie->num_planes; int status = 0; if (h > pie->rows_left) h = pie->rows_left; for (y = 0; y < h; ++y) { if (nplanes > 1) { /* * We flip images in blocks, and each block except the last one * must contain an integral number of pixels. The easiest way * to meet this condition is for all blocks except the last to * be a multiple of 3 source bytes (guaranteeing an integral * number of 1/2/4/8/12-bit samples), i.e., 3*nplanes flipped * bytes. This requires a buffer of at least * 3*GS_IMAGE_MAX_COMPONENTS bytes. */ int pi; uint count = bcount; uint offset = 0; #define ROW_BYTES max(200 /*arbitrary*/, 3 * GS_IMAGE_MAX_COMPONENTS) const byte *bit_planes[GS_IMAGE_MAX_COMPONENTS]; int block_bytes = ROW_BYTES / (3 * nplanes) * 3; byte row[ROW_BYTES]; for (pi = 0; pi < nplanes; ++pi) bit_planes[pi] = planes[pi].data + planes[pi].raster * y; while (count) { uint flip_count; uint flipped_count; if (count >= block_bytes) { flip_count = block_bytes; flipped_count = block_bytes * nplanes; } else { flip_count = count; flipped_count = (width_bits % (block_bytes * 8) * nplanes + 7) >> 3; } image_flip_planes(row, bit_planes, offset, flip_count, nplanes, pie->plane_depths[0]); status = sputs(pie->writer.binary[alt_writer_index].strm, row, flipped_count, &ignore); if (status < 0) break; offset += flip_count; count -= flip_count; } } else { status = sputs(pie->writer.binary[alt_writer_index].strm, planes[0].data + planes[0].raster * y, bcount, &ignore); } if (status < 0) break; } *rows_used = h; if (status < 0) return_error(gs_error_ioerror); return !pie->rows_left; #undef ROW_BYTES }
false
false
false
false
false
0
parport_mos7715_frob_control(struct parport *pp, unsigned char mask, unsigned char val) { struct mos7715_parport *mos_parport = pp->private_data; __u8 dcr; mask &= 0x0f; val &= 0x0f; if (parport_prologue(pp) < 0) return 0; mos_parport->shadowDCR = (mos_parport->shadowDCR & (~mask)) ^ val; write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, mos_parport->shadowDCR); dcr = mos_parport->shadowDCR & 0x0f; parport_epilogue(pp); return dcr; }
false
false
false
false
false
0
doPosteriors(const nor_utils::Args& args) { VJCascadeClassifier classifier(args, _verbose); //int numofargs = args.getNumValues( "posteriors" ); // -posteriors <dataFile> <shypFile> <outFile> <numIters> string testFileName = args.getValue<string>("posteriors", 0); string shypFileName = args.getValue<string>("posteriors", 1); string outFileName = args.getValue<string>("posteriors", 2); int numStages = args.getValue<int>("posteriors", 3); classifier.savePosteriors(testFileName, shypFileName, outFileName, numStages); }
false
false
false
false
false
0
Togl_PostOverlayRedisplay(Togl *togl) { if (!togl->OverlayUpdatePending && togl->OverlayWindow && togl->OverlayDisplayProc) { Tk_DoWhenIdle(RenderOverlay, (ClientData) togl); togl->OverlayUpdatePending = True; } }
false
false
false
false
false
0
gt_seqorder_output(unsigned long seqnum, GtEncseq *encseq) { GtEncseqReader *esr; unsigned long startpos, len, desclen = 0; const char *desc = NULL; unsigned long i; startpos = gt_encseq_seqstartpos(encseq, seqnum); len = gt_encseq_seqlength(encseq, seqnum); gt_xfputc(GT_FASTA_SEPARATOR, stdout); if (gt_encseq_has_description_support(encseq)) { desc = gt_encseq_description(encseq, &desclen, seqnum); gt_xfwrite(desc, (size_t)1, (size_t)desclen, stdout); } gt_xfputc('\n', stdout); esr = gt_encseq_create_reader_with_readmode(encseq, GT_READMODE_FORWARD, startpos); for (i = 0; i < len; i++) { gt_xfputc(gt_encseq_reader_next_decoded_char(esr), stdout); } gt_encseq_reader_delete(esr); gt_xfputc('\n', stdout); }
false
false
false
false
false
0
turbo_update_sprite_info(void) { struct sprite_params_data *data = sprite_params; int i; /* first loop over all sprites and update those whose scanlines intersect ours */ for (i = 0; i < 16; i++, data++) { UINT8 *sprite_base = spriteram + 16 * i; /* snarf all the data */ data->base = sprite_expanded_data + (i & 7) * 0x8000; data->enable = sprite_expanded_enable + (i & 7) * 0x8000; data->offset = (sprite_base[6] + 256 * sprite_base[7]) & sprite_mask; data->rowbytes = (INT16)(sprite_base[4] + 256 * sprite_base[5]); data->miny = sprite_base[0]; data->maxy = sprite_base[1]; data->xscale = ((5 * 256 - 4 * sprite_base[2]) << 16) / (5 * 256); data->yscale = (4 << 16) / (sprite_base[3] + 4); data->xoffs = -1; data->flip = 0; } /* now find the X positions */ for (i = 0; i < 0x200; i++) { int value = sega_sprite_position[i]; if (value) { int base = (i & 0x100) >> 5; int which; for (which = 0; which < 8; which++) if (value & (1 << which)) sprite_params[base + which].xoffs = i & 0xff; } } }
false
false
false
false
false
0
gameTypeChanged() { stopDemo(); if ( allowedToStartNewGame() ) { setEasy( options->currentItem() == 0 ); startNew( gameNumber() ); } else { // If we're not allowed, reset the option to // the current number of suits. options->setCurrentItem( easyRules ? 0 : 1 ); } }
false
false
false
false
false
0
parse_select(struct expr_t *idndp) { struct expr_t *ndp, *sel_ndp, *i1ndp, *i2ndp; /* build (alloc and copy) select sub expression root */ sel_ndp = alloc_xtnd(__xndi); __xndi++; /* side effect of parsing sub expression is advancing global x ndi */ /* returned i1ndp is malloced not built in __exprtab */ if ((i1ndp = parse_qcexpr()) == NULL) return(NULL); sel_ndp->lu.x = idndp; ndp = __exprtab[__xndi]; if (ndp->optyp == RSB) { sel_ndp->ru.x = i1ndp; __xndi++; /* next may be dot (handled as term by caller) or rest of expr */ return(sel_ndp); } /* part select - if illegal in context caller must detect */ if (ndp->optyp != COLON) { if (__pv_err_cnt <= __saverr_cnt) __pv_ferr(1114, "bit/part select expression : or ] separator expected - %s read", to_xndnam(__xs, __xndi)); /* if T, current is one past ending ] */ return(NULL); } /* part select after : */ __xndi++; if ((i2ndp = parse_qcexpr()) == NULL) return(NULL); ndp = __exprtab[__xndi]; if (ndp->optyp != RSB) { if (__pv_err_cnt <= __saverr_cnt) __pv_ferr(1115, "part select expression ending ] expected - %s read", to_xndnam(__xs, __xndi)); return(NULL); } sel_ndp->optyp = PARTSEL; ndp = alloc_xtnd(__xndi); ndp->optyp = COLON; sel_ndp->ru.x = ndp; ndp->lu.x = i1ndp; ndp->ru.x = i2ndp; /* move one past RSB if possible */ if (__xndi < __last_xtk) __xndi++; /* part select never xmr */ return(sel_ndp); }
false
false
false
false
false
0
snefru_addn(fingerprint_ty *p, const void *vt, size_t len) { const unsigned char *t = vt; snefru_ty *s; int n; int i; unsigned char newlen; unsigned char l[64]; unsigned char m[32]; snefru512_word *wm; snefru512_word *wl; unsigned char *ctr; wm = (snefru512_word *)&m[0]; wl = (snefru512_word *)&l[0]; ctr = (unsigned char *)&tr[0]; s = (snefru_ty *)p; i = len; while (i >= 32) { if (!++s->len[1]) if (!++s->len[2]) if (!++s->len[3]) if (!++s->len[4]) if (!++s->len[5]) if (!++s->len[6]) ++s->len[7]; i -= 32; } newlen = i << 3; if ((s->len[0] += newlen) < newlen) if (!++s->len[1]) if (!++s->len[2]) if (!++s->len[3]) if (!++s->len[4]) if (!++s->len[5]) if (!++s->len[6]) ++s->len[7]; n = s->n; while (len--) { s->c[n++] = *t++; if (n == 64) { for (i = 0; i < 64; ++i) l[ctr[i]] = s->c[i]; snefru512(wm, wl, 8); for (i = 0; i < 32; ++i) s->c[i] = m[ctr[i]]; n = 32; } } s->n = n; }
false
false
false
false
false
0
c_parser_objc_class_definition (c_parser *parser, tree attributes) { bool iface_p; tree id1; tree superclass; if (c_parser_next_token_is_keyword (parser, RID_AT_INTERFACE)) iface_p = true; else if (c_parser_next_token_is_keyword (parser, RID_AT_IMPLEMENTATION)) iface_p = false; else gcc_unreachable (); c_parser_consume_token (parser); if (c_parser_next_token_is_not (parser, CPP_NAME)) { c_parser_error (parser, "expected identifier"); return; } id1 = c_parser_peek_token (parser)->value; c_parser_consume_token (parser); if (c_parser_next_token_is (parser, CPP_OPEN_PAREN)) { /* We have a category or class extension. */ tree id2; tree proto = NULL_TREE; c_parser_consume_token (parser); if (c_parser_next_token_is_not (parser, CPP_NAME)) { if (iface_p && c_parser_next_token_is (parser, CPP_CLOSE_PAREN)) { /* We have a class extension. */ id2 = NULL_TREE; } else { c_parser_error (parser, "expected identifier or %<)%>"); c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, NULL); return; } } else { id2 = c_parser_peek_token (parser)->value; c_parser_consume_token (parser); } c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, "expected %<)%>"); if (!iface_p) { objc_start_category_implementation (id1, id2); return; } if (c_parser_next_token_is (parser, CPP_LESS)) proto = c_parser_objc_protocol_refs (parser); objc_start_category_interface (id1, id2, proto, attributes); c_parser_objc_methodprotolist (parser); c_parser_require_keyword (parser, RID_AT_END, "expected %<@end%>"); objc_finish_interface (); return; } if (c_parser_next_token_is (parser, CPP_COLON)) { c_parser_consume_token (parser); if (c_parser_next_token_is_not (parser, CPP_NAME)) { c_parser_error (parser, "expected identifier"); return; } superclass = c_parser_peek_token (parser)->value; c_parser_consume_token (parser); } else superclass = NULL_TREE; if (iface_p) { tree proto = NULL_TREE; if (c_parser_next_token_is (parser, CPP_LESS)) proto = c_parser_objc_protocol_refs (parser); objc_start_class_interface (id1, superclass, proto, attributes); } else objc_start_class_implementation (id1, superclass); if (c_parser_next_token_is (parser, CPP_OPEN_BRACE)) c_parser_objc_class_instance_variables (parser); if (iface_p) { objc_continue_interface (); c_parser_objc_methodprotolist (parser); c_parser_require_keyword (parser, RID_AT_END, "expected %<@end%>"); objc_finish_interface (); } else { objc_continue_implementation (); return; } }
false
false
false
false
false
0
ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw) { unsigned i; ffi_type **tp = cif->arg_types; for (i = 0; i < cif->nargs; i++, tp++, args++) { switch ((*tp)->type) { case FFI_TYPE_UINT8: (raw++)->uint = *(UINT8*) (*args); break; case FFI_TYPE_SINT8: (raw++)->sint = *(SINT8*) (*args); break; case FFI_TYPE_UINT16: (raw++)->uint = *(UINT16*) (*args); break; case FFI_TYPE_SINT16: (raw++)->sint = *(SINT16*) (*args); break; #if FFI_SIZEOF_ARG >= 4 case FFI_TYPE_UINT32: (raw++)->uint = *(UINT32*) (*args); break; case FFI_TYPE_SINT32: (raw++)->sint = *(SINT32*) (*args); break; #endif #if !FFI_NO_STRUCTS case FFI_TYPE_STRUCT: (raw++)->ptr = *args; break; #endif case FFI_TYPE_POINTER: (raw++)->ptr = **(void***) args; break; default: memcpy ((void*) raw->data, (void*)*args, (*tp)->size); raw += ALIGN ((*tp)->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; } } }
false
false
false
false
false
0
unzipToMemory(__GPRO__ char *zip, char *file, UzpBuffer *retstr) { int r; char *incname[2]; if ((zip == NULL) || (strlen(zip) > ((WSIZE>>2) - 160))) return PK_PARAM; if ((file == NULL) || (strlen(file) > ((WSIZE>>2) - 160))) return PK_PARAM; G.process_all_files = FALSE; G.extract_flag = TRUE; uO.qflag = 2; G.wildzipfn = zip; G.pfnames = incname; incname[0] = file; incname[1] = NULL; G.filespecs = 1; r = process_zipfiles(__G); if (retstr) { retstr->strptr = (char *)G.redirect_buffer; retstr->strlength = G.redirect_size; } return r; /* returns `PK_???' error values */ }
true
true
false
false
false
1
fimc_clk_get(struct fimc_dev *fimc) { int i, ret; for (i = 0; i < MAX_FIMC_CLOCKS; i++) fimc->clock[i] = ERR_PTR(-EINVAL); for (i = 0; i < MAX_FIMC_CLOCKS; i++) { fimc->clock[i] = clk_get(&fimc->pdev->dev, fimc_clocks[i]); if (IS_ERR(fimc->clock[i])) { ret = PTR_ERR(fimc->clock[i]); goto err; } ret = clk_prepare(fimc->clock[i]); if (ret < 0) { clk_put(fimc->clock[i]); fimc->clock[i] = ERR_PTR(-EINVAL); goto err; } } return 0; err: fimc_clk_put(fimc); dev_err(&fimc->pdev->dev, "failed to get clock: %s\n", fimc_clocks[i]); return -ENXIO; }
false
false
false
false
false
0
view_window_active_image(ViewWindow *vw) { if (vw->fs) return vw->fs->imd; return vw->imd; }
false
false
false
false
false
0
open_append(file) char *file; { FILE *fp; if ((fp = fopen(file, "a")) == NULL) { perror(file); exit(1); } return fp; }
false
false
false
false
false
0
set_explicit_duration_for_all_locks() { int i; MDL_ticket *ticket; /* In the most common case when this function is called list of transactional locks is bigger than list of locks with explicit duration. So we start by swapping these two lists and then move elements from new list of transactional locks and list of statement locks to list of locks with explicit duration. */ m_tickets[MDL_EXPLICIT].swap(m_tickets[MDL_TRANSACTION]); for (i= 0; i < MDL_EXPLICIT; i++) { Ticket_iterator it_ticket(m_tickets[i]); while ((ticket= it_ticket++)) { m_tickets[i].remove(ticket); m_tickets[MDL_EXPLICIT].push_front(ticket); } } #ifndef DBUG_OFF Ticket_iterator exp_it(m_tickets[MDL_EXPLICIT]); while ((ticket= exp_it++)) ticket->m_duration= MDL_EXPLICIT; #endif }
false
false
false
false
false
0
map_find_by_archetype(mapstruct *m, int x, int y, const archetype *at) { if (m == NULL || out_of_map(m, x, y)) { LOG(llevError, "Present_arch called outside map.\n"); return NULL; } FOR_MAP_PREPARE(m, x, y, tmp) if (tmp->arch == at) return tmp; FOR_MAP_FINISH(); return NULL; }
false
false
false
false
false
0
__qam_31_qammeta(dbp, real_name, buf) DB *dbp; char *real_name; u_int8_t *buf; { QMETA30 *oldmeta; QMETA31 *newmeta; COMPQUIET(dbp, NULL); COMPQUIET(real_name, NULL); newmeta = (QMETA31 *)buf; oldmeta = (QMETA30 *)buf; /* * Copy the fields to their new locations. * They may overlap so start at the bottom and use memmove(). */ newmeta->rec_page = oldmeta->rec_page; newmeta->re_pad = oldmeta->re_pad; newmeta->re_len = oldmeta->re_len; newmeta->cur_recno = oldmeta->cur_recno; newmeta->first_recno = oldmeta->first_recno; newmeta->start = oldmeta->start; memmove(newmeta->dbmeta.uid, oldmeta->dbmeta.uid, sizeof(oldmeta->dbmeta.uid)); newmeta->dbmeta.flags = oldmeta->dbmeta.flags; newmeta->dbmeta.record_count = 0; newmeta->dbmeta.key_count = 0; ZERO_LSN(newmeta->dbmeta.unused3); /* Update the version. */ newmeta->dbmeta.version = 2; return (0); }
false
false
false
false
false
0
AcceptSig(int s) { for(int i=0; i<waiting_num; i++) { if(waiting[i]==this) continue; if(waiting[i]->AcceptSig(s)==WANTDIE) { while(waiting[i]->waiting_num>0) { Job *new_waiting=waiting[i]->waiting[0]; waiting[i]->RemoveWaiting(new_waiting); AddWaiting(new_waiting); } Job *j=waiting[i]; RemoveWaiting(j); Delete(j); i--; } } return WANTDIE; }
false
false
false
false
false
0
process_reply(EAP_HANDLER *handler, tls_session_t *tls_session, REQUEST *request, RADIUS_PACKET *reply) { int rcode = RLM_MODULE_REJECT; VALUE_PAIR *vp; peap_tunnel_t *t = tls_session->opaque; if ((debug_flag > 0) && fr_log_fp) { RDEBUG("Got tunneled reply RADIUS code %d", reply->code); debug_pair_list(reply->vps); } switch (reply->code) { case PW_AUTHENTICATION_ACK: RDEBUG2("Tunneled authentication was successful."); t->status = PEAP_STATUS_SENT_TLV_SUCCESS; eappeap_success(handler, tls_session); rcode = RLM_MODULE_HANDLED; /* * If we've been told to use the attributes from * the reply, then do so. * * WARNING: This may leak information about the * tunneled user! */ if (t->use_tunneled_reply) { RDEBUG2("Saving tunneled attributes for later"); /* * Clean up the tunneled reply. */ pairdelete(&reply->vps, PW_PROXY_STATE); pairdelete(&reply->vps, PW_EAP_MESSAGE); pairdelete(&reply->vps, PW_MESSAGE_AUTHENTICATOR); /* * Delete MPPE keys & encryption policy. We don't * want these here. */ pairdelete(&reply->vps, ((311 << 16) | 7)); pairdelete(&reply->vps, ((311 << 16) | 8)); pairdelete(&reply->vps, ((311 << 16) | 16)); pairdelete(&reply->vps, ((311 << 16) | 17)); t->accept_vps = reply->vps; reply->vps = NULL; } break; case PW_AUTHENTICATION_REJECT: RDEBUG2("Tunneled authentication was rejected."); t->status = PEAP_STATUS_SENT_TLV_FAILURE; eappeap_failure(handler, tls_session); rcode = RLM_MODULE_HANDLED; break; case PW_ACCESS_CHALLENGE: RDEBUG2("Got tunneled Access-Challenge"); /* * Keep the State attribute, if necessary. * * Get rid of the old State, too. */ pairfree(&t->state); pairmove2(&t->state, &(reply->vps), PW_STATE); /* * PEAP takes only EAP-Message attributes inside * of the tunnel. Any Reply-Message in the * Access-Challenge is ignored. */ vp = NULL; pairmove2(&vp, &(reply->vps), PW_EAP_MESSAGE); /* * Handle EAP-MSCHAP-V2, where Access-Accept's * from the home server may contain MS-CHAP-Success, * which the module turns into challenges, so that * the client may respond to the challenge with * an "ack" packet. */ if (t->home_access_accept && t->use_tunneled_reply) { RDEBUG2("Saving tunneled attributes for later"); /* * Clean up the tunneled reply. */ pairdelete(&reply->vps, PW_PROXY_STATE); pairdelete(&reply->vps, PW_MESSAGE_AUTHENTICATOR); t->accept_vps = reply->vps; reply->vps = NULL; } /* * Handle the ACK, by tunneling any necessary reply * VP's back to the client. */ if (vp) { vp2eap(request, tls_session, vp); pairfree(&vp); } rcode = RLM_MODULE_HANDLED; break; default: RDEBUG2("Unknown RADIUS packet type %d: rejecting tunneled user", reply->code); rcode = RLM_MODULE_REJECT; break; } return rcode; }
false
false
false
false
false
0
isIncludeFile (const char *const fileName) { boolean result = FALSE; const char *const extension = fileExtension (fileName); if (Option.headerExt != NULL) result = stringListExtensionMatched (Option.headerExt, extension); return result; }
false
false
false
false
false
0
BoundaryExtractor(vtkPolyData* polyInput, vtkPolyData* boundary) { if (polyInput->GetNumberOfCells()==0) { return; } vtkFeatureEdges *boundaryExtractor = vtkFeatureEdges::New(); boundaryExtractor->BoundaryEdgesOn(); boundaryExtractor->FeatureEdgesOff(); boundaryExtractor->NonManifoldEdgesOff(); boundaryExtractor->ManifoldEdgesOff(); boundaryExtractor->SetInput(polyInput); boundaryExtractor->Update(); if (boundaryExtractor->GetOutput()->GetNumberOfCells()==0) { boundaryExtractor->Delete(); return; } vtkCleanPolyData *boundaryExtractorCleaner = vtkCleanPolyData::New(); boundaryExtractorCleaner->SetInput(boundaryExtractor->GetOutput()); vtkStripper *boundaryExtractorStripper = vtkStripper::New(); boundaryExtractorStripper->SetInput(boundaryExtractorCleaner->GetOutput()); boundaryExtractorStripper->Update(); boundary->DeepCopy(boundaryExtractorStripper->GetOutput()); boundary->Update(); boundaryExtractorStripper->Delete(); boundaryExtractorCleaner->Delete(); boundaryExtractor->Delete(); }
false
false
false
false
false
0
slot_remove_history() { #ifdef _DEBUG std::cout << "HistorySubMenu::slot_remove_history no = " << m_number_menuitem << std::endl; #endif const int i = m_number_menuitem; CORE::DATA_INFO_LIST info_list; SESSION::get_history( m_url_history, info_list ); if( (int)info_list.size() <= i ) return; CORE::core_set_command( "remove_history", m_url_history, info_list[ i ].url ); }
false
false
false
false
false
0
drbd_debugfs_init(void) { struct dentry *dentry; dentry = debugfs_create_dir("drbd", NULL); if (IS_ERR_OR_NULL(dentry)) goto fail; drbd_debugfs_root = dentry; dentry = debugfs_create_file("version", 0444, drbd_debugfs_root, NULL, &drbd_version_fops); if (IS_ERR_OR_NULL(dentry)) goto fail; drbd_debugfs_version = dentry; dentry = debugfs_create_dir("resources", drbd_debugfs_root); if (IS_ERR_OR_NULL(dentry)) goto fail; drbd_debugfs_resources = dentry; dentry = debugfs_create_dir("minors", drbd_debugfs_root); if (IS_ERR_OR_NULL(dentry)) goto fail; drbd_debugfs_minors = dentry; return 0; fail: drbd_debugfs_cleanup(); if (dentry) return PTR_ERR(dentry); else return -EINVAL; }
false
false
false
false
false
0
set_flag(struct isl_arg *decl, unsigned *val, const char *flag, size_t len) { int i; for (i = 0; decl->u.flags.flags[i].name; ++i) { if (strncmp(flag, decl->u.flags.flags[i].name, len)) continue; *val &= ~decl->u.flags.flags[i].mask; *val |= decl->u.flags.flags[i].value; return 1; } return 0; }
false
false
false
false
false
0
Proc_1(DS_DATA& dd, REG Rec_Pointer Ptr_Val_Par) { REG Rec_Pointer Next_Record = Ptr_Val_Par->Ptr_Comp; /* == Ptr_Glob_Next */ /* Local variable, initialized with Ptr_Val_Par->Ptr_Comp, */ /* corresponds to "rename" in Ada, "with" in Pascal */ structassign (*Ptr_Val_Par->Ptr_Comp, *Ptr_Glob); Ptr_Val_Par->variant.var_1.Int_Comp = 5; Next_Record->variant.var_1.Int_Comp = Ptr_Val_Par->variant.var_1.Int_Comp; Next_Record->Ptr_Comp = Ptr_Val_Par->Ptr_Comp; Proc_3 (dd, &Next_Record->Ptr_Comp); /* Ptr_Val_Par->Ptr_Comp->Ptr_Comp == Ptr_Glob->Ptr_Comp */ if (Next_Record->Discr == Ident_1) /* then, executed */ { Next_Record->variant.var_1.Int_Comp = 6; Proc_6 (dd, Ptr_Val_Par->variant.var_1.Enum_Comp, &Next_Record->variant.var_1.Enum_Comp); Next_Record->Ptr_Comp = Ptr_Glob->Ptr_Comp; Proc_7 (Next_Record->variant.var_1.Int_Comp, 10, &Next_Record->variant.var_1.Int_Comp); } else /* not executed */ structassign (*Ptr_Val_Par, *Ptr_Val_Par->Ptr_Comp); }
false
false
false
false
false
0
dbsetversion(DBINT version) { tdsdump_log(TDS_DBG_FUNC, "dbsetversion(%d)\n", version); switch (version ) { case DBVERSION_42: case DBVERSION_46: case DBVERSION_100: case DBVERSION_70: case DBVERSION_80: g_dblib_version = version; return SUCCEED; default: break; } dbperror(NULL, SYBEIVERS, 0); return FAIL; }
false
false
false
false
false
0
find_in_aPlusBlk( Junction *alt ) #else find_in_aPlusBlk( alt ) Junction *alt; #endif { require(alt!=NULL&&alt->p2!=NULL, "invalid aPlusBlk"); return find_in_aSubBlk( alt ); }
false
false
false
false
false
0
getMatrix(SoGetMatrixAction *action) // //////////////////////////////////////////////////////////////////////// { int numIndices; const int *indices; // Only need to compute matrix if array is a node in middle of // current path chain. We don't need to push or pop the state, // since this shouldn't have any effect on other nodes being // traversed. if (action->getPathCode(numIndices, indices) == SoAction::IN_PATH) { // Translate entire array if necessary if (! origin.isIgnored() && origin.getValue() != FIRST) { int n1 = numElements1.getValue(); int n2 = numElements2.getValue(); int n3 = numElements3.getValue(); SbVec3f vecToCenter = -(separation1.getValue() * (n1 - 1) + separation2.getValue() * (n2 - 1) + separation3.getValue() * (n3 - 1)); if (origin.getValue() == CENTER) vecToCenter *= 0.5; // Translate the matrices in the action SbMatrix m; m.setTranslate(vecToCenter); action->getMatrix().multLeft(m); m.setTranslate(-vecToCenter); action->getInverse().multRight(m); } children->traverse(action, 0, indices[numIndices - 1]); } }
false
false
false
false
false
0
btrfs_compress_pages(int type, struct address_space *mapping, u64 start, unsigned long len, struct page **pages, unsigned long nr_dest_pages, unsigned long *out_pages, unsigned long *total_in, unsigned long *total_out, unsigned long max_out) { struct list_head *workspace; int ret; workspace = find_workspace(type); if (IS_ERR(workspace)) return PTR_ERR(workspace); ret = btrfs_compress_op[type-1]->compress_pages(workspace, mapping, start, len, pages, nr_dest_pages, out_pages, total_in, total_out, max_out); free_workspace(type, workspace); return ret; }
false
false
false
false
false
0
crop_rect_from_surface(SDL_Surface *pSource, SDL_Rect *pRect) { SDL_Surface *pNew = create_surf_with_format(pSource->format, pRect ? pRect->w : pSource->w, pRect ? pRect->h : pSource->h, SDL_SWSURFACE); if (alphablit(pSource, pRect, pNew, NULL) != 0) { FREESURFACE(pNew); } return pNew; }
false
false
false
false
false
0
run_udp_server(server_type* server) { if(server) { unsigned int cycle=0; while (1) { cycle++; run_events(server); } } }
false
false
false
false
false
0
hasGroupLeftWindow() const { // try to find _FLUXBOX_GROUP_LEFT atom in window // if we have one then we have a group left window int format; Atom atom_return; unsigned long num = 0, len = 0; static Atom group_left_hint = XInternAtom(display(), "_FLUXBOX_GROUP_LEFT", False); Window *data = 0; if (property(group_left_hint, 0, 1, false, XA_WINDOW, &atom_return, &format, &num, &len, (unsigned char **) &data) && data) { XFree(data); if (num != 1) return false; else return true; } return false; }
false
false
false
false
false
0
note_digest_auth_failure(request_rec *r, const digest_config_rec *conf, digest_header_rec *resp, int stale) { const char *qop, *opaque, *opaque_param, *domain, *nonce; /* Setup qop */ if (apr_is_empty_array(conf->qop_list)) { qop = ", qop=\"auth\""; } else if (!strcasecmp(*(const char **)(conf->qop_list->elts), "none")) { qop = ""; } else { qop = apr_pstrcat(r->pool, ", qop=\"", apr_array_pstrcat(r->pool, conf->qop_list, ','), "\"", NULL); } /* Setup opaque */ if (resp->opaque == NULL) { /* new client */ if ((conf->check_nc || conf->nonce_lifetime == 0 || !strcasecmp(conf->algorithm, "MD5-sess")) && (resp->client = gen_client(r)) != NULL) { opaque = ltox(r->pool, resp->client->key); } else { opaque = ""; /* opaque not needed */ } } else if (resp->client == NULL) { /* client info was gc'd */ resp->client = gen_client(r); if (resp->client != NULL) { opaque = ltox(r->pool, resp->client->key); stale = 1; client_list->num_renewed++; } else { opaque = ""; /* ??? */ } } else { opaque = resp->opaque; /* we're generating a new nonce, so reset the nonce-count */ resp->client->nonce_count = 0; } if (opaque[0]) { opaque_param = apr_pstrcat(r->pool, ", opaque=\"", opaque, "\"", NULL); } else { opaque_param = NULL; } /* Setup nonce */ nonce = gen_nonce(r->pool, r->request_time, opaque, r->server, conf); if (resp->client && conf->nonce_lifetime == 0) { memcpy(resp->client->last_nonce, nonce, NONCE_LEN+1); } /* Setup MD5-sess stuff. Note that we just clear out the session * info here, since we can't generate a new session until the request * from the client comes in with the cnonce. */ if (!strcasecmp(conf->algorithm, "MD5-sess")) { clear_session(resp); } /* setup domain attribute. We want to send this attribute wherever * possible so that the client won't send the Authorization header * unnecessarily (it's usually > 200 bytes!). */ /* don't send domain * - for proxy requests * - if it's not specified */ if (r->proxyreq || !conf->uri_list) { domain = NULL; } else { domain = conf->uri_list; } apr_table_mergen(r->err_headers_out, (PROXYREQ_PROXY == r->proxyreq) ? "Proxy-Authenticate" : "WWW-Authenticate", apr_psprintf(r->pool, "Digest realm=\"%s\", " "nonce=\"%s\", algorithm=%s%s%s%s%s", ap_auth_name(r), nonce, conf->algorithm, opaque_param ? opaque_param : "", domain ? domain : "", stale ? ", stale=true" : "", qop)); }
false
false
false
false
false
0
linkdb_final( struct linkdb_node** head ) { struct linkdb_node *node, *node2; if( head == NULL ) return; node = *head; while( node ) { node2 = node->next; aFree( node ); node = node2; } *head = NULL; }
false
false
false
false
false
0
o2hb_region_unpin(const char *region_uuid) { struct o2hb_region *reg; char *uuid; int found = 0; assert_spin_locked(&o2hb_live_lock); list_for_each_entry(reg, &o2hb_all_regions, hr_all_item) { if (reg->hr_item_dropped) continue; uuid = config_item_name(&reg->hr_item); if (region_uuid) { if (strcmp(region_uuid, uuid)) continue; found = 1; } if (reg->hr_item_pinned) { mlog(ML_CLUSTER, "Unpin region %s\n", uuid); o2nm_undepend_item(&reg->hr_item); reg->hr_item_pinned = 0; } if (found) break; } }
false
false
false
false
false
0
make_array_region_data_list(Block_var_table *bvt, Block *block_head, int kind) { Array_region_data *ret = NULL; Boolean first_array_flag = TRUE; Array_subscript_info *array_info, *same_array; if (!bvt->array_sub_info) return NULL; for (array_info = bvt->array_sub_info; array_info != NULL; array_info = array_info->next_array) { Array_region_data *tmp_first_ard = NULL, *tmp_ard = NULL; Boolean first_same_array_flag = TRUE; for (same_array = array_info; same_array != NULL; same_array = same_array->next) { Array_table *apt; Array_region_data *array_data; apt = search_array_table(block_head->module->array_head, same_array->entry); array_data = make_array_region_data(same_array, apt, kind); if (first_array_flag) { ret = array_data; tmp_first_ard = ret; tmp_ard = tmp_first_ard; first_array_flag = FALSE; first_same_array_flag = FALSE; } else if (first_same_array_flag) { array_data->prev_array = tmp_first_ard; tmp_first_ard->next_array= array_data; tmp_first_ard = tmp_first_ard->next_array; tmp_ard = tmp_first_ard; first_same_array_flag = FALSE; } else { switch (what_kind_of_process_for_made_data(tmp_first_ard, array_data)) { case FREE: free(array_data); break; case UPDATE: update_array_region_data(tmp_first_ard, array_data); break; case APPEND: array_data->prev = tmp_ard; tmp_ard->next = array_data; tmp_ard = tmp_ard->next; break; default: break; } } } } return ret; }
false
false
false
true
false
1
demangle(const char* name) { #ifndef HAVE_CXA_DEMANGLE char buf[4096]; size_t size = 4096; int status = 0; abi::__cxa_demangle(name, buf, &size, &status); if (status==0) return std::string(buf); return std::string(name); #else return std::string(name); #endif }
false
false
false
false
false
0
drop_widget_init(GtkWidget *widget, drag_data_received_cb callback, void *user_data) { static const GtkTargetEntry targets[] = { #if GTK_CHECK_VERSION(2,0,0) { "UTF8_STRING", 0, 3 }, { "text/plain;charset=utf-8", 0, 4 }, #endif /* Gtk+ >= 2.0 */ { "STRING", 0, 1 }, { "text/plain", 0, 2 }, }; g_return_if_fail(widget); g_return_if_fail(callback); gtk_drag_dest_set(widget, GTK_DEST_DEFAULT_ALL, targets, G_N_ELEMENTS(targets), GDK_ACTION_COPY | GDK_ACTION_MOVE); #if GTK_CHECK_VERSION(2,0,0) { static GtkClipboard *clipboard; if (!clipboard) { clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY); } } gtk_drag_dest_set_target_list(widget, gtk_target_list_new(targets, G_N_ELEMENTS(targets))); #endif /* USE_GTK2 */ #if !GTK_CHECK_VERSION(2,0,0) gtk_selection_add_targets(widget, GDK_SELECTION_TYPE_STRING, targets, G_N_ELEMENTS(targets)); #endif /* USE_GTK1 */ gui_signal_connect(GTK_OBJECT(widget), "drag-data-received", callback, user_data); }
false
false
false
false
false
0
precision(int p) { A = 1.0; for (B = 1; p--;) B *= 10; }
false
false
false
false
false
0
reset() const { char v = 0; while (wait(0)) read(wait_pipe[0], &v, 1); }
false
false
false
false
false
0
exec_read(struct exec_info *info) { int ret=G10ERR_GENERAL; fclose(info->tochild); info->tochild=NULL; if(info->flags.use_temp_files) { if(DBG_EXTPROG) log_debug("system() command is %s\n",info->command); #if defined (_WIN32) info->progreturn=win_system(info->command); #else info->progreturn=system(info->command); #endif if(info->progreturn==-1) { log_error(_("system error while calling external program: %s\n"), strerror(errno)); info->progreturn=127; goto fail; } #if defined(WIFEXITED) && defined(WEXITSTATUS) if(WIFEXITED(info->progreturn)) info->progreturn=WEXITSTATUS(info->progreturn); else { log_error(_("unnatural exit of external program\n")); info->progreturn=127; goto fail; } #else /* If we don't have the macros, do the best we can. */ info->progreturn = (info->progreturn & 0xff00) >> 8; #endif /* 127 is the magic value returned from system() to indicate that the shell could not be executed, or from /bin/sh to indicate that the program could not be executed. */ if(info->progreturn==127) { log_error(_("unable to execute external program\n")); goto fail; } if(!info->flags.writeonly) { info->fromchild=iobuf_open(info->tempfile_out); if (info->fromchild && is_secured_file (iobuf_get_fd (info->fromchild))) { iobuf_close (info->fromchild); info->fromchild = NULL; errno = EPERM; } if(info->fromchild==NULL) { log_error(_("unable to read external program response: %s\n"), strerror(errno)); ret=G10ERR_READ_FILE; goto fail; } /* Do not cache this iobuf on close */ iobuf_ioctl(info->fromchild,3,1,NULL); } } ret=0; fail: return ret; }
false
false
false
false
false
0