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
load_pixbuf_for_gicon (GIcon *icon) { GtkIconTheme *theme; GtkIconInfo *icon_info; GdkPixbuf *pixbuf = NULL; GError *err = NULL; if (icon == NULL) return NULL; theme = gtk_icon_theme_get_default (); icon_info = gtk_icon_theme_lookup_by_gicon (theme, icon, 48, GTK_ICON_LOOKUP_FORCE_SIZE); if (icon_info) { pixbuf = gtk_icon_info_load_icon (icon_info, &err); if (err) { g_warning ("Could not load icon '%s': %s", gtk_icon_info_get_filename (icon_info), err->message); g_error_free (err); } gtk_icon_info_free (icon_info); } else { g_warning ("Could not find icon"); } return pixbuf; }
false
false
false
false
false
0
PyCurses_Delay_Output(PyObject *self, PyObject *args) { int ms; PyCursesInitialised; if (!PyArg_ParseTuple(args, "i:delay_output", &ms)) return NULL; return PyCursesCheckERR(delay_output(ms), "delay_output"); }
false
false
false
false
false
0
cl_statchkdir(const struct cl_stat *dbstat) { DIR *dd; struct dirent *dent; #if defined(HAVE_READDIR_R_3) || defined(HAVE_READDIR_R_2) union { struct dirent d; char b[offsetof(struct dirent, d_name) + NAME_MAX + 1]; } result; #endif STATBUF sb; unsigned int i, found; char *fname; if(!dbstat || !dbstat->dir) { cli_errmsg("cl_statdbdir(): Null argument passed.\n"); return CL_ENULLARG; } if((dd = opendir(dbstat->dir)) == NULL) { cli_errmsg("cl_statdbdir(): Can't open directory %s\n", dbstat->dir); return CL_EOPEN; } cli_dbgmsg("Stat()ing files in %s\n", dbstat->dir); #ifdef HAVE_READDIR_R_3 while(!readdir_r(dd, &result.d, &dent) && dent) { #elif defined(HAVE_READDIR_R_2) while((dent = (struct dirent *) readdir_r(dd, &result.d))) { #else while((dent = readdir(dd))) { #endif if(dent->d_ino) { if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..") && CLI_DBEXT(dent->d_name)) { fname = cli_malloc(strlen(dbstat->dir) + strlen(dent->d_name) + 32); if(!fname) { cli_errmsg("cl_statchkdir: can't allocate memory for fname\n"); closedir(dd); return CL_EMEM; } sprintf(fname, "%s"PATHSEP"%s", dbstat->dir, dent->d_name); CLAMSTAT(fname, &sb); free(fname); found = 0; for(i = 0; i < dbstat->entries; i++) #ifdef _WIN32 if(!strcmp(dbstat->statdname[i], dent->d_name)) { #else if(dbstat->stattab[i].st_ino == sb.st_ino) { #endif found = 1; if(dbstat->stattab[i].st_mtime != sb.st_mtime) { closedir(dd); return 1; } } if(!found) { closedir(dd); return 1; } } } } closedir(dd); return CL_SUCCESS; }
false
false
false
false
false
0
_dxf_ExNeedsWriting(void) { int res; if (tmpbufferused == NULL) return 0; DXlock(tmpbufferlock, 0); res = (*tmpbufferused > 0); DXunlock(tmpbufferlock, 0); return res; }
false
false
false
false
false
0
template_setup (GuTemplate* t) { const gchar *filename; char *filepath = NULL; GError *error = NULL; GtkTreeIter iter; gchar *dirpath = g_build_filename (g_get_user_config_dir (), "gummi", "templates" , NULL); GDir* dir = g_dir_open (dirpath, 0, &error); if (error) { /* print error if directory does not exist */ slog (L_INFO, "unable to read template directory, creating new..\n"); g_mkdir_with_parents (dirpath, DIR_PERMS); g_free (dirpath); return; } while ( (filename = g_dir_read_name (dir))) { filepath = g_build_filename (dirpath, filename, NULL); gtk_list_store_append (t->list_templates, &iter); gtk_list_store_set (t->list_templates, &iter, 0, filename, 1, filepath, -1); g_free (filepath); } g_free (dirpath); // disable the add button when there are no tabs opened (#388) if (!tabmanager_has_tabs()) { gtk_widget_set_sensitive (t->template_add, FALSE); } gtk_widget_set_sensitive (t->template_open, FALSE); }
false
false
false
false
false
0
digest_md5_encode (const char *input, size_t input_len, char **output, size_t * output_len, digest_md5_qop qop, unsigned long sendseqnum, char key[DIGEST_MD5_LENGTH]) { int res; if (qop & DIGEST_MD5_QOP_AUTH_CONF) { return -1; } else if (qop & DIGEST_MD5_QOP_AUTH_INT) { char *seqnumin; char hash[GC_MD5_DIGEST_SIZE]; size_t len; seqnumin = malloc (MAC_SEQNUM_LEN + input_len); if (seqnumin == NULL) return -1; seqnumin[0] = (sendseqnum >> 24) & 0xFF; seqnumin[1] = (sendseqnum >> 16) & 0xFF; seqnumin[2] = (sendseqnum >> 8) & 0xFF; seqnumin[3] = sendseqnum & 0xFF; memcpy (seqnumin + MAC_SEQNUM_LEN, input, input_len); res = gc_hmac_md5 (key, MD5LEN, seqnumin, MAC_SEQNUM_LEN + input_len, hash); free (seqnumin); if (res) return -1; *output_len = MAC_DATA_LEN + input_len + MAC_HMAC_LEN + MAC_MSG_TYPE_LEN + MAC_SEQNUM_LEN; *output = malloc (*output_len); if (!*output) return -1; len = MAC_DATA_LEN; memcpy (*output + len, input, input_len); len += input_len; memcpy (*output + len, hash, MAC_HMAC_LEN); len += MAC_HMAC_LEN; memcpy (*output + len, MAC_MSG_TYPE, MAC_MSG_TYPE_LEN); len += MAC_MSG_TYPE_LEN; (*output + len)[0] = (sendseqnum >> 24) & 0xFF; (*output + len)[1] = (sendseqnum >> 16) & 0xFF; (*output + len)[2] = (sendseqnum >> 8) & 0xFF; (*output + len)[3] = sendseqnum & 0xFF; len += MAC_SEQNUM_LEN; (*output)[0] = ((len - MAC_DATA_LEN) >> 24) & 0xFF; (*output)[1] = ((len - MAC_DATA_LEN) >> 16) & 0xFF; (*output)[2] = ((len - MAC_DATA_LEN) >> 8) & 0xFF; (*output)[3] = (len - MAC_DATA_LEN) & 0xFF; } else { *output_len = input_len; *output = malloc (input_len); if (!*output) return -1; memcpy (*output, input, input_len); } return 0; }
false
false
false
false
false
0
tty_ldisc_lock(struct tty_struct *tty, unsigned long timeout) { int ret; ret = __tty_ldisc_lock(tty, timeout); if (!ret) return -EBUSY; set_bit(TTY_LDISC_HALTED, &tty->flags); return 0; }
false
false
false
false
false
0
fsi_seek_i(InStream *is, off_t pos) { if (lseek(is->file.fd, pos, SEEK_SET) < 0) { RAISE(IO_ERROR, "seeking pos %"OFF_T_PFX"d: <%s>", pos, strerror(errno)); } }
false
false
false
false
false
0
sb_write_res_just(String_buf sb, Just g, I3list map) { Ilist q; Ilist p = g->u.lst; sb_append(sb, jstring(g)); sb_append(sb, "("); sb_append_id(sb, p->i, map); for (q = p->next; q != NULL; q = q->next->next->next) { int nuc_lit = q->i; int sat_id = q->next->i; int sat_lit = q->next->next->i; sb_append(sb, ","); sb_append_char(sb, itoc(nuc_lit)); if (sat_id == 0) sb_append(sb, ",xx"); else { sb_append(sb, ","); sb_append_id(sb, sat_id, map); sb_append(sb, ","); if (sat_lit > 0) sb_append_char(sb, itoc(sat_lit)); else { sb_append_char(sb, itoc(-sat_lit)); sb_append(sb, "(flip)"); } } } sb_append(sb, ")"); }
false
false
false
false
false
0
xmlSecGnuTLSX509StoreFinalize(xmlSecKeyDataStorePtr store) { xmlSecGnuTLSX509StoreCtxPtr ctx; xmlSecAssert(xmlSecKeyDataStoreCheckId(store, xmlSecGnuTLSX509StoreId)); ctx = xmlSecGnuTLSX509StoreGetCtx(store); xmlSecAssert(ctx != NULL); xmlSecPtrListFinalize(&(ctx->certsTrusted)); xmlSecPtrListFinalize(&(ctx->certsUntrusted)); memset(ctx, 0, sizeof(xmlSecGnuTLSX509StoreCtx)); }
false
false
false
false
false
0
test_getsecret(sasl_conn_t *conn __attribute__((unused)), void *context __attribute__((unused)), int id, sasl_secret_t **psecret) { if(id != SASL_CB_PASS) fatal("test_getsecret not looking for pass"); if(!psecret) return SASL_BADPARAM; *psecret = g_secret; return SASL_OK; }
false
false
false
false
false
0
GetInternalType( char *pName, STABCOFFMAP *pMap ){ int n, found, i; if ( !pName ) { return(False); } found = False; n = strlen(pName); /* Find out if it is a local type */ for (i = 0; FundamentalTypes[i].pString != 0; i++) { if ( !strncmp(pName, FundamentalTypes[i].pString, n) ) { /* found an internal type */ pMap->CoffType = FundamentalTypes[i].Type; pMap->ByteSize = FundamentalTypes[i].Size; found = True; } } return(found); }
false
false
false
false
false
0
ve_is_string_in_list (const GList *list, const char *string) { g_return_val_if_fail (string != NULL, FALSE); while (list != NULL) { if (list->data != NULL && strcmp (string, list->data) == 0) return TRUE; list = list->next; } return FALSE; }
false
false
false
false
false
0
aem_exit(void) { struct aem_data *p1, *next1; ipmi_smi_watcher_unregister(&driver_data.bmc_events); driver_unregister(&aem_driver.driver); list_for_each_entry_safe(p1, next1, &driver_data.aem_devices, list) aem_delete(p1); }
false
false
false
false
false
0
__gsi_delete_mad_batch_context( IN ibis_gsi_mad_batch_context_t *p_batch_ctx) { ibis_gsi_mad_batch_context_t *p_rem_res; /* find the context in the map or assert */ cl_spinlock_acquire( &g_ibis_batch_contexts_map_lock ); p_rem_res = cl_map_remove( &g_ibis_active_batch_contexts_map, p_batch_ctx->id ); cl_spinlock_release( &g_ibis_batch_contexts_map_lock ); /* is it possible it was already deleted ??? */ if (p_rem_res != NULL) { /* need to cleanup the allocated event and lock */ cl_event_destroy(&p_batch_ctx->wait_for_resp); cl_spinlock_destroy(&p_batch_ctx->lock); memset(p_batch_ctx, 0, sizeof(ibis_gsi_mad_batch_context_t)); /* finally */ free(p_batch_ctx); } }
false
false
false
false
false
0
paramGetIntegral(OfxParamHandle paramHandle, OfxTime time1, OfxTime time2, ...) { # ifdef OFX_DEBUG_PARAMETERS std::cout << "OFX: paramGetIntegral - " << paramHandle << ' ' << time1 << ' ' << time2 << " ..."; # endif Instance *paramInstance = reinterpret_cast<Instance*>(paramHandle); if(!paramInstance || !paramInstance->verifyMagic()) { # ifdef OFX_DEBUG_PARAMETERS std::cout << ' ' << StatStr(kOfxStatErrBadHandle) << std::endl; # endif return kOfxStatErrBadHandle; } va_list ap; va_start(ap, time2); OfxStatus stat = kOfxStatErrUnsupported; try { stat = paramInstance->integrateV(time1, time2, ap); } catch(...) {} va_end(ap); # ifdef OFX_DEBUG_PARAMETERS std::cout << ' ' << StatStr(stat) << std::endl; # endif return stat; }
false
false
false
false
false
0
pquo(io *f, char *s) { pchr(f, '\''); for(;*s;s++) if(*s=='\'') pfmt(f, "''"); else pchr(f, *s); pchr(f, '\''); }
false
false
false
false
false
0
sighandler( int signum ) { #if ((defined(__INTEL_COMPILER) || defined(__ICC)) && defined(DO_PGO_DUMP)) _PGOPTI_Prof_Dump(); #endif signal( signum, sighandler ); if( signum == SIGQUIT ) clean_exit( SUCCESS ); // _exit( SUCCESS ); if( signum == SIGTERM ) clean_exit( FAILURE ); // _exit( FAILURE ); if( signum == SIGINT ) { #if ((defined(__INTEL_COMPILER) || defined(__ICC)) && defined(DO_PGO_DUMP)) clean_exit( FAILURE ); // _exit( FAILURE ); #else /* if(intr_read > 0)*/ clean_exit( FAILURE ); /* else intr_read++;*/ #endif } if( signum == SIGWINCH ) printf( "\33[2J\n" ); }
false
false
false
false
false
0
grl_registry_add_directory (GrlRegistry *registry, const gchar *path) { g_return_if_fail (GRL_IS_REGISTRY (registry)); g_return_if_fail (path); /* Use append instead of prepend so plugins are loaded in the same order as they were added */ registry->priv->plugins_dir = g_slist_append (registry->priv->plugins_dir, g_strdup (path)); registry->priv->all_plugins_preloaded = FALSE; }
false
false
false
false
false
0
ex_folddo(eap) exarg_T *eap; { linenr_T lnum; /* First set the marks for all lines closed/open. */ for (lnum = eap->line1; lnum <= eap->line2; ++lnum) if (hasFolding(lnum, NULL, NULL) == (eap->cmdidx == CMD_folddoclosed)) ml_setmarked(lnum); /* Execute the command on the marked lines. */ global_exe(eap->arg); ml_clearmarked(); /* clear rest of the marks */ }
false
false
false
false
false
0
logimevents(std::vector<struct imevent> &imevents) { char buffer[BUFFER_SIZE]; class Socket loggingsock(AF_UNIX, SOCK_STREAM); /* Complete the connection. */ if (!(loggingsock.connectsocket(LOGGING_SOCKET, ""))) return false; memset(buffer, 0, BUFFER_SIZE); snprintf(buffer, BUFFER_SIZE - 1, "%ld\n", (long)imevents.size()); if (!loggingsock.sendalldata(buffer, strlen(buffer))) return false; for (std::vector<struct imevent>::iterator i = imevents.begin(); i != imevents.end(); i++) { memset(buffer, 0, BUFFER_SIZE); /* Count up the lines. */ int eventdatalines = 1; for (char *p = (char *)(*i).eventdata.c_str(); *p; p++) { if (*p == '\n') eventdatalines++; } snprintf(buffer, BUFFER_SIZE - 1, "%d\n" "%s\n%s\n" "%d\n%d\n" "%s\n%s\n" "%d\n" "%s\n" "%d\n%s\n", (int)(*i).timestamp, (*i).clientaddress.c_str(), (*i).protocolname.c_str(), (*i).outgoing ? 1 : 0, (*i).type, (*i).localid.c_str(), (*i).remoteid.c_str(), (*i).filtered ? 1 : 0, (*i).categories.c_str(), eventdatalines, (*i).eventdata.c_str()); if (!loggingsock.sendalldata(buffer, strlen(buffer))) return false; } loggingsock.closesocket(); return true; }
false
false
false
false
false
0
maildir_shared_fparse(char *p, char **name, char **dir) { char *q; *name=0; *dir=0; if ((q=strchr(p, '\n')) != 0) *q=0; if ((q=strchr(p, '#')) != 0) *q=0; for (q=p; *q; q++) if (isspace((int)(unsigned char)*q)) break; if (!*q) return; *q++=0; while (*q && isspace((int)(unsigned char)*q)) ++q; if (*q) { *name=p; *dir=q; } }
false
true
false
false
false
1
mch_total_mem(special) int special; { # ifdef __EMX__ return ulimit(3, 0L) >> 10; /* always 32MB? */ # else long_u mem = 0; long_u shiftright = 10; /* how much to shift "mem" right for Kbyte */ # ifdef HAVE_SYSCTL int mib[2], physmem; size_t len; /* BSD way of getting the amount of RAM available. */ mib[0] = CTL_HW; mib[1] = HW_USERMEM; len = sizeof(physmem); if (sysctl(mib, 2, &physmem, &len, NULL, 0) == 0) mem = (long_u)physmem; # endif # if defined(HAVE_SYS_SYSINFO_H) && defined(HAVE_SYSINFO) if (mem == 0) { struct sysinfo sinfo; /* Linux way of getting amount of RAM available */ if (sysinfo(&sinfo) == 0) { # ifdef HAVE_SYSINFO_MEM_UNIT /* avoid overflow as much as possible */ while (shiftright > 0 && (sinfo.mem_unit & 1) == 0) { sinfo.mem_unit = sinfo.mem_unit >> 1; --shiftright; } mem = sinfo.totalram * sinfo.mem_unit; # else mem = sinfo.totalram; # endif } } # endif # ifdef HAVE_SYSCONF if (mem == 0) { long pagesize, pagecount; /* Solaris way of getting amount of RAM available */ pagesize = sysconf(_SC_PAGESIZE); pagecount = sysconf(_SC_PHYS_PAGES); if (pagesize > 0 && pagecount > 0) { /* avoid overflow as much as possible */ while (shiftright > 0 && (pagesize & 1) == 0) { pagesize = (long_u)pagesize >> 1; --shiftright; } mem = (long_u)pagesize * pagecount; } } # endif /* Return the minimum of the physical memory and the user limit, because * using more than the user limit may cause Vim to be terminated. */ # if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_GETRLIMIT) { struct rlimit rlp; if (getrlimit(RLIMIT_DATA, &rlp) == 0 && rlp.rlim_cur < ((rlim_t)1 << (sizeof(long_u) * 8 - 1)) # ifdef RLIM_INFINITY && rlp.rlim_cur != RLIM_INFINITY # endif && ((long_u)rlp.rlim_cur >> 10) < (mem >> shiftright) ) { mem = (long_u)rlp.rlim_cur; shiftright = 10; } } # endif if (mem > 0) return mem >> shiftright; return (long_u)0x1fffff; # endif }
false
false
false
false
false
0
utf8_to_imaputf7 (const std::string str) { gchar *buffer = utf8_to_imaputf7 (str.c_str(), -1); if (!buffer) return std::string (""); std::string result = std::string (buffer); g_free(buffer); return result; }
false
false
false
false
false
0
sigar_fs_type_get(sigar_file_system_t *fsp) { if (!(fsp->type || /* already set */ sigar_os_fs_type_get(fsp) || /* try os specifics first */ sigar_common_fs_type_get(fsp))) /* try common ones last */ { fsp->type = SIGAR_FSTYPE_NONE; } if (fsp->type >= SIGAR_FSTYPE_MAX) { fsp->type = SIGAR_FSTYPE_NONE; } strcpy(fsp->type_name, fstype_names[fsp->type]); }
false
false
false
false
false
0
S_with_queued_errors(pTHX_ SV *ex) { PERL_ARGS_ASSERT_WITH_QUEUED_ERRORS; if (PL_errors && SvCUR(PL_errors) && !SvROK(ex)) { sv_catsv(PL_errors, ex); ex = sv_mortalcopy(PL_errors); SvCUR_set(PL_errors, 0); } return ex; }
false
false
false
false
false
0
corsair_probe(struct hid_device *dev, const struct hid_device_id *id) { int ret; unsigned long quirks = id->driver_data; struct corsair_drvdata *drvdata; struct usb_interface *usbif = to_usb_interface(dev->dev.parent); drvdata = devm_kzalloc(&dev->dev, sizeof(struct corsair_drvdata), GFP_KERNEL); if (drvdata == NULL) return -ENOMEM; drvdata->quirks = quirks; hid_set_drvdata(dev, drvdata); ret = hid_parse(dev); if (ret != 0) { hid_err(dev, "parse failed\n"); return ret; } ret = hid_hw_start(dev, HID_CONNECT_DEFAULT); if (ret != 0) { hid_err(dev, "hw start failed\n"); return ret; } if (usbif->cur_altsetting->desc.bInterfaceNumber == 0) { if (quirks & CORSAIR_USE_K90_MACRO) { ret = k90_init_macro_functions(dev); if (ret != 0) hid_warn(dev, "Failed to initialize K90 macro functions.\n"); } if (quirks & CORSAIR_USE_K90_BACKLIGHT) { ret = k90_init_backlight(dev); if (ret != 0) hid_warn(dev, "Failed to initialize K90 backlight.\n"); } } return 0; }
false
false
false
false
false
0
ServerRefresh(CServer* NOT_ON_DAEMON(server)) { #ifndef AMULE_DAEMON if (theApp->amuledlg->m_serverwnd && theApp->amuledlg->m_serverwnd->serverlistctrl) { theApp->amuledlg->m_serverwnd->serverlistctrl->RefreshServer(server); } #endif }
false
false
false
false
false
0
_ppdLocalizedAttr(ppd_file_t *ppd, /* I - PPD file */ const char *keyword, /* I - Main keyword */ const char *spec, /* I - Option keyword */ const char *ll_CC) /* I - Language + country locale */ { char lkeyword[PPD_MAX_NAME]; /* Localization keyword */ ppd_attr_t *attr; /* Current attribute */ DEBUG_printf(("4_ppdLocalizedAttr(ppd=%p, keyword=\"%s\", spec=\"%s\", " "ll_CC=\"%s\")", ppd, keyword, spec, ll_CC)); /* * Look for Keyword.ll_CC, then Keyword.ll... */ snprintf(lkeyword, sizeof(lkeyword), "%s.%s", ll_CC, keyword); if ((attr = ppdFindAttr(ppd, lkeyword, spec)) == NULL) { snprintf(lkeyword, sizeof(lkeyword), "%2.2s.%s", ll_CC, keyword); attr = ppdFindAttr(ppd, lkeyword, spec); if (!attr) { if (!strncmp(ll_CC, "ja", 2)) { /* * Due to a bug in the CUPS DDK 1.1.0 ppdmerge program, Japanese * PPD files were incorrectly assigned "jp" as the locale name * instead of "ja". Support both the old (incorrect) and new * locale names for Japanese... */ snprintf(lkeyword, sizeof(lkeyword), "jp.%s", keyword); attr = ppdFindAttr(ppd, lkeyword, spec); } else if (!strncmp(ll_CC, "no", 2)) { /* * Norway has two languages, "Bokmal" (the primary one) * and "Nynorsk" (new Norwegian); we map "no" to "nb" here as * recommended by the locale folks... */ snprintf(lkeyword, sizeof(lkeyword), "nb.%s", keyword); attr = ppdFindAttr(ppd, lkeyword, spec); } } } #ifdef DEBUG if (attr) DEBUG_printf(("5_ppdLocalizedAttr: *%s %s/%s: \"%s\"\n", attr->name, attr->spec, attr->text, attr->value ? attr->value : "")); else DEBUG_puts("5_ppdLocalizedAttr: NOT FOUND"); #endif /* DEBUG */ return (attr); }
false
false
false
false
false
0
get_pa_object_name(Pa_object *obj) { char *name; Array_table *a; Var_table *v; Iv_table *i; Heap_table *h; switch(obj->kind) { case KIND_ARRAY : a = obj->tbl.a; name = a->name; break; case KIND_VAR : v = obj->tbl.v; name = v->name; break; case KIND_INVISIBLE : i = obj->tbl.i; name = i->name; break; case KIND_HEAP : h = obj->tbl.h; name = h->name; break; case KIND_TEMP : case KIND_UNINIT : case KIND_UNKNOWN : case KIND_FILE : name = NULL; break; default : name = NULL; fatal("unexpected kind\n"); break; } return name; }
false
false
false
false
false
0
GdipCreateImageAttributes (GpImageAttributes **imageattr) { GpImageAttributes *result; if (!imageattr) return InvalidParameter; result = (GpImageAttributes *) GdipAlloc (sizeof (GpImageAttributes)); if (!result) { *imageattr = NULL; return OutOfMemory; } gdip_init_image_attribute (&result->def); gdip_init_image_attribute (&result->bitmap); gdip_init_image_attribute (&result->brush); gdip_init_image_attribute (&result->pen); gdip_init_image_attribute (&result->text); result->color = 0; result->wrapmode = WrapModeClamp; *imageattr = result; return Ok; }
false
false
false
false
false
0
sanei_rts88xx_get_mem (SANE_Int devnum, SANE_Byte ctrl1, SANE_Byte ctrl2, SANE_Int length, SANE_Byte * value) { SANE_Status status; SANE_Byte regs[2]; regs[0] = ctrl1; regs[1] = ctrl2; status = sanei_rts88xx_write_regs (devnum, 0x91, regs, 2); if (status != SANE_STATUS_GOOD) { DBG (DBG_error, "sanei_rts88xx_get_mem: failed to write 0x91/0x92 registers\n"); return status; } status = sanei_rts88xx_read_mem (devnum, length, value); if (status != SANE_STATUS_GOOD) { DBG (DBG_error, "sanei_rts88xx_get_mem: failed to read memory\n"); } return status; }
false
false
false
false
false
0
eet_data_encode(Eet_Dictionary *ed, Eet_Data_Stream *ds, void *data, const char *name, int size, int type, int group_type) { Eet_Data_Chunk *echnk; if (!data) type = EET_T_NULL; if (group_type != EET_G_UNKNOWN) if (type >= EET_T_LAST) type = EET_T_UNKNOW; echnk = eet_data_chunk_new(data, size, name, type, group_type); eet_data_chunk_put(ed, echnk, ds); eet_data_chunk_free(echnk); free(data); }
false
false
false
false
false
0
printone(i) int i; { if (i >= 0) { exprintln(); printch(mbuffer[i].token); mvcur(-1,3); if (movemap[(unsigned int)(mbuffer[i].token)] == INSMACRO) prints("!= "); else prints(" = "); prints(mbuffer[i].m_text); } }
false
false
false
false
false
0
gtk_plot_pc_draw_string (GtkPlotPC *pc, gint x, gint y, gint angle, const GdkColor *fg, const GdkColor *bg, gboolean transparent, gint border, gint border_space, gint border_width, gint shadow_width, const gchar *font, gint height, GtkJustification just, const gchar *text) { if(!text) return; if(strlen(text) == 0) return; GTK_PLOT_PC_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(pc)))->draw_string(pc, x, y, angle, fg, bg, transparent, border, border_space, border_width, shadow_width, font, height, just, text); }
false
false
false
false
false
0
HTMLGetFont(li, env) HTMLInfo li; HTMLEnv env; { int i; HTMLClass lc = li->lc; HTMLFont lfi; HTMLFontList fl; lfi = env->fi; if (lfi == NULL) { lfi = HTMLDupFont(li,li->cfi); env->fi = lfi; } /* * Check spacing */ if (lfi->fixed) fl = lc->fixed; else fl = lc->prop; /* * Check slant, size, and weight */ for (i = 0; i < fl->count; i++) { if (((lfi->weight > 0) == (fl->fontInfo[i].weight > 0)) && ((lfi->slant > 0) == (fl->fontInfo[i].slant > 0)) && fl->scale[lfi->scale] == fl->fontInfo[i].size) { return(GetFont(lc, fl, i)); } } /* * Check slant and size */ for (i = 0; i < fl->count; i++) { if (((lfi->slant > 0) == (fl->fontInfo[i].slant > 0)) && fl->scale[lfi->scale] == fl->fontInfo[i].size) { return(GetFont(lc, fl, i)); } } /* * Check weight and size */ for (i = 0; i < fl->count; i++) { if (((lfi->weight > 0) == (fl->fontInfo[i].weight > 0)) && fl->scale[lfi->scale] == fl->fontInfo[i].size) { return(GetFont(lc, fl, i)); } } /* * Check size */ for (i = 0; i < fl->count; i++) { if (fl->scale[lfi->scale] == fl->fontInfo[i].size) { return(GetFont(lc, fl, i)); } } return(lc->defaultFont); }
false
false
false
false
false
0
wl18xx_lnk_high_prio(struct wl1271 *wl, u8 hlid, struct wl1271_link *lnk) { u8 thold; struct wl18xx_fw_status_priv *status_priv = (struct wl18xx_fw_status_priv *)wl->fw_status->priv; unsigned long suspend_bitmap; /* if we don't have the link map yet, assume they all low prio */ if (!status_priv) return false; /* suspended links are never high priority */ suspend_bitmap = le32_to_cpu(status_priv->link_suspend_bitmap); if (test_bit(hlid, &suspend_bitmap)) return false; /* the priority thresholds are taken from FW */ if (test_bit(hlid, &wl->fw_fast_lnk_map) && !test_bit(hlid, &wl->ap_fw_ps_map)) thold = status_priv->tx_fast_link_prio_threshold; else thold = status_priv->tx_slow_link_prio_threshold; return lnk->allocated_pkts < thold; }
false
false
false
false
false
0
CbInsert(void *data,std::vector<PlayItem> & items, unsigned position) { PlaylistWindow *playlist_window = (PlaylistWindow *)data; pthread_mutex_lock(&playlist_window->playlist_list_mutex); GDK_THREADS_ENTER(); std::vector<PlayItem> item_copy = items; GtkListStore *list = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(playlist_window->GetList()))); GtkTreeIter iter; if(items.size() > 0) { std::vector<PlayItem>::const_iterator item; for(item = items.begin(); item != items.end(); item++, position++) { gchar *list_item[4]; new_list_item(&(*item), list_item); gtk_list_store_insert (list, &iter, position); gtk_list_store_set (list, &iter, 0, NULL, 1, list_item[1], 2, list_item[2], 3, list_item[3], -1); g_free(list_item[0]); g_free(list_item[1]); g_free(list_item[2]); g_free(list_item[3]); } } GDK_THREADS_LEAVE(); pthread_mutex_unlock(&playlist_window->playlist_list_mutex); }
false
false
false
false
false
0
gss_inquire_mechs_for_name (OM_uint32 * minor_status, const gss_name_t input_name, gss_OID_set * mech_types) { OM_uint32 maj_stat; if (input_name == GSS_C_NO_NAME) { if (minor_status) *minor_status = 0; return GSS_S_BAD_NAME | GSS_S_CALL_INACCESSIBLE_READ; } maj_stat = gss_create_empty_oid_set (minor_status, mech_types); if (GSS_ERROR (maj_stat)) return maj_stat; maj_stat = _gss_inquire_mechs_for_name1 (minor_status, input_name->type, mech_types); if (GSS_ERROR (maj_stat)) { gss_release_oid_set (minor_status, mech_types); return maj_stat; } if (minor_status) *minor_status = 0; return GSS_S_COMPLETE; }
false
false
false
false
false
0
vmci_host_get_version(struct vmci_host_dev *vmci_host_dev, unsigned int cmd, void __user *uptr) { if (cmd == IOCTL_VMCI_VERSION2) { int __user *vptr = uptr; if (get_user(vmci_host_dev->user_version, vptr)) return -EFAULT; } /* * The basic logic here is: * * If the user sends in a version of 0 tell it our version. * If the user didn't send in a version, tell it our version. * If the user sent in an old version, tell it -its- version. * If the user sent in an newer version, tell it our version. * * The rationale behind telling the caller its version is that * Workstation 6.5 required that VMX and VMCI kernel module were * version sync'd. All new VMX users will be programmed to * handle the VMCI kernel module version. */ if (vmci_host_dev->user_version > 0 && vmci_host_dev->user_version < VMCI_VERSION_HOSTQP) { return vmci_host_dev->user_version; } return VMCI_VERSION; }
false
false
false
false
false
0
isl_basic_map_plain_is_empty(__isl_keep isl_basic_map *bmap) { if (!bmap) return -1; return ISL_F_ISSET(bmap, ISL_BASIC_MAP_EMPTY); }
false
false
false
false
false
0
loopcxt_is_autoclear(struct loopdev_cxt *lc) { struct sysfs_cxt *sysfs = loopcxt_get_sysfs(lc); if (sysfs) { int fl; if (sysfs_read_int(sysfs, "loop/autoclear", &fl) == 0) return fl; } if (loopcxt_ioctl_enabled(lc)) { struct loop_info64 *lo = loopcxt_get_info(lc); if (lo) return lo->lo_flags & LO_FLAGS_AUTOCLEAR; } return 0; }
false
false
false
false
false
0
gnm_style_get_align_h (GnmStyle const *style) { g_return_val_if_fail (style != NULL, GNM_HALIGN_LEFT); g_return_val_if_fail (elem_is_set (style, MSTYLE_ALIGN_H), GNM_HALIGN_LEFT); return style->h_align; }
false
false
false
false
false
0
vstop( b, flag ) register bptr b; char *flag; { register int i; if( *flag == '+' ) b->traced |= STOPVECCHANGE; else { for( i = 0; i < b->nbits; i += 1 ) b->nodes[i]->nflags &= ~STOPVECCHANGE; b->traced &= ~STOPVECCHANGE; } return( 1 ); }
false
false
false
false
false
0
restore(const char *filename) { static char *path; static size_t path_size; FILE *file; char *l; int line = 0, backup_line, status = 0; if (strcmp(filename, "-") == 0) file = stdin; else { file = fopen(filename, "r"); if (file == NULL) { fprintf(stderr, "%s: %s: %s\n", progname, filename, strerror_ea(errno)); return 1; } } for(;;) { backup_line = line; while ((l = next_line(file)) != NULL && *l == '\0') line++; if (l == NULL) break; line++; if (strncmp(l, "# file: ", 8) != 0) { if (file != stdin) { fprintf(stderr, _("%s: %s: No filename found " "in line %d, aborting\n"), progname, filename, backup_line); } else { fprintf(stderr, _("%s: No filename found in " "line %d of standard input, " "aborting\n"), progname, backup_line); } status = 1; goto cleanup; } else l += 8; l = unquote(l); if (high_water_alloc((void **)&path, &path_size, strlen(l)+1)) { perror(progname); status = 1; goto cleanup; } strcpy(path, l); while ((l = next_line(file)) != NULL && *l != '\0') { char *name = l, *value = strchr(l, '='); line++; if (value) *value++ = '\0'; status = do_set(path, unquote(name), value); } if (l == NULL) break; line++; } if (!feof(file)) { fprintf(stderr, "%s: %s: %s\n", progname, filename, strerror(errno)); if (!status) status = 1; } cleanup: if (path) free(path); if (file != stdin) fclose(file); if (status) had_errors++; return status; }
false
false
true
false
true
1
qla4xxx_create_ipv6_iface(struct scsi_qla_host *ha) { if (!ha->iface_ipv6_0) /* IPv6 iface-0 */ ha->iface_ipv6_0 = iscsi_create_iface(ha->host, &qla4xxx_iscsi_transport, ISCSI_IFACE_TYPE_IPV6, 0, 0); if (!ha->iface_ipv6_0) ql4_printk(KERN_ERR, ha, "Could not create IPv6 iSCSI " "iface0.\n"); if (!ha->iface_ipv6_1) /* IPv6 iface-1 */ ha->iface_ipv6_1 = iscsi_create_iface(ha->host, &qla4xxx_iscsi_transport, ISCSI_IFACE_TYPE_IPV6, 1, 0); if (!ha->iface_ipv6_1) ql4_printk(KERN_ERR, ha, "Could not create IPv6 iSCSI " "iface1.\n"); }
false
false
false
false
false
0
withTildeHomePath(const QString &path) { #ifdef Q_OS_WIN QString outPath = path; #else static const QString homePath = QDir::homePath(); QFileInfo fi(QDir::cleanPath(path)); QString outPath = fi.absoluteFilePath(); if (outPath.startsWith(homePath)) outPath = QLatin1Char('~') + outPath.mid(homePath.size()); else outPath = path; #endif return outPath; }
false
false
false
false
false
0
OnProjectOpened(CodeBlocksEvent& event) // ---------------------------------------------------------------------------- { // NB: EVT_PROJECT_ACTIVATE is occuring before EVT_PROJECT_OPEN // NB: EVT_EDITOR_ACTIVATE events occur before EVT_PROJECT_ACTIVATE or EVT_PROJECT_OPEN // Currently, this event is a hack to us since it occurs AFTER editors are activated // and AFTER the project is activated // But since the editors are now already open, we can read the layout file // that saved previous BrowseMark and book mark history, and use that data // to build/set old saved Browse/Book marks. if ( not IsBrowseMarksEnabled() ) return; m_bProjectClosing = false; cbProject* pProject = event.GetProject(); if ( not pProject ) { //caused when project imported m_bProjectIsLoading = false; return; } #if defined(LOGGING) LOGIT( _T("BT -----------------------------------")); LOGIT( _T("BT Project OPENED[%s]"), event.GetProject()->GetFilename().c_str() ); #endif wxString projectFilename = event.GetProject()->GetFilename(); // allocate a ProjectData to hold activated editors cbProject* pCBProject = event.GetProject(); ProjectData* pProjectData = GetProjectDataFromHash( pCBProject); if (not pProjectData) { pProjectData = new ProjectData(pCBProject); m_ProjectDataHash[pCBProject] = pProjectData; } // Read the layout file for this project, build BrowseMarks for each editor pProjectData = GetProjectDataFromHash( event.GetProject() ); if ( pProjectData) if (not pProjectData->IsLayoutLoaded() ) pProjectData->LoadLayout(); // There is a bug such that the project loading hook is *not* called // for some projects with a stray </unit> in its xml file. // Remove all the activated editors for this project when // the project was loaded. We don't want to see them if the user // didn't manually activate them. if (not m_bProjectIsLoading) { for (FilesList::iterator it = pCBProject->GetFilesList().begin(); it != pCBProject->GetFilesList().end(); ++it) { for (int j=0; j<MaxEntries; ++j) { if ( GetEditor(j) == 0 ) continue; //#if defined(LOGGING) //LOGIT( _T("BT eb[%s]projectFile[%s]"), // GetEditor(j)->GetFilename().c_str(), pProject->GetFile(i)->file.GetFullPath().c_str() ); //#endif if ( (*it)->file.GetFullPath() == GetEditor(j)->GetFilename()) { //#if defined(LOGGING) //LOGIT( _T("BT OnProjectOpened:Removing[%s]"),GetEditor(j)->GetFilename().c_str() ); //#endif RemoveEditor(GetEditor(j)); break; } } }//for }//if // Turn off "project loading" in order to record the last activated editor m_bProjectIsLoading = false; // Record the last CB activated editor as if the user activate it. EditorBase* eb = m_pEdMgr->GetBuiltinActiveEditor(); if ( eb && (eb != GetCurrentEditor()) ) { CodeBlocksEvent evt; evt.SetEditor(eb); OnEditorActivated(evt); #if defined(LOGGING) LOGIT( _T("BT OnProjectOpened Activated Editor[%p][%s]"), eb, eb->GetShortName().c_str() ); #endif } //*Testing* //for (EbBrowse_MarksHash::iterator it = m_EdBrowse_MarksArchive.begin(); it !=m_EdBrowse_MarksArchive.end(); ++it ) // it->second->Dump(); event.Skip(); }
false
false
false
false
false
0
_dxf_ExGQCurrent () { if (*gq_curr == NULL) return (NULL); return((*gq_curr)->func); }
false
false
false
false
false
0
find_first_table_item (ETableGroup *group) { GnomeCanvasGroup *cgroup; GList *l; cgroup = GNOME_CANVAS_GROUP (group); for (l = cgroup->item_list; l; l = l->next) { GnomeCanvasItem *i; i = GNOME_CANVAS_ITEM (l->data); if (E_IS_TABLE_GROUP (i)) return find_first_table_item (E_TABLE_GROUP (i)); else if (E_IS_TABLE_ITEM (i)) { return E_TABLE_ITEM (i); } } return NULL; }
false
false
false
false
false
0
focusIn(void) { if (checkBox()) checkBox()->selectedItem(checkBox()->buttons().indexOf((unsigned long)(MSWidget *)this)); MSCheckButton::focusIn(); }
false
false
false
false
false
0
read_attr_from_file(const char *path, int macro_ok) { FILE *fp = fopen(path, "r"); struct attr_stack *res; char buf[2048]; int lineno = 0; if (!fp) return NULL; res = xcalloc(1, sizeof(*res)); while (fgets(buf, sizeof(buf), fp)) handle_attr_line(res, buf, path, ++lineno, macro_ok); fclose(fp); return res; }
false
false
false
false
false
0
ad_read(ad1848_info * devc, int reg) { int x; int timeout = 900000; while (timeout > 0 && inb(devc->base) == 0x80) /*Are we initializing */ timeout--; if(reg < 32) { outb(((unsigned char) (reg & 0xff) | devc->MCE_bit), io_Index_Addr(devc)); x = inb(io_Indexed_Data(devc)); } else { int xreg, xra; xreg = (reg & 0xff) - 32; xra = (((xreg & 0x0f) << 4) & 0xf0) | 0x08 | ((xreg & 0x10) >> 2); outb(((unsigned char) (23 & 0xff) | devc->MCE_bit), io_Index_Addr(devc)); outb(((unsigned char) (xra & 0xff)), io_Indexed_Data(devc)); x = inb(io_Indexed_Data(devc)); } return x; }
false
false
false
false
false
0
VisitLiteral(Literal* expr) { HConstant* instr = new HConstant(expr->handle(), Representation::Tagged()); ast_context()->ReturnInstruction(instr, expr->id()); }
false
false
false
false
false
0
nilfs_free_incomplete_logs(struct list_head *logs, struct the_nilfs *nilfs) { struct nilfs_segment_buffer *segbuf, *prev; struct inode *sufile = nilfs->ns_sufile; int ret; segbuf = NILFS_FIRST_SEGBUF(logs); if (nilfs->ns_nextnum != segbuf->sb_nextnum) { ret = nilfs_sufile_free(sufile, segbuf->sb_nextnum); WARN_ON(ret); /* never fails */ } if (atomic_read(&segbuf->sb_err)) { /* Case 1: The first segment failed */ if (segbuf->sb_pseg_start != segbuf->sb_fseg_start) /* Case 1a: Partial segment appended into an existing segment */ nilfs_terminate_segment(nilfs, segbuf->sb_fseg_start, segbuf->sb_fseg_end); else /* Case 1b: New full segment */ set_nilfs_discontinued(nilfs); } prev = segbuf; list_for_each_entry_continue(segbuf, logs, sb_list) { if (prev->sb_nextnum != segbuf->sb_nextnum) { ret = nilfs_sufile_free(sufile, segbuf->sb_nextnum); WARN_ON(ret); /* never fails */ } if (atomic_read(&segbuf->sb_err) && segbuf->sb_segnum != nilfs->ns_nextnum) /* Case 2: extended segment (!= next) failed */ nilfs_sufile_set_error(sufile, segbuf->sb_segnum); prev = segbuf; } }
false
false
false
false
false
0
vflsh(void) { VPAGE *vp; VPAGE *vlowest; long addr; long last; VFILE *vfile; int x; for (vfile = vfiles.link.next; vfile != &vfiles; vfile = vfile->link.next) { last = -1; loop: addr = MAXLONG; vlowest = NULL; for (x = 0; x != HTSIZE; x++) for (vp = htab[x]; vp; vp = vp->next) if (vp->addr < addr && vp->addr > last && vp->vfile == vfile && (vp->addr >= vfile->size || (vp->dirty && !vp->count))) { addr = vp->addr; vlowest = vp; } if (vlowest) { if (!vfile->name) vfile->name = mktmp(NULL, vfile->fd ? NULL : &vfile->fd); if (!vfile->fd) vfile->fd = open((char *)(vfile->name), O_RDWR); lseek(vfile->fd, addr, 0); if (addr + PGSIZE > vsize(vfile)) { joe_write(vfile->fd, vlowest->data, vsize(vfile) - addr); vfile->size = vsize(vfile); } else { joe_write(vfile->fd, vlowest->data, PGSIZE); if (addr + PGSIZE > vfile->size) vfile->size = addr + PGSIZE; } vlowest->dirty = 0; last = addr; goto loop; } } }
false
false
false
false
false
0
accelCalReset() { for (int i = 0; i < 3; i++) { if (m_accelCalEnable[i]) { m_accelMin.setData(i, RTIMUCALDEFS_DEFAULT_MIN); m_accelMax.setData(i, RTIMUCALDEFS_DEFAULT_MAX); } } }
false
false
false
false
false
0
efopen(const char* name, const char* mode) { FILE* f=fopen(name,mode); if (f==NULL) { fprintf(stderr,"luac: cannot open %sput file ",*mode=='r' ? "in" : "out"); perror(name); exit(1); } return f; }
false
false
false
false
false
0
unchanged(buf, ff) buf_T *buf; int ff; /* also reset 'fileformat' */ { if (buf->b_changed || (ff && file_ff_differs(buf, FALSE))) { buf->b_changed = 0; ml_setflags(buf); if (ff) save_file_ff(buf); #ifdef FEAT_WINDOWS check_status(buf); redraw_tabline = TRUE; #endif #ifdef FEAT_TITLE need_maketitle = TRUE; /* set window title later */ #endif } ++buf->b_changedtick; #ifdef FEAT_NETBEANS_INTG netbeans_unmodified(buf); #endif }
false
false
false
false
false
0
ewma( float *d, float *s, float w ) { for( int i = 0; i < ( m_num / 2 ); i++, d++, s++ ) *d = *d * w + *s * ( 1 - w ); }
false
false
false
false
false
0
writeTimeoutCbk (TimeoutId id, void *data) { Connection cxn = (Connection) data ; const char *peerName ; ASSERT (id == cxn->writeBlockedTimerId) ; ASSERT (cxn->state == cxnConnectingS || cxn->state == cxnFeedingS || cxn->state == cxnFlushingS || cxn->state == cxnClosingS) ; VALIDATE_CONNECTION (cxn) ; /* XXX - let abortConnection clear writeBlockedTimerId, otherwise VALIDATE_CONNECTION() will croak */ peerName = hostPeerName (cxn->myHost) ; warn ("%s:%d cxnsleep write timeout", peerName, cxn->ident) ; d_printf (1,"%s:%d shutting down non-responsive connection\n", hostPeerName (cxn->myHost), cxn->ident) ; cxnLogStats (cxn,true) ; if (cxn->state == cxnClosingS) { abortConnection (cxn) ; delConnection (cxn) ; } else cxnSleep (cxn) ; /* will notify the Host */ }
false
false
false
false
false
0
var_find_add_submap(const string& name, bool* isnew) { *isnew = false; GLEVarSubMap* sub = m_SubMap.back(); int idx = sub->var_get(name); if (idx == -1) { idx = addVarIdx(name); sub->var_add(name, idx); *isnew = true; } return idx; }
false
false
false
false
false
0
is_start_code(uint8_t * data, int * type, uint32_t * length) { if(memcmp(data, startcode, 5)) return 0; if(memcmp(data + 10, endcode, 6)) return 0; *type = data[5]; *length = BGAV_PTR_2_32BE(&data[6]); return 1; }
false
false
false
false
false
0
mem_copy(void *dest, const void *src, size_t size) { size_t count; if (dest == src) { return ((u8 *) dest) + size; } if (ADDR_IS_ALIGN(src, 8) && ADDR_IS_ALIGN(dest, 8)) { count = size >> 3; dest = mem_copy64(dest, src, count); src = ((const u64 *) src) + count; count = size & 0x07; } else if (ADDR_IS_ALIGN(src, 4) && ADDR_IS_ALIGN(dest, 4)) { count = size >> 2; dest = mem_copy32(dest, src, count); src = ((const u32 *) src) + count; count = size & 0x03; } else if (ADDR_IS_ALIGN(src, 2) && ADDR_IS_ALIGN(dest, 2)) { count = size >> 1; dest = mem_copy16(dest, src, count); src = ((const u16 *) src) + count; count = size & 0x01; } else { count = size; } return mem_copy8(dest, src, count); }
false
false
false
false
false
0
IssueLocateRequest() { OMNIORB_ASSERT(pd_state == IOP_C::Idle); OMNIORB_ASSERT(pd_ior); pd_state = IOP_C::RequestInProgress; impl()->sendLocateRequest(this); pd_state = IOP_C::WaitingForReply; impl()->inputMessageBegin(this,impl()->unmarshalLocateReply); pd_state = IOP_C::ReplyIsBeingProcessed; GIOP::LocateStatusType rc = locateStatus(); if (rc == GIOP::LOC_SYSTEM_EXCEPTION) { UnMarshallSystemException(); // never reaches here } return rc; }
false
false
false
false
false
0
ata_eh_qc_retry(struct ata_queued_cmd *qc) { struct scsi_cmnd *scmd = qc->scsicmd; if (!qc->err_mask) scmd->allowed++; __ata_eh_qc_complete(qc); }
false
false
false
false
false
0
markWeakPtrList ( void ) { StgWeak *w, **last_w; last_w = &weak_ptr_list; for (w = weak_ptr_list; w; w = w->link) { // w might be WEAK, EVACUATED, or DEAD_WEAK (actually CON_STATIC) here #ifdef DEBUG { // careful to do this assertion only reading the info ptr // once, because during parallel GC it might change under our feet. const StgInfoTable *info; info = w->header.info; ASSERT(IS_FORWARDING_PTR(info) || info == &stg_DEAD_WEAK_info || INFO_PTR_TO_STRUCT(info)->type == WEAK); } #endif evacuate((StgClosure **)last_w); w = *last_w; if (w->header.info == &stg_DEAD_WEAK_info) { last_w = &(((StgDeadWeak*)w)->link); } else { last_w = &(w->link); } } }
false
false
false
false
false
0
peer_connect_fics(gpointer data) { mainw->openServer("freechess.org",5000,new FicsProtocol(),"timeseal"); if (global.FicsAutoLogin) if (global.network) if (global.network->isConnected()) new ScriptInstance("autofics.pl"); }
false
false
false
false
false
0
s_wsue(cilist *a) #endif { int n; if(!f__init) f_init(); if(n=c_sue(a)) return(n); f__reading=0; f__reclen=0; if(f__curunit->uwrt != 1 && f__nowwriting(f__curunit)) err(a->cierr, errno, "write start"); f__recloc=FTELL(f__cf); FSEEK(f__cf,(OFF_T)sizeof(uiolen),SEEK_CUR); return(0); }
false
false
false
false
false
0
config_renumber_one( Operation *op, SlapReply *rs, CfEntryInfo *parent, Entry *e, int idx, int tailindex, int use_ldif ) { struct berval ival, newrdn, nnewrdn; struct berval rdn; Attribute *a; char ibuf[32], *ptr1, *ptr2 = NULL; int rc = 0; rc = config_rename_attr( rs, e, &rdn, &a ); if ( rc ) return rc; ival.bv_val = ibuf; ival.bv_len = snprintf( ibuf, sizeof( ibuf ), SLAP_X_ORDERED_FMT, idx ); if ( ival.bv_len >= sizeof( ibuf ) ) { return LDAP_NAMING_VIOLATION; } newrdn.bv_len = rdn.bv_len + ival.bv_len; newrdn.bv_val = ch_malloc( newrdn.bv_len+1 ); if ( tailindex ) { ptr1 = lutil_strncopy( newrdn.bv_val, rdn.bv_val, rdn.bv_len ); ptr1 = lutil_strcopy( ptr1, ival.bv_val ); } else { int xlen; ptr2 = ber_bvchr( &rdn, '}' ); if ( ptr2 ) { ptr2++; } else { ptr2 = rdn.bv_val + a->a_desc->ad_cname.bv_len + 1; } xlen = rdn.bv_len - (ptr2 - rdn.bv_val); ptr1 = lutil_strncopy( newrdn.bv_val, a->a_desc->ad_cname.bv_val, a->a_desc->ad_cname.bv_len ); *ptr1++ = '='; ptr1 = lutil_strcopy( ptr1, ival.bv_val ); ptr1 = lutil_strncopy( ptr1, ptr2, xlen ); *ptr1 = '\0'; } /* Do the equivalent of ModRDN */ /* Replace DN / NDN */ newrdn.bv_len = ptr1 - newrdn.bv_val; rdnNormalize( 0, NULL, NULL, &newrdn, &nnewrdn, NULL ); rc = config_rename_one( op, rs, e, parent, a, &newrdn, &nnewrdn, use_ldif ); free( nnewrdn.bv_val ); free( newrdn.bv_val ); return rc; }
true
true
false
false
true
1
getCalleeSavedRegs(const MachineFunction *MF) const { const ARMSubtarget &STI = MF->getSubtarget<ARMSubtarget>(); const MCPhysReg *RegList = STI.isTargetDarwin() ? CSR_iOS_SaveList : CSR_AAPCS_SaveList; const Function *F = MF->getFunction(); if (F->getCallingConv() == CallingConv::GHC) { // GHC set of callee saved regs is empty as all those regs are // used for passing STG regs around return CSR_NoRegs_SaveList; } else if (F->hasFnAttribute("interrupt")) { if (STI.isMClass()) { // M-class CPUs have hardware which saves the registers needed to allow a // function conforming to the AAPCS to function as a handler. return CSR_AAPCS_SaveList; } else if (F->getFnAttribute("interrupt").getValueAsString() == "FIQ") { // Fast interrupt mode gives the handler a private copy of R8-R14, so less // need to be saved to restore user-mode state. return CSR_FIQ_SaveList; } else { // Generally only R13-R14 (i.e. SP, LR) are automatically preserved by // exception handling. return CSR_GenericInt_SaveList; } } return RegList; }
false
false
false
false
false
0
mma8452_write_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int val, int val2, long mask) { struct mma8452_data *data = iio_priv(indio_dev); int i, ret; if (iio_buffer_enabled(indio_dev)) return -EBUSY; switch (mask) { case IIO_CHAN_INFO_SAMP_FREQ: i = mma8452_get_samp_freq_index(data, val, val2); if (i < 0) return i; data->ctrl_reg1 &= ~MMA8452_CTRL_DR_MASK; data->ctrl_reg1 |= i << MMA8452_CTRL_DR_SHIFT; return mma8452_change_config(data, MMA8452_CTRL_REG1, data->ctrl_reg1); case IIO_CHAN_INFO_SCALE: i = mma8452_get_scale_index(data, val, val2); if (i < 0) return i; data->data_cfg &= ~MMA8452_DATA_CFG_FS_MASK; data->data_cfg |= i; return mma8452_change_config(data, MMA8452_DATA_CFG, data->data_cfg); case IIO_CHAN_INFO_CALIBBIAS: if (val < -128 || val > 127) return -EINVAL; return mma8452_change_config(data, MMA8452_OFF_X + chan->scan_index, val); case IIO_CHAN_INFO_HIGH_PASS_FILTER_3DB_FREQUENCY: if (val == 0 && val2 == 0) { data->data_cfg &= ~MMA8452_DATA_CFG_HPF_MASK; } else { data->data_cfg |= MMA8452_DATA_CFG_HPF_MASK; ret = mma8452_set_hp_filter_frequency(data, val, val2); if (ret < 0) return ret; } return mma8452_change_config(data, MMA8452_DATA_CFG, data->data_cfg); default: return -EINVAL; } }
false
false
false
false
false
0
posix_group_task_add(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter, int *returncode, char *returntext, void *arg) { PRThread *thread = NULL; int rv = SLAPI_DSE_CALLBACK_OK; task_data *mytaskdata = NULL; Slapi_Task *task = NULL; const char *filter; const char *dn = 0; *returncode = LDAP_SUCCESS; slapi_log_error(SLAPI_LOG_PLUGIN, POSIX_WINSYNC_PLUGIN_NAME, "posix_group_task_add: ==>\n"); /* get arg(s) */ /* default: set replication basedn */ if ((dn = fetch_attr(e, "basedn", slapi_sdn_get_dn(posix_winsync_config_get_suffix()))) == NULL) { *returncode = LDAP_OBJECT_CLASS_VIOLATION; rv = SLAPI_DSE_CALLBACK_ERROR; goto out; } slapi_log_error(SLAPI_LOG_PLUGIN, POSIX_WINSYNC_PLUGIN_NAME, "posix_group_task_add: retrieved basedn: %s\n", dn); if ((filter = fetch_attr(e, "filter", "(objectclass=ntGroup)")) == NULL) { *returncode = LDAP_OBJECT_CLASS_VIOLATION; rv = SLAPI_DSE_CALLBACK_ERROR; goto out; } slapi_log_error(SLAPI_LOG_PLUGIN, POSIX_WINSYNC_PLUGIN_NAME, "posix_group_task_add: retrieved filter: %s\n", filter); /* setup our task data */ mytaskdata = (task_data*) slapi_ch_malloc(sizeof(task_data)); if (mytaskdata == NULL) { *returncode = LDAP_OPERATIONS_ERROR; rv = SLAPI_DSE_CALLBACK_ERROR; goto out; } mytaskdata->dn = slapi_ch_strdup(dn); mytaskdata->filter_str = slapi_ch_strdup(filter); slapi_log_error(SLAPI_LOG_PLUGIN, POSIX_WINSYNC_PLUGIN_NAME, "posix_group_task_add: task data allocated\n"); /* allocate new task now */ char * ndn = slapi_entry_get_ndn(e); slapi_log_error(SLAPI_LOG_PLUGIN, POSIX_WINSYNC_PLUGIN_NAME, "posix_group_task_add: creating task object: %s\n", ndn); task = slapi_new_task(ndn); slapi_log_error(SLAPI_LOG_PLUGIN, POSIX_WINSYNC_PLUGIN_NAME, "posix_group_task_add: task object created\n"); /* register our destructor for cleaning up our private data */ slapi_task_set_destructor_fn(task, posix_group_task_destructor); slapi_log_error(SLAPI_LOG_PLUGIN, POSIX_WINSYNC_PLUGIN_NAME, "posix_group_task_add: task destructor set\n"); /* Stash a pointer to our data in the task */ slapi_task_set_data(task, mytaskdata); slapi_log_error(SLAPI_LOG_PLUGIN, POSIX_WINSYNC_PLUGIN_NAME, "posix_group_task_add: task object initialized\n"); /* start the sample task as a separate thread */ thread = PR_CreateThread(PR_USER_THREAD, posix_group_fixup_task_thread, (void *) task, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, SLAPD_DEFAULT_THREAD_STACKSIZE); slapi_log_error(SLAPI_LOG_PLUGIN, POSIX_WINSYNC_PLUGIN_NAME, "posix_group_task_add: thread created\n"); if (thread == NULL) { slapi_log_error(SLAPI_LOG_FATAL, POSIX_WINSYNC_PLUGIN_NAME, "unable to create task thread!\n"); *returncode = LDAP_OPERATIONS_ERROR; rv = SLAPI_DSE_CALLBACK_ERROR; slapi_task_finish(task, *returncode); } else { rv = SLAPI_DSE_CALLBACK_OK; } out: slapi_log_error(SLAPI_LOG_PLUGIN, POSIX_WINSYNC_PLUGIN_NAME, "posix_group_task_add: <==\n"); return rv; }
false
false
false
false
false
0
nm_system_compat_get_iface_type (int ifindex, const char *name) { int res = NM_IFACE_TYPE_UNSPEC; char *ifname = NULL, *path = NULL; struct vlan_ioctl_args ifv; struct ifreq ifr; struct ifbond ifb; struct stat st; int fd; g_return_val_if_fail (ifindex > 0 || name, NM_IFACE_TYPE_UNSPEC); if ((fd = socket (AF_INET, SOCK_STREAM, 0)) < 0) { nm_log_err (LOGD_DEVICE, "couldn't open control socket."); goto out; } if (!name) { g_assert (ifindex > 0); ifname = nm_netlink_index_to_iface (ifindex); } /* Check VLAN */ memset (&ifv, 0, sizeof (ifv)); ifv.cmd = GET_VLAN_VID_CMD; strncpy (ifv.device1, ifname ? ifname : name, sizeof (ifv.device1) - 1); if (ioctl (fd, SIOCGIFVLAN, &ifv) == 0) { res = NM_IFACE_TYPE_VLAN; goto out; } /* and bond */ memset (&ifr, 0, sizeof (ifr)); strncpy (ifr.ifr_name, ifname ? ifname : name, sizeof (ifr.ifr_name) - 1); memset (&ifb, 0, sizeof (ifb)); ifr.ifr_data = (caddr_t) &ifb; if (ioctl (fd, SIOCBONDINFOQUERY, &ifr) == 0) { res = NM_IFACE_TYPE_BOND; goto out; } /* and bridge */ path = g_strdup_printf ("/sys/class/net/%s/bridge", ifname ? ifname : name); if ((stat (path, &st) == 0) && S_ISDIR (st.st_mode)) { res = NM_IFACE_TYPE_BRIDGE; goto out; } out: g_free (path); close (fd); g_free (ifname); return res; }
false
true
false
false
false
1
AdCreateTableHeader ( char *Filename, ACPI_TABLE_HEADER *Table) { char *NewFilename; UINT8 Checksum; /* * Print file header and dump original table header */ AdDisassemblerHeader (Filename); AcpiOsPrintf (" * Original Table Header:\n"); AcpiOsPrintf (" * Signature \"%4.4s\"\n", Table->Signature); AcpiOsPrintf (" * Length 0x%8.8X (%u)\n", Table->Length, Table->Length); /* Print and validate the revision */ AcpiOsPrintf (" * Revision 0x%2.2X", Table->Revision); switch (Table->Revision) { case 0: AcpiOsPrintf (" **** Invalid Revision"); break; case 1: /* Revision of DSDT controls the ACPI integer width */ if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_DSDT)) { AcpiOsPrintf (" **** 32-bit table (V1), no 64-bit math support"); } break; default: break; } AcpiOsPrintf ("\n"); /* Print and validate the table checksum */ AcpiOsPrintf (" * Checksum 0x%2.2X", Table->Checksum); Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Table->Length); if (Checksum) { AcpiOsPrintf (" **** Incorrect checksum, should be 0x%2.2X", (UINT8) (Table->Checksum - Checksum)); } AcpiOsPrintf ("\n"); AcpiOsPrintf (" * OEM ID \"%.6s\"\n", Table->OemId); AcpiOsPrintf (" * OEM Table ID \"%.8s\"\n", Table->OemTableId); AcpiOsPrintf (" * OEM Revision 0x%8.8X (%u)\n", Table->OemRevision, Table->OemRevision); AcpiOsPrintf (" * Compiler ID \"%.4s\"\n", Table->AslCompilerId); AcpiOsPrintf (" * Compiler Version 0x%8.8X (%u)\n", Table->AslCompilerRevision, Table->AslCompilerRevision); AcpiOsPrintf (" */\n"); /* Create AML output filename based on input filename */ if (Filename) { NewFilename = FlGenerateFilename (Filename, "aml"); } else { NewFilename = ACPI_ALLOCATE_ZEROED (9); if (NewFilename) { strncat (NewFilename, Table->Signature, 4); strcat (NewFilename, ".aml"); } } if (!NewFilename) { AcpiOsPrintf (" **** Could not generate AML output filename\n"); return; } /* Open the ASL definition block */ AcpiOsPrintf ( "DefinitionBlock (\"%s\", \"%4.4s\", %hu, \"%.6s\", \"%.8s\", 0x%8.8X)\n", NewFilename, Table->Signature, Table->Revision, Table->OemId, Table->OemTableId, Table->OemRevision); ACPI_FREE (NewFilename); }
false
true
false
false
false
1
create_valid_preview(guchar **preview_data) { if (adjusted_thumbnail_data) { gint bpp = (print_mode_is_color(pv->v)) ? 3 : 1; gint v_denominator = preview_h > 1 ? preview_h - 1 : 1; gint v_numerator = (preview_thumbnail_h - 1) % v_denominator; gint v_whole = (preview_thumbnail_h - 1) / v_denominator; gint h_denominator = preview_w > 1 ? preview_w - 1 : 1; gint h_numerator = (preview_thumbnail_w - 1) % h_denominator; gint h_whole = (preview_thumbnail_w - 1) / h_denominator; gint adjusted_preview_width = bpp * preview_w; gint adjusted_thumbnail_width = bpp * preview_thumbnail_w; gint v_cur = 0; gint v_last = -1; gint v_error = v_denominator / 2; gint y; gint i; if (*preview_data) g_free (*preview_data); *preview_data = g_malloc (bpp * preview_h * preview_w); for (y = 0; y < preview_h; y++) { guchar *outbuf = *preview_data + adjusted_preview_width * y; if (v_cur == v_last) memcpy (outbuf, outbuf-adjusted_preview_width, adjusted_preview_width); else { guchar *inbuf = preview_thumbnail_data - bpp + adjusted_thumbnail_width * v_cur; gint h_cur = 0; gint h_last = -1; gint h_error = h_denominator / 2; gint x; v_last = v_cur; for (x = 0; x < preview_w; x++) { if (h_cur == h_last) { for (i = 0; i < bpp; i++) outbuf[i] = outbuf[i - bpp]; } else { inbuf += bpp * (h_cur - h_last); h_last = h_cur; for (i = 0; i < bpp; i++) outbuf[i] = inbuf[i]; } outbuf += bpp; h_cur += h_whole; h_error += h_numerator; if (h_error >= h_denominator) { h_error -= h_denominator; h_cur++; } } } v_cur += v_whole; v_error += v_numerator; if (v_error >= v_denominator) { v_error -= v_denominator; v_cur++; } } preview_valid = TRUE; } }
false
false
false
false
false
0
getRawTexChar(void) /*************************************************************************** purpose: get the next character from the input stream with minimal filtering (CRLF or CR or LF -> \n) and '\t' -> ' ' it also keeps track of the line number should only be used by \verb and \verbatim and getTexChar() ****************************************************************************/ { int thechar; if (g_parser_file) { thechar = getc(g_parser_file); while (thechar == EOF) { if (!feof(g_parser_file)) diagnostics(ERROR, "Unknown file I/O error reading latex file\n"); else if (g_parser_include_level > 1) { PopSource(); /* go back to parsing parent */ thechar = getRawTexChar(); /* get next char from parent file */ } else thechar = '\0'; } if (thechar == CR) { /* convert CR, CRLF, or LF to \n */ thechar = getc(g_parser_file); if (thechar != LF && !feof(g_parser_file)) ungetc(thechar, g_parser_file); thechar = '\n'; } else if (thechar == LF) thechar = '\n'; else if (thechar == '\t') thechar = ' '; g_parser_currentChar = (char) thechar; } else { if (g_parser_string && *g_parser_string) { thechar = *g_parser_string; /* convert CR, CRLF, or LF to \n */ if (thechar == CR) { g_parser_string++; thechar = *g_parser_string; if (thechar != LF) g_parser_string--; thechar = '\n'; } else if (thechar == LF) thechar = '\n'; else if (thechar == '\t') thechar = ' '; g_parser_currentChar = thechar; g_parser_string++; } else if (g_parser_depth > 15) { PopSource(); /* go back to parsing parent */ g_parser_currentChar = getRawTexChar(); /* get next char from parent file */ } else g_parser_currentChar = '\0'; } if (g_parser_currentChar == '\n' && g_track_line_number_stack[g_track_line_number]) g_parser_line++; g_parser_penultimateChar = g_parser_lastChar; g_parser_lastChar = g_parser_currentChar; if (0) { if (g_parser_currentChar=='\n') diagnostics(5,"getRawTexChar = <\\n>"); else if (g_parser_currentChar=='\0') diagnostics(5,"getRawTexChar = <\\0> depth=%d, files=%d", g_parser_depth, g_parser_include_level); else diagnostics(5,"getRawTexChar = <%2c>",g_parser_currentChar); } /* if (g_parser_currentChar=='\0') exit(0);*/ return g_parser_currentChar; }
false
false
false
false
false
0
dpcm_fe_dai_shutdown(struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *fe = substream->private_data; int stream = substream->stream; dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); /* shutdown the BEs */ dpcm_be_dai_shutdown(fe, substream->stream); dev_dbg(fe->dev, "ASoC: close FE %s\n", fe->dai_link->name); /* now shutdown the frontend */ soc_pcm_close(substream); /* run the stream event for each BE */ dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP); fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); return 0; }
false
false
false
false
false
0
print_nested_var_list(__isl_take isl_printer *p, __isl_keep isl_space *global_dim, enum isl_dim_type global_type, __isl_keep isl_space *local_dim, enum isl_dim_type local_type, int latex, __isl_keep isl_basic_map *eq, __isl_keep isl_multi_aff *maff, int offset) { int i, j; if (global_dim != local_dim && local_type == isl_dim_out) offset += local_dim->n_in; for (i = 0; i < isl_space_dim(local_dim, local_type); ++i) { if (i) p = isl_printer_print_str(p, ", "); if (maff && global_type == isl_dim_out) { p = print_aff_body(p, maff->p[offset + i]); continue; } j = defining_equality(eq, global_dim, global_type, offset + i); if (j >= 0) { int pos = 1 + isl_space_offset(global_dim, global_type) + offset + i; p = print_affine_of_len(eq->dim, NULL, p, eq->eq[j], pos); } else { p = print_name(global_dim, p, global_type, offset + i, latex); } } return p; }
false
false
false
false
false
0
logical_rewrite_heap_tuple(RewriteState state, ItemPointerData old_tid, HeapTuple new_tuple) { ItemPointerData new_tid = new_tuple->t_self; TransactionId cutoff = state->rs_logical_xmin; TransactionId xmin; TransactionId xmax; bool do_log_xmin = false; bool do_log_xmax = false; LogicalRewriteMappingData map; /* no logical rewrite in progress, we don't need to log anything */ if (!state->rs_logical_rewrite) return; xmin = HeapTupleHeaderGetXmin(new_tuple->t_data); /* use *GetUpdateXid to correctly deal with multixacts */ xmax = HeapTupleHeaderGetUpdateXid(new_tuple->t_data); /* * Log the mapping iff the tuple has been created recently. */ if (TransactionIdIsNormal(xmin) && !TransactionIdPrecedes(xmin, cutoff)) do_log_xmin = true; if (!TransactionIdIsNormal(xmax)) { /* * no xmax is set, can't have any permanent ones, so this check is * sufficient */ } else if (HEAP_XMAX_IS_LOCKED_ONLY(new_tuple->t_data->t_infomask)) { /* only locked, we don't care */ } else if (!TransactionIdPrecedes(xmax, cutoff)) { /* tuple has been deleted recently, log */ do_log_xmax = true; } /* if neither needs to be logged, we're done */ if (!do_log_xmin && !do_log_xmax) return; /* fill out mapping information */ map.old_node = state->rs_old_rel->rd_node; map.old_tid = old_tid; map.new_node = state->rs_new_rel->rd_node; map.new_tid = new_tid; /* --- * Now persist the mapping for the individual xids that are affected. We * need to log for both xmin and xmax if they aren't the same transaction * since the mapping files are per "affected" xid. * We don't muster all that much effort detecting whether xmin and xmax * are actually the same transaction, we just check whether the xid is the * same disregarding subtransactions. Logging too much is relatively * harmless and we could never do the check fully since subtransaction * data is thrown away during restarts. * --- */ if (do_log_xmin) logical_rewrite_log_mapping(state, xmin, &map); /* separately log mapping for xmax unless it'd be redundant */ if (do_log_xmax && !TransactionIdEquals(xmin, xmax)) logical_rewrite_log_mapping(state, xmax, &map); }
false
false
false
false
false
0
gt_encseq_has_twobitencoding(const GtEncseq *encseq) { gt_assert(encseq != NULL); return (encseq->accesstype_via_utables || encseq->sat >= GT_ACCESS_TYPE_EQUALLENGTH || encseq->sat == GT_ACCESS_TYPE_BITACCESS) ? true : false; }
false
false
false
false
false
0
parse_commit(struct commit *item) { enum object_type type; void *buffer; unsigned long size; int ret; if (item->object.parsed) return 0; buffer = read_sha1_file(item->object.sha1, &type, &size); if (!buffer) return error("Could not read %s", sha1_to_hex(item->object.sha1)); if (type != OBJ_COMMIT) { free(buffer); return error("Object %s not a commit", sha1_to_hex(item->object.sha1)); } ret = parse_commit_buffer(item, buffer, size); if (save_commit_buffer && !ret) { item->buffer = buffer; return 0; } free(buffer); return ret; }
false
false
false
false
false
0
apm_prtn_intxn(cli_ctx *ctx, struct apm_partition_info *aptable, size_t sectorsize, int old_school) { prtn_intxn_list_t prtncheck; struct apm_partition_info apentry; unsigned i, pitxn; int ret = CL_CLEAN, tmp = CL_CLEAN; off_t pos; uint32_t max_prtns = 0; prtn_intxn_list_init(&prtncheck); /* check engine maxpartitions limit */ if (aptable->numPartitions < ctx->engine->maxpartitions) { max_prtns = aptable->numPartitions; } else { max_prtns = ctx->engine->maxpartitions; } for (i = 1; i <= max_prtns; ++i) { /* read partition table entry */ pos = i * sectorsize; if (fmap_readn(*ctx->fmap, &apentry, pos, sizeof(apentry)) != sizeof(apentry)) { cli_dbgmsg("cli_scanapm: Invalid Apple partition entry\n"); prtn_intxn_list_free(&prtncheck); return CL_EFORMAT; } /* convert necessary info big endian to host */ apentry.pBlockStart = be32_to_host(apentry.pBlockStart); apentry.pBlockCount = be32_to_host(apentry.pBlockCount); /* re-calculate if old_school and aligned [512 * 4 => 2048] */ if (old_school && ((i % 4) == 0)) { if (!strncmp((char*)apentry.type, "Apple_Driver", 32) || !strncmp((char*)apentry.type, "Apple_Driver43", 32) || !strncmp((char*)apentry.type, "Apple_Driver43_CD", 32) || !strncmp((char*)apentry.type, "Apple_Driver_ATA", 32) || !strncmp((char*)apentry.type, "Apple_Driver_ATAPI", 32) || !strncmp((char*)apentry.type, "Apple_Patches", 32)) { apentry.pBlockCount = apentry.pBlockCount * 4;; } } tmp = prtn_intxn_list_check(&prtncheck, &pitxn, apentry.pBlockStart, apentry.pBlockCount); if (tmp != CL_CLEAN) { if ((ctx->options & CL_SCAN_ALLMATCHES) && (tmp == CL_VIRUS)) { apm_parsemsg("Name: %s\n", (char*)aptable.name); apm_parsemsg("Type: %s\n", (char*)aptable.type); cli_dbgmsg("cli_scanapm: detected intersection with partitions " "[%u, %u]\n", pitxn, i); cli_append_virus(ctx, PRTN_INTXN_DETECTION); ret = tmp; tmp = 0; } else if (tmp == CL_VIRUS) { apm_parsemsg("Name: %s\n", (char*)aptable.name); apm_parsemsg("Type: %s\n", (char*)aptable.type); cli_dbgmsg("cli_scanapm: detected intersection with partitions " "[%u, %u]\n", pitxn, i); cli_append_virus(ctx, PRTN_INTXN_DETECTION); prtn_intxn_list_free(&prtncheck); return CL_VIRUS; } else { prtn_intxn_list_free(&prtncheck); return tmp; } } pos += sectorsize; } prtn_intxn_list_free(&prtncheck); return ret; }
false
false
false
false
false
0
qed_ptt_set_win(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt, u32 new_hw_addr) { u32 prev_hw_addr; prev_hw_addr = qed_ptt_get_hw_addr(p_hwfn, p_ptt); if (new_hw_addr == prev_hw_addr) return; /* Update PTT entery in admin window */ DP_VERBOSE(p_hwfn, NETIF_MSG_HW, "Updating PTT entry %d to offset 0x%x\n", p_ptt->idx, new_hw_addr); /* The HW is using DWORDS and the address is in Bytes */ p_ptt->pxp.offset = cpu_to_le32(new_hw_addr >> 2); REG_WR(p_hwfn, qed_ptt_config_addr(p_ptt) + offsetof(struct pxp_ptt_entry, offset), le32_to_cpu(p_ptt->pxp.offset)); }
false
false
false
false
false
0
kvm_iommu_unmap_memslots(struct kvm *kvm) { int idx; struct kvm_memslots *slots; struct kvm_memory_slot *memslot; idx = srcu_read_lock(&kvm->srcu); slots = kvm_memslots(kvm); kvm_for_each_memslot(memslot, slots) kvm_iommu_unmap_pages(kvm, memslot); srcu_read_unlock(&kvm->srcu, idx); if (kvm->arch.iommu_noncoherent) kvm_arch_unregister_noncoherent_dma(kvm); return 0; }
false
false
false
false
false
0
homebank_save_xml(gchar *filename) { GIOChannel *io; char buf1[G_ASCII_DTOSTR_BUF_SIZE]; gchar *outstr; gint retval = XML_OK; io = g_io_channel_new_file(filename, "w", NULL); if(io == NULL) { g_message("file error on: %s", filename); retval = XML_IO_ERROR; } else { g_io_channel_write_chars(io, "<?xml version=\"1.0\"?>\n", -1, NULL, NULL); outstr = g_strdup_printf("<homebank v=\"%s\">\n", g_ascii_dtostr (buf1, sizeof (buf1), FILE_VERSION)); g_io_channel_write_chars(io, outstr, -1, NULL, NULL); g_free(outstr); homebank_save_xml_prop(io); //homebank_save_xml_cur(io); homebank_save_xml_acc(io); homebank_save_xml_pay(io); homebank_save_xml_cat(io); homebank_save_xml_tag(io); homebank_save_xml_asg(io); homebank_save_xml_arc(io); homebank_save_xml_ope(io); g_io_channel_write_chars(io, "</homebank>\n", -1, NULL, NULL); g_io_channel_unref (io); } return retval; }
true
true
false
false
false
1
aeMain(aeEventLoop *eventLoop) { eventLoop->stop = 0; while (!eventLoop->stop) { if (eventLoop->beforesleep != NULL) eventLoop->beforesleep(eventLoop); aeProcessEvents(eventLoop, AE_ALL_EVENTS); } }
false
false
false
false
false
0
dir_rewind(VALUE dir) { struct dir_data *dirp; if (rb_safe_level() >= 4 && !OBJ_UNTRUSTED(dir)) { rb_raise(rb_eSecurityError, "Insecure: can't close"); } GetDIR(dir, dirp); rewinddir(dirp->dir); return dir; }
false
false
false
false
false
0
FAR_pos(int FAR_row, int FAR_major, int FAR_minor) { int result, i; if (FAR_row < 0 || FAR_major < 0 || FAR_minor < 0) return -1; if (FAR_row > 3 || FAR_major > 17 || FAR_minor >= get_major_minors(XC6SLX9, FAR_major)) return -1; result = FAR_row * 505*130; for (i = 0; i < FAR_major; i++) result += get_major_minors(XC6SLX9, i)*130; return result + FAR_minor*130; }
false
false
false
false
false
0
main (int argc, char * argv[]) { long int array[] = { 10, 3, 4, 8, 2, 9, 7, 1, 2, 6, 5 }; Heap * heap = heap_new_with_data ((void**)array, 11, 0, NULL, NULL); heap_remove(heap, (void *)2); while (heap_size(heap) > 0) { printf ("%li\n", (long int)heap_pop(heap)); } return 0; }
false
false
false
false
false
0
mCreate( const char * pszFilename, int nXSize, int nYSize, int nBands, GDALDataType eType, char ** papszOptions ) { /*if( !SupportsInstr(INSTR_Create) ) { CPLError(CE_Failure, CPLE_NotSupported, "Create() not supported by server"); return FALSE; }*/ const char* pszServerDriver = CSLFetchNameValue(papszOptions, "SERVER_DRIVER"); if( pszServerDriver == NULL ) { CPLError(CE_Failure, CPLE_AppDefined, "Creation options should contain a SERVER_DRIVER item"); return FALSE; } if( !CSLFetchBoolean(papszOptions, "APPEND_SUBDATASET", FALSE) ) { if( !GDALClientDatasetQuietDelete(p, pszFilename) ) return FALSE; } GDALPipeWriteConfigOption(p,"GTIFF_POINT_GEO_IGNORE", bRecycleChild); GDALPipeWriteConfigOption(p,"GTIFF_DELETE_ON_ERROR", bRecycleChild); GDALPipeWriteConfigOption(p,"ESRI_XML_PAM", bRecycleChild); GDALPipeWriteConfigOption(p,"GTIFF_DONT_WRITE_BLOCKS", bRecycleChild); char* pszCWD = CPLGetCurrentDir(); if( !GDALPipeWrite(p, INSTR_Create) || !GDALPipeWrite(p, pszFilename) || !GDALPipeWrite(p, pszCWD) || !GDALPipeWrite(p, nXSize) || !GDALPipeWrite(p, nYSize) || !GDALPipeWrite(p, nBands) || !GDALPipeWrite(p, eType) || !GDALPipeWrite(p, papszOptions) ) { CPLFree(pszCWD); return FALSE; } CPLFree(pszCWD); if( !GDALSkipUntilEndOfJunkMarker(p) ) return FALSE; int bOK; if( !GDALPipeRead(p, &bOK) ) return FALSE; if( !bOK ) { GDALConsumeErrors(p); return FALSE; } GDALConsumeErrors(p); return Init(NULL, GA_Update); }
false
false
false
false
false
0
zzn2_from_big(_MIPD_ big x, zzn2 *w) { #ifdef MR_OS_THREADS miracl *mr_mip=get_mip(); #endif if (mr_mip->ERNUM) return; MR_IN(167) nres(_MIPP_ x,w->a); zero(w->b); MR_OUT }
false
false
false
false
false
0
focusblur_brush_render_oversamp (gfloat *dlp, gsize rowstride, gint width, FblurBrush *brush, gfloat factor, gfloat fx, gfloat fx_incx, gfloat fx_incy, gfloat fy, gfloat fy_incx, gfloat fy_incy) { const gfloat color_fnum = 1.0f / 255.0f; gfloat density = 0.0f; gfloat *dp; gint rx, ry, sx, sy; gfloat tran_sin, tran_cos; gint div; gfloat div_fac; gfloat val, sum; gfloat bit_sin, bit_cos; gfloat bx, by; gfloat bx_incx, by_incx; gfloat bx_incy, by_incy; gfloat bx_d, by_d; /* divided coordinates and first offset */ div = ((gint) floorf (factor)) * 2 + 1; if (div > 15) div = 15; div_fac = 1.0 / (div * div); tran_sin = - fy_incx; tran_cos = fx_incx; bit_sin = tran_sin / div; bit_cos = tran_cos / div; bx_incx = bit_cos; by_incx = - bit_sin; bx_incy = bit_sin - tran_cos; by_incy = bit_cos + tran_sin; bx_d = (bit_cos + bit_sin) * (div / 2); by_d = (bit_cos - bit_sin) * (div / 2); /* run on distribution */ for (ry = width; ry --; dlp += rowstride, fx += fx_incy, fy += fy_incy) for (rx = width, dp = dlp; rx --; dp ++, fx += fx_incx, fy += fy_incx) { /* clip */ if (fx + factor < 0.0f || fx - factor > (brush->width - 1) || fy + factor < 0.0f || fy - factor > (brush->height - 1)) continue; bx = fx - bx_d; by = fy - by_d; sum = 0.0f; /* run more minutely */ for (sy = div; sy --; bx += bx_incy, by += by_incy) for (sx = div; sx --; bx += bx_incx, by += by_incx) sum += focusblur_brush_get_pixel (brush, rintf (bx), rintf (by)); val = sum * div_fac; density += *dp = val * color_fnum; } g_assert (density > 0.0f); return density; }
false
false
false
false
false
0
alloc_data(bam1_t *b, int size) { if (b->m_data < size) { b->m_data = size; kroundup32(b->m_data); b->data = (uint8_t*)realloc(b->data, b->m_data); } return b->data; }
false
false
false
false
false
0
string2operator(string) const char *string; { if (strcmp(string, "eq") == 0 || strcmp(string, "=") == 0) return eq; if (strcmp(string, "neq") == 0 || strcmp(string, "!=") == 0) return neq; if (strcmp(string, "ge") == 0 || strcmp(string, ">=") == 0) return ge; if (strcmp(string, "le") == 0 || strcmp(string, "<=") == 0) return le; if (strcmp(string, "gt") == 0 || strcmp(string, ">") == 0) return gt; if (strcmp(string, "lt") == 0 || strcmp(string, "<") == 0) return lt; /* parser should make sure this never happens. */ SERRX(string); /* NOTREACHED */ }
false
false
false
false
false
0
umount_all1(char *devs[], size_t count, int flags) { size_t i; int ret, ret_tmp; for (i = 0, ret = 0; i < count; i++) { if (devs[i] == NULL) { continue; } ret_tmp = umount_main(devs[i], flags); if (ret_tmp < 0) { if (errno == EPERM) { return ret_tmp; } ret = ret_tmp; } } return ret; }
false
false
false
false
false
0
refresh() { if(brightness_) { bar_draw_=bar_brightness_; back_draw_=back_brightness_; } else { bar_draw_=bar_; back_draw_=back_; } }
false
false
false
false
false
0
FixFeatureTestsInRules(GrcFont *pfont) { GdlLookupExpression * pexplookFeature = dynamic_cast<GdlLookupExpression *>(m_pexpOperand1); if (m_psymOperator->IsComparativeOp() && pexplookFeature && pexplookFeature->NameFitsSymbolType(ksymtFeature)) { GdlFeatureDefn * pfeat = pexplookFeature->Name()->FeatureDefnData(); Assert(pfeat); GdlExpression * pexpNew = m_pexpOperand2->ConvertFeatureSettingValue(pfeat); if (pexpNew != m_pexpOperand2) { delete m_pexpOperand2; m_pexpOperand2 = pexpNew; } pexpNew = m_pexpOperand2->SimplifyAndUnscale(0xFFFF, pfont); Assert(pexpNew); if (pexpNew && pexpNew != m_pexpOperand2) { delete m_pexpOperand2; m_pexpOperand2 = pexpNew; } GdlNumericExpression * pexpnum = dynamic_cast<GdlNumericExpression *>(m_pexpOperand2); if (pexpnum) { if (!pfeat->IsLanguageFeature()) { GdlFeatureSetting * pfset = pfeat->FindSettingWithValue(pexpnum->Value()); if (!pfset) { char rgch[20]; itoa(pexpnum->Value(), rgch, 10); g_errorList.AddWarning(2514, this, "Feature '", pfeat->Name(), "' has no setting with value ", rgch, ((pexpnum->m_munits >= kmunitDefault) ? "m" : "")); } } } } else { m_pexpOperand1->FixFeatureTestsInRules(pfont); m_pexpOperand2->FixFeatureTestsInRules(pfont); } }
false
false
false
false
false
0
fli_set_form_icon_data( FL_FORM * form, char ** data ) { Pixmap p, s = None; unsigned int j; p = fl_create_from_pixmapdata( fl_root, data, &j, &j, &s, NULL, NULL, 0 ); if ( p != None ) { fl_set_form_icon( form, p, s ); fl_free( xpmattrib ); } }
false
false
false
false
false
0
parse_xml_make_state(Parse_xml_acs_state_code code, void *object) { Parse_xml_acs_state *s; s = ALLOC(Parse_xml_acs_state); s->code = code; switch (code) { case ACS_PARSE_ACL_INDEX: s->object.acl_index = (Acl_index *) object; break; case ACS_PARSE_ACL_MAP: s->object.acl_map = (Acl_map *) object; break; case ACS_PARSE_SERVICES: s->object.services = (Services *) object; break; case ACS_PARSE_SERVICE: s->object.service = (Service *) object; break; default: /* XXX ??? */ return(NULL); } return(s); }
false
false
false
false
false
0