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
fmap_dump_to_file(fmap_t *map, const char *tmpdir, char **outname, int *outfd) { char *tmpname; int tmpfd, ret; size_t pos = 0, len; cli_dbgmsg("fmap_dump_to_file: dumping fmap not backed by file...\n"); ret = cli_gentempfd(tmpdir, &tmpname, &tmpfd); if(ret != CL_SUCCESS) { cli_dbgmsg("fmap_dump_to_file: failed to generate temporary file.\n"); return ret; } do { const char *b; len = 0; b = fmap_need_off_once_len(map, pos, BUFSIZ, &len); pos += len; if(b && (len > 0)) { if (cli_writen(tmpfd, b, len) != len) { cli_warnmsg("fmap_dump_to_file: write failed to %s!\n", tmpname); close(tmpfd); unlink(tmpname); free(tmpname); return CL_EWRITE; } } } while (len > 0); if(lseek(tmpfd, 0, SEEK_SET) == -1) { cli_dbgmsg("fmap_dump_to_file: lseek failed\n"); } *outname = tmpname; *outfd = tmpfd; return CL_SUCCESS; }
false
false
false
false
false
0
GetGeneratorTarget(cmTarget* t) const { cmGeneratorTargetsType::const_iterator ti = this->GeneratorTargets.find(t); if(ti == this->GeneratorTargets.end()) { this->CMakeInstance->IssueMessage( cmake::INTERNAL_ERROR, "Missing cmGeneratorTarget instance!", cmListFileBacktrace()); return 0; } return ti->second; }
false
false
false
false
false
0
multi_version(Module_table *module_head, Lad_opt *lad_opt) { Module_table *mpt; for (mpt = module_head; mpt != NULL; mpt = mpt->next) { search_block_for_multi(mpt->block_head, NULL, 1, lad_opt); set_mt_num(mpt->block_head, 0); } }
false
false
false
false
false
0
plD_init_xw(PLStream *pls) { XwDev *dev; PLFLT pxlx, pxly; int xmin = 0; int xmax = PIXELS_X - 1; int ymin = 0; int ymax = PIXELS_Y - 1; dbug_enter("plD_init_xw"); pls->termin = 1; /* Is an interactive terminal */ pls->dev_flush = 1; /* Handle our own flushes */ pls->dev_fill0 = 1; /* Handle solid fills */ pls->plbuf_write = 1; /* Activate plot buffer */ pls->dev_fastimg = 1; /* is a fast image device */ pls->dev_xor = 1; /* device support xor mode */ #ifndef HAVE_PTHREAD usepthreads = 0; #endif plParseDrvOpts(xwin_options); #ifndef HAVE_PTHREAD if(usepthreads) plwarn("You said you want pthreads, but they are not available."); #endif if (nobuffered) pls->plbuf_write = 0; /* desactivate plot buffer */ /* The real meat of the initialization done here */ if (pls->dev == NULL) OpenXwin(pls); dev = (XwDev *) pls->dev; Init(pls); /* Get ready for plotting */ dev->xlen = xmax - xmin; dev->ylen = ymax - ymin; dev->xscale_init = dev->init_width / (double) dev->xlen; dev->yscale_init = dev->init_height / (double) dev->ylen; dev->xscale = dev->xscale_init; dev->yscale = dev->yscale_init; #if PHYSICAL pxlx = DPMM/dev->xscale; pxly = DPMM/dev->yscale; #else pxlx = (double) PIXELS_X / LPAGE_X; pxly = (double) PIXELS_Y / LPAGE_Y; #endif plP_setpxl(pxlx, pxly); plP_setphy(xmin, xmax, ymin, ymax); #ifdef HAVE_PTHREAD if (usepthreads) { pthread_mutexattr_t mutexatt; pthread_attr_t pthattr; if (!already) { pthread_mutexattr_init(&mutexatt); if( pthread_mutexattr_settype(&mutexatt, PLPLOT_MUTEX_RECURSIVE) ) plexit("xwin: pthread_mutexattr_settype() failed!\n"); pthread_mutex_init(&events_mutex, &mutexatt); already = 1; } else { pthread_mutex_lock(&events_mutex); already++; pthread_mutex_unlock(&events_mutex); } pthread_attr_init(&pthattr); pthread_attr_setdetachstate(&pthattr, PTHREAD_CREATE_JOINABLE); if (pthread_create(&(dev->updater), &pthattr, (void *) &events_thread, (void *) pls)) { pthread_mutex_lock(&events_mutex); already--; pthread_mutex_unlock(&events_mutex); if (already == 0) { pthread_mutex_destroy(&events_mutex); plexit("xwin: pthread_create() failed!\n"); } else plwarn("xwin: couldn't create thread for this plot window!\n"); } } #endif }
false
false
false
false
false
0
read_stats(int curr) { DIR *dir; struct dirent *drp; unsigned int p = 0, q, pid, thr_nr; struct pid_stats *pst; struct stats_cpu *st_cpu; /* * Allocate two structures for CPU statistics. * No need to init them (done by read_stat_cpu() function). */ if ((st_cpu = (struct stats_cpu *) malloc(STATS_CPU_SIZE * 2)) == NULL) { perror("malloc"); exit(4); } /* Read statistics for CPUs "all" and 0 */ read_stat_cpu(st_cpu, 2, &uptime[curr], &uptime0[curr]); free(st_cpu); if (DISPLAY_ALL_PID(pidflag)) { /* Open /proc directory */ if ((dir = opendir(PROC)) == NULL) { perror("opendir"); exit(4); } while (p < pid_nr) { /* Get directory entries */ while ((drp = readdir(dir)) != NULL) { if (isdigit(drp->d_name[0])) break; } if (drp) { pst = st_pid_list[curr] + p++; pid = atoi(drp->d_name); if (read_pid_stats(pid, pst, &thr_nr, 0)) { /* Process has terminated */ pst->pid = 0; } else if (DISPLAY_TID(pidflag)) { /* Read stats for threads in task subdirectory */ read_task_stats(curr, pid, &p); } } else { for (q = p; q < pid_nr; q++) { pst = st_pid_list[curr] + q; pst->pid = 0; } break; } } /* Close /proc directory */ closedir(dir); } else if (DISPLAY_PID(pidflag)) { unsigned int op; /* Read stats for each PID in the list */ for (op = 0; op < pid_array_nr; op++) { if (p >= pid_nr) break; pst = st_pid_list[curr] + p++; if (pid_array[op]) { /* PID should still exist. So read its stats */ if (read_pid_stats(pid_array[op], pst, &thr_nr, 0)) { /* PID has terminated */ pst->pid = 0; pid_array[op] = 0; } else if (DISPLAY_TID(pidflag)) { read_task_stats(curr, pid_array[op], &p); } } } /* Reset remaining structures */ for (q = p; q < pid_nr; q++) { pst = st_pid_list[curr] + q; pst->pid = 0; } } /* else unknown command */ }
false
false
false
false
true
1
unload_plugin_cb (char *word[], char *word_eol[], void *userdata) { RemoteObject *obj; obj = g_hash_table_find (clients, clients_find_filename_foreach, word[2]); if (obj != NULL) { g_signal_emit (obj, signals[UNLOAD_SIGNAL], 0); return HEXCHAT_EAT_ALL; } return HEXCHAT_EAT_NONE; }
false
false
false
false
false
0
ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *scsidev, int cmd, void __user *arg) { unsigned long val; int rc = -EINVAL; unsigned long flags; switch (cmd) { case HDIO_GET_32BIT: spin_lock_irqsave(ap->lock, flags); val = ata_ioc32(ap); spin_unlock_irqrestore(ap->lock, flags); return put_user(val, (unsigned long __user *)arg); case HDIO_SET_32BIT: val = (unsigned long) arg; rc = 0; spin_lock_irqsave(ap->lock, flags); if (ap->pflags & ATA_PFLAG_PIO32CHANGE) { if (val) ap->pflags |= ATA_PFLAG_PIO32; else ap->pflags &= ~ATA_PFLAG_PIO32; } else { if (val != ata_ioc32(ap)) rc = -EINVAL; } spin_unlock_irqrestore(ap->lock, flags); return rc; case HDIO_GET_IDENTITY: return ata_get_identity(ap, scsidev, arg); case HDIO_DRIVE_CMD: if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO)) return -EACCES; return ata_cmd_ioctl(scsidev, arg); case HDIO_DRIVE_TASK: if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO)) return -EACCES; return ata_task_ioctl(scsidev, arg); default: rc = -ENOTTY; break; } return rc; }
false
false
false
false
false
0
header_dlmodEntry(struct variable *vp, oid * name, size_t * length, int exact, size_t * var_len, WriteMethod ** write_method) { #define DLMODENTRY_NAME_LENGTH 12 oid newname[MAX_OID_LEN]; int result; struct dlmod *dlm = NULL; unsigned int dlmod_index; memcpy((char *) newname, (char *) vp->name, (int) vp->namelen * sizeof(oid)); *write_method = 0; for (dlmod_index = 1; dlmod_index < dlmod_next_index; dlmod_index++) { dlm = dlmod_get_by_index(dlmod_index); DEBUGMSGTL(("dlmod", "dlmodEntry dlm: %p dlmod_index: %d\n", dlm, dlmod_index)); if (dlm) { newname[12] = dlmod_index; result = snmp_oid_compare(name, *length, newname, (int) vp->namelen + 1); if ((exact && (result == 0)) || (!exact && (result < 0))) break; } } if (dlmod_index >= dlmod_next_index) { if (dlmod_index == dlmod_next_index && exact && vp->magic == DLMODSTATUS) *write_method = write_dlmodStatus; return NULL; } memcpy((char *) name, (char *) newname, ((int) vp->namelen + 1) * sizeof(oid)); *length = vp->namelen + 1; *var_len = sizeof(long); return dlm; }
false
false
false
false
false
0
getItemElement ( const stringc& key ) { const SItemElement *item = Quake3ItemElement; while ( item->key[0] ) { if ( 0 == strcmp ( key.c_str(), item->key ) ) return item; item += 1; } return 0; }
false
false
false
false
false
0
format(Area::size_type w, int /*halign*/ ) const { if (!items.get()) return 0; static ListFormat lf("MENU", 0, 0, 0, "2", "NO_BULLET"); int type = lf.get_type(attributes.get(), nesting, NO_BULLET); auto_ptr<Area> res; const list<auto_ptr<ListItem> > &il(*items); list<auto_ptr<ListItem> >::const_iterator i; for (i = il.begin(); i != il.end(); ++i) { auto_ptr<Area> a((*i)->format(w, type, lf.get_indent(nesting))); if (a.get()) { if (res.get()) { res->append(lf.vspace_between); } else { res.reset(new Area); res->append(lf.vspace_before); } *res += *a; } } if (res.get()) res->append(lf.vspace_after); return res.release(); }
false
false
false
false
false
0
aliases(Objid oid) { Var value; db_prop_handle h; h = db_find_property(oid, "aliases", &value); if (!h.ptr || value.type != TYPE_LIST) { /* Simulate a pointer to an empty list */ return &zero; } else return value.v.list; }
false
false
false
false
false
0
main() { LpSolver::printList(Stderr); lpSetSolver("cddgmp"); FileParser P(Stdin); PolynomialRing theRing=P.parsePolynomialRing(); PolynomialSet a=P.parsePolynomialSet(theRing); PolynomialSet b=P.parsePolynomialSet(theRing); PolynomialSet ret(theRing); for(PolynomialSet::const_iterator i=a.begin();i!=a.end();i++) for(PolynomialSet::const_iterator j=b.begin();j!=b.end();j++) { ret.push_back(*i * *j); } pout<<ret; return 0; }
false
false
false
false
false
0
vmw_surface_define_encode(const struct vmw_surface *srf, void *cmd_space) { struct vmw_surface_define *cmd = (struct vmw_surface_define *) cmd_space; struct drm_vmw_size *src_size; SVGA3dSize *cmd_size; uint32_t cmd_len; int i; cmd_len = sizeof(cmd->body) + srf->num_sizes * sizeof(SVGA3dSize); cmd->header.id = SVGA_3D_CMD_SURFACE_DEFINE; cmd->header.size = cmd_len; cmd->body.sid = srf->res.id; cmd->body.surfaceFlags = srf->flags; cmd->body.format = srf->format; for (i = 0; i < DRM_VMW_MAX_SURFACE_FACES; ++i) cmd->body.face[i].numMipLevels = srf->mip_levels[i]; cmd += 1; cmd_size = (SVGA3dSize *) cmd; src_size = srf->sizes; for (i = 0; i < srf->num_sizes; ++i, cmd_size++, src_size++) { cmd_size->width = src_size->width; cmd_size->height = src_size->height; cmd_size->depth = src_size->depth; } }
false
false
false
false
false
0
transaction_list_select_get ( void ) { CustomRecord *record; CustomList *custom_list; custom_list = transaction_model_get_model (); g_return_val_if_fail ( custom_list != NULL, FALSE ); record = custom_list -> selected_row; if (!record) return -1; return gsb_data_transaction_get_transaction_number (record -> transaction_pointer); }
false
false
false
false
false
0
PredicateLockTuple(Relation relation, HeapTuple tuple, Snapshot snapshot) { PREDICATELOCKTARGETTAG tag; ItemPointer tid; TransactionId targetxmin; if (!SerializationNeededForRead(relation, snapshot)) return; /* * If it's a heap tuple, return if this xact wrote it. */ if (relation->rd_index == NULL) { TransactionId myxid; targetxmin = HeapTupleHeaderGetXmin(tuple->t_data); myxid = GetTopTransactionIdIfAny(); if (TransactionIdIsValid(myxid)) { if (TransactionIdFollowsOrEquals(targetxmin, TransactionXmin)) { TransactionId xid = SubTransGetTopmostTransaction(targetxmin); if (TransactionIdEquals(xid, myxid)) { /* We wrote it; we already have a write lock. */ return; } } } } /* * Do quick-but-not-definitive test for a relation lock first. This will * never cause a return when the relation is *not* locked, but will * occasionally let the check continue when there really *is* a relation * level lock. */ SET_PREDICATELOCKTARGETTAG_RELATION(tag, relation->rd_node.dbNode, relation->rd_id); if (PredicateLockExists(&tag)) return; tid = &(tuple->t_self); SET_PREDICATELOCKTARGETTAG_TUPLE(tag, relation->rd_node.dbNode, relation->rd_id, ItemPointerGetBlockNumber(tid), ItemPointerGetOffsetNumber(tid)); PredicateLockAcquire(&tag); }
false
false
false
false
false
0
icalvalue_set_recur(icalvalue* value, struct icalrecurrencetype v) { struct icalvalue_impl* impl; icalerror_check_arg_rv( (value!=0),"value"); icalerror_check_value_type(value, ICAL_RECUR_VALUE); impl = (struct icalvalue_impl*)value; if (impl->data.v_recur != 0){ free(impl->data.v_recur); impl->data.v_recur = 0; } impl->data.v_recur = malloc(sizeof(struct icalrecurrencetype)); if (impl->data.v_recur == 0){ icalerror_set_errno(ICAL_NEWFAILED_ERROR); return; } else { memcpy(impl->data.v_recur, &v, sizeof(struct icalrecurrencetype)); } }
false
false
false
false
false
0
RunTask(void*arg) { Thread* thread = static_cast<Thread*>(arg); ITask * task = thread->task_; if (task == NULL) return NULL; atomic_cas(&thread->busy_, 0, 1); pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,NULL); task->Run(); atomic_cas(&thread->busy_, 1, 0); return task; }
false
false
false
false
false
0
u_strncmpNoCase(const UChar *s1, const UChar *s2, int32_t n) { if(n > 0) { int32_t rc; for(;;) { rc = (int32_t)u_tolower(*s1) - (int32_t)u_tolower(*s2); if(rc != 0 || *s1 == 0 || --n == 0) { return rc; } ++s1; ++s2; } } return 0; }
false
false
false
false
false
0
add (pIIR_TextLiteral id) { for (int i = 0; i < n_ids; i++) if (ids[i] == NULL) { ids[i] = id; return; } ids = (pIIR_TextLiteral *)vaul_xrealloc (ids, (n_ids+1)*sizeof(pIIR_TextLiteral *)); ids[n_ids++] = id; }
false
false
false
false
false
0
load_colors(name) char_u *name; { char_u *buf; int retval = FAIL; static int recursive = FALSE; /* When being called recursively, this is probably because setting * 'background' caused the highlighting to be reloaded. This means it is * working, thus we should return OK. */ if (recursive) return OK; recursive = TRUE; buf = alloc((unsigned)(STRLEN(name) + 12)); if (buf != NULL) { sprintf((char *)buf, "colors/%s.vim", name); retval = source_runtime(buf, FALSE); vim_free(buf); #ifdef FEAT_AUTOCMD apply_autocmds(EVENT_COLORSCHEME, NULL, NULL, FALSE, curbuf); #endif } recursive = FALSE; return retval; }
false
false
false
false
false
0
gnl_composition_change_state (GstElement * element, GstStateChange transition) { GnlComposition *comp = (GnlComposition *) element; GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; GST_DEBUG_OBJECT (comp, "%s => %s", gst_element_state_get_name (GST_STATE_TRANSITION_CURRENT (transition)), gst_element_state_get_name (GST_STATE_TRANSITION_NEXT (transition))); switch (transition) { case GST_STATE_CHANGE_NULL_TO_READY: comp->priv->running = TRUE; comp->priv->update_pipeline_thread = g_thread_new ("update_pipeline_thread", (GThreadFunc) update_pipeline_func, comp); break; case GST_STATE_CHANGE_READY_TO_PAUSED: { GstIterator *children; gnl_composition_reset (comp); /* state-lock all elements */ GST_DEBUG_OBJECT (comp, "Setting all children to READY and locking their state"); children = gst_bin_iterate_elements (GST_BIN (comp)); retry_lock: if (G_UNLIKELY (gst_iterator_fold (children, (GstIteratorFoldFunction) lock_child_state, NULL, NULL) == GST_ITERATOR_RESYNC)) { gst_iterator_resync (children); goto retry_lock; } gst_iterator_free (children); /* Set caps on all objects */ if (G_UNLIKELY (!gst_caps_is_any (GNL_OBJECT (comp)->caps))) { children = gst_bin_iterate_elements (GST_BIN (comp)); retry_caps: if (G_UNLIKELY (gst_iterator_fold (children, (GstIteratorFoldFunction) set_child_caps, NULL, comp) == GST_ITERATOR_RESYNC)) { gst_iterator_resync (children); goto retry_caps; } gst_iterator_free (children); } /* set ghostpad target */ COMP_OBJECTS_LOCK (comp); if (!(update_pipeline (comp, COMP_REAL_START (comp), TRUE, FALSE, TRUE))) { ret = GST_STATE_CHANGE_FAILURE; COMP_OBJECTS_UNLOCK (comp); goto beach; } COMP_OBJECTS_UNLOCK (comp); } break; case GST_STATE_CHANGE_PAUSED_TO_READY: gnl_composition_reset (comp); break; case GST_STATE_CHANGE_READY_TO_NULL: gnl_composition_reset (comp); comp->priv->running = FALSE; SIGNAL_UPDATE_PIPELINE (comp); g_thread_join (comp->priv->update_pipeline_thread); break; default: break; } ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); if (ret == GST_STATE_CHANGE_FAILURE) return ret; switch (transition) { case GST_STATE_CHANGE_PAUSED_TO_READY: case GST_STATE_CHANGE_READY_TO_NULL: unblock_children (comp); break; default: break; } beach: return ret; }
false
false
false
false
false
0
Mask_Editor_List_Move_Down (void) { GtkTreeSelection *selection; GList *selectedRows; GList *l; GtkTreeIter currentFile; GtkTreeIter nextFile; GtkTreePath *currentPath; GtkTreeModel *treemodel; g_return_if_fail (MaskEditorList != NULL); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(MaskEditorList)); treemodel = gtk_tree_view_get_model(GTK_TREE_VIEW(MaskEditorList)); selectedRows = gtk_tree_selection_get_selected_rows(selection, NULL); if (!selectedRows) { Log_Print(LOG_ERROR,_("Move Down: No row selected")); return; } for (l = selectedRows; l != NULL; l = g_list_next (l)) { currentPath = (GtkTreePath *)l->data; if (gtk_tree_model_get_iter(treemodel, &currentFile, currentPath)) { /* Find the entry below the node and swap the two nodes by iter */ gtk_tree_path_next(currentPath); if (gtk_tree_model_get_iter(treemodel, &nextFile, currentPath)) gtk_list_store_swap(GTK_LIST_STORE(treemodel), &currentFile, &nextFile); } } g_list_free_full (selectedRows, (GDestroyNotify)gtk_tree_path_free); }
false
false
false
false
false
0
readAttribute(size_t startLinePos) { size_t endLinePos = headerString.find_first_of("\r\n", startLinePos); if(endLinePos == std::string::npos) return std::string::npos; size_t pos = headerString.find(':', startLinePos); if(pos > endLinePos) // ignore bad attributes return nextLine(endLinePos); std::string name(headerString, startLinePos, pos-startLinePos); // skip leading white space if ((name.compare("Set-Cookie") == 0) || (name.compare("Set-cookie") == 0)) { std::string ckline(headerString, startLinePos, endLinePos); cookiesString.append(ckline); } pos = headerString.find_first_not_of("\t ", pos+1); std::string value(headerString, pos, endLinePos-pos); (header.fields)[name] = value; return nextLine(endLinePos); }
false
false
false
false
false
0
setUInt(unsigned int *v, char *arg) { char *p; unsigned int i; i = (unsigned int) strtol(arg, &p, 10); if (p == arg) { fprintf(stderr, "Error: bad value in flag -%s - ignored\n", arg - 1); return 1; } *v = i; return 0; }
false
false
false
false
false
0
mboxdriver_fetch_header(mailsession * session, uint32_t indx, char ** result, size_t * result_len) { int r; char * msg_content; size_t msg_length; struct mailmbox_folder * folder; folder = session_get_mbox_session(session); if (folder == NULL) return MAIL_ERROR_BAD_STATE; r = mailmbox_fetch_msg_headers(folder, indx, &msg_content, &msg_length); if (r != MAILMBOX_NO_ERROR) return mboxdriver_mbox_error_to_mail_error(r); * result = msg_content; * result_len = msg_length; return MAIL_NO_ERROR; }
false
false
false
false
false
0
readHduInfo () { // Read BITPIX and NAXIS keywords int status = 0; char* comment = 0; int htype = -1; if (fits_get_hdu_type(fitsPointer(),&htype,&status)) throw FitsError(status); HduType xtype = HduType(htype); if (xtype == ImageHdu) { // Do not try and read BITPIX or NAXIS directly. If this is a // compressed image, the relevant information will need to come // from ZBITPIX and ZNAXIS instead. int temp = 0; if (fits_get_img_type(fitsPointer(), &temp, &status)) throw FitsError(status); m_bitpix = temp; if (fits_get_img_dim(fitsPointer(), &temp, &status)) throw FitsError(status); m_naxis = temp; } else { // m_bitpix will retain its default value, 8. string keyname("NAXIS"); if (fits_read_key_lng(fitsPointer(),const_cast<char*>(keyname.c_str()), &m_naxis, comment, &status)) throw FitsError(status); } // okay, we have the number of axes and therefore the number of values // (z)NAXISn. FITSUtil::auto_array_ptr<long> axes(new long[m_naxis]); long* pAxes = axes.get(); if (xtype == ImageHdu) { if (fits_get_img_size(fitsPointer(), m_naxis, pAxes, &status)) throw FitsError(status); } else { // create strings NAXIS1 - NAXISn, where n = NAXIS, and read keyword. for (int i=0; i <m_naxis; i++) { string keyname("NAXIS"); #ifdef SSTREAM_DEFECT std::ostrstream axisKey; axisKey << keyname << i+1 << std::ends; if (fits_read_key_lng(fitsPointer(),axisKey.str(),&pAxes[i],comment,&status) ) throw FitsError(status); #else std::ostringstream axisKey; axisKey << keyname << i+1; if (fits_read_key_lng(fitsPointer(),const_cast<char*>(axisKey.str().c_str()), &pAxes[i],comment,&status) ) throw FitsError(status); #endif } } std::copy(&pAxes[0],&pAxes[m_naxis], std::back_inserter(m_naxes)); }
false
false
false
false
false
0
i915_gem_object_fence_ok(struct drm_i915_gem_object *obj, int tiling_mode) { u32 size; if (tiling_mode == I915_TILING_NONE) return true; if (INTEL_INFO(obj->base.dev)->gen >= 4) return true; if (INTEL_INFO(obj->base.dev)->gen == 3) { if (i915_gem_obj_ggtt_offset(obj) & ~I915_FENCE_START_MASK) return false; } else { if (i915_gem_obj_ggtt_offset(obj) & ~I830_FENCE_START_MASK) return false; } size = i915_gem_get_gtt_size(obj->base.dev, obj->base.size, tiling_mode); if (i915_gem_obj_ggtt_size(obj) != size) return false; if (i915_gem_obj_ggtt_offset(obj) & (size - 1)) return false; return true; }
false
false
false
false
false
0
_cfsml_write_menu_item_t(FILE *fh, menu_item_t* save_struc) { int min, max, i; fprintf(fh, "{\n"); fprintf(fh, "type = "); _cfsml_write_int(fh, (int*) &(save_struc->type)); fprintf(fh, "\n"); fprintf(fh, "keytext = "); _cfsml_write_string(fh, (char **) &(save_struc->keytext)); fprintf(fh, "\n"); fprintf(fh, "keytext_size = "); _cfsml_write_int(fh, (int*) &(save_struc->keytext_size)); fprintf(fh, "\n"); fprintf(fh, "flags = "); _cfsml_write_int(fh, (int*) &(save_struc->flags)); fprintf(fh, "\n"); fprintf(fh, "said = "); min = max = MENU_SAID_SPEC_SIZE; fprintf(fh, "[%d][\n", max); for (i = 0; i < min; i++) { _cfsml_write_byte(fh, &(save_struc->said[i])); fprintf(fh, "\n"); } fprintf(fh, "]"); fprintf(fh, "\n"); fprintf(fh, "said_pos = "); write_reg_t(fh, (reg_t*) &(save_struc->said_pos)); fprintf(fh, "\n"); fprintf(fh, "text = "); _cfsml_write_string(fh, (char **) &(save_struc->text)); fprintf(fh, "\n"); fprintf(fh, "text_pos = "); write_reg_t(fh, (reg_t*) &(save_struc->text_pos)); fprintf(fh, "\n"); fprintf(fh, "modifiers = "); _cfsml_write_int(fh, (int*) &(save_struc->modifiers)); fprintf(fh, "\n"); fprintf(fh, "key = "); _cfsml_write_int(fh, (int*) &(save_struc->key)); fprintf(fh, "\n"); fprintf(fh, "enabled = "); _cfsml_write_int(fh, (int*) &(save_struc->enabled)); fprintf(fh, "\n"); fprintf(fh, "tag = "); _cfsml_write_int(fh, (int*) &(save_struc->tag)); fprintf(fh, "\n"); fprintf(fh, "}"); }
false
false
false
false
false
0
removeManagedTopLevelWidget( const QWidget *topLevel ) { if ( !topLevel->isTopLevel() ) return; d->m_managedTopLevelWidgets.removeAll( topLevel ); }
false
false
false
false
false
0
cyber5kDrawLine( void *drv, void *dev, DFBRegion *line ) { CyberDriverData *cdrv = (CyberDriverData*) drv; CyberDeviceData *cdev = (CyberDeviceData*) dev; volatile u8 *mmio = cdrv->mmio_base; u32 cmd = COP_LINE_DRAW | PAT_FIXFGD; int dx; int dy; dx = line->x2 - line->x1; dy = line->y2 - line->y1; if (dx < 0) { dx = -dx; cmd |= DX_NEG; } if (dy < 0) { dy = -dy; cmd |= DY_NEG; } if (dx < dy) { int tmp; cmd |= YMAJOR; tmp = dx; dx = dy; dy = tmp; } cyber_waitidle( cdrv, cdev ); cyber_out32( mmio, DSTPTR, cdev->dst_pixeloffset + line->y1 * cdev->dst_pixelpitch + line->x1); cyber_out16( mmio, DIMW , dx); cyber_out16( mmio, K1 , 2*dy); cyber_out16( mmio, ERRORTERM, 2*dy-dx); cyber_out32( mmio, K2 ,2*(dy-dx)); cyber_out32( mmio, PIXOP , cmd); return true; }
false
false
false
false
false
0
vivid_rds_gen_fill(struct vivid_rds_gen *rds, unsigned freq, bool alt) { /* Alternate PTY between Info and Weather */ if (rds->use_rbds) { rds->picode = 0x2e75; /* 'KLNX' call sign */ rds->pty = alt ? 29 : 2; } else { rds->picode = 0x8088; rds->pty = alt ? 16 : 3; } rds->mono_stereo = true; rds->art_head = false; rds->compressed = false; rds->dyn_pty = false; rds->tp = true; rds->ta = alt; rds->ms = true; snprintf(rds->psname, sizeof(rds->psname), "%6d.%1d", freq / 16, ((freq & 0xf) * 10) / 16); if (alt) strlcpy(rds->radiotext, " The Radio Data System can switch between different Radio Texts ", sizeof(rds->radiotext)); else strlcpy(rds->radiotext, "An example of Radio Text as transmitted by the Radio Data System", sizeof(rds->radiotext)); }
false
false
false
false
false
0
NotifyStyleToNeeded(int endStyleNeeded) { #ifdef SCI_LEXER if (DocumentLexState()->lexLanguage != SCLEX_CONTAINER) { int lineEndStyled = pdoc->LineFromPosition(pdoc->GetEndStyled()); int endStyled = pdoc->LineStart(lineEndStyled); DocumentLexState()->Colourise(endStyled, endStyleNeeded); return; } #endif Editor::NotifyStyleToNeeded(endStyleNeeded); }
false
false
false
false
false
0
rd_port_tchk(FILE *f, struct tcterm_t *tctp) { char pnam[IDLEN]; int32 i1, i2, eval, ettyp; tctp->ti1 = tctp->ti2 = -1; tctp->cndnam = NULL; tctp->cndi1 = tctp->cndi2 = -1; tctp->cnd_op = UNDEF; tctp->cnd_const = -1; tctp->eval = NOEDGE; if (__toktyp == LPAR) { /* collects ID (maybe strange edge) into __token */ ettyp = rd_edge_ident(f); /* if (COND form contains port tchk */ if (ettyp == -1 && __toktyp == SDF_COND) return(rd_tchk_cond(f, tctp)); /* port_edge */ if (ettyp == -1) { __pv_ferr(1386, "port_edge edge expected - %s read", prt_sdftok()); return(FALSE); } tctp->eval = ettyp; get_sdftok(f); if (!rd_port_spec(f, pnam, &i1, &i2, &eval, TRUE)) return(FALSE); tctp->tnam = __pv_stralloc(pnam); tctp->ti1 = i1; tctp->ti2 = i2; tctp->eval = eval; if (__toktyp != RPAR) { __pv_ferr(1363, "port_edge ending ) expected - %s read", prt_sdftok()); return(FALSE); } get_sdftok(f); return(TRUE); } /* port_instance */ if (!rd_port(f, pnam, &i1, &i2)) return(FALSE); tctp->tnam = __pv_stralloc(pnam); tctp->ti1 = i1; tctp->ti2 = i2; return(TRUE); }
true
true
false
false
false
1
setData( const QModelIndex& index, const QVariant& value, int role ) { if( index.isValid() && index.column() == 0 && role == Qt::CheckStateRole ) { const QString path = filePath( index ); if( value.toInt() == Qt::Checked ) { // New path selected if( recursive() ) { // Recursive, so clear any paths in m_checked that are made // redundant by this new selection QString _path = normalPath( path ); foreach( QString elem, m_checked ) { if( normalPath( elem ).startsWith( _path ) ) m_checked.remove( elem ); } } m_checked << path; } else { // Path un-selected m_checked.remove( path ); if( recursive() && ancestorChecked( path ) ) { // Recursive, so we need to deal with the case of un-selecting // an implicitly selected path const QStringList ancestors = allCheckedAncestors( path ); QString topAncestor; // Remove all selected ancestor of path, and find shallowest // ancestor foreach( QString elem, ancestors ) { m_checked.remove( elem ); if( elem < topAncestor || topAncestor.isEmpty() ) topAncestor = elem; } // Check all paths reachable from topAncestor, except for // those that are ancestors of path checkRecursiveSubfolders( topAncestor, path ); } } // A check or un-check can possibly require the whole view to change, // so we signal that the root's data is changed emit dataChanged( QModelIndex(), QModelIndex() ); return true; } return QFileSystemModel::setData( index, value, role ); }
false
false
false
false
false
0
vm_map_ram(struct page **pages, unsigned int count, int node, pgprot_t prot) { unsigned long size = count << PAGE_SHIFT; unsigned long addr; void *mem; if (likely(count <= VMAP_MAX_ALLOC)) { mem = vb_alloc(size, GFP_KERNEL); if (IS_ERR(mem)) return NULL; addr = (unsigned long)mem; } else { struct vmap_area *va; va = alloc_vmap_area(size, PAGE_SIZE, VMALLOC_START, VMALLOC_END, node, GFP_KERNEL); if (IS_ERR(va)) return NULL; addr = va->va_start; mem = (void *)addr; } if (vmap_page_range(addr, addr + size, prot, pages) < 0) { vm_unmap_ram(mem, count); return NULL; } return mem; }
false
false
false
false
false
0
ig_decode_interactive(BITBUFFER *bb, BD_IG_INTERACTIVE *p) { BD_PG_SEQUENCE_DESCRIPTOR sd; pg_decode_video_descriptor(bb, &p->video_descriptor); pg_decode_composition_descriptor(bb, &p->composition_descriptor); pg_decode_sequence_descriptor(bb, &sd); if (!sd.first_in_seq) { BD_DEBUG(DBG_DECODE, "ig_decode_interactive(): not first in seq\n"); return 0; } if (!sd.last_in_seq) { BD_DEBUG(DBG_DECODE, "ig_decode_interactive(): not last in seq\n"); return 0; } if (!bb_is_align(bb, 0x07)) { BD_DEBUG(DBG_DECODE, "ig_decode_interactive(): alignment error\n"); return 0; } return _decode_interactive_composition(bb, &p->interactive_composition); }
false
false
false
false
false
0
inverse(CPosePDF &o) const { ASSERT_(o.GetRuntimeClass() == CLASS_ID(CPosePDFGaussian)); CPosePDFGaussian *out = static_cast<CPosePDFGaussian*>( &o ); // The mean: out->mean = CPose2D(0,0,0) - mean; // The covariance: const double ccos = ::cos(mean.phi()); const double ssin = ::sin(mean.phi()); // jacobian: MRPT_ALIGN16 const double H_values[] = { -ccos, -ssin, mean.x()*ssin-mean.y()*ccos, ssin, -ccos, mean.x()*ccos+mean.y()*ssin, 0 , 0, -1 }; const CMatrixFixedNumeric<double,3,3> H(H_values); out->cov.noalias() = (H * cov * H.adjoint()).eval(); // o.cov = H * cov * Ht }
false
false
false
false
false
0
check_flow(ushort childID, bool strict) { return check_block(childID, strict) || check_inline(childID, strict); }
false
false
false
false
false
0
sci_oem_parameters_validate(struct sci_oem_params *oem, u8 version) { int i; for (i = 0; i < SCI_MAX_PORTS; i++) if (oem->ports[i].phy_mask > SCIC_SDS_PARM_PHY_MASK_MAX) return -EINVAL; for (i = 0; i < SCI_MAX_PHYS; i++) if (oem->phys[i].sas_address.high == 0 && oem->phys[i].sas_address.low == 0) return -EINVAL; if (oem->controller.mode_type == SCIC_PORT_AUTOMATIC_CONFIGURATION_MODE) { for (i = 0; i < SCI_MAX_PHYS; i++) if (oem->ports[i].phy_mask != 0) return -EINVAL; } else if (oem->controller.mode_type == SCIC_PORT_MANUAL_CONFIGURATION_MODE) { u8 phy_mask = 0; for (i = 0; i < SCI_MAX_PHYS; i++) phy_mask |= oem->ports[i].phy_mask; if (phy_mask == 0) return -EINVAL; } else return -EINVAL; if (oem->controller.max_concurr_spin_up > MAX_CONCURRENT_DEVICE_SPIN_UP_COUNT || oem->controller.max_concurr_spin_up < 1) return -EINVAL; if (oem->controller.do_enable_ssc) { if (version < ISCI_ROM_VER_1_1 && oem->controller.do_enable_ssc != 1) return -EINVAL; if (version >= ISCI_ROM_VER_1_1) { u8 test = oem->controller.ssc_sata_tx_spread_level; switch (test) { case 0: case 2: case 3: case 6: case 7: break; default: return -EINVAL; } test = oem->controller.ssc_sas_tx_spread_level; if (oem->controller.ssc_sas_tx_type == 0) { switch (test) { case 0: case 2: case 3: break; default: return -EINVAL; } } else if (oem->controller.ssc_sas_tx_type == 1) { switch (test) { case 0: case 3: case 6: break; default: return -EINVAL; } } } } return 0; }
false
false
false
false
false
0
basic_map_identity(__isl_take isl_space *dims) { struct isl_basic_map *bmap; unsigned nparam; unsigned dim; int i; if (!dims) return NULL; nparam = dims->nparam; dim = dims->n_out; bmap = isl_basic_map_alloc_space(dims, 0, dim, 0); if (!bmap) goto error; for (i = 0; i < dim; ++i) { int j = isl_basic_map_alloc_equality(bmap); if (j < 0) goto error; isl_seq_clr(bmap->eq[j], 1 + isl_basic_map_total_dim(bmap)); isl_int_set_si(bmap->eq[j][1+nparam+i], 1); isl_int_set_si(bmap->eq[j][1+nparam+dim+i], -1); } return isl_basic_map_finalize(bmap); error: isl_basic_map_free(bmap); return NULL; }
false
false
false
false
false
0
throwMagickException(JNIEnv *env, const char *mesg) { jclass magickExceptionClass; magickExceptionClass = (*env)->FindClass(env, "magick/MagickException"); if (magickExceptionClass == 0) { fprintf(stderr, "Cannot find MagickException class\n"); return; } (*env)->ThrowNew(env, magickExceptionClass, mesg); }
false
false
false
false
false
0
update_file_list (DialogData *data, ReadyFunc ready_func) { UpdateData *update_data; update_data = g_new (UpdateData, 1); update_data->data = data; update_data->ready_func = ready_func; if (data->template_changed) { char *required_attributes; gboolean reload_required; required_attributes = get_required_attributes (data); reload_required = attribute_list_reload_required (data->required_attributes, required_attributes); g_free (data->required_attributes); data->required_attributes = required_attributes; if (reload_required) { GtkWidget *child; gtk_widget_set_sensitive (GET_WIDGET ("options_table"), FALSE); gtk_widget_set_sensitive (GET_WIDGET ("ok_button"), FALSE); gtk_widget_show (GET_WIDGET ("task_box")); update_data->task = gth_load_file_data_task_new (data->file_list, data->required_attributes); update_data->task_completed_id = g_signal_connect (update_data->task, "completed", G_CALLBACK (load_file_data_task_completed_cb), update_data); data->tasks = g_list_prepend (data->tasks, update_data->task); child = gth_task_progress_new (update_data->task); gtk_widget_show (child); gtk_box_pack_start (GTK_BOX (GET_WIDGET ("task_box")), child, TRUE, TRUE, 0); gth_task_exec (update_data->task, NULL); return; } } call_when_idle (update_file_list__step2, update_data); }
false
false
false
false
false
0
editbar_add_mode_button(struct editbar *eb, enum editor_tool_mode etm) { GdkPixbuf *pixbuf; GtkWidget *image, *button, *hbox; struct sprite *sprite; const char *tooltip; if (!eb || !(0 <= etm && etm < NUM_EDITOR_TOOL_MODES)) { return; } button = gtk_toggle_button_new(); sprite = editor_get_mode_sprite(etm); fc_assert_ret(sprite != NULL); pixbuf = sprite_get_pixbuf(sprite); image = gtk_image_new_from_pixbuf(pixbuf); g_object_unref(G_OBJECT(pixbuf)); gtk_container_add(GTK_CONTAINER(button), image); gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(button), FALSE); tooltip = editor_get_mode_tooltip(etm); if (tooltip != NULL) { gtk_widget_set_tooltip_text(button, tooltip); } gtk_size_group_add_widget(eb->size_group, button); gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); gtk_button_set_focus_on_click(GTK_BUTTON(button), FALSE); g_signal_connect(button, "toggled", G_CALLBACK(editbar_mode_button_toggled), GINT_TO_POINTER(etm)); hbox = eb->widget; gtk_container_add(GTK_CONTAINER(hbox), button); eb->mode_buttons[etm] = button; }
false
false
false
false
false
0
handle_profile ( int argc, char * argv[]) { int i; char *profile_pathname = NULL; for (i = 1; i < argc; ++i) { if ((strcmp (argv[i], "-npro") == 0) || (strcmp (argv[i], "--ignore-profile") == 0) || (strcmp (argv[i], "+ignore-profile") == 0)) { break; } } if (i >= argc) { profile_pathname = set_profile (); } return profile_pathname; }
false
false
false
false
false
0
proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *auth) { #ifdef NETWORKACCESSMANAGER_DEBUG qDebug() << __FUNCTION__; #endif BrowserMainWindow *mainWindow = BrowserApplication::instance()->mainWindow(); QDialog dialog(mainWindow); dialog.setWindowFlags(Qt::Sheet); Ui::ProxyDialog proxyDialog; proxyDialog.setupUi(&dialog); proxyDialog.iconLabel->setText(QString()); proxyDialog.iconLabel->setPixmap(mainWindow->style()->standardIcon(QStyle::SP_MessageBoxQuestion, 0, mainWindow).pixmap(32, 32)); QString introMessage = tr("<qt>Connect to proxy \"%1\" using:</qt>"); introMessage = introMessage.arg(Qt::escape(proxy.hostName())); proxyDialog.introLabel->setText(introMessage); proxyDialog.introLabel->setWordWrap(true); if (dialog.exec() == QDialog::Accepted) { auth->setUser(proxyDialog.userNameLineEdit->text()); auth->setPassword(proxyDialog.passwordLineEdit->text()); } }
false
false
false
false
false
0
nvkm_ram_ctor(const struct nvkm_ram_func *func, struct nvkm_fb *fb, enum nvkm_ram_type type, u64 size, u32 tags, struct nvkm_ram *ram) { static const char *name[] = { [NVKM_RAM_TYPE_UNKNOWN] = "of unknown memory type", [NVKM_RAM_TYPE_STOLEN ] = "stolen system memory", [NVKM_RAM_TYPE_SGRAM ] = "SGRAM", [NVKM_RAM_TYPE_SDRAM ] = "SDRAM", [NVKM_RAM_TYPE_DDR1 ] = "DDR1", [NVKM_RAM_TYPE_DDR2 ] = "DDR2", [NVKM_RAM_TYPE_DDR3 ] = "DDR3", [NVKM_RAM_TYPE_GDDR2 ] = "GDDR2", [NVKM_RAM_TYPE_GDDR3 ] = "GDDR3", [NVKM_RAM_TYPE_GDDR4 ] = "GDDR4", [NVKM_RAM_TYPE_GDDR5 ] = "GDDR5", }; struct nvkm_subdev *subdev = &fb->subdev; int ret; nvkm_info(subdev, "%d MiB %s\n", (int)(size >> 20), name[type]); ram->func = func; ram->fb = fb; ram->type = type; ram->size = size; if (!nvkm_mm_initialised(&ram->vram)) { ret = nvkm_mm_init(&ram->vram, 0, size >> NVKM_RAM_MM_SHIFT, 1); if (ret) return ret; } if (!nvkm_mm_initialised(&ram->tags)) { ret = nvkm_mm_init(&ram->tags, 0, tags ? ++tags : 0, 1); if (ret) return ret; nvkm_debug(subdev, "%d compression tags\n", tags); } return 0; }
false
false
false
false
false
0
polkit_authority_enumerate_actions_finish (PolkitAuthority *authority, GAsyncResult *res, GError **error) { GList *ret; GVariant *value; GVariantIter iter; GVariant *child; GVariant *array; GAsyncResult *_res; g_return_val_if_fail (POLKIT_IS_AUTHORITY (authority), NULL); g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (res), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); ret = NULL; g_warn_if_fail (g_simple_async_result_get_source_tag (G_SIMPLE_ASYNC_RESULT (res)) == polkit_authority_enumerate_actions); _res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res))); value = g_dbus_proxy_call_finish (authority->proxy, _res, error); if (value == NULL) goto out; array = g_variant_get_child_value (value, 0); g_variant_iter_init (&iter, array); while ((child = g_variant_iter_next_value (&iter)) != NULL) { ret = g_list_prepend (ret, polkit_action_description_new_for_gvariant (child)); g_variant_unref (child); } ret = g_list_reverse (ret); g_variant_unref (array); g_variant_unref (value); out: return ret; }
false
false
false
false
false
0
mono_error_set_field_load (MonoError *oerror, MonoClass *klass, const char *field_name, const char *msg_format, ...) { MonoErrorInternal *error = (MonoErrorInternal*)oerror; mono_error_prepare (error); error->error_code = MONO_ERROR_MISSING_FIELD; mono_error_set_class (oerror, klass); mono_error_set_member_name (oerror, field_name); set_error_message (); }
false
false
false
false
false
0
IsIgnorable(PkgIterator const &/*Pkg*/) const { if (IsNegative() == false) return false; pkgCache::PkgIterator PP = ParentPkg(); pkgCache::PkgIterator PT = TargetPkg(); if (PP->Group != PT->Group) return false; // self-conflict if (PP == PT) return true; pkgCache::VerIterator PV = ParentVer(); // ignore group-conflict on a M-A:same package - but not our implicit dependencies // so that we can have M-A:same packages conflicting with their own real name if ((PV->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same) { // Replaces: ${self}:other ( << ${binary:Version}) if (S->Type == pkgCache::Dep::Replaces && S->CompareOp == pkgCache::Dep::Less && strcmp(PV.VerStr(), TargetVer()) == 0) return false; // Breaks: ${self}:other (!= ${binary:Version}) if (S->Type == pkgCache::Dep::DpkgBreaks && S->CompareOp == pkgCache::Dep::NotEquals && strcmp(PV.VerStr(), TargetVer()) == 0) return false; return true; } return false; }
false
false
false
false
false
0
sleepcmd(FILE *input, BSOCK *UA_sock) { if (argc > 1) { sleep(atoi(argk[1])); } return 1; }
false
false
false
false
false
0
clist_init(gx_device * dev) { gx_device_clist_writer * const cdev = &((gx_device_clist *)dev)->writer; int code = clist_reset(dev); if (code >= 0) { cdev->image_enum_id = gs_no_id; cdev->error_is_retryable = 0; cdev->driver_call_nesting = 0; cdev->ignore_lo_mem_warnings = 0; } return code; }
false
false
false
false
false
0
pysqlite_collation_callback( void* context, int text1_length, const void* text1_data, int text2_length, const void* text2_data) { PyObject* callback = (PyObject*)context; PyObject* string1 = 0; PyObject* string2 = 0; #ifdef WITH_THREAD PyGILState_STATE gilstate; #endif PyObject* retval = NULL; int result = 0; #ifdef WITH_THREAD gilstate = PyGILState_Ensure(); #endif if (PyErr_Occurred()) { goto finally; } string1 = PyUnicode_FromStringAndSize((const char*)text1_data, text1_length); string2 = PyUnicode_FromStringAndSize((const char*)text2_data, text2_length); if (!string1 || !string2) { goto finally; /* failed to allocate strings */ } retval = PyObject_CallFunctionObjArgs(callback, string1, string2, NULL); if (!retval) { /* execution failed */ goto finally; } result = PyLong_AsLong(retval); if (PyErr_Occurred()) { result = 0; } finally: Py_XDECREF(string1); Py_XDECREF(string2); Py_XDECREF(retval); #ifdef WITH_THREAD PyGILState_Release(gilstate); #endif return result; }
false
false
false
false
false
0
isl_printer_print_constraint(__isl_take isl_printer *p, __isl_keep isl_constraint *c) { isl_basic_map *bmap; if (!p || !c) goto error; bmap = isl_basic_map_from_constraint(isl_constraint_copy(c)); p = isl_printer_print_basic_map(p, bmap); isl_basic_map_free(bmap); return p; error: isl_printer_free(p); return NULL; }
false
false
false
false
false
0
so_request(SO_HANDLE h, const char *reqstr, long *length){ string res=TKawariShioriFactory::GetFactory().RequestInstance( (int)h, string(reqstr, *length)); return string2cstr(res, length); }
false
false
false
false
false
0
php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase) { zval **regex, /* Regular expression */ **array = NULL; /* Optional register array */ char *findin; /* String to apply expression to */ int findin_len; regex_t re; regmatch_t *subs; int err, match_len, string_len; uint i; int copts = 0; off_t start, end; char *buf = NULL; char *string = NULL; int argc = ZEND_NUM_ARGS(); if (zend_parse_parameters(argc TSRMLS_CC, "Zs|Z", &regex, &findin, &findin_len, &array) == FAILURE) { return; } if (icase) { copts |= REG_ICASE; } if (argc == 2) { copts |= REG_NOSUB; } /* compile the regular expression from the supplied regex */ if (Z_TYPE_PP(regex) == IS_STRING) { err = regcomp(&re, Z_STRVAL_PP(regex), REG_EXTENDED | copts); } else { /* we convert numbers to integers and treat them as a string */ if (Z_TYPE_PP(regex) == IS_DOUBLE) { convert_to_long_ex(regex); /* get rid of decimal places */ } convert_to_string_ex(regex); /* don't bother doing an extended regex with just a number */ err = regcomp(&re, Z_STRVAL_PP(regex), copts); } if (err) { php_ereg_eprint(err, &re); RETURN_FALSE; } /* make a copy of the string we're looking in */ string = estrndup(findin, findin_len); /* allocate storage for (sub-)expression-matches */ subs = (regmatch_t *)ecalloc(sizeof(regmatch_t),re.re_nsub+1); /* actually execute the regular expression */ err = regexec(&re, string, re.re_nsub+1, subs, 0); if (err && err != REG_NOMATCH) { php_ereg_eprint(err, &re); regfree(&re); efree(subs); RETURN_FALSE; } match_len = 1; if (array && err != REG_NOMATCH) { match_len = (int) (subs[0].rm_eo - subs[0].rm_so); string_len = findin_len + 1; buf = emalloc(string_len); zval_dtor(*array); /* start with clean array */ array_init(*array); for (i = 0; i <= re.re_nsub; i++) { start = subs[i].rm_so; end = subs[i].rm_eo; if (start != -1 && end > 0 && start < string_len && end < string_len && start < end) { add_index_stringl(*array, i, string+start, end-start, 1); } else { add_index_bool(*array, i, 0); } } efree(buf); } efree(subs); efree(string); if (err == REG_NOMATCH) { RETVAL_FALSE; } else { if (match_len == 0) match_len = 1; RETVAL_LONG(match_len); } regfree(&re); }
false
true
false
false
false
1
pwr64 (gint64 op, int exp) { qofint128 tmp; if (exp == 0) return 1; if (exp % 2) { tmp = mult128 (op, pwr64 (op, exp - 1)); if (tmp.isbig) return 0; return tmp.lo; } tmp.lo = pwr64 (op, exp / 2); tmp = mult128 (tmp.lo, tmp.lo); if (tmp.isbig) return 0; return tmp.lo; }
false
false
false
false
false
0
cro_levelcell(FILE *outf, Outchoices *od, choice rep, int level) { if (level >= 1) fprintf(outf, "%d%s", level, od->compsep); }
false
false
false
false
false
0
sourceRowsRemoved(const QModelIndex &source_parent, int start, int end) { if (completeRemove) { completeRemove = false; // Source parent is already in the model. invokeRowsRemoved(source_parent, start, end); // fall through. After removing rows, we need to refresh things so that intermediates will be removed too if necessary. } if (ignoreRemove) { ignoreRemove = false; return; } // Refresh intermediate rows too. // This is needed because QSFPM only invalidates the mapping for the // index range given to dataChanged, not its children. if (source_parent.isValid()) refreshAscendantMapping(source_parent, true); }
false
false
false
false
false
0
slot_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { static PyObject *new_str; PyObject *func; PyObject *newargs, *x; Py_ssize_t i, n; if (new_str == NULL) { new_str = PyString_InternFromString("__new__"); if (new_str == NULL) return NULL; } func = PyObject_GetAttr((PyObject *)type, new_str); if (func == NULL) return NULL; assert(PyTuple_Check(args)); n = PyTuple_GET_SIZE(args); newargs = PyTuple_New(n+1); if (newargs == NULL) return NULL; Py_INCREF(type); PyTuple_SET_ITEM(newargs, 0, (PyObject *)type); for (i = 0; i < n; i++) { x = PyTuple_GET_ITEM(args, i); Py_INCREF(x); PyTuple_SET_ITEM(newargs, i+1, x); } x = PyObject_Call(func, newargs, kwds); Py_DECREF(newargs); Py_DECREF(func); return x; }
false
false
false
false
false
0
ajPatlistRegexRemoveCurrent (AjPPatlistRegex thys) { if (!thys->Iter) return; ajListIterRemove(thys->Iter); ajListIterGetBack(thys->Iter); return; }
false
false
false
false
false
0
IIT_fieldint (T this, char *fieldstring) { int i = 0; unsigned int start; while (i < this->nfields) { start = this->fieldpointers[i]; if (!strcmp(fieldstring,&(this->fieldstrings[start]))) { return i; } i++; } return -1; }
false
false
false
false
false
0
bc_push_arg (const struct buildcmd_control *ctl, struct buildcmd_state *state, const char *arg, size_t len, const char *prefix, size_t pfxlen, int initial_args) { if (!initial_args) { state->todo = 1; } if (arg) { /* XXX_SOC: if do_exec() is only guaranteeed to free up one * argument, this if statement may need to become a while loop. * If it becomes a while loop, it needs not to be an infinite * loop... */ if (state->cmd_argv_chars + len > ctl->arg_max) { if (initial_args || state->cmd_argc == ctl->initial_argc) error (1, 0, _("can not fit single argument within argument list size limit")); /* xargs option -i (replace_pat) implies -x (exit_if_size_exceeded) */ if (ctl->replace_pat || (ctl->exit_if_size_exceeded && (ctl->lines_per_exec || ctl->args_per_exec))) error (1, 0, _("argument list too long")); do_exec (ctl, state); } /* XXX_SOC: this if may also need to become a while loop. In fact perhaps it is best to factor this out into a separate function which ceeps calling the exec handler until there is space for our next argument. Each exec will free one argc "slot" so the main thing to worry about repeated exec calls for would be total argument length. */ if (bc_argc_limit_reached(initial_args, ctl, state)) do_exec (ctl, state); } if (state->cmd_argc >= state->cmd_argv_alloc) { /* XXX: we could use extendbuf() here. */ if (!state->cmd_argv) { state->cmd_argv_alloc = 64; state->cmd_argv = xmalloc (sizeof (char *) * state->cmd_argv_alloc); } else { state->cmd_argv_alloc *= 2; state->cmd_argv = xrealloc (state->cmd_argv, sizeof (char *) * state->cmd_argv_alloc); } } if (!arg) state->cmd_argv[state->cmd_argc++] = NULL; else { state->cmd_argv[state->cmd_argc++] = state->argbuf + state->cmd_argv_chars; if (prefix) { strcpy (state->argbuf + state->cmd_argv_chars, prefix); state->cmd_argv_chars += pfxlen; } strcpy (state->argbuf + state->cmd_argv_chars, arg); state->cmd_argv_chars += len; /* If we have now collected enough arguments, * do the exec immediately. This must be * conditional on arg!=NULL, since do_exec() * actually calls bc_push_arg(ctl, state, NULL, 0, false). */ if (bc_argc_limit_reached(initial_args, ctl, state)) do_exec (ctl, state); } /* If this is an initial argument, set the high-water mark. */ if (initial_args) { state->cmd_initial_argv_chars = state->cmd_argv_chars; } }
false
true
false
false
false
1
Lock() const { int r = VideoRendererWithLock::Lock(); if (r == 0 && !dga && info.info.x11.lock_func) info.info.x11.lock_func(); return r; }
false
false
false
false
false
0
arch_early_irq_init(void) { init_legacy_irqs(); x86_vector_domain = irq_domain_add_tree(NULL, &x86_vector_domain_ops, NULL); BUG_ON(x86_vector_domain == NULL); irq_set_default_host(x86_vector_domain); arch_init_msi_domain(x86_vector_domain); arch_init_htirq_domain(x86_vector_domain); BUG_ON(!alloc_cpumask_var(&vector_cpumask, GFP_KERNEL)); BUG_ON(!alloc_cpumask_var(&vector_searchmask, GFP_KERNEL)); BUG_ON(!alloc_cpumask_var(&searched_cpumask, GFP_KERNEL)); return arch_early_ioapic_init(); }
false
false
false
false
false
0
DrawRadioButton(struct XObj *xobj, XEvent *evp) { int i,j; j=xobj->height/2+3; i=16; /* Dessin du cercle arrondi */ XSetForeground(dpy,xobj->gc,xobj->TabColor[shad]); XDrawArc(dpy,xobj->win,xobj->gc,1,j-11,11,11,45*64,180*64); XSetForeground(dpy,xobj->gc,xobj->TabColor[hili]); XDrawArc(dpy,xobj->win,xobj->gc,1,j-11,11,11,225*64,180*64); XSetForeground(dpy,xobj->gc,xobj->TabColor[shad]); XDrawArc(dpy,xobj->win,xobj->gc,2,j-10,9,9,0*64,360*64); XSetForeground(dpy,xobj->gc,xobj->TabColor[fore]); if (xobj->value) XFillArc(dpy,xobj->win,xobj->gc,2,j-10,9,9,0*64,360*64); /* Calcul de la position de la chaine de charactere */ MyDrawString(dpy,xobj,xobj->win,i,j,xobj->title,fore,hili, back,!xobj->flags[1], NULL, evp); }
false
false
false
false
false
0
fr_socket_find(fr_packet_list_t *pl, int sockfd) { int i, start; i = start = SOCK2OFFSET(sockfd); do { /* make this hack slightly more efficient */ if (pl->sockets[i].sockfd == sockfd) return &pl->sockets[i]; i = (i + 1) & SOCKOFFSET_MASK; } while (i != start); return NULL; }
false
false
false
false
false
0
waitingblits (void) { static int warned = 10; bool waited = false; while (bltstate != BLT_done && dmaen (DMA_BLITTER)) { waited = true; x_do_cycles (8 * CYCLE_UNIT); } if (warned && waited) { warned--; write_log (_T("waiting_blits detected\n")); } if (bltstate == BLT_done) return true; return false; }
false
false
false
false
false
0
~CoinWarmStartBasis() { delete[] structuralStatus_; }
false
false
false
false
false
0
_ecore_con_server_timer_update(Ecore_Con_Server *svr) { if (svr->disconnect_time) { if (svr->disconnect_time > 0) { if (svr->until_deletion) ecore_timer_interval_set(svr->until_deletion, svr->disconnect_time); else svr->until_deletion = ecore_timer_add(svr->disconnect_time, (Ecore_Task_Cb)_ecore_con_server_timer, svr); } else if (svr->until_deletion) { ecore_timer_del(svr->until_deletion); svr->until_deletion = NULL; } } else { if (svr->until_deletion) { ecore_timer_del(svr->until_deletion); svr->until_deletion = NULL; } } }
false
false
false
false
false
0
get_charset_table(void) { static CharsetTable *ctable = NULL; EncArray *encarray; gint i; if (!ctable) { ctable = g_malloc(sizeof(CharsetTable)); ctable->num = 0; ctable->charset[ctable->num] = get_default_charset(); ctable->str[ctable->num] = g_strdup_printf(_("Current Locale (%s)"), get_default_charset()); ctable->num++; ctable->charset[ctable->num] = "UTF-8"; ctable->str[ctable->num] = ctable->charset[ctable->num]; ctable->num++; encarray = get_encoding_items(get_encoding_code()); for (i = 0; i < ENCODING_MAX_ITEM_NUM; i++) if (encarray->item[i]) { ctable->charset[ctable->num] = encarray->item[i]; ctable->str[ctable->num] = encarray->item[i]; ctable->num++; } } return ctable; }
false
false
false
false
false
0
example_labeling() { CamImage source; CamRLEImage encoded; CamBlobs results; int i; // Load picture small_ulp.pgm (example provided by ULP, which made labelling v1.0 fail) camLoadPGM(&source,"resources/small_ulp.pgm"); // Label the image camRLEAllocate(&encoded,10000); camRLEEncode(&source,&encoded); printf("Number of runs : %d\n",encoded.nbRuns); camRLELabeling(&encoded,&results); // Print the results for (i=0;i<results.nbBlobs;i++) { printf("Blob #%2d : (%3d,%3d,%3d,%3d) Surface=%d\n", i,results.blobInfo[i].left,results.blobInfo[i].top, results.blobInfo[i].width,results.blobInfo[i].height, results.blobInfo[i].surface); } camRLEDeallocate(&encoded); camDeallocateImage(&source); }
false
false
false
false
false
0
getl3proc(struct PStack *st, int cr) { struct l3_process *p = st->l3.proc; while (p) if (p->callref == cr) return (p); else p = p->next; return (NULL); }
false
false
false
false
false
0
tgdb_is_busy(struct tgdb *tgdb, int *is_busy) { /* Validate parameters */ if (!tgdb || !is_busy) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_is_busy failed"); return -1; } if (tgdb_can_issue_command(tgdb) == 1) *is_busy = 0; else *is_busy = 1; return 0; }
false
false
false
false
false
0
tb_cfg_print_error(struct tb_ctl *ctl, const struct tb_cfg_result *res) { WARN_ON(res->err != 1); switch (res->tb_error) { case TB_CFG_ERROR_PORT_NOT_CONNECTED: /* Port is not connected. This can happen during surprise * removal. Do not warn. */ return; case TB_CFG_ERROR_INVALID_CONFIG_SPACE: /* * Invalid cfg_space/offset/length combination in * cfg_read/cfg_write. */ tb_ctl_WARN(ctl, "CFG_ERROR(%llx:%x): Invalid config space of offset\n", res->response_route, res->response_port); return; case TB_CFG_ERROR_NO_SUCH_PORT: /* * - The route contains a non-existent port. * - The route contains a non-PHY port (e.g. PCIe). * - The port in cfg_read/cfg_write does not exist. */ tb_ctl_WARN(ctl, "CFG_ERROR(%llx:%x): Invalid port\n", res->response_route, res->response_port); return; case TB_CFG_ERROR_LOOP: tb_ctl_WARN(ctl, "CFG_ERROR(%llx:%x): Route contains a loop\n", res->response_route, res->response_port); return; default: /* 5,6,7,9 and 11 are also valid error codes */ tb_ctl_WARN(ctl, "CFG_ERROR(%llx:%x): Unknown error\n", res->response_route, res->response_port); return; } }
false
false
false
false
false
0
keywordDoStartsLoop(int pos, Accessor &styler) { char ch; int style; int lineStart = styler.GetLine(pos); int lineStartPosn = styler.LineStart(lineStart); styler.Flush(); while (--pos >= lineStartPosn) { style = actual_style(styler.StyleAt(pos)); if (style == SCE_RB_DEFAULT) { if ((ch = styler[pos]) == '\r' || ch == '\n') { // Scintilla's LineStart() and GetLine() routines aren't // platform-independent, so if we have text prepared with // a different system we can't rely on it. return false; } } else if (style == SCE_RB_WORD) { // Check for while or until, but write the word in backwards char prevWord[MAX_KEYWORD_LENGTH + 1]; // 1 byte for zero char *dst = prevWord; int wordLen = 0; int start_word; for (start_word = pos; start_word >= lineStartPosn && actual_style(styler.StyleAt(start_word)) == SCE_RB_WORD; start_word--) { if (++wordLen < MAX_KEYWORD_LENGTH) { *dst++ = styler[start_word]; } } *dst = 0; // Did we see our keyword? if (!strcmp(prevWord, WHILE_BACKWARDS) || !strcmp(prevWord, UNTIL_BACKWARDS)) { return true; } // We can move pos to the beginning of the keyword, and then // accept another decrement, as we can never have two contiguous // keywords: // word1 word2 // ^ // <- move to start_word // ^ // <- loop decrement // ^ # pointing to end of word1 is fine pos = start_word; } } return false; }
false
false
false
false
false
0
caml_hash_mix_float(uint32 hash, float d) { union { float f; uint32 i; } u; uint32 n; /* Convert to int32 */ u.f = d; n = u.i; /* Normalize NaNs */ if ((n & 0x7F800000) == 0x7F800000 && (n & 0x007FFFFF) != 0) { n = 0x7F800001; } /* Normalize -0 into +0 */ else if (n == 0x80000000) { n = 0; } MIX(hash, n); return hash; }
false
false
false
false
false
0
syn_rule_class_state_size(const qpol_iterator_t * iter) { syn_rule_class_state_t *srcs = NULL; size_t count = 0; class_perm_node_t *cpn = NULL; if (!iter || !(srcs = (syn_rule_class_state_t *) qpol_iterator_state(iter))) { errno = EINVAL; return 0; } for (cpn = srcs->head; cpn; cpn = cpn->next) count++; return count; }
false
false
false
false
false
0
nic_nxt_avail_sqs(struct nicpf *nic) { int sqs; for (sqs = 0; sqs < nic->num_sqs_en; sqs++) { if (!nic->sqs_used[sqs]) nic->sqs_used[sqs] = true; else continue; return sqs + nic->num_vf_en; } return -1; }
false
false
false
false
false
0
compare_tlist_datatypes(List *tlist, List *colTypes, bool *differentTypes) { ListCell *l; ListCell *colType = list_head(colTypes); foreach(l, tlist) { TargetEntry *tle = (TargetEntry *) lfirst(l); if (tle->resjunk) continue; /* ignore resjunk columns */ if (colType == NULL) elog(ERROR, "wrong number of tlist entries"); if (exprType((Node *) tle->expr) != lfirst_oid(colType)) differentTypes[tle->resno] = true; colType = lnext(colType); } if (colType != NULL) elog(ERROR, "wrong number of tlist entries"); }
false
false
false
false
false
0
ar_1d_ft (int PTS, Real* X, Real *Y) { // ARBITRARY RADIX ONE DIMENSIONAL FOURIER TRANSFORM REPORT int F,J,N,NF,P,PMAX,P_SYM,P_TWO,Q,R,TWO_GRP; // NP is maximum number of squared factors allows PTS up to 2**32 at least // NQ is number of not-squared factors - increase if we increase PMAX const int NP = 16, NQ = 10; SimpleIntArray PP(NP), QQ(NQ); TWO_GRP=16; PMAX=19; // PMAX is the maximum factor size // TWO_GRP is the maximum power of 2 handled as a single factor // Doesn't take advantage of combining powers of 2 when calculating // number of factors if (PTS<=1) return true; N=PTS; P_SYM=1; F=2; P=0; Q=0; // P counts the number of squared factors // Q counts the number of the rest // R = 0 for no non-squared factors; 1 otherwise // FACTOR holds all the factors - non-squared ones in the middle // - length is 2*P+Q // SYM also holds all the factors but with the non-squared ones // multiplied together - length is 2*P+R // PP holds the values of the squared factors - length is P // QQ holds the values of the rest - length is Q // P_SYM holds the product of the squared factors // find the factors - load into PP and QQ while (N > 1) { bool fail = true; for (J=F; J<=PMAX; J++) if (N % J == 0) { fail = false; F=J; break; } if (fail || P >= NP || Q >= NQ) return false; // can't factor N /= F; if (N % F != 0) QQ[Q++] = F; else { N /= F; PP[P++] = F; P_SYM *= F; } } R = (Q == 0) ? 0 : 1; // R = 0 if no not-squared factors, 1 otherwise NF = 2*P + Q; SimpleIntArray FACTOR(NF + 1), SYM(2*P + R); FACTOR[NF] = 0; // we need this in the "combine powers of 2" // load into SYM and FACTOR for (J=0; J<P; J++) { SYM[J]=FACTOR[J]=PP[P-1-J]; FACTOR[P+Q+J]=SYM[P+R+J]=PP[J]; } if (Q>0) { REPORT for (J=0; J<Q; J++) FACTOR[P+J]=QQ[J]; SYM[P]=PTS/square(P_SYM); } // combine powers of 2 P_TWO = 1; for (J=0; J < NF; J++) { if (FACTOR[J]!=2) continue; P_TWO=P_TWO*2; FACTOR[J]=1; if (P_TWO<TWO_GRP && FACTOR[J+1]==2) continue; FACTOR[J]=P_TWO; P_TWO=1; } if (P==0) R=0; if (Q<=1) Q=0; // do the analysis GR_1D_FT(PTS,NF,FACTOR,X,Y); // the transform GR_1D_FS(PTS,2*P+R,Q,SYM,P_SYM,QQ,X,Y); // the reshuffling return true; }
false
false
false
false
false
0
issinglepositioninseparatorViaequallength(GtEncseqReader *esr) { if (esr->currentpos != esr->nextseparatorpos) { return false; } singlepositioninseparatorViaequallength_updatestate(esr); return true; }
false
false
false
false
false
0
res_ourserver(const struct irc_ssaddr *inp) { #ifdef IPV6 const struct sockaddr_in6 *v6; const struct sockaddr_in6 *v6in = (const struct sockaddr_in6 *)inp; #endif const struct sockaddr_in *v4; const struct sockaddr_in *v4in = (const struct sockaddr_in *)inp; int ns; for (ns = 0; ns < irc_nscount; ns++) { const struct irc_ssaddr *srv = &irc_nsaddr_list[ns]; #ifdef IPV6 v6 = (const struct sockaddr_in6 *)srv; #endif v4 = (const struct sockaddr_in *)srv; /* could probably just memcmp(srv, inp, srv.ss_len) here * but we'll air on the side of caution - stu * */ switch (srv->ss.ss_family) { #ifdef IPV6 case AF_INET6: if (srv->ss.ss_family == inp->ss.ss_family) if (v6->sin6_port == v6in->sin6_port) if ((memcmp(&v6->sin6_addr.s6_addr, &v6in->sin6_addr.s6_addr, sizeof(struct in6_addr)) == 0) || (memcmp(&v6->sin6_addr.s6_addr, &in6addr_any, sizeof(struct in6_addr)) == 0)) return 1; break; #endif case AF_INET: if (srv->ss.ss_family == inp->ss.ss_family) if (v4->sin_port == v4in->sin_port) if ((v4->sin_addr.s_addr == INADDR_ANY) || (v4->sin_addr.s_addr == v4in->sin_addr.s_addr)) return 1; break; default: break; } } return 0; }
false
false
false
false
false
0
io_stats_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector, int32_t count, off_t offset, struct iobref *iobref) { int len = 0; if (fd->inode) frame->local = fd->inode; len = iov_length (vector, count); BUMP_WRITE (fd, len); START_FOP_LATENCY (frame); STACK_WIND (frame, io_stats_writev_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->writev, fd, vector, count, offset, iobref); return 0; }
false
false
false
false
false
0
postAttack( bool reactionFire, const Context& context ) { if ( !reactionFire ) { if ( typ->hasFunction( ContainerBaseType::MoveAfterAttack ) ) { int decrease = maxMovement() * attackmovecost / 100; if ( decrease ) (new ChangeUnitMovement( this, decrease, true ))->execute( context ); } else { GameAction* a = new ChangeUnitMovement( this, 0 ); a->execute( context ); } GameAction* a = new ChangeUnitProperty( this, ChangeUnitProperty::AttackedFlag, 1 ); a->execute( context ); } }
false
false
false
false
false
0
xg_apply_userdef_op_fn (OpType op, long a) { switch (op) { case OP_OPERAND_F32MINUS: return operand_function_F32MINUS (a); case OP_OPERAND_LOW8: return operand_function_LOW8 (a); case OP_OPERAND_HI24S: return operand_function_HI24S (a); case OP_OPERAND_LOW16U: return operand_function_LOW16U (a); case OP_OPERAND_HI16U: return operand_function_HI16U (a); default: break; } return FALSE; }
false
true
false
false
false
1
dstr_connect ( PIA *pi ) { pi->saved_r0 = r0(); pi->saved_r2 = r2(); w2(4); CCP(0xe0); w0(0xff); }
false
false
false
false
false
0
macvtap_get_vlan(struct macvtap_queue *q) { struct macvlan_dev *vlan; ASSERT_RTNL(); vlan = rtnl_dereference(q->vlan); if (vlan) dev_hold(vlan->dev); return vlan; }
false
false
false
false
false
0
deliver_remote(struct qitem *it) { struct mx_hostentry *hosts, *h; const char *host; int port; int error = 1, smarthost = 0; host = strrchr(it->addr, '@'); /* Should not happen */ if (host == NULL) { snprintf(errmsg, sizeof(errmsg), "Internal error: badly formed address %s", it->addr); return(-1); } else { /* Step over the @ */ host++; } port = SMTP_PORT; /* Smarthost support? */ if (config.smarthost != NULL) { host = config.smarthost; port = config.port; syslog(LOG_INFO, "using smarthost (%s:%i)", host, port); smarthost = 1; } error = dns_get_mx_list(host, port, &hosts, smarthost); if (error) { syslog(LOG_NOTICE, "remote delivery %s: DNS failure (%s)", error < 0 ? "failed" : "deferred", host); return (error); } for (h = hosts; *h->host != 0; h++) { switch (deliver_to_host(it, h)) { case 0: /* success */ error = 0; goto out; case 1: /* temp failure */ error = 1; break; default: /* perm failure */ error = -1; goto out; } } out: free(hosts); return (error); }
false
false
false
false
false
0
imSaveMap(int width, int height, int format, unsigned char *map, int palette_count, long *palette, char *filename) { int error; char* new_format = i_format_old2new[format & 0x00FF]; imFile* ifile = imFileNew(filename, new_format, &error); if (!ifile) return error; if (format & 0xFF00) imFileSetInfo(ifile, NULL); else imFileSetInfo(ifile, "NONE"); imFileSetPalette(ifile, palette, palette_count); if (iOldResolutionCB) { double xres, yres; int res_unit; iOldResolutionCB(filename, &xres, &yres, &res_unit); float fxres=(float)xres, fyres=(float)yres; imFileSetAttribute(ifile, "XResolution", IM_FLOAT, 1, (void*)&fxres); imFileSetAttribute(ifile, "YResolution", IM_FLOAT, 1, (void*)&fyres); imFileSetAttribute(ifile, "ResolutionUnit", IM_INT, 1, (void*)&res_unit); } if (iOldTiffImageDescCB) { char img_desc[50]; iOldTiffImageDescCB(filename, img_desc); imFileSetAttribute(ifile, "Description", IM_BYTE, -1, (void*)img_desc); } if (iOldGifTranspIndexCB) { unsigned char transp_index; iOldGifTranspIndexCB(filename, &transp_index); imFileSetAttribute(ifile, "TransparencyIndex", IM_BYTE, 1, (void*)&transp_index); } error = imFileWriteImageInfo(ifile, width, height, IM_MAP, IM_BYTE); if (error) { imFileClose(ifile); return error; } if (iOldCounterCB) imCounterSetCallback(filename, iOldFileCounter); error = imFileWriteImageData(ifile, map); imFileClose(ifile); return error; }
false
false
false
false
false
0
getJS(int i) { Object obj; // getJSNameTree()->getValue(i) returns a shallow copy of the object so we // do not need to free it catalogLocker(); getJSNameTree()->getValue(i).fetch(xref, &obj); if (!obj.isDict()) { obj.free(); return 0; } Object obj2; if (!obj.dictLookup("S", &obj2)->isName()) { obj2.free(); obj.free(); return 0; } if (strcmp(obj2.getName(), "JavaScript")) { obj2.free(); obj.free(); return 0; } obj2.free(); obj.dictLookup("JS", &obj2); GooString *js = 0; if (obj2.isString()) { js = new GooString(obj2.getString()); } else if (obj2.isStream()) { Stream *stream = obj2.getStream(); js = new GooString(); stream->fillGooString(js); } obj2.free(); obj.free(); return js; }
false
false
false
false
false
0
fgetc_ws(FILE *f) { int c; while (1) { c = fgetc(f); if (c=='#') { while (1) { c = fgetc(f); if (c=='\n' || c==EOF) { break; } } } /* space, tab, line feed, carriage return, form-feed */ if (c!=' ' && c!='\t' && c!='\r' && c!='\n' && c!=12) { return c; } } }
false
false
false
false
false
0
will_collide_pp(vec3d *p0, vec3d *p1, float radius, object *big_objp, vec3d *collision_point) { mc_info mc; polymodel *pm = model_get(Ship_info[Ships[big_objp->instance].ship_info_index].model_num); mc.model_instance_num = -1; mc.model_num = pm->id; // Fill in the model to check mc.orient = &big_objp->orient; // The object's orient mc.pos = &big_objp->pos; // The object's position mc.p0 = p0; // Point 1 of ray to check mc.p1 = p1; mc.flags = MC_CHECK_MODEL | MC_CHECK_SPHERELINE | MC_SUBMODEL; // flags mc.radius = radius; // Only check the 2nd lowest hull object mc.submodel_num = pm->detail[0]; model_collide(&mc); if (mc.num_hits) *collision_point = mc.hit_point_world; return mc.num_hits; }
false
false
false
false
false
0
opal_dss_unpack_bool(opal_buffer_t *buffer, void *dest, int32_t *num_vals, opal_data_type_t type) { int ret; opal_data_type_t remote_type; if (OPAL_DSS_BUFFER_FULLY_DESC == buffer->type) { /* see what type was actually packed */ if (OPAL_SUCCESS != (ret = opal_dss_peek_type(buffer, &remote_type))) { return ret; } } else { if (OPAL_SUCCESS != (ret = opal_dss_get_data_type(buffer, &remote_type))) { return ret; } } if (remote_type == DSS_TYPE_BOOL) { /* fast path it if the sizes are the same */ /* Turn around and unpack the real type */ if (OPAL_SUCCESS != (ret = opal_dss_unpack_buffer(buffer, dest, num_vals, DSS_TYPE_BOOL))) { } } else { /* slow path - types are different sizes */ UNPACK_SIZE_MISMATCH(bool, remote_type, ret); } return ret; }
false
false
false
false
false
0
getWhere(ImageWindow *iw, char *oldWhere) { Object where; if (oldWhere) { char buf[1024]; sprintf(buf, "%s[%s]", iw->where, oldWhere); where = (Object)DXNewString(buf); } else where = (Object)DXNewString(iw->where); return where; }
true
true
false
false
false
1
main(int argc, char **argv) { int status; try { fprintf(stdout, "*** %s version %s build at %s\n", APP_NAME, VERSION, __DATE__); application = new Application(); signal(SIGINT, sigint_handler); // Parse command line options status = application->parseCommandLine(argc, argv); if (status) { application->startGUI(argc, argv); application->setScreen(new MainMenu(application)); application->run(); } } catch (std::exception& e) { fprintf(stderr, "%s\n", e.what()); } if (NULL != application) { delete application; application = NULL; } fprintf(stdout, "*** %s: Exit\n", APP_NAME); return status; }
false
false
false
false
false
0
es_unreadn (estream_t ES__RESTRICT stream, const unsigned char *ES__RESTRICT data, size_t data_n, size_t *ES__RESTRICT bytes_unread) { size_t space_left; space_left = stream->unread_buffer_size - stream->unread_data_len; if (data_n > space_left) data_n = space_left; if (! data_n) goto out; memcpy (stream->unread_buffer + stream->unread_data_len, data, data_n); stream->unread_data_len += data_n; stream->intern->indicators.eof = 0; out: if (bytes_unread) *bytes_unread = data_n; }
false
false
false
false
false
0
encode_32bit(struct lwpb_buf *buf, u32_t value) { if (lwpb_buf_left(buf) < 4) return LWPB_ERR_END_OF_BUF; buf->pos[0] = (value) & 0xff; buf->pos[1] = (value >> 8) & 0xff; buf->pos[2] = (value >> 16) & 0xff; buf->pos[3] = (value >> 24) & 0xff; buf->pos += 4; return LWPB_ERR_OK; }
false
false
false
false
false
0
error_msg_rpc(const char *msg) { int len; while (msg[0] == ' ' || msg[0] == ':') msg++; len = strlen(msg); while (len && msg[len-1] == '\n') len--; bb_error_msg("%.*s", len, msg); }
false
false
false
false
false
0
dumpRule(Archive *fout, RuleInfo *rinfo) { TableInfo *tbinfo = rinfo->ruletable; PQExpBuffer query; PQExpBuffer cmd; PQExpBuffer delcmd; PGresult *res; /* Skip if not to be dumped */ if (!rinfo->dobj.dump || dataOnly) return; /* * If it is an ON SELECT rule that is created implicitly by CREATE VIEW, * we do not want to dump it as a separate object. */ if (!rinfo->separate) return; /* * Make sure we are in proper schema. */ selectSourceSchema(tbinfo->dobj.namespace->dobj.name); query = createPQExpBuffer(); cmd = createPQExpBuffer(); delcmd = createPQExpBuffer(); if (g_fout->remoteVersion >= 70300) { appendPQExpBuffer(query, "SELECT pg_catalog.pg_get_ruledef('%u'::pg_catalog.oid) AS definition", rinfo->dobj.catId.oid); } else { /* Rule name was unique before 7.3 ... */ appendPQExpBuffer(query, "SELECT pg_get_ruledef('%s') AS definition", rinfo->dobj.name); } res = PQexec(g_conn, query->data); check_sql_result(res, g_conn, query->data, PGRES_TUPLES_OK); if (PQntuples(res) != 1) { write_msg(NULL, "query to get rule \"%s\" for table \"%s\" failed: wrong number of rows returned", rinfo->dobj.name, tbinfo->dobj.name); exit_nicely(); } printfPQExpBuffer(cmd, "%s\n", PQgetvalue(res, 0, 0)); /* * DROP must be fully qualified in case same name appears in pg_catalog */ appendPQExpBuffer(delcmd, "DROP RULE %s ", fmtId(rinfo->dobj.name)); appendPQExpBuffer(delcmd, "ON %s.", fmtId(tbinfo->dobj.namespace->dobj.name)); appendPQExpBuffer(delcmd, "%s;\n", fmtId(tbinfo->dobj.name)); ArchiveEntry(fout, rinfo->dobj.catId, rinfo->dobj.dumpId, rinfo->dobj.name, tbinfo->dobj.namespace->dobj.name, NULL, tbinfo->rolname, false, "RULE", cmd->data, delcmd->data, NULL, rinfo->dobj.dependencies, rinfo->dobj.nDeps, NULL, NULL); /* Dump rule comments */ resetPQExpBuffer(query); appendPQExpBuffer(query, "RULE %s", fmtId(rinfo->dobj.name)); appendPQExpBuffer(query, " ON %s", fmtId(tbinfo->dobj.name)); dumpComment(fout, query->data, tbinfo->dobj.namespace->dobj.name, tbinfo->rolname, rinfo->dobj.catId, 0, rinfo->dobj.dumpId); PQclear(res); destroyPQExpBuffer(query); destroyPQExpBuffer(cmd); destroyPQExpBuffer(delcmd); }
false
false
false
false
false
0
stab_new(void) { stab_t st = malloc(sizeof(*st)); if (!st) { pr_error("stab: failed to allocate memory\n"); return NULL; } st->sym = btree_alloc(&sym_table_def); if (!st->sym) { printc_err("stab: failed to allocate symbol table\n"); free(st); return NULL; } st->addr = btree_alloc(&addr_table_def); if (!st->addr) { printc_err("stab: failed to allocate address table\n"); btree_free(st->sym); free(st); return NULL; } return st; }
false
false
false
false
false
0