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
mysystem(const char *command, ErrorHandler *errh) { if (no_create) { errh->message("would run %s", command); return 0; } else { if (verbose) errh->message("running %s", command); return system(command); } }
false
false
false
false
false
0
tulip_open(struct net_device *dev) { struct tulip_private *tp = netdev_priv(dev); int retval; tulip_init_ring (dev); retval = request_irq(tp->pdev->irq, tulip_interrupt, IRQF_SHARED, dev->name, dev); if (retval) goto free_ring; tulip_up (dev); netif_start_queue (dev); return 0; free_ring: tulip_free_ring (dev); return retval; }
false
false
false
false
false
0
childSqlGroups() const { SqlStorage* sqlStorage = CollectionManager::instance()->sqlStorage(); if( !sqlStorage ) return SqlPlaylistGroupList(); if ( !m_hasFetchedChildGroups ) { QString query = "SELECT id, parent_id, name, description FROM \ playlist_groups where parent_id=%1 ORDER BY name;"; query = query.arg( QString::number( m_dbId ) ); QStringList result = sqlStorage->query( query ); int resultRows = result.count() / 4; for( int i = 0; i < resultRows; i++ ) { QStringList row = result.mid( i*4, 4 ); SqlPlaylistGroup* mutableThis = const_cast<SqlPlaylistGroup*>( this ); m_childGroups << SqlPlaylistGroupPtr( new SqlPlaylistGroup( row, SqlPlaylistGroupPtr( mutableThis ), m_provider ) ); } m_hasFetchedChildGroups = true; } return m_childGroups; }
false
false
false
false
false
0
be_disable_vxlan_offloads(struct be_adapter *adapter) { struct net_device *netdev = adapter->netdev; if (adapter->flags & BE_FLAGS_VXLAN_OFFLOADS) be_cmd_manage_iface(adapter, adapter->if_handle, OP_CONVERT_TUNNEL_TO_NORMAL); if (adapter->vxlan_port) be_cmd_set_vxlan_port(adapter, 0); adapter->flags &= ~BE_FLAGS_VXLAN_OFFLOADS; adapter->vxlan_port = 0; netdev->hw_enc_features = 0; netdev->hw_features &= ~(NETIF_F_GSO_UDP_TUNNEL); netdev->features &= ~(NETIF_F_GSO_UDP_TUNNEL); }
false
false
false
false
false
0
GVA_seek_frame(t_GVA_Handle *gvahand, gdouble pos, t_GVA_PosUnit pos_unit) { t_GVA_RetCode l_rc; if(gap_debug) { printf("GVA_seek_frame: START handle:%d, pos%.4f unit:%d\n" , (int)gvahand, (float)pos, (int)pos_unit); } l_rc = p_gva_worker_seek_frame(gvahand, pos, pos_unit); if(gap_debug) { printf("GVA_seek_frame: END rc:%d\n" , (int)l_rc); } return(l_rc); }
false
false
false
false
false
0
nntpdriver_connect_stream(mailsession * session, mailstream * s) { int r; r = newsnntp_connect(get_nntp_session(session), s); switch (r) { case NEWSNNTP_NO_ERROR: return MAIL_NO_ERROR_NON_AUTHENTICATED; default: return nntpdriver_nntp_error_to_mail_error(r); } }
false
false
false
false
false
0
is_UCX(fhp) const unsigned char *fhp; { register int i; int seen_null = 0; for (i = 1; i < 14; i++) { if (ND_ISPRINT(fhp[i])) { if (seen_null) return(0); else continue; } else if (fhp[i] == 0) { seen_null = 1; continue; } else return(0); } return(1); }
false
false
false
false
false
0
gotoFirstElement() { this->gotoFirstCategory(); while(cat_cur != NULL) { this->gotoCategoriesFirstElement(); if(el_cur != NULL) { break; } this->gotoNextCategory(); } }
false
false
false
false
false
0
out_coeff(FILE *fp, const double v, const int print_1) const { double lp_eps = getEpsilon(); if(!print_1) { if(fabs(v-1) < lp_eps) { return; } if(fabs(v+1) < lp_eps) { fprintf(fp, " -"); return; } } double frac = v - floor(v); if(frac < lp_eps) { fprintf(fp, " %.0f", floor(v)); } else { if(frac > 1 - lp_eps) { fprintf(fp, " %.0f", floor(v+0.5)); } else { int decimals = getDecimals(); char form[15]; sprintf(form, " %%.%df", decimals); fprintf(fp, form, v); } } }
false
false
false
false
false
0
Le(const Vector &w) const { const AreaLight *area = primitive->GetAreaLight(); return area ? area->L(dg.p, dg.nn, w) : Spectrum(0.); }
false
false
false
false
false
0
_cogl_util_pixel_format_from_masks_real (unsigned long r_mask, unsigned long g_mask, unsigned long b_mask, int depth, int bpp, CoglBool check_bgr, CoglBool check_afirst, int recursion_depth) { CoglPixelFormat image_format; if (depth == 24 && bpp == 24 && r_mask == 0xff0000 && g_mask == 0xff00 && b_mask == 0xff) { return COGL_PIXEL_FORMAT_RGB_888; } else if ((depth == 24 || depth == 32) && bpp == 32 && r_mask == 0xff0000 && g_mask == 0xff00 && b_mask == 0xff) { return COGL_PIXEL_FORMAT_ARGB_8888_PRE; } else if ((depth == 30 || depth == 32) && r_mask == 0x3ff00000 && g_mask == 0xffc00 && b_mask == 0x3ff) { return COGL_PIXEL_FORMAT_ARGB_2101010_PRE; } else if (depth == 16 && bpp == 16 && r_mask == 0xf800 && g_mask == 0x7e0 && b_mask == 0x1f) { return COGL_PIXEL_FORMAT_RGB_565; } if (recursion_depth == 2) return 0; /* Check for BGR ordering if we didn't find a match */ if (check_bgr) { image_format = _cogl_util_pixel_format_from_masks_real (b_mask, g_mask, r_mask, depth, bpp, FALSE, TRUE, recursion_depth + 1); if (image_format) return image_format ^ COGL_BGR_BIT; } /* Check for alpha in the least significant bits if we still * haven't found a match... */ if (check_afirst && depth != bpp) { int shift = bpp - depth; image_format = _cogl_util_pixel_format_from_masks_real (r_mask >> shift, g_mask >> shift, b_mask >> shift, depth, bpp, TRUE, FALSE, recursion_depth + 1); if (image_format) return image_format ^ COGL_AFIRST_BIT; } return 0; }
false
false
false
false
false
0
enumRangeForCopy(const void *context, UChar32 start, UChar32 end, uint32_t value) { return value == Collation::UNASSIGNED_CE32 || value == Collation::FALLBACK_CE32 || ((CopyHelper *)context)->copyRangeCE32(start, end, value); }
false
false
false
false
false
0
list2set (Tree l) { Tree s = nil; while (isList(l)) { s = addElement(hd(l),s); l = tl(l); } return s; }
false
false
false
false
false
0
yield(void) { #if (PthreadDraftVersion == 6) pthread_yield(NULL); #elif (PthreadDraftVersion < 9) pthread_yield(); #else THROW_ERRORS(sched_yield()); #endif }
false
false
false
false
false
0
drv_generic_graphic_blit(const int row, const int col, const int height, const int width) { if (drv_generic_graphic_real_blit) { int r, c, h, w; drv_generic_graphic_window(row, height, DROWS, &r, &h); drv_generic_graphic_window(col, width, DCOLS, &c, &w); if (h > 0 && w > 0) { drv_generic_graphic_real_blit(r, c, h, w); } } }
false
false
false
false
false
0
lzexe_init(exe_handle_t *handle, FILE *f) { handle->f = f; handle->bufptr = handle->buffer; handle->eod = 0; if (!lzexe_read_uint16(handle->f, &handle->buf)) return 0; handle->count = 16; return 1; }
false
false
false
false
false
0
pnfs_lseg_dec_and_remove_zero(struct pnfs_layout_segment *lseg, struct list_head *tmp_list) { if (!atomic_dec_and_test(&lseg->pls_refcount)) return false; pnfs_layout_remove_lseg(lseg->pls_layout, lseg); list_add(&lseg->pls_list, tmp_list); return true; }
false
false
false
false
false
0
ast_party_connected_line_copy(struct ast_party_connected_line *dest, const struct ast_party_connected_line *src) { if (dest == src) { /* Don't copy to self */ return; } ast_party_id_copy(&dest->id, &src->id); ast_party_id_copy(&dest->ani, &src->ani); ast_party_id_copy(&dest->priv, &src->priv); dest->ani2 = src->ani2; dest->source = src->source; }
false
false
false
false
false
0
bfd_elf_allocate_object (bfd *abfd, size_t object_size, enum elf_target_id object_id) { BFD_ASSERT (object_size >= sizeof (struct elf_obj_tdata)); abfd->tdata.any = bfd_zalloc (abfd, object_size); if (abfd->tdata.any == NULL) return FALSE; elf_object_id (abfd) = object_id; elf_program_header_size (abfd) = (bfd_size_type) -1; return TRUE; }
false
false
false
false
false
0
sprintf_ipaddr(char *buf, u8 *ip) { char *str = buf; if (ip[0] == 0 && ip[1] == 0 && ip[2] == 0 && ip[3] == 0 && ip[4] == 0 && ip[5] == 0 && ip[6] == 0 && ip[7] == 0 && ip[8] == 0 && ip[9] == 0 && ip[10] == 0xff && ip[11] == 0xff) { /* * IPV4 */ str += sprintf(buf, "%pI4", ip + 12); } else { /* * IPv6 */ str += sprintf(str, "%pI6", ip); } str += sprintf(str, "\n"); return str - buf; }
false
false
false
false
false
0
pack_cells(ref_t* href) { ref_t ref = *href--; if (ref == ROOT_REF) { return; } if (cell_[ref].is_left_ref_ || cell_[ref].is_right_ref_ || cell_[ref].left_.bitmap_ != cell_[ref].right_.bitmap_) { return; } const bitmap_t bitmap = cell_[ref].left_.bitmap_; do { ref = *href--; if (!cell_[ref].is_left_ref_) { if (cell_[ref].left_.bitmap_ != bitmap) { break; } } else if (!cell_[ref].is_right_ref_) { if (cell_[ref].right_.bitmap_ != bitmap) { break; } } else { break; } } while (ref != ROOT_REF); const ref_t par_ref = href[2]; if (cell_[ref].is_left_ref_ && cell_[ref].left_.ref_ == par_ref) { cell_[ref].is_left_ref_ = false; cell_[ref].left_.bitmap_ = bitmap; } else { cell_[ref].is_right_ref_ = false; cell_[ref].right_.bitmap_ = bitmap; } free_cell(par_ref); }
false
false
false
false
false
0
qlcnic_83xx_poll_process_aen(struct qlcnic_adapter *adapter) { u32 resp, event, rsp_status = QLC_83XX_MBX_RESPONSE_ARRIVED; struct qlcnic_mailbox *mbx = adapter->ahw->mailbox; unsigned long flags; spin_lock_irqsave(&mbx->aen_lock, flags); resp = QLCRDX(adapter->ahw, QLCNIC_FW_MBX_CTRL); if (!(resp & QLCNIC_SET_OWNER)) goto out; event = readl(QLCNIC_MBX_FW(adapter->ahw, 0)); if (event & QLCNIC_MBX_ASYNC_EVENT) { __qlcnic_83xx_process_aen(adapter); } else { if (mbx->rsp_status != rsp_status) qlcnic_83xx_notify_mbx_response(mbx); } out: qlcnic_83xx_enable_legacy_msix_mbx_intr(adapter); spin_unlock_irqrestore(&mbx->aen_lock, flags); }
false
false
false
false
false
0
rbtree_lookup(const rbtree_t *rbt, const void *key) { struct rbdata *rd; struct rbdata item; rbtree_check(rbt); g_assert(key != NULL); item.data = deconstify_pointer(key); rd = erbtree_lookup(ERBTREE(rbt), &item); return NULL == rd ? NULL : rd->data; }
false
false
false
false
false
0
e_tree_model_generator_convert_child_iter_to_iter (ETreeModelGenerator *tree_model_generator, GtkTreeIter *generator_iter, GtkTreeIter *child_iter) { GtkTreePath *path; GArray *group; gint depth; gint index = 0; g_return_if_fail (E_IS_TREE_MODEL_GENERATOR (tree_model_generator)); path = gtk_tree_model_get_path (tree_model_generator->priv->child_model, child_iter); if (!path) return; group = tree_model_generator->priv->root_nodes; for (depth = 0; depth < gtk_tree_path_get_depth (path); depth++) { Node *node; index = gtk_tree_path_get_indices (path)[depth]; node = &g_array_index (group, Node, index); if (depth + 1 < gtk_tree_path_get_depth (path)) group = node->child_nodes; if (!group) { g_warning ("ETreeModelGenerator was asked for iter to unknown child element!"); break; } } g_return_if_fail (group != NULL); index = child_offset_to_generated_offset (group, index); ITER_SET (tree_model_generator, generator_iter, group, index); gtk_tree_path_free (path); }
false
false
false
false
false
0
string_obj_hash(const void *key) { struct vm_object *array; unsigned long hash; jint offset; jint count; offset = field_get_int(key, vm_java_lang_String_offset); count = field_get_int(key, vm_java_lang_String_count); array = field_get_object(key, vm_java_lang_String_value); hash = 0; for (jint i = 0; i < count; i++) hash += 31 * hash + array_get_field_char(array, i + offset); return hash; }
false
false
false
false
false
0
compute_right(GtBittab **right, const ConsensusSA *csa) { gt_assert(csa); compute_left_or_right(right, csa, is_left_of); }
false
false
false
false
false
0
zexp(i_ctx_t *i_ctx_p) { os_ptr op = osp; double args[2]; double result; double ipart; int code = num_params(op, 2, args); if (code < 0) return code; if (args[0] < 0.0 && modf(args[1], &ipart) != 0.0) return_error(e_undefinedresult); if (args[0] == 0.0 && args[1] == 0.0) result = 1.0; /* match Adobe; can't rely on C library */ else result = pow(args[0], args[1]); make_real(op - 1, result); pop(1); return 0; }
false
false
false
false
false
0
endstrcb(CONNECTION *c, int pending) { int rc; char lbuf[MAXERRMSG]; int i; char buf[4]; if (!c->numrecs) { /* If no recs include result code of 0 */ rrpc_initbuf(&c->obuf); buf[0] = '0'; buf[1] = '\0'; i = 2; } else i = 0; if (pending) buf[i++] = 1; buf[i++] = '\0'; if ((rc = rrpc_bufwrite(&c->handle, &c->obuf, buf, i, 1, c->errmsg)) != GLOBUS_RLS_SUCCESS) logit(LOG_WARNING, "endstrcb: rrpc_bufwrite: %s", globus_rls_errmsg(rc, c->errmsg, lbuf, MAXERRMSG)); c->numrecs = 0; }
false
false
false
false
false
0
ser_emit_triple(void* user_data, const char* subject, int subject_type, const char* predicate_nspace, const char* predicate_name, const char *object, int object_type, const char *datatype_uri) { raptor_serializer* serializer = (raptor_serializer*)user_data; raptor_statement s; /* static */ raptor_uri* predicate_ns_uri; raptor_uri* predicate_uri; raptor_statement_init(&s, rworld); if(subject_type == FLICKCURL_TERM_TYPE_RESOURCE) s.subject = raptor_new_term_from_uri_string(rworld, (const unsigned char*)subject); else /* blank node */ s.subject = raptor_new_term_from_blank(rworld, (const unsigned char*)subject); predicate_ns_uri = raptor_new_uri(rworld, (const unsigned char*)predicate_nspace); predicate_uri = raptor_new_uri_from_uri_local_name(rworld, predicate_ns_uri, (const unsigned char*)predicate_name); s.predicate = raptor_new_term_from_uri(rworld, predicate_uri); raptor_free_uri(predicate_uri); raptor_free_uri(predicate_ns_uri); if(object_type == FLICKCURL_TERM_TYPE_RESOURCE) s.object = raptor_new_term_from_uri_string(rworld, (const unsigned char*)object); else if(object_type == FLICKCURL_TERM_TYPE_BLANK) s.object = raptor_new_term_from_blank(rworld, (const unsigned char*)subject); else { /* literal */ raptor_uri* raptor_datatype_uri = NULL; if(datatype_uri) raptor_datatype_uri = raptor_new_uri(rworld, (const unsigned char*)datatype_uri); s.object = raptor_new_term_from_literal(rworld, (const unsigned char*)object, raptor_datatype_uri, NULL /* language */); raptor_free_uri(raptor_datatype_uri); } raptor_serializer_serialize_statement(serializer, &s); raptor_statement_clear(&s); }
false
false
false
false
false
0
restore_cache_bottom(struct traverse_info *info, int bottom) { struct unpack_trees_options *o = info->data; if (o->diff_index_cached) return; o->cache_bottom = bottom; }
false
false
false
false
false
0
gretl_quantile (int t1, int t2, const double *x, double p, gretlopt opt, int *err) { double *a = NULL; double xmin, xmax; double N, ret; int nl, nh; int t, n = 0; if (p <= 0 || p >= 1) { /* sanity check */ *err = E_DATA; return NADBL; } n = gretl_minmax(t1, t2, x, &xmin, &xmax); if (n == 0) { *err = E_DATA; return NADBL; } N = (n + 1) * p - 1; nl = floor(N); nh = ceil(N); if (nh == 0 || nh == n) { /* too few usable observations for such an extreme quantile */ *err = E_DATA; if (!(opt & OPT_Q)) { fprintf(stderr, "n = %d: not enough data for %g quantile\n", n, p); } return NADBL; } a = malloc(n * sizeof *a); if (a == NULL) { *err = E_ALLOC; return NADBL; } n = 0; for (t=t1; t<=t2; t++) { if (!na(x[t])) { a[n++] = x[t]; } } #if 0 fprintf(stderr, "\tp = %12.10f, n = %d, N = %12.10f, nl = %d, nh = %d\n", p, n, N, nl, nh); #endif if (nl == nh) { /* "exact" */ ret = find_hoare(a, n, nl); } else { ret = find_hoare_inexact(a, p, xmin, xmax, N - nl, n, nl, nh); } free(a); return ret; }
false
false
false
false
true
1
putRV(RegisterValue rv) { RegisterValue before = getReplaced()->getRV_notrace(); getReplaced()->putRV(rv); if (before != getReplaced()->getRV_notrace()) invokeAction(); }
false
false
false
false
false
0
iks_sasl_mechanisms (iks *x) { int sasl_mech = 0; while (x) { if (!iks_strcmp(iks_cdata(iks_child(x)), "DIGEST-MD5")) sasl_mech |= IKS_STREAM_SASL_MD5; else if (!iks_strcmp(iks_cdata(iks_child(x)), "PLAIN")) sasl_mech |= IKS_STREAM_SASL_PLAIN; x = iks_next_tag(x); } return sasl_mech; }
false
false
false
false
false
0
compare_vector2(int k, int i, int num) { int j; for (j = 0; j < num; j++) if (connect_mtr[i][j].next != connect_mtr[k][j].next || connect_mtr[i][j].cost != connect_mtr[k][j].cost) return 0; return 1; }
false
false
false
false
false
0
Score(OBMol &mol, unsigned int index, const RotorKeys &keys, const std::vector<double*> &conformers) { unsigned int numAtoms = mol.NumAtoms(); double *origCoords = mol.GetCoordinates(); // copy the original coordinates to coords // copy the conformer coordinates to OBMol object std::vector<double> coords(mol.NumAtoms() * 3); for (unsigned int i = 0; i < mol.NumAtoms() * 3; ++i) { coords[i] = origCoords[i]; origCoords[i] = conformers[index][i]; } OBForceField *ff = OBForceField::FindType("MMFF94"); if (!ff->Setup(mol)) { ff = OBForceField::FindType("UFF"); if (!ff->Setup(mol)) return 10e10; } ff->SteepestDescent(50); double score = ff->Energy(); // copy original coordinates back for (unsigned int i = 0; i < mol.NumAtoms() * 3; ++i) origCoords[i] = coords[i]; double *conformer_i = conformers[index]; std::vector<vector3> vi; for (unsigned int a = 0; a < numAtoms; ++a) vi.push_back(vector3(conformer_i[a*3], conformer_i[a*3+1], conformer_i[a*3+2])); OBAlign align(mol, mol, false, false); align.SetRef(vi); double score_min = 10e10; for (unsigned int j = 0; j < conformers.size(); ++j) { if (index == j) continue; double *conformer_j = conformers[j]; // create vector3 conformer std::vector<vector3> vj; for (unsigned int a = 0; a < numAtoms; ++a) vj.push_back(vector3(conformer_j[a*3], conformer_j[a*3+1], conformer_j[a*3+2])); // perform Kabsch alignment align.SetTarget(vj); align.Align(); // get the RMSD double rmsd = align.GetRMSD(); // store the rmsd if it is lower than any of the previous if (rmsd < score_min) score_min = rmsd; } // return the lowest RMSD return score_min; }
false
false
false
false
false
0
IoCoroutine_rawSetErrorDescription_(IoCoroutine *self, IoSymbol *description) { IoSymbol *errorSlotName = IOSYMBOL("error"); IoObject *error = IoObject_rawGetSlot_(self, errorSlotName); if(!error || ISNIL(error)) { error = IoObject_rawGetSlot_(self, IOSYMBOL("Error")); error = IOCLONE(error); IoObject_setSlot_to_(self, errorSlotName, error); } IoObject_setSlot_to_(error, IOSYMBOL("description"), description); return error; }
false
false
false
false
false
0
asan_needs_local_alias (tree decl) { return DECL_WEAK (decl) || !targetm.binds_local_p (decl); }
false
false
false
false
false
0
fso_framework_pty_transport_instance_init (FsoFrameworkPtyTransport * self) { gchar* _tmp0_ = NULL; self->priv = FSO_FRAMEWORK_PTY_TRANSPORT_GET_PRIVATE (self); _tmp0_ = g_new0 (gchar, 1024); self->priv->ptyname = _tmp0_; self->priv->ptyname_length1 = 1024; self->priv->_ptyname_size_ = self->priv->ptyname_length1; }
false
false
false
false
false
0
stac9205_fixup_ref(struct hda_codec *codec, const struct hda_fixup *fix, int action) { struct sigmatel_spec *spec = codec->spec; if (action == HDA_FIXUP_ACT_PRE_PROBE) { snd_hda_apply_pincfgs(codec, ref9205_pin_configs); /* SPDIF-In enabled */ spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0; } }
false
false
false
false
false
0
kv_populate_vce_table(struct amdgpu_device *adev) { struct kv_power_info *pi = kv_get_pi(adev); int ret; u32 i; struct amdgpu_vce_clock_voltage_dependency_table *table = &adev->pm.dpm.dyn_state.vce_clock_voltage_dependency_table; struct atom_clock_dividers dividers; if (table == NULL || table->count == 0) return 0; pi->vce_level_count = 0; for (i = 0; i < table->count; i++) { if (pi->high_voltage_t && pi->high_voltage_t < table->entries[i].v) break; pi->vce_level[i].Frequency = cpu_to_be32(table->entries[i].evclk); pi->vce_level[i].MinVoltage = cpu_to_be16(table->entries[i].v); pi->vce_level[i].ClkBypassCntl = (u8)kv_get_clk_bypass(adev, table->entries[i].evclk); ret = amdgpu_atombios_get_clock_dividers(adev, COMPUTE_ENGINE_PLL_PARAM, table->entries[i].evclk, false, &dividers); if (ret) return ret; pi->vce_level[i].Divider = (u8)dividers.post_div; pi->vce_level_count++; } ret = amdgpu_kv_copy_bytes_to_smc(adev, pi->dpm_table_start + offsetof(SMU7_Fusion_DpmTable, VceLevelCount), (u8 *)&pi->vce_level_count, sizeof(u8), pi->sram_end); if (ret) return ret; pi->vce_interval = 1; ret = amdgpu_kv_copy_bytes_to_smc(adev, pi->dpm_table_start + offsetof(SMU7_Fusion_DpmTable, VCEInterval), (u8 *)&pi->vce_interval, sizeof(u8), pi->sram_end); if (ret) return ret; ret = amdgpu_kv_copy_bytes_to_smc(adev, pi->dpm_table_start + offsetof(SMU7_Fusion_DpmTable, VceLevel), (u8 *)&pi->vce_level, sizeof(SMU7_Fusion_ExtClkLevel) * SMU7_MAX_LEVELS_VCE, pi->sram_end); return ret; }
false
false
false
false
false
0
costString(EventTypeSet*) { if (_dirty) update(); return QString("%1/%2") .arg(_followedCount.pretty()) .arg(_executedCount.pretty()); }
false
false
false
false
false
0
onCmdMoveRight(FXObject*,FXSelector,void*){ if(current.col>ncols-2) return 1; setCurrentItem(current.row,current.col+1,TRUE); makePositionVisible(current.row,current.col); return 1; }
false
false
false
false
false
0
mprintf(const char *zFormat, ...){ va_list ap; struct sgMprintf sMprintf; char *zNew; char zBuf[200]; sMprintf.nChar = 0; sMprintf.nAlloc = sizeof(zBuf); sMprintf.zText = zBuf; sMprintf.zBase = zBuf; va_start(ap,zFormat); vxprintf(mout,&sMprintf,zFormat,ap); va_end(ap); sMprintf.zText[sMprintf.nChar] = 0; if( sMprintf.zText==sMprintf.zBase ){ zNew = malloc( sMprintf.nChar+1 ); if( zNew ) memcpy(zNew, zBuf, sMprintf.nChar+1); }else{ zNew = realloc(sMprintf.zText,sMprintf.nChar+1); if( zNew==0 ){ free(sMprintf.zText); } } if( zNew==0 ) exit(1); return zNew; }
false
false
false
false
false
0
cgraph_allocate_node (void) { struct cgraph_node *node; if (free_nodes) { node = free_nodes; free_nodes = NEXT_FREE_NODE (node); } else { node = ggc_alloc_cleared_cgraph_node (); node->uid = cgraph_max_uid++; } return node; }
false
false
false
false
false
0
rtl8152_get_coalesce(struct net_device *netdev, struct ethtool_coalesce *coalesce) { struct r8152 *tp = netdev_priv(netdev); switch (tp->version) { case RTL_VER_01: case RTL_VER_02: return -EOPNOTSUPP; default: break; } coalesce->rx_coalesce_usecs = tp->coalesce; return 0; }
false
false
false
false
false
0
gegl_path_remove_node (GeglPath *vector, gint pos) { GeglPathPrivate *priv = GEGL_PATH_GET_PRIVATE (vector); GeglPathList *iter; GeglPathList *prev = NULL; gint count=0; if (pos == -1) pos = gegl_path_get_n_nodes (vector)-1; for (iter = priv->path; iter; iter=iter->next) { if (count == pos) { if (prev) prev->next = iter->next; else priv->path = iter->next; gegl_path_item_free (iter); break; } prev = iter; count ++; } priv->flat_path_clean = FALSE; priv->length_clean = FALSE; priv->tail = NULL; gegl_path_emit_changed (vector, NULL); }
false
false
false
false
false
0
constraintescape(const char* url) { size_t len; char* p; int c; char* eurl; if(url == NULL) return NULL; len = strlen(url); eurl = ocmalloc(1+3*len); /* worst case: c -> %xx */ MEMCHECK(eurl,NULL); p = eurl; *p = '\0'; while((c=*url++)) { if(c >= '0' && c <= '9') {*p++ = c;} else if(c >= 'a' && c <= 'z') {*p++ = c;} else if(c >= 'A' && c <= 'Z') {*p++ = c;} else if(strchr(okchars,c) != NULL) {*p++ = c;} else { *p++ = '%'; *p++ = hexdigits[(c & 0xf0)>>4]; *p++ = hexdigits[(c & 0xf)]; } } *p = '\0'; return eurl; }
false
false
false
false
false
0
ghid_category_vbox (GtkWidget * box, const gchar * category_header, gint header_pad, gint box_pad, gboolean pack_start, gboolean bottom_pad) { GtkWidget *vbox, *vbox1, *hbox, *label; gchar *s; vbox = gtk_vbox_new (FALSE, 0); if (pack_start) gtk_box_pack_start (GTK_BOX (box), vbox, FALSE, FALSE, 0); else gtk_box_pack_end (GTK_BOX (box), vbox, FALSE, FALSE, 0); if (category_header) { label = gtk_label_new (NULL); s = g_strconcat ("<span weight=\"bold\">", category_header, "</span>", NULL); gtk_label_set_markup (GTK_LABEL (label), s); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, header_pad); g_free (s); } hbox = gtk_hbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new (" "); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); vbox1 = gtk_vbox_new (FALSE, box_pad); gtk_box_pack_start (GTK_BOX (hbox), vbox1, TRUE, TRUE, 0); if (bottom_pad) { label = gtk_label_new (""); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); } return vbox1; }
false
false
false
false
false
0
xtensa_return_addr (int count, rtx frame) { rtx result, retaddr, curaddr, label; if (count == -1) retaddr = gen_rtx_REG (Pmode, A0_REG); else { rtx addr = plus_constant (frame, -4 * UNITS_PER_WORD); addr = memory_address (Pmode, addr); retaddr = gen_reg_rtx (Pmode); emit_move_insn (retaddr, gen_rtx_MEM (Pmode, addr)); } /* The 2 most-significant bits of the return address on Xtensa hold the register window size. To get the real return address, these bits must be replaced with the high bits from some address in the code. */ /* Get the 2 high bits of a local label in the code. */ curaddr = gen_reg_rtx (Pmode); label = gen_label_rtx (); emit_label (label); LABEL_PRESERVE_P (label) = 1; emit_move_insn (curaddr, gen_rtx_LABEL_REF (Pmode, label)); emit_insn (gen_lshrsi3 (curaddr, curaddr, GEN_INT (30))); emit_insn (gen_ashlsi3 (curaddr, curaddr, GEN_INT (30))); /* Clear the 2 high bits of the return address. */ result = gen_reg_rtx (Pmode); emit_insn (gen_ashlsi3 (result, retaddr, GEN_INT (2))); emit_insn (gen_lshrsi3 (result, result, GEN_INT (2))); /* Combine them to get the result. */ emit_insn (gen_iorsi3 (result, result, curaddr)); return result; }
false
false
false
false
false
0
do_lo_import(const char *filename_arg, const char *comment_arg) { PGresult *res; Oid loid; char oidbuf[32]; bool own_transaction; if (!start_lo_xact("\\lo_import", &own_transaction)) return false; SetCancelConn(); loid = lo_import(pset.db, filename_arg); ResetCancelConn(); if (loid == InvalidOid) { fputs(PQerrorMessage(pset.db), stderr); return fail_lo_xact("\\lo_import", own_transaction); } /* insert description if given */ if (comment_arg) { char *cmdbuf; char *bufptr; size_t slen = strlen(comment_arg); cmdbuf = malloc(slen * 2 + 256); if (!cmdbuf) return fail_lo_xact("\\lo_import", own_transaction); sprintf(cmdbuf, "COMMENT ON LARGE OBJECT %u IS '", loid); bufptr = cmdbuf + strlen(cmdbuf); bufptr += PQescapeStringConn(pset.db, bufptr, comment_arg, slen, NULL); strcpy(bufptr, "'"); if (!(res = PSQLexec(cmdbuf, false))) { free(cmdbuf); return fail_lo_xact("\\lo_import", own_transaction); } PQclear(res); free(cmdbuf); } if (!finish_lo_xact("\\lo_import", own_transaction)) return false; fprintf(pset.queryFout, "lo_import %u\n", loid); sprintf(oidbuf, "%u", loid); SetVariable(pset.vars, "LASTOID", oidbuf); return true; }
true
true
false
false
false
1
wi_hash(wi_runtime_instance_t *instance) { wi_runtime_class_t *class; if(!instance) return 0; _WI_RUNTIME_ASSERT_MAGIC(instance); _WI_RUNTIME_ASSERT_ZOMBIE(instance); class = _wi_runtime_class_table[WI_RUNTIME_BASE(instance)->id]; if(class->hash) return class->hash(instance); return wi_hash_pointer(instance); }
false
false
false
false
false
0
sky2_set_tx_stfwd(struct sky2_hw *hw, unsigned port) { if ( (hw->chip_id == CHIP_ID_YUKON_EX && hw->chip_rev != CHIP_REV_YU_EX_A0) || hw->chip_id == CHIP_ID_YUKON_FE_P || hw->chip_id == CHIP_ID_YUKON_SUPR) { /* disable jumbo frames on devices that support them */ sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), TX_JUMBO_DIS | TX_STFW_ENA); } else { sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), TX_STFW_ENA); } }
false
false
false
false
false
0
qof_log_init_filename_special(const char *log_to_filename) { if (g_ascii_strcasecmp("stderr", log_to_filename) == 0) { qof_log_init(); qof_log_set_file(stderr); } else if (g_ascii_strcasecmp("stdout", log_to_filename) == 0) { qof_log_init(); qof_log_set_file(stdout); } else { qof_log_init_filename(log_to_filename); } }
false
false
false
false
false
0
timer_irq_works(void) { unsigned long t1 = jiffies; unsigned long flags; if (no_timer_check) return 1; local_save_flags(flags); local_irq_enable(); /* Let ten ticks pass... */ mdelay((10 * 1000) / HZ); local_irq_restore(flags); /* * Expect a few ticks at least, to be sure some possible * glue logic does not lock up after one or two first * ticks in a non-ExtINT mode. Also the local APIC * might have cached one ExtINT interrupt. Finally, at * least one tick may be lost due to delays. */ /* jiffies wrap? */ if (time_after(jiffies, t1 + 4)) return 1; return 0; }
false
false
false
false
false
0
i810_dma_vertex(struct drm_device *dev, void *data, struct drm_file *file_priv) { struct drm_device_dma *dma = dev->dma; drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private; u32 *hw_status = dev_priv->hw_status_page; drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) dev_priv->sarea_priv; drm_i810_vertex_t *vertex = data; LOCK_TEST_WITH_RETURN(dev, file_priv); DRM_DEBUG("idx %d used %d discard %d\n", vertex->idx, vertex->used, vertex->discard); if (vertex->idx < 0 || vertex->idx > dma->buf_count) return -EINVAL; i810_dma_dispatch_vertex(dev, dma->buflist[vertex->idx], vertex->discard, vertex->used); sarea_priv->last_enqueue = dev_priv->counter - 1; sarea_priv->last_dispatch = (int)hw_status[5]; return 0; }
false
false
false
false
false
0
main(int argc, char **argv) { int cf_index; Cfg *cfg; bb_status = BB_RUNNING; gwlib_init(); start_time = time(NULL); suspended = gwlist_create(); isolated = gwlist_create(); gwlist_add_producer(suspended); gwlist_add_producer(isolated); cf_index = get_and_set_debugs(argc, argv, check_args); if (argv[cf_index] == NULL) cfg_filename = octstr_create("kannel.conf"); else cfg_filename = octstr_create(argv[cf_index]); cfg = cfg_create(cfg_filename); if (cfg_read(cfg) == -1) panic(0, "Couldn't read configuration from `%s'.", octstr_get_cstr(cfg_filename)); dlr_init(cfg); report_versions("bearerbox"); flow_threads = gwlist_create(); if (init_bearerbox(cfg) == NULL) panic(0, "Initialization failed."); info(0, "----------------------------------------"); info(0, GW_NAME " bearerbox II version %s starting", GW_VERSION); gwthread_sleep(5.0); /* give time to threads to register themselves */ if (store_load(dispatch_into_queue) == -1) panic(0, "Cannot start with store-file failing"); info(0, "MAIN: Start-up done, entering mainloop"); if (bb_status == BB_SUSPENDED) { info(0, "Gateway is now SUSPENDED by startup arguments"); } else if (bb_status == BB_ISOLATED) { info(0, "Gateway is now ISOLATED by startup arguments"); gwlist_remove_producer(suspended); } else { smsc2_resume(); gwlist_remove_producer(suspended); gwlist_remove_producer(isolated); } while (bb_status != BB_SHUTDOWN && bb_status != BB_DEAD && gwlist_producer_count(flow_threads) > 0) { /* debug("bb", 0, "Main Thread: going to sleep."); */ /* * Not infinite sleep here, because we should notice * when all "flow threads" are dead and shutting bearerbox * down. * XXX if all "flow threads" call gwthread_wakeup(MAIN_THREAD_ID), * we can enter infinite sleep then. */ gwthread_sleep(10.0); /* debug("bb", 0, "Main Thread: woken up."); */ if (bb_todo == 0) { continue; } if (bb_todo & BB_LOGREOPEN) { warning(0, "SIGHUP received, catching and re-opening logs"); log_reopen(); alog_reopen(); bb_todo = bb_todo & ~BB_LOGREOPEN; } if (bb_todo & BB_CHECKLEAKS) { warning(0, "SIGQUIT received, reporting memory usage."); gw_check_leaks(); bb_todo = bb_todo & ~BB_CHECKLEAKS; } } if (bb_status == BB_SHUTDOWN || bb_status == BB_DEAD) warning(0, "Killing signal or HTTP admin command received, shutting down..."); /* call shutdown */ bb_shutdown(); /* wait until flow threads exit */ while (gwlist_consume(flow_threads) != NULL) ; info(0, "All flow threads have died, killing core"); bb_status = BB_DEAD; httpadmin_stop(); boxc_cleanup(); smsc2_cleanup(); store_shutdown(); empty_msg_lists(); gwlist_destroy(flow_threads, NULL); gwlist_destroy(suspended, NULL); gwlist_destroy(isolated, NULL); mutex_destroy(status_mutex); alog_close(); /* if we have any */ bb_alog_shutdown(); cfg_destroy(cfg); octstr_destroy(cfg_filename); dlr_shutdown(); /* now really restart */ if (restart) restart_box(argv); gwlib_shutdown(); return 0; }
false
false
false
false
false
0
_archive_it (int argc, char *argv[]) { int error_code = SLURM_SUCCESS; int command_len = 0; if(readonly_flag) { exit_code = 1; fprintf(stderr, "Can't run this command in readonly mode.\n"); return; } if(!argv[0]) goto helpme; command_len = strlen(argv[0]); /* reset the connection to get the most recent stuff */ acct_storage_g_commit(db_conn, 0); /* First identify the entity to add */ if (strncasecmp (argv[0], "dump", MAX(command_len, 1)) == 0) { error_code = sacctmgr_archive_dump((argc - 1), &argv[1]); } else if (strncasecmp (argv[0], "load", MAX(command_len, 1)) == 0) { error_code = sacctmgr_archive_load((argc - 1), &argv[1]); } else { helpme: exit_code = 1; fprintf(stderr, "No valid entity in archive command\n"); fprintf(stderr, "Input line must include, "); fprintf(stderr, "\"Dump\", or \"load\"\n"); } if (error_code == SLURM_ERROR) { exit_code = 1; } }
false
false
false
false
false
0
wipe_engr_at(x,y,cnt) register xchar x,y,cnt; { register struct engr *ep = engr_at(x,y); /* Headstones are indelible */ if(ep && ep->engr_type != HEADSTONE){ if(ep->engr_type != BURN || is_ice(x,y)) { if(ep->engr_type != DUST && ep->engr_type != ENGR_BLOOD) { cnt = rn2(1 + 50/(cnt+1)) ? 0 : 1; } wipeout_text(ep->engr_txt, (int)cnt, 0); while(ep->engr_txt[0] == ' ') ep->engr_txt++; if(!ep->engr_txt[0]) del_engr(ep); } } }
false
false
false
false
false
0
cheese_flash_opacity_fade (gpointer data) { CheeseFlash *flash = data; CheeseFlashPrivate *flash_priv = CHEESE_FLASH_GET_PRIVATE (flash); GtkWindow *flash_window = flash_priv->window; double opacity = gtk_window_get_opacity (flash_window); /* exponentially decrease */ gtk_window_set_opacity (flash_window, opacity * FLASH_FADE_FACTOR); if (opacity <= FLASH_LOW_THRESHOLD) { /* the flasher has finished when we reach the quit value */ gtk_widget_hide (GTK_WIDGET (flash_window)); return FALSE; } return TRUE; }
false
false
false
false
false
0
addbuf(WImage *w, uchar *buf, int nbuf) { int n; if(buf == nil || w->outp+nbuf > w->eout) { if(w->loutp==w->outbuf){ /* can't really happen -- we checked line length above */ eprintf("buffer too small for line\n"); return ERROR; } n=w->loutp-w->outbuf; fprintf(w->f, "%11d %11d ", w->r.max.y, n); fwrite(w->outbuf, 1, n, w->f); w->r.min.y=w->r.max.y; w->outp=w->outbuf; w->loutp=w->outbuf; zerohash(w); return -1; } memmove(w->outp, buf, nbuf); w->outp += nbuf; return nbuf; }
false
false
false
false
false
0
gst_trigger_control_source_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { GstTriggerControlSource *self = GST_TRIGGER_CONTROL_SOURCE (object); switch (prop_id) { case PROP_TOLERANCE: GST_TIMED_VALUE_CONTROL_SOURCE_LOCK (self); self->priv->tolerance = g_value_get_int64 (value); GST_TIMED_VALUE_CONTROL_SOURCE_UNLOCK (self); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
false
false
false
false
false
0
sreadHeaderSpix(const l_uint32 *data, l_int32 *pwidth, l_int32 *pheight, l_int32 *pbps, l_int32 *pspp, l_int32 *piscmap) { char *id; l_int32 d, ncolors; PROCNAME("sreadHeaderSpix"); if (!data) return ERROR_INT("data not defined", procName, 1); if (!pwidth || !pheight || !pbps || !pspp) return ERROR_INT("input ptr(s) not defined", procName, 1); *pwidth = *pheight = *pbps = *pspp = 0; if (piscmap) *piscmap = 0; /* Check file id */ id = (char *)data; if (id[0] != 's' || id[1] != 'p' || id[2] != 'i' || id[3] != 'x') return ERROR_INT("not a valid spix file", procName, 1); *pwidth = data[1]; *pheight = data[2]; d = data[3]; if (d <= 16) { *pbps = d; *pspp = 1; } else { *pbps = 8; *pspp = d / 8; /* if the pix is 32 bpp, call it 4 samples */ } ncolors = data[5]; if (piscmap) *piscmap = (ncolors == 0) ? 0 : 1; return 0; }
false
false
false
false
false
0
dy_gadd(struct au_splhead *spl, struct au_dykey *key) { struct au_dykey *tmp, *found; struct list_head *head; const void *h_op = key->dk_op.dy_hop; found = NULL; head = &spl->head; spin_lock(&spl->spin); list_for_each_entry(tmp, head, dk_list) if (tmp->dk_op.dy_hop == h_op) { kref_get(&tmp->dk_kref); found = tmp; break; } if (!found) list_add_rcu(&key->dk_list, head); spin_unlock(&spl->spin); if (!found) DyPrSym(key); return found; }
false
false
false
false
false
0
transform(mpg123_string *dest, mpg123_string *source) { debug("transform!"); if(source == NULL) return; if(utf8env) mpg123_copy_string(source, dest); else utf8_ascii(dest, source); }
false
false
false
false
false
0
gs_idtransform(gs_state * pgs, floatp dx, floatp dy, gs_point * pt) { /* If the matrix isn't skewed, we get more accurate results */ /* by using transform_inverse than by using the inverse matrix. */ if (!is_skewed(&pgs->ctm)) { return gs_distance_transform_inverse(dx, dy, &ctm_only(pgs), pt); } else { ensure_inverse_valid(pgs); return gs_distance_transform(dx, dy, &pgs->ctm_inverse, pt); } }
false
false
false
false
false
0
H5Tinsert(hid_t parent_id, const char *name, size_t offset, hid_t member_id) { H5T_t *parent; /* The compound parent datatype */ H5T_t *member; /* The member datatype */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*szi", parent_id, name, offset, member_id); /* Check args */ if(parent_id == member_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't insert compound datatype within itself") if(NULL == (parent = (H5T_t *)H5I_object_verify(parent_id, H5I_DATATYPE)) || H5T_COMPOUND != parent->shared->type) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a compound datatype") if(H5T_STATE_TRANSIENT != parent->shared->state) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "parent type read-only") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no member name") if(NULL == (member = (H5T_t *)H5I_object_verify(member_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Insert */ if(H5T__insert(parent, name, offset, member) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "unable to insert member") done: FUNC_LEAVE_API(ret_value) }
false
false
false
false
false
0
plain_pagetitle(FILE *outf, Outchoices *od) { fprintf(outf, "%s %s\n", od->lngstr[webstatsfor_], od->hostname); matchlength(outf, od, od->hostname, '='); matchlength(outf, od, od->lngstr[webstatsfor_], '='); fputs("=\n\n", outf); if (!strcaseeq(od->headerfile, "none")) plain_includefile(outf, od, od->headerfile, 'h'); }
false
false
false
false
false
0
getDelegationID(const URL& durl, std::string& delegation_id) { if(!durl) { logger.msg(INFO, "Failed to delegate credentials to server - no delegation interface found"); return false; } AutoPointer<EMIESClient> ac(clients.acquire(durl)); delegation_id = ac->delegation(); if(delegation_id.empty()) { logger.msg(INFO, "Failed to delegate credentials to server - %s",ac->failure()); return false; } clients.release(ac.Release()); return true; }
false
false
false
false
false
0
packbitfield(sge_pack_buffer *pb, const bitfield *bitfield) { int ret; u_long32 size; u_long32 char_size; DENTER(PACK_LAYER, "packbitfield"); size = sge_bitfield_get_size(bitfield); char_size = sge_bitfield_get_size_bytes(size); if((ret = packint(pb, size)) != PACK_SUCCESS) { DEXIT; return ret; } if((ret = packbuf(pb, sge_bitfield_get_buffer(bitfield), char_size)) != PACK_SUCCESS) { DEXIT; return ret; } DEXIT; return PACK_SUCCESS; }
false
false
false
false
false
0
outhex(FXuint hex){ if(!psout){ fxerror("FXDCPrint: no output device has been selected.\n"); } fprintf((FILE*)psout,"%02x",hex); if(++nchars>35){fputc('\n',(FILE*)psout);nchars=0;} }
false
false
false
false
false
0
CalcReferenceLength(size_t sentence_id, size_t length) { switch (m_ref_length_type) { case AVERAGE: return m_references[sentence_id]->CalcAverage(); break; case CLOSEST: return m_references[sentence_id]->CalcClosest(length); break; case SHORTEST: return m_references[sentence_id]->CalcShortest(); break; default: cerr << "unknown reference types." << endl; exit(1); } }
false
false
false
false
false
0
Perl_magic_getvec(pTHX_ SV *sv, MAGIC *mg) { SV * const lsv = LvTARG(sv); PERL_ARGS_ASSERT_MAGIC_GETVEC; PERL_UNUSED_ARG(mg); if (lsv) sv_setuv(sv, do_vecget(lsv, LvTARGOFF(sv), LvTARGLEN(sv))); else SvOK_off(sv); return 0; }
false
false
false
false
false
0
nilfs_direct_assign_v(struct nilfs_bmap *direct, __u64 key, __u64 ptr, struct buffer_head **bh, sector_t blocknr, union nilfs_binfo *binfo) { struct inode *dat = nilfs_bmap_get_dat(direct); union nilfs_bmap_ptr_req req; int ret; req.bpr_ptr = ptr; ret = nilfs_dat_prepare_start(dat, &req.bpr_req); if (!ret) { nilfs_dat_commit_start(dat, &req.bpr_req, blocknr); binfo->bi_v.bi_vblocknr = cpu_to_le64(ptr); binfo->bi_v.bi_blkoff = cpu_to_le64(key); } return ret; }
false
false
false
false
false
0
gPrintTapeInfo (FILE *fp, unsigned int indentAmt) { char indent [INDENT_BUFFER_SIZE] ; unsigned int i ; for (i = 0 ; i < MIN(INDENT_BUFFER_SIZE - 1,indentAmt) ; i++) indent [i] = ' ' ; indent [i] = '\0' ; fprintf (fp,"%sGlobal Tape List : (count %lu) {\n", indent,(unsigned long) activeTapeIdx) ; for (i = 0 ; i < activeTapeIdx ; i++) printTapeInfo (activeTapes [i],fp,indentAmt + INDENT_INCR) ; fprintf (fp,"%s}\n",indent) ; }
true
true
false
false
false
1
appendTail(RegularExpression *regexp, UChar **destBuf, int32_t *destCapacity, UErrorCode *status) { // If we come in with a buffer overflow error, don't suppress the operation. // A series of appendReplacements, appendTail need to correctly preflight // the buffer size when an overflow happens somewhere in the middle. UBool pendingBufferOverflow = FALSE; if (*status == U_BUFFER_OVERFLOW_ERROR && destCapacity != NULL && *destCapacity == 0) { pendingBufferOverflow = TRUE; *status = U_ZERO_ERROR; } if (validateRE(regexp, TRUE, status) == FALSE) { return 0; } if (destCapacity == NULL || destBuf == NULL || (*destBuf == NULL && *destCapacity > 0) || *destCapacity < 0) { *status = U_ILLEGAL_ARGUMENT_ERROR; return 0; } RegexMatcher *m = regexp->fMatcher; int32_t destIdx = 0; int32_t destCap = *destCapacity; UChar *dest = *destBuf; if (regexp->fText != NULL) { int32_t srcIdx; int64_t nativeIdx = (m->fMatch ? m->fMatchEnd : m->fLastMatchEnd); if (nativeIdx == -1) { srcIdx = 0; } else if (UTEXT_USES_U16(m->fInputText)) { srcIdx = (int32_t)nativeIdx; } else { UErrorCode status = U_ZERO_ERROR; srcIdx = utext_extract(m->fInputText, 0, nativeIdx, NULL, 0, &status); } for (;;) { U_ASSERT(destIdx >= 0); if (srcIdx == regexp->fTextLength) { break; } UChar c = regexp->fText[srcIdx]; if (c == 0 && regexp->fTextLength == -1) { regexp->fTextLength = srcIdx; break; } if (destIdx < destCap) { dest[destIdx] = c; } else { // We've overflowed the dest buffer. // If the total input string length is known, we can // compute the total buffer size needed without scanning through the string. if (regexp->fTextLength > 0) { destIdx += (regexp->fTextLength - srcIdx); break; } } srcIdx++; destIdx++; } } else { int64_t srcIdx; if (m->fMatch) { // The most recent call to find() succeeded. srcIdx = m->fMatchEnd; } else { // The last call to find() on this matcher failed(). // Look back to the end of the last find() that succeeded for src index. srcIdx = m->fLastMatchEnd; if (srcIdx == -1) { // There has been no successful match with this matcher. // We want to copy the whole string. srcIdx = 0; } } destIdx = utext_extract(m->fInputText, srcIdx, m->fInputLength, dest, destCap, status); } // // NUL terminate the output string, if possible, otherwise issue the // appropriate error or warning. // if (destIdx < destCap) { dest[destIdx] = 0; } else if (destIdx == destCap) { *status = U_STRING_NOT_TERMINATED_WARNING; } else { *status = U_BUFFER_OVERFLOW_ERROR; } // // Update the user's buffer ptr and capacity vars to reflect the // amount used. // if (destIdx < destCap) { *destBuf += destIdx; *destCapacity -= destIdx; } else if (*destBuf != NULL) { *destBuf += destCap; *destCapacity = 0; } if (pendingBufferOverflow && U_SUCCESS(*status)) { *status = U_BUFFER_OVERFLOW_ERROR; } return destIdx; }
false
false
false
true
false
1
wext_can_scan (WifiDataWext *wext) { struct iwreq wrq; memset (&wrq, 0, sizeof (struct iwreq)); strncpy (wrq.ifr_name, wext->parent.iface, IFNAMSIZ); if (ioctl (wext->fd, SIOCSIWSCAN, &wrq) < 0) { if (errno == EOPNOTSUPP) return FALSE; } return TRUE; }
false
false
false
false
false
0
selectImages(IDB_HANDLE ** h, const char *patientID, const char *studyInstanceUID, const char *accessionNumber) { CONDITION cond; IDB_HANDLE *handle; IDB_Query recs; long count; LST_HEAD *imageList = NULL; recs.PatientQFlag = recs.StudyQFlag = recs.SeriesQFlag = recs.ImageQFlag = 0; recs.PatientNullFlag = recs.StudyNullFlag = recs.SeriesNullFlag = recs.ImageNullFlag = 0; if (strlen(patientID) != 0) { recs.PatientQFlag |= QF_PAT_PatID; strcpy(recs.patient.PatID, patientID); } if (strlen(studyInstanceUID) != 0) { recs.StudyQFlag |= QF_STU_StuInsUID; strcpy(recs.study.StuInsUID, studyInstanceUID); } if (strlen(accessionNumber) != 0) { recs.StudyQFlag |= QF_STU_AccNum; strcpy(recs.study.AccNum, accessionNumber); } if (imageList == NULL) { imageList = LST_Create(); if (imageList == NULL) exit(1); } cond = IDB_Select(h, STUDY_ROOT, IDB_PATIENT_LEVEL, IDB_IMAGE_LEVEL, &recs, &count, selectCallback, imageList); if (cond != IDB_NORMAL) { COND_DumpConditions(); } printf("%ld\n", LST_Count(&imageList)); return imageList; }
false
false
false
false
false
0
exofs_evict_inode(struct inode *inode) { struct exofs_i_info *oi = exofs_i(inode); struct super_block *sb = inode->i_sb; struct exofs_sb_info *sbi = sb->s_fs_info; struct ore_io_state *ios; int ret; truncate_inode_pages_final(&inode->i_data); /* TODO: should do better here */ if (inode->i_nlink || is_bad_inode(inode)) goto no_delete; inode->i_size = 0; clear_inode(inode); /* if we are deleting an obj that hasn't been created yet, wait. * This also makes sure that create_done cannot be called with an * already evicted inode. */ wait_obj_created(oi); /* ignore the error, attempt a remove anyway */ /* Now Remove the OSD objects */ ret = ore_get_io_state(&sbi->layout, &oi->oc, &ios); if (unlikely(ret)) { EXOFS_ERR("%s: ore_get_io_state failed\n", __func__); return; } ios->done = delete_done; ios->private = sbi; ret = ore_remove(ios); if (ret) { EXOFS_ERR("%s: ore_remove failed\n", __func__); ore_put_io_state(ios); return; } atomic_inc(&sbi->s_curr_pending); return; no_delete: clear_inode(inode); }
false
false
false
false
false
0
keyUp(SDL_Event *event) { Global *game = Global::getInstance(); switch(event->key.keysym.sym) { case SDLK_SPACE: game->hero->fireGun(false); break; default: break; } }
false
false
false
false
false
0
parse_brackets(IPFilter::Primitive& prim, const Vector<String>& words, int pos, ErrorHandler* errh) { int first_pos = pos + 1; String combination; for (pos++; pos < words.size() && words[pos] != "]"; pos++) combination += words[pos]; if (pos >= words.size()) { errh->error("missing ']'"); return first_pos; } pos++; // parse 'combination' int fieldpos, len = 1; const char* colon = find(combination.begin(), combination.end(), ':'); const char* comma = find(combination.begin(), combination.end(), ','); if (colon < combination.end() - 1) { if (cp_integer(combination.begin(), colon, 0, &fieldpos) == colon && cp_integer(colon + 1, combination.end(), 0, &len) == combination.end()) goto non_syntax_error; } else if (comma < combination.end() - 1) { int pos2; if (cp_integer(combination.begin(), comma, 0, &fieldpos) == comma && cp_integer(comma + 1, combination.end(), 0, &pos2) == combination.end()) { len = pos2 - fieldpos + 1; goto non_syntax_error; } } else if (cp_integer(combination, &fieldpos)) goto non_syntax_error; errh->error("syntax error after '[', expected '[POS]' or '[POS:LEN]'"); return pos; non_syntax_error: if (len < 1 || len > 4) errh->error("LEN in '[POS:LEN]' out of range, should be between 1 and 4"); else if ((fieldpos & ~3) != ((fieldpos + len - 1) & ~3)) errh->error("field [%d:%d] does not fit in a single word", fieldpos, len); else if (prim._transp_proto == IPFilter::UNKNOWN) prim.set_type(IPFilter::TYPE_FIELD | ((fieldpos*8) << IPFilter::FIELD_OFFSET_SHIFT) | ((len*8 - 1) << IPFilter::FIELD_LENGTH_SHIFT), errh); else prim.set_type(IPFilter::TYPE_FIELD | (prim._transp_proto << IPFilter::FIELD_PROTO_SHIFT) | ((fieldpos*8) << IPFilter::FIELD_OFFSET_SHIFT) | ((len*8 - 1) << IPFilter::FIELD_LENGTH_SHIFT), errh); return pos; }
false
false
false
false
false
0
nextRun() { if (benchmarkRun == (COLD_RUNS + HOT_RUNS)) { filesToBenchmark.removeFirst(); benchmarkRun = 0; } if (!filesToBenchmark.isEmpty()) { loadTimer.start(); m_part->openUrl(filesToBenchmark[0]); } else { //Generate HTML for report. m_part->begin(); m_part->write("<html><body><table border=1>"); for (QMap<QString, QList<int> >::iterator i = results.begin(); i != results.end(); ++i) { m_part->write("<tr><td>" + i.key() + "</td>"); QList<int> timings = i.value(); int total = 0; for (int pos = 0; pos < timings.size(); ++pos) { int t = timings[pos]; if (pos < COLD_RUNS) m_part->write(QString::fromLatin1("<td>(Cold):") + QString::number(t) + "</td>"); else { total += t; m_part->write(QString::fromLatin1("<td><i>") + QString::number(t) + "</i></td>"); } } m_part->write(QString::fromLatin1("<td>Average:<b>") + QString::number(double(total) / HOT_RUNS) + "</b></td>"); m_part->write("</tr>"); } m_part->end(); } }
false
false
false
false
false
0
EventTaskToWait(P_ECB pecb,P_OSTCB ptcb) { P_OSTCB ptcb1; #if (CFG_EVENT_SORT == 2) || (CFG_EVENT_SORT == 3) P_OSTCB ptcb2; #endif OsSchedLock(); /* Lock schedule */ ptcb1 = pecb->eventTCBList; /* Get first task in event waiting list */ ptcb->eventID = pecb->id; /* Set event ID for task */ #if CFG_EVENT_SORT == 3 /* Does event waiting list sort as FIFO? */ if(pecb->eventSortType == EVENT_SORT_TYPE_FIFO) #endif #if (CFG_EVENT_SORT == 1) || (CFG_EVENT_SORT == 3) { if(ptcb1 == Co_NULL) { /* Is no item in event waiting list?*/ pecb->eventTCBList = ptcb; /* Yes,set task as first item */ } else { while(ptcb1->waitNext != Co_NULL) { /* No,insert task in last */ ptcb1 = ptcb1->waitNext; } ptcb1->waitNext = ptcb; /* Set link for list */ ptcb->waitPrev = ptcb1; } } #endif #if CFG_EVENT_SORT ==3 /* Does event waiting list sort as preemptive priority?*/ else if(pecb->eventSortType == EVENT_SORT_TYPE_PRIO) #endif #if (CFG_EVENT_SORT == 2) || (CFG_EVENT_SORT == 3) { if(ptcb1 == Co_NULL) { /* Is no item in event waiting list? */ pecb->eventTCBList = ptcb; /* Yes,set task as first item */ } /* Is PRI of task higher than list first item? */ else if(ptcb1->prio > ptcb->prio) { pecb->eventTCBList = ptcb; /* Reset task as first item */ ptcb->waitNext = ptcb1; /* Set link for list */ ptcb1->waitPrev = ptcb; } else { /* No,find correct place to insert */ ptcb2 = ptcb1->waitNext; while(ptcb2 != Co_NULL) { /* Is last item? */ if(ptcb2->prio > ptcb->prio) { /* No,is correct place? */ break; /* Yes,break Circulation */ } ptcb1 = ptcb2; /* Save current item */ ptcb2 = ptcb2->waitNext; /* Get next item */ } ptcb1->waitNext = ptcb; /* Set link for list */ ptcb->waitPrev = ptcb1; ptcb->waitNext = ptcb2; if(ptcb2 != Co_NULL) { ptcb2->waitPrev = ptcb; } } } #endif ptcb->state = TASK_WAITING; /* Set task status to TASK_WAITING state */ TaskSchedReq = Co_TRUE; OsSchedUnlock(); /* Unlock schedule,and call task schedule */ }
false
false
false
false
false
0
__xfs_trans_roll( struct xfs_trans **tpp, struct xfs_inode *dp, int *committed) { struct xfs_trans *trans; struct xfs_trans_res tres; int error; /* * Ensure that the inode is always logged. */ trans = *tpp; if (dp) xfs_trans_log_inode(trans, dp, XFS_ILOG_CORE); /* * Copy the critical parameters from one trans to the next. */ tres.tr_logres = trans->t_log_res; tres.tr_logcount = trans->t_log_count; *tpp = xfs_trans_dup(trans); /* * Commit the current transaction. * If this commit failed, then it'd just unlock those items that * are not marked ihold. That also means that a filesystem shutdown * is in progress. The caller takes the responsibility to cancel * the duplicate transaction that gets returned. */ error = __xfs_trans_commit(trans, true); if (error) return error; *committed = 1; trans = *tpp; /* * Reserve space in the log for th next transaction. * This also pushes items in the "AIL", the list of logged items, * out to disk if they are taking up space at the tail of the log * that we want to use. This requires that either nothing be locked * across this call, or that anything that is locked be logged in * the prior and the next transactions. */ tres.tr_logflags = XFS_TRANS_PERM_LOG_RES; error = xfs_trans_reserve(trans, &tres, 0, 0); /* * Ensure that the inode is in the new transaction and locked. */ if (error) return error; if (dp) xfs_trans_ijoin(trans, dp, 0); return 0; }
false
false
false
false
false
0
messageview_set_menu_sensitive(MessageView *messageview) { if (!messageview || !messageview->ui_manager) return; cm_toggle_menu_set_active_full(messageview->ui_manager, "Menu/View/Quotes/CollapseAll", (prefs_common.hide_quotes == 1)); cm_toggle_menu_set_active_full(messageview->ui_manager, "Menu/View/Quotes/Collapse2", (prefs_common.hide_quotes == 2)); cm_toggle_menu_set_active_full(messageview->ui_manager, "Menu/View/Quotes/Collapse3", (prefs_common.hide_quotes == 3)); cm_menu_set_sensitive_full(messageview->ui_manager, "Menu/View/Goto/PrevHistory", messageview_nav_has_prev(messageview)); cm_menu_set_sensitive_full(messageview->ui_manager, "Menu/View/Goto/NextHistory", messageview_nav_has_next(messageview)); cm_menu_set_sensitive_full(messageview->ui_manager, "Menu/Message/CheckSignature", messageview->mimeview->signed_part); }
false
false
false
false
false
0
cardCommandInit (reader* globalData, char socket, char needToBePoweredOn) { if (!globalData->cards[(int)socket].status) { return ASE_READER_NO_CARD_ERROR; } if (needToBePoweredOn && globalData->cards[(int)socket].status != 2) { return ASE_READER_CARD_NOT_POWERED_ERROR; } return ASE_OK; }
false
false
false
false
false
0
pad_type_hash_eq (const void *p1, const void *p2) { const struct pad_type_hash *const t1 = (const struct pad_type_hash *) p1; const struct pad_type_hash *const t2 = (const struct pad_type_hash *) p2; tree type1, type2; if (t1->hash != t2->hash) return 0; type1 = t1->type; type2 = t2->type; /* We consider that the padded types are equivalent if they pad the same type and have the same size, alignment and RM size. Taking the mode into account is redundant since it is determined by the others. */ return TREE_TYPE (TYPE_FIELDS (type1)) == TREE_TYPE (TYPE_FIELDS (type2)) && TYPE_SIZE (type1) == TYPE_SIZE (type2) && TYPE_ALIGN (type1) == TYPE_ALIGN (type2) && TYPE_ADA_SIZE (type1) == TYPE_ADA_SIZE (type2); }
false
false
false
false
false
0
parse_arguments (int argc, char **argv) { int key; /* getopt_long stores the option index here. */ int index = 0; /* Set default values. */ program_args.silent = 0; program_args.verbose = 0; program_args.input_file = NULL; program_args.output_file = NULL; while ((key = getopt_long(argc, argv, "o:qsvV", long_options, &index)) != -1) { switch (key) { case 'q': case 's': program_args.silent = 1; break; case 'v': ++program_args.verbose; break; case 'o': program_args.output_file = optarg; break; case 0: /* Use index to differentiate between options */ if (strcmp(long_options[index].name, "usage") == 0) { usage(); } else if (strcmp(long_options[index].name, "help") == 0) { help(); } break; case 'V': version(); break; case '?': /* Error message has been printed by getopt_long */ exit(1); break; default: /* Forgot to handle a short option, most likely */ exit(1); break; } } /* Must be one additional argument, which is the input file. */ if (argc-1 != optind) { printf("Usage: xlnk [OPTION...] FILE\nTry `xlnk --help' or `xlnk --usage' for more information.\n"); exit(1); } else { program_args.input_file = argv[optind]; } }
false
true
true
false
true
1
checkHostName( gchar *pnHostName ) { #ifndef G_OS_WIN32 GList *psList; GResolver *psResolver; psResolver = g_resolver_get_default(); psList = g_resolver_lookup_by_name( psResolver, pnHostName, NULL, NULL ); g_object_unref( psResolver ); if ( psList != NULL ) { g_resolver_free_addresses( psList ); return 0; } return 1; #else return 0; #endif }
false
false
false
false
false
0
radeon_get_pm_profile(struct device *dev, struct device_attribute *attr, char *buf) { struct drm_device *ddev = dev_get_drvdata(dev); struct radeon_device *rdev = ddev->dev_private; int cp = rdev->pm.profile; return snprintf(buf, PAGE_SIZE, "%s\n", (cp == PM_PROFILE_AUTO) ? "auto" : (cp == PM_PROFILE_LOW) ? "low" : (cp == PM_PROFILE_MID) ? "mid" : (cp == PM_PROFILE_HIGH) ? "high" : "default"); }
false
false
false
false
false
0
NetFilter( void ) { static tCharacterFilter filter; // run through string for( int i = Len()-2; i>=0; --i ) { // character to filter char & my = (*this)(i); my = filter.Filter(my); } }
false
false
false
false
false
0
istgt_iscsi_send_r2t(CONN_Ptr conn, ISTGT_LU_CMD_Ptr lu_cmd, int offset, int len, uint32_t transfer_tag, uint32_t *R2TSN) { ISCSI_PDU rsp_pdu; uint8_t *rsp; int rc; /* R2T PDU */ rsp = (uint8_t *) &rsp_pdu.bhs; rsp_pdu.data = NULL; memset(rsp, 0, ISCSI_BHS_LEN); rsp[0] = ISCSI_OP_R2T; BDADD8(&rsp[1], 1, 7); rsp[4] = 0; // TotalAHSLength DSET24(&rsp[5], 0); // DataSegmentLength DSET64(&rsp[8], lu_cmd->lun); DSET32(&rsp[16], lu_cmd->task_tag); DSET32(&rsp[20], transfer_tag); DSET32(&rsp[24], conn->StatSN); SESS_MTX_LOCK(conn); DSET32(&rsp[28], conn->sess->ExpCmdSN); DSET32(&rsp[32], conn->sess->MaxCmdSN); SESS_MTX_UNLOCK(conn); DSET32(&rsp[36], *R2TSN); *R2TSN += 1; DSET32(&rsp[40], (uint32_t) offset); DSET32(&rsp[44], (uint32_t) len); rc = istgt_iscsi_write_pdu(conn, &rsp_pdu); if (rc < 0) { ISTGT_ERRLOG("iscsi_write_pdu() failed\n"); return -1; } return 0; }
false
false
false
false
false
0
alloc_comp_eqs(struct mlx5_core_dev *dev) { struct mlx5_eq_table *table = &dev->priv.eq_table; char name[MLX5_MAX_IRQ_NAME]; struct mlx5_eq *eq; int ncomp_vec; int nent; int err; int i; INIT_LIST_HEAD(&table->comp_eqs_list); ncomp_vec = table->num_comp_vectors; nent = MLX5_COMP_EQ_SIZE; for (i = 0; i < ncomp_vec; i++) { eq = kzalloc(sizeof(*eq), GFP_KERNEL); if (!eq) { err = -ENOMEM; goto clean; } snprintf(name, MLX5_MAX_IRQ_NAME, "mlx5_comp%d", i); err = mlx5_create_map_eq(dev, eq, i + MLX5_EQ_VEC_COMP_BASE, nent, 0, name, &dev->priv.uuari.uars[0]); if (err) { kfree(eq); goto clean; } mlx5_core_dbg(dev, "allocated completion EQN %d\n", eq->eqn); eq->index = i; spin_lock(&table->lock); list_add_tail(&eq->list, &table->comp_eqs_list); spin_unlock(&table->lock); } return 0; clean: free_comp_eqs(dev); return err; }
false
false
false
false
false
0
xenvif_carrier_on(struct xenvif *vif) { rtnl_lock(); if (!vif->can_sg && vif->dev->mtu > ETH_DATA_LEN) dev_set_mtu(vif->dev, ETH_DATA_LEN); netdev_update_features(vif->dev); set_bit(VIF_STATUS_CONNECTED, &vif->status); if (netif_running(vif->dev)) xenvif_up(vif); rtnl_unlock(); }
false
false
false
false
false
0
print_proof(FILE *fp, Plist proof, String_buf comment, int format, I3list jmap, int number) { Plist p; int length = proof_length(proof); int max_count = max_clause_symbol_count(proof); if (format == CL_FORM_XML) { fprintf(fp, "\n<proof number=\"%d\" length=\"%d\" max_count=\"%d\">\n", number, length, max_count); if (comment) { fprintf(fp, "\n<comments><![CDATA[\n"); fprint_sb(fp, comment); fprintf(fp, "]]></comments>\n"); } } else if (format == CL_FORM_IVY) { fprintf(fp, "\n;; BEGINNING OF PROOF OBJECT\n"); fprintf(fp, "(\n"); } else { print_separator(stdout, "PROOF", TRUE); if (comment) { fprintf(fp, "\n%% -------- Comments from original proof --------\n"); fprint_sb(stdout, comment); fprintf(fp, "\n"); } } for (p = proof; p; p = p->next) fwrite_clause_jmap(stdout, p->v, format, jmap); if (format == CL_FORM_XML) fprintf(fp, "\n</proof>\n"); else if (format == CL_FORM_IVY) { fprintf(fp, ")\n"); fprintf(fp, ";; END OF PROOF OBJECT\n"); } else print_separator(stdout, "end of proof", TRUE); }
false
false
false
false
false
0
nextfield(char *p, char *lim, char **truncated_end, char **prev_beg, int hdr_only) { int i = 0; char *q; *truncated_end = NULL; do { q = p; p = nextline(p, lim, hdr_only); if (p == NULL) break; i++; if (Field_len != 0 && i == Field_len) *truncated_end = p; } while (*p == SP || *p == TAB); if (prev_beg != NULL) *prev_beg = q; return p; }
false
false
false
false
false
0
inflated_signature_in_image (gpointer key, gpointer value, gpointer data) { MonoImage *image = (MonoImage *)data; MonoInflatedMethodSignature *sig = (MonoInflatedMethodSignature *)key; return signature_in_image (sig->sig, image) || (sig->context.class_inst && ginst_in_image (sig->context.class_inst, image)) || (sig->context.method_inst && ginst_in_image (sig->context.method_inst, image)); }
false
false
false
false
false
0
insert(Cone const &c) { if(c.dimension>dimension)dimension=c.dimension; if(!contains(c))//#2 { cones.insert(c); } else { if(c.isKnownToBeNonMaximal()){cones.erase(c);cones.insert(c);}// mark as non-maximal } }
false
false
false
false
false
0
twl6040_write(struct snd_soc_codec *codec, unsigned int reg, unsigned int value) { struct twl6040 *twl6040 = codec->control_data; if (reg >= TWL6040_CACHEREGNUM) return -EIO; twl6040_update_dl12_cache(codec, reg, value); if (twl6040_can_write_to_chip(codec, reg)) return twl6040_reg_write(twl6040, reg, value); else return 0; }
false
false
false
false
false
0
mono_aot_get_offset (guint32 *table, int index) { int i, group, ngroups, index_entry_size; int start_offset, offset, noffsets, group_size; guint8 *data_start, *p; guint32 *index32 = NULL; guint16 *index16 = NULL; noffsets = table [0]; group_size = table [1]; ngroups = table [2]; index_entry_size = table [3]; group = index / group_size; if (index_entry_size == 2) { index16 = (guint16*)&table [4]; data_start = (guint8*)&index16 [ngroups]; p = data_start + index16 [group]; } else { index32 = (guint32*)&table [4]; data_start = (guint8*)&index32 [ngroups]; p = data_start + index32 [group]; } /* offset will contain the value of offsets [group * group_size] */ offset = start_offset = decode_value (p, &p); for (i = group * group_size + 1; i <= index; ++i) { offset += decode_value (p, &p); } //printf ("Offset lookup: %d -> %d, start=%d, p=%d\n", index, offset, start_offset, table [3 + group]); return offset; }
false
false
false
false
false
0
mimeview_set_multipart_tree(MimeView *mimeview, MimeInfo *mimeinfo, GtkTreeIter *parent) { GtkTreeStore *model = GTK_TREE_STORE(gtk_tree_view_get_model( GTK_TREE_VIEW(mimeview->ctree))); GtkTreeIter iter; gchar *content_type, *length, *name; cm_return_if_fail(mimeinfo != NULL); while (mimeinfo != NULL) { if (mimeinfo->type != MIMETYPE_UNKNOWN && mimeinfo->subtype) content_type = g_strdup_printf("%s/%s", procmime_get_media_type_str(mimeinfo->type), mimeinfo->subtype); else content_type = g_strdup("UNKNOWN"); length = g_strdup(to_human_readable((goffset) mimeinfo->length)); if (prefs_common.attach_desc) name = g_strdup(get_part_description(mimeinfo)); else name = g_strdup(get_part_name(mimeinfo)); gtk_tree_store_append(model, &iter, parent); gtk_tree_store_set(model, &iter, COL_MIMETYPE, content_type, COL_SIZE, length, COL_NAME, name, COL_DATA, mimeinfo, -1); g_free(content_type); g_free(length); g_free(name); if (mimeinfo->node->children) mimeview_set_multipart_tree(mimeview, (MimeInfo *) mimeinfo->node->children->data, &iter); mimeinfo = mimeinfo->node->next != NULL ? (MimeInfo *) mimeinfo->node->next->data : NULL; } }
false
false
false
false
false
0