idx
int64
func
string
target
int64
173,803
void V8TestObject::DeprecateAsSameValueMeasureAsSameValueOverloadedMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_deprecateAsSameValueMeasureAsSameValueOverloadedMethod"); test_object_v8_internal::DeprecateAsSameValueMeasureAsSameValueOverloadedMethodMethod(info); }
0
388,913
static uint8_t *msix_pending_byte(PCIDevice *dev, int vector) { return dev->msix_pba + vector / 8; }
0
78,914
static void prb_close_block(struct tpacket_kbdq_core *pkc1, struct tpacket_block_desc *pbd1, struct packet_sock *po, unsigned int stat) { __u32 status = TP_STATUS_USER | stat; struct tpacket3_hdr *last_pkt; struct tpacket_hdr_v1 *h1 = &pbd1->hdr.bh1; if (po->stats.stats3.tp_drops) status |= TP_STATUS_LOSING; last_pkt = (struct tpacket3_hdr *)pkc1->prev; last_pkt->tp_next_offset = 0; /* Get the ts of the last pkt */ if (BLOCK_NUM_PKTS(pbd1)) { h1->ts_last_pkt.ts_sec = last_pkt->tp_sec; h1->ts_last_pkt.ts_nsec = last_pkt->tp_nsec; } else { /* Ok, we tmo'd - so get the current time */ struct timespec ts; getnstimeofday(&ts); h1->ts_last_pkt.ts_sec = ts.tv_sec; h1->ts_last_pkt.ts_nsec = ts.tv_nsec; } smp_wmb(); /* Flush the block */ prb_flush_block(pkc1, pbd1, status); pkc1->kactive_blk_num = GET_NEXT_PRB_BLK_NUM(pkc1); }
0
219,973
void SplashOutputDev::clipToStrokePath(GfxState *state) { SplashPath *path, *path2; path = convertPath(state, state->getPath()); path2 = splash->makeStrokePath(path); delete path; splash->clipToPath(path2, gFalse); delete path2; }
0
415,381
cupsdFindJob(int id) /* I - Job ID */ { cupsd_job_t key; /* Search key */ key.id = id; return ((cupsd_job_t *)cupsArrayFind(Jobs, &key)); }
0
212,640
bool Document::hasFocus() const { return GetPage() && GetPage()->GetFocusController().IsDocumentFocused(*this); }
0
474,703
struct sk_buff *nfc_alloc_recv_skb(unsigned int size, gfp_t gfp) { struct sk_buff *skb; unsigned int total_size; total_size = size + 1; skb = alloc_skb(total_size, gfp); if (skb) skb_reserve(skb, 1); return skb; }
0
244,641
init_params() { Spool = param("SPOOL"); if( Spool == NULL ) { EXCEPT( "SPOOL not specified in config file\n" ); } Log = param("LOG"); if( Log == NULL ) { EXCEPT( "LOG not specified in config file\n" ); } DaemonSockDir = param("DAEMON_SOCKET_DIR"); if( DaemonSockDir == NULL ) { EXCEPT("DAEMON_SOCKET_DIR not defined\n"); } char *Execute = param("EXECUTE"); if( Execute ) { ExecuteDirs.append(Execute); free(Execute); Execute = NULL; } ExtArray<ParamValue> *params = param_all(); for( int p=params->length(); p--; ) { char const *name = (*params)[p].name.Value(); char *tail = NULL; if( strncasecmp( name, "SLOT", 4 ) != 0 ) continue; strtol( name+4, &tail, 10 ); if( tail <= name || strcasecmp( tail, "_EXECUTE" ) != 0 ) continue; Execute = param(name); if( Execute ) { if( !ExecuteDirs.contains( Execute ) ) { ExecuteDirs.append( Execute ); } free( Execute ); } } delete params; if( (PreenAdmin = param("PREEN_ADMIN")) == NULL ) { if( (PreenAdmin = param("CONDOR_ADMIN")) == NULL ) { EXCEPT( "CONDOR_ADMIN not specified in config file" ); } } ValidSpoolFiles = param("VALID_SPOOL_FILES"); InvalidLogFiles = param("INVALID_LOG_FILES"); if( (MailPrg = param("MAIL")) == NULL ) { EXCEPT ( "MAIL not specified in config file" ); } }
0
355,957
static inline int is_cow_mapping(unsigned int flags) { return (flags & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE; }
0
155,843
njs_lvlhsh_alloc(void *data, size_t size) { return njs_mp_align(data, size, size); }
0
98,205
TfLiteStatus EvalHybridPerChannel(TfLiteContext* context, TfLiteNode* node, TfLiteConvParams* params, OpData* data, const TfLiteTensor* input, const TfLiteTensor* filter, const TfLiteTensor* bias, TfLiteTensor* im2col, TfLiteTensor* output) { float output_activation_min, output_activation_max; CalculateActivationRange(params->activation, &output_activation_min, &output_activation_max); const int input_size = NumElements(input) / SizeOfDimension(input, 0); const int batch_size = SizeOfDimension(input, 0); TfLiteTensor* quantized_input_tensor; TF_LITE_ENSURE_OK(context, GetTemporarySafe(context, node, data->input_quantized_index, &quantized_input_tensor)); int8_t* quantized_input_ptr_batch = GetTensorData<int8_t>(quantized_input_tensor); TfLiteTensor* scaling_factors_tensor; TF_LITE_ENSURE_OK(context, GetTemporarySafe(context, node, data->scaling_factors_index, &scaling_factors_tensor)); float* scaling_factors_ptr = GetTensorData<float>(scaling_factors_tensor); TfLiteTensor* input_offset_tensor; TF_LITE_ENSURE_OK(context, GetTemporarySafe(context, node, data->input_offset_index, &input_offset_tensor)); int32_t* input_offset_ptr = GetTensorData<int32_t>(input_offset_tensor); for (int b = 0; b < batch_size; ++b) { const int offset = b * input_size; tensor_utils::AsymmetricQuantizeFloats( GetTensorData<float>(input) + offset, input_size, quantized_input_ptr_batch + offset, &scaling_factors_ptr[b], &input_offset_ptr[b]); } int8_t* im2col_ptr = nullptr; int8_t* filter_ptr = nullptr; if (im2col != nullptr) { im2col_ptr = im2col->data.int8; } filter_ptr = filter->data.int8; const auto* affine_quantization = reinterpret_cast<TfLiteAffineQuantization*>(filter->quantization.params); ConvParams op_params; op_params.padding_type = PaddingType::kSame; op_params.padding_values.width = data->padding.width; op_params.padding_values.height = data->padding.height; op_params.stride_width = params->stride_width; op_params.stride_height = params->stride_height; op_params.dilation_width_factor = 1; op_params.dilation_height_factor = 1; op_params.float_activation_min = output_activation_min; op_params.float_activation_max = output_activation_max; switch (kernel_type) { case kReference: reference_ops::HybridConvPerChannel( op_params, scaling_factors_ptr, GetTensorShape(input), quantized_input_ptr_batch, GetTensorShape(filter), filter_ptr, GetTensorShape(bias), GetTensorData<float>(bias), GetTensorShape(output), GetTensorData<float>(output), GetTensorShape(im2col), im2col_ptr, affine_quantization->scale->data, input_offset_ptr); break; case kGenericOptimized: case kMultithreadOptimized: case kCblasOptimized: { TfLiteTensor* row_sums; TF_LITE_ENSURE_OK( context, GetTemporarySafe(context, node, data->row_sums_index, &row_sums)); TfLiteTensor* scratch; TF_LITE_ENSURE_OK( context, GetTemporarySafe(context, node, data->accum_scratch_index, &scratch)); optimized_ops::HybridConvPerChannel( op_params, scaling_factors_ptr, GetTensorShape(input), quantized_input_ptr_batch, GetTensorShape(filter), filter_ptr, GetTensorShape(bias), GetTensorData<float>(bias), GetTensorShape(output), GetTensorData<float>(output), GetTensorShape(im2col), im2col_ptr, affine_quantization->scale->data, input_offset_ptr, GetTensorShape(scratch), GetTensorData<int32>(scratch), GetTensorData<int32_t>(row_sums), &data->compute_hybrid_row_sums, CpuBackendContext::GetFromContext(context)); data->compute_hybrid_row_sums = false; break; } } return kTfLiteOk; }
0
202,619
int ide_init_drive(IDEState *s, BlockBackend *blk, IDEDriveKind kind, const char *version, const char *serial, const char *model, uint64_t wwn, uint32_t cylinders, uint32_t heads, uint32_t secs, int chs_trans) { uint64_t nb_sectors; s->blk = blk; s->drive_kind = kind; blk_get_geometry(blk, &nb_sectors); s->cylinders = cylinders; s->heads = heads; s->sectors = secs; s->chs_trans = chs_trans; s->nb_sectors = nb_sectors; s->wwn = wwn; /* The SMART values should be preserved across power cycles but they aren't. */ s->smart_enabled = 1; s->smart_autosave = 1; s->smart_errors = 0; s->smart_selftest_count = 0; if (kind == IDE_CD) { blk_set_dev_ops(blk, &ide_cd_block_ops, s); blk_set_guest_block_size(blk, 2048); } else { if (!blk_is_inserted(s->blk)) { error_report("Device needs media, but drive is empty"); return -1; } if (blk_is_read_only(blk)) { error_report("Can't use a read-only drive"); return -1; } blk_set_dev_ops(blk, &ide_hd_block_ops, s); } if (serial) { pstrcpy(s->drive_serial_str, sizeof(s->drive_serial_str), serial); } else { snprintf(s->drive_serial_str, sizeof(s->drive_serial_str), "QM%05d", s->drive_serial); } if (model) { pstrcpy(s->drive_model_str, sizeof(s->drive_model_str), model); } else { switch (kind) { case IDE_CD: strcpy(s->drive_model_str, "QEMU DVD-ROM"); break; case IDE_CFATA: strcpy(s->drive_model_str, "QEMU MICRODRIVE"); break; default: strcpy(s->drive_model_str, "QEMU HARDDISK"); break; } } if (version) { pstrcpy(s->version, sizeof(s->version), version); } else { pstrcpy(s->version, sizeof(s->version), qemu_get_version()); } ide_reset(s); blk_iostatus_enable(blk); return 0; }
0
88,406
privsep_preauth_child(void) { gid_t gidset[1]; struct passwd *pw; /* Enable challenge-response authentication for privilege separation */ privsep_challenge_enable(); #ifdef GSSAPI /* Cache supported mechanism OIDs for later use */ if (options.gss_authentication) ssh_gssapi_prepare_supported_oids(); #endif /* Demote the private keys to public keys. */ demote_sensitive_data(); /* Demote the child */ if (getuid() == 0 || geteuid() == 0) { if ((pw = getpwnam(SSH_PRIVSEP_USER)) == NULL) fatal("Privilege separation user %s does not exist", SSH_PRIVSEP_USER); explicit_bzero(pw->pw_passwd, strlen(pw->pw_passwd)); endpwent(); /* Change our root directory */ if (chroot(_PATH_PRIVSEP_CHROOT_DIR) == -1) fatal("chroot(\"%s\"): %s", _PATH_PRIVSEP_CHROOT_DIR, strerror(errno)); if (chdir("/") == -1) fatal("chdir(\"/\"): %s", strerror(errno)); /* * Drop our privileges * NB. Can't use setusercontext() after chroot. */ debug3("privsep user:group %u:%u", (u_int)pw->pw_uid, (u_int)pw->pw_gid); gidset[0] = pw->pw_gid; if (setgroups(1, gidset) < 0) fatal("setgroups: %.100s", strerror(errno)); permanently_set_uid(pw); } }
0
459,295
static void cmd_inquiry(IDEState *s, uint8_t *buf) { uint8_t page_code = buf[2]; int max_len = buf[4]; unsigned idx = 0; unsigned size_idx; unsigned preamble_len; /* If the EVPD (Enable Vital Product Data) bit is set in byte 1, * we are being asked for a specific page of info indicated by byte 2. */ if (buf[1] & 0x01) { preamble_len = 4; size_idx = 3; buf[idx++] = 0x05; /* CD-ROM */ buf[idx++] = page_code; /* Page Code */ buf[idx++] = 0x00; /* reserved */ idx++; /* length (set later) */ switch (page_code) { case 0x00: /* Supported Pages: List of supported VPD responses. */ buf[idx++] = 0x00; /* 0x00: Supported Pages, and: */ buf[idx++] = 0x83; /* 0x83: Device Identification. */ break; case 0x83: /* Device Identification. Each entry is optional, but the entries * included here are modeled after libata's VPD responses. * If the response is given, at least one entry must be present. */ /* Entry 1: Serial */ if (idx + 24 > max_len) { /* Not enough room for even the first entry: */ /* 4 byte header + 20 byte string */ ide_atapi_cmd_error(s, ILLEGAL_REQUEST, ASC_DATA_PHASE_ERROR); return; } buf[idx++] = 0x02; /* Ascii */ buf[idx++] = 0x00; /* Vendor Specific */ buf[idx++] = 0x00; buf[idx++] = 20; /* Remaining length */ padstr8(buf + idx, 20, s->drive_serial_str); idx += 20; /* Entry 2: Drive Model and Serial */ if (idx + 72 > max_len) { /* 4 (header) + 8 (vendor) + 60 (model & serial) */ goto out; } buf[idx++] = 0x02; /* Ascii */ buf[idx++] = 0x01; /* T10 Vendor */ buf[idx++] = 0x00; buf[idx++] = 68; padstr8(buf + idx, 8, "ATA"); /* Generic T10 vendor */ idx += 8; padstr8(buf + idx, 40, s->drive_model_str); idx += 40; padstr8(buf + idx, 20, s->drive_serial_str); idx += 20; /* Entry 3: WWN */ if (s->wwn && (idx + 12 <= max_len)) { /* 4 byte header + 8 byte wwn */ buf[idx++] = 0x01; /* Binary */ buf[idx++] = 0x03; /* NAA */ buf[idx++] = 0x00; buf[idx++] = 0x08; stq_be_p(&buf[idx], s->wwn); idx += 8; } break; default: /* SPC-3, revision 23 sec. 6.4 */ ide_atapi_cmd_error(s, ILLEGAL_REQUEST, ASC_INV_FIELD_IN_CMD_PACKET); return; } } else { preamble_len = 5; size_idx = 4; buf[0] = 0x05; /* CD-ROM */ buf[1] = 0x80; /* removable */ buf[2] = 0x00; /* ISO */ buf[3] = 0x21; /* ATAPI-2 (XXX: put ATAPI-4 ?) */ /* buf[size_idx] set below. */ buf[5] = 0; /* reserved */ buf[6] = 0; /* reserved */ buf[7] = 0; /* reserved */ padstr8(buf + 8, 8, "QEMU"); padstr8(buf + 16, 16, "QEMU DVD-ROM"); padstr8(buf + 32, 4, s->version); idx = 36; } out: buf[size_idx] = idx - preamble_len; ide_atapi_cmd_reply(s, idx, max_len); }
0
318,442
static void test_validate_struct_nested(TestInputVisitorData *data, const void *unused) { UserDefTwo *udp = NULL; Visitor *v; v = validate_test_init(data, "{ 'string0': 'string0', " "'dict1': { 'string1': 'string1', " "'dict2': { 'userdef': { 'integer': 42, " "'string': 'string' }, 'string': 'string2'}}}"); visit_type_UserDefTwo(v, NULL, &udp, &error_abort); qapi_free_UserDefTwo(udp); }
0
302,964
**/ const CImg<T>& save_cpp(const char *const filename) const { return _save_cpp(0,filename);
0
359,928
is_anyone_waiting_for_metafile (NautilusDirectory *directory) { if (directory->details->call_when_ready_counters[REQUEST_METAFILE] > 0) { return TRUE; } if (directory->details->monitor_counters[REQUEST_METAFILE] > 0) { return TRUE; } return FALSE; }
0
124,700
static int snd_usb_audio_dev_free(struct snd_device *device) { struct snd_usb_audio *chip = device->device_data; return snd_usb_audio_free(chip); }
0
271,721
static ut32 decodeBitMasks(ut32 imm) { // get element size int size = 32; // determine rot to make element be 0^m 1^n ut32 cto, i; ut32 mask = ((ut64) - 1LL) >> (64 - size); if (isShiftedMask (imm)) { i = countTrailingZeros (imm); cto = countTrailingOnes (imm >> i); } else { imm |= ~mask; if (!isShiftedMask (imm)) { return UT32_MAX; } ut32 clo = countLeadingOnes (imm); i = 64 - clo; cto = clo + countTrailingOnes (imm) - (64 - size); } // Encode in Immr the number of RORs it would take to get *from* 0^m 1^n // to our target value, where I is the number of RORs to go the opposite // direction ut32 immr = (size - i) & (size - 1); // If size has a 1 in the n'th bit, create a value that has zeroes in // bits [0, n] and ones above that. ut64 nimms = ~(size - 1) << 1; // Or the cto value into the low bits, which must be below the Nth bit // bit mentioned above. nimms |= (cto - 1); // Extract and toggle seventh bit to make N field. ut32 n = ((nimms >> 6) & 1) ^ 1; ut64 encoding = (n << 12) | (immr << 6) | (nimms & 0x3f); return encoding; }
0
174,587
bool PulseAudioMixer::InitThread() { bool AudioMixerPulse::InitThread() { AutoLock lock(mixer_state_lock_); if (mixer_state_ != UNINITIALIZED) return false; if (thread_ == NULL) { thread_.reset(new base::Thread("AudioMixerPulse")); if (!thread_->Start()) { thread_.reset(); return false; } } mixer_state_ = INITIALIZING; return true; }
0
123,515
bool resolve(const std::string& moduleName, const std::string& exportName, ObjectType type, Object*& outObject) override { auto namedInstance = moduleNameToInstanceMap.get(moduleName); if(namedInstance) { outObject = getInstanceExport(*namedInstance, exportName); if(outObject) { if(isA(outObject, type)) { return true; } else { Log::printf(Log::error, "Resolved import %s.%s to a %s, but was expecting %s\n", moduleName.c_str(), exportName.c_str(), asString(getObjectType(outObject)).c_str(), asString(type).c_str()); return false; } } } Log::printf(Log::error, "Generated stub for missing import %s.%s : %s\n", moduleName.c_str(), exportName.c_str(), asString(type).c_str()); outObject = getStubObject(exportName, type); return true; }
0
192,964
void LocalFrame::ForceSynchronousDocumentInstall( const AtomicString& mime_type, scoped_refptr<SharedBuffer> data) { CHECK(loader_.StateMachine()->IsDisplayingInitialEmptyDocument()); DCHECK(!Client()->IsLocalFrameClientImpl()); GetDocument()->Shutdown(); DomWindow()->InstallNewDocument( mime_type, DocumentInit::Create().WithFrame(this), false); loader_.StateMachine()->AdvanceTo( FrameLoaderStateMachine::kCommittedFirstRealLoad); GetDocument()->OpenForNavigation(kForceSynchronousParsing, mime_type, AtomicString("UTF-8")); data->ForEachSegment( [this](const char* segment, size_t segment_size, size_t segment_offset) { GetDocument()->Parser()->AppendBytes(segment, segment_size); return true; }); GetDocument()->Parser()->Finish(); if (GetPage() && GetDocument()->IsSVGDocument()) GetPage()->GetUseCounter().DidCommitLoad(this); }
0
284,258
SkColor TabStrip::GetTabForegroundColor(TabState tab_state, SkColor background_color) const { const ui::ThemeProvider* tp = GetThemeProvider(); if (!tp) return SK_ColorBLACK; const bool is_active_frame = ShouldPaintAsActiveFrame(); SkColor default_color; if (tab_state == TAB_ACTIVE) { default_color = tp->GetColor(ThemeProperties::COLOR_TAB_TEXT); } else { if (!is_active_frame && tp->HasCustomColor( ThemeProperties::COLOR_BACKGROUND_TAB_TEXT_INACTIVE)) { return tp->GetColor(ThemeProperties::COLOR_BACKGROUND_TAB_TEXT_INACTIVE); } const int color_id = ThemeProperties::COLOR_BACKGROUND_TAB_TEXT; default_color = tp->HasCustomColor(color_id) ? tp->GetColor(color_id) : color_utils::PickContrastingColor( gfx::kGoogleGrey400, gfx::kGoogleGrey800, background_color); } if (!is_active_frame) { default_color = color_utils::AlphaBlend(default_color, background_color, 0.75f); } return color_utils::GetColorWithMinimumContrast(default_color, background_color); }
0
370,701
static void process_delete_command(conn *c, token_t *tokens, const size_t ntokens) { char *key; size_t nkey; item *it; assert(c != NULL); if (ntokens > 3) { bool hold_is_zero = strcmp(tokens[KEY_TOKEN+1].value, "0") == 0; bool sets_noreply = set_noreply_maybe(c, tokens, ntokens); bool valid = (ntokens == 4 && (hold_is_zero || sets_noreply)) || (ntokens == 5 && hold_is_zero && sets_noreply); if (!valid) { out_string(c, "CLIENT_ERROR bad command line format. " "Usage: delete <key> [noreply]"); return; } } key = tokens[KEY_TOKEN].value; nkey = tokens[KEY_TOKEN].length; if(nkey > KEY_MAX_LENGTH) { out_string(c, "CLIENT_ERROR bad command line format"); return; } if (settings.detail_enabled) { stats_prefix_record_delete(key, nkey); } it = item_get(key, nkey); if (it) { MEMCACHED_COMMAND_DELETE(c->sfd, ITEM_key(it), it->nkey); pthread_mutex_lock(&c->thread->stats.mutex); c->thread->stats.slab_stats[it->slabs_clsid].delete_hits++; pthread_mutex_unlock(&c->thread->stats.mutex); item_unlink(it); item_remove(it); /* release our reference */ out_string(c, "DELETED"); } else { pthread_mutex_lock(&c->thread->stats.mutex); c->thread->stats.delete_misses++; pthread_mutex_unlock(&c->thread->stats.mutex); out_string(c, "NOT_FOUND"); } }
0
10,855
bool FrameSelection::SetSelectionDeprecated( const SelectionInDOMTree& passed_selection, const SetSelectionData& options) { DCHECK(IsAvailable()); passed_selection.AssertValidFor(GetDocument()); SelectionInDOMTree::Builder builder(passed_selection); if (ShouldAlwaysUseDirectionalSelection(frame_)) builder.SetIsDirectional(true); SelectionInDOMTree new_selection = builder.Build(); if (granularity_strategy_ && !options.DoNotClearStrategy()) granularity_strategy_->Clear(); granularity_ = options.Granularity(); if (options.ShouldCloseTyping()) TypingCommand::CloseTyping(frame_); if (options.ShouldClearTypingStyle()) frame_->GetEditor().ClearTypingStyle(); const SelectionInDOMTree old_selection_in_dom_tree = selection_editor_->GetSelectionInDOMTree(); if (old_selection_in_dom_tree == new_selection) return false; selection_editor_->SetSelection(new_selection); ScheduleVisualUpdateForPaintInvalidationIfNeeded(); const Document& current_document = GetDocument(); frame_->GetEditor().RespondToChangedSelection( old_selection_in_dom_tree.ComputeStartPosition(), options.ShouldCloseTyping() ? TypingContinuation::kEnd : TypingContinuation::kContinue); DCHECK_EQ(current_document, GetDocument()); return true; }
1
33,189
static void php_mysqlnd_sha256_pk_request_free_mem(void * _packet, zend_bool stack_allocation TSRMLS_DC) { if (!stack_allocation) { MYSQLND_PACKET_SHA256_PK_REQUEST * p = (MYSQLND_PACKET_SHA256_PK_REQUEST *) _packet; mnd_pefree(p, p->header.persistent); }
0
340,469
static int v9fs_do_open2(V9fsState *s, V9fsCreateState *vs) { FsCred cred; int flags; cred_init(&cred); cred.fc_uid = vs->fidp->uid; cred.fc_mode = vs->perm & 0777; flags = omode_to_uflags(vs->mode) | O_CREAT; return s->ops->open2(&s->ctx, vs->fullname.data, flags, &cred); }
0
127,783
static inline void *f2fs_kvzalloc(struct f2fs_sb_info *sbi, size_t size, gfp_t flags) { return f2fs_kvmalloc(sbi, size, flags | __GFP_ZERO); }
0
136,382
inline int web_client_api_request_single_chart(RRDHOST *host, struct web_client *w, char *url, void callback(RRDSET *st, BUFFER *buf)) { int ret = 400; char *chart = NULL; buffer_flush(w->response.data); while(url) { char *value = mystrsep(&url, "?&"); if(!value || !*value) continue; char *name = mystrsep(&value, "="); if(!name || !*name) continue; if(!value || !*value) continue; // name and value are now the parameters // they are not null and not empty if(!strcmp(name, "chart")) chart = value; //else { /// buffer_sprintf(w->response.data, "Unknown parameter '%s' in request.", name); // goto cleanup; //} } if(!chart || !*chart) { buffer_sprintf(w->response.data, "No chart id is given at the request."); goto cleanup; } RRDSET *st = rrdset_find(host, chart); if(!st) st = rrdset_find_byname(host, chart); if(!st) { buffer_strcat(w->response.data, "Chart is not found: "); buffer_strcat_htmlescape(w->response.data, chart); ret = 404; goto cleanup; } w->response.data->contenttype = CT_APPLICATION_JSON; st->last_accessed_time = now_realtime_sec(); callback(st, w->response.data); return 200; cleanup: return ret; }
0
19,214
static int vorbis_parse_setup_hdr_tdtransforms ( vorbis_context * vc ) { GetBitContext * gb = & vc -> gb ; unsigned i , vorbis_time_count = get_bits ( gb , 6 ) + 1 ; for ( i = 0 ; i < vorbis_time_count ; ++ i ) { unsigned vorbis_tdtransform = get_bits ( gb , 16 ) ; av_dlog ( NULL , " Vorbis time domain transform %u: %u\n" , vorbis_time_count , vorbis_tdtransform ) ; if ( vorbis_tdtransform ) { av_log ( vc -> avctx , AV_LOG_ERROR , "Vorbis time domain transform data nonzero. \n" ) ; return AVERROR_INVALIDDATA ; } } return 0 ; }
0
410,570
QPDFWriter::Members::~Members() { if (file && close_file) { fclose(file); } if (output_buffer) { delete output_buffer; } }
0
102,546
void SGeometry_PropertyScanner::open(int container_id) { // First check for container_id, if variable doesn't exist error out if(nc_inq_var(this->nc, container_id, nullptr, nullptr, nullptr, nullptr, nullptr) != NC_NOERR) { return; // change to exception } // Now exists, see what variables refer to this one // First get name of this container char contname[NC_MAX_NAME + 1]; memset(contname, 0, NC_MAX_NAME + 1); if(nc_inq_varname(this->nc, container_id, contname) != NC_NOERR) { return; } // Then scan throughout the netcdfDataset if those variables geometry_container // atrribute matches the container int varCount = 0; if(nc_inq_nvars(this->nc, &varCount) != NC_NOERR) { return; } for(int curr = 0; curr < varCount; curr++) { size_t contname2_len = 0; // First find container length, and make buf that size in chars if(nc_inq_attlen(this->nc, curr, CF_SG_GEOMETRY, &contname2_len) != NC_NOERR) { // not a geometry variable, continue continue; } // Also if present but empty, go on if(contname2_len == 0) continue; // Otherwise, geometry: see what container it has char buf[NC_MAX_CHAR + 1]; memset(buf, 0, NC_MAX_CHAR + 1); if(nc_get_att_text(this->nc, curr, CF_SG_GEOMETRY, buf)!= NC_NOERR) { continue; } // If matches, then establish a reference by placing this variable's data in both vectors if(!strcmp(contname, buf)) { char property_name[NC_MAX_NAME]; nc_inq_varname(this->nc, curr, property_name); std::string n(property_name); v_ids.push_back(curr); v_headers.push_back(n); } } }
0
209,864
process_pa_info(krb5_context context, const krb5_principal client, const AS_REQ *asreq, struct pa_info_data *paid, METHOD_DATA *md) { struct pa_info_data *p = NULL; size_t i; for (i = 0; p == NULL && i < sizeof(pa_prefs)/sizeof(pa_prefs[0]); i++) { PA_DATA *pa = find_pa_data(md, pa_prefs[i].type); if (pa == NULL) continue; paid->salt.salttype = (krb5_salttype)pa_prefs[i].type; p = (*pa_prefs[i].salt_info)(context, client, asreq, paid, &pa->padata_value); } return p; }
0
460,600
dnIsSuffixScope( struct berval *ndn, struct berval *nbase, int scope ) { if ( !dnIsSuffix( ndn, nbase ) ) { return 0; } return dnIsWithinScope( ndn, nbase, scope ); }
0
493,775
static void rename_open_files(connection_struct *conn, struct share_mode_lock *lck, struct file_id id, uint32_t orig_name_hash, const struct smb_filename *smb_fname_dst) { files_struct *fsp; bool did_rename = False; NTSTATUS status; uint32_t new_name_hash = 0; for(fsp = file_find_di_first(conn->sconn, id, false); fsp; fsp = file_find_di_next(fsp, false)) { SMB_STRUCT_STAT fsp_orig_sbuf; struct file_id_buf idbuf; /* fsp_name is a relative path under the fsp. To change this for other sharepaths we need to manipulate relative paths. */ /* TODO - create the absolute path and manipulate the newname relative to the sharepath. */ if (!strequal(fsp->conn->connectpath, conn->connectpath)) { continue; } if (fsp->name_hash != orig_name_hash) { continue; } DBG_DEBUG("renaming file %s " "(file_id %s) from %s -> %s\n", fsp_fnum_dbg(fsp), file_id_str_buf(fsp->file_id, &idbuf), fsp_str_dbg(fsp), smb_fname_str_dbg(smb_fname_dst)); /* * The incoming smb_fname_dst here has an * invalid stat struct (it must not have * existed for the rename to succeed). * Preserve the existing stat from the * open fsp after fsp_set_smb_fname() * overwrites with the invalid stat. * * We will do an fstat before returning * any of this metadata to the client anyway. */ fsp_orig_sbuf = fsp->fsp_name->st; status = fsp_set_smb_fname(fsp, smb_fname_dst); if (NT_STATUS_IS_OK(status)) { did_rename = True; new_name_hash = fsp->name_hash; /* Restore existing stat. */ fsp->fsp_name->st = fsp_orig_sbuf; } } if (!did_rename) { struct file_id_buf idbuf; DBG_DEBUG("no open files on file_id %s " "for %s\n", file_id_str_buf(id, &idbuf), smb_fname_str_dbg(smb_fname_dst)); } /* Send messages to all smbd's (not ourself) that the name has changed. */ rename_share_filename(conn->sconn->msg_ctx, lck, id, conn->connectpath, orig_name_hash, new_name_hash, smb_fname_dst); }
0
328,773
static void ff_h264_idct_add8_mmx(uint8_t **dest, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){ int i; for(i=16; i<16+8; i++){ if(nnzc[ scan8[i] ] || block[i*16]) ff_h264_idct_add_mmx (dest[(i&4)>>2] + block_offset[i], block + i*16, stride); } }
0
79,707
void pdf_delete(pdf_t *pdf) { int i; for (i=0; i<pdf->n_xrefs; i++) { free(pdf->xrefs[i].creator); free(pdf->xrefs[i].entries); free(pdf->xrefs[i].kids); } free(pdf->name); free(pdf->xrefs); free(pdf); }
0
182,067
void OmniboxViewWin::OnTemporaryTextMaybeChanged(const string16& display_text, bool save_original_selection) { if (save_original_selection) GetSelection(original_selection_); ScopedFreeze freeze(this, GetTextObjectModel()); SetWindowTextAndCaretPos(display_text, display_text.length()); TextChanged(); }
0
68,078
static inline RzBinDwarfLocList *create_loc_list(ut64 offset) { RzBinDwarfLocList *list = RZ_NEW0(RzBinDwarfLocList); if (list) { list->list = rz_list_new(); list->offset = offset; } return list; }
0
425,681
static int round_event_name_len(struct fsnotify_event *fsn_event) { struct inotify_event_info *event; event = INOTIFY_E(fsn_event); if (!event->name_len) return 0; return roundup(event->name_len + 1, sizeof(struct inotify_event)); }
0
282,882
xsltLocalVariablePop(xsltTransformContextPtr ctxt, int limitNr, int level) { xsltStackElemPtr variable; if (ctxt->varsNr <= 0) return; do { if (ctxt->varsNr <= limitNr) break; variable = ctxt->varsTab[ctxt->varsNr - 1]; if (variable->level <= level) break; if (variable->level >= 0) xsltFreeStackElemList(variable); ctxt->varsNr--; } while (ctxt->varsNr != 0); if (ctxt->varsNr > 0) ctxt->vars = ctxt->varsTab[ctxt->varsNr - 1]; else ctxt->vars = NULL; }
0
244,164
void Element::updateNamedItemRegistration(const AtomicString& oldName, const AtomicString& newName) { if (!document()->isHTMLDocument()) return; if (!oldName.isEmpty()) toHTMLDocument(document())->removeNamedItem(oldName); if (!newName.isEmpty()) toHTMLDocument(document())->addNamedItem(newName); }
0
399,324
static inline void debug_deactivate(struct hrtimer *timer) { debug_hrtimer_deactivate(timer); trace_hrtimer_cancel(timer); }
0
410,758
static char *expand_escapes(const char *line, SERVER_REC *server, WI_ITEM_REC *item) { char *ptr, *ret; const char *prev; int chr; prev = line; ret = ptr = g_malloc(strlen(line)+1); for (; *line != '\0'; line++) { if (*line != '\\') { *ptr++ = *line; continue; } line++; if (*line == '\0') { *ptr++ = '\\'; break; } chr = expand_escape(&line); if (chr == '\r' || chr == '\n') { /* newline .. we need to send another "send text" event to handle it (or actually the text before the newline..) */ if (prev != line) { char *prev_line = g_strndup(prev, (line - prev) - 1); event_text(prev_line, server, item); g_free(prev_line); prev = line + 1; ptr = ret; } } else if (chr != -1) { /* escaping went ok */ *ptr++ = chr; } else { /* unknown escape, add it as-is */ *ptr++ = '\\'; *ptr++ = *line; } } *ptr = '\0'; return ret; }
0
143,231
static int snd_timer_user_release(struct inode *inode, struct file *file) { struct snd_timer_user *tu; if (file->private_data) { tu = file->private_data; file->private_data = NULL; mutex_lock(&tu->ioctl_lock); if (tu->timeri) snd_timer_close(tu->timeri); mutex_unlock(&tu->ioctl_lock); kfree(tu->queue); kfree(tu->tqueue); kfree(tu); } return 0; }
0
4,765
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TF_LITE_ENSURE_EQ(context, NumInputs(node), 1); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); const TfLiteTensor* input = GetInput(context, node, kInputTensor); TfLiteIntArray* input_dims = input->dims; int input_dims_size = input_dims->size; TF_LITE_ENSURE(context, input_dims_size >= 1); TfLiteTensor* output = GetOutput(context, node, kOutputTensor); // Resize the output tensor. TfLiteIntArray* output_shape = TfLiteIntArrayCreate(input_dims_size + 1); for (int i = 0; i < input_dims_size; i++) { output_shape->data[i] = input_dims->data[i]; } // Last dimension in the output is the same as the last dimension in the // input. output_shape->data[input_dims_size] = input_dims->data[input_dims_size - 1]; output->type = input->type; TF_LITE_ENSURE_OK(context, context->ResizeTensor(context, output, output_shape)); return kTfLiteOk; }
1
308,753
static void xhci_port_update(XHCIPort *port, int is_detach) { uint32_t pls = PLS_RX_DETECT; port->portsc = PORTSC_PP; if (!is_detach && xhci_port_have_device(port)) { port->portsc |= PORTSC_CCS; switch (port->uport->dev->speed) { case USB_SPEED_LOW: port->portsc |= PORTSC_SPEED_LOW; pls = PLS_POLLING; break; case USB_SPEED_FULL: port->portsc |= PORTSC_SPEED_FULL; pls = PLS_POLLING; break; case USB_SPEED_HIGH: port->portsc |= PORTSC_SPEED_HIGH; pls = PLS_POLLING; break; case USB_SPEED_SUPER: port->portsc |= PORTSC_SPEED_SUPER; port->portsc |= PORTSC_PED; pls = PLS_U0; break; } } set_field(&port->portsc, pls, PORTSC_PLS); trace_usb_xhci_port_link(port->portnr, pls); xhci_port_notify(port, PORTSC_CSC); }
0
374,025
static int count_commas(char *s) { int n = 0; while (*s) { if (*s == ',') n ++; s ++; } return n; }
0
296,664
authenticate_job(cupsd_client_t *con, /* I - Client connection */ ipp_attribute_t *uri) /* I - Job URI */ { ipp_attribute_t *attr, /* job-id attribute */ *auth_info; /* auth-info attribute */ int jobid; /* Job ID */ cupsd_job_t *job; /* Current job */ char scheme[HTTP_MAX_URI], /* Method portion of URI */ username[HTTP_MAX_URI], /* Username portion of URI */ host[HTTP_MAX_URI], /* Host portion of URI */ resource[HTTP_MAX_URI]; /* Resource portion of URI */ int port; /* Port portion of URI */ cupsdLogMessage(CUPSD_LOG_DEBUG2, "authenticate_job(%p[%d], %s)", con, con->number, uri->values[0].string.text); /* * Start with "everything is OK" status... */ con->response->request.status.status_code = IPP_OK; /* * See if we have a job URI or a printer URI... */ if (!strcmp(uri->name, "printer-uri")) { /* * Got a printer URI; see if we also have a job-id attribute... */ if ((attr = ippFindAttribute(con->request, "job-id", IPP_TAG_INTEGER)) == NULL) { send_ipp_status(con, IPP_BAD_REQUEST, _("Got a printer-uri attribute but no job-id.")); return; } jobid = attr->values[0].integer; } else { /* * Got a job URI; parse it to get the job ID... */ httpSeparateURI(HTTP_URI_CODING_ALL, uri->values[0].string.text, scheme, sizeof(scheme), username, sizeof(username), host, sizeof(host), &port, resource, sizeof(resource)); if (strncmp(resource, "/jobs/", 6)) { /* * Not a valid URI! */ send_ipp_status(con, IPP_BAD_REQUEST, _("Bad job-uri \"%s\"."), uri->values[0].string.text); return; } jobid = atoi(resource + 6); } /* * See if the job exists... */ if ((job = cupsdFindJob(jobid)) == NULL) { /* * Nope - return a "not found" error... */ send_ipp_status(con, IPP_NOT_FOUND, _("Job #%d does not exist."), jobid); return; } /* * See if the job has been completed... */ if (job->state_value != IPP_JOB_HELD) { /* * Return a "not-possible" error... */ send_ipp_status(con, IPP_NOT_POSSIBLE, _("Job #%d is not held for authentication."), jobid); return; } /* * See if we have already authenticated... */ auth_info = ippFindAttribute(con->request, "auth-info", IPP_TAG_TEXT); if (!con->username[0] && !auth_info) { cupsd_printer_t *printer; /* Job destination */ /* * No auth data. If we need to authenticate via Kerberos, send a * HTTP auth challenge, otherwise just return an IPP error... */ printer = cupsdFindDest(job->dest); if (printer && printer->num_auth_info_required > 0 && !strcmp(printer->auth_info_required[0], "negotiate")) send_http_error(con, HTTP_UNAUTHORIZED, printer); else send_ipp_status(con, IPP_NOT_AUTHORIZED, _("No authentication information provided.")); return; } /* * See if the job is owned by the requesting user... */ if (!validate_user(job, con, job->username, username, sizeof(username))) { send_http_error(con, con->username[0] ? HTTP_FORBIDDEN : HTTP_UNAUTHORIZED, cupsdFindDest(job->dest)); return; } /* * Save the authentication information for this job... */ save_auth_info(con, job, auth_info); /* * Reset the job-hold-until value to "no-hold"... */ if ((attr = ippFindAttribute(job->attrs, "job-hold-until", IPP_TAG_KEYWORD)) == NULL) attr = ippFindAttribute(job->attrs, "job-hold-until", IPP_TAG_NAME); if (attr) { ippSetValueTag(job->attrs, &attr, IPP_TAG_KEYWORD); ippSetString(job->attrs, &attr, 0, "no-hold"); } /* * Release the job and return... */ cupsdReleaseJob(job); cupsdAddEvent(CUPSD_EVENT_JOB_STATE, NULL, job, "Job authenticated by user"); cupsdLogJob(job, CUPSD_LOG_INFO, "Authenticated by \"%s\".", con->username); cupsdCheckJobs(); }
0
220,370
void ResetMonitoredUrls() { base::AutoLock lock(lock_); monitored_urls_.clear(); }
0
37,120
did_set_spell_option(int is_spellfile) { char_u *errmsg = NULL; win_T *wp; int l; if (is_spellfile) { l = (int)STRLEN(curwin->w_s->b_p_spf); if (l > 0 && (l < 4 || STRCMP(curwin->w_s->b_p_spf + l - 4, ".add") != 0)) errmsg = e_invarg; } if (errmsg == NULL) { FOR_ALL_WINDOWS(wp) if (wp->w_buffer == curbuf && wp->w_p_spell) { errmsg = did_set_spelllang(wp); # ifdef FEAT_WINDOWS break; # endif } } return errmsg; }
0
422,459
ews_connection_gather_auth_methods_cb (SoupMessage *message, GSimpleAsyncResult *simple) { EwsAsyncData *async_data; const gchar *auths_lst; gboolean has_bearer = FALSE; gchar **auths; gint ii; async_data = g_simple_async_result_get_op_res_gpointer (simple); g_return_if_fail (async_data != NULL); auths_lst = soup_message_headers_get_list (message->response_headers, "WWW-Authenticate"); if (!auths_lst) return; auths = g_strsplit (auths_lst, ",", -1); for (ii = 0; auths && auths[ii]; ii++) { gchar *auth, *space; auth = g_strstrip (g_strdup (auths[ii])); if (auth && *auth) { space = strchr (auth, ' '); if (space) *space = '\0'; has_bearer = has_bearer || g_ascii_strcasecmp (auth, "Bearer") == 0; async_data->items = g_slist_prepend (async_data->items, auth); } else { g_free (auth); } } g_strfreev (auths); if (!has_bearer) { /* Special-case Office365 OAuth2, because outlook.office365.com doesn't advertise Bearer */ SoupURI *suri; suri = soup_message_get_uri (message); if (suri && soup_uri_get_host (suri) && g_ascii_strcasecmp (soup_uri_get_host (suri), "outlook.office365.com") == 0) { async_data->items = g_slist_prepend (async_data->items, g_strdup ("Bearer")); } } g_object_set_data (G_OBJECT (simple), EWS_OBJECT_KEY_AUTHS_GATHERED, GINT_TO_POINTER (1)); soup_message_set_status_full (message, SOUP_STATUS_CANCELLED, "EWS auths gathered"); }
0
218,928
qboolean FS_FilenameCompare( const char *s1, const char *s2 ) { int c1, c2; do { c1 = *s1++; c2 = *s2++; if ( Q_islower( c1 ) ) { c1 -= ( 'a' - 'A' ); } if ( Q_islower( c2 ) ) { c2 -= ( 'a' - 'A' ); } if ( c1 == '\\' || c1 == ':' ) { c1 = '/'; } if ( c2 == '\\' || c2 == ':' ) { c2 = '/'; } if ( c1 != c2 ) { return qtrue; // strings not equal } } while ( c1 ); return qfalse; // strings are equal }
0
165,873
void ClearState() { context_menu_request_received_ = false; context_menu_params_.source_type = ui::MENU_SOURCE_NONE; }
0
449,017
UTI_StringToIP(const char *addr, IPAddr *ip) { #ifdef FEAT_IPV6 struct in_addr in4; struct in6_addr in6; if (inet_pton(AF_INET, addr, &in4) > 0) { ip->family = IPADDR_INET4; ip->_pad = 0; ip->addr.in4 = ntohl(in4.s_addr); return 1; } if (inet_pton(AF_INET6, addr, &in6) > 0) { ip->family = IPADDR_INET6; ip->_pad = 0; memcpy(ip->addr.in6, in6.s6_addr, sizeof (ip->addr.in6)); return 1; } #else unsigned long a, b, c, d, n; n = sscanf(addr, "%lu.%lu.%lu.%lu", &a, &b, &c, &d); if (n == 4) { ip->family = IPADDR_INET4; ip->_pad = 0; ip->addr.in4 = ((a & 0xff) << 24) | ((b & 0xff) << 16) | ((c & 0xff) << 8) | (d & 0xff); return 1; } #endif return 0; }
0
401,839
ZEND_VM_HANDLER(128, ZEND_INIT_DYNAMIC_CALL, ANY, CONST|TMPVAR|CV, NUM) { USE_OPLINE zend_free_op free_op2; zval *function_name; zend_execute_data *call; SAVE_OPLINE(); function_name = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R); ZEND_VM_C_LABEL(try_function_name): if (OP2_TYPE != IS_CONST && EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) { call = zend_init_dynamic_call_string(Z_STR_P(function_name), opline->extended_value); } else if (OP2_TYPE != IS_CONST && EXPECTED(Z_TYPE_P(function_name) == IS_OBJECT)) { call = zend_init_dynamic_call_object(function_name, opline->extended_value); } else if (EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY)) { call = zend_init_dynamic_call_array(Z_ARRVAL_P(function_name), opline->extended_value); } else if ((OP2_TYPE & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(function_name) == IS_REFERENCE)) { function_name = Z_REFVAL_P(function_name); ZEND_VM_C_GOTO(try_function_name); } else { if (OP2_TYPE == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) { ZVAL_UNDEFINED_OP2(); if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); } } zend_throw_error(NULL, "Function name must be a string"); call = NULL; } FREE_OP2(); if (UNEXPECTED(!call)) { HANDLE_EXCEPTION(); } if (OP2_TYPE & (IS_VAR|IS_TMP_VAR)) { if (UNEXPECTED(EG(exception))) { if (call) { if (call->func->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) { zend_string_release_ex(call->func->common.function_name, 0); zend_free_trampoline(call->func); } zend_vm_stack_free_call_frame(call); } HANDLE_EXCEPTION(); } } call->prev_execute_data = EX(call); EX(call) = call; ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION(); }
0
459,689
dissect_kafka_offset_commit_response_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, kafka_api_version_t api_version) { proto_item *subti; proto_tree *subtree; int topic_start, topic_len; subtree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_kafka_topic, &subti, "Topic"); /* topic */ offset = dissect_kafka_string(subtree, hf_kafka_topic_name, tvb, pinfo, offset, api_version >= 8, &topic_start, &topic_len); /* [partition_response] */ offset = dissect_kafka_array(subtree, tvb, pinfo, offset, api_version >= 8, api_version, &dissect_kafka_offset_commit_response_partition_response, NULL); if (api_version >= 8) { offset = dissect_kafka_tagged_fields(tvb, pinfo, subtree, offset, 0); } proto_item_set_end(subti, tvb, offset); proto_item_append_text(subti, " (Name=%s)", tvb_get_string_enc(wmem_packet_scope(), tvb, topic_start, topic_len, ENC_UTF_8)); return offset; }
0
346,632
windows_icon_typefind (GstTypeFind * find, gpointer user_data) { const guint8 *data; gint64 datalen; guint16 type, nimages; gint32 size, offset; datalen = gst_type_find_get_length (find); if ((data = gst_type_find_peek (find, 0, 6)) == NULL) return; /* header - simple and not enough to rely on it alone */ if (GST_READ_UINT16_LE (data) != 0) return; type = GST_READ_UINT16_LE (data + 2); if (type != 1 && type != 2) return; nimages = GST_READ_UINT16_LE (data + 4); if (nimages == 0) /* we can assume we can't have an empty image file ? */ return; /* first image */ if (data[6 + 3] != 0) return; if (type == 1) { guint16 planes = GST_READ_UINT16_LE (data + 6 + 4); if (planes > 1) return; } size = GST_READ_UINT32_LE (data + 6 + 8); offset = GST_READ_UINT32_LE (data + 6 + 12); if (offset < 0 || size <= 0 || size >= datalen || offset >= datalen || size + offset > datalen) return; gst_type_find_suggest_simple (find, GST_TYPE_FIND_NEARLY_CERTAIN, "image/x-icon", NULL); }
1
114,964
static int page_cache_pipe_buf_steal(struct pipe_inode_info *pipe, struct pipe_buffer *buf) { struct page *page = buf->page; struct address_space *mapping; lock_page(page); mapping = page_mapping(page); if (mapping) { WARN_ON(!PageUptodate(page)); /* * At least for ext2 with nobh option, we need to wait on * writeback completing on this page, since we'll remove it * from the pagecache. Otherwise truncate wont wait on the * page, allowing the disk blocks to be reused by someone else * before we actually wrote our data to them. fs corruption * ensues. */ wait_on_page_writeback(page); if (page_has_private(page) && !try_to_release_page(page, GFP_KERNEL)) goto out_unlock; /* * If we succeeded in removing the mapping, set LRU flag * and return good. */ if (remove_mapping(mapping, page)) { buf->flags |= PIPE_BUF_FLAG_LRU; return 0; } } /* * Raced with truncate or failed to remove page from current * address space, unlock and return failure. */ out_unlock: unlock_page(page); return 1; }
0
18,830
static long timelib_parse_tz_cor ( char * * ptr ) { char * begin = * ptr , * end ; long tmp ; while ( isdigit ( * * ptr ) || * * ptr == ':' ) { ++ * ptr ; } end = * ptr ; switch ( end - begin ) { case 1 : case 2 : return HOUR ( strtol ( begin , NULL , 10 ) ) ; break ; case 3 : case 4 : if ( begin [ 1 ] == ':' ) { tmp = HOUR ( strtol ( begin , NULL , 10 ) ) + strtol ( begin + 2 , NULL , 10 ) ; return tmp ; } else if ( begin [ 2 ] == ':' ) { tmp = HOUR ( strtol ( begin , NULL , 10 ) ) + strtol ( begin + 3 , NULL , 10 ) ; return tmp ; } else { tmp = strtol ( begin , NULL , 10 ) ; return HOUR ( tmp / 100 ) + tmp % 100 ; } case 5 : tmp = HOUR ( strtol ( begin , NULL , 10 ) ) + strtol ( begin + 3 , NULL , 10 ) ; return tmp ; } return 0 ; }
0
441,892
static void ptrace_do_notify(int signr, int exit_code, int why) { kernel_siginfo_t info; clear_siginfo(&info); info.si_signo = signr; info.si_code = exit_code; info.si_pid = task_pid_vnr(current); info.si_uid = from_kuid_munged(current_user_ns(), current_uid()); /* Let the debugger run. */ ptrace_stop(exit_code, why, 1, &info); }
0
241,219
void ResourceLoader::DidReceiveResponse( const WebURLResponse& web_url_response, std::unique_ptr<WebDataConsumerHandle> handle) { DCHECK(!web_url_response.IsNull()); Resource::Type resource_type = resource_->GetType(); const ResourceRequest& initial_request = resource_->GetResourceRequest(); WebURLRequest::RequestContext request_context = initial_request.GetRequestContext(); WebURLRequest::FetchRequestMode fetch_request_mode = initial_request.GetFetchRequestMode(); const ResourceLoaderOptions& options = resource_->Options(); const ResourceResponse& response = web_url_response.ToResourceResponse(); StringBuilder cors_error_msg; resource_->SetCORSStatus(DetermineCORSStatus(response, cors_error_msg)); if (response.WasFetchedViaServiceWorker()) { if (options.cors_handling_by_resource_fetcher == kEnableCORSHandlingByResourceFetcher && fetch_request_mode == WebURLRequest::kFetchRequestModeCORS && response.WasFallbackRequiredByServiceWorker()) { ResourceRequest last_request = resource_->LastResourceRequest(); DCHECK_EQ(last_request.GetServiceWorkerMode(), WebURLRequest::ServiceWorkerMode::kAll); if (!Context().ShouldLoadNewResource(resource_type)) { HandleError(ResourceError::CancelledError(response.Url())); return; } last_request.SetServiceWorkerMode( WebURLRequest::ServiceWorkerMode::kForeign); Restart(last_request); return; } const KURL& original_url = response.OriginalURLViaServiceWorker(); if (!original_url.IsEmpty()) { Context().CheckCSPForRequest( request_context, original_url, options, SecurityViolationReportingPolicy::kReport, ResourceRequest::RedirectStatus::kFollowedRedirect); ResourceRequestBlockedReason blocked_reason = Context().CanRequest( resource_type, initial_request, original_url, options, SecurityViolationReportingPolicy::kReport, FetchParameters::kUseDefaultOriginRestrictionForType, ResourceRequest::RedirectStatus::kFollowedRedirect); if (blocked_reason != ResourceRequestBlockedReason::kNone) { HandleError(ResourceError::CancelledDueToAccessCheckError( original_url, blocked_reason)); return; } } } else if (options.cors_handling_by_resource_fetcher == kEnableCORSHandlingByResourceFetcher && fetch_request_mode == WebURLRequest::kFetchRequestModeCORS) { if (!resource_->IsSameOriginOrCORSSuccessful()) { if (!resource_->IsUnusedPreload()) Context().AddErrorConsoleMessage(cors_error_msg.ToString(), FetchContext::kJSSource); HandleError(ResourceError::CancelledDueToAccessCheckError( response.Url(), ResourceRequestBlockedReason::kOther)); return; } } Context().DispatchDidReceiveResponse( resource_->Identifier(), response, initial_request.GetFrameType(), request_context, resource_, FetchContext::ResourceResponseType::kNotFromMemoryCache); resource_->ResponseReceived(response, std::move(handle)); if (!resource_->Loader()) return; if (response.HttpStatusCode() >= 400 && !resource_->ShouldIgnoreHTTPStatusCodeErrors()) HandleError(ResourceError::CancelledError(response.Url())); }
0
440,231
onig_node_str_clear(Node* node) { if (STR_(node)->capacity != 0 && IS_NOT_NULL(STR_(node)->s) && STR_(node)->s != STR_(node)->buf) { xfree(STR_(node)->s); } STR_(node)->flag = 0; STR_(node)->s = STR_(node)->buf; STR_(node)->end = STR_(node)->buf; STR_(node)->capacity = 0; STR_(node)->case_min_len = 0; }
0
446,337
virDomainDiskSourceNVMeFormat(virBufferPtr attrBuf, virBufferPtr childBuf, const virStorageSourceNVMeDef *nvme) { virBufferAddLit(attrBuf, " type='pci'"); if (nvme->managed != VIR_TRISTATE_BOOL_ABSENT) virBufferAsprintf(attrBuf, " managed='%s'", virTristateBoolTypeToString(nvme->managed)); virBufferAsprintf(attrBuf, " namespace='%llu'", nvme->namespc); virPCIDeviceAddressFormat(childBuf, nvme->pciAddr, false); }
0
379,200
static inline void php_sqlite_strtoupper(char *s) { while (*s!='\0') { *s = toupper(*s); s++; } }
0
452,493
static void kbd_keycode(unsigned int keycode, int down, int hw_raw) { struct vc_data *vc = vc_cons[fg_console].d; unsigned short keysym, *key_map; unsigned char type; bool raw_mode; struct tty_struct *tty; int shift_final; struct keyboard_notifier_param param = { .vc = vc, .value = keycode, .down = down }; int rc; tty = vc->port.tty; if (tty && (!tty->driver_data)) { /* No driver data? Strange. Okay we fix it then. */ tty->driver_data = vc; } kbd = kbd_table + vc->vc_num; #ifdef CONFIG_SPARC if (keycode == KEY_STOP) sparc_l1_a_state = down; #endif rep = (down == 2); raw_mode = (kbd->kbdmode == VC_RAW); if (raw_mode && !hw_raw) if (emulate_raw(vc, keycode, !down << 7)) if (keycode < BTN_MISC && printk_ratelimit()) pr_warn("can't emulate rawmode for keycode %d\n", keycode); #ifdef CONFIG_SPARC if (keycode == KEY_A && sparc_l1_a_state) { sparc_l1_a_state = false; sun_do_break(); } #endif if (kbd->kbdmode == VC_MEDIUMRAW) { /* * This is extended medium raw mode, with keys above 127 * encoded as 0, high 7 bits, low 7 bits, with the 0 bearing * the 'up' flag if needed. 0 is reserved, so this shouldn't * interfere with anything else. The two bytes after 0 will * always have the up flag set not to interfere with older * applications. This allows for 16384 different keycodes, * which should be enough. */ if (keycode < 128) { put_queue(vc, keycode | (!down << 7)); } else { put_queue(vc, !down << 7); put_queue(vc, (keycode >> 7) | 0x80); put_queue(vc, keycode | 0x80); } raw_mode = true; } if (down) set_bit(keycode, key_down); else clear_bit(keycode, key_down); if (rep && (!vc_kbd_mode(kbd, VC_REPEAT) || (tty && !L_ECHO(tty) && tty_chars_in_buffer(tty)))) { /* * Don't repeat a key if the input buffers are not empty and the * characters get aren't echoed locally. This makes key repeat * usable with slow applications and under heavy loads. */ return; } param.shift = shift_final = (shift_state | kbd->slockstate) ^ kbd->lockstate; param.ledstate = kbd->ledflagstate; key_map = key_maps[shift_final]; rc = atomic_notifier_call_chain(&keyboard_notifier_list, KBD_KEYCODE, &param); if (rc == NOTIFY_STOP || !key_map) { atomic_notifier_call_chain(&keyboard_notifier_list, KBD_UNBOUND_KEYCODE, &param); do_compute_shiftstate(); kbd->slockstate = 0; return; } if (keycode < NR_KEYS) keysym = key_map[keycode]; else if (keycode >= KEY_BRL_DOT1 && keycode <= KEY_BRL_DOT8) keysym = U(K(KT_BRL, keycode - KEY_BRL_DOT1 + 1)); else return; type = KTYP(keysym); if (type < 0xf0) { param.value = keysym; rc = atomic_notifier_call_chain(&keyboard_notifier_list, KBD_UNICODE, &param); if (rc != NOTIFY_STOP) if (down && !raw_mode) k_unicode(vc, keysym, !down); return; } type -= 0xf0; if (type == KT_LETTER) { type = KT_LATIN; if (vc_kbd_led(kbd, VC_CAPSLOCK)) { key_map = key_maps[shift_final ^ (1 << KG_SHIFT)]; if (key_map) keysym = key_map[keycode]; } } param.value = keysym; rc = atomic_notifier_call_chain(&keyboard_notifier_list, KBD_KEYSYM, &param); if (rc == NOTIFY_STOP) return; if ((raw_mode || kbd->kbdmode == VC_OFF) && type != KT_SPEC && type != KT_SHIFT) return; (*k_handler[type])(vc, keysym & 0xff, !down); param.ledstate = kbd->ledflagstate; atomic_notifier_call_chain(&keyboard_notifier_list, KBD_POST_KEYSYM, &param); if (type != KT_SLOCK) kbd->slockstate = 0; }
0
396,353
poolGrow(STRING_POOL *pool) { if (pool->freeBlocks) { if (pool->start == 0) { pool->blocks = pool->freeBlocks; pool->freeBlocks = pool->freeBlocks->next; pool->blocks->next = NULL; pool->start = pool->blocks->s; pool->end = pool->start + pool->blocks->size; pool->ptr = pool->start; return XML_TRUE; } if (pool->end - pool->start < pool->freeBlocks->size) { BLOCK *tem = pool->freeBlocks->next; pool->freeBlocks->next = pool->blocks; pool->blocks = pool->freeBlocks; pool->freeBlocks = tem; memcpy(pool->blocks->s, pool->start, (pool->end - pool->start) * sizeof(XML_Char)); pool->ptr = pool->blocks->s + (pool->ptr - pool->start); pool->start = pool->blocks->s; pool->end = pool->start + pool->blocks->size; return XML_TRUE; } } if (pool->blocks && pool->start == pool->blocks->s) { BLOCK *temp; int blockSize = (int)((unsigned)(pool->end - pool->start)*2U); if (blockSize < 0) return XML_FALSE; temp = (BLOCK *) pool->mem->realloc_fcn(pool->blocks, (offsetof(BLOCK, s) + blockSize * sizeof(XML_Char))); if (temp == NULL) return XML_FALSE; pool->blocks = temp; pool->blocks->size = blockSize; pool->ptr = pool->blocks->s + (pool->ptr - pool->start); pool->start = pool->blocks->s; pool->end = pool->start + blockSize; } else { BLOCK *tem; int blockSize = (int)(pool->end - pool->start); if (blockSize < 0) return XML_FALSE; if (blockSize < INIT_BLOCK_SIZE) blockSize = INIT_BLOCK_SIZE; else blockSize *= 2; tem = (BLOCK *)pool->mem->malloc_fcn(offsetof(BLOCK, s) + blockSize * sizeof(XML_Char)); if (!tem) return XML_FALSE; tem->size = blockSize; tem->next = pool->blocks; pool->blocks = tem; if (pool->ptr != pool->start) memcpy(tem->s, pool->start, (pool->ptr - pool->start) * sizeof(XML_Char)); pool->ptr = tem->s + (pool->ptr - pool->start); pool->start = tem->s; pool->end = tem->s + blockSize; } return XML_TRUE; }
0
137,312
inline internal::NamedArgWithType<char, T> arg(StringRef name, const T &arg) { return internal::NamedArgWithType<char, T>(name, arg); }
0
282,623
static int ehci_state_fetchitd(EHCIState *ehci, int async) { uint32_t entry; EHCIitd itd; assert(!async); entry = ehci_get_fetch_addr(ehci, async); if (get_dwords(ehci, NLPTR_GET(entry), (uint32_t *) &itd, sizeof(EHCIitd) >> 2) < 0) { return -1; } ehci_trace_itd(ehci, entry, &itd); if (ehci_process_itd(ehci, &itd, entry) != 0) { return -1; } put_dwords(ehci, NLPTR_GET(entry), (uint32_t *) &itd, sizeof(EHCIitd) >> 2); ehci_set_fetch_addr(ehci, async, itd.next); ehci_set_state(ehci, async, EST_FETCHENTRY); return 1; }
0
355,215
do_notify_resume(struct pt_regs *regs, void *unused, __u32 thread_info_flags) { #ifdef DEBUG_SIG printk("do_notify_resume flags:%x ip:%lx sp:%lx caller:%p pending:%x\n", thread_info_flags, regs->ip, regs->sp, __builtin_return_address(0),signal_pending(current)); #endif /* Pending single-step? */ if (thread_info_flags & _TIF_SINGLESTEP) { regs->flags |= X86_EFLAGS_TF; clear_thread_flag(TIF_SINGLESTEP); } #ifdef CONFIG_X86_MCE /* notify userspace of pending MCEs */ if (thread_info_flags & _TIF_MCE_NOTIFY) mce_notify_user(); #endif /* CONFIG_X86_MCE */ /* deal with pending signal delivery */ if (thread_info_flags & (_TIF_SIGPENDING|_TIF_RESTORE_SIGMASK)) do_signal(regs); if (thread_info_flags & _TIF_HRTICK_RESCHED) hrtick_resched(); }
0
519,267
int Field_short::store(const char *from,size_t len,CHARSET_INFO *cs) { ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED; int store_tmp; int error; longlong rnd; error= get_int(cs, from, len, &rnd, UINT_MAX16, INT_MIN16, INT_MAX16); store_tmp= unsigned_flag ? (int) (ulonglong) rnd : (int) rnd; int2store(ptr, store_tmp); return error; }
0
25,210
int parse_args ( int argc , char * * argv ) { if ( load_defaults ( "my" , load_default_groups , & argc , & argv ) ) exit ( 1 ) ; default_argv = argv ; if ( ( handle_options ( & argc , & argv , my_long_options , get_one_option ) ) ) exit ( 1 ) ; if ( argc > 1 ) { usage ( ) ; exit ( 1 ) ; } if ( argc == 1 ) opt_db = * argv ; if ( tty_password ) opt_pass = get_tty_password ( NullS ) ; if ( debug_info_flag ) my_end_arg = MY_CHECK_ERROR | MY_GIVE_INFO ; if ( debug_check_flag ) my_end_arg |= MY_CHECK_ERROR ; if ( global_subst != NULL ) { char * comma = strstr ( global_subst , "," ) ; if ( comma == NULL ) die ( "wrong --global-subst, must be X,Y" ) ; memcpy ( global_subst_from , global_subst , ( comma - global_subst ) ) ; global_subst_from [ comma - global_subst ] = 0 ; memcpy ( global_subst_to , comma + 1 , strlen ( comma ) ) ; } if ( ! opt_suite_dir ) opt_suite_dir = "./" ; suite_dir_len = strlen ( opt_suite_dir ) ; overlay_dir_len = opt_overlay_dir ? strlen ( opt_overlay_dir ) : 0 ; if ( ! record ) { if ( result_file_name && access ( result_file_name , F_OK ) != 0 ) die ( "The specified result file '%s' does not exist" , result_file_name ) ; } return 0 ; }
0
516,863
alloc_group_fields(JOIN *join,ORDER *group) { if (group) { for (; group ; group=group->next) { Cached_item *tmp=new_Cached_item(join->thd, *group->item, TRUE); if (!tmp || join->group_fields.push_front(tmp)) return TRUE; } } join->sort_and_group=1; /* Mark for do_select */ return FALSE; }
0
94,333
static struct ib_ucontext *hns_roce_alloc_ucontext(struct ib_device *ib_dev, struct ib_udata *udata) { int ret = 0; struct hns_roce_ucontext *context; struct hns_roce_ib_alloc_ucontext_resp resp = {}; struct hns_roce_dev *hr_dev = to_hr_dev(ib_dev); resp.qp_tab_size = hr_dev->caps.num_qps; context = kmalloc(sizeof(*context), GFP_KERNEL); if (!context) return ERR_PTR(-ENOMEM); ret = hns_roce_uar_alloc(hr_dev, &context->uar); if (ret) goto error_fail_uar_alloc; if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_RECORD_DB) { INIT_LIST_HEAD(&context->page_list); mutex_init(&context->page_mutex); } ret = ib_copy_to_udata(udata, &resp, sizeof(resp)); if (ret) goto error_fail_copy_to_udata; return &context->ibucontext; error_fail_copy_to_udata: hns_roce_uar_free(hr_dev, &context->uar); error_fail_uar_alloc: kfree(context); return ERR_PTR(ret); }
0
25,180
static void encode_signal_range ( VC2EncContext * s ) { put_bits ( & s -> pb , 1 , ! s -> strict_compliance ) ; if ( ! s -> strict_compliance ) put_vc2_ue_uint ( & s -> pb , s -> bpp_idx ) ; }
0
226,290
void InlineTextBox::paintDocumentMarkers(GraphicsContext* pt, int tx, int ty, RenderStyle* style, const Font& font, bool background) { if (!renderer()->node()) return; Vector<DocumentMarker> markers = renderer()->document()->markers()->markersForNode(renderer()->node()); Vector<DocumentMarker>::iterator markerIt = markers.begin(); for ( ; markerIt != markers.end(); markerIt++) { const DocumentMarker& marker = *markerIt; switch (marker.type) { case DocumentMarker::Grammar: case DocumentMarker::Spelling: case DocumentMarker::Replacement: case DocumentMarker::CorrectionIndicator: case DocumentMarker::RejectedCorrection: if (background) continue; break; case DocumentMarker::TextMatch: if (!background) continue; break; default: ASSERT_NOT_REACHED(); } if (marker.endOffset <= start()) continue; if (marker.startOffset > end()) break; switch (marker.type) { case DocumentMarker::Spelling: paintSpellingOrGrammarMarker(pt, tx, ty, marker, style, font, false); break; case DocumentMarker::Grammar: paintSpellingOrGrammarMarker(pt, tx, ty, marker, style, font, true); break; case DocumentMarker::TextMatch: paintTextMatchMarker(pt, tx, ty, marker, style, font); break; case DocumentMarker::CorrectionIndicator: computeRectForReplacementMarker(tx, ty, marker, style, font); paintSpellingOrGrammarMarker(pt, tx, ty, marker, style, font, false); break; case DocumentMarker::Replacement: case DocumentMarker::RejectedCorrection: break; default: ASSERT_NOT_REACHED(); } } }
0
219,972
void V8TestObject::ReflectedNameAttributeSetterCallback( const v8::FunctionCallbackInfo<v8::Value>& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_reflectedName_Setter"); v8::Local<v8::Value> v8_value = info[0]; test_object_v8_internal::ReflectedNameAttributeSetter(v8_value, info); }
0
298,734
static SDL_INLINE void BG_Blended_Color(const TTF_Image *image, Uint32 *destination, Sint32 srcskip, Uint32 dstskip, Uint8 fg_alpha) { const Uint32 *src = (Uint32 *)image->buffer; Uint32 *dst = destination; Uint32 width = image->width; Uint32 height = image->rows; if (fg_alpha == 0) { /* SDL_ALPHA_OPAQUE */ while (height--) { /* *INDENT-OFF* */ DUFFS_LOOP4( *dst++ = *src++; , width); /* *INDENT-ON* */ src = (const Uint32 *)((const Uint8 *)src + srcskip); dst = (Uint32 *)((Uint8 *)dst + dstskip); } } else { Uint32 alpha; Uint32 tmp; while (height--) { /* *INDENT-OFF* */ DUFFS_LOOP4( tmp = *src++; alpha = tmp >> 24; tmp &= ~0xFF000000; alpha = fg_alpha * alpha; alpha = DIVIDE_BY_255(alpha) << 24; *dst++ = tmp | alpha , width); /* *INDENT-ON* */ src = (const Uint32 *)((const Uint8 *)src + srcskip); dst = (Uint32 *)((Uint8 *)dst + dstskip); } } }
0
47,367
static int r_core_cmd_nullcallback(void *data) { RCore *core = (RCore*) data; if (core->cons->context->breaked) { core->cons->context->breaked = false; return 0; } if (!core->cmdrepeat) { return 0; } r_core_cmd_repeat (core, true); return 1; }
0
12,786
static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, long elements, int objprops) { while (elements-- > 0) { zval *key, *data, **old_data; ALLOC_INIT_ZVAL(key); if (!php_var_unserialize(&key, p, max, NULL TSRMLS_CC)) { zval_dtor(key); FREE_ZVAL(key); return 0; } if (Z_TYPE_P(key) != IS_LONG && Z_TYPE_P(key) != IS_STRING) { zval_dtor(key); FREE_ZVAL(key); return 0; } ALLOC_INIT_ZVAL(data); if (!php_var_unserialize(&data, p, max, var_hash TSRMLS_CC)) { zval_dtor(key); FREE_ZVAL(key); zval_dtor(data); FREE_ZVAL(data); return 0; } if (!objprops) { switch (Z_TYPE_P(key)) { case IS_LONG: if (zend_hash_index_find(ht, Z_LVAL_P(key), (void **)&old_data)==SUCCESS) { var_push_dtor(var_hash, old_data); } zend_hash_index_update(ht, Z_LVAL_P(key), &data, sizeof(data), NULL); break; case IS_STRING: if (zend_symtable_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) { var_push_dtor(var_hash, old_data); } zend_symtable_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, sizeof(data), NULL); break; } } else { /* object properties should include no integers */ convert_to_string(key); zend_hash_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data, sizeof data, NULL); } if (elements && *(*p-1) != ';' && *(*p-1) != '}') { (*p)--; return 0; } }
1
166,702
int CountFilesCreatedAfter(const FilePath& path, const base::Time& comparison_time) { base::ThreadRestrictions::AssertIOAllowed(); int file_count = 0; DIR* dir = opendir(path.value().c_str()); if (dir) { #if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_BSD) && \ !defined(OS_SOLARIS) && !defined(OS_ANDROID) #error Port warning: depending on the definition of struct dirent, \ additional space for pathname may be needed #endif struct dirent ent_buf; struct dirent* ent; while (readdir_r(dir, &ent_buf, &ent) == 0 && ent) { if ((strcmp(ent->d_name, ".") == 0) || (strcmp(ent->d_name, "..") == 0)) continue; stat_wrapper_t st; int test = CallStat(path.Append(ent->d_name).value().c_str(), &st); if (test != 0) { DPLOG(ERROR) << "stat64 failed"; continue; } if (static_cast<time_t>(st.st_ctime) >= comparison_time.ToTimeT()) ++file_count; } closedir(dir); } return file_count; }
0
396,571
GC_API void GC_CALL GC_enable(void) { DCL_LOCK_STATE; LOCK(); GC_ASSERT(GC_dont_gc != 0); /* ensure no counter underflow */ GC_dont_gc--; UNLOCK(); }
0
173,944
status_t ACodec::allocateOutputBuffersFromNativeWindow() { OMX_U32 bufferCount, bufferSize, minUndequeuedBuffers; status_t err = configureOutputBuffersFromNativeWindow( &bufferCount, &bufferSize, &minUndequeuedBuffers); if (err != 0) return err; mNumUndequeuedBuffers = minUndequeuedBuffers; if (!storingMetadataInDecodedBuffers()) { static_cast<Surface*>(mNativeWindow.get()) ->getIGraphicBufferProducer()->allowAllocation(true); } ALOGV("[%s] Allocating %u buffers from a native window of size %u on " "output port", mComponentName.c_str(), bufferCount, bufferSize); for (OMX_U32 i = 0; i < bufferCount; i++) { ANativeWindowBuffer *buf; int fenceFd; err = mNativeWindow->dequeueBuffer(mNativeWindow.get(), &buf, &fenceFd); if (err != 0) { ALOGE("dequeueBuffer failed: %s (%d)", strerror(-err), -err); break; } sp<GraphicBuffer> graphicBuffer(new GraphicBuffer(buf, false)); BufferInfo info; info.mStatus = BufferInfo::OWNED_BY_US; info.mFenceFd = fenceFd; info.mIsReadFence = false; info.mRenderInfo = NULL; info.mData = new ABuffer(NULL /* data */, bufferSize /* capacity */); info.mGraphicBuffer = graphicBuffer; mBuffers[kPortIndexOutput].push(info); IOMX::buffer_id bufferId; err = mOMX->useGraphicBuffer(mNode, kPortIndexOutput, graphicBuffer, &bufferId); if (err != 0) { ALOGE("registering GraphicBuffer %u with OMX IL component failed: " "%d", i, err); break; } mBuffers[kPortIndexOutput].editItemAt(i).mBufferID = bufferId; ALOGV("[%s] Registered graphic buffer with ID %u (pointer = %p)", mComponentName.c_str(), bufferId, graphicBuffer.get()); } OMX_U32 cancelStart; OMX_U32 cancelEnd; if (err != 0) { cancelStart = 0; cancelEnd = mBuffers[kPortIndexOutput].size(); } else { cancelStart = bufferCount - minUndequeuedBuffers; cancelEnd = bufferCount; } for (OMX_U32 i = cancelStart; i < cancelEnd; i++) { BufferInfo *info = &mBuffers[kPortIndexOutput].editItemAt(i); if (info->mStatus == BufferInfo::OWNED_BY_US) { status_t error = cancelBufferToNativeWindow(info); if (err == 0) { err = error; } } } if (!storingMetadataInDecodedBuffers()) { static_cast<Surface*>(mNativeWindow.get()) ->getIGraphicBufferProducer()->allowAllocation(false); } return err; }
0
306,609
DEFINE_TEST(test_read_format_rar5_multiarchive_skip_all) { const char* reffiles[] = { "test_read_format_rar5_multiarchive.part01.rar", "test_read_format_rar5_multiarchive.part02.rar", "test_read_format_rar5_multiarchive.part03.rar", "test_read_format_rar5_multiarchive.part04.rar", "test_read_format_rar5_multiarchive.part05.rar", "test_read_format_rar5_multiarchive.part06.rar", "test_read_format_rar5_multiarchive.part07.rar", "test_read_format_rar5_multiarchive.part08.rar", NULL }; PROLOGUE_MULTI(reffiles); assertA(0 == archive_read_next_header(a, &ae)); assertEqualString("home/antek/temp/build/unrar5/libarchive/bin/bsdcat_test", archive_entry_pathname(ae)); assertA(0 == archive_read_next_header(a, &ae)); assertEqualString("home/antek/temp/build/unrar5/libarchive/bin/bsdtar_test", archive_entry_pathname(ae)); assertA(ARCHIVE_EOF == archive_read_next_header(a, &ae)); EPILOGUE(); }
0
396,051
word32 DecodeDSA_Signature(byte* decoded, const byte* encoded, word32 sz) { Source source(encoded, sz); if (source.next() != (SEQUENCE | CONSTRUCTED)) { source.SetError(SEQUENCE_E); return 0; } GetLength(source); // total // r if (source.next() != INTEGER) { source.SetError(INTEGER_E); return 0; } word32 rLen = GetLength(source); if (rLen != 20) { while (rLen > 20 && source.remaining() > 0) { // zero's at front, eat source.next(); --rLen; } if (rLen < 20) { // add zero's to front so 20 bytes word32 tmpLen = rLen; while (tmpLen < 20) { decoded[0] = 0; decoded++; tmpLen++; } } } memcpy(decoded, source.get_buffer() + source.get_index(), rLen); source.advance(rLen); // s if (source.next() != INTEGER) { source.SetError(INTEGER_E); return 0; } word32 sLen = GetLength(source); if (sLen != 20) { while (sLen > 20 && source.remaining() > 0) { source.next(); // zero's at front, eat --sLen; } if (sLen < 20) { // add zero's to front so 20 bytes word32 tmpLen = sLen; while (tmpLen < 20) { decoded[rLen] = 0; decoded++; tmpLen++; } } } memcpy(decoded + rLen, source.get_buffer() + source.get_index(), sLen); source.advance(sLen); return 40; }
0
408,572
int finish_transfer(const char *fname, const char *fnametmp, const char *fnamecmp, const char *partialptr, struct file_struct *file, int ok_to_set_time, int overwriting_basis) { int ret; const char *temp_copy_name = partialptr && *partialptr != '/' ? partialptr : NULL; if (inplace) { if (DEBUG_GTE(RECV, 1)) rprintf(FINFO, "finishing %s\n", fname); fnametmp = fname; goto do_set_file_attrs; } if (make_backups > 0 && overwriting_basis) { int ok = make_backup(fname, False); if (!ok) exit_cleanup(RERR_FILEIO); if (ok == 1 && fnamecmp == fname) fnamecmp = get_backup_name(fname); } /* Change permissions before putting the file into place. */ set_file_attrs(fnametmp, file, NULL, fnamecmp, ok_to_set_time ? 0 : ATTRS_SKIP_MTIME); /* move tmp file over real file */ if (DEBUG_GTE(RECV, 1)) rprintf(FINFO, "renaming %s to %s\n", fnametmp, fname); ret = robust_rename(fnametmp, fname, temp_copy_name, file->mode); if (ret < 0) { rsyserr(FERROR_XFER, errno, "%s %s -> \"%s\"", ret == -2 ? "copy" : "rename", full_fname(fnametmp), fname); if (!partialptr || (ret == -2 && temp_copy_name) || robust_rename(fnametmp, partialptr, NULL, file->mode) < 0) do_unlink(fnametmp); return 0; } if (ret == 0) { /* The file was moved into place (not copied), so it's done. */ return 1; } /* The file was copied, so tweak the perms of the copied file. If it * was copied to partialptr, move it into its final destination. */ fnametmp = temp_copy_name ? temp_copy_name : fname; do_set_file_attrs: set_file_attrs(fnametmp, file, NULL, fnamecmp, ok_to_set_time ? 0 : ATTRS_SKIP_MTIME); if (temp_copy_name) { if (do_rename(fnametmp, fname) < 0) { rsyserr(FERROR_XFER, errno, "rename %s -> \"%s\"", full_fname(fnametmp), fname); return 0; } handle_partial_dir(temp_copy_name, PDIR_DELETE); } return 1; }
0
394,098
static void __sched notrace preempt_schedule_common(void) { do { preempt_disable_notrace(); __schedule(true); preempt_enable_no_resched_notrace(); /* * Check again in case we missed a preemption opportunity * between schedule and now. */ } while (need_resched()); }
0
407,928
void FAST_FUNC dealloc_bunzip(bunzip_data *bd) { free(bd->dbuf); free(bd); }
0
319,092
void qemu_cond_init(QemuCond *cond) { memset(cond, 0, sizeof(*cond)); cond->sema = CreateSemaphore(NULL, 0, LONG_MAX, NULL); if (!cond->sema) { error_exit(GetLastError(), __func__); } cond->continue_event = CreateEvent(NULL, /* security */ FALSE, /* auto-reset */ FALSE, /* not signaled */ NULL); /* name */ if (!cond->continue_event) { error_exit(GetLastError(), __func__); } }
1
43,130
mrb_mod_module_function(mrb_state *mrb, mrb_value mod) { mrb_value *argv; mrb_int argc, i; mrb_sym mid; mrb_method_t m; struct RClass *rclass; int ai; mrb_check_type(mrb, mod, MRB_TT_MODULE); mrb_get_args(mrb, "*", &argv, &argc); if (argc == 0) { /* set MODFUNC SCOPE if implemented */ return mod; } /* set PRIVATE method visibility if implemented */ /* mrb_mod_dummy_visibility(mrb, mod); */ for (i=0; i<argc; i++) { mrb_check_type(mrb, argv[i], MRB_TT_SYMBOL); mid = mrb_symbol(argv[i]); rclass = mrb_class_ptr(mod); m = mrb_method_search(mrb, rclass, mid); prepare_singleton_class(mrb, (struct RBasic*)rclass); ai = mrb_gc_arena_save(mrb); mrb_define_method_raw(mrb, rclass->c, mid, m); mrb_gc_arena_restore(mrb, ai); } return mod; }
0
373,063
AbstractSqlMigrator::AbstractSqlMigrator() : _query(0) { }
0
331,019
static int usb_host_init(void) { const struct libusb_pollfd **poll; int i, rc; if (ctx) { return 0; } rc = libusb_init(&ctx); if (rc != 0) { return -1; } libusb_set_debug(ctx, loglevel); libusb_set_pollfd_notifiers(ctx, usb_host_add_fd, usb_host_del_fd, ctx); poll = libusb_get_pollfds(ctx); if (poll) { for (i = 0; poll[i] != NULL; i++) { usb_host_add_fd(poll[i]->fd, poll[i]->events, ctx); } } free(poll); return 0; }
0
11,401
bool SeekHead::ParseEntry(IMkvReader* pReader, long long start, long long size_, Entry* pEntry) { if (size_ <= 0) return false; long long pos = start; const long long stop = start + size_; long len; const long long seekIdId = ReadUInt(pReader, pos, len); if (seekIdId != 0x13AB) // SeekID ID return false; if ((pos + len) > stop) return false; pos += len; // consume SeekID id const long long seekIdSize = ReadUInt(pReader, pos, len); if (seekIdSize <= 0) return false; if ((pos + len) > stop) return false; pos += len; // consume size of field if ((pos + seekIdSize) > stop) return false; pEntry->id = ReadUInt(pReader, pos, len); // payload if (pEntry->id <= 0) return false; if (len != seekIdSize) return false; pos += seekIdSize; // consume SeekID payload const long long seekPosId = ReadUInt(pReader, pos, len); if (seekPosId != 0x13AC) // SeekPos ID return false; if ((pos + len) > stop) return false; pos += len; // consume id const long long seekPosSize = ReadUInt(pReader, pos, len); if (seekPosSize <= 0) return false; if ((pos + len) > stop) return false; pos += len; // consume size if ((pos + seekPosSize) > stop) return false; pEntry->pos = UnserializeUInt(pReader, pos, seekPosSize); if (pEntry->pos < 0) return false; pos += seekPosSize; // consume payload if (pos != stop) return false; return true; }
1
298,468
static size_t inet_nlmsg_size(void) { return NLMSG_ALIGN(sizeof(struct ifaddrmsg)) + nla_total_size(4) /* IFA_ADDRESS */ + nla_total_size(4) /* IFA_LOCAL */ + nla_total_size(4) /* IFA_BROADCAST */ + nla_total_size(IFNAMSIZ) /* IFA_LABEL */ + nla_total_size(4) /* IFA_FLAGS */ + nla_total_size(sizeof(struct ifa_cacheinfo)); /* IFA_CACHEINFO */ }
0
31,528
static inline void last_modified(TSRMLS_D) /* {{{ */ { const char *path; struct stat sb; char buf[MAX_STR + 1]; path = SG(request_info).path_translated; if (path) { if (VCWD_STAT(path, &sb) == -1) { return; } #define LAST_MODIFIED "Last-Modified: " memcpy(buf, LAST_MODIFIED, sizeof(LAST_MODIFIED) - 1); strcpy_gmt(buf + sizeof(LAST_MODIFIED) - 1, &sb.st_mtime); ADD_HEADER(buf); } }
0
509,211
int unit_add_node_link(Unit *u, const char *what, bool wants) { Unit *device; _cleanup_free_ char *e = NULL; int r; assert(u); if (!what) return 0; /* Adds in links to the device node that this unit is based on */ if (!is_device_path(what)) return 0; e = unit_name_from_path(what, ".device"); if (!e) return -ENOMEM; r = manager_load_unit(u->manager, e, NULL, NULL, &device); if (r < 0) return r; r = unit_add_two_dependencies(u, UNIT_AFTER, UNIT_BINDS_TO, device, true); if (r < 0) return r; if (wants) { r = unit_add_dependency(device, UNIT_WANTS, u, false); if (r < 0) return r; } return 0; }
0
414,712
} static inline bool ext4_has_incompat_features(struct super_block *sb) { return (EXT4_SB(sb)->s_es->s_feature_incompat != 0);
0
125,527
static BOOL rdp_recv_server_set_keyboard_ime_status_pdu(rdpRdp* rdp, wStream* s) { UINT16 unitId; UINT32 imeState; UINT32 imeConvMode; if (!rdp || !rdp->input) return FALSE; if (Stream_GetRemainingLength(s) < 10) return FALSE; Stream_Read_UINT16(s, unitId); /* unitId (2 bytes) */ Stream_Read_UINT32(s, imeState); /* imeState (4 bytes) */ Stream_Read_UINT32(s, imeConvMode); /* imeConvMode (4 bytes) */ IFCALL(rdp->update->SetKeyboardImeStatus, rdp->context, unitId, imeState, imeConvMode); return TRUE; }
0
407,802
int seccomp_load_syscall_filter_set(uint32_t default_action, const SyscallFilterSet *set, uint32_t action) { uint32_t arch; int r; assert(set); /* The one-stop solution: allocate a seccomp object, add the specified filter to it, and apply it. Once for * earch local arch. */ SECCOMP_FOREACH_LOCAL_ARCH(arch) { _cleanup_(seccomp_releasep) scmp_filter_ctx seccomp = NULL; log_debug("Operating on architecture: %s", seccomp_arch_to_string(arch)); r = seccomp_init_for_arch(&seccomp, arch, default_action); if (r < 0) return r; r = seccomp_add_syscall_filter_set(seccomp, set, action, NULL); if (r < 0) { log_debug_errno(r, "Failed to add filter set, ignoring: %m"); continue; } r = seccomp_load(seccomp); if (IN_SET(r, -EPERM, -EACCES)) return r; if (r < 0) log_debug_errno(r, "Failed to install filter set for architecture %s, skipping: %m", seccomp_arch_to_string(arch)); } return 0; }
0
210,431
zdoneshowpage(i_ctx_t *i_ctx_p) { gx_device *dev = gs_currentdevice(igs); gx_device *tdev = (*dev_proc(dev, get_page_device)) (dev); if (tdev != 0) tdev->ShowpageCount++; return 0; }
0