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
nonDestructiveBasicTest() { Q_ASSERT ( model->buddy ( QModelIndex() ) == QModelIndex() ); model->canFetchMore ( QModelIndex() ); Q_ASSERT ( model->columnCount ( QModelIndex() ) >= 0 ); Q_ASSERT ( model->data ( QModelIndex() ) == QVariant() ); fetchingMore = true; model->fetchMore ( QModelIndex() ); fetchingMore = false; Qt::ItemFlags flags = model->flags ( QModelIndex() ); Q_ASSERT ( flags == Qt::ItemIsDropEnabled || flags == 0 ); model->hasChildren ( QModelIndex() ); model->hasIndex ( 0, 0 ); model->headerData ( 0, Qt::Horizontal ); model->index ( 0, 0 ); model->itemData ( QModelIndex() ); QVariant cache; model->match ( QModelIndex(), -1, cache ); model->mimeTypes(); Q_ASSERT ( model->parent ( QModelIndex() ) == QModelIndex() ); Q_ASSERT ( model->rowCount() >= 0 ); QVariant variant; model->setData ( QModelIndex(), variant, -1 ); model->setHeaderData ( -1, Qt::Horizontal, QVariant() ); model->setHeaderData ( 999999, Qt::Horizontal, QVariant() ); QMap<int, QVariant> roles; model->sibling ( 0, 0, QModelIndex() ); model->span ( QModelIndex() ); model->supportedDropActions(); }
false
false
false
false
false
0
gnc_commodity_set_mnemonic(gnc_commodity * cm, const char * mnemonic) { CommodityPrivate* priv; if (!cm) return; priv = GET_PRIVATE(cm); if (priv->mnemonic == mnemonic) return; gnc_commodity_begin_edit(cm); CACHE_REMOVE (priv->mnemonic); priv->mnemonic = CACHE_INSERT(mnemonic); mark_commodity_dirty (cm); reset_printname(priv); reset_unique_name(priv); gnc_commodity_commit_edit(cm); }
false
false
false
false
false
0
runOnMachineFunction(MachineFunction &MF) { DEBUG(dbgs() << "******** Machine Sinking ********\n"); const TargetMachine &TM = MF.getTarget(); TII = TM.getInstrInfo(); TRI = TM.getRegisterInfo(); MRI = &MF.getRegInfo(); DT = &getAnalysis<MachineDominatorTree>(); LI = &getAnalysis<MachineLoopInfo>(); AA = &getAnalysis<AliasAnalysis>(); AllocatableSet = TRI->getAllocatableSet(MF); bool EverMadeChange = false; while (1) { bool MadeChange = false; // Process all basic blocks. CEBCandidates.clear(); for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) MadeChange |= ProcessBlock(*I); // If this iteration over the code changed anything, keep iterating. if (!MadeChange) break; EverMadeChange = true; } return EverMadeChange; }
false
false
false
false
false
0
gfilechooser_mouse(GGadget *g, GEvent *event) { GFileChooser *gfc = (GFileChooser *) g; if (( event->type==et_mouseup || event->type==et_mousedown ) && (event->u.mouse.button>=4 && event->u.mouse.button<=7) ) { if ( gfc->files->vsb!=NULL ) return( GGadgetDispatchEvent(&gfc->files->vsb->g,event)); else return( true ); } return( false ); }
false
false
false
false
false
0
fc_exch_mgr_add(struct fc_lport *lport, struct fc_exch_mgr *mp, bool (*match)(struct fc_frame *)) { struct fc_exch_mgr_anchor *ema; ema = kmalloc(sizeof(*ema), GFP_ATOMIC); if (!ema) return ema; ema->mp = mp; ema->match = match; /* add EM anchor to EM anchors list */ list_add_tail(&ema->ema_list, &lport->ema_list); kref_get(&mp->kref); return ema; }
false
false
false
false
false
0
open(const char *filename) { if (Generator::open(filename) != 0) { return -1; } fprintf(out, ".tms9900\n"); // Set where RAM starts / ends //Generator *generator = this; //if (dynamic_cast<TMS9900 *>(this) == NULL) if (typeid(this) == typeid(TMS9900 *)) { // FIXME //fprintf(out, "free_ram equ 0\n"); } //fprintf(out, "heap_ptr equ free_ram\n"); //fprintf(out, "free_ram equ ram_start+0\n"); return 0; }
false
false
false
false
false
0
init_test(hid_t file_id) { const char* f_to_c = "(5/9.0)*(x-32)"; /* utrans is a transform for unsigned types: no negative numbers involved and results are < 255 to fit into uchar */ const char* utrans = "((x+100)/4)*3"; hid_t dataspace = -1; hid_t dxpl_id_f_to_c = -1; hid_t dxpl_id_utrans = -1; hid_t cparms = -1; hid_t filespace = -1; hsize_t dim[2] = { ROWS, COLS }; hsize_t offset[2] = { 0, 0 }; if((dxpl_id_f_to_c = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR if((dxpl_id_utrans = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR if(H5Pset_data_transform(dxpl_id_f_to_c, f_to_c) < 0) TEST_ERROR if(H5Pset_data_transform(dxpl_id_utrans, utrans) < 0) TEST_ERROR cparms = H5Pcreate(H5P_DATASET_CREATE); if(H5Pset_chunk(cparms, 2, dim) < 0) TEST_ERROR if((dataspace = H5Screate_simple(2, dim, NULL)) < 0) TEST_ERROR TESTING("Intializing test...") if((dset_id_int = H5Dcreate2(file_id, "/default_int", H5T_NATIVE_INT, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Dwrite(dset_id_int, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillFfloat) < 0) TEST_ERROR if((dset_id_float = H5Dcreate2(file_id, "/default_float", H5T_NATIVE_FLOAT, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Dwrite(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillFfloat) < 0) TEST_ERROR if((dset_id_int_chunk = H5Dcreate2(file_id, "/default_chunk_int", H5T_NATIVE_INT, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0) TEST_ERROR if((filespace = H5Dget_space(dset_id_int_chunk)) < 0) TEST_ERROR if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, dim, NULL) < 0) TEST_ERROR if(H5Dwrite(dset_id_int_chunk, H5T_NATIVE_FLOAT, dataspace, filespace, dxpl_id_f_to_c, windchillFfloat) < 0) TEST_ERROR if((dset_id_float_chunk = H5Dcreate2(file_id, "/default_chunk_float", H5T_NATIVE_FLOAT, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Dwrite(dset_id_float_chunk, H5T_NATIVE_FLOAT, dataspace, filespace, dxpl_id_f_to_c, windchillFfloat) < 0) TEST_ERROR if(H5Pclose(cparms) < 0) TEST_ERROR if(H5Pclose(dxpl_id_f_to_c) < 0) TEST_ERROR if(H5Pclose(dxpl_id_utrans) < 0) TEST_ERROR if(H5Sclose(dataspace) < 0) TEST_ERROR if(H5Sclose(filespace) < 0) TEST_ERROR PASSED(); return 0; error: H5E_BEGIN_TRY { H5Pclose(cparms); H5Pclose(dxpl_id_f_to_c); H5Pclose(dxpl_id_utrans); H5Sclose(dataspace); H5Sclose(filespace); } H5E_END_TRY return -1; }
false
false
false
false
false
0
prepare_generic(EncdescWriteInfo *info, unsigned length, GtBitsequence code) { EncdescCode *this_code; GT_GETNEXTFREEINARRAY(this_code, info->codes, EncdescCode, GT_ENCDESC_ARRAY_RESIZE); this_code->length = length; this_code->code = code; info->total_bits_prepared += this_code->length; }
false
false
false
false
false
0
do_one_keyinfo (ctrl_t ctrl, const unsigned char *grip, assuan_context_t ctx, int data, int with_ssh_fpr, int in_ssh, int ttl, int disabled, int confirm) { gpg_error_t err; char hexgrip[40+1]; char *fpr = NULL; int keytype; unsigned char *shadow_info = NULL; char *serialno = NULL; char *idstr = NULL; const char *keytypestr; int missing_key = 0; char ttlbuf[20]; char flagsbuf[5]; err = agent_key_info_from_file (ctrl, grip, &keytype, &shadow_info); if (err) { if (in_ssh && gpg_err_code (err) == GPG_ERR_NOT_FOUND) missing_key = 1; else goto leave; } /* Reformat the grip so that we use uppercase as good style. */ bin2hex (grip, 20, hexgrip); if (ttl > 0) snprintf (ttlbuf, sizeof ttlbuf, "%d", ttl); else strcpy (ttlbuf, "-"); *flagsbuf = 0; if (disabled) strcat (flagsbuf, "D"); if (in_ssh) strcat (flagsbuf, "S"); if (confirm) strcat (flagsbuf, "c"); if (!*flagsbuf) strcpy (flagsbuf, "-"); if (missing_key) { keytypestr = "-"; } else { switch (keytype) { case PRIVATE_KEY_CLEAR: keytypestr = "D"; break; case PRIVATE_KEY_PROTECTED: keytypestr = "D"; break; case PRIVATE_KEY_SHADOWED: keytypestr = "T"; break; default: keytypestr = "X"; break; } } /* Compute the ssh fingerprint if requested. */ if (with_ssh_fpr) { gcry_sexp_t key; if (!agent_raw_key_from_file (ctrl, grip, &key)) { ssh_get_fingerprint_string (key, &fpr); gcry_sexp_release (key); } } if (shadow_info) { err = parse_shadow_info (shadow_info, &serialno, &idstr); if (err) goto leave; } /* Note that we don't support the CACHED and PROTECTION values as gnupg 2.1 does. We print '-' instead. However we support the ssh fingerprint. */ if (!data) err = agent_write_status (ctrl, "KEYINFO", hexgrip, keytypestr, serialno? serialno : "-", idstr? idstr : "-", "-", "-", fpr? fpr : "-", ttlbuf, flagsbuf, NULL); else { char *string; string = xtryasprintf ("%s %s %s %s - - %s %s %s\n", hexgrip, keytypestr, serialno? serialno : "-", idstr? idstr : "-", fpr? fpr : "-", ttlbuf, flagsbuf); if (!string) err = gpg_error_from_syserror (); else err = assuan_send_data (ctx, string, strlen(string)); xfree (string); } leave: xfree (fpr); xfree (shadow_info); xfree (serialno); xfree (idstr); return err; }
true
true
false
false
false
1
dialog_response_callback (GtkDialog *dialog, gint response_id, TotemGalleryProgress *self) { if (response_id != GTK_RESPONSE_OK) { /* Cancel the operation by killing the process */ kill (self->priv->child_pid, SIGINT); /* Unlink the output file, just in case (race condition) it's already been created */ g_unlink (self->priv->output_filename); } }
false
false
false
false
false
0
GenerateRepresentation(int *regions, int len, vtkPolyData *pd) { int i; vtkPoints *pts; vtkCellArray *polys; if ( this->Top == NULL ) { vtkErrorMacro(<<"vtkKdTree::GenerateRepresentation no tree"); return; } int npoints = 8 * len; int npolys = 6 * len; pts = vtkPoints::New(); pts->Allocate(npoints); polys = vtkCellArray::New(); polys->Allocate(npolys); for (i=0; i<len; i++) { if ((regions[i] < 0) || (regions[i] >= this->NumberOfRegions)) { break; } vtkKdTree::AddPolys(this->RegionList[regions[i]], pts, polys); } pd->SetPoints(pts); pts->Delete(); pd->SetPolys(polys); polys->Delete(); pd->Squeeze(); }
false
false
false
false
false
0
nv_addsub(cap) cmdarg_T *cap; { if (!checkclearopq(cap->oap) && do_addsub((int)cap->cmdchar, cap->count1) == OK) prep_redo_cmd(cap); }
false
false
false
false
false
0
glusterd_volume_compute_cksum (glusterd_volinfo_t *volinfo) { int32_t ret = -1; glusterd_conf_t *priv = NULL; char path[PATH_MAX] = {0,}; char cksum_path[PATH_MAX] = {0,}; char filepath[PATH_MAX] = {0,}; int fd = -1; uint32_t cksum = 0; char buf[4096] = {0,}; char sort_filepath[PATH_MAX] = {0}; gf_boolean_t unlink_sortfile = _gf_false; int sort_fd = 0; runner_t runner; GF_ASSERT (volinfo); priv = THIS->private; GF_ASSERT (priv); GLUSTERD_GET_VOLUME_DIR (path, volinfo, priv); snprintf (cksum_path, sizeof (cksum_path), "%s/%s", path, GLUSTERD_CKSUM_FILE); fd = open (cksum_path, O_RDWR | O_APPEND | O_CREAT| O_TRUNC, 0644); if (-1 == fd) { gf_log (THIS->name, GF_LOG_ERROR, "Unable to open %s, errno: %d", cksum_path, errno); ret = -1; goto out; } snprintf (filepath, sizeof (filepath), "%s/%s", path, GLUSTERD_VOLUME_INFO_FILE); snprintf (sort_filepath, sizeof (sort_filepath), "/tmp/%s.XXXXXX", volinfo->volname); sort_fd = mkstemp (sort_filepath); if (sort_fd < 0) { gf_log (THIS->name, GF_LOG_ERROR, "Could not generate temp file, " "reason: %s for volume: %s", strerror (errno), volinfo->volname); goto out; } else { unlink_sortfile = _gf_true; } /* sort the info file, result in sort_filepath */ runinit (&runner); runner_add_args (&runner, "sort", filepath, NULL); runner_redir (&runner, STDOUT_FILENO, sort_fd); ret = runner_run (&runner); close (sort_fd); if (ret) { gf_log (THIS->name, GF_LOG_ERROR, "failed to sort file %s to %s", filepath, sort_filepath); goto out; } ret = get_checksum_for_path (sort_filepath, &cksum); if (ret) { gf_log (THIS->name, GF_LOG_ERROR, "Unable to get checksum" " for path: %s", sort_filepath); goto out; } snprintf (buf, sizeof (buf), "%s=%u\n", "info", cksum); ret = write (fd, buf, strlen (buf)); if (ret <= 0) { ret = -1; goto out; } ret = get_checksum_for_file (fd, &cksum); if (ret) goto out; volinfo->cksum = cksum; out: if (fd > 0) close (fd); if (unlink_sortfile) unlink (sort_filepath); gf_log (THIS->name, GF_LOG_DEBUG, "Returning with %d", ret); return ret; }
false
false
false
true
false
1
xfermem_get_freespace (txfermem *xf) { size_t freeindex, readindex; if(!xf) return 0; if ((freeindex = xf->freeindex) < 0 || (readindex = xf->readindex) < 0) return (0); if (readindex > freeindex) return ((readindex - freeindex) - 1); else return ((xf->size - (freeindex - readindex)) - 1); }
false
false
false
false
false
0
vertexInferiorDreta(){ QPointF verInferiorDreta(0.0,0.0); QVector<QPointF> pSolucio; for(int i=0;i<=arrayPeces.size()-1;i++){ arrayPeces[i]->puntsSolucio(pSolucio,1.0); for(int j=0;j<=pSolucio.size()-1;j++){ verInferiorDreta.setX(qMax(pSolucio[j].x(), verInferiorDreta.rx())); verInferiorDreta.setY(qMax(pSolucio[j].y(), verInferiorDreta.ry())); } } return verInferiorDreta; }
false
false
false
false
false
0
xm_envelope_calculate_value(IT_ENVELOPE *envelope, IT_PLAYING_ENVELOPE *pe) { if (pe->next_node <= 0) pe->value = envelope->node_y[0] << IT_ENVELOPE_SHIFT; else if (pe->next_node >= envelope->n_nodes) pe->value = envelope->node_y[envelope->n_nodes-1] << IT_ENVELOPE_SHIFT; else { int ys = envelope->node_y[pe->next_node-1] << IT_ENVELOPE_SHIFT; int ts = envelope->node_t[pe->next_node-1]; int te = envelope->node_t[pe->next_node]; if (ts == te) pe->value = ys; else { int ye = envelope->node_y[pe->next_node] << IT_ENVELOPE_SHIFT; int t = pe->tick; pe->value = ys + (ye - ys) * (t - ts) / (te - ts); } } }
false
false
false
false
false
0
addMAC(pMAC_t pMAC, unsigned char* mac) { pMAC_t cur = pMAC; if(mac == NULL) return -1; if(pMAC == NULL) return -1; while(cur->next != NULL) cur = cur->next; //alloc mem cur->next = (pMAC_t) malloc(sizeof(struct MAC_list)); cur = cur->next; //set mac memcpy(cur->mac, mac, 6); cur->next = NULL; return 0; }
false
true
false
false
false
1
glade_widget_get_pack_property (GladeWidget *widget, const gchar *id_property) { GladeProperty *property; g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL); g_return_val_if_fail (id_property != NULL, NULL); if (widget->pack_props_hash && (property = g_hash_table_lookup (widget->pack_props_hash, id_property))) return property; return NULL; }
false
false
false
false
false
0
sky2_rx_start(struct sky2_port *sky2) { struct sky2_hw *hw = sky2->hw; struct rx_ring_info *re; unsigned rxq = rxqaddr[sky2->port]; unsigned i, size, thresh; sky2->rx_put = sky2->rx_next = 0; sky2_qset(hw, rxq); /* On PCI express lowering the watermark gives better performance */ if (pci_find_capability(hw->pdev, PCI_CAP_ID_EXP)) sky2_write32(hw, Q_ADDR(rxq, Q_WM), BMU_WM_PEX); /* These chips have no ram buffer? * MAC Rx RAM Read is controlled by hardware */ if (hw->chip_id == CHIP_ID_YUKON_EC_U && (hw->chip_rev == CHIP_REV_YU_EC_U_A1 || hw->chip_rev == CHIP_REV_YU_EC_U_B0)) sky2_write32(hw, Q_ADDR(rxq, Q_TEST), F_M_RX_RAM_DIS); sky2_prefetch_init(hw, rxq, sky2->rx_le_map, RX_LE_SIZE - 1); if (!(hw->flags & SKY2_HW_NEW_LE)) rx_set_checksum(sky2); /* Space needed for frame data + headers rounded up */ size = (ETH_FRAME_LEN + 8) & ~7; /* Stopping point for hardware truncation */ thresh = (size - 8) / sizeof(u32); sky2->rx_data_size = size; /* Fill Rx ring */ for (i = 0; i < RX_PENDING; i++) { re = sky2->rx_ring + i; re->iob = sky2_rx_alloc(sky2); if (!re->iob) goto nomem; sky2_rx_map_iob(hw->pdev, re, sky2->rx_data_size); sky2_rx_submit(sky2, re); } /* * The receiver hangs if it receives frames larger than the * packet buffer. As a workaround, truncate oversize frames, but * the register is limited to 9 bits, so if you do frames > 2052 * you better get the MTU right! */ if (thresh > 0x1ff) sky2_write32(hw, SK_REG(sky2->port, RX_GMF_CTRL_T), RX_TRUNC_OFF); else { sky2_write16(hw, SK_REG(sky2->port, RX_GMF_TR_THR), thresh); sky2_write32(hw, SK_REG(sky2->port, RX_GMF_CTRL_T), RX_TRUNC_ON); } /* Tell chip about available buffers */ sky2_rx_update(sky2, rxq); return 0; nomem: sky2_rx_clean(sky2); return -ENOMEM; }
false
false
false
false
false
0
cqueue_list_add_cqueue(lList *this_list, lListElem *queue) { bool ret = false; static lSortOrder *so = NULL; DENTER(TOP_LAYER, "cqueue_list_add_cqueue"); if (queue != NULL) { if (so == NULL) { so = lParseSortOrderVarArg(CQ_Type, "%I+", CQ_name); } lInsertSorted(so, queue, this_list); ret = true; } DEXIT; return ret; }
false
false
false
false
false
0
save_CopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = alloc_instruction(ctx, OPCODE_COPY_TEX_IMAGE1D, 7); if (n) { n[1].e = target; n[2].i = level; n[3].e = internalformat; n[4].i = x; n[5].i = y; n[6].i = width; n[7].i = border; } if (ctx->ExecuteFlag) { CALL_CopyTexImage1D(ctx->Exec, (target, level, internalformat, x, y, width, border)); } }
false
false
false
false
false
0
watcher_below_green(const tenm_object *my) { /* sanity check */ if (my == NULL) return 0; if ((my->count[2] == 1) && (my->count[4] >= 3) && (my->count[3] <= 4100)) return 1; if ((my->count[2] == 2) && (my->count[8] != 0)) return 1; return 0; }
false
false
false
false
false
0
dump_invalid_creds(const struct cred *cred, const char *label, const struct task_struct *tsk) { printk(KERN_ERR "CRED: %s credentials: %p %s%s%s\n", label, cred, cred == &init_cred ? "[init]" : "", cred == tsk->real_cred ? "[real]" : "", cred == tsk->cred ? "[eff]" : ""); printk(KERN_ERR "CRED: ->magic=%x, put_addr=%p\n", cred->magic, cred->put_addr); printk(KERN_ERR "CRED: ->usage=%d, subscr=%d\n", atomic_read(&cred->usage), read_cred_subscribers(cred)); printk(KERN_ERR "CRED: ->*uid = { %d,%d,%d,%d }\n", from_kuid_munged(&init_user_ns, cred->uid), from_kuid_munged(&init_user_ns, cred->euid), from_kuid_munged(&init_user_ns, cred->suid), from_kuid_munged(&init_user_ns, cred->fsuid)); printk(KERN_ERR "CRED: ->*gid = { %d,%d,%d,%d }\n", from_kgid_munged(&init_user_ns, cred->gid), from_kgid_munged(&init_user_ns, cred->egid), from_kgid_munged(&init_user_ns, cred->sgid), from_kgid_munged(&init_user_ns, cred->fsgid)); #ifdef CONFIG_SECURITY printk(KERN_ERR "CRED: ->security is %p\n", cred->security); if ((unsigned long) cred->security >= PAGE_SIZE && (((unsigned long) cred->security & 0xffffff00) != (POISON_FREE << 24 | POISON_FREE << 16 | POISON_FREE << 8))) printk(KERN_ERR "CRED: ->security {%x, %x}\n", ((u32*)cred->security)[0], ((u32*)cred->security)[1]); #endif }
false
false
false
false
false
0
fat32_fs_info_verbose_info(const struct fat32_fs_info_t *fs_info) { CHECK_NN( log_debug("FSInfo verbose info: ") ); CHECK_NN( log_debug("\tLead signature: %#" PRIx32, fs_info->lead_signature) ); CHECK_NN( log_debug("\tStruct signature: %#" PRIx32, fs_info->struct_signature) ); CHECK_NN( log_debug("\tTrail signature: %#" PRIx32, fs_info->trail_signature) ); CHECK_NN( log_debug("\tLast known free cluster count: %#" PRIu32, fs_info->last_free_count) ); CHECK_NN( log_debug("\tFree cluster hint: %#" PRIu32, fs_info->free_cluster_hint) ); return 0; }
false
false
false
false
false
0
soup_multipart_input_stream_constructed (GObject *object) { SoupMultipartInputStream *multipart; SoupMultipartInputStreamPrivate *priv; GInputStream *base_stream; const char* boundary; GHashTable *params = NULL; multipart = SOUP_MULTIPART_INPUT_STREAM (object); priv = multipart->priv; base_stream = G_FILTER_INPUT_STREAM (multipart)->base_stream; priv->base_stream = SOUP_FILTER_INPUT_STREAM (soup_filter_input_stream_new (base_stream)); soup_message_headers_get_content_type (priv->msg->response_headers, &params); boundary = g_hash_table_lookup (params, "boundary"); if (boundary) { if (g_str_has_prefix (boundary, "--")) priv->boundary = g_strdup (boundary); else priv->boundary = g_strdup_printf ("--%s", boundary); priv->boundary_size = strlen (priv->boundary); } else { g_warning ("No boundary found in message tagged as multipart."); } g_hash_table_destroy (params); if (G_OBJECT_CLASS (soup_multipart_input_stream_parent_class)->constructed) G_OBJECT_CLASS (soup_multipart_input_stream_parent_class)->constructed (object); }
false
false
false
false
false
0
get_expected_token(const string& raw) { TokenType p = peek_token().type; string s = peek_token().as_string(); if (s != raw) { string msg = "expected `" + raw + "'"; throw_syntax_error(p == kTokenNop ? msg : msg + " instead of `" + s + "'"); } return get_token(); }
false
false
false
false
false
0
qp_free_res(struct mlx4_dev *dev, int slave, int op, int cmd, u64 in_param) { int err; int count; int base; int qpn; switch (op) { case RES_OP_RESERVE: base = get_param_l(&in_param) & 0x7fffff; count = get_param_h(&in_param); err = rem_res_range(dev, slave, base, count, RES_QP, 0); if (err) break; mlx4_release_resource(dev, slave, RES_QP, count, 0); __mlx4_qp_release_range(dev, base, count); break; case RES_OP_MAP_ICM: qpn = get_param_l(&in_param) & 0x7fffff; err = qp_res_start_move_to(dev, slave, qpn, RES_QP_RESERVED, NULL, 0); if (err) return err; if (!fw_reserved(dev, qpn)) __mlx4_qp_free_icm(dev, qpn); res_end_move(dev, slave, RES_QP, qpn); if (valid_reserved(dev, slave, qpn)) err = rem_res_range(dev, slave, qpn, 1, RES_QP, 0); break; default: err = -EINVAL; break; } return err; }
false
false
false
false
false
0
QRinput_encodeModeKanji(QRinput_List *entry, BitStream *bstream, int version, int mqr) { int ret, i; unsigned int val, h; if(mqr) { if(version < 2) { errno = EINVAL; return -1; } ret = BitStream_appendNum(bstream, version - 1, MQRSPEC_MODEID_KANJI); if(ret < 0) return -1; ret = BitStream_appendNum(bstream, MQRspec_lengthIndicator(QR_MODE_KANJI, version), entry->size/2); if(ret < 0) return -1; } else { ret = BitStream_appendNum(bstream, 4, QRSPEC_MODEID_KANJI); if(ret < 0) return -1; ret = BitStream_appendNum(bstream, QRspec_lengthIndicator(QR_MODE_KANJI, version), entry->size/2); if(ret < 0) return -1; } for(i=0; i<entry->size; i+=2) { val = ((unsigned int)entry->data[i] << 8) | entry->data[i+1]; if(val <= 0x9ffc) { val -= 0x8140; } else { val -= 0xc140; } h = (val >> 8) * 0xc0; val = (val & 0xff) + h; ret = BitStream_appendNum(bstream, 13, val); if(ret < 0) return -1; } return 0; }
false
false
false
false
false
0
get_node_attribute_value(const xmlpp::Element* node, const Glib::ustring& strAttributeName) { if(node) { const xmlpp::Attribute* attribute = node->get_attribute(strAttributeName); if(attribute) { Glib::ustring value = attribute->get_value(); //Success. return value; } } return ""; //Failed. }
false
false
false
false
false
0
run_test_loop(struct options *opts) { parameters parms; int i; size_t buf_bytes; /* load options into parameter structure */ parms.num_files = opts->num_files; parms.num_dsets = opts->num_dsets; parms.num_iters = opts->num_iters; parms.rank = opts->dset_rank; parms.h5_align = opts->h5_alignment; parms.h5_thresh = opts->h5_threshold; parms.h5_use_chunks = opts->h5_use_chunks; parms.h5_extendable = opts->h5_extendable; parms.h5_write_only = opts->h5_write_only; parms.h5_use_mpi_posix = opts->h5_use_mpi_posix; parms.verify = opts->verify; parms.vfd = opts->vfd; /* load multidimensional options */ parms.num_bytes = 1; buf_bytes = 1; for (i=0; i<parms.rank; i++){ parms.buf_size[i] = opts->buf_size[i]; parms.dset_size[i] = opts->dset_size[i]; parms.chk_size[i] = opts->chk_size[i]; parms.order[i] = opts->order[i]; parms.num_bytes *= opts->dset_size[i]; buf_bytes *= opts->buf_size[i]; } /* print size information */ output_report("Transfer Buffer Size (bytes): %d\n", buf_bytes); output_report("File Size(MB): %.2f\n",((double)parms.num_bytes) / ONE_MB); print_indent(0); if (opts->io_types & SIO_POSIX) run_test(POSIXIO, parms, opts); print_indent(0); if (opts->io_types & SIO_HDF5) run_test(HDF5, parms, opts); }
false
false
false
false
false
0
qlcnic_82xx_read_phys_port_id(struct qlcnic_adapter *adapter) { u8 mac[ETH_ALEN]; int ret; ret = qlcnic_get_mac_address(adapter, mac, adapter->ahw->physical_port); if (ret) return ret; memcpy(adapter->ahw->phys_port_id, mac, ETH_ALEN); adapter->flags |= QLCNIC_HAS_PHYS_PORT_ID; return 0; }
false
false
false
false
false
0
prefs_set_dialog_to_default(PrefParam *param) { gint i; PrefParam tmpparam; gchar *str_data = NULL; gint int_data; gushort ushort_data; gboolean bool_data; DummyEnum enum_data; for (i = 0; param[i].name != NULL; i++) { if (!param[i].widget_set_func) continue; tmpparam = param[i]; switch (tmpparam.type) { case P_STRING: if (tmpparam.defval) { if (!g_ascii_strncasecmp(tmpparam.defval, "ENV_", 4)) { str_data = g_strdup(g_getenv(param[i].defval + 4)); tmpparam.data = &str_data; break; } else if (tmpparam.defval[0] == '~') { str_data = g_strconcat(get_home_dir(), param[i].defval + 1, NULL); tmpparam.data = &str_data; break; } } tmpparam.data = &tmpparam.defval; break; case P_PASSWORD: tmpparam.data = &tmpparam.defval; break; case P_INT: if (tmpparam.defval) int_data = atoi(tmpparam.defval); else int_data = 0; tmpparam.data = &int_data; break; case P_USHORT: if (tmpparam.defval) ushort_data = atoi(tmpparam.defval); else ushort_data = 0; tmpparam.data = &ushort_data; break; case P_BOOL: if (tmpparam.defval) { if (!g_ascii_strcasecmp(tmpparam.defval, "TRUE")) bool_data = TRUE; else bool_data = atoi(tmpparam.defval) ? TRUE : FALSE; } else bool_data = FALSE; tmpparam.data = &bool_data; break; case P_ENUM: if (tmpparam.defval) enum_data = (DummyEnum)atoi(tmpparam.defval); else enum_data = 0; tmpparam.data = &enum_data; break; case P_OTHER: default: break; } tmpparam.widget_set_func(&tmpparam); g_free(str_data); str_data = NULL; } }
false
false
false
false
false
0
xsh_spectrum_integrate(double* pif, double* piw, int i1_inf, int i1_sup, int i2_inf, int i2_sup, double wave, double wstep) { double sum1=0; double sum2=0; double sum3=0; int i=0; /* main contribute */ for(i=i1_sup;i<i2_inf;i++) { /* simple integration */ sum2+=pif[i]*(piw[i+1]-piw[i]); /* mean 2 point sum2+=pif[i]*(piw[i+1]-piw[i-1])*0.5; Simplex 5 points sum2+=(1/3*pif[i-1]+4/3*pif[i]+1/3*pif[i+1])*(piw[i+1]-piw[i-1])*0.5; */ /* Bode's 5 points formula sum2+=(14/45*pif[i-2]+64/45*pif[i-1]+24/45*pif[i]+64/45*pif[i+1]+14/45*pif[i+2])*(piw[i+1]-piw[i-1])*0.5; */ } /* extra bit from signal on fractional inf/sup pixel sum1=(wave-piw[i1_inf])*pif[i1_inf]; sum3=(piw[i2_sup]-wave)*pif[i2_sup]; */ return (sum1+sum2+sum3); }
false
false
false
false
false
0
sendquery(isc_task_t *task, isc_event_t *event) { struct in_addr inaddr; isc_sockaddr_t address; isc_region_t r; isc_result_t result; dns_fixedname_t keyname; dns_fixedname_t ownername; isc_buffer_t namestr, keybuf; unsigned char keydata[9]; dns_message_t *query; dns_request_t *request; static char keystr[] = "0123456789ab"; isc_event_free(&event); result = ISC_R_FAILURE; if (inet_pton(AF_INET, "10.53.0.1", &inaddr) != 1) CHECK("inet_pton", result); isc_sockaddr_fromin(&address, &inaddr, PORT); dns_fixedname_init(&keyname); isc_buffer_constinit(&namestr, "tkeytest.", 9); isc_buffer_add(&namestr, 9); result = dns_name_fromtext(dns_fixedname_name(&keyname), &namestr, NULL, 0, NULL); CHECK("dns_name_fromtext", result); dns_fixedname_init(&ownername); isc_buffer_constinit(&namestr, ownername_str, strlen(ownername_str)); isc_buffer_add(&namestr, strlen(ownername_str)); result = dns_name_fromtext(dns_fixedname_name(&ownername), &namestr, NULL, 0, NULL); CHECK("dns_name_fromtext", result); isc_buffer_init(&keybuf, keydata, 9); result = isc_base64_decodestring(keystr, &keybuf); CHECK("isc_base64_decodestring", result); isc_buffer_usedregion(&keybuf, &r); initialkey = NULL; result = dns_tsigkey_create(dns_fixedname_name(&keyname), DNS_TSIG_HMACMD5_NAME, isc_buffer_base(&keybuf), isc_buffer_usedlength(&keybuf), ISC_FALSE, NULL, 0, 0, mctx, ring, &initialkey); CHECK("dns_tsigkey_create", result); query = NULL; result = dns_message_create(mctx, DNS_MESSAGE_INTENTRENDER, &query); CHECK("dns_message_create", result); result = dns_tkey_builddhquery(query, ourkey, dns_fixedname_name(&ownername), DNS_TSIG_HMACMD5_NAME, &nonce, 3600); CHECK("dns_tkey_builddhquery", result); request = NULL; result = dns_request_create(requestmgr, query, &address, DNS_REQUESTOPT_TCP, initialkey, TIMEOUT, task, recvquery, query, &request); CHECK("dns_request_create", result); }
true
true
false
false
false
1
tcp_checksum(uint16_t *data, size_t n, struct iphdr *ip) { uint32_t sum = uint16_checksum(data, n); uint16_t sum2; sum += uint16_checksum((uint16_t *)(void *)&ip->saddr, sizeof(ip->saddr)); sum += uint16_checksum((uint16_t *)(void *)&ip->daddr, sizeof(ip->daddr)); sum += ip->protocol + n; sum = (sum & 0xFFFF) + (sum >> 16); sum = (sum & 0xFFFF) + (sum >> 16); sum2 = htons(sum); sum2 = ~sum2; if (sum2 == 0) { return 0xFFFF; } return sum2; }
false
false
false
false
false
0
p7_hmm_CreateBody(P7_HMM *hmm, int M, const ESL_ALPHABET *abc) { int k; int status; hmm->abc = abc; hmm->M = M; /* level 1 */ ESL_ALLOC(hmm->t, (M+1) * sizeof(float *)); ESL_ALLOC(hmm->mat, (M+1) * sizeof(float *)); ESL_ALLOC(hmm->ins, (M+1) * sizeof(float *)); hmm->t[0] = NULL; hmm->mat[0] = NULL; hmm->ins[0] = NULL; /* level 2 */ ESL_ALLOC(hmm->t[0], (p7H_NTRANSITIONS*(M+1)) * sizeof(float)); ESL_ALLOC(hmm->mat[0], (abc->K*(M+1)) * sizeof(float)); ESL_ALLOC(hmm->ins[0], (abc->K*(M+1)) * sizeof(float)); for (k = 1; k <= M; k++) { hmm->mat[k] = hmm->mat[0] + k * hmm->abc->K; hmm->ins[k] = hmm->ins[0] + k * hmm->abc->K; hmm->t[k] = hmm->t[0] + k * p7H_NTRANSITIONS; } /* Enforce conventions on unused but allocated distributions, so * Compare() tests succeed unless memory was corrupted. */ if ((status = p7_hmm_Zero(hmm)) != eslOK) goto ERROR; hmm->mat[0][0] = 1.0; hmm->t[0][p7H_DM] = 1.0; /* Optional allocation, status flag dependent */ if (hmm->flags & p7H_RF) ESL_ALLOC(hmm->rf, (M+2) * sizeof(char)); if (hmm->flags & p7H_MMASK) ESL_ALLOC(hmm->mm, (M+2) * sizeof(char)); if (hmm->flags & p7H_CONS) ESL_ALLOC(hmm->consensus, (M+2) * sizeof(char)); if (hmm->flags & p7H_CS) ESL_ALLOC(hmm->cs, (M+2) * sizeof(char)); if (hmm->flags & p7H_CA) ESL_ALLOC(hmm->ca, (M+2) * sizeof(char)); if (hmm->flags & p7H_MAP) ESL_ALLOC(hmm->map, (M+1) * sizeof(int)); return eslOK; ERROR: return status; }
false
true
false
false
false
1
process_aliases(World *world, const char *cmdline, int start, int end) { char cmd[MAX_BUFFER + 1]; int len = end - start; char *result; if (len >= MAX_BUFFER) { ansitextview_append_string_nl(world->gui, _("Warning: Trying to send a very long command line. Perhaps a recursive alias definition?")); process_command(world, cmdline + start, len); return; } memcpy(cmd, cmdline + start, len); cmd[len] = '\0'; result = substitute_aliases(world, cmd); if (result) { parse_commands(world, result, strlen(result)); g_free(result); } else { process_command(world, cmd, len); } }
true
true
false
false
false
1
iwl_drv_stop(struct iwl_drv *drv) { wait_for_completion(&drv->request_firmware_complete); _iwl_op_mode_stop(drv); iwl_dealloc_ucode(drv); mutex_lock(&iwlwifi_opmode_table_mtx); /* * List is empty (this item wasn't added) * when firmware loading failed -- in that * case we can't remove it from any list. */ if (!list_empty(&drv->list)) list_del(&drv->list); mutex_unlock(&iwlwifi_opmode_table_mtx); #ifdef CONFIG_IWLWIFI_DEBUGFS debugfs_remove_recursive(drv->dbgfs_drv); #endif kfree(drv); }
false
false
false
false
false
0
netsnmp_arch_ipaddress_container_load(netsnmp_container *container, u_int load_flags) { int rc = 0, idx_offset = 0; if (0 == (load_flags & NETSNMP_ACCESS_IPADDRESS_LOAD_IPV6_ONLY)) { rc = _netsnmp_ioctl_ipaddress_container_load_v4(container, idx_offset); if(rc < 0) { u_int flags = NETSNMP_ACCESS_IPADDRESS_FREE_KEEP_CONTAINER; netsnmp_access_ipaddress_container_free(container, flags); } } #if defined (NETSNMP_ENABLE_IPV6) if (0 == (load_flags & NETSNMP_ACCESS_IPADDRESS_LOAD_IPV4_ONLY)) { if (rc < 0) rc = 0; idx_offset = rc; /* * load ipv6, ignoring errors if file not found */ rc = _load_v6(container, idx_offset); if (-2 == rc) rc = 0; else if(rc < 0) { u_int flags = NETSNMP_ACCESS_IPADDRESS_FREE_KEEP_CONTAINER; netsnmp_access_ipaddress_container_free(container, flags); } } #endif /* * return no errors (0) if we found any interfaces */ if(rc > 0) rc = 0; return rc; }
false
false
false
false
false
0
netcgi2_apache_table_get_all(value tv, value str) { CAMLparam2(tv, str); CAMLlocal1(res); /* list */ table *t = Table_val(tv); char *key = String_val(str); res = Val_int(0); /* empty list [] */ /* Only iterates over values associated with [key]. */ apr_table_do(&netcgi2_apache_table_get_loop, &res, t, key, NULL); CAMLreturn(res); }
false
false
false
false
false
0
ossl_ec_key_set_group(VALUE self, VALUE group_v) { VALUE old_group_v; EC_KEY *ec; EC_GROUP *group; Require_EC_KEY(self, ec); SafeRequire_EC_GROUP(group_v, group); old_group_v = rb_iv_get(self, "@group"); if (!NIL_P(old_group_v)) { ossl_ec_group *old_ec_group; SafeGet_ec_group(old_group_v, old_ec_group); old_ec_group->group = NULL; old_ec_group->dont_free = 0; rb_iv_set(old_group_v, "@key", Qnil); } rb_iv_set(self, "@group", Qnil); if (EC_KEY_set_group(ec, group) != 1) ossl_raise(eECError, "EC_KEY_set_group"); return group_v; }
false
false
false
false
false
0
select_container (MonoGenericContainer *gc, MonoTypeEnum type) { gboolean is_var = (type == MONO_TYPE_VAR); if (!gc) return NULL; g_assert (is_var || type == MONO_TYPE_MVAR); if (is_var) { if (gc->is_method || gc->parent) /* * The current MonoGenericContainer is a generic method -> its `parent' * points to the containing class'es container. */ return gc->parent; } return gc; }
false
false
false
false
false
0
Clear() { m_pText->Clear(); m_LastRowStartingAddress = 0; m_ByteCounter = 0; for (int i = 0; i < 67; ++i) m_LineText[i] = _T(' '); }
false
false
false
false
false
0
_e_fileman_dbus_daemon_open_directory_cb(E_DBus_Object *obj __UNUSED__, DBusMessage *message) { DBusMessageIter itr; const char *directory = NULL, *p; char *dev, *to_free = NULL; E_Zone *zone; dbus_message_iter_init(message, &itr); dbus_message_iter_get_basic(&itr, &directory); if ((!directory) || (directory[0] == '\0')) return _e_fileman_dbus_daemon_error(message, "no directory provided."); zone = e_util_zone_current_get(e_manager_current_get()); if (!zone) return _e_fileman_dbus_daemon_error(message, "could not find a zone."); if (strstr(directory, "://")) { Efreet_Uri *uri = efreet_uri_decode(directory); directory = NULL; if (uri) { if ((uri->protocol) && (strcmp(uri->protocol, "file") == 0)) directory = to_free = strdup(uri->path); efreet_uri_free(uri); } if (!directory) return _e_fileman_dbus_daemon_error(message, "unsupported protocol"); } p = strchr(directory, '/'); if (p) { int len = p - directory + 1; dev = malloc(len + 1); if (!dev) { free(to_free); return _e_fileman_dbus_daemon_error(message, "could not allocate memory."); } memcpy(dev, directory, len); dev[len] = '\0'; if ((dev[0] != '/') && (dev[0] != '~')) dev[len - 1] = '\0'; /* remove trailing '/' */ directory += p - directory; } else { dev = strdup(directory); directory = "/"; } e_fwin_new(zone->container, dev, directory); free(dev); free(to_free); return dbus_message_new_method_return(message); }
false
false
false
false
false
0
gtkpod_get_registered_track_commands() { g_return_val_if_fail(GTKPOD_IS_APP(gtkpod_app), NULL); GtkPodAppInterface *gp_iface = GTKPOD_APP_GET_INTERFACE (gtkpod_app); return g_list_copy(gp_iface->track_commands); }
false
false
false
false
false
0
send_dtmf(char *buf, char *name, int id, char *args, struct adsi_script *state, const char *script, int lineno) { char dtmfstr[80], *a; int bytes = 0; if (!(a = get_token(&args, script, lineno))) { ast_log(LOG_WARNING, "Expecting something to send for SENDDTMF at line %d of %s\n", lineno, script); return 0; } if (process_token(dtmfstr, a, sizeof(dtmfstr) - 1, ARG_STRING)) { ast_log(LOG_WARNING, "Invalid token for SENDDTMF at line %d of %s\n", lineno, script); return 0; } a = dtmfstr; while (*a) { if (strchr(validdtmf, *a)) { *buf = *a; buf++; bytes++; } else ast_log(LOG_WARNING, "'%c' is not a valid DTMF tone at line %d of %s\n", *a, lineno, script); a++; } return bytes; }
true
true
false
false
false
1
sge_ls_stop_ls(lListElem *this_ls, int send_no_quit_command) { int ret, exit_status; struct timeval t; DENTER(TOP_LAYER, "sge_ls_stop_ls"); if (sge_ls_get_pid(this_ls) == -1) { DRETURN_VOID; } if (!send_no_quit_command) { ls_send_command(this_ls, "quit\n"); ret = sge_ls_status(this_ls); } else { ret = LS_BROKEN_PIPE; } memset(&t, 0, sizeof(t)); if (ret == LS_OK) { t.tv_sec = LS_QUIT_TIMEOUT; } else { t.tv_sec = 0; } /* close all fds to load sensor */ if (ret != LS_NOT_STARTED) { exit_status = sge_peclose(sge_ls_get_pid(this_ls), lGetRef(this_ls, LS_in), lGetRef(this_ls, LS_out), lGetRef(this_ls, LS_err), (t.tv_sec ? &t : NULL)); DPRINTF(("%s: load sensor `%s` stopped, exit status from sge_peclose= %d\n", SGE_FUNC, lGetString(this_ls, LS_command), exit_status)); } sge_ls_set_pid(this_ls, -1); DRETURN_VOID; }
false
false
false
false
false
0
bfa_fcpim_get_throttle_cfg(struct bfa_s *bfa, u16 drv_cfg_param) { u16 tmp; struct bfa_fcp_mod_s *fcp = BFA_FCP_MOD(bfa); /* * If throttle value from flash is already in effect after driver is * loaded then until next load, always return current value instead * of actual flash value */ if (!fcp->throttle_update_required) return (u16)fcp->num_ioim_reqs; tmp = bfa_dconf_read_data_valid(bfa) ? bfa_fcpim_read_throttle(bfa) : 0; if (!tmp || (tmp > drv_cfg_param)) tmp = drv_cfg_param; return tmp; }
false
false
false
false
false
0
gmm_calc_mix(GMMCalc *gc, HTK_HMM_State *state) { int i; LOGPROB logprob, logprobsum; int s; PROB stream_weight; /* compute Gaussian set */ logprobsum = 0.0; for(s=0;s<gc->OP_nstream;s++) { /* set stream weight */ if (state->w) stream_weight = state->w->weight[s]; else stream_weight = 1.0; /* setup storage pointer for this mixture pdf */ gc->OP_vec = gc->OP_vec_stream[s]; gc->OP_veclen = gc->OP_veclen_stream[s]; /* compute output probabilities */ gmm_gprune_safe(gc, state->pdf[s]->b, state->pdf[s]->mix_num); /* computed Gaussians will be set in: score ... OP_calced_score[0..OP_calced_num] id ... OP_calced_id[0..OP_calced_num] */ /* sum */ for(i=0;i<gc->OP_calced_num;i++) { gc->OP_calced_score[i] += state->pdf[s]->bweight[gc->OP_calced_id[i]]; } /* add log probs */ logprob = addlog_array(gc->OP_calced_score, gc->OP_calced_num); /* if outprob of a stream is zero, skip this stream */ if (logprob <= LOG_ZERO) continue; /* sum all the obtained mixture scores */ logprobsum += logprob * stream_weight; } if (logprobsum == 0.0) return(LOG_ZERO); /* no valid stream */ if (logprobsum <= LOG_ZERO) return(LOG_ZERO); /* lowest == LOG_ZERO */ return (logprob * INV_LOG_TEN); }
false
false
false
false
false
0
check(const QString &checkFilename, const QString &exe, const QByteArray &catalogs) { const QString pwd_buffer = QDir::currentPath(); const QFileInfo file( checkFilename ); setenv( "XML_CATALOG_FILES", catalogs.constData(), 1 ); if ( QFileInfo( exe ).isExecutable() ) { QDir::setCurrent( file.absolutePath() ); QString cmd = exe; cmd += " --valid --noout "; cmd += file.fileName(); cmd += " 2>&1"; FILE *xmllint = popen( QFile::encodeName( cmd ).constData(), "r" ); char buf[ 512 ]; bool noout = true; unsigned int n; while ( ( n = fread(buf, 1, sizeof( buf ) - 1, xmllint ) ) ) { noout = false; buf[ n ] = '\0'; fputs( buf, stderr ); } pclose( xmllint ); QDir::setCurrent( pwd_buffer ); if ( !noout ) return CheckNoOut; } else { return CheckNoXmllint; } return CheckSuccess; }
false
false
false
false
false
0
PKIX_CertSelector_Create( PKIX_CertSelector_MatchCallback callback, PKIX_PL_Object *certSelectorContext, PKIX_CertSelector **pSelector, void *plContext) { PKIX_CertSelector *selector = NULL; PKIX_ENTER(CERTSELECTOR, "PKIX_CertSelector_Create"); PKIX_NULLCHECK_ONE(pSelector); PKIX_CHECK(PKIX_PL_Object_Alloc (PKIX_CERTSELECTOR_TYPE, sizeof (PKIX_CertSelector), (PKIX_PL_Object **)&selector, plContext), PKIX_COULDNOTCREATECERTSELECTOROBJECT); /* * if user specified a particular match callback, we use that one. * otherwise, we use the default match implementation which * understands how to process PKIX_ComCertSelParams */ if (callback){ selector->matchCallback = callback; } else { selector->matchCallback = pkix_CertSelector_DefaultMatch; } /* initialize other fields */ selector->params = NULL; PKIX_INCREF(certSelectorContext); selector->context = certSelectorContext; *pSelector = selector; cleanup: PKIX_RETURN(CERTSELECTOR); }
false
false
false
false
false
0
alloc_mem(size_t siz, CVmObject *) { CVmVarHeapHybrid_head **subheap; size_t i; /* scan for a cell-based subheap that can handle the request */ for (i = 0, subheap = cell_heaps_ ; i < cell_heap_cnt_ ; ++i, ++subheap) { /* * If it will fit in this one's cell size, allocate it from this * subheap. Note that we must adjust the return pointer so that * it points to the caller-visible portion of the block returned * from the subheap, which immediately follows the internal * header. */ if (siz <= (*subheap)->get_cell_size()) return (void *)((*subheap)->alloc(siz) + 1); } /* * We couldn't find a cell-based manager that can handle a block * this large. Allocate the block from the default malloc heap. * Note that the caller-visible block is the part that immediately * follows our internal header, so we must adjust the return pointer * accordingly. */ return (void *)(malloc_heap_->alloc(siz) + 1); }
false
false
false
false
false
0
max_min(argvars, rettv, domax) typval_T *argvars; typval_T *rettv; int domax; { long n = 0; long i; int error = FALSE; if (argvars[0].v_type == VAR_LIST) { list_T *l; listitem_T *li; l = argvars[0].vval.v_list; if (l != NULL) { li = l->lv_first; if (li != NULL) { n = get_tv_number_chk(&li->li_tv, &error); for (;;) { li = li->li_next; if (li == NULL) break; i = get_tv_number_chk(&li->li_tv, &error); if (domax ? i > n : i < n) n = i; } } } } else if (argvars[0].v_type == VAR_DICT) { dict_T *d; int first = TRUE; hashitem_T *hi; int todo; d = argvars[0].vval.v_dict; if (d != NULL) { todo = (int)d->dv_hashtab.ht_used; for (hi = d->dv_hashtab.ht_array; todo > 0; ++hi) { if (!HASHITEM_EMPTY(hi)) { --todo; i = get_tv_number_chk(&HI2DI(hi)->di_tv, &error); if (first) { n = i; first = FALSE; } else if (domax ? i > n : i < n) n = i; } } } } else EMSG(_(e_listdictarg)); rettv->vval.v_number = error ? 0 : n; }
false
false
false
false
false
0
rawgraph_parse(gchar *buffer, RawGraphArgs *args, GError **error) { GwyGraphModel *gmodel; GwyGraphCurveModel *gcmodel; GArray *data = NULL; guint i, ncols = 0; gchar *line, *end; for (line = gwy_str_next_line(&buffer); line; line = gwy_str_next_line(&buffer)) { gdouble *dd; g_strstrip(line); if (!line[0] || line[0] == '#') continue; if (!ncols) { gchar *orig_line = line; while (g_ascii_strtod(line, &end) || end > line) { line = end; ncols++; } /* Skip arbitrary rubbish at the begining */ if (!ncols) { continue; } /* FIXME: We could support more columns, but it quickly gets * complicated. */ if (ncols != 2) { g_set_error(error, GWY_MODULE_FILE_ERROR, GWY_MODULE_FILE_ERROR_DATA, _("Only files with two columns can be imported.")); return NULL; } data = g_array_new(FALSE, FALSE, sizeof(gdouble)*ncols); line = orig_line; } g_array_set_size(data, data->len + 1); dd = &g_array_index(data, gdouble, ncols*(data->len - 1)); /* FIXME: Check whether we actually read data and abort on rubbish. */ for (i = 0; i < ncols; i++) { dd[i] = g_ascii_strtod(line, &end); line = end; } } if (!data) { err_NO_DATA(error); return NULL; } if (!data->len) { err_NO_DATA(error); return NULL; } g_array_sort(data, compare_double); args->data = data; args->xdata = g_new(gdouble, data->len); args->ydata = g_new(gdouble, data->len); args->ncols = ncols; gmodel = gwy_graph_model_new(); for (i = 1; i < ncols; i++) { gcmodel = gwy_graph_curve_model_new(); gwy_graph_model_add_curve(gmodel, gcmodel); g_object_unref(gcmodel); } return gmodel; }
false
false
false
false
false
0
_sock_buffer_maximize(int s, int optname, const char *buftype, int size) { int curbuf = 0; socklen_t curbuflen = sizeof(int); int lo, mid, hi; /* * First we need to determine our current buffer */ if ((getsockopt(s, SOL_SOCKET, optname, (void *) &curbuf, &curbuflen) == 0) && (curbuflen == sizeof(int))) { DEBUGMSGTL(("verbose:socket:buffer:max", "Current %s is %d\n", buftype, curbuf)); /* * Let's not be stupid ... if we were asked for less than what we * already have, then forget about it */ if (size <= curbuf) { DEBUGMSGTL(("verbose:socket:buffer:max", "Requested %s <= current buffer\n", buftype)); return curbuf; } /* * Do a binary search the optimal buffer within 1k of the point of * failure. This is rather bruteforce, but simple */ hi = size; lo = curbuf; while (hi - lo > 1024) { mid = (lo + hi) / 2; if (setsockopt(s, SOL_SOCKET, optname, (void *) &mid, sizeof(int)) == 0) { lo = mid; /* Success: search between mid and hi */ } else { hi = mid; /* Failed: search between lo and mid */ } } /* * Now print if this optimization helped or not */ if (getsockopt(s,SOL_SOCKET, optname, (void *) &curbuf, &curbuflen) == 0) { DEBUGMSGTL(("socket:buffer:max", "Maximized %s: %d\n",buftype, curbuf)); } } else { /* * There is really not a lot we can do anymore. * If the OS doesn't give us the current buffer, then what's the * point in trying to make it better */ DEBUGMSGTL(("socket:buffer:max", "Get %s failed ... giving up!\n", buftype)); curbuf = -1; } return curbuf; }
false
false
false
false
false
0
missing_tail (const double *x, int n) { int i, nmiss = 0; for (i=n-1; i>=0; i--) { if (na(x[i])) { nmiss++; } else { break; } } return nmiss; }
false
false
false
false
false
0
test_config_rename__prevent_overwrite(void) { const git_config_entry *ce; cl_git_pass(git_config_set_string( g_config, "branch.local-track.remote", "yellow")); cl_git_pass(git_config_get_entry( &ce, g_config, "branch.local-track.remote")); cl_assert_equal_s("yellow", ce->value); cl_git_pass(git_config_rename_section( g_repo, "branch.track-local", "branch.local-track")); cl_git_pass(git_config_get_entry( &ce, g_config, "branch.local-track.remote")); cl_assert_equal_s(".", ce->value); /* so, we don't currently prevent overwrite... */ /* { const git_error *err; cl_assert((err = giterr_last()) != NULL); cl_assert(err->message != NULL); } */ }
false
false
false
false
false
0
IsEndpointStart(const std::string &line, int &endpoint) { if( strncmp(line.c_str(), "sep: ", 5) == 0 || strncmp(line.c_str(), "rep: ", 5) == 0 ) { endpoint = atoi(line.c_str() + 5); return true; } return false; }
false
false
false
false
false
0
e1000_check_fiber_options(struct e1000_adapter *adapter) { int bd = adapter->bd_number; if (num_Speed > bd) { e_dev_info("Speed not valid for fiber adapters, parameter " "ignored\n"); } if (num_Duplex > bd) { e_dev_info("Duplex not valid for fiber adapters, parameter " "ignored\n"); } if ((num_AutoNeg > bd) && (AutoNeg[bd] != 0x20)) { e_dev_info("AutoNeg other than 1000/Full is not valid for fiber" "adapters, parameter ignored\n"); } }
false
false
false
false
false
0
diplomat_sabotage_callback(struct widget *pWidget) { if (Main.event.button.button == SDL_BUTTON_LEFT) { if (NULL != game_unit_by_number(pDiplomat_Dlg->diplomat_id) && NULL != game_city_by_number(pDiplomat_Dlg->diplomat_target_id)) { request_diplomat_action(DIPLOMAT_SABOTAGE, pDiplomat_Dlg->diplomat_id, pDiplomat_Dlg->diplomat_target_id, B_LAST + 1); } popdown_diplomat_dialog(); } return -1; }
false
false
false
false
false
0
makeabs(const char *basepath) { int namelen; char *ret; if(!(ret = malloc(PATH_MAX + 1))) { logg("^Can't make room for fullpath.\n"); return NULL; } if(!cli_is_abspath(basepath)) { if(!getcwd(ret, PATH_MAX)) { logg("^Can't get absolute pathname of current working directory.\n"); free(ret); return NULL; } #ifdef _WIN32 if(*basepath == '\\') { namelen = 2; basepath++; } else #endif namelen = strlen(ret); snprintf(&ret[namelen], PATH_MAX - namelen, PATHSEP"%s", basepath); } else { strncpy(ret, basepath, PATH_MAX); } ret[PATH_MAX] = '\0'; return ret; }
false
false
false
false
false
0
squaretrans_pow2(mpd_uint_t *matrix, mpd_size_t size) { mpd_uint_t buf1[SIDE*SIDE]; mpd_uint_t buf2[SIDE*SIDE]; mpd_uint_t *to, *from; mpd_size_t b = size; mpd_size_t r, c; mpd_size_t i; while (b > SIDE) b >>= 1; for (r = 0; r < size; r += b) { for (c = r; c < size; c += b) { from = matrix + r*size + c; to = buf1; for (i = 0; i < b; i++) { memcpy(to, from, b*(sizeof *to)); from += size; to += b; } squaretrans(buf1, b); if (r == c) { to = matrix + r*size + c; from = buf1; for (i = 0; i < b; i++) { memcpy(to, from, b*(sizeof *to)); from += b; to += size; } continue; } else { from = matrix + c*size + r; to = buf2; for (i = 0; i < b; i++) { memcpy(to, from, b*(sizeof *to)); from += size; to += b; } squaretrans(buf2, b); to = matrix + c*size + r; from = buf1; for (i = 0; i < b; i++) { memcpy(to, from, b*(sizeof *to)); from += b; to += size; } to = matrix + r*size + c; from = buf2; for (i = 0; i < b; i++) { memcpy(to, from, b*(sizeof *to)); from += b; to += size; } } } } }
false
true
false
false
false
1
addLine() { int line_no = getNbLines() + 1; GLESourceLine* line = new GLESourceLine(); line->setLineNo(line_no); line->setSource(this); m_Code.push_back(line); return line; }
false
false
false
false
false
0
sqliteBeginTransaction(Parse *pParse, int onError){ sqlite *db; if( pParse==0 || (db=pParse->db)==0 || db->aDb[0].pBt==0 ) return; if( pParse->nErr || sqlite_malloc_failed ) return; if( sqliteAuthCheck(pParse, SQLITE_TRANSACTION, "BEGIN", 0, 0) ) return; if( db->flags & SQLITE_InTrans ){ sqliteErrorMsg(pParse, "cannot start a transaction within a transaction"); return; } sqliteBeginWriteOperation(pParse, 0, 0); if( !pParse->explain ){ db->flags |= SQLITE_InTrans; db->onError = onError; } }
false
false
false
false
false
0
find_first_and_last(const unsigned char *line, int length, int *first, int *last) { int i; int found_first = 0; if (!first || !last) return; *first = 0; *last = 0; for (i = 0; i < length; i++) { if (line[i] == 0) { if (!found_first) (*first)++; } else { *last = i; found_first = 1; } } }
false
false
false
false
false
0
DSDPIndexView(DSDPIndex IS){ int i; DSDPFunctionBegin; printf("Index Set with %d indices.\n",IS.indx[0]); for (i=0;i<IS.indx[0];i++){ printf(" %d",IS.indx[i+1]); } printf(" \n"); DSDPFunctionReturn(0); }
false
false
false
false
false
0
chksuser(uid,gid,hostname,ptrcode,permstr) int uid; /* uid of caller */ int gid; /* gid of caller */ char *hostname ; /* caller's host name */ int *ptrcode ; /* Return code */ char *permstr; /* permission string for the request */ { int found = 0 ; char *cp , *p; char hostname1[MAXHOSTNAMELEN]; int l; if ( uid < 100 ) { if ( permstr != NULL && hostname != NULL && (p=getconfent("RFIOD", permstr, 1)) != NULL ) { l = strlen(localdomain); for (cp=strtok(p,"\t ");cp!=NULL;cp=strtok(NULL,"\t ")) { if ( !strcmp(hostname,cp) ) { found ++ ; break ; } if (strchr(cp,'.')) continue; if (strlen(cp)+l+1 > MAXHOSTNAMELEN) continue; sprintf(hostname1,"%s.%s",cp,localdomain); if ( !strcmp(hostname1,hostname) ) { found ++ ; break ; } } } if (!found) { *ptrcode = EACCES ; log(LOG_ERR,"chksuser():uid < 100: No %s.\n",permstr) ; return -1 ; } else log(LOG_INFO, "chksuser():root authorized from %s\n",hostname); } return 0 ; }
false
false
false
false
false
0
nemo_column_new (const char *name, const char *attribute, const char *label, const char *description) { NemoColumn *column; g_return_val_if_fail (name != NULL, NULL); g_return_val_if_fail (attribute != NULL, NULL); g_return_val_if_fail (label != NULL, NULL); g_return_val_if_fail (description != NULL, NULL); column = g_object_new (NEMO_TYPE_COLUMN, "name", name, "attribute", attribute, "label", label, "description", description, NULL); return column; }
false
false
false
false
false
0
resetContext(int width, int height) { // ### FIXME FIXME: use khtmlImLoad's limit policy // for physical canvas and transform painter to match logical resolution if (workPainter.isActive()) workPainter.end(); if (canvasImage) canvasImage->resizeImage(width, height); else canvasImage = new khtmlImLoad::CanvasImage(width, height); canvasImage->qimage()->fill(0x00000000); // transparent black is the initial state stateStack.clear(); PaintState defaultState; beginPath(); defaultState.infinityTransform = false; defaultState.clipPath = QPainterPath(); defaultState.clipPath.setFillRule(Qt::WindingFill); defaultState.clipping = false; defaultState.globalAlpha = 1.0f; defaultState.globalCompositeOperation = QPainter::CompositionMode_SourceOver; defaultState.strokeStyle = new CanvasColorImpl(QColor(Qt::black)); defaultState.fillStyle = new CanvasColorImpl(QColor(Qt::black)); defaultState.lineWidth = 1.0f; defaultState.lineCap = Qt::FlatCap; defaultState.lineJoin = Qt::SvgMiterJoin; defaultState.miterLimit = 10.0f; defaultState.shadowOffsetX = 0.0f; defaultState.shadowOffsetY = 0.0f; defaultState.shadowBlur = 0.0f; defaultState.shadowColor = QColor(0, 0, 0, 0); // Transparent black stateStack.push(defaultState); dirty = DrtAll; needRendererUpdate(); emptyPath = true; }
false
false
false
false
false
0
AddVisualScene() { FCDSceneNode* visualScene = visualSceneLibrary->AddEntity(); if (visualSceneRoot->GetEntity() == NULL) visualSceneRoot->SetEntity(visualScene); return visualScene; }
false
false
false
false
false
0
PLDataCreate() { PLData *PL = OOGLNewE(PLData, "PLData"); if(toPLsel == 0) initmethods(); PL->maxdim = 0; PL->some = 0; PL->all = PL_HASVC|PL_HASPC|PL_HASVN; VVINIT(PL->faces, Face, 1000); vvzero(&PL->faces); VVINIT(PL->verts, Vert, 1000); vvzero(&PL->faces); VVINIT(PL->vtable, int, 4000); PL->Tn = NULL; TmIdentity(PL->T); PL->ap = ApCreate(AP_DO, APF_FACEDRAW|APF_VECTDRAW, AP_LINEWIDTH, 1, AP_NORMSCALE, 1.0, AP_SHADING, APF_FLAT, AP_END); return PL; }
false
false
false
false
false
0
ssl_sock_infocbk(const SSL *ssl, int where, int ret) { struct connection *conn = (struct connection *)SSL_get_app_data(ssl); (void)ret; /* shut gcc stupid warning */ BIO *write_bio; if (where & SSL_CB_HANDSHAKE_START) { /* Disable renegotiation (CVE-2009-3555) */ if (conn->flags & CO_FL_CONNECTED) { conn->flags |= CO_FL_ERROR; conn->err_code = CO_ER_SSL_RENEG; } } if ((where & SSL_CB_ACCEPT_LOOP) == SSL_CB_ACCEPT_LOOP) { if (!(conn->xprt_st & SSL_SOCK_ST_FL_16K_WBFSIZE)) { /* Long certificate chains optimz If write and read bios are differents, we consider that the buffering was activated, so we rise the output buffer size from 4k to 16k */ write_bio = SSL_get_wbio(ssl); if (write_bio != SSL_get_rbio(ssl)) { BIO_set_write_buffer_size(write_bio, 16384); conn->xprt_st |= SSL_SOCK_ST_FL_16K_WBFSIZE; } } } }
false
false
false
false
false
0
sdmmc_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios) { struct rtsx_usb_sdmmc *host = mmc_priv(mmc); struct rtsx_ucr *ucr = host->ucr; int err = 0; dev_dbg(sdmmc_dev(host), "%s: signal_voltage = %d\n", __func__, ios->signal_voltage); if (host->host_removal) return -ENOMEDIUM; if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_120) return -EPERM; mutex_lock(&ucr->dev_mutex); err = rtsx_usb_card_exclusive_check(ucr, RTSX_USB_SD_CARD); if (err) { mutex_unlock(&ucr->dev_mutex); return err; } /* Let mmc core do the busy checking, simply stop the forced-toggle * clock(while issuing CMD11) and switch voltage. */ rtsx_usb_init_cmd(ucr); if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_330) { rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, SD_PAD_CTL, SD_IO_USING_1V8, SD_IO_USING_3V3); rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, LDO_POWER_CFG, TUNE_SD18_MASK, TUNE_SD18_3V3); } else { rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, SD_BUS_STAT, SD_CLK_TOGGLE_EN | SD_CLK_FORCE_STOP, SD_CLK_FORCE_STOP); rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, SD_PAD_CTL, SD_IO_USING_1V8, SD_IO_USING_1V8); rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, LDO_POWER_CFG, TUNE_SD18_MASK, TUNE_SD18_1V8); } err = rtsx_usb_send_cmd(ucr, MODE_C, 100); mutex_unlock(&ucr->dev_mutex); return err; }
false
false
false
false
false
0
init_status_reason(void) { int i; for(i = 0; i < 600; i++) { status_reason[i] = "(Unknown)"; page_text[i] = NULL; } status_reason[100] = "Continue"; status_reason[101] = "Switching Protocols"; status_reason[200] = "OK"; status_reason[201] = "Created"; status_reason[202] = "Accepted"; status_reason[203] = "Non-Authoritative Information"; status_reason[204] = "No Content"; status_reason[205] = "Reset Content"; status_reason[206] = "Partial Content"; status_reason[300] = "Multiple Choices"; status_reason[301] = "Moved Permanently"; status_reason[302] = "Found"; status_reason[303] = "See Other"; status_reason[304] = "Not Modified"; status_reason[305] = "Use Proxy"; status_reason[306] = "(Unused)"; status_reason[307] = "Temporary Redirect"; status_reason[400] = "Bad Request"; page_text[400] = "The client issued a request that the server is unable to " "respond to."; status_reason[401] = "Unauthorized"; status_reason[402] = "Payment Required"; status_reason[403] = "Forbidden"; page_text[403] = "You are not allowed to visit this page."; status_reason[404] = "Not Found"; page_text[404] = "The file could not be located on the server."; status_reason[405] = "Method Not Allowed"; status_reason[406] = "Not Acceptable"; status_reason[407] = "Proxy Authentication Required"; status_reason[408] = "Request Timeout"; status_reason[409] = "Conflict"; status_reason[410] = "Gone"; status_reason[411] = "Length Required"; status_reason[412] = "Precondition Failed"; status_reason[413] = "Request Entity Too Large"; status_reason[414] = "Request-URI Too Long"; status_reason[415] = "Unsupported Media Type"; status_reason[416] = "Requested Range Not Satisfiable"; status_reason[417] = "Expectation Failed"; status_reason[418] = "I'm a teapot";/* RFC2324 (HTCPCP) only */ status_reason[500] = "Internal Server Error"; page_text[500] = "The server is experiencing abnormal circumstances and was " "unable to respond to your request."; status_reason[501] = "Not Implemented"; status_reason[502] = "Bad Gateway"; status_reason[503] = "Service Unavailable"; status_reason[504] = "Gateway Timeout"; status_reason[505] = "HTTP Version Unsupported"; }
false
false
false
false
false
0
_delete_records (ipmi_sel_state_data_t *state_data) { struct ipmi_sel_arguments *args; unsigned int i; assert (state_data); args = state_data->prog_data->args; for (i = 0; i < args->delete_record_list_length; i++) { if (_delete_entry (state_data, args->delete_record_list[i], 0) < 0) return (-1); } return (0); }
false
false
false
false
false
0
addEvidParams(qs,v) /* overwrite VARID/OPCELL v with */ List qs; /* application of variable to evid. */ Cell v; { /* parameters given by qs */ if (nonNull(qs)) { Cell nv; if (!isVar(v)) internal("addEvidParams"); for (nv=mkVar(textOf(v)); nonNull(tl(qs)); qs=tl(qs)) nv = ap(nv,thd3(hd(qs))); fst(v) = nv; snd(v) = thd3(hd(qs)); } }
false
false
false
false
false
0
awe_match_preset(SFPatchRec *rec, SFPatchRec *pat) { if (rec->preset != -1 && pat->preset != -1 && rec->preset != pat->preset) return FALSE; if (rec->bank != -1 && pat->bank != -1 && rec->bank != pat->bank) return FALSE; if (rec->keynote != -1 && pat->keynote != -1 && rec->keynote != pat->keynote) return FALSE; return TRUE; }
false
false
false
false
false
0
probe_by_scheme (ProbeState * state) { const char * s = strstr (state->filename, "://"); if (s == NULL) return; AUDDBG ("Probing by scheme.\n"); char buf[s - state->filename + 1]; memcpy (buf, state->filename, s - state->filename); buf[s - state->filename] = 0; input_plugin_for_key (INPUT_KEY_SCHEME, buf, (PluginForEachFunc) probe_func_fast, state); }
true
true
false
false
false
1
de_set_rx_mode (struct net_device *dev) { unsigned long flags; struct de_private *de = netdev_priv(dev); spin_lock_irqsave (&de->lock, flags); __de_set_rx_mode(dev); spin_unlock_irqrestore (&de->lock, flags); }
false
false
false
false
false
0
pdfwrite_pdf_open_document(gx_device_pdf * pdev) { if (!is_in_page(pdev) && pdf_stell(pdev) == 0) { stream *s = pdev->strm; int level = (int)(pdev->CompatibilityLevel * 10 + 0.5); pdev->binary_ok = !pdev->params.ASCII85EncodePages; if (pdev->ForOPDFRead) { int code, status; char BBox[256]; int width = (int)(pdev->width * 72.0 / pdev->HWResolution[0] + 0.5); int height = (int)(pdev->height * 72.0 / pdev->HWResolution[1] + 0.5); if (pdev->ProduceDSC) pdev->CompressEntireFile = 0; else { stream_write(s, (byte *)"%!\r", 3); gs_sprintf(BBox, "%%%%BoundingBox: 0 0 %d %d\n", width, height); stream_write(s, (byte *)BBox, strlen(BBox)); if (pdev->params.CompressPages || pdev->CompressEntireFile) { /* When CompressEntireFile is true and ASCII85EncodePages is false, the ASCII85Encode filter is applied, rather one may expect the opposite. Keeping it so due to no demand for this mode. A right implementation should compute the length of the compressed procset, write out an invocation of SubFileDecode filter, and write the length to there assuming the output file is positionable. */ stream_write(s, (byte *)"currentfile /ASCII85Decode filter /LZWDecode filter cvx exec\n", 61); code = encode(&s, &s_A85E_template, pdev->pdf_memory); if (code < 0) return code; code = encode(&s, &s_LZWE_template, pdev->pdf_memory); if (code < 0) return code; } stream_puts(s, "/DSC_OPDFREAD false def\n"); code = copy_procsets(s, pdev->HaveTrueTypes, true); if (code < 0) return code; if (!pdev->CompressEntireFile) { status = s_close_filters(&s, pdev->strm); if (status < 0) return_error(gs_error_ioerror); } else pdev->strm = s; if(pdev->SetPageSize) stream_puts(s, "/SetPageSize true def\n"); if(pdev->RotatePages) stream_puts(s, "/RotatePages true def\n"); if(pdev->FitPages) stream_puts(s, "/FitPages true def\n"); if(pdev->CenterPages) stream_puts(s, "/CenterPages true def\n"); pdev->OPDFRead_procset_length = stell(s); } } if (!(pdev->ForOPDFRead)) { pprintd2(s, "%%PDF-%d.%d\n", level / 10, level % 10); if (pdev->binary_ok) stream_puts(s, "%\307\354\217\242\n"); } } /* * Determine the compression method. Currently this does nothing. * It also isn't clear whether the compression method can now be * changed in the course of the document. * * Flate compression is available starting in PDF 1.2. Since we no * longer support any older PDF versions, we ignore UseFlateCompression * and always use Flate compression. */ if (!pdev->params.CompressPages) pdev->compression = pdf_compress_none; else pdev->compression = pdf_compress_Flate; return 0; }
false
false
false
false
false
0
traverse(void*top){ /*22:*/ #line 472 "./critbit.w" uint8*p= top; if(1&(intptr_t)p){ critbit0_node*q= (void*)(p-1); traverse(q->child[0]); traverse(q->child[1]); free(q); }else{ free(p); } /*:22*/ #line 457 "./critbit.w" }
false
false
false
false
false
0
_pager_window_cb_drag_finished(E_Drag *drag, int dropped) { Pager_Win *pw; E_Container *cont; E_Zone *zone; E_Desk *desk; int x, y, dx, dy; pw = drag->data; if (!pw) return; evas_object_show(pw->o_window); if (!dropped) { int zx, zy, zw, zh; /* wasn't dropped (on pager). move it to position of mouse on screen */ cont = e_container_current_get(e_manager_current_get()); zone = e_zone_current_get(cont); desk = e_desk_current_get(zone); e_border_zone_set(pw->border, zone); e_border_desk_set(pw->border, desk); ecore_x_pointer_last_xy_get(&x, &y); dx = (pw->border->w / 2); dy = (pw->border->h / 2); e_zone_useful_geometry_get(zone, &zx, &zy, &zw, &zh); /* offset so that center of window is on mouse, but keep within desk bounds */ if (dx < x) { x -= dx; if ((pw->border->w < zw) && (x + pw->border->w > zx + zw)) x -= x + pw->border->w - (zx + zw); } else x = 0; if (dy < y) { y -= dy; if ((pw->border->h < zh) && (y + pw->border->h > zy + zh)) y -= y + pw->border->h - (zy + zh); } else y = 0; e_border_move(pw->border, x, y); if (!(pw->border->lock_user_stacking)) e_border_raise(pw->border); } if (pw->drag.from_pager) pw->drag.from_pager->dragging = 0; pw->drag.from_pager = NULL; if (act_popup) { e_grabinput_get(input_window, 0, input_window); if (!hold_count) _pager_popup_hide(1); } }
false
false
false
false
false
0
FLAC__stream_encoder_get_resolved_state_string(const FLAC__StreamEncoder *encoder) { FLAC__ASSERT(0 != encoder); FLAC__ASSERT(0 != encoder->private_); FLAC__ASSERT(0 != encoder->protected_); if(encoder->protected_->state != FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR) return FLAC__StreamEncoderStateString[encoder->protected_->state]; else return FLAC__stream_decoder_get_resolved_state_string(encoder->private_->verify.decoder); }
false
false
false
false
false
0
ast_say_datetime_from_now_en(struct ast_channel *chan, time_t t, const char *ints, const char *lang) { int res=0; struct timeval nowtv = ast_tvnow(), when = { t, 0 }; int daydiff; struct ast_tm tm; struct ast_tm now; char fn[256]; ast_localtime(&when, &tm, NULL); ast_localtime(&nowtv, &now, NULL); daydiff = now.tm_yday - tm.tm_yday; if ((daydiff < 0) || (daydiff > 6)) { /* Day of month and month */ if (!res) { snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon); res = ast_streamfile(chan, fn, lang); if (!res) res = ast_waitstream(chan, ints); } if (!res) res = ast_say_number(chan, tm.tm_mday, ints, lang, (char *) NULL); } else if (daydiff) { /* Just what day of the week */ if (!res) { snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday); res = ast_streamfile(chan, fn, lang); if (!res) res = ast_waitstream(chan, ints); } } /* Otherwise, it was today */ if (!res) res = ast_say_time(chan, t, ints, lang); return res; }
true
true
false
false
false
1
getExternalStorageFileAbsolutePath(std::string &out_path) const { ASSERT_(m_externalFile.size()>2); if (m_externalFile[0]=='/' || ( m_externalFile[1]==':' && m_externalFile[2]=='\\' ) ) { out_path= m_externalFile; } else { out_path = IMAGES_PATH_BASE; size_t N=IMAGES_PATH_BASE.size()-1; if (IMAGES_PATH_BASE[N]!='/' && IMAGES_PATH_BASE[N]!='\\' ) out_path+= "/"; out_path+= m_externalFile; } }
false
false
false
false
false
0
movq(Register dst, Handle<Object> value, RelocInfo::Mode mode) { // If there is no relocation info, emit the value of the handle efficiently // (possibly using less that 8 bytes for the value). if (mode == RelocInfo::NONE) { // There is no possible reason to store a heap pointer without relocation // info, so it must be a smi. ASSERT(value->IsSmi()); movq(dst, reinterpret_cast<int64_t>(*value), RelocInfo::NONE); } else { EnsureSpace ensure_space(this); last_pc_ = pc_; ASSERT(value->IsHeapObject()); ASSERT(!Heap::InNewSpace(*value)); emit_rex_64(dst); emit(0xB8 | dst.low_bits()); emitq(reinterpret_cast<uintptr_t>(value.location()), mode); } }
false
false
false
false
false
0
rt61pci_config_ant(struct rt2x00_dev *rt2x00dev, struct antenna_setup *ant) { const struct antenna_sel *sel; unsigned int lna; unsigned int i; u32 reg; /* * We should never come here because rt2x00lib is supposed * to catch this and send us the correct antenna explicitely. */ BUG_ON(ant->rx == ANTENNA_SW_DIVERSITY || ant->tx == ANTENNA_SW_DIVERSITY); if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) { sel = antenna_sel_a; lna = rt2x00_has_cap_external_lna_a(rt2x00dev); } else { sel = antenna_sel_bg; lna = rt2x00_has_cap_external_lna_bg(rt2x00dev); } for (i = 0; i < ARRAY_SIZE(antenna_sel_a); i++) rt61pci_bbp_write(rt2x00dev, sel[i].word, sel[i].value[lna]); rt2x00mmio_register_read(rt2x00dev, PHY_CSR0, &reg); rt2x00_set_field32(&reg, PHY_CSR0_PA_PE_BG, rt2x00dev->curr_band == IEEE80211_BAND_2GHZ); rt2x00_set_field32(&reg, PHY_CSR0_PA_PE_A, rt2x00dev->curr_band == IEEE80211_BAND_5GHZ); rt2x00mmio_register_write(rt2x00dev, PHY_CSR0, reg); if (rt2x00_rf(rt2x00dev, RF5225) || rt2x00_rf(rt2x00dev, RF5325)) rt61pci_config_antenna_5x(rt2x00dev, ant); else if (rt2x00_rf(rt2x00dev, RF2527)) rt61pci_config_antenna_2x(rt2x00dev, ant); else if (rt2x00_rf(rt2x00dev, RF2529)) { if (rt2x00_has_cap_double_antenna(rt2x00dev)) rt61pci_config_antenna_2x(rt2x00dev, ant); else rt61pci_config_antenna_2529(rt2x00dev, ant); } }
false
false
false
false
false
0
ios_fd(ios_t *s, long fd, int isfile, int own) { _ios_init(s); s->fd = fd; if (isfile) s->rereadable = 1; _buf_init(s, bm_block); s->ownfd = own; if (fd == STDERR_FILENO) s->bm = bm_none; return s; }
false
false
false
false
false
0
find_unaggregated_cols_walker(Node *node, Bitmapset **colnos) { if (node == NULL) return false; if (IsA(node, Var)) { Var *var = (Var *) node; /* setrefs.c should have set the varno to OUTER_VAR */ Assert(var->varno == OUTER_VAR); Assert(var->varlevelsup == 0); *colnos = bms_add_member(*colnos, var->varattno); return false; } if (IsA(node, Aggref) ||IsA(node, GroupingFunc)) { /* do not descend into aggregate exprs */ return false; } return expression_tree_walker(node, find_unaggregated_cols_walker, (void *) colnos); }
false
false
false
false
false
0
findRandomFreeSector() { foreach (const QList<Sector> &i, m_grid) { foreach (const Sector &j, i) { if (!j.hasPlanet()) { goto freesectorexists; } } } return NULL; freesectorexists: Coordinate c; do { c = Game::generatePlanetCoordinates(rows(), columns()); } while (m_grid[c.x()][c.y()].hasPlanet()); return &m_grid[c.x()][c.y()]; }
false
false
false
false
false
0
bsc_skip_to(Scorer *self, int doc_num) { Scorer *cnt_sum_sc = BSc(self)->counting_sum_scorer; if (!BSc(self)->counting_sum_scorer) { cnt_sum_sc = bsc_init_counting_sum_scorer(BSc(self)); } if (cnt_sum_sc->skip_to(cnt_sum_sc, doc_num)) { self->doc = cnt_sum_sc->doc; return true; } else { return false; } }
false
false
false
false
false
0
nonmodal_keypress_cb ( GtkWidget * /*wid*/, GdkEventKey * event, XAP_Dialog * pDlg ) { // propegate keypress up if not F1 if ( event->keyval == GDK_KEY_F1 || event->keyval == GDK_KEY_Help ) { sDoHelp( pDlg ) ; return TRUE ; } return FALSE ; }
false
false
false
false
false
0
select_dlg_create( SDL_Surface *lbox_frame, SDL_Surface *lbox_buttons, int lbox_button_w, int lbox_button_h, int lbox_cell_count, int lbox_cell_w, int lbox_cell_h, void (*lbox_render_cb)(void*, SDL_Surface*), SDL_Surface *conf_frame, SDL_Surface *conf_buttons, int conf_button_w, int conf_button_h, int id_ok, SDL_Surface *surf, int x, int y ) { SelectDlg *sdlg = NULL; int sx, sy; sdlg = calloc(1, sizeof(SelectDlg)); if (sdlg == NULL) goto failure; sdlg->button_group = group_create(conf_frame, 160, conf_buttons, conf_button_w, conf_button_h, 2, id_ok, gui->label, sdl.screen, 0, 0); if (sdlg->button_group == NULL) goto failure; sx = group_get_width( sdlg->button_group ) - 60; sy = 5; group_add_button( sdlg->button_group, id_ok, sx, sy, 0, tr("Apply") ); group_add_button( sdlg->button_group, id_ok+1, sx + 30, sy, 0, tr("Cancel") ); sdlg->select_lbox = lbox_create( lbox_frame, 160, 6, lbox_buttons, lbox_button_w, lbox_button_h, gui->label, lbox_cell_count, lbox_cell_count/2, lbox_cell_w, lbox_cell_h, 1, 0x0000ff, lbox_render_cb, sdl.screen, 0, 0); if (sdlg->select_lbox == NULL) goto failure; return sdlg; failure: fprintf(stderr, tr("Failed to create select dialogue\n")); select_dlg_delete(&sdlg); return NULL; }
false
false
false
false
false
0
gwy_brick_multiply(GwyBrick *brick, gdouble value) { gint i; g_return_if_fail(GWY_IS_BRICK(brick)); for (i = 0; i < (brick->xres*brick->yres*brick->zres); i++) brick->data[i] *= value; }
false
false
false
false
false
0
dup_NC_attr(const NC_attr *rattrp) { NC_attr *attrp = new_NC_attr(rattrp->name->cp, rattrp->type, rattrp->nelems); if(attrp == NULL) return NULL; (void) memcpy(attrp->xvalue, rattrp->xvalue, rattrp->xsz); return attrp; }
false
false
false
false
false
0
mxf_primer_pack_reset (MXFPrimerPack * pack) { g_return_if_fail (pack != NULL); if (pack->mappings) g_hash_table_destroy (pack->mappings); if (pack->reverse_mappings) g_hash_table_destroy (pack->reverse_mappings); memset (pack, 0, sizeof (MXFPrimerPack)); pack->next_free_tag = 0x8000; }
false
false
false
false
false
0
table_primary_key(DB_DATABASE *db, char *table, char ***primary) { #ifdef ODBC_DEBUG_HEADER fprintf(stderr,"[ODBC][%s][%d]\n",__FILE__,__LINE__); fprintf(stderr,"\ttable_primary_key\n"); fflush(stderr); #endif SQLHSTMT statHandle; SQLRETURN retcode; //SQLRETURN V_OD_erg; SQLRETURN nReturn = -1; SQLCHAR szKeyName[101] = ""; SQLCHAR szColumnName[101] = ""; SQLCHAR query[101] = "SELECT * FROM "; SQLSMALLINT colsNum; int i; ODBC_CONN *han = (ODBC_CONN *)db->handle; // CREATE A STATEMENT ODBC_RESULT *res; strcpy((char *)&query[14], table); res = malloc(sizeof(ODBC_RESULT)); retcode = SQLAllocHandle(SQL_HANDLE_STMT, han->odbcHandle, &statHandle); if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO)) { return retcode; } /*if (!SQL_SUCCEEDED (nReturn = SQLPrimaryKeys(statHandle, 0, 0, 0, SQL_NTS, (SQLCHAR *)table, SQL_NTS)))*/ if (!SQL_SUCCEEDED(nReturn = SQLPrimaryKeys(statHandle, (SQLCHAR *)"", 0, (SQLCHAR *)"", 0, (SQLCHAR *)table, SQL_NTS))) { free(res); fprintf(stderr, "return %d\n", nReturn); GB.Error("Unable to get primary key: &1", table); return TRUE; } // GET RESULTS SQLNumResultCols(statHandle, &colsNum); GB.NewArray(primary, sizeof(char *), 0); i = 0; while (SQL_SUCCEEDED(SQLFetch(statHandle))) { if (!SQL_SUCCEEDED (SQLGetData (statHandle, 4, SQL_C_CHAR, &szColumnName[0], sizeof(szColumnName), 0))) strcpy((char *) szColumnName, "Unknown"); if (!SQL_SUCCEEDED (SQLGetData (statHandle, 6, SQL_C_CHAR, &szKeyName[0], sizeof(szKeyName), 0))) strcpy((char *) szKeyName, "Unknown"); *(char **)GB.Add(primary) = GB.NewZeroString((char *)szColumnName); i++; } SQLFreeHandle(SQL_HANDLE_STMT, statHandle); free(res); return FALSE; }
false
true
false
false
false
1
set_packet_list_mode( int mode ) { int old = list_mode; list_mode = mode; mpi_print_mode = DBG_MPI; /* We use stdout print only if invoked by the --list-packets command but switch to stderr in all otehr cases. This breaks the previous behaviour but that seems to be more of a bug than intentional. I don't believe that any application makes use of this long standing annoying way of printing to stdout except when doing a --list-packets. If this assumption fails, it will be easy to add an option for the listing stream. Note that we initialize it only once; mainly because some code may switch the option value later back to 1 and we want to have all output to the same stream. Using stderr is not actually very clean because it bypasses the logging code but it is a special thing anyay. I am not sure whether using log_stream() would be better. Perhaps we should enable the list mdoe only with a special option. */ if (!listfp) listfp = opt.list_packets == 2 ? stdout : stderr; return old; }
false
false
false
false
false
0
release_card(struct l1oip *hc) { int ch; if (timer_pending(&hc->keep_tl)) del_timer(&hc->keep_tl); if (timer_pending(&hc->timeout_tl)) del_timer(&hc->timeout_tl); cancel_work_sync(&hc->workq); if (hc->socket_thread) l1oip_socket_close(hc); if (hc->registered && hc->chan[hc->d_idx].dch) mISDN_unregister_device(&hc->chan[hc->d_idx].dch->dev); for (ch = 0; ch < 128; ch++) { if (hc->chan[ch].dch) { mISDN_freedchannel(hc->chan[ch].dch); kfree(hc->chan[ch].dch); } if (hc->chan[ch].bch) { mISDN_freebchannel(hc->chan[ch].bch); kfree(hc->chan[ch].bch); #ifdef REORDER_DEBUG if (hc->chan[ch].disorder_skb) dev_kfree_skb(hc->chan[ch].disorder_skb); #endif } } spin_lock(&l1oip_lock); list_del(&hc->list); spin_unlock(&l1oip_lock); kfree(hc); }
false
false
false
false
false
0
execute(Environment &env, const Arguments &args) const { calc::Lexer *l = env.getReadLexer(); if (!l) { return 0; } yy::Parser::semantic_type value; yy::location location; bool minus = false; for(;;) { int token = l->nextToken(value, location); switch (token) { case yy::Parser::token::NUMBER: return minus ? - value.num : value.num; case '\n': break; case '-': if (!minus) { minus = true; break; } default: env.error(location.end, "read: expected number"); return 0; } } }
false
false
false
false
false
0