idx
int64
func
string
target
int64
359,671
DEFUN (clear_ip_bgp_external_soft_in, clear_ip_bgp_external_soft_in_cmd, "clear ip bgp external soft in", CLEAR_STR IP_STR BGP_STR "Clear all external peers\n" "Soft reconfig\n" "Soft reconfig inbound update\n") { return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, BGP_CLEAR_SOFT_IN, NULL); }
0
386,577
bool DL_Dxf::processDXFGroup(DL_CreationInterface* creationInterface, int groupCode, const std::string& groupValue) { //printf("%d\n", groupCode); //printf("%s\n", groupValue.c_str()); // Init values on first call if (firstCall) { settingValue[0] = '\0'; firstCall=false; } // Indicates comment or dxflib version: if (groupCode==999) { if (!groupValue.empty()) { if (groupValue.substr(0, 6)=="dxflib") { libVersion = getLibVersion(groupValue.substr(7)); } addComment(creationInterface, groupValue); } } // Indicates start of new entity or variable: else if (groupCode==0 || groupCode==9) { // If new entity is encountered, the last one is complete. // Prepare default attributes for next entity: std::string layer = getStringValue(8, "0"); int width; // Compatibility with qcad1: if (hasValue(39) && !hasValue(370)) { width = getIntValue(39, -1); } // since autocad 2002: else if (hasValue(370)) { width = getIntValue(370, -1); } // default to BYLAYER: else { width = -1; } int color; color = getIntValue(62, 256); int color24; color24 = getIntValue(420, -1); int handle; handle = getInt16Value(5, -1); std::string linetype = getStringValue(6, "BYLAYER"); attrib = DL_Attributes(layer, // layer color, // color color24, // 24 bit color width, // width linetype, // linetype handle); // handle attrib.setInPaperSpace((bool)getIntValue(67, 0)); attrib.setLinetypeScale(getRealValue(48, 1.0)); creationInterface->setAttributes(attrib); int elevationGroupCode=30; if (currentObjectType==DL_ENTITY_LWPOLYLINE ) { // see lwpolyline group codes reference elevationGroupCode=38; } else { // see polyline group codes reference elevationGroupCode=30; } creationInterface->setExtrusion(getRealValue(210, 0.0), getRealValue(220, 0.0), getRealValue(230, 1.0), getRealValue(elevationGroupCode, 0.0)); // Add the previously parsed entity via creationInterface switch (currentObjectType) { case DL_SETTING: addSetting(creationInterface); break; case DL_LAYER: addLayer(creationInterface); break; case DL_LINETYPE: addLinetype(creationInterface); break; case DL_BLOCK: addBlock(creationInterface); break; case DL_ENDBLK: endBlock(creationInterface); break; case DL_STYLE: addTextStyle(creationInterface); break; case DL_ENTITY_POINT: addPoint(creationInterface); break; case DL_ENTITY_LINE: addLine(creationInterface); break; case DL_ENTITY_XLINE: addXLine(creationInterface); break; case DL_ENTITY_RAY: addRay(creationInterface); break; case DL_ENTITY_POLYLINE: case DL_ENTITY_LWPOLYLINE: addPolyline(creationInterface); break; case DL_ENTITY_VERTEX: addVertex(creationInterface); break; case DL_ENTITY_SPLINE: addSpline(creationInterface); break; case DL_ENTITY_ARC: addArc(creationInterface); break; case DL_ENTITY_CIRCLE: addCircle(creationInterface); break; case DL_ENTITY_ELLIPSE: addEllipse(creationInterface); break; case DL_ENTITY_INSERT: addInsert(creationInterface); break; case DL_ENTITY_MTEXT: addMText(creationInterface); break; case DL_ENTITY_TEXT: addText(creationInterface); break; case DL_ENTITY_ARCALIGNEDTEXT: addArcAlignedText(creationInterface); break; case DL_ENTITY_ATTRIB: addAttribute(creationInterface); break; case DL_ENTITY_DIMENSION: { int type = (getIntValue(70, 0)&0x07); switch (type) { case 0: addDimLinear(creationInterface); break; case 1: addDimAligned(creationInterface); break; case 2: addDimAngular(creationInterface); break; case 3: addDimDiametric(creationInterface); break; case 4: addDimRadial(creationInterface); break; case 5: addDimAngular3P(creationInterface); break; case 6: addDimOrdinate(creationInterface); break; default: break; } } break; case DL_ENTITY_LEADER: addLeader(creationInterface); break; case DL_ENTITY_HATCH: //addHatch(creationInterface); handleHatchData(creationInterface); break; case DL_ENTITY_IMAGE: addImage(creationInterface); break; case DL_ENTITY_IMAGEDEF: addImageDef(creationInterface); break; case DL_ENTITY_TRACE: addTrace(creationInterface); break; case DL_ENTITY_3DFACE: add3dFace(creationInterface); break; case DL_ENTITY_SOLID: addSolid(creationInterface); break; case DL_ENTITY_SEQEND: endSequence(creationInterface); break; default: break; } creationInterface->endSection(); // reset all values (they are not persistent and only this // way we can set defaults for omitted values) // for (int i=0; i<DL_DXF_MAXGROUPCODE; ++i) { // values[i][0] = '\0'; // } values.clear(); settingValue[0] = '\0'; settingKey = ""; firstHatchLoop = true; //firstHatchEdge = true; hatchEdge = DL_HatchEdgeData(); //xRecordHandle = ""; xRecordValues = false; // Last DXF entity or setting has been handled // Now determine what the next entity or setting type is int prevEntity = currentObjectType; // Read DXF variable: if (groupValue[0]=='$') { currentObjectType = DL_SETTING; settingKey = groupValue; } // Read Layers: else if (groupValue=="LAYER") { currentObjectType = DL_LAYER; } // Read Linetypes: else if (groupValue=="LTYPE") { currentObjectType = DL_LINETYPE; } // Read Blocks: else if (groupValue=="BLOCK") { currentObjectType = DL_BLOCK; } else if (groupValue=="ENDBLK") { currentObjectType = DL_ENDBLK; } // Read text styles: else if (groupValue=="STYLE") { currentObjectType = DL_STYLE; } // Read entities: else if (groupValue=="POINT") { currentObjectType = DL_ENTITY_POINT; } else if (groupValue=="LINE") { currentObjectType = DL_ENTITY_LINE; } else if (groupValue=="XLINE") { currentObjectType = DL_ENTITY_XLINE; } else if (groupValue=="RAY") { currentObjectType = DL_ENTITY_RAY; } else if (groupValue=="POLYLINE") { currentObjectType = DL_ENTITY_POLYLINE; } else if (groupValue=="LWPOLYLINE") { currentObjectType = DL_ENTITY_LWPOLYLINE; } else if (groupValue=="VERTEX") { currentObjectType = DL_ENTITY_VERTEX; } else if (groupValue=="SPLINE") { currentObjectType = DL_ENTITY_SPLINE; } else if (groupValue=="ARC") { currentObjectType = DL_ENTITY_ARC; } else if (groupValue=="ELLIPSE") { currentObjectType = DL_ENTITY_ELLIPSE; } else if (groupValue=="CIRCLE") { currentObjectType = DL_ENTITY_CIRCLE; } else if (groupValue=="INSERT") { currentObjectType = DL_ENTITY_INSERT; } else if (groupValue=="TEXT") { currentObjectType = DL_ENTITY_TEXT; } else if (groupValue=="MTEXT") { currentObjectType = DL_ENTITY_MTEXT; } else if (groupValue=="ARCALIGNEDTEXT") { currentObjectType = DL_ENTITY_ARCALIGNEDTEXT; } else if (groupValue=="ATTRIB") { currentObjectType = DL_ENTITY_ATTRIB; } else if (groupValue=="DIMENSION") { currentObjectType = DL_ENTITY_DIMENSION; } else if (groupValue=="LEADER") { currentObjectType = DL_ENTITY_LEADER; } else if (groupValue=="HATCH") { currentObjectType = DL_ENTITY_HATCH; } else if (groupValue=="IMAGE") { currentObjectType = DL_ENTITY_IMAGE; } else if (groupValue=="IMAGEDEF") { currentObjectType = DL_ENTITY_IMAGEDEF; } else if (groupValue=="TRACE") { currentObjectType = DL_ENTITY_TRACE; } else if (groupValue=="SOLID") { currentObjectType = DL_ENTITY_SOLID; } else if (groupValue=="3DFACE") { currentObjectType = DL_ENTITY_3DFACE; } else if (groupValue=="SEQEND") { currentObjectType = DL_ENTITY_SEQEND; } else if (groupValue=="XRECORD") { currentObjectType = DL_XRECORD; } else if (groupValue=="DICTIONARY") { currentObjectType = DL_DICTIONARY; } else { currentObjectType = DL_UNKNOWN; } // end of old style POLYLINE entity if (prevEntity==DL_ENTITY_VERTEX && currentObjectType!=DL_ENTITY_VERTEX) { endEntity(creationInterface); } // TODO: end of SPLINE entity //if (prevEntity==DL_ENTITY_CONTROLPOINT && currentEntity!=DL_ENTITY_CONTROLPOINT) { // endEntity(creationInterface); //} return true; } else { // Group code does not indicate start of new entity or setting, // so this group must be continuation of data for the current // one. if (groupCode<DL_DXF_MAXGROUPCODE) { bool handled = false; switch (currentObjectType) { case DL_ENTITY_MTEXT: handled = handleMTextData(creationInterface); break; case DL_ENTITY_LWPOLYLINE: handled = handleLWPolylineData(creationInterface); break; case DL_ENTITY_SPLINE: handled = handleSplineData(creationInterface); break; case DL_ENTITY_LEADER: handled = handleLeaderData(creationInterface); break; case DL_ENTITY_HATCH: handled = handleHatchData(creationInterface); break; case DL_XRECORD: handled = handleXRecordData(creationInterface); break; case DL_DICTIONARY: handled = handleDictionaryData(creationInterface); break; case DL_LINETYPE: handled = handleLinetypeData(creationInterface); break; default: break; } // Always try to handle XData, unless we're in an XData record: if (currentObjectType!=DL_XRECORD) { handled = handleXData(creationInterface); } if (!handled) { // Normal group / value pair: values[groupCode] = groupValue; } } return false; } return false; }
0
513,297
static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table, Item ***copy_func, bool modify_item) { DBUG_ASSERT(thd == table->in_use); Field *new_field= item->Item::create_tmp_field(false, table); if (copy_func && (item->is_result_field() || (item->real_item()->is_result_field()))) *((*copy_func)++) = item; // Save for copy_funcs if (modify_item) item->set_result_field(new_field); if (item->type() == Item::NULL_ITEM) new_field->is_created_from_null_item= TRUE; return new_field; }
0
401,495
static bool crng_init_try_arch(struct crng_state *crng) { int i; bool arch_init = true; unsigned long rv; for (i = 4; i < 16; i++) { if (!arch_get_random_seed_long(&rv) && !arch_get_random_long(&rv)) { rv = random_get_entropy(); arch_init = false; } crng->state[i] ^= rv; } return arch_init; }
0
514,315
bool mysql_multi_update(THD *thd, TABLE_LIST *table_list, List<Item> *fields, List<Item> *values, COND *conds, ulonglong options, enum enum_duplicates handle_duplicates, bool ignore, SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex, multi_update **result) { bool res; DBUG_ENTER("mysql_multi_update"); if (!(*result= new (thd->mem_root) multi_update(thd, table_list, &thd->lex->select_lex.leaf_tables, fields, values, handle_duplicates, ignore))) { DBUG_RETURN(TRUE); } if ((*result)->init(thd)) DBUG_RETURN(1); thd->abort_on_warning= !ignore && thd->is_strict_mode(); List<Item> total_list; if (setup_tables(thd, &select_lex->context, &select_lex->top_join_list, table_list, select_lex->leaf_tables, FALSE, FALSE)) DBUG_RETURN(1); if (select_lex->vers_setup_conds(thd, table_list)) DBUG_RETURN(1); res= mysql_select(thd, table_list, select_lex->with_wild, total_list, conds, select_lex->order_list.elements, select_lex->order_list.first, NULL, NULL, NULL, options | SELECT_NO_JOIN_CACHE | SELECT_NO_UNLOCK | OPTION_SETUP_TABLES_DONE, *result, unit, select_lex); DBUG_PRINT("info",("res: %d report_error: %d", res, (int) thd->is_error())); res|= thd->is_error(); if (unlikely(res)) (*result)->abort_result_set(); else { if (thd->lex->describe || thd->lex->analyze_stmt) res= thd->lex->explain->send_explain(thd); } thd->abort_on_warning= 0; DBUG_RETURN(res); }
0
248,311
DLLIMPORT int cfg_setmulti(cfg_t *cfg, const char *name, unsigned int nvalues, char **values) { cfg_opt_t *opt; if (!cfg || !name || !values) { errno = EINVAL; return CFG_FAIL; } opt = cfg_getopt(cfg, name); if (!opt) { errno = ENOENT; return CFG_FAIL; } return cfg_opt_setmulti(cfg, opt, nvalues, values); }
0
369,936
static int proc_fd_link(struct dentry *dentry, struct path *path) { return proc_fd_info(dentry->d_inode, path, NULL); }
0
267,952
R_API RBinSymbol *r_bin_file_add_method(RBinFile *bf, const char *klass, const char *method, int nargs) { r_return_val_if_fail (bf, NULL); RBinClass *c = r_bin_file_add_class (bf, klass, NULL, 0); if (!c) { eprintf ("Cannot allocate class %s\n", klass); return NULL; } RBinSymbol *sym = __getMethod (bf, klass, method); if (!sym) { sym = R_NEW0 (RBinSymbol); if (sym) { sym->name = strdup (method); r_list_append (c->methods, sym); char *name = r_str_newf ("%s::%s", klass, method); ht_pp_insert (bf->o->methods_ht, name, sym); free (name); } } return sym; }
0
512,551
Item_func_ifnull::real_op() { DBUG_ASSERT(fixed == 1); double value= args[0]->val_real(); if (!args[0]->null_value) { null_value=0; return value; } value= args[1]->val_real(); if ((null_value=args[1]->null_value)) return 0.0; return value; }
0
512,423
void Item_cond_and::mark_as_condition_AND_part(TABLE_LIST *embedding) { List_iterator<Item> li(list); Item *item; while ((item=li++)) { item->mark_as_condition_AND_part(embedding); } }
0
275,481
njs_vm_prop_magic16(njs_object_prop_t *prop) { return prop->value.data.magic16; }
0
248,255
DLLIMPORT int cfg_numopts(cfg_opt_t *opts) { int n; for (n = 0; opts && opts[n].name; n++) /* do nothing */ ; return n; }
0
359,568
DEFUN (neighbor_filter_list, neighbor_filter_list_cmd, NEIGHBOR_CMD2 "filter-list WORD (in|out)", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Establish BGP filters\n" "AS path access-list name\n" "Filter incoming routes\n" "Filter outgoing routes\n") { return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty), bgp_node_safi (vty), argv[1], argv[2]); }
0
488,338
static inline unsigned long zap_pmd_range(struct mmu_gather *tlb, struct vm_area_struct *vma, pud_t *pud, unsigned long addr, unsigned long end, long *zap_work, struct zap_details *details) { pmd_t *pmd; unsigned long next; pmd = pmd_offset(pud, addr); do { next = pmd_addr_end(addr, end); if (pmd_none_or_clear_bad(pmd)) { (*zap_work)--; continue; } next = zap_pte_range(tlb, vma, pmd, addr, next, zap_work, details); } while (pmd++, addr = next, (addr != end && *zap_work > 0)); return addr; }
0
351,177
static struct DataStruct * build_index (SHPHandle shp, DBFHandle dbf) { struct DataStruct *data = malloc (sizeof *data * nShapes); if (!data) { fputs("malloc failed!\n", stderr); exit(EXIT_FAILURE); } /* populate array */ for (int i = 0; i < nShapes; i++) { data[i].value = malloc(sizeof data[0].value[0] * nFields); if (0 == data[i].value) { fputs("malloc failed!\n", stderr); exit(EXIT_FAILURE); } data[i].record = i; for (int j = 0; j < nFields; j++) { data[i].value[j].null = 0; switch (fldType[j]) { case FIDType: data[i].value[j].u.i = i; break; case SHPType: { SHPObject *feat = SHPReadObject(shp, i); switch (feat->nSHPType) { case SHPT_NULL: fprintf(stderr, "Shape %d is a null feature!\n", i); data[i].value[j].null = 1; break; case SHPT_POINT: case SHPT_POINTZ: case SHPT_POINTM: case SHPT_MULTIPOINT: case SHPT_MULTIPOINTZ: case SHPT_MULTIPOINTM: case SHPT_MULTIPATCH: /* Y-sort bounds */ data[i].value[j].u.d = feat->dfYMax; break; case SHPT_ARC: case SHPT_ARCZ: case SHPT_ARCM: data[i].value[j].u.d = shp_length(feat); break; case SHPT_POLYGON: case SHPT_POLYGONZ: case SHPT_POLYGONM: data[i].value[j].u.d = shp_area(feat); break; default: fputs("Can't sort on Shapefile feature type!\n", stderr); exit(EXIT_FAILURE); } SHPDestroyObject(feat); break; } case FTString: data[i].value[j].null = DBFIsAttributeNULL(dbf, i, fldIdx[j]); if (!data[i].value[j].null) { data[i].value[j].u.s = dupstr(DBFReadStringAttribute(dbf, i, fldIdx[j])); } break; case FTInteger: case FTLogical: data[i].value[j].null = DBFIsAttributeNULL(dbf, i, fldIdx[j]); if (!data[i].value[j].null) { data[i].value[j].u.i = DBFReadIntegerAttribute(dbf, i, fldIdx[j]); } break; case FTDouble: data[i].value[j].null = DBFIsAttributeNULL(dbf, i, fldIdx[j]); if (!data[i].value[j].null) { data[i].value[j].u.d = DBFReadDoubleAttribute(dbf, i, fldIdx[j]); } break; } } } #ifdef DEBUG PrintDataStruct(data); fputs("build_index: sorting array\n", stdout); #endif qsort (data, nShapes, sizeof data[0], compare); #ifdef DEBUG PrintDataStruct(data); fputs("build_index: returning array\n", stdout); #endif return data; }
0
210,961
static int nft_set_desc_concat_parse(const struct nlattr *attr, struct nft_set_desc *desc) { struct nlattr *tb[NFTA_SET_FIELD_MAX + 1]; u32 len; int err; err = nla_parse_nested_deprecated(tb, NFTA_SET_FIELD_MAX, attr, nft_concat_policy, NULL); if (err < 0) return err; if (!tb[NFTA_SET_FIELD_LEN]) return -EINVAL; len = ntohl(nla_get_be32(tb[NFTA_SET_FIELD_LEN])); if (len * BITS_PER_BYTE / 32 > NFT_REG32_COUNT) return -E2BIG; desc->field_len[desc->field_count++] = len; return 0; }
1
204,278
static void build_dirs(char *src, char *dst, size_t src_prefix_len, size_t dst_prefix_len) { char *p = src + src_prefix_len + 1; char *q = dst + dst_prefix_len + 1; char *r = dst + dst_prefix_len; struct stat s; bool last = false; *r = '\0'; for (; !last; p++, q++) { if (*p == '\0') { last = true; } if (*p == '\0' || (*p == '/' && *(p - 1) != '/')) { // We found a new component of our src path. // Null-terminate it temporarily here so that we can work // with it. *p = '\0'; if (stat(src, &s) == 0 && S_ISDIR(s.st_mode)) { // Null-terminate the dst path and undo its previous // termination. *q = '\0'; *r = '/'; r = q; mkdir_attr(dst, s.st_mode, 0, 0); } if (!last) { // If we're not at the final terminating null, restore // the slash so that we can continue our traversal. *p = '/'; } } } }
1
226,070
GF_Box *dmed_box_new() { ISOM_DECL_BOX_ALLOC(GF_DMEDBox, GF_ISOM_BOX_TYPE_DMED); return (GF_Box *)tmp; }
0
372,355
check_limit(VALUE str, VALUE opt) { if (NIL_P(str)) return; if (SYMBOL_P(str)) str = rb_sym2str(str); StringValue(str); size_t slen = RSTRING_LEN(str); size_t limit = get_limit(opt); if (slen > limit) { rb_raise(rb_eArgError, "string length (%"PRI_SIZE_PREFIX"u) exceeds the limit %"PRI_SIZE_PREFIX"u", slen, limit); } }
0
318,958
test_gui_drop_files(dict_T *args UNUSED) { # if defined(HAVE_DROP_FILE) int row; int col; int_u mods; char_u **fnames; int count = 0; typval_T t; list_T *l; listitem_T *li; if (dict_find(args, (char_u *)"files", -1) == NULL || dict_find(args, (char_u *)"row", -1) == NULL || dict_find(args, (char_u *)"col", -1) == NULL || dict_find(args, (char_u *)"modifiers", -1) == NULL) return FALSE; (void)dict_get_tv(args, (char_u *)"files", &t); row = (int)dict_get_number(args, (char_u *)"row"); col = (int)dict_get_number(args, (char_u *)"col"); mods = (int)dict_get_number(args, (char_u *)"modifiers"); if (t.v_type != VAR_LIST || list_len(t.vval.v_list) == 0) return FALSE; l = t.vval.v_list; fnames = ALLOC_MULT(char_u *, list_len(l)); if (fnames == NULL) return FALSE; FOR_ALL_LIST_ITEMS(l, li) { // ignore non-string items if (li->li_tv.v_type != VAR_STRING || li->li_tv.vval.v_string == NULL) continue; fnames[count] = vim_strsave(li->li_tv.vval.v_string); if (fnames[count] == NULL) { while (--count >= 0) vim_free(fnames[count]); vim_free(fnames); return FALSE; } count++; } if (count > 0) gui_handle_drop(TEXT_X(col - 1), TEXT_Y(row - 1), mods, fnames, count); else vim_free(fnames); # endif return TRUE; }
0
231,003
argnum_error(mrb_state *mrb, mrb_int num) { mrb_value exc; mrb_value str; mrb_int argc = mrb->c->ci->n; if (argc == 15) { mrb_value args = mrb->c->ci->stack[1]; if (mrb_array_p(args)) { argc = RARRAY_LEN(args); } } if (argc == 0 && mrb->c->ci->nk != 0 && !mrb_hash_empty_p(mrb, mrb->c->ci->stack[1])) { argc++; } str = mrb_format(mrb, "wrong number of arguments (given %i, expected %i)", argc, num); exc = mrb_exc_new_str(mrb, E_ARGUMENT_ERROR, str); mrb_exc_set(mrb, exc); }
0
446,116
atusb_set_cca_mode(struct ieee802154_hw *hw, const struct wpan_phy_cca *cca) { struct atusb *atusb = hw->priv; u8 val; /* mapping 802.15.4 to driver spec */ switch (cca->mode) { case NL802154_CCA_ENERGY: val = 1; break; case NL802154_CCA_CARRIER: val = 2; break; case NL802154_CCA_ENERGY_CARRIER: switch (cca->opt) { case NL802154_CCA_OPT_ENERGY_CARRIER_AND: val = 3; break; case NL802154_CCA_OPT_ENERGY_CARRIER_OR: val = 0; break; default: return -EINVAL; } break; default: return -EINVAL; } return atusb_write_subreg(atusb, SR_CCA_MODE, val); }
0
349,529
static int virtbt_add_inbuf(struct virtio_bluetooth *vbt) { struct virtqueue *vq = vbt->vqs[VIRTBT_VQ_RX]; struct scatterlist sg[1]; struct sk_buff *skb; int err; skb = alloc_skb(1000, GFP_KERNEL); if (!skb) return -ENOMEM; sg_init_one(sg, skb->data, 1000); err = virtqueue_add_inbuf(vq, sg, 1, skb, GFP_KERNEL); if (err < 0) { kfree_skb(skb); return err; } return 0; }
0
328,916
R_API ConstJavaValue *U(r_bin_java_resolve_to_const_value)(RBinJavaObj * BIN_OBJ, int idx) { // TODO XXX FIXME add a size parameter to the str when it is passed in RBinJavaCPTypeObj *item = NULL, *item2 = NULL; ConstJavaValue *result = R_NEW0 (ConstJavaValue); if (!result) { return NULL; } char *class_str = NULL, *name_str = NULL, *desc_str = NULL, *string_str = NULL, *empty = "", *cp_name = NULL; result->type = "unknown"; if (BIN_OBJ && BIN_OBJ->cp_count < 1) { // r_bin_java_new_bin(BIN_OBJ); return result; } item = (RBinJavaCPTypeObj *) r_bin_java_get_item_from_bin_cp_list (BIN_OBJ, idx); if (!item) { return result; } cp_name = ((RBinJavaCPTypeMetas *) item->metas->type_info)->name; IFDBG eprintf ("java_resolve Resolved: (%d) %s\n", idx, cp_name); if (strcmp (cp_name, "Class") == 0) { item2 = (RBinJavaCPTypeObj *) r_bin_java_get_item_from_bin_cp_list (BIN_OBJ, idx); // str = r_bin_java_get_name_from_bin_cp_list (BIN_OBJ, idx-1); class_str = r_bin_java_get_item_name_from_bin_cp_list (BIN_OBJ, item); if (!class_str) { class_str = empty; } name_str = r_bin_java_get_item_name_from_bin_cp_list (BIN_OBJ, item2); if (!name_str) { name_str = empty; } desc_str = r_bin_java_get_item_desc_from_bin_cp_list (BIN_OBJ, item2); if (!desc_str) { desc_str = empty; } result->value._ref = R_NEW0 (_JavaRef); result->type = "ref"; result->value._ref->class_name = strdup (class_str); result->value._ref->name = strdup (name_str); result->value._ref->desc = strdup (desc_str); if (class_str != empty) { free (class_str); } if (name_str != empty) { free (name_str); } if (desc_str != empty) { free (desc_str); } } else if (strcmp (cp_name, "MethodRef") == 0 || strcmp (cp_name, "FieldRef") == 0 || strcmp (cp_name, "InterfaceMethodRef") == 0) { /* * The MethodRef, FieldRef, and InterfaceMethodRef structures */ class_str = r_bin_java_get_name_from_bin_cp_list (BIN_OBJ, item->info.cp_method.class_idx); if (!class_str) { class_str = empty; } name_str = r_bin_java_get_item_name_from_bin_cp_list (BIN_OBJ, item); if (!name_str) { name_str = empty; } desc_str = r_bin_java_get_item_desc_from_bin_cp_list (BIN_OBJ, item); if (!desc_str) { desc_str = empty; } result->value._ref = R_NEW0 (_JavaRef); result->type = "ref"; result->value._ref->class_name = strdup (class_str); result->value._ref->name = strdup (name_str); result->value._ref->desc = strdup (desc_str); if (class_str != empty) { free (class_str); } if (name_str != empty) { free (name_str); } if (desc_str != empty) { free (desc_str); } } else if (strcmp (cp_name, "String") == 0) { ut32 length = r_bin_java_get_utf8_len_from_bin_cp_list (BIN_OBJ, item->info.cp_string.string_idx); string_str = r_bin_java_get_utf8_from_bin_cp_list (BIN_OBJ, item->info.cp_string.string_idx); IFDBG eprintf ("java_resolve String got: (%d) %s\n", item->info.cp_string.string_idx, string_str); if (!string_str) { string_str = empty; length = strlen (empty); } result->type = "str"; result->value._str = R_NEW0 (struct java_const_value_str_t); result->value._str->len = length; if (length > 0) { result->value._str->str = r_str_ndup (string_str, length); } else { result->value._str->str = strdup (""); } if (string_str != empty) { free (string_str); } } else if (strcmp (cp_name, "Utf8") == 0) { result->type = "str"; result->value._str = R_NEW0 (struct java_const_value_str_t); result->value._str->str = malloc (item->info.cp_utf8.length); result->value._str->len = item->info.cp_utf8.length; memcpy (result->value._str->str, item->info.cp_utf8.bytes, item->info.cp_utf8.length); } else if (strcmp (cp_name, "Long") == 0) { result->type = "long"; result->value._long = r_bin_java_raw_to_long (item->info.cp_long.bytes.raw, 0); } else if (strcmp (cp_name, "Double") == 0) { result->type = "double"; result->value._double = r_bin_java_raw_to_double (item->info.cp_double.bytes.raw, 0); } else if (strcmp (cp_name, "Integer") == 0) { result->type = "int"; result->value._int = R_BIN_JAVA_UINT (item->info.cp_integer.bytes.raw, 0); } else if (strcmp (cp_name, "Float") == 0) { result->type = "float"; result->value._float = R_BIN_JAVA_FLOAT (item->info.cp_float.bytes.raw, 0); } else if (strcmp (cp_name, "NameAndType") == 0) { result->value._ref = R_NEW0 (struct java_const_value_ref_t); result->type = "ref"; name_str = r_bin_java_get_item_name_from_bin_cp_list (BIN_OBJ, item); if (!name_str) { name_str = empty; } desc_str = r_bin_java_get_item_desc_from_bin_cp_list (BIN_OBJ, item); if (!desc_str) { desc_str = empty; } result->value._ref->class_name = strdup (empty); result->value._ref->name = strdup (name_str); result->value._ref->desc = strdup (desc_str); if (name_str != empty) { free (name_str); } if (desc_str != empty) { free (desc_str); } result->value._ref->is_method = r_bin_java_does_cp_idx_ref_method (BIN_OBJ, idx); result->value._ref->is_field = r_bin_java_does_cp_idx_ref_field (BIN_OBJ, idx); } return result; }
0
411,927
fix_transited_encoding(krb5_context context, krb5_kdc_configuration *config, krb5_boolean check_policy, const TransitedEncoding *tr, EncTicketPart *et, const char *client_realm, const char *server_realm, const char *tgt_realm) { krb5_error_code ret = 0; char **realms, **tmp; unsigned int num_realms; size_t i; switch (tr->tr_type) { case domain_X500_Compress: break; case 0: /* * Allow empty content of type 0 because that is was Microsoft * generates in their TGT. */ if (tr->contents.length == 0) break; kdc_log(context, config, 4, "Transited type 0 with non empty content"); return KRB5KDC_ERR_TRTYPE_NOSUPP; default: kdc_log(context, config, 4, "Unknown transited type: %u", tr->tr_type); return KRB5KDC_ERR_TRTYPE_NOSUPP; } ret = krb5_domain_x500_decode(context, tr->contents, &realms, &num_realms, client_realm, server_realm); if(ret){ krb5_warn(context, ret, "Decoding transited encoding"); return ret; } /* * If the realm of the presented tgt is neither the client nor the server * realm, it is a transit realm and must be added to transited set. */ if(strcmp(client_realm, tgt_realm) && strcmp(server_realm, tgt_realm)) { if (num_realms + 1 > UINT_MAX/sizeof(*realms)) { ret = ERANGE; goto free_realms; } tmp = realloc(realms, (num_realms + 1) * sizeof(*realms)); if(tmp == NULL){ ret = ENOMEM; goto free_realms; } realms = tmp; realms[num_realms] = strdup(tgt_realm); if(realms[num_realms] == NULL){ ret = ENOMEM; goto free_realms; } num_realms++; } if(num_realms == 0) { if(strcmp(client_realm, server_realm)) kdc_log(context, config, 4, "cross-realm %s -> %s", client_realm, server_realm); } else { size_t l = 0; char *rs; for(i = 0; i < num_realms; i++) l += strlen(realms[i]) + 2; rs = malloc(l); if(rs != NULL) { *rs = '\0'; for(i = 0; i < num_realms; i++) { if(i > 0) strlcat(rs, ", ", l); strlcat(rs, realms[i], l); } kdc_log(context, config, 4, "cross-realm %s -> %s via [%s]", client_realm, server_realm, rs); free(rs); } } if(check_policy) { ret = krb5_check_transited(context, client_realm, server_realm, realms, num_realms, NULL); if(ret) { krb5_warn(context, ret, "cross-realm %s -> %s", client_realm, server_realm); goto free_realms; } et->flags.transited_policy_checked = 1; } et->transited.tr_type = domain_X500_Compress; ret = krb5_domain_x500_encode(realms, num_realms, &et->transited.contents); if(ret) krb5_warn(context, ret, "Encoding transited encoding"); free_realms: for(i = 0; i < num_realms; i++) free(realms[i]); free(realms); return ret; }
0
412,105
key_get_es_version(uint8_t version[2]) { struct es_version { uint8_t es_version[2]; const char *name; }; const int num_versions = 2; struct es_version es_versions[] = { {{0x00, 0x01}, "X25519-XSalsa20Poly1305"}, {{0x00, 0x02}, "X25519-XChacha20Poly1305"}, }; int i; for(i=0; i < num_versions; i++){ if(es_versions[i].es_version[0] == version[0] && es_versions[i].es_version[1] == version[1]){ return es_versions[i].name; } } return NULL; }
0
353,185
void SplashOutputDev::setSoftMaskFromImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, bool invert, bool inlineImg, double *baseMatrix) { const double *ctm; SplashCoord mat[6]; SplashOutImageMaskData imgMaskData; Splash *maskSplash; SplashColor maskColor; double bbox[4] = {0, 0, 1, 1}; // default; if (state->getFillColorSpace()->isNonMarking()) { return; } ctm = state->getCTM(); for (int i = 0; i < 6; ++i) { if (!std::isfinite(ctm[i])) return; } beginTransparencyGroup(state, bbox, nullptr, false, false, false); baseMatrix[4] -= transpGroupStack->tx; baseMatrix[5] -= transpGroupStack->ty; ctm = state->getCTM(); mat[0] = ctm[0]; mat[1] = ctm[1]; mat[2] = -ctm[2]; mat[3] = -ctm[3]; mat[4] = ctm[2] + ctm[4]; mat[5] = ctm[3] + ctm[5]; imgMaskData.imgStr = new ImageStream(str, width, 1, 1); imgMaskData.imgStr->reset(); imgMaskData.invert = invert ? 0 : 1; imgMaskData.width = width; imgMaskData.height = height; imgMaskData.y = 0; transpGroupStack->softmask = new SplashBitmap(bitmap->getWidth(), bitmap->getHeight(), 1, splashModeMono8, false); maskSplash = new Splash(transpGroupStack->softmask, vectorAntialias); maskColor[0] = 0; maskSplash->clear(maskColor); maskColor[0] = 0xff; maskSplash->setFillPattern(new SplashSolidColor(maskColor)); maskSplash->fillImageMask(&imageMaskSrc, &imgMaskData, width, height, mat, t3GlyphStack != nullptr); delete maskSplash; delete imgMaskData.imgStr; str->close(); }
0
339,710
ZEND_API int zend_shutdown_strtod(void) /* {{{ */ { destroy_freelist(); #ifdef ZTS tsrm_mutex_free(dtoa_mutex); dtoa_mutex = NULL; tsrm_mutex_free(pow5mult_mutex); pow5mult_mutex = NULL; #endif return 1; }
0
281,112
static int __net_init xfrm_statistics_init(struct net *net) { return 0; }
0
197,359
Status AutoParallel::Initialize(const GrapplerItem& item) { num_gpus_ = GetNumAvailableGPUs(); LOG(INFO) << "Number of GPUs: " << num_gpus_; item_ = &item; graph_ = item.graph; LOG(INFO) << "Original graph size: " << graph_.node_size(); if (item.fetch.empty()) { return Status(error::INVALID_ARGUMENT, "No fetch nodes provided."); } if (item.MainVariables().empty()) { return Status(error::INVALID_ARGUMENT, "No variables provided."); } for (const auto& init : item.init_ops) { VLOG(1) << "Init node: " << init; } for (const auto& fetch : item.fetch) { VLOG(1) << "Fetch node: " << fetch; } for (const auto& var : item.MainVariables()) { VLOG(2) << "Variable: " << var->name(); } const std::set<string> apply_gradients_ops = {"ApplyGradientDescent", "ApplyProximalGradientDescent", "ApplyAdadelta", "ApplyAdagrad", "ApplyProximalAdagrad", "ApplyAdagradDA", "ApplyFtrl", "ApplyMomentum", "ApplyAdam", "ApplyRMSProp", "ApplyCenteredRMSProp"}; for (int i = 0; i < graph_.node_size(); i++) { all_nodes_.insert( std::make_pair(graph_.node(i).name(), graph_.mutable_node(i))); if (apply_gradients_ops.find(graph_.node(i).op()) != apply_gradients_ops.end()) { apply_gradients_nodes_.insert(graph_.node(i).name()); VLOG(2) << "Apply gradients node: " << graph_.node(i).name(); } } auto div_const_node = AddNodeDivConst(); all_nodes_.insert(std::make_pair(div_const_node->name(), div_const_node)); std::map<string, int> gradient_pos = {{"ApplyGradientDescent", 2}, {"ApplyProximalGradientDescent", 4}, {"ApplyAdadelta", 6}, {"ApplyAdagrad", 3}, {"ApplyProximalAdagrad", 5}, {"ApplyAdagradDA", 3}, {"ApplyFtrl", 3}, {"ApplyMomentum", 3}, {"ApplyAdam", 9}, {"ApplyRMSProp", 7}, {"ApplyCenteredRMSProp", 8}}; for (const auto& apply_gradient_node_name : apply_gradients_nodes_) { auto apply_gradients_op = all_nodes_[apply_gradient_node_name]->op(); auto apply_gradients_node = all_nodes_[apply_gradient_node_name]; auto div_node = AddNodeDiv( apply_gradient_node_name, apply_gradients_node->input(gradient_pos[apply_gradients_op]), div_const_node->name()); all_nodes_.insert(std::make_pair(div_node->name(), div_node)); *apply_gradients_node->mutable_input(gradient_pos[apply_gradients_op]) = div_node->name(); } LOG(INFO) << "Graph size after adding div nodes: " << all_nodes_.size(); std::vector<const NodeDef*> train_nodes; TF_RETURN_IF_ERROR(ComputeTransitiveFanin(graph_, item.fetch, &train_nodes)); LOG(INFO) << "Number of training nodes: " << train_nodes.size(); const NodeDef* dequeue_node; for (const auto& train_node : train_nodes) { if (IsDequeueOp(*train_node)) { dequeue_node = train_node; break; } } std::vector<const NodeDef*> input_nodes; if (dequeue_node) { LOG(INFO) << "Dequeue node: " << dequeue_node->name(); TF_RETURN_IF_ERROR(ComputeTransitiveFanin(graph_, {dequeue_node->name()}, {}, &input_nodes)); } LOG(INFO) << "Number of input nodes: " << input_nodes.size(); std::set<string> dont_replicate_nodes; for (const auto& variable : item.MainVariables()) { dont_replicate_nodes.insert(variable->name()); } for (const auto& init : item.init_ops) { dont_replicate_nodes.insert(NodeName(init)); } // Don't replicate all input nodes, except the dequeue node. for (const auto& input_node : input_nodes) { if (input_node->name() != dequeue_node->name()) { dont_replicate_nodes.insert(input_node->name()); } } for (const auto& node : train_nodes) { if (dont_replicate_nodes.find(node->name()) == dont_replicate_nodes.end()) { replica_nodes_.insert(node->name()); } } LOG(INFO) << "Number of replica nodes: " << replica_nodes_.size(); for (const auto& node : all_nodes_) { if (replica_nodes_.find(node.first) == replica_nodes_.end()) { shared_nodes_.insert(node.first); } } LOG(INFO) << "Number of shared nodes: " << shared_nodes_.size(); return Status::OK(); }
1
440,890
LogClose(enum ExitCode error) { if (logFile) { int msgtype = (error == EXIT_NO_ERROR) ? X_INFO : X_ERROR; LogMessageVerbSigSafe(msgtype, -1, "Server terminated %s (%d). Closing log file.\n", (error == EXIT_NO_ERROR) ? "successfully" : "with error", error); fclose(logFile); logFile = NULL; logFileFd = -1; } }
0
352,963
firstComponentNormalize( slap_mask_t usage, Syntax *syntax, MatchingRule *mr, struct berval *val, struct berval *normalized, void *ctx ) { int rc; struct berval comp; ber_len_t len; if( SLAP_MR_IS_VALUE_OF_ASSERTION_SYNTAX( usage )) { ber_dupbv_x( normalized, val, ctx ); return LDAP_SUCCESS; } if( val->bv_len < 3 ) return LDAP_INVALID_SYNTAX; if( ! ( val->bv_val[0] == '(' /*')'*/ && val->bv_val[val->bv_len - 1] == /*'('*/ ')' ) && ! ( val->bv_val[0] == '{' /*'}'*/ && val->bv_val[val->bv_len - 1] == /*'('*/ '}' ) ) { return LDAP_INVALID_SYNTAX; } /* trim leading white space */ for( len=1; len < val->bv_len && ASCII_SPACE(val->bv_val[len]); len++ ) { /* empty */ } /* grab next word */ comp.bv_val = &val->bv_val[len]; len = val->bv_len - len - STRLENOF(/*"{"*/ "}"); for( comp.bv_len = 0; !ASCII_SPACE(comp.bv_val[comp.bv_len]) && comp.bv_len < len; comp.bv_len++ ) { /* empty */ } if( mr == slap_schema.si_mr_objectIdentifierFirstComponentMatch ) { rc = numericoidValidate( NULL, &comp ); } else if( mr == slap_schema.si_mr_integerFirstComponentMatch ) { rc = integerValidate( NULL, &comp ); } else { rc = LDAP_INVALID_SYNTAX; } if( rc == LDAP_SUCCESS ) { ber_dupbv_x( normalized, &comp, ctx ); } return rc; }
0
427,240
static void field (LexState *ls, ConsControl *cc) { /* field -> listfield | recfield */ switch(ls->t.token) { case TK_NAME: { /* may be 'listfield' or 'recfield' */ if (luaX_lookahead(ls) != '=') /* expression? */ listfield(ls, cc); else recfield(ls, cc); break; } case '[': { recfield(ls, cc); break; } default: { listfield(ls, cc); break; } } }
0
462,265
PJ_DEF(pj_stun_attr_hdr*) pj_stun_attr_clone( pj_pool_t *pool, const pj_stun_attr_hdr *attr) { const struct attr_desc *adesc; /* Get the attribute descriptor */ adesc = find_attr_desc(attr->type); if (adesc) { return (pj_stun_attr_hdr*) (*adesc->clone_attr)(pool, attr); } else { /* Clone generic attribute */ const pj_stun_binary_attr *bin_attr = (const pj_stun_binary_attr*) attr; PJ_ASSERT_RETURN(bin_attr->magic == PJ_STUN_MAGIC, NULL); if (bin_attr->magic == PJ_STUN_MAGIC) { return (pj_stun_attr_hdr*) clone_binary_attr(pool, attr); } else { return NULL; } } }
0
294,434
c_julian_last_day_of_month(int y, int m) { assert(m >= 1 && m <= 12); return monthtab[c_julian_leap_p(y) ? 1 : 0][m]; }
0
508,372
Repair_mrg_table_error_handler() : m_handled_errors(false), m_unhandled_errors(false) {}
0
248,747
static void freecookie(struct Cookie *co) { free(co->expirestr); free(co->domain); free(co->path); free(co->spath); free(co->name); free(co->value); free(co->maxage); free(co->version); free(co); }
0
359,511
DEFUN (no_neighbor_route_server_client, no_neighbor_route_server_client_cmd, NO_NEIGHBOR_CMD2 "route-server-client", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Configure a neighbor as Route Server client\n") { return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty), bgp_node_safi(vty)); }
0
386,605
bool DL_Dxf::handleXRecordData(DL_CreationInterface* creationInterface) { if (groupCode==105) { return false; } if (groupCode==5) { creationInterface->addXRecord(groupValue); return true; } if (groupCode==280) { xRecordValues = true; return true; } if (!xRecordValues) { return false; } // string: if (groupCode<=9 || groupCode==100 || groupCode==102 || groupCode==105 || (groupCode>=300 && groupCode<=369) || (groupCode>=1000 && groupCode<=1009)) { creationInterface->addXRecordString(groupCode, groupValue); return true; } // int: else if ((groupCode>=60 && groupCode<=99) || (groupCode>=160 && groupCode<=179) || (groupCode>=270 && groupCode<=289)) { creationInterface->addXRecordInt(groupCode, toInt(groupValue)); return true; } // bool: else if (groupCode>=290 && groupCode<=299) { creationInterface->addXRecordBool(groupCode, toBool(groupValue)); return true; } // double: else if ((groupCode>=10 && groupCode<=59) || (groupCode>=110 && groupCode<=149) || (groupCode>=210 && groupCode<=239)) { creationInterface->addXRecordReal(groupCode, toReal(groupValue)); return true; } return false; }
0
264,295
static void vnc_listen_read(void *opaque, bool websocket) { VncDisplay *vs = opaque; struct sockaddr_in addr; socklen_t addrlen = sizeof(addr); int csock; /* Catch-up */ graphic_hw_update(NULL); #ifdef CONFIG_VNC_WS if (websocket) { csock = qemu_accept(vs->lwebsock, (struct sockaddr *)&addr, &addrlen); } else #endif /* CONFIG_VNC_WS */ { csock = qemu_accept(vs->lsock, (struct sockaddr *)&addr, &addrlen); } if (csock != -1) { vnc_connect(vs, csock, false, websocket); } }
0
246,683
void PrintLiveUsage() { u32 i=0; gf_sys_format_help(helpout, help_flags, "# Live Scene Encoder Options\n" "The options shall be specified as òpt_name=opt_val.\n" "Options:\n" "\n" ); while (m4b_liveenc_args[i].name) { GF_GPACArg *arg = (GF_GPACArg *) &m4b_liveenc_args[i]; i++; gf_sys_print_arg(helpout, help_flags, arg, "mp4box-extract"); } gf_sys_format_help(helpout, help_flags, " \n" "Runtime options:\n" "- q: quits\n" "- u: inputs some commands to be sent\n" "- U: same as u but signals the updates as critical\n" "- e: inputs some commands to be sent without being aggregated\n" "- E: same as e but signals the updates as critical\n" "- f: forces RAP sending\n" "- F: forces RAP regeneration and sending\n" "- p: dumps current scene\n" ); }
0
374,041
static void destroy(RBinFile *bf) { r_coresym_cache_element_free (bf->o->bin_obj); }
0
277,005
fiber_eq(mrb_state *mrb, mrb_value self) { mrb_value other = mrb_get_arg1(mrb); if (!mrb_fiber_p(other)) { return mrb_false_value(); } return mrb_bool_value(fiber_ptr(self) == fiber_ptr(other)); }
0
387,850
int InstanceKlass::nof_implementors() const { assert_lock_strong(Compile_lock); Klass* k = implementor(); if (k == NULL) { return 0; } else if (k != this) { return 1; } else { return 2; } }
0
398,497
RZ_API void rz_bin_dwarf_debug_info_free(RzBinDwarfDebugInfo *inf) { if (!inf) { return; } for (size_t i = 0; i < inf->count; i++) { free_comp_unit(&inf->comp_units[i]); } ht_up_free(inf->line_info_offset_comp_dir); ht_up_free(inf->lookup_table); free(inf->comp_units); free(inf); }
0
462,403
sessActivity(ptcpsess_t *pSess, int *continue_polling) { int lenRcv; int lenBuf; uchar *peerName; int lenPeer; int remsock = 0; /* init just to keep compiler happy... :-( */ sbool bEmitOnClose = 0; char rcvBuf[128*1024]; DEFiRet; DBGPRINTF("imptcp: new activity on session socket %d\n", pSess->sock); while(1) { lenBuf = sizeof(rcvBuf); lenRcv = recv(pSess->sock, rcvBuf, lenBuf, 0); if(lenRcv > 0) { /* have data, process it */ DBGPRINTF("imptcp: data(%d) on socket %d: %s\n", lenBuf, pSess->sock, rcvBuf); CHKiRet(DataRcvd(pSess, rcvBuf, lenRcv)); } else if (lenRcv == 0) { /* session was closed, do clean-up */ if(pSess->pLstn->pSrv->bEmitMsgOnClose) { prop.GetString(pSess->peerName, &peerName, &lenPeer), remsock = pSess->sock; bEmitOnClose = 1; } *continue_polling = 0; CHKiRet(closeSess(pSess)); /* close may emit more messages in strmzip mode! */ if(bEmitOnClose) { errmsg.LogError(0, RS_RET_PEER_CLOSED_CONN, "imptcp session %d closed by " "remote peer %s.", remsock, peerName); } break; } else { if(errno == EAGAIN || errno == EWOULDBLOCK) break; DBGPRINTF("imptcp: error on session socket %d - closed.\n", pSess->sock); *continue_polling = 0; closeSess(pSess); /* try clean-up by dropping session */ break; } } finalize_it: RETiRet; }
0
292,240
inbound_set_all_away_status (server *serv, char *nick, unsigned int status) { GSList *list; session *sess; list = sess_list; while (list) { sess = list->data; if (sess->server == serv) userlist_set_away (sess, nick, status); list = list->next; } }
0
212,165
static int synic_set_irq(struct kvm_vcpu_hv_synic *synic, u32 sint) { struct kvm_vcpu *vcpu = hv_synic_to_vcpu(synic); struct kvm_lapic_irq irq; int ret, vector; if (sint >= ARRAY_SIZE(synic->sint)) return -EINVAL; vector = synic_get_sint_vector(synic_read_sint(synic, sint)); if (vector < 0) return -ENOENT; memset(&irq, 0, sizeof(irq)); irq.shorthand = APIC_DEST_SELF; irq.dest_mode = APIC_DEST_PHYSICAL; irq.delivery_mode = APIC_DM_FIXED; irq.vector = vector; irq.level = 1; ret = kvm_irq_delivery_to_apic(vcpu->kvm, vcpu->arch.apic, &irq, NULL); trace_kvm_hv_synic_set_irq(vcpu->vcpu_id, sint, irq.vector, ret); return ret; }
1
359,251
DEFUN (neighbor_attr_unchanged1, neighbor_attr_unchanged1_cmd, NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "BGP attribute is propagated unchanged to this neighbor\n" "As-path attribute\n" "Nexthop attribute\n" "Med attribute\n") { u_int16_t flags = 0; if (strncmp (argv[1], "as-path", 1) == 0) SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); else if (strncmp (argv[1], "next-hop", 1) == 0) SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); else if (strncmp (argv[1], "med", 1) == 0) SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), bgp_node_safi (vty), flags); }
0
463,044
comics_document_document_thumbnails_iface_init (EvDocumentThumbnailsInterface *iface) { iface->get_thumbnail = comics_document_thumbnails_get_thumbnail; iface->get_dimensions = comics_document_thumbnails_get_dimensions; }
0
231,705
TEST_F(QuicServerTransportTest, TestAckRstStream) { auto streamId = server->createUnidirectionalStream().value(); auto stream = server->getNonConstConn().streamManager->getStream(streamId); auto packetNum = rstStreamAndSendPacket( server->getNonConstConn(), server->getSocket(), *stream, GenericApplicationErrorCode::UNKNOWN); AckBlocks acks = {{packetNum, packetNum}}; auto packet1 = createAckPacket( server->getNonConstConn(), ++clientNextAppDataPacketNum, acks, PacketNumberSpace::AppData); deliverData(packetToBuf(packet1)); // Closed streams should be deleted. EXPECT_EQ(server->getConn().streamManager->streamCount(), 0); }
0
437,717
static int cx23888_ir_tx_g_parameters(struct v4l2_subdev *sd, struct v4l2_subdev_ir_parameters *p) { struct cx23888_ir_state *state = to_state(sd); mutex_lock(&state->tx_params_lock); memcpy(p, &state->tx_params, sizeof(struct v4l2_subdev_ir_parameters)); mutex_unlock(&state->tx_params_lock); return 0; }
0
391,661
static NTSTATUS mkdir_internal(connection_struct *conn, struct smb_filename *smb_dname, uint32 file_attributes) { mode_t mode; char *parent_dir = NULL; NTSTATUS status; bool posix_open = false; bool need_re_stat = false; uint32_t access_mask = SEC_DIR_ADD_SUBDIR; if (!CAN_WRITE(conn) || (access_mask & ~(conn->share_access))) { DEBUG(5,("mkdir_internal: failing share access " "%s\n", lp_servicename(talloc_tos(), SNUM(conn)))); return NT_STATUS_ACCESS_DENIED; } if (!parent_dirname(talloc_tos(), smb_dname->base_name, &parent_dir, NULL)) { return NT_STATUS_NO_MEMORY; } if (file_attributes & FILE_FLAG_POSIX_SEMANTICS) { posix_open = true; mode = (mode_t)(file_attributes & ~FILE_FLAG_POSIX_SEMANTICS); } else { mode = unix_mode(conn, FILE_ATTRIBUTE_DIRECTORY, smb_dname, parent_dir); } status = check_parent_access(conn, smb_dname, access_mask); if(!NT_STATUS_IS_OK(status)) { DEBUG(5,("mkdir_internal: check_parent_access " "on directory %s for path %s returned %s\n", parent_dir, smb_dname->base_name, nt_errstr(status) )); return status; } if (SMB_VFS_MKDIR(conn, smb_dname->base_name, mode) != 0) { return map_nt_error_from_unix(errno); } /* Ensure we're checking for a symlink here.... */ /* We don't want to get caught by a symlink racer. */ if (SMB_VFS_LSTAT(conn, smb_dname) == -1) { DEBUG(2, ("Could not stat directory '%s' just created: %s\n", smb_fname_str_dbg(smb_dname), strerror(errno))); return map_nt_error_from_unix(errno); } if (!S_ISDIR(smb_dname->st.st_ex_mode)) { DEBUG(0, ("Directory '%s' just created is not a directory !\n", smb_fname_str_dbg(smb_dname))); return NT_STATUS_NOT_A_DIRECTORY; } if (lp_store_dos_attributes(SNUM(conn))) { if (!posix_open) { file_set_dosmode(conn, smb_dname, file_attributes | FILE_ATTRIBUTE_DIRECTORY, parent_dir, true); } } if (lp_inherit_perms(SNUM(conn))) { inherit_access_posix_acl(conn, parent_dir, smb_dname->base_name, mode); need_re_stat = true; } if (!posix_open) { /* * Check if high bits should have been set, * then (if bits are missing): add them. * Consider bits automagically set by UNIX, i.e. SGID bit from parent * dir. */ if ((mode & ~(S_IRWXU|S_IRWXG|S_IRWXO)) && (mode & ~smb_dname->st.st_ex_mode)) { SMB_VFS_CHMOD(conn, smb_dname->base_name, (smb_dname->st.st_ex_mode | (mode & ~smb_dname->st.st_ex_mode))); need_re_stat = true; } } /* Change the owner if required. */ if (lp_inherit_owner(SNUM(conn))) { change_dir_owner_to_parent(conn, parent_dir, smb_dname->base_name, &smb_dname->st); need_re_stat = true; } if (need_re_stat) { if (SMB_VFS_LSTAT(conn, smb_dname) == -1) { DEBUG(2, ("Could not stat directory '%s' just created: %s\n", smb_fname_str_dbg(smb_dname), strerror(errno))); return map_nt_error_from_unix(errno); } } notify_fname(conn, NOTIFY_ACTION_ADDED, FILE_NOTIFY_CHANGE_DIR_NAME, smb_dname->base_name); return NT_STATUS_OK; }
0
488,680
static int __init nonx_setup(char *str) { if (!str) return -EINVAL; if (!strncmp(str, "on", 2)) { __supported_pte_mask |= _PAGE_NX; do_not_nx = 0; } else if (!strncmp(str, "off", 3)) { do_not_nx = 1; __supported_pte_mask &= ~_PAGE_NX; } return 0; }
0
222,504
Status FunctionLibraryDefinition::AddFunctionDefHelper( const FunctionDef& fdef, const StackTracesMap& stack_traces, bool* added) { *added = false; std::shared_ptr<FunctionDefAndOpRegistration>& entry = function_defs_[fdef.signature().name()]; if (entry) { if (!FunctionDefsEqual(entry->fdef, fdef)) { return errors::InvalidArgument( "Cannot add function '", fdef.signature().name(), "' because a different function with the same name already " "exists."); } // Ignore duplicate FunctionDefs. return Status::OK(); } const OpDef* op_def; if (default_registry_->LookUpOpDef(fdef.signature().name(), &op_def).ok()) { return errors::InvalidArgument( "Cannot add function '", fdef.signature().name(), "' because an op with the same name already exists."); } entry = std::make_shared<FunctionDefAndOpRegistration>(fdef, stack_traces); *added = true; return Status::OK(); }
0
294,676
date_s_httpdate(int argc, VALUE *argv, VALUE klass) { VALUE str, sg, opt; rb_scan_args(argc, argv, "02:", &str, &sg, &opt); switch (argc) { case 0: str = rb_str_new2("Mon, 01 Jan -4712 00:00:00 GMT"); case 1: sg = INT2FIX(DEFAULT_SG); } { int argc2 = 1; VALUE argv2[2]; argv2[0] = str; if (!NIL_P(opt)) argv2[argc2++] = opt; VALUE hash = date_s__httpdate(argc2, argv2, klass); return d_new_by_frags(klass, hash, sg); } }
0
349,871
int hw_atl_utils_fw_downld_dwords(struct aq_hw_s *self, u32 a, u32 *p, u32 cnt) { int err = 0; u32 val; err = readx_poll_timeout_atomic(hw_atl_sem_ram_get, self, val, val == 1U, 1U, 10000U); if (err < 0) { bool is_locked; hw_atl_reg_glb_cpu_sem_set(self, 1U, HW_ATL_FW_SM_RAM); is_locked = hw_atl_sem_ram_get(self); if (!is_locked) { err = -ETIME; goto err_exit; } } aq_hw_write_reg(self, HW_ATL_MIF_ADDR, a); for (++cnt; --cnt && !err;) { aq_hw_write_reg(self, HW_ATL_MIF_CMD, 0x00008000U); if (ATL_HW_IS_CHIP_FEATURE(self, REVISION_B1)) err = readx_poll_timeout_atomic(hw_atl_utils_mif_addr_get, self, val, val != a, 1U, 1000U); else err = readx_poll_timeout_atomic(hw_atl_utils_mif_cmd_get, self, val, !(val & 0x100), 1U, 1000U); *(p++) = aq_hw_read_reg(self, HW_ATL_MIF_VAL); a += 4; } hw_atl_reg_glb_cpu_sem_set(self, 1U, HW_ATL_FW_SM_RAM); err_exit: return err; }
0
427,709
cdf_read_short_sector_chain(const cdf_header_t *h, const cdf_sat_t *ssat, const cdf_stream_t *sst, cdf_secid_t sid, size_t len, cdf_stream_t *scn) { size_t ss = CDF_SHORT_SEC_SIZE(h), i, j; scn->sst_tab = NULL; scn->sst_len = cdf_count_chain(ssat, sid, CDF_SEC_SIZE(h)); scn->sst_dirlen = len; scn->sst_ss = ss; if (scn->sst_len == CAST(size_t, -1)) goto out; scn->sst_tab = CDF_CALLOC(scn->sst_len, ss); if (scn->sst_tab == NULL) return cdf_zero_stream(scn); for (j = i = 0; sid >= 0; i++, j++) { if (j >= CDF_LOOP_LIMIT) { DPRINTF(("Read short sector chain loop limit")); goto out; } if (i >= scn->sst_len) { DPRINTF(("Out of bounds reading short sector chain " "%" SIZE_T_FORMAT "u > %" SIZE_T_FORMAT "u\n", i, scn->sst_len)); goto out; } if (cdf_read_short_sector(sst, scn->sst_tab, i * ss, ss, h, sid) != CAST(ssize_t, ss)) { DPRINTF(("Reading short sector chain %d", sid)); goto out; } sid = CDF_TOLE4(CAST(uint32_t, ssat->sat_tab[sid])); } return 0; out: errno = EFTYPE; return cdf_zero_stream(scn); }
0
218,969
bool ConstantFolding::IsReductionCandidateForSimplification( const NodeDef& node, const GraphProperties& properties, TensorShapeProto* input_tensor_shape, TensorShapeProto* output_tensor_shape, bool* is_single_element_op) const { // Get the properties of the input & output tensors and check if they both // contain a single element. if (!properties.HasInputProperties(node.name()) || !properties.HasOutputProperties(node.name())) { return false; } const auto& input_props = properties.GetInputProperties(node.name())[0]; const auto& output_props = properties.GetOutputProperties(node.name())[0]; if (!input_props.has_shape() || input_props.shape().unknown_rank() || !output_props.has_shape() || output_props.shape().unknown_rank()) { return false; } *input_tensor_shape = input_props.shape(); *output_tensor_shape = output_props.shape(); for (int i = 0; i < input_tensor_shape->dim_size(); ++i) { if (input_tensor_shape->dim(i).size() < 0) { return false; } } for (int i = 0; i < output_tensor_shape->dim_size(); ++i) { if (output_tensor_shape->dim(i).size() < 0) { return false; } } const int input_num_elements = TensorShape(*input_tensor_shape).num_elements(); const int output_num_elements = TensorShape(*output_tensor_shape).num_elements(); *is_single_element_op = input_num_elements == 1 && output_num_elements == 1; return true; }
0
211,594
static Image *ReadWPGImage(const ImageInfo *image_info, ExceptionInfo *exception) { typedef struct { size_t FileId; MagickOffsetType DataOffset; unsigned int ProductType; unsigned int FileType; unsigned char MajorVersion; unsigned char MinorVersion; unsigned int EncryptKey; unsigned int Reserved; } WPGHeader; typedef struct { unsigned char RecType; size_t RecordLength; } WPGRecord; typedef struct { unsigned char Class; unsigned char RecType; size_t Extension; size_t RecordLength; } WPG2Record; typedef struct { unsigned HorizontalUnits; unsigned VerticalUnits; unsigned char PosSizePrecision; } WPG2Start; typedef struct { unsigned int Width; unsigned int Height; unsigned int Depth; unsigned int HorzRes; unsigned int VertRes; } WPGBitmapType1; typedef struct { unsigned int Width; unsigned int Height; unsigned char Depth; unsigned char Compression; } WPG2BitmapType1; typedef struct { unsigned int RotAngle; unsigned int LowLeftX; unsigned int LowLeftY; unsigned int UpRightX; unsigned int UpRightY; unsigned int Width; unsigned int Height; unsigned int Depth; unsigned int HorzRes; unsigned int VertRes; } WPGBitmapType2; typedef struct { unsigned int StartIndex; unsigned int NumOfEntries; } WPGColorMapRec; /* typedef struct { size_t PS_unknown1; unsigned int PS_unknown2; unsigned int PS_unknown3; } WPGPSl1Record; */ Image *image; unsigned int status; WPGHeader Header; WPGRecord Rec; WPG2Record Rec2; WPG2Start StartWPG; WPGBitmapType1 BitmapHeader1; WPG2BitmapType1 Bitmap2Header1; WPGBitmapType2 BitmapHeader2; WPGColorMapRec WPG_Palette; int i, bpp, WPG2Flags; ssize_t ldblk; size_t one; unsigned char *BImgBuff; tCTM CTM; /*current transform matrix*/ /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); one=1; image=AcquireImage(image_info,exception); image->depth=8; status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } /* Read WPG image. */ Header.FileId=ReadBlobLSBLong(image); Header.DataOffset=(MagickOffsetType) ReadBlobLSBLong(image); Header.ProductType=ReadBlobLSBShort(image); Header.FileType=ReadBlobLSBShort(image); Header.MajorVersion=ReadBlobByte(image); Header.MinorVersion=ReadBlobByte(image); Header.EncryptKey=ReadBlobLSBShort(image); Header.Reserved=ReadBlobLSBShort(image); if (Header.FileId!=0x435057FF || (Header.ProductType>>8)!=0x16) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); if (Header.EncryptKey!=0) ThrowReaderException(CoderError,"EncryptedWPGImageFileNotSupported"); image->columns = 1; image->rows = 1; image->colors = 0; bpp=0; BitmapHeader2.RotAngle=0; Rec2.RecordLength=0; switch(Header.FileType) { case 1: /* WPG level 1 */ while(!EOFBlob(image)) /* object parser loop */ { (void) SeekBlob(image,Header.DataOffset,SEEK_SET); if(EOFBlob(image)) break; Rec.RecType=(i=ReadBlobByte(image)); if(i==EOF) break; Rd_WP_DWORD(image,&Rec.RecordLength); if (Rec.RecordLength > GetBlobSize(image)) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); if(EOFBlob(image)) break; Header.DataOffset=TellBlob(image)+Rec.RecordLength; switch(Rec.RecType) { case 0x0B: /* bitmap type 1 */ BitmapHeader1.Width=ReadBlobLSBShort(image); BitmapHeader1.Height=ReadBlobLSBShort(image); if ((BitmapHeader1.Width == 0) || (BitmapHeader1.Height == 0)) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); BitmapHeader1.Depth=ReadBlobLSBShort(image); BitmapHeader1.HorzRes=ReadBlobLSBShort(image); BitmapHeader1.VertRes=ReadBlobLSBShort(image); if(BitmapHeader1.HorzRes && BitmapHeader1.VertRes) { image->units=PixelsPerCentimeterResolution; image->resolution.x=BitmapHeader1.HorzRes/470.0; image->resolution.y=BitmapHeader1.VertRes/470.0; } image->columns=BitmapHeader1.Width; image->rows=BitmapHeader1.Height; bpp=BitmapHeader1.Depth; goto UnpackRaster; case 0x0E: /*Color palette */ WPG_Palette.StartIndex=ReadBlobLSBShort(image); WPG_Palette.NumOfEntries=ReadBlobLSBShort(image); if ((WPG_Palette.NumOfEntries-WPG_Palette.StartIndex) > (Rec2.RecordLength-2-2) / 3) ThrowReaderException(CorruptImageError,"InvalidColormapIndex"); image->colors=WPG_Palette.NumOfEntries; if (!AcquireImageColormap(image,image->colors,exception)) goto NoMemory; for (i=WPG_Palette.StartIndex; i < (int)WPG_Palette.NumOfEntries; i++) { image->colormap[i].red=ScaleCharToQuantum((unsigned char) ReadBlobByte(image)); image->colormap[i].green=ScaleCharToQuantum((unsigned char) ReadBlobByte(image)); image->colormap[i].blue=ScaleCharToQuantum((unsigned char) ReadBlobByte(image)); } break; case 0x11: /* Start PS l1 */ if(Rec.RecordLength > 8) image=ExtractPostscript(image,image_info, TellBlob(image)+8, /* skip PS header in the wpg */ (ssize_t) Rec.RecordLength-8,exception); break; case 0x14: /* bitmap type 2 */ BitmapHeader2.RotAngle=ReadBlobLSBShort(image); BitmapHeader2.LowLeftX=ReadBlobLSBShort(image); BitmapHeader2.LowLeftY=ReadBlobLSBShort(image); BitmapHeader2.UpRightX=ReadBlobLSBShort(image); BitmapHeader2.UpRightY=ReadBlobLSBShort(image); BitmapHeader2.Width=ReadBlobLSBShort(image); BitmapHeader2.Height=ReadBlobLSBShort(image); if ((BitmapHeader2.Width == 0) || (BitmapHeader2.Height == 0)) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); BitmapHeader2.Depth=ReadBlobLSBShort(image); BitmapHeader2.HorzRes=ReadBlobLSBShort(image); BitmapHeader2.VertRes=ReadBlobLSBShort(image); image->units=PixelsPerCentimeterResolution; image->page.width=(unsigned int) ((BitmapHeader2.LowLeftX-BitmapHeader2.UpRightX)/470.0); image->page.height=(unsigned int) ((BitmapHeader2.LowLeftX-BitmapHeader2.UpRightY)/470.0); image->page.x=(int) (BitmapHeader2.LowLeftX/470.0); image->page.y=(int) (BitmapHeader2.LowLeftX/470.0); if(BitmapHeader2.HorzRes && BitmapHeader2.VertRes) { image->resolution.x=BitmapHeader2.HorzRes/470.0; image->resolution.y=BitmapHeader2.VertRes/470.0; } image->columns=BitmapHeader2.Width; image->rows=BitmapHeader2.Height; bpp=BitmapHeader2.Depth; UnpackRaster: status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) break; if ((image->colors == 0) && (bpp != 24)) { image->colors=one << bpp; if (!AcquireImageColormap(image,image->colors,exception)) { NoMemory: ThrowReaderException(ResourceLimitError, "MemoryAllocationFailed"); } /* printf("Load default colormap \n"); */ for (i=0; (i < (int) image->colors) && (i < 256); i++) { image->colormap[i].red=ScaleCharToQuantum(WPG1_Palette[i].Red); image->colormap[i].green=ScaleCharToQuantum(WPG1_Palette[i].Green); image->colormap[i].blue=ScaleCharToQuantum(WPG1_Palette[i].Blue); } } else { if (bpp < 24) if ( (image->colors < (one << bpp)) && (bpp != 24) ) image->colormap=(PixelInfo *) ResizeQuantumMemory( image->colormap,(size_t) (one << bpp), sizeof(*image->colormap)); } if (bpp == 1) { if(image->colormap[0].red==0 && image->colormap[0].green==0 && image->colormap[0].blue==0 && image->colormap[1].red==0 && image->colormap[1].green==0 && image->colormap[1].blue==0) { /* fix crippled monochrome palette */ image->colormap[1].red = image->colormap[1].green = image->colormap[1].blue = QuantumRange; } } if(UnpackWPGRaster(image,bpp,exception) < 0) /* The raster cannot be unpacked */ { DecompressionFailed: ThrowReaderException(CoderError,"UnableToDecompressImage"); } if(Rec.RecType==0x14 && BitmapHeader2.RotAngle!=0 && !image_info->ping) { /* flop command */ if(BitmapHeader2.RotAngle & 0x8000) { Image *flop_image; flop_image = FlopImage(image, exception); if (flop_image != (Image *) NULL) { DuplicateBlob(flop_image,image); ReplaceImageInList(&image,flop_image); } } /* flip command */ if(BitmapHeader2.RotAngle & 0x2000) { Image *flip_image; flip_image = FlipImage(image, exception); if (flip_image != (Image *) NULL) { DuplicateBlob(flip_image,image); ReplaceImageInList(&image,flip_image); } } /* rotate command */ if(BitmapHeader2.RotAngle & 0x0FFF) { Image *rotate_image; rotate_image=RotateImage(image,(BitmapHeader2.RotAngle & 0x0FFF), exception); if (rotate_image != (Image *) NULL) { DuplicateBlob(rotate_image,image); ReplaceImageInList(&image,rotate_image); } } } /* Allocate next image structure. */ AcquireNextImage(image_info,image,exception); image->depth=8; if (image->next == (Image *) NULL) goto Finish; image=SyncNextImageInList(image); image->columns=image->rows=1; image->colors=0; break; case 0x1B: /* Postscript l2 */ if(Rec.RecordLength>0x3C) image=ExtractPostscript(image,image_info, TellBlob(image)+0x3C, /* skip PS l2 header in the wpg */ (ssize_t) Rec.RecordLength-0x3C,exception); break; } } break; case 2: /* WPG level 2 */ (void) memset(CTM,0,sizeof(CTM)); StartWPG.PosSizePrecision = 0; while(!EOFBlob(image)) /* object parser loop */ { (void) SeekBlob(image,Header.DataOffset,SEEK_SET); if(EOFBlob(image)) break; Rec2.Class=(i=ReadBlobByte(image)); if(i==EOF) break; Rec2.RecType=(i=ReadBlobByte(image)); if(i==EOF) break; Rd_WP_DWORD(image,&Rec2.Extension); Rd_WP_DWORD(image,&Rec2.RecordLength); if(EOFBlob(image)) break; Header.DataOffset=TellBlob(image)+Rec2.RecordLength; switch(Rec2.RecType) { case 1: StartWPG.HorizontalUnits=ReadBlobLSBShort(image); StartWPG.VerticalUnits=ReadBlobLSBShort(image); StartWPG.PosSizePrecision=ReadBlobByte(image); break; case 0x0C: /* Color palette */ WPG_Palette.StartIndex=ReadBlobLSBShort(image); WPG_Palette.NumOfEntries=ReadBlobLSBShort(image); if ((WPG_Palette.NumOfEntries-WPG_Palette.StartIndex) > (Rec2.RecordLength-2-2) / 3) ThrowReaderException(CorruptImageError,"InvalidColormapIndex"); image->colors=WPG_Palette.NumOfEntries; if (AcquireImageColormap(image,image->colors,exception) == MagickFalse) ThrowReaderException(ResourceLimitError, "MemoryAllocationFailed"); for (i=WPG_Palette.StartIndex; i < (int)WPG_Palette.NumOfEntries; i++) { image->colormap[i].red=ScaleCharToQuantum((char) ReadBlobByte(image)); image->colormap[i].green=ScaleCharToQuantum((char) ReadBlobByte(image)); image->colormap[i].blue=ScaleCharToQuantum((char) ReadBlobByte(image)); (void) ReadBlobByte(image); /*Opacity??*/ } break; case 0x0E: Bitmap2Header1.Width=ReadBlobLSBShort(image); Bitmap2Header1.Height=ReadBlobLSBShort(image); if ((Bitmap2Header1.Width == 0) || (Bitmap2Header1.Height == 0)) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); Bitmap2Header1.Depth=ReadBlobByte(image); Bitmap2Header1.Compression=ReadBlobByte(image); if(Bitmap2Header1.Compression > 1) continue; /*Unknown compression method */ switch(Bitmap2Header1.Depth) { case 1: bpp=1; break; case 2: bpp=2; break; case 3: bpp=4; break; case 4: bpp=8; break; case 8: bpp=24; break; default: continue; /*Ignore raster with unknown depth*/ } image->columns=Bitmap2Header1.Width; image->rows=Bitmap2Header1.Height; status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) break; if ((image->colors == 0) && (bpp != 24)) { image->colors=one << bpp; if (!AcquireImageColormap(image,image->colors,exception)) goto NoMemory; } else { if(bpp < 24) if( image->colors<(one << bpp) && bpp!=24 ) image->colormap=(PixelInfo *) ResizeQuantumMemory( image->colormap,(size_t) (one << bpp), sizeof(*image->colormap)); } switch(Bitmap2Header1.Compression) { case 0: /*Uncompressed raster*/ { ldblk=(ssize_t) ((bpp*image->columns+7)/8); BImgBuff=(unsigned char *) AcquireQuantumMemory((size_t) ldblk+1,sizeof(*BImgBuff)); if (BImgBuff == (unsigned char *) NULL) goto NoMemory; for(i=0; i< (ssize_t) image->rows; i++) { (void) ReadBlob(image,ldblk,BImgBuff); InsertRow(image,BImgBuff,i,bpp,exception); } if(BImgBuff) BImgBuff=(unsigned char *) RelinquishMagickMemory(BImgBuff); break; } case 1: /*RLE for WPG2 */ { if( UnpackWPG2Raster(image,bpp,exception) < 0) goto DecompressionFailed; break; } } if(CTM[0][0]<0 && !image_info->ping) { /*?? RotAngle=360-RotAngle;*/ Image *flop_image; flop_image = FlopImage(image, exception); if (flop_image != (Image *) NULL) { DuplicateBlob(flop_image,image); ReplaceImageInList(&image,flop_image); } /* Try to change CTM according to Flip - I am not sure, must be checked. Tx(0,0)=-1; Tx(1,0)=0; Tx(2,0)=0; Tx(0,1)= 0; Tx(1,1)=1; Tx(2,1)=0; Tx(0,2)=(WPG._2Rect.X_ur+WPG._2Rect.X_ll); Tx(1,2)=0; Tx(2,2)=1; */ } if(CTM[1][1]<0 && !image_info->ping) { /*?? RotAngle=360-RotAngle;*/ Image *flip_image; flip_image = FlipImage(image, exception); if (flip_image != (Image *) NULL) { DuplicateBlob(flip_image,image); ReplaceImageInList(&image,flip_image); } /* Try to change CTM according to Flip - I am not sure, must be checked. float_matrix Tx(3,3); Tx(0,0)= 1; Tx(1,0)= 0; Tx(2,0)=0; Tx(0,1)= 0; Tx(1,1)=-1; Tx(2,1)=0; Tx(0,2)= 0; Tx(1,2)=(WPG._2Rect.Y_ur+WPG._2Rect.Y_ll); Tx(2,2)=1; */ } /* Allocate next image structure. */ AcquireNextImage(image_info,image,exception); image->depth=8; if (image->next == (Image *) NULL) goto Finish; image=SyncNextImageInList(image); image->columns=image->rows=1; image->colors=0; break; case 0x12: /* Postscript WPG2*/ i=ReadBlobLSBShort(image); if(Rec2.RecordLength > (unsigned int) i) image=ExtractPostscript(image,image_info, TellBlob(image)+i, /*skip PS header in the wpg2*/ (ssize_t) (Rec2.RecordLength-i-2),exception); break; case 0x1B: /*bitmap rectangle*/ WPG2Flags = LoadWPG2Flags(image,StartWPG.PosSizePrecision,NULL,&CTM); (void) WPG2Flags; break; } } break; default: { ThrowReaderException(CoderError,"DataEncodingSchemeIsNotSupported"); } } Finish: (void) CloseBlob(image); { Image *p; ssize_t scene=0; /* Rewind list, removing any empty images while rewinding. */ p=image; image=NULL; while (p != (Image *) NULL) { Image *tmp=p; if ((p->rows == 0) || (p->columns == 0)) { p=p->previous; DeleteImageFromList(&tmp); } else { image=p; p=p->previous; } } /* Fix scene numbers. */ for (p=image; p != (Image *) NULL; p=p->next) p->scene=(size_t) scene++; } if (image == (Image *) NULL) ThrowReaderException(CorruptImageError, "ImageFileDoesNotContainAnyImageData"); return(image); }
1
352,976
int slap_has64( int onoff ) { if ( onoff < 0 ) return 0; else return onoff ? -1 : 0; }
0
512,518
void cmp_item_row::store_value(Item *item) { DBUG_ENTER("cmp_item_row::store_value"); DBUG_ASSERT(comparators); DBUG_ASSERT(n == item->cols()); item->bring_value(); item->null_value= 0; for (uint i=0; i < n; i++) { DBUG_ASSERT(comparators[i]); comparators[i]->store_value(item->element_index(i)); item->null_value|= item->element_index(i)->null_value; } DBUG_VOID_RETURN; }
0
372,868
static void irda_getvalue_confirm(int result, __u16 obj_id, struct ias_value *value, void *priv) { struct irda_sock *self; self = (struct irda_sock *) priv; if (!self) { IRDA_WARNING("%s: lost myself!\n", __func__); return; } IRDA_DEBUG(2, "%s(%p)\n", __func__, self); /* We probably don't need to make any more queries */ iriap_close(self->iriap); self->iriap = NULL; /* Check if request succeeded */ if (result != IAS_SUCCESS) { IRDA_DEBUG(1, "%s(), IAS query failed! (%d)\n", __func__, result); self->errno = result; /* We really need it later */ /* Wake up any processes waiting for result */ wake_up_interruptible(&self->query_wait); return; } /* Pass the object to the caller (so the caller must delete it) */ self->ias_result = value; self->errno = 0; /* Wake up any processes waiting for result */ wake_up_interruptible(&self->query_wait); }
0
386,568
void DL_Dxf::writeAttribute(DL_WriterA& dw, const DL_AttributeData& data, const DL_Attributes& attrib) { dw.entity("ATTRIB"); if (version==DL_VERSION_2000) { dw.dxfString(100, "AcDbEntity"); } dw.entityAttributes(attrib); if (version==DL_VERSION_2000) { dw.dxfString(100, "AcDbText"); } dw.dxfReal(10, data.ipx); dw.dxfReal(20, data.ipy); dw.dxfReal(30, data.ipz); dw.dxfReal(40, data.height); dw.dxfString(1, data.text); dw.dxfReal(50, data.angle/(2*M_PI)*360.0); dw.dxfReal(41, data.xScaleFactor); dw.dxfString(7, data.style); dw.dxfInt(71, data.textGenerationFlags); dw.dxfInt(72, data.hJustification); dw.dxfReal(11, data.apx); dw.dxfReal(21, data.apy); dw.dxfReal(31, data.apz); if (version==DL_VERSION_2000) { dw.dxfString(100, "AcDbAttribute"); } dw.dxfString(2, data.tag); dw.dxfInt(74, data.vJustification); }
0
381,861
int udf_setsize(struct inode *inode, loff_t newsize) { int err; struct udf_inode_info *iinfo; unsigned int bsize = i_blocksize(inode); if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))) return -EINVAL; if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) return -EPERM; iinfo = UDF_I(inode); if (newsize > inode->i_size) { down_write(&iinfo->i_data_sem); if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { if (bsize < (udf_file_entry_alloc_offset(inode) + newsize)) { err = udf_expand_file_adinicb(inode); if (err) return err; down_write(&iinfo->i_data_sem); } else { iinfo->i_lenAlloc = newsize; goto set_size; } } err = udf_extend_file(inode, newsize); if (err) { up_write(&iinfo->i_data_sem); return err; } set_size: up_write(&iinfo->i_data_sem); truncate_setsize(inode, newsize); } else { if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { down_write(&iinfo->i_data_sem); udf_clear_extent_cache(inode); memset(iinfo->i_data + iinfo->i_lenEAttr + newsize, 0x00, bsize - newsize - udf_file_entry_alloc_offset(inode)); iinfo->i_lenAlloc = newsize; truncate_setsize(inode, newsize); up_write(&iinfo->i_data_sem); goto update_time; } err = block_truncate_page(inode->i_mapping, newsize, udf_get_block); if (err) return err; truncate_setsize(inode, newsize); down_write(&iinfo->i_data_sem); udf_clear_extent_cache(inode); err = udf_truncate_extents(inode); up_write(&iinfo->i_data_sem); if (err) return err; } update_time: inode->i_mtime = inode->i_ctime = current_time(inode); if (IS_SYNC(inode)) udf_sync_inode(inode); else mark_inode_dirty(inode); return 0; }
0
238,313
static int digest_update_from_fd(struct digest *d, int fd, loff_t start, loff_t size) { unsigned char *buf = xmalloc(PAGE_SIZE); int ret = 0; if (lseek(fd, start, SEEK_SET) != start) { perror("lseek"); ret = -errno; goto out_free; } while (size) { unsigned long now = min_t(typeof(size), PAGE_SIZE, size); ret = read(fd, buf, now); if (ret < 0) { perror("read"); goto out_free; } if (!ret) break; ret = digest_update_interruptible(d, buf, ret); if (ret) goto out_free; size -= now; } out_free: free(buf); return ret; }
0
247,750
void disconnect() { EXPECT_CALL(client_callbacks_, onEvent(Network::ConnectionEvent::LocalClose)); EXPECT_CALL(server_callbacks_, onEvent(Network::ConnectionEvent::RemoteClose)) .WillOnce(Invoke([&](Network::ConnectionEvent) -> void { dispatcher_->exit(); })); client_connection_->close(Network::ConnectionCloseType::NoFlush); dispatcher_->run(Event::Dispatcher::RunType::Block); }
0
229,330
Status EagerExecute(EagerOperation* op, TensorHandle** retvals, int* num_retvals) { profiler::TraceMe activity([&] { return ::tensorflow::profiler::TraceMeEncode( "EagerExecute", {{"eager_op", op->Name()}, {"is_func", op->is_function()}}); }); if (!op->Executor().Async()) { VLOG(6) << "op: " << op->Name() << " is not Async."; if (!op->EagerContext() .GetGlobalRendezvousForFunctionLocalRendezvousStatus() .ok()) { VLOG(6) << "global_rendezvous_for_functions_ is in bad state. Resetting."; op->EagerContext().ResetGlobalRendezvousForFunction(); } // In sync mode, always clear error to maintain the same behavior as before. // TODO(b/141004939): Remove this. op->Executor().ClearError(); } std::unique_ptr<tensorflow::EagerOperation> out_op; TF_RETURN_IF_ERROR(EagerOpRewriteRegistry::Global()->RunRewrite( EagerOpRewriteRegistry::PRE_EXECUTION, op, &out_op)); if (op->IsLocal()) { if (out_op) { op = out_op.get(); } TF_RETURN_IF_ERROR(MaybePackInputTensor(op)); return EagerLocalExecute(op, retvals, num_retvals); } #if defined(IS_MOBILE_PLATFORM) return errors::Unimplemented( "Eager's remote execution is not available on mobile devices."); #else // !IS_MOBILE_PLATFORM if (out_op) { op = out_op.get(); } return EagerRemoteExecute(op, retvals, num_retvals); #endif // !IS_MOBILE_PLATFORM }
0
446,060
TIFFInitLZW(TIFF* tif, int scheme) { static const char module[] = "TIFFInitLZW"; assert(scheme == COMPRESSION_LZW); /* * Allocate state block so tag methods have storage to record values. */ tif->tif_data = (uint8*) _TIFFmalloc(sizeof (LZWCodecState)); if (tif->tif_data == NULL) goto bad; DecoderState(tif)->dec_codetab = NULL; DecoderState(tif)->dec_decode = NULL; EncoderState(tif)->enc_hashtab = NULL; LZWState(tif)->rw_mode = tif->tif_mode; /* * Install codec methods. */ tif->tif_fixuptags = LZWFixupTags; tif->tif_setupdecode = LZWSetupDecode; tif->tif_predecode = LZWPreDecode; tif->tif_decoderow = LZWDecode; tif->tif_decodestrip = LZWDecode; tif->tif_decodetile = LZWDecode; tif->tif_setupencode = LZWSetupEncode; tif->tif_preencode = LZWPreEncode; tif->tif_postencode = LZWPostEncode; tif->tif_encoderow = LZWEncode; tif->tif_encodestrip = LZWEncode; tif->tif_encodetile = LZWEncode; tif->tif_cleanup = LZWCleanup; /* * Setup predictor setup. */ (void) TIFFPredictorInit(tif); return (1); bad: TIFFErrorExt(tif->tif_clientdata, module, "No space for LZW state block"); return (0); }
0
513,024
Item_cache_time(THD *thd) :Item_cache_temporal(thd, &type_handler_time2) { }
0
226,083
GF_Err npck_box_size(GF_Box *s) { s->size += 4; return GF_OK; }
0
337,380
open_buffer( int read_stdin, // read file from stdin exarg_T *eap, // for forced 'ff' and 'fenc' or NULL int flags) // extra flags for readfile() { int retval = OK; bufref_T old_curbuf; #ifdef FEAT_SYN_HL long old_tw = curbuf->b_p_tw; #endif int read_fifo = FALSE; // The 'readonly' flag is only set when BF_NEVERLOADED is being reset. // When re-entering the same buffer, it should not change, because the // user may have reset the flag by hand. if (readonlymode && curbuf->b_ffname != NULL && (curbuf->b_flags & BF_NEVERLOADED)) curbuf->b_p_ro = TRUE; if (ml_open(curbuf) == FAIL) { // There MUST be a memfile, otherwise we can't do anything // If we can't create one for the current buffer, take another buffer close_buffer(NULL, curbuf, 0, FALSE, FALSE); FOR_ALL_BUFFERS(curbuf) if (curbuf->b_ml.ml_mfp != NULL) break; // If there is no memfile at all, exit. // This is OK, since there are no changes to lose. if (curbuf == NULL) { emsg(_(e_cannot_allocate_any_buffer_exiting)); // Don't try to do any saving, with "curbuf" NULL almost nothing // will work. v_dying = 2; getout(2); } emsg(_(e_cannot_allocate_buffer_using_other_one)); enter_buffer(curbuf); #ifdef FEAT_SYN_HL if (old_tw != curbuf->b_p_tw) check_colorcolumn(curwin); #endif return FAIL; } // The autocommands in readfile() may change the buffer, but only AFTER // reading the file. set_bufref(&old_curbuf, curbuf); modified_was_set = FALSE; // mark cursor position as being invalid curwin->w_valid = 0; if (curbuf->b_ffname != NULL #ifdef FEAT_NETBEANS_INTG && netbeansReadFile #endif ) { int old_msg_silent = msg_silent; #ifdef UNIX int save_bin = curbuf->b_p_bin; int perm; #endif #ifdef FEAT_NETBEANS_INTG int oldFire = netbeansFireChanges; netbeansFireChanges = 0; #endif #ifdef UNIX perm = mch_getperm(curbuf->b_ffname); if (perm >= 0 && (S_ISFIFO(perm) || S_ISSOCK(perm) # ifdef OPEN_CHR_FILES || (S_ISCHR(perm) && is_dev_fd_file(curbuf->b_ffname)) # endif )) read_fifo = TRUE; if (read_fifo) curbuf->b_p_bin = TRUE; #endif if (shortmess(SHM_FILEINFO)) msg_silent = 1; retval = readfile(curbuf->b_ffname, curbuf->b_fname, (linenr_T)0, (linenr_T)0, (linenr_T)MAXLNUM, eap, flags | READ_NEW | (read_fifo ? READ_FIFO : 0)); #ifdef UNIX if (read_fifo) { curbuf->b_p_bin = save_bin; if (retval == OK) retval = read_buffer(FALSE, eap, flags); } #endif msg_silent = old_msg_silent; #ifdef FEAT_NETBEANS_INTG netbeansFireChanges = oldFire; #endif // Help buffer is filtered. if (bt_help(curbuf)) fix_help_buffer(); } else if (read_stdin) { int save_bin = curbuf->b_p_bin; // First read the text in binary mode into the buffer. // Then read from that same buffer and append at the end. This makes // it possible to retry when 'fileformat' or 'fileencoding' was // guessed wrong. curbuf->b_p_bin = TRUE; retval = readfile(NULL, NULL, (linenr_T)0, (linenr_T)0, (linenr_T)MAXLNUM, NULL, flags | (READ_NEW + READ_STDIN)); curbuf->b_p_bin = save_bin; if (retval == OK) retval = read_buffer(TRUE, eap, flags); } // if first time loading this buffer, init b_chartab[] if (curbuf->b_flags & BF_NEVERLOADED) { (void)buf_init_chartab(curbuf, FALSE); #ifdef FEAT_CINDENT parse_cino(curbuf); #endif } // Set/reset the Changed flag first, autocmds may change the buffer. // Apply the automatic commands, before processing the modelines. // So the modelines have priority over autocommands. // // When reading stdin, the buffer contents always needs writing, so set // the changed flag. Unless in readonly mode: "ls | gview -". // When interrupted and 'cpoptions' contains 'i' set changed flag. if ((got_int && vim_strchr(p_cpo, CPO_INTMOD) != NULL) || modified_was_set // ":set modified" used in autocmd #ifdef FEAT_EVAL || (aborting() && vim_strchr(p_cpo, CPO_INTMOD) != NULL) #endif ) changed(); else if (retval == OK && !read_stdin && !read_fifo) unchanged(curbuf, FALSE, TRUE); save_file_ff(curbuf); // keep this fileformat // Set last_changedtick to avoid triggering a TextChanged autocommand right // after it was added. curbuf->b_last_changedtick = CHANGEDTICK(curbuf); curbuf->b_last_changedtick_i = CHANGEDTICK(curbuf); curbuf->b_last_changedtick_pum = CHANGEDTICK(curbuf); // require "!" to overwrite the file, because it wasn't read completely #ifdef FEAT_EVAL if (aborting()) #else if (got_int) #endif curbuf->b_flags |= BF_READERR; #ifdef FEAT_FOLDING // Need to update automatic folding. Do this before the autocommands, // they may use the fold info. foldUpdateAll(curwin); #endif // need to set w_topline, unless some autocommand already did that. if (!(curwin->w_valid & VALID_TOPLINE)) { curwin->w_topline = 1; #ifdef FEAT_DIFF curwin->w_topfill = 0; #endif } #ifdef FEAT_EVAL apply_autocmds_retval(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf, &retval); #else apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf); #endif if (retval == OK) { // The autocommands may have changed the current buffer. Apply the // modelines to the correct buffer, if it still exists and is loaded. if (bufref_valid(&old_curbuf) && old_curbuf.br_buf->b_ml.ml_mfp != NULL) { aco_save_T aco; // Go to the buffer that was opened. aucmd_prepbuf(&aco, old_curbuf.br_buf); do_modelines(0); curbuf->b_flags &= ~(BF_CHECK_RO | BF_NEVERLOADED); if ((flags & READ_NOWINENTER) == 0) #ifdef FEAT_EVAL apply_autocmds_retval(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf, &retval); #else apply_autocmds(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf); #endif // restore curwin/curbuf and a few other things aucmd_restbuf(&aco); } } return retval; }
0
400,737
size_t iov_iter_single_seg_count(const struct iov_iter *i) { if (i->nr_segs > 1) { if (likely(iter_is_iovec(i) || iov_iter_is_kvec(i))) return min(i->count, i->iov->iov_len - i->iov_offset); if (iov_iter_is_bvec(i)) return min(i->count, i->bvec->bv_len - i->iov_offset); } return i->count; }
0
409,520
term_windgoto(int row, int col) { OUT_STR(tgoto((char *)T_CM, col, row)); }
0
197,748
Status TransposeShapeFn(InferenceContext* c) { ShapeHandle input = c->input(0); ShapeHandle perm_shape = c->input(1); const Tensor* perm = c->input_tensor(1); DimensionHandle perm_elems = c->NumElements(perm_shape); // If we don't have rank information on the input or value information on // perm we can't return any shape information, otherwise we have enough // information to at least find the rank of the output. if (!c->RankKnown(input) && !c->ValueKnown(perm_elems) && perm == nullptr) { c->set_output(0, c->UnknownShape()); return Status::OK(); } // Find our value of the rank. int64_t rank; if (c->RankKnown(input)) { rank = c->Rank(input); } else if (c->ValueKnown(perm_elems)) { rank = c->Value(perm_elems); } else { rank = perm->NumElements(); } if (!c->RankKnown(input) && rank < 2) { // A permutation array containing a single element is ambiguous. It could // indicate either a scalar or a 1-dimensional array, both of which the // transpose op returns unchanged. c->set_output(0, input); return Status::OK(); } std::vector<DimensionHandle> dims; dims.resize(rank); TF_RETURN_IF_ERROR(c->WithRank(input, rank, &input)); // Ensure that perm is a vector and has rank elements. TF_RETURN_IF_ERROR(c->WithRank(perm_shape, 1, &perm_shape)); TF_RETURN_IF_ERROR(c->WithValue(perm_elems, rank, &perm_elems)); // If we know the rank of the input and the value of perm, we can return // all shape information, otherwise we can only return rank information, // but no information for the dimensions. if (perm != nullptr) { std::vector<int64_t> data; if (perm->dtype() == DT_INT32) { data = AsInt64<int32>(perm, rank); } else { data = AsInt64<int64_t>(perm, rank); } for (int32_t i = 0; i < rank; ++i) { int64_t in_idx = data[i]; if (in_idx >= rank) { return errors::InvalidArgument("perm dim ", in_idx, " is out of range of input rank ", rank); } dims[i] = c->Dim(input, in_idx); } } else { for (int i = 0; i < rank; ++i) { dims[i] = c->UnknownDim(); } } c->set_output(0, c->MakeShape(dims)); return Status::OK(); }
1
234,822
static void btrfs_close_one_device(struct btrfs_device *device) { struct btrfs_fs_devices *fs_devices = device->fs_devices; if (test_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state) && device->devid != BTRFS_DEV_REPLACE_DEVID) { list_del_init(&device->dev_alloc_list); fs_devices->rw_devices--; } if (test_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state)) fs_devices->missing_devices--; btrfs_close_bdev(device); if (device->bdev) { fs_devices->open_devices--; device->bdev = NULL; } clear_bit(BTRFS_DEV_STATE_WRITEABLE, &device->dev_state); btrfs_destroy_dev_zone_info(device); device->fs_info = NULL; atomic_set(&device->dev_stats_ccnt, 0); extent_io_tree_release(&device->alloc_state); /* Verify the device is back in a pristine state */ ASSERT(!test_bit(BTRFS_DEV_STATE_FLUSH_SENT, &device->dev_state)); ASSERT(!test_bit(BTRFS_DEV_STATE_REPLACE_TGT, &device->dev_state)); ASSERT(list_empty(&device->dev_alloc_list)); ASSERT(list_empty(&device->post_commit_list)); ASSERT(atomic_read(&device->reada_in_flight) == 0); }
0
310,182
immedhook(ENTRY * ep GCC_UNUSED) /* write out entries with no use capabilities immediately to save storage */ { #if !HAVE_BIG_CORE /* * This is strictly a core-economy kluge. The really clean way to handle * compilation is to slurp the whole file into core and then do all the * name-collision checks and entry writes in one swell foop. But the * terminfo master file is large enough that some core-poor systems swap * like crazy when you compile it this way...there have been reports of * this process taking *three hours*, rather than the twenty seconds or * less typical on my development box. * * So. This hook *immediately* writes out the referenced entry if it * has no use capabilities. The compiler main loop refrains from * adding the entry to the in-core list when this hook fires. If some * other entry later needs to reference an entry that got written * immediately, that's OK; the resolution code will fetch it off disk * when it can't find it in core. * * Name collisions will still be detected, just not as cleanly. The * write_entry() code complains before overwriting an entry that * postdates the time of tic's first call to write_entry(). Thus * it will complain about overwriting entries newly made during the * tic run, but not about overwriting ones that predate it. * * The reason this is a hook, and not in line with the rest of the * compiler code, is that the support for termcap fallback cannot assume * it has anywhere to spool out these entries! * * The _nc_set_type() call here requires a compensating one in * _nc_parse_entry(). * * If you define HAVE_BIG_CORE, you'll disable this kluge. This will * make tic a bit faster (because the resolution code won't have to do * disk I/O nearly as often). */ if (ep->nuses == 0) { int oldline = _nc_curr_line; write_it(ep); _nc_curr_line = oldline; free(ep->tterm.str_table); return (TRUE); } #endif /* HAVE_BIG_CORE */ return (FALSE); }
0
229,254
void cql_server::response::write_string_list(std::vector<sstring> string_list) { write_short(cast_if_fits<uint16_t>(string_list.size())); for (auto&& s : string_list) { write_string(s); } }
0
489,148
sctp_disposition_t sctp_sf_sendbeat_8_3(const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands) { struct sctp_transport *transport = (struct sctp_transport *) arg; if (asoc->overall_error_count > asoc->max_retrans) { sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, SCTP_ERROR(ETIMEDOUT)); /* CMD_ASSOC_FAILED calls CMD_DELETE_TCB. */ sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, SCTP_PERR(SCTP_ERROR_NO_ERROR)); SCTP_INC_STATS(SCTP_MIB_ABORTEDS); SCTP_DEC_STATS(SCTP_MIB_CURRESTAB); return SCTP_DISPOSITION_DELETE_TCB; } /* Section 3.3.5. * The Sender-specific Heartbeat Info field should normally include * information about the sender's current time when this HEARTBEAT * chunk is sent and the destination transport address to which this * HEARTBEAT is sent (see Section 8.3). */ if (transport->param_flags & SPP_HB_ENABLE) { if (SCTP_DISPOSITION_NOMEM == sctp_sf_heartbeat(ep, asoc, type, arg, commands)) return SCTP_DISPOSITION_NOMEM; /* Set transport error counter and association error counter * when sending heartbeat. */ sctp_add_cmd_sf(commands, SCTP_CMD_TRANSPORT_RESET, SCTP_TRANSPORT(transport)); } sctp_add_cmd_sf(commands, SCTP_CMD_HB_TIMER_UPDATE, SCTP_TRANSPORT(transport)); return SCTP_DISPOSITION_CONSUME; }
0
476,137
static int bos_desc(struct usb_composite_dev *cdev) { struct usb_ext_cap_descriptor *usb_ext; struct usb_dcd_config_params dcd_config_params; struct usb_bos_descriptor *bos = cdev->req->buf; unsigned int besl = 0; bos->bLength = USB_DT_BOS_SIZE; bos->bDescriptorType = USB_DT_BOS; bos->wTotalLength = cpu_to_le16(USB_DT_BOS_SIZE); bos->bNumDeviceCaps = 0; /* Get Controller configuration */ if (cdev->gadget->ops->get_config_params) { cdev->gadget->ops->get_config_params(cdev->gadget, &dcd_config_params); } else { dcd_config_params.besl_baseline = USB_DEFAULT_BESL_UNSPECIFIED; dcd_config_params.besl_deep = USB_DEFAULT_BESL_UNSPECIFIED; dcd_config_params.bU1devExitLat = USB_DEFAULT_U1_DEV_EXIT_LAT; dcd_config_params.bU2DevExitLat = cpu_to_le16(USB_DEFAULT_U2_DEV_EXIT_LAT); } if (dcd_config_params.besl_baseline != USB_DEFAULT_BESL_UNSPECIFIED) besl = USB_BESL_BASELINE_VALID | USB_SET_BESL_BASELINE(dcd_config_params.besl_baseline); if (dcd_config_params.besl_deep != USB_DEFAULT_BESL_UNSPECIFIED) besl |= USB_BESL_DEEP_VALID | USB_SET_BESL_DEEP(dcd_config_params.besl_deep); /* * A SuperSpeed device shall include the USB2.0 extension descriptor * and shall support LPM when operating in USB2.0 HS mode. */ usb_ext = cdev->req->buf + le16_to_cpu(bos->wTotalLength); bos->bNumDeviceCaps++; le16_add_cpu(&bos->wTotalLength, USB_DT_USB_EXT_CAP_SIZE); usb_ext->bLength = USB_DT_USB_EXT_CAP_SIZE; usb_ext->bDescriptorType = USB_DT_DEVICE_CAPABILITY; usb_ext->bDevCapabilityType = USB_CAP_TYPE_EXT; usb_ext->bmAttributes = cpu_to_le32(USB_LPM_SUPPORT | USB_BESL_SUPPORT | besl); /* * The Superspeed USB Capability descriptor shall be implemented by all * SuperSpeed devices. */ if (gadget_is_superspeed(cdev->gadget)) { struct usb_ss_cap_descriptor *ss_cap; ss_cap = cdev->req->buf + le16_to_cpu(bos->wTotalLength); bos->bNumDeviceCaps++; le16_add_cpu(&bos->wTotalLength, USB_DT_USB_SS_CAP_SIZE); ss_cap->bLength = USB_DT_USB_SS_CAP_SIZE; ss_cap->bDescriptorType = USB_DT_DEVICE_CAPABILITY; ss_cap->bDevCapabilityType = USB_SS_CAP_TYPE; ss_cap->bmAttributes = 0; /* LTM is not supported yet */ ss_cap->wSpeedSupported = cpu_to_le16(USB_LOW_SPEED_OPERATION | USB_FULL_SPEED_OPERATION | USB_HIGH_SPEED_OPERATION | USB_5GBPS_OPERATION); ss_cap->bFunctionalitySupport = USB_LOW_SPEED_OPERATION; ss_cap->bU1devExitLat = dcd_config_params.bU1devExitLat; ss_cap->bU2DevExitLat = dcd_config_params.bU2DevExitLat; } /* The SuperSpeedPlus USB Device Capability descriptor */ if (gadget_is_superspeed_plus(cdev->gadget)) { struct usb_ssp_cap_descriptor *ssp_cap; u8 ssac = 1; u8 ssic; int i; if (cdev->gadget->max_ssp_rate == USB_SSP_GEN_2x2) ssac = 3; /* * Paired RX and TX sublink speed attributes share * the same SSID. */ ssic = (ssac + 1) / 2 - 1; ssp_cap = cdev->req->buf + le16_to_cpu(bos->wTotalLength); bos->bNumDeviceCaps++; le16_add_cpu(&bos->wTotalLength, USB_DT_USB_SSP_CAP_SIZE(ssac)); ssp_cap->bLength = USB_DT_USB_SSP_CAP_SIZE(ssac); ssp_cap->bDescriptorType = USB_DT_DEVICE_CAPABILITY; ssp_cap->bDevCapabilityType = USB_SSP_CAP_TYPE; ssp_cap->bReserved = 0; ssp_cap->wReserved = 0; ssp_cap->bmAttributes = cpu_to_le32(FIELD_PREP(USB_SSP_SUBLINK_SPEED_ATTRIBS, ssac) | FIELD_PREP(USB_SSP_SUBLINK_SPEED_IDS, ssic)); ssp_cap->wFunctionalitySupport = cpu_to_le16(FIELD_PREP(USB_SSP_MIN_SUBLINK_SPEED_ATTRIBUTE_ID, 0) | FIELD_PREP(USB_SSP_MIN_RX_LANE_COUNT, 1) | FIELD_PREP(USB_SSP_MIN_TX_LANE_COUNT, 1)); /* * Use 1 SSID if the gadget supports up to gen2x1 or not * specified: * - SSID 0 for symmetric RX/TX sublink speed of 10 Gbps. * * Use 1 SSID if the gadget supports up to gen1x2: * - SSID 0 for symmetric RX/TX sublink speed of 5 Gbps. * * Use 2 SSIDs if the gadget supports up to gen2x2: * - SSID 0 for symmetric RX/TX sublink speed of 5 Gbps. * - SSID 1 for symmetric RX/TX sublink speed of 10 Gbps. */ for (i = 0; i < ssac + 1; i++) { u8 ssid; u8 mantissa; u8 type; ssid = i >> 1; if (cdev->gadget->max_ssp_rate == USB_SSP_GEN_2x1 || cdev->gadget->max_ssp_rate == USB_SSP_GEN_UNKNOWN) mantissa = 10; else mantissa = 5 << ssid; if (i % 2) type = USB_SSP_SUBLINK_SPEED_ST_SYM_TX; else type = USB_SSP_SUBLINK_SPEED_ST_SYM_RX; ssp_cap->bmSublinkSpeedAttr[i] = cpu_to_le32(FIELD_PREP(USB_SSP_SUBLINK_SPEED_SSID, ssid) | FIELD_PREP(USB_SSP_SUBLINK_SPEED_LSE, USB_SSP_SUBLINK_SPEED_LSE_GBPS) | FIELD_PREP(USB_SSP_SUBLINK_SPEED_ST, type) | FIELD_PREP(USB_SSP_SUBLINK_SPEED_LP, USB_SSP_SUBLINK_SPEED_LP_SSP) | FIELD_PREP(USB_SSP_SUBLINK_SPEED_LSM, mantissa)); } } return le16_to_cpu(bos->wTotalLength); }
0
366,312
static struct mnt_namespace *alloc_mnt_ns(struct user_namespace *user_ns, bool anon) { struct mnt_namespace *new_ns; struct ucounts *ucounts; int ret; ucounts = inc_mnt_namespaces(user_ns); if (!ucounts) return ERR_PTR(-ENOSPC); new_ns = kzalloc(sizeof(struct mnt_namespace), GFP_KERNEL); if (!new_ns) { dec_mnt_namespaces(ucounts); return ERR_PTR(-ENOMEM); } if (!anon) { ret = ns_alloc_inum(&new_ns->ns); if (ret) { kfree(new_ns); dec_mnt_namespaces(ucounts); return ERR_PTR(ret); } } new_ns->ns.ops = &mntns_operations; if (!anon) new_ns->seq = atomic64_add_return(1, &mnt_ns_seq); refcount_set(&new_ns->ns.count, 1); INIT_LIST_HEAD(&new_ns->list); init_waitqueue_head(&new_ns->poll); spin_lock_init(&new_ns->ns_lock); new_ns->user_ns = get_user_ns(user_ns); new_ns->ucounts = ucounts; return new_ns; }
0
254,738
njs_typed_array_get_u8(const void *a) { return *(const uint8_t *) a; }
0
473,902
st_numhash(st_data_t n) { return (st_index_t)n; }
0
344,231
void luaV_finishOp (lua_State *L) { CallInfo *ci = L->ci; StkId base = ci->func + 1; Instruction inst = *(ci->u.l.savedpc - 1); /* interrupted instruction */ OpCode op = GET_OPCODE(inst); switch (op) { /* finish its execution */ case OP_MMBIN: case OP_MMBINI: case OP_MMBINK: { setobjs2s(L, base + GETARG_A(*(ci->u.l.savedpc - 2)), --L->top); break; } case OP_UNM: case OP_BNOT: case OP_LEN: case OP_GETTABUP: case OP_GETTABLE: case OP_GETI: case OP_GETFIELD: case OP_SELF: { setobjs2s(L, base + GETARG_A(inst), --L->top); break; } case OP_LT: case OP_LE: case OP_LTI: case OP_LEI: case OP_GTI: case OP_GEI: case OP_EQ: { /* note that 'OP_EQI'/'OP_EQK' cannot yield */ int res = !l_isfalse(s2v(L->top - 1)); L->top--; #if defined(LUA_COMPAT_LT_LE) if (ci->callstatus & CIST_LEQ) { /* "<=" using "<" instead? */ ci->callstatus ^= CIST_LEQ; /* clear mark */ res = !res; /* negate result */ } #endif lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_JMP); if (res != GETARG_k(inst)) /* condition failed? */ ci->u.l.savedpc++; /* skip jump instruction */ break; } case OP_CONCAT: { StkId top = L->top - 1; /* top when 'luaT_tryconcatTM' was called */ int a = GETARG_A(inst); /* first element to concatenate */ int total = cast_int(top - 1 - (base + a)); /* yet to concatenate */ setobjs2s(L, top - 2, top); /* put TM result in proper position */ L->top = top - 1; /* top is one after last element (at top-2) */ luaV_concat(L, total); /* concat them (may yield again) */ break; } case OP_CLOSE: { /* yielded closing variables */ ci->u.l.savedpc--; /* repeat instruction to close other vars. */ break; } case OP_RETURN: { /* yielded closing variables */ StkId ra = base + GETARG_A(inst); /* adjust top to signal correct number of returns, in case the return is "up to top" ('isIT') */ L->top = ra + ci->u2.nres; /* repeat instruction to close other vars. and complete the return */ ci->u.l.savedpc--; break; } default: { /* only these other opcodes can yield */ lua_assert(op == OP_TFORCALL || op == OP_CALL || op == OP_TAILCALL || op == OP_SETTABUP || op == OP_SETTABLE || op == OP_SETI || op == OP_SETFIELD); break; } } }
0
389,755
size_t get_default_max_mem_usage(void) { size_t total_mem_size = jas_get_total_mem_size(); size_t max_mem; if (total_mem_size) { max_mem = 0.90 * total_mem_size; } else { max_mem = JAS_DEFAULT_MAX_MEM_USAGE; } return max_mem; }
0
450,326
static void vnc_connect(VncDisplay *vd, QIOChannelSocket *sioc, bool skipauth, bool websocket) { VncState *vs = g_new0(VncState, 1); bool first_client = QTAILQ_EMPTY(&vd->clients); int i; trace_vnc_client_connect(vs, sioc); vs->zrle = g_new0(VncZrle, 1); vs->tight = g_new0(VncTight, 1); vs->magic = VNC_MAGIC; vs->sioc = sioc; object_ref(OBJECT(vs->sioc)); vs->ioc = QIO_CHANNEL(sioc); object_ref(OBJECT(vs->ioc)); vs->vd = vd; buffer_init(&vs->input, "vnc-input/%p", sioc); buffer_init(&vs->output, "vnc-output/%p", sioc); buffer_init(&vs->jobs_buffer, "vnc-jobs_buffer/%p", sioc); buffer_init(&vs->tight->tight, "vnc-tight/%p", sioc); buffer_init(&vs->tight->zlib, "vnc-tight-zlib/%p", sioc); buffer_init(&vs->tight->gradient, "vnc-tight-gradient/%p", sioc); #ifdef CONFIG_VNC_JPEG buffer_init(&vs->tight->jpeg, "vnc-tight-jpeg/%p", sioc); #endif #ifdef CONFIG_VNC_PNG buffer_init(&vs->tight->png, "vnc-tight-png/%p", sioc); #endif buffer_init(&vs->zlib.zlib, "vnc-zlib/%p", sioc); buffer_init(&vs->zrle->zrle, "vnc-zrle/%p", sioc); buffer_init(&vs->zrle->fb, "vnc-zrle-fb/%p", sioc); buffer_init(&vs->zrle->zlib, "vnc-zrle-zlib/%p", sioc); if (skipauth) { vs->auth = VNC_AUTH_NONE; vs->subauth = VNC_AUTH_INVALID; } else { if (websocket) { vs->auth = vd->ws_auth; vs->subauth = VNC_AUTH_INVALID; } else { vs->auth = vd->auth; vs->subauth = vd->subauth; } } VNC_DEBUG("Client sioc=%p ws=%d auth=%d subauth=%d\n", sioc, websocket, vs->auth, vs->subauth); vs->lossy_rect = g_malloc0(VNC_STAT_ROWS * sizeof (*vs->lossy_rect)); for (i = 0; i < VNC_STAT_ROWS; ++i) { vs->lossy_rect[i] = g_new0(uint8_t, VNC_STAT_COLS); } VNC_DEBUG("New client on socket %p\n", vs->sioc); update_displaychangelistener(&vd->dcl, VNC_REFRESH_INTERVAL_BASE); qio_channel_set_blocking(vs->ioc, false, NULL); if (vs->ioc_tag) { g_source_remove(vs->ioc_tag); } if (websocket) { vs->websocket = 1; if (vd->tlscreds) { vs->ioc_tag = qio_channel_add_watch( vs->ioc, G_IO_IN, vncws_tls_handshake_io, vs, NULL); } else { vs->ioc_tag = qio_channel_add_watch( vs->ioc, G_IO_IN, vncws_handshake_io, vs, NULL); } } else { vs->ioc_tag = qio_channel_add_watch( vs->ioc, G_IO_IN, vnc_client_io, vs, NULL); } vnc_client_cache_addr(vs); vnc_qmp_event(vs, QAPI_EVENT_VNC_CONNECTED); vnc_set_share_mode(vs, VNC_SHARE_MODE_CONNECTING); vs->last_x = -1; vs->last_y = -1; vs->as.freq = 44100; vs->as.nchannels = 2; vs->as.fmt = AUDIO_FORMAT_S16; vs->as.endianness = 0; qemu_mutex_init(&vs->output_mutex); vs->bh = qemu_bh_new(vnc_jobs_bh, vs); QTAILQ_INSERT_TAIL(&vd->clients, vs, next); if (first_client) { vnc_update_server_surface(vd); } graphic_hw_update(vd->dcl.con); if (!vs->websocket) { vnc_start_protocol(vs); } if (vd->num_connecting > vd->connections_limit) { QTAILQ_FOREACH(vs, &vd->clients, next) { if (vs->share_mode == VNC_SHARE_MODE_CONNECTING) { vnc_disconnect_start(vs); return; } } } }
0
513,108
longlong Item_func_between::val_int_cmp_datetime() { THD *thd= current_thd; longlong value= args[0]->val_datetime_packed(thd), a, b; if ((null_value= args[0]->null_value)) return 0; a= args[1]->val_datetime_packed(thd); b= args[2]->val_datetime_packed(thd); return val_int_cmp_int_finalize(value, a, b); }
0
437,720
static unsigned int rxclk_rx_s_carrier(struct cx23885_dev *dev, unsigned int freq, u16 *divider) { *divider = carrier_freq_to_clock_divider(freq); cx23888_ir_write4(dev, CX23888_IR_RXCLK_REG, *divider); return clock_divider_to_carrier_freq(*divider); }
0
437,671
static RCoreSymCacheElement *parseDragons(RBinFile *bf, RBuffer *buf, int off, int bits, R_OWN char *file_name) { D eprintf ("Dragons at 0x%x\n", off); st64 size = r_buf_size (buf); if (off >= size) { return NULL; } size -= off; if (!size) { return NULL; } if (size < 32) { return NULL; } ut8 *b = malloc (size); if (!b) { return NULL; } int available = r_buf_read_at (buf, off, b, size); if (available != size) { eprintf ("Warning: r_buf_read_at failed\n"); return NULL; } #if 0 // after the list of sections, there's a bunch of unknown // data, brobably dwords, and then the same section list again // this function aims to parse it. 0x00000138 |1a2b b2a1 0300 0000 1a2b b2a1 e055 0000| .+.......+...U.. n_segments ----. .--- how many sections ? 0x00000148 |0100 0000 ca55 0000 0400 0000 1800 0000| .....U.......... .---- how many symbols? 0xc7 0x00000158 |c700 0000 0000 0000 0000 0000 0104 0000| ................ 0x00000168 |250b e803 0000 0100 0000 0000 bd55 0000| %............U.. 0x00000178 |91bb e903 e35a b42c 93a4 340a 8746 9489| .....Z.,..4..F.. 0x00000188 |0cea 4c40 0c00 0000 0900 0000 0000 0000| ..L@............ 0x00000198 |0000 0000 0000 0000 0000 0000 0000 0000| ................ 0x000001a8 |0080 0000 0000 0000 5f5f 5445 5854 0000| ........__TEXT.. 0x000001b8 |0000 0000 0000 0000 0080 0000 0000 0000| ................ 0x000001c8 |0040 0000 0000 0000 5f5f 4441 5441 0000| .@......__DATA.. 0x000001d8 |0000 0000 0000 0000 00c0 0000 0000 0000| ................ 0x000001e8 |0000 0100 0000 0000 5f5f 4c4c 564d 0000| ........__LLVM.. 0x000001f8 |0000 0000 0000 0000 00c0 0100 0000 0000| ................ 0x00000208 |00c0 0000 0000 0000 5f5f 4c49 4e4b 4544| ........__LINKED 0x00000218 |4954 0000 0000 0000 0000 0000 d069 0000| IT...........i.. #endif // eprintf ("Dragon's magic:\n"); int magicCombo = 0; if (!memcmp ("\x1a\x2b\xb2\xa1", b, 4)) { // 0x130 ? magicCombo++; } if (!memcmp ("\x1a\x2b\xb2\xa1", b + 8, 4)) { magicCombo++; } if (magicCombo != 2) { // hack for C22F7494 available = r_buf_read_at (buf, off - 8, b, size); if (available != size) { eprintf ("Warning: r_buf_read_at failed\n"); return NULL; } if (!memcmp ("\x1a\x2b\xb2\xa1", b, 4)) { // 0x130 ? off -= 8; } else { eprintf ("0x%08x parsing error: invalid magic retry\n", off); } } D eprintf ("0x%08x magic OK\n", off); D { const int e0ss = r_read_le32 (b + 12); eprintf ("0x%08x eoss 0x%x\n", off + 12, e0ss); } free (b); return r_coresym_cache_element_new (bf, buf, off + 16, bits, file_name); }
0
391,638
static NTSTATUS fcb_or_dos_open(struct smb_request *req, connection_struct *conn, files_struct *fsp_to_dup_into, const struct smb_filename *smb_fname, struct file_id id, uint16 file_pid, uint64_t vuid, uint32 access_mask, uint32 share_access, uint32 create_options) { files_struct *fsp; DEBUG(5,("fcb_or_dos_open: attempting old open semantics for " "file %s.\n", smb_fname_str_dbg(smb_fname))); for(fsp = file_find_di_first(conn->sconn, id); fsp; fsp = file_find_di_next(fsp)) { DEBUG(10,("fcb_or_dos_open: checking file %s, fd = %d, " "vuid = %llu, file_pid = %u, private_options = 0x%x " "access_mask = 0x%x\n", fsp_str_dbg(fsp), fsp->fh->fd, (unsigned long long)fsp->vuid, (unsigned int)fsp->file_pid, (unsigned int)fsp->fh->private_options, (unsigned int)fsp->access_mask )); if (fsp != fsp_to_dup_into && fsp->fh->fd != -1 && fsp->vuid == vuid && fsp->file_pid == file_pid && (fsp->fh->private_options & (NTCREATEX_OPTIONS_PRIVATE_DENY_DOS | NTCREATEX_OPTIONS_PRIVATE_DENY_FCB)) && (fsp->access_mask & FILE_WRITE_DATA) && strequal(fsp->fsp_name->base_name, smb_fname->base_name) && strequal(fsp->fsp_name->stream_name, smb_fname->stream_name)) { DEBUG(10,("fcb_or_dos_open: file match\n")); break; } } if (!fsp) { return NT_STATUS_NOT_FOUND; } /* quite an insane set of semantics ... */ if (is_executable(smb_fname->base_name) && (fsp->fh->private_options & NTCREATEX_OPTIONS_PRIVATE_DENY_DOS)) { DEBUG(10,("fcb_or_dos_open: file fail due to is_executable.\n")); return NT_STATUS_INVALID_PARAMETER; } /* We need to duplicate this fsp. */ return dup_file_fsp(req, fsp, access_mask, share_access, create_options, fsp_to_dup_into); }
0
513,042
Item_param *get_item_param() { return this; }
0
236,158
u32 gpp_read_rgba(GF_BitStream *bs) { u8 r, g, b, a; u32 col; r = gf_bs_read_u8(bs); g = gf_bs_read_u8(bs); b = gf_bs_read_u8(bs); a = gf_bs_read_u8(bs); col = a; col<<=8; col |= r; col<<=8; col |= g; col<<=8; col |= b; return col; }
0
512,719
void fix_from_value(Derivation dv, const Metadata metadata) { fix_charset_and_length(str_value.charset(), dv, metadata); }
0
175,693
NetworkLibraryStubImpl() : ip_address_("1.1.1.1"), ethernet_(new EthernetNetwork()), wifi_(NULL), cellular_(NULL) { }
0
508,318
bool Locked_tables_list::restore_lock(THD *thd, TABLE_LIST *dst_table_list, TABLE *table, MYSQL_LOCK *lock) { MYSQL_LOCK *merged_lock; DBUG_ENTER("restore_lock"); DBUG_ASSERT(!strcmp(dst_table_list->table_name, table->s->table_name.str)); /* Ensure we have the memory to add the table back */ if (!(merged_lock= mysql_lock_merge(thd->lock, lock))) DBUG_RETURN(1); thd->lock= merged_lock; /* Link to the new table */ dst_table_list->table= table; /* The lock type may have changed (normally it should not as create table will lock the table in write mode */ dst_table_list->lock_type= table->reginfo.lock_type; table->pos_in_locked_tables= dst_table_list; add_back_last_deleted_lock(dst_table_list); table->mdl_ticket->downgrade_lock(table->reginfo.lock_type >= TL_WRITE_ALLOW_WRITE ? MDL_SHARED_NO_READ_WRITE : MDL_SHARED_READ); DBUG_RETURN(0); }
0
336,681
static void reds_mig_finished(RedsState *reds, int completed) { spice_debug("trace"); reds->mig_inprogress = TRUE; if (reds->src_do_seamless_migrate && completed) { reds_migrate_channels_seamless(reds); } else { reds->main_channel->migrate_src_complete(completed); } if (completed) { reds_mig_fill_wait_disconnect(reds); } else { reds_mig_cleanup(reds); } reds_mig_release(reds->config); }
0
292,187
CallInfo::CallInfo(Method* resolved_method, Klass* resolved_klass, TRAPS) { Klass* resolved_method_holder = resolved_method->method_holder(); if (resolved_klass == NULL) { // 2nd argument defaults to holder of 1st resolved_klass = resolved_method_holder; } _resolved_klass = resolved_klass; _selected_klass = resolved_klass; _resolved_method = resolved_method; _selected_method = resolved_method; // classify: CallKind kind = CallInfo::unknown_kind; int index = resolved_method->vtable_index(); if (resolved_method->can_be_statically_bound()) { kind = CallInfo::direct_call; } else if (!resolved_method_holder->is_interface()) { // Could be an Object method inherited into an interface, but still a vtable call. kind = CallInfo::vtable_call; } else if (!resolved_klass->is_interface()) { // A default or miranda method. Compute the vtable index. index = LinkResolver::vtable_index_of_interface_method(resolved_klass, resolved_method); assert(index >= 0 , "we should have valid vtable index at this point"); kind = CallInfo::vtable_call; } else if (resolved_method->has_vtable_index()) { // Can occur if an interface redeclares a method of Object. #ifdef ASSERT // Ensure that this is really the case. Klass* object_klass = SystemDictionary::Object_klass(); Method * object_resolved_method = object_klass->vtable().method_at(index); assert(object_resolved_method->name() == resolved_method->name(), "Object and interface method names should match at vtable index %d, %s != %s", index, object_resolved_method->name()->as_C_string(), resolved_method->name()->as_C_string()); assert(object_resolved_method->signature() == resolved_method->signature(), "Object and interface method signatures should match at vtable index %d, %s != %s", index, object_resolved_method->signature()->as_C_string(), resolved_method->signature()->as_C_string()); #endif // ASSERT kind = CallInfo::vtable_call; } else { // A regular interface call. kind = CallInfo::itable_call; index = resolved_method->itable_index(); } assert(index == Method::nonvirtual_vtable_index || index >= 0, "bad index %d", index); _call_kind = kind; _call_index = index; _resolved_appendix = Handle(); // Find or create a ResolvedMethod instance for this Method* set_resolved_method_name(CHECK); DEBUG_ONLY(verify()); }
0
289,305
static int snd_pcm_oss_format_to(snd_pcm_format_t format) { switch (format) { case SNDRV_PCM_FORMAT_MU_LAW: return AFMT_MU_LAW; case SNDRV_PCM_FORMAT_A_LAW: return AFMT_A_LAW; case SNDRV_PCM_FORMAT_IMA_ADPCM: return AFMT_IMA_ADPCM; case SNDRV_PCM_FORMAT_U8: return AFMT_U8; case SNDRV_PCM_FORMAT_S16_LE: return AFMT_S16_LE; case SNDRV_PCM_FORMAT_S16_BE: return AFMT_S16_BE; case SNDRV_PCM_FORMAT_S8: return AFMT_S8; case SNDRV_PCM_FORMAT_U16_LE: return AFMT_U16_LE; case SNDRV_PCM_FORMAT_U16_BE: return AFMT_U16_BE; case SNDRV_PCM_FORMAT_MPEG: return AFMT_MPEG; case SNDRV_PCM_FORMAT_S32_LE: return AFMT_S32_LE; case SNDRV_PCM_FORMAT_S32_BE: return AFMT_S32_BE; case SNDRV_PCM_FORMAT_S24_LE: return AFMT_S24_LE; case SNDRV_PCM_FORMAT_S24_BE: return AFMT_S24_BE; case SNDRV_PCM_FORMAT_S24_3LE: return AFMT_S24_PACKED; case SNDRV_PCM_FORMAT_FLOAT: return AFMT_FLOAT; case SNDRV_PCM_FORMAT_IEC958_SUBFRAME: return AFMT_SPDIF_RAW; default: return -EINVAL; } }
0
273,401
explicit BlockLSTMOp(OpKernelConstruction* ctx) : OpKernel(ctx) { if (ctx->HasAttr("forget_bias")) { OP_REQUIRES_OK(ctx, ctx->GetAttr("forget_bias", &forget_bias_)); } else { // V2 version does not have "forget_bias" attribute. forget_bias_ = 0.0; } OP_REQUIRES_OK(ctx, ctx->GetAttr("cell_clip", &cell_clip_)); OP_REQUIRES_OK(ctx, ctx->GetAttr("use_peephole", &use_peephole_)); }
0
413,625
static int core_anal_graph_nodes(RCore *core, RAnalFunction *fcn, int opts, PJ *pj) { int is_json = opts & R_CORE_ANAL_JSON; int is_keva = opts & R_CORE_ANAL_KEYVALUE; int nodes = 0; Sdb *DB = NULL; char *pal_jump = palColorFor ("graph.true"); char *pal_fail = palColorFor ("graph.false"); char *pal_trfa = palColorFor ("graph.trufae"); char *pal_curr = palColorFor ("graph.current"); char *pal_traced = palColorFor ("graph.traced"); char *pal_box4 = palColorFor ("graph.box4"); if (!fcn || !fcn->bbs) { eprintf ("No fcn\n"); free (pal_jump); free (pal_fail); free (pal_trfa); free (pal_curr); free (pal_traced); free (pal_box4); return -1; } if (is_keva) { char ns[64]; DB = sdb_ns (core->anal->sdb, "graph", 1); snprintf (ns, sizeof (ns), "fcn.0x%08"PFMT64x, fcn->addr); DB = sdb_ns (DB, ns, 1); } if (is_keva) { char *ename = sdb_encode ((const ut8*)fcn->name, -1); sdb_set (DB, "name", fcn->name, 0); sdb_set (DB, "ename", ename, 0); free (ename); sdb_num_set (DB, "size", r_anal_function_linear_size (fcn), 0); if (fcn->maxstack > 0) { sdb_num_set (DB, "stack", fcn->maxstack, 0); } sdb_set (DB, "pos", "0,0", 0); // needs to run layout sdb_set (DB, "type", r_anal_functiontype_tostring (fcn->type), 0); } else if (is_json) { // TODO: show vars, refs and xrefs char *fcn_name_escaped = r_str_escape_utf8_for_json (fcn->name, -1); pj_o (pj); pj_ks (pj, "name", r_str_getf (fcn_name_escaped)); free (fcn_name_escaped); pj_kn (pj, "offset", fcn->addr); pj_ki (pj, "ninstr", fcn->ninstr); pj_ki (pj, "nargs", r_anal_var_count_args (fcn)); pj_ki (pj, "nlocals", r_anal_var_count_locals (fcn)); pj_kn (pj, "size", r_anal_function_linear_size (fcn)); pj_ki (pj, "stack", fcn->maxstack); pj_ks (pj, "type", r_anal_functiontype_tostring (fcn->type)); pj_k (pj, "blocks"); pj_a (pj); } nodes += core_anal_graph_construct_nodes (core, fcn, opts, pj, DB); nodes += core_anal_graph_construct_edges (core, fcn, opts, pj, DB); if (is_json) { pj_end (pj); pj_end (pj); } free (pal_jump); free (pal_fail); free (pal_trfa); free (pal_curr); free (pal_traced); free (pal_box4); return nodes; }
0