idx
int64
func
string
target
int64
346,847
int main(int argc, char **argv) { MYSQL mysql; option_string *eptr; MY_INIT(argv[0]); if (load_defaults("my",load_default_groups,&argc,&argv)) { my_end(0); exit(1); } defaults_argv=argv; if (get_options(&argc,&argv)) { free_defaults(defaults_argv); my_end(0); exit(1); } /* Seed the random number generator if we will be using it. */ if (auto_generate_sql) srandom((uint)time(NULL)); /* globals? Yes, so we only have to run strlen once */ delimiter_length= strlen(delimiter); if (argc > 2) { fprintf(stderr,"%s: Too many arguments\n",my_progname); free_defaults(defaults_argv); my_end(0); exit(1); } mysql_init(&mysql); if (opt_compress) mysql_options(&mysql,MYSQL_OPT_COMPRESS,NullS); #ifdef HAVE_OPENSSL if (opt_use_ssl) mysql_ssl_set(&mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca, opt_ssl_capath, opt_ssl_cipher); #endif if (opt_protocol) mysql_options(&mysql,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol); #ifdef HAVE_SMEM if (shared_memory_base_name) mysql_options(&mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); #endif mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset); if (opt_plugin_dir && *opt_plugin_dir) mysql_options(&mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir); if (opt_default_auth && *opt_default_auth) mysql_options(&mysql, MYSQL_DEFAULT_AUTH, opt_default_auth); if (using_opt_enable_cleartext_plugin) mysql_options(&mysql, MYSQL_ENABLE_CLEARTEXT_PLUGIN, (char*) &opt_enable_cleartext_plugin); if (!opt_only_print) { if (!(mysql_connect_ssl_check(&mysql, host, user, opt_password, NULL, opt_mysql_port, opt_mysql_unix_port, connect_flags, opt_ssl_required))) { fprintf(stderr,"%s: Error when connecting to server: %s\n", my_progname,mysql_error(&mysql)); free_defaults(defaults_argv); my_end(0); exit(1); } } pthread_mutex_init(&counter_mutex, NULL); pthread_cond_init(&count_threshhold, NULL); pthread_mutex_init(&sleeper_mutex, NULL); pthread_cond_init(&sleep_threshhold, NULL); /* Main iterations loop */ eptr= engine_options; do { /* For the final stage we run whatever queries we were asked to run */ uint *current; if (verbose >= 2) printf("Starting Concurrency Test\n"); if (*concurrency) { for (current= concurrency; current && *current; current++) concurrency_loop(&mysql, *current, eptr); } else { uint infinite= 1; do { concurrency_loop(&mysql, infinite, eptr); } while (infinite++); } if (!opt_preserve) drop_schema(&mysql, create_schema_string); } while (eptr ? (eptr= eptr->next) : 0); pthread_mutex_destroy(&counter_mutex); pthread_cond_destroy(&count_threshhold); pthread_mutex_destroy(&sleeper_mutex); pthread_cond_destroy(&sleep_threshhold); if (!opt_only_print) mysql_close(&mysql); /* Close & free connection */ /* now free all the strings we created */ my_free(opt_password); my_free(concurrency); statement_cleanup(create_statements); statement_cleanup(query_statements); statement_cleanup(pre_statements); statement_cleanup(post_statements); option_cleanup(engine_options); #ifdef HAVE_SMEM my_free(shared_memory_base_name); #endif free_defaults(defaults_argv); my_end(my_end_arg); return 0; }
1
49,285
long qemu_maxrampagesize(void) { long pagesize = 0; Object *memdev_root = object_resolve_path("/objects", NULL); object_child_foreach(memdev_root, find_max_backend_pagesize, &pagesize); return pagesize; }
0
397,244
static void ehci_trace_usbsts(uint32_t mask, int state) { /* interrupts */ if (mask & USBSTS_INT) { trace_usb_ehci_usbsts("INT", state); } if (mask & USBSTS_ERRINT) { trace_usb_ehci_usbsts("ERRINT", state); } if (mask & USBSTS_PCD) { trace_usb_ehci_usbsts("PCD", state); } if (mask & USBSTS_FLR) { trace_usb_ehci_usbsts("FLR", state); } if (mask & USBSTS_HSE) { trace_usb_ehci_usbsts("HSE", state); } if (mask & USBSTS_IAA) { trace_usb_ehci_usbsts("IAA", state); } /* status */ if (mask & USBSTS_HALT) { trace_usb_ehci_usbsts("HALT", state); } if (mask & USBSTS_REC) { trace_usb_ehci_usbsts("REC", state); } if (mask & USBSTS_PSS) { trace_usb_ehci_usbsts("PSS", state); } if (mask & USBSTS_ASS) { trace_usb_ehci_usbsts("ASS", state); } }
0
269,299
void remove_remote_root() { int reply; reply= get_response((const char *) "\n\nNormally, root should only be " "allowed to connect from\n'localhost'. " "This ensures that someone cannot guess at" "\nthe root password from the network.\n\n" "Disallow root login remotely? (Press y|Y " "for Yes, any other key for No) : "); if (reply == (int) 'y' || reply == (int) 'Y') { const char *query; query= "SELECT USER, HOST FROM mysql.user WHERE USER='root' " "AND HOST NOT IN ('localhost', '127.0.0.1', '::1')"; if (!execute_query(&query, strlen(query))) DBUG_PRINT("info", ("query success!")); MYSQL_RES *result= mysql_store_result(&mysql); if (result) drop_users(result); mysql_free_result(result); fprintf(stdout, "Done.. Moving on..\n\n"); } else fprintf(stdout, "\n ... skipping.\n"); }
0
377,755
int tcf_action_destroy(struct list_head *actions, int bind) { struct tc_action *a, *tmp; int ret = 0; list_for_each_entry_safe(a, tmp, actions, list) { ret = tcf_hash_release(a, bind); if (ret == ACT_P_DELETED) module_put(a->ops->owner); else if (ret < 0) return ret; list_del(&a->list); kfree(a); } return ret; }
0
121,473
static void skb_recv_done(struct virtqueue *rvq) { struct virtnet_info *vi = rvq->vdev->priv; struct receive_queue *rq = &vi->rq[vq2rxq(rvq)]; /* Schedule NAPI, Suppress further interrupts if successful. */ if (napi_schedule_prep(&rq->napi)) { virtqueue_disable_cb(rvq); __napi_schedule(&rq->napi); } }
0
65,637
static int coolkey_select_file(sc_card_t *card, const sc_path_t *in_path, sc_file_t **file_out) { int r; struct sc_file *file = NULL; coolkey_private_data_t * priv = COOLKEY_DATA(card); unsigned long object_id; assert(card != NULL && in_path != NULL); SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE); if (in_path->len != 4) { return SC_ERROR_OBJECT_NOT_FOUND; } r = coolkey_select_applet(card); if (r != SC_SUCCESS) { return r; } object_id = bebytes2ulong(in_path->value); priv->obj = coolkey_find_object_by_id(&priv->objects_list, object_id); if (priv->obj == NULL) { return SC_ERROR_OBJECT_NOT_FOUND; } priv->key_id = COOLKEY_INVALID_KEY; if (coolkey_class(object_id) == COOLKEY_KEY_CLASS) { priv->key_id = coolkey_get_key_id(object_id); } if (file_out) { file = sc_file_new(); if (file == NULL) LOG_FUNC_RETURN(card->ctx, SC_ERROR_OUT_OF_MEMORY); file->path = *in_path; /* this could be like the FCI */ file->type = SC_PATH_TYPE_FILE_ID; file->shareable = 0; file->ef_structure = 0; file->size = priv->obj->length; *file_out = file; } return SC_SUCCESS; }
0
206,956
JsVar *jsvGetArrayItem(const JsVar *arr, JsVarInt index) { return jsvSkipNameAndUnLock(jsvGetArrayIndex(arr,index)); }
0
460,422
static void hidinput_cleanup_hidinput(struct hid_device *hid, struct hid_input *hidinput) { struct hid_report *report; int i, k; list_del(&hidinput->list); input_free_device(hidinput->input); kfree(hidinput->name); for (k = HID_INPUT_REPORT; k <= HID_OUTPUT_REPORT; k++) { if (k == HID_OUTPUT_REPORT && hid->quirks & HID_QUIRK_SKIP_OUTPUT_REPORTS) continue; list_for_each_entry(report, &hid->report_enum[k].report_list, list) { for (i = 0; i < report->maxfield; i++) if (report->field[i]->hidinput == hidinput) report->field[i]->hidinput = NULL; } } kfree(hidinput); }
0
427,412
static void libopenjpeg_error_callback(const char *msg, void * /*client_data*/) { error(errSyntaxError, -1, "{0:s}", msg); }
0
131,396
pixOctreeQuantNumColors(PIX *pixs, l_int32 maxcolors, l_int32 subsample) { l_int32 w, h, minside, bpp, wpls, wpld, i, j, actualcolors; l_int32 rval, gval, bval, nbase, nextra, maxlevel, ncubes, val; l_int32 *lut1, *lut2; l_uint32 index; l_uint32 *lines, *lined, *datas, *datad, *pspixel; l_uint32 *rtab, *gtab, *btab; OQCELL *oqc; OQCELL **oqca; L_HEAP *lh; PIX *pixd; PIXCMAP *cmap; PROCNAME("pixOctreeQuantNumColors"); if (!pixs) return (PIX *)ERROR_PTR("pixs not defined", procName, NULL); if (pixGetDepth(pixs) != 32) return (PIX *)ERROR_PTR("pixs not 32 bpp", procName, NULL); if (maxcolors < 8) { L_WARNING("max colors < 8; setting to 8\n", procName); maxcolors = 8; } if (maxcolors > 256) { L_WARNING("max colors > 256; setting to 256\n", procName); maxcolors = 256; } pixGetDimensions(pixs, &w, &h, NULL); datas = pixGetData(pixs); wpls = pixGetWpl(pixs); minside = L_MIN(w, h); if (subsample <= 0) { subsample = L_MAX(1, minside / 200); } if (maxcolors <= 16) { bpp = 4; pixd = pixCreate(w, h, bpp); maxlevel = 2; ncubes = 64; /* 2^6 */ nbase = 8; nextra = maxcolors - nbase; } else if (maxcolors <= 64) { bpp = 8; pixd = pixCreate(w, h, bpp); maxlevel = 2; ncubes = 64; /* 2^6 */ nbase = 8; nextra = maxcolors - nbase; } else { /* maxcolors <= 256 */ bpp = 8; pixd = pixCreate(w, h, bpp); maxlevel = 3; ncubes = 512; /* 2^9 */ nbase = 64; nextra = maxcolors - nbase; } pixCopyResolution(pixd, pixs); pixCopyInputFormat(pixd, pixs); /*----------------------------------------------------------* * If we're using the minimum number of colors, it is * * much simpler. We just use 'nbase' octcubes. * * For this case, we don't eliminate any extra colors. * *----------------------------------------------------------*/ if (nextra == 0) { /* prepare the OctcubeQuantCell array */ if ((oqca = (OQCELL **)LEPT_CALLOC(nbase, sizeof(OQCELL *))) == NULL) { pixDestroy(&pixd); return (PIX *)ERROR_PTR("oqca not made", procName, NULL); } for (i = 0; i < nbase; i++) { oqca[i] = (OQCELL *)LEPT_CALLOC(1, sizeof(OQCELL)); oqca[i]->n = 0.0; } rtab = gtab = btab = NULL; makeRGBToIndexTables(maxlevel - 1, &rtab, &gtab, &btab); /* Go through the entire image, gathering statistics and * assigning pixels to their quantized value */ datad = pixGetData(pixd); wpld = pixGetWpl(pixd); for (i = 0; i < h; i++) { lines = datas + i * wpls; lined = datad + i * wpld; for (j = 0; j < w; j++) { pspixel = lines + j; extractRGBValues(*pspixel, &rval, &gval, &bval); getOctcubeIndexFromRGB(rval, gval, bval, rtab, gtab, btab, &index); /* lept_stderr("rval = %d, gval = %d, bval = %d," " index = %d\n", rval, gval, bval, index); */ if (bpp == 4) SET_DATA_QBIT(lined, j, index); else /* bpp == 8 */ SET_DATA_BYTE(lined, j, index); oqca[index]->n += 1.0; oqca[index]->rcum += rval; oqca[index]->gcum += gval; oqca[index]->bcum += bval; } } /* Compute average color values in each octcube, and * generate colormap */ cmap = pixcmapCreate(bpp); pixSetColormap(pixd, cmap); for (i = 0; i < nbase; i++) { oqc = oqca[i]; if (oqc->n != 0) { oqc->rval = (l_int32)(oqc->rcum / oqc->n); oqc->gval = (l_int32)(oqc->gcum / oqc->n); oqc->bval = (l_int32)(oqc->bcum / oqc->n); } else { getRGBFromOctcube(i, maxlevel - 1, &oqc->rval, &oqc->gval, &oqc->bval); } pixcmapAddColor(cmap, oqc->rval, oqc->gval, oqc->bval); } for (i = 0; i < nbase; i++) LEPT_FREE(oqca[i]); LEPT_FREE(oqca); LEPT_FREE(rtab); LEPT_FREE(gtab); LEPT_FREE(btab); return pixd; } /*------------------------------------------------------------* * General case: we will use colors in octcubes at maxlevel. * * We also remove any colors that are not populated from * * the colormap. * *------------------------------------------------------------*/ /* Prepare the OctcubeQuantCell array */ if ((oqca = (OQCELL **)LEPT_CALLOC(ncubes, sizeof(OQCELL *))) == NULL) { pixDestroy(&pixd); return (PIX *)ERROR_PTR("oqca not made", procName, NULL); } for (i = 0; i < ncubes; i++) { oqca[i] = (OQCELL *)LEPT_CALLOC(1, sizeof(OQCELL)); oqca[i]->n = 0.0; } /* Make the tables to map color to the octindex, * of which there are 'ncubes' at 'maxlevel' */ rtab = gtab = btab = NULL; makeRGBToIndexTables(maxlevel, &rtab, &gtab, &btab); /* Estimate the color distribution; we want to find the * most popular nextra colors at 'maxlevel' */ for (i = 0; i < h; i += subsample) { lines = datas + i * wpls; for (j = 0; j < w; j += subsample) { pspixel = lines + j; extractRGBValues(*pspixel, &rval, &gval, &bval); getOctcubeIndexFromRGB(rval, gval, bval, rtab, gtab, btab, &index); oqca[index]->n += 1.0; oqca[index]->octindex = index; oqca[index]->rcum += rval; oqca[index]->gcum += gval; oqca[index]->bcum += bval; } } /* Transfer the OQCELL from the array, and order in a heap */ lh = lheapCreate(512, L_SORT_DECREASING); for (i = 0; i < ncubes; i++) lheapAdd(lh, oqca[i]); LEPT_FREE(oqca); /* don't need this array */ /* Prepare a new OctcubeQuantCell array, with maxcolors cells */ oqca = (OQCELL **)LEPT_CALLOC(maxcolors, sizeof(OQCELL *)); for (i = 0; i < nbase; i++) { /* make nbase cells */ oqca[i] = (OQCELL *)LEPT_CALLOC(1, sizeof(OQCELL)); oqca[i]->n = 0.0; } /* Remove the nextra most populated ones, and put them in the array */ for (i = 0; i < nextra; i++) { oqc = (OQCELL *)lheapRemove(lh); oqc->n = 0.0; /* reinit */ oqc->rcum = 0; oqc->gcum = 0; oqc->bcum = 0; oqca[nbase + i] = oqc; /* store it in the array */ } /* Destroy the heap and its remaining contents */ lheapDestroy(&lh, TRUE); /* Generate a lookup table from octindex at maxlevel * to color table index */ lut1 = (l_int32 *)LEPT_CALLOC(ncubes, sizeof(l_int32)); for (i = 0; i < nextra; i++) lut1[oqca[nbase + i]->octindex] = nbase + i; for (index = 0; index < ncubes; index++) { if (lut1[index] == 0) /* not one of the extras; need to assign */ lut1[index] = index >> 3; /* remove the least significant bits */ /* lept_stderr("lut1[%d] = %d\n", index, lut1[index]); */ } /* Go through the entire image, gathering statistics and * assigning pixels to their quantized value */ datad = pixGetData(pixd); wpld = pixGetWpl(pixd); for (i = 0; i < h; i++) { lines = datas + i * wpls; lined = datad + i * wpld; for (j = 0; j < w; j++) { pspixel = lines + j; extractRGBValues(*pspixel, &rval, &gval, &bval); getOctcubeIndexFromRGB(rval, gval, bval, rtab, gtab, btab, &index); /* lept_stderr("rval = %d, gval = %d, bval = %d, index = %d\n", rval, gval, bval, index); */ val = lut1[index]; switch (bpp) { case 4: SET_DATA_QBIT(lined, j, val); break; case 8: SET_DATA_BYTE(lined, j, val); break; default: LEPT_FREE(oqca); LEPT_FREE(lut1); return (PIX *)ERROR_PTR("bpp not 4 or 8!", procName, NULL); break; } oqca[val]->n += 1.0; oqca[val]->rcum += rval; oqca[val]->gcum += gval; oqca[val]->bcum += bval; } } /* Compute averages, set up a colormap, and make a second * lut that converts from the color values currently in * the image to a minimal set */ lut2 = (l_int32 *)LEPT_CALLOC(ncubes, sizeof(l_int32)); cmap = pixcmapCreate(bpp); pixSetColormap(pixd, cmap); for (i = 0, index = 0; i < maxcolors; i++) { oqc = oqca[i]; lut2[i] = index; if (oqc->n == 0) /* no occupancy; don't bump up index */ continue; oqc->rval = (l_int32)(oqc->rcum / oqc->n); oqc->gval = (l_int32)(oqc->gcum / oqc->n); oqc->bval = (l_int32)(oqc->bcum / oqc->n); pixcmapAddColor(cmap, oqc->rval, oqc->gval, oqc->bval); index++; } /* pixcmapWriteStream(stderr, cmap); */ actualcolors = pixcmapGetCount(cmap); /* lept_stderr("Number of different colors = %d\n", actualcolors); */ /* Last time through the image; use the lookup table to * remap the pixel value to the minimal colormap */ if (actualcolors < maxcolors) { for (i = 0; i < h; i++) { lined = datad + i * wpld; for (j = 0; j < w; j++) { switch (bpp) { case 4: val = GET_DATA_QBIT(lined, j); SET_DATA_QBIT(lined, j, lut2[val]); break; case 8: val = GET_DATA_BYTE(lined, j); SET_DATA_BYTE(lined, j, lut2[val]); break; } } } } if (oqca) { for (i = 0; i < maxcolors; i++) LEPT_FREE(oqca[i]); } LEPT_FREE(oqca); LEPT_FREE(lut1); LEPT_FREE(lut2); LEPT_FREE(rtab); LEPT_FREE(gtab); LEPT_FREE(btab); return pixd; }
0
433,503
int validate_sp(unsigned long sp, struct task_struct *p, unsigned long nbytes) { unsigned long stack_page = (unsigned long)task_stack_page(p); if (sp < THREAD_SIZE) return 0; if (sp >= stack_page && sp <= stack_page + THREAD_SIZE - nbytes) return 1; return valid_irq_stack(sp, p, nbytes); }
0
18,440
static int dissect_h245_INTEGER ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_integer ( tvb , offset , actx , tree , hf_index , NULL ) ; return offset ; }
0
390,432
void SSL_CTX::setFailNoCert() { method_->setFailNoCert(); }
0
129,875
int am_has_header(request_rec *r, const char *h, const char *v) { return (am_get_header_attr(r, h, v, NULL) != NULL); }
0
199,401
ScreenRecorder::ScreenRecorder( MessageLoop* capture_loop, MessageLoop* encode_loop, base::MessageLoopProxy* network_loop, Capturer* capturer, Encoder* encoder) : capture_loop_(capture_loop), encode_loop_(encode_loop), network_loop_(network_loop), capturer_(capturer), encoder_(encoder), is_recording_(false), network_stopped_(false), encoder_stopped_(false), max_recordings_(kMaxRecordings), recordings_(0), frame_skipped_(false), sequence_number_(0) { DCHECK(capture_loop_); DCHECK(encode_loop_); DCHECK(network_loop_); }
0
152,409
*/ void skb_condense(struct sk_buff *skb) { if (skb->data_len) { if (skb->data_len > skb->end - skb->tail || skb_cloned(skb)) return; /* Nice, we can free page frag(s) right now */ __pskb_pull_tail(skb, skb->data_len); } /* At this point, skb->truesize might be over estimated, * because skb had a fragment, and fragments do not tell * their truesize. * When we pulled its content into skb->head, fragment * was freed, but __pskb_pull_tail() could not possibly * adjust skb->truesize, not knowing the frag truesize. */ skb->truesize = SKB_TRUESIZE(skb_end_offset(skb));
0
478,155
T cubic_atXYZ_c(const float fx, const float fy, const float fz, const int c, const T& out_value) const { return cimg::type<T>::cut(cubic_atXYZ(fx,fy,fz,c,out_value)); }
0
186,752
void red_channel_client_pipe_add_empty_msg(RedChannelClient *rcc, int msg_type) { EmptyMsgPipeItem *item = spice_new(EmptyMsgPipeItem, 1); red_channel_pipe_item_init(rcc->channel, &item->base, PIPE_ITEM_TYPE_EMPTY_MSG); item->msg = msg_type; red_channel_client_pipe_add(rcc, &item->base); red_channel_client_push(rcc); }
0
130,022
GF_Err void_box_read(GF_Box *s, GF_BitStream *bs) { if (s->size) return GF_ISOM_INVALID_FILE; return GF_OK;
0
218,674
bool ShellDelegateImpl::IsForceMaximizeOnFirstRun() const { return false; }
0
463,561
static int io_sqpoll_wait_sq(struct io_ring_ctx *ctx) { int ret = 0; DEFINE_WAIT(wait); do { if (!io_sqring_full(ctx)) break; prepare_to_wait(&ctx->sqo_sq_wait, &wait, TASK_INTERRUPTIBLE); if (unlikely(ctx->sqo_dead)) { ret = -EOWNERDEAD; goto out; } if (!io_sqring_full(ctx)) break; schedule(); } while (!signal_pending(current)); finish_wait(&ctx->sqo_sq_wait, &wait); out: return ret;
0
399,157
static void add_fifo_list (pathname) char *pathname; { if (nfifo >= fifo_list_size - 1) { fifo_list_size += FIFO_INCR; fifo_list = (struct temp_fifo *)xrealloc (fifo_list, fifo_list_size * sizeof (struct temp_fifo)); } fifo_list[nfifo].file = savestring (pathname); nfifo++;
0
379,687
static int ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op2; zval *dim = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC); zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_IS TSRMLS_CC); if (IS_CV == IS_VAR && !container) { zend_error_noreturn(E_ERROR, "Cannot use string offset as an array"); } zend_fetch_dimension_address_read(&EX_T(opline->result.u.var), container, dim, 1, BP_VAR_IS TSRMLS_CC); zval_dtor(free_op2.var); ZEND_VM_NEXT_OPCODE(); }
0
56,860
void Vertex(double *args) { SetTransferMatrix(1,0,0,1,args[0],args[1]); BezierCircle(args[2],"f"); }
0
232,420
SWFShape_addBitmapFillStyle(SWFShape shape, SWFBitmap bitmap, byte flags) { SWFFillStyle fill; if ( bitmap ) { SWFCharacter_addDependency((SWFCharacter)shape, (SWFCharacter)bitmap); } fill = newSWFBitmapFillStyle(bitmap, flags); if(addFillStyle(shape, fill) < 0) { destroySWFFillStyle(fill); return NULL; } return fill; }
0
51,649
flatpak_repo_set_homepage (OstreeRepo *repo, const char *homepage, GError **error) { g_autoptr(GKeyFile) config = NULL; config = ostree_repo_copy_config (repo); if (homepage) g_key_file_set_string (config, "flatpak", "homepage", homepage); else g_key_file_remove_key (config, "flatpak", "homepage", NULL); if (!ostree_repo_write_config (repo, config, error)) return FALSE; return TRUE; }
0
313,531
void BluetoothAdapter::RemoveDiscoverySession( BluetoothDiscoverySession* discovery_session, const base::Closure& callback, DiscoverySessionErrorCallback error_callback) { size_t erased = discovery_sessions_.erase(discovery_session); DCHECK_EQ(1u, erased); std::unique_ptr<StartOrStopDiscoveryCallback> removal_callbacks( new StartOrStopDiscoveryCallback(callback, std::move(error_callback))); discovery_callback_queue_.push(std::move(removal_callbacks)); if (discovery_request_pending_) { return; } ProcessDiscoveryQueue(); }
0
236,375
XcursorLibraryShape (const char *library) { int low, high; int mid; int c; low = 0; high = NUM_STANDARD_NAMES - 1; while (low < high - 1) { mid = (low + high) >> 1; c = strcmp (library, STANDARD_NAME (mid)); if (c == 0) return (mid << 1); if (c > 0) low = mid; else high = mid; } while (low <= high) { if (!strcmp (library, STANDARD_NAME (low))) return (low << 1); low++; } return -1; }
0
514,666
void StreamResource::EmitRead(ssize_t nread, const uv_buf_t& buf) { DebugSealHandleScope seal_handle_scope; if (nread > 0) bytes_read_ += static_cast<uint64_t>(nread); listener_->OnStreamRead(nread, buf); }
0
329,609
static void verdex_init(ram_addr_t ram_size, int vga_ram_size, const char *boot_device, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { struct pxa2xx_state_s *cpu; int index; uint32_t verdex_rom = 0x02000000; uint32_t verdex_ram = 0x10000000; if (ram_size < (verdex_ram + verdex_rom + PXA2XX_INTERNAL_SIZE)) { fprintf(stderr, "This platform requires %i bytes of memory\n", verdex_ram + verdex_rom + PXA2XX_INTERNAL_SIZE); exit(1); } cpu = pxa270_init(verdex_ram, cpu_model ?: "pxa270-c0"); index = drive_get_index(IF_PFLASH, 0, 0); if (index == -1) { fprintf(stderr, "A flash image must be given with the " "'pflash' parameter\n"); exit(1); } if (!pflash_cfi01_register(0x00000000, qemu_ram_alloc(verdex_rom), drives_table[index].bdrv, sector_len, verdex_rom / sector_len, 2, 0, 0, 0, 0)) { fprintf(stderr, "qemu: Error registering flash memory.\n"); exit(1); } cpu->env->regs[15] = 0x00000000; /* Interrupt line of NIC is connected to GPIO line 99 */ smc91c111_init(&nd_table[0], 0x04000300, pxa2xx_gpio_in_get(cpu->gpio)[99]); }
0
519,747
void prepare_frm_header(THD *thd, uint reclength, uchar *fileinfo, HA_CREATE_INFO *create_info, uint keys, KEY *key_info) { ulong key_comment_total_bytes= 0; uint i; DBUG_ENTER("prepare_frm_header"); /* Fix this when we have new .frm files; Current limit is 4G rows (TODO) */ if (create_info->max_rows > UINT_MAX32) create_info->max_rows= UINT_MAX32; if (create_info->min_rows > UINT_MAX32) create_info->min_rows= UINT_MAX32; uint key_length, tmp_key_length, tmp, csid; bzero((char*) fileinfo, FRM_HEADER_SIZE); /* header */ fileinfo[0]=(uchar) 254; fileinfo[1]= 1; fileinfo[2]= (create_info->expression_length == 0 ? FRM_VER_TRUE_VARCHAR : FRM_VER_EXPRESSSIONS); DBUG_ASSERT(ha_storage_engine_is_enabled(create_info->db_type)); fileinfo[3]= (uchar) ha_legacy_type(create_info->db_type); /* Keep in sync with pack_keys() in unireg.cc For each key: 8 bytes for the key header 9 bytes for each key-part (MAX_REF_PARTS) NAME_LEN bytes for the name 1 byte for the NAMES_SEP_CHAR (before the name) For all keys: 6 bytes for the header 1 byte for the NAMES_SEP_CHAR (after the last name) 9 extra bytes (padding for safety? alignment?) */ for (i= 0; i < keys; i++) { DBUG_ASSERT(MY_TEST(key_info[i].flags & HA_USES_COMMENT) == (key_info[i].comment.length > 0)); if (key_info[i].flags & HA_USES_COMMENT) key_comment_total_bytes += 2 + key_info[i].comment.length; } key_length= keys * (8 + MAX_REF_PARTS * 9 + NAME_LEN + 1) + 16 + key_comment_total_bytes; int2store(fileinfo+8,1); tmp_key_length= (key_length < 0xffff) ? key_length : 0xffff; int2store(fileinfo+14,tmp_key_length); int2store(fileinfo+16,reclength); int4store(fileinfo+18,create_info->max_rows); int4store(fileinfo+22,create_info->min_rows); /* fileinfo[26] is set in mysql_create_frm() */ fileinfo[27]=2; // Use long pack-fields /* fileinfo[28 & 29] is set to key_info_length in mysql_create_frm() */ create_info->table_options|=HA_OPTION_LONG_BLOB_PTR; // Use portable blob pointers int2store(fileinfo+30,create_info->table_options); fileinfo[32]=0; // No filename anymore fileinfo[33]=5; // Mark for 5.0 frm file int4store(fileinfo+34,create_info->avg_row_length); csid= (create_info->default_table_charset ? create_info->default_table_charset->number : 0); fileinfo[38]= (uchar) csid; fileinfo[39]= (uchar) ((uint) create_info->transactional | ((uint) create_info->page_checksum << 2)); fileinfo[40]= (uchar) create_info->row_type; /* Bytes 41-46 were for RAID support; now reused for other purposes */ fileinfo[41]= (uchar) (csid >> 8); int2store(fileinfo+42, create_info->stats_sample_pages & 0xffff); fileinfo[44]= (uchar) create_info->stats_auto_recalc; int2store(fileinfo+45, (create_info->check_constraint_list->elements+ create_info->field_check_constraints)); int4store(fileinfo+47, key_length); tmp= MYSQL_VERSION_ID; // Store to avoid warning from int4store int4store(fileinfo+51, tmp); int4store(fileinfo+55, create_info->extra_size); /* 59-60 is unused since 10.2.4 61 for default_part_db_type */ int2store(fileinfo+62, create_info->key_block_size); DBUG_VOID_RETURN; } /* prepare_fileinfo */
0
200,288
CMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *data, const EVP_CIPHER *cipher, unsigned int flags) { CMS_ContentInfo *cms; int i; X509 *recip; cms = CMS_EnvelopedData_create(cipher); if (!cms) goto merr; for (i = 0; i < sk_X509_num(certs); i++) { recip = sk_X509_value(certs, i); if (!CMS_add1_recipient_cert(cms, recip, flags)) { CMSerr(CMS_F_CMS_ENCRYPT, CMS_R_RECIPIENT_ERROR); goto err; } } if(!(flags & CMS_DETACHED)) CMS_set_detached(cms, 0); if ((flags & (CMS_STREAM|CMS_PARTIAL)) || CMS_final(cms, data, NULL, flags)) return cms; else goto err; merr: CMSerr(CMS_F_CMS_ENCRYPT, ERR_R_MALLOC_FAILURE); err: if (cms) CMS_ContentInfo_free(cms); return NULL; }
0
318,491
static inline void RENAME(yuvPlanartouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, long width, long height, long lumStride, long chromStride, long dstStride, long vertLumPerChroma) { long y; const x86_reg chromWidth= width>>1; for (y=0; y<height; y++) { #if COMPILE_TEMPLATE_MMX //FIXME handle 2 lines at once (fewer prefetches, reuse some chroma, but very likely memory-limited anyway) __asm__ volatile( "xor %%"REG_a", %%"REG_a" \n\t" ".p2align 4 \n\t" "1: \n\t" PREFETCH" 32(%1, %%"REG_a", 2) \n\t" PREFETCH" 32(%2, %%"REG_a") \n\t" PREFETCH" 32(%3, %%"REG_a") \n\t" "movq (%2, %%"REG_a"), %%mm0 \n\t" // U(0) "movq %%mm0, %%mm2 \n\t" // U(0) "movq (%3, %%"REG_a"), %%mm1 \n\t" // V(0) "punpcklbw %%mm1, %%mm0 \n\t" // UVUV UVUV(0) "punpckhbw %%mm1, %%mm2 \n\t" // UVUV UVUV(8) "movq (%1, %%"REG_a",2), %%mm3 \n\t" // Y(0) "movq 8(%1, %%"REG_a",2), %%mm5 \n\t" // Y(8) "movq %%mm0, %%mm4 \n\t" // Y(0) "movq %%mm2, %%mm6 \n\t" // Y(8) "punpcklbw %%mm3, %%mm0 \n\t" // YUYV YUYV(0) "punpckhbw %%mm3, %%mm4 \n\t" // YUYV YUYV(4) "punpcklbw %%mm5, %%mm2 \n\t" // YUYV YUYV(8) "punpckhbw %%mm5, %%mm6 \n\t" // YUYV YUYV(12) MOVNTQ" %%mm0, (%0, %%"REG_a", 4) \n\t" MOVNTQ" %%mm4, 8(%0, %%"REG_a", 4) \n\t" MOVNTQ" %%mm2, 16(%0, %%"REG_a", 4) \n\t" MOVNTQ" %%mm6, 24(%0, %%"REG_a", 4) \n\t" "add $8, %%"REG_a" \n\t" "cmp %4, %%"REG_a" \n\t" " jb 1b \n\t" ::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g" (chromWidth) : "%"REG_a ); #else //FIXME adapt the Alpha ASM code from yv12->yuy2 #if HAVE_FAST_64BIT int i; uint64_t *ldst = (uint64_t *) dst; const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc; for (i = 0; i < chromWidth; i += 2) { uint64_t k, l; k = uc[0] + (yc[0] << 8) + (vc[0] << 16) + (yc[1] << 24); l = uc[1] + (yc[2] << 8) + (vc[1] << 16) + (yc[3] << 24); *ldst++ = k + (l << 32); yc += 4; uc += 2; vc += 2; } #else int i, *idst = (int32_t *) dst; const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc; for (i = 0; i < chromWidth; i++) { #if HAVE_BIGENDIAN *idst++ = (uc[0] << 24)+ (yc[0] << 16) + (vc[0] << 8) + (yc[1] << 0); #else *idst++ = uc[0] + (yc[0] << 8) + (vc[0] << 16) + (yc[1] << 24); #endif yc += 2; uc++; vc++; } #endif #endif if ((y&(vertLumPerChroma-1)) == vertLumPerChroma-1) { usrc += chromStride; vsrc += chromStride; } ysrc += lumStride; dst += dstStride; } #if COMPILE_TEMPLATE_MMX __asm__(EMMS" \n\t" SFENCE" \n\t" :::"memory"); #endif }
0
112,681
static struct timing_generator *dce112_timing_generator_create( struct dc_context *ctx, uint32_t instance, const struct dce110_timing_generator_offsets *offsets) { struct dce110_timing_generator *tg110 = kzalloc(sizeof(struct dce110_timing_generator), GFP_KERNEL); if (!tg110) return NULL; dce110_timing_generator_construct(tg110, ctx, instance, offsets); return &tg110->base; }
0
179,626
void SoftVorbis::initPorts() { OMX_PARAM_PORTDEFINITIONTYPE def; InitOMXParams(&def); def.nPortIndex = 0; def.eDir = OMX_DirInput; def.nBufferCountMin = kNumBuffers; def.nBufferCountActual = def.nBufferCountMin; def.nBufferSize = 8192; def.bEnabled = OMX_TRUE; def.bPopulated = OMX_FALSE; def.eDomain = OMX_PortDomainAudio; def.bBuffersContiguous = OMX_FALSE; def.nBufferAlignment = 1; def.format.audio.cMIMEType = const_cast<char *>(MEDIA_MIMETYPE_AUDIO_VORBIS); def.format.audio.pNativeRender = NULL; def.format.audio.bFlagErrorConcealment = OMX_FALSE; def.format.audio.eEncoding = OMX_AUDIO_CodingVORBIS; addPort(def); def.nPortIndex = 1; def.eDir = OMX_DirOutput; def.nBufferCountMin = kNumBuffers; def.nBufferCountActual = def.nBufferCountMin; def.nBufferSize = kMaxNumSamplesPerBuffer * sizeof(int16_t); def.bEnabled = OMX_TRUE; def.bPopulated = OMX_FALSE; def.eDomain = OMX_PortDomainAudio; def.bBuffersContiguous = OMX_FALSE; def.nBufferAlignment = 2; def.format.audio.cMIMEType = const_cast<char *>("audio/raw"); def.format.audio.pNativeRender = NULL; def.format.audio.bFlagErrorConcealment = OMX_FALSE; def.format.audio.eEncoding = OMX_AUDIO_CodingPCM; addPort(def); }
0
474,695
process (GeglOperation *operation, GeglOperationContext *context, const gchar *output_pad, const GeglRectangle *result, gint level) { GeglProperties *o = GEGL_PROPERTIES (operation); if (!o->user_data) return FALSE; /* overriding the predefined behavior */ g_object_ref (o->user_data); gegl_operation_context_take_object (context, "output", G_OBJECT (o->user_data)); return TRUE; }
0
62,298
last_search_pattern(void) { return spats[RE_SEARCH].pat; }
0
121,874
static ut64 binobj_a2b(RBinObject *bo, ut64 addr) { return addr + (bo ? bo->baddr_shift : 0); }
0
8,065
static int jpc_pi_nextpcrl(register jpc_pi_t *pi) { int rlvlno; jpc_pirlvl_t *pirlvl; jpc_pchg_t *pchg; int prchind; int prcvind; int *prclyrno; int compno; jpc_picomp_t *picomp; int xstep; int ystep; uint_fast32_t trx0; uint_fast32_t try0; uint_fast32_t r; uint_fast32_t rpx; uint_fast32_t rpy; pchg = pi->pchg; if (!pi->prgvolfirst) { goto skip; } else { pi->xstep = 0; pi->ystep = 0; for (compno = 0, picomp = pi->picomps; compno < pi->numcomps; ++compno, ++picomp) { for (rlvlno = 0, pirlvl = picomp->pirlvls; rlvlno < picomp->numrlvls; ++rlvlno, ++pirlvl) { xstep = picomp->hsamp * (1 << (pirlvl->prcwidthexpn + picomp->numrlvls - rlvlno - 1)); ystep = picomp->vsamp * (1 << (pirlvl->prcheightexpn + picomp->numrlvls - rlvlno - 1)); pi->xstep = (!pi->xstep) ? xstep : JAS_MIN(pi->xstep, xstep); pi->ystep = (!pi->ystep) ? ystep : JAS_MIN(pi->ystep, ystep); } } pi->prgvolfirst = 0; } for (pi->y = pi->ystart; pi->y < pi->yend; pi->y += pi->ystep - (pi->y % pi->ystep)) { for (pi->x = pi->xstart; pi->x < pi->xend; pi->x += pi->xstep - (pi->x % pi->xstep)) { for (pi->compno = pchg->compnostart, pi->picomp = &pi->picomps[pi->compno]; pi->compno < pi->numcomps && pi->compno < JAS_CAST(int, pchg->compnoend); ++pi->compno, ++pi->picomp) { for (pi->rlvlno = pchg->rlvlnostart, pi->pirlvl = &pi->picomp->pirlvls[pi->rlvlno]; pi->rlvlno < pi->picomp->numrlvls && pi->rlvlno < pchg->rlvlnoend; ++pi->rlvlno, ++pi->pirlvl) { if (pi->pirlvl->numprcs == 0) { continue; } r = pi->picomp->numrlvls - 1 - pi->rlvlno; trx0 = JPC_CEILDIV(pi->xstart, pi->picomp->hsamp << r); try0 = JPC_CEILDIV(pi->ystart, pi->picomp->vsamp << r); rpx = r + pi->pirlvl->prcwidthexpn; rpy = r + pi->pirlvl->prcheightexpn; if (((pi->x == pi->xstart && ((trx0 << r) % (1 << rpx))) || !(pi->x % (pi->picomp->hsamp << rpx))) && ((pi->y == pi->ystart && ((try0 << r) % (1 << rpy))) || !(pi->y % (pi->picomp->vsamp << rpy)))) { prchind = JPC_FLOORDIVPOW2(JPC_CEILDIV(pi->x, pi->picomp->hsamp << r), pi->pirlvl->prcwidthexpn) - JPC_FLOORDIVPOW2(trx0, pi->pirlvl->prcwidthexpn); prcvind = JPC_FLOORDIVPOW2(JPC_CEILDIV(pi->y, pi->picomp->vsamp << r), pi->pirlvl->prcheightexpn) - JPC_FLOORDIVPOW2(try0, pi->pirlvl->prcheightexpn); pi->prcno = prcvind * pi->pirlvl->numhprcs + prchind; assert(pi->prcno < pi->pirlvl->numprcs); for (pi->lyrno = 0; pi->lyrno < pi->numlyrs && pi->lyrno < JAS_CAST(int, pchg->lyrnoend); ++pi->lyrno) { prclyrno = &pi->pirlvl->prclyrnos[pi->prcno]; if (pi->lyrno >= *prclyrno) { ++(*prclyrno); return 0; } skip: ; } } } } } } return 1; }
1
189,460
ZEND_API void *zend_object_store_get_object_by_handle(zend_object_handle handle TSRMLS_DC) { return EG(objects_store).object_buckets[handle].bucket.obj.object; }
0
244,317
static vm_fault_t hugetlb_vm_op_fault(struct vm_fault *vmf) { BUG(); return 0; }
0
112,881
static int unix_accept(struct socket *sock, struct socket *newsock, int flags) { struct sock *sk = sock->sk; struct sock *tsk; struct sk_buff *skb; int err; err = -EOPNOTSUPP; if (sock->type != SOCK_STREAM && sock->type != SOCK_SEQPACKET) goto out; err = -EINVAL; if (sk->sk_state != TCP_LISTEN) goto out; /* If socket state is TCP_LISTEN it cannot change (for now...), * so that no locks are necessary. */ skb = skb_recv_datagram(sk, 0, flags&O_NONBLOCK, &err); if (!skb) { /* This means receive shutdown. */ if (err == 0) err = -EINVAL; goto out; } tsk = skb->sk; skb_free_datagram(sk, skb); wake_up_interruptible(&unix_sk(sk)->peer_wait); /* attach accepted sock to socket */ unix_state_lock(tsk); newsock->state = SS_CONNECTED; sock_graft(tsk, newsock); unix_state_unlock(tsk); return 0; out: return err; }
0
402,034
e1000e_start_recv(E1000ECore *core) { int i; trace_e1000e_rx_start_recv(); for (i = 0; i <= core->max_queue_num; i++) { qemu_flush_queued_packets(qemu_get_subqueue(core->owner_nic, i)); } }
0
399,043
bash_servicename_completion_function (text, state) const char *text; int state; { #if defined (__WIN32__) || defined (__OPENNT) || !defined (HAVE_GETSERVENT) return ((char *)NULL); #else static char *sname = (char *)NULL; static struct servent *srvent; static int snamelen, firstc; char *value; char **alist, *aentry; int afound; if (state == 0) { FREE (sname); firstc = *text; sname = savestring (text); snamelen = strlen (sname); setservent (0); } while (srvent = getservent ()) { afound = 0; if (snamelen == 0 || (STREQN (sname, srvent->s_name, snamelen))) break; /* Not primary, check aliases */ for (alist = srvent->s_aliases; *alist; alist++) { aentry = *alist; if (STREQN (sname, aentry, snamelen)) { afound = 1; break; } } if (afound) break; } if (srvent == 0) { endservent (); return ((char *)NULL); } value = afound ? savestring (aentry) : savestring (srvent->s_name); return value; #endif }
0
353,105
rsvg_new_use (void) { RsvgNodeUse *use; use = g_new (RsvgNodeUse, 1); _rsvg_node_init (&use->super); use->super.draw = rsvg_node_use_draw; use->super.set_atts = rsvg_node_use_set_atts; use->x = _rsvg_css_parse_length ("0"); use->y = _rsvg_css_parse_length ("0"); use->w = _rsvg_css_parse_length ("0"); use->h = _rsvg_css_parse_length ("0"); use->link = NULL; return (RsvgNode *) use; }
1
454,153
TEST(FieldPath, NoOptimizationForRootFieldPathWithDottedPath) { intrusive_ptr<ExpressionContextForTest> expCtx(new ExpressionContextForTest()); intrusive_ptr<ExpressionFieldPath> expression = ExpressionFieldPath::parse(expCtx, "$$ROOT.x.y", expCtx->variablesParseState); // An attempt to optimize returns the Expression itself. ASSERT_EQUALS(expression, expression->optimize()); }
0
46,241
GF_Err sdtp_Read(GF_Box *s, GF_BitStream *bs) { GF_SampleDependencyTypeBox *ptr = (GF_SampleDependencyTypeBox*)s; /*out-of-order sdtp, assume no padding at the end*/ if (!ptr->sampleCount) ptr->sampleCount = (u32) ptr->size; else if (ptr->sampleCount > (u32) ptr->size) return GF_ISOM_INVALID_FILE; ptr->sample_info = (u8 *) gf_malloc(sizeof(u8)*ptr->sampleCount); gf_bs_read_data(bs, (char*)ptr->sample_info, ptr->sampleCount); ISOM_DECREASE_SIZE(ptr, ptr->sampleCount); return GF_OK; }
0
380,843
void XMLRPC_Free(void* mem) { my_free(mem); }
0
371,681
extract_archive_thread (GSimpleAsyncResult *result, GObject *object, GCancellable *cancellable) { ExtractData *extract_data; LoadData *load_data; GHashTable *checked_folders; struct archive *a; struct archive_entry *entry; int r; extract_data = g_simple_async_result_get_op_res_gpointer (result); load_data = LOAD_DATA (extract_data); checked_folders = g_hash_table_new_full (g_file_hash, (GEqualFunc) g_file_equal, g_object_unref, NULL); fr_archive_progress_set_total_files (load_data->archive, extract_data->n_files_to_extract); a = archive_read_new (); archive_read_support_filter_all (a); archive_read_support_format_all (a); archive_read_open (a, load_data, load_data_open, load_data_read, load_data_close); while ((r = archive_read_next_header (a, &entry)) == ARCHIVE_OK) { const char *pathname; char *fullpath; const char *relative_path; GFile *file; GFile *parent; GOutputStream *ostream; const void *buffer; size_t buffer_size; int64_t offset; GError *local_error = NULL; __LA_MODE_T filetype; if (g_cancellable_is_cancelled (cancellable)) break; pathname = archive_entry_pathname (entry); if (! extract_data_get_extraction_requested (extract_data, pathname)) { archive_read_data_skip (a); continue; } fullpath = (*pathname == '/') ? g_strdup (pathname) : g_strconcat ("/", pathname, NULL); relative_path = _g_path_get_relative_basename_safe (fullpath, extract_data->base_dir, extract_data->junk_paths); if (relative_path == NULL) { archive_read_data_skip (a); continue; } file = g_file_get_child (extract_data->destination, relative_path); /* honor the skip_older and overwrite options */ if (extract_data->skip_older || ! extract_data->overwrite) { GFileInfo *info; info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME "," G_FILE_ATTRIBUTE_TIME_MODIFIED, G_FILE_QUERY_INFO_NONE, cancellable, &local_error); if (info != NULL) { gboolean skip = FALSE; if (! extract_data->overwrite) { skip = TRUE; } else if (extract_data->skip_older) { GTimeVal modification_time; g_file_info_get_modification_time (info, &modification_time); if (archive_entry_mtime (entry) < modification_time.tv_sec) skip = TRUE; } g_object_unref (info); if (skip) { g_object_unref (file); archive_read_data_skip (a); fr_archive_progress_inc_completed_bytes (load_data->archive, archive_entry_size_is_set (entry) ? archive_entry_size (entry) : 0); if ((extract_data->file_list != NULL) && (--extract_data->n_files_to_extract == 0)) { r = ARCHIVE_EOF; break; } continue; } } else { if (! g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) { load_data->error = local_error; g_object_unref (info); break; } g_error_free (local_error); } } fr_archive_progress_inc_completed_files (load_data->archive, 1); /* create the file parents */ parent = g_file_get_parent (file); if ((parent != NULL) && (g_hash_table_lookup (checked_folders, parent) == NULL) && ! g_file_query_exists (parent, cancellable)) { if (g_file_make_directory_with_parents (parent, cancellable, &load_data->error)) { GFile *grandparent; grandparent = g_object_ref (parent); while (grandparent != NULL) { if (g_hash_table_lookup (checked_folders, grandparent) == NULL) g_hash_table_insert (checked_folders, grandparent, GINT_TO_POINTER (1)); grandparent = g_file_get_parent (grandparent); } } } g_object_unref (parent); /* create the file */ filetype = archive_entry_filetype (entry); if (load_data->error == NULL) { const char *linkname; linkname = archive_entry_hardlink (entry); if (linkname != NULL) { char *link_fullpath; const char *relative_path; GFile *link_file; char *oldname; char *newname; int r; link_fullpath = (*linkname == '/') ? g_strdup (linkname) : g_strconcat ("/", linkname, NULL); relative_path = _g_path_get_relative_basename_safe (link_fullpath, extract_data->base_dir, extract_data->junk_paths); if (relative_path == NULL) { g_free (link_fullpath); archive_read_data_skip (a); continue; } link_file = g_file_get_child (extract_data->destination, relative_path); oldname = g_file_get_path (link_file); newname = g_file_get_path (file); if ((oldname != NULL) && (newname != NULL)) r = link (oldname, newname); else r = -1; if (r == 0) { __LA_INT64_T filesize; if (archive_entry_size_is_set (entry)) filesize = archive_entry_size (entry); else filesize = -1; if (filesize > 0) filetype = AE_IFREG; /* treat as a regular file to save the data */ } else { char *uri; char *msg; uri = g_file_get_uri (file); msg = g_strdup_printf ("Could not create the hard link %s", uri); load_data->error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, msg); g_free (msg); g_free (uri); } g_free (newname); g_free (oldname); g_object_unref (link_file); g_free (link_fullpath); } } if (load_data->error == NULL) { switch (filetype) { case AE_IFDIR: if (! g_file_make_directory (file, cancellable, &local_error)) { if (! g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_EXISTS)) load_data->error = g_error_copy (local_error); g_error_free (local_error); } else _g_file_set_attributes_from_entry (file, entry, extract_data, cancellable); archive_read_data_skip (a); break; case AE_IFREG: ostream = (GOutputStream *) g_file_replace (file, NULL, FALSE, G_FILE_CREATE_REPLACE_DESTINATION, cancellable, &load_data->error); if (ostream == NULL) break; while ((r = archive_read_data_block (a, &buffer, &buffer_size, &offset)) == ARCHIVE_OK) { if (g_output_stream_write (ostream, buffer, buffer_size, cancellable, &load_data->error) == -1) break; fr_archive_progress_inc_completed_bytes (load_data->archive, buffer_size); } _g_object_unref (ostream); if (r != ARCHIVE_EOF) load_data->error = g_error_new_literal (FR_ERROR, FR_ERROR_COMMAND_ERROR, archive_error_string (a)); else _g_file_set_attributes_from_entry (file, entry, extract_data, cancellable); break; case AE_IFLNK: if (! g_file_make_symbolic_link (file, archive_entry_symlink (entry), cancellable, &local_error)) { if (! g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_EXISTS)) load_data->error = g_error_copy (local_error); g_error_free (local_error); } archive_read_data_skip (a); break; default: archive_read_data_skip (a); break; } } g_object_unref (file); g_free (fullpath); if (load_data->error != NULL) break; if ((extract_data->file_list != NULL) && (--extract_data->n_files_to_extract == 0)) { r = ARCHIVE_EOF; break; } } if ((load_data->error == NULL) && (r != ARCHIVE_EOF)) load_data->error = g_error_new_literal (FR_ERROR, FR_ERROR_COMMAND_ERROR, archive_error_string (a)); if (load_data->error == NULL) g_cancellable_set_error_if_cancelled (cancellable, &load_data->error); if (load_data->error != NULL) g_simple_async_result_set_from_error (result, load_data->error); g_hash_table_unref (checked_folders); archive_read_free (a); extract_data_free (extract_data); }
0
446,850
_dbus_read_socket (DBusSocket fd, DBusString *buffer, int count) { return _dbus_read (fd.fd, buffer, count); }
0
326,644
static uint32_t nvdimm_get_max_xfer_label_size(void) { uint32_t max_get_size, max_set_size, dsm_memory_size = 4096; /* * the max data ACPI can read one time which is transferred by * the response of 'Get Namespace Label Data' function. */ max_get_size = dsm_memory_size - sizeof(NvdimmFuncGetLabelDataOut); /* * the max data ACPI can write one time which is transferred by * 'Set Namespace Label Data' function. */ max_set_size = dsm_memory_size - offsetof(NvdimmDsmIn, arg3) - sizeof(NvdimmFuncSetLabelDataIn); return MIN(max_get_size, max_set_size); }
0
189,962
void TabHelper::CreateApplicationShortcuts() { DCHECK(CanCreateApplicationShortcuts()); if (pending_web_app_action_ != NONE) return; GetApplicationInfo(CREATE_SHORTCUT); }
0
173,061
SynchronizeVisualPropertiesMessageFilter() : content::BrowserMessageFilter(kMessageClassesToFilter, arraysize(kMessageClassesToFilter)), screen_space_rect_run_loop_(std::make_unique<base::RunLoop>()), screen_space_rect_received_(false) {}
0
389,283
NCR_ModifyMaxpoll(NCR_Instance inst, int new_maxpoll) { if (new_maxpoll < MIN_POLL || new_maxpoll > MAX_POLL) return; inst->maxpoll = new_maxpoll; LOG(LOGS_INFO, LOGF_NtpCore, "Source %s new maxpoll %d", UTI_IPToString(&inst->remote_addr.ip_addr), new_maxpoll); if (inst->minpoll > inst->maxpoll) NCR_ModifyMinpoll(inst, inst->maxpoll); }
0
191,458
dissect_rpcap_filterbpf_insn (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, gint offset) { proto_tree *tree, *code_tree; proto_item *ti, *code_ti; guint8 inst_class; ti = proto_tree_add_item (parent_tree, hf_filterbpf_insn, tvb, offset, 8, ENC_NA); tree = proto_item_add_subtree (ti, ett_filterbpf_insn); code_ti = proto_tree_add_item (tree, hf_code, tvb, offset, 2, ENC_BIG_ENDIAN); code_tree = proto_item_add_subtree (code_ti, ett_filterbpf_insn_code); proto_tree_add_item (code_tree, hf_code_class, tvb, offset, 2, ENC_BIG_ENDIAN); inst_class = tvb_get_guint8 (tvb, offset + 1) & 0x07; proto_item_append_text (ti, ": %s", val_to_str_const (inst_class, bpf_class, "")); switch (inst_class) { case 0x00: /* ld */ case 0x01: /* ldx */ proto_tree_add_item (code_tree, hf_code_ld_size, tvb, offset, 2, ENC_BIG_ENDIAN); proto_tree_add_item (code_tree, hf_code_ld_mode, tvb, offset, 2, ENC_BIG_ENDIAN); break; case 0x04: /* alu */ proto_tree_add_item (code_tree, hf_code_src, tvb, offset, 2, ENC_BIG_ENDIAN); proto_tree_add_item (code_tree, hf_code_alu_op, tvb, offset, 2, ENC_BIG_ENDIAN); break; case 0x05: /* jmp */ proto_tree_add_item (code_tree, hf_code_src, tvb, offset, 2, ENC_BIG_ENDIAN); proto_tree_add_item (code_tree, hf_code_jmp_op, tvb, offset, 2, ENC_BIG_ENDIAN); break; case 0x06: /* ret */ proto_tree_add_item (code_tree, hf_code_rval, tvb, offset, 2, ENC_BIG_ENDIAN); break; case 0x07: /* misc */ proto_tree_add_item (code_tree, hf_code_misc_op, tvb, offset, 2, ENC_BIG_ENDIAN); break; default: proto_tree_add_item (code_tree, hf_code_fields, tvb, offset, 2, ENC_BIG_ENDIAN); break; } offset += 2; proto_tree_add_item (tree, hf_jt, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; proto_tree_add_item (tree, hf_jf, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; proto_tree_add_item (tree, hf_instr_value, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; return offset; }
0
45,643
static inline ut16 r_read_at_be16(const void *src, size_t offset) { const ut8 *s = (const ut8*)src + offset; return r_read_be16 (s); }
0
151,609
static void clear_exception(struct pstore *ps, uint32_t index) { struct disk_exception *de = get_exception(ps, index); /* clear it */ de->old_chunk = 0; de->new_chunk = 0; }
0
206,217
void SyncManager::SyncInternal::OnServerConnectionEvent( const ServerConnectionEvent& event) { DCHECK(thread_checker_.CalledOnValidThread()); allstatus_.HandleServerConnectionEvent(event); if (event.connection_code == browser_sync::HttpResponse::SERVER_CONNECTION_OK) { ObserverList<SyncManager::Observer> temp_obs_list; CopyObservers(&temp_obs_list); FOR_EACH_OBSERVER(SyncManager::Observer, temp_obs_list, OnAuthError(AuthError::None())); } if (event.connection_code == browser_sync::HttpResponse::SYNC_AUTH_ERROR) { observing_ip_address_changes_ = false; ObserverList<SyncManager::Observer> temp_obs_list; CopyObservers(&temp_obs_list); FOR_EACH_OBSERVER(SyncManager::Observer, temp_obs_list, OnAuthError(AuthError(AuthError::INVALID_GAIA_CREDENTIALS))); } if (event.connection_code == browser_sync::HttpResponse::SYNC_SERVER_ERROR) { ObserverList<SyncManager::Observer> temp_obs_list; CopyObservers(&temp_obs_list); FOR_EACH_OBSERVER(SyncManager::Observer, temp_obs_list, OnAuthError(AuthError(AuthError::CONNECTION_FAILED))); } }
0
284,523
static void cmdproc_thread_cleanup(void *arg) { struct tcmu_device *dev = arg; struct tcmur_handler *rhandler = tcmu_get_runner_handler(dev); rhandler->close(dev); }
0
350,397
int cancel_extop( Operation *op, SlapReply *rs ) { Operation *o; int rc; int opid; BerElementBuffer berbuf; BerElement *ber = (BerElement *)&berbuf; assert( ber_bvcmp( &slap_EXOP_CANCEL, &op->ore_reqoid ) == 0 ); if ( op->ore_reqdata == NULL ) { rs->sr_text = "no message ID supplied"; return LDAP_PROTOCOL_ERROR; } if ( op->ore_reqdata->bv_len == 0 ) { rs->sr_text = "empty request data field"; return LDAP_PROTOCOL_ERROR; } /* ber_init2 uses reqdata directly, doesn't allocate new buffers */ ber_init2( ber, op->ore_reqdata, 0 ); if ( ber_scanf( ber, "{i}", &opid ) == LBER_ERROR ) { rs->sr_text = "message ID parse failed"; return LDAP_PROTOCOL_ERROR; } Statslog( LDAP_DEBUG_STATS, "%s CANCEL msg=%d\n", op->o_log_prefix, opid, 0, 0, 0 ); if ( opid < 0 ) { rs->sr_text = "message ID invalid"; return LDAP_PROTOCOL_ERROR; } ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex ); if ( op->o_abandon ) { /* FIXME: Should instead reject the cancel/abandon of this op, but * it seems unsafe to reset op->o_abandon once it is set. ITS#6138. */ rc = LDAP_OPERATIONS_ERROR; rs->sr_text = "tried to abandon or cancel this operation"; goto out; } LDAP_STAILQ_FOREACH( o, &op->o_conn->c_pending_ops, o_next ) { if ( o->o_msgid == opid ) { /* TODO: We could instead remove the cancelled operation * from c_pending_ops like Abandon does, and send its * response here. Not if it is pending because of a * congested connection though. */ rc = LDAP_CANNOT_CANCEL; rs->sr_text = "too busy for Cancel, try Abandon instead"; goto out; } } LDAP_STAILQ_FOREACH( o, &op->o_conn->c_ops, o_next ) { if ( o->o_msgid == opid ) { break; } } if ( o == NULL ) { rc = LDAP_NO_SUCH_OPERATION; rs->sr_text = "message ID not found"; } else if ( o->o_tag == LDAP_REQ_BIND || o->o_tag == LDAP_REQ_UNBIND || o->o_tag == LDAP_REQ_ABANDON ) { rc = LDAP_CANNOT_CANCEL; } else if ( o->o_cancel != SLAP_CANCEL_NONE ) { rc = LDAP_OPERATIONS_ERROR; rs->sr_text = "message ID already being cancelled"; #if 0 } else if ( o->o_abandon ) { /* TODO: Would this break something when * o_abandon="suppress response"? (ITS#6138) */ rc = LDAP_TOO_LATE; #endif } else { rc = LDAP_SUCCESS; o->o_cancel = SLAP_CANCEL_REQ; o->o_abandon = 1; } out: ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex ); if ( rc == LDAP_SUCCESS ) { LDAP_STAILQ_FOREACH( op->o_bd, &backendDB, be_next ) { if( !op->o_bd->be_cancel ) continue; op->oq_cancel.rs_msgid = opid; if ( op->o_bd->be_cancel( op, rs ) == LDAP_SUCCESS ) { return LDAP_SUCCESS; } } do { /* Fake a cond_wait with thread_yield, then * verify the result properly mutex-protected. */ while ( o->o_cancel == SLAP_CANCEL_REQ ) ldap_pvt_thread_yield(); ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex ); rc = o->o_cancel; ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex ); } while ( rc == SLAP_CANCEL_REQ ); if ( rc == SLAP_CANCEL_ACK ) { rc = LDAP_SUCCESS; } o->o_cancel = SLAP_CANCEL_DONE; } return rc; }
1
475,621
START_TEST(virgl_test_transfer_read_unbound_res) { int ret; struct virgl_box box; ret = virgl_renderer_transfer_read_iov(1, 1, 0, 1, 1, &box, 0, NULL, 0); ck_assert_int_eq(ret, EINVAL); }
0
208,836
void IndexedDBDatabase::SetIndexKeys( IndexedDBTransaction* transaction, int64_t object_store_id, std::unique_ptr<IndexedDBKey> primary_key, const std::vector<IndexedDBIndexKeys>& index_keys) { DCHECK(transaction); IDB_TRACE1("IndexedDBDatabase::SetIndexKeys", "txn.id", transaction->id()); DCHECK_EQ(transaction->mode(), blink::kWebIDBTransactionModeVersionChange); IndexedDBBackingStore::RecordIdentifier record_identifier; bool found = false; Status s = backing_store_->KeyExistsInObjectStore( transaction->BackingStoreTransaction(), metadata_.id, object_store_id, *primary_key, &record_identifier, &found); if (!s.ok()) { ReportErrorWithDetails(s, "Internal error setting index keys."); return; } if (!found) { transaction->Abort(IndexedDBDatabaseError( blink::kWebIDBDatabaseExceptionUnknownError, "Internal error setting index keys for object store.")); return; } std::vector<std::unique_ptr<IndexWriter>> index_writers; base::string16 error_message; bool obeys_constraints = false; DCHECK(metadata_.object_stores.find(object_store_id) != metadata_.object_stores.end()); const IndexedDBObjectStoreMetadata& object_store_metadata = metadata_.object_stores[object_store_id]; bool backing_store_success = MakeIndexWriters(transaction, backing_store_.get(), id(), object_store_metadata, *primary_key, false, index_keys, &index_writers, &error_message, &obeys_constraints); if (!backing_store_success) { transaction->Abort(IndexedDBDatabaseError( blink::kWebIDBDatabaseExceptionUnknownError, "Internal error: backing store error updating index keys.")); return; } if (!obeys_constraints) { transaction->Abort(IndexedDBDatabaseError( blink::kWebIDBDatabaseExceptionConstraintError, error_message)); return; } for (const auto& writer : index_writers) { writer->WriteIndexKeys(record_identifier, backing_store_.get(), transaction->BackingStoreTransaction(), id(), object_store_id); } }
0
296,608
ia64_patch (u64 insn_addr, u64 mask, u64 val) { u64 m0, m1, v0, v1, b0, b1, *b = (u64 *) (insn_addr & -16); # define insn_mask ((1UL << 41) - 1) unsigned long shift; b0 = b[0]; b1 = b[1]; shift = 5 + 41 * (insn_addr % 16); /* 5 bits of template, then 3 x 41-bit instructions */ if (shift >= 64) { m1 = mask << (shift - 64); v1 = val << (shift - 64); } else { m0 = mask << shift; m1 = mask >> (64 - shift); v0 = val << shift; v1 = val >> (64 - shift); b[0] = (b0 & ~m0) | (v0 & m0); } b[1] = (b1 & ~m1) | (v1 & m1); }
0
356,402
static void try_to_follow_renames(struct tree_desc *t1, struct tree_desc *t2, const char *base, struct diff_options *opt) { struct diff_options diff_opts; struct diff_queue_struct *q = &diff_queued_diff; struct diff_filepair *choice; const char *paths[1]; int i; /* Remove the file creation entry from the diff queue, and remember it */ choice = q->queue[0]; q->nr = 0; diff_setup(&diff_opts); DIFF_OPT_SET(&diff_opts, RECURSIVE); diff_opts.detect_rename = DIFF_DETECT_RENAME; diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT; diff_opts.single_follow = opt->paths[0]; diff_opts.break_opt = opt->break_opt; paths[0] = NULL; diff_tree_setup_paths(paths, &diff_opts); if (diff_setup_done(&diff_opts) < 0) die("unable to set up diff options to follow renames"); diff_tree(t1, t2, base, &diff_opts); diffcore_std(&diff_opts); diff_tree_release_paths(&diff_opts); /* Go through the new set of filepairing, and see if we find a more interesting one */ for (i = 0; i < q->nr; i++) { struct diff_filepair *p = q->queue[i]; /* * Found a source? Not only do we use that for the new * diff_queued_diff, we will also use that as the path in * the future! */ if ((p->status == 'R' || p->status == 'C') && !strcmp(p->two->path, opt->paths[0])) { /* Switch the file-pairs around */ q->queue[i] = choice; choice = p; /* Update the path we use from now on.. */ diff_tree_release_paths(opt); opt->paths[0] = xstrdup(p->one->path); diff_tree_setup_paths(opt->paths, opt); break; } } /* * Then, discard all the non-relevane file pairs... */ for (i = 0; i < q->nr; i++) { struct diff_filepair *p = q->queue[i]; diff_free_filepair(p); } /* * .. and re-instate the one we want (which might be either the * original one, or the rename/copy we found) */ q->queue[0] = choice; q->nr = 1; }
0
451,159
void clearInline() override { memset(inline_headers_, 0, inlineHeadersSize()); }
0
520,018
inline ulong query_start_sec_part() { query_start_sec_part_used=1; return start_time_sec_part; }
0
763
static void dissect_q931_IEs ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * root_tree , proto_tree * q931_tree , gboolean is_over_ip , int offset , int initial_codeset ) { proto_item * ti ; proto_tree * ie_tree = NULL ; guint8 info_element ; guint8 dummy ; guint16 info_element_len ; int codeset , locked_codeset ; gboolean non_locking_shift , first_segment ; tvbuff_t * h225_tvb , * next_tvb ; e164_info_t e164_info ; e164_info . e164_number_type = NONE ; e164_info . nature_of_address = NONE ; e164_info . E164_number_str = "" ; e164_info . E164_number_length = NONE ; codeset = locked_codeset = initial_codeset ; first_segment = FALSE ; while ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) { info_element = tvb_get_guint8 ( tvb , offset ) ; if ( ( info_element & Q931_IE_SO_MASK ) && ( ( info_element & Q931_IE_SO_IDENTIFIER_MASK ) == Q931_IE_SHIFT ) ) { non_locking_shift = info_element & Q931_IE_SHIFT_NON_LOCKING ; codeset = info_element & Q931_IE_SHIFT_CODESET ; if ( ! non_locking_shift ) locked_codeset = codeset ; if ( q931_tree != NULL ) { proto_tree_add_uint_format ( q931_tree , hf_q931_locking_codeset , tvb , offset , 1 , codeset , "%s shift to codeset %u: %s" , ( non_locking_shift ? "Non-locking" : "Locking" ) , codeset , val_to_str ( codeset , q931_codeset_vals , "Unknown (0x%02X)" ) ) ; } offset += 1 ; continue ; } if ( info_element & Q931_IE_SO_MASK ) { if ( dissector_get_uint_handle ( codeset_dissector_table , codeset ) || dissector_get_uint_handle ( ie_dissector_table , ( codeset << 8 ) | ( info_element & Q931_IE_SO_IDENTIFIER_MASK ) ) ) { next_tvb = tvb_new_subset_length ( tvb , offset , 1 ) ; if ( dissector_try_uint ( ie_dissector_table , ( codeset << 8 ) | ( info_element & Q931_IE_SO_IDENTIFIER_MASK ) , next_tvb , pinfo , q931_tree ) || dissector_try_uint ( codeset_dissector_table , codeset , next_tvb , pinfo , q931_tree ) ) { offset += 1 ; codeset = locked_codeset ; continue ; } } switch ( ( codeset << 8 ) | ( info_element & Q931_IE_SO_IDENTIFIER_MASK ) ) { case CS0 | Q931_IE_MORE_DATA_OR_SEND_COMP : switch ( info_element ) { case Q931_IE_MORE_DATA : proto_tree_add_item ( q931_tree , hf_q931_more_data , tvb , offset , 1 , ENC_NA ) ; break ; case Q931_IE_SENDING_COMPLETE : proto_tree_add_item ( q931_tree , hf_q931_sending_complete , tvb , offset , 1 , ENC_NA ) ; break ; default : proto_tree_add_expert_format ( q931_tree , pinfo , & ei_q931_information_element , tvb , offset , 1 , "Unknown information element (0x%02X)" , info_element ) ; break ; } break ; case CS0 | Q931_IE_CONGESTION_LEVEL : proto_tree_add_item ( q931_tree , hf_q931_congestion_level , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; break ; case CS0 | Q931_IE_REPEAT_INDICATOR : proto_tree_add_item ( q931_tree , hf_q931_repeat_indicator , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; break ; default : proto_tree_add_expert_format ( q931_tree , pinfo , & ei_q931_information_element , tvb , offset , 1 , "Unknown information element (0x%02X)" , info_element ) ; break ; } offset += 1 ; codeset = locked_codeset ; continue ; } if ( is_over_ip && tvb_bytes_exist ( tvb , offset , 4 ) && codeset == 0 && tvb_get_guint8 ( tvb , offset ) == Q931_IE_USER_USER && tvb_get_guint8 ( tvb , offset + 3 ) == Q931_PROTOCOL_DISCRIMINATOR_ASN1 ) { info_element_len = tvb_get_ntohs ( tvb , offset + 1 ) ; if ( q931_tree != NULL ) { ie_tree = proto_tree_add_subtree ( q931_tree , tvb , offset , 1 + 2 + info_element_len , ett_q931_ie [ info_element ] , NULL , val_to_str ( info_element , q931_info_element_vals [ codeset ] , "Unknown information element (0x%02X)" ) ) ; proto_tree_add_uint_format_value ( ie_tree , hf_q931_information_element , tvb , offset , 1 , info_element , "%s" , val_to_str ( info_element , q931_info_element_vals [ codeset ] , "Unknown (0x%02X)" ) ) ; proto_tree_add_item ( ie_tree , hf_q931_information_element_len , tvb , offset + 1 , 2 , ENC_BIG_ENDIAN ) ; proto_tree_add_item ( ie_tree , hf_q931_user_protocol_discriminator , tvb , offset + 3 , 1 , ENC_NA ) ; } if ( info_element_len > 1 ) { if ( ! pinfo -> can_desegment ) { info_element_len = MIN ( info_element_len , tvb_captured_length_remaining ( tvb , offset + 3 ) ) ; } if ( h225_handle != NULL ) { h225_tvb = tvb_new_subset_length ( tvb , offset + 4 , info_element_len - 1 ) ; call_dissector ( h225_handle , h225_tvb , pinfo , root_tree ) ; } else { proto_tree_add_item ( ie_tree , hf_q931_user_information_bytes , tvb , offset + 4 , info_element_len - 1 , ENC_NA ) ; } } offset += 1 + 2 + info_element_len ; } else { info_element_len = tvb_get_guint8 ( tvb , offset + 1 ) ; if ( first_segment && ( tvb_reported_length_remaining ( tvb , offset + 2 ) < info_element_len ) ) { proto_tree_add_expert ( q931_tree , pinfo , & ei_q931_incomplete_ie , tvb , offset , - 1 ) ; break ; } if ( dissector_get_uint_handle ( codeset_dissector_table , codeset ) || dissector_get_uint_handle ( ie_dissector_table , ( codeset << 8 ) | info_element ) ) { next_tvb = tvb_new_subset_length ( tvb , offset , info_element_len + 2 ) ; if ( dissector_try_uint ( ie_dissector_table , ( codeset << 8 ) | info_element , next_tvb , pinfo , q931_tree ) || dissector_try_uint ( codeset_dissector_table , codeset , next_tvb , pinfo , q931_tree ) ) { offset += 2 + info_element_len ; codeset = locked_codeset ; continue ; } } ie_tree = proto_tree_add_subtree ( q931_tree , tvb , offset , 1 + 1 + info_element_len , ett_q931_ie [ info_element ] , & ti , val_to_str ( info_element , q931_info_element_vals [ codeset ] , "Unknown information element (0x%02X)" ) ) ; proto_tree_add_uint_format_value ( ie_tree , hf_q931_information_element , tvb , offset , 1 , info_element , "%s" , val_to_str ( info_element , q931_info_element_vals [ codeset ] , "Unknown (0x%02X)" ) ) ; proto_tree_add_uint ( ie_tree , hf_q931_information_element_len , tvb , offset + 1 , 1 , info_element_len ) ; if ( ( ( codeset << 8 ) | info_element ) == ( CS0 | Q931_IE_SEGMENTED_MESSAGE ) ) { dissect_q931_segmented_message_ie ( tvb , pinfo , offset + 2 , info_element_len , ie_tree , ti ) ; col_append_fstr ( pinfo -> cinfo , COL_INFO , " of %s" , val_to_str_ext ( tvb_get_guint8 ( tvb , offset + 3 ) , & q931_message_type_vals_ext , "Unknown message type (0x%02X)" ) ) ; if ( tvb_get_guint8 ( tvb , offset + 2 ) & 0x80 ) { first_segment = TRUE ; } else { proto_tree_add_item ( q931_tree , hf_q931_message_segment , tvb , offset + 4 , - 1 , ENC_NA ) ; info_element_len += tvb_reported_length_remaining ( tvb , offset + 4 ) ; } } else { switch ( ( codeset << 8 ) | info_element ) { case CS0 | Q931_IE_BEARER_CAPABILITY : case CS0 | Q931_IE_LOW_LAYER_COMPAT : if ( q931_tree != NULL ) { dissect_q931_bearer_capability_ie ( tvb , offset + 2 , info_element_len , ie_tree ) ; } break ; case CS0 | Q931_IE_CAUSE : dissect_q931_cause_ie_unsafe ( tvb , offset + 2 , info_element_len , ie_tree , hf_q931_cause_value , & dummy , q931_info_element_vals0 ) ; break ; case CS0 | Q931_IE_CHANGE_STATUS : if ( q931_tree != NULL ) { dissect_q931_change_status_ie ( tvb , offset + 2 , info_element_len , ie_tree ) ; } break ; case CS0 | Q931_IE_CALL_STATE : if ( q931_tree != NULL ) { dissect_q931_call_state_ie ( tvb , offset + 2 , info_element_len , ie_tree ) ; } break ; case CS0 | Q931_IE_CHANNEL_IDENTIFICATION : if ( q931_tree != NULL ) { dissect_q931_channel_identification_ie ( tvb , offset + 2 , info_element_len , ie_tree ) ; } break ; case CS0 | Q931_IE_PROGRESS_INDICATOR : if ( q931_tree != NULL ) { dissect_q931_progress_indicator_ie ( tvb , offset + 2 , info_element_len , ie_tree ) ; } break ; case CS0 | Q931_IE_NETWORK_SPECIFIC_FACIL : case CS0 | Q931_IE_TRANSIT_NETWORK_SEL : if ( q931_tree != NULL ) { dissect_q931_ns_facilities_ie ( tvb , offset + 2 , info_element_len , ie_tree ) ; } break ; case CS0 | Q931_IE_NOTIFICATION_INDICATOR : if ( q931_tree != NULL ) { dissect_q931_notification_indicator_ie ( tvb , offset + 2 , info_element_len , ie_tree ) ; } break ; case CS0 | Q931_IE_DISPLAY : if ( q931_tree != NULL ) { dissect_q931_ia5_ie ( tvb , offset + 2 , info_element_len , ie_tree , hf_q931_display_information ) ; } break ; case CS0 | Q931_IE_DATE_TIME : dissect_q931_date_time_ie ( tvb , pinfo , offset + 2 , info_element_len , ie_tree ) ; break ; case CS0 | Q931_IE_KEYPAD_FACILITY : if ( q931_tree != NULL ) { dissect_q931_ia5_ie ( tvb , offset + 2 , info_element_len , ie_tree , hf_q931_keypad_facility ) ; } break ; case CS0 | Q931_IE_SIGNAL : dissect_q931_signal_ie ( tvb , pinfo , offset + 2 , info_element_len , ie_tree , ti ) ; break ; case CS0 | Q931_IE_INFORMATION_RATE : dissect_q931_information_rate_ie ( tvb , pinfo , offset + 2 , info_element_len , ie_tree , ti ) ; break ; case CS0 | Q931_IE_E2E_TRANSIT_DELAY : dissect_q931_e2e_transit_delay_ie ( tvb , pinfo , offset + 2 , info_element_len , ie_tree , ti ) ; break ; case CS0 | Q931_IE_TD_SELECTION_AND_INT : dissect_q931_td_selection_and_int_ie ( tvb , pinfo , offset + 2 , info_element_len , ie_tree , ti ) ; break ; case CS0 | Q931_IE_PL_BINARY_PARAMETERS : if ( q931_tree != NULL ) { dissect_q931_pl_binary_parameters_ie ( tvb , offset + 2 , info_element_len , ie_tree ) ; } break ; case CS0 | Q931_IE_PL_WINDOW_SIZE : if ( q931_tree != NULL ) { dissect_q931_pl_window_size_ie ( tvb , offset + 2 , info_element_len , ie_tree ) ; } break ; case CS0 | Q931_IE_PACKET_SIZE : if ( q931_tree != NULL ) { dissect_q931_packet_size_ie ( tvb , offset + 2 , info_element_len , ie_tree ) ; } break ; case CS0 | Q931_IE_CUG : if ( q931_tree != NULL ) { dissect_q931_cug_ie ( tvb , offset + 2 , info_element_len , ie_tree ) ; } break ; case CS0 | Q931_IE_REVERSE_CHARGE_IND : if ( q931_tree != NULL ) { dissect_q931_reverse_charge_ind_ie ( tvb , offset + 2 , info_element_len , ie_tree ) ; } break ; case CS0 | Q931_IE_CONNECTED_NUMBER_DEFAULT : if ( q931_tree != NULL ) { dissect_q931_number_ie ( tvb , offset + 2 , info_element_len , ie_tree , hf_q931_connected_number , e164_info ) ; } break ; case CS0 | Q931_IE_CALLING_PARTY_NUMBER : e164_info . e164_number_type = CALLING_PARTY_NUMBER ; dissect_q931_number_ie ( tvb , offset + 2 , info_element_len , ie_tree , hf_q931_calling_party_number , e164_info ) ; break ; case CS0 | Q931_IE_CALLED_PARTY_NUMBER : e164_info . e164_number_type = CALLED_PARTY_NUMBER ; dissect_q931_number_ie ( tvb , offset + 2 , info_element_len , ie_tree , hf_q931_called_party_number , e164_info ) ; break ; case CS0 | Q931_IE_CALLING_PARTY_SUBADDR : case CS0 | Q931_IE_CALLED_PARTY_SUBADDR : if ( q931_tree != NULL ) { dissect_q931_party_subaddr_ie ( tvb , offset + 2 , info_element_len , ie_tree ) ; } break ; case CS0 | Q931_IE_REDIRECTING_NUMBER : if ( q931_tree != NULL ) { dissect_q931_number_ie ( tvb , offset + 2 , info_element_len , ie_tree , hf_q931_redirecting_number , e164_info ) ; } break ; case CS0 | Q931_IE_RESTART_INDICATOR : dissect_q931_restart_indicator_ie ( tvb , pinfo , offset + 2 , info_element_len , ie_tree , ti ) ; break ; case CS0 | Q931_IE_HIGH_LAYER_COMPAT : if ( q931_tree != NULL ) { dissect_q931_high_layer_compat_ie ( tvb , offset + 2 , info_element_len , ie_tree ) ; } break ; case CS0 | Q931_IE_USER_USER : if ( q931_tree != NULL ) { dissect_q931_user_user_ie ( tvb , pinfo , offset + 2 , info_element_len , ie_tree ) ; } break ; case CS5 | Q931_IE_PARTY_CATEGORY : if ( q931_tree != NULL ) { dissect_q931_party_category_ie ( tvb , offset + 2 , info_element_len , ie_tree ) ; } break ; case CS6 | Q931_IE_DISPLAY : if ( q931_tree != NULL ) { dissect_q931_ia5_ie ( tvb , offset + 2 , info_element_len , ie_tree , hf_q931_avaya_display ) ; } break ; default : if ( q931_tree != NULL ) { proto_tree_add_item ( ie_tree , hf_q931_data , tvb , offset + 2 , info_element_len , ENC_NA ) ; } break ; } } offset += 1 + 1 + info_element_len ; } codeset = locked_codeset ; } if ( have_valid_q931_pi ) { tap_queue_packet ( q931_tap , pinfo , q931_pi ) ; } have_valid_q931_pi = FALSE ; }
1
341,082
static AVRational update_sar(int old_w, int old_h, AVRational sar, int new_w, int new_h) { // attempt to keep aspect during typical resolution switches if (!sar.num) sar = (AVRational){1, 1}; sar = av_mul_q(sar, (AVRational){new_h * old_w, new_w * old_h}); return sar; }
1
483,764
void topology_normalize_cpu_scale(void) { u64 capacity; u64 capacity_scale; int cpu; if (!raw_capacity) return; capacity_scale = 1; for_each_possible_cpu(cpu) { capacity = raw_capacity[cpu] * per_cpu(freq_factor, cpu); capacity_scale = max(capacity, capacity_scale); } pr_debug("cpu_capacity: capacity_scale=%llu\n", capacity_scale); for_each_possible_cpu(cpu) { capacity = raw_capacity[cpu] * per_cpu(freq_factor, cpu); capacity = div64_u64(capacity << SCHED_CAPACITY_SHIFT, capacity_scale); topology_set_cpu_scale(cpu, capacity); pr_debug("cpu_capacity: CPU%d cpu_capacity=%lu\n", cpu, topology_get_cpu_scale(cpu)); } }
0
120,137
static int mpeg4_update_thread_context(AVCodecContext *dst, const AVCodecContext *src) { Mpeg4DecContext *s = dst->priv_data; const Mpeg4DecContext *s1 = src->priv_data; int init = s->m.context_initialized; int ret = ff_mpeg_update_thread_context(dst, src); if (ret < 0) return ret; memcpy(((uint8_t*)s) + sizeof(MpegEncContext), ((uint8_t*)s1) + sizeof(MpegEncContext), sizeof(Mpeg4DecContext) - sizeof(MpegEncContext)); if (CONFIG_MPEG4_DECODER && !init && s1->xvid_build >= 0) ff_xvid_idct_init(&s->m.idsp, dst); return 0; }
0
130,079
static GFINLINE void flac_dmx_update_cts(GF_FLACDmxCtx *ctx, u32 nb_samp) { if (ctx->timescale) { u64 inc = nb_samp; inc *= ctx->timescale; inc /= ctx->sample_rate; ctx->cts += inc; } else { ctx->cts += nb_samp; } }
0
254,493
ofputil_protocols_to_version_bitmap(enum ofputil_protocol protocols) { uint32_t bitmap = 0; for (; protocols; protocols = zero_rightmost_1bit(protocols)) { enum ofputil_protocol protocol = rightmost_1bit(protocols); bitmap |= 1u << ofputil_protocol_to_ofp_version(protocol); } return bitmap; }
0
310,674
virtual void TearDown() { adapter_ = NULL; DBusThreadManager::Shutdown(); }
0
58,837
size_t HTTP2Codec::generateTrailers(folly::IOBufQueue& writeBuf, StreamID stream, const HTTPHeaders& trailers) { VLOG(4) << "generating TRAILERS for stream=" << stream; std::vector<compress::Header> allHeaders; CodecUtil::appendHeaders(trailers, allHeaders, HTTP_HEADER_NONE); HTTPHeaderSize size; auto out = encodeHeaders(trailers, allHeaders, &size); IOBufQueue queue(IOBufQueue::cacheChainLength()); queue.append(std::move(out)); auto maxFrameSize = maxSendFrameSize(); if (queue.chainLength() > 0) { folly::Optional<http2::PriorityUpdate> pri; auto remainingFrameSize = maxFrameSize; auto chunk = queue.split(std::min(remainingFrameSize, queue.chainLength())); bool endHeaders = queue.chainLength() == 0; generateHeaderCallbackWrapper(stream, http2::FrameType::HEADERS, http2::writeHeaders(writeBuf, std::move(chunk), stream, pri, http2::kNoPadding, true /*eom*/, endHeaders)); if (!endHeaders) { generateContinuation(writeBuf, queue, stream, maxFrameSize); } } return size.compressed; }
0
239,990
pax_dump_header_0 (struct tar_sparse_file *file) { off_t block_ordinal = current_block_ordinal (); union block *blk; size_t i; char nbuf[UINTMAX_STRSIZE_BOUND]; struct sp_array *map = file->stat_info->sparse_map; char *save_file_name = NULL; /* Store the real file size */ xheader_store ("GNU.sparse.size", file->stat_info, NULL); xheader_store ("GNU.sparse.numblocks", file->stat_info, NULL); if (xheader_keyword_deleted_p ("GNU.sparse.map") || tar_sparse_minor == 0) { for (i = 0; i < file->stat_info->sparse_map_avail; i++) { xheader_store ("GNU.sparse.offset", file->stat_info, &i); xheader_store ("GNU.sparse.numbytes", file->stat_info, &i); } } else { xheader_store ("GNU.sparse.name", file->stat_info, NULL); save_file_name = file->stat_info->file_name; file->stat_info->file_name = xheader_format_name (file->stat_info, "%d/GNUSparseFile.%p/%f", 0); xheader_string_begin (&file->stat_info->xhdr); for (i = 0; i < file->stat_info->sparse_map_avail; i++) { if (i) xheader_string_add (&file->stat_info->xhdr, ","); xheader_string_add (&file->stat_info->xhdr, umaxtostr (map[i].offset, nbuf)); xheader_string_add (&file->stat_info->xhdr, ","); xheader_string_add (&file->stat_info->xhdr, umaxtostr (map[i].numbytes, nbuf)); } if (!xheader_string_end (&file->stat_info->xhdr, "GNU.sparse.map")) { free (file->stat_info->file_name); file->stat_info->file_name = save_file_name; return false; } } blk = pax_start_header (file->stat_info); finish_header (file->stat_info, blk, block_ordinal); if (save_file_name) { free (file->stat_info->file_name); file->stat_info->file_name = save_file_name; } return true; }
0
476,170
bool InstanceKlass::is_record() const { return _record_components != NULL && is_final() && java_super() == vmClasses::Record_klass(); }
0
208,707
_crypt_extended(const char *key, const char *setting) { static int initialized = 0; static struct php_crypt_extended_data data; if (!initialized) { _crypt_extended_init(); initialized = 1; data.initialized = 0; } return _crypt_extended_r(key, setting, &data); }
0
196,941
void GpuCommandBufferStub::PollWork() { TRACE_EVENT0("gpu", "GpuCommandBufferStub::PollWork"); delayed_work_scheduled_ = false; FastSetActiveURL(active_url_, active_url_hash_); if (decoder_.get() && !MakeCurrent()) return; if (scheduler_.get()) scheduler_->PollUnscheduleFences(); ScheduleDelayedWork(kHandleMoreWorkPeriodBusyMs); }
0
252,318
void ExtensionTabUtil::ForEachTab( const base::Callback<void(WebContents*)>& callback) { for (TabContentsIterator iterator; !iterator.done(); ++iterator) callback.Run(*iterator); }
0
317,116
void V8DOMWindow::eventAttrSetterCustom(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) { v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8DOMWindow::GetTemplate(info.GetIsolate(), worldTypeInMainThread(info.GetIsolate()))); if (holder.IsEmpty()) return; Frame* frame = V8DOMWindow::toNative(holder)->frame(); if (!BindingSecurity::shouldAllowAccessToFrame(frame)) return; ASSERT(frame); v8::Local<v8::Context> context = frame->script()->currentWorldContext(); if (context.IsEmpty()) return; v8::Handle<v8::String> eventSymbol = V8HiddenPropertyName::event(); context->Global()->SetHiddenValue(eventSymbol, value); }
0
310,781
static void stroke_config(private_stroke_socket_t *this, stroke_msg_t *msg, FILE *out) { this->cred->cachecrl(this->cred, msg->config.cachecrl); }
0
42,565
static int __init crypto_user_init(void) { struct netlink_kernel_cfg cfg = { .input = crypto_netlink_rcv, }; crypto_nlsk = netlink_kernel_create(&init_net, NETLINK_CRYPTO, &cfg); if (!crypto_nlsk) return -ENOMEM; return 0; }
0
438,904
static int ieee80211_set_csa_beacon(struct ieee80211_sub_if_data *sdata, struct cfg80211_csa_settings *params, u32 *changed) { struct ieee80211_csa_settings csa = {}; int err; switch (sdata->vif.type) { case NL80211_IFTYPE_AP: sdata->u.ap.next_beacon = cfg80211_beacon_dup(&params->beacon_after); if (!sdata->u.ap.next_beacon) return -ENOMEM; /* * With a count of 0, we don't have to wait for any * TBTT before switching, so complete the CSA * immediately. In theory, with a count == 1 we * should delay the switch until just before the next * TBTT, but that would complicate things so we switch * immediately too. If we would delay the switch * until the next TBTT, we would have to set the probe * response here. * * TODO: A channel switch with count <= 1 without * sending a CSA action frame is kind of useless, * because the clients won't know we're changing * channels. The action frame must be implemented * either here or in the userspace. */ if (params->count <= 1) break; if ((params->n_counter_offsets_beacon > IEEE80211_MAX_CSA_COUNTERS_NUM) || (params->n_counter_offsets_presp > IEEE80211_MAX_CSA_COUNTERS_NUM)) return -EINVAL; csa.counter_offsets_beacon = params->counter_offsets_beacon; csa.counter_offsets_presp = params->counter_offsets_presp; csa.n_counter_offsets_beacon = params->n_counter_offsets_beacon; csa.n_counter_offsets_presp = params->n_counter_offsets_presp; csa.count = params->count; err = ieee80211_assign_beacon(sdata, &params->beacon_csa, &csa); if (err < 0) { kfree(sdata->u.ap.next_beacon); return err; } *changed |= err; break; case NL80211_IFTYPE_ADHOC: if (!sdata->vif.bss_conf.ibss_joined) return -EINVAL; if (params->chandef.width != sdata->u.ibss.chandef.width) return -EINVAL; switch (params->chandef.width) { case NL80211_CHAN_WIDTH_40: if (cfg80211_get_chandef_type(&params->chandef) != cfg80211_get_chandef_type(&sdata->u.ibss.chandef)) return -EINVAL; case NL80211_CHAN_WIDTH_5: case NL80211_CHAN_WIDTH_10: case NL80211_CHAN_WIDTH_20_NOHT: case NL80211_CHAN_WIDTH_20: break; default: return -EINVAL; } /* changes into another band are not supported */ if (sdata->u.ibss.chandef.chan->band != params->chandef.chan->band) return -EINVAL; /* see comments in the NL80211_IFTYPE_AP block */ if (params->count > 1) { err = ieee80211_ibss_csa_beacon(sdata, params); if (err < 0) return err; *changed |= err; } ieee80211_send_action_csa(sdata, params); break; #ifdef CONFIG_MAC80211_MESH case NL80211_IFTYPE_MESH_POINT: { struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; if (params->chandef.width != sdata->vif.bss_conf.chandef.width) return -EINVAL; /* changes into another band are not supported */ if (sdata->vif.bss_conf.chandef.chan->band != params->chandef.chan->band) return -EINVAL; if (ifmsh->csa_role == IEEE80211_MESH_CSA_ROLE_NONE) { ifmsh->csa_role = IEEE80211_MESH_CSA_ROLE_INIT; if (!ifmsh->pre_value) ifmsh->pre_value = 1; else ifmsh->pre_value++; } /* see comments in the NL80211_IFTYPE_AP block */ if (params->count > 1) { err = ieee80211_mesh_csa_beacon(sdata, params); if (err < 0) { ifmsh->csa_role = IEEE80211_MESH_CSA_ROLE_NONE; return err; } *changed |= err; } if (ifmsh->csa_role == IEEE80211_MESH_CSA_ROLE_INIT) ieee80211_send_action_csa(sdata, params); break; } #endif default: return -EOPNOTSUPP; } return 0; }
0
200,446
void AutofillExternalDelegate::OnPopupShown() { manager_->DidShowSuggestions(has_autofill_suggestions_, query_form_, query_field_); if (should_show_scan_credit_card_) { AutofillMetrics::LogScanCreditCardPromptMetric( AutofillMetrics::SCAN_CARD_ITEM_SHOWN); } }
0
128,870
TfLiteStatus EvalFloat(const TfLiteTensor* input, const TfLiteTensor* input_weights, const TfLiteTensor* recurrent_weights, const TfLiteTensor* bias, const TfLiteSequenceRNNParams* params, TfLiteTensor* hidden_state, TfLiteTensor* output) { // Initialize the pointer bias. const float* bias_ptr = GetTensorData<float>(bias); const bool time_major = params->time_major; const int batch_size = (time_major) ? input->dims->data[1] : input->dims->data[0]; const int max_time = (time_major) ? input->dims->data[0] : input->dims->data[1]; const int num_units = input_weights->dims->data[0]; const int input_size = input->dims->data[2]; // Initialize input_weights and recurrent_weights. const float* input_weights_ptr = GetTensorData<float>(input_weights); const float* recurrent_weights_ptr = GetTensorData<float>(recurrent_weights); if (time_major) { // Initialize the pointer to hidden state. float* hidden_state_ptr_batch = GetTensorData<float>(hidden_state); // Unroll the sequence and use batch operations for efficiency. for (int s = 0; s < max_time; s++) { // Initialize the pointer to input and output. const float* input_ptr_batch = GetTensorData<float>(input) + s * input_size * batch_size; float* output_ptr_batch = GetTensorData<float>(output) + s * num_units * batch_size; kernel_utils::RnnBatchStep( input_ptr_batch, input_weights_ptr, recurrent_weights_ptr, bias_ptr, input_size, num_units, batch_size, num_units, params->activation, hidden_state_ptr_batch, output_ptr_batch); } } else { // For each batch for (int b = 0; b < batch_size; b++) { // Initialize the pointer to hidden state. float* hidden_state_ptr_batch = GetTensorData<float>(hidden_state) + b * num_units; for (int s = 0; s < max_time; s++) { // Initialize the pointer to input and output. const float* input_ptr_batch = GetTensorData<float>(input) + b * input_size * max_time + s * input_size; float* output_ptr_batch = GetTensorData<float>(output) + b * num_units * max_time + s * num_units; kernel_utils::RnnBatchStep( input_ptr_batch, input_weights_ptr, recurrent_weights_ptr, bias_ptr, input_size, num_units, /*batch_size=*/1, num_units, params->activation, hidden_state_ptr_batch, output_ptr_batch); } } } return kTfLiteOk; }
0
200,005
bool FrameLoader::isLoadingMainFrame() const { Page* page = m_frame->page(); return page && m_frame == page->mainFrame(); }
0
475,147
static bool check_iov_bounds(struct vrend_resource *res, const struct vrend_transfer_info *info, const struct iovec *iov, int num_iovs) { GLuint transfer_size; GLuint iovsize = vrend_get_iovec_size(iov, num_iovs); GLuint valid_stride, valid_layer_stride; /* If the transfer specifies a stride, verify that it's at least as large as * the minimum required for the transfer. If no stride is specified use the * image stride for the specified level. */ if (info->stride) { GLuint min_stride = util_format_get_stride(res->base.format, info->box->width); if (info->stride < min_stride) return false; valid_stride = info->stride; } else { valid_stride = util_format_get_stride(res->base.format, u_minify(res->base.width0, info->level)); } /* If the transfer specifies a layer_stride, verify that it's at least as * large as the minimum required for the transfer. If no layer_stride is * specified use the image layer_stride for the specified level. */ if (info->layer_stride) { GLuint min_layer_stride = util_format_get_2d_size(res->base.format, valid_stride, info->box->height); if (info->layer_stride < min_layer_stride) return false; valid_layer_stride = info->layer_stride; } else { valid_layer_stride = util_format_get_2d_size(res->base.format, valid_stride, u_minify(res->base.height0, info->level)); } /* Calculate the size required for the transferred data, based on the * calculated or provided strides, and ensure that the iov, starting at the * specified offset, is able to hold at least that size. */ transfer_size = vrend_transfer_size(res, info, valid_stride, valid_layer_stride); if (iovsize < info->offset) return false; if (iovsize < transfer_size) return false; if (iovsize < info->offset + transfer_size) return false; return true; }
0
274,738
void Monitor::health_tick_stop() { dout(15) << __func__ << dendl; if (health_tick_event) { timer.cancel_event(health_tick_event); health_tick_event = NULL; } }
0
449,327
SCK_AcceptConnection(int sock_fd, IPSockAddr *remote_addr) { union sockaddr_all saddr; socklen_t saddr_len = sizeof (saddr); int conn_fd; conn_fd = accept(sock_fd, &saddr.sa, &saddr_len); if (conn_fd < 0) { DEBUG_LOG("accept() failed : %s", strerror(errno)); return INVALID_SOCK_FD; } if (!UTI_FdSetCloexec(conn_fd) || !set_socket_nonblock(conn_fd)) { close(conn_fd); return INVALID_SOCK_FD; } SCK_SockaddrToIPSockAddr(&saddr.sa, saddr_len, remote_addr); return conn_fd; }
0
394,707
static size_t php_bz2iop_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) { struct php_bz2_stream_data_t *self = (struct php_bz2_stream_data_t *) stream->abstract; int bz2_ret; bz2_ret = BZ2_bzread(self->bz_file, buf, count); if (bz2_ret < 0) { stream->eof = 1; return -1; } if (bz2_ret == 0) { stream->eof = 1; } return (size_t)bz2_ret; }
0
285,492
status_t CameraClient::checkPidAndHardware() const { status_t result = checkPid(); if (result != NO_ERROR) return result; if (mHardware == 0) { ALOGE("attempt to use a camera after disconnect() (pid %d)", getCallingPid()); return INVALID_OPERATION; } return NO_ERROR; }
0
508,063
int test_exp(BIO *bp, BN_CTX *ctx) { BIGNUM *a, *b, *d, *e, *one; int i; a = BN_new(); b = BN_new(); d = BN_new(); e = BN_new(); one = BN_new(); BN_one(one); for (i = 0; i < num2; i++) { BN_bntest_rand(a, 20 + i * 5, 0, 0); BN_bntest_rand(b, 2 + i, 0, 0); if (BN_exp(d, a, b, ctx) <= 0) return (0); if (bp != NULL) { if (!results) { BN_print(bp, a); BIO_puts(bp, " ^ "); BN_print(bp, b); BIO_puts(bp, " - "); } BN_print(bp, d); BIO_puts(bp, "\n"); } BN_one(e); for (; !BN_is_zero(b); BN_sub(b, b, one)) BN_mul(e, e, a, ctx); BN_sub(e, e, d); if (!BN_is_zero(e)) { fprintf(stderr, "Exponentiation test failed!\n"); return 0; } } BN_free(a); BN_free(b); BN_free(d); BN_free(e); BN_free(one); return (1); }
0
451,576
static BROTLI_INLINE uint32_t BrotliGetAvailableBits( const BrotliBitReader* br) { return (BROTLI_64_BITS ? 64 : 32) - br->bit_pos_; }
0
316,467
copy_buckets_for_remove_bucket(const struct ofgroup *ofgroup, struct ofgroup *new_ofgroup, uint32_t command_bucket_id) { const struct ofputil_bucket *skip = NULL; if (command_bucket_id == OFPG15_BUCKET_ALL) { return 0; } if (command_bucket_id == OFPG15_BUCKET_FIRST) { if (!ovs_list_is_empty(&ofgroup->buckets)) { skip = ofputil_bucket_list_front(&ofgroup->buckets); } } else if (command_bucket_id == OFPG15_BUCKET_LAST) { if (!ovs_list_is_empty(&ofgroup->buckets)) { skip = ofputil_bucket_list_back(&ofgroup->buckets); } } else { skip = ofputil_bucket_find(&ofgroup->buckets, command_bucket_id); if (!skip) { return OFPERR_OFPGMFC_UNKNOWN_BUCKET; } } ofputil_bucket_clone_list(CONST_CAST(struct ovs_list *, &new_ofgroup->buckets), &ofgroup->buckets, skip); return 0; }
0
402,765
ModuleExport size_t RegisterMIFFImage(void) { char version[MagickPathExtent]; MagickInfo *entry; *version='\0'; #if defined(MagickImageCoderSignatureText) (void) CopyMagickString(version,MagickLibVersionText,MagickPathExtent); #if defined(ZLIB_VERSION) (void) ConcatenateMagickString(version," with Zlib ",MagickPathExtent); (void) ConcatenateMagickString(version,ZLIB_VERSION,MagickPathExtent); #endif #if defined(MAGICKCORE_BZLIB_DELEGATE) (void) ConcatenateMagickString(version," and BZlib",MagickPathExtent); #endif #endif entry=AcquireMagickInfo("MIFF","MIFF","Magick Image File Format"); entry->decoder=(DecodeImageHandler *) ReadMIFFImage; entry->encoder=(EncodeImageHandler *) WriteMIFFImage; entry->magick=(IsImageFormatHandler *) IsMIFF; entry->flags|=CoderDecoderSeekableStreamFlag; if (*version != '\0') entry->version=ConstantString(version); (void) RegisterMagickInfo(entry); return(MagickImageCoderSignature); }
0
159,156
static int add_file_info(struct augeas *aug, const char *node, struct lens *lens, const char *lens_name, const char *filename, bool force_reload) { struct tree *file, *tree; char *tmp = NULL; int r; char *path = NULL; int result = -1; if (lens == NULL) return -1; r = pathjoin(&path, 2, AUGEAS_META_TREE, node); ERR_NOMEM(r < 0, aug); file = tree_fpath_cr(aug, path); ERR_BAIL(aug); /* Set 'path' */ tree = tree_child_cr(file, s_path); ERR_NOMEM(tree == NULL, aug); r = tree_set_value(tree, node); ERR_NOMEM(r < 0, aug); /* Set 'mtime' */ if (force_reload) { tmp = strdup("0"); ERR_NOMEM(tmp == NULL, aug); } else { tmp = mtime_as_string(aug, filename); ERR_BAIL(aug); } tree = tree_child_cr(file, s_mtime); ERR_NOMEM(tree == NULL, aug); tree_store_value(tree, &tmp); /* Set 'lens/info' */ tmp = format_info(lens->info); ERR_NOMEM(tmp == NULL, aug); tree = tree_path_cr(file, 2, s_lens, s_info); ERR_NOMEM(tree == NULL, aug); r = tree_set_value(tree, tmp); ERR_NOMEM(r < 0, aug); FREE(tmp); /* Set 'lens' */ tree = tree->parent; r = tree_set_value(tree, lens_name); ERR_NOMEM(r < 0, aug); tree_clean(file); result = 0; error: free(path); free(tmp); return result; }
0
353,738
static int aes_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) { EVP_AES_GCM_CTX *gctx = c->cipher_data; switch (type) { case EVP_CTRL_INIT: gctx->key_set = 0; gctx->iv_set = 0; gctx->ivlen = c->cipher->iv_len; gctx->iv = c->iv; gctx->taglen = -1; gctx->iv_gen = 0; gctx->tls_aad_len = -1; return 1; case EVP_CTRL_GCM_SET_IVLEN: if (arg <= 0) return 0; /* Allocate memory for IV if needed */ if ((arg > EVP_MAX_IV_LENGTH) && (arg > gctx->ivlen)) { if (gctx->iv != c->iv) OPENSSL_free(gctx->iv); gctx->iv = OPENSSL_malloc(arg); if (!gctx->iv) return 0; } gctx->ivlen = arg; return 1; case EVP_CTRL_GCM_SET_TAG: if (arg <= 0 || arg > 16 || c->encrypt) return 0; memcpy(c->buf, ptr, arg); gctx->taglen = arg; return 1; case EVP_CTRL_GCM_GET_TAG: if (arg <= 0 || arg > 16 || !c->encrypt || gctx->taglen < 0) return 0; memcpy(ptr, c->buf, arg); return 1; case EVP_CTRL_GCM_SET_IV_FIXED: /* Special case: -1 length restores whole IV */ if (arg == -1) { memcpy(gctx->iv, ptr, gctx->ivlen); gctx->iv_gen = 1; return 1; } /* * Fixed field must be at least 4 bytes and invocation field at least * 8. */ if ((arg < 4) || (gctx->ivlen - arg) < 8) return 0; if (arg) memcpy(gctx->iv, ptr, arg); if (c->encrypt && RAND_bytes(gctx->iv + arg, gctx->ivlen - arg) <= 0) return 0; gctx->iv_gen = 1; return 1; case EVP_CTRL_GCM_IV_GEN: if (gctx->iv_gen == 0 || gctx->key_set == 0) return 0; CRYPTO_gcm128_setiv(&gctx->gcm, gctx->iv, gctx->ivlen); if (arg <= 0 || arg > gctx->ivlen) arg = gctx->ivlen; memcpy(ptr, gctx->iv + gctx->ivlen - arg, arg); /* * Invocation field will be at least 8 bytes in size and so no need * to check wrap around or increment more than last 8 bytes. */ ctr64_inc(gctx->iv + gctx->ivlen - 8); gctx->iv_set = 1; return 1; case EVP_CTRL_GCM_SET_IV_INV: if (gctx->iv_gen == 0 || gctx->key_set == 0 || c->encrypt) return 0; memcpy(gctx->iv + gctx->ivlen - arg, ptr, arg); CRYPTO_gcm128_setiv(&gctx->gcm, gctx->iv, gctx->ivlen); gctx->iv_set = 1; return 1; case EVP_CTRL_AEAD_TLS1_AAD: /* Save the AAD for later use */ if (arg != 13) return 0; memcpy(c->buf, ptr, arg); gctx->tls_aad_len = arg; { unsigned int len = c->buf[arg - 2] << 8 | c->buf[arg - 1]; /* Correct length for explicit IV */ len -= EVP_GCM_TLS_EXPLICIT_IV_LEN; /* If decrypting correct for tag too */ if (!c->encrypt) len -= EVP_GCM_TLS_TAG_LEN; c->buf[arg - 2] = len >> 8; c->buf[arg - 1] = len & 0xff; } /* Extra padding: tag appended to record */ return EVP_GCM_TLS_TAG_LEN; case EVP_CTRL_COPY: { EVP_CIPHER_CTX *out = ptr; EVP_AES_GCM_CTX *gctx_out = out->cipher_data; if (gctx->gcm.key) { if (gctx->gcm.key != &gctx->ks) return 0; gctx_out->gcm.key = &gctx_out->ks; } if (gctx->iv == c->iv) gctx_out->iv = out->iv; else { gctx_out->iv = OPENSSL_malloc(gctx->ivlen); if (!gctx_out->iv) return 0; memcpy(gctx_out->iv, gctx->iv, gctx->ivlen); } return 1; } default: return -1; } }
1
292,078
AP_DECLARE(void) ap_clear_auth_internal(void) { auth_internal_per_conf_hooks = 0; auth_internal_per_conf_providers = 0; }
0
377,560
static int ide_drive_pio_post_load(void *opaque, int version_id) { IDEState *s = opaque; if (s->end_transfer_fn_idx >= ARRAY_SIZE(transfer_end_table)) { return -EINVAL; } s->end_transfer_func = transfer_end_table[s->end_transfer_fn_idx]; s->data_ptr = s->io_buffer + s->cur_io_buffer_offset; s->data_end = s->data_ptr + s->cur_io_buffer_len; return 0; }
0