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
bet_data_future_modify_lines ( struct_futur_data *scheduled ) { gchar *key; key = bet_data_get_key ( scheduled -> account_number, scheduled -> number ); g_hash_table_replace ( bet_future_list, key, scheduled ); if ( etat.modification_fichier == 0 ) modification_fichier ( TRUE ); return TRUE; }
false
false
false
false
false
0
writeImageDef(DL_WriterA& dw, int handle, const DL_ImageData& data) { /*if (data.file.empty()) { std::cerr << "DL_Dxf::writeImage: " << "Image file must not be empty\n"; return; }*/ dw.dxfString(0, "IMAGEDEF"); if (version==DL_VERSION_2000) { dw.dxfHex(5, handle); } if (version==DL_VERSION_2000) { dw.dxfString(100, "AcDbRasterImageDef"); dw.dxfInt(90, 0); } // file name: dw.dxfString(1, data.ref); // image size in pixel dw.dxfReal(10, data.width); dw.dxfReal(20, data.height); dw.dxfReal(11, 1.0); dw.dxfReal(21, 1.0); // loaded: dw.dxfInt(280, 1); // units: dw.dxfInt(281, 0); }
false
false
false
false
false
0
findline(char *buffer, int count) { int ctr; char *p = buffer - 1; if (count < 1) return buffer; for (ctr = 0; ctr < count; ctr++) { p = strchr(p + 1, '\n'); if (p == NULL) return NULL; } return p; }
false
false
false
false
false
0
generate_call_graph (struct profdata *profdata) { size_t cnt; puts ("\nindex % time self children called name\n"); for (cnt = 0; cnt < symidx; ++cnt) if (sortsym[cnt]->froms != NULL || sortsym[cnt]->tos != NULL) { struct arc_list *runp; size_t n; /* First print the from-information. */ runp = sortsym[cnt]->froms; while (runp != NULL) { printf (" %8.2f%8.2f%9" PRIdMAX "/%-9" PRIdMAX " %s", (runp->idx != (size_t) -1l ? sortsym[runp->idx]->ticks * tick_unit : 0.0), 0.0, /* FIXME: what's time for the children, recursive */ runp->count, sortsym[cnt]->calls, (runp->idx != (size_t) -1l ? sortsym[runp->idx]->name : "<UNKNOWN>")); if (runp->idx != (size_t) -1l) printf (" [%Zd]", runp->idx); putchar_unlocked ('\n'); runp = runp->next; } /* Info about the function itself. */ n = printf ("[%Zu]", cnt); printf ("%*s%5.1f%8.2f%8.2f%9" PRIdMAX " %s [%Zd]\n", (int) (7 - n), " ", total_ticks ? (100.0 * sortsym[cnt]->ticks) / total_ticks : 0, sortsym[cnt]->ticks * tick_unit, 0.0, /* FIXME: what's time for the children, recursive */ sortsym[cnt]->calls, sortsym[cnt]->name, cnt); /* Info about the functions this function calls. */ runp = sortsym[cnt]->tos; while (runp != NULL) { printf (" %8.2f%8.2f%9" PRIdMAX "/", (runp->idx != (size_t) -1l ? sortsym[runp->idx]->ticks * tick_unit : 0.0), 0.0, /* FIXME: what's time for the children, recursive */ runp->count); if (runp->idx != (size_t) -1l) printf ("%-9" PRIdMAX " %s [%Zd]\n", sortsym[runp->idx]->calls, sortsym[runp->idx]->name, runp->idx); else fputs ("??? <UNKNOWN>\n\n", stdout); runp = runp->next; } fputs ("-----------------------------------------------\n", stdout); } }
false
false
false
false
false
0
da9150_fg_read_attr(struct da9150_fg *fg, u8 code, u8 size) { u8 buf[size]; u8 read_addr; u32 res = 0; int i; /* Set QIF code (READ mode) */ read_addr = (code & DA9150_QIF_CODE_MASK) | DA9150_QIF_READ; da9150_read_qif(fg->da9150, read_addr, size, buf); for (i = 0; i < size; ++i) res |= (buf[i] << (i * DA9150_QIF_BYTE_SIZE)); return res; }
false
false
false
false
false
0
get_bg_tile_info(int tile_index) { unsigned char attr = ddrible_bg_videoram[tile_index]; int num = ddrible_bg_videoram[tile_index + 0x400] + ((attr & 0xc0) << 2) + ((attr & 0x20) << 5) + (charbank[1] << 11); SET_TILE_INFO( 1, num, 0, TILE_FLIPYX((attr & 0x30) >> 4)) }
false
false
false
false
false
0
ffgtrm(fitsfile *gfptr, /* FITS file pointer to group */ int rmopt, /* code specifying if member elements are to be deleted: OPT_RM_GPT ==> remove only group table OPT_RM_ALL ==> recursively remove members and their members (if groups) */ int *status) /* return status code */ /* remove a grouping table, and optionally all its members. Any groups containing the grouping table are updated, and all members (if not deleted) have their GRPIDn and GRPLCn keywords updated accordingly. If the (deleted) members are members of another grouping table then those tables are also updated. The CHDU of the FITS file pointed to by gfptr must be positioned to the grouping table to be deleted. */ { int hdutype; long i; long nmembers = 0; HDUtracker HDU; if(*status != 0) return(*status); /* remove the grouping table depending upon the rmopt parameter */ switch(rmopt) { case OPT_RM_GPT: /* for this option, the grouping table is deleted, but the member HDUs remain; in this case we only have to remove each member from the grouping table by calling fits_remove_member() with the OPT_RM_ENTRY option */ /* get the number of members contained by this table */ *status = fits_get_num_members(gfptr,&nmembers,status); /* loop over all grouping table members and remove them */ for(i = nmembers; i > 0 && *status == 0; --i) *status = fits_remove_member(gfptr,i,OPT_RM_ENTRY,status); break; case OPT_RM_ALL: /* for this option the entire Group is deleted -- this includes all members and their members (if grouping tables themselves). Call the recursive form of this function to perform the removal. */ /* add the current grouping table to the HDUtracker struct */ HDU.nHDU = 0; *status = fftsad(gfptr,&HDU,NULL,NULL); /* call the recursive group remove function */ *status = ffgtrmr(gfptr,&HDU,status); /* free the memory allocated to the HDUtracker struct */ for(i = 0; i < HDU.nHDU; ++i) { free(HDU.filename[i]); free(HDU.newFilename[i]); } break; default: *status = BAD_OPTION; ffpmsg("Invalid value for the rmopt parameter specified (ffgtrm)"); break; } /* if all went well then unlink and delete the grouping table HDU */ *status = ffgmul(gfptr,0,status); *status = fits_delete_hdu(gfptr,&hdutype,status); return(*status); }
false
false
false
false
false
0
bitsetv_ones (bitsetv bsetv) { bitset_bindex i; for (i = 0; bsetv[i]; i++) bitset_ones (bsetv[i]); }
false
false
false
false
false
0
pdf_write_spot_function(gx_device_pdf *pdev, const gx_ht_order *porder, long *pid) { /****** DOESN'T HANDLE STRIP HALFTONES ******/ int w = porder->width, h = porder->height; uint num_bits = porder->num_bits; gs_function_Sd_params_t params; static const float domain_spot[4] = { -1, 1, -1, 1 }; static const float range_spot[4] = { -1, 1 }; int size[2]; gs_memory_t *mem = pdev->pdf_memory; /* * Even though the values are logically ushort, we must always store * them in big-endian order, so we access them as bytes. */ byte *values; gs_function_t *pfn; uint i; int code = 0; params.array_size = 0; params.m = 2; params.Domain = domain_spot; params.n = 1; params.Range = range_spot; params.Order = 0; /* default */ /* * We could use 8, 16, or 32 bits per sample to save space, but for * simplicity, we always use 16. */ if (num_bits > 0x10000) /* rangecheck is a 'special case' in gdev_pdf_fill_path, if this error is encountered * then it 'falls back' to a different method assuming its handling transparency in an * old PDF output version. But if we fail to write the halftone, we want to abort * so use limitcheck instead. */ return_error(gs_error_limitcheck); params.BitsPerSample = 16; params.Encode = 0; /* * The default Decode array maps the actual data values [1 .. w*h] to a * sub-interval of the Range, but that's OK, since all that matters is * the relative values, not the absolute values. */ params.Decode = 0; size[0] = w; size[1] = h; params.Size = size; /* Create the (temporary) threshold array. */ values = gs_alloc_byte_array(mem, num_bits, 2, "pdf_write_spot_function"); if (values == 0) return_error(gs_error_VMerror); for (i = 0; i < num_bits; ++i) { gs_int_point pt; int value; if ((code = porder->procs->bit_index(porder, i, &pt)) < 0) break; value = pt.y * w + pt.x; /* Always store the values in big-endian order. */ values[i * 2] = (byte)(value >> 8); values[i * 2 + 1] = (byte)value; } data_source_init_bytes(&params.DataSource, (const byte *)values, sizeof(*values) * num_bits); if (code >= 0 && /* Warning from COverity that params.array_size is uninitialised. Correct */ /* but immeidiately after copying the data Sd_init sets the copied value */ /* to zero, so it is not actually used uninitialised. */ (code = gs_function_Sd_init(&pfn, &params, mem)) >= 0 ) { code = pdf_write_function(pdev, pfn, pid); gs_function_free(pfn, false, mem); } gs_free_object(mem, values, "pdf_write_spot_function"); return code; }
false
false
false
false
false
0
gst_dccp_client_src_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { GstDCCPClientSrc *src = GST_DCCP_CLIENT_SRC (object); switch (prop_id) { case PROP_PORT: g_value_set_int (value, src->port); break; case PROP_HOST: g_value_set_string (value, src->host); break; case PROP_SOCK_FD: g_value_set_int (value, src->sock_fd); break; case PROP_CLOSED: g_value_set_boolean (value, src->closed); break; case PROP_CCID: g_value_set_int (value, src->ccid); break; case PROP_CAPS: gst_value_set_caps (value, src->caps); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
false
false
false
false
false
0
save_weblist() { char filename[512]; xmlDoc *doc; xmlNode *xsearchengine; xmlNode *xgroup; xmlNode *xengine; gint type; gchar *title=NULL; gchar *home=NULL; gchar *pre=NULL; gchar *post=NULL; gchar *glue=NULL; gchar *code=NULL; GtkTreeIter parent_iter; GtkTreeIter child_iter; LOG(LOG_DEBUG, "IN : save_weblist()"); sprintf(filename, "%s%s%s", user_dir, DIR_DELIMITER, FILENAME_WEBLIST); doc = xml_doc_new(); doc->encoding = strdup("euc-jp"); doc->version = strdup("1.0"); xsearchengine = xml_add_child(doc->root, "searchengine", NULL); if(gtk_tree_model_get_iter_first(GTK_TREE_MODEL(web_store), &parent_iter) == TRUE){ do { gtk_tree_model_get(GTK_TREE_MODEL(web_store), &parent_iter, WEB_TYPE_COLUMN, &type, WEB_TITLE_COLUMN, &title, -1); xgroup = xml_add_child(xsearchengine, "group", NULL); xml_set_attr(xgroup, "name", title); g_free (title); if(gtk_tree_model_iter_children(GTK_TREE_MODEL(web_store), &child_iter, &parent_iter) == TRUE){ do { title=NULL; home=NULL; pre=NULL; post=NULL; glue=NULL; code=NULL; gtk_tree_model_get(GTK_TREE_MODEL(web_store), &child_iter, WEB_TYPE_COLUMN, &type, WEB_TITLE_COLUMN, &title, WEB_HOME_COLUMN, &home, WEB_PRE_COLUMN, &pre, WEB_POST_COLUMN, &post, WEB_GLUE_COLUMN, &glue, WEB_CODE_COLUMN, &code, -1); xengine = xml_add_child(xgroup, "engine", NULL); xml_add_child(xengine, "name", title); xml_add_child(xengine, "home", home); xml_add_child(xengine, "pre", pre); xml_add_child(xengine, "post", post); xml_add_child(xengine, "glue", glue); xml_add_child(xengine, "charcode", code); g_free (title); g_free (home); g_free (pre); g_free (post); g_free (glue); g_free (code); } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(web_store), &child_iter) == TRUE); } } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(web_store), &parent_iter) == TRUE); } xml_save_file(filename, doc); xml_destroy_document(doc); LOG(LOG_DEBUG, "OUT : save_weblist()"); return(TRUE); }
true
true
true
false
false
1
AddBlock(HBasicBlock* block) { if (block == loop_header()) return; if (block->parent_loop_header() == loop_header()) return; if (block->parent_loop_header() != NULL) { AddBlock(block->parent_loop_header()); } else { block->set_parent_loop_header(loop_header()); blocks_.Add(block); for (int i = 0; i < block->predecessors()->length(); ++i) { AddBlock(block->predecessors()->at(i)); } } }
false
false
false
false
false
0
RewriteUsesOfClonedInstructions(BasicBlock *OrigHeader, BasicBlock *OrigPreheader, ValueToValueMapTy &ValueMap) { // Remove PHI node entries that are no longer live. BasicBlock::iterator I, E = OrigHeader->end(); for (I = OrigHeader->begin(); PHINode *PN = dyn_cast<PHINode>(I); ++I) PN->removeIncomingValue(PN->getBasicBlockIndex(OrigPreheader)); // Now fix up users of the instructions in OrigHeader, inserting PHI nodes // as necessary. SSAUpdater SSA; for (I = OrigHeader->begin(); I != E; ++I) { Value *OrigHeaderVal = &*I; // If there are no uses of the value (e.g. because it returns void), there // is nothing to rewrite. if (OrigHeaderVal->use_empty()) continue; Value *OrigPreHeaderVal = ValueMap[OrigHeaderVal]; // The value now exits in two versions: the initial value in the preheader // and the loop "next" value in the original header. SSA.Initialize(OrigHeaderVal->getType(), OrigHeaderVal->getName()); SSA.AddAvailableValue(OrigHeader, OrigHeaderVal); SSA.AddAvailableValue(OrigPreheader, OrigPreHeaderVal); // Visit each use of the OrigHeader instruction. for (Value::use_iterator UI = OrigHeaderVal->use_begin(), UE = OrigHeaderVal->use_end(); UI != UE; ) { // Grab the use before incrementing the iterator. Use &U = *UI; // Increment the iterator before removing the use from the list. ++UI; // SSAUpdater can't handle a non-PHI use in the same block as an // earlier def. We can easily handle those cases manually. Instruction *UserInst = cast<Instruction>(U.getUser()); if (!isa<PHINode>(UserInst)) { BasicBlock *UserBB = UserInst->getParent(); // The original users in the OrigHeader are already using the // original definitions. if (UserBB == OrigHeader) continue; // Users in the OrigPreHeader need to use the value to which the // original definitions are mapped. if (UserBB == OrigPreheader) { U = OrigPreHeaderVal; continue; } } // Anything else can be handled by SSAUpdater. SSA.RewriteUse(U); } } }
false
false
false
false
false
0
SendFeatureData(PalInfo *pal) { Command cmd; char path[MAX_PATHLEN]; const gchar *env; int sock; if (*progdt.sign != '\0') cmd.SendMySign(cthrd.udpsock, pal); env = g_get_user_config_dir(); snprintf(path, MAX_PATHLEN, "%s" ICON_PATH "/%s", env, progdt.myicon); if (access(path, F_OK) == 0) cmd.SendMyIcon(cthrd.udpsock, pal); snprintf(path, MAX_PATHLEN, "%s" PHOTO_PATH "/photo", env); if (access(path, F_OK) == 0) { if ((sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) { pop_error(_("Fatal Error!!\nFailed to create new socket!\n%s"), strerror(errno)); exit(1); } cmd.SendSublayer(sock, pal, IPTUX_PHOTOPICOPT, path); close(sock); } }
false
false
false
false
false
0
gnash_view_display(GnashView *view) { gnash::InvalidatedRanges changed_ranges; changed_ranges.setWorld(); boost::shared_ptr<gnash::Renderer> renderer = gnash_canvas_get_renderer(view->canvas); renderer->set_invalidated_regions(changed_ranges); gdk_window_invalidate_rect(GTK_WIDGET(view->canvas)->window, NULL, false); gnash_canvas_before_rendering(view->canvas, view->stage.get()); view->stage->display(); gdk_window_process_updates(GTK_WIDGET(view->canvas)->window, false); }
false
false
false
false
false
0
delete_char(void){ int i; int input_ptr; if(input_len){ // Only delete if there is something already input_ptr = (cursor_pos + cursor_offset); if(input_ptr < input_len){ // Only if the cursor isn't at the end for(i=input_ptr;i<input_len;i++){ // Shift items in the buffer input_buffer[i] = input_buffer[i+1]; } } input_buffer[--input_len] = 0; // NULL terminate string if(input_len < input_ptr){ // Deleting before the end string if(--cursor_pos < 0){ cursor_pos = 0; if(cursor_offset){ cursor_offset--; } } else if(input_len >= DIGITS_MAX && cursor_offset){ cursor_offset--; cursor_pos++; } } printd("cursor_offset: %d\n cursor_pos: %d\n input_len: %d\n", cursor_offset, cursor_pos, input_len); } display_input_buffer(); }
false
false
false
false
false
0
pcmcia_register_driver(struct pcmcia_driver *driver) { int error; if (!driver) return -EINVAL; pcmcia_check_driver(driver); /* initialize common fields */ driver->drv.bus = &pcmcia_bus_type; driver->drv.owner = driver->owner; driver->drv.name = driver->name; mutex_init(&driver->dynids.lock); INIT_LIST_HEAD(&driver->dynids.list); pr_debug("registering driver %s\n", driver->name); error = driver_register(&driver->drv); if (error < 0) return error; error = pcmcia_create_newid_file(driver); if (error) driver_unregister(&driver->drv); return error; }
false
false
false
false
false
0
airEndsWith(const char *s, const char *suff) { if (!(s && suff)) return 0; if (!(strlen(s) >= strlen(suff))) return 0; if (!strncmp(s + strlen(s) - strlen(suff), suff, strlen(suff))) return 1; else return 0; }
false
false
false
false
false
0
ldns_verify_time( ldns_rr_list *rrset, ldns_rr_list *rrsig, const ldns_rr_list *keys, time_t check_time, ldns_rr_list *good_keys ) { uint16_t i; ldns_status verify_result = LDNS_STATUS_ERR; if (!rrset || !rrsig || !keys) { return LDNS_STATUS_ERR; } if (ldns_rr_list_rr_count(rrset) < 1) { return LDNS_STATUS_ERR; } if (ldns_rr_list_rr_count(rrsig) < 1) { return LDNS_STATUS_CRYPTO_NO_RRSIG; } if (ldns_rr_list_rr_count(keys) < 1) { verify_result = LDNS_STATUS_CRYPTO_NO_TRUSTED_DNSKEY; } else { for (i = 0; i < ldns_rr_list_rr_count(rrsig); i++) { ldns_status s = ldns_verify_rrsig_keylist_time( rrset, ldns_rr_list_rr(rrsig, i), keys, check_time, good_keys); /* try a little to get more descriptive error */ if(s == LDNS_STATUS_OK) { verify_result = LDNS_STATUS_OK; } else if(verify_result == LDNS_STATUS_ERR) verify_result = s; else if(s != LDNS_STATUS_ERR && verify_result == LDNS_STATUS_CRYPTO_NO_MATCHING_KEYTAG_DNSKEY) verify_result = s; } } return verify_result; }
false
false
false
false
false
0
reset_generation(CELL i) { F_ZONE *z = (i == NURSERY ? &nursery : &data_heap->generations[i]); z->here = z->start; if(secure_gc) memset((void*)z->start,69,z->size); }
false
false
false
false
false
0
memory_ass_sub(PyMemoryViewObject *self, PyObject *key, PyObject *value) { Py_ssize_t start, len, bytelen; Py_buffer srcview; Py_buffer *view = &(self->view); char *srcbuf, *destbuf; if (view->readonly) { PyErr_SetString(PyExc_TypeError, "cannot modify read-only memory"); return -1; } if (value == NULL) { PyErr_SetString(PyExc_TypeError, "cannot delete memory"); return -1; } if (view->ndim != 1) { PyErr_SetNone(PyExc_NotImplementedError); return -1; } if (PyIndex_Check(key)) { start = PyNumber_AsSsize_t(key, NULL); if (start == -1 && PyErr_Occurred()) return -1; if (start < 0) { start += get_shape0(view); } if ((start < 0) || (start >= get_shape0(view))) { PyErr_SetString(PyExc_IndexError, "index out of bounds"); return -1; } len = 1; } else if (PySlice_Check(key)) { Py_ssize_t stop, step; if (PySlice_GetIndicesEx((PySliceObject*)key, get_shape0(view), &start, &stop, &step, &len) < 0) { return -1; } if (step != 1) { PyErr_SetNone(PyExc_NotImplementedError); return -1; } } else { PyErr_Format(PyExc_TypeError, "cannot index memory using \"%.200s\"", key->ob_type->tp_name); return -1; } if (PyObject_GetBuffer(value, &srcview, PyBUF_CONTIG_RO) == -1) { return -1; } /* XXX should we allow assignment of different item sizes as long as the byte length is the same? (e.g. assign 2 shorts to a 4-byte slice) */ if (srcview.itemsize != view->itemsize) { PyErr_Format(PyExc_TypeError, "mismatching item sizes for \"%.200s\" and \"%.200s\"", view->obj->ob_type->tp_name, srcview.obj->ob_type->tp_name); goto _error; } bytelen = len * view->itemsize; if (bytelen != srcview.len) { PyErr_SetString(PyExc_ValueError, "cannot modify size of memoryview object"); goto _error; } /* Do the actual copy */ destbuf = (char *) view->buf + start * view->itemsize; srcbuf = (char *) srcview.buf; if (destbuf + bytelen < srcbuf || srcbuf + bytelen < destbuf) /* No overlapping */ memcpy(destbuf, srcbuf, bytelen); else memmove(destbuf, srcbuf, bytelen); PyBuffer_Release(&srcview); return 0; _error: PyBuffer_Release(&srcview); return -1; }
false
true
false
false
false
1
create_check_texture (void) { int i, j; Texture * tex; unsigned char * pixmap; pixmap = (unsigned char *) malloc (TEXTURE_SIZE*TEXTURE_SIZE*3*sizeof (unsigned char)); for (i=0; i< TEXTURE_SIZE; i++) { for (j=0; j< TEXTURE_SIZE; j++) { pixmap [3*TEXTURE_SIZE*i + 3*j] = 255 * ( (((i)/32) %2) == (((j)/32) %2)); pixmap [3*TEXTURE_SIZE*i + 3*j + 1] = 255 * ( (((i)/32) %2) == (((j)/32) %2)); pixmap [3*TEXTURE_SIZE*i + 3*j + 2] = 255 * ( (((i)/32) %2) == (((j)/32) %2)); } } tex = (Texture *) malloc (sizeof (Texture)); tex -> size = TEXTURE_SIZE; tex -> pixmap = pixmap; return tex; }
false
false
false
false
false
0
run_startup_cmd(void) { gchar **argv = NULL; GError *e = NULL; gboolean ok; if (!g_shell_parse_argv(startup_cmd, NULL, &argv, &e)) { g_message("Error parsing startup command: %s", e->message); g_error_free(e); e = NULL; } ok = g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, NULL, &e); if (!ok) { g_message("Error launching startup command: %s", e->message); g_error_free(e); e = NULL; } }
false
false
false
false
false
0
ompi_group_difference(ompi_group_t* group1, ompi_group_t* group2, ompi_group_t **new_group) { /* local varibles */ int new_group_size, proc1, proc2, found_in_group2, cnt; int my_group_rank; ompi_group_t *group1_pointer, *group2_pointer, *new_group_pointer; ompi_proc_t *proc1_pointer, *proc2_pointer, *my_proc_pointer = NULL; group1_pointer=(ompi_group_t *)group1; group2_pointer=(ompi_group_t *)group2; /* * form union */ /* get new group size */ new_group_size=0; /* loop over group1 members */ for( proc1=0; proc1 < group1_pointer->grp_proc_count; proc1++ ) { proc1_pointer = ompi_group_peer_lookup(group1_pointer,proc1); /* check to see if this proc is in group2 */ found_in_group2=0; for( proc2=0 ; proc2 < group2_pointer->grp_proc_count ; proc2++ ) { proc2_pointer = ompi_group_peer_lookup(group2_pointer,proc2); if( proc1_pointer == proc2_pointer ) { found_in_group2=true; break; } } /* end proc1 loop */ if(found_in_group2) { continue; } new_group_size++; } /* end proc loop */ if ( 0 == new_group_size ) { *new_group = MPI_GROUP_EMPTY; OBJ_RETAIN(MPI_GROUP_EMPTY); return MPI_SUCCESS; } /* allocate a new ompi_group_t structure */ new_group_pointer=ompi_group_allocate(new_group_size); if( NULL == new_group_pointer ) { return MPI_ERR_GROUP; } /* fill in group list */ cnt=0; /* loop over group1 members */ for( proc1=0; proc1 < group1_pointer->grp_proc_count; proc1++ ) { proc1_pointer = ompi_group_peer_lookup(group1_pointer,proc1); /* check to see if this proc is in group2 */ found_in_group2=0; for( proc2=0 ; proc2 < group2_pointer->grp_proc_count ; proc2++ ) { proc2_pointer = ompi_group_peer_lookup(group2_pointer,proc2); if( proc1_pointer == proc2_pointer ) { found_in_group2=true; break; } } /* end proc1 loop */ if(found_in_group2) { continue; } new_group_pointer->grp_proc_pointers[cnt] = ompi_group_peer_lookup(group1_pointer,proc1); cnt++; } /* end proc loop */ /* increment proc reference counters */ ompi_group_increment_proc_count(new_group_pointer); /* find my rank */ my_group_rank=group1_pointer->grp_my_rank; if ( MPI_UNDEFINED != my_group_rank ) { my_proc_pointer = ompi_group_peer_lookup(group1_pointer,my_group_rank); } else { my_group_rank=group2_pointer->grp_my_rank; if ( MPI_UNDEFINED != my_group_rank ) { my_proc_pointer = ompi_group_peer_lookup(group2_pointer,my_group_rank); } } if ( MPI_UNDEFINED == my_group_rank ) { new_group_pointer->grp_my_rank = MPI_UNDEFINED; } else { ompi_set_group_rank(new_group_pointer,my_proc_pointer); } *new_group = (MPI_Group)new_group_pointer; return OMPI_SUCCESS; }
false
false
false
false
false
0
gst_clock_get_master (GstClock * clock) { GstClock *result = NULL; GstClockPrivate *priv; g_return_val_if_fail (GST_IS_CLOCK (clock), NULL); priv = clock->priv; GST_OBJECT_LOCK (clock); if (priv->master) result = gst_object_ref (priv->master); GST_OBJECT_UNLOCK (clock); return result; }
false
false
false
false
false
0
inPoly(Point vertex[], int n, Point q) { int i, i1; /* point index; i1 = i-1 mod n */ double x; /* x intersection of e with ray */ double crossings = 0; /* number of edge/ray crossings */ if (tp3 == NULL) tp3 = N_GNEW(maxcnt, Point); /* Shift so that q is the origin. */ for (i = 0; i < n; i++) { tp3[i].x = vertex[i].x - q.x; tp3[i].y = vertex[i].y - q.y; } /* For each edge e=(i-1,i), see if crosses ray. */ for (i = 0; i < n; i++) { i1 = (i + n - 1) % n; /* if edge is horizontal, test to see if the point is on it */ if ((tp3[i].y == 0) && (tp3[i1].y == 0)) { if ((tp3[i].x * tp3[i1].x) < 0) { return 1; } else { continue; } } /* if e straddles the x-axis... */ if (((tp3[i].y >= 0) && (tp3[i1].y <= 0)) || ((tp3[i1].y >= 0) && (tp3[i].y <= 0))) { /* e straddles ray, so compute intersection with ray. */ x = (tp3[i].x * tp3[i1].y - tp3[i1].x * tp3[i].y) / (double) (tp3[i1].y - tp3[i].y); /* if intersect at origin, we've found intersection */ if (x == 0) return 1;; /* crosses ray if strictly positive intersection. */ if (x > 0) { if ((tp3[i].y == 0) || (tp3[i1].y == 0)) { crossings += .5; /* goes thru vertex */ } else { crossings += 1.0; } } } } /* q inside if an odd number of crossings. */ if ((((int) crossings) % 2) == 1) return 1; else return 0; }
false
false
false
false
false
0
RecordCodeGeneration(Code* code, MacroAssembler* masm) { code->set_major_key(MajorKey()); OPROFILE(CreateNativeCodeRegion(GetName(), code->instruction_start(), code->instruction_size())); LOG(CodeCreateEvent(Logger::STUB_TAG, code, GetName())); Counters::total_stubs_code_size.Increment(code->instruction_size()); #ifdef ENABLE_DISASSEMBLER if (FLAG_print_code_stubs) { #ifdef DEBUG Print(); #endif code->Disassemble(GetName()); PrintF("\n"); } #endif }
false
false
false
false
false
0
find_neighbors_LL(EW * ewptr, NEIGHBOR * nbr_head, SHORT row, SHORT col, int npoints, SHORT * neighbors) { MELEMENT **Mptr; /* double indirection !! */ int westward = 1; /* 1 if west of interpolation point */ double distance; short *active; /* TRUE if active search in this direction */ active = &ewptr->walive; /* TRUE if searching west in this row */ Mptr = &ewptr->west; /* process search west first, then east */ do { if (*active) { distance = distance_LL(row, col, *Mptr); if (*neighbors < npoints) add_neighbor(Mptr, nbr_head, distance, ++(*neighbors)); else if (!replace_neighbor(Mptr, nbr_head, distance)) *active = FALSE; /* curtail search in this direction */ if (*active) if (westward) extend_west(ewptr); else extend_east(ewptr); } active = &ewptr->ealive; Mptr = &ewptr->east; } while (westward--); /* repeat loop for east and quit */ return 0; }
false
false
false
false
false
0
rep_hist_record_mtbf_data(time_t now, int missing_means_down) { char time_buf[ISO_TIME_LEN+1]; digestmap_iter_t *orhist_it; const char *digest; void *or_history_p; or_history_t *hist; open_file_t *open_file = NULL; FILE *f; { char *filename = get_datadir_fname("router-stability"); f = start_writing_to_stdio_file(filename, OPEN_FLAGS_REPLACE|O_TEXT, 0600, &open_file); tor_free(filename); if (!f) return -1; } /* File format is: * FormatLine *KeywordLine Data * * FormatLine = "format 1" NL * KeywordLine = Keyword SP Arguments NL * Data = "data" NL *RouterMTBFLine "." NL * RouterMTBFLine = Fingerprint SP WeightedRunLen SP * TotalRunWeights [SP S=StartRunTime] NL */ #define PUT(s) STMT_BEGIN if (fputs((s),f)<0) goto err; STMT_END #define PRINTF(args) STMT_BEGIN if (fprintf args <0) goto err; STMT_END PUT("format 2\n"); format_iso_time(time_buf, time(NULL)); PRINTF((f, "stored-at %s\n", time_buf)); if (started_tracking_stability) { format_iso_time(time_buf, started_tracking_stability); PRINTF((f, "tracked-since %s\n", time_buf)); } if (stability_last_downrated) { format_iso_time(time_buf, stability_last_downrated); PRINTF((f, "last-downrated %s\n", time_buf)); } PUT("data\n"); /* XXX Nick: now bridge auths record this for all routers too. * Should we make them record it only for bridge routers? -RD * Not for 0.2.0. -NM */ for (orhist_it = digestmap_iter_init(history_map); !digestmap_iter_done(orhist_it); orhist_it = digestmap_iter_next(history_map,orhist_it)) { char dbuf[HEX_DIGEST_LEN+1]; const char *t = NULL; digestmap_iter_get(orhist_it, &digest, &or_history_p); hist = (or_history_t*) or_history_p; base16_encode(dbuf, sizeof(dbuf), digest, DIGEST_LEN); if (missing_means_down && hist->start_of_run && !router_get_by_id_digest(digest)) { /* We think this relay is running, but it's not listed in our * routerlist. Somehow it fell out without telling us it went * down. Complain and also correct it. */ log_info(LD_HIST, "Relay '%s' is listed as up in rephist, but it's not in " "our routerlist. Correcting.", dbuf); rep_hist_note_router_unreachable(digest, now); } PRINTF((f, "R %s\n", dbuf)); if (hist->start_of_run > 0) { format_iso_time(time_buf, hist->start_of_run); t = time_buf; } PRINTF((f, "+MTBF %lu %.5lf%s%s\n", hist->weighted_run_length, hist->total_run_weights, t ? " S=" : "", t ? t : "")); t = NULL; if (hist->start_of_downtime > 0) { format_iso_time(time_buf, hist->start_of_downtime); t = time_buf; } PRINTF((f, "+WFU %lu %lu%s%s\n", hist->weighted_uptime, hist->total_weighted_time, t ? " S=" : "", t ? t : "")); } PUT(".\n"); #undef PUT #undef PRINTF return finish_writing_to_file(open_file); err: abort_writing_to_file(open_file); return -1; }
false
false
false
false
false
0
str_to_uppercase(string& output) { int len = output.length(); for (int i = 0; i < len; i++) { output[i] = toupper(output[i]); } }
false
false
false
false
false
0
check_response(usb_handle *usb, unsigned int size, char *response) { unsigned char status[65]; int r; for(;;) { r = usb_read(usb, status, 64); if(r < 0) { sprintf(ERROR, "status read failed (%s)", strerror(errno)); usb_close(usb); return -1; } status[r] = 0; if(r < 4) { sprintf(ERROR, "status malformed (%d bytes)", r); usb_close(usb); return -1; } if(!memcmp(status, "INFO", 4)) { fprintf(stderr,"(bootloader) %s\n", status + 4); continue; } if(!memcmp(status, "OKAY", 4)) { if(response) { strcpy(response, (char*) status + 4); } return 0; } if(!memcmp(status, "FAIL", 4)) { if(r > 4) { sprintf(ERROR, "remote: %s", status + 4); } else { strcpy(ERROR, "remote failure"); } return -1; } if(!memcmp(status, "DATA", 4) && size > 0){ unsigned dsize = strtoul((char*) status + 4, 0, 16); if(dsize > size) { strcpy(ERROR, "data size too large"); usb_close(usb); return -1; } return dsize; } strcpy(ERROR,"unknown status code"); usb_close(usb); break; } return -1; }
false
false
false
false
false
0
factor_using_division (GArray *fact, mpz_t t, unsigned int limit) { mpz_t q, r; unsigned long int f; int ai; unsigned *addv = add; unsigned int failures; mpz_init (q); mpz_init (r); f = mpz_scan1 (t, 0); mpz_div_2exp (t, t, f); while (f) { append_factor_uint (fact, 2); --f; } for (;;) { mpz_tdiv_qr_ui (q, r, t, 3); if (mpz_cmp_ui (r, 0) != 0) break; mpz_set (t, q); append_factor_uint (fact, 3); } for (;;) { mpz_tdiv_qr_ui (q, r, t, 5); if (mpz_cmp_ui (r, 0) != 0) break; mpz_set (t, q); append_factor_uint (fact, 5); } failures = 0; f = 7; ai = 0; while (mpz_cmp_ui (t, 1) != 0) { mpz_tdiv_qr_ui (q, r, t, f); if (mpz_cmp_ui (r, 0) != 0) { f += addv[ai]; if (mpz_cmp_ui (q, f) < 0) break; ai = (ai + 1) & 7; failures++; if (failures > limit) break; } else { mpz_swap (t, q); append_factor_uint (fact, f); failures = 0; } } mpz_clear (q); mpz_clear (r); }
false
false
false
false
false
0
lfsr(unsigned short v, unsigned int bits) { unsigned short bit; if (v >= (1 << bits)) { fprintf(stderr, "lfsr: internal error\n"); exit(-1); } if (v == (((1 << bits) - 1) & 0xace1)) return 0; if (v == 0) v = ((1 << bits) - 1) & 0xace1; switch (bits) { case 8: /* x^8 + x^6 + x^5 + x^4 + 1 */ bit = ((v >> 0) ^ (v >> 2) ^ (v >> 3) ^ (v >> 4)) & 1; break; case 9: /* x9 + x5 + 1 */ bit = ((v >> 0) ^ (v >> 4)) & 1; break; case 10: /* x10 + x7 + 1 */ bit = ((v >> 0) ^ (v >> 3)) & 1; break; case 11: /* x11 + x9 + 1 */ bit = ((v >> 0) ^ (v >> 2)) & 1; break; case 12: bit = ((v >> 0) ^ (v >> 1) ^ (v >> 2) ^ (v >> 8)) & 1; break; case 13: /* x^13 + x^12 + x^11 + x^8 + 1 */ bit = ((v >> 0) ^ (v >> 1) ^ (v >> 2) ^ (v >> 5)) & 1; break; case 14: /* x^14 + x^13 + x^12 + x^2 + 1 */ bit = ((v >> 0) ^ (v >> 1) ^ (v >> 2) ^ (v >> 12)) & 1; break; case 15: /* x^15 + x^14 + 1 */ bit = ((v >> 0) ^ (v >> 1) ) & 1; break; case 16: /* x^16 + x^14 + x^13 + x^11 + 1 */ bit = ((v >> 0) ^ (v >> 2) ^ (v >> 3) ^ (v >> 5) ) & 1; break; default: fprintf(stderr, "lfsr: internal error\n"); exit(-1); } return v >> 1 | bit << (bits - 1); }
false
false
false
false
false
0
window2_button_callback(GtkWidget *w, gpointer data) { GtkWidget * x, *apply_button,*add_new_button; gchar * c, *c2; int i; long select = (long)data; gchar * clist_item[3]; // printf("point2 data = %d\n",select); apply_button = (GtkWidget*)gtk_object_get_data(GTK_OBJECT(window2),"button2"); add_new_button = (GtkWidget*)gtk_object_get_data(GTK_OBJECT(window2),"button3"); switch(select) { case 1: gtk_widget_hide(window2); //OK case 2: //Apply if(signal_window2_change) { task_set_active(task_extract_man_data); task_set_active(task_add_data_to_clist); } signal_window2_change = 0; gtk_widget_set_sensitive(apply_button,0); break; case 3: //Add New x = (GtkWidget*)gtk_object_get_data(GTK_OBJECT(window2),"entry2"); c = (gchar *)gtk_entry_get_text(GTK_ENTRY(x)); if(!strcmp(c,"")) { g_print("gman: path name can not be empty\n"); break; } if (man_paths->have_item(c)) break; c2 = my_strdup(c); clist_item[0] = "o"; clist_item[1] = c2; clist_item[2] = "???"; gtk_clist_append(GTK_CLIST(clist2),clist_item); man_paths->add_item(c2,(void*)0); man_paths_to_be_load->add_item(c2); task_set_active(task_loading_man_data); signal_window2_change ++; gtk_widget_set_sensitive(apply_button,1); gtk_editable_select_region (GTK_EDITABLE (x), 0, strlen(c)); break; case 4: //Delete if (clist2_selected_row == -1) break; // printf("remove %d\n",clist2_selected_row); i = clist2_selected_row; delete ((ManPath*)(man_paths->get_value(i))); man_paths->delete_item(i); gtk_clist_remove(GTK_CLIST(clist2),i); signal_window2_change ++; gtk_widget_set_sensitive(apply_button,1); break; default: g_print("gman: sorry... this function not implemented yet\n"); }; return 1; }
false
false
false
false
false
0
_fm_folder_model_add_file(FmFolderModel* model, FmFileInfo* file) { if(!file_can_show(model, file)) g_sequence_append( model->hidden, fm_folder_item_new(file) ); else fm_folder_model_file_created(model, file); }
false
false
false
false
false
0
putFIFO(BUF_POS * b, int totalnum){ if(Findex2 >= totalnum){ printf(" out of FIFO range error 1 !\n"); exit(1); } (FIFO2+Findex2)->altitude = b ->altitude ; (FIFO2+Findex2)->x = b ->x; (FIFO2+Findex2)->y = b ->y; (FIFO2+Findex2)->prev = b ->prev; (FIFO2+Findex2)->next = b ->next; (FIFO2+Findex2)->isit = b ->isit; Findex2 ++ ; }
false
false
false
false
false
0
alc5632_set_bias_level(struct snd_soc_codec *codec, enum snd_soc_bias_level level) { switch (level) { case SND_SOC_BIAS_ON: enable_power_depop(codec); break; case SND_SOC_BIAS_PREPARE: break; case SND_SOC_BIAS_STANDBY: /* everything off except vref/vmid, */ snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD1, ALC5632_PWR_MANAG_ADD1_MASK, ALC5632_PWR_ADD1_MAIN_BIAS); snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2, ALC5632_PWR_MANAG_ADD2_MASK, ALC5632_PWR_ADD2_VREF); /* "normal" mode: 0 @ 26 */ snd_soc_update_bits(codec, ALC5632_PWR_DOWN_CTRL_STATUS, ALC5632_PWR_DOWN_CTRL_STATUS_MASK, 0xffff ^ (ALC5632_PWR_VREF_PR3 | ALC5632_PWR_VREF_PR2)); break; case SND_SOC_BIAS_OFF: /* everything off, dac mute, inactive */ snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2, ALC5632_PWR_MANAG_ADD2_MASK, 0); snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD3, ALC5632_PWR_MANAG_ADD3_MASK, 0); snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD1, ALC5632_PWR_MANAG_ADD1_MASK, 0); break; } return 0; }
false
false
false
false
false
0
test_ctzv_to_timezone (void) { gint tz1 = 0; gint _tmp0_ = 0; gint tz2 = 0; gint _tmp1_ = 0; gint tz3 = 0; gint _tmp2_ = 0; #line 26 "/tmp/buildd/fso-gsmd-0.12.0/tests/testconst.vala" _tmp0_ = fso_gsm_constants_ctzvToTimeZone (0x19); #line 26 "/tmp/buildd/fso-gsmd-0.12.0/tests/testconst.vala" tz1 = _tmp0_; #line 27 "/tmp/buildd/fso-gsmd-0.12.0/tests/testconst.vala" _vala_assert (tz1 == (-165), "tz1 == -165"); #line 29 "/tmp/buildd/fso-gsmd-0.12.0/tests/testconst.vala" _tmp1_ = fso_gsm_constants_ctzvToTimeZone (35); #line 29 "/tmp/buildd/fso-gsmd-0.12.0/tests/testconst.vala" tz2 = _tmp1_; #line 30 "/tmp/buildd/fso-gsmd-0.12.0/tests/testconst.vala" _vala_assert (tz2 == (8 * 60), "tz2 == 8*60"); #line 32 "/tmp/buildd/fso-gsmd-0.12.0/tests/testconst.vala" _tmp2_ = fso_gsm_constants_ctzvToTimeZone (105); #line 32 "/tmp/buildd/fso-gsmd-0.12.0/tests/testconst.vala" tz3 = _tmp2_; #line 33 "/tmp/buildd/fso-gsmd-0.12.0/tests/testconst.vala" _vala_assert (tz3 == ((-4) * 60), "tz3 == -4*60"); #line 69 "testconst.c" }
false
false
false
false
false
0
check_batch_flags(void) { int i; if (protocol_version < 29) flag_ptr[7] = NULL; else if (protocol_version < 30) flag_ptr[9] = NULL; tweaked_append = append_mode == 1; tweaked_append_verify = append_mode == 2; #ifdef ICONV_OPTION tweaked_iconv = iconv_opt != NULL; #endif for (i = 0; flag_ptr[i]; i++) { int set = batch_stream_flags & (1 << i) ? 1 : 0; if (*flag_ptr[i] != set) { if (i == 9) { rprintf(FERROR, "%s specify the --iconv option to use this batch file.\n", set ? "Please" : "Do not"); exit_cleanup(RERR_SYNTAX); } if (INFO_GTE(MISC, 1)) { rprintf(FINFO, "%sing the %s option to match the batchfile.\n", set ? "Sett" : "Clear", flag_name[i]); } *flag_ptr[i] = set; } } if (protocol_version < 29) { if (recurse) xfer_dirs |= 1; else if (xfer_dirs < 2) xfer_dirs = 0; } if (tweaked_append) append_mode = 1; else if (tweaked_append_verify) append_mode = 2; }
false
false
false
false
false
0
handle_char_store (gimple_stmt_iterator *gsi) { int idx = -1; strinfo si = NULL; gimple stmt = gsi_stmt (*gsi); tree ssaname = NULL_TREE, lhs = gimple_assign_lhs (stmt); if (TREE_CODE (lhs) == MEM_REF && TREE_CODE (TREE_OPERAND (lhs, 0)) == SSA_NAME) { if (integer_zerop (TREE_OPERAND (lhs, 1))) { ssaname = TREE_OPERAND (lhs, 0); idx = get_stridx (ssaname); } } else idx = get_addr_stridx (lhs); if (idx > 0) { si = get_strinfo (idx); if (si != NULL && si->length != NULL_TREE && integer_zerop (si->length)) { if (initializer_zerop (gimple_assign_rhs1 (stmt))) { /* When storing '\0', the store can be removed if we know it has been stored in the current function. */ if (!stmt_could_throw_p (stmt) && si->writable) { unlink_stmt_vdef (stmt); release_defs (stmt); gsi_remove (gsi, true); return false; } else { si->writable = true; si->dont_invalidate = true; } } else /* Otherwise this statement overwrites the '\0' with something, if the previous stmt was a memcpy, its length may be decreased. */ adjust_last_stmt (si, stmt, false); } else if (si != NULL && integer_zerop (gimple_assign_rhs1 (stmt))) { si = unshare_strinfo (si); si->length = build_int_cst (size_type_node, 0); si->endptr = NULL; si->prev = 0; si->next = 0; si->stmt = NULL; si->first = 0; si->writable = true; if (ssaname && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ssaname)) si->endptr = ssaname; si->dont_invalidate = true; } } else if (idx == 0 && initializer_zerop (gimple_assign_rhs1 (stmt))) { if (ssaname) { si = zero_length_string (ssaname, NULL); if (si != NULL) si->dont_invalidate = true; } else { int idx = new_addr_stridx (lhs); if (idx != 0) { si = new_strinfo (build_fold_addr_expr (lhs), idx, build_int_cst (size_type_node, 0)); set_strinfo (idx, si); si->dont_invalidate = true; } } if (si != NULL) si->writable = true; } if (si != NULL && initializer_zerop (gimple_assign_rhs1 (stmt))) { /* Allow adjust_last_stmt to remove it if the stored '\0' is immediately overwritten. */ laststmt.stmt = stmt; laststmt.len = build_int_cst (size_type_node, 1); laststmt.stridx = si->idx; } return true; }
false
false
false
false
false
0
free_pdp(struct drm_device *dev, struct i915_page_directory_pointer *pdp) { __pdp_fini(pdp); if (USES_FULL_48BIT_PPGTT(dev)) { cleanup_px(dev, pdp); kfree(pdp); } }
false
false
false
false
false
0
GetLength() { double result, l=0.0; int i; this->ComputeBounds(); for (i=0; i<3; i++) { result = this->Bounds[2*i+1] - this->Bounds[2*i]; l += result * result; } result = sqrt(l); assert("post: positive_result" && result>=0); return result; }
false
false
false
false
false
0
glp_ios_node_bound(glp_tree *tree, int p) { IOSNPD *node; /* obtain pointer to the specified subproblem */ if (!(1 <= p && p <= tree->nslots)) err: xerror("glp_ios_node_bound: p = %d; invalid subproblem referen" "ce number\n", p); node = tree->slot[p].node; if (node == NULL) goto err; /* return the node local bound */ return node->bound; }
false
false
false
false
false
0
regmatchrepeat(regex_t *preg, int scan, int matchmin) { int *scanpt = preg->program + scan; int max = scanpt[2]; int min = scanpt[3]; if (scanpt[4] < min) { scanpt[4]++; if (regmatch(preg, scan + 5)) { return 1; } scanpt[4]--; return 0; } if (scanpt[4] > max) { return 0; } if (matchmin) { if (regmatch(preg, regnext(preg, scan))) { return 1; } scanpt[4]++; if (regmatch(preg, scan + 5)) { return 1; } scanpt[4]--; return 0; } if (scanpt[4] < max) { scanpt[4]++; if (regmatch(preg, scan + 5)) { return 1; } scanpt[4]--; } return regmatch(preg, regnext(preg, scan)); }
false
false
false
false
false
0
mtd_point(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, void **virt, resource_size_t *phys) { *retlen = 0; *virt = NULL; if (phys) *phys = 0; if (!mtd->_point) return -EOPNOTSUPP; if (from < 0 || from >= mtd->size || len > mtd->size - from) return -EINVAL; if (!len) return 0; return mtd->_point(mtd, from, len, retlen, virt, phys); }
false
false
false
false
false
0
removeSubscription( Podcasts::SqlPodcastChannelPtr sqlChannel ) { debug() << "Deleting channel " << sqlChannel->title(); sqlChannel->deleteFromDb(); m_channels.removeOne( sqlChannel ); //HACK: because of a database "leak" in the past we have orphan data in the tables. //Remove it when we know it's supposed to be empty. if( m_channels.isEmpty() ) { SqlStorage *sqlStorage = CollectionManager::instance()->sqlStorage(); if( !sqlStorage ) return; debug() << "Unsubscribed from last channel, cleaning out the podcastepisodes table."; sqlStorage->query( "DELETE FROM podcastepisodes WHERE 1;" ); } emit playlistRemoved( Playlists::PlaylistPtr::dynamicCast( sqlChannel ) ); }
false
false
false
false
false
0
update(btDbvtNode* leaf,btDbvtVolume& volume,const btVector3& velocity) { if(leaf->volume.Contain(volume)) return(false); volume.SignedExpand(velocity); update(leaf,volume); return(true); }
false
false
false
false
false
0
alg_fromtext(const char *name) { const char *p = name; if (strncasecmp(p, "hmac-", 5) == 0) p = &name[5]; if (strcasecmp(p, "md5") == 0) return DST_ALG_HMACMD5; if (strcasecmp(p, "sha1") == 0) return DST_ALG_HMACSHA1; if (strcasecmp(p, "sha224") == 0) return DST_ALG_HMACSHA224; if (strcasecmp(p, "sha256") == 0) return DST_ALG_HMACSHA256; if (strcasecmp(p, "sha384") == 0) return DST_ALG_HMACSHA384; if (strcasecmp(p, "sha512") == 0) return DST_ALG_HMACSHA512; return DST_ALG_UNKNOWN; }
false
false
false
false
false
0
eb_finalize_appendix_subbooks(EB_Appendix *appendix) { EB_Appendix_Subbook *subbook; int i; LOG(("in: eb_finalize_appendix_subbooks(appendix=%d)", (int)appendix->code)); for (i = 0, subbook = appendix->subbooks; i < appendix->subbook_count; i++, subbook++) { zio_finalize(&appendix->subbooks[i].zio); } LOG(("out: eb_finalize_appendix_subbooks()")); }
false
false
false
false
false
0
cacheId(const QString &elementId) { if (size.isValid() && size != naturalSize) { return CACHE_ID_WITH_SIZE(size, elementId); } else { return CACHE_ID_NATURAL_SIZE(elementId); } }
false
false
false
false
false
0
outPendingInlineStatements() { if( linkStack.size() > 1 && linkStack[linkStack.size()-2].openedInMif && !linkStack[linkStack.size()-2].forcesNoLink() ) { LinkInfo::pendingMifClosings++; linkStack[linkStack.size()-2].openedInMif = false; } for( ; LinkInfo::pendingMifClosings > 0; LinkInfo::pendingMifClosings-- ) { MifDoc::Marker marker( MifDoc::T_string( "" ), MifDoc::Marker::Hypertext ); marker.out( mifDoc.os() ); } if( indexEntryStack.size() > 0 ) { indexEntryStack.back().out( mifDoc.os() ); indexEntryStack.resize( indexEntryStack.size() - 1 ); } for( size_t i = 0; i < nodeStack.size(); i++ ) { unsigned long n; if( nodeStack[i].node->elementIndex( n ) == accessOK ) { GroveString id; nodeStack[i].node->getId( id ); unsigned long groveIndex = nodeStack[i].node->groveIndex(); mifDoc.os() << MifDoc::CrossRefInfo ( groveIndex, n, mifDoc.os().CurTagIndent, MifDoc::CrossRefInfo::PotentialMarker, id.data(), id.size() ); if( id.size() > 0 ) mifDoc.elements().setBookComponentIndex ( groveIndex, StringC( id.data(), id.size() ), mifDoc.bookComponents().size() - 1 ); else mifDoc.elements().setBookComponentIndex ( groveIndex, n, mifDoc.bookComponents().size() - 1 ); } } NodeInfo::nonEmptyElementsOpened = 0; nodeStack.resize(0); if( linkStack.size() > 0 && !linkStack.back().openedInMif && !linkStack.back().forcesNoLink() ) { linkStack.back().crossRefInfo->tagIndent = mifDoc.os().CurTagIndent; mifDoc.os() << *linkStack.back().crossRefInfo; linkStack.back().openedInMif = true; } }
false
false
false
false
false
0
multi_sync_start_countdown() { // don't allow repeat button presses if(Multi_sync_launch_pressed){ return; } Multi_sync_launch_pressed = 1; // if I'm the server, begin the countdown if(Net_player->flags & NETINFO_FLAG_AM_MASTER){ gamesnd_play_iface(SND_COMMIT_PRESSED); Multi_sync_countdown_timer = 0.0f; Multi_sync_countdown = MULTI_SYNC_COUNTDOWN_TIME; // send an initial countdown value send_countdown_packet(Multi_sync_countdown); } // otherwise send the "start countdown" packet to the standalone else { Assert(Net_player->flags & NETINFO_FLAG_GAME_HOST); send_countdown_packet(-1); } }
false
false
false
false
false
0
bnx2i_setup_host_queue_size(struct bnx2i_hba *hba, struct Scsi_Host *shost) { if (test_bit(BNX2I_NX2_DEV_5708, &hba->cnic_dev_type)) shost->can_queue = ISCSI_MAX_CMDS_PER_HBA_5708; else if (test_bit(BNX2I_NX2_DEV_5709, &hba->cnic_dev_type)) shost->can_queue = ISCSI_MAX_CMDS_PER_HBA_5709; else if (test_bit(BNX2I_NX2_DEV_57710, &hba->cnic_dev_type)) shost->can_queue = ISCSI_MAX_CMDS_PER_HBA_57710; else shost->can_queue = ISCSI_MAX_CMDS_PER_HBA_5708; }
false
false
false
false
false
0
loc_compare_locale_signatures (const char *signature, const sc_locale_t *locale) { sc_int index_; sc_bool is_matched; /* Compare signatures, stopping on the first match found. */ is_matched = FALSE; for (index_ = 0; index_ < SIGNATURE_COUNT; index_++) { if (memcmp (locale->signature[index_], signature, sizeof (locale->signature[0])) == 0) { is_matched = TRUE; break; } } return is_matched; }
false
false
false
false
false
0
netsnmp_iterator_create_table( Netsnmp_First_Data_Point *firstDP, Netsnmp_Next_Data_Point *nextDP, Netsnmp_First_Data_Point *getidx, netsnmp_variable_list *indexes) { netsnmp_iterator_info *iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info); if ( !iinfo ) return NULL; if ( indexes ) iinfo->indexes = snmp_clone_varbind(indexes); iinfo->get_first_data_point = firstDP; iinfo->get_next_data_point = nextDP; iinfo->get_row_indexes = getidx; return iinfo; }
false
false
false
false
false
0
LongestAxisLength (void) const { // Return longest axis length RNLength dx = this->XLength(); RNLength dy = this->YLength(); return (dx > dy) ? dx : dy; }
false
false
false
false
false
0
write_metadata_block_data_streaminfo_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_StreamInfo *block) { FLAC__byte buffer[FLAC__STREAM_METADATA_STREAMINFO_LENGTH]; const unsigned channels1 = block->channels - 1; const unsigned bps1 = block->bits_per_sample - 1; /* we are using hardcoded numbers for simplicity but we should * probably eventually write a bit-level packer and use the * _STREAMINFO_ constants. */ pack_uint32_(block->min_blocksize, buffer, 2); pack_uint32_(block->max_blocksize, buffer+2, 2); pack_uint32_(block->min_framesize, buffer+4, 3); pack_uint32_(block->max_framesize, buffer+7, 3); buffer[10] = (block->sample_rate >> 12) & 0xff; buffer[11] = (block->sample_rate >> 4) & 0xff; buffer[12] = ((block->sample_rate & 0x0f) << 4) | (channels1 << 1) | (bps1 >> 4); buffer[13] = (FLAC__byte)(((bps1 & 0x0f) << 4) | ((block->total_samples >> 32) & 0x0f)); pack_uint32_((FLAC__uint32)block->total_samples, buffer+14, 4); memcpy(buffer+18, block->md5sum, 16); if(write_cb(buffer, 1, FLAC__STREAM_METADATA_STREAMINFO_LENGTH, handle) != FLAC__STREAM_METADATA_STREAMINFO_LENGTH) return false; return true; }
false
true
false
false
false
1
gwy_app_menu_setup_accels(GNode *node, gpointer prefix) { MenuNodeData *data = (MenuNodeData*)node->data; gchar *accel_path; if (GTK_IS_MENU_ITEM(data->widget)) { accel_path = g_strconcat((gchar*)prefix, data->path, NULL); gwy_app_menu_canonicalize_label(accel_path); gtk_menu_item_set_accel_path(GTK_MENU_ITEM(data->widget), accel_path); g_free(accel_path); } return FALSE; }
false
false
false
false
false
0
set_member_ringinuse_help_members(struct call_queue *q, const char *interface, int ringinuse) { struct member *mem; int foundinterface = 0; char rtringinuse[80]; ao2_lock(q); if ((mem = interface_exists(q, interface))) { foundinterface++; if (!mem->realtime) { mem->ringinuse = ringinuse; } else { sprintf(rtringinuse, "%i", ringinuse); update_realtime_member_field(mem, q->name, realtime_ringinuse_field, rtringinuse); } ast_queue_log(q->name, "NONE", interface, "RINGINUSE", "%d", ringinuse); /*** DOCUMENTATION <managerEventInstance> <synopsis>Raised when a member's ringinuse setting is changed.</synopsis> <syntax> <xi:include xpointer="xpointer(/docs/managerEvent[@name='QueueMemberStatus']/managerEventInstance/syntax/parameter[@name='Queue'])" /> <xi:include xpointer="xpointer(/docs/managerEvent[@name='QueueMemberStatus']/managerEventInstance/syntax/parameter[@name='Location'])" /> <parameter name="Ringinuse"> <enumlist> <enum name="0"/> <enum name="1"/> </enumlist> </parameter> </syntax> <see-also> <ref type="function">QUEUE_MEMBER</ref> </see-also> </managerEventInstance> ***/ manager_event(EVENT_FLAG_AGENT, "QueueMemberRinginuse", "Queue: %s\r\n" "Location: %s\r\n" "Ringinuse: %d\r\n", q->name, mem->interface, ringinuse); ao2_ref(mem, -1); } ao2_unlock(q); return foundinterface; }
true
true
false
false
false
1
Drop(UFName name) { _UFGroupMap::iterator iter = ufgroup->Map.find(name); if (iter == ufgroup->Map.end()) Throw("index '%s' does not exists", name); UFObject *dropObject = (*iter).second; ufgroup->Map.erase(name); for (UFGroupList::iterator iter = ufgroup->List.begin(); iter != ufgroup->List.end(); iter++) { if (*iter == dropObject) { ufgroup->List.erase(iter); break; } } _UFGROUP_PARENT(dropObject) = NULL; return *dropObject; }
false
false
false
false
false
0
process_fpdus(struct nes_vnic *nesvnic, struct nes_qp *nesqp) { int again = 1; unsigned long flags; do { /* Ignore rc - if it failed, tcp retries will cause it to try again */ forward_fpdus(nesvnic, nesqp); spin_lock_irqsave(&nesqp->pau_lock, flags); if (nesqp->pau_pending) { nesqp->pau_pending = 0; } else { nesqp->pau_busy = 0; again = 0; } spin_unlock_irqrestore(&nesqp->pau_lock, flags); } while (again); }
false
false
false
false
false
0
insert(timeval futureTime, IOHandler* handler) { if (isEmpty() || futureTime < earliestTime()) { _first = new Timer(futureTime, handler, _first); } else { Timer* before = _first; Timer* after = _first->next; while (after != NULL && futureTime > after->timerValue) { before = after; after = after->next; } before->next = new Timer(futureTime, handler, after); } }
false
false
false
false
false
0
tenEMBimodalParmNix(tenEMBimodalParm *biparm) { if (biparm) { biparm->histo = (double *)airFree(biparm->histo); biparm->pp1 = (double *)airFree(biparm->pp1); biparm->pp2 = (double *)airFree(biparm->pp2); } airFree(biparm); return NULL; }
false
false
false
false
false
0
P_SetMessage(player_t * player, char *message, boolean ultmsg) { extern boolean messageson; if ((ultimatemsg || !messageson) && !ultmsg) { return; } player->message = message; player->messageTics = MESSAGETICS; BorderTopRefresh = true; if (ultmsg) { ultimatemsg = true; } }
false
false
false
false
false
0
cx_fw_version(struct ipmi_intf *intf, char *version) { struct ipmi_rs *rsp; struct ipmi_rq req; uint8_t msg_data[64]; int i; memset(&req, 0, sizeof(req)); memset(msg_data, 0, sizeof(msg_data)); req.msg.netfn = IPMI_NETFN_OEM_SS; req.msg.cmd = IPMI_CMD_OEM_FW_SET_STATUS; msg_data[0] = 0; // resvd msg_data[1] = 4; // param = 4 = "set version" strncpy(&msg_data[2], version, 32); req.msg.data = msg_data; req.msg.data_len = 34; rsp = intf->sendrecv(intf, &req); if (rsp == NULL) { lprintf(LOG_ERR, "Error setting firmware version"); return -1; } if (rsp->ccode > 0) { lprintf(LOG_ERR, "Error: %s", val2str(rsp->ccode, completion_code_vals)); return -1; } return 0; }
false
true
false
false
false
1
guid_add_banned(const struct guid *guid) { struct guiddata *gd; struct guiddata new_gd; gd = get_guiddata(guid); if (NULL == gd) { gd = &new_gd; gd->create_time = gd->last_time = tm_time(); gnet_stats_inc_general(GNR_BANNED_GUID_HELD); if (GNET_PROPERTY(guid_debug)) { g_debug("GUID banning %s", guid_hex_str(guid)); } } else { gd->last_time = tm_time(); } dbmw_write(db_guid, guid, gd, sizeof *gd); }
false
false
false
false
false
0
GetVMTypeFromLength(unsigned int length, unsigned int size) { // Check first of length is a indeed a multiple of size and that length is != 0 if ( !length || length % size ) return VM::VM0; const unsigned int ratio = length / size; //std::cerr << "RATIO=" << ratio << std::endl; switch( ratio ) { case 1: return VM::VM1; case 2: return VM::VM2; case 3: return VM::VM3; case 4: return VM::VM4; case 5: return VM::VM5; case 6: return VM::VM6; case 8: return VM::VM8; case 9: return VM::VM9; case 16: return VM::VM16; case 24: return VM::VM24; case 32: return VM::VM32; default: return VM::VM1_n; } }
false
false
false
false
false
0
select_namelist(char *new) { struct stat stat1, stat2; if (pc->server_namelist) { pc->namelist_debug = new; return TRUE; } if (!file_exists(pc->namelist, &stat1) || !file_exists(new, &stat2)) { return FALSE; } if (stat1.st_size > stat2.st_size) { pc->namelist_debug = pc->namelist; pc->namelist = new; } else if (stat2.st_size > stat1.st_size) pc->namelist_debug = new; else { error(INFO, "cannot distinguish %s and %s\n", pc->namelist, new); return FALSE; } return TRUE; }
false
false
false
false
false
0
PrintDataObject( void *theEnv, char *fileid, DATA_OBJECT_PTR argPtr) { switch(argPtr->type) { case RVOID: case SYMBOL: case STRING: case INTEGER: case FLOAT: case EXTERNAL_ADDRESS: case FACT_ADDRESS: #if OBJECT_SYSTEM case INSTANCE_NAME: case INSTANCE_ADDRESS: #endif PrintAtom(theEnv,fileid,argPtr->type,argPtr->value); break; case MULTIFIELD: PrintMultifield(theEnv,fileid,(struct multifield *) argPtr->value, argPtr->begin,argPtr->end,TRUE); break; default: if (EvaluationData(theEnv)->PrimitivesArray[argPtr->type] != NULL) { if (EvaluationData(theEnv)->PrimitivesArray[argPtr->type]->longPrintFunction) { (*EvaluationData(theEnv)->PrimitivesArray[argPtr->type]->longPrintFunction)(theEnv,fileid,argPtr->value); break; } else if (EvaluationData(theEnv)->PrimitivesArray[argPtr->type]->shortPrintFunction) { (*EvaluationData(theEnv)->PrimitivesArray[argPtr->type]->shortPrintFunction)(theEnv,fileid,argPtr->value); break; } } EnvPrintRouter(theEnv,fileid,"<UnknownPrintType"); PrintLongInteger(theEnv,fileid,(long int) argPtr->type); EnvPrintRouter(theEnv,fileid,">"); SetHaltExecution(theEnv,TRUE); SetEvaluationError(theEnv,TRUE); break; } }
false
false
false
false
false
0
blkid_parse_line(blkid_cache cache, blkid_dev *dev_p, char *cp) { blkid_dev dev; int ret; if (!cache || !dev_p) return -BLKID_ERR_PARAM; *dev_p = NULL; DBG(DEBUG_READ, printf("line: %s\n", cp)); if ((ret = parse_dev(cache, dev_p, &cp)) <= 0) return ret; dev = *dev_p; while ((ret = parse_tag(cache, dev, &cp)) > 0) { ; } if (dev->bid_type == NULL) { DBG(DEBUG_READ, printf("blkid: device %s has no TYPE\n",dev->bid_name)); blkid_free_dev(dev); } DBG(DEBUG_READ, blkid_debug_dump_dev(dev)); return ret; }
false
false
false
false
false
0
zmq_msg_init_data (zmq_msg_t *msg_, void *data_, size_t size_, zmq_free_fn *ffn_) { msg_->shared = 0; msg_->content = (zmq::msg_content_t*) malloc (sizeof (zmq::msg_content_t)); zmq_assert (msg_->content); zmq::msg_content_t *content = (zmq::msg_content_t*) msg_->content; content->data = data_; content->size = size_; content->ffn = ffn_; new (&content->refcnt) zmq::atomic_counter_t (); return 0; }
false
false
false
false
false
0
dcc_request(DCC_REC *dcc) { char *service; g_return_if_fail(dcc != NULL); if (dcc->port < 1024) { /* warn about connecting to lowports */ service = net_getservbyport(dcc->port); printformat(dcc->server, NULL, MSGLEVEL_DCC, IRCTXT_DCC_LOWPORT, dcc->port, service != NULL ? service : "unknown"); } }
false
false
false
false
false
0
tns_render_hash_pair_list(tns_outbuf *outbuf, bstring key, struct bstrList *value) { int i = 0; tns_value_t val = {.type = tns_tag_string}; tns_outbuf_putc(outbuf, ']'); int orig_size = outbuf->used_size; for(i = value->qty - 1; i >= 0 ; i--) { val.value.string = value->entry[i]; tns_render_value(&val, outbuf); } tns_outbuf_clamp(outbuf, orig_size); val.value.string = key; tns_render_value(&val, outbuf); }
false
false
false
false
false
0
rpcsvc_program_actor (rpcsvc_request_t *req) { rpcsvc_program_t *program = NULL; int err = SYSTEM_ERR; rpcsvc_actor_t *actor = NULL; rpcsvc_t *svc = NULL; char found = 0; if (!req) goto err; svc = req->svc; pthread_mutex_lock (&svc->rpclock); { list_for_each_entry (program, &svc->programs, program) { if (program->prognum == req->prognum) { err = PROG_MISMATCH; } if ((program->prognum == req->prognum) && (program->progver == req->progver)) { found = 1; break; } } } pthread_mutex_unlock (&svc->rpclock); if (!found) { if (err != PROG_MISMATCH) { /* log in DEBUG when nfs clients try to see if * ACL requests are accepted by nfs server */ gf_log (GF_RPCSVC, (req->prognum == ACL_PROGRAM) ? GF_LOG_DEBUG : GF_LOG_WARNING, "RPC program not available (req %u %u)", req->prognum, req->progver); err = PROG_UNAVAIL; goto err; } gf_log (GF_RPCSVC, GF_LOG_WARNING, "RPC program version not available (req %u %u)", req->prognum, req->progver); goto err; } req->prog = program; if (!program->actors) { gf_log (GF_RPCSVC, GF_LOG_WARNING, "RPC Actor not found for program %s %d", program->progname, program->prognum); err = SYSTEM_ERR; goto err; } if ((req->procnum < 0) || (req->procnum >= program->numactors)) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "RPC Program procedure not" " available for procedure %d in %s", req->procnum, program->progname); err = PROC_UNAVAIL; goto err; } actor = &program->actors[req->procnum]; if (!actor->actor) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "RPC Program procedure not" " available for procedure %d in %s", req->procnum, program->progname); err = PROC_UNAVAIL; actor = NULL; goto err; } err = SUCCESS; gf_log (GF_RPCSVC, GF_LOG_TRACE, "Actor found: %s - %s", program->progname, actor->procname); err: if (req) req->rpc_err = err; return actor; }
false
false
false
false
false
0
radialShadedFill(GfxState *state, GfxRadialShading *shading, double sMin, double sMax) { double x0, y0, r0, x1, y1, r1; double dx, dy, dr; shading->getCoords(&x0, &y0, &r0, &x1, &y1, &r1); dx = x1 - x0; dy = y1 - y0; dr = r1 - r0; cairo_pattern_destroy(fill_pattern); fill_pattern = cairo_pattern_create_radial (x0 + sMin * dx, y0 + sMin * dy, r0 + sMin * dr, x0 + sMax * dx, y0 + sMax * dy, r0 + sMax * dr); if (shading->getExtend0() && shading->getExtend1()) cairo_pattern_set_extend (fill_pattern, CAIRO_EXTEND_PAD); else cairo_pattern_set_extend (fill_pattern, CAIRO_EXTEND_NONE); LOG (printf ("radial-sh\n")); return gFalse; }
false
false
false
false
false
0
instantiate_pending_templates (int retries) { int reconsider; location_t saved_loc = input_location; /* Instantiating templates may trigger vtable generation. This in turn may require further template instantiations. We place a limit here to avoid infinite loop. */ if (pending_templates && retries >= max_tinst_depth) { tree decl = pending_templates->tinst->decl; error ("template instantiation depth exceeds maximum of %d" " instantiating %q+D, possibly from virtual table generation" " (use -ftemplate-depth= to increase the maximum)", max_tinst_depth, decl); if (TREE_CODE (decl) == FUNCTION_DECL) /* Pretend that we defined it. */ DECL_INITIAL (decl) = error_mark_node; return; } do { struct pending_template **t = &pending_templates; struct pending_template *last = NULL; reconsider = 0; while (*t) { tree instantiation = reopen_tinst_level ((*t)->tinst); bool complete = false; if (TYPE_P (instantiation)) { tree fn; if (!COMPLETE_TYPE_P (instantiation)) { instantiate_class_template (instantiation); if (CLASSTYPE_TEMPLATE_INSTANTIATION (instantiation)) for (fn = TYPE_METHODS (instantiation); fn; fn = TREE_CHAIN (fn)) if (! DECL_ARTIFICIAL (fn)) instantiate_decl (fn, /*defer_ok=*/0, /*expl_inst_class_mem_p=*/false); if (COMPLETE_TYPE_P (instantiation)) reconsider = 1; } complete = COMPLETE_TYPE_P (instantiation); } else { if (!DECL_TEMPLATE_SPECIALIZATION (instantiation) && !DECL_TEMPLATE_INSTANTIATED (instantiation)) { instantiation = instantiate_decl (instantiation, /*defer_ok=*/0, /*expl_inst_class_mem_p=*/false); if (DECL_TEMPLATE_INSTANTIATED (instantiation)) reconsider = 1; } complete = (DECL_TEMPLATE_SPECIALIZATION (instantiation) || DECL_TEMPLATE_INSTANTIATED (instantiation)); } if (complete) /* If INSTANTIATION has been instantiated, then we don't need to consider it again in the future. */ *t = (*t)->next; else { last = *t; t = &(*t)->next; } tinst_depth = 0; current_tinst_level = NULL; } last_pending_template = last; } while (reconsider); input_location = saved_loc; }
false
false
false
false
false
0
w_e_end_csum_rs_req(struct drbd_work *w, int cancel) { struct drbd_peer_request *peer_req = container_of(w, struct drbd_peer_request, w); struct drbd_peer_device *peer_device = peer_req->peer_device; struct drbd_device *device = peer_device->device; struct digest_info *di; int digest_size; void *digest = NULL; int err, eq = 0; if (unlikely(cancel)) { drbd_free_peer_req(device, peer_req); dec_unacked(device); return 0; } if (get_ldev(device)) { drbd_rs_complete_io(device, peer_req->i.sector); put_ldev(device); } di = peer_req->digest; if (likely((peer_req->flags & EE_WAS_ERROR) == 0)) { /* quick hack to try to avoid a race against reconfiguration. * a real fix would be much more involved, * introducing more locking mechanisms */ if (peer_device->connection->csums_tfm) { digest_size = crypto_hash_digestsize(peer_device->connection->csums_tfm); D_ASSERT(device, digest_size == di->digest_size); digest = kmalloc(digest_size, GFP_NOIO); } if (digest) { drbd_csum_ee(peer_device->connection->csums_tfm, peer_req, digest); eq = !memcmp(digest, di->digest, digest_size); kfree(digest); } if (eq) { drbd_set_in_sync(device, peer_req->i.sector, peer_req->i.size); /* rs_same_csums unit is BM_BLOCK_SIZE */ device->rs_same_csum += peer_req->i.size >> BM_BLOCK_SHIFT; err = drbd_send_ack(peer_device, P_RS_IS_IN_SYNC, peer_req); } else { inc_rs_pending(device); peer_req->block_id = ID_SYNCER; /* By setting block_id, digest pointer becomes invalid! */ peer_req->flags &= ~EE_HAS_DIGEST; /* This peer request no longer has a digest pointer */ kfree(di); err = drbd_send_block(peer_device, P_RS_DATA_REPLY, peer_req); } } else { err = drbd_send_ack(peer_device, P_NEG_RS_DREPLY, peer_req); if (__ratelimit(&drbd_ratelimit_state)) drbd_err(device, "Sending NegDReply. I guess it gets messy.\n"); } dec_unacked(device); move_to_net_ee_or_free(device, peer_req); if (unlikely(err)) drbd_err(device, "drbd_send_block/ack() failed\n"); return err; }
false
false
false
false
false
0
wcinc(const FXchar* string,FXint pos){ return (string[pos++]==0 || FXISUTF(string[pos]) || string[pos++]==0 || FXISUTF(string[pos]) || string[pos++]==0 || FXISUTF(string[pos]) || string[pos++]==0 || FXISUTF(string[pos]) || string[pos++]==0 || FXISUTF(string[pos]) || ++pos), pos; }
false
false
false
false
false
0
der_put_general_string (unsigned char *p, size_t len, const general_string *str, size_t *size) { size_t slen = strlen(*str); if (len < slen) return ASN1_OVERFLOW; p -= slen; len -= slen; memcpy (p+1, *str, slen); *size = slen; return 0; }
false
false
false
false
false
0
init_nodemask_of_mempolicy(nodemask_t *mask) { struct mempolicy *mempolicy; int nid; if (!(mask && current->mempolicy)) return false; task_lock(current); mempolicy = current->mempolicy; switch (mempolicy->mode) { case MPOL_PREFERRED: if (mempolicy->flags & MPOL_F_LOCAL) nid = numa_node_id(); else nid = mempolicy->v.preferred_node; init_nodemask_of_node(mask, nid); break; case MPOL_BIND: /* Fall through */ case MPOL_INTERLEAVE: *mask = mempolicy->v.nodes; break; default: BUG(); } task_unlock(current); return true; }
false
false
false
false
false
0
attach(Solver& s, bool setOwner) { MinimizeConstraint* ret = new MinimizeConstraint(this, setOwner); ret->attach(s); return ret; }
false
false
false
false
false
0
getorder(const char *restrict script, const char mode) { dir_t * dir = findscript(script); int order = 0; if (dir) { handle_t * peg = (mode == 'K') ? &dir->stopp : &dir->start; order = peg->deep; } return order; }
false
false
false
false
false
0
__hypotl(long double x, long double y) { long double z; z = __ieee754_hypotl(x,y); if(__builtin_expect(!__finitel(z), 0) && __finitel(x) && __finitel(y) && _LIB_VERSION != _IEEE_) return __kernel_standard_l(x, y, 204); /* hypot overflow */ return z; }
false
false
false
false
false
0
output_tagged_type_instantiation (type) tree type; { if (type == 0 || type == error_mark_node) return; /* We are going to output a DIE to represent the unqualified version of this type (i.e. without any const or volatile qualifiers) so make sure that we have the main variant (i.e. the unqualified version) of this type now. */ if (type != type_main_variant (type)) abort (); if (!TREE_ASM_WRITTEN (type)) abort (); switch (TREE_CODE (type)) { case ERROR_MARK: break; case ENUMERAL_TYPE: output_die (output_inlined_enumeration_type_die, type); break; case RECORD_TYPE: output_die (output_inlined_structure_type_die, type); break; case UNION_TYPE: case QUAL_UNION_TYPE: output_die (output_inlined_union_type_die, type); break; default: abort (); /* Should never happen. */ } }
false
false
false
false
false
0
ExecEvalParam(ExprState *exprstate, ExprContext *econtext, bool *isNull, ExprDoneCond *isDone) { Param *expression = (Param *) exprstate->expr; int thisParamId = expression->paramid; if (isDone) *isDone = ExprSingleResult; if (expression->paramkind == PARAM_EXEC) { /* * PARAM_EXEC params (internal executor parameters) are stored in the * ecxt_param_exec_vals array, and can be accessed by array index. */ ParamExecData *prm; prm = &(econtext->ecxt_param_exec_vals[thisParamId]); if (prm->execPlan != NULL) { /* Parameter not evaluated yet, so go do it */ ExecSetParamPlan(prm->execPlan, econtext); /* ExecSetParamPlan should have processed this param... */ Assert(prm->execPlan == NULL); } *isNull = prm->isnull; return prm->value; } else { /* * PARAM_EXTERN parameters must be sought in ecxt_param_list_info. */ ParamListInfo paramInfo = econtext->ecxt_param_list_info; Assert(expression->paramkind == PARAM_EXTERN); if (paramInfo && thisParamId > 0 && thisParamId <= paramInfo->numParams) { ParamExternData *prm = &paramInfo->params[thisParamId - 1]; if (OidIsValid(prm->ptype)) { Assert(prm->ptype == expression->paramtype); *isNull = prm->isnull; return prm->value; } } ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("no value found for parameter %d", thisParamId))); return (Datum) 0; /* keep compiler quiet */ } }
false
false
false
false
false
0
znotify(i_ctx_t *i_ctx_p) { os_ptr op = osp; gs_context_t *current = (gs_context_t *)i_ctx_p; gs_condition_t *pcond; check_stype(*op, st_condition); pcond = r_ptr(op, gs_condition_t); if_debug1('"', "[\"]notify 0x%lx\n", (ulong) pcond); pop(1); op--; if (pcond->waiting.head_index == 0) /* nothing to do */ return 0; activate_waiting(current->scheduler, &pcond->waiting); return zyield(i_ctx_p); }
false
false
false
false
false
0
write_infokey_file (FILE *fp, struct sect *sections) { /* Get rid of sections with no effect. */ if (sections[info].cur == 1 && sections[info].data[0] == 0) sections[info].cur = 0; if (sections[ea].cur == 1 && sections[ea].data[0] == 0) sections[ea].cur = 0; /* Write all parts of the file out in order (no lseeks), checking for errors all the way. */ return fputc (INFOKEY_MAGIC_S0, fp) != EOF && fputc (INFOKEY_MAGIC_S1, fp) != EOF && fputc (INFOKEY_MAGIC_S2, fp) != EOF && fputc (INFOKEY_MAGIC_S3, fp) != EOF && fputs (VERSION, fp) != EOF && fputc ('\0', fp) != EOF && putsect (&sections[info], INFOKEY_SECTION_INFO, fp) && putsect (&sections[ea], INFOKEY_SECTION_EA, fp) && putsect (&sections[var], INFOKEY_SECTION_VAR, fp) && fputc (INFOKEY_MAGIC_E0, fp) != EOF && fputc (INFOKEY_MAGIC_E1, fp) != EOF && fputc (INFOKEY_MAGIC_E2, fp) != EOF && fputc (INFOKEY_MAGIC_E3, fp) != EOF; }
false
false
false
false
false
0
reset() { if (m_threaded) { m_threadSetMutex.lock(); for (set<ProcessThread *>::iterator i = m_threadSet.begin(); i != m_threadSet.end(); ++i) { if (m_debugLevel > 0) { cerr << "RubberBandStretcher::~RubberBandStretcher: joining (channel " << *i << ")" << endl; } (*i)->abandon(); (*i)->wait(); delete *i; } m_threadSet.clear(); } for (size_t c = 0; c < m_channels; ++c) { m_channelData[c]->reset(); } m_mode = JustCreated; if (m_phaseResetAudioCurve) m_phaseResetAudioCurve->reset(); if (m_stretchAudioCurve) m_stretchAudioCurve->reset(); if (m_silentAudioCurve) m_silentAudioCurve->reset(); m_inputDuration = 0; m_silentHistory = 0; if (m_threaded) m_threadSetMutex.unlock(); reconfigure(); }
false
false
false
false
false
0
rapl_init_domains(struct rapl_package *rp) { int i; struct rapl_domain *rd = rp->domains; for (i = 0; i < RAPL_DOMAIN_MAX; i++) { unsigned int mask = rp->domain_map & (1 << i); switch (mask) { case BIT(RAPL_DOMAIN_PACKAGE): rd->name = rapl_domain_names[RAPL_DOMAIN_PACKAGE]; rd->id = RAPL_DOMAIN_PACKAGE; rd->msrs[0] = MSR_PKG_POWER_LIMIT; rd->msrs[1] = MSR_PKG_ENERGY_STATUS; rd->msrs[2] = MSR_PKG_PERF_STATUS; rd->msrs[3] = 0; rd->msrs[4] = MSR_PKG_POWER_INFO; rd->rpl[0].prim_id = PL1_ENABLE; rd->rpl[0].name = pl1_name; rd->rpl[1].prim_id = PL2_ENABLE; rd->rpl[1].name = pl2_name; break; case BIT(RAPL_DOMAIN_PP0): rd->name = rapl_domain_names[RAPL_DOMAIN_PP0]; rd->id = RAPL_DOMAIN_PP0; rd->msrs[0] = MSR_PP0_POWER_LIMIT; rd->msrs[1] = MSR_PP0_ENERGY_STATUS; rd->msrs[2] = 0; rd->msrs[3] = MSR_PP0_POLICY; rd->msrs[4] = 0; rd->rpl[0].prim_id = PL1_ENABLE; rd->rpl[0].name = pl1_name; break; case BIT(RAPL_DOMAIN_PP1): rd->name = rapl_domain_names[RAPL_DOMAIN_PP1]; rd->id = RAPL_DOMAIN_PP1; rd->msrs[0] = MSR_PP1_POWER_LIMIT; rd->msrs[1] = MSR_PP1_ENERGY_STATUS; rd->msrs[2] = 0; rd->msrs[3] = MSR_PP1_POLICY; rd->msrs[4] = 0; rd->rpl[0].prim_id = PL1_ENABLE; rd->rpl[0].name = pl1_name; break; case BIT(RAPL_DOMAIN_DRAM): rd->name = rapl_domain_names[RAPL_DOMAIN_DRAM]; rd->id = RAPL_DOMAIN_DRAM; rd->msrs[0] = MSR_DRAM_POWER_LIMIT; rd->msrs[1] = MSR_DRAM_ENERGY_STATUS; rd->msrs[2] = MSR_DRAM_PERF_STATUS; rd->msrs[3] = 0; rd->msrs[4] = MSR_DRAM_POWER_INFO; rd->rpl[0].prim_id = PL1_ENABLE; rd->rpl[0].name = pl1_name; rd->domain_energy_unit = rapl_defaults->dram_domain_energy_unit; if (rd->domain_energy_unit) pr_info("DRAM domain energy unit %dpj\n", rd->domain_energy_unit); break; } if (mask) { rd->package_id = rp->id; rd++; } } }
false
false
false
false
false
0
closeout() { char *saveoutptr; if (outstage == 3) { saveoutptr = outbufptr; flushout(); /* buffer from last stage */ outbufptr = saveoutptr; } outstage = 0; /* flush from top to current ptr */ flushout(); close(output); }
true
true
false
false
false
1
ResolveTimeout() { double timeout = this->TestProperties->Timeout; if(this->CTest->GetStopTime() == "") { return timeout; } struct tm* lctime; time_t current_time = time(0); lctime = gmtime(&current_time); int gm_hour = lctime->tm_hour; time_t gm_time = mktime(lctime); lctime = localtime(&current_time); int local_hour = lctime->tm_hour; int tzone_offset = local_hour - gm_hour; if(gm_time > current_time && gm_hour < local_hour) { // this means gm_time is on the next day tzone_offset -= 24; } else if(gm_time < current_time && gm_hour > local_hour) { // this means gm_time is on the previous day tzone_offset += 24; } tzone_offset *= 100; char buf[1024]; // add todays year day and month to the time in str because // curl_getdate no longer assumes the day is today sprintf(buf, "%d%02d%02d %s %+05i", lctime->tm_year + 1900, lctime->tm_mon + 1, lctime->tm_mday, this->CTest->GetStopTime().c_str(), tzone_offset); time_t stop_time = curl_getdate(buf, &current_time); if(stop_time == -1) { return timeout; } //the stop time refers to the next day if(this->CTest->NextDayStopTime) { stop_time += 24*60*60; } int stop_timeout = static_cast<int>(stop_time - current_time) % (24*60*60); this->CTest->LastStopTimeout = stop_timeout; if(stop_timeout <= 0 || stop_timeout > this->CTest->LastStopTimeout) { cmCTestLog(this->CTest, ERROR_MESSAGE, "The stop time has been passed. " "Stopping all tests." << std::endl); this->StopTimePassed = true; return 0; } return timeout == 0 ? stop_timeout : (timeout < stop_timeout ? timeout : stop_timeout); }
false
false
false
false
false
0
StartNamespaceDeclHandler ( void * userData, XMP_StringPtr prefix, XMP_StringPtr uri ) { IgnoreParam(userData); // As a bug fix hack, change a URI of "http://purl.org/dc/1.1/" to ""http://purl.org/dc/elements/1.1/. // Early versions of Flash that put XMP in SWF used a bad URI for the dc: namespace. ExpatAdapter * thiz = (ExpatAdapter*)userData; if ( prefix == 0 ) prefix = "_dflt_"; // Have default namespace. if ( uri == 0 ) return; // Ignore, have xmlns:pre="", no URI to register. #if XMP_DebugBuild & DumpXMLParseEvents if ( thiz->parseLog != 0 ) { PrintIndent ( thiz->parseLog, thiz->elemNesting ); fprintf ( thiz->parseLog, "StartNamespace: %s - \"%s\"\n", prefix, uri ); } #endif if ( XMP_LitMatch ( uri, "http://purl.org/dc/1.1/" ) ) uri = "http://purl.org/dc/elements/1.1/"; (void) thiz->registeredNamespaces->Define ( uri, prefix, 0, 0 ); }
false
false
false
false
false
0
lookup_name(const char *s, const char * const names[], int max) { int i; if (names && *s > '9') { for (i = 0; names[i]; i++) { if (!strcasecmp(s, names[i])) { return i; } } } /* Allow months and weekdays to be specified as numbers, as well */ if (sscanf(s, "%2d", &i) == 1 && i >= 1 && i <= max) { /* What the array offset would have been: "1" would be at offset 0 */ return i - 1; } return -1; /* error return */ }
false
false
false
false
false
0
evg_surface_set_clipper(GF_SURFACE _this , GF_IRect *rc) { EVGSurface *surf = (EVGSurface *)_this; if (!surf) return GF_BAD_PARAM; if (rc) { surf->clipper = *rc; surf->useClipper = 1; /*clipper was given in BIFS like coords, we work with bottom-min for rect, (0,0) top-left of surface*/ if (surf->center_coords) { surf->clipper.x += surf->width / 2; surf->clipper.y = surf->height / 2 - rc->y; } else { surf->clipper.y -= rc->height; } if (surf->clipper.x <=0) { if (surf->clipper.x + (s32) surf->clipper.width < 0) return GF_BAD_PARAM; surf->clipper.width += surf->clipper.x; surf->clipper.x = 0; } if (surf->clipper.y <=0) { if (surf->clipper.y + (s32) surf->clipper.height < 0) return GF_BAD_PARAM; surf->clipper.height += surf->clipper.y; surf->clipper.y = 0; } if (surf->clipper.x + surf->clipper.width > (s32) surf->width) { surf->clipper.width = surf->width - surf->clipper.x; } if (surf->clipper.y + surf->clipper.height > (s32) surf->height) { surf->clipper.height = surf->height - surf->clipper.y; } } else { surf->useClipper = 0; } return GF_OK; }
false
false
false
false
false
0
sys_waitid(struct tcb *tcp) { siginfo_t si; if (entering(tcp)) { printxval(waitid_types, tcp->u_arg[0], "P_???"); tprintf(", %ld, ", tcp->u_arg[1]); } else { /* siginfo */ if (!tcp->u_arg[2]) tprintf("NULL"); else if (syserror(tcp)) tprintf("%#lx", tcp->u_arg[2]); else if (umove(tcp, tcp->u_arg[2], &si) < 0) tprintf("{???}"); else printsiginfo(&si, verbose(tcp)); /* options */ tprintf(", "); printflags(wait4_options, tcp->u_arg[3], "W???"); if (tcp->u_nargs > 4) { /* usage */ tprintf(", "); if (!tcp->u_arg[4]) tprintf("NULL"); else if (tcp->u_error) tprintf("%#lx", tcp->u_arg[4]); else printrusage(tcp, tcp->u_arg[4]); } } return 0; }
false
false
false
false
false
0
ima_mok_init(void) { pr_notice("Allocating IMA MOK and blacklist keyrings.\n"); ima_mok_keyring = keyring_alloc(".ima_mok", KUIDT_INIT(0), KGIDT_INIT(0), current_cred(), (KEY_POS_ALL & ~KEY_POS_SETATTR) | KEY_USR_VIEW | KEY_USR_READ | KEY_USR_WRITE | KEY_USR_SEARCH, KEY_ALLOC_NOT_IN_QUOTA, NULL); ima_blacklist_keyring = keyring_alloc(".ima_blacklist", KUIDT_INIT(0), KGIDT_INIT(0), current_cred(), (KEY_POS_ALL & ~KEY_POS_SETATTR) | KEY_USR_VIEW | KEY_USR_READ | KEY_USR_WRITE | KEY_USR_SEARCH, KEY_ALLOC_NOT_IN_QUOTA, NULL); if (IS_ERR(ima_mok_keyring) || IS_ERR(ima_blacklist_keyring)) panic("Can't allocate IMA MOK or blacklist keyrings."); set_bit(KEY_FLAG_TRUSTED_ONLY, &ima_mok_keyring->flags); set_bit(KEY_FLAG_TRUSTED_ONLY, &ima_blacklist_keyring->flags); return 0; }
false
false
false
false
false
0
samsung_sysfs_is_visible(struct kobject *kobj, struct attribute *attr, int idx) { struct device *dev = container_of(kobj, struct device, kobj); struct platform_device *pdev = to_platform_device(dev); struct samsung_laptop *samsung = platform_get_drvdata(pdev); bool ok = true; if (attr == &dev_attr_performance_level.attr) ok = !!samsung->config->performance_levels[0].name; if (attr == &dev_attr_battery_life_extender.attr) ok = !!(read_battery_life_extender(samsung) >= 0); if (attr == &dev_attr_usb_charge.attr) ok = !!(read_usb_charge(samsung) >= 0); if (attr == &dev_attr_lid_handling.attr) ok = !!(read_lid_handling(samsung) >= 0); return ok ? attr->mode : 0; }
false
false
false
false
false
0
aname_get_selstring(krb5_context context, krb5_const_principal aname, const char **contextp, char **selstring_out) { const char *current; char *end, *str; long num_comps, ind; const krb5_data *datap; struct k5buf selstring; size_t nlit; *selstring_out = NULL; if (**contextp != '[') { /* * No selstring part; use the principal name without realm. This is * problematic in many multiple-realm environments, but is how we've * historically done it. */ return krb5_unparse_name_flags(context, aname, KRB5_PRINCIPAL_UNPARSE_NO_REALM, selstring_out); } /* Advance past the '[' and read the number of components. */ current = *contextp + 1; errno = 0; num_comps = strtol(current, &end, 10); if (errno != 0 || num_comps < 0 || *end != ':') return KRB5_CONFIG_BADFORMAT; current = end; if (num_comps != aname->length) return KRB5_LNAME_NOTRANS; current++; k5_buf_init_dynamic(&selstring); while (TRUE) { /* Copy in literal characters up to the next $ or ]. */ nlit = strcspn(current, "$]"); k5_buf_add_len(&selstring, current, nlit); current += nlit; if (*current != '$') break; /* Expand $ substitution to a principal component. */ errno = 0; ind = strtol(current + 1, &end, 10); if (errno || ind > num_comps) break; current = end; datap = ind > 0 ? &aname->data[ind - 1] : &aname->realm; k5_buf_add_len(&selstring, datap->data, datap->length); } /* Check that we hit a ']' and not the end of the string. */ if (*current != ']') { k5_free_buf(&selstring); return KRB5_CONFIG_BADFORMAT; } str = k5_buf_data(&selstring); if (str == NULL) return ENOMEM; *contextp = current + 1; *selstring_out = str; return 0; }
false
false
false
false
false
0
decode_block_refinement(MJpegDecodeContext *s, DCTELEM *block, uint8_t *last_nnz, int ac_index, int16_t *quant_matrix, int ss, int se, int Al, int *EOBRUN) { int code, i=ss, j, sign, val, run; int last = FFMIN(se, *last_nnz); OPEN_READER(re, &s->gb); if(*EOBRUN) (*EOBRUN)--; else { for(;;i++) { UPDATE_CACHE(re, &s->gb); GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2) /* Progressive JPEG use AC coeffs from zero and this decoder sets offset 16 by default */ code -= 16; if(code & 0xF) { run = ((unsigned) code) >> 4; UPDATE_CACHE(re, &s->gb); val = SHOW_UBITS(re, &s->gb, 1); LAST_SKIP_BITS(re, &s->gb, 1); ZERO_RUN; j = s->scantable.permutated[i]; val--; block[j] = ((quant_matrix[j]^val)-val) << Al; if(i == se) { if(i > *last_nnz) *last_nnz = i; CLOSE_READER(re, &s->gb) return 0; } }else{ run = ((unsigned) code) >> 4; if(run == 0xF){ ZERO_RUN; }else{ val = run; run = (1 << run); if(val) { UPDATE_CACHE(re, &s->gb); run += SHOW_UBITS(re, &s->gb, val); LAST_SKIP_BITS(re, &s->gb, val); } *EOBRUN = run - 1; break; } } } if(i > *last_nnz) *last_nnz = i; } for(;i<=last;i++) { j = s->scantable.permutated[i]; if(block[j]) REFINE_BIT(j) } CLOSE_READER(re, &s->gb); return 0; }
false
false
false
false
false
0
absolute_path(const char *path) { static char buf[PATH_MAX + 1]; if (is_absolute_path(path)) { if (strlcpy(buf, path, PATH_MAX) >= PATH_MAX) die("Too long path: %.*s", 60, path); } else { size_t len; const char *fmt; const char *cwd = get_pwd_cwd(); if (!cwd) die_errno("Cannot determine the current working directory"); len = strlen(cwd); fmt = (len > 0 && is_dir_sep(cwd[len-1])) ? "%s%s" : "%s/%s"; if (snprintf(buf, PATH_MAX, fmt, cwd, path) >= PATH_MAX) die("Too long path: %.*s", 60, path); } return buf; }
false
false
false
false
false
0