unique_id
int64
13
189k
target
int64
0
1
code
stringlengths
20
241k
__index_level_0__
int64
0
18.9k
33,353
0
static __u8 map_line_status(__u8 ti_lsr) { __u8 lsr = 0; #define MAP_FLAG(flagUmp, flagUart) \ if (ti_lsr & flagUmp) \ lsr |= flagUart; MAP_FLAG(UMP_UART_LSR_OV_MASK, LSR_OVER_ERR) /* overrun */ MAP_FLAG(UMP_UART_LSR_PE_MASK, LSR_PAR_ERR) /* parity error */ MAP_FLAG(UMP_UART_LSR_FE_MASK, LSR_FRM_ERR) /* framing error */ MAP_FLAG(UMP_UART_LSR_BR_MASK, LSR_BREAK) /* break detected */ MAP_FLAG(UMP_UART_LSR_RX_MASK, LSR_RX_AVAIL) /* rx data available */ MAP_FLAG(UMP_UART_LSR_TX_MASK, LSR_TX_EMPTY) /* tx hold reg empty */ #undef MAP_FLAG return lsr; }
5,800
123,192
0
bool RenderWidgetHostViewAura::HasHitTestMask() const { return false; }
5,801
52,015
0
dissect_NOTIFY_OPTIONS_ARRAY(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { /* Why is a check for di->conformant_run not required here? */ offset = dissect_ndr_ucarray( tvb, offset, pinfo, tree, di, drep, dissect_NOTIFY_OPTION); return offset; }
5,802
61,647
0
expat_end_cb(void *userData, const XML_Char *name) { struct expat_userData *ud = (struct expat_userData *)userData; xml_end(ud->archive, (const char *)name); }
5,803
83,807
0
static inline void hwsim_net_set_wmediumd(struct net *net, u32 portid) { struct hwsim_net *hwsim_net = net_generic(net, hwsim_net_id); hwsim_net->wmediumd = portid; }
5,804
126,971
0
AudioRendererHost::AudioEntry::AudioEntry() : stream_id(0), pending_close(false) { }
5,805
144,551
0
uint64_t WebContentsImpl::GetUploadPosition() const { return upload_position_; }
5,806
79,358
0
static int mov_write_header(AVFormatContext *s) { AVIOContext *pb = s->pb; MOVMuxContext *mov = s->priv_data; AVDictionaryEntry *t, *global_tcr = av_dict_get(s->metadata, "timecode", NULL, 0); int i, ret, hint_track = 0, tmcd_track = 0, nb_tracks = s->nb_streams; if (mov->mode & (MODE_MP4|MODE_MOV|MODE_IPOD) && s->nb_chapters) nb_tracks++; if (mov->flags & FF_MOV_FLAG_RTP_HINT) { hint_track = nb_tracks; for (i = 0; i < s->nb_streams; i++) if (rtp_hinting_needed(s->streams[i])) nb_tracks++; } if (mov->mode == MODE_MOV || mov->mode == MODE_MP4) tmcd_track = nb_tracks; for (i = 0; i < s->nb_streams; i++) { int j; AVStream *st= s->streams[i]; MOVTrack *track= &mov->tracks[i]; /* copy extradata if it exists */ if (st->codecpar->extradata_size) { if (st->codecpar->codec_id == AV_CODEC_ID_DVD_SUBTITLE) mov_create_dvd_sub_decoder_specific_info(track, st); else if (!TAG_IS_AVCI(track->tag) && st->codecpar->codec_id != AV_CODEC_ID_DNXHD) { track->vos_len = st->codecpar->extradata_size; track->vos_data = av_malloc(track->vos_len); if (!track->vos_data) { return AVERROR(ENOMEM); } memcpy(track->vos_data, st->codecpar->extradata, track->vos_len); } } if (st->codecpar->codec_type != AVMEDIA_TYPE_AUDIO || track->par->channel_layout != AV_CH_LAYOUT_MONO) continue; for (j = 0; j < s->nb_streams; j++) { AVStream *stj= s->streams[j]; MOVTrack *trackj= &mov->tracks[j]; if (j == i) continue; if (stj->codecpar->codec_type != AVMEDIA_TYPE_AUDIO || trackj->par->channel_layout != AV_CH_LAYOUT_MONO || trackj->language != track->language || trackj->tag != track->tag ) continue; track->multichannel_as_mono++; } } if (!(mov->flags & FF_MOV_FLAG_DELAY_MOOV)) { if ((ret = mov_write_identification(pb, s)) < 0) return ret; } if (mov->reserved_moov_size){ mov->reserved_header_pos = avio_tell(pb); if (mov->reserved_moov_size > 0) avio_skip(pb, mov->reserved_moov_size); } if (mov->flags & FF_MOV_FLAG_FRAGMENT) { /* If no fragmentation options have been set, set a default. */ if (!(mov->flags & (FF_MOV_FLAG_FRAG_KEYFRAME | FF_MOV_FLAG_FRAG_CUSTOM | FF_MOV_FLAG_FRAG_EVERY_FRAME)) && !mov->max_fragment_duration && !mov->max_fragment_size) mov->flags |= FF_MOV_FLAG_FRAG_KEYFRAME; } else { if (mov->flags & FF_MOV_FLAG_FASTSTART) mov->reserved_header_pos = avio_tell(pb); mov_write_mdat_tag(pb, mov); } ff_parse_creation_time_metadata(s, &mov->time, 1); if (mov->time) mov->time += 0x7C25B080; // 1970 based -> 1904 based if (mov->chapter_track) if ((ret = mov_create_chapter_track(s, mov->chapter_track)) < 0) return ret; if (mov->flags & FF_MOV_FLAG_RTP_HINT) { for (i = 0; i < s->nb_streams; i++) { if (rtp_hinting_needed(s->streams[i])) { if ((ret = ff_mov_init_hinting(s, hint_track, i)) < 0) return ret; hint_track++; } } } if (mov->nb_meta_tmcd) { /* Initialize the tmcd tracks */ for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; t = global_tcr; if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { AVTimecode tc; if (!t) t = av_dict_get(st->metadata, "timecode", NULL, 0); if (!t) continue; if (mov_check_timecode_track(s, &tc, i, t->value) < 0) continue; if ((ret = mov_create_timecode_track(s, tmcd_track, i, tc)) < 0) return ret; tmcd_track++; } } } avio_flush(pb); if (mov->flags & FF_MOV_FLAG_ISML) mov_write_isml_manifest(pb, mov, s); if (mov->flags & FF_MOV_FLAG_EMPTY_MOOV && !(mov->flags & FF_MOV_FLAG_DELAY_MOOV)) { if ((ret = mov_write_moov_tag(pb, mov, s)) < 0) return ret; avio_flush(pb); mov->moov_written = 1; if (mov->flags & FF_MOV_FLAG_GLOBAL_SIDX) mov->reserved_header_pos = avio_tell(pb); } return 0; }
5,807
59,041
0
on_check_config(TCMUService1 *interface, GDBusMethodInvocation *invocation, gchar *cfgstring, gpointer user_data) { struct tcmur_handler *handler = user_data; char *reason = NULL; bool str_ok = true; if (handler->check_config) str_ok = handler->check_config(cfgstring, &reason); if (str_ok) reason = "success"; g_dbus_method_invocation_return_value(invocation, g_variant_new("(bs)", str_ok, reason ? : "unknown")); if (!str_ok) free(reason); return TRUE; }
5,808
130,382
0
bool IsFormSubmit(const NavigationEntry* entry) { return (ui::PageTransitionStripQualifier(entry->GetTransitionType()) == ui::PAGE_TRANSITION_FORM_SUBMIT); }
5,809
170,632
0
int AecInit (preproc_effect_t *effect) { ALOGV("AecInit"); webrtc::EchoControlMobile *aec = static_cast<webrtc::EchoControlMobile *>(effect->engine); aec->set_routing_mode(kAecDefaultMode); aec->enable_comfort_noise(kAecDefaultComfortNoise); return 0; }
5,810
147,744
0
static void ReadonlyEventTargetAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) { v8::Local<v8::Object> holder = info.Holder(); TestObject* impl = V8TestObject::ToImpl(holder); V8SetReturnValueFast(info, WTF::GetPtr(impl->readonlyEventTargetAttribute()), impl); }
5,811
153,904
0
void GLES2DecoderImpl::ClearFramebufferForWorkaround(GLbitfield mask) { ScopedGLErrorSuppressor suppressor("GLES2DecoderImpl::ClearWorkaround", error_state_.get()); clear_framebuffer_blit_->ClearFramebuffer( this, gfx::Size(viewport_max_width_, viewport_max_height_), mask, state_.color_clear_red, state_.color_clear_green, state_.color_clear_blue, state_.color_clear_alpha, state_.depth_clear, state_.stencil_clear); }
5,812
138,720
0
void RenderFrameHostImpl::JavaScriptDialogClosed( IPC::Message* reply_msg, bool success, const base::string16& user_input, bool dialog_was_suppressed) { GetProcess()->SetIgnoreInputEvents(false); SendJavaScriptDialogReply(reply_msg, success, user_input); for (RenderFrameHostImpl* frame = this; frame; frame = frame->GetParent()) { if (frame->is_waiting_for_beforeunload_ack_) { if (dialog_was_suppressed) { frame->SimulateBeforeUnloadAck(); } else if (frame->beforeunload_timeout_) { frame->beforeunload_timeout_->Start( TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS)); } } } }
5,813
76,646
0
static boolean str_suffix(const char *begin_buf, const char *end_buf, const char *s) { const char *s1 = end_buf - 1, *s2 = strend(s) - 1; if (*s1 == 10) s1--; while (s1 >= begin_buf && s2 >= s) { if (*s1-- != *s2--) return false; } return s2 < s; }
5,814
96,115
0
static ssize_t WritePSDChannels(const PSDInfo *psd_info, const ImageInfo *image_info,Image *image,Image *next_image, MagickOffsetType size_offset,const MagickBooleanType separate) { Image *mask; MagickOffsetType rows_offset; size_t channels, count, length, offset_length; unsigned char *compact_pixels; count=0; offset_length=0; rows_offset=0; compact_pixels=(unsigned char *) NULL; if (next_image->compression == RLECompression) { compact_pixels=AcquireCompactPixels(image); if (compact_pixels == (unsigned char *) NULL) return(0); } channels=1; if (separate == MagickFalse) { if (next_image->storage_class != PseudoClass) { if (IsGrayImage(next_image,&next_image->exception) == MagickFalse) channels=next_image->colorspace == CMYKColorspace ? 4 : 3; if (next_image->matte != MagickFalse) channels++; } rows_offset=TellBlob(image)+2; count+=WriteCompressionStart(psd_info,image,next_image,channels); offset_length=(next_image->rows*(psd_info->version == 1 ? 2 : 4)); } size_offset+=2; if (next_image->storage_class == PseudoClass) { length=WritePSDChannel(psd_info,image_info,image,next_image, IndexQuantum,compact_pixels,rows_offset,separate); if (separate != MagickFalse) size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2; else rows_offset+=offset_length; count+=length; } else { if (IsGrayImage(next_image,&next_image->exception) != MagickFalse) { length=WritePSDChannel(psd_info,image_info,image,next_image, GrayQuantum,compact_pixels,rows_offset,separate); if (separate != MagickFalse) size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2; else rows_offset+=offset_length; count+=length; } else { if (next_image->colorspace == CMYKColorspace) (void) NegateImage(next_image,MagickFalse); length=WritePSDChannel(psd_info,image_info,image,next_image, RedQuantum,compact_pixels,rows_offset,separate); if (separate != MagickFalse) size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2; else rows_offset+=offset_length; count+=length; length=WritePSDChannel(psd_info,image_info,image,next_image, GreenQuantum,compact_pixels,rows_offset,separate); if (separate != MagickFalse) size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2; else rows_offset+=offset_length; count+=length; length=WritePSDChannel(psd_info,image_info,image,next_image, BlueQuantum,compact_pixels,rows_offset,separate); if (separate != MagickFalse) size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2; else rows_offset+=offset_length; count+=length; if (next_image->colorspace == CMYKColorspace) { length=WritePSDChannel(psd_info,image_info,image,next_image, BlackQuantum,compact_pixels,rows_offset,separate); if (separate != MagickFalse) size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2; else rows_offset+=offset_length; count+=length; } } if (next_image->matte != MagickFalse) { length=WritePSDChannel(psd_info,image_info,image,next_image, AlphaQuantum,compact_pixels,rows_offset,separate); if (separate != MagickFalse) size_offset+=WritePSDSize(psd_info,image,length,size_offset)+2; else rows_offset+=offset_length; count+=length; } } compact_pixels=(unsigned char *) RelinquishMagickMemory(compact_pixels); if (next_image->colorspace == CMYKColorspace) (void) NegateImage(next_image,MagickFalse); if (separate != MagickFalse) { const char *property; property=GetImageArtifact(next_image,"psd:opacity-mask"); if (property != (const char *) NULL) { mask=(Image *) GetImageRegistry(ImageRegistryType,property, &image->exception); if (mask != (Image *) NULL) { if (mask->compression == RLECompression) { compact_pixels=AcquireCompactPixels(mask); if (compact_pixels == (unsigned char *) NULL) return(0); } length=WritePSDChannel(psd_info,image_info,image,mask, RedQuantum,compact_pixels,rows_offset,MagickTrue); (void) WritePSDSize(psd_info,image,length,size_offset); count+=length; compact_pixels=(unsigned char *) RelinquishMagickMemory( compact_pixels); } } } return(count); }
5,815
45,974
0
magic_close(struct magic_set *ms) { if (ms == NULL) return; file_ms_free(ms); }
5,816
130,822
0
static void locationAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) { TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); TestObjectV8Internal::locationAttributeSetter(jsValue, info); TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); }
5,817
174,675
0
WORD32 ih264d_delete_lt_node(dpb_manager_t *ps_dpb_mgr, UWORD32 u4_lt_idx, UWORD8 u1_fld_pic_flag, struct dpb_info_t *ps_lt_node_to_insert, WORD32 *pi4_status) { *pi4_status = 0; if(ps_dpb_mgr->u1_num_lt_ref_bufs > 0) { WORD32 i; struct dpb_info_t *ps_next_dpb; /* ps_unmark_node points to the node to be removed */ /* from long term list. */ struct dpb_info_t *ps_unmark_node; ps_next_dpb = ps_dpb_mgr->ps_dpb_ht_head; if(ps_next_dpb->u1_lt_idx == u4_lt_idx) { ps_unmark_node = ps_next_dpb; } else { for(i = 1; i < ps_dpb_mgr->u1_num_lt_ref_bufs; i++) { if(ps_next_dpb->ps_prev_long->u1_lt_idx == u4_lt_idx) break; ps_next_dpb = ps_next_dpb->ps_prev_long; } if(i == ps_dpb_mgr->u1_num_lt_ref_bufs) *pi4_status = 1; else ps_unmark_node = ps_next_dpb->ps_prev_long; } if(*pi4_status == 0) { if(u1_fld_pic_flag) { if(ps_lt_node_to_insert != ps_unmark_node) { UWORD8 u1_deleted = 0; /* for the ps_unmark_node mark the corresponding field */ /* field as unused for reference */ if(ps_unmark_node->s_top_field.u1_long_term_frame_idx == u4_lt_idx) { ps_unmark_node->s_top_field.u1_reference_info = UNUSED_FOR_REF; ps_unmark_node->s_top_field.u1_long_term_frame_idx = MAX_REF_BUFS + 1; u1_deleted = 1; } if(ps_unmark_node->s_bot_field.u1_long_term_frame_idx == u4_lt_idx) { ps_unmark_node->s_bot_field.u1_reference_info = UNUSED_FOR_REF; ps_unmark_node->s_bot_field.u1_long_term_frame_idx = MAX_REF_BUFS + 1; u1_deleted = 1; } if(!u1_deleted) { UWORD32 i4_error_code; i4_error_code = ERROR_DBP_MANAGER_T; return i4_error_code; } } ps_unmark_node->u1_used_as_ref = ps_unmark_node->s_top_field.u1_reference_info | ps_unmark_node->s_bot_field.u1_reference_info; } else ps_unmark_node->u1_used_as_ref = UNUSED_FOR_REF; if(UNUSED_FOR_REF == ps_unmark_node->u1_used_as_ref) { if(ps_unmark_node == ps_dpb_mgr->ps_dpb_ht_head) ps_dpb_mgr->ps_dpb_ht_head = ps_next_dpb->ps_prev_long; ps_unmark_node->u1_lt_idx = MAX_REF_BUFS + 1; ps_unmark_node->s_top_field.u1_reference_info = UNUSED_FOR_REF; ps_unmark_node->s_bot_field.u1_reference_info = UNUSED_FOR_REF; ih264d_free_ref_pic_mv_bufs(ps_dpb_mgr->pv_codec_handle, ps_unmark_node->u1_buf_id); ps_next_dpb->ps_prev_long = ps_unmark_node->ps_prev_long; //update link ps_unmark_node->ps_prev_long = NULL; ps_dpb_mgr->u1_num_lt_ref_bufs--; //decrement LT buf count } } } return OK; }
5,818
124,727
0
void RenderBlockFlow::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, LayoutUnit& previousFloatLogicalBottom) { LayoutUnit oldPosMarginBefore = maxPositiveMarginBefore(); LayoutUnit oldNegMarginBefore = maxNegativeMarginBefore(); child->computeAndSetBlockDirectionMargins(this); LayoutUnit estimateWithoutPagination; LayoutUnit logicalTopEstimate = estimateLogicalTopPosition(child, marginInfo, estimateWithoutPagination); LayoutRect oldRect = child->frameRect(); LayoutUnit oldLogicalTop = logicalTopForChild(child); #if !ASSERT_DISABLED LayoutSize oldLayoutDelta = RuntimeEnabledFeatures::repaintAfterLayoutEnabled() ? LayoutSize() : view()->layoutDelta(); #endif setLogicalTopForChild(child, logicalTopEstimate, ApplyLayoutDelta); RenderBlock* childRenderBlock = child->isRenderBlock() ? toRenderBlock(child) : 0; RenderBlockFlow* childRenderBlockFlow = (childRenderBlock && child->isRenderBlockFlow()) ? toRenderBlockFlow(child) : 0; bool markDescendantsWithFloats = false; if (logicalTopEstimate != oldLogicalTop && !child->avoidsFloats() && childRenderBlock && childRenderBlock->containsFloats()) { markDescendantsWithFloats = true; } else if (UNLIKELY(logicalTopEstimate.mightBeSaturated())) { markDescendantsWithFloats = true; } else if (!child->avoidsFloats() || child->shrinkToAvoidFloats()) { LayoutUnit fb = max(previousFloatLogicalBottom, lowestFloatLogicalBottom()); if (fb > logicalTopEstimate) markDescendantsWithFloats = true; } if (childRenderBlockFlow) { if (markDescendantsWithFloats) childRenderBlockFlow->markAllDescendantsWithFloatsForLayout(); if (!child->isWritingModeRoot()) previousFloatLogicalBottom = max(previousFloatLogicalBottom, oldLogicalTop + childRenderBlockFlow->lowestFloatLogicalBottom()); } SubtreeLayoutScope layoutScope(*child); if (!child->needsLayout()) child->markForPaginationRelayoutIfNeeded(layoutScope); bool childHadLayout = child->everHadLayout(); bool childNeededLayout = child->needsLayout(); if (childNeededLayout) child->layout(); bool atBeforeSideOfBlock = marginInfo.atBeforeSideOfBlock(); bool childIsSelfCollapsing = child->isSelfCollapsingBlock(); LayoutUnit logicalTopBeforeClear = collapseMargins(child, marginInfo, childIsSelfCollapsing); LayoutUnit logicalTopAfterClear = clearFloatsIfNeeded(child, marginInfo, oldPosMarginBefore, oldNegMarginBefore, logicalTopBeforeClear, childIsSelfCollapsing); bool paginated = view()->layoutState()->isPaginated(); if (paginated) { logicalTopAfterClear = adjustBlockChildForPagination(logicalTopAfterClear, estimateWithoutPagination, child, atBeforeSideOfBlock && logicalTopBeforeClear == logicalTopAfterClear); } setLogicalTopForChild(child, logicalTopAfterClear, ApplyLayoutDelta); if (logicalTopAfterClear != logicalTopEstimate || child->needsLayout() || (paginated && childRenderBlock && childRenderBlock->shouldBreakAtLineToAvoidWidow())) { SubtreeLayoutScope layoutScope(*child); if (child->shrinkToAvoidFloats()) { layoutScope.setChildNeedsLayout(child); } if (childRenderBlock) { if (!child->avoidsFloats() && childRenderBlock->containsFloats()) childRenderBlockFlow->markAllDescendantsWithFloatsForLayout(); if (!child->needsLayout()) child->markForPaginationRelayoutIfNeeded(layoutScope); } child->layoutIfNeeded(); } if (!marginInfo.canCollapseMarginAfterWithLastChild() && !childIsSelfCollapsing) marginInfo.setCanCollapseMarginAfterWithLastChild(true); if (marginInfo.atBeforeSideOfBlock() && !childIsSelfCollapsing) marginInfo.setAtBeforeSideOfBlock(false); determineLogicalLeftPositionForChild(child, ApplyLayoutDelta); LayoutSize childOffset = child->location() - oldRect.location(); setLogicalHeight(logicalHeight() + logicalHeightForChild(child)); if (mustSeparateMarginAfterForChild(child)) { setLogicalHeight(logicalHeight() + marginAfterForChild(child)); marginInfo.clearMargin(); } if (childRenderBlockFlow) addOverhangingFloats(childRenderBlockFlow, !childNeededLayout); if (childOffset.width() || childOffset.height()) { if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) view()->addLayoutDelta(childOffset); if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && childHadLayout && !selfNeedsLayout()) child->repaintOverhangingFloats(true); else if (childHadLayout && !selfNeedsLayout() && child->checkForRepaintDuringLayout()) child->repaintDuringLayoutIfMoved(oldRect); } if (!childHadLayout && child->checkForRepaint()) { if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) child->repaint(); child->repaintOverhangingFloats(true); } if (paginated) { LayoutUnit newHeight = applyAfterBreak(child, logicalHeight(), marginInfo); if (newHeight != height()) setLogicalHeight(newHeight); } if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) { ASSERT(view()->layoutDeltaMatches(oldLayoutDelta)); } }
5,819
158,555
0
void WebLocalFrameImpl::LoadHTMLString(const WebData& data, const WebURL& base_url, const WebURL& unreachable_url, bool replace) { DCHECK(GetFrame()); CommitDataNavigation(data, WebString::FromUTF8("text/html"), WebString::FromUTF8("UTF-8"), base_url, unreachable_url, replace, WebFrameLoadType::kStandard, WebHistoryItem(), false, nullptr, nullptr, WebNavigationTimings()); }
5,820
177,432
0
long Segment::Load() { assert(m_clusters == NULL); assert(m_clusterSize == 0); assert(m_clusterCount == 0); const long long header_status = ParseHeaders(); if (header_status < 0) // error return static_cast<long>(header_status); if (header_status > 0) // underflow return E_BUFFER_NOT_FULL; if (m_pInfo == NULL || m_pTracks == NULL) return E_FILE_FORMAT_INVALID; for (;;) { const int status = LoadCluster(); if (status < 0) // error return status; if (status >= 1) // no more clusters return 0; } }
5,821
3,261
0
ref_array_param_requested(const iparam_list *iplist, gs_param_name pkey, ref *pvalue, uint size, client_name_t cname) { int code; if (!ref_param_requested((const gs_param_list *)iplist, pkey)) return 0; code = gs_alloc_ref_array(iplist->ref_memory, pvalue, a_all, size, cname); return (code < 0 ? code : 1); }
5,822
145,886
0
views::Label* GetLabelView(WindowSelectorItem* window) { return window->label_view_; }
5,823
127,732
0
void TestTransactionConsumer::DidRead(int result) { if (result <= 0) { DidFinish(result); } else { content_.append(read_buf_->data(), result); Read(); } }
5,824
108,579
0
PassRefPtr<SimpleFontData> FontCache::getSimilarFontPlatformData(const Font& font) { return 0; }
5,825
181,213
1
kdc_process_for_user(kdc_realm_t *kdc_active_realm, krb5_pa_data *pa_data, krb5_keyblock *tgs_session, krb5_pa_s4u_x509_user **s4u_x509_user, const char **status) { krb5_error_code code; krb5_pa_for_user *for_user; krb5_data req_data; req_data.length = pa_data->length; req_data.data = (char *)pa_data->contents; code = decode_krb5_pa_for_user(&req_data, &for_user); if (code) return code; code = verify_for_user_checksum(kdc_context, tgs_session, for_user); if (code) { *status = "INVALID_S4U2SELF_CHECKSUM"; krb5_free_pa_for_user(kdc_context, for_user); return code; } *s4u_x509_user = calloc(1, sizeof(krb5_pa_s4u_x509_user)); if (*s4u_x509_user == NULL) { krb5_free_pa_for_user(kdc_context, for_user); return ENOMEM; } (*s4u_x509_user)->user_id.user = for_user->user; for_user->user = NULL; krb5_free_pa_for_user(kdc_context, for_user); return 0; }
5,826
70,549
0
static int ext4_statfs_project(struct super_block *sb, kprojid_t projid, struct kstatfs *buf) { struct kqid qid; struct dquot *dquot; u64 limit; u64 curblock; qid = make_kqid_projid(projid); dquot = dqget(sb, qid); if (IS_ERR(dquot)) return PTR_ERR(dquot); spin_lock(&dq_data_lock); limit = (dquot->dq_dqb.dqb_bsoftlimit ? dquot->dq_dqb.dqb_bsoftlimit : dquot->dq_dqb.dqb_bhardlimit) >> sb->s_blocksize_bits; if (limit && buf->f_blocks > limit) { curblock = dquot->dq_dqb.dqb_curspace >> sb->s_blocksize_bits; buf->f_blocks = limit; buf->f_bfree = buf->f_bavail = (buf->f_blocks > curblock) ? (buf->f_blocks - curblock) : 0; } limit = dquot->dq_dqb.dqb_isoftlimit ? dquot->dq_dqb.dqb_isoftlimit : dquot->dq_dqb.dqb_ihardlimit; if (limit && buf->f_files > limit) { buf->f_files = limit; buf->f_ffree = (buf->f_files > dquot->dq_dqb.dqb_curinodes) ? (buf->f_files - dquot->dq_dqb.dqb_curinodes) : 0; } spin_unlock(&dq_data_lock); dqput(dquot); return 0; }
5,827
31,475
0
static int pfkey_xfrm_policy2msg_size(const struct xfrm_policy *xp) { const struct xfrm_tmpl *t; int sockaddr_size = pfkey_sockaddr_size(xp->family); int socklen = 0; int i; for (i=0; i<xp->xfrm_nr; i++) { t = xp->xfrm_vec + i; socklen += pfkey_sockaddr_len(t->encap_family); } return sizeof(struct sadb_msg) + (sizeof(struct sadb_lifetime) * 3) + (sizeof(struct sadb_address) * 2) + (sockaddr_size * 2) + sizeof(struct sadb_x_policy) + (xp->xfrm_nr * sizeof(struct sadb_x_ipsecrequest)) + (socklen * 2) + pfkey_xfrm_policy2sec_ctx_size(xp); }
5,828
87,429
0
static unsigned HuffmanTree_makeFromLengths2(HuffmanTree* tree) { uivector blcount; uivector nextcode; unsigned bits, n, error = 0; uivector_init(&blcount); uivector_init(&nextcode); tree->tree1d = (unsigned*)calloc(tree->numcodes, sizeof(unsigned)); if(!tree->tree1d) error = 83; /*alloc fail*/ if(!uivector_resizev(&blcount, tree->maxbitlen + 1, 0) || !uivector_resizev(&nextcode, tree->maxbitlen + 1, 0)) error = 83; /*alloc fail*/ if(!error) { /*step 1: count number of instances of each code length*/ for(bits = 0; bits < tree->numcodes; bits++) blcount.data[tree->lengths[bits]]++; /*step 2: generate the nextcode values*/ for(bits = 1; bits <= tree->maxbitlen; bits++) { nextcode.data[bits] = (nextcode.data[bits - 1] + blcount.data[bits - 1]) << 1; } /*step 3: generate all the codes*/ for(n = 0; n < tree->numcodes; n++) { if(tree->lengths[n] != 0) tree->tree1d[n] = nextcode.data[tree->lengths[n]]++; } } uivector_cleanup(&blcount); uivector_cleanup(&nextcode); if(!error) return HuffmanTree_make2DTree(tree); else return error; }
5,829
149,386
0
void CheckClientDownloadRequest::SetDownloadPingToken( const std::string& token) { DCHECK(!token.empty()); DownloadProtectionService::SetDownloadPingToken(item_, token); }
5,830
89,902
0
check_fast(krb5_context context, struct fast_state *state) { if (state->flags & KRB5_FAST_EXPECTED) { krb5_set_error_message(context, KRB5KRB_AP_ERR_MODIFIED, "Expected FAST, but no FAST " "was in the response from the KDC"); return KRB5KRB_AP_ERR_MODIFIED; } return 0; }
5,831
45,812
0
int lrw_init_table(struct lrw_table_ctx *ctx, const u8 *tweak) { be128 tmp = { 0 }; int i; if (ctx->table) gf128mul_free_64k(ctx->table); /* initialize multiplication table for Key2 */ ctx->table = gf128mul_init_64k_bbe((be128 *)tweak); if (!ctx->table) return -ENOMEM; /* initialize optimization table */ for (i = 0; i < 128; i++) { setbit128_bbe(&tmp, i); ctx->mulinc[i] = tmp; gf128mul_64k_bbe(&ctx->mulinc[i], ctx->table); } return 0; }
5,832
16,494
0
fill_attributes() { /* There are a few attributes that specify what platform we're on that we want to insert values for even if they're not defined in the config sources. These are ARCH and OPSYS, which we compute with the sysapi_condor_arch() and sysapi_opsys() functions. We also insert the subsystem here. Moved all the domain stuff to check_domain_attributes() on 10/20. Also, since this is called before we read in any config sources, there's no reason to check to see if any of these are already defined. -Derek Wright Amended -Pete Keller 06/01/99 */ const char *tmp; MyString val; if( (tmp = sysapi_condor_arch()) != NULL ) { insert( "ARCH", tmp, ConfigTab, TABLESIZE ); extra_info->AddInternalParam("ARCH"); } if( (tmp = sysapi_uname_arch()) != NULL ) { insert( "UNAME_ARCH", tmp, ConfigTab, TABLESIZE ); extra_info->AddInternalParam("UNAME_ARCH"); } if( (tmp = sysapi_opsys()) != NULL ) { insert( "OPSYS", tmp, ConfigTab, TABLESIZE ); extra_info->AddInternalParam("OPSYS"); int ver = sysapi_opsys_version(); if (ver > 0) { val.sprintf("%d", ver); insert( "OPSYSVER", val.Value(), ConfigTab, TABLESIZE ); extra_info->AddInternalParam("OPSYSVER"); } } if( (tmp = sysapi_opsys_versioned()) != NULL ) { insert( "OPSYS_AND_VER", tmp, ConfigTab, TABLESIZE ); extra_info->AddInternalParam("OPSYS_AND_VER"); } if( (tmp = sysapi_uname_opsys()) != NULL ) { insert( "UNAME_OPSYS", tmp, ConfigTab, TABLESIZE ); extra_info->AddInternalParam("UNAME_OPSYS"); } insert( "SUBSYSTEM", get_mySubSystem()->getName(), ConfigTab, TABLESIZE ); extra_info->AddInternalParam("SUBSYSTEM"); val.sprintf("%d",sysapi_phys_memory_raw_no_param()); insert( "DETECTED_MEMORY", val.Value(), ConfigTab, TABLESIZE ); extra_info->AddInternalParam("DETECTED_MEMORY"); int num_cpus=0; int num_hyperthread_cpus=0; sysapi_ncpus_raw_no_param(&num_cpus,&num_hyperthread_cpus); val.sprintf("%d",num_hyperthread_cpus); insert( "DETECTED_CORES", val.Value(), ConfigTab, TABLESIZE ); extra_info->AddInternalParam("DETECTED_CORES"); }
5,833
9,390
0
int ssl3_accept(SSL *s) { BUF_MEM *buf; unsigned long alg_k, Time = (unsigned long)time(NULL); void (*cb) (const SSL *ssl, int type, int val) = NULL; int ret = -1; int new_state, state, skip = 0; RAND_add(&Time, sizeof(Time), 0); ERR_clear_error(); clear_sys_error(); if (s->info_callback != NULL) cb = s->info_callback; else if (s->ctx->info_callback != NULL) cb = s->ctx->info_callback; /* init things to blank */ s->in_handshake++; if (!SSL_in_init(s) || SSL_in_before(s)) SSL_clear(s); if (s->cert == NULL) { SSLerr(SSL_F_SSL3_ACCEPT, SSL_R_NO_CERTIFICATE_SET); return (-1); } #ifndef OPENSSL_NO_HEARTBEATS /* * If we're awaiting a HeartbeatResponse, pretend we already got and * don't await it anymore, because Heartbeats don't make sense during * handshakes anyway. */ if (s->tlsext_hb_pending) { s->tlsext_hb_pending = 0; s->tlsext_hb_seq++; } #endif for (;;) { state = s->state; switch (s->state) { case SSL_ST_RENEGOTIATE: s->renegotiate = 1; /* s->state=SSL_ST_ACCEPT; */ case SSL_ST_BEFORE: case SSL_ST_ACCEPT: case SSL_ST_BEFORE | SSL_ST_ACCEPT: case SSL_ST_OK | SSL_ST_ACCEPT: s->server = 1; if (cb != NULL) cb(s, SSL_CB_HANDSHAKE_START, 1); if ((s->version >> 8) != 3) { SSLerr(SSL_F_SSL3_ACCEPT, ERR_R_INTERNAL_ERROR); s->state = SSL_ST_ERR; return -1; } s->type = SSL_ST_ACCEPT; if (s->init_buf == NULL) { if ((buf = BUF_MEM_new()) == NULL) { ret = -1; s->state = SSL_ST_ERR; goto end; } if (!BUF_MEM_grow(buf, SSL3_RT_MAX_PLAIN_LENGTH)) { BUF_MEM_free(buf); ret = -1; s->state = SSL_ST_ERR; goto end; } s->init_buf = buf; } if (!ssl3_setup_buffers(s)) { ret = -1; s->state = SSL_ST_ERR; goto end; } s->init_num = 0; s->s3->flags &= ~SSL3_FLAGS_SGC_RESTART_DONE; s->s3->flags &= ~SSL3_FLAGS_CCS_OK; /* * Should have been reset by ssl3_get_finished, too. */ s->s3->change_cipher_spec = 0; if (s->state != SSL_ST_RENEGOTIATE) { /* * Ok, we now need to push on a buffering BIO so that the * output is sent in a way that TCP likes :-) */ if (!ssl_init_wbio_buffer(s, 1)) { ret = -1; s->state = SSL_ST_ERR; goto end; } ssl3_init_finished_mac(s); s->state = SSL3_ST_SR_CLNT_HELLO_A; s->ctx->stats.sess_accept++; } else if (!s->s3->send_connection_binding && !(s->options & SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION)) { /* * Server attempting to renegotiate with client that doesn't * support secure renegotiation. */ SSLerr(SSL_F_SSL3_ACCEPT, SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED); ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE); ret = -1; s->state = SSL_ST_ERR; goto end; } else { /* * s->state == SSL_ST_RENEGOTIATE, we will just send a * HelloRequest */ s->ctx->stats.sess_accept_renegotiate++; s->state = SSL3_ST_SW_HELLO_REQ_A; } break; case SSL3_ST_SW_HELLO_REQ_A: case SSL3_ST_SW_HELLO_REQ_B: s->shutdown = 0; ret = ssl3_send_hello_request(s); if (ret <= 0) goto end; s->s3->tmp.next_state = SSL3_ST_SW_HELLO_REQ_C; s->state = SSL3_ST_SW_FLUSH; s->init_num = 0; ssl3_init_finished_mac(s); break; case SSL3_ST_SW_HELLO_REQ_C: s->state = SSL_ST_OK; break; case SSL3_ST_SR_CLNT_HELLO_A: case SSL3_ST_SR_CLNT_HELLO_B: case SSL3_ST_SR_CLNT_HELLO_C: s->shutdown = 0; if (s->rwstate != SSL_X509_LOOKUP) { ret = ssl3_get_client_hello(s); if (ret <= 0) goto end; } #ifndef OPENSSL_NO_SRP { int al; if ((ret = ssl_check_srp_ext_ClientHello(s, &al)) < 0) { /* * callback indicates firther work to be done */ s->rwstate = SSL_X509_LOOKUP; goto end; } if (ret != SSL_ERROR_NONE) { ssl3_send_alert(s, SSL3_AL_FATAL, al); /* * This is not really an error but the only means to for * a client to detect whether srp is supported. */ if (al != TLS1_AD_UNKNOWN_PSK_IDENTITY) SSLerr(SSL_F_SSL3_ACCEPT, SSL_R_CLIENTHELLO_TLSEXT); ret = -1; s->state = SSL_ST_ERR; goto end; } } #endif s->renegotiate = 2; s->state = SSL3_ST_SW_SRVR_HELLO_A; s->init_num = 0; break; case SSL3_ST_SW_SRVR_HELLO_A: case SSL3_ST_SW_SRVR_HELLO_B: ret = ssl3_send_server_hello(s); if (ret <= 0) goto end; #ifndef OPENSSL_NO_TLSEXT if (s->hit) { if (s->tlsext_ticket_expected) s->state = SSL3_ST_SW_SESSION_TICKET_A; else s->state = SSL3_ST_SW_CHANGE_A; } #else if (s->hit) s->state = SSL3_ST_SW_CHANGE_A; #endif else s->state = SSL3_ST_SW_CERT_A; s->init_num = 0; break; case SSL3_ST_SW_CERT_A: case SSL3_ST_SW_CERT_B: /* Check if it is anon DH or anon ECDH, */ /* normal PSK or KRB5 or SRP */ if (! (s->s3->tmp. new_cipher->algorithm_auth & (SSL_aNULL | SSL_aKRB5 | SSL_aSRP)) && !(s->s3->tmp.new_cipher->algorithm_mkey & SSL_kPSK)) { ret = ssl3_send_server_certificate(s); if (ret <= 0) goto end; #ifndef OPENSSL_NO_TLSEXT if (s->tlsext_status_expected) s->state = SSL3_ST_SW_CERT_STATUS_A; else s->state = SSL3_ST_SW_KEY_EXCH_A; } else { skip = 1; s->state = SSL3_ST_SW_KEY_EXCH_A; } #else } else skip = 1; s->state = SSL3_ST_SW_KEY_EXCH_A; #endif s->init_num = 0; break; case SSL3_ST_SW_KEY_EXCH_A: case SSL3_ST_SW_KEY_EXCH_B: alg_k = s->s3->tmp.new_cipher->algorithm_mkey; /* * clear this, it may get reset by * send_server_key_exchange */ s->s3->tmp.use_rsa_tmp = 0; /* * only send if a DH key exchange, fortezza or RSA but we have a * sign only certificate PSK: may send PSK identity hints For * ECC ciphersuites, we send a serverKeyExchange message only if * the cipher suite is either ECDH-anon or ECDHE. In other cases, * the server certificate contains the server's public key for * key exchange. */ if (0 /* * PSK: send ServerKeyExchange if PSK identity hint if * provided */ #ifndef OPENSSL_NO_PSK || ((alg_k & SSL_kPSK) && s->ctx->psk_identity_hint) #endif #ifndef OPENSSL_NO_SRP /* SRP: send ServerKeyExchange */ || (alg_k & SSL_kSRP) #endif || (alg_k & (SSL_kDHr | SSL_kDHd | SSL_kEDH)) || (alg_k & SSL_kEECDH) || ((alg_k & SSL_kRSA) && (s->cert->pkeys[SSL_PKEY_RSA_ENC].privatekey == NULL || (SSL_C_IS_EXPORT(s->s3->tmp.new_cipher) && EVP_PKEY_size(s->cert->pkeys [SSL_PKEY_RSA_ENC].privatekey) * 8 > SSL_C_EXPORT_PKEYLENGTH(s->s3->tmp.new_cipher) ) ) ) ) { ret = ssl3_send_server_key_exchange(s); if (ret <= 0) goto end; } else skip = 1; s->state = SSL3_ST_SW_CERT_REQ_A; s->init_num = 0; break; case SSL3_ST_SW_CERT_REQ_A: case SSL3_ST_SW_CERT_REQ_B: if ( /* don't request cert unless asked for it: */ !(s->verify_mode & SSL_VERIFY_PEER) || /* * if SSL_VERIFY_CLIENT_ONCE is set, don't request cert * during re-negotiation: */ ((s->session->peer != NULL) && (s->verify_mode & SSL_VERIFY_CLIENT_ONCE)) || /* * never request cert in anonymous ciphersuites (see * section "Certificate request" in SSL 3 drafts and in * RFC 2246): */ ((s->s3->tmp.new_cipher->algorithm_auth & SSL_aNULL) && /* * ... except when the application insists on * verification (against the specs, but s3_clnt.c accepts * this for SSL 3) */ !(s->verify_mode & SSL_VERIFY_FAIL_IF_NO_PEER_CERT)) || /* * never request cert in Kerberos ciphersuites */ (s->s3->tmp.new_cipher->algorithm_auth & SSL_aKRB5) || /* don't request certificate for SRP auth */ (s->s3->tmp.new_cipher->algorithm_auth & SSL_aSRP) /* * With normal PSK Certificates and Certificate Requests * are omitted */ || (s->s3->tmp.new_cipher->algorithm_mkey & SSL_kPSK)) { /* no cert request */ skip = 1; s->s3->tmp.cert_request = 0; s->state = SSL3_ST_SW_SRVR_DONE_A; if (s->s3->handshake_buffer) { if (!ssl3_digest_cached_records(s)) { s->state = SSL_ST_ERR; return -1; } } } else { s->s3->tmp.cert_request = 1; ret = ssl3_send_certificate_request(s); if (ret <= 0) goto end; #ifndef NETSCAPE_HANG_BUG s->state = SSL3_ST_SW_SRVR_DONE_A; #else s->state = SSL3_ST_SW_FLUSH; s->s3->tmp.next_state = SSL3_ST_SR_CERT_A; #endif s->init_num = 0; } break; case SSL3_ST_SW_SRVR_DONE_A: case SSL3_ST_SW_SRVR_DONE_B: ret = ssl3_send_server_done(s); if (ret <= 0) goto end; s->s3->tmp.next_state = SSL3_ST_SR_CERT_A; s->state = SSL3_ST_SW_FLUSH; s->init_num = 0; break; case SSL3_ST_SW_FLUSH: /* * This code originally checked to see if any data was pending * using BIO_CTRL_INFO and then flushed. This caused problems as * documented in PR#1939. The proposed fix doesn't completely * resolve this issue as buggy implementations of * BIO_CTRL_PENDING still exist. So instead we just flush * unconditionally. */ s->rwstate = SSL_WRITING; if (BIO_flush(s->wbio) <= 0) { ret = -1; goto end; } s->rwstate = SSL_NOTHING; s->state = s->s3->tmp.next_state; break; case SSL3_ST_SR_CERT_A: case SSL3_ST_SR_CERT_B: /* Check for second client hello (MS SGC) */ ret = ssl3_check_client_hello(s); if (ret <= 0) goto end; if (ret == 2) s->state = SSL3_ST_SR_CLNT_HELLO_C; else { if (s->s3->tmp.cert_request) { ret = ssl3_get_client_certificate(s); if (ret <= 0) goto end; } s->init_num = 0; s->state = SSL3_ST_SR_KEY_EXCH_A; } break; case SSL3_ST_SR_KEY_EXCH_A: case SSL3_ST_SR_KEY_EXCH_B: ret = ssl3_get_client_key_exchange(s); if (ret <= 0) goto end; if (ret == 2) { /* * For the ECDH ciphersuites when the client sends its ECDH * pub key in a certificate, the CertificateVerify message is * not sent. Also for GOST ciphersuites when the client uses * its key from the certificate for key exchange. */ #if defined(OPENSSL_NO_TLSEXT) || defined(OPENSSL_NO_NEXTPROTONEG) s->state = SSL3_ST_SR_FINISHED_A; #else if (s->s3->next_proto_neg_seen) s->state = SSL3_ST_SR_NEXT_PROTO_A; else s->state = SSL3_ST_SR_FINISHED_A; #endif s->init_num = 0; } else if (TLS1_get_version(s) >= TLS1_2_VERSION) { s->state = SSL3_ST_SR_CERT_VRFY_A; s->init_num = 0; if (!s->session->peer) break; /* * For TLS v1.2 freeze the handshake buffer at this point and * digest cached records. */ if (!s->s3->handshake_buffer) { SSLerr(SSL_F_SSL3_ACCEPT, ERR_R_INTERNAL_ERROR); s->state = SSL_ST_ERR; return -1; } s->s3->flags |= TLS1_FLAGS_KEEP_HANDSHAKE; if (!ssl3_digest_cached_records(s)) { s->state = SSL_ST_ERR; return -1; } } else { int offset = 0; int dgst_num; s->state = SSL3_ST_SR_CERT_VRFY_A; s->init_num = 0; /* * We need to get hashes here so if there is a client cert, * it can be verified FIXME - digest processing for * CertificateVerify should be generalized. But it is next * step */ if (s->s3->handshake_buffer) { if (!ssl3_digest_cached_records(s)) { s->state = SSL_ST_ERR; return -1; } } for (dgst_num = 0; dgst_num < SSL_MAX_DIGEST; dgst_num++) if (s->s3->handshake_dgst[dgst_num]) { int dgst_size; s->method->ssl3_enc->cert_verify_mac(s, EVP_MD_CTX_type (s-> s3->handshake_dgst [dgst_num]), &(s->s3-> tmp.cert_verify_md [offset])); dgst_size = EVP_MD_CTX_size(s->s3->handshake_dgst[dgst_num]); if (dgst_size < 0) { s->state = SSL_ST_ERR; ret = -1; goto end; } offset += dgst_size; } } break; case SSL3_ST_SR_CERT_VRFY_A: case SSL3_ST_SR_CERT_VRFY_B: ret = ssl3_get_cert_verify(s); if (ret <= 0) goto end; #if defined(OPENSSL_NO_TLSEXT) || defined(OPENSSL_NO_NEXTPROTONEG) s->state = SSL3_ST_SR_FINISHED_A; #else if (s->s3->next_proto_neg_seen) s->state = SSL3_ST_SR_NEXT_PROTO_A; else s->state = SSL3_ST_SR_FINISHED_A; #endif s->init_num = 0; break; #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) case SSL3_ST_SR_NEXT_PROTO_A: case SSL3_ST_SR_NEXT_PROTO_B: /* * Enable CCS for NPN. Receiving a CCS clears the flag, so make * sure not to re-enable it to ban duplicates. This *should* be the * first time we have received one - but we check anyway to be * cautious. * s->s3->change_cipher_spec is set when a CCS is * processed in s3_pkt.c, and remains set until * the client's Finished message is read. */ if (!s->s3->change_cipher_spec) s->s3->flags |= SSL3_FLAGS_CCS_OK; ret = ssl3_get_next_proto(s); if (ret <= 0) goto end; s->init_num = 0; s->state = SSL3_ST_SR_FINISHED_A; break; #endif case SSL3_ST_SR_FINISHED_A: case SSL3_ST_SR_FINISHED_B: /* * Enable CCS for handshakes without NPN. In NPN the CCS flag has * already been set. Receiving a CCS clears the flag, so make * sure not to re-enable it to ban duplicates. * s->s3->change_cipher_spec is set when a CCS is * processed in s3_pkt.c, and remains set until * the client's Finished message is read. */ if (!s->s3->change_cipher_spec) s->s3->flags |= SSL3_FLAGS_CCS_OK; ret = ssl3_get_finished(s, SSL3_ST_SR_FINISHED_A, SSL3_ST_SR_FINISHED_B); if (ret <= 0) goto end; if (s->hit) s->state = SSL_ST_OK; #ifndef OPENSSL_NO_TLSEXT else if (s->tlsext_ticket_expected) s->state = SSL3_ST_SW_SESSION_TICKET_A; #endif else s->state = SSL3_ST_SW_CHANGE_A; s->init_num = 0; break; #ifndef OPENSSL_NO_TLSEXT case SSL3_ST_SW_SESSION_TICKET_A: case SSL3_ST_SW_SESSION_TICKET_B: ret = ssl3_send_newsession_ticket(s); if (ret <= 0) goto end; s->state = SSL3_ST_SW_CHANGE_A; s->init_num = 0; break; case SSL3_ST_SW_CERT_STATUS_A: case SSL3_ST_SW_CERT_STATUS_B: ret = ssl3_send_cert_status(s); if (ret <= 0) goto end; s->state = SSL3_ST_SW_KEY_EXCH_A; s->init_num = 0; break; #endif case SSL3_ST_SW_CHANGE_A: case SSL3_ST_SW_CHANGE_B: s->session->cipher = s->s3->tmp.new_cipher; if (!s->method->ssl3_enc->setup_key_block(s)) { ret = -1; s->state = SSL_ST_ERR; goto end; } ret = ssl3_send_change_cipher_spec(s, SSL3_ST_SW_CHANGE_A, SSL3_ST_SW_CHANGE_B); if (ret <= 0) goto end; s->state = SSL3_ST_SW_FINISHED_A; s->init_num = 0; if (!s->method->ssl3_enc->change_cipher_state(s, SSL3_CHANGE_CIPHER_SERVER_WRITE)) { ret = -1; s->state = SSL_ST_ERR; goto end; } break; case SSL3_ST_SW_FINISHED_A: case SSL3_ST_SW_FINISHED_B: ret = ssl3_send_finished(s, SSL3_ST_SW_FINISHED_A, SSL3_ST_SW_FINISHED_B, s->method-> ssl3_enc->server_finished_label, s->method-> ssl3_enc->server_finished_label_len); if (ret <= 0) goto end; s->state = SSL3_ST_SW_FLUSH; if (s->hit) { #if defined(OPENSSL_NO_TLSEXT) || defined(OPENSSL_NO_NEXTPROTONEG) s->s3->tmp.next_state = SSL3_ST_SR_FINISHED_A; #else if (s->s3->next_proto_neg_seen) { s->s3->tmp.next_state = SSL3_ST_SR_NEXT_PROTO_A; } else s->s3->tmp.next_state = SSL3_ST_SR_FINISHED_A; #endif } else s->s3->tmp.next_state = SSL_ST_OK; s->init_num = 0; break; case SSL_ST_OK: /* clean a few things up */ ssl3_cleanup_key_block(s); BUF_MEM_free(s->init_buf); s->init_buf = NULL; /* remove buffering on output */ ssl_free_wbio_buffer(s); s->init_num = 0; if (s->renegotiate == 2) { /* skipped if we just sent a * HelloRequest */ s->renegotiate = 0; s->new_session = 0; ssl_update_cache(s, SSL_SESS_CACHE_SERVER); s->ctx->stats.sess_accept_good++; /* s->server=1; */ s->handshake_func = ssl3_accept; if (cb != NULL) cb(s, SSL_CB_HANDSHAKE_DONE, 1); } ret = 1; goto end; /* break; */ case SSL_ST_ERR: default: SSLerr(SSL_F_SSL3_ACCEPT, SSL_R_UNKNOWN_STATE); ret = -1; goto end; /* break; */ } if (!s->s3->tmp.reuse_message && !skip) { if (s->debug) { if ((ret = BIO_flush(s->wbio)) <= 0) goto end; } if ((cb != NULL) && (s->state != state)) { new_state = s->state; s->state = state; cb(s, SSL_CB_ACCEPT_LOOP, 1); s->state = new_state; } } skip = 0; }
5,834
156,006
0
FinishCompleteLoginParams::~FinishCompleteLoginParams() {}
5,835
27,668
0
static int compat_match_to_user(struct ebt_entry_match *m, void __user **dstptr, unsigned int *size) { const struct xt_match *match = m->u.match; struct compat_ebt_entry_mwt __user *cm = *dstptr; int off = ebt_compat_match_offset(match, m->match_size); compat_uint_t msize = m->match_size - off; BUG_ON(off >= m->match_size); if (copy_to_user(cm->u.name, match->name, strlen(match->name) + 1) || put_user(msize, &cm->match_size)) return -EFAULT; if (match->compat_to_user) { if (match->compat_to_user(cm->data, m->data)) return -EFAULT; } else if (copy_to_user(cm->data, m->data, msize)) return -EFAULT; *size -= ebt_compat_entry_padsize() + off; *dstptr = cm->data; *dstptr += msize; return 0; }
5,836
51,240
0
static ssize_t hiddev_read(struct file * file, char __user * buffer, size_t count, loff_t *ppos) { DEFINE_WAIT(wait); struct hiddev_list *list = file->private_data; int event_size; int retval; event_size = ((list->flags & HIDDEV_FLAG_UREF) != 0) ? sizeof(struct hiddev_usage_ref) : sizeof(struct hiddev_event); if (count < event_size) return 0; /* lock against other threads */ retval = mutex_lock_interruptible(&list->thread_lock); if (retval) return -ERESTARTSYS; while (retval == 0) { if (list->head == list->tail) { prepare_to_wait(&list->hiddev->wait, &wait, TASK_INTERRUPTIBLE); while (list->head == list->tail) { if (signal_pending(current)) { retval = -ERESTARTSYS; break; } if (!list->hiddev->exist) { retval = -EIO; break; } if (file->f_flags & O_NONBLOCK) { retval = -EAGAIN; break; } /* let O_NONBLOCK tasks run */ mutex_unlock(&list->thread_lock); schedule(); if (mutex_lock_interruptible(&list->thread_lock)) { finish_wait(&list->hiddev->wait, &wait); return -EINTR; } set_current_state(TASK_INTERRUPTIBLE); } finish_wait(&list->hiddev->wait, &wait); } if (retval) { mutex_unlock(&list->thread_lock); return retval; } while (list->head != list->tail && retval + event_size <= count) { if ((list->flags & HIDDEV_FLAG_UREF) == 0) { if (list->buffer[list->tail].field_index != HID_FIELD_INDEX_NONE) { struct hiddev_event event; event.hid = list->buffer[list->tail].usage_code; event.value = list->buffer[list->tail].value; if (copy_to_user(buffer + retval, &event, sizeof(struct hiddev_event))) { mutex_unlock(&list->thread_lock); return -EFAULT; } retval += sizeof(struct hiddev_event); } } else { if (list->buffer[list->tail].field_index != HID_FIELD_INDEX_NONE || (list->flags & HIDDEV_FLAG_REPORT) != 0) { if (copy_to_user(buffer + retval, list->buffer + list->tail, sizeof(struct hiddev_usage_ref))) { mutex_unlock(&list->thread_lock); return -EFAULT; } retval += sizeof(struct hiddev_usage_ref); } } list->tail = (list->tail + 1) & (HIDDEV_BUFFER_SIZE - 1); } } mutex_unlock(&list->thread_lock); return retval; }
5,837
140,846
0
void GLES2DecoderImpl::OnOutOfMemoryError() { if (lose_context_when_out_of_memory_) { group_->LoseContexts(GL_UNKNOWN_CONTEXT_RESET_ARB); } }
5,838
160,005
0
CacheThread() : base::Thread("CacheThread_BlockFile") { CHECK( StartWithOptions(base::Thread::Options(base::MessageLoop::TYPE_IO, 0))); }
5,839
43,897
0
archive_write_disk_set_skip_file(struct archive *_a, int64_t d, int64_t i) { struct archive_write_disk *a = (struct archive_write_disk *)_a; archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, ARCHIVE_STATE_ANY, "archive_write_disk_set_skip_file"); a->skip_file_set = 1; a->skip_file_dev = d; a->skip_file_ino = i; return (ARCHIVE_OK); }
5,840
161,757
0
void PlatformSensorAndroid::StopSensor() { JNIEnv* env = AttachCurrentThread(); Java_PlatformSensor_stopSensor(env, j_object_); }
5,841
2,290
0
struct ldb_dn *ldb_dn_new(TALLOC_CTX *mem_ctx, struct ldb_context *ldb, const char *strdn) { struct ldb_val blob; blob.data = discard_const_p(uint8_t, strdn); blob.length = strdn ? strlen(strdn) : 0; return ldb_dn_from_ldb_val(mem_ctx, ldb, &blob); }
5,842
112,189
0
DictionaryValue* SessionHeaderToValue( const sync_pb::SessionHeader& proto) { DictionaryValue* value = new DictionaryValue(); SET_REP(window, SessionWindowToValue); SET_STR(client_name); SET_ENUM(device_type, GetDeviceTypeString); return value; }
5,843
36,418
0
static void pppol2tp_seq_stop(struct seq_file *p, void *v) { /* nothing to do */ }
5,844
140,551
0
int SpdyProxyClientSocket::GetPeerAddress(IPEndPoint* address) const { if (!IsConnected()) return ERR_SOCKET_NOT_CONNECTED; return spdy_stream_->GetPeerAddress(address); }
5,845
99,486
0
static bool NPN_GetProperty(NPP, NPObject* npObject, NPIdentifier propertyName, NPVariant* result) { if (npObject->_class->hasProperty && npObject->_class->getProperty) { if (npObject->_class->hasProperty(npObject, propertyName)) return npObject->_class->getProperty(npObject, propertyName, result); } VOID_TO_NPVARIANT(*result); return false; }
5,846
51,716
0
sic10_opaque_literal_attr(tvbuff_t *tvb, guint32 offset, const char *token, guint8 codepage _U_, guint32 *length) { guint32 data_len = tvb_get_guintvar(tvb, offset, length); char *str = NULL; if ( token && ( (strcmp(token, "created") == 0) || (strcmp(token, "si-expires") == 0) ) ) { str = date_time_from_opaque(tvb, offset + *length, data_len); } if (str == NULL) { /* Error, or not parsed */ str = wmem_strdup_printf(wmem_packet_scope(), "(%d bytes of unparsed opaque data)", data_len); } *length += data_len; return str; }
5,847
157,161
0
bool UrlData::ValidateDataOrigin(const GURL& origin) { if (!have_data_origin_) { data_origin_ = origin; have_data_origin_ = true; return true; } if (cors_mode_ == UrlData::CORS_UNSPECIFIED) { return data_origin_ == origin; } return true; }
5,848
163,416
0
void RenderThreadImpl::UpdateScrollbarTheme( mojom::UpdateScrollbarThemeParamsPtr params) { #if defined(OS_MACOSX) static_cast<WebScrollbarBehaviorImpl*>( blink_platform_impl_->ScrollbarBehavior()) ->set_jump_on_track_click(params->jump_on_track_click); blink::WebScrollbarTheme::UpdateScrollbarsWithNSDefaults( params->initial_button_delay, params->autoscroll_button_delay, params->preferred_scroller_style, params->redraw, params->button_placement); is_elastic_overscroll_enabled_ = params->scroll_view_rubber_banding; #else NOTREACHED(); #endif }
5,849
31,514
0
PHP_FUNCTION(radius_demangle) { radius_descriptor *raddesc; zval *z_radh; const void *mangled; unsigned char *buf; int len, res; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_radh, &mangled, &len) == FAILURE) { return; } ZEND_FETCH_RESOURCE(raddesc, radius_descriptor *, &z_radh, -1, "rad_handle", le_radius); buf = emalloc(len); res = rad_demangle(raddesc->radh, mangled, len, buf); if (res == -1) { efree(buf); RETURN_FALSE; } else { RETVAL_STRINGL((char *) buf, len, 1); efree(buf); return; } }
5,850
7,016
0
Bezier_Up( RAS_ARGS Int degree, TSplitter splitter, Long miny, Long maxy ) { Long y1, y2, e, e2, e0; Short f1; TPoint* arc; TPoint* start_arc; PLong top; arc = ras.arc; y1 = arc[degree].y; y2 = arc[0].y; top = ras.top; if ( y2 < miny || y1 > maxy ) goto Fin; e2 = FLOOR( y2 ); if ( e2 > maxy ) e2 = maxy; e0 = miny; if ( y1 < miny ) e = miny; else { e = CEILING( y1 ); f1 = (Short)( FRAC( y1 ) ); e0 = e; if ( f1 == 0 ) { if ( ras.joint ) { top--; ras.joint = FALSE; } *top++ = arc[degree].x; e += ras.precision; } } if ( ras.fresh ) { ras.cProfile->start = TRUNC( e0 ); ras.fresh = FALSE; } if ( e2 < e ) goto Fin; if ( ( top + TRUNC( e2 - e ) + 1 ) >= ras.maxBuff ) { ras.top = top; ras.error = FT_THROW( Overflow ); return FAILURE; } start_arc = arc; while ( arc >= start_arc && e <= e2 ) { ras.joint = FALSE; y2 = arc[0].y; if ( y2 > e ) { y1 = arc[degree].y; if ( y2 - y1 >= ras.precision_step ) { splitter( arc ); arc += degree; } else { *top++ = arc[degree].x + FMulDiv( arc[0].x - arc[degree].x, e - y1, y2 - y1 ); arc -= degree; e += ras.precision; } } else { if ( y2 == e ) { ras.joint = TRUE; *top++ = arc[0].x; e += ras.precision; } arc -= degree; } } Fin: ras.top = top; ras.arc -= degree; return SUCCESS; }
5,851
30,798
0
static int ax25_listen(struct socket *sock, int backlog) { struct sock *sk = sock->sk; int res = 0; lock_sock(sk); if (sk->sk_type == SOCK_SEQPACKET && sk->sk_state != TCP_LISTEN) { sk->sk_max_ack_backlog = backlog; sk->sk_state = TCP_LISTEN; goto out; } res = -EOPNOTSUPP; out: release_sock(sk); return res; }
5,852
35,893
0
struct sctp_association *sctp_unpack_cookie( const struct sctp_endpoint *ep, const struct sctp_association *asoc, struct sctp_chunk *chunk, gfp_t gfp, int *error, struct sctp_chunk **errp) { struct sctp_association *retval = NULL; struct sctp_signed_cookie *cookie; struct sctp_cookie *bear_cookie; int headersize, bodysize, fixed_size; __u8 *digest = ep->digest; struct scatterlist sg; unsigned int len; sctp_scope_t scope; struct sk_buff *skb = chunk->skb; ktime_t kt; struct hash_desc desc; /* Header size is static data prior to the actual cookie, including * any padding. */ headersize = sizeof(sctp_chunkhdr_t) + (sizeof(struct sctp_signed_cookie) - sizeof(struct sctp_cookie)); bodysize = ntohs(chunk->chunk_hdr->length) - headersize; fixed_size = headersize + sizeof(struct sctp_cookie); /* Verify that the chunk looks like it even has a cookie. * There must be enough room for our cookie and our peer's * INIT chunk. */ len = ntohs(chunk->chunk_hdr->length); if (len < fixed_size + sizeof(struct sctp_chunkhdr)) goto malformed; /* Verify that the cookie has been padded out. */ if (bodysize % SCTP_COOKIE_MULTIPLE) goto malformed; /* Process the cookie. */ cookie = chunk->subh.cookie_hdr; bear_cookie = &cookie->c; if (!sctp_sk(ep->base.sk)->hmac) goto no_hmac; /* Check the signature. */ sg_init_one(&sg, bear_cookie, bodysize); desc.tfm = sctp_sk(ep->base.sk)->hmac; desc.flags = 0; memset(digest, 0x00, SCTP_SIGNATURE_SIZE); if (crypto_hash_setkey(desc.tfm, ep->secret_key, sizeof(ep->secret_key)) || crypto_hash_digest(&desc, &sg, bodysize, digest)) { *error = -SCTP_IERROR_NOMEM; goto fail; } if (memcmp(digest, cookie->signature, SCTP_SIGNATURE_SIZE)) { *error = -SCTP_IERROR_BAD_SIG; goto fail; } no_hmac: /* IG Section 2.35.2: * 3) Compare the port numbers and the verification tag contained * within the COOKIE ECHO chunk to the actual port numbers and the * verification tag within the SCTP common header of the received * packet. If these values do not match the packet MUST be silently * discarded, */ if (ntohl(chunk->sctp_hdr->vtag) != bear_cookie->my_vtag) { *error = -SCTP_IERROR_BAD_TAG; goto fail; } if (chunk->sctp_hdr->source != bear_cookie->peer_addr.v4.sin_port || ntohs(chunk->sctp_hdr->dest) != bear_cookie->my_port) { *error = -SCTP_IERROR_BAD_PORTS; goto fail; } /* Check to see if the cookie is stale. If there is already * an association, there is no need to check cookie's expiration * for init collision case of lost COOKIE ACK. * If skb has been timestamped, then use the stamp, otherwise * use current time. This introduces a small possibility that * that a cookie may be considered expired, but his would only slow * down the new association establishment instead of every packet. */ if (sock_flag(ep->base.sk, SOCK_TIMESTAMP)) kt = skb_get_ktime(skb); else kt = ktime_get(); if (!asoc && ktime_before(bear_cookie->expiration, kt)) { /* * Section 3.3.10.3 Stale Cookie Error (3) * * Cause of error * --------------- * Stale Cookie Error: Indicates the receipt of a valid State * Cookie that has expired. */ len = ntohs(chunk->chunk_hdr->length); *errp = sctp_make_op_error_space(asoc, chunk, len); if (*errp) { suseconds_t usecs = ktime_to_us(ktime_sub(kt, bear_cookie->expiration)); __be32 n = htonl(usecs); sctp_init_cause(*errp, SCTP_ERROR_STALE_COOKIE, sizeof(n)); sctp_addto_chunk(*errp, sizeof(n), &n); *error = -SCTP_IERROR_STALE_COOKIE; } else *error = -SCTP_IERROR_NOMEM; goto fail; } /* Make a new base association. */ scope = sctp_scope(sctp_source(chunk)); retval = sctp_association_new(ep, ep->base.sk, scope, gfp); if (!retval) { *error = -SCTP_IERROR_NOMEM; goto fail; } /* Set up our peer's port number. */ retval->peer.port = ntohs(chunk->sctp_hdr->source); /* Populate the association from the cookie. */ memcpy(&retval->c, bear_cookie, sizeof(*bear_cookie)); if (sctp_assoc_set_bind_addr_from_cookie(retval, bear_cookie, GFP_ATOMIC) < 0) { *error = -SCTP_IERROR_NOMEM; goto fail; } /* Also, add the destination address. */ if (list_empty(&retval->base.bind_addr.address_list)) { sctp_add_bind_addr(&retval->base.bind_addr, &chunk->dest, SCTP_ADDR_SRC, GFP_ATOMIC); } retval->next_tsn = retval->c.initial_tsn; retval->ctsn_ack_point = retval->next_tsn - 1; retval->addip_serial = retval->c.initial_tsn; retval->adv_peer_ack_point = retval->ctsn_ack_point; retval->peer.prsctp_capable = retval->c.prsctp_capable; retval->peer.adaptation_ind = retval->c.adaptation_ind; /* The INIT stuff will be done by the side effects. */ return retval; fail: if (retval) sctp_association_free(retval); return NULL; malformed: /* Yikes! The packet is either corrupt or deliberately * malformed. */ *error = -SCTP_IERROR_MALFORMED; goto fail; }
5,853
186,631
1
void RenderWidgetHostImpl::DidNavigate(uint32_t next_source_id) { current_content_source_id_ = next_source_id; did_receive_first_frame_after_navigation_ = false; if (enable_surface_synchronization_) { // Resize messages before navigation are not acked, so reset // |visual_properties_ack_pending_| and make sure the next resize will be // acked if the last resize before navigation was supposed to be acked. visual_properties_ack_pending_ = false; viz::LocalSurfaceId old_surface_id = view_->GetLocalSurfaceId(); if (view_) view_->DidNavigate(); viz::LocalSurfaceId new_surface_id = view_->GetLocalSurfaceId(); // If |view_| didn't allocate a new surface id, then don't start // |new_content_rendering_timeout_|. Two reasons: // 1. It's not needed (because this was the first navigation event) // 2. If we don't change the surface id, then we will not get the call to // OnFirstSurfaceActivation, and not stop the timer (even if we get new // frames). // https://crbug.com/853651, https://crbug.com/535375 if (old_surface_id == new_surface_id) return; } else { // It is possible for a compositor frame to arrive before the browser is // notified about the page being committed, in which case no timer is // necessary. if (last_received_content_source_id_ >= current_content_source_id_) return; } if (!new_content_rendering_timeout_) return; new_content_rendering_timeout_->Start(new_content_rendering_delay_); }
5,854
92,911
0
ber_out_header(STREAM s, int tagval, int length) { if (tagval > 0xff) { out_uint16_be(s, tagval); } else { out_uint8(s, tagval); } if (length >= 0x80) { out_uint8(s, 0x82); out_uint16_be(s, length); } else out_uint8(s, length); }
5,855
102,120
0
void CheckServerReachable() { if (connection_manager()) { connection_manager()->CheckServerReachable(); } else { NOTREACHED() << "Should be valid connection manager!"; } }
5,856
162,221
0
int released_buffer_count() const { return released_buffer_count_; }
5,857
110,653
0
MailboxManager* mailbox_manager() { return group_->mailbox_manager(); }
5,858
179,789
1
static void oz_usb_handle_ep_data(struct oz_usb_ctx *usb_ctx, struct oz_usb_hdr *usb_hdr, int len) { struct oz_data *data_hdr = (struct oz_data *)usb_hdr; switch (data_hdr->format) { case OZ_DATA_F_MULTIPLE_FIXED: { struct oz_multiple_fixed *body = (struct oz_multiple_fixed *)data_hdr; u8 *data = body->data; int n = (len - sizeof(struct oz_multiple_fixed)+1) / body->unit_size; while (n--) { oz_hcd_data_ind(usb_ctx->hport, body->endpoint, data, body->unit_size); data += body->unit_size; } } break; case OZ_DATA_F_ISOC_FIXED: { struct oz_isoc_fixed *body = (struct oz_isoc_fixed *)data_hdr; int data_len = len-sizeof(struct oz_isoc_fixed)+1; int unit_size = body->unit_size; u8 *data = body->data; int count; int i; if (!unit_size) break; count = data_len/unit_size; for (i = 0; i < count; i++) { oz_hcd_data_ind(usb_ctx->hport, body->endpoint, data, unit_size); data += unit_size; } } break; } }
5,859
71,250
0
unsigned long kvm_vcpu_gfn_to_hva_prot(struct kvm_vcpu *vcpu, gfn_t gfn, bool *writable) { struct kvm_memory_slot *slot = kvm_vcpu_gfn_to_memslot(vcpu, gfn); return gfn_to_hva_memslot_prot(slot, gfn, writable); }
5,860
176,069
0
void mca_ccb_snd_rsp(tMCA_CCB* p_ccb, tMCA_CCB_EVT* p_data) { tMCA_CCB_MSG* p_msg = (tMCA_CCB_MSG*)p_data; uint8_t *p, *p_start; BT_HDR* p_pkt = (BT_HDR*)osi_malloc(MCA_CTRL_MTU + sizeof(BT_HDR)); MCA_TRACE_DEBUG("%s cong=%d req=%d", __func__, p_ccb->cong, p_msg->op_code); /* assume that API functions verified the parameters */ p_pkt->offset = L2CAP_MIN_OFFSET; p = p_start = (uint8_t*)(p_pkt + 1) + L2CAP_MIN_OFFSET; *p++ = p_msg->op_code; *p++ = p_msg->rsp_code; UINT16_TO_BE_STREAM(p, p_msg->mdl_id); if (p_msg->rsp_code == MCA_RSP_SUCCESS) { if (p_msg->op_code == MCA_OP_MDL_CREATE_RSP) { *p++ = p_msg->param; } if (p_msg->op_code == MCA_OP_MDL_CREATE_RSP || p_msg->op_code == MCA_OP_MDL_RECONNECT_RSP) { mca_dcb_by_hdl(p_msg->dcb_idx); BTM_SetSecurityLevel(false, "", BTM_SEC_SERVICE_MCAP_DATA, p_ccb->sec_mask, p_ccb->p_rcb->reg.data_psm, BTM_SEC_PROTO_MCA, p_msg->dcb_idx); p_ccb->status = MCA_CCB_STAT_PENDING; /* set p_tx_req to block API_REQ/API_RSP before DL is up */ osi_free_and_reset((void**)&p_ccb->p_tx_req); p_ccb->p_tx_req = p_ccb->p_rx_msg; p_ccb->p_rx_msg = NULL; p_ccb->p_tx_req->dcb_idx = p_msg->dcb_idx; } } osi_free_and_reset((void**)&p_ccb->p_rx_msg); p_pkt->len = p - p_start; L2CA_DataWrite(p_ccb->lcid, p_pkt); }
5,861
176,732
0
bool Parcel::readBool() const { return readInt32() != 0; }
5,862
85,463
0
static enum ata_completion_errors sas_to_ata_err(struct task_status_struct *ts) { /* Cheesy attempt to translate SAS errors into ATA. Hah! */ /* transport error */ if (ts->resp == SAS_TASK_UNDELIVERED) return AC_ERR_ATA_BUS; /* ts->resp == SAS_TASK_COMPLETE */ /* task delivered, what happened afterwards? */ switch (ts->stat) { case SAS_DEV_NO_RESPONSE: return AC_ERR_TIMEOUT; case SAS_INTERRUPTED: case SAS_PHY_DOWN: case SAS_NAK_R_ERR: return AC_ERR_ATA_BUS; case SAS_DATA_UNDERRUN: /* * Some programs that use the taskfile interface * (smartctl in particular) can cause underrun * problems. Ignore these errors, perhaps at our * peril. */ return 0; case SAS_DATA_OVERRUN: case SAS_QUEUE_FULL: case SAS_DEVICE_UNKNOWN: case SAS_SG_ERR: return AC_ERR_INVALID; case SAS_OPEN_TO: case SAS_OPEN_REJECT: SAS_DPRINTK("%s: Saw error %d. What to do?\n", __func__, ts->stat); return AC_ERR_OTHER; case SAM_STAT_CHECK_CONDITION: case SAS_ABORTED_TASK: return AC_ERR_DEV; case SAS_PROTO_RESPONSE: /* This means the ending_fis has the error * value; return 0 here to collect it */ return 0; default: return 0; } }
5,863
54,796
0
static int snd_usbmidi_output_close(struct snd_rawmidi_substream *substream) { return substream_open(substream, 0, 0); }
5,864
125,251
0
void DatabaseMessageFilter::OnDatabaseGetSpaceAvailable( const string16& origin_identifier, IPC::Message* reply_msg) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(db_tracker_->quota_manager_proxy()); QuotaManager* quota_manager = db_tracker_->quota_manager_proxy()->quota_manager(); if (!quota_manager) { NOTREACHED(); // The system is shutting down, messages are unexpected. DatabaseHostMsg_GetSpaceAvailable::WriteReplyParams( reply_msg, static_cast<int64>(0)); Send(reply_msg); return; } quota_manager->GetUsageAndQuota( DatabaseUtil::GetOriginFromIdentifier(origin_identifier), quota::kStorageTypeTemporary, base::Bind(&DatabaseMessageFilter::OnDatabaseGetUsageAndQuota, this, reply_msg)); }
5,865
61,683
0
OPJ_BOOL opj_alloc_tile_component_data(opj_tcd_tilecomp_t *l_tilec) { if ((l_tilec->data == 00) || ((l_tilec->data_size_needed > l_tilec->data_size) && (l_tilec->ownsData == OPJ_FALSE))) { l_tilec->data = (OPJ_INT32 *) opj_image_data_alloc(l_tilec->data_size_needed); if (! l_tilec->data) { return OPJ_FALSE; } /*fprintf(stderr, "tAllocate data of tilec (int): %d x OPJ_UINT32n",l_data_size);*/ l_tilec->data_size = l_tilec->data_size_needed; l_tilec->ownsData = OPJ_TRUE; } else if (l_tilec->data_size_needed > l_tilec->data_size) { /* We don't need to keep old data */ opj_image_data_free(l_tilec->data); l_tilec->data = (OPJ_INT32 *) opj_image_data_alloc(l_tilec->data_size_needed); if (! l_tilec->data) { l_tilec->data_size = 0; l_tilec->data_size_needed = 0; l_tilec->ownsData = OPJ_FALSE; return OPJ_FALSE; } /*fprintf(stderr, "tReallocate data of tilec (int): from %d to %d x OPJ_UINT32n", l_tilec->data_size, l_data_size);*/ l_tilec->data_size = l_tilec->data_size_needed; l_tilec->ownsData = OPJ_TRUE; } return OPJ_TRUE; }
5,866
87,844
0
callout_func_list_add(CalloutNameListType* s, int* rid) { if (s->n >= s->alloc) { int new_size = s->alloc * 2; CalloutNameListEntry* nv = (CalloutNameListEntry* ) xrealloc(s->v, sizeof(CalloutNameListEntry) * new_size); if (IS_NULL(nv)) return ONIGERR_MEMORY; s->alloc = new_size; s->v = nv; } *rid = s->n; xmemset(&(s->v[s->n]), 0, sizeof(*(s->v))); s->n++; return ONIG_NORMAL; }
5,867
107,540
0
Eina_Bool ewk_view_history_enable_set(Evas_Object* ewkView, Eina_Bool enable) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); static_cast<WebCore::BackForwardListImpl*>(priv->page->backForwardList())->setEnabled(enable); return true; }
5,868
114,838
0
int xmlThrDefSubstituteEntitiesDefaultValue(int v) { int ret; xmlMutexLock(xmlThrDefMutex); ret = xmlSubstituteEntitiesDefaultValueThrDef; xmlSubstituteEntitiesDefaultValueThrDef = v; xmlMutexUnlock(xmlThrDefMutex); return ret; }
5,869
158,019
0
unsigned LocalFrameClientImpl::BackForwardLength() { WebViewImpl* webview = web_frame_->ViewImpl(); if (!webview || !webview->Client()) return 0; return webview->Client()->HistoryBackListCount() + 1 + webview->Client()->HistoryForwardListCount(); }
5,870
104,466
0
GLvoid StubGLStencilFunc(GLenum func, GLint ref, GLuint mask) { glStencilFunc(func, ref, mask); }
5,871
18,663
0
int kernel_listen(struct socket *sock, int backlog) { return sock->ops->listen(sock, backlog); }
5,872
110,251
0
int NaClIPCAdapter::RewrittenMessage::Read(char* dest_buffer, size_t dest_buffer_size) { CHECK(data_len_ >= data_read_cursor_); size_t bytes_to_write = std::min(dest_buffer_size, data_len_ - data_read_cursor_); if (bytes_to_write == 0) return 0; memcpy(dest_buffer, &data_[data_read_cursor_], bytes_to_write); data_read_cursor_ += bytes_to_write; return static_cast<int>(bytes_to_write); }
5,873
57,838
0
static inline long ldsem_atomic_update(long delta, struct ld_semaphore *sem) { return atomic_long_add_return(delta, (atomic_long_t *)&sem->count); }
5,874
39,543
0
fst_tx_timeout(struct net_device *dev) { struct fst_port_info *port; struct fst_card_info *card; port = dev_to_port(dev); card = port->card; dev->stats.tx_errors++; dev->stats.tx_aborted_errors++; dbg(DBG_ASS, "Tx timeout card %d port %d\n", card->card_no, port->index); fst_issue_cmd(port, ABORTTX); dev->trans_start = jiffies; netif_wake_queue(dev); port->start = 0; }
5,875
184,259
1
void ThreadableBlobRegistry::registerBlobURL(SecurityOrigin* origin, const KURL& url, const KURL& srcURL) { // If the blob URL contains null origin, as in the context with unique // security origin or file URL, save the mapping between url and origin so // that the origin can be retrived when doing security origin check. if (origin && BlobURL::getOrigin(url) == "null") originMap()->add(url.string(), origin); if (isMainThread()) blobRegistry().registerBlobURL(url, srcURL); else { OwnPtr<BlobRegistryContext> context = adoptPtr(new BlobRegistryContext(url, srcURL)); callOnMainThread(&registerBlobURLFromTask, context.leakPtr()); } }
5,876
3,014
0
void vga_invalidate_scanlines(VGACommonState *s, int y1, int y2) { int y; if (y1 >= VGA_MAX_HEIGHT) return; if (y2 >= VGA_MAX_HEIGHT) y2 = VGA_MAX_HEIGHT; for(y = y1; y < y2; y++) { s->invalidated_y_table[y >> 5] |= 1 << (y & 0x1f); } }
5,877
71,914
0
WandExport int ProcessCommandOptions(MagickCLI *cli_wand,int argc,char **argv, int index) { const char *option, *arg1, *arg2; int i, end, count; CommandOptionFlags option_type; assert(argc>=index); /* you may have no arguments left! */ assert(argv != (char **) NULL); assert(argv[index] != (char *) NULL); assert(argv[argc-1] != (char *) NULL); assert(cli_wand != (MagickCLI *) NULL); assert(cli_wand->signature == MagickWandSignature); /* define the error location string for use in exceptions order of localtion format escapes: filename, line, column */ cli_wand->location="at %s arg %u"; cli_wand->filename="CLI"; cli_wand->line=index; /* note first argument we will process */ if (cli_wand->wand.debug != MagickFalse) (void) CLILogEvent(cli_wand,CommandEvent,GetMagickModule(), "- Starting (\"%s\")", argv[index]); end = argc; if ( (cli_wand->process_flags & ProcessImplictWrite) != 0 ) end--; /* the last arument is an implied write, do not process directly */ for (i=index; i < end; i += count +1) { /* Finished processing one option? */ if ( (cli_wand->process_flags & ProcessOneOptionOnly) != 0 && i != index ) return(i); do { /* use break to loop to exception handler and loop */ option=argv[i]; cli_wand->line=i; /* note the argument for this option */ /* get option, its argument count, and option type */ cli_wand->command = GetCommandOptionInfo(argv[i]); count=cli_wand->command->type; option_type=(CommandOptionFlags) cli_wand->command->flags; #if 0 (void) FormatLocaleFile(stderr, "CLI %d: \"%s\" matched \"%s\"\n", i, argv[i], cli_wand->command->mnemonic ); #endif if ( option_type == UndefinedOptionFlag || (option_type & NonMagickOptionFlag) != 0 ) { #if MagickCommandDebug >= 3 (void) FormatLocaleFile(stderr, "CLI arg %d Non-Option: \"%s\"\n", i, option); #endif if (IsCommandOption(option) == MagickFalse) { if ( (cli_wand->process_flags & ProcessImplictRead) != 0 ) { /* non-option -- treat as a image read */ cli_wand->command=(const OptionInfo *) NULL; CLIOption(cli_wand,"-read",option); break; /* next option */ } } CLIWandException(OptionFatalError,"UnrecognizedOption",option); break; /* next option */ } if ( ((option_type & SpecialOptionFlag) != 0 ) && ((cli_wand->process_flags & ProcessScriptOption) != 0) && (LocaleCompare(option,"-script") == 0) ) { /* Call Script from CLI, with a filename as a zeroth argument. NOTE: -script may need to use the 'implict write filename' argument so it must be handled specially to prevent a 'missing argument' error. */ if ( (i+count) >= argc ) CLIWandException(OptionFatalError,"MissingArgument",option); ProcessScriptOptions(cli_wand,argv[i+1],argc,argv,i+count); return(argc); /* Script does not return to CLI -- Yet */ /* FUTURE: when it does, their may be no write arg! */ } if ((i+count) >= end ) { CLIWandException(OptionFatalError,"MissingArgument",option); if ( CLICatchException(cli_wand, MagickFalse) != MagickFalse ) return(end); break; /* next option - not that their is any! */ } arg1 = ( count >= 1 ) ? argv[i+1] : (char *) NULL; arg2 = ( count >= 2 ) ? argv[i+2] : (char *) NULL; /* Process Known Options */ #if MagickCommandDebug >= 3 (void) FormatLocaleFile(stderr, "CLI arg %u Option: \"%s\" Count: %d Flags: %04x Args: \"%s\" \"%s\"\n", i,option,count,option_type,arg1,arg2); #endif /* ignore 'genesis options' in command line args */ if ( (option_type & GenesisOptionFlag) != 0 ) break; /* next option */ /* Handle any special options for CLI (-script handled above) */ if ( (option_type & SpecialOptionFlag) != 0 ) { if ( (cli_wand->process_flags & ProcessExitOption) != 0 && LocaleCompare(option,"-exit") == 0 ) return(i+count); break; /* next option */ } /* Process standard image option */ CLIOption(cli_wand, option, arg1, arg2); DisableMSCWarning(4127) } while (0); /* break block to next option */ RestoreMSCWarning #if MagickCommandDebug >= 5 (void) FormatLocaleFile(stderr, "CLI-post Image Count = %ld\n", (long) GetImageListLength(cli_wand->wand.images) ); #endif if ( CLICatchException(cli_wand, MagickFalse) != MagickFalse ) return(i+count); } assert(i==end); if ( (cli_wand->process_flags & ProcessImplictWrite) == 0 ) return(end); /* no implied write -- just return to caller */ assert(end==argc-1); /* end should not include last argument */ /* Implicit Write of images to final CLI argument */ option=argv[i]; cli_wand->line=i; /* check that stacks are empty - or cause exception */ if (cli_wand->image_list_stack != (Stack *) NULL) CLIWandException(OptionError,"UnbalancedParenthesis", "(end of cli)"); else if (cli_wand->image_info_stack != (Stack *) NULL) CLIWandException(OptionError,"UnbalancedBraces", "(end of cli)"); if ( CLICatchException(cli_wand, MagickFalse) != MagickFalse ) return(argc); #if MagickCommandDebug >= 3 (void) FormatLocaleFile(stderr,"CLI arg %d Write File: \"%s\"\n",i,option); #endif /* Valid 'do no write' replacement option (instead of "null:") */ if (LocaleCompare(option,"-exit") == 0 ) return(argc); /* just exit, no image write */ /* If filename looks like an option, Or the common 'end of line' error of a single space. -- produce an error */ if (IsCommandOption(option) != MagickFalse || (option[0] == ' ' && option[1] == '\0') ) { CLIWandException(OptionError,"MissingOutputFilename",option); return(argc); } cli_wand->command=(const OptionInfo *) NULL; CLIOption(cli_wand,"-write",option); return(argc); }
5,878
141,848
0
void rethrowExceptionInPrivateScript(v8::Isolate* isolate, v8::TryCatch& block, ScriptState* scriptStateInUserScript, ExceptionState::ContextType errorContext, const char* propertyName, const char* interfaceName) { v8::Local<v8::Context> context = scriptStateInUserScript->context(); v8::Local<v8::Value> exception = block.Exception(); RELEASE_ASSERT(!exception.IsEmpty() && exception->IsObject()); v8::Local<v8::Object> exceptionObject = v8::Local<v8::Object>::Cast(exception); v8::Local<v8::Value> name = exceptionObject->Get(context, v8String(isolate, "name")).ToLocalChecked(); RELEASE_ASSERT(name->IsString()); v8::Local<v8::Message> tryCatchMessage = block.Message(); v8::Local<v8::Value> message; String messageString; if (exceptionObject->Get(context, v8String(isolate, "message")).ToLocal(&message) && message->IsString()) messageString = toCoreString(v8::Local<v8::String>::Cast(message)); String exceptionName = toCoreString(v8::Local<v8::String>::Cast(name)); if (exceptionName == "PrivateScriptException") { v8::Local<v8::Value> code = exceptionObject->Get(context, v8String(isolate, "code")).ToLocalChecked(); RELEASE_ASSERT(code->IsInt32()); int exceptionCode = code.As<v8::Int32>()->Value(); ScriptState::Scope scope(scriptStateInUserScript); ExceptionState exceptionState(errorContext, propertyName, interfaceName, context->Global(), scriptStateInUserScript->isolate()); exceptionState.throwDOMException(exceptionCode, messageString); return; } if (exceptionName == "RangeError" && messageString.contains("Maximum call stack size exceeded")) { ScriptState::Scope scope(scriptStateInUserScript); ExceptionState exceptionState(errorContext, propertyName, interfaceName, scriptStateInUserScript->context()->Global(), scriptStateInUserScript->isolate()); exceptionState.throwDOMException(V8RangeError, messageString); return; } fprintf(stderr, "Private script error: %s was thrown.\n", exceptionName.utf8().data()); dumpV8Message(context, tryCatchMessage); RELEASE_NOTREACHED(); }
5,879
141,395
0
IntRect PaintLayerScrollableArea::PaintLayerScrollableArea::CornerRect( const IntRect& bounds) const { int horizontal_thickness; int vertical_thickness; if (!VerticalScrollbar() && !HorizontalScrollbar()) { horizontal_thickness = GetPageScrollbarTheme().ScrollbarThickness(); vertical_thickness = horizontal_thickness; } else if (VerticalScrollbar() && !HorizontalScrollbar()) { horizontal_thickness = VerticalScrollbar()->ScrollbarThickness(); vertical_thickness = horizontal_thickness; } else if (HorizontalScrollbar() && !VerticalScrollbar()) { vertical_thickness = HorizontalScrollbar()->ScrollbarThickness(); horizontal_thickness = vertical_thickness; } else { horizontal_thickness = VerticalScrollbar()->ScrollbarThickness(); vertical_thickness = HorizontalScrollbar()->ScrollbarThickness(); } return IntRect(CornerStart(*GetLayoutBox(), bounds.X(), bounds.MaxX(), horizontal_thickness), bounds.MaxY() - vertical_thickness - GetLayoutBox()->StyleRef().BorderBottomWidth(), horizontal_thickness, vertical_thickness); }
5,880
159,190
0
void DownloadItemImpl::SetDangerType(DownloadDangerType danger_type) { if (danger_type != danger_type_) { TRACE_EVENT_INSTANT1("download", "DownloadItemSaftyStateUpdated", TRACE_EVENT_SCOPE_THREAD, "danger_type", GetDownloadDangerNames(danger_type).c_str()); } if ((danger_type_ == DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS || danger_type_ == DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE || danger_type_ == DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT || danger_type_ == DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT) && (danger_type == DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST || danger_type == DOWNLOAD_DANGER_TYPE_DANGEROUS_URL || danger_type == DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT || danger_type == DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED)) { RecordMaliciousDownloadClassified(danger_type); } danger_type_ = danger_type; }
5,881
180,046
1
loadImage(TIFF* in, struct image_data *image, struct dump_opts *dump, unsigned char **read_ptr) { uint32 i; float xres = 0.0, yres = 0.0; uint16 nstrips = 0, ntiles = 0, planar = 0; uint16 bps = 0, spp = 0, res_unit = 0; uint16 orientation = 0; uint16 input_compression = 0, input_photometric = 0; uint16 subsampling_horiz, subsampling_vert; uint32 width = 0, length = 0; uint32 stsize = 0, tlsize = 0, buffsize = 0, scanlinesize = 0; uint32 tw = 0, tl = 0; /* Tile width and length */ uint32 tile_rowsize = 0; unsigned char *read_buff = NULL; unsigned char *new_buff = NULL; int readunit = 0; static uint32 prev_readsize = 0; TIFFGetFieldDefaulted(in, TIFFTAG_BITSPERSAMPLE, &bps); TIFFGetFieldDefaulted(in, TIFFTAG_SAMPLESPERPIXEL, &spp); TIFFGetFieldDefaulted(in, TIFFTAG_PLANARCONFIG, &planar); TIFFGetFieldDefaulted(in, TIFFTAG_ORIENTATION, &orientation); if (! TIFFGetFieldDefaulted(in, TIFFTAG_PHOTOMETRIC, &input_photometric)) TIFFError("loadImage","Image lacks Photometric interpreation tag"); if (! TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &width)) TIFFError("loadimage","Image lacks image width tag"); if(! TIFFGetField(in, TIFFTAG_IMAGELENGTH, &length)) TIFFError("loadimage","Image lacks image length tag"); TIFFGetFieldDefaulted(in, TIFFTAG_XRESOLUTION, &xres); TIFFGetFieldDefaulted(in, TIFFTAG_YRESOLUTION, &yres); if (!TIFFGetFieldDefaulted(in, TIFFTAG_RESOLUTIONUNIT, &res_unit)) res_unit = RESUNIT_INCH; if (!TIFFGetField(in, TIFFTAG_COMPRESSION, &input_compression)) input_compression = COMPRESSION_NONE; #ifdef DEBUG2 char compressionid[16]; switch (input_compression) { case COMPRESSION_NONE: /* 1 dump mode */ strcpy (compressionid, "None/dump"); break; case COMPRESSION_CCITTRLE: /* 2 CCITT modified Huffman RLE */ strcpy (compressionid, "Huffman RLE"); break; case COMPRESSION_CCITTFAX3: /* 3 CCITT Group 3 fax encoding */ strcpy (compressionid, "Group3 Fax"); break; case COMPRESSION_CCITTFAX4: /* 4 CCITT Group 4 fax encoding */ strcpy (compressionid, "Group4 Fax"); break; case COMPRESSION_LZW: /* 5 Lempel-Ziv & Welch */ strcpy (compressionid, "LZW"); break; case COMPRESSION_OJPEG: /* 6 !6.0 JPEG */ strcpy (compressionid, "Old Jpeg"); break; case COMPRESSION_JPEG: /* 7 %JPEG DCT compression */ strcpy (compressionid, "New Jpeg"); break; case COMPRESSION_NEXT: /* 32766 NeXT 2-bit RLE */ strcpy (compressionid, "Next RLE"); break; case COMPRESSION_CCITTRLEW: /* 32771 #1 w/ word alignment */ strcpy (compressionid, "CITTRLEW"); break; case COMPRESSION_PACKBITS: /* 32773 Macintosh RLE */ strcpy (compressionid, "Mac Packbits"); break; case COMPRESSION_THUNDERSCAN: /* 32809 ThunderScan RLE */ strcpy (compressionid, "Thunderscan"); break; case COMPRESSION_IT8CTPAD: /* 32895 IT8 CT w/padding */ strcpy (compressionid, "IT8 padded"); break; case COMPRESSION_IT8LW: /* 32896 IT8 Linework RLE */ strcpy (compressionid, "IT8 RLE"); break; case COMPRESSION_IT8MP: /* 32897 IT8 Monochrome picture */ strcpy (compressionid, "IT8 mono"); break; case COMPRESSION_IT8BL: /* 32898 IT8 Binary line art */ strcpy (compressionid, "IT8 lineart"); break; case COMPRESSION_PIXARFILM: /* 32908 Pixar companded 10bit LZW */ strcpy (compressionid, "Pixar 10 bit"); break; case COMPRESSION_PIXARLOG: /* 32909 Pixar companded 11bit ZIP */ strcpy (compressionid, "Pixar 11bit"); break; case COMPRESSION_DEFLATE: /* 32946 Deflate compression */ strcpy (compressionid, "Deflate"); break; case COMPRESSION_ADOBE_DEFLATE: /* 8 Deflate compression */ strcpy (compressionid, "Adobe deflate"); break; default: strcpy (compressionid, "None/unknown"); break; } TIFFError("loadImage", "Input compression %s", compressionid); #endif scanlinesize = TIFFScanlineSize(in); image->bps = bps; image->spp = spp; image->planar = planar; image->width = width; image->length = length; image->xres = xres; image->yres = yres; image->res_unit = res_unit; image->compression = input_compression; image->photometric = input_photometric; #ifdef DEBUG2 char photometricid[12]; switch (input_photometric) { case PHOTOMETRIC_MINISWHITE: strcpy (photometricid, "MinIsWhite"); break; case PHOTOMETRIC_MINISBLACK: strcpy (photometricid, "MinIsBlack"); break; case PHOTOMETRIC_RGB: strcpy (photometricid, "RGB"); break; case PHOTOMETRIC_PALETTE: strcpy (photometricid, "Palette"); break; case PHOTOMETRIC_MASK: strcpy (photometricid, "Mask"); break; case PHOTOMETRIC_SEPARATED: strcpy (photometricid, "Separated"); break; case PHOTOMETRIC_YCBCR: strcpy (photometricid, "YCBCR"); break; case PHOTOMETRIC_CIELAB: strcpy (photometricid, "CIELab"); break; case PHOTOMETRIC_ICCLAB: strcpy (photometricid, "ICCLab"); break; case PHOTOMETRIC_ITULAB: strcpy (photometricid, "ITULab"); break; case PHOTOMETRIC_LOGL: strcpy (photometricid, "LogL"); break; case PHOTOMETRIC_LOGLUV: strcpy (photometricid, "LOGLuv"); break; default: strcpy (photometricid, "Unknown"); break; } TIFFError("loadImage", "Input photometric interpretation %s", photometricid); #endif image->orientation = orientation; switch (orientation) { case 0: case ORIENTATION_TOPLEFT: image->adjustments = 0; break; case ORIENTATION_TOPRIGHT: image->adjustments = MIRROR_HORIZ; break; case ORIENTATION_BOTRIGHT: image->adjustments = ROTATECW_180; break; case ORIENTATION_BOTLEFT: image->adjustments = MIRROR_VERT; break; case ORIENTATION_LEFTTOP: image->adjustments = MIRROR_VERT | ROTATECW_90; break; case ORIENTATION_RIGHTTOP: image->adjustments = ROTATECW_90; break; case ORIENTATION_RIGHTBOT: image->adjustments = MIRROR_VERT | ROTATECW_270; break; case ORIENTATION_LEFTBOT: image->adjustments = ROTATECW_270; break; default: image->adjustments = 0; image->orientation = ORIENTATION_TOPLEFT; } if ((bps == 0) || (spp == 0)) { TIFFError("loadImage", "Invalid samples per pixel (%d) or bits per sample (%d)", spp, bps); return (-1); } if (TIFFIsTiled(in)) { readunit = TILE; tlsize = TIFFTileSize(in); ntiles = TIFFNumberOfTiles(in); TIFFGetField(in, TIFFTAG_TILEWIDTH, &tw); TIFFGetField(in, TIFFTAG_TILELENGTH, &tl); tile_rowsize = TIFFTileRowSize(in); if (ntiles == 0 || tlsize == 0 || tile_rowsize == 0) { TIFFError("loadImage", "File appears to be tiled, but the number of tiles, tile size, or tile rowsize is zero."); exit(-1); } buffsize = tlsize * ntiles; if (tlsize != (buffsize / ntiles)) { TIFFError("loadImage", "Integer overflow when calculating buffer size"); exit(-1); } if (buffsize < (uint32)(ntiles * tl * tile_rowsize)) { buffsize = ntiles * tl * tile_rowsize; if (ntiles != (buffsize / tl / tile_rowsize)) { TIFFError("loadImage", "Integer overflow when calculating buffer size"); exit(-1); } #ifdef DEBUG2 TIFFError("loadImage", "Tilesize %u is too small, using ntiles * tilelength * tilerowsize %lu", tlsize, (unsigned long)buffsize); #endif } if (dump->infile != NULL) dump_info (dump->infile, dump->format, "", "Tilesize: %u, Number of Tiles: %u, Tile row size: %u", tlsize, ntiles, tile_rowsize); } else { uint32 buffsize_check; readunit = STRIP; TIFFGetFieldDefaulted(in, TIFFTAG_ROWSPERSTRIP, &rowsperstrip); stsize = TIFFStripSize(in); nstrips = TIFFNumberOfStrips(in); if (nstrips == 0 || stsize == 0) { TIFFError("loadImage", "File appears to be striped, but the number of stipes or stripe size is zero."); exit(-1); } buffsize = stsize * nstrips; if (stsize != (buffsize / nstrips)) { TIFFError("loadImage", "Integer overflow when calculating buffer size"); exit(-1); } buffsize_check = ((length * width * spp * bps) + 7); if (length != ((buffsize_check - 7) / width / spp / bps)) { TIFFError("loadImage", "Integer overflow detected."); exit(-1); } if (buffsize < (uint32) (((length * width * spp * bps) + 7) / 8)) { buffsize = ((length * width * spp * bps) + 7) / 8; #ifdef DEBUG2 TIFFError("loadImage", "Stripsize %u is too small, using imagelength * width * spp * bps / 8 = %lu", stsize, (unsigned long)buffsize); #endif } if (dump->infile != NULL) dump_info (dump->infile, dump->format, "", "Stripsize: %u, Number of Strips: %u, Rows per Strip: %u, Scanline size: %u", stsize, nstrips, rowsperstrip, scanlinesize); } if (input_compression == COMPRESSION_JPEG) { /* Force conversion to RGB */ jpegcolormode = JPEGCOLORMODE_RGB; TIFFSetField(in, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB); } /* The clause up to the read statement is taken from Tom Lane's tiffcp patch */ else { /* Otherwise, can't handle subsampled input */ if (input_photometric == PHOTOMETRIC_YCBCR) { TIFFGetFieldDefaulted(in, TIFFTAG_YCBCRSUBSAMPLING, &subsampling_horiz, &subsampling_vert); if (subsampling_horiz != 1 || subsampling_vert != 1) { TIFFError("loadImage", "Can't copy/convert subsampled image with subsampling %d horiz %d vert", subsampling_horiz, subsampling_vert); return (-1); } } } read_buff = *read_ptr; /* +3 : add a few guard bytes since reverseSamples16bits() can read a bit */ /* outside buffer */ if (!read_buff) read_buff = (unsigned char *)_TIFFmalloc(buffsize+3); else { if (prev_readsize < buffsize) { new_buff = _TIFFrealloc(read_buff, buffsize+3); if (!new_buff) { free (read_buff); read_buff = (unsigned char *)_TIFFmalloc(buffsize+3); } else read_buff = new_buff; } } if (!read_buff) { TIFFError("loadImage", "Unable to allocate/reallocate read buffer"); return (-1); } read_buff[buffsize] = 0; read_buff[buffsize+1] = 0; read_buff[buffsize+2] = 0; prev_readsize = buffsize; *read_ptr = read_buff; /* N.B. The read functions used copy separate plane data into a buffer as interleaved * samples rather than separate planes so the same logic works to extract regions * regardless of the way the data are organized in the input file. */ switch (readunit) { case STRIP: if (planar == PLANARCONFIG_CONTIG) { if (!(readContigStripsIntoBuffer(in, read_buff))) { TIFFError("loadImage", "Unable to read contiguous strips into buffer"); return (-1); } } else { if (!(readSeparateStripsIntoBuffer(in, read_buff, length, width, spp, dump))) { TIFFError("loadImage", "Unable to read separate strips into buffer"); return (-1); } } break; case TILE: if (planar == PLANARCONFIG_CONTIG) { if (!(readContigTilesIntoBuffer(in, read_buff, length, width, tw, tl, spp, bps))) { TIFFError("loadImage", "Unable to read contiguous tiles into buffer"); return (-1); } } else { if (!(readSeparateTilesIntoBuffer(in, read_buff, length, width, tw, tl, spp, bps))) { TIFFError("loadImage", "Unable to read separate tiles into buffer"); return (-1); } } break; default: TIFFError("loadImage", "Unsupported image file format"); return (-1); break; } if ((dump->infile != NULL) && (dump->level == 2)) { dump_info (dump->infile, dump->format, "loadImage", "Image width %d, length %d, Raw image data, %4d bytes", width, length, buffsize); dump_info (dump->infile, dump->format, "", "Bits per sample %d, Samples per pixel %d", bps, spp); for (i = 0; i < length; i++) dump_buffer(dump->infile, dump->format, 1, scanlinesize, i, read_buff + (i * scanlinesize)); } return (0); } /* end loadImage */
5,882
66,324
0
static void gen_bpt_io(DisasContext *s, TCGv_i32 t_port, int ot) { if (s->flags & HF_IOBPT_MASK) { TCGv_i32 t_size = tcg_const_i32(1 << ot); TCGv t_next = tcg_const_tl(s->pc - s->cs_base); gen_helper_bpt_io(cpu_env, t_port, t_size, t_next); tcg_temp_free_i32(t_size); tcg_temp_free(t_next); } }
5,883
90,427
0
static void megasas_teardown_frame_pool(struct megasas_instance *instance) { int i; u16 max_cmd = instance->max_mfi_cmds; struct megasas_cmd *cmd; if (!instance->frame_dma_pool) return; /* * Return all frames to pool */ for (i = 0; i < max_cmd; i++) { cmd = instance->cmd_list[i]; if (cmd->frame) dma_pool_free(instance->frame_dma_pool, cmd->frame, cmd->frame_phys_addr); if (cmd->sense) dma_pool_free(instance->sense_dma_pool, cmd->sense, cmd->sense_phys_addr); } /* * Now destroy the pool itself */ dma_pool_destroy(instance->frame_dma_pool); dma_pool_destroy(instance->sense_dma_pool); instance->frame_dma_pool = NULL; instance->sense_dma_pool = NULL; }
5,884
137,895
0
bool MediaControlVolumeSliderElement::willRespondToMouseMoveEvents() { if (!isConnected() || !document().isActive()) return false; return MediaControlInputElement::willRespondToMouseMoveEvents(); }
5,885
99,826
0
std::string WebPluginProxy::GetCookies(const GURL& url, const GURL& first_party_for_cookies) { std::string cookies; Send(new PluginHostMsg_GetCookies(route_id_, url, first_party_for_cookies, &cookies)); return cookies; }
5,886
6,882
0
static int pat_parse_meth(const char *text, struct pattern *pattern, int mflags, char **err) { int len, meth; len = strlen(text); meth = find_http_meth(text, len); pattern->val.i = meth; if (meth == HTTP_METH_OTHER) { pattern->ptr.str = (char *)text; pattern->len = len; } else { pattern->ptr.str = NULL; pattern->len = 0; } return 1; }
5,887
176,844
0
static int connectSocketNative(JNIEnv *env, jobject object, jbyteArray address, jint type, jbyteArray uuidObj, jint channel, jint flag) { jbyte *addr = NULL, *uuid = NULL; int socket_fd; bt_status_t status; if (!sBluetoothSocketInterface) return -1; addr = env->GetByteArrayElements(address, NULL); if (!addr) { ALOGE("failed to get Bluetooth device address"); goto Fail; } if(uuidObj != NULL) { uuid = env->GetByteArrayElements(uuidObj, NULL); if (!uuid) { ALOGE("failed to get uuid"); goto Fail; } } if ( (status = sBluetoothSocketInterface->connect((bt_bdaddr_t *) addr, (btsock_type_t) type, (const uint8_t*) uuid, channel, &socket_fd, flag)) != BT_STATUS_SUCCESS) { ALOGE("Socket connection failed: %d", status); goto Fail; } if (socket_fd < 0) { ALOGE("Fail to create file descriptor on socket fd"); goto Fail; } env->ReleaseByteArrayElements(address, addr, 0); env->ReleaseByteArrayElements(uuidObj, uuid, 0); return socket_fd; Fail: if (addr) env->ReleaseByteArrayElements(address, addr, 0); if (uuid) env->ReleaseByteArrayElements(uuidObj, uuid, 0); return -1; }
5,888
24,873
0
static void remove_full(struct kmem_cache *s, struct page *page) { struct kmem_cache_node *n; if (!(s->flags & SLAB_STORE_USER)) return; n = get_node(s, page_to_nid(page)); spin_lock(&n->list_lock); list_del(&page->lru); spin_unlock(&n->list_lock); }
5,889
132,201
0
RenderFrame* RenderFrame::FromRoutingID(int routing_id) { return RenderFrameImpl::FromRoutingID(routing_id); }
5,890
70,655
0
evdns_shutdown(int fail_requests) { if (current_base) { struct evdns_base *b = current_base; current_base = NULL; evdns_base_free(b, fail_requests); } evdns_log_fn = NULL; }
5,891
148,680
0
SkiaOutputSurfaceImpl::~SkiaOutputSurfaceImpl() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); current_paint_.reset(); root_recorder_.reset(); std::vector<std::unique_ptr<ImageContextImpl>> render_pass_image_contexts; render_pass_image_contexts.reserve(render_pass_image_cache_.size()); for (auto& id_and_image_context : render_pass_image_cache_) { id_and_image_context.second->clear_image(); render_pass_image_contexts.push_back( std::move(id_and_image_context.second)); } base::WaitableEvent event; auto callback = base::BindOnce( [](std::vector<std::unique_ptr<ImageContextImpl>> render_passes, std::unique_ptr<SkiaOutputSurfaceImplOnGpu> impl_on_gpu, base::WaitableEvent* event) { if (!render_passes.empty()) impl_on_gpu->RemoveRenderPassResource(std::move(render_passes)); impl_on_gpu = nullptr; event->Signal(); }, std::move(render_pass_image_contexts), std::move(impl_on_gpu_), &event); ScheduleGpuTask(std::move(callback), std::vector<gpu::SyncToken>()); event.Wait(); task_sequence_ = nullptr; }
5,892
100,686
0
xmlCtxtReadFile(xmlParserCtxtPtr ctxt, const char *filename, const char *encoding, int options) { xmlParserInputPtr stream; if (filename == NULL) return (NULL); if (ctxt == NULL) return (NULL); xmlCtxtReset(ctxt); stream = xmlLoadExternalEntity(filename, NULL, ctxt); if (stream == NULL) { return (NULL); } inputPush(ctxt, stream); return (xmlDoRead(ctxt, NULL, encoding, options, 1)); }
5,893
45,985
0
magic_version(void) { return MAGIC_VERSION; }
5,894
130,591
0
static void activityLoggedAttrSetter1AttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) { TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext()); if (contextData && contextData->activityLogger()) { v8::Handle<v8::Value> loggerArg[] = { jsValue }; contextData->activityLogger()->log("TestObject.activityLoggedAttrSetter1", 1, &loggerArg[0], "Setter"); } TestObjectV8Internal::activityLoggedAttrSetter1AttributeSetter(jsValue, info); TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); }
5,895
50,901
0
write_path_table(struct archive_write *a, int type_m, struct vdd *vdd) { int depth, r; size_t path_table_size; r = ARCHIVE_OK; path_table_size = 0; for (depth = 0; depth < vdd->max_depth; depth++) { r = _write_path_table(a, type_m, depth, vdd); if (r < 0) return (r); path_table_size += r; } /* Write padding data. */ path_table_size = path_table_size % PATH_TABLE_BLOCK_SIZE; if (path_table_size > 0) r = write_null(a, PATH_TABLE_BLOCK_SIZE - path_table_size); return (r); }
5,896
7,045
0
Vertical_Sweep_Drop( RAS_ARGS Short y, FT_F26Dot6 x1, FT_F26Dot6 x2, PProfile left, PProfile right ) { Long e1, e2, pxl; Short c1, f1; /* Drop-out control */ /* e2 x2 x1 e1 */ /* */ /* ^ | */ /* | | */ /* +-------------+---------------------+------------+ */ /* | | */ /* | v */ /* */ /* pixel contour contour pixel */ /* center center */ /* drop-out mode scan conversion rules (as defined in OpenType) */ /* --------------------------------------------------------------- */ /* 0 1, 2, 3 */ /* 1 1, 2, 4 */ /* 2 1, 2 */ /* 3 same as mode 2 */ /* 4 1, 2, 5 */ /* 5 1, 2, 6 */ /* 6, 7 same as mode 2 */ e1 = CEILING( x1 ); e2 = FLOOR ( x2 ); pxl = e1; if ( e1 > e2 ) { Int dropOutControl = left->flags & 7; if ( e1 == e2 + ras.precision ) { switch ( dropOutControl ) { case 0: /* simple drop-outs including stubs */ pxl = e2; break; case 4: /* smart drop-outs including stubs */ pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half ); break; case 1: /* simple drop-outs excluding stubs */ case 5: /* smart drop-outs excluding stubs */ /* Drop-out Control Rules #4 and #6 */ /* The specification neither provides an exact definition */ /* of a `stub' nor gives exact rules to exclude them. */ /* */ /* Here the constraints we use to recognize a stub. */ /* */ /* upper stub: */ /* */ /* - P_Left and P_Right are in the same contour */ /* - P_Right is the successor of P_Left in that contour */ /* - y is the top of P_Left and P_Right */ /* */ /* lower stub: */ /* */ /* - P_Left and P_Right are in the same contour */ /* - P_Left is the successor of P_Right in that contour */ /* - y is the bottom of P_Left */ /* */ /* We draw a stub if the following constraints are met. */ /* */ /* - for an upper or lower stub, there is top or bottom */ /* overshoot, respectively */ /* - the covered interval is greater or equal to a half */ /* pixel */ /* upper stub test */ if ( left->next == right && left->height <= 0 && !( left->flags & Overshoot_Top && x2 - x1 >= ras.precision_half ) ) return; /* lower stub test */ if ( right->next == left && left->start == y && !( left->flags & Overshoot_Bottom && x2 - x1 >= ras.precision_half ) ) return; if ( dropOutControl == 1 ) pxl = e2; else pxl = FLOOR( ( x1 + x2 - 1 ) / 2 + ras.precision_half ); break; default: /* modes 2, 3, 6, 7 */ return; /* no drop-out control */ } /* undocumented but confirmed: If the drop-out would result in a */ /* pixel outside of the bounding box, use the pixel inside of the */ /* bounding box instead */ if ( pxl < 0 ) pxl = e1; else if ( TRUNC( pxl ) >= ras.bWidth ) pxl = e2; /* check that the other pixel isn't set */ e1 = pxl == e1 ? e2 : e1; e1 = TRUNC( e1 ); c1 = (Short)( e1 >> 3 ); f1 = (Short)( e1 & 7 ); if ( e1 >= 0 && e1 < ras.bWidth && ras.bTarget[ras.traceOfs + c1] & ( 0x80 >> f1 ) ) return; } else return; } e1 = TRUNC( pxl ); if ( e1 >= 0 && e1 < ras.bWidth ) { c1 = (Short)( e1 >> 3 ); f1 = (Short)( e1 & 7 ); if ( ras.gray_min_x > c1 ) ras.gray_min_x = c1; if ( ras.gray_max_x < c1 ) ras.gray_max_x = c1; ras.bTarget[ras.traceOfs + c1] |= (char)( 0x80 >> f1 ); } }
5,897
143,551
0
bool GLSurfaceEGLSurfaceControl::IsSurfaceless() const { return true; }
5,898
812
0
poppler_print_annot_cb (Annot *annot, void *user_data) { if (annot->getFlags () & Annot::flagPrint) return gTrue; return (annot->getType() == Annot::typeWidget); }
5,899