unique_id
int64
13
189k
target
int64
0
1
code
stringlengths
20
241k
__index_level_0__
int64
0
18.9k
48,914
0
static int netif_rx_internal(struct sk_buff *skb) { int ret; net_timestamp_check(netdev_tstamp_prequeue, skb); trace_netif_rx(skb); #ifdef CONFIG_RPS if (static_key_false(&rps_needed)) { struct rps_dev_flow voidflow, *rflow = &voidflow; int cpu; preempt_disable(); rcu_read_lock(); cpu = get_rps_cpu(skb->dev, skb, &rflow); if (cpu < 0) cpu = smp_processor_id(); ret = enqueue_to_backlog(skb, cpu, &rflow->last_qtail); rcu_read_unlock(); preempt_enable(); } else #endif { unsigned int qtail; ret = enqueue_to_backlog(skb, get_cpu(), &qtail); put_cpu(); } return ret; }
2,400
137,180
0
gfx::Rect Textfield::GetBounds() { return GetLocalBounds(); }
2,401
166,569
0
void BrowserCommandController::UpdateCommandsForMediaRouter() { if (is_locked_fullscreen_) return; command_updater_.UpdateCommandEnabled(IDC_ROUTE_MEDIA, CanRouteMedia(browser_)); }
2,402
175,245
0
void RIL_onUnsolicitedResponse(int unsolResponse, const void *data, size_t datalen, RIL_SOCKET_ID socket_id) #else extern "C" void RIL_onUnsolicitedResponse(int unsolResponse, const void *data, size_t datalen) #endif { int unsolResponseIndex; int ret; int64_t timeReceived = 0; bool shouldScheduleTimeout = false; RIL_RadioState newState; RIL_SOCKET_ID soc_id = RIL_SOCKET_1; #if defined(ANDROID_MULTI_SIM) soc_id = socket_id; #endif if (s_registerCalled == 0) { RLOGW("RIL_onUnsolicitedResponse called before RIL_register"); return; } unsolResponseIndex = unsolResponse - RIL_UNSOL_RESPONSE_BASE; if ((unsolResponseIndex < 0) || (unsolResponseIndex >= (int32_t)NUM_ELEMS(s_unsolResponses))) { RLOGE("unsupported unsolicited response code %d", unsolResponse); return; } switch (s_unsolResponses[unsolResponseIndex].wakeType) { case WAKE_PARTIAL: grabPartialWakeLock(); shouldScheduleTimeout = true; break; case DONT_WAKE: default: shouldScheduleTimeout = false; break; } if (unsolResponse == RIL_UNSOL_NITZ_TIME_RECEIVED) { timeReceived = elapsedRealtime(); } appendPrintBuf("[UNSL]< %s", requestToString(unsolResponse)); Parcel p; if (s_callbacks.version >= 13 && s_unsolResponses[unsolResponseIndex].wakeType == WAKE_PARTIAL) { p.writeInt32 (RESPONSE_UNSOLICITED_ACK_EXP); } else { p.writeInt32 (RESPONSE_UNSOLICITED); } p.writeInt32 (unsolResponse); ret = s_unsolResponses[unsolResponseIndex] .responseFunction(p, const_cast<void*>(data), datalen); if (ret != 0) { goto error_exit; } switch(unsolResponse) { case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED: newState = processRadioState(CALL_ONSTATEREQUEST(soc_id), soc_id); p.writeInt32(newState); appendPrintBuf("%s {%s}", printBuf, radioStateToString(CALL_ONSTATEREQUEST(soc_id))); break; case RIL_UNSOL_NITZ_TIME_RECEIVED: p.writeInt64(timeReceived); break; } if (s_callbacks.version < 13) { if (shouldScheduleTimeout) { UserCallbackInfo *p_info = internalRequestTimedCallback(wakeTimeoutCallback, NULL, &TIMEVAL_WAKE_TIMEOUT); if (p_info == NULL) { goto error_exit; } else { if (s_last_wake_timeout_info != NULL) { s_last_wake_timeout_info->userParam = (void *)1; } s_last_wake_timeout_info = p_info; } } } #if VDBG RLOGI("%s UNSOLICITED: %s length:%d", rilSocketIdToString(soc_id), requestToString(unsolResponse), p.dataSize()); #endif ret = sendResponse(p, soc_id); if (ret != 0 && unsolResponse == RIL_UNSOL_NITZ_TIME_RECEIVED) { if (s_lastNITZTimeData != NULL) { free (s_lastNITZTimeData); s_lastNITZTimeData = NULL; } s_lastNITZTimeData = calloc(p.dataSize(), 1); if (s_lastNITZTimeData == NULL) { RLOGE("Memory allocation failed in RIL_onUnsolicitedResponse"); goto error_exit; } s_lastNITZTimeDataSize = p.dataSize(); memcpy(s_lastNITZTimeData, p.data(), p.dataSize()); } return; error_exit: if (shouldScheduleTimeout) { releaseWakeLock(); } }
2,403
145,285
0
~DetectedLanguage() {}
2,404
55,530
0
bool find_numa_distance(int distance) { int i; if (distance == node_distance(0, 0)) return true; for (i = 0; i < sched_domains_numa_levels; i++) { if (sched_domains_numa_distance[i] == distance) return true; } return false; }
2,405
156,642
0
explicit ClosePageBeforeCommitHelper(WebContents* web_contents) : DidCommitProvisionalLoadInterceptor(web_contents) {}
2,406
77,628
0
ofputil_make_flow_mod_table_id(bool flow_mod_table_id) { struct nx_flow_mod_table_id *nfmti; struct ofpbuf *msg; msg = ofpraw_alloc(OFPRAW_NXT_FLOW_MOD_TABLE_ID, OFP10_VERSION, 0); nfmti = ofpbuf_put_zeros(msg, sizeof *nfmti); nfmti->set = flow_mod_table_id; return msg; }
2,407
115,559
0
void NetworkChangeNotifier::NotifyObserversOfDNSChange() { if (g_network_change_notifier) { g_network_change_notifier->resolver_state_observer_list_->Notify( &DNSObserver::OnDNSChanged); } }
2,408
145,616
0
void NavigationRequest::CommitErrorPage( RenderFrameHostImpl* render_frame_host, const base::Optional<std::string>& error_page_content) { UpdateRequestNavigationParamsHistory(); frame_tree_node_->TransferNavigationRequestOwnership(render_frame_host); if (IsPerNavigationMojoInterfaceEnabled() && request_navigation_client_ && request_navigation_client_.is_bound()) { IgnorePipeDisconnection(); if (associated_site_instance_id_ == render_frame_host->GetSiteInstance()->GetId()) { commit_navigation_client_ = std::move(request_navigation_client_); } associated_site_instance_id_.reset(); } navigation_handle_->ReadyToCommitNavigation(render_frame_host, true); render_frame_host->FailedNavigation( navigation_handle_->GetNavigationId(), common_params_, request_params_, has_stale_copy_in_cache_, net_error_, error_page_content); }
2,409
187,096
1
DOMHandler::DOMHandler() : DevToolsDomainHandler(DOM::Metainfo::domainName), host_(nullptr) { }
2,410
50,881
0
set_str_a_characters_bp(struct archive_write *a, unsigned char *bp, int from, int to, const char *s, enum vdc vdc) { int r; switch (vdc) { case VDC_STD: set_str(bp+from, s, to - from + 1, 0x20, a_characters_map); r = ARCHIVE_OK; break; case VDC_LOWERCASE: set_str(bp+from, s, to - from + 1, 0x20, a1_characters_map); r = ARCHIVE_OK; break; case VDC_UCS2: case VDC_UCS2_DIRECT: r = set_str_utf16be(a, bp+from, s, to - from + 1, 0x0020, vdc); break; default: r = ARCHIVE_FATAL; } return (r); }
2,411
63,396
0
static void ape_flush(AVCodecContext *avctx) { APEContext *s = avctx->priv_data; s->samples= 0; }
2,412
43,781
0
iakerb_gss_inquire_context(OM_uint32 *minor_status, gss_ctx_id_t context_handle, gss_name_t *src_name, gss_name_t *targ_name, OM_uint32 *lifetime_rec, gss_OID *mech_type, OM_uint32 *ctx_flags, int *initiate, int *opened) { OM_uint32 ret; iakerb_ctx_id_t ctx = (iakerb_ctx_id_t)context_handle; if (src_name != NULL) *src_name = GSS_C_NO_NAME; if (targ_name != NULL) *targ_name = GSS_C_NO_NAME; if (lifetime_rec != NULL) *lifetime_rec = 0; if (mech_type != NULL) *mech_type = (gss_OID)gss_mech_iakerb; if (ctx_flags != NULL) *ctx_flags = 0; if (initiate != NULL) *initiate = ctx->initiate; if (opened != NULL) *opened = ctx->established; if (ctx->gssc == GSS_C_NO_CONTEXT) return GSS_S_COMPLETE; ret = krb5_gss_inquire_context(minor_status, ctx->gssc, src_name, targ_name, lifetime_rec, mech_type, ctx_flags, initiate, opened); if (!ctx->established) { /* Report IAKERB as the mech OID until the context is established. */ if (mech_type != NULL) *mech_type = (gss_OID)gss_mech_iakerb; /* We don't support exporting partially-established contexts. */ if (ctx_flags != NULL) *ctx_flags &= ~GSS_C_TRANS_FLAG; } return ret; }
2,413
29,453
0
static void serial_unlink_irq_chain(struct mp_port *mtpt) { struct irq_info *i = irq_lists + mtpt->port.irq; if (list_empty(i->head)) { free_irq(mtpt->port.irq, i); } serial_do_unlink(i, mtpt); }
2,414
17,216
0
BrowserContextDestroyer::~BrowserContextDestroyer() {}
2,415
166,718
0
Address NormalPageArena::AllocateFromFreeList(size_t allocation_size, size_t gc_info_index) { size_t bucket_size = static_cast<size_t>(1) << free_list_.biggest_free_list_index_; int index = free_list_.biggest_free_list_index_; for (; index > 0; --index, bucket_size >>= 1) { FreeListEntry* entry = free_list_.free_lists_[index]; if (allocation_size > bucket_size) { if (!entry || entry->size() < allocation_size) break; } if (entry) { entry->Unlink(&free_list_.free_lists_[index]); SetAllocationPoint(entry->GetAddress(), entry->size()); DCHECK(HasCurrentAllocationArea()); DCHECK_GE(RemainingAllocationSize(), allocation_size); free_list_.biggest_free_list_index_ = index; return AllocateObject(allocation_size, gc_info_index); } } free_list_.biggest_free_list_index_ = index; return nullptr; }
2,416
187,473
1
int send_event (int fd, uint16_t type, uint16_t code, int32_t value) { struct uinput_event event; BTIF_TRACE_DEBUG("%s type:%u code:%u value:%d", __FUNCTION__, type, code, value); memset(&event, 0, sizeof(event)); event.type = type; event.code = code; event.value = value; return write(fd, &event, sizeof(event)); }
2,417
41,380
0
static unsigned long kvm_get_guest_ip(void) { unsigned long ip = 0; if (percpu_read(current_vcpu)) ip = kvm_rip_read(percpu_read(current_vcpu)); return ip; }
2,418
41,165
0
static int tcp_is_sackfrto(const struct tcp_sock *tp) { return (sysctl_tcp_frto == 0x2) && !tcp_is_reno(tp); }
2,419
178,401
1
xps_parse_glyphs(xps_document *doc, const fz_matrix *ctm, char *base_uri, xps_resource *dict, fz_xml *root) { fz_xml *node; char *fill_uri; char *opacity_mask_uri; char *bidi_level_att; char *fill_att; char *font_size_att; char *font_uri_att; char *origin_x_att; char *origin_y_att; char *is_sideways_att; char *indices_att; char *unicode_att; char *style_att; char *transform_att; char *clip_att; char *opacity_att; char *opacity_mask_att; char *navigate_uri_att; fz_xml *transform_tag = NULL; fz_xml *clip_tag = NULL; fz_xml *fill_tag = NULL; fz_xml *opacity_mask_tag = NULL; char *fill_opacity_att = NULL; xps_part *part; fz_font *font; char partname[1024]; char fakename[1024]; char *subfont; float font_size = 10; int subfontid = 0; int is_sideways = 0; int bidi_level = 0; fz_text *text; fz_rect area; fz_matrix local_ctm = *ctm; /* * Extract attributes and extended attributes. */ bidi_level_att = fz_xml_att(root, "BidiLevel"); fill_att = fz_xml_att(root, "Fill"); font_size_att = fz_xml_att(root, "FontRenderingEmSize"); font_uri_att = fz_xml_att(root, "FontUri"); origin_x_att = fz_xml_att(root, "OriginX"); origin_y_att = fz_xml_att(root, "OriginY"); is_sideways_att = fz_xml_att(root, "IsSideways"); indices_att = fz_xml_att(root, "Indices"); unicode_att = fz_xml_att(root, "UnicodeString"); style_att = fz_xml_att(root, "StyleSimulations"); transform_att = fz_xml_att(root, "RenderTransform"); clip_att = fz_xml_att(root, "Clip"); opacity_att = fz_xml_att(root, "Opacity"); opacity_mask_att = fz_xml_att(root, "OpacityMask"); navigate_uri_att = fz_xml_att(root, "FixedPage.NavigateUri"); for (node = fz_xml_down(root); node; node = fz_xml_next(node)) { if (!strcmp(fz_xml_tag(node), "Glyphs.RenderTransform")) transform_tag = fz_xml_down(node); if (!strcmp(fz_xml_tag(node), "Glyphs.OpacityMask")) opacity_mask_tag = fz_xml_down(node); if (!strcmp(fz_xml_tag(node), "Glyphs.Clip")) clip_tag = fz_xml_down(node); if (!strcmp(fz_xml_tag(node), "Glyphs.Fill")) fill_tag = fz_xml_down(node); } fill_uri = base_uri; opacity_mask_uri = base_uri; xps_resolve_resource_reference(doc, dict, &transform_att, &transform_tag, NULL); xps_resolve_resource_reference(doc, dict, &clip_att, &clip_tag, NULL); xps_resolve_resource_reference(doc, dict, &fill_att, &fill_tag, &fill_uri); xps_resolve_resource_reference(doc, dict, &opacity_mask_att, &opacity_mask_tag, &opacity_mask_uri); /* * Check that we have all the necessary information. */ if (!font_size_att || !font_uri_att || !origin_x_att || !origin_y_att) { fz_warn(doc->ctx, "missing attributes in glyphs element"); return; } if (!indices_att && !unicode_att) return; /* nothing to draw */ if (is_sideways_att) is_sideways = !strcmp(is_sideways_att, "true"); if (bidi_level_att) bidi_level = atoi(bidi_level_att); /* * Find and load the font resource */ xps_resolve_url(partname, base_uri, font_uri_att, sizeof partname); subfont = strrchr(partname, '#'); if (subfont) { subfontid = atoi(subfont + 1); *subfont = 0; } /* Make a new part name for font with style simulation applied */ fz_strlcpy(fakename, partname, sizeof fakename); if (style_att) { if (!strcmp(style_att, "BoldSimulation")) fz_strlcat(fakename, "#Bold", sizeof fakename); else if (!strcmp(style_att, "ItalicSimulation")) fz_strlcat(fakename, "#Italic", sizeof fakename); else if (!strcmp(style_att, "BoldItalicSimulation")) fz_strlcat(fakename, "#BoldItalic", sizeof fakename); } font = xps_lookup_font(doc, fakename); if (!font) { fz_try(doc->ctx) { part = xps_read_part(doc, partname); } fz_catch(doc->ctx) { fz_rethrow_if(doc->ctx, FZ_ERROR_TRYLATER); fz_warn(doc->ctx, "cannot find font resource part '%s'", partname); return; } /* deobfuscate if necessary */ if (strstr(part->name, ".odttf")) xps_deobfuscate_font_resource(doc, part); if (strstr(part->name, ".ODTTF")) xps_deobfuscate_font_resource(doc, part); fz_try(doc->ctx) { fz_buffer *buf = fz_new_buffer_from_data(doc->ctx, part->data, part->size); font = fz_new_font_from_buffer(doc->ctx, NULL, buf, subfontid, 1); fz_drop_buffer(doc->ctx, buf); } fz_catch(doc->ctx) { fz_rethrow_if(doc->ctx, FZ_ERROR_TRYLATER); fz_warn(doc->ctx, "cannot load font resource '%s'", partname); xps_free_part(doc, part); return; } if (style_att) { font->ft_bold = !!strstr(style_att, "Bold"); font->ft_italic = !!strstr(style_att, "Italic"); } xps_select_best_font_encoding(doc, font); xps_insert_font(doc, fakename, font); /* NOTE: we already saved part->data in the buffer in the font */ fz_free(doc->ctx, part->name); fz_free(doc->ctx, part); } /* * Set up graphics state. */ if (transform_att || transform_tag) { fz_matrix transform; if (transform_att) xps_parse_render_transform(doc, transform_att, &transform); if (transform_tag) xps_parse_matrix_transform(doc, transform_tag, &transform); fz_concat(&local_ctm, &transform, &local_ctm); } if (clip_att || clip_tag) xps_clip(doc, &local_ctm, dict, clip_att, clip_tag); font_size = fz_atof(font_size_att); text = xps_parse_glyphs_imp(doc, &local_ctm, font, font_size, fz_atof(origin_x_att), fz_atof(origin_y_att), is_sideways, bidi_level, indices_att, unicode_att); fz_bound_text(doc->ctx, text, NULL, &local_ctm, &area); if (navigate_uri_att) xps_add_link(doc, &area, base_uri, navigate_uri_att); xps_begin_opacity(doc, &local_ctm, &area, opacity_mask_uri, dict, opacity_att, opacity_mask_tag); /* If it's a solid color brush fill/stroke do a simple fill */ if (fill_tag && !strcmp(fz_xml_tag(fill_tag), "SolidColorBrush")) { fill_opacity_att = fz_xml_att(fill_tag, "Opacity"); fill_att = fz_xml_att(fill_tag, "Color"); fill_tag = NULL; } if (fill_att) { float samples[32]; fz_colorspace *colorspace; xps_parse_color(doc, base_uri, fill_att, &colorspace, samples); if (fill_opacity_att) samples[0] *= fz_atof(fill_opacity_att); xps_set_color(doc, colorspace, samples); fz_fill_text(doc->dev, text, &local_ctm, doc->colorspace, doc->color, doc->alpha); } /* If it's a complex brush, use the charpath as a clip mask */ if (fill_tag) { fz_clip_text(doc->dev, text, &local_ctm, 0); xps_parse_brush(doc, &local_ctm, &area, fill_uri, dict, fill_tag); fz_pop_clip(doc->dev); } xps_end_opacity(doc, opacity_mask_uri, dict, opacity_att, opacity_mask_tag); fz_free_text(doc->ctx, text); if (clip_att || clip_tag) fz_pop_clip(doc->dev); fz_drop_font(doc->ctx, font); }
2,420
163,986
0
void PaymentRequestState::SetDefaultProfileSelections() { if (!contact_profiles().empty() && profile_comparator()->IsContactInfoComplete(contact_profiles_[0])) selected_contact_profile_ = contact_profiles()[0]; const std::vector<std::unique_ptr<PaymentInstrument>>& instruments = available_instruments(); auto first_complete_instrument = std::find_if(instruments.begin(), instruments.end(), [](const std::unique_ptr<PaymentInstrument>& instrument) { return instrument->IsCompleteForPayment() && instrument->IsExactlyMatchingMerchantRequest(); }); selected_instrument_ = first_complete_instrument == instruments.end() ? nullptr : first_complete_instrument->get(); SelectDefaultShippingAddressAndNotifyObservers(); bool has_complete_instrument = available_instruments().empty() ? false : available_instruments()[0]->IsCompleteForPayment(); journey_logger_->SetNumberOfSuggestionsShown( JourneyLogger::Section::SECTION_PAYMENT_METHOD, available_instruments().size(), has_complete_instrument); }
2,421
74,387
0
VOID ParaNdis_UpdateDeviceFilters(PARANDIS_ADAPTER *pContext) { if (pContext->bHasHardwareFilters) { ParaNdis_DeviceFiltersUpdateRxMode(pContext); ParaNdis_DeviceFiltersUpdateAddresses(pContext); ParaNdis_DeviceFiltersUpdateVlanId(pContext); } }
2,422
6,295
0
PHP_MINIT_FUNCTION(date) { REGISTER_INI_ENTRIES(); date_register_classes(TSRMLS_C); /* * RFC4287, Section 3.3: http://www.ietf.org/rfc/rfc4287.txt * A Date construct is an element whose content MUST conform to the * "date-time" production in [RFC3339]. In addition, an uppercase "T" * character MUST be used to separate date and time, and an uppercase * "Z" character MUST be present in the absence of a numeric time zone offset. */ REGISTER_STRING_CONSTANT("DATE_ATOM", DATE_FORMAT_RFC3339, CONST_CS | CONST_PERSISTENT); /* * Preliminary specification: http://wp.netscape.com/newsref/std/cookie_spec.html * "This is based on RFC 822, RFC 850, RFC 1036, and RFC 1123, * with the variations that the only legal time zone is GMT * and the separators between the elements of the date must be dashes." */ REGISTER_STRING_CONSTANT("DATE_COOKIE", DATE_FORMAT_COOKIE, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("DATE_ISO8601", DATE_FORMAT_ISO8601, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("DATE_RFC822", DATE_FORMAT_RFC822, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("DATE_RFC850", DATE_FORMAT_RFC850, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("DATE_RFC1036", DATE_FORMAT_RFC1036, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("DATE_RFC1123", DATE_FORMAT_RFC1123, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("DATE_RFC2822", DATE_FORMAT_RFC2822, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("DATE_RFC3339", DATE_FORMAT_RFC3339, CONST_CS | CONST_PERSISTENT); /* * RSS 2.0 Specification: http://blogs.law.harvard.edu/tech/rss * "All date-times in RSS conform to the Date and Time Specification of RFC 822, * with the exception that the year may be expressed with two characters or four characters (four preferred)" */ REGISTER_STRING_CONSTANT("DATE_RSS", DATE_FORMAT_RFC1123, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("DATE_W3C", DATE_FORMAT_RFC3339, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SUNFUNCS_RET_TIMESTAMP", SUNFUNCS_RET_TIMESTAMP, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SUNFUNCS_RET_STRING", SUNFUNCS_RET_STRING, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SUNFUNCS_RET_DOUBLE", SUNFUNCS_RET_DOUBLE, CONST_CS | CONST_PERSISTENT); php_date_global_timezone_db = NULL; php_date_global_timezone_db_enabled = 0; DATEG(last_errors) = NULL; return SUCCESS; }
2,423
8,098
0
GfxFont *GfxResources::lookupFont(char *name) { GfxFont *font; GfxResources *resPtr; for (resPtr = this; resPtr; resPtr = resPtr->next) { if (resPtr->fonts) { if ((font = resPtr->fonts->lookup(name))) return font; } } error(-1, "Unknown font tag '%s'", name); return NULL; }
2,424
81,588
0
void ftrace_profile_free_filter(struct perf_event *event) { struct event_filter *filter = event->filter; event->filter = NULL; __free_filter(filter); }
2,425
55,160
0
enum commit_action get_commit_action(struct rev_info *revs, struct commit *commit) { if (commit->object.flags & SHOWN) return commit_ignore; if (revs->unpacked && has_sha1_pack(commit->object.sha1)) return commit_ignore; if (revs->show_all) return commit_show; if (commit->object.flags & UNINTERESTING) return commit_ignore; if (revs->min_age != -1 && (commit->date > revs->min_age)) return commit_ignore; if (revs->min_parents || (revs->max_parents >= 0)) { int n = commit_list_count(commit->parents); if ((n < revs->min_parents) || ((revs->max_parents >= 0) && (n > revs->max_parents))) return commit_ignore; } if (!commit_match(commit, revs)) return commit_ignore; if (revs->prune && revs->dense) { /* Commit without changes? */ if (commit->object.flags & TREESAME) { int n; struct commit_list *p; /* drop merges unless we want parenthood */ if (!want_ancestry(revs)) return commit_ignore; /* * If we want ancestry, then need to keep any merges * between relevant commits to tie together topology. * For consistency with TREESAME and simplification * use "relevant" here rather than just INTERESTING, * to treat bottom commit(s) as part of the topology. */ for (n = 0, p = commit->parents; p; p = p->next) if (relevant_commit(p->item)) if (++n >= 2) return commit_show; return commit_ignore; } } return commit_show; }
2,426
11,363
0
fbCombineDisjointGeneralC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width, CARD8 combine) { int i; for (i = 0; i < width; ++i) { CARD32 s, d; CARD32 m,n,o,p; CARD32 Fa, Fb; CARD16 t, u, v; CARD32 sa; CARD8 da; s = READ(src + i); m = READ(mask + i); d = READ(dest + i); da = d >> 24; fbCombineMaskC (&s, &m); sa = m; switch (combine & CombineA) { default: Fa = 0; break; case CombineAOut: m = fbCombineDisjointOutPart ((CARD8) (sa >> 0), da); n = fbCombineDisjointOutPart ((CARD8) (sa >> 8), da) << 8; o = fbCombineDisjointOutPart ((CARD8) (sa >> 16), da) << 16; p = fbCombineDisjointOutPart ((CARD8) (sa >> 24), da) << 24; Fa = m|n|o|p; break; case CombineAIn: m = fbCombineDisjointInPart ((CARD8) (sa >> 0), da); n = fbCombineDisjointInPart ((CARD8) (sa >> 8), da) << 8; o = fbCombineDisjointInPart ((CARD8) (sa >> 16), da) << 16; p = fbCombineDisjointInPart ((CARD8) (sa >> 24), da) << 24; Fa = m|n|o|p; break; case CombineA: Fa = 0xffffffff; break; } switch (combine & CombineB) { default: Fb = 0; break; case CombineBOut: m = fbCombineDisjointOutPart (da, (CARD8) (sa >> 0)); n = fbCombineDisjointOutPart (da, (CARD8) (sa >> 8)) << 8; o = fbCombineDisjointOutPart (da, (CARD8) (sa >> 16)) << 16; p = fbCombineDisjointOutPart (da, (CARD8) (sa >> 24)) << 24; Fb = m|n|o|p; break; case CombineBIn: m = fbCombineDisjointInPart (da, (CARD8) (sa >> 0)); n = fbCombineDisjointInPart (da, (CARD8) (sa >> 8)) << 8; o = fbCombineDisjointInPart (da, (CARD8) (sa >> 16)) << 16; p = fbCombineDisjointInPart (da, (CARD8) (sa >> 24)) << 24; Fb = m|n|o|p; break; case CombineB: Fb = 0xffffffff; break; } m = FbGen (s,d,0,FbGet8(Fa,0),FbGet8(Fb,0),t, u, v); n = FbGen (s,d,8,FbGet8(Fa,8),FbGet8(Fb,8),t, u, v); o = FbGen (s,d,16,FbGet8(Fa,16),FbGet8(Fb,16),t, u, v); p = FbGen (s,d,24,FbGet8(Fa,24),FbGet8(Fb,24),t, u, v); s = m|n|o|p; WRITE(dest + i, s); } }
2,427
77,942
0
static void PNGType(png_bytep p,const png_byte *type) { (void) memcpy(p,type,4*sizeof(png_byte)); }
2,428
77,650
0
ofputil_port_stats_from_ofp10(struct ofputil_port_stats *ops, const struct ofp10_port_stats *ps10) { ops->port_no = u16_to_ofp(ntohs(ps10->port_no)); ops->stats.rx_packets = ntohll(get_32aligned_be64(&ps10->rx_packets)); ops->stats.tx_packets = ntohll(get_32aligned_be64(&ps10->tx_packets)); ops->stats.rx_bytes = ntohll(get_32aligned_be64(&ps10->rx_bytes)); ops->stats.tx_bytes = ntohll(get_32aligned_be64(&ps10->tx_bytes)); ops->stats.rx_dropped = ntohll(get_32aligned_be64(&ps10->rx_dropped)); ops->stats.tx_dropped = ntohll(get_32aligned_be64(&ps10->tx_dropped)); ops->stats.rx_errors = ntohll(get_32aligned_be64(&ps10->rx_errors)); ops->stats.tx_errors = ntohll(get_32aligned_be64(&ps10->tx_errors)); ops->stats.rx_frame_errors = ntohll(get_32aligned_be64(&ps10->rx_frame_err)); ops->stats.rx_over_errors = ntohll(get_32aligned_be64(&ps10->rx_over_err)); ops->stats.rx_crc_errors = ntohll(get_32aligned_be64(&ps10->rx_crc_err)); ops->stats.collisions = ntohll(get_32aligned_be64(&ps10->collisions)); ops->duration_sec = ops->duration_nsec = UINT32_MAX; return 0; }
2,429
25,876
0
void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long ip) { regs->ip = ip; }
2,430
63,180
0
static av_always_inline int dnxhd_decode_dct_block(const DNXHDContext *ctx, RowContext *row, int n, int index_bits, int level_bias, int level_shift, int dc_shift) { int i, j, index1, index2, len, flags; int level, component, sign; const int *scale; const uint8_t *weight_matrix; const uint8_t *ac_info = ctx->cid_table->ac_info; int16_t *block = row->blocks[n]; const int eob_index = ctx->cid_table->eob_index; int ret = 0; OPEN_READER(bs, &row->gb); ctx->bdsp.clear_block(block); if (!ctx->is_444) { if (n & 2) { component = 1 + (n & 1); scale = row->chroma_scale; weight_matrix = ctx->cid_table->chroma_weight; } else { component = 0; scale = row->luma_scale; weight_matrix = ctx->cid_table->luma_weight; } } else { component = (n >> 1) % 3; if (component) { scale = row->chroma_scale; weight_matrix = ctx->cid_table->chroma_weight; } else { scale = row->luma_scale; weight_matrix = ctx->cid_table->luma_weight; } } UPDATE_CACHE(bs, &row->gb); GET_VLC(len, bs, &row->gb, ctx->dc_vlc.table, DNXHD_DC_VLC_BITS, 1); if (len) { level = GET_CACHE(bs, &row->gb); LAST_SKIP_BITS(bs, &row->gb, len); sign = ~level >> 31; level = (NEG_USR32(sign ^ level, len) ^ sign) - sign; row->last_dc[component] += level * (1 << dc_shift); } block[0] = row->last_dc[component]; i = 0; UPDATE_CACHE(bs, &row->gb); GET_VLC(index1, bs, &row->gb, ctx->ac_vlc.table, DNXHD_VLC_BITS, 2); while (index1 != eob_index) { level = ac_info[2*index1+0]; flags = ac_info[2*index1+1]; sign = SHOW_SBITS(bs, &row->gb, 1); SKIP_BITS(bs, &row->gb, 1); if (flags & 1) { level += SHOW_UBITS(bs, &row->gb, index_bits) << 7; SKIP_BITS(bs, &row->gb, index_bits); } if (flags & 2) { UPDATE_CACHE(bs, &row->gb); GET_VLC(index2, bs, &row->gb, ctx->run_vlc.table, DNXHD_VLC_BITS, 2); i += ctx->cid_table->run[index2]; } if (++i > 63) { av_log(ctx->avctx, AV_LOG_ERROR, "ac tex damaged %d, %d\n", n, i); ret = -1; break; } j = ctx->scantable.permutated[i]; level *= scale[i]; level += scale[i] >> 1; if (level_bias < 32 || weight_matrix[i] != level_bias) level += level_bias; // 1<<(level_shift-1) level >>= level_shift; block[j] = (level ^ sign) - sign; UPDATE_CACHE(bs, &row->gb); GET_VLC(index1, bs, &row->gb, ctx->ac_vlc.table, DNXHD_VLC_BITS, 2); } CLOSE_READER(bs, &row->gb); return ret; }
2,431
93,656
0
static unsigned int cqspi_calc_rdreg(struct spi_nor *nor, const u8 opcode) { struct cqspi_flash_pdata *f_pdata = nor->priv; u32 rdreg = 0; rdreg |= f_pdata->inst_width << CQSPI_REG_RD_INSTR_TYPE_INSTR_LSB; rdreg |= f_pdata->addr_width << CQSPI_REG_RD_INSTR_TYPE_ADDR_LSB; rdreg |= f_pdata->data_width << CQSPI_REG_RD_INSTR_TYPE_DATA_LSB; return rdreg; }
2,432
175,489
0
static int out_open_pcm_devices(struct stream_out *out) { struct pcm_device *pcm_device; struct listnode *node; struct audio_device *adev = out->dev; int ret = 0; list_for_each(node, &out->pcm_dev_list) { pcm_device = node_to_item(node, struct pcm_device, stream_list_node); ALOGV("%s: Opening PCM device card_id(%d) device_id(%d)", __func__, pcm_device->pcm_profile->card, pcm_device->pcm_profile->device); if (pcm_device->pcm_profile->dsp_name) { pcm_device->dsp_context = cras_dsp_context_new(pcm_device->pcm_profile->config.rate, (adev->mode == AUDIO_MODE_IN_CALL || adev->mode == AUDIO_MODE_IN_COMMUNICATION) ? "voice-comm" : "playback"); if (pcm_device->dsp_context) { cras_dsp_set_variable(pcm_device->dsp_context, "dsp_name", pcm_device->pcm_profile->dsp_name); cras_dsp_load_pipeline(pcm_device->dsp_context); } } pcm_device->pcm = pcm_open(pcm_device->pcm_profile->card, pcm_device->pcm_profile->device, PCM_OUT | PCM_MONOTONIC, &pcm_device->pcm_profile->config); if (pcm_device->pcm && !pcm_is_ready(pcm_device->pcm)) { ALOGE("%s: %s", __func__, pcm_get_error(pcm_device->pcm)); pcm_device->pcm = NULL; ret = -EIO; goto error_open; } /* * If the stream rate differs from the PCM rate, we need to * create a resampler. */ if (out->sample_rate != pcm_device->pcm_profile->config.rate) { ALOGV("%s: create_resampler(), pcm_device_card(%d), pcm_device_id(%d), \ out_rate(%d), device_rate(%d)",__func__, pcm_device->pcm_profile->card, pcm_device->pcm_profile->device, out->sample_rate, pcm_device->pcm_profile->config.rate); ret = create_resampler(out->sample_rate, pcm_device->pcm_profile->config.rate, audio_channel_count_from_out_mask(out->channel_mask), RESAMPLER_QUALITY_DEFAULT, NULL, &pcm_device->resampler); pcm_device->res_byte_count = 0; pcm_device->res_buffer = NULL; } } return ret; error_open: out_close_pcm_devices(out); return ret; }
2,433
46,256
0
int blkdev_fsync(struct file *filp, loff_t start, loff_t end, int datasync) { struct inode *bd_inode = filp->f_mapping->host; struct block_device *bdev = I_BDEV(bd_inode); int error; error = filemap_write_and_wait_range(filp->f_mapping, start, end); if (error) return error; /* * There is no need to serialise calls to blkdev_issue_flush with * i_mutex and doing so causes performance issues with concurrent * O_SYNC writers to a block device. */ error = blkdev_issue_flush(bdev, GFP_KERNEL, NULL); if (error == -EOPNOTSUPP) error = 0; return error; }
2,434
58,376
0
void dump_backtrace_entry(unsigned long where, unsigned long from, unsigned long frame) { #ifdef CONFIG_KALLSYMS printk("[<%08lx>] (%pS) from [<%08lx>] (%pS)\n", where, (void *)where, from, (void *)from); #else printk("Function entered at [<%08lx>] from [<%08lx>]\n", where, from); #endif if (in_exception_text(where)) dump_mem("", "Exception stack", frame + 4, frame + 4 + sizeof(struct pt_regs)); }
2,435
96,378
0
static VOID SharedMemAllocateCompleteHandler( IN NDIS_HANDLE MiniportAdapterContext, IN PVOID VirtualAddress, IN PNDIS_PHYSICAL_ADDRESS PhysicalAddress, IN ULONG Length, IN PVOID Context ) { UNREFERENCED_PARAMETER(MiniportAdapterContext); UNREFERENCED_PARAMETER(VirtualAddress); UNREFERENCED_PARAMETER(PhysicalAddress); UNREFERENCED_PARAMETER(Length); UNREFERENCED_PARAMETER(Context); }
2,436
170,294
0
virtual ~MediaStreamDevicesControllerBrowserTest() {}
2,437
26,879
0
static int proc_pident_fill_cache(struct file *filp, void *dirent, filldir_t filldir, struct task_struct *task, const struct pid_entry *p) { return proc_fill_cache(filp, dirent, filldir, p->name, p->len, proc_pident_instantiate, task, p); }
2,438
16,583
0
FileTransfer::HandleCommands(Service *, int command, Stream *s) { FileTransfer *transobject; char *transkey = NULL; dprintf(D_FULLDEBUG,"entering FileTransfer::HandleCommands\n"); if ( s->type() != Stream::reli_sock ) { return 0; } ReliSock *sock = (ReliSock *) s; sock->timeout(0); if (!sock->get_secret(transkey) || !sock->end_of_message() ) { dprintf(D_FULLDEBUG, "FileTransfer::HandleCommands failed to read transkey\n"); return 0; } dprintf(D_FULLDEBUG, "FileTransfer::HandleCommands read transkey=%s\n",transkey); MyString key(transkey); free(transkey); if ( (TranskeyTable == NULL) || (TranskeyTable->lookup(key,transobject) < 0) ) { sock->snd_int(0,1); // sends a "0" then an end_of_record dprintf(D_FULLDEBUG,"transkey is invalid!\n"); sleep(5); return FALSE; } switch (command) { case FILETRANS_UPLOAD: { const char *currFile; transobject->CommitFiles(); Directory spool_space( transobject->SpoolSpace, transobject->getDesiredPrivState() ); while ( (currFile=spool_space.Next()) ) { if (transobject->UserLogFile && !file_strcmp(transobject->UserLogFile,currFile)) { continue; } else { const char *filename = spool_space.GetFullPath(); if ( !transobject->InputFiles->file_contains(filename) && !transobject->InputFiles->file_contains(condor_basename(filename)) ) { transobject->InputFiles->append(filename); } } } transobject->FilesToSend = transobject->InputFiles; transobject->EncryptFiles = transobject->EncryptInputFiles; transobject->DontEncryptFiles = transobject->DontEncryptInputFiles; transobject->Upload(sock,true); // blocking = true for now... } break; case FILETRANS_DOWNLOAD: transobject->Download(sock,true); // blocking = true for now... break; default: dprintf(D_ALWAYS, "FileTransfer::HandleCommands: unrecognized command %d\n", command); return 0; break; } return 1; }
2,439
66,337
0
static inline void gen_goto_tb(DisasContext *s, int tb_num, target_ulong eip) { target_ulong pc = s->cs_base + eip; if (use_goto_tb(s, pc)) { /* jump to same page: we can use a direct jump */ tcg_gen_goto_tb(tb_num); gen_jmp_im(eip); tcg_gen_exit_tb((uintptr_t)s->tb + tb_num); } else { /* jump to another page: currently not optimized */ gen_jmp_im(eip); gen_eob(s); } }
2,440
139,617
0
std::string TranslateLegacyAvc1CodecIds(const std::string& codec_id) { uint32_t level_start = 0; std::string result; if (base::StartsWith(codec_id, "avc1.66.", base::CompareCase::SENSITIVE)) { level_start = 8; result = "avc1.4200"; } else if (base::StartsWith(codec_id, "avc1.77.", base::CompareCase::SENSITIVE)) { level_start = 8; result = "avc1.4D00"; } else if (base::StartsWith(codec_id, "avc1.100.", base::CompareCase::SENSITIVE)) { level_start = 9; result = "avc1.6400"; } uint32_t level = 0; if (level_start > 0 && base::StringToUint(codec_id.substr(level_start), &level) && level < 256) { result.push_back(IntToHex(level >> 4)); result.push_back(IntToHex(level & 0xf)); return result; } return codec_id; }
2,441
91,911
0
static void sycc444_to_rgb(opj_image_t *img) { int *d0, *d1, *d2, *r, *g, *b; const int *y, *cb, *cr; size_t maxw, maxh, max, i; int offset, upb; upb = (int)img->comps[0].prec; offset = 1 << (upb - 1); upb = (1 << upb) - 1; maxw = (size_t)img->comps[0].w; maxh = (size_t)img->comps[0].h; max = maxw * maxh; y = img->comps[0].data; cb = img->comps[1].data; cr = img->comps[2].data; d0 = r = (int*)opj_image_data_alloc(sizeof(int) * max); d1 = g = (int*)opj_image_data_alloc(sizeof(int) * max); d2 = b = (int*)opj_image_data_alloc(sizeof(int) * max); if (r == NULL || g == NULL || b == NULL) { goto fails; } for (i = 0U; i < max; ++i) { sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b); ++y; ++cb; ++cr; ++r; ++g; ++b; } opj_image_data_free(img->comps[0].data); img->comps[0].data = d0; opj_image_data_free(img->comps[1].data); img->comps[1].data = d1; opj_image_data_free(img->comps[2].data); img->comps[2].data = d2; img->color_space = OPJ_CLRSPC_SRGB; return; fails: opj_image_data_free(r); opj_image_data_free(g); opj_image_data_free(b); }/* sycc444_to_rgb() */
2,442
2,920
0
gs_to_exit(const gs_memory_t *mem, int exit_status) { return gs_to_exit_with_code(mem, exit_status, 0); }
2,443
100,762
0
xmlReadFd(int fd, const char *URL, const char *encoding, int options) { xmlParserCtxtPtr ctxt; xmlParserInputBufferPtr input; xmlParserInputPtr stream; if (fd < 0) return (NULL); input = xmlParserInputBufferCreateFd(fd, XML_CHAR_ENCODING_NONE); if (input == NULL) return (NULL); input->closecallback = NULL; ctxt = xmlNewParserCtxt(); if (ctxt == NULL) { xmlFreeParserInputBuffer(input); return (NULL); } stream = xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE); if (stream == NULL) { xmlFreeParserInputBuffer(input); xmlFreeParserCtxt(ctxt); return (NULL); } inputPush(ctxt, stream); return (xmlDoRead(ctxt, URL, encoding, options, 0)); }
2,444
141,319
0
ProcessingInstruction* Document::createProcessingInstruction( const String& target, const String& data, ExceptionState& exception_state) { if (!IsValidName(target)) { exception_state.ThrowDOMException( DOMExceptionCode::kInvalidCharacterError, "The target provided ('" + target + "') is not a valid name."); return nullptr; } if (data.Contains("?>")) { exception_state.ThrowDOMException( DOMExceptionCode::kInvalidCharacterError, "The data provided ('" + data + "') contains '?>'."); return nullptr; } if (IsHTMLDocument()) { UseCounter::Count(*this, WebFeature::kHTMLDocumentCreateProcessingInstruction); } return ProcessingInstruction::Create(*this, target, data); }
2,445
104,264
0
RTCVoidRequestImpl::~RTCVoidRequestImpl() { }
2,446
164,323
0
bool TabsHighlightFunction::HighlightTab(TabStripModel* tabstrip, ui::ListSelectionModel* selection, int* active_index, int index, std::string* error) { if (!tabstrip->ContainsIndex(index)) { *error = ErrorUtils::FormatErrorMessage( tabs_constants::kTabIndexNotFoundError, base::IntToString(index)); return false; } if (*active_index == -1) *active_index = index; selection->AddIndexToSelection(index); return true; }
2,447
157,725
0
void WebContentsImpl::ClearDeviceEmulationSize() { RenderWidgetHostView* rwhv = GetMainFrame()->GetView(); if (!view_size_before_emulation_.IsEmpty() && rwhv && rwhv->GetViewBounds().size() == device_emulation_size_) { rwhv->SetSize(view_size_before_emulation_); } device_emulation_size_ = gfx::Size(); view_size_before_emulation_ = gfx::Size(); }
2,448
84,426
0
side_get_n_unix_fds (ProxySide *side, int n_fds) { GList *res = NULL; while (side->control_messages != NULL) { GSocketControlMessage *control_message = side->control_messages->data; if (G_IS_UNIX_FD_MESSAGE (control_message)) { GUnixFDMessage *fd_message = G_UNIX_FD_MESSAGE (control_message); GUnixFDList *fd_list = g_unix_fd_message_get_fd_list (fd_message); int len = g_unix_fd_list_get_length (fd_list); /* I believe that socket control messages are never merged, and the sender side sends only one unix-fd-list per message, so at this point there should always be one full fd list per requested number of fds */ if (len != n_fds) { g_warning ("Not right nr of fds in socket message"); return NULL; } side->control_messages = g_list_delete_link (side->control_messages, side->control_messages); return g_list_append (NULL, control_message); } g_object_unref (control_message); side->control_messages = g_list_delete_link (side->control_messages, side->control_messages); } return res; }
2,449
15,382
0
void EC_ec_pre_comp_free(EC_PRE_COMP *pre) { int i; if (pre == NULL) return; CRYPTO_DOWN_REF(&pre->references, &i, pre->lock); REF_PRINT_COUNT("EC_ec", pre); if (i > 0) return; REF_ASSERT_ISNT(i < 0); if (pre->points != NULL) { EC_POINT **pts; for (pts = pre->points; *pts != NULL; pts++) EC_POINT_free(*pts); OPENSSL_free(pre->points); } CRYPTO_THREAD_lock_free(pre->lock); OPENSSL_free(pre); }
2,450
101,842
0
void Browser::TabReplacedAt(TabStripModel* tab_strip_model, TabContentsWrapper* old_contents, TabContentsWrapper* new_contents, int index) { TabDetachedAtImpl(old_contents, index, DETACH_TYPE_REPLACE); TabInsertedAt(new_contents, index, (index == tab_handler_->GetTabStripModel()->active_index())); int entry_count = new_contents->controller().entry_count(); if (entry_count > 0) { new_contents->controller().NotifyEntryChanged( new_contents->controller().GetEntryAtIndex(entry_count - 1), entry_count - 1); } SessionService* session_service = SessionServiceFactory::GetForProfile(profile()); if (session_service) { session_service->TabRestored( new_contents, tab_handler_->GetTabStripModel()->IsTabPinned(index)); } DevToolsManager* devtools_manager = DevToolsManager::GetInstance(); if (devtools_manager) // NULL in unit tests. devtools_manager->TabReplaced(old_contents->tab_contents(), new_contents->tab_contents()); }
2,451
93,570
0
struct sock *mroute6_socket(struct net *net, struct sk_buff *skb) { struct mr6_table *mrt; struct flowi6 fl6 = { .flowi6_iif = skb->skb_iif ? : LOOPBACK_IFINDEX, .flowi6_oif = skb->dev->ifindex, .flowi6_mark = skb->mark, }; if (ip6mr_fib_lookup(net, &fl6, &mrt) < 0) return NULL; return mrt->mroute6_sk; }
2,452
36,315
0
follow_link(struct path *link, struct nameidata *nd, void **p) { struct dentry *dentry = link->dentry; int error; char *s; BUG_ON(nd->flags & LOOKUP_RCU); if (link->mnt == nd->path.mnt) mntget(link->mnt); error = -ELOOP; if (unlikely(current->total_link_count >= 40)) goto out_put_nd_path; cond_resched(); current->total_link_count++; touch_atime(link); nd_set_link(nd, NULL); error = security_inode_follow_link(link->dentry, nd); if (error) goto out_put_nd_path; nd->last_type = LAST_BIND; *p = dentry->d_inode->i_op->follow_link(dentry, nd); error = PTR_ERR(*p); if (IS_ERR(*p)) goto out_put_nd_path; error = 0; s = nd_get_link(nd); if (s) { if (unlikely(IS_ERR(s))) { path_put(&nd->path); put_link(nd, link, *p); return PTR_ERR(s); } if (*s == '/') { set_root(nd); path_put(&nd->path); nd->path = nd->root; path_get(&nd->root); nd->flags |= LOOKUP_JUMPED; } nd->inode = nd->path.dentry->d_inode; error = link_path_walk(s, nd); if (unlikely(error)) put_link(nd, link, *p); } return error; out_put_nd_path: *p = NULL; path_put(&nd->path); path_put(link); return error; }
2,453
111,493
0
int relativeLeftOffset(int caretPosition, int leftOffset) { ASSERT(caretPosition >= 0); return std::max(0, caretPosition - leftOffset); }
2,454
57,788
0
int load_pdptrs(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, unsigned long cr3) { gfn_t pdpt_gfn = cr3 >> PAGE_SHIFT; unsigned offset = ((cr3 & (PAGE_SIZE-1)) >> 5) << 2; int i; int ret; u64 pdpte[ARRAY_SIZE(mmu->pdptrs)]; ret = kvm_read_guest_page_mmu(vcpu, mmu, pdpt_gfn, pdpte, offset * sizeof(u64), sizeof(pdpte), PFERR_USER_MASK|PFERR_WRITE_MASK); if (ret < 0) { ret = 0; goto out; } for (i = 0; i < ARRAY_SIZE(pdpte); ++i) { if (is_present_gpte(pdpte[i]) && (pdpte[i] & vcpu->arch.mmu.guest_rsvd_check.rsvd_bits_mask[0][2])) { ret = 0; goto out; } } ret = 1; memcpy(mmu->pdptrs, pdpte, sizeof(mmu->pdptrs)); __set_bit(VCPU_EXREG_PDPTR, (unsigned long *)&vcpu->arch.regs_avail); __set_bit(VCPU_EXREG_PDPTR, (unsigned long *)&vcpu->arch.regs_dirty); out: return ret; }
2,455
124,416
0
void setSerifFontFamilyWrapper(WebSettings* settings, const string16& font, UScriptCode script) { settings->setSerifFontFamily(font, script); }
2,456
138,564
0
explicit CustomNTPUrlTest(const std::string& ntp_file_path) : https_test_server_(net::EmbeddedTestServer::TYPE_HTTPS), ntp_file_path_(ntp_file_path) { https_test_server_.ServeFilesFromSourceDirectory( "chrome/test/data/local_ntp"); }
2,457
182,977
1
rdpdr_process(STREAM s) { uint32 handle; uint16 vmin; uint16 component; uint16 pakid; logger(Protocol, Debug, "rdpdr_process()"); /* hexdump(s->p, s->end - s->p); */ in_uint16(s, component); in_uint16(s, pakid); if (component == RDPDR_CTYP_CORE) { switch (pakid) { case PAKID_CORE_DEVICE_IOREQUEST: rdpdr_process_irp(s); break; case PAKID_CORE_SERVER_ANNOUNCE: /* DR_CORE_SERVER_ANNOUNCE_REQ */ in_uint8s(s, 2); /* skip versionMajor */ in_uint16_le(s, vmin); /* VersionMinor */ in_uint32_le(s, g_client_id); /* ClientID */ /* The RDP client is responsibility to provide a random client id if server version is < 12 */ if (vmin < 0x000c) g_client_id = 0x815ed39d; /* IP address (use 127.0.0.1) 0x815ed39d */ g_epoch++; #if WITH_SCARD /* * We need to release all SCARD contexts to end all * current transactions and pending calls */ scard_release_all_contexts(); /* * According to [MS-RDPEFS] 3.2.5.1.2: * * If this packet appears after a sequence of other packets, * it is a signal that the server has reconnected to a new session * and the whole sequence has been reset. The client MUST treat * this packet as the beginning of a new sequence. * The client MUST also cancel all outstanding requests and release * previous references to all devices. * * If any problem arises in the future, please, pay attention to the * "If this packet appears after a sequence of other packets" part * */ #endif rdpdr_send_client_announce_reply(); rdpdr_send_client_name_request(); break; case PAKID_CORE_CLIENTID_CONFIRM: rdpdr_send_client_device_list_announce(); break; case PAKID_CORE_DEVICE_REPLY: in_uint32(s, handle); logger(Protocol, Debug, "rdpdr_process(), server connected to resource %d", handle); break; case PAKID_CORE_SERVER_CAPABILITY: rdpdr_send_client_capability_response(); break; default: logger(Protocol, Debug, "rdpdr_process(), pakid 0x%x of component 0x%x", pakid, component); break; } } else if (component == RDPDR_CTYP_PRN) { if (pakid == PAKID_PRN_CACHE_DATA) printercache_process(s); } else logger(Protocol, Warning, "rdpdr_process(), unhandled component 0x%x", component); }
2,458
22,865
0
static int nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred, struct nfs_fattr *fattr, struct iattr *sattr, struct nfs4_state *state) { struct nfs_server *server = NFS_SERVER(inode); struct nfs4_exception exception = { }; int err; do { err = nfs4_handle_exception(server, _nfs4_do_setattr(inode, cred, fattr, sattr, state), &exception); } while (exception.retry); return err; }
2,459
19,871
0
static struct nfs4_createdata *nfs4_alloc_createdata(struct inode *dir, struct qstr *name, struct iattr *sattr, u32 ftype) { struct nfs4_createdata *data; data = kzalloc(sizeof(*data), GFP_KERNEL); if (data != NULL) { struct nfs_server *server = NFS_SERVER(dir); data->msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_CREATE]; data->msg.rpc_argp = &data->arg; data->msg.rpc_resp = &data->res; data->arg.dir_fh = NFS_FH(dir); data->arg.server = server; data->arg.name = name; data->arg.attrs = sattr; data->arg.ftype = ftype; data->arg.bitmask = server->attr_bitmask; data->res.server = server; data->res.fh = &data->fh; data->res.fattr = &data->fattr; data->res.dir_fattr = &data->dir_fattr; nfs_fattr_init(data->res.fattr); nfs_fattr_init(data->res.dir_fattr); } return data; }
2,460
132,533
0
LayoutTestContentBrowserClient::GetLayoutTestNotificationManager() { return layout_test_notification_manager_.get(); }
2,461
6,182
0
static int do_ssl3_write(SSL *s, int type, const unsigned char *buf, unsigned int len, int create_empty_fragment) { unsigned char *p, *plen; int i, mac_size, clear = 0; int prefix_len = 0; int eivlen; long align = 0; SSL3_RECORD *wr; SSL3_BUFFER *wb = &(s->s3->wbuf); SSL_SESSION *sess; /* * first check if there is a SSL3_BUFFER still being written out. This * will happen with non blocking IO */ if (wb->left != 0) return (ssl3_write_pending(s, type, buf, len)); /* If we have an alert to send, lets send it */ if (s->s3->alert_dispatch) { i = s->method->ssl_dispatch_alert(s); if (i <= 0) return (i); /* if it went, fall through and send more stuff */ } if (wb->buf == NULL) if (!ssl3_setup_write_buffer(s)) return -1; if (len == 0 && !create_empty_fragment) return 0; wr = &(s->s3->wrec); sess = s->session; if ((sess == NULL) || (s->enc_write_ctx == NULL) || (EVP_MD_CTX_md(s->write_hash) == NULL)) { #if 1 clear = s->enc_write_ctx ? 0 : 1; /* must be AEAD cipher */ #else clear = 1; #endif mac_size = 0; } else { mac_size = EVP_MD_CTX_size(s->write_hash); if (mac_size < 0) goto err; } /* * 'create_empty_fragment' is true only when this function calls itself */ if (!clear && !create_empty_fragment && !s->s3->empty_fragment_done) { /* * countermeasure against known-IV weakness in CBC ciphersuites (see * http://www.openssl.org/~bodo/tls-cbc.txt) */ if (s->s3->need_empty_fragments && type == SSL3_RT_APPLICATION_DATA) { /* * recursive function call with 'create_empty_fragment' set; this * prepares and buffers the data for an empty fragment (these * 'prefix_len' bytes are sent out later together with the actual * payload) */ prefix_len = do_ssl3_write(s, type, buf, 0, 1); if (prefix_len <= 0) goto err; if (prefix_len > (SSL3_RT_HEADER_LENGTH + SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD)) { /* insufficient space */ SSLerr(SSL_F_DO_SSL3_WRITE, ERR_R_INTERNAL_ERROR); goto err; } } s->s3->empty_fragment_done = 1; } if (create_empty_fragment) { #if defined(SSL3_ALIGN_PAYLOAD) && SSL3_ALIGN_PAYLOAD!=0 /* * extra fragment would be couple of cipher blocks, which would be * multiple of SSL3_ALIGN_PAYLOAD, so if we want to align the real * payload, then we can just pretent we simply have two headers. */ align = (long)wb->buf + 2 * SSL3_RT_HEADER_LENGTH; align = (-align) & (SSL3_ALIGN_PAYLOAD - 1); #endif p = wb->buf + align; wb->offset = align; } else if (prefix_len) { p = wb->buf + wb->offset + prefix_len; } else { #if defined(SSL3_ALIGN_PAYLOAD) && SSL3_ALIGN_PAYLOAD!=0 align = (long)wb->buf + SSL3_RT_HEADER_LENGTH; align = (-align) & (SSL3_ALIGN_PAYLOAD - 1); #endif p = wb->buf + align; wb->offset = align; } /* write the header */ *(p++) = type & 0xff; wr->type = type; *(p++) = (s->version >> 8); /* * Some servers hang if iniatial client hello is larger than 256 bytes * and record version number > TLS 1.0 */ if (s->state == SSL3_ST_CW_CLNT_HELLO_B && !s->renegotiate && TLS1_get_version(s) > TLS1_VERSION) *(p++) = 0x1; else *(p++) = s->version & 0xff; /* field where we are to write out packet length */ plen = p; p += 2; /* Explicit IV length, block ciphers appropriate version flag */ if (s->enc_write_ctx && SSL_USE_EXPLICIT_IV(s)) { int mode = EVP_CIPHER_CTX_mode(s->enc_write_ctx); if (mode == EVP_CIPH_CBC_MODE) { eivlen = EVP_CIPHER_CTX_iv_length(s->enc_write_ctx); if (eivlen <= 1) eivlen = 0; } /* Need explicit part of IV for GCM mode */ else if (mode == EVP_CIPH_GCM_MODE) eivlen = EVP_GCM_TLS_EXPLICIT_IV_LEN; else eivlen = 0; } else eivlen = 0; /* lets setup the record stuff. */ wr->data = p + eivlen; wr->length = (int)len; wr->input = (unsigned char *)buf; /* * we now 'read' from wr->input, wr->length bytes into wr->data */ /* first we compress */ if (s->compress != NULL) { if (!ssl3_do_compress(s)) { SSLerr(SSL_F_DO_SSL3_WRITE, SSL_R_COMPRESSION_FAILURE); goto err; } } else { memcpy(wr->data, wr->input, wr->length); wr->input = wr->data; } /* * we should still have the output to wr->data and the input from * wr->input. Length should be wr->length. wr->data still points in the * wb->buf */ if (mac_size != 0) { if (s->method->ssl3_enc->mac(s, &(p[wr->length + eivlen]), 1) < 0) goto err; wr->length += mac_size; } wr->input = p; wr->data = p; if (eivlen) { /* * if (RAND_pseudo_bytes(p, eivlen) <= 0) goto err; */ wr->length += eivlen; } if (s->method->ssl3_enc->enc(s, 1) < 1) goto err; /* record length after mac and block padding */ s2n(wr->length, plen); if (s->msg_callback) s->msg_callback(1, 0, SSL3_RT_HEADER, plen - 5, 5, s, s->msg_callback_arg); /* * we should now have wr->data pointing to the encrypted data, which is * wr->length long */ wr->type = type; /* not needed but helps for debugging */ wr->length += SSL3_RT_HEADER_LENGTH; if (create_empty_fragment) { /* * we are in a recursive call; just return the length, don't write * out anything here */ return wr->length; } /* now let's set up wb */ wb->left = prefix_len + wr->length; /* * memorize arguments so that ssl3_write_pending can detect bad write * retries later */ s->s3->wpend_tot = len; s->s3->wpend_buf = buf; s->s3->wpend_type = type; s->s3->wpend_ret = len; /* we now just need to write the buffer */ return ssl3_write_pending(s, type, buf, len); err: return -1; }
2,462
106,804
0
void AddSetMsiMarkerWorkItem(const InstallerState& installer_state, BrowserDistribution* dist, bool set, WorkItemList* work_item_list) { DCHECK(work_item_list); DWORD msi_value = set ? 1 : 0; WorkItem* set_msi_work_item = work_item_list->AddSetRegValueWorkItem( installer_state.root_key(), dist->GetStateKey(), google_update::kRegMSIField, msi_value, true); DCHECK(set_msi_work_item); set_msi_work_item->set_ignore_failure(true); set_msi_work_item->set_log_message("Could not write MSI marker!"); }
2,463
149,656
0
static LayoutPoint CornerPointOfRect(LayoutRect rect, Corner which_corner) { switch (which_corner) { case Corner::kTopLeft: return rect.MinXMinYCorner(); case Corner::kTopRight: return rect.MaxXMinYCorner(); } NOTREACHED(); return LayoutPoint(); }
2,464
54,415
0
static ZIPARCHIVE_METHOD(unchangeArchive) { struct zip *intern; zval *self = getThis(); if (!self) { RETURN_FALSE; } ZIP_FROM_OBJECT(intern, self); if (zip_unchange_archive(intern) != 0) { RETURN_FALSE; } else { RETURN_TRUE; } }
2,465
155,527
0
AuthenticatorGenericErrorSheetModel::AuthenticatorGenericErrorSheetModel( AuthenticatorRequestDialogModel* dialog_model, base::string16 title, base::string16 description) : AuthenticatorSheetModelBase(dialog_model), title_(std::move(title)), description_(std::move(description)) {}
2,466
149,359
0
void BinaryUploadService::ResetAuthorizationData() { can_upload_data_ = base::nullopt; IsAuthorized(base::DoNothing()); }
2,467
38,072
0
static int picolcd_probe(struct hid_device *hdev, const struct hid_device_id *id) { struct picolcd_data *data; int error = -ENOMEM; dbg_hid(PICOLCD_NAME " hardware probe...\n"); /* * Let's allocate the picolcd data structure, set some reasonable * defaults, and associate it with the device */ data = kzalloc(sizeof(struct picolcd_data), GFP_KERNEL); if (data == NULL) { hid_err(hdev, "can't allocate space for Minibox PicoLCD device data\n"); error = -ENOMEM; goto err_no_cleanup; } spin_lock_init(&data->lock); mutex_init(&data->mutex); data->hdev = hdev; data->opmode_delay = 5000; if (hdev->product == USB_DEVICE_ID_PICOLCD_BOOTLOADER) data->status |= PICOLCD_BOOTLOADER; hid_set_drvdata(hdev, data); /* Parse the device reports and start it up */ error = hid_parse(hdev); if (error) { hid_err(hdev, "device report parse failed\n"); goto err_cleanup_data; } error = hid_hw_start(hdev, 0); if (error) { hid_err(hdev, "hardware start failed\n"); goto err_cleanup_data; } error = hid_hw_open(hdev); if (error) { hid_err(hdev, "failed to open input interrupt pipe for key and IR events\n"); goto err_cleanup_hid_hw; } error = device_create_file(&hdev->dev, &dev_attr_operation_mode_delay); if (error) { hid_err(hdev, "failed to create sysfs attributes\n"); goto err_cleanup_hid_ll; } error = device_create_file(&hdev->dev, &dev_attr_operation_mode); if (error) { hid_err(hdev, "failed to create sysfs attributes\n"); goto err_cleanup_sysfs1; } if (data->status & PICOLCD_BOOTLOADER) error = picolcd_probe_bootloader(hdev, data); else error = picolcd_probe_lcd(hdev, data); if (error) goto err_cleanup_sysfs2; dbg_hid(PICOLCD_NAME " activated and initialized\n"); return 0; err_cleanup_sysfs2: device_remove_file(&hdev->dev, &dev_attr_operation_mode); err_cleanup_sysfs1: device_remove_file(&hdev->dev, &dev_attr_operation_mode_delay); err_cleanup_hid_ll: hid_hw_close(hdev); err_cleanup_hid_hw: hid_hw_stop(hdev); err_cleanup_data: kfree(data); err_no_cleanup: hid_set_drvdata(hdev, NULL); return error; }
2,468
162,642
0
bool HeadlessPrintManager::OnMessageReceived( const IPC::Message& message, content::RenderFrameHost* render_frame_host) { if (!printing_rfh_ && (message.type() == PrintHostMsg_GetDefaultPrintSettings::ID || message.type() == PrintHostMsg_ScriptedPrint::ID)) { std::string type; switch (message.type()) { case PrintHostMsg_GetDefaultPrintSettings::ID: type = "GetDefaultPrintSettings"; break; case PrintHostMsg_ScriptedPrint::ID: type = "ScriptedPrint"; break; default: type = "Unknown"; break; } DLOG(ERROR) << "Unexpected message received before GetPDFContents is called: " << type; render_frame_host->Send(IPC::SyncMessage::GenerateReply(&message)); return true; } FrameDispatchHelper helper = {this, render_frame_host}; bool handled = true; IPC_BEGIN_MESSAGE_MAP(HeadlessPrintManager, message) IPC_MESSAGE_HANDLER(PrintHostMsg_ShowInvalidPrinterSettingsError, OnShowInvalidPrinterSettingsError) IPC_MESSAGE_HANDLER(PrintHostMsg_DidPrintDocument, OnDidPrintDocument) IPC_MESSAGE_FORWARD_DELAY_REPLY( PrintHostMsg_GetDefaultPrintSettings, &helper, FrameDispatchHelper::OnGetDefaultPrintSettings) IPC_MESSAGE_FORWARD_DELAY_REPLY(PrintHostMsg_ScriptedPrint, &helper, FrameDispatchHelper::OnScriptedPrint) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled || PrintManager::OnMessageReceived(message, render_frame_host); }
2,469
21,013
0
static void __mem_cgroup_threshold(struct mem_cgroup *memcg, bool swap) { struct mem_cgroup_threshold_ary *t; u64 usage; int i; rcu_read_lock(); if (!swap) t = rcu_dereference(memcg->thresholds.primary); else t = rcu_dereference(memcg->memsw_thresholds.primary); if (!t) goto unlock; usage = mem_cgroup_usage(memcg, swap); /* * current_threshold points to threshold just below usage. * If it's not true, a threshold was crossed after last * call of __mem_cgroup_threshold(). */ i = t->current_threshold; /* * Iterate backward over array of thresholds starting from * current_threshold and check if a threshold is crossed. * If none of thresholds below usage is crossed, we read * only one element of the array here. */ for (; i >= 0 && unlikely(t->entries[i].threshold > usage); i--) eventfd_signal(t->entries[i].eventfd, 1); /* i = current_threshold + 1 */ i++; /* * Iterate forward over array of thresholds starting from * current_threshold+1 and check if a threshold is crossed. * If none of thresholds above usage is crossed, we read * only one element of the array here. */ for (; i < t->size && unlikely(t->entries[i].threshold <= usage); i++) eventfd_signal(t->entries[i].eventfd, 1); /* Update current_threshold */ t->current_threshold = i - 1; unlock: rcu_read_unlock(); }
2,470
17,425
0
getEventMask(ScreenPtr pScreen, ClientPtr client) { SetupScreen(pScreen); ScreenSaverEventPtr pEv; if (!pPriv) return 0; for (pEv = pPriv->events; pEv; pEv = pEv->next) if (pEv->client == client) return pEv->mask; return 0; }
2,471
89,537
0
newSWFGlyphShape() { SWFShape shape = (SWFShape)malloc(sizeof(struct SWFShape_s)); /* If malloc failed, return NULL to signify this */ if (NULL == shape) return NULL; SWFCharacterInit((SWFCharacter)shape); BLOCK(shape)->writeBlock = NULL; BLOCK(shape)->complete = NULL; BLOCK(shape)->dtor = NULL; BLOCK(shape)->type = SWF_UNUSEDBLOCK; shape->out = newSWFOutput(); CHARACTER(shape)->bounds = newSWFRect(0,0,0,0); shape->edgeBounds = newSWFRect(0,0,0,0); shape->records = NULL; shape->lines = NULL; shape->fills = NULL; shape->nRecords = 0; shape->xpos = 0; shape->ypos = 0; shape->nLines = 0; shape->nFills = 0; shape->lineWidth = 0; shape->isMorph = FALSE; shape->isEnded = FALSE; shape->flags = 0; shape->useVersion = 0; SWFOutput_writeUInt8(shape->out, 0); /* space for nFillBits, nLineBits */ #if TRACK_ALLOCS shape->gcnode = ming_gc_add_node(shape, (dtorfunctype) destroySWFShape); #endif return shape; }
2,472
181,205
1
static Image *ReadJPEGImage(const ImageInfo *image_info, ExceptionInfo *exception) { char value[MaxTextExtent]; const char *option; ErrorManager error_manager; Image *image; IndexPacket index; JSAMPLE *volatile jpeg_pixels; JSAMPROW scanline[1]; MagickBooleanType debug, status; MagickSizeType number_pixels; MemoryInfo *memory_info; register ssize_t i; struct jpeg_decompress_struct jpeg_info; struct jpeg_error_mgr jpeg_error; register JSAMPLE *p; size_t units; ssize_t y; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); debug=IsEventLogging(); (void) debug; image=AcquireImage(image_info); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } /* Initialize JPEG parameters. */ (void) ResetMagickMemory(&error_manager,0,sizeof(error_manager)); (void) ResetMagickMemory(&jpeg_info,0,sizeof(jpeg_info)); (void) ResetMagickMemory(&jpeg_error,0,sizeof(jpeg_error)); jpeg_info.err=jpeg_std_error(&jpeg_error); jpeg_info.err->emit_message=(void (*)(j_common_ptr,int)) JPEGWarningHandler; jpeg_info.err->error_exit=(void (*)(j_common_ptr)) JPEGErrorHandler; memory_info=(MemoryInfo *) NULL; error_manager.image=image; if (setjmp(error_manager.error_recovery) != 0) { jpeg_destroy_decompress(&jpeg_info); if (error_manager.profile != (StringInfo *) NULL) error_manager.profile=DestroyStringInfo(error_manager.profile); (void) CloseBlob(image); number_pixels=(MagickSizeType) image->columns*image->rows; if (number_pixels != 0) return(GetFirstImageInList(image)); InheritException(exception,&image->exception); return(DestroyImage(image)); } jpeg_info.client_data=(void *) &error_manager; jpeg_create_decompress(&jpeg_info); JPEGSourceManager(&jpeg_info,image); jpeg_set_marker_processor(&jpeg_info,JPEG_COM,ReadComment); option=GetImageOption(image_info,"profile:skip"); if (IsOptionMember("ICC",option) == MagickFalse) jpeg_set_marker_processor(&jpeg_info,ICC_MARKER,ReadICCProfile); if (IsOptionMember("IPTC",option) == MagickFalse) jpeg_set_marker_processor(&jpeg_info,IPTC_MARKER,ReadIPTCProfile); for (i=1; i < 16; i++) if ((i != 2) && (i != 13) && (i != 14)) if (IsOptionMember("APP",option) == MagickFalse) jpeg_set_marker_processor(&jpeg_info,(int) (JPEG_APP0+i),ReadProfile); i=(ssize_t) jpeg_read_header(&jpeg_info,TRUE); if ((image_info->colorspace == YCbCrColorspace) || (image_info->colorspace == Rec601YCbCrColorspace) || (image_info->colorspace == Rec709YCbCrColorspace)) jpeg_info.out_color_space=JCS_YCbCr; /* Set image resolution. */ units=0; if ((jpeg_info.saw_JFIF_marker != 0) && (jpeg_info.X_density != 1) && (jpeg_info.Y_density != 1)) { image->x_resolution=(double) jpeg_info.X_density; image->y_resolution=(double) jpeg_info.Y_density; units=(size_t) jpeg_info.density_unit; } if (units == 1) image->units=PixelsPerInchResolution; if (units == 2) image->units=PixelsPerCentimeterResolution; number_pixels=(MagickSizeType) image->columns*image->rows; option=GetImageOption(image_info,"jpeg:size"); if ((option != (const char *) NULL) && (jpeg_info.out_color_space != JCS_YCbCr)) { double scale_factor; GeometryInfo geometry_info; MagickStatusType flags; /* Scale the image. */ flags=ParseGeometry(option,&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=geometry_info.rho; jpeg_calc_output_dimensions(&jpeg_info); image->magick_columns=jpeg_info.output_width; image->magick_rows=jpeg_info.output_height; scale_factor=1.0; if (geometry_info.rho != 0.0) scale_factor=jpeg_info.output_width/geometry_info.rho; if ((geometry_info.sigma != 0.0) && (scale_factor > (jpeg_info.output_height/geometry_info.sigma))) scale_factor=jpeg_info.output_height/geometry_info.sigma; jpeg_info.scale_num=1U; jpeg_info.scale_denom=(unsigned int) scale_factor; jpeg_calc_output_dimensions(&jpeg_info); if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "Scale factor: %.20g",(double) scale_factor); } #if (JPEG_LIB_VERSION >= 61) && defined(D_PROGRESSIVE_SUPPORTED) #if defined(D_LOSSLESS_SUPPORTED) image->interlace=jpeg_info.process == JPROC_PROGRESSIVE ? JPEGInterlace : NoInterlace; image->compression=jpeg_info.process == JPROC_LOSSLESS ? LosslessJPEGCompression : JPEGCompression; if (jpeg_info.data_precision > 8) (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "12-bit JPEG not supported. Reducing pixel data to 8 bits","`%s'", image->filename); if (jpeg_info.data_precision == 16) jpeg_info.data_precision=12; #else image->interlace=jpeg_info.progressive_mode != 0 ? JPEGInterlace : NoInterlace; image->compression=JPEGCompression; #endif #else image->compression=JPEGCompression; image->interlace=JPEGInterlace; #endif option=GetImageOption(image_info,"jpeg:colors"); if (option != (const char *) NULL) { /* Let the JPEG library quantize for us. */ jpeg_info.quantize_colors=TRUE; jpeg_info.desired_number_of_colors=(int) StringToUnsignedLong(option); } option=GetImageOption(image_info,"jpeg:block-smoothing"); if (option != (const char *) NULL) jpeg_info.do_block_smoothing=IsStringTrue(option) != MagickFalse ? TRUE : FALSE; jpeg_info.dct_method=JDCT_FLOAT; option=GetImageOption(image_info,"jpeg:dct-method"); if (option != (const char *) NULL) switch (*option) { case 'D': case 'd': { if (LocaleCompare(option,"default") == 0) jpeg_info.dct_method=JDCT_DEFAULT; break; } case 'F': case 'f': { if (LocaleCompare(option,"fastest") == 0) jpeg_info.dct_method=JDCT_FASTEST; if (LocaleCompare(option,"float") == 0) jpeg_info.dct_method=JDCT_FLOAT; break; } case 'I': case 'i': { if (LocaleCompare(option,"ifast") == 0) jpeg_info.dct_method=JDCT_IFAST; if (LocaleCompare(option,"islow") == 0) jpeg_info.dct_method=JDCT_ISLOW; break; } } option=GetImageOption(image_info,"jpeg:fancy-upsampling"); if (option != (const char *) NULL) jpeg_info.do_fancy_upsampling=IsStringTrue(option) != MagickFalse ? TRUE : FALSE; (void) jpeg_start_decompress(&jpeg_info); image->columns=jpeg_info.output_width; image->rows=jpeg_info.output_height; image->depth=(size_t) jpeg_info.data_precision; switch (jpeg_info.out_color_space) { case JCS_RGB: default: { (void) SetImageColorspace(image,sRGBColorspace); break; } case JCS_GRAYSCALE: { (void) SetImageColorspace(image,GRAYColorspace); break; } case JCS_YCbCr: { (void) SetImageColorspace(image,YCbCrColorspace); break; } case JCS_CMYK: { (void) SetImageColorspace(image,CMYKColorspace); break; } } if (IsITUFaxImage(image) != MagickFalse) { (void) SetImageColorspace(image,LabColorspace); jpeg_info.out_color_space=JCS_YCbCr; } option=GetImageOption(image_info,"jpeg:colors"); if (option != (const char *) NULL) if (AcquireImageColormap(image,StringToUnsignedLong(option)) == MagickFalse) { InheritException(exception,&image->exception); return(DestroyImageList(image)); } if ((jpeg_info.output_components == 1) && (jpeg_info.quantize_colors == 0)) { size_t colors; colors=(size_t) GetQuantumRange(image->depth)+1; if (AcquireImageColormap(image,colors) == MagickFalse) { InheritException(exception,&image->exception); return(DestroyImageList(image)); } } if (image->debug != MagickFalse) { if (image->interlace != NoInterlace) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "Interlace: progressive"); else (void) LogMagickEvent(CoderEvent,GetMagickModule(), "Interlace: nonprogressive"); (void) LogMagickEvent(CoderEvent,GetMagickModule(),"Data precision: %d", (int) jpeg_info.data_precision); (void) LogMagickEvent(CoderEvent,GetMagickModule(),"Geometry: %dx%d", (int) jpeg_info.output_width,(int) jpeg_info.output_height); } JPEGSetImageQuality(&jpeg_info,image); JPEGSetImageSamplingFactor(&jpeg_info,image); (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double) jpeg_info.out_color_space); (void) SetImageProperty(image,"jpeg:colorspace",value); if (image_info->ping != MagickFalse) { jpeg_destroy_decompress(&jpeg_info); (void) CloseBlob(image); return(GetFirstImageInList(image)); } status=SetImageExtent(image,image->columns,image->rows); if (status == MagickFalse) { jpeg_destroy_decompress(&jpeg_info); InheritException(exception,&image->exception); return(DestroyImageList(image)); } if ((jpeg_info.output_components != 1) && (jpeg_info.output_components != 3) && (jpeg_info.output_components != 4)) { jpeg_destroy_decompress(&jpeg_info); ThrowReaderException(CorruptImageError,"ImageTypeNotSupported"); } memory_info=AcquireVirtualMemory((size_t) image->columns, jpeg_info.output_components*sizeof(*jpeg_pixels)); if (memory_info == (MemoryInfo *) NULL) { jpeg_destroy_decompress(&jpeg_info); ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); } jpeg_pixels=(JSAMPLE *) GetVirtualMemoryBlob(memory_info); /* Convert JPEG pixels to pixel packets. */ if (setjmp(error_manager.error_recovery) != 0) { if (memory_info != (MemoryInfo *) NULL) memory_info=RelinquishVirtualMemory(memory_info); jpeg_destroy_decompress(&jpeg_info); (void) CloseBlob(image); number_pixels=(MagickSizeType) image->columns*image->rows; if (number_pixels != 0) return(GetFirstImageInList(image)); return(DestroyImage(image)); } if (jpeg_info.quantize_colors != 0) { image->colors=(size_t) jpeg_info.actual_number_of_colors; if (jpeg_info.out_color_space == JCS_GRAYSCALE) for (i=0; i < (ssize_t) image->colors; i++) { image->colormap[i].red=ScaleCharToQuantum(jpeg_info.colormap[0][i]); image->colormap[i].green=image->colormap[i].red; image->colormap[i].blue=image->colormap[i].red; image->colormap[i].opacity=OpaqueOpacity; } else for (i=0; i < (ssize_t) image->colors; i++) { image->colormap[i].red=ScaleCharToQuantum(jpeg_info.colormap[0][i]); image->colormap[i].green=ScaleCharToQuantum(jpeg_info.colormap[1][i]); image->colormap[i].blue=ScaleCharToQuantum(jpeg_info.colormap[2][i]); image->colormap[i].opacity=OpaqueOpacity; } } scanline[0]=(JSAMPROW) jpeg_pixels; for (y=0; y < (ssize_t) image->rows; y++) { register IndexPacket *magick_restrict indexes; register ssize_t x; register PixelPacket *magick_restrict q; if (jpeg_read_scanlines(&jpeg_info,scanline,1) != 1) { (void) ThrowMagickException(exception,GetMagickModule(), CorruptImageWarning,"SkipToSyncByte","`%s'",image->filename); continue; } p=jpeg_pixels; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) break; indexes=GetAuthenticIndexQueue(image); if (jpeg_info.data_precision > 8) { unsigned short scale; scale=65535/(unsigned short) GetQuantumRange((size_t) jpeg_info.data_precision); if (jpeg_info.output_components == 1) for (x=0; x < (ssize_t) image->columns; x++) { size_t pixel; pixel=(size_t) (scale*GETJSAMPLE(*p)); index=ConstrainColormapIndex(image,pixel); SetPixelIndex(indexes+x,index); SetPixelRGBO(q,image->colormap+(ssize_t) index); p++; q++; } else if (image->colorspace != CMYKColorspace) for (x=0; x < (ssize_t) image->columns; x++) { SetPixelRed(q,ScaleShortToQuantum((unsigned short) (scale*GETJSAMPLE(*p++)))); SetPixelGreen(q,ScaleShortToQuantum((unsigned short) (scale*GETJSAMPLE(*p++)))); SetPixelBlue(q,ScaleShortToQuantum((unsigned short) (scale*GETJSAMPLE(*p++)))); SetPixelOpacity(q,OpaqueOpacity); q++; } else for (x=0; x < (ssize_t) image->columns; x++) { SetPixelCyan(q,QuantumRange-ScaleShortToQuantum( (unsigned short) (scale*GETJSAMPLE(*p++)))); SetPixelMagenta(q,QuantumRange-ScaleShortToQuantum( (unsigned short) (scale*GETJSAMPLE(*p++)))); SetPixelYellow(q,QuantumRange-ScaleShortToQuantum( (unsigned short) (scale*GETJSAMPLE(*p++)))); SetPixelBlack(indexes+x,QuantumRange-ScaleShortToQuantum( (unsigned short) (scale*GETJSAMPLE(*p++)))); SetPixelOpacity(q,OpaqueOpacity); q++; } } else if (jpeg_info.output_components == 1) for (x=0; x < (ssize_t) image->columns; x++) { index=ConstrainColormapIndex(image,(size_t) GETJSAMPLE(*p)); SetPixelIndex(indexes+x,index); SetPixelRGBO(q,image->colormap+(ssize_t) index); p++; q++; } else if (image->colorspace != CMYKColorspace) for (x=0; x < (ssize_t) image->columns; x++) { SetPixelRed(q,ScaleCharToQuantum((unsigned char) GETJSAMPLE(*p++))); SetPixelGreen(q,ScaleCharToQuantum((unsigned char) GETJSAMPLE(*p++))); SetPixelBlue(q,ScaleCharToQuantum((unsigned char) GETJSAMPLE(*p++))); SetPixelOpacity(q,OpaqueOpacity); q++; } else for (x=0; x < (ssize_t) image->columns; x++) { SetPixelCyan(q,QuantumRange-ScaleCharToQuantum((unsigned char) GETJSAMPLE(*p++))); SetPixelMagenta(q,QuantumRange-ScaleCharToQuantum((unsigned char) GETJSAMPLE(*p++))); SetPixelYellow(q,QuantumRange-ScaleCharToQuantum((unsigned char) GETJSAMPLE(*p++))); SetPixelBlack(indexes+x,QuantumRange-ScaleCharToQuantum( (unsigned char) GETJSAMPLE(*p++))); SetPixelOpacity(q,OpaqueOpacity); q++; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) { jpeg_abort_decompress(&jpeg_info); break; } } if (status != MagickFalse) { error_manager.finished=MagickTrue; if (setjmp(error_manager.error_recovery) == 0) (void) jpeg_finish_decompress(&jpeg_info); } /* Free jpeg resources. */ jpeg_destroy_decompress(&jpeg_info); memory_info=RelinquishVirtualMemory(memory_info); (void) CloseBlob(image); return(GetFirstImageInList(image)); }
2,473
113,584
0
bool AccessibilityUIElement::isAttributeSupported(JSStringRef attribute) { return false; }
2,474
174,522
0
decode_rfc3442_rt(int dl, const uint8_t *data) { const uint8_t *p = data; const uint8_t *e; uint8_t cidr; size_t ocets; struct rt *routes = NULL; struct rt *rt = NULL; /* Minimum is 5 -first is CIDR and a router length of 4 */ if (dl < 5) return NULL; e = p + dl; while (p < e) { cidr = *p++; if (cidr > 32) { free_routes(routes); errno = EINVAL; return NULL; } if (rt) { rt->next = xzalloc(sizeof(*rt)); rt = rt->next; } else { routes = rt = xzalloc(sizeof(*routes)); } rt->next = NULL; ocets = (cidr + 7) / 8; /* If we have ocets then we have a destination and netmask */ if (ocets > 0) { memcpy(&rt->dest.s_addr, p, ocets); p += ocets; rt->net.s_addr = htonl(~0U << (32 - cidr)); } /* Finally, snag the router */ memcpy(&rt->gate.s_addr, p, 4); p += 4; } return routes; }
2,475
163,359
0
bool RenderThreadImpl::IsThreadedAnimationEnabled() { return is_threaded_animation_enabled_; }
2,476
45,931
0
static int init_tfm(struct crypto_tfm *tfm) { struct crypto_cipher *cipher; struct crypto_instance *inst = (void *)tfm->__crt_alg; struct crypto_spawn *spawn = crypto_instance_ctx(inst); struct priv *ctx = crypto_tfm_ctx(tfm); u32 *flags = &tfm->crt_flags; cipher = crypto_spawn_cipher(spawn); if (IS_ERR(cipher)) return PTR_ERR(cipher); if (crypto_cipher_blocksize(cipher) != XTS_BLOCK_SIZE) { *flags |= CRYPTO_TFM_RES_BAD_BLOCK_LEN; crypto_free_cipher(cipher); return -EINVAL; } ctx->child = cipher; cipher = crypto_spawn_cipher(spawn); if (IS_ERR(cipher)) { crypto_free_cipher(ctx->child); return PTR_ERR(cipher); } /* this check isn't really needed, leave it here just in case */ if (crypto_cipher_blocksize(cipher) != XTS_BLOCK_SIZE) { crypto_free_cipher(cipher); crypto_free_cipher(ctx->child); *flags |= CRYPTO_TFM_RES_BAD_BLOCK_LEN; return -EINVAL; } ctx->tweak = cipher; return 0; }
2,477
178,620
1
ProcEstablishConnection(ClientPtr client) { const char *reason; char *auth_proto, *auth_string; xConnClientPrefix *prefix; REQUEST(xReq); prefix = (xConnClientPrefix *) ((char *) stuff + sz_xReq); auth_proto = (char *) prefix + sz_xConnClientPrefix; auth_string = auth_proto + pad_to_int32(prefix->nbytesAuthProto); if ((prefix->majorVersion != X_PROTOCOL) || (prefix->minorVersion != X_PROTOCOL_REVISION)) reason = "Protocol version mismatch"; else return (SendConnSetup(client, reason)); }
2,478
92,835
0
GF_Err EncodeFile(char *in, GF_ISOFile *mp4, GF_SMEncodeOptions *opts, FILE *logs) { #ifdef GPAC_DISABLE_SMGR return GF_NOT_SUPPORTED; #else GF_Err e; GF_SceneLoader load; GF_SceneManager *ctx; GF_SceneGraph *sg; #ifndef GPAC_DISABLE_SCENE_STATS GF_StatManager *statsman = NULL; #endif sg = gf_sg_new(); ctx = gf_sm_new(sg); memset(&load, 0, sizeof(GF_SceneLoader)); load.fileName = in; load.ctx = ctx; load.swf_import_flags = swf_flags; load.swf_flatten_limit = swf_flatten_angle; /*since we're encoding we must get MPEG4 nodes only*/ load.flags = GF_SM_LOAD_MPEG4_STRICT; e = gf_sm_load_init(&load); if (e<0) { gf_sm_load_done(&load); fprintf(stderr, "Cannot load context %s - %s\n", in, gf_error_to_string(e)); goto err_exit; } e = gf_sm_load_run(&load); gf_sm_load_done(&load); #ifndef GPAC_DISABLE_SCENE_STATS if (opts->auto_quant) { fprintf(stderr, "Analysing Scene for Automatic Quantization\n"); statsman = gf_sm_stats_new(); e = gf_sm_stats_for_scene(statsman, ctx); if (!e) { GF_SceneStatistics *stats = gf_sm_stats_get(statsman); /*LASeR*/ if (opts->auto_quant==1) { if (opts->resolution > (s32)stats->frac_res_2d) { fprintf(stderr, " Given resolution %d is (unnecessarily) too high, using %d instead.\n", opts->resolution, stats->frac_res_2d); opts->resolution = stats->frac_res_2d; } else if (stats->int_res_2d + opts->resolution <= 0) { fprintf(stderr, " Given resolution %d is too low, using %d instead.\n", opts->resolution, stats->int_res_2d - 1); opts->resolution = 1 - stats->int_res_2d; } opts->coord_bits = stats->int_res_2d + opts->resolution; fprintf(stderr, " Coordinates & Lengths encoded using "); if (opts->resolution < 0) fprintf(stderr, "only the %d most significant bits (of %d).\n", opts->coord_bits, stats->int_res_2d); else fprintf(stderr, "a %d.%d representation\n", stats->int_res_2d, opts->resolution); fprintf(stderr, " Matrix Scale & Skew Coefficients "); if (opts->coord_bits - 8 < stats->scale_int_res_2d) { opts->scale_bits = stats->scale_int_res_2d - opts->coord_bits + 8; fprintf(stderr, "encoded using a %d.8 representation\n", stats->scale_int_res_2d); } else { opts->scale_bits = 0; fprintf(stderr, "encoded using a %d.8 representation\n", opts->coord_bits - 8); } } #ifndef GPAC_DISABLE_VRML /*BIFS*/ else if (stats->base_layer) { GF_AUContext *au; GF_CommandField *inf; M_QuantizationParameter *qp; GF_Command *com = gf_sg_command_new(ctx->scene_graph, GF_SG_GLOBAL_QUANTIZER); qp = (M_QuantizationParameter *) gf_node_new(ctx->scene_graph, TAG_MPEG4_QuantizationParameter); inf = gf_sg_command_field_new(com); inf->new_node = (GF_Node *)qp; inf->field_ptr = &inf->new_node; inf->fieldType = GF_SG_VRML_SFNODE; gf_node_register(inf->new_node, NULL); au = gf_list_get(stats->base_layer->AUs, 0); gf_list_insert(au->commands, com, 0); qp->useEfficientCoding = 1; qp->textureCoordinateQuant = 0; if ((stats->count_2f+stats->count_2d) && opts->resolution) { qp->position2DMin = stats->min_2d; qp->position2DMax = stats->max_2d; qp->position2DNbBits = opts->resolution; qp->position2DQuant = 1; } if ((stats->count_3f+stats->count_3d) && opts->resolution) { qp->position3DMin = stats->min_3d; qp->position3DMax = stats->max_3d; qp->position3DQuant = opts->resolution; qp->position3DQuant = 1; qp->textureCoordinateQuant = 1; } #if 0 if (stats->count_float && opts->resolution) { qp->scaleMin = stats->min_fixed; qp->scaleMax = stats->max_fixed; qp->scaleNbBits = 2*opts->resolution; qp->scaleQuant = 1; } #endif } #endif } } #endif /*GPAC_DISABLE_SCENE_STATS*/ if (e<0) { fprintf(stderr, "Error loading file %s\n", gf_error_to_string(e)); goto err_exit; } else { gf_log_cbk prev_logs = NULL; if (logs) { gf_log_set_tool_level(GF_LOG_CODING, GF_LOG_DEBUG); prev_logs = gf_log_set_callback(logs, scene_coding_log); } opts->src_url = in; e = gf_sm_encode_to_file(ctx, mp4, opts); if (logs) { gf_log_set_tool_level(GF_LOG_CODING, GF_LOG_ERROR); gf_log_set_callback(NULL, prev_logs); } } gf_isom_set_brand_info(mp4, GF_ISOM_BRAND_MP42, 1); gf_isom_modify_alternate_brand(mp4, GF_ISOM_BRAND_ISOM, 1); err_exit: #ifndef GPAC_DISABLE_SCENE_STATS if (statsman) gf_sm_stats_del(statsman); #endif gf_sm_del(ctx); gf_sg_del(sg); return e; #endif /*GPAC_DISABLE_SMGR*/ }
2,479
158,863
0
bool Browser::ShouldStartShutdown() const { if (IsBrowserClosing()) return false; const size_t closing_browsers_count = BrowserList::GetInstance()->currently_closing_browsers().size(); return BrowserList::GetInstance()->size() == closing_browsers_count + 1u; }
2,480
168,515
0
void ReadableStreamBytesConsumer::OnRejected() { DCHECK(is_reading_); DCHECK(!pending_buffer_); is_reading_ = false; if (state_ == PublicState::kClosed) return; DCHECK_EQ(state_, PublicState::kReadableOrWaiting); state_ = PublicState::kErrored; reader_.Clear(); Client* client = client_; ClearClient(); if (client) client->OnStateChange(); }
2,481
123,542
0
void SavePackage::GetSerializedHtmlDataForCurrentPageWithLocalLinks() { if (wait_state_ != HTML_DATA) return; std::vector<GURL> saved_links; std::vector<FilePath> saved_file_paths; int successful_started_items_count = 0; for (SaveUrlItemMap::iterator it = in_progress_items_.begin(); it != in_progress_items_.end(); ++it) { DCHECK(it->second->save_source() == SaveFileCreateInfo::SAVE_FILE_FROM_DOM); if (it->second->has_final_name()) successful_started_items_count++; saved_links.push_back(it->second->url()); saved_file_paths.push_back(it->second->file_name()); } if (successful_started_items_count != in_process_count()) return; for (SavedItemMap::iterator it = saved_success_items_.begin(); it != saved_success_items_.end(); ++it) { DCHECK(it->second->has_final_name()); saved_links.push_back(it->second->url()); saved_file_paths.push_back(it->second->file_name()); } FilePath relative_dir_name = saved_main_directory_path_.BaseName(); Send(new ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks( routing_id(), saved_links, saved_file_paths, relative_dir_name)); }
2,482
122,980
0
void RenderWidgetHostImpl::ImeConfirmComposition(const string16& text) { ImeConfirmComposition(text, ui::Range::InvalidRange()); }
2,483
10,441
0
static int megasas_finish_internal_dcmd(MegasasCmd *cmd, SCSIRequest *req) { int opcode; int retval = MFI_STAT_OK; int lun = req->lun; opcode = le32_to_cpu(cmd->frame->dcmd.opcode); scsi_req_unref(req); trace_megasas_dcmd_internal_finish(cmd->index, opcode, lun); switch (opcode) { case MFI_DCMD_PD_GET_INFO: retval = megasas_pd_get_info_submit(req->dev, lun, cmd); break; case MFI_DCMD_LD_GET_INFO: retval = megasas_ld_get_info_submit(req->dev, lun, cmd); break; default: trace_megasas_dcmd_internal_invalid(cmd->index, opcode); retval = MFI_STAT_INVALID_DCMD; break; } if (retval != MFI_STAT_INVALID_STATUS) { megasas_finish_dcmd(cmd, cmd->iov_size); } return retval; }
2,484
167,075
0
BluetoothSocketCloseFunction::BluetoothSocketCloseFunction() {}
2,485
141,148
0
static inline bool IsValidNameStart(UChar32 c) { if ((c >= 0x02BB && c <= 0x02C1) || c == 0x559 || c == 0x6E5 || c == 0x6E6) return true; if (c == ':' || c == '_') return true; const uint32_t kNameStartMask = WTF::unicode::kLetter_Lowercase | WTF::unicode::kLetter_Uppercase | WTF::unicode::kLetter_Other | WTF::unicode::kLetter_Titlecase | WTF::unicode::kNumber_Letter; if (!(WTF::unicode::Category(c) & kNameStartMask)) return false; if (c >= 0xF900 && c < 0xFFFE) return false; WTF::unicode::CharDecompositionType decomp_type = WTF::unicode::DecompositionType(c); if (decomp_type == WTF::unicode::kDecompositionFont || decomp_type == WTF::unicode::kDecompositionCompat) return false; return true; }
2,486
175,095
0
void SoundChannel::setVolume(float leftVolume, float rightVolume) { Mutex::Autolock lock(&mLock); setVolume_l(leftVolume, rightVolume); }
2,487
124,972
0
LayoutUnit RenderBox::viewLogicalHeightForPercentages() const { if (document().printing()) return static_cast<LayoutUnit>(view()->pageLogicalHeight()); return view()->viewLogicalHeight(); }
2,488
62,245
0
bgp_capabilities_print(netdissect_options *ndo, const u_char *opt, int caps_len) { int cap_type, cap_len, tcap_len, cap_offset; int i = 0; while (i < caps_len) { ND_TCHECK2(opt[i], BGP_CAP_HEADER_SIZE); cap_type=opt[i]; cap_len=opt[i+1]; tcap_len=cap_len; ND_PRINT((ndo, "\n\t %s (%u), length: %u", tok2str(bgp_capcode_values, "Unknown", cap_type), cap_type, cap_len)); ND_TCHECK2(opt[i+2], cap_len); switch (cap_type) { case BGP_CAPCODE_MP: ND_PRINT((ndo, "\n\t\tAFI %s (%u), SAFI %s (%u)", tok2str(af_values, "Unknown", EXTRACT_16BITS(opt+i+2)), EXTRACT_16BITS(opt+i+2), tok2str(bgp_safi_values, "Unknown", opt[i+5]), opt[i+5])); break; case BGP_CAPCODE_RESTART: ND_PRINT((ndo, "\n\t\tRestart Flags: [%s], Restart Time %us", ((opt[i+2])&0x80) ? "R" : "none", EXTRACT_16BITS(opt+i+2)&0xfff)); tcap_len-=2; cap_offset=4; while(tcap_len>=4) { ND_PRINT((ndo, "\n\t\t AFI %s (%u), SAFI %s (%u), Forwarding state preserved: %s", tok2str(af_values,"Unknown", EXTRACT_16BITS(opt+i+cap_offset)), EXTRACT_16BITS(opt+i+cap_offset), tok2str(bgp_safi_values,"Unknown", opt[i+cap_offset+2]), opt[i+cap_offset+2], ((opt[i+cap_offset+3])&0x80) ? "yes" : "no" )); tcap_len-=4; cap_offset+=4; } break; case BGP_CAPCODE_RR: case BGP_CAPCODE_RR_CISCO: break; case BGP_CAPCODE_AS_NEW: /* * Extract the 4 byte AS number encoded. */ if (cap_len == 4) { ND_PRINT((ndo, "\n\t\t 4 Byte AS %s", as_printf(ndo, astostr, sizeof(astostr), EXTRACT_32BITS(opt + i + 2)))); } break; case BGP_CAPCODE_ADD_PATH: cap_offset=2; if (tcap_len == 0) { ND_PRINT((ndo, " (bogus)")); /* length */ break; } while (tcap_len > 0) { if (tcap_len < 4) { ND_PRINT((ndo, "\n\t\t(invalid)")); break; } ND_PRINT((ndo, "\n\t\tAFI %s (%u), SAFI %s (%u), Send/Receive: %s", tok2str(af_values,"Unknown",EXTRACT_16BITS(opt+i+cap_offset)), EXTRACT_16BITS(opt+i+cap_offset), tok2str(bgp_safi_values,"Unknown",opt[i+cap_offset+2]), opt[i+cap_offset+2], tok2str(bgp_add_path_recvsend,"Bogus (0x%02x)",opt[i+cap_offset+3]) )); tcap_len-=4; cap_offset+=4; } break; default: ND_PRINT((ndo, "\n\t\tno decoder for Capability %u", cap_type)); if (ndo->ndo_vflag <= 1) print_unknown_data(ndo, &opt[i+2], "\n\t\t", cap_len); break; } if (ndo->ndo_vflag > 1 && cap_len > 0) { print_unknown_data(ndo, &opt[i+2], "\n\t\t", cap_len); } i += BGP_CAP_HEADER_SIZE + cap_len; } return; trunc: ND_PRINT((ndo, "[|BGP]")); }
2,489
25,275
0
static inline u32 armv7pmu_read_counter(int idx) { unsigned long value = 0; if (idx == ARMV7_CYCLE_COUNTER) asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r" (value)); else if ((idx >= ARMV7_COUNTER0) && (idx <= ARMV7_COUNTER_LAST)) { if (armv7_pmnc_select_counter(idx) == idx) asm volatile("mrc p15, 0, %0, c9, c13, 2" : "=r" (value)); } else pr_err("CPU%u reading wrong counter %d\n", smp_processor_id(), idx); return value; }
2,490
183,419
1
static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) { struct tun_struct *tun; struct tun_file *tfile = file->private_data; struct net_device *dev; int err; if (tfile->detached) return -EINVAL; dev = __dev_get_by_name(net, ifr->ifr_name); if (dev) { if (ifr->ifr_flags & IFF_TUN_EXCL) return -EBUSY; if ((ifr->ifr_flags & IFF_TUN) && dev->netdev_ops == &tun_netdev_ops) tun = netdev_priv(dev); else if ((ifr->ifr_flags & IFF_TAP) && dev->netdev_ops == &tap_netdev_ops) tun = netdev_priv(dev); else return -EINVAL; if (!!(ifr->ifr_flags & IFF_MULTI_QUEUE) != !!(tun->flags & IFF_MULTI_QUEUE)) return -EINVAL; if (tun_not_capable(tun)) return -EPERM; err = security_tun_dev_open(tun->security); if (err < 0) return err; err = tun_attach(tun, file, ifr->ifr_flags & IFF_NOFILTER); if (err < 0) return err; if (tun->flags & IFF_MULTI_QUEUE && (tun->numqueues + tun->numdisabled > 1)) { /* One or more queue has already been attached, no need * to initialize the device again. */ return 0; } } else { char *name; unsigned long flags = 0; int queues = ifr->ifr_flags & IFF_MULTI_QUEUE ? MAX_TAP_QUEUES : 1; if (!ns_capable(net->user_ns, CAP_NET_ADMIN)) return -EPERM; err = security_tun_dev_create(); if (err < 0) return err; /* Set dev type */ if (ifr->ifr_flags & IFF_TUN) { /* TUN device */ flags |= IFF_TUN; name = "tun%d"; } else if (ifr->ifr_flags & IFF_TAP) { /* TAP device */ flags |= IFF_TAP; name = "tap%d"; } else return -EINVAL; if (*ifr->ifr_name) name = ifr->ifr_name; dev = alloc_netdev_mqs(sizeof(struct tun_struct), name, NET_NAME_UNKNOWN, tun_setup, queues, queues); if (!dev) return -ENOMEM; err = dev_get_valid_name(net, dev, name); if (err) goto err_free_dev; dev_net_set(dev, net); dev->rtnl_link_ops = &tun_link_ops; dev->ifindex = tfile->ifindex; dev->sysfs_groups[0] = &tun_attr_group; tun = netdev_priv(dev); tun->dev = dev; tun->flags = flags; tun->txflt.count = 0; tun->vnet_hdr_sz = sizeof(struct virtio_net_hdr); tun->align = NET_SKB_PAD; tun->filter_attached = false; tun->sndbuf = tfile->socket.sk->sk_sndbuf; tun->rx_batched = 0; tun->pcpu_stats = netdev_alloc_pcpu_stats(struct tun_pcpu_stats); if (!tun->pcpu_stats) { err = -ENOMEM; goto err_free_dev; } spin_lock_init(&tun->lock); err = security_tun_dev_alloc_security(&tun->security); if (err < 0) goto err_free_stat; tun_net_init(dev); tun_flow_init(tun); dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | TUN_USER_FEATURES | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX; dev->features = dev->hw_features | NETIF_F_LLTX; dev->vlan_features = dev->features & ~(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX); INIT_LIST_HEAD(&tun->disabled); err = tun_attach(tun, file, false); if (err < 0) goto err_free_flow; err = register_netdevice(tun->dev); if (err < 0) goto err_detach; } netif_carrier_on(tun->dev); tun_debug(KERN_INFO, tun, "tun_set_iff\n"); tun->flags = (tun->flags & ~TUN_FEATURES) | (ifr->ifr_flags & TUN_FEATURES); /* Make sure persistent devices do not get stuck in * xoff state. */ if (netif_running(tun->dev)) netif_tx_wake_all_queues(tun->dev); strcpy(ifr->ifr_name, tun->dev->name); return 0; err_detach: tun_detach_all(dev); /* register_netdevice() already called tun_free_netdev() */ goto err_free_dev; err_free_flow: tun_flow_uninit(tun); security_tun_dev_free_security(tun->security); err_free_stat: free_percpu(tun->pcpu_stats); err_free_dev: free_netdev(dev); return err; }
2,491
184,497
1
bool PrintPreviewMessageHandler::OnMessageReceived( const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(PrintPreviewMessageHandler, message) IPC_MESSAGE_HANDLER(PrintHostMsg_RequestPrintPreview, OnRequestPrintPreview) IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetPreviewPageCount, OnDidGetPreviewPageCount) IPC_MESSAGE_HANDLER(PrintHostMsg_DidPreviewPage, OnDidPreviewPage) IPC_MESSAGE_HANDLER(PrintHostMsg_MetafileReadyForPrinting, OnMetafileReadyForPrinting) IPC_MESSAGE_HANDLER(PrintHostMsg_PrintPreviewFailed, OnPrintPreviewFailed) IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetDefaultPageLayout, OnDidGetDefaultPageLayout) IPC_MESSAGE_HANDLER(PrintHostMsg_PrintPreviewCancelled, OnPrintPreviewCancelled) IPC_MESSAGE_HANDLER(PrintHostMsg_PrintPreviewInvalidPrinterSettings, OnInvalidPrinterSettings) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; }
2,492
150,726
0
const PermissionInfoList& last_permission_info_list() { return last_permission_info_list_; }
2,493
130,412
0
void ThreadWatcher::OnCheckResponsiveness(uint64 ping_sequence_number) { DCHECK(WatchDogThread::CurrentlyOnWatchDogThread()); if (!active_) { responsive_ = true; return; } if (ping_sequence_number_ != ping_sequence_number) { ResetHangCounters(); responsive_ = true; return; } GotNoResponse(); base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, base::Bind(&ThreadWatcher::OnCheckResponsiveness, weak_ptr_factory_.GetWeakPtr(), ping_sequence_number_), unresponsive_time_); responsive_ = false; }
2,494
107,042
0
WKPageRef QQuickWebView::pageRef() const { Q_D(const QQuickWebView); return toAPI(d->webPageProxy.get()); }
2,495
133,351
0
void WindowTreeHostManager::CreateOrUpdateMirroringDisplay( const DisplayInfoList& info_list) { if (GetDisplayManager()->IsInMirrorMode() || GetDisplayManager()->IsInUnifiedMode()) { mirror_window_controller_->UpdateWindow(info_list); cursor_window_controller_->UpdateContainer(); } else { NOTREACHED(); } }
2,496
37,578
0
static int rmap_add(struct kvm_vcpu *vcpu, u64 *spte, gfn_t gfn) { struct kvm_mmu_page *sp; unsigned long *rmapp; sp = page_header(__pa(spte)); kvm_mmu_page_set_gfn(sp, spte - sp->spt, gfn); rmapp = gfn_to_rmap(vcpu->kvm, gfn, sp->role.level); return pte_list_add(vcpu, spte, rmapp); }
2,497
79,416
0
static int mov_write_tfrf_tags(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *track) { int64_t pos = avio_tell(pb); int i; for (i = 0; i < mov->ism_lookahead; i++) { /* Update the tfrf tag for the last ism_lookahead fragments, * nb_frag_info - 1 is the next fragment to be written. */ mov_write_tfrf_tag(pb, mov, track, track->nb_frag_info - 2 - i); } avio_seek(pb, pos, SEEK_SET); return 0; }
2,498
25,939
0
static int is_f00f_bug(struct pt_regs *regs, unsigned long address) { #ifdef CONFIG_X86_F00F_BUG unsigned long nr; /* * Pentium F0 0F C7 C8 bug workaround: */ if (boot_cpu_data.f00f_bug) { nr = (address - idt_descr.address) >> 3; if (nr == 6) { do_invalid_op(regs, 0); return 1; } } #endif return 0; }
2,499