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
init_ivtv_i2c(struct ivtv *itv) { int retval; IVTV_DEBUG_I2C("i2c init\n"); /* Sanity checks for the I2C hardware arrays. They must be the * same size. */ if (ARRAY_SIZE(hw_devicenames) != ARRAY_SIZE(hw_addrs)) { IVTV_ERR("Mismatched I2C hardware arrays\n"); return -ENODEV; } if (itv->options.newi2c > 0) { itv->i2c_adap = ivtv_i2c_adap_hw_template; } else { itv->i2c_adap = ivtv_i2c_adap_template; itv->i2c_algo = ivtv_i2c_algo_template; } itv->i2c_algo.udelay = itv->options.i2c_clock_period / 2; itv->i2c_algo.data = itv; itv->i2c_adap.algo_data = &itv->i2c_algo; sprintf(itv->i2c_adap.name + strlen(itv->i2c_adap.name), " #%d", itv->instance); i2c_set_adapdata(&itv->i2c_adap, &itv->v4l2_dev); itv->i2c_client = ivtv_i2c_client_template; itv->i2c_client.adapter = &itv->i2c_adap; itv->i2c_adap.dev.parent = &itv->pdev->dev; IVTV_DEBUG_I2C("setting scl and sda to 1\n"); ivtv_setscl(itv, 1); ivtv_setsda(itv, 1); if (itv->options.newi2c > 0) retval = i2c_add_adapter(&itv->i2c_adap); else retval = i2c_bit_add_bus(&itv->i2c_adap); return retval; }
false
true
false
false
false
1
m_explore_and_check (pIIR_InterfaceDeclaration id, RegionStack &rstack, bool collect_access_info) { if (done(id) & EXPLORED) return 0; else done(id) |= EXPLORED; int error_count = 0; ContextInfo &ctxt = *ActiveContext(rstack); error_count += explore_and_check(id->subtype, rstack, collect_access_info); if (id->initial_value && id->initial_value->is(IR_EXPRESSION)) { if (collect_access_info) { get_context(id->initial_value, ctxt, rstack, false, 0); get_context(id->initial_value->subtype, ctxt, rstack, false, 0); } error_count += explore_and_check(id->initial_value->subtype, rstack, collect_access_info); error_count += constant_fold(id->initial_value, rstack); error_count += check_expression(id->initial_value, rstack); } return error_count; }
false
false
false
false
false
0
write_task_queue(void) { int forked_count = 0; int suspended_count = 0; task *t; tqueue *tq; dbio_printf("0 clocks\n"); /* for compatibility's sake */ for (t = waiting_tasks; t; t = t->next) if (t->kind == TASK_FORKED) forked_count++; else /* t->kind == TASK_SUSPENDED */ suspended_count++; for (tq = active_tqueues; tq; tq = tq->next) for (t = tq->first_bg; t; t = t->next) if (t->kind == TASK_FORKED) forked_count++; else /* t->kind == TASK_SUSPENDED */ suspended_count++; dbio_printf("%d queued tasks\n", forked_count); for (t = waiting_tasks; t; t = t->next) if (t->kind == TASK_FORKED) write_forked_task(t->t.forked); for (tq = active_tqueues; tq; tq = tq->next) for (t = tq->first_bg; t; t = t->next) if (t->kind == TASK_FORKED) write_forked_task(t->t.forked); dbio_printf("%d suspended tasks\n", suspended_count); for (t = waiting_tasks; t; t = t->next) if (t->kind == TASK_SUSPENDED) write_suspended_task(t->t.suspended); for (tq = active_tqueues; tq; tq = tq->next) for (t = tq->first_bg; t; t = t->next) if (t->kind == TASK_SUSPENDED) write_suspended_task(t->t.suspended); }
false
false
false
false
false
0
homogeneous_spec_list (struct Spec_list *s) { int b, c; s->state = BEGIN_STATE; if ((b = get_next (s, NULL)) == -1) return false; while ((c = get_next (s, NULL)) != -1) if (c != b) return false; return true; }
false
false
false
false
false
0
__tzstring (const char *s) { char *p; struct tzstring_l *t, *u, *new; size_t len = strlen (s); /* Walk the list and look for a match. If this string is the same as the end of an already-allocated string, it can share space. */ for (u = t = tzstring_list; t; u = t, t = t->next) if (len <= t->len) { p = &t->data[t->len - len]; if (strcmp (s, p) == 0) return p; } /* Not found; allocate a new buffer. */ new = malloc (sizeof (struct tzstring_l) + len + 1); if (!new) return NULL; new->next = NULL; new->len = len; strcpy (new->data, s); if (u) u->next = new; else tzstring_list = new; return new->data; }
false
true
false
false
false
1
pack_float_ARGB2101010(const GLfloat src[4], void *dst) { GLuint *d = ((GLuint *) dst); GLushort r, g, b, a; UNCLAMPED_FLOAT_TO_USHORT(r, src[RCOMP]); UNCLAMPED_FLOAT_TO_USHORT(g, src[GCOMP]); UNCLAMPED_FLOAT_TO_USHORT(b, src[BCOMP]); UNCLAMPED_FLOAT_TO_USHORT(a, src[ACOMP]); *d = PACK_COLOR_2101010_US(a, r, g, b); }
false
false
false
false
false
0
predicate_elimination(Clist clauses, Clist disabled, BOOL echo) { Plist clauses2 = prepend_clist_to_plist(NULL, clauses); BOOL equality = equality_in_clauses(clauses2); /* eq => different method */ Ilist syms = eliminable_relations(clauses2, equality); if (syms == NULL) { zap_plist(clauses2); if (echo) printf("\nNo predicates eliminated.\n"); } else { clist_remove_all_clauses(clauses); while (syms) { /* use first symbol, discard rest, get new list */ if (echo) printf("\nEliminating %s/%d\n", sn_to_str(syms->i), sn_to_arity(syms->i)); clauses2 = elim_relation(syms->i, clauses2, disabled, echo); zap_ilist(syms); syms = eliminable_relations(clauses2, equality); } clist_append_plist(clauses, clauses2); zap_plist(clauses2); } }
false
false
false
false
false
0
ocfs2_put_slot(struct ocfs2_super *osb) { int status, slot_num; struct ocfs2_slot_info *si = osb->slot_info; if (!si) return; spin_lock(&osb->osb_lock); ocfs2_update_slot_info(si); slot_num = osb->slot_num; ocfs2_invalidate_slot(si, osb->slot_num); osb->slot_num = OCFS2_INVALID_SLOT; spin_unlock(&osb->osb_lock); status = ocfs2_update_disk_slot(osb, si, slot_num); if (status < 0) { mlog_errno(status); goto bail; } bail: ocfs2_free_slot_info(osb); }
false
false
false
false
false
0
GetLineRect(size_t line) const { if ( !InReportView() ) return GetLine(line)->m_gi->m_rectAll; wxRect rect; rect.x = HEADER_OFFSET_X; rect.y = GetLineY(line); rect.width = GetHeaderWidth(); rect.height = GetLineHeight(); return rect; }
false
false
false
false
false
0
cr_statement_ruleset_append_decl2 (CRStatement * a_this, CRString * a_prop, CRTerm * a_value) { CRDeclaration *new_decls = NULL; g_return_val_if_fail (a_this && a_this->type == RULESET_STMT && a_this->kind.ruleset, CR_BAD_PARAM_ERROR); new_decls = cr_declaration_append2 (a_this->kind.ruleset->decl_list, a_prop, a_value); g_return_val_if_fail (new_decls, CR_ERROR); a_this->kind.ruleset->decl_list = new_decls; return CR_OK; }
false
false
false
false
false
0
find_items_decode_secrets (DBusMessageIter *iter, find_items_args *args) { DBusMessageIter array, dict; GnomeKeyringFound *found; const char *path; gchar *keyring; gchar *secret; guint32 item_id; int type; if (dbus_message_iter_get_arg_type (iter) != DBUS_TYPE_ARRAY || dbus_message_iter_get_element_type (iter) != DBUS_TYPE_DICT_ENTRY) return FALSE; dbus_message_iter_recurse (iter, &array); for (;;) { type = dbus_message_iter_get_arg_type (&array); if (type == DBUS_TYPE_INVALID) break; else if (type != DBUS_TYPE_DICT_ENTRY) return FALSE; dbus_message_iter_recurse (&array, &dict); if (dbus_message_iter_get_arg_type (&dict) != DBUS_TYPE_OBJECT_PATH) return FALSE; /* The item path */ dbus_message_iter_get_basic (&dict, &path); if (!dbus_message_iter_next (&dict)) return FALSE; keyring = gkr_decode_keyring_item_id (path, &item_id); if (keyring == NULL) return FALSE; /* The secret */ if (!gkr_session_decode_secret (args->session, &dict, &secret)) { g_free (keyring); return FALSE; } found = g_new0 (GnomeKeyringFound, 1); found->item_id = item_id; found->keyring = keyring; found->secret = secret; args->queued = g_list_prepend (args->queued, found); dbus_message_iter_next (&array); } return TRUE; }
false
false
false
false
false
0
front_chdir(const char* dir) { int rc; if ( dir == NULL ) { cerr << "chdir: No valid diretory given!" << endl; return false; } #if defined(WIN32) rc = _chdir(dir); #else rc = chdir(dir); #endif if(rc == -1) { switch(errno) { case EACCES: cerr << "chdir: No permissions to:" << dir << endl; break; case EIO: cerr << "chdir: I/O error with: " << dir << endl; break; case ENOENT: cerr << "chdir: No such directory as: " << dir << endl; break; case ENOTDIR: cerr << "chdir: Not a directory:" << dir << endl; break; default: cerr << "chdir: Unexpected error with dir: " << dir << endl; break; } return false; } return true; }
false
false
false
false
false
0
cafe_smbus_write_data(struct cafe_camera *cam, u16 addr, u8 command, u8 value) { unsigned int rval; unsigned long flags; struct mcam_camera *mcam = &cam->mcam; spin_lock_irqsave(&mcam->dev_lock, flags); rval = TWSIC0_EN | ((addr << TWSIC0_SID_SHIFT) & TWSIC0_SID); rval |= TWSIC0_OVMAGIC; /* Make OV sensors work */ /* * Marvell sez set clkdiv to all 1's for now. */ rval |= TWSIC0_CLKDIV; mcam_reg_write(mcam, REG_TWSIC0, rval); (void) mcam_reg_read(mcam, REG_TWSIC1); /* force write */ rval = value | ((command << TWSIC1_ADDR_SHIFT) & TWSIC1_ADDR); mcam_reg_write(mcam, REG_TWSIC1, rval); spin_unlock_irqrestore(&mcam->dev_lock, flags); /* Unfortunately, reading TWSIC1 too soon after sending a command * causes the device to die. * Use a busy-wait because we often send a large quantity of small * commands at-once; using msleep() would cause a lot of context * switches which take longer than 2ms, resulting in a noticeable * boot-time and capture-start delays. */ mdelay(2); /* * Another sad fact is that sometimes, commands silently complete but * cafe_smbus_write_done() never becomes aware of this. * This happens at random and appears to possible occur with any * command. * We don't understand why this is. We work around this issue * with the timeout in the wait below, assuming that all commands * complete within the timeout. */ wait_event_timeout(cam->smbus_wait, cafe_smbus_write_done(mcam), CAFE_SMBUS_TIMEOUT); spin_lock_irqsave(&mcam->dev_lock, flags); rval = mcam_reg_read(mcam, REG_TWSIC1); spin_unlock_irqrestore(&mcam->dev_lock, flags); if (rval & TWSIC1_WSTAT) { cam_err(cam, "SMBUS write (%02x/%02x/%02x) timed out\n", addr, command, value); return -EIO; } if (rval & TWSIC1_ERROR) { cam_err(cam, "SMBUS write (%02x/%02x/%02x) error\n", addr, command, value); return -EIO; } return 0; }
false
false
false
false
false
0
createDate() const { GooString *goo = m_embeddedFile->filespec->getEmbeddedFile()->createDate(); return goo ? convertDate(goo->getCString()) : QDateTime(); }
false
false
false
false
false
0
account_up(GtkWidget *widget, gpointer data) { GtkTreePath *sel = account_list_view_get_selected_account_path (edit_account.list_view), *up; GtkTreeIter isel, iup; GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW(edit_account.list_view)); if (!sel) return; account_list_dirty = TRUE; up = gtk_tree_path_copy(sel); if (!up) { gtk_tree_path_free(sel); return; } if (!gtk_tree_path_prev(up)) { gtk_tree_path_free(up); gtk_tree_path_free(sel); return; } if (!gtk_tree_model_get_iter(model, &isel, sel) || !gtk_tree_model_get_iter(model, &iup, up)) { gtk_tree_path_free(up); gtk_tree_path_free(sel); return; } gtk_list_store_swap(GTK_LIST_STORE(model), &isel, &iup); account_list_set(); gtk_tree_path_free(up); gtk_tree_path_free(sel); }
false
false
false
false
false
0
run_init(int dir) { int py = p_ptr->py; int px = p_ptr->px; int i, row, col; bool deepleft, deepright; bool shortleft, shortright; /* Save the direction */ p_ptr->run_cur_dir = dir; /* Assume running straight */ p_ptr->run_old_dir = dir; /* Assume looking for open area */ p_ptr->run_open_area = TRUE; /* Assume not looking for breaks */ p_ptr->run_break_right = FALSE; p_ptr->run_break_left = FALSE; /* Assume no nearby walls */ deepleft = deepright = FALSE; shortright = shortleft = FALSE; /* Find the destination grid */ row = py + ddy[dir]; col = px + ddx[dir]; /* Extract cycle index */ i = chome[dir]; /* Check for nearby wall */ if (see_wall(cycle[i+1], py, px)) { p_ptr->run_break_left = TRUE; shortleft = TRUE; } /* Check for distant wall */ else if (see_wall(cycle[i+1], row, col)) { p_ptr->run_break_left = TRUE; deepleft = TRUE; } /* Check for nearby wall */ if (see_wall(cycle[i-1], py, px)) { p_ptr->run_break_right = TRUE; shortright = TRUE; } /* Check for distant wall */ else if (see_wall(cycle[i-1], row, col)) { p_ptr->run_break_right = TRUE; deepright = TRUE; } /* Looking for a break */ if (p_ptr->run_break_left && p_ptr->run_break_right) { /* Not looking for open area */ p_ptr->run_open_area = FALSE; /* Hack -- allow angled corridor entry */ if (dir & 0x01) { if (deepleft && !deepright) { p_ptr->run_old_dir = cycle[i - 1]; } else if (deepright && !deepleft) { p_ptr->run_old_dir = cycle[i + 1]; } } /* Hack -- allow blunt corridor entry */ else if (see_wall(cycle[i], row, col)) { if (shortleft && !shortright) { p_ptr->run_old_dir = cycle[i - 2]; } else if (shortright && !shortleft) { p_ptr->run_old_dir = cycle[i + 2]; } } } }
false
false
false
false
false
0
closest_grid_new (GfsDomain * domain, gdouble h) { ClosestGrid * g = g_malloc (sizeof (ClosestGrid)); guint i; g->max.x = - G_MAXDOUBLE; g->max.y = - G_MAXDOUBLE; g->max.z = - G_MAXDOUBLE; g->min.x = G_MAXDOUBLE; g->min.y = G_MAXDOUBLE; g->min.z = G_MAXDOUBLE; gfs_domain_cell_traverse (domain, FTT_PRE_ORDER, FTT_TRAVERSE_LEAFS, -1, (FttCellTraverseFunc) min_max_extent, g); g->nx = (g->max.x - g->min.x)/h + 3; g->h = h; g->ny = (g->max.y - g->min.y)/h + 3; g->min.x -= h; g->min.y -= h; g->max.x = g->min.x + g->nx*g->h; g->max.y = g->min.y + g->ny*g->h; g->p = g_malloc (g->nx*sizeof (GSList **)); for (i = 0; i < g->nx; i++) g->p[i] = g_malloc0 (g->ny*sizeof (GSList *)); return g; }
false
false
false
false
false
0
main() { string s; if (s.empty()) cout << "It's an empty string" << endl; }
false
false
false
false
false
0
find_ticket_state_attr_legacy(cib_t * the_cib, const char *attr, const char *ticket_id, const char *set_type, const char *set_name, const char *attr_id, const char *attr_name, char **value) { int offset = 0; static int xpath_max = 1024; int rc = pcmk_ok; xmlNode *xml_search = NULL; char *xpath_string = NULL; CRM_ASSERT(value != NULL); *value = NULL; xpath_string = calloc(1, xpath_max); offset += snprintf(xpath_string + offset, xpath_max - offset, "%s", "/cib/status/tickets"); if (set_type) { offset += snprintf(xpath_string + offset, xpath_max - offset, "/%s", set_type); if (set_name) { offset += snprintf(xpath_string + offset, xpath_max - offset, "[@id=\"%s\"]", set_name); } } offset += snprintf(xpath_string + offset, xpath_max - offset, "//nvpair["); if (attr_id) { offset += snprintf(xpath_string + offset, xpath_max - offset, "@id=\"%s\"", attr_id); } if (attr_name) { const char *attr_prefix = NULL; char *long_key = NULL; if (crm_str_eq(attr_name, "granted", TRUE)) { attr_prefix = "granted-ticket"; } else { attr_prefix = attr_name; } long_key = crm_concat(attr_prefix, ticket_id, '-'); if (attr_id) { offset += snprintf(xpath_string + offset, xpath_max - offset, " and "); } offset += snprintf(xpath_string + offset, xpath_max - offset, "@name=\"%s\"", long_key); free(long_key); } offset += snprintf(xpath_string + offset, xpath_max - offset, "]"); rc = the_cib->cmds->query(the_cib, xpath_string, &xml_search, cib_sync_call | cib_scope_local | cib_xpath); if (rc != pcmk_ok) { goto bail; } crm_log_xml_debug(xml_search, "Match"); if (xml_has_children(xml_search)) { xmlNode *child = NULL; rc = -EINVAL; fprintf(stdout, "Multiple attributes match name=%s\n", attr_name); for (child = __xml_first_child(xml_search); child != NULL; child = __xml_next(child)) { fprintf(stdout, " Value: %s \t(id=%s)\n", crm_element_value(child, XML_NVPAIR_ATTR_VALUE), ID(child)); } } else { const char *tmp = crm_element_value(xml_search, attr); if (tmp) { *value = strdup(tmp); } } bail: free(xpath_string); free_xml(xml_search); return rc; }
false
false
false
false
false
0
reposition (ChamplainMarkerLayer *layer) { ClutterActorIter iter; ClutterActor *child; g_return_if_fail (CHAMPLAIN_IS_MARKER_LAYER (layer)); clutter_actor_iter_init (&iter, CLUTTER_ACTOR (layer)); while (clutter_actor_iter_next (&iter, &child)) { ChamplainMarker *marker = CHAMPLAIN_MARKER (child); set_marker_position (layer, marker); } }
false
false
false
false
false
0
vfio_basic_config_read(struct vfio_pci_device *vdev, int pos, int count, struct perm_bits *perm, int offset, __le32 *val) { if (is_bar(offset)) /* pos == offset for basic config */ vfio_bar_fixup(vdev); count = vfio_default_config_read(vdev, pos, count, perm, offset, val); /* Mask in virtual memory enable for SR-IOV devices */ if (offset == PCI_COMMAND && vdev->pdev->is_virtfn) { u16 cmd = le16_to_cpu(*(__le16 *)&vdev->vconfig[PCI_COMMAND]); u32 tmp_val = le32_to_cpu(*val); tmp_val |= cmd & PCI_COMMAND_MEMORY; *val = cpu_to_le32(tmp_val); } return count; }
false
false
false
false
false
0
http_unescape(char *data) { char hex[3]; char *stp; int src_x = 0; int dst_x = 0; int length = (int) strlen(data); hex[2] = 0; while (src_x < length) { if (strncmp(data + src_x, "%", 1) == 0 && src_x + 2 < length) { // // Since we encountered a '%' we know this is an escaped character // hex[0] = data[src_x + 1]; hex[1] = data[src_x + 2]; data[dst_x] = (char) strtol(hex, &stp, 16); dst_x += 1; src_x += 3; } else if (src_x != dst_x) { // // This doesn't need to be unescaped. If we didn't unescape anything previously // there is no need to copy the string either // data[dst_x] = data[src_x]; src_x += 1; dst_x += 1; } else { // // This doesn't need to be unescaped, however we need to copy the string // src_x += 1; dst_x += 1; } } data[dst_x] = '\0'; }
false
false
false
false
false
0
appledisplay_complete(struct urb *urb) { struct appledisplay *pdata = urb->context; struct device *dev = &pdata->udev->dev; unsigned long flags; int status = urb->status; int retval; switch (status) { case 0: /* success */ break; case -EOVERFLOW: dev_err(dev, "OVERFLOW with data length %d, actual length is %d\n", ACD_URB_BUFFER_LEN, pdata->urb->actual_length); case -ECONNRESET: case -ENOENT: case -ESHUTDOWN: /* This urb is terminated, clean up */ dev_dbg(dev, "%s - urb shuttingdown with status: %d\n", __func__, status); return; default: dev_dbg(dev, "%s - nonzero urb status received: %d\n", __func__, status); goto exit; } spin_lock_irqsave(&pdata->lock, flags); switch(pdata->urbdata[1]) { case ACD_BTN_BRIGHT_UP: case ACD_BTN_BRIGHT_DOWN: pdata->button_pressed = 1; queue_delayed_work(wq, &pdata->work, 0); break; case ACD_BTN_NONE: default: pdata->button_pressed = 0; break; } spin_unlock_irqrestore(&pdata->lock, flags); exit: retval = usb_submit_urb(pdata->urb, GFP_ATOMIC); if (retval) { dev_err(dev, "%s - usb_submit_urb failed with result %d\n", __func__, retval); } }
false
false
false
false
false
0
news_command(char *arg, struct session *ses) { char line[BUFFER_SIZE]; FILE* news=fopen( NEWS_FILE , "r"); #ifdef DATA_PATH if (!news) news=fopen( DATA_PATH "/" NEWS_FILE , "r"); #endif if (news) { tintin_printf(ses,"~2~"); while (fgets(line,BUFFER_SIZE,news)) { *(char *)strchr(line,'\n')=0; tintin_printf(ses,"%s",line); } tintin_printf(ses,"~7~"); } else #ifdef DATA_PATH tintin_eprintf(ses,"#'%s' file not found in '%s'", NEWS_FILE, DATA_PATH); #else tintin_eprintf(ses,"#'%s' file not found!", NEWS_FILE); #endif prompt(ses); }
true
true
false
false
true
1
_dxf_pushHwGatherClipPlanes(gatherO go, int n, Point *p, Vector *v) { int i; gatherP gop; clipPlaneP clips = NULL; if (! go) return ERROR; gop = _getHwGatherData(go); clips = (clipPlaneP)DXAllocateZero(sizeof(clipPlanesT)); if (! clips) goto error; clips->n = n; if (n > 0) { clips->p = (Point *)DXAllocateZero(n*sizeof(Point)); if (! clips->p) goto error; clips->v = (Point *)DXAllocateZero(n*sizeof(Vector)); if (! clips->v) goto error; for (i = 0; i < n; i++) { clips->p[i] = p[i]; clips->v[i] = v[i]; } } clips->next = gop->clipStack; gop->clipStack = clips; return OK; error: if (clips) { DXFree((Pointer)clips->p); DXFree((Pointer)clips->v); DXFree((Pointer)clips); } return ERROR; }
false
false
false
false
false
0
reserve(size_t to) { if (_capacity >= to) return true; if (to >= IntUtil::maxUInt<size_t>() - sizeof(intptr_t) * 2) return false; to = IntUtil::alignTo<size_t>(to, sizeof(intptr_t)); char* newData = static_cast<char*>(ASMJIT_ALLOC(to + sizeof(intptr_t))); if (newData == NULL) return false; ::memcpy(newData, _data, _length + 1); if (_canFree) ASMJIT_FREE(_data); _data = newData; _capacity = to + sizeof(intptr_t) - 1; _canFree = true; return true; }
false
false
false
false
false
0
nuke_dead_procs(void) { Proc *proc, *next; for (proc = proclist; proc; proc = next) { next = proc->next; if (proc->state == PROC_DEAD) nukeproc(proc); } }
false
false
false
false
false
0
addWebcamProvider(WebcamPhotoProvider *provider) { if (!provider) return; ui->devicesCombo->addItem(provider->name(), QVariant(provider->id())); // m_availableDevices[provider->device()] = provider; }
false
false
false
false
false
0
gconf_list_model_iter_n_children (GtkTreeModel *tree_model, GtkTreeIter *iter) { /* it should ask for the root node, because we're a list */ if (!iter) return g_slist_length (GCONF_LIST_MODEL (tree_model)->values); return -1; }
false
false
false
false
false
0
lms_parser_del(lms_t *lms, lms_plugin_t *handle) { int i; if (!lms) return -1; if (!handle) return -2; if (!lms->parsers) return -3; if (lms->is_processing) { fprintf(stderr, "ERROR: do not del parsers while it's processing.\n"); return -4; } for (i = 0; i < lms->n_parsers; i++) if (lms->parsers[i].plugin == handle) return lms_parser_del_int(lms, i); return -3; }
false
false
false
false
false
0
ArgumentOption_is_set(ArgumentOption *ao){ if(ao->arg_list) return ao->arg_list->len?TRUE:FALSE; return ao->arg_value?TRUE:FALSE; }
false
false
false
false
false
0
isEmptyType(const Type* type) { // a type that has no variables and no constructor std::pair<std::map<const Type *,bool>::iterator,bool> found=isEmptyTypeMap.insert( std::pair<const Type *,bool>(type,false)); bool & emptyType=found.first->second; if (!found.second) return emptyType; if (type && type->classScope && type->classScope->numConstructors == 0 && (type->classScope->varlist.empty())) { for (std::vector<Type::BaseInfo>::const_iterator i = type->derivedFrom.begin(); i != type->derivedFrom.end(); ++i) { if (!isEmptyType(i->type)) { emptyType=false; return emptyType; } } emptyType=true; return emptyType; } emptyType=false; // unknown types are assumed to be nonempty return emptyType; }
false
false
false
false
false
0
AcpiDsExecBeginOp ( ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT **OutOp) { ACPI_PARSE_OBJECT *Op; ACPI_STATUS Status = AE_OK; UINT32 OpcodeClass; ACPI_FUNCTION_TRACE_PTR (DsExecBeginOp, WalkState); Op = WalkState->Op; if (!Op) { Status = AcpiDsLoad2BeginOp (WalkState, OutOp); if (ACPI_FAILURE (Status)) { goto ErrorExit; } Op = *OutOp; WalkState->Op = Op; WalkState->Opcode = Op->Common.AmlOpcode; WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); if (AcpiNsOpensScope (WalkState->OpInfo->ObjectType)) { ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", AcpiUtGetTypeName (WalkState->OpInfo->ObjectType), Op)); Status = AcpiDsScopeStackPop (WalkState); if (ACPI_FAILURE (Status)) { goto ErrorExit; } } } if (Op == WalkState->Origin) { if (OutOp) { *OutOp = Op; } return_ACPI_STATUS (AE_OK); } /* * If the previous opcode was a conditional, this opcode * must be the beginning of the associated predicate. * Save this knowledge in the current scope descriptor */ if ((WalkState->ControlState) && (WalkState->ControlState->Common.State == ACPI_CONTROL_CONDITIONAL_EXECUTING)) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Exec predicate Op=%p State=%p\n", Op, WalkState)); WalkState->ControlState->Common.State = ACPI_CONTROL_PREDICATE_EXECUTING; /* Save start of predicate */ WalkState->ControlState->Control.PredicateOp = Op; } OpcodeClass = WalkState->OpInfo->Class; /* We want to send namepaths to the load code */ if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP) { OpcodeClass = AML_CLASS_NAMED_OBJECT; } /* * Handle the opcode based upon the opcode type */ switch (OpcodeClass) { case AML_CLASS_CONTROL: Status = AcpiDsExecBeginControlOp (WalkState, Op); break; case AML_CLASS_NAMED_OBJECT: if (WalkState->WalkType & ACPI_WALK_METHOD) { /* * Found a named object declaration during method execution; * we must enter this object into the namespace. The created * object is temporary and will be deleted upon completion of * the execution of this method. * * Note 10/2010: Except for the Scope() op. This opcode does * not actually create a new object, it refers to an existing * object. However, for Scope(), we want to indeed open a * new scope. */ if (Op->Common.AmlOpcode != AML_SCOPE_OP) { Status = AcpiDsLoad2BeginOp (WalkState, NULL); } else { Status = AcpiDsScopeStackPush (Op->Named.Node, Op->Named.Node->Type, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } } } break; case AML_CLASS_EXECUTE: case AML_CLASS_CREATE: break; default: break; } /* Nothing to do here during method execution */ return_ACPI_STATUS (Status); ErrorExit: Status = AcpiDsMethodError (Status, WalkState); return_ACPI_STATUS (Status); }
false
false
false
false
false
0
find_kernel_nfs_mount_version(void) { int kernel_version; if (nfs_mount_version) return; nfs_mount_version = 4; /* default */ kernel_version = get_linux_version_code(); if (kernel_version) { if (kernel_version < KERNEL_VERSION(2,2,18)) nfs_mount_version = 3; /* else v4 since 2.3.99pre4 */ } }
false
false
false
false
false
0
FindDefaultValue( void *theEnv, int theType, CONSTRAINT_RECORD *theConstraints, void *standardDefault) { struct expr *theList; /*=====================================================*/ /* Look on the the allowed values list to see if there */ /* is a value of the requested type. Return the first */ /* value found of the requested type. */ /*=====================================================*/ theList = theConstraints->restrictionList; while (theList != NULL) { if (theList->type == theType) return(theList->value); theList = theList->nextArg; } /*=============================================================*/ /* If no specific values were available for the default value, */ /* and the type requested is a float or integer, then use the */ /* range attribute to select a default value. */ /*=============================================================*/ if (theType == INTEGER) { if (theConstraints->minValue->type == INTEGER) { return(theConstraints->minValue->value); } else if (theConstraints->minValue->type == FLOAT) { return(EnvAddLong(theEnv,(long) ValueToDouble(theConstraints->minValue->value))); } else if (theConstraints->maxValue->type == INTEGER) { return(theConstraints->maxValue->value); } else if (theConstraints->maxValue->type == FLOAT) { return(EnvAddLong(theEnv,(long) ValueToDouble(theConstraints->maxValue->value))); } } else if (theType == FLOAT) { if (theConstraints->minValue->type == FLOAT) { return(theConstraints->minValue->value); } else if (theConstraints->minValue->type == INTEGER) { return(EnvAddDouble(theEnv,(double) ValueToLong(theConstraints->minValue->value))); } else if (theConstraints->maxValue->type == FLOAT) { return(theConstraints->maxValue->value); } else if (theConstraints->maxValue->type == INTEGER) { return(EnvAddDouble(theEnv,(double) ValueToLong(theConstraints->maxValue->value))); } } /*======================================*/ /* Use the standard default value (such */ /* as nil if symbols are allowed). */ /*======================================*/ return(standardDefault); }
false
false
false
false
false
0
existsTimeLineHistoryFile(char *basedir, TimeLineID tli) { char path[MAXPGPATH]; char histfname[MAXFNAMELEN]; int fd; /* * Timeline 1 never has a history file. We treat that as if it existed, * since we never need to stream it. */ if (tli == 1) return true; TLHistoryFileName(histfname, tli); snprintf(path, sizeof(path), "%s/%s", basedir, histfname); fd = open(path, O_RDONLY | PG_BINARY, 0); if (fd < 0) { if (errno != ENOENT) fprintf(stderr, _("%s: could not open timeline history file \"%s\": %s\n"), progname, path, strerror(errno)); return false; } else { close(fd); return true; } }
true
true
false
false
true
1
resolve_name(struct addrinfo **out, char* fullname) { struct addrinfo hint; char *serv, *host; int res; char *sep = strrchr(fullname, ':'); if (!sep) /* No separator: parameter is just a port */ { fprintf(stderr, "names must be fully specified as hostname:port\n"); exit(1); } host = fullname; serv = sep+1; *sep = 0; memset(&hint, 0, sizeof(hint)); hint.ai_family = PF_UNSPEC; hint.ai_socktype = SOCK_STREAM; res = getaddrinfo(host, serv, &hint, out); if (res) { fprintf(stderr, "%s `%s'\n", gai_strerror(res), fullname); if (res == EAI_SERVICE) fprintf(stderr, "(Check you have specified all ports)\n"); exit(4); } }
false
false
false
false
false
0
read_line(CvsServerCtx * ctx, char * p) { int len = 0; while (1) { if (ctx->head == ctx->tail) if (refill_buffer(ctx) <= 0) return -1; *p = *ctx->head++; if (*p == '\n') { *p = 0; break; } p++; len++; } return len; }
false
false
false
false
false
0
getmaxgroups () { static int maxgroups = -1; if (maxgroups > 0) return maxgroups; #if defined (HAVE_SYSCONF) && defined (_SC_NGROUPS_MAX) maxgroups = sysconf (_SC_NGROUPS_MAX); #else # if defined (NGROUPS_MAX) maxgroups = NGROUPS_MAX; # else /* !NGROUPS_MAX */ # if defined (NGROUPS) maxgroups = NGROUPS; # else /* !NGROUPS */ maxgroups = DEFAULT_MAXGROUPS; # endif /* !NGROUPS */ # endif /* !NGROUPS_MAX */ #endif /* !HAVE_SYSCONF || !SC_NGROUPS_MAX */ if (maxgroups <= 0) maxgroups = DEFAULT_MAXGROUPS; return maxgroups; }
false
false
false
false
false
0
__bamc_compress_get_prev_nodup(dbc, flags) DBC *dbc; u_int32_t flags; { int ret; BTREE_CURSOR *cp; DB *dbp; BTREE *t; cp = (BTREE_CURSOR *)dbc->internal; dbp = dbc->dbp; t = (BTREE *)dbp->bt_internal; if (cp->currentKey == 0) return (__bamc_compress_get_prev(dbc, flags)); /* * If this is a deleted entry, del_key is already set, otherwise we * have to set it now. */ if (!F_ISSET(cp, C_COMPRESS_DELETED)) if ((ret = __bam_compress_set_dbt(dbp, &cp->del_key, cp->currentKey->data, cp->currentKey->size)) != 0) return (ret); /* * Linear search for the next non-duplicate key - this is * especially inefficient for DB_PREV_NODUP, since we have to * decompress from the beginning of the chunk to find previous * key/data pairs. Instead we could check for key equality as we * decompress. */ do if ((ret = __bamc_compress_get_prev(dbc, flags)) != 0) return (ret); while (t->bt_compare(dbp, cp->currentKey, &cp->del_key, NULL) == 0); return (0); }
false
false
false
false
false
0
build_map_info(struct address_space *mapping, loff_t offset, bool is_register) { unsigned long pgoff = offset >> PAGE_SHIFT; struct vm_area_struct *vma; struct map_info *curr = NULL; struct map_info *prev = NULL; struct map_info *info; int more = 0; again: i_mmap_lock_read(mapping); vma_interval_tree_foreach(vma, &mapping->i_mmap, pgoff, pgoff) { if (!valid_vma(vma, is_register)) continue; if (!prev && !more) { /* * Needs GFP_NOWAIT to avoid i_mmap_rwsem recursion through * reclaim. This is optimistic, no harm done if it fails. */ prev = kmalloc(sizeof(struct map_info), GFP_NOWAIT | __GFP_NOMEMALLOC | __GFP_NOWARN); if (prev) prev->next = NULL; } if (!prev) { more++; continue; } if (!atomic_inc_not_zero(&vma->vm_mm->mm_users)) continue; info = prev; prev = prev->next; info->next = curr; curr = info; info->mm = vma->vm_mm; info->vaddr = offset_to_vaddr(vma, offset); } i_mmap_unlock_read(mapping); if (!more) goto out; prev = curr; while (curr) { mmput(curr->mm); curr = curr->next; } do { info = kmalloc(sizeof(struct map_info), GFP_KERNEL); if (!info) { curr = ERR_PTR(-ENOMEM); goto out; } info->next = prev; prev = info; } while (--more); goto again; out: while (prev) prev = free_map_info(prev); return curr; }
false
false
false
false
false
0
creator (CONST int type) { int i; int color1 = color (type, 0, 0); for (i = nrockets; i < nobjects && (object[i].live || object[i].type == CREATOR); i++); if (i >= MAXOBJECT) return; if (!find_possition (&object[i].x, &object[i].y, radius (type))) return; if (i >= nobjects) nobjects = i + 1; object[i].live = 0; object[i].live1 = 1; object[i].lineto = -1; object[i].ctype = type; object[i].fx = 0.0; object[i].fy = 0.0; object[i].time = 50; object[i].rotation = 0; object[i].type = CREATOR; object[i].M = M (type); object[i].radius = radius (type); object[i].accel = ROCKET_SPEED; object[i].letter = ' '; #ifdef NETSUPPORT if (server) CreatorsPoints (object[i].radius, object[i].x, object[i].y, color1); else #endif creators_points (object[i].radius, object[i].x, object[i].y, color1); Effect (S_CREATOR1, 0); }
false
false
false
false
false
0
dwc_alloc_chan_resources(struct dma_chan *chan) { struct dw_dma_chan *dwc = to_dw_dma_chan(chan); struct dw_dma *dw = to_dw_dma(chan->device); struct dw_desc *desc; int i; unsigned long flags; dev_vdbg(chan2dev(chan), "%s\n", __func__); /* ASSERT: channel is idle */ if (dma_readl(dw, CH_EN) & dwc->mask) { dev_dbg(chan2dev(chan), "DMA channel not idle?\n"); return -EIO; } dma_cookie_init(chan); /* * NOTE: some controllers may have additional features that we * need to initialize here, like "scatter-gather" (which * doesn't mean what you think it means), and status writeback. */ /* * We need controller-specific data to set up slave transfers. */ if (chan->private && !dw_dma_filter(chan, chan->private)) { dev_warn(chan2dev(chan), "Wrong controller-specific data\n"); return -EINVAL; } /* Enable controller here if needed */ if (!dw->in_use) dw_dma_on(dw); dw->in_use |= dwc->mask; spin_lock_irqsave(&dwc->lock, flags); i = dwc->descs_allocated; while (dwc->descs_allocated < NR_DESCS_PER_CHANNEL) { dma_addr_t phys; spin_unlock_irqrestore(&dwc->lock, flags); desc = dma_pool_alloc(dw->desc_pool, GFP_ATOMIC, &phys); if (!desc) goto err_desc_alloc; memset(desc, 0, sizeof(struct dw_desc)); INIT_LIST_HEAD(&desc->tx_list); dma_async_tx_descriptor_init(&desc->txd, chan); desc->txd.tx_submit = dwc_tx_submit; desc->txd.flags = DMA_CTRL_ACK; desc->txd.phys = phys; dwc_desc_put(dwc, desc); spin_lock_irqsave(&dwc->lock, flags); i = ++dwc->descs_allocated; } spin_unlock_irqrestore(&dwc->lock, flags); dev_dbg(chan2dev(chan), "%s: allocated %d descriptors\n", __func__, i); return i; err_desc_alloc: dev_info(chan2dev(chan), "only allocated %d descriptors\n", i); return i; }
false
false
false
false
false
0
__pyx_f_9lightning_4impl_14primal_cd_fast_3Log_derivatives(CYTHON_UNUSED struct __pyx_obj_9lightning_4impl_14primal_cd_fast_Log *__pyx_v_self, CYTHON_UNUSED int __pyx_v_j, double __pyx_v_C, int *__pyx_v_indices, double *__pyx_v_data, int __pyx_v_n_nz, double *__pyx_v_y, double *__pyx_v_b, double *__pyx_v_Lp, double *__pyx_v_Lpp, double *__pyx_v_L) { int __pyx_v_i; int __pyx_v_ii; double __pyx_v_val; double __pyx_v_tau; double __pyx_v_exppred; double __pyx_v_tmp; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; long __pyx_t_3; __Pyx_RefNannySetupContext("derivatives", 0); /* "lightning/impl/primal_cd_fast.pyx":977 * * # First derivative * Lp[0] = 0 # <<<<<<<<<<<<<< * # Second derivative * Lpp[0] = 0 */ (__pyx_v_Lp[0]) = 0.0; /* "lightning/impl/primal_cd_fast.pyx":979 * Lp[0] = 0 * # Second derivative * Lpp[0] = 0 # <<<<<<<<<<<<<< * # Objective value * L[0] = 0 */ (__pyx_v_Lpp[0]) = 0.0; /* "lightning/impl/primal_cd_fast.pyx":981 * Lpp[0] = 0 * # Objective value * L[0] = 0 # <<<<<<<<<<<<<< * * for ii in xrange(n_nz): */ (__pyx_v_L[0]) = 0.0; /* "lightning/impl/primal_cd_fast.pyx":983 * L[0] = 0 * * for ii in xrange(n_nz): # <<<<<<<<<<<<<< * i = indices[ii] * val = data[ii] * y[i] */ __pyx_t_1 = __pyx_v_n_nz; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_ii = __pyx_t_2; /* "lightning/impl/primal_cd_fast.pyx":984 * * for ii in xrange(n_nz): * i = indices[ii] # <<<<<<<<<<<<<< * val = data[ii] * y[i] * */ __pyx_v_i = (__pyx_v_indices[__pyx_v_ii]); /* "lightning/impl/primal_cd_fast.pyx":985 * for ii in xrange(n_nz): * i = indices[ii] * val = data[ii] * y[i] # <<<<<<<<<<<<<< * * exppred = 1 + 1 / b[i] */ __pyx_v_val = ((__pyx_v_data[__pyx_v_ii]) * (__pyx_v_y[__pyx_v_i])); /* "lightning/impl/primal_cd_fast.pyx":987 * val = data[ii] * y[i] * * exppred = 1 + 1 / b[i] # <<<<<<<<<<<<<< * tau = 1 / exppred * tmp = val * C */ __pyx_v_exppred = (1.0 + (1.0 / (__pyx_v_b[__pyx_v_i]))); /* "lightning/impl/primal_cd_fast.pyx":988 * * exppred = 1 + 1 / b[i] * tau = 1 / exppred # <<<<<<<<<<<<<< * tmp = val * C * Lp[0] += tmp * (tau - 1) */ __pyx_v_tau = (1.0 / __pyx_v_exppred); /* "lightning/impl/primal_cd_fast.pyx":989 * exppred = 1 + 1 / b[i] * tau = 1 / exppred * tmp = val * C # <<<<<<<<<<<<<< * Lp[0] += tmp * (tau - 1) * Lpp[0] += tmp * val * tau * (1 - tau) */ __pyx_v_tmp = (__pyx_v_val * __pyx_v_C); /* "lightning/impl/primal_cd_fast.pyx":990 * tau = 1 / exppred * tmp = val * C * Lp[0] += tmp * (tau - 1) # <<<<<<<<<<<<<< * Lpp[0] += tmp * val * tau * (1 - tau) * L[0] += C * log(exppred) */ __pyx_t_3 = 0; (__pyx_v_Lp[__pyx_t_3]) = ((__pyx_v_Lp[__pyx_t_3]) + (__pyx_v_tmp * (__pyx_v_tau - 1.0))); /* "lightning/impl/primal_cd_fast.pyx":991 * tmp = val * C * Lp[0] += tmp * (tau - 1) * Lpp[0] += tmp * val * tau * (1 - tau) # <<<<<<<<<<<<<< * L[0] += C * log(exppred) * */ __pyx_t_3 = 0; (__pyx_v_Lpp[__pyx_t_3]) = ((__pyx_v_Lpp[__pyx_t_3]) + (((__pyx_v_tmp * __pyx_v_val) * __pyx_v_tau) * (1.0 - __pyx_v_tau))); /* "lightning/impl/primal_cd_fast.pyx":992 * Lp[0] += tmp * (tau - 1) * Lpp[0] += tmp * val * tau * (1 - tau) * L[0] += C * log(exppred) # <<<<<<<<<<<<<< * * */ __pyx_t_3 = 0; (__pyx_v_L[__pyx_t_3]) = ((__pyx_v_L[__pyx_t_3]) + (__pyx_v_C * log(__pyx_v_exppred))); } /* "lightning/impl/primal_cd_fast.pyx":962 * # Binary * * cdef void derivatives(self, # <<<<<<<<<<<<<< * int j, * double C, */ /* function exit code */ __Pyx_RefNannyFinishContext(); }
false
false
false
false
false
0
tools_read_range(const string & s, S_I & min, U_I & max) { string::const_iterator it = s.begin(); while(it < s.end() && *it != '-') it++; try { if(it < s.end()) { min = tools_str2int(string(s.begin(), it)); max = tools_str2int(string(++it, s.end())); } else min = max = tools_str2int(s); } catch(Erange & e) { min = tools_str2signed_int(s); max = 0; } }
false
false
false
false
false
0
ExecSelect ( PTreeNode *pt, ObjStruct *os, int numInputs, Pointer *inputs, Pointer result, InvalidComponentHandle *invalids, InvalidComponentHandle outInvalid) { int size0 = pt->args->metaType.items; int size1 = pt->args->next->metaType.items; int i, j, k; int numBasic; int size; int subSize; PTreeNode *vect; int vectLen; int selector; int items; int allValid = (invalids[0] == NULL || DXGetInvalidCount(invalids[0]) == 0) && (invalids[1] == NULL || DXGetInvalidCount(invalids[1]) == 0); #ifdef COMP_DEBUG DXDebug ("C", "ExecSelect, %d: pt = 0x%08x, os = 0x%08x", __LINE__, pt, os); #endif /* Get type of arguments, and allocate nargs of pointers. * For each arg, allocate a result array, and execute it */ vect = pt->args; if (vect->metaType.rank == 0) { subSize = DXTypeSize (vect->metaType.type) * DXCategorySize (vect->metaType.category); size = subSize; vectLen = 1; } else { for (numBasic = 1, i = 1; i < vect->metaType.rank; ++i) { numBasic *= vect->metaType.shape[i]; } subSize = DXTypeSize (vect->metaType.type) * DXCategorySize (vect->metaType.category) * numBasic; /* Put the results together into a list */ vectLen = vect->metaType.shape[0]; size = subSize * vectLen; } /* For each item in list, select out the value */ items = pt->metaType.items; for (i = j = k = 0; i < items; ++i) { if (allValid || _dxfComputeInvalidOr(outInvalid, i, invalids[0], j, invalids[1], k)) { selector = *(int *)(((char *)inputs[1]) + k * sizeof (int)); if (selector < vectLen && selector >= 0) { bcopy ((Pointer)(((char *)inputs[0]) + (j * size) + selector * subSize), (Pointer)(((char *)result) + (i * subSize)), subSize); } else { DXSetError (ERROR_BAD_TYPE, "#12010", selector, vectLen); return (ERROR); } } if (size0 != 1) ++j; if (size1 != 1) ++k; } return (OK); }
true
true
false
false
false
1
get_type(int fd) { int drive; struct stat statbuf; if (fstat(fd, &statbuf) < 0 ){ perror("stat"); exit(0); } if (!S_ISBLK(statbuf.st_mode) || major(statbuf.st_rdev) != FLOPPY_MAJOR) return -1; drive = minor( statbuf.st_rdev ); return (drive & 3) + ((drive & 0x80) >> 5); }
false
false
false
false
false
0
acpi_ut_display_init_pathname(u8 type, struct acpi_namespace_node *obj_handle, char *path) { acpi_status status; struct acpi_buffer buffer; ACPI_FUNCTION_ENTRY(); /* Only print the path if the appropriate debug level is enabled */ if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) { return; } /* Get the full pathname to the node */ buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; status = acpi_ns_handle_to_pathname(obj_handle, &buffer, TRUE); if (ACPI_FAILURE(status)) { return; } /* Print what we're doing */ switch (type) { case ACPI_TYPE_METHOD: acpi_os_printf("Executing "); break; default: acpi_os_printf("Initializing "); break; } /* Print the object type and pathname */ acpi_os_printf("%-12s %s", acpi_ut_get_type_name(type), (char *)buffer.pointer); /* Extra path is used to append names like _STA, _INI, etc. */ if (path) { acpi_os_printf(".%s", path); } acpi_os_printf("\n"); ACPI_FREE(buffer.pointer); }
false
false
false
false
false
0
apol_bst_get_element(const apol_bst_t * b, const void *elem, void *data, void **result) { bst_node_t *node; int compval; if (!b || !result) { errno = EINVAL; return -1; } node = b->head; while (node != NULL) { if (b->cmp != NULL) { compval = b->cmp(node->elem, elem, data); } else { char *p1 = (char *)node->elem; char *p2 = (char *)elem; if (p1 < p2) { compval = -1; } else if (p1 > p2) { compval = 1; } else { compval = 0; } } if (compval == 0) { *result = node->elem; return 0; } else if (compval > 0) { node = node->child[0]; } else { node = node->child[1]; } } return -1; }
false
false
false
false
false
0
steeltal_init_common(offs_t ds3_transfer_pc, int proto_sloop) { /* initialize the boards */ init_multisync(0); init_ds3(); init_dspcom(); atarijsa3_init_adpcm(REGION_SOUND1); atarijsa_init(hdcpu_jsa, 14, 0, 0x0020); install_mem_read16_handler(hdcpu_main, 0x908000, 0x908001, steeltal_dummy_r); /* set up the SLOOP */ if (!proto_sloop) { hd68k_slapstic_base = install_mem_read16_handler(hdcpu_main, 0xe0000, 0xfffff, st68k_sloop_r); hd68k_slapstic_base = install_mem_write16_handler(hdcpu_main, 0xe0000, 0xfffff, st68k_sloop_w); st68k_sloop_alt_base = install_mem_read16_handler(hdcpu_main, 0x4e000, 0x4ffff, st68k_sloop_alt_r); } else { hd68k_slapstic_base = install_mem_read16_handler(hdcpu_main, 0xe0000, 0xfffff, st68k_protosloop_r); hd68k_slapstic_base = install_mem_write16_handler(hdcpu_main, 0xe0000, 0xfffff, st68k_protosloop_w); } /* synchronization */ stmsp_sync[0] = &hdmsp_ram[TOWORD(0x80010)]; install_mem_write16_handler(hdcpu_msp, TOBYTE(0x80010), TOBYTE(0x8007f), stmsp_sync0_w); stmsp_sync[1] = &hdmsp_ram[TOWORD(0x99680)]; install_mem_write16_handler(hdcpu_msp, TOBYTE(0x99680), TOBYTE(0x9968f), stmsp_sync1_w); stmsp_sync[2] = &hdmsp_ram[TOWORD(0x99d30)]; install_mem_write16_handler(hdcpu_msp, TOBYTE(0x99d30), TOBYTE(0x99d50), stmsp_sync2_w); /* set up protection hacks */ hdgsp_protection = install_mem_write16_handler(hdcpu_gsp, TOBYTE(0xfff965d0), TOBYTE(0xfff965df), hdgsp_protection_w); /* set up msp speedup handlers */ install_mem_read16_handler(hdcpu_msp, TOBYTE(0x80020), TOBYTE(0x8002f), stmsp_speedup_r); /* set up adsp speedup handlers */ install_mem_read16_handler(hdcpu_adsp, ADSP_DATA_ADDR_RANGE(0x1fff, 0x1fff), hdadsp_speedup_r); install_mem_read16_handler(hdcpu_adsp, ADSP_DATA_ADDR_RANGE(0x1f99, 0x1f99), hdds3_speedup_r); hdds3_speedup_addr = (data16_t *)(memory_region(REGION_CPU1 + hdcpu_adsp) + ADSP2100_DATA_OFFSET) + 0x1f99; hdds3_speedup_pc = 0xff; hdds3_transfer_pc = ds3_transfer_pc; }
false
false
false
false
true
1
inc_running (void) { StgWord new; new = atomic_inc(&gc_running_threads); ASSERT(new <= n_gc_threads); return new; }
false
false
false
false
false
0
Vect_point_in_area(struct Map_info *Map, int area, double x, double y) { int i, isle; struct Plus_head *Plus; P_AREA *Area; int poly; Plus = &(Map->plus); Area = Plus->Area[area]; if (Area == NULL) return 0; poly = Vect_point_in_area_outer_ring(x, y, Map, area); if (poly == 0) return 0; /* includes area boundary (poly == 2), OK? */ /* check if in islands */ for (i = 0; i < Area->n_isles; i++) { isle = Area->isles[i]; poly = Vect_point_in_island(x, y, Map, isle); if (poly >= 1) return 0; /* excludes island boundary (poly == 2), OK? */ } return 1; }
false
false
false
false
false
0
OGRDODSGetVarPath( BaseType *poTarget ) { string oFullName; oFullName = poTarget->name(); while( (poTarget = poTarget->get_parent()) != NULL ) { oFullName = poTarget->name() + "." + oFullName; } return oFullName; }
false
false
false
false
false
0
WriteCharges(ostream &ofs,OBMol &mol) { unsigned int i; OBAtom *atom; char buffer[BUFF_SIZE]; for(i = 1;i <= mol.NumAtoms(); i++) { atom = mol.GetAtom(i); snprintf(buffer, BUFF_SIZE, "%4s%4d % 2.10f", etab.GetSymbol(atom->GetAtomicNum()), i, atom->GetPartialCharge()); ofs << buffer << "\n"; } }
false
false
false
false
false
0
bt_store_piece_sha1(torrent_ctx *ctx) { unsigned char* block; unsigned char* hash; if((ctx->piece_count % BT_BLOCK_SIZE) == 0) { block = (unsigned char*)malloc(BT_HASH_SIZE * BT_BLOCK_SIZE); if(block == NULL || !bt_vector_add_ptr(&ctx->hash_blocks, block)) { if(block) free(block); return 0; } } else { block = (unsigned char*)(ctx->hash_blocks.array[ctx->piece_count / BT_BLOCK_SIZE]); } hash = &block[BT_HASH_SIZE * (ctx->piece_count % BT_BLOCK_SIZE)]; SHA1_FINAL(ctx, hash); /* write the hash */ ctx->piece_count++; return 1; }
true
true
false
false
false
1
xstrcat(const char *arg1, ...) { const char *argptr; char *resptr, *result; int nargs = 0; size_t len = 0; va_list valist; va_start(valist, arg1); for(argptr = arg1; argptr != NULL; argptr = va_arg(valist, char *)) len += strlen(argptr); va_end(valist); result = xmalloc(len + 1); resptr = result; va_start(valist, arg1); nargs = 0; for(argptr = arg1; argptr != NULL; argptr = va_arg(valist, char *)) { len = strlen(argptr); memcpy(resptr, argptr, len); resptr += len; } va_end(valist); *resptr = '\0'; return result; }
false
true
false
false
true
1
canVectorizeInst(Instruction *Inst, User *User) { switch (Inst->getOpcode()) { case Instruction::Load: case Instruction::BitCast: case Instruction::AddrSpaceCast: return true; case Instruction::Store: { // Must be the stored pointer operand, not a stored value. StoreInst *SI = cast<StoreInst>(Inst); return SI->getPointerOperand() == User; } default: return false; } }
false
false
false
false
false
0
xmalloc_vmm_inited(void) { STATIC_ASSERT(IS_POWER_OF_2(XMALLOC_BUCKET_FACTOR)); STATIC_ASSERT(IS_POWER_OF_2(XMALLOC_BLOCK_SIZE)); STATIC_ASSERT(0 == (XMALLOC_FACTOR_MASK & XMALLOC_SPLIT_MIN)); STATIC_ASSERT(XMALLOC_SPLIT_MIN / 2 == XMALLOC_BUCKET_FACTOR); STATIC_ASSERT(1 == (((1 << WALLOC_MAX_SHIFT) - 1) & XMALLOC_WALLOC_MAGIC)); xmalloc_vmm_is_up = TRUE; safe_to_log = TRUE; xmalloc_pagesize = compat_pagesize(); xmalloc_grows_up = vmm_grows_upwards(); xmalloc_freelist_setup(); #ifdef XMALLOC_IS_MALLOC vmm_malloc_inited(); #endif /* * We wait for the VMM layer to be up before we install the xgc() idle * thread in an attempt to tweak the self-bootstrapping path of this * library and avoid creating some objects too early: we wish to avoid * sbrk() allocation if possible. */ once_run(&xmalloc_xgc_installed, xmalloc_xgc_install); }
false
false
false
false
false
0
cifs_get_root(struct smb_vol *vol, struct super_block *sb) { struct dentry *dentry; struct cifs_sb_info *cifs_sb = CIFS_SB(sb); char *full_path = NULL; char *s, *p; char sep; full_path = cifs_build_path_to_root(vol, cifs_sb, cifs_sb_master_tcon(cifs_sb)); if (full_path == NULL) return ERR_PTR(-ENOMEM); cifs_dbg(FYI, "Get root dentry for %s\n", full_path); sep = CIFS_DIR_SEP(cifs_sb); dentry = dget(sb->s_root); p = s = full_path; do { struct inode *dir = d_inode(dentry); struct dentry *child; if (!dir) { dput(dentry); dentry = ERR_PTR(-ENOENT); break; } if (!S_ISDIR(dir->i_mode)) { dput(dentry); dentry = ERR_PTR(-ENOTDIR); break; } /* skip separators */ while (*s == sep) s++; if (!*s) break; p = s++; /* next separator */ while (*s && *s != sep) s++; mutex_lock(&dir->i_mutex); child = lookup_one_len(p, dentry, s - p); mutex_unlock(&dir->i_mutex); dput(dentry); dentry = child; } while (!IS_ERR(dentry)); kfree(full_path); return dentry; }
false
false
false
false
false
0
IPrcParse(const pfPrcTag* tag, plResManager* mgr) { if (tag->getName() == "OneShotLinkParams") { fAnimName = tag->getParam("AnimName", ""); fMarkerName = tag->getParam("MarkerName", ""); } else { plCreatable::IPrcParse(tag, mgr); } }
false
false
false
false
false
0
padata_do_parallel(struct padata_instance *pinst, struct padata_priv *padata, int cb_cpu) { int target_cpu, err; struct padata_parallel_queue *queue; struct parallel_data *pd; rcu_read_lock_bh(); pd = rcu_dereference_bh(pinst->pd); err = -EINVAL; if (!(pinst->flags & PADATA_INIT) || pinst->flags & PADATA_INVALID) goto out; if (!cpumask_test_cpu(cb_cpu, pd->cpumask.cbcpu)) goto out; err = -EBUSY; if ((pinst->flags & PADATA_RESET)) goto out; if (atomic_read(&pd->refcnt) >= MAX_OBJ_NUM) goto out; err = 0; atomic_inc(&pd->refcnt); padata->pd = pd; padata->cb_cpu = cb_cpu; target_cpu = padata_cpu_hash(pd); queue = per_cpu_ptr(pd->pqueue, target_cpu); spin_lock(&queue->parallel.lock); list_add_tail(&padata->list, &queue->parallel.list); spin_unlock(&queue->parallel.lock); queue_work_on(target_cpu, pinst->wq, &queue->work); out: rcu_read_unlock_bh(); return err; }
false
false
false
false
false
0
snd_pcm_extplug_dump(snd_pcm_t *pcm, snd_output_t *out) { extplug_priv_t *ext = pcm->private_data; if (ext->data->callback->dump) ext->data->callback->dump(ext->data, out); else { if (ext->data->name) snd_output_printf(out, "%s\n", ext->data->name); else snd_output_printf(out, "External PCM Plugin\n"); if (pcm->setup) { snd_output_printf(out, "Its setup is:\n"); snd_pcm_dump_setup(pcm, out); } } snd_output_printf(out, "Slave: "); snd_pcm_dump(ext->plug.gen.slave, out); }
false
false
false
false
false
0
unpack_index_entry(struct cache_entry *ce, struct unpack_trees_options *o) { struct cache_entry *src[5] = { NULL }; int ret; src[0] = ce; mark_ce_used(ce, o); if (ce_stage(ce)) { if (o->skip_unmerged) { add_entry(o, ce, 0, 0); return 0; } } ret = call_unpack_fn(src, o); if (ce_stage(ce)) mark_ce_used_same_name(ce, o); return ret; }
false
false
false
false
false
0
PyFF_Font_get_texparams(PyFF_Font *self,void *closure) { SplineFont *sf = self->fv->sf; int i, em = sf->ascent+sf->descent; PyObject *tuple = PyTuple_New(23); double val; if ( sf->texdata.type==tex_text ) PyTuple_SetItem(tuple,0,Py_BuildValue("s", "text")); else if ( sf->texdata.type==tex_math ) PyTuple_SetItem(tuple,0,Py_BuildValue("s", "mathsym")); else if ( sf->texdata.type==tex_mathext ) PyTuple_SetItem(tuple,0,Py_BuildValue("s", "mathext")); else if ( sf->texdata.type==tex_unset ) { PyTuple_SetItem(tuple,0,Py_BuildValue("s", "unset")); TeXDefaultParams(sf); } for ( i=1; i<23; i++ ) { val = rint( (double) sf->texdata.params[i-1] * em / (1<<20) ); PyTuple_SetItem(tuple,i,Py_BuildValue( "d", val )); } return( tuple ); }
false
false
false
false
false
0
clutter_x11_get_default_screen (void) { ClutterBackend *backend = clutter_get_default_backend (); if (backend == NULL) { g_critical ("The Clutter backend has not been initialised"); return 0; } if (!CLUTTER_IS_BACKEND_X11 (backend)) { g_critical ("The Clutter backend is not a X11 backend"); return 0; } return CLUTTER_BACKEND_X11 (backend)->xscreen_num; }
false
false
false
false
false
0
Get_Nil(WamWord start_word) { WamWord word, tag_mask; DEREF(start_word, word, tag_mask); if (tag_mask == TAG_REF_MASK) { Bind_UV(UnTag_REF(word), NIL_WORD); return TRUE; } return (word == NIL_WORD); }
false
false
false
false
false
0
__unref_object(gpointer data, GClosure *closure) { if (data == NULL) return; if (!G_IS_OBJECT(data)) return; g_object_unref(G_OBJECT(data)); }
false
false
false
false
false
0
Rule_compile_c2(Node *node) { assert(node); assert(Rule == node->type); if (!node->rule.expression) fprintf(stderr, "rule '%s' used but not defined\n", node->rule.name); else { int ko= yyl(), safe; if ((!(RuleUsed & node->rule.flags)) && (node != start)) fprintf(stderr, "rule '%s' defined but not used\n", node->rule.name); safe= ((Query == node->rule.expression->type) || (Star == node->rule.expression->type)); fprintf(output, "\nYY_RULE(int) yy_%s()\n{", node->rule.name); if (!safe) save(0); if (node->rule.variables) fprintf(output, " yyDo(yyPush, %d, 0);", countVariables(node->rule.variables)); fprintf(output, "\n yyprintf((stderr, \"%%s\\n\", \"%s\"));", node->rule.name); Node_compile_c_ko(node->rule.expression, ko); fprintf(output, "\n yyprintf((stderr, \" ok %%s @ %%s\\n\", \"%s\", yybuf+yypos));", node->rule.name); if (node->rule.variables) fprintf(output, " yyDo(yyPop, %d, 0);", countVariables(node->rule.variables)); fprintf(output, "\n return 1;"); if (!safe) { label(ko); restore(0); fprintf(output, "\n yyprintf((stderr, \" fail %%s @ %%s\\n\", \"%s\", yybuf+yypos));", node->rule.name); fprintf(output, "\n return 0;"); } fprintf(output, "\n}"); } if (node->rule.next) Rule_compile_c2(node->rule.next); }
false
false
false
true
false
1
TCSP_CreateEndorsementKeyPair_Internal(TCS_CONTEXT_HANDLE hContext, /* in */ TCPA_NONCE antiReplay, /* in */ UINT32 endorsementKeyInfoSize, /* in */ BYTE * endorsementKeyInfo, /* in */ UINT32 * endorsementKeySize, /* out */ BYTE ** endorsementKey, /* out */ TCPA_DIGEST * checksum) /* out */ { UINT64 offset = 0; UINT32 paramSize; TSS_RESULT result; BYTE txBlob[TSS_TPM_TXBLOB_SIZE]; if ((result = ctx_verify_context(hContext))) return result; if ((result = tpm_rqu_build(TPM_ORD_CreateEndorsementKeyPair, &offset, txBlob, antiReplay.nonce, endorsementKeyInfoSize, endorsementKeyInfo))) return result; if ((result = req_mgr_submit_req(txBlob))) return result; result = UnloadBlob_Header(txBlob, &paramSize); if (!result) { result = tpm_rsp_parse(TPM_ORD_CreateEndorsementKeyPair, txBlob, paramSize, endorsementKeySize, endorsementKey, checksum->digest); } LogDebug("Leaving CreateEKPair with result: 0x%x", result); return result; }
false
false
false
false
false
0
do_include(char *name, struct pnode *parms) { struct pnode *p; /* FIXME: make sure only one argument is passed */ p = HEAD(parms); if (enforce_simple(p)) { open_src(p->value.symbol, 1); } return 0; }
false
false
false
false
false
0
add_answer_to_cache(const char *address, uint8_t is_reverse, uint32_t addr, const char *hostname, char outcome, uint32_t ttl) { cached_resolve_t *resolve; if (outcome == DNS_RESOLVE_FAILED_TRANSIENT) return; //log_notice(LD_EXIT, "Adding to cache: %s -> %s (%lx, %s), %d", // address, is_reverse?"(reverse)":"", (unsigned long)addr, // hostname?hostname:"NULL",(int)outcome); resolve = tor_malloc_zero(sizeof(cached_resolve_t)); resolve->magic = CACHED_RESOLVE_MAGIC; resolve->state = (outcome == DNS_RESOLVE_SUCCEEDED) ? CACHE_STATE_CACHED_VALID : CACHE_STATE_CACHED_FAILED; strlcpy(resolve->address, address, sizeof(resolve->address)); resolve->is_reverse = is_reverse; if (is_reverse) { if (outcome == DNS_RESOLVE_SUCCEEDED) { tor_assert(hostname); resolve->result.hostname = tor_strdup(hostname); } else { tor_assert(! hostname); resolve->result.hostname = NULL; } } else { tor_assert(!hostname); resolve->result.a.addr = addr; } resolve->ttl = ttl; assert_resolve_ok(resolve); HT_INSERT(cache_map, &cache_root, resolve); set_expiry(resolve, time(NULL) + dns_get_expiry_ttl(ttl)); }
false
false
false
false
false
0
__resize_get_dir_from_window( int *ret_xmotion, int *ret_ymotion, FvwmWindow *fw, Window context_w) { if (context_w != Scr.Root && context_w != None) { if (context_w == FW_W_SIDE(fw, 0)) /* top */ { *ret_ymotion = 1; } else if (context_w == FW_W_SIDE(fw, 1)) /* right */ { *ret_xmotion = -1; } else if (context_w == FW_W_SIDE(fw, 2)) /* bottom */ { *ret_ymotion = -1; } else if (context_w == FW_W_SIDE(fw, 3)) /* left */ { *ret_xmotion = 1; } else if (context_w == FW_W_CORNER(fw, 0)) /* upper-left */ { *ret_xmotion = 1; *ret_ymotion = 1; } else if (context_w == FW_W_CORNER(fw, 1)) /* upper-right */ { *ret_xmotion = -1; *ret_ymotion = 1; } else if (context_w == FW_W_CORNER(fw, 2)) /* lower left */ { *ret_xmotion = 1; *ret_ymotion = -1; } else if (context_w == FW_W_CORNER(fw, 3)) /* lower right */ { *ret_xmotion = -1; *ret_ymotion = -1; } } return; }
false
false
false
false
false
0
init(GtkWidget *widget) { /* OpenGL functions can be called only if makecurrent returns true */ if (gtk_gl_area_make_current(GTK_GL_AREA(widget))) { #if !defined(WIN32) GdkFont *font; #endif /* set viewport */ glViewport(0,0, widget->allocation.width, widget->allocation.height); #if !defined(WIN32) /* generate font display lists */ font = gdk_font_load("-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*"); if (font) { fontbase = glGenLists( 128 ); gdk_gl_use_gdk_font(font, 0, 128, fontbase); gdk_font_unref(font); } #endif } return TRUE; }
false
false
false
false
false
0
modem_init(void) { int i; static int inited = 0; if (inited) return; sqrt_lo = (int *)malloc(2048*sizeof(int)); sqrt_hi = (int *)malloc(2048*sizeof(int)); if (!(sqrt_lo) || !(sqrt_hi)) { perror("modem_init:sqrt_*"); exit(1); } amreal = (char *)malloc(258); if (!(amreal)) { perror("modem_init:am{real|imag}"); exit(1); } sintab = (int *)malloc(1024*sizeof(int)); if (!(sintab)) { perror("modem_init:sintab"); exit(1); } asntab = (int *)malloc(512*sizeof(int)); if (!(asntab)) { perror("modem_init:asntab"); exit(1); } fmphsinc = (int *)malloc(258*sizeof(int)); for (i=0; i<1024; i++) sintab[i] = 127.5 + 127*sin(i*M_PI/512.0); inited = -1; }
false
false
false
false
false
0
TraceGoodLine(TraceData *base,TraceData *end) { /* Make sure that we don't stray more than line_wobble pixels */ int dx, dy; double diff; TraceData *pt; if (( dx = end->x-base->x )<0 ) dx = -dx; if (( dy = end->y-base->y )<0 ) dy = -dy; if ( dy>dx ) { dx = end->x-base->x; dy = end->y-base->y; for ( pt=base->next; pt!=end; pt=pt->next ) { diff = (pt->y-base->y)*dx/(double) dy + base->x - pt->x; if ( diff>line_wobble || diff<-line_wobble ) return( false ); } } else { dx = end->x-base->x; dy = end->y-base->y; for ( pt=base->next; pt!=end; pt=pt->next ) { diff = (pt->x-base->x)*dy/(double) dx + base->y - pt->y; if ( diff>line_wobble || diff<-line_wobble ) return( false ); } } return( true ); }
false
false
false
false
false
0
fdilate_1_30(l_uint32 *datad, l_int32 w, l_int32 h, l_int32 wpld, l_uint32 *datas, l_int32 wpls) { l_int32 i; register l_int32 j, pwpls; register l_uint32 *sptr, *dptr; l_int32 wpls2, wpls3; wpls2 = 2 * wpls; wpls3 = 3 * wpls; pwpls = (l_uint32)(w + 31) / 32; /* proper wpl of src */ for (i = 0; i < h; i++) { sptr = datas + i * wpls; dptr = datad + i * wpld; for (j = 0; j < pwpls; j++, sptr++, dptr++) { *dptr = (*(sptr + wpls3)) | (*(sptr + wpls2)) | (*(sptr + wpls)) | (*sptr) | (*(sptr - wpls)) | (*(sptr - wpls2)) | (*(sptr - wpls3)); } } }
false
false
false
false
false
0
cqueue_verify_attributes(lListElem *cqueue, lList **answer_list, lListElem *reduced_elem, bool in_master) { bool ret = true; DENTER(CQUEUE_LAYER, "cqueue_verify_attributes"); if (cqueue != NULL && reduced_elem != NULL) { int index = 0; while (cqueue_attribute_array[index].cqueue_attr != NoName && ret) { int pos = lGetPosViaElem(reduced_elem, cqueue_attribute_array[index].cqueue_attr, SGE_NO_ABORT); if (pos >= 0) { lList *list = NULL; list = lGetList(cqueue, cqueue_attribute_array[index].cqueue_attr); /* * Configurations without default setting are rejected */ if (ret) { lListElem *elem = lGetElemHost(list, cqueue_attribute_array[index].href_attr, HOSTREF_DEFAULT); if (elem == NULL) { SGE_ADD_MSG_ID(sprintf(SGE_EVENT, MSG_CQUEUE_NODEFVALUE_S, cqueue_attribute_array[index].name)); answer_list_add(answer_list, SGE_EVENT, STATUS_EUNKNOWN, ANSWER_QUALITY_ERROR); ret = false; } } /* * Reject multiple settings for one domain/host * Resolve all hostnames * Verify host group names */ if (ret) { lListElem *elem = NULL; for_each(elem, list) { const char *hostname = NULL; const void *iterator = NULL; lListElem *first_elem = NULL; hostname = lGetHost(elem, cqueue_attribute_array[index].href_attr); first_elem = lGetElemHostFirst(list, cqueue_attribute_array[index].href_attr, hostname, &iterator); if (elem != first_elem) { SGE_ADD_MSG_ID(sprintf(SGE_EVENT, MSG_CQUEUE_MULVALNOTALLOWED_S, hostname)); answer_list_add(answer_list, SGE_EVENT, STATUS_EUNKNOWN, ANSWER_QUALITY_ERROR); ret = false; break; } if (is_hgroup_name(hostname)) { if (in_master && strcmp(hostname, HOSTREF_DEFAULT)) { const lList *master_list = *(object_type_get_master_list(SGE_TYPE_HGROUP)); const lListElem *hgroup = hgroup_list_locate(master_list, hostname); if (hgroup == NULL) { ERROR((SGE_EVENT, MSG_CQUEUE_INVALIDDOMSETTING_SS, cqueue_attribute_array[index].name, hostname)); answer_list_add(answer_list, SGE_EVENT, STATUS_ESYNTAX, ANSWER_QUALITY_ERROR); ret = false; break; } } } else { char resolved_name[CL_MAXHOSTLEN+1]; int back = getuniquehostname(hostname, resolved_name, 0); if (back == CL_RETVAL_OK) { lSetHost(elem, cqueue_attribute_array[index].href_attr, resolved_name); } else { /* * Due to CR 6319231, IZ 1760 this is allowed */ } } } } /* * Call native verify function if it is possible */ if (ret && cqueue_attribute_array[index].verify_function != NULL && (cqueue_attribute_array[index].verify_client || in_master)) { lListElem *elem = NULL; for_each(elem, list) { ret &= cqueue_attribute_array[index]. verify_function(cqueue, answer_list, elem); } } } index++; } } DEXIT; return ret; }
true
true
true
false
true
1
readXMLPatientData(const DSRXMLDocument &doc, DSRXMLCursor cursor, const size_t /*flags*/) { OFCondition result = SR_EC_InvalidDocument; if (cursor.valid()) { OFString tmpString; result = EC_Normal; /* iterate over all nodes */ while (cursor.valid()) { /* check for known element tags (all type 2) */ if (doc.matchNode(cursor, "name")) { /* Patient's Name */ DSRPNameTreeNode::getValueFromXMLNodeContent(doc, cursor.getChild(), tmpString); PatientName.putString(tmpString.c_str()); } else if (doc.matchNode(cursor, "birthday")) { /* Patient's Birth Date */ DSRDateTreeNode::getValueFromXMLNodeContent(doc, doc.getNamedNode(cursor.getChild(), "date"), tmpString); PatientBirthDate.putString(tmpString.c_str()); } else if (doc.getElementFromNodeContent(cursor, PatientID, "id").bad() && doc.getElementFromNodeContent(cursor, PatientSex, "sex").bad()) { doc.printUnexpectedNodeWarning(cursor); } /* proceed with next node */ cursor.gotoNext(); } } return result; }
false
false
false
false
false
0
nh_aux(void *kp, void *dp, void *hp, UINT32 dlen) /* Same as previous nh_aux, but two streams are handled in one pass, * reading and writing 16 bytes of hash-state per call. */ { UINT64 h1,h2; UWORD c = dlen / 32; UINT32 *k = (UINT32 *)kp; UINT32 *d = (UINT32 *)dp; UINT32 d0,d1,d2,d3,d4,d5,d6,d7; UINT32 k0,k1,k2,k3,k4,k5,k6,k7, k8,k9,k10,k11; h1 = *((UINT64 *)hp); h2 = *((UINT64 *)hp + 1); k0 = *(k+0); k1 = *(k+1); k2 = *(k+2); k3 = *(k+3); do { d0 = LOAD_UINT32_LITTLE(d+0); d1 = LOAD_UINT32_LITTLE(d+1); d2 = LOAD_UINT32_LITTLE(d+2); d3 = LOAD_UINT32_LITTLE(d+3); d4 = LOAD_UINT32_LITTLE(d+4); d5 = LOAD_UINT32_LITTLE(d+5); d6 = LOAD_UINT32_LITTLE(d+6); d7 = LOAD_UINT32_LITTLE(d+7); k4 = *(k+4); k5 = *(k+5); k6 = *(k+6); k7 = *(k+7); k8 = *(k+8); k9 = *(k+9); k10 = *(k+10); k11 = *(k+11); h1 += MUL64((k0 + d0), (k4 + d4)); h2 += MUL64((k4 + d0), (k8 + d4)); h1 += MUL64((k1 + d1), (k5 + d5)); h2 += MUL64((k5 + d1), (k9 + d5)); h1 += MUL64((k2 + d2), (k6 + d6)); h2 += MUL64((k6 + d2), (k10 + d6)); h1 += MUL64((k3 + d3), (k7 + d7)); h2 += MUL64((k7 + d3), (k11 + d7)); k0 = k8; k1 = k9; k2 = k10; k3 = k11; d += 8; k += 8; } while (--c); ((UINT64 *)hp)[0] = h1; ((UINT64 *)hp)[1] = h2; }
false
false
false
false
false
0
BuildPaths(vtkAssemblyPaths *paths, vtkAssemblyPath *path) { // the path consists only of the active image vtkImageSlice *image = this->GetActiveImage(); if (image) { path->AddNode(image, image->GetMatrix()); image->BuildPaths(paths, path); path->DeleteLastNode(); } }
false
false
false
false
false
0
dce_v8_0_audio_write_latency_fields(struct drm_encoder *encoder, struct drm_display_mode *mode) { struct amdgpu_device *adev = encoder->dev->dev_private; struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); struct amdgpu_encoder_atom_dig *dig = amdgpu_encoder->enc_priv; struct drm_connector *connector; struct amdgpu_connector *amdgpu_connector = NULL; u32 tmp = 0, offset; if (!dig || !dig->afmt || !dig->afmt->pin) return; offset = dig->afmt->pin->offset; list_for_each_entry(connector, &encoder->dev->mode_config.connector_list, head) { if (connector->encoder == encoder) { amdgpu_connector = to_amdgpu_connector(connector); break; } } if (!amdgpu_connector) { DRM_ERROR("Couldn't find encoder's connector\n"); return; } if (mode->flags & DRM_MODE_FLAG_INTERLACE) { if (connector->latency_present[1]) tmp = (connector->video_latency[1] << AZALIA_F0_CODEC_PIN_CONTROL_RESPONSE_LIPSYNC__VIDEO_LIPSYNC__SHIFT) | (connector->audio_latency[1] << AZALIA_F0_CODEC_PIN_CONTROL_RESPONSE_LIPSYNC__AUDIO_LIPSYNC__SHIFT); else tmp = (0 << AZALIA_F0_CODEC_PIN_CONTROL_RESPONSE_LIPSYNC__VIDEO_LIPSYNC__SHIFT) | (0 << AZALIA_F0_CODEC_PIN_CONTROL_RESPONSE_LIPSYNC__AUDIO_LIPSYNC__SHIFT); } else { if (connector->latency_present[0]) tmp = (connector->video_latency[0] << AZALIA_F0_CODEC_PIN_CONTROL_RESPONSE_LIPSYNC__VIDEO_LIPSYNC__SHIFT) | (connector->audio_latency[0] << AZALIA_F0_CODEC_PIN_CONTROL_RESPONSE_LIPSYNC__AUDIO_LIPSYNC__SHIFT); else tmp = (0 << AZALIA_F0_CODEC_PIN_CONTROL_RESPONSE_LIPSYNC__VIDEO_LIPSYNC__SHIFT) | (0 << AZALIA_F0_CODEC_PIN_CONTROL_RESPONSE_LIPSYNC__AUDIO_LIPSYNC__SHIFT); } WREG32_AUDIO_ENDPT(offset, ixAZALIA_F0_CODEC_PIN_CONTROL_RESPONSE_LIPSYNC, tmp); }
false
false
false
false
false
0
krb5_rc_register_type(krb5_context context, const krb5_rc_ops *ops) { struct krb5_rc_typelist *t; k5_mutex_lock(&rc_typelist_lock); for (t = typehead;t && strcmp(t->ops->type,ops->type);t = t->next) ; if (t) { k5_mutex_unlock(&rc_typelist_lock); return KRB5_RC_TYPE_EXISTS; } t = (struct krb5_rc_typelist *) malloc(sizeof(struct krb5_rc_typelist)); if (t == NULL) { k5_mutex_unlock(&rc_typelist_lock); return KRB5_RC_MALLOC; } t->next = typehead; t->ops = ops; typehead = t; k5_mutex_unlock(&rc_typelist_lock); return 0; }
false
false
false
false
false
0
implicitConvTo(Type *t) { MATCH result = Expression::implicitConvTo(t); Type *tb = t->toBasetype(); Type *typeb = type->toBasetype(); if (result == MATCHnomatch && tb->ty == Tsarray && typeb->ty == Tarray && lwr && upr) { typeb = toStaticArrayType(); if (typeb) result = typeb->implicitConvTo(t); } return result; }
false
false
false
false
false
0
xmlSecNssKWAesGetKeySize(xmlSecTransformPtr transform) { if(xmlSecTransformCheckId(transform, xmlSecNssTransformKWAes128Id)) { return(XMLSEC_NSS_AES128_KEY_SIZE); } else if(xmlSecTransformCheckId(transform, xmlSecNssTransformKWAes192Id)) { return(XMLSEC_NSS_AES192_KEY_SIZE); } else if(xmlSecTransformCheckId(transform, xmlSecNssTransformKWAes256Id)) { return(XMLSEC_NSS_AES256_KEY_SIZE); } return(0); }
false
false
false
false
false
0
getOutputDescriptors() const { OutputList list; float stepSecs = m_preferredStepSecs; // if (m_d) stepSecs = m_d->dfConfig.stepSecs; OutputDescriptor onsets; onsets.identifier = "onsets"; onsets.name = "Note Onsets"; onsets.description = "Perceived note onset positions"; onsets.unit = ""; onsets.hasFixedBinCount = true; onsets.binCount = 0; onsets.sampleType = OutputDescriptor::VariableSampleRate; onsets.sampleRate = 1.0 / stepSecs; OutputDescriptor df; df.identifier = "detection_fn"; df.name = "Onset Detection Function"; df.description = "Probability function of note onset likelihood"; df.unit = ""; df.hasFixedBinCount = true; df.binCount = 1; df.hasKnownExtents = false; df.isQuantized = false; df.sampleType = OutputDescriptor::OneSamplePerStep; OutputDescriptor sdf; sdf.identifier = "smoothed_df"; sdf.name = "Smoothed Detection Function"; sdf.description = "Smoothed probability function used for peak-picking"; sdf.unit = ""; sdf.hasFixedBinCount = true; sdf.binCount = 1; sdf.hasKnownExtents = false; sdf.isQuantized = false; sdf.sampleType = OutputDescriptor::VariableSampleRate; //!!! SV doesn't seem to handle these correctly in getRemainingFeatures // sdf.sampleType = OutputDescriptor::FixedSampleRate; sdf.sampleRate = 1.0 / stepSecs; list.push_back(onsets); list.push_back(df); list.push_back(sdf); return list; }
false
false
false
false
false
0
abst(void) { if ( (INT32)(R.ACC.d) < 0 ) { R.ACC.d = -R.ACC.d; if (OVM) { SET0(OV_FLAG); if (R.ACC.d == 0x80000000) R.ACC.d-- ; } } CLR1(C_FLAG); }
false
false
false
false
false
0
AsssListCheck ( Obj list, Obj poss, Obj rhss ) { if ( ! IS_POSS_LIST(poss) ) { ErrorQuit( "List Assignment: <positions> must be a dense list of positive integers", 0L, 0L ); } if ( ! IS_DENSE_LIST(rhss) ) { ErrorQuit( "List Assignment: <rhss> must be a dense list", 0L, 0L ); } if ( LEN_LIST( poss ) != LEN_LIST( rhss ) ) { ErrorQuit( "List Assignment: <rhss> must have the same length as <positions> (%d)", (Int)LEN_LIST(poss), 0L ); } ASSS_LIST( list, poss, rhss ); }
false
false
false
false
false
0
esl_permutation_Reuse(ESL_PERMUTATION *P) { int i; for (i = 0; i < P->n; i++) P->pi[i] = i; return eslOK; }
false
false
false
false
false
0
store_temp_max(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { int nr = (to_sensor_dev_attr(attr))->index; struct lm93_data *data = dev_get_drvdata(dev); struct i2c_client *client = data->client; long val; int err; err = kstrtol(buf, 10, &val); if (err) return err; mutex_lock(&data->update_lock); data->temp_lim[nr].max = LM93_TEMP_TO_REG(val); lm93_write_byte(client, LM93_REG_TEMP_MAX(nr), data->temp_lim[nr].max); mutex_unlock(&data->update_lock); return count; }
false
false
false
false
false
0
buff_addb (char* buff, char* buffEnd, const void* data, int len) { int avail = (buffEnd - buff); if (avail <= 0 || len <= 0) /* already overflowing */ return buff; if (len > avail) len = avail; memcpy(buff, data, len); buff += len; /* ensure there is a terminating zero */ if (buff >= buffEnd) { /* overflow */ buff[-1] = 0; } else buff[0] = 0; return buff; }
false
false
false
false
false
0
is_runnable() { if (this->object_->relocs_must_follow_section_writes() && this->output_sections_blocker_->is_blocked()) return this->output_sections_blocker_; if (this->object_->is_locked()) return this->object_->token(); return NULL; }
false
false
false
false
false
0
_notify_srun_missing_step(struct job_record *job_ptr, int node_inx, time_t now, time_t node_boot_time) { ListIterator step_iterator; struct step_record *step_ptr; char *node_name = node_record_table_ptr[node_inx].name; xassert(job_ptr); step_iterator = list_iterator_create (job_ptr->step_list); while ((step_ptr = (struct step_record *) list_next (step_iterator))) { if (!bit_test(step_ptr->step_node_bitmap, node_inx)) continue; if (step_ptr->time_last_active >= now) { /* Back up timer in case more than one node * registration happens at this same time. * We don't want this node's registration * to count toward a different node's * registration message. */ step_ptr->time_last_active = now - 1; } else if (step_ptr->host && step_ptr->port) { /* srun may be able to verify step exists on * this node using I/O sockets and kill the * job as needed */ srun_step_missing(step_ptr, node_name); } else if ((step_ptr->start_time < node_boot_time) && (step_ptr->no_kill == 0)) { /* There is a risk that the job step's tasks completed * on this node before its reboot, but that should be * very rare and there is no srun to work with (POE) */ info("Node %s rebooted, killing missing step %u.%u", node_name, job_ptr->job_id, step_ptr->step_id); signal_step_tasks_on_node(node_name, step_ptr, SIGKILL, REQUEST_TERMINATE_TASKS); } } list_iterator_destroy (step_iterator); }
false
false
false
false
false
0
OpAssignsToB(unsigned int op) { if(op >= OP_BITSET && op <= OP_BITCLRP) return true; if(op >= OP_STORE_I && op <= OP_STORE_FI) return true; if(op == OP_STOREP_C || op == OP_LOADP_C) return true; if(op >= OP_MULSTORE_F && op <= OP_SUBSTOREP_V) return true; if(op >= OP_STORE_F && op <= OP_STOREP_FNC) return true; return false; }
false
false
false
false
false
0
CKYBuffer_GetShortLE(const CKYBuffer *buf, CKYOffset offset) { unsigned short val; if (buf->len < offset+2) { return 0; } val = ((unsigned short)buf->data[offset+1]) << 8; val |= ((unsigned short)buf->data[offset+0]) << 0; return val; }
false
false
false
false
false
0
merge_session_cookie_dir_config(apr_pool_t * p, void *basev, void *addv) { session_cookie_dir_conf *new = (session_cookie_dir_conf *) apr_pcalloc(p, sizeof(session_cookie_dir_conf)); session_cookie_dir_conf *add = (session_cookie_dir_conf *) addv; session_cookie_dir_conf *base = (session_cookie_dir_conf *) basev; new->name = (add->name_set == 0) ? base->name : add->name; new->name_attrs = (add->name_set == 0) ? base->name_attrs : add->name_attrs; new->name_set = add->name_set || base->name_set; new->name2 = (add->name2_set == 0) ? base->name2 : add->name2; new->name2_attrs = (add->name2_set == 0) ? base->name2_attrs : add->name2_attrs; new->name2_set = add->name2_set || base->name2_set; new->remove = (add->remove_set == 0) ? base->remove : add->remove; new->remove_set = add->remove_set || base->remove_set; return new; }
false
false
false
false
false
0
iwl_drv_init(void) { int i; mutex_init(&iwlwifi_opmode_table_mtx); for (i = 0; i < ARRAY_SIZE(iwlwifi_opmode_table); i++) INIT_LIST_HEAD(&iwlwifi_opmode_table[i].drv); pr_info(DRV_DESCRIPTION "\n"); pr_info(DRV_COPYRIGHT "\n"); #ifdef CONFIG_IWLWIFI_DEBUGFS /* Create the root of iwlwifi debugfs subsystem. */ iwl_dbgfs_root = debugfs_create_dir(DRV_NAME, NULL); if (!iwl_dbgfs_root) return -EFAULT; #endif return iwl_pci_register_driver(); }
false
false
false
false
false
0
resolve(const Value &root, const Value &defaultValue) const { const Value *node = &root; for (Args::const_iterator it = args_.begin(); it != args_.end(); ++it) { const PathArgument &arg = *it; if (arg.kind_ == PathArgument::kindIndex) { if (!node->isArray() || !node->isValidIndex(arg.index_)) return defaultValue; node = &((*node)[arg.index_]); } else if (arg.kind_ == PathArgument::kindKey) { if (!node->isObject()) return defaultValue; node = &((*node)[arg.key_]); if (node == &Value::null) return defaultValue; } } return *node; }
false
false
false
false
false
0
read_post(SAPI_Info& , char *buf, size_t max_bytes) { size_t read_size=0; do { ssize_t chunk_size=read(fileno(stdin), buf+read_size, min(READ_POST_CHUNK_SIZE, max_bytes-read_size)); if(chunk_size<=0) break; read_size+=chunk_size; } while(read_size<max_bytes); return read_size; }
false
false
false
false
false
0
dup_basename_token(const char *name, const char *ext) { char *p, *ret = dup_basename( name, ext ); /* map invalid characters to '_' */ for (p = ret; *p; p++) if (!isalnum(*p)) *p = '_'; return ret; }
false
false
false
false
false
0
dSncpy(String *dest, const char *src, int n, const char *file, int line) { int len = strlen(src); if (n < 0) core("dSncpy: n==%ld", file, line, (long)n); if (n > len) n = len; dest->len = n; if (dest->charattrs) { Sfree(dest, dest->charattrs); dest->charattrs = NULL; } lcheck(dest, file, line); memcpy(dest->data, src, n); dest->data[n] = '\0'; return dest; }
false
false
false
false
false
0