idx
int64
func
string
target
int64
330,319
static int thread_get_buffer_internal(AVCodecContext *avctx, ThreadFrame *f, int flags) { PerThreadContext *p = avctx->thread_opaque; int err; f->owner = avctx; ff_init_buffer_info(avctx, f->f); if (!(avctx->active_thread_type & FF_THREAD_FRAME)) return ff_get_buffer(avctx, f->f, flags); if (p->state != STATE_SETTING_UP && (avctx->codec->update_thread_context || (!avctx->thread_safe_callbacks && avctx->get_buffer != avcodec_default_get_buffer))) { av_log(avctx, AV_LOG_ERROR, "get_buffer() cannot be called after ff_thread_finish_setup()\n"); return -1; } if (avctx->internal->allocate_progress) { int *progress; f->progress = av_buffer_alloc(2 * sizeof(int)); if (!f->progress) { return AVERROR(ENOMEM); } progress = (int*)f->progress->data; progress[0] = progress[1] = -1; } pthread_mutex_lock(&p->parent->buffer_mutex); if (avctx->thread_safe_callbacks || ( #if FF_API_GET_BUFFER !avctx->get_buffer && #endif avctx->get_buffer2 == avcodec_default_get_buffer2)) { err = ff_get_buffer(avctx, f->f, flags); } else { pthread_mutex_lock(&p->progress_mutex); p->requested_frame = f->f; p->requested_flags = flags; p->state = STATE_GET_BUFFER; pthread_cond_broadcast(&p->progress_cond); while (p->state != STATE_SETTING_UP) pthread_cond_wait(&p->progress_cond, &p->progress_mutex); err = p->result; pthread_mutex_unlock(&p->progress_mutex); if (!avctx->codec->update_thread_context) ff_thread_finish_setup(avctx); } if (err) av_buffer_unref(&f->progress); pthread_mutex_unlock(&p->parent->buffer_mutex); return err; }
0
183,114
void DocumentLoader::SetSubresourceFilter( SubresourceFilter* subresource_filter) { subresource_filter_ = subresource_filter; }
0
479,268
bool containsXYZC(const int x, const int y=0, const int z=0, const int c=0) const { return !is_empty() && x>=0 && x<width() && y>=0 && y<height() && z>=0 && z<depth() && c>=0 && c<spectrum(); }
0
135,068
static MagickBooleanType ReadPSDLayer(Image *image,const ImageInfo *image_info, const PSDInfo *psd_info,LayerInfo* layer_info,ExceptionInfo *exception) { char message[MagickPathExtent]; MagickBooleanType status; PSDCompressionType compression; ssize_t j; if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " setting up new layer image"); if (psd_info->mode != IndexedMode) (void) SetImageBackgroundColor(layer_info->image,exception); layer_info->image->compose=PSDBlendModeToCompositeOperator( layer_info->blendkey); if (layer_info->visible == MagickFalse) layer_info->image->compose=NoCompositeOp; if (psd_info->mode == CMYKMode) SetImageColorspace(layer_info->image,CMYKColorspace,exception); else if ((psd_info->mode == BitmapMode) || (psd_info->mode == DuotoneMode) || (psd_info->mode == GrayscaleMode)) SetImageColorspace(layer_info->image,GRAYColorspace,exception); /* Set up some hidden attributes for folks that need them. */ (void) FormatLocaleString(message,MagickPathExtent,"%.20g", (double) layer_info->page.x); (void) SetImageArtifact(layer_info->image,"psd:layer.x",message); (void) FormatLocaleString(message,MagickPathExtent,"%.20g", (double) layer_info->page.y); (void) SetImageArtifact(layer_info->image,"psd:layer.y",message); (void) FormatLocaleString(message,MagickPathExtent,"%.20g",(double) layer_info->opacity); (void) SetImageArtifact(layer_info->image,"psd:layer.opacity",message); (void) SetImageProperty(layer_info->image,"label",(char *) layer_info->name, exception); status=MagickTrue; for (j=0; j < (ssize_t) layer_info->channels; j++) { if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " reading data for channel %.20g",(double) j); compression=(PSDCompressionType) ReadBlobShort(layer_info->image); layer_info->image->compression=ConvertPSDCompression(compression); if (layer_info->channel_info[j].type == -1) layer_info->image->alpha_trait=BlendPixelTrait; status=ReadPSDChannel(layer_info->image,image_info,psd_info,layer_info,j, compression,exception); if (status == MagickFalse) break; } if (status != MagickFalse) status=ApplyPSDLayerOpacity(layer_info->image,layer_info->opacity, MagickFalse,exception); if ((status != MagickFalse) && (layer_info->image->colorspace == CMYKColorspace)) status=NegateCMYK(layer_info->image,exception); if ((status != MagickFalse) && (layer_info->mask.image != (Image *) NULL)) { const char *option; layer_info->mask.image->page.x=layer_info->mask.page.x; layer_info->mask.image->page.y=layer_info->mask.page.y; /* Do not composite the mask when it is disabled */ if ((layer_info->mask.flags & 0x02) == 0x02) layer_info->mask.image->compose=NoCompositeOp; else status=ApplyPSDOpacityMask(layer_info->image,layer_info->mask.image, layer_info->mask.background == 0 ? 0 : QuantumRange,MagickFalse, exception); option=GetImageOption(image_info,"psd:preserve-opacity-mask"); if (IsStringTrue(option) != MagickFalse) PreservePSDOpacityMask(image,layer_info,exception); layer_info->mask.image=DestroyImage(layer_info->mask.image); } return(status); }
0
213,810
WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( RenderFrame* render_frame, const NavigationPolicyInfo& info) { Referrer referrer(RenderViewImpl::GetReferrerFromRequest(info.frame, info.urlRequest)); if (SiteIsolationPolicy::IsSwappedOutStateForbidden() && is_subframe_) { } else { if (is_swapped_out_) { if (info.urlRequest.url() != GURL(kSwappedOutURL)) { if (info.frame->parent() == NULL) { OpenURL(info.frame, info.urlRequest.url(), referrer, info.defaultPolicy); return blink::WebNavigationPolicyIgnore; // Suppress the load here. } return blink::WebNavigationPolicyIgnore; } return info.defaultPolicy; } } const GURL& url = info.urlRequest.url(); DocumentState* document_state = static_cast<DocumentState*>(info.extraData); bool is_content_initiated = document_state->navigation_state()->IsContentInitiated(); if (is_content_initiated) { bool is_form_post = ((info.navigationType == blink::WebNavigationTypeFormSubmitted) || (info.navigationType == blink::WebNavigationTypeFormResubmitted)) && base::EqualsASCII(base::StringPiece16(info.urlRequest.httpMethod()), "POST"); bool browser_handles_request = render_view_->renderer_preferences_ .browser_handles_non_local_top_level_requests && IsNonLocalTopLevelNavigation(url, info.frame, info.navigationType, is_form_post); if (!browser_handles_request) { browser_handles_request = IsTopLevelNavigation(info.frame) && render_view_->renderer_preferences_ .browser_handles_all_top_level_requests; } if (browser_handles_request) { OpenURL(info.frame, url, referrer, info.defaultPolicy); return blink::WebNavigationPolicyIgnore; // Suppress the load here. } } GURL old_url(info.frame->dataSource()->request().url()); if (!info.frame->parent() && is_content_initiated && !url.SchemeIs(url::kAboutScheme)) { bool send_referrer = false; int cumulative_bindings = RenderProcess::current()->GetEnabledBindings(); bool is_initial_navigation = render_view_->history_list_length_ == 0; bool should_fork = HasWebUIScheme(url) || HasWebUIScheme(old_url) || (cumulative_bindings & BINDINGS_POLICY_WEB_UI) || url.SchemeIs(kViewSourceScheme) || (info.frame->isViewSourceModeEnabled() && info.navigationType != blink::WebNavigationTypeReload); if (!should_fork && url.SchemeIs(url::kFileScheme)) { GURL source_url(old_url); if (is_initial_navigation && source_url.is_empty() && info.frame->opener()) source_url = info.frame->opener()->top()->document().url(); DCHECK(!source_url.is_empty()); should_fork = !source_url.SchemeIs(url::kFileScheme); } if (!should_fork) { should_fork = GetContentClient()->renderer()->ShouldFork( info.frame, url, info.urlRequest.httpMethod().utf8(), is_initial_navigation, info.isRedirect, &send_referrer); } if (should_fork) { OpenURL(info.frame, url, send_referrer ? referrer : Referrer(), info.defaultPolicy); return blink::WebNavigationPolicyIgnore; // Suppress the load here. } } bool is_fork = old_url == GURL(url::kAboutBlankURL) && render_view_->historyBackListCount() < 1 && render_view_->historyForwardListCount() < 1 && info.frame->opener() == NULL && info.frame->parent() == NULL && is_content_initiated && info.defaultPolicy == blink::WebNavigationPolicyCurrentTab && info.navigationType == blink::WebNavigationTypeOther; if (is_fork) { OpenURL(info.frame, url, Referrer(), info.defaultPolicy); return blink::WebNavigationPolicyIgnore; } if (base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableBrowserSideNavigation) && info.urlRequest.checkForBrowserSideNavigation() && ShouldMakeNetworkRequestForURL(url)) { BeginNavigation(&info.urlRequest); return blink::WebNavigationPolicyIgnore; } return info.defaultPolicy; }
0
382,270
ShowUsage(const char *title) { StringInfoData str; struct timeval user, sys; struct timeval elapse_t; struct rusage r; getrusage(RUSAGE_SELF, &r); gettimeofday(&elapse_t, NULL); memcpy((char *) &user, (char *) &r.ru_utime, sizeof(user)); memcpy((char *) &sys, (char *) &r.ru_stime, sizeof(sys)); if (elapse_t.tv_usec < Save_t.tv_usec) { elapse_t.tv_sec--; elapse_t.tv_usec += 1000000; } if (r.ru_utime.tv_usec < Save_r.ru_utime.tv_usec) { r.ru_utime.tv_sec--; r.ru_utime.tv_usec += 1000000; } if (r.ru_stime.tv_usec < Save_r.ru_stime.tv_usec) { r.ru_stime.tv_sec--; r.ru_stime.tv_usec += 1000000; } /* * the only stats we don't show here are for memory usage -- i can't * figure out how to interpret the relevant fields in the rusage struct, * and they change names across o/s platforms, anyway. if you can figure * out what the entries mean, you can somehow extract resident set size, * shared text size, and unshared data and stack sizes. */ initStringInfo(&str); appendStringInfoString(&str, "! system usage stats:\n"); appendStringInfo(&str, "!\t%ld.%06ld elapsed %ld.%06ld user %ld.%06ld system sec\n", (long) (elapse_t.tv_sec - Save_t.tv_sec), (long) (elapse_t.tv_usec - Save_t.tv_usec), (long) (r.ru_utime.tv_sec - Save_r.ru_utime.tv_sec), (long) (r.ru_utime.tv_usec - Save_r.ru_utime.tv_usec), (long) (r.ru_stime.tv_sec - Save_r.ru_stime.tv_sec), (long) (r.ru_stime.tv_usec - Save_r.ru_stime.tv_usec)); appendStringInfo(&str, "!\t[%ld.%06ld user %ld.%06ld sys total]\n", (long) user.tv_sec, (long) user.tv_usec, (long) sys.tv_sec, (long) sys.tv_usec); #if defined(HAVE_GETRUSAGE) appendStringInfo(&str, "!\t%ld/%ld [%ld/%ld] filesystem blocks in/out\n", r.ru_inblock - Save_r.ru_inblock, /* they only drink coffee at dec */ r.ru_oublock - Save_r.ru_oublock, r.ru_inblock, r.ru_oublock); appendStringInfo(&str, "!\t%ld/%ld [%ld/%ld] page faults/reclaims, %ld [%ld] swaps\n", r.ru_majflt - Save_r.ru_majflt, r.ru_minflt - Save_r.ru_minflt, r.ru_majflt, r.ru_minflt, r.ru_nswap - Save_r.ru_nswap, r.ru_nswap); appendStringInfo(&str, "!\t%ld [%ld] signals rcvd, %ld/%ld [%ld/%ld] messages rcvd/sent\n", r.ru_nsignals - Save_r.ru_nsignals, r.ru_nsignals, r.ru_msgrcv - Save_r.ru_msgrcv, r.ru_msgsnd - Save_r.ru_msgsnd, r.ru_msgrcv, r.ru_msgsnd); appendStringInfo(&str, "!\t%ld/%ld [%ld/%ld] voluntary/involuntary context switches\n", r.ru_nvcsw - Save_r.ru_nvcsw, r.ru_nivcsw - Save_r.ru_nivcsw, r.ru_nvcsw, r.ru_nivcsw); #endif /* HAVE_GETRUSAGE */ /* remove trailing newline */ if (str.data[str.len - 1] == '\n') str.data[--str.len] = '\0'; ereport(LOG, (errmsg_internal("%s", title), errdetail_internal("%s", str.data))); pfree(str.data); }
0
112,945
static int common_timer_create(struct k_itimer *new_timer) { hrtimer_init(&new_timer->it.real.timer, new_timer->it_clock, 0); return 0; }
0
104,820
static int sctp_setsockopt(struct sock *sk, int level, int optname, char __user *optval, unsigned int optlen) { int retval = 0; pr_debug("%s: sk:%p, optname:%d\n", __func__, sk, optname); /* I can hardly begin to describe how wrong this is. This is * so broken as to be worse than useless. The API draft * REALLY is NOT helpful here... I am not convinced that the * semantics of setsockopt() with a level OTHER THAN SOL_SCTP * are at all well-founded. */ if (level != SOL_SCTP) { struct sctp_af *af = sctp_sk(sk)->pf->af; retval = af->setsockopt(sk, level, optname, optval, optlen); goto out_nounlock; } lock_sock(sk); switch (optname) { case SCTP_SOCKOPT_BINDX_ADD: /* 'optlen' is the size of the addresses buffer. */ retval = sctp_setsockopt_bindx(sk, (struct sockaddr __user *)optval, optlen, SCTP_BINDX_ADD_ADDR); break; case SCTP_SOCKOPT_BINDX_REM: /* 'optlen' is the size of the addresses buffer. */ retval = sctp_setsockopt_bindx(sk, (struct sockaddr __user *)optval, optlen, SCTP_BINDX_REM_ADDR); break; case SCTP_SOCKOPT_CONNECTX_OLD: /* 'optlen' is the size of the addresses buffer. */ retval = sctp_setsockopt_connectx_old(sk, (struct sockaddr __user *)optval, optlen); break; case SCTP_SOCKOPT_CONNECTX: /* 'optlen' is the size of the addresses buffer. */ retval = sctp_setsockopt_connectx(sk, (struct sockaddr __user *)optval, optlen); break; case SCTP_DISABLE_FRAGMENTS: retval = sctp_setsockopt_disable_fragments(sk, optval, optlen); break; case SCTP_EVENTS: retval = sctp_setsockopt_events(sk, optval, optlen); break; case SCTP_AUTOCLOSE: retval = sctp_setsockopt_autoclose(sk, optval, optlen); break; case SCTP_PEER_ADDR_PARAMS: retval = sctp_setsockopt_peer_addr_params(sk, optval, optlen); break; case SCTP_DELAYED_SACK: retval = sctp_setsockopt_delayed_ack(sk, optval, optlen); break; case SCTP_PARTIAL_DELIVERY_POINT: retval = sctp_setsockopt_partial_delivery_point(sk, optval, optlen); break; case SCTP_INITMSG: retval = sctp_setsockopt_initmsg(sk, optval, optlen); break; case SCTP_DEFAULT_SEND_PARAM: retval = sctp_setsockopt_default_send_param(sk, optval, optlen); break; case SCTP_DEFAULT_SNDINFO: retval = sctp_setsockopt_default_sndinfo(sk, optval, optlen); break; case SCTP_PRIMARY_ADDR: retval = sctp_setsockopt_primary_addr(sk, optval, optlen); break; case SCTP_SET_PEER_PRIMARY_ADDR: retval = sctp_setsockopt_peer_primary_addr(sk, optval, optlen); break; case SCTP_NODELAY: retval = sctp_setsockopt_nodelay(sk, optval, optlen); break; case SCTP_RTOINFO: retval = sctp_setsockopt_rtoinfo(sk, optval, optlen); break; case SCTP_ASSOCINFO: retval = sctp_setsockopt_associnfo(sk, optval, optlen); break; case SCTP_I_WANT_MAPPED_V4_ADDR: retval = sctp_setsockopt_mappedv4(sk, optval, optlen); break; case SCTP_MAXSEG: retval = sctp_setsockopt_maxseg(sk, optval, optlen); break; case SCTP_ADAPTATION_LAYER: retval = sctp_setsockopt_adaptation_layer(sk, optval, optlen); break; case SCTP_CONTEXT: retval = sctp_setsockopt_context(sk, optval, optlen); break; case SCTP_FRAGMENT_INTERLEAVE: retval = sctp_setsockopt_fragment_interleave(sk, optval, optlen); break; case SCTP_MAX_BURST: retval = sctp_setsockopt_maxburst(sk, optval, optlen); break; case SCTP_AUTH_CHUNK: retval = sctp_setsockopt_auth_chunk(sk, optval, optlen); break; case SCTP_HMAC_IDENT: retval = sctp_setsockopt_hmac_ident(sk, optval, optlen); break; case SCTP_AUTH_KEY: retval = sctp_setsockopt_auth_key(sk, optval, optlen); break; case SCTP_AUTH_ACTIVE_KEY: retval = sctp_setsockopt_active_key(sk, optval, optlen); break; case SCTP_AUTH_DELETE_KEY: retval = sctp_setsockopt_del_key(sk, optval, optlen); break; case SCTP_AUTO_ASCONF: retval = sctp_setsockopt_auto_asconf(sk, optval, optlen); break; case SCTP_PEER_ADDR_THLDS: retval = sctp_setsockopt_paddr_thresholds(sk, optval, optlen); break; case SCTP_RECVRCVINFO: retval = sctp_setsockopt_recvrcvinfo(sk, optval, optlen); break; case SCTP_RECVNXTINFO: retval = sctp_setsockopt_recvnxtinfo(sk, optval, optlen); break; case SCTP_PR_SUPPORTED: retval = sctp_setsockopt_pr_supported(sk, optval, optlen); break; case SCTP_DEFAULT_PRINFO: retval = sctp_setsockopt_default_prinfo(sk, optval, optlen); break; default: retval = -ENOPROTOOPT; break; } release_sock(sk); out_nounlock: return retval; }
0
436,821
void repo_read_gitmodules(struct repository *repo) { submodule_cache_check_init(repo); if (repo->worktree) { char *gitmodules; if (repo_read_index(repo) < 0) return; gitmodules = repo_worktree_path(repo, GITMODULES_FILE); if (!is_gitmodules_unmerged(repo->index)) git_config_from_file(gitmodules_cb, gitmodules, repo); free(gitmodules); } repo->submodule_cache->gitmodules_read = 1; }
0
422,322
mail_config_ews_autodiscover_run_thread (GTask *task, gpointer source_object, gpointer task_data, GCancellable *cancellable) { AsyncContext *async_context = task_data; GError *local_error = NULL; gboolean success = FALSE; if (!g_cancellable_set_error_if_cancelled (cancellable, &local_error) && !local_error) { gboolean without_password; without_password = e_ews_connection_utils_get_without_password (async_context->ews_settings); if (without_password) { success = e_ews_autodiscover_ws_url_sync (async_context->source, async_context->ews_settings, async_context->email_address, "", &async_context->certificate_pem, &async_context->certificate_errors, cancellable, &local_error); } if (!without_password || g_error_matches (local_error, SOUP_HTTP_ERROR, SOUP_STATUS_UNAUTHORIZED)) { EShell *shell; e_ews_connection_utils_force_off_ntlm_auth_check (); g_clear_error (&local_error); shell = e_shell_get_default (); success = e_credentials_prompter_loop_prompt_sync (e_shell_get_credentials_prompter (shell), async_context->source, E_CREDENTIALS_PROMPTER_PROMPT_FLAG_ALLOW_SOURCE_SAVE, mail_config_ews_autodiscover_sync, async_context, cancellable, &local_error); } } if (local_error != NULL) { g_task_return_error (task, local_error); } else { g_task_return_boolean (task, success); } }
0
18,207
static int parse_streaminfo ( FLACContext * s , const uint8_t * buf , int buf_size ) { int metadata_type , metadata_size , ret ; if ( buf_size < FLAC_STREAMINFO_SIZE + 8 ) { return 0 ; } avpriv_flac_parse_block_header ( & buf [ 4 ] , NULL , & metadata_type , & metadata_size ) ; if ( metadata_type != FLAC_METADATA_TYPE_STREAMINFO || metadata_size != FLAC_STREAMINFO_SIZE ) { return AVERROR_INVALIDDATA ; } avpriv_flac_parse_streaminfo ( s -> avctx , ( FLACStreaminfo * ) s , & buf [ 8 ] ) ; ret = allocate_buffers ( s ) ; if ( ret < 0 ) return ret ; flac_set_bps ( s ) ; ff_flacdsp_init ( & s -> dsp , s -> avctx -> sample_fmt , s -> bps ) ; s -> got_streaminfo = 1 ; return 0 ; }
0
325,617
static int probe_file(WriterContext *wctx, const char *filename) { AVFormatContext *fmt_ctx; int ret, i; int section_id; do_read_frames = do_show_frames || do_count_frames; do_read_packets = do_show_packets || do_count_packets; ret = open_input_file(&fmt_ctx, filename); if (ret < 0) return ret; nb_streams_frames = av_calloc(fmt_ctx->nb_streams, sizeof(*nb_streams_frames)); nb_streams_packets = av_calloc(fmt_ctx->nb_streams, sizeof(*nb_streams_packets)); selected_streams = av_calloc(fmt_ctx->nb_streams, sizeof(*selected_streams)); for (i = 0; i < fmt_ctx->nb_streams; i++) { if (stream_specifier) { ret = avformat_match_stream_specifier(fmt_ctx, fmt_ctx->streams[i], stream_specifier); if (ret < 0) goto end; else selected_streams[i] = ret; ret = 0; } else { selected_streams[i] = 1; } } if (do_read_frames || do_read_packets) { if (do_show_frames && do_show_packets && wctx->writer->flags & WRITER_FLAG_PUT_PACKETS_AND_FRAMES_IN_SAME_CHAPTER) section_id = SECTION_ID_PACKETS_AND_FRAMES; else if (do_show_packets && !do_show_frames) section_id = SECTION_ID_PACKETS; else // (!do_show_packets && do_show_frames) section_id = SECTION_ID_FRAMES; if (do_show_frames || do_show_packets) writer_print_section_header(wctx, section_id); read_packets(wctx, fmt_ctx); if (do_show_frames || do_show_packets) writer_print_section_footer(wctx); } if (do_show_programs) show_programs(wctx, fmt_ctx); if (do_show_streams) show_streams(wctx, fmt_ctx); if (do_show_chapters) show_chapters(wctx, fmt_ctx); if (do_show_format) show_format(wctx, fmt_ctx); end: close_input_file(&fmt_ctx); av_freep(&nb_streams_frames); av_freep(&nb_streams_packets); av_freep(&selected_streams); return ret; }
0
366,881
static int cap_tun_dev_attach(struct sock *sk) { return 0; }
0
363,371
gdm_session_settings_get_layout_name (GdmSessionSettings *settings) { g_return_val_if_fail (GDM_IS_SESSION_SETTINGS (settings), NULL); return g_strdup (settings->priv->layout_name); }
0
341,066
static void vga_get_text_resolution(VGACommonState *s, int *pwidth, int *pheight, int *pcwidth, int *pcheight) { int width, cwidth, height, cheight; /* total width & height */ cheight = (s->cr[VGA_CRTC_MAX_SCAN] & 0x1f) + 1; cwidth = 8; if (!(s->sr[VGA_SEQ_CLOCK_MODE] & VGA_SR01_CHAR_CLK_8DOTS)) { cwidth = 9; } if (s->sr[VGA_SEQ_CLOCK_MODE] & 0x08) { cwidth = 16; /* NOTE: no 18 pixel wide */ } width = (s->cr[VGA_CRTC_H_DISP] + 1); if (s->cr[VGA_CRTC_V_TOTAL] == 100) { /* ugly hack for CGA 160x100x16 - explain me the logic */ height = 100; } else { height = s->cr[VGA_CRTC_V_DISP_END] | ((s->cr[VGA_CRTC_OVERFLOW] & 0x02) << 7) | ((s->cr[VGA_CRTC_OVERFLOW] & 0x40) << 3); height = (height + 1) / cheight; } *pwidth = width; *pheight = height; *pcwidth = cwidth; *pcheight = cheight; }
1
464,702
int xt_find_revision(u8 af, const char *name, u8 revision, int target, int *err) { int have_rev, best = -1; if (target == 1) have_rev = target_revfn(af, name, revision, &best); else have_rev = match_revfn(af, name, revision, &best); /* Nothing at all? Return 0 to try loading module. */ if (best == -1) { *err = -ENOENT; return 0; } *err = best; if (!have_rev) *err = -EPROTONOSUPPORT; return 1; }
0
11,080
standard_display_init(standard_display *dp, png_store* ps, png_uint_32 id, int do_interlace, int use_update_info) { memset(dp, 0, sizeof *dp); dp->ps = ps; dp->colour_type = COL_FROM_ID(id); dp->bit_depth = DEPTH_FROM_ID(id); if (dp->bit_depth < 1 || dp->bit_depth > 16) internal_error(ps, "internal: bad bit depth"); if (dp->colour_type == 3) dp->red_sBIT = dp->blue_sBIT = dp->green_sBIT = dp->alpha_sBIT = 8; else dp->red_sBIT = dp->blue_sBIT = dp->green_sBIT = dp->alpha_sBIT = dp->bit_depth; dp->interlace_type = INTERLACE_FROM_ID(id); check_interlace_type(dp->interlace_type); dp->id = id; /* All the rest are filled in after the read_info: */ dp->w = 0; dp->h = 0; dp->npasses = 0; dp->pixel_size = 0; dp->bit_width = 0; dp->cbRow = 0; dp->do_interlace = do_interlace; dp->is_transparent = 0; dp->speed = ps->speed; dp->use_update_info = use_update_info; dp->npalette = 0; /* Preset the transparent color to black: */ memset(&dp->transparent, 0, sizeof dp->transparent); /* Preset the palette to full intensity/opaque througout: */ memset(dp->palette, 0xff, sizeof dp->palette); }
1
469,756
size_t olm_pk_decrypt( OlmPkDecryption * decryption, void const * ephemeral_key, size_t ephemeral_key_length, void const * mac, size_t mac_length, void * ciphertext, size_t ciphertext_length, void * plaintext, size_t max_plaintext_length ) { if (max_plaintext_length < olm_pk_max_plaintext_length(decryption, ciphertext_length)) { decryption->last_error = OlmErrorCode::OLM_OUTPUT_BUFFER_TOO_SMALL; return std::size_t(-1); } size_t raw_ciphertext_length = olm::decode_base64_length(ciphertext_length); if (ephemeral_key_length != olm::encode_base64_length(CURVE25519_KEY_LENGTH) || mac_length != olm::encode_base64_length(MAC_LENGTH) || raw_ciphertext_length == std::size_t(-1)) { decryption->last_error = OlmErrorCode::OLM_INVALID_BASE64; return std::size_t(-1); } struct _olm_curve25519_public_key ephemeral; olm::decode_base64( (const uint8_t*)ephemeral_key, olm::encode_base64_length(CURVE25519_KEY_LENGTH), (uint8_t *)ephemeral.public_key ); olm::SharedKey secret; _olm_crypto_curve25519_shared_secret(&decryption->key_pair, &ephemeral, secret); uint8_t raw_mac[MAC_LENGTH]; olm::decode_base64( (const uint8_t *)mac, olm::encode_base64_length(MAC_LENGTH), raw_mac ); olm::decode_base64( (const uint8_t *)ciphertext, ciphertext_length, (uint8_t *)ciphertext ); size_t result = _olm_cipher_aes_sha_256_ops.decrypt( olm_pk_cipher, secret, sizeof(secret), (uint8_t *) raw_mac, MAC_LENGTH, (const uint8_t *) ciphertext, raw_ciphertext_length, (uint8_t *) plaintext, max_plaintext_length ); if (result == std::size_t(-1)) { // we already checked the buffer sizes, so the only error that decrypt // will return is if the MAC is incorrect decryption->last_error = OlmErrorCode::OLM_BAD_MESSAGE_MAC; return std::size_t(-1); } else { return result; } }
0
458,588
dp_packet_set_l2_pad_size(struct dp_packet *b, uint16_t pad_size) { ovs_assert(pad_size <= dp_packet_size(b)); b->l2_pad_size = pad_size; }
0
395,057
update_random_seed_file() { ulong *sp, *dp; int fd, i; if( !seed_file_name || !is_initialized || !pool_filled ) return; if( !allow_seed_file_update ) { log_info(_("note: random_seed file not updated\n")); return; } /* copy the entropy pool to a scratch pool and mix both of them */ for(i=0,dp=(ulong*)keypool, sp=(ulong*)rndpool; i < POOLWORDS; i++, dp++, sp++ ) { *dp = *sp + ADD_VALUE; } mix_pool(rndpool); rndstats.mixrnd++; mix_pool(keypool); rndstats.mixkey++; #if defined(HAVE_DOSISH_SYSTEM) || defined(__CYGWIN__) fd = open( seed_file_name, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, S_IRUSR|S_IWUSR ); #else # if LOCK_SEED_FILE fd = open( seed_file_name, O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR ); # else # ifdef __VMS /* Open the seed file for exclusive write access, but allow other * readers. Loop until success. Complain after a few failures. */ { int backoff = 0; while ((fd = open( seed_file_name, O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR, "shr=get")) == -1 ) { if ((errno != EVMSERR) || (vaxc$errno != RMS$_FLK)) { /* Some unexpected open failure. */ log_info (_("can't lock `%s': %s\n"), seed_file_name, strerror (errno)); return; } if (backoff > 2) /* Show the first message after ~3.75 seconds. */ log_info( _("waiting for lock on `%s'...\n"), seed_file_name); wait_vms( backoff+ 0.25); if (backoff < 10) backoff++ ; } } # else /* !def __VMS */ fd = open( seed_file_name, O_WRONLY|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR ); # endif /* !def __VMS */ # endif #endif if( fd == -1 ) { log_info(_("can't create `%s': %s\n"), seed_file_name, strerror(errno)); return; } if (lock_seed_file (fd, seed_file_name, 1)) { close (fd); return; } #if LOCK_SEED_FILE if (ftruncate (fd, 0)) { log_info(_("can't write `%s': %s\n"), seed_file_name, strerror(errno)); close (fd); return; } #endif /*LOCK_SEED_FILE*/ do { i = write( fd, keypool, POOLSIZE ); } while( i == -1 && errno == EINTR ); if( i != POOLSIZE ) { log_info(_("can't write `%s': %s\n"), seed_file_name, strerror(errno) ); } if( close(fd) ) log_info(_("can't close `%s': %s\n"), seed_file_name, strerror(errno) ); }
0
76,588
convertToPassage(const int pass_start, const int pass_end, const int word_start, EmphasisInfo *buffer, const EmphRuleNumber emphRule, const EmphasisClass class, const TranslationTableHeader *table, unsigned int *wordBuffer) { int i; const TranslationTableRule *indicRule; for (i = pass_start; i <= pass_end; i++) if (wordBuffer[i] & WORD_WHOLE) { buffer[i].symbol &= ~class; buffer[i].word &= ~class; wordBuffer[i] &= ~WORD_WHOLE; } buffer[pass_start].begin |= class; if (brailleIndicatorDefined( table->emphRules[emphRule][endOffset], table, &indicRule) || brailleIndicatorDefined( table->emphRules[emphRule][endPhraseAfterOffset], table, &indicRule)) buffer[pass_end].end |= class; else if (brailleIndicatorDefined(table->emphRules[emphRule][endPhraseBeforeOffset], table, &indicRule)) buffer[word_start].end |= class; }
0
333,742
static int cmos_get_fd_drive_type(FloppyDriveType fd0) { int val; switch (fd0) { case FLOPPY_DRIVE_TYPE_144: /* 1.44 Mb 3"5 drive */ val = 4; break; case FLOPPY_DRIVE_TYPE_288: /* 2.88 Mb 3"5 drive */ val = 5; break; case FLOPPY_DRIVE_TYPE_120: /* 1.2 Mb 5"5 drive */ val = 2; break; case FLOPPY_DRIVE_TYPE_NONE: default: val = 0; break; } return val; }
0
8,032
PHP_FUNCTION(locale_accept_from_http) { UEnumeration *available; char *http_accept = NULL; int http_accept_len; UErrorCode status = 0; int len; char resultLocale[INTL_MAX_LOCALE_LEN+1]; UAcceptResult outResult; if(zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s", &http_accept, &http_accept_len) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "locale_accept_from_http: unable to parse input parameters", 0 TSRMLS_CC ); RETURN_FALSE; } available = ures_openAvailableLocales(NULL, &status); INTL_CHECK_STATUS(status, "locale_accept_from_http: failed to retrieve locale list"); len = uloc_acceptLanguageFromHTTP(resultLocale, INTL_MAX_LOCALE_LEN, &outResult, http_accept, available, &status); uenum_close(available); INTL_CHECK_STATUS(status, "locale_accept_from_http: failed to find acceptable locale"); if (len < 0 || outResult == ULOC_ACCEPT_FAILED) { RETURN_FALSE; } RETURN_STRINGL(resultLocale, len, 1); }
1
193,302
base::PendingTask TaskQueue::TakeTaskFromWorkQueue() { base::PendingTask pending_task = work_queue_.front(); work_queue_.pop(); TraceQueueSize(false); return pending_task; }
0
256,391
void ScrollHitTestDisplayItem::Record( GraphicsContext& context, const DisplayItemClient& client, DisplayItem::Type type, scoped_refptr<const TransformPaintPropertyNode> scroll_offset_node) { PaintController& paint_controller = context.GetPaintController(); DCHECK_NE(paint_controller.CurrentPaintChunkProperties().Transform(), scroll_offset_node.get()); if (paint_controller.DisplayItemConstructionIsDisabled()) return; paint_controller.CreateAndAppend<ScrollHitTestDisplayItem>( client, type, std::move(scroll_offset_node)); }
1
344,388
static void qxl_reset_surfaces(PCIQXLDevice *d) { dprint(d, 1, "%s:\n", __FUNCTION__); d->mode = QXL_MODE_UNDEFINED; qxl_spice_destroy_surfaces(d); }
1
449,389
size_t CanonicalQuery::countNodes(const MatchExpression* root, MatchExpression::MatchType type) { size_t sum = 0; if (type == root->matchType()) { sum = 1; } for (size_t i = 0; i < root->numChildren(); ++i) { sum += countNodes(root->getChild(i), type); } return sum; }
0
476,279
bool InstanceKlass::is_same_package_member(const Klass* class2, TRAPS) const { if (class2 == this) return true; if (!class2->is_instance_klass()) return false; // must be in same package before we try anything else if (!is_same_class_package(class2)) return false; // As long as there is an outer_this.getEnclosingClass, // shift the search outward. const InstanceKlass* outer_this = this; for (;;) { // As we walk along, look for equalities between outer_this and class2. // Eventually, the walks will terminate as outer_this stops // at the top-level class around the original class. bool ignore_inner_is_member; const Klass* next = outer_this->compute_enclosing_class(&ignore_inner_is_member, CHECK_false); if (next == NULL) break; if (next == class2) return true; outer_this = InstanceKlass::cast(next); } // Now do the same for class2. const InstanceKlass* outer2 = InstanceKlass::cast(class2); for (;;) { bool ignore_inner_is_member; Klass* next = outer2->compute_enclosing_class(&ignore_inner_is_member, CHECK_false); if (next == NULL) break; // Might as well check the new outer against all available values. if (next == this) return true; if (next == outer_this) return true; outer2 = InstanceKlass::cast(next); } // If by this point we have not found an equality between the // two classes, we know they are in separate package members. return false; }
0
92,941
static void ZEND_FASTCALL zend_hash_do_resize(HashTable *ht) { IS_CONSISTENT(ht); HT_ASSERT(GC_REFCOUNT(ht) == 1); if (ht->nNumUsed > ht->nNumOfElements + (ht->nNumOfElements >> 5)) { /* additional term is there to amortize the cost of compaction */ HANDLE_BLOCK_INTERRUPTIONS(); zend_hash_rehash(ht); HANDLE_UNBLOCK_INTERRUPTIONS(); } else if (ht->nTableSize < HT_MAX_SIZE) { /* Let's double the table size */ void *new_data, *old_data = HT_GET_DATA_ADDR(ht); uint32_t nSize = ht->nTableSize + ht->nTableSize; Bucket *old_buckets = ht->arData; HANDLE_BLOCK_INTERRUPTIONS(); new_data = pemalloc(HT_SIZE_EX(nSize, -nSize), ht->u.flags & HASH_FLAG_PERSISTENT); ht->nTableSize = nSize; ht->nTableMask = -ht->nTableSize; HT_SET_DATA_ADDR(ht, new_data); memcpy(ht->arData, old_buckets, sizeof(Bucket) * ht->nNumUsed); pefree(old_data, ht->u.flags & HASH_FLAG_PERSISTENT); zend_hash_rehash(ht); HANDLE_UNBLOCK_INTERRUPTIONS(); } else { zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%zu * %zu + %zu)", ht->nTableSize * 2, sizeof(Bucket) + sizeof(uint32_t), sizeof(Bucket)); } }
0
382,190
is_next_separator(FormatNode *n) { if (n->type == NODE_TYPE_END) return FALSE; if (n->type == NODE_TYPE_ACTION && S_THth(n->suffix)) return TRUE; /* * Next node */ n++; /* end of format string is treated like a non-digit separator */ if (n->type == NODE_TYPE_END) return TRUE; if (n->type == NODE_TYPE_ACTION) { if (n->key->is_digit) return FALSE; return TRUE; } else if (isdigit((unsigned char) n->character)) return FALSE; return TRUE; /* some non-digit input (separator) */ }
0
138,795
BGD_DECLARE(void) gdImageDestroy (gdImagePtr im) { int i; if (im->pixels) { for (i = 0; (i < im->sy); i++) { gdFree (im->pixels[i]); } gdFree (im->pixels); } if (im->tpixels) { for (i = 0; (i < im->sy); i++) { gdFree (im->tpixels[i]); } gdFree (im->tpixels); } if (im->polyInts) { gdFree (im->polyInts); } if (im->style) { gdFree (im->style); } gdFree (im); }
0
51,608
rio_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) { int phy_addr; struct netdev_private *np = netdev_priv(dev); struct mii_ioctl_data *miidata = if_mii(rq); phy_addr = np->phy_addr; switch (cmd) { case SIOCGMIIPHY: miidata->phy_id = phy_addr; break; case SIOCGMIIREG: miidata->val_out = mii_read (dev, phy_addr, miidata->reg_num); break; case SIOCSMIIREG: if (!capable(CAP_NET_ADMIN)) return -EPERM; mii_write (dev, phy_addr, miidata->reg_num, miidata->val_in); break; default: return -EOPNOTSUPP; } return 0; }
0
116,690
static void gen_leave(DisasContext *s) { TCGMemOp d_ot = mo_pushpop(s, s->dflag); TCGMemOp a_ot = mo_stacksize(s); gen_lea_v_seg(s, a_ot, cpu_regs[R_EBP], R_SS, -1); gen_op_ld_v(s, d_ot, cpu_T0, cpu_A0); tcg_gen_addi_tl(cpu_T1, cpu_regs[R_EBP], 1 << d_ot); gen_op_mov_reg_v(d_ot, R_EBP, cpu_T0); gen_op_mov_reg_v(a_ot, R_ESP, cpu_T1); }
0
427,613
static bool ipv4_datagram_support_cmsg(const struct sock *sk, struct sk_buff *skb, int ee_origin) { struct in_pktinfo *info; if (ee_origin == SO_EE_ORIGIN_ICMP) return true; if (ee_origin == SO_EE_ORIGIN_LOCAL) return false; /* Support IP_PKTINFO on tstamp packets if requested, to correlate * timestamp with egress dev. Not possible for packets without iif * or without payload (SOF_TIMESTAMPING_OPT_TSONLY). */ info = PKTINFO_SKB_CB(skb); if (!(sk->sk_tsflags & SOF_TIMESTAMPING_OPT_CMSG) || !info->ipi_ifindex) return false; info->ipi_spec_dst.s_addr = ip_hdr(skb)->saddr; return true; }
0
403,241
krb5_ticket_get_endtime(krb5_context context, const krb5_ticket *ticket) { return ticket->ticket.endtime; }
0
81,439
static NORETURN void die_startup(void) { fputs("fatal: not enough memory for initialization", stderr); exit(128); }
0
466,721
create_syncinfo_value(int type, const char *cookie, const char **uuids) { BerElement *ber; struct berval *bvp = NULL; if ((ber = der_alloc()) == NULL) { return (NULL); } switch (type) { case LDAP_TAG_SYNC_NEW_COOKIE: ber_printf(ber, "to", type, cookie); break; case LDAP_TAG_SYNC_REFRESH_DELETE: case LDAP_TAG_SYNC_REFRESH_PRESENT: ber_printf(ber, "t{", type); if (cookie) ber_printf(ber, "s", cookie); /* ber_printf(ber, "b",1); */ ber_printf(ber, "}"); break; case LDAP_TAG_SYNC_ID_SET: ber_printf(ber, "t{", type); if (cookie) ber_printf(ber, "s", cookie); if (uuids) ber_printf(ber, "b[v]", 1, uuids); ber_printf(ber, "}"); break; default: break; } ber_flatten(ber, &bvp); ber_free(ber, 1); return (bvp); }
0
262,188
int yr_re_ast_create( RE_AST** re_ast) { *re_ast = (RE_AST*) yr_malloc(sizeof(RE_AST)); if (*re_ast == NULL) return ERROR_INSUFFICIENT_MEMORY; (*re_ast)->flags = 0; (*re_ast)->levels = 0; (*re_ast)->root_node = NULL; return ERROR_SUCCESS; }
0
72,638
selaDisplayInPix(SELA *sela, l_int32 size, l_int32 gthick, l_int32 spacing, l_int32 ncols) { l_int32 nsels, i, w, width; PIX *pixt, *pixd; PIXA *pixa; SEL *sel; PROCNAME("selaDisplayInPix"); if (!sela) return (PIX *)ERROR_PTR("sela not defined", procName, NULL); if (size < 13) { L_WARNING("size < 13; setting to 13\n", procName); size = 13; } if (size % 2 == 0) size++; if (gthick < 2) { L_WARNING("grid thickness < 2; setting to 2\n", procName); gthick = 2; } if (spacing < 5) { L_WARNING("spacing < 5; setting to 5\n", procName); spacing = 5; } /* Accumulate the pix of each sel */ nsels = selaGetCount(sela); pixa = pixaCreate(nsels); for (i = 0; i < nsels; i++) { sel = selaGetSel(sela, i); pixt = selDisplayInPix(sel, size, gthick); pixaAddPix(pixa, pixt, L_INSERT); } /* Find the tiled output width, using just the first * ncols pix in the pixa. If all pix have the same width, * they will align properly in columns. */ width = 0; ncols = L_MIN(nsels, ncols); for (i = 0; i < ncols; i++) { pixt = pixaGetPix(pixa, i, L_CLONE); pixGetDimensions(pixt, &w, NULL, NULL); width += w; pixDestroy(&pixt); } width += (ncols + 1) * spacing; /* add spacing all around as well */ pixd = pixaDisplayTiledInRows(pixa, 1, width, 1.0, 0, spacing, 0); pixaDestroy(&pixa); return pixd; }
0
49,743
int kernel_read(struct file *file, loff_t offset, char *addr, unsigned long count) { mm_segment_t old_fs; loff_t pos = offset; int result; old_fs = get_fs(); set_fs(get_ds()); /* The cast to a user pointer is valid due to the set_fs() */ result = vfs_read(file, (void __user *)addr, count, &pos); set_fs(old_fs); return result; }
0
359,886
static void context_stop(struct context *ctx) { u32 reg; int i; reg_write(ctx->ohci, CONTROL_CLEAR(ctx->regs), CONTEXT_RUN); flush_writes(ctx->ohci); for (i = 0; i < 10; i++) { reg = reg_read(ctx->ohci, CONTROL_SET(ctx->regs)); if ((reg & CONTEXT_ACTIVE) == 0) return; mdelay(1); } fw_error("Error: DMA context still active (0x%08x)\n", reg); }
0
10,464
write_one_file(Image *output, Image *image, int convert_to_8bit) { if (image->opts & FAST_WRITE) image->image.flags |= PNG_IMAGE_FLAG_FAST; if (image->opts & USE_STDIO) { FILE *f = tmpfile(); if (f != NULL) { if (png_image_write_to_stdio(&image->image, f, convert_to_8bit, image->buffer+16, (png_int_32)image->stride, image->colormap)) { if (fflush(f) == 0) { rewind(f); initimage(output, image->opts, "tmpfile", image->stride_extra); output->input_file = f; if (!checkopaque(image)) return 0; } else return logclose(image, f, "tmpfile", ": flush: "); } else { fclose(f); return logerror(image, "tmpfile", ": write failed", ""); } } else return logerror(image, "tmpfile", ": open: ", strerror(errno)); } else { static int counter = 0; char name[32]; sprintf(name, "%s%d.png", tmpf, ++counter); if (png_image_write_to_file(&image->image, name, convert_to_8bit, image->buffer+16, (png_int_32)image->stride, image->colormap)) { initimage(output, image->opts, output->tmpfile_name, image->stride_extra); /* Afterwards, or freeimage will delete it! */ strcpy(output->tmpfile_name, name); if (!checkopaque(image)) return 0; } else return logerror(image, name, ": write failed", ""); } /* 'output' has an initialized temporary image, read this back in and compare * this against the original: there should be no change since the original * format was written unmodified unless 'convert_to_8bit' was specified. * However, if the original image was color-mapped, a simple read will zap * the linear, color and maybe alpha flags, this will cause spurious failures * under some circumstances. */ if (read_file(output, image->image.format | FORMAT_NO_CHANGE, NULL)) { png_uint_32 original_format = image->image.format; if (convert_to_8bit) original_format &= ~PNG_FORMAT_FLAG_LINEAR; if ((output->image.format & BASE_FORMATS) != (original_format & BASE_FORMATS)) return logerror(image, image->file_name, ": format changed on read: ", output->file_name); return compare_two_images(image, output, 0/*via linear*/, NULL); } else return logerror(output, output->tmpfile_name, ": read of new file failed", ""); }
1
459,534
dissect_kafka_create_topics_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, kafka_api_version_t api_version) { proto_item *subti; proto_tree *subtree; if (api_version >= 2) { offset = dissect_kafka_throttle_time(tvb, pinfo, tree, offset); } /* [topic_error_code] */ subtree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_kafka_topics, &subti, "Topics"); offset = dissect_kafka_array(subtree, tvb, pinfo, offset, api_version >= 5, api_version, &dissect_kafka_create_topics_response_topic, NULL); proto_item_set_end(subti, tvb, offset); if (api_version >= 5) { offset = dissect_kafka_tagged_fields(tvb, pinfo, tree, offset, 0); } return offset; }
0
427,398
static void qxl_realize_common(PCIQXLDevice *qxl, Error **errp) { uint8_t* config = qxl->pci.config; uint32_t pci_device_rev; uint32_t io_size; qemu_spice_display_init_common(&qxl->ssd); qxl->mode = QXL_MODE_UNDEFINED; qxl->num_memslots = NUM_MEMSLOTS; qemu_mutex_init(&qxl->track_lock); qemu_mutex_init(&qxl->async_lock); qxl->current_async = QXL_UNDEFINED_IO; qxl->guest_bug = 0; switch (qxl->revision) { case 1: /* spice 0.4 -- qxl-1 */ pci_device_rev = QXL_REVISION_STABLE_V04; io_size = 8; break; case 2: /* spice 0.6 -- qxl-2 */ pci_device_rev = QXL_REVISION_STABLE_V06; io_size = 16; break; case 3: /* qxl-3 */ pci_device_rev = QXL_REVISION_STABLE_V10; io_size = 32; /* PCI region size must be pow2 */ break; case 4: /* qxl-4 */ pci_device_rev = QXL_REVISION_STABLE_V12; io_size = pow2ceil(QXL_IO_RANGE_SIZE); break; default: error_setg(errp, "Invalid revision %d for qxl device (max %d)", qxl->revision, QXL_DEFAULT_REVISION); return; } pci_set_byte(&config[PCI_REVISION_ID], pci_device_rev); pci_set_byte(&config[PCI_INTERRUPT_PIN], 1); qxl->rom_size = qxl_rom_size(); memory_region_init_ram(&qxl->rom_bar, OBJECT(qxl), "qxl.vrom", qxl->rom_size, &error_fatal); init_qxl_rom(qxl); init_qxl_ram(qxl); qxl->guest_surfaces.cmds = g_new0(QXLPHYSICAL, qxl->ssd.num_surfaces); memory_region_init_ram(&qxl->vram_bar, OBJECT(qxl), "qxl.vram", qxl->vram_size, &error_fatal); memory_region_init_alias(&qxl->vram32_bar, OBJECT(qxl), "qxl.vram32", &qxl->vram_bar, 0, qxl->vram32_size); memory_region_init_io(&qxl->io_bar, OBJECT(qxl), &qxl_io_ops, qxl, "qxl-ioports", io_size); if (qxl->have_vga) { vga_dirty_log_start(&qxl->vga); } memory_region_set_flush_coalesced(&qxl->io_bar); pci_register_bar(&qxl->pci, QXL_IO_RANGE_INDEX, PCI_BASE_ADDRESS_SPACE_IO, &qxl->io_bar); pci_register_bar(&qxl->pci, QXL_ROM_RANGE_INDEX, PCI_BASE_ADDRESS_SPACE_MEMORY, &qxl->rom_bar); pci_register_bar(&qxl->pci, QXL_RAM_RANGE_INDEX, PCI_BASE_ADDRESS_SPACE_MEMORY, &qxl->vga.vram); pci_register_bar(&qxl->pci, QXL_VRAM_RANGE_INDEX, PCI_BASE_ADDRESS_SPACE_MEMORY, &qxl->vram32_bar); if (qxl->vram32_size < qxl->vram_size) { /* * Make the 64bit vram bar show up only in case it is * configured to be larger than the 32bit vram bar. */ pci_register_bar(&qxl->pci, QXL_VRAM64_RANGE_INDEX, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64 | PCI_BASE_ADDRESS_MEM_PREFETCH, &qxl->vram_bar); } /* print pci bar details */ dprint(qxl, 1, "ram/%s: %" PRId64 " MB [region 0]\n", qxl->have_vga ? "pri" : "sec", qxl->vga.vram_size / MiB); dprint(qxl, 1, "vram/32: %" PRIx64 " MB [region 1]\n", qxl->vram32_size / MiB); dprint(qxl, 1, "vram/64: %" PRIx64 " MB %s\n", qxl->vram_size / MiB, qxl->vram32_size < qxl->vram_size ? "[region 4]" : "[unmapped]"); qxl->ssd.qxl.base.sif = &qxl_interface.base; if (qemu_spice_add_display_interface(&qxl->ssd.qxl, qxl->vga.con) != 0) { error_setg(errp, "qxl interface %d.%d not supported by spice-server", SPICE_INTERFACE_QXL_MAJOR, SPICE_INTERFACE_QXL_MINOR); return; } #if SPICE_SERVER_VERSION >= 0x000e02 /* release 0.14.2 */ char device_address[256] = ""; if (qemu_spice_fill_device_address(qxl->vga.con, device_address, 256)) { spice_qxl_set_device_info(&qxl->ssd.qxl, device_address, 0, qxl->max_outputs); } #endif qemu_add_vm_change_state_handler(qxl_vm_change_state_handler, qxl); qxl->update_irq = qemu_bh_new(qxl_update_irq_bh, qxl); qxl_reset_state(qxl); qxl->update_area_bh = qemu_bh_new(qxl_render_update_area_bh, qxl); qxl->ssd.cursor_bh = qemu_bh_new(qemu_spice_cursor_refresh_bh, &qxl->ssd); }
0
518,180
rename_file_ext(const char * from,const char * to,const char * ext) { char from_b[FN_REFLEN],to_b[FN_REFLEN]; (void) strxmov(from_b,from,ext,NullS); (void) strxmov(to_b,to,ext,NullS); return mysql_file_rename(key_file_frm, from_b, to_b, MYF(0)); }
0
394,341
static const char *parse_hier(struct parse_state *state) { if (*state->ptr == '/') { if (state->end - state->ptr > 1) { if (*(state->ptr + 1) == '/') { state->ptr += 2; if (!(state->ptr = parse_authority(state))) { return NULL; } } } } return parse_path(state); }
0
225,261
chash_end(int type, void *base, uschar *string, int length, uschar *digest) { if (type == HMAC_MD5) md5_end((md5 *)base, string, length, digest); else sha1_end((sha1 *)base, string, length, digest); }
0
125,079
ExitPostmaster(int status) { #ifdef HAVE_PTHREAD_IS_THREADED_NP /* * There is no known cause for a postmaster to become multithreaded after * startup. Recheck to account for the possibility of unknown causes. * This message uses LOG level, because an unclean shutdown at this point * would usually not look much different from a clean shutdown. */ if (pthread_is_threaded_np() != 0) ereport(LOG, (errcode(ERRCODE_INTERNAL_ERROR), errmsg_internal("postmaster became multithreaded"), errdetail("Please report this to <%s>.", PACKAGE_BUGREPORT))); #endif /* should cleanup shared memory and kill all backends */ /* * Not sure of the semantics here. When the Postmaster dies, should the * backends all be killed? probably not. * * MUST -- vadim 05-10-1999 */ proc_exit(status); }
0
68,587
OurModifiers(XtermWidget xw) { return (ShiftMask | ControlMask | MetaMask(xw)); }
0
423,089
struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk, const union tcp_md5_addr *addr, int family) { struct tcp_sock *tp = tcp_sk(sk); struct tcp_md5sig_key *key; unsigned int size = sizeof(struct in_addr); struct tcp_md5sig_info *md5sig; /* caller either holds rcu_read_lock() or socket lock */ md5sig = rcu_dereference_check(tp->md5sig_info, sock_owned_by_user(sk) || lockdep_is_held(&sk->sk_lock.slock)); if (!md5sig) return NULL; #if IS_ENABLED(CONFIG_IPV6) if (family == AF_INET6) size = sizeof(struct in6_addr); #endif hlist_for_each_entry_rcu(key, &md5sig->head, node) { if (key->family != family) continue; if (!memcmp(&key->addr, addr, size)) return key; } return NULL; }
0
503,546
void cql_server::connection::on_connection_close() { _server._notifier->unregister_connection(this); }
0
128,566
static int wc_ecc_sign_hash_hw(const byte* in, word32 inlen, mp_int* r, mp_int* s, byte* out, word32 *outlen, WC_RNG* rng, ecc_key* key) { int err; #ifdef PLUTON_CRYPTO_ECC if (key->devId != INVALID_DEVID) /* use hardware */ #endif { int keysize = key->dp->size; /* Check args */ if (keysize > ECC_MAX_CRYPTO_HW_SIZE || inlen != keysize || *outlen < keysize*2) { return ECC_BAD_ARG_E; } #if defined(WOLFSSL_ATECC508A) /* Sign: Result is 32-bytes of R then 32-bytes of S */ err = atcatls_sign(key->slot, in, out); if (err != ATCA_SUCCESS) { return BAD_COND_E; } #elif defined(PLUTON_CRYPTO_ECC) { /* perform ECC sign */ word32 raw_sig_size = *outlen; err = Crypto_EccSign(in, inlen, out, &raw_sig_size); if (err != CRYPTO_RES_SUCCESS || raw_sig_size != keysize*2){ return BAD_COND_E; } } #endif /* Load R and S */ err = mp_read_unsigned_bin(r, &out[0], keysize); if (err != MP_OKAY) { return err; } err = mp_read_unsigned_bin(s, &out[keysize], keysize); if (err != MP_OKAY) { return err; } /* Check for zeros */ if (mp_iszero(r) || mp_iszero(s)) { return MP_ZERO_E; } } #ifdef PLUTON_CRYPTO_ECC else { err = wc_ecc_sign_hash_ex(in, inlen, rng, key, r, s); } #endif return err; }
0
178,641
explicit ConnectionFilterImpl(int gpu_process_id) { auto task_runner = BrowserThread::GetTaskRunnerForThread(BrowserThread::UI); registry_.AddInterface(base::Bind(&FieldTrialRecorder::Create), task_runner); #if defined(OS_ANDROID) registry_.AddInterface( base::Bind(&BindJavaInterface<media::mojom::AndroidOverlayProvider>), task_runner); #endif registry_.AddInterface( base::BindRepeating(&CreateMemoryCoordinatorHandleForGpuProcess, gpu_process_id), task_runner); }
0
262,417
TEST_P(SslSocketTest, RevokedIntermediateCertificateCRLInTrustedCA) { // This should succeed, since the crl chain is complete. // // Trust chain contains: // - Root authority certificate (i.e., ca_cert.pem) // - Root authority certificate revocation list (i.e., ca_cert.crl) // - Intermediate authority certificate (i.e., intermediate_ca_cert.pem) // - Intermediate authority certificate revocation list (i.e., intermediate_ca_cert.crl) const std::string complete_server_ctx_yaml = R"EOF( common_tls_context: tls_certificates: certificate_chain: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/unittest_cert.pem" private_key: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/unittest_key.pem" validation_context: trusted_ca: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/intermediate_ca_cert_chain_with_crl_chain.pem" )EOF"; // This should fail, since the crl chain is incomplete. // // Trust chain contains: // - Root authority certificate (i.e., ca_cert.pem) // - Intermediate authority certificate (i.e., intermediate_ca_cert.pem) // - Intermediate authority certificate revocation list (i.e., intermediate_ca_cert.crl) // // Trust chain omits: // - Root authority certificate revocation list (i.e., ca_cert.crl) const std::string incomplete_server_ctx_yaml = R"EOF( common_tls_context: tls_certificates: certificate_chain: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/unittest_cert.pem" private_key: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/unittest_key.pem" validation_context: trusted_ca: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/intermediate_ca_cert_chain_with_crl.pem" )EOF"; // This should fail, since the certificate has been revoked. const std::string revoked_client_ctx_yaml = R"EOF( common_tls_context: tls_certificates: certificate_chain: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_dns3_cert.pem" private_key: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_dns3_key.pem" )EOF"; // This should succeed, since the certificate has not been revoked. const std::string unrevoked_client_ctx_yaml = R"EOF( common_tls_context: tls_certificates: certificate_chain: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_dns4_cert.pem" private_key: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_dns4_key.pem" )EOF"; // Ensure that incomplete crl chains fail with revoked certificates. TestUtilOptions incomplete_revoked_test_options(revoked_client_ctx_yaml, incomplete_server_ctx_yaml, false, GetParam()); testUtil(incomplete_revoked_test_options.setExpectedServerStats("ssl.fail_verify_error") .setExpectedVerifyErrorCode(X509_V_ERR_CERT_REVOKED)); // Ensure that incomplete crl chains fail with unrevoked certificates. TestUtilOptions incomplete_unrevoked_test_options(unrevoked_client_ctx_yaml, incomplete_server_ctx_yaml, false, GetParam()); testUtil(incomplete_unrevoked_test_options.setExpectedServerStats("ssl.fail_verify_error") .setExpectedVerifyErrorCode(X509_V_ERR_UNABLE_TO_GET_CRL)); // Ensure that complete crl chains fail with revoked certificates. TestUtilOptions complete_revoked_test_options(revoked_client_ctx_yaml, complete_server_ctx_yaml, false, GetParam()); testUtil(complete_revoked_test_options.setExpectedServerStats("ssl.fail_verify_error") .setExpectedVerifyErrorCode(X509_V_ERR_CERT_REVOKED)); // Ensure that complete crl chains succeed with unrevoked certificates. TestUtilOptions complete_unrevoked_test_options(unrevoked_client_ctx_yaml, complete_server_ctx_yaml, true, GetParam()); testUtil(complete_unrevoked_test_options.setExpectedSerialNumber(TEST_SAN_DNS4_CERT_SERIAL)); }
0
294,009
static TypedValue* add_vars_helper(ActRec* ar) { int start_index = 1; Resource packet_id = getArg<KindOfResource>(ar, 0); auto wddxPacket = packet_id.getTyped<WddxPacket>(); for (int i = start_index; i < ar->numArgs(); i++) { auto const tv = getArg(ar, i); find_var_recursive(tv, wddxPacket); } return arReturn(ar, true); }
0
491,780
ecma_new_ecma_string_from_number (ecma_number_t num) /**< ecma-number */ { uint32_t uint32_num = ecma_number_to_uint32 (num); if (num == ((ecma_number_t) uint32_num)) { return ecma_new_ecma_string_from_uint32 (uint32_num); } if (ecma_number_is_nan (num)) { return ecma_get_magic_string (LIT_MAGIC_STRING_NAN); } if (ecma_number_is_infinity (num)) { lit_magic_string_id_t id = (ecma_number_is_negative (num) ? LIT_MAGIC_STRING_NEGATIVE_INFINITY_UL : LIT_MAGIC_STRING_INFINITY_UL); return ecma_get_magic_string (id); } lit_utf8_byte_t str_buf[ECMA_MAX_CHARS_IN_STRINGIFIED_NUMBER]; lit_utf8_size_t str_size = ecma_number_to_utf8_string (num, str_buf, sizeof (str_buf)); JERRY_ASSERT (str_size > 0); #ifndef JERRY_NDEBUG JERRY_ASSERT (lit_is_utf8_string_magic (str_buf, str_size) == LIT_MAGIC_STRING__COUNT && lit_is_ex_utf8_string_magic (str_buf, str_size) == lit_get_magic_string_ex_count ()); #endif /* !JERRY_NDEBUG */ lit_utf8_byte_t *data_p; ecma_string_t *string_desc_p = ecma_new_ecma_string_from_utf8_buffer (lit_utf8_string_length (str_buf, str_size), str_size, &data_p); string_desc_p->u.hash = lit_utf8_string_calc_hash (str_buf, str_size); memcpy (data_p, str_buf, str_size); return string_desc_p; } /* ecma_new_ecma_string_from_number */
0
101,500
void CL_StopVideo_f( void ) { CL_CloseAVI( ); }
0
93,644
static inline struct htx_blk *htx_add_header(struct htx *htx, const struct ist name, const struct ist value) { struct htx_blk *blk; if (name.len > 255 || value.len > 1048575) return NULL; blk = htx_add_blk(htx, HTX_BLK_HDR, name.len + value.len); if (!blk) return NULL; blk->info += (value.len << 8) + name.len; ist2bin_lc(htx_get_blk_ptr(htx, blk), name); memcpy(htx_get_blk_ptr(htx, blk) + name.len, value.ptr, value.len); return blk; }
0
139,773
static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL, const int buflen, const int acl_type) { __u16 rc = 0; struct cifs_posix_acl *cifs_acl = (struct cifs_posix_acl *)parm_data; posix_acl_xattr_header *local_acl = (posix_acl_xattr_header *)pACL; int count; int i; if ((buflen == 0) || (pACL == NULL) || (cifs_acl == NULL)) return 0; count = posix_acl_xattr_count((size_t)buflen); cFYI(1, "setting acl with %d entries from buf of length %d and " "version of %d", count, buflen, le32_to_cpu(local_acl->a_version)); if (le32_to_cpu(local_acl->a_version) != 2) { cFYI(1, "unknown POSIX ACL version %d", le32_to_cpu(local_acl->a_version)); return 0; } cifs_acl->version = cpu_to_le16(1); if (acl_type == ACL_TYPE_ACCESS) cifs_acl->access_entry_count = cpu_to_le16(count); else if (acl_type == ACL_TYPE_DEFAULT) cifs_acl->default_entry_count = cpu_to_le16(count); else { cFYI(1, "unknown ACL type %d", acl_type); return 0; } for (i = 0; i < count; i++) { rc = convert_ace_to_cifs_ace(&cifs_acl->ace_array[i], &local_acl->a_entries[i]); if (rc != 0) { /* ACE not converted */ break; } } if (rc == 0) { rc = (__u16)(count * sizeof(struct cifs_posix_ace)); rc += sizeof(struct cifs_posix_acl); /* BB add check to make sure ACL does not overflow SMB */ } return rc; }
0
344,919
void RemoveZeroOperations() { RemoveZeroAdd(&added_lower_index_, &added_lower_offset_); RemoveZeroAdd(&added_upper_index_, &added_upper_offset_); }
1
119,466
heap_add_entry(struct archive_read *a, struct heap_queue *heap, struct xar_file *file) { uint64_t file_id, parent_id; int hole, parent; /* Expand our pending files list as necessary. */ if (heap->used >= heap->allocated) { struct xar_file **new_pending_files; int new_size = heap->allocated * 2; if (heap->allocated < 1024) new_size = 1024; /* Overflow might keep us from growing the list. */ if (new_size <= heap->allocated) { archive_set_error(&a->archive, ENOMEM, "Out of memory"); return (ARCHIVE_FATAL); } new_pending_files = (struct xar_file **) malloc(new_size * sizeof(new_pending_files[0])); if (new_pending_files == NULL) { archive_set_error(&a->archive, ENOMEM, "Out of memory"); return (ARCHIVE_FATAL); } memcpy(new_pending_files, heap->files, heap->allocated * sizeof(new_pending_files[0])); if (heap->files != NULL) free(heap->files); heap->files = new_pending_files; heap->allocated = new_size; } file_id = file->id; /* * Start with hole at end, walk it up tree to find insertion point. */ hole = heap->used++; while (hole > 0) { parent = (hole - 1)/2; parent_id = heap->files[parent]->id; if (file_id >= parent_id) { heap->files[hole] = file; return (ARCHIVE_OK); } /* Move parent into hole <==> move hole up tree. */ heap->files[hole] = heap->files[parent]; hole = parent; } heap->files[0] = file; return (ARCHIVE_OK); }
0
469,510
static void __exit ucma_cleanup(void) { ib_unregister_client(&rdma_cma_client); unregister_net_sysctl_table(ucma_ctl_table_hdr); device_remove_file(ucma_misc.this_device, &dev_attr_abi_version); misc_deregister(&ucma_misc); }
0
382,223
flushbuffer(PrintfTarget *target) { size_t nc = target->bufptr - target->bufstart; if (nc > 0) target->nchars += fwrite(target->bufstart, 1, nc, target->stream); target->bufptr = target->bufstart; }
0
53,528
virDomainSetMaxMemory(virDomainPtr domain, unsigned long memory) { virConnectPtr conn; VIR_DOMAIN_DEBUG(domain, "memory=%lu", memory); virResetLastError(); virCheckDomainReturn(domain, -1); conn = domain->conn; virCheckReadOnlyGoto(conn->flags, error); virCheckNonZeroArgGoto(memory, error); if (virMemoryMaxValue(true) / 1024 <= memory) { virReportError(VIR_ERR_OVERFLOW, _("input too large: %lu"), memory); goto error; } if (conn->driver->domainSetMaxMemory) { int ret; ret = conn->driver->domainSetMaxMemory(domain, memory); if (ret < 0) goto error; return ret; } virReportUnsupportedError(); error: virDispatchError(domain->conn); return -1; }
0
407,126
request_send (const struct request *req, int fd, FILE *warc_tmp) { char *request_string, *p; int i, size, write_error; /* Count the request size. */ size = 0; /* METHOD " " ARG " " "HTTP/1.0" "\r\n" */ size += strlen (req->method) + 1 + strlen (req->arg) + 1 + 8 + 2; for (i = 0; i < req->hcount; i++) { struct request_header *hdr = &req->headers[i]; /* NAME ": " VALUE "\r\n" */ size += strlen (hdr->name) + 2 + strlen (hdr->value) + 2; } /* "\r\n\0" */ size += 3; p = request_string = xmalloc (size); /* Generate the request. */ APPEND (p, req->method); *p++ = ' '; APPEND (p, req->arg); *p++ = ' '; memcpy (p, "HTTP/1.1\r\n", 10); p += 10; for (i = 0; i < req->hcount; i++) { struct request_header *hdr = &req->headers[i]; APPEND (p, hdr->name); *p++ = ':', *p++ = ' '; APPEND (p, hdr->value); *p++ = '\r', *p++ = '\n'; } *p++ = '\r', *p++ = '\n', *p++ = '\0'; assert (p - request_string == size); #undef APPEND DEBUGP (("\n---request begin---\n%s---request end---\n", request_string)); /* Send the request to the server. */ write_error = fd_write (fd, request_string, size - 1, -1); if (write_error < 0) logprintf (LOG_VERBOSE, _("Failed writing HTTP request: %s.\n"), fd_errstr (fd)); else if (warc_tmp != NULL) { /* Write a copy of the data to the WARC record. */ int warc_tmp_written = fwrite (request_string, 1, size - 1, warc_tmp); if (warc_tmp_written != size - 1) write_error = -2; } xfree (request_string); return write_error; }
0
24,762
static int x ( struct vcache * avc , int afun , struct vrequest * areq , \ struct afs_pdata * ain , struct afs_pdata * aout , \ afs_ucred_t * * acred ) DECL_PIOCTL ( PGetFID ) ; DECL_PIOCTL ( PSetAcl ) ; DECL_PIOCTL ( PStoreBehind ) ; DECL_PIOCTL ( PGCPAGs ) ; DECL_PIOCTL ( PGetAcl ) ; DECL_PIOCTL ( PNoop ) ; DECL_PIOCTL ( PBogus ) ; DECL_PIOCTL ( PGetFileCell ) ; DECL_PIOCTL ( PGetWSCell ) ; DECL_PIOCTL ( PGetUserCell ) ; DECL_PIOCTL ( PSetTokens ) ; DECL_PIOCTL ( PGetVolumeStatus ) ; DECL_PIOCTL ( PSetVolumeStatus ) ; DECL_PIOCTL ( PFlush ) ; DECL_PIOCTL ( PNewStatMount ) ; DECL_PIOCTL ( PGetTokens ) ; DECL_PIOCTL ( PUnlog ) ; DECL_PIOCTL ( PMariner ) ; DECL_PIOCTL ( PCheckServers ) ; DECL_PIOCTL ( PCheckVolNames ) ; DECL_PIOCTL ( PCheckAuth ) ; DECL_PIOCTL ( PFindVolume ) ; DECL_PIOCTL ( PViceAccess ) ; DECL_PIOCTL ( PSetCacheSize ) ; DECL_PIOCTL ( PGetCacheSize ) ; DECL_PIOCTL ( PRemoveCallBack )
0
133,376
smtp_proceed_commit(struct smtp_session *s, const char *args) { smtp_message_end(s->tx); }
0
508,479
void SSL_CTX_set_verify(SSL_CTX *ctx, int mode, int (*cb) (int, X509_STORE_CTX *)) { ctx->verify_mode = mode; ctx->default_verify_callback = cb; }
0
495,500
njs_encode_base64(njs_str_t *dst, const njs_str_t *src) { static u_char basis64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; njs_encode_base64_core(dst, src, basis64, 1); }
0
518,595
ulonglong val_uint(void) { return (ulonglong) val_int_from_real(true); }
0
209,337
BrowserContextIOData::GetTemporarySavedPermissionContext() const { return temporary_saved_permission_context_.get(); }
0
26,835
ParseResult mime_scanner_get ( MIMEScanner * S , const char * * raw_input_s , const char * raw_input_e , const char * * output_s , const char * * output_e , bool * output_shares_raw_input , bool raw_input_eof , int raw_input_scan_type ) { const char * raw_input_c , * lf_ptr ; ParseResult zret = PARSE_RESULT_CONT ; static const char RAW_CR = ParseRules : : CHAR_CR ; ink_assert ( ( raw_input_s != nullptr ) && ( * raw_input_s != nullptr ) ) ; ink_assert ( raw_input_e != nullptr ) ; raw_input_c = * raw_input_s ; while ( PARSE_RESULT_CONT == zret && raw_input_c < raw_input_e ) { ptrdiff_t runway = raw_input_e - raw_input_c ; switch ( S -> m_state ) { case MIME_PARSE_BEFORE : if ( ParseRules : : is_cr ( * raw_input_c ) ) { ++ raw_input_c ; if ( runway >= 2 && ParseRules : : is_lf ( * raw_input_c ) ) { ++ raw_input_c ; zret = PARSE_RESULT_DONE ; } else { S -> m_state = MIME_PARSE_FOUND_CR ; } } else if ( ParseRules : : is_lf ( * raw_input_c ) ) { ++ raw_input_c ; zret = PARSE_RESULT_DONE ; } else { S -> m_state = MIME_PARSE_INSIDE ; } break ; case MIME_PARSE_FOUND_CR : if ( ParseRules : : is_lf ( * raw_input_c ) ) { ++ raw_input_c ; zret = PARSE_RESULT_DONE ; } else { mime_scanner_append ( S , & RAW_CR , 1 ) ; S -> m_state = MIME_PARSE_INSIDE ; } break ; case MIME_PARSE_INSIDE : lf_ptr = static_cast < const char * > ( memchr ( raw_input_c , ParseRules : : CHAR_LF , runway ) ) ; if ( lf_ptr ) { raw_input_c = lf_ptr + 1 ; if ( MIME_SCANNER_TYPE_LINE == raw_input_scan_type ) { zret = PARSE_RESULT_OK ; S -> m_state = MIME_PARSE_BEFORE ; } else { S -> m_state = MIME_PARSE_AFTER ; } } else { raw_input_c = raw_input_e ; } break ; case MIME_PARSE_AFTER : if ( ParseRules : : is_ws ( * raw_input_c ) ) { char * unfold = const_cast < char * > ( raw_input_c - 1 ) ; * unfold -- = ' ' ; if ( ParseRules : : is_cr ( * unfold ) ) { * unfold = ' ' ; } S -> m_state = MIME_PARSE_INSIDE ; } else { S -> m_state = MIME_PARSE_BEFORE ; zret = PARSE_RESULT_OK ; } break ; } } ptrdiff_t data_size = raw_input_c - * raw_input_s ; if ( PARSE_RESULT_CONT == zret ) { if ( raw_input_eof ) { if ( 0 == data_size ) { if ( MIME_PARSE_INSIDE != S -> m_state ) { S -> m_state = MIME_PARSE_BEFORE ; zret = PARSE_RESULT_DONE ; } else { zret = PARSE_RESULT_ERROR ; } } else if ( MIME_PARSE_AFTER == S -> m_state ) { S -> m_state = MIME_PARSE_BEFORE ; zret = PARSE_RESULT_OK ; } else { zret = PARSE_RESULT_ERROR ; } } else if ( data_size ) { if ( MIME_PARSE_INSIDE == S -> m_state ) { mime_scanner_append ( S , * raw_input_s , data_size ) ; data_size = 0 ; } else if ( MIME_PARSE_AFTER == S -> m_state ) { S -> m_state = MIME_PARSE_BEFORE ; zret = PARSE_RESULT_OK ; } } } if ( data_size && S -> m_line_length ) { mime_scanner_append ( S , * raw_input_s , data_size ) ; } * output_shares_raw_input = 0 == S -> m_line_length ; if ( PARSE_RESULT_CONT != zret ) { if ( 0 != S -> m_line_length ) { * output_s = S -> m_line ; * output_e = * output_s + S -> m_line_length ; S -> m_line_length = 0 ; } else { * output_s = * raw_input_s ; * output_e = raw_input_c ; } } if ( zret != PARSE_RESULT_ERROR && memchr ( * raw_input_s , '\0' , raw_input_c - * raw_input_s ) != nullptr ) { zret = PARSE_RESULT_ERROR ; } * raw_input_s = raw_input_c ; return zret ; }
0
509,279
SCM_DEFINE (scm_dirname, "dirname", 1, 0, 0, (SCM filename), "Return the directory name component of the file name\n" "@var{filename}. If @var{filename} does not contain a directory\n" "component, @code{.} is returned.") #define FUNC_NAME s_scm_dirname { char *c_filename, *c_dirname; SCM res; scm_dynwind_begin (0); c_filename = scm_to_utf8_string (filename); scm_dynwind_free (c_filename); c_dirname = mdir_name (c_filename); if (!c_dirname) SCM_SYSERROR; scm_dynwind_free (c_dirname); res = scm_from_utf8_string (c_dirname); scm_dynwind_end (); return res; }
0
120,528
QPDFObjectHandle::getDictAsMap() { std::map<std::string, QPDFObjectHandle> result; if (isDictionary()) { result = dynamic_cast<QPDF_Dictionary*>( m->obj.getPointer())->getAsMap(); } else { typeWarning("dictionary", "treating as empty"); QTC::TC("qpdf", "QPDFObjectHandle dictionary empty map for asMap"); } return result; }
0
91,822
static int tpacket_fill_skb(struct packet_sock *po, struct sk_buff *skb, void *frame, struct net_device *dev, int size_max, __be16 proto, unsigned char *addr) { union { struct tpacket_hdr *h1; struct tpacket2_hdr *h2; void *raw; } ph; int to_write, offset, len, tp_len, nr_frags, len_max; struct socket *sock = po->sk.sk_socket; struct page *page; void *data; int err; ph.raw = frame; skb->protocol = proto; skb->dev = dev; skb->priority = po->sk.sk_priority; skb->mark = po->sk.sk_mark; skb_shinfo(skb)->destructor_arg = ph.raw; switch (po->tp_version) { case TPACKET_V2: tp_len = ph.h2->tp_len; break; default: tp_len = ph.h1->tp_len; break; } if (unlikely(tp_len > size_max)) { pr_err("packet size is too long (%d > %d)\n", tp_len, size_max); return -EMSGSIZE; } skb_reserve(skb, LL_RESERVED_SPACE(dev)); skb_reset_network_header(skb); data = ph.raw + po->tp_hdrlen - sizeof(struct sockaddr_ll); to_write = tp_len; if (sock->type == SOCK_DGRAM) { err = dev_hard_header(skb, dev, ntohs(proto), addr, NULL, tp_len); if (unlikely(err < 0)) return -EINVAL; } else if (dev->hard_header_len) { /* net device doesn't like empty head */ if (unlikely(tp_len <= dev->hard_header_len)) { pr_err("packet size is too short (%d < %d)\n", tp_len, dev->hard_header_len); return -EINVAL; } skb_push(skb, dev->hard_header_len); err = skb_store_bits(skb, 0, data, dev->hard_header_len); if (unlikely(err)) return err; data += dev->hard_header_len; to_write -= dev->hard_header_len; } err = -EFAULT; offset = offset_in_page(data); len_max = PAGE_SIZE - offset; len = ((to_write > len_max) ? len_max : to_write); skb->data_len = to_write; skb->len += to_write; skb->truesize += to_write; atomic_add(to_write, &po->sk.sk_wmem_alloc); while (likely(to_write)) { nr_frags = skb_shinfo(skb)->nr_frags; if (unlikely(nr_frags >= MAX_SKB_FRAGS)) { pr_err("Packet exceed the number of skb frags(%lu)\n", MAX_SKB_FRAGS); return -EFAULT; } page = pgv_to_page(data); data += len; flush_dcache_page(page); get_page(page); skb_fill_page_desc(skb, nr_frags, page, offset, len); to_write -= len; offset = 0; len_max = PAGE_SIZE; len = ((to_write > len_max) ? len_max : to_write); } return tp_len; }
0
276,451
ResourceLoadTiming* PerformanceNavigationTiming::GetResourceLoadTiming() const { return resource_timing_info_->FinalResponse().GetResourceLoadTiming(); }
0
37,902
int set_env_passwd(unsigned char* passwd, size_t length) { struct digest *d = NULL; unsigned char *passwd_sum; int ret, hash_len; if (IS_ENABLED(CONFIG_PASSWD_CRYPTO_PBKDF2)) { hash_len = PBKDF2_LENGTH; } else { d = digest_alloc(PASSWD_SUM); if (!d) return -EINVAL; hash_len = digest_length(d); } passwd_sum = calloc(hash_len, sizeof(unsigned char)); if (!passwd_sum) return -ENOMEM; if (IS_ENABLED(CONFIG_PASSWD_CRYPTO_PBKDF2)) { char *key = passwd_sum + PBKDF2_SALT_LEN; char *salt = passwd_sum; int keylen = PBKDF2_LENGTH - PBKDF2_SALT_LEN; ret = get_crypto_bytes(passwd_sum, PBKDF2_SALT_LEN); if (ret) { pr_err("Can't get random numbers\n"); return ret; } ret = pkcs5_pbkdf2_hmac_sha1(passwd, length, salt, PBKDF2_SALT_LEN, PBKDF2_COUNT, keylen, key); } else { ret = digest_digest(d, passwd, length, passwd_sum); } if (ret) goto err; ret = write_env_passwd(passwd_sum, hash_len); err: digest_free(d); free(passwd_sum); return ret; }
0
501,497
iasecc_read_public_key(struct sc_card *card, unsigned type, struct sc_path *key_path, unsigned ref, unsigned size, unsigned char **out, size_t *out_len) { struct sc_context *ctx = card->ctx; struct iasecc_sdo sdo; struct sc_pkcs15_bignum bn[2]; struct sc_pkcs15_pubkey_rsa rsa_key; int rv; LOG_FUNC_CALLED(ctx); if (type != SC_ALGORITHM_RSA) LOG_FUNC_RETURN(ctx, SC_ERROR_NOT_SUPPORTED); sc_log(ctx, "read public kay(ref:%i;size:%i)", ref, size); memset(&bn, 0, sizeof bn); memset(&sdo, 0, sizeof(sdo)); sdo.sdo_class = IASECC_SDO_CLASS_RSA_PUBLIC; sdo.sdo_ref = ref & ~IASECC_OBJECT_REF_LOCAL; rv = iasecc_sdo_get_data(card, &sdo); LOG_TEST_GOTO_ERR(ctx, rv, "failed to read public key: cannot get RSA SDO data"); if (out) *out = NULL; if (out_len) *out_len = 0; bn[0].data = (unsigned char *) malloc(sdo.data.pub_key.n.size); if (!bn[0].data) LOG_TEST_GOTO_ERR(ctx, SC_ERROR_OUT_OF_MEMORY, "failed to read public key: cannot allocate modulus"); bn[0].len = sdo.data.pub_key.n.size; memcpy(bn[0].data, sdo.data.pub_key.n.value, sdo.data.pub_key.n.size); bn[1].data = (unsigned char *) malloc(sdo.data.pub_key.e.size); if (!bn[1].data) LOG_TEST_GOTO_ERR(ctx, SC_ERROR_OUT_OF_MEMORY, "failed to read public key: cannot allocate exponent"); bn[1].len = sdo.data.pub_key.e.size; memcpy(bn[1].data, sdo.data.pub_key.e.value, sdo.data.pub_key.e.size); rsa_key.modulus = bn[0]; rsa_key.exponent = bn[1]; rv = sc_pkcs15_encode_pubkey_rsa(ctx, &rsa_key, out, out_len); LOG_TEST_GOTO_ERR(ctx, rv, "failed to read public key: cannot encode RSA public key"); if (out && out_len) sc_log(ctx, "encoded public key: %s", sc_dump_hex(*out, *out_len)); err: if (bn[0].data) free(bn[0].data); if (bn[1].data) free(bn[1].data); iasecc_sdo_free_fields(card, &sdo); LOG_FUNC_RETURN(ctx, SC_SUCCESS); }
0
191,355
static void gen_helper_fp_arith_STN_ST0(int op, int opreg) { TCGv_i32 tmp = tcg_const_i32(opreg); switch (op) { case 0: gen_helper_fadd_STN_ST0(cpu_env, tmp); break; case 1: gen_helper_fmul_STN_ST0(cpu_env, tmp); break; case 4: gen_helper_fsubr_STN_ST0(cpu_env, tmp); break; case 5: gen_helper_fsub_STN_ST0(cpu_env, tmp); break; case 6: gen_helper_fdivr_STN_ST0(cpu_env, tmp); break; case 7: gen_helper_fdiv_STN_ST0(cpu_env, tmp); break; } }
0
237,119
LogL16toY(int p16) /* compute luminance from 16-bit LogL */ { int Le = p16 & 0x7fff; double Y; if (!Le) return (0.); Y = exp(M_LN2/256.*(Le+.5) - M_LN2*64.); return (!(p16 & 0x8000) ? Y : -Y); }
0
377,029
static int dp_register_genl(void) { int n_registered; int err; int i; n_registered = 0; for (i = 0; i < ARRAY_SIZE(dp_genl_families); i++) { const struct genl_family_and_ops *f = &dp_genl_families[i]; f->family->ops = f->ops; f->family->n_ops = f->n_ops; f->family->mcgrps = f->group; f->family->n_mcgrps = f->group ? 1 : 0; err = genl_register_family(f->family); if (err) goto error; n_registered++; } return 0; error: dp_unregister_genl(n_registered); return err; }
0
495,776
static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps) { #define HWACCEL_MAX (CONFIG_HEVC_DXVA2_HWACCEL + \ CONFIG_HEVC_D3D11VA_HWACCEL * 2 + \ CONFIG_HEVC_VAAPI_HWACCEL + \ CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL + \ CONFIG_HEVC_VDPAU_HWACCEL) enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmt = pix_fmts; switch (sps->pix_fmt) { case AV_PIX_FMT_YUV420P: case AV_PIX_FMT_YUVJ420P: #if CONFIG_HEVC_DXVA2_HWACCEL *fmt++ = AV_PIX_FMT_DXVA2_VLD; #endif #if CONFIG_HEVC_D3D11VA_HWACCEL *fmt++ = AV_PIX_FMT_D3D11VA_VLD; *fmt++ = AV_PIX_FMT_D3D11; #endif #if CONFIG_HEVC_VAAPI_HWACCEL *fmt++ = AV_PIX_FMT_VAAPI; #endif #if CONFIG_HEVC_VDPAU_HWACCEL *fmt++ = AV_PIX_FMT_VDPAU; #endif #if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL *fmt++ = AV_PIX_FMT_VIDEOTOOLBOX; #endif break; case AV_PIX_FMT_YUV420P10: #if CONFIG_HEVC_DXVA2_HWACCEL *fmt++ = AV_PIX_FMT_DXVA2_VLD; #endif #if CONFIG_HEVC_D3D11VA_HWACCEL *fmt++ = AV_PIX_FMT_D3D11VA_VLD; *fmt++ = AV_PIX_FMT_D3D11; #endif #if CONFIG_HEVC_VAAPI_HWACCEL *fmt++ = AV_PIX_FMT_VAAPI; #endif #if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL *fmt++ = AV_PIX_FMT_VIDEOTOOLBOX; #endif break; } *fmt++ = sps->pix_fmt; *fmt = AV_PIX_FMT_NONE; return ff_thread_get_format(s->avctx, pix_fmts); }
0
146,251
static int cmd_env(void *data, const char *input) { RCore *core = (RCore*)data; int ret = true; switch (*input) { case '?': { const char* help_msg[] = { "Usage:", "%[name[=value]]", "Set each NAME to VALUE in the environment", "%", "", "list all environment variables", "%", "SHELL", "prints SHELL value", "%", "TMPDIR=/tmp", "sets TMPDIR value to \"/tmp\"", NULL}; r_core_cmd_help (core, help_msg); } break; default: ret = r_core_cmdf (core, "env %s", input); } return ret; }
0
71,428
static void rebase_info2_free(RDyldRebaseInfo2 *rebase_info) { if (!rebase_info) { return; } R_FREE (rebase_info->page_starts); R_FREE (rebase_info->page_extras); R_FREE (rebase_info); }
0
511,434
skip_to_histexp (string, start, delims, flags) char *string; int start; char *delims; int flags; { int i, pass_next, backq, dquote, si, c, oldjmp; int histexp_comsub, histexp_backq, old_dquote; size_t slen; char *temp, open[3]; DECLARE_MBSTATE; slen = strlen (string + start) + start; oldjmp = no_longjmp_on_fatal_error; if (flags & SD_NOJMP) no_longjmp_on_fatal_error = 1; histexp_comsub = histexp_backq = old_dquote = 0; i = start; pass_next = backq = dquote = 0; while (c = string[i]) { if (pass_next) { pass_next = 0; if (c == 0) CQ_RETURN(i); ADVANCE_CHAR (string, slen, i); continue; } else if (c == '\\') { pass_next = 1; i++; continue; } else if (backq && c == '`') { backq = 0; histexp_backq--; dquote = old_dquote; i++; continue; } else if (c == '`') { backq = 1; histexp_backq++; old_dquote = dquote; /* simple - one level for now */ dquote = 0; i++; continue; } /* When in double quotes, act as if the double quote is a member of history_no_expand_chars, like the history library does */ else if (dquote && c == delims[0] && string[i+1] == '"') { i++; continue; } else if (c == delims[0]) break; /* the usual case is to use skip_xxx_quoted, but we don't skip over double quoted strings when looking for the history expansion character as a delimiter. */ else if (dquote && c == '\'') { i++; continue; } else if (c == '\'') i = skip_single_quoted (string, slen, ++i, 0); /* The posixly_correct test makes posix-mode shells allow double quotes to quote the history expansion character */ else if (posixly_correct == 0 && c == '"') { dquote = 1 - dquote; i++; continue; } else if (c == '"') i = skip_double_quoted (string, slen, ++i, 0); #if defined (PROCESS_SUBSTITUTION) else if ((c == '$' || c == '<' || c == '>') && string[i+1] == LPAREN && string[i+2] != LPAREN) #else else if (c == '$' && string[i+1] == LPAREN && string[i+2] != LPAREN) #endif { if (string[i+2] == '\0') CQ_RETURN(i+2); i += 2; histexp_comsub++; old_dquote = dquote; dquote = 0; } else if (histexp_comsub && c == RPAREN) { histexp_comsub--; dquote = old_dquote; i++; continue; } else if (backq) /* placeholder */ { ADVANCE_CHAR (string, slen, i); continue; } else ADVANCE_CHAR (string, slen, i); } CQ_RETURN(i); }
0
77,156
} static inline bool f2fs_realtime_discard_enable(struct f2fs_sb_info *sbi) { return (test_opt(sbi, DISCARD) && f2fs_hw_support_discard(sbi)) ||
0
69,433
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* input; TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, kInputTensor, &input)); TfLiteTensor* output; TF_LITE_ENSURE_OK(context, GetOutputSafe(context, node, kOutputTensor, &output)); const int num_elements = NumElements(input); TF_LITE_ENSURE_EQ(context, num_elements, NumElements(output)); switch (input->type) { case kTfLiteInt64: return copyToTensor(context, input->data.i64, output, num_elements); case kTfLiteInt32: return copyToTensor(context, input->data.i32, output, num_elements); case kTfLiteUInt8: return copyToTensor(context, input->data.uint8, output, num_elements); case kTfLiteFloat32: return copyToTensor(context, GetTensorData<float>(input), output, num_elements); case kTfLiteBool: return copyToTensor(context, input->data.b, output, num_elements); case kTfLiteComplex64: return copyToTensor( context, reinterpret_cast<std::complex<float>*>(input->data.c64), output, num_elements); default: // Unsupported type. TF_LITE_UNSUPPORTED_TYPE(context, input->type, "Cast"); } return kTfLiteOk; }
0
445,427
DnsImplTest() : api_(Api::createApiForTest()), dispatcher_(api_->allocateDispatcher("test_thread")) {}
0
146,917
static void tcp_fixup_rcvbuf(struct sock *sk) { u32 mss = tcp_sk(sk)->advmss; u32 icwnd = TCP_DEFAULT_INIT_RCVWND; int rcvmem; /* Limit to 10 segments if mss <= 1460, * or 14600/mss segments, with a minimum of two segments. */ if (mss > 1460) icwnd = max_t(u32, (1460 * TCP_DEFAULT_INIT_RCVWND) / mss, 2); rcvmem = SKB_TRUESIZE(mss + MAX_TCP_HEADER); while (tcp_win_from_space(rcvmem) < mss) rcvmem += 128; rcvmem *= icwnd; if (sk->sk_rcvbuf < rcvmem) sk->sk_rcvbuf = min(rcvmem, sysctl_tcp_rmem[2]); }
0
245,555
int tls1_process_heartbeat(SSL *s) { unsigned char *p = &s->s3->rrec.data[0], *pl; unsigned short hbtype; unsigned int payload; unsigned int padding = 16; /* Use minimum padding */ if (s->msg_callback) s->msg_callback(0, s->version, TLS1_RT_HEARTBEAT, &s->s3->rrec.data[0], s->s3->rrec.length, s, s->msg_callback_arg); /* Read type and payload length first */ if (1 + 2 + 16 > s->s3->rrec.length) return 0; /* silently discard */ hbtype = *p++; n2s(p, payload); if (1 + 2 + payload + 16 > s->s3->rrec.length) return 0; /* silently discard per RFC 6520 sec. 4 */ pl = p; if (hbtype == TLS1_HB_REQUEST) { unsigned char *buffer, *bp; int r; /* * Allocate memory for the response, size is 1 bytes message type, * plus 2 bytes payload length, plus payload, plus padding */ buffer = OPENSSL_malloc(1 + 2 + payload + padding); if (buffer == NULL) return -1; bp = buffer; /* Enter response type, length and copy payload */ *bp++ = TLS1_HB_RESPONSE; s2n(payload, bp); memcpy(bp, pl, payload); bp += payload; /* Random padding */ if (RAND_bytes(bp, padding) <= 0) { OPENSSL_free(buffer); return -1; } r = ssl3_write_bytes(s, TLS1_RT_HEARTBEAT, buffer, 3 + payload + padding); if (r >= 0 && s->msg_callback) s->msg_callback(1, s->version, TLS1_RT_HEARTBEAT, buffer, 3 + payload + padding, s, s->msg_callback_arg); OPENSSL_free(buffer); if (r < 0) return r; } else if (hbtype == TLS1_HB_RESPONSE) { unsigned int seq; /* * We only send sequence numbers (2 bytes unsigned int), and 16 * random bytes, so we just try to read the sequence number */ n2s(pl, seq); if (payload == 18 && seq == s->tlsext_hb_seq) { s->tlsext_hb_seq++; s->tlsext_hb_pending = 0; } } return 0; }
0
16,830
const char * TSHttpTxnRedirectUrlGet ( TSHttpTxn txnp , int * url_len_ptr ) { sdk_assert ( sdk_sanity_check_txn ( txnp ) == TS_SUCCESS ) ; HttpSM * sm = ( HttpSM * ) txnp ; * url_len_ptr = sm -> redirect_url_len ; return sm -> redirect_url ; }
0
383,727
static void php_date_timezone_set(zval *object, zval *timezone_object, zval *return_value TSRMLS_DC) { php_date_obj *dateobj; php_timezone_obj *tzobj; dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC); DATE_CHECK_INITIALIZED(dateobj->time, DateTime); tzobj = (php_timezone_obj *) zend_object_store_get_object(timezone_object TSRMLS_CC); switch (tzobj->type) { case TIMELIB_ZONETYPE_OFFSET: timelib_set_timezone_from_offset(dateobj->time, tzobj->tzi.utc_offset); break; case TIMELIB_ZONETYPE_ABBR: timelib_set_timezone_from_abbr(dateobj->time, tzobj->tzi.z); break; case TIMELIB_ZONETYPE_ID: timelib_set_timezone(dateobj->time, tzobj->tzi.tz); break; } timelib_unixtime2local(dateobj->time, dateobj->time->sse);
0
38,068
static void saa7164_bus_dumpmsg(struct saa7164_dev *dev, struct tmComResInfo *m, void *buf) { dprintk(DBGLVL_BUS, "Dumping msg structure:\n"); dprintk(DBGLVL_BUS, " .id = %d\n", m->id); dprintk(DBGLVL_BUS, " .flags = 0x%x\n", m->flags); dprintk(DBGLVL_BUS, " .size = 0x%x\n", m->size); dprintk(DBGLVL_BUS, " .command = 0x%x\n", m->command); dprintk(DBGLVL_BUS, " .controlselector = 0x%x\n", m->controlselector); dprintk(DBGLVL_BUS, " .seqno = %d\n", m->seqno); if (buf) dprintk(DBGLVL_BUS, " .buffer (ignored)\n"); }
0
353,499
NeXTDecode(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s) { static const char module[] = "NeXTDecode"; unsigned char *bp, *op; tmsize_t cc; uint8* row; tmsize_t scanline, n; (void) s; /* * Each scanline is assumed to start off as all * white (we assume a PhotometricInterpretation * of ``min-is-black''). */ for (op = (unsigned char*) buf, cc = occ; cc-- > 0;) *op++ = 0xff; bp = (unsigned char *)tif->tif_rawcp; cc = tif->tif_rawcc; scanline = tif->tif_scanlinesize; if (occ % scanline) { TIFFErrorExt(tif->tif_clientdata, module, "Fractional scanlines cannot be read"); return (0); } for (row = buf; occ > 0; occ -= scanline, row += scanline) { n = *bp++, cc--; switch (n) { case LITERALROW: /* * The entire scanline is given as literal values. */ if (cc < scanline) goto bad; _TIFFmemcpy(row, bp, scanline); bp += scanline; cc -= scanline; break; case LITERALSPAN: { tmsize_t off; /* * The scanline has a literal span that begins at some * offset. */ off = (bp[0] * 256) + bp[1]; n = (bp[2] * 256) + bp[3]; if (cc < 4+n || off+n > scanline) goto bad; _TIFFmemcpy(row+off, bp+4, n); bp += 4+n; cc -= 4+n; break; } default: { uint32 npixels = 0, grey; uint32 imagewidth = tif->tif_dir.td_imagewidth; if( isTiled(tif) ) imagewidth = tif->tif_dir.td_tilewidth; /* * The scanline is composed of a sequence of constant * color ``runs''. We shift into ``run mode'' and * interpret bytes as codes of the form * <color><npixels> until we've filled the scanline. */ op = row; for (;;) { grey = (uint32)((n>>6) & 0x3); n &= 0x3f; /* * Ensure the run does not exceed the scanline * bounds, potentially resulting in a security * issue. */ while (n-- > 0 && npixels < imagewidth) SETPIXEL(op, grey); if (npixels >= imagewidth) break; if (cc == 0) goto bad; n = *bp++, cc--; } break; } } } tif->tif_rawcp = (uint8*) bp; tif->tif_rawcc = cc; return (1); bad: TIFFErrorExt(tif->tif_clientdata, module, "Not enough data for scanline %ld", (long) tif->tif_row); return (0); }
1
338,984
static void dvbsub_parse_region_segment(AVCodecContext *avctx, const uint8_t *buf, int buf_size) { DVBSubContext *ctx = avctx->priv_data; const uint8_t *buf_end = buf + buf_size; int region_id, object_id; int av_unused version; DVBSubRegion *region; DVBSubObject *object; DVBSubObjectDisplay *display; int fill; if (buf_size < 10) region_id = *buf++; region = get_region(ctx, region_id); if (!region) { region = av_mallocz(sizeof(DVBSubRegion)); region->id = region_id; region->version = -1; region->next = ctx->region_list; ctx->region_list = region; } version = ((*buf)>>4) & 15; fill = ((*buf++) >> 3) & 1; region->width = AV_RB16(buf); buf += 2; region->height = AV_RB16(buf); buf += 2; if (region->width * region->height != region->buf_size) { av_free(region->pbuf); region->buf_size = region->width * region->height; region->pbuf = av_malloc(region->buf_size); fill = 1; region->dirty = 0; } region->depth = 1 << (((*buf++) >> 2) & 7); if(region->depth<2 || region->depth>8){ av_log(avctx, AV_LOG_ERROR, "region depth %d is invalid\n", region->depth); region->depth= 4; } region->clut = *buf++; if (region->depth == 8) { region->bgcolor = *buf++; buf += 1; } else { buf += 1; if (region->depth == 4) region->bgcolor = (((*buf++) >> 4) & 15); else region->bgcolor = (((*buf++) >> 2) & 3); } av_dlog(avctx, "Region %d, (%dx%d)\n", region_id, region->width, region->height); if (fill) { memset(region->pbuf, region->bgcolor, region->buf_size); av_dlog(avctx, "Fill region (%d)\n", region->bgcolor); } delete_region_display_list(ctx, region); while (buf + 5 < buf_end) { object_id = AV_RB16(buf); buf += 2; object = get_object(ctx, object_id); if (!object) { object = av_mallocz(sizeof(DVBSubObject)); object->id = object_id; object->next = ctx->object_list; ctx->object_list = object; } object->type = (*buf) >> 6; display = av_mallocz(sizeof(DVBSubObjectDisplay)); display->object_id = object_id; display->region_id = region_id; display->x_pos = AV_RB16(buf) & 0xfff; buf += 2; display->y_pos = AV_RB16(buf) & 0xfff; buf += 2; if ((object->type == 1 || object->type == 2) && buf+1 < buf_end) { display->fgcolor = *buf++; display->bgcolor = *buf++; } display->region_list_next = region->display_list; region->display_list = display; display->object_list_next = object->display_list; object->display_list = display; } }
1
175,073
void V8TestObject::ActivityLoggingGetterForAllWorldsLongAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_activityLoggingGetterForAllWorldsLongAttribute_Getter"); ScriptState* script_state = ScriptState::ForRelevantRealm(info); V8PerContextData* context_data = script_state->PerContextData(); if (context_data && context_data->ActivityLogger()) { context_data->ActivityLogger()->LogGetter("TestObject.activityLoggingGetterForAllWorldsLongAttribute"); } test_object_v8_internal::ActivityLoggingGetterForAllWorldsLongAttributeAttributeGetter(info); }
0
522,233
ha_rows get_rownum() const { if (io_cache) return rownum; else return (cache_pos - cache_start) / ref_length; }
0
117,987
add_monitor_path_args (gboolean use_session_helper, FlatpakBwrap *bwrap) { g_autoptr(AutoFlatpakSessionHelper) session_helper = NULL; g_autofree char *monitor_path = NULL; g_autofree char *pkcs11_socket_path = NULL; g_autoptr(GVariant) session_data = NULL; if (use_session_helper) { session_helper = flatpak_session_helper_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES | G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS, "org.freedesktop.Flatpak", "/org/freedesktop/Flatpak/SessionHelper", NULL, NULL); } if (session_helper && flatpak_session_helper_call_request_session_sync (session_helper, &session_data, NULL, NULL)) { if (g_variant_lookup (session_data, "path", "s", &monitor_path)) flatpak_bwrap_add_args (bwrap, "--ro-bind", monitor_path, "/run/host/monitor", "--symlink", "/run/host/monitor/resolv.conf", "/etc/resolv.conf", "--symlink", "/run/host/monitor/host.conf", "/etc/host.conf", "--symlink", "/run/host/monitor/hosts", "/etc/hosts", NULL); if (g_variant_lookup (session_data, "pkcs11-socket", "s", &pkcs11_socket_path)) { g_autofree char *sandbox_pkcs11_socket_path = g_strdup_printf ("/run/user/%d/p11-kit/pkcs11", getuid ()); const char *trusted_module_contents = "# This overrides the runtime p11-kit-trusted module with a client one talking to the trust module on the host\n" "module: p11-kit-client.so\n"; if (flatpak_bwrap_add_args_data (bwrap, "p11-kit-trust.module", trusted_module_contents, -1, "/etc/pkcs11/modules/p11-kit-trust.module", NULL)) { flatpak_bwrap_add_args (bwrap, "--ro-bind", pkcs11_socket_path, sandbox_pkcs11_socket_path, NULL); flatpak_bwrap_unset_env (bwrap, "P11_KIT_SERVER_ADDRESS"); } } } else { if (g_file_test ("/etc/resolv.conf", G_FILE_TEST_EXISTS)) flatpak_bwrap_add_args (bwrap, "--ro-bind", "/etc/resolv.conf", "/etc/resolv.conf", NULL); if (g_file_test ("/etc/host.conf", G_FILE_TEST_EXISTS)) flatpak_bwrap_add_args (bwrap, "--ro-bind", "/etc/host.conf", "/etc/host.conf", NULL); if (g_file_test ("/etc/hosts", G_FILE_TEST_EXISTS)) flatpak_bwrap_add_args (bwrap, "--ro-bind", "/etc/hosts", "/etc/hosts", NULL); } }
0
383,263
pubkey_letter( int algo ) { switch (algo) { case PUBKEY_ALGO_RSA: return 'R' ; case PUBKEY_ALGO_RSA_E: return 'r' ; case PUBKEY_ALGO_RSA_S: return 's' ; case PUBKEY_ALGO_ELGAMAL_E: return 'g' ; case PUBKEY_ALGO_ELGAMAL: return 'G' ; case PUBKEY_ALGO_DSA: return 'D' ; case PUBKEY_ALGO_ECDH: return 'e' ; /* ECC DH (encrypt only) */ case PUBKEY_ALGO_ECDSA: return 'E' ; /* ECC DSA (sign only) */ case PUBKEY_ALGO_EDDSA: return 'E' ; /* ECC EdDSA (sign only) */ default: return '?'; } }
0
429,603
ModuleExport size_t RegisterPCLImage(void) { MagickInfo *entry; entry=SetMagickInfo("PCL"); entry->decoder=(DecodeImageHandler *) ReadPCLImage; entry->encoder=(EncodeImageHandler *) WritePCLImage; entry->magick=(IsImageFormatHandler *) IsPCL; entry->blob_support=MagickFalse; entry->seekable_stream=MagickTrue; entry->thread_support=EncoderThreadSupport; entry->description=ConstantString("Printer Control Language"); entry->module=ConstantString("PCL"); (void) RegisterMagickInfo(entry); return(MagickImageCoderSignature); }
0