unique_id
int64
13
189k
target
int64
0
1
code
stringlengths
20
241k
__index_level_0__
int64
0
18.9k
55,697
0
archive_read_format_zip_cleanup(struct archive_read *a) { struct zip *zip; struct zip_entry *zip_entry, *next_zip_entry; zip = (struct zip *)(a->format->data); #ifdef HAVE_ZLIB_H if (zip->stream_valid) inflateEnd(&zip->stream); free(zip->uncompressed_buffer); #endif if (zip->zip_entries) { zip_entry = zip->zip_entries; while (zip_entry != NULL) { next_zip_entry = zip_entry->next; archive_string_free(&zip_entry->rsrcname); free(zip_entry); zip_entry = next_zip_entry; } } free(zip->decrypted_buffer); if (zip->cctx_valid) archive_decrypto_aes_ctr_release(&zip->cctx); if (zip->hctx_valid) archive_hmac_sha1_cleanup(&zip->hctx); free(zip->iv); free(zip->erd); free(zip->v_data); archive_string_free(&zip->format_name); free(zip); (a->format->data) = NULL; return (ARCHIVE_OK); }
9,200
48,777
0
int dev_change_carrier(struct net_device *dev, bool new_carrier) { const struct net_device_ops *ops = dev->netdev_ops; if (!ops->ndo_change_carrier) return -EOPNOTSUPP; if (!netif_device_present(dev)) return -ENODEV; return ops->ndo_change_carrier(dev, new_carrier); }
9,201
58,633
0
static int rdp_recv_callback(rdpTransport* transport, STREAM* s, void* extra) { int status = 0; rdpRdp* rdp = (rdpRdp*) extra; switch (rdp->state) { case CONNECTION_STATE_NEGO: if (!rdp_client_connect_mcs_connect_response(rdp, s)) status = -1; break; case CONNECTION_STATE_MCS_ATTACH_USER: if (!rdp_client_connect_mcs_attach_user_confirm(rdp, s)) status = -1; break; case CONNECTION_STATE_MCS_CHANNEL_JOIN: if (!rdp_client_connect_mcs_channel_join_confirm(rdp, s)) status = -1; break; case CONNECTION_STATE_LICENSE: if (!rdp_client_connect_license(rdp, s)) status = -1; break; case CONNECTION_STATE_CAPABILITY: if (!rdp_client_connect_demand_active(rdp, s)) status = -1; break; case CONNECTION_STATE_FINALIZATION: status = rdp_recv_pdu(rdp, s); if ((status >= 0) && (rdp->finalize_sc_pdus == FINALIZE_SC_COMPLETE)) rdp->state = CONNECTION_STATE_ACTIVE; break; case CONNECTION_STATE_ACTIVE: status = rdp_recv_pdu(rdp, s); break; default: printf("Invalid state %d\n", rdp->state); status = -1; break; } return status; }
9,202
41,583
0
static int irda_find_lsap_sel(struct irda_sock *self, char *name) { pr_debug("%s(%p, %s)\n", __func__, self, name); if (self->iriap) { net_warn_ratelimited("%s(): busy with a previous query\n", __func__); return -EBUSY; } self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self, irda_getvalue_confirm); if(self->iriap == NULL) return -ENOMEM; /* Treat unexpected wakeup as disconnect */ self->errno = -EHOSTUNREACH; /* Query remote LM-IAS */ iriap_getvaluebyclass_request(self->iriap, self->saddr, self->daddr, name, "IrDA:TinyTP:LsapSel"); /* Wait for answer, if not yet finished (or failed) */ if (wait_event_interruptible(self->query_wait, (self->iriap==NULL))) /* Treat signals as disconnect */ return -EHOSTUNREACH; /* Check what happened */ if (self->errno) { /* Requested object/attribute doesn't exist */ if((self->errno == IAS_CLASS_UNKNOWN) || (self->errno == IAS_ATTRIB_UNKNOWN)) return -EADDRNOTAVAIL; else return -EHOSTUNREACH; } /* Get the remote TSAP selector */ switch (self->ias_result->type) { case IAS_INTEGER: pr_debug("%s() int=%d\n", __func__, self->ias_result->t.integer); if (self->ias_result->t.integer != -1) self->dtsap_sel = self->ias_result->t.integer; else self->dtsap_sel = 0; break; default: self->dtsap_sel = 0; pr_debug("%s(), bad type!\n", __func__); break; } if (self->ias_result) irias_delete_value(self->ias_result); if (self->dtsap_sel) return 0; return -EADDRNOTAVAIL; }
9,203
70,938
0
void DupTagTypeList(struct _cmsContext_struct* ctx, const struct _cmsContext_struct* src, int loc) { _cmsTagTypePluginChunkType newHead = { NULL }; _cmsTagTypeLinkedList* entry; _cmsTagTypeLinkedList* Anterior = NULL; _cmsTagTypePluginChunkType* head = (_cmsTagTypePluginChunkType*) src->chunks[loc]; for (entry = head->TagTypes; entry != NULL; entry = entry ->Next) { _cmsTagTypeLinkedList *newEntry = ( _cmsTagTypeLinkedList *) _cmsSubAllocDup(ctx ->MemPool, entry, sizeof(_cmsTagTypeLinkedList)); if (newEntry == NULL) return; newEntry -> Next = NULL; if (Anterior) Anterior -> Next = newEntry; Anterior = newEntry; if (newHead.TagTypes == NULL) newHead.TagTypes = newEntry; } ctx ->chunks[loc] = _cmsSubAllocDup(ctx->MemPool, &newHead, sizeof(_cmsTagTypePluginChunkType)); }
9,204
79,880
0
av_cold int ff_h263_decode_init(AVCodecContext *avctx) { MpegEncContext *s = avctx->priv_data; int ret; s->out_format = FMT_H263; ff_mpv_decode_defaults(s); ff_mpv_decode_init(s, avctx); s->quant_precision = 5; s->decode_mb = ff_h263_decode_mb; s->low_delay = 1; s->unrestricted_mv = 1; /* select sub codec */ switch (avctx->codec->id) { case AV_CODEC_ID_H263: case AV_CODEC_ID_H263P: s->unrestricted_mv = 0; avctx->chroma_sample_location = AVCHROMA_LOC_CENTER; break; case AV_CODEC_ID_MPEG4: break; case AV_CODEC_ID_MSMPEG4V1: s->h263_pred = 1; s->msmpeg4_version = 1; break; case AV_CODEC_ID_MSMPEG4V2: s->h263_pred = 1; s->msmpeg4_version = 2; break; case AV_CODEC_ID_MSMPEG4V3: s->h263_pred = 1; s->msmpeg4_version = 3; break; case AV_CODEC_ID_WMV1: s->h263_pred = 1; s->msmpeg4_version = 4; break; case AV_CODEC_ID_WMV2: s->h263_pred = 1; s->msmpeg4_version = 5; break; case AV_CODEC_ID_VC1: case AV_CODEC_ID_WMV3: case AV_CODEC_ID_VC1IMAGE: case AV_CODEC_ID_WMV3IMAGE: case AV_CODEC_ID_MSS2: s->h263_pred = 1; s->msmpeg4_version = 6; avctx->chroma_sample_location = AVCHROMA_LOC_LEFT; break; case AV_CODEC_ID_H263I: break; case AV_CODEC_ID_FLV1: s->h263_flv = 1; break; default: av_log(avctx, AV_LOG_ERROR, "Unsupported codec %d\n", avctx->codec->id); return AVERROR(ENOSYS); } s->codec_id = avctx->codec->id; if (avctx->codec_tag == AV_RL32("L263") || avctx->codec_tag == AV_RL32("S263")) if (avctx->extradata_size == 56 && avctx->extradata[0] == 1) s->ehc_mode = 1; /* for H.263, we allocate the images after having read the header */ if (avctx->codec->id != AV_CODEC_ID_H263 && avctx->codec->id != AV_CODEC_ID_H263P && avctx->codec->id != AV_CODEC_ID_MPEG4) { avctx->pix_fmt = h263_get_format(avctx); ff_mpv_idct_init(s); if ((ret = ff_mpv_common_init(s)) < 0) return ret; } ff_h263dsp_init(&s->h263dsp); ff_qpeldsp_init(&s->qdsp); ff_h263_decode_init_vlc(); return 0; }
9,205
173,859
0
status_t BnOMXObserver::onTransact( uint32_t code, const Parcel &data, Parcel *reply, uint32_t flags) { switch (code) { case OBSERVER_ON_MSG: { CHECK_OMX_INTERFACE(IOMXObserver, data, reply); IOMX::node_id node = data.readInt32(); std::list<omx_message> messages; status_t err = FAILED_TRANSACTION; // must receive at least one message do { int haveFence = data.readInt32(); if (haveFence < 0) { // we use -1 to mark end of messages break; } omx_message msg; msg.node = node; msg.fenceFd = haveFence ? ::dup(data.readFileDescriptor()) : -1; msg.type = (typeof(msg.type))data.readInt32(); err = data.read(&msg.u, sizeof(msg.u)); ALOGV("onTransact reading message %d, size %zu", msg.type, sizeof(msg)); messages.push_back(msg); } while (err == OK); if (err == OK) { onMessages(messages); } return err; } default: return BBinder::onTransact(code, data, reply, flags); } }
9,206
128,329
0
void FrameView::scrollToAnchor() { RefPtrWillBeRawPtr<Node> anchorNode = m_maintainScrollPositionAnchor; if (!anchorNode) return; if (!anchorNode->renderer()) return; LayoutRect rect; if (anchorNode != m_frame->document()) rect = anchorNode->boundingBox(); anchorNode->renderer()->scrollRectToVisible(rect, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignTopAlways); if (AXObjectCache* cache = m_frame->document()->existingAXObjectCache()) cache->handleScrolledToAnchor(anchorNode.get()); m_maintainScrollPositionAnchor = anchorNode; }
9,207
167,884
0
bool Document::IsSlotAssignmentOrLegacyDistributionDirty() { if (ChildNeedsDistributionRecalc()) return true; if (RuntimeEnabledFeatures::IncrementalShadowDOMEnabled() && GetSlotAssignmentEngine().HasPendingSlotAssignmentRecalc()) { return true; } return false; }
9,208
1,645
0
static RELOC_PTRS_BEGIN(dc_binary_masked_reloc_ptrs) { RELOC_USING(st_dc_pure_masked, vptr, size); RELOC_USING(st_dc_ht_binary, vptr, size); }
9,209
49,394
0
static int map_files_d_revalidate(struct dentry *dentry, unsigned int flags) { unsigned long vm_start, vm_end; bool exact_vma_exists = false; struct mm_struct *mm = NULL; struct task_struct *task; const struct cred *cred; struct inode *inode; int status = 0; if (flags & LOOKUP_RCU) return -ECHILD; inode = d_inode(dentry); task = get_proc_task(inode); if (!task) goto out_notask; mm = mm_access(task, PTRACE_MODE_READ_FSCREDS); if (IS_ERR_OR_NULL(mm)) goto out; if (!dname_to_vma_addr(dentry, &vm_start, &vm_end)) { down_read(&mm->mmap_sem); exact_vma_exists = !!find_exact_vma(mm, vm_start, vm_end); up_read(&mm->mmap_sem); } mmput(mm); if (exact_vma_exists) { if (task_dumpable(task)) { rcu_read_lock(); cred = __task_cred(task); inode->i_uid = cred->euid; inode->i_gid = cred->egid; rcu_read_unlock(); } else { inode->i_uid = GLOBAL_ROOT_UID; inode->i_gid = GLOBAL_ROOT_GID; } security_task_to_inode(task, inode); status = 1; } out: put_task_struct(task); out_notask: return status; }
9,210
181,062
1
l2tp_avp_print(netdissect_options *ndo, const u_char *dat, int length) { u_int len; const uint16_t *ptr = (const uint16_t *)dat; uint16_t attr_type; int hidden = FALSE; if (length <= 0) { return; } ND_PRINT((ndo, " ")); ND_TCHECK(*ptr); /* Flags & Length */ len = EXTRACT_16BITS(ptr) & L2TP_AVP_HDR_LEN_MASK; /* If it is not long enough to contain the header, we'll give up. */ if (len < 6) goto trunc; /* If it goes past the end of the remaining length of the packet, we'll give up. */ if (len > (u_int)length) goto trunc; /* If it goes past the end of the remaining length of the captured data, we'll give up. */ ND_TCHECK2(*ptr, len); /* After this point, no need to worry about truncation * if (EXTRACT_16BITS(ptr) & L2TP_AVP_HDR_FLAG_MANDATORY) { ND_PRINT((ndo, "*")); } if (EXTRACT_16BITS(ptr) & L2TP_AVP_HDR_FLAG_HIDDEN) { hidden = TRUE; ND_PRINT((ndo, "?")); } ptr++; if (EXTRACT_16BITS(ptr)) { /* Vendor Specific Attribute */ ND_PRINT((ndo, "VENDOR%04x:", EXTRACT_16BITS(ptr))); ptr++; ND_PRINT((ndo, "ATTR%04x", EXTRACT_16BITS(ptr))); ptr++; ND_PRINT((ndo, "(")); print_octets(ndo, (const u_char *)ptr, len-6); ND_PRINT((ndo, ")")); } else { /* IETF-defined Attributes */ ptr++; attr_type = EXTRACT_16BITS(ptr); ptr++; ND_PRINT((ndo, "%s", tok2str(l2tp_avp2str, "AVP-#%u", attr_type))); ND_PRINT((ndo, "(")); if (hidden) { ND_PRINT((ndo, "???")); } else { switch (attr_type) { case L2TP_AVP_MSGTYPE: l2tp_msgtype_print(ndo, (const u_char *)ptr); break; case L2TP_AVP_RESULT_CODE: l2tp_result_code_print(ndo, (const u_char *)ptr, len-6); break; case L2TP_AVP_PROTO_VER: l2tp_proto_ver_print(ndo, ptr); break; case L2TP_AVP_FRAMING_CAP: l2tp_framing_cap_print(ndo, (const u_char *)ptr); break; case L2TP_AVP_BEARER_CAP: l2tp_bearer_cap_print(ndo, (const u_char *)ptr); break; case L2TP_AVP_TIE_BREAKER: print_octets(ndo, (const u_char *)ptr, 8); break; case L2TP_AVP_FIRM_VER: case L2TP_AVP_ASSND_TUN_ID: case L2TP_AVP_RECV_WIN_SIZE: case L2TP_AVP_ASSND_SESS_ID: print_16bits_val(ndo, ptr); break; case L2TP_AVP_HOST_NAME: case L2TP_AVP_VENDOR_NAME: case L2TP_AVP_CALLING_NUMBER: case L2TP_AVP_CALLED_NUMBER: case L2TP_AVP_SUB_ADDRESS: case L2TP_AVP_PROXY_AUTH_NAME: case L2TP_AVP_PRIVATE_GRP_ID: print_string(ndo, (const u_char *)ptr, len-6); break; case L2TP_AVP_CHALLENGE: case L2TP_AVP_INI_RECV_LCP: case L2TP_AVP_LAST_SENT_LCP: case L2TP_AVP_LAST_RECV_LCP: case L2TP_AVP_PROXY_AUTH_CHAL: case L2TP_AVP_PROXY_AUTH_RESP: case L2TP_AVP_RANDOM_VECTOR: print_octets(ndo, (const u_char *)ptr, len-6); break; case L2TP_AVP_Q931_CC: l2tp_q931_cc_print(ndo, (const u_char *)ptr, len-6); break; case L2TP_AVP_CHALLENGE_RESP: print_octets(ndo, (const u_char *)ptr, 16); break; case L2TP_AVP_CALL_SER_NUM: case L2TP_AVP_MINIMUM_BPS: case L2TP_AVP_MAXIMUM_BPS: case L2TP_AVP_TX_CONN_SPEED: case L2TP_AVP_PHY_CHANNEL_ID: case L2TP_AVP_RX_CONN_SPEED: print_32bits_val(ndo, (const uint32_t *)ptr); break; case L2TP_AVP_BEARER_TYPE: l2tp_bearer_type_print(ndo, (const u_char *)ptr); break; case L2TP_AVP_FRAMING_TYPE: l2tp_framing_type_print(ndo, (const u_char *)ptr); break; case L2TP_AVP_PACKET_PROC_DELAY: l2tp_packet_proc_delay_print(ndo); break; case L2TP_AVP_PROXY_AUTH_TYPE: l2tp_proxy_auth_type_print(ndo, (const u_char *)ptr); break; case L2TP_AVP_PROXY_AUTH_ID: l2tp_proxy_auth_id_print(ndo, (const u_char *)ptr); break; case L2TP_AVP_CALL_ERRORS: l2tp_call_errors_print(ndo, (const u_char *)ptr); break; case L2TP_AVP_ACCM: l2tp_accm_print(ndo, (const u_char *)ptr); break; case L2TP_AVP_SEQ_REQUIRED: break; /* No Attribute Value */ case L2TP_AVP_PPP_DISCON_CC: l2tp_ppp_discon_cc_print(ndo, (const u_char *)ptr, len-6); break; default: break; } } ND_PRINT((ndo, ")")); } l2tp_avp_print(ndo, dat+len, length-len); return; trunc: ND_PRINT((ndo, "|...")); }
9,211
118,141
0
void WebContentsAndroid::HideTransitionElements(JNIEnv* env, jobject jobj, jstring css_selector) { web_contents_->GetMainFrame()->Send( new FrameMsg_HideTransitionElements( web_contents_->GetMainFrame()->GetRoutingID(), ConvertJavaStringToUTF8(env, css_selector))); }
9,212
80,438
0
GF_Err stbl_Write(GF_Box *s, GF_BitStream *bs) { GF_Err e; GF_SampleTableBox *ptr = (GF_SampleTableBox *)s; if (!s) return GF_BAD_PARAM; e = gf_isom_box_write_header(s, bs); if (e) return e; if (ptr->SampleDescription) { e = gf_isom_box_write((GF_Box *) ptr->SampleDescription, bs); if (e) return e; } if (ptr->TimeToSample) { e = gf_isom_box_write((GF_Box *) ptr->TimeToSample, bs); if (e) return e; } if (ptr->CompositionOffset) { e = gf_isom_box_write((GF_Box *) ptr->CompositionOffset, bs); if (e) return e; } if (ptr->CompositionToDecode) { e = gf_isom_box_write((GF_Box *) ptr->CompositionToDecode, bs); if (e) return e; } if (ptr->SyncSample) { e = gf_isom_box_write((GF_Box *) ptr->SyncSample, bs); if (e) return e; } if (ptr->ShadowSync) { e = gf_isom_box_write((GF_Box *) ptr->ShadowSync, bs); if (e) return e; } if (ptr->SampleToChunk) { e = gf_isom_box_write((GF_Box *) ptr->SampleToChunk, bs); if (e) return e; } if (ptr->SampleSize) { e = gf_isom_box_write((GF_Box *) ptr->SampleSize, bs); if (e) return e; } if (ptr->ChunkOffset) { e = gf_isom_box_write(ptr->ChunkOffset, bs); if (e) return e; } if (ptr->DegradationPriority) { e = gf_isom_box_write((GF_Box *) ptr->DegradationPriority, bs); if (e) return e; } if (ptr->SampleDep && ptr->SampleDep->sampleCount) { e = gf_isom_box_write((GF_Box *) ptr->SampleDep, bs); if (e) return e; } if (ptr->PaddingBits) { e = gf_isom_box_write((GF_Box *) ptr->PaddingBits, bs); if (e) return e; } if (ptr->sub_samples) { e = gf_isom_box_array_write(s, ptr->sub_samples, bs); if (e) return e; } if (ptr->sampleGroupsDescription) { e = gf_isom_box_array_write(s, ptr->sampleGroupsDescription, bs); if (e) return e; } if (ptr->sampleGroups) { e = gf_isom_box_array_write(s, ptr->sampleGroups, bs); if (e) return e; } if (ptr->sai_sizes) { e = gf_isom_box_array_write(s, ptr->sai_sizes, bs); if (e) return e; } if (ptr->sai_offsets) { e = gf_isom_box_array_write(s, ptr->sai_offsets, bs); if (e) return e; } #if WRITE_SAMPLE_FRAGMENTS if (ptr->Fragments) { e = gf_isom_box_write((GF_Box *) ptr->Fragments, bs); if (e) return e; } #endif return GF_OK; }
9,213
58,915
0
static void l2cap_add_conf_opt(void **ptr, u8 type, u8 len, unsigned long val) { struct l2cap_conf_opt *opt = *ptr; BT_DBG("type 0x%2.2x len %d val 0x%lx", type, len, val); opt->type = type; opt->len = len; switch (len) { case 1: *((u8 *) opt->val) = val; break; case 2: *((__le16 *) opt->val) = cpu_to_le16(val); break; case 4: *((__le32 *) opt->val) = cpu_to_le32(val); break; default: memcpy(opt->val, (void *) val, len); break; } *ptr += L2CAP_CONF_OPT_SIZE + len; }
9,214
96,863
0
pipe_poll(struct file *filp, poll_table *wait) { __poll_t mask; struct pipe_inode_info *pipe = filp->private_data; int nrbufs; poll_wait(filp, &pipe->wait, wait); /* Reading only -- no need for acquiring the semaphore. */ nrbufs = pipe->nrbufs; mask = 0; if (filp->f_mode & FMODE_READ) { mask = (nrbufs > 0) ? EPOLLIN | EPOLLRDNORM : 0; if (!pipe->writers && filp->f_version != pipe->w_counter) mask |= EPOLLHUP; } if (filp->f_mode & FMODE_WRITE) { mask |= (nrbufs < pipe->buffers) ? EPOLLOUT | EPOLLWRNORM : 0; /* * Most Unices do not set EPOLLERR for FIFOs but on Linux they * behave exactly like pipes for poll(). */ if (!pipe->readers) mask |= EPOLLERR; } return mask; }
9,215
171,451
0
static vpx_codec_err_t decoder_peek_si(const uint8_t *data, unsigned int data_sz, vpx_codec_stream_info_t *si) { return decoder_peek_si_internal(data, data_sz, si, NULL, NULL, NULL); }
9,216
55,103
0
static void parse_checkpoint(void) { checkpoint_requested = 1; skip_optional_lf(); }
9,217
186,940
1
void ImageCapture::SetMediaTrackConstraints( ScriptPromiseResolver* resolver, const HeapVector<MediaTrackConstraintSet>& constraints_vector) { DCHECK_GT(constraints_vector.size(), 0u); if (!service_) { resolver->Reject(DOMException::Create(kNotFoundError, kNoServiceError)); return; } // TODO(mcasas): add support more than one single advanced constraint. auto constraints = constraints_vector[0]; if ((constraints.hasWhiteBalanceMode() && !capabilities_.hasWhiteBalanceMode()) || (constraints.hasExposureMode() && !capabilities_.hasExposureMode()) || (constraints.hasFocusMode() && !capabilities_.hasFocusMode()) || (constraints.hasExposureCompensation() && !capabilities_.hasExposureCompensation()) || (constraints.hasColorTemperature() && !capabilities_.hasColorTemperature()) || (constraints.hasIso() && !capabilities_.hasIso()) || (constraints.hasBrightness() && !capabilities_.hasBrightness()) || (constraints.hasContrast() && !capabilities_.hasContrast()) || (constraints.hasSaturation() && !capabilities_.hasSaturation()) || (constraints.hasSharpness() && !capabilities_.hasSharpness()) || (constraints.hasZoom() && !capabilities_.hasZoom()) || (constraints.hasTorch() && !capabilities_.hasTorch())) { resolver->Reject( DOMException::Create(kNotSupportedError, "Unsupported constraint(s)")); return; } auto settings = media::mojom::blink::PhotoSettings::New(); MediaTrackConstraintSet temp_constraints = current_constraints_; // TODO(mcasas): support other Mode types beyond simple string i.e. the // equivalents of "sequence<DOMString>"" or "ConstrainDOMStringParameters". settings->has_white_balance_mode = constraints.hasWhiteBalanceMode() && constraints.whiteBalanceMode().IsString(); if (settings->has_white_balance_mode) { const auto white_balance_mode = constraints.whiteBalanceMode().GetAsString(); if (capabilities_.whiteBalanceMode().Find(white_balance_mode) == kNotFound) { resolver->Reject(DOMException::Create(kNotSupportedError, "Unsupported whiteBalanceMode.")); return; } temp_constraints.setWhiteBalanceMode(constraints.whiteBalanceMode()); settings->white_balance_mode = ParseMeteringMode(white_balance_mode); } settings->has_exposure_mode = constraints.hasExposureMode() && constraints.exposureMode().IsString(); if (settings->has_exposure_mode) { const auto exposure_mode = constraints.exposureMode().GetAsString(); if (capabilities_.exposureMode().Find(exposure_mode) == kNotFound) { resolver->Reject(DOMException::Create(kNotSupportedError, "Unsupported exposureMode.")); return; } temp_constraints.setExposureMode(constraints.exposureMode()); settings->exposure_mode = ParseMeteringMode(exposure_mode); } settings->has_focus_mode = constraints.hasFocusMode() && constraints.focusMode().IsString(); if (settings->has_focus_mode) { const auto focus_mode = constraints.focusMode().GetAsString(); if (capabilities_.focusMode().Find(focus_mode) == kNotFound) { resolver->Reject( DOMException::Create(kNotSupportedError, "Unsupported focusMode.")); return; } temp_constraints.setFocusMode(constraints.focusMode()); settings->focus_mode = ParseMeteringMode(focus_mode); } // TODO(mcasas): support ConstrainPoint2DParameters. if (constraints.hasPointsOfInterest() && constraints.pointsOfInterest().IsPoint2DSequence()) { for (const auto& point : constraints.pointsOfInterest().GetAsPoint2DSequence()) { auto mojo_point = media::mojom::blink::Point2D::New(); mojo_point->x = point.x(); mojo_point->y = point.y(); settings->points_of_interest.push_back(std::move(mojo_point)); } temp_constraints.setPointsOfInterest(constraints.pointsOfInterest()); } // TODO(mcasas): support ConstrainDoubleRange where applicable. settings->has_exposure_compensation = constraints.hasExposureCompensation() && constraints.exposureCompensation().IsDouble(); if (settings->has_exposure_compensation) { const auto exposure_compensation = constraints.exposureCompensation().GetAsDouble(); if (exposure_compensation < capabilities_.exposureCompensation()->min() || exposure_compensation > capabilities_.exposureCompensation()->max()) { resolver->Reject(DOMException::Create( kNotSupportedError, "exposureCompensation setting out of range")); return; } temp_constraints.setExposureCompensation( constraints.exposureCompensation()); settings->exposure_compensation = exposure_compensation; } settings->has_color_temperature = constraints.hasColorTemperature() && constraints.colorTemperature().IsDouble(); if (settings->has_color_temperature) { const auto color_temperature = constraints.colorTemperature().GetAsDouble(); if (color_temperature < capabilities_.colorTemperature()->min() || color_temperature > capabilities_.colorTemperature()->max()) { resolver->Reject(DOMException::Create( kNotSupportedError, "colorTemperature setting out of range")); return; } temp_constraints.setColorTemperature(constraints.colorTemperature()); settings->color_temperature = color_temperature; } settings->has_iso = constraints.hasIso() && constraints.iso().IsDouble(); if (settings->has_iso) { const auto iso = constraints.iso().GetAsDouble(); if (iso < capabilities_.iso()->min() || iso > capabilities_.iso()->max()) { resolver->Reject( DOMException::Create(kNotSupportedError, "iso setting out of range")); return; } temp_constraints.setIso(constraints.iso()); settings->iso = iso; } settings->has_brightness = constraints.hasBrightness() && constraints.brightness().IsDouble(); if (settings->has_brightness) { const auto brightness = constraints.brightness().GetAsDouble(); if (brightness < capabilities_.brightness()->min() || brightness > capabilities_.brightness()->max()) { resolver->Reject(DOMException::Create(kNotSupportedError, "brightness setting out of range")); return; } temp_constraints.setBrightness(constraints.brightness()); settings->brightness = brightness; } settings->has_contrast = constraints.hasContrast() && constraints.contrast().IsDouble(); if (settings->has_contrast) { const auto contrast = constraints.contrast().GetAsDouble(); if (contrast < capabilities_.contrast()->min() || contrast > capabilities_.contrast()->max()) { resolver->Reject(DOMException::Create(kNotSupportedError, "contrast setting out of range")); return; } temp_constraints.setContrast(constraints.contrast()); settings->contrast = contrast; } settings->has_saturation = constraints.hasSaturation() && constraints.saturation().IsDouble(); if (settings->has_saturation) { const auto saturation = constraints.saturation().GetAsDouble(); if (saturation < capabilities_.saturation()->min() || saturation > capabilities_.saturation()->max()) { resolver->Reject(DOMException::Create(kNotSupportedError, "saturation setting out of range")); return; } temp_constraints.setSaturation(constraints.saturation()); settings->saturation = saturation; } settings->has_sharpness = constraints.hasSharpness() && constraints.sharpness().IsDouble(); if (settings->has_sharpness) { const auto sharpness = constraints.sharpness().GetAsDouble(); if (sharpness < capabilities_.sharpness()->min() || sharpness > capabilities_.sharpness()->max()) { resolver->Reject(DOMException::Create(kNotSupportedError, "sharpness setting out of range")); return; } temp_constraints.setSharpness(constraints.sharpness()); settings->sharpness = sharpness; } settings->has_zoom = constraints.hasZoom() && constraints.zoom().IsDouble(); if (settings->has_zoom) { const auto zoom = constraints.zoom().GetAsDouble(); if (zoom < capabilities_.zoom()->min() || zoom > capabilities_.zoom()->max()) { resolver->Reject(DOMException::Create(kNotSupportedError, "zoom setting out of range")); return; } temp_constraints.setZoom(constraints.zoom()); settings->zoom = zoom; } // TODO(mcasas): support ConstrainBooleanParameters where applicable. settings->has_torch = constraints.hasTorch() && constraints.torch().IsBoolean(); if (settings->has_torch) { const auto torch = constraints.torch().GetAsBoolean(); if (torch && !capabilities_.torch()) { resolver->Reject( DOMException::Create(kNotSupportedError, "torch not supported")); return; } temp_constraints.setTorch(constraints.torch()); settings->torch = torch; } current_constraints_ = temp_constraints; service_requests_.insert(resolver); MediaTrackConstraints resolver_constraints; resolver_constraints.setAdvanced(constraints_vector); auto resolver_cb = WTF::Bind(&ImageCapture::ResolveWithMediaTrackConstraints, WrapPersistent(this), resolver_constraints); service_->SetOptions( stream_track_->Component()->Source()->Id(), std::move(settings), ConvertToBaseCallback(WTF::Bind( &ImageCapture::OnMojoSetOptions, WrapPersistent(this), WrapPersistent(resolver), WTF::Passed(std::move(resolver_cb)), false /* trigger_take_photo */))); }
9,218
59,744
0
static inline const char *plural(int n) { return (n == 1 ? "" : "s"); }
9,219
30,827
0
static void vcc_release_cb(struct sock *sk) { struct atm_vcc *vcc = atm_sk(sk); if (vcc->release_cb) vcc->release_cb(vcc); }
9,220
63,851
0
static void destroy_inodecache(void) { /* * Make sure all delayed rcu free inodes are flushed before we * destroy cache. */ rcu_barrier(); kmem_cache_destroy(f2fs_inode_cachep); }
9,221
22,257
0
static void copy_flags(unsigned long clone_flags, struct task_struct *p) { unsigned long new_flags = p->flags; new_flags &= ~(PF_SUPERPRIV | PF_WQ_WORKER); new_flags |= PF_FORKNOEXEC; new_flags |= PF_STARTING; p->flags = new_flags; clear_freeze_flag(p); }
9,222
158,672
0
bool GLES2DecoderImpl::DoBindOrCopyTexImageIfNeeded(Texture* texture, GLenum textarget, GLuint texture_unit) { if (texture && !texture->IsAttachedToFramebuffer()) { Texture::ImageState image_state; gl::GLImage* image = texture->GetLevelImage(textarget, 0, &image_state); if (image && image_state == Texture::UNBOUND) { ScopedGLErrorSuppressor suppressor( "GLES2DecoderImpl::DoBindOrCopyTexImageIfNeeded", GetErrorState()); if (texture_unit) api()->glActiveTextureFn(texture_unit); api()->glBindTextureFn(textarget, texture->service_id()); if (image->BindTexImage(textarget)) { image_state = Texture::BOUND; } else { DoCopyTexImage(texture, textarget, image); } if (!texture_unit) { RestoreCurrentTextureBindings(&state_, textarget, state_.active_texture_unit); return false; } return true; } } return false; }
9,223
38,656
0
static inline void tm_reclaim_task(struct task_struct *tsk) { /* We have to work out if we're switching from/to a task that's in the * middle of a transaction. * * In switching we need to maintain a 2nd register state as * oldtask->thread.ckpt_regs. We tm_reclaim(oldproc); this saves the * checkpointed (tbegin) state in ckpt_regs and saves the transactional * (current) FPRs into oldtask->thread.transact_fpr[]. * * We also context switch (save) TFHAR/TEXASR/TFIAR in here. */ struct thread_struct *thr = &tsk->thread; if (!thr->regs) return; if (!MSR_TM_ACTIVE(thr->regs->msr)) goto out_and_saveregs; /* Stash the original thread MSR, as giveup_fpu et al will * modify it. We hold onto it to see whether the task used * FP & vector regs. If the TIF_RESTORE_TM flag is set, * tm_orig_msr is already set. */ if (!test_ti_thread_flag(task_thread_info(tsk), TIF_RESTORE_TM)) thr->tm_orig_msr = thr->regs->msr; TM_DEBUG("--- tm_reclaim on pid %d (NIP=%lx, " "ccr=%lx, msr=%lx, trap=%lx)\n", tsk->pid, thr->regs->nip, thr->regs->ccr, thr->regs->msr, thr->regs->trap); tm_reclaim_thread(thr, task_thread_info(tsk), TM_CAUSE_RESCHED); TM_DEBUG("--- tm_reclaim on pid %d complete\n", tsk->pid); out_and_saveregs: /* Always save the regs here, even if a transaction's not active. * This context-switches a thread's TM info SPRs. We do it here to * be consistent with the restore path (in recheckpoint) which * cannot happen later in _switch(). */ tm_save_sprs(thr); }
9,224
118,866
0
void WebContentsImpl::DragSourceEndedAt(int client_x, int client_y, int screen_x, int screen_y, WebKit::WebDragOperation operation) { if (browser_plugin_embedder_.get()) browser_plugin_embedder_->DragSourceEndedAt(client_x, client_y, screen_x, screen_y, operation); if (GetRenderViewHost()) GetRenderViewHostImpl()->DragSourceEndedAt(client_x, client_y, screen_x, screen_y, operation); }
9,225
127,363
0
void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const AnimationEffect::CompositableValueMap& compositableValues) { ASSERT(RuntimeEnabledFeatures::webAnimationsCSSEnabled()); ASSERT(pass != VariableDefinitions); ASSERT(pass != AnimationProperties); for (AnimationEffect::CompositableValueMap::const_iterator iter = compositableValues.begin(); iter != compositableValues.end(); ++iter) { CSSPropertyID property = iter->key; if (!isPropertyForPass<pass>(property)) continue; ASSERT_WITH_MESSAGE(!iter->value->dependsOnUnderlyingValue(), "Web Animations not yet implemented: An interface for compositing onto the underlying value."); RefPtr<AnimatableValue> animatableValue = iter->value->compositeOnto(0); AnimatedStyleBuilder::applyProperty(property, state, animatableValue.get()); } }
9,226
35,179
0
int kill_pid_info_as_uid(int sig, struct siginfo *info, struct pid *pid, uid_t uid, uid_t euid, u32 secid) { int ret = -EINVAL; struct task_struct *p; const struct cred *pcred; unsigned long flags; if (!valid_signal(sig)) return ret; rcu_read_lock(); p = pid_task(pid, PIDTYPE_PID); if (!p) { ret = -ESRCH; goto out_unlock; } pcred = __task_cred(p); if (si_fromuser(info) && euid != pcred->suid && euid != pcred->uid && uid != pcred->suid && uid != pcred->uid) { ret = -EPERM; goto out_unlock; } ret = security_task_kill(p, info, sig, secid); if (ret) goto out_unlock; if (sig) { if (lock_task_sighand(p, &flags)) { ret = __send_signal(sig, info, p, 1, 0); unlock_task_sighand(p, &flags); } else ret = -ESRCH; } out_unlock: rcu_read_unlock(); return ret; }
9,227
126,610
0
void TabStripModel::AddSelectionFromAnchorTo(int index) { TabStripSelectionModel new_model; new_model.Copy(selection_model_); new_model.AddSelectionFromAnchorTo(index); SetSelection(new_model, NOTIFY_DEFAULT); }
9,228
157,783
0
WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() { RenderFrameHostImpl* rfh = static_cast<RenderFrameHostImpl*>( ShowingInterstitialPage() ? GetInterstitialPage()->GetMainFrame() : GetMainFrame()); return rfh ? rfh->GetOrCreateBrowserAccessibilityManager() : nullptr; }
9,229
11,543
0
char hexchar(int x) { static const char table[16] = "0123456789abcdef"; return table[x & 15]; }
9,230
30,903
0
static void free_arg_page(struct linux_binprm *bprm, int i) { }
9,231
77,987
0
static int32 TIFFReadPixels(TIFF *tiff,const tsample_t sample,const ssize_t row, tdata_t scanline) { int32 status; status=TIFFReadScanline(tiff,scanline,(uint32) row,sample); return(status); }
9,232
105,521
0
void webkit_web_view_set_zoom_level(WebKitWebView* webView, gfloat zoomLevel) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); webkit_web_view_apply_zoom_level(webView, zoomLevel); g_object_notify(G_OBJECT(webView), "zoom-level"); }
9,233
17,471
0
ProcXvQueryImageAttributes(ClientPtr client) { xvQueryImageAttributesReply rep; int size, num_planes, i; CARD16 width, height; XvImagePtr pImage = NULL; XvPortPtr pPort; int *offsets; int *pitches; int planeLength; REQUEST(xvQueryImageAttributesReq); REQUEST_SIZE_MATCH(xvQueryImageAttributesReq); VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess); for (i = 0; i < pPort->pAdaptor->nImages; i++) { if (pPort->pAdaptor->pImages[i].id == stuff->id) { pImage = &(pPort->pAdaptor->pImages[i]); break; } } #ifdef XvMCExtension if (!pImage) pImage = XvMCFindXvImage(pPort, stuff->id); #endif if (!pImage) return BadMatch; num_planes = pImage->num_planes; if (!(offsets = malloc(num_planes << 3))) return BadAlloc; pitches = offsets + num_planes; width = stuff->width; height = stuff->height; size = (*pPort->pAdaptor->ddQueryImageAttributes) (pPort, pImage, &width, &height, offsets, pitches); rep = (xvQueryImageAttributesReply) { .type = X_Reply, .sequenceNumber = client->sequence, .length = planeLength = num_planes << 1, .num_planes = num_planes, .width = width, .height = height, .data_size = size }; _WriteQueryImageAttributesReply(client, &rep); if (client->swapped) SwapLongs((CARD32 *) offsets, planeLength); WriteToClient(client, planeLength << 2, offsets); free(offsets); return Success; }
9,234
132,712
0
void ChromotingInstance::Disconnect() { DCHECK(plugin_task_runner_->BelongsToCurrentThread()); VLOG(0) << "Disconnecting from host."; mouse_input_filter_.set_input_stub(nullptr); client_.reset(); video_renderer_.reset(); }
9,235
12,866
0
int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key) { if (ctx->cipher->flags & EVP_CIPH_RAND_KEY) return EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_RAND_KEY, 0, key); if (RAND_bytes(key, ctx->key_len) <= 0) return 0; return 1; }
9,236
49,890
0
phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, char *path, int path_len, char dir, char **error, int security) /* {{{ */ { const char *pcr_error; phar_entry_info *entry; int is_dir; #ifdef PHP_WIN32 phar_unixify_path_separators(path, path_len); #endif is_dir = (path_len && (path[path_len - 1] == '/')) ? 1 : 0; if (error) { *error = NULL; } if (security && path_len >= sizeof(".phar")-1 && !memcmp(path, ".phar", sizeof(".phar")-1)) { if (error) { spprintf(error, 4096, "phar error: cannot directly access magic \".phar\" directory or files within it"); } return NULL; } if (!path_len && !dir) { if (error) { spprintf(error, 4096, "phar error: invalid path \"%s\" must not be empty", path); } return NULL; } if (phar_path_check(&path, &path_len, &pcr_error) > pcr_is_ok) { if (error) { spprintf(error, 4096, "phar error: invalid path \"%s\" contains %s", path, pcr_error); } return NULL; } if (!phar->manifest.u.flags) { return NULL; } if (is_dir) { if (!path_len || path_len == 1) { return NULL; } path_len--; } if (NULL != (entry = zend_hash_str_find_ptr(&phar->manifest, path, path_len))) { if (entry->is_deleted) { /* entry is deleted, but has not been flushed to disk yet */ return NULL; } if (entry->is_dir && !dir) { if (error) { spprintf(error, 4096, "phar error: path \"%s\" is a directory", path); } return NULL; } if (!entry->is_dir && dir == 2) { /* user requested a directory, we must return one */ if (error) { spprintf(error, 4096, "phar error: path \"%s\" exists and is a not a directory", path); } return NULL; } return entry; } if (dir) { if (zend_hash_str_exists(&phar->virtual_dirs, path, path_len)) { /* a file or directory exists in a sub-directory of this path */ entry = (phar_entry_info *) ecalloc(1, sizeof(phar_entry_info)); /* this next line tells PharFileInfo->__destruct() to efree the filename */ entry->is_temp_dir = entry->is_dir = 1; entry->filename = (char *) estrndup(path, path_len + 1); entry->filename_len = path_len; entry->phar = phar; return entry; } } if (phar->mounted_dirs.u.flags && zend_hash_num_elements(&phar->mounted_dirs)) { zend_string *str_key; ZEND_HASH_FOREACH_STR_KEY(&phar->mounted_dirs, str_key) { if ((int)ZSTR_LEN(str_key) >= path_len || strncmp(ZSTR_VAL(str_key), path, ZSTR_LEN(str_key))) { continue; } else { char *test; int test_len; php_stream_statbuf ssb; if (NULL == (entry = zend_hash_find_ptr(&phar->manifest, str_key))) { if (error) { spprintf(error, 4096, "phar internal error: mounted path \"%s\" could not be retrieved from manifest", ZSTR_VAL(str_key)); } return NULL; } if (!entry->tmp || !entry->is_mounted) { if (error) { spprintf(error, 4096, "phar internal error: mounted path \"%s\" is not properly initialized as a mounted path", ZSTR_VAL(str_key)); } return NULL; } test_len = spprintf(&test, MAXPATHLEN, "%s%s", entry->tmp, path + ZSTR_LEN(str_key)); if (SUCCESS != php_stream_stat_path(test, &ssb)) { efree(test); return NULL; } if (ssb.sb.st_mode & S_IFDIR && !dir) { efree(test); if (error) { spprintf(error, 4096, "phar error: path \"%s\" is a directory", path); } return NULL; } if ((ssb.sb.st_mode & S_IFDIR) == 0 && dir) { efree(test); /* user requested a directory, we must return one */ if (error) { spprintf(error, 4096, "phar error: path \"%s\" exists and is a not a directory", path); } return NULL; } /* mount the file just in time */ if (SUCCESS != phar_mount_entry(phar, test, test_len, path, path_len)) { efree(test); if (error) { spprintf(error, 4096, "phar error: path \"%s\" exists as file \"%s\" and could not be mounted", path, test); } return NULL; } efree(test); if (NULL == (entry = zend_hash_str_find_ptr(&phar->manifest, path, path_len))) { if (error) { spprintf(error, 4096, "phar error: path \"%s\" exists as file \"%s\" and could not be retrieved after being mounted", path, test); } return NULL; } return entry; } } ZEND_HASH_FOREACH_END(); } return NULL; } /* }}} */
9,237
61,750
0
int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *hp, const struct sk_buff *skb, unsigned int header_len) { struct scatterlist sg; const struct tcphdr *tp = tcp_hdr(skb); struct ahash_request *req = hp->md5_req; unsigned int i; const unsigned int head_data_len = skb_headlen(skb) > header_len ? skb_headlen(skb) - header_len : 0; const struct skb_shared_info *shi = skb_shinfo(skb); struct sk_buff *frag_iter; sg_init_table(&sg, 1); sg_set_buf(&sg, ((u8 *) tp) + header_len, head_data_len); ahash_request_set_crypt(req, &sg, NULL, head_data_len); if (crypto_ahash_update(req)) return 1; for (i = 0; i < shi->nr_frags; ++i) { const struct skb_frag_struct *f = &shi->frags[i]; unsigned int offset = f->page_offset; struct page *page = skb_frag_page(f) + (offset >> PAGE_SHIFT); sg_set_page(&sg, page, skb_frag_size(f), offset_in_page(offset)); ahash_request_set_crypt(req, &sg, NULL, skb_frag_size(f)); if (crypto_ahash_update(req)) return 1; } skb_walk_frags(skb, frag_iter) if (tcp_md5_hash_skb_data(hp, frag_iter, 0)) return 1; return 0; }
9,238
173,971
0
long long Chapters::Atom::GetStopTime(const Chapters* pChapters) const { return GetTime(pChapters, m_stop_timecode); }
9,239
105,174
0
bool ShadowRoot::hasInsertionPoint() const { for (Node* n = firstChild(); n; n = n->traverseNextNode(this)) { if (isInsertionPoint(n)) return true; } return false; }
9,240
44,472
0
static int create_cgroup(struct cgroup_mount_point *mp, const char *path) { return create_or_remove_cgroup(false, mp, path, false); }
9,241
106,492
0
void WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments) { RefPtr<APIObject> userData; WebContextUserMessageDecoder messageDecoder(userData, context()); if (!arguments->decode(messageDecoder)) return; WebFrameProxy* frame = process()->webFrame(frameID); MESSAGE_CHECK(frame); m_loaderClient.didFirstVisuallyNonEmptyLayoutForFrame(this, frame, userData.get()); }
9,242
156,485
0
void RenderFrameDevToolsAgentHost::UpdateFrameHost( RenderFrameHostImpl* frame_host) { if (frame_host == frame_host_) { if (frame_host && !render_frame_alive_) { render_frame_alive_ = true; for (auto* inspector : protocol::InspectorHandler::ForAgentHost(this)) inspector->TargetReloadedAfterCrash(); UpdateRendererChannel(IsAttached()); } return; } if (frame_host && !ShouldCreateDevToolsForHost(frame_host)) { DestroyOnRenderFrameGone(); return; } if (IsAttached()) RevokePolicy(); frame_host_ = frame_host; std::vector<DevToolsSession*> restricted_sessions; for (DevToolsSession* session : sessions()) { if (!ShouldAllowSession(session)) restricted_sessions.push_back(session); } if (!restricted_sessions.empty()) ForceDetachRestrictedSessions(restricted_sessions); if (!render_frame_alive_) { render_frame_alive_ = true; for (auto* inspector : protocol::InspectorHandler::ForAgentHost(this)) inspector->TargetReloadedAfterCrash(); } if (IsAttached()) GrantPolicy(); UpdateRendererChannel(IsAttached()); }
9,243
46,906
0
static void cast6_xts_dec(void *ctx, u128 *dst, const u128 *src, le128 *iv) { glue_xts_crypt_128bit_one(ctx, dst, src, iv, GLUE_FUNC_CAST(__cast6_decrypt)); }
9,244
25,548
0
asmlinkage void do_address_error(struct pt_regs *regs, unsigned long writeaccess, unsigned long address) { unsigned long error_code = 0; mm_segment_t oldfs; siginfo_t info; insn_size_t instruction; int tmp; /* Intentional ifdef */ #ifdef CONFIG_CPU_HAS_SR_RB error_code = lookup_exception_vector(); #endif oldfs = get_fs(); if (user_mode(regs)) { int si_code = BUS_ADRERR; unsigned int user_action; local_irq_enable(); inc_unaligned_user_access(); set_fs(USER_DS); if (copy_from_user(&instruction, (insn_size_t *)(regs->pc & ~1), sizeof(instruction))) { set_fs(oldfs); goto uspace_segv; } set_fs(oldfs); /* shout about userspace fixups */ unaligned_fixups_notify(current, instruction, regs); user_action = unaligned_user_action(); if (user_action & UM_FIXUP) goto fixup; if (user_action & UM_SIGNAL) goto uspace_segv; else { /* ignore */ regs->pc += instruction_size(instruction); return; } fixup: /* bad PC is not something we can fix */ if (regs->pc & 1) { si_code = BUS_ADRALN; goto uspace_segv; } set_fs(USER_DS); tmp = handle_unaligned_access(instruction, regs, &user_mem_access, 0, address); set_fs(oldfs); if (tmp == 0) return; /* sorted */ uspace_segv: printk(KERN_NOTICE "Sending SIGBUS to \"%s\" due to unaligned " "access (PC %lx PR %lx)\n", current->comm, regs->pc, regs->pr); info.si_signo = SIGBUS; info.si_errno = 0; info.si_code = si_code; info.si_addr = (void __user *)address; force_sig_info(SIGBUS, &info, current); } else { inc_unaligned_kernel_access(); if (regs->pc & 1) die("unaligned program counter", regs, error_code); set_fs(KERNEL_DS); if (copy_from_user(&instruction, (void __user *)(regs->pc), sizeof(instruction))) { /* Argh. Fault on the instruction itself. This should never happen non-SMP */ set_fs(oldfs); die("insn faulting in do_address_error", regs, 0); } unaligned_fixups_notify(current, instruction, regs); handle_unaligned_access(instruction, regs, &user_mem_access, 0, address); set_fs(oldfs); } }
9,245
143,199
0
bool Document::haveScriptBlockingStylesheetsLoaded() const { return m_styleEngine->haveScriptBlockingStylesheetsLoaded(); }
9,246
185,190
1
bool GDataDirectory::FromProto(const GDataDirectoryProto& proto) { DCHECK(proto.gdata_entry().file_info().is_directory()); DCHECK(!proto.gdata_entry().has_file_specific_info()); for (int i = 0; i < proto.child_files_size(); ++i) { scoped_ptr<GDataFile> file(new GDataFile(NULL, directory_service_)); if (!file->FromProto(proto.child_files(i))) { RemoveChildren(); return false; } AddEntry(file.release()); } for (int i = 0; i < proto.child_directories_size(); ++i) { scoped_ptr<GDataDirectory> dir(new GDataDirectory(NULL, directory_service_)); if (!dir->FromProto(proto.child_directories(i))) { RemoveChildren(); return false; } AddEntry(dir.release()); } // The states of the directory should be updated after children are // handled successfully, so that incomplete states are not left. if (!GDataEntry::FromProto(proto.gdata_entry())) return false; return true; }
9,247
16,207
0
GahpClient::gt4_gram_client_ping(const char * resource_contact) { static const char* command = "GT4_GRAM_PING"; if (server->m_commands_supported->contains_anycase(command)==FALSE) { return GAHPCLIENT_COMMAND_NOT_SUPPORTED; } if (!resource_contact) resource_contact=NULLSTRING; std::string reqline; int x = sprintf(reqline,"%s",escapeGahpString(resource_contact)); ASSERT( x > 0 ); const char *buf = reqline.c_str(); if ( !is_pending(command,buf) ) { if ( m_mode == results_only ) { return GAHPCLIENT_COMMAND_NOT_SUBMITTED; } now_pending(command,buf,normal_proxy); } Gahp_Args* result = get_pending_result(command,buf); if ( result ) { if (result->argc != 3) { EXCEPT("Bad %s Result",command); } int rc = atoi(result->argv[1]); if ( strcasecmp(result->argv[2], NULLSTRING) ) { error_string = result->argv[2]; } else { error_string = ""; } delete result; return rc; } if ( check_pending_timeout(command,buf) ) { sprintf( error_string, "%s timed out", command ); return GAHPCLIENT_COMMAND_TIMED_OUT; } return GAHPCLIENT_COMMAND_PENDING; }
9,248
26,648
0
static bool tomoyo_check_mount_acl(struct tomoyo_request_info *r, const struct tomoyo_acl_info *ptr) { const struct tomoyo_mount_acl *acl = container_of(ptr, typeof(*acl), head); return tomoyo_compare_number_union(r->param.mount.flags, &acl->flags) && tomoyo_compare_name_union(r->param.mount.type, &acl->fs_type) && tomoyo_compare_name_union(r->param.mount.dir, &acl->dir_name) && (!r->param.mount.need_dev || tomoyo_compare_name_union(r->param.mount.dev, &acl->dev_name)); }
9,249
37,629
0
static int handle_pause(struct kvm_vcpu *vcpu) { skip_emulated_instruction(vcpu); kvm_vcpu_on_spin(vcpu); return 1; }
9,250
170,862
0
status_t GraphicBuffer::lockYCbCr(uint32_t usage, const Rect& rect, android_ycbcr *ycbcr) { if (rect.left < 0 || rect.right > this->width || rect.top < 0 || rect.bottom > this->height) { ALOGE("locking pixels (%d,%d,%d,%d) outside of buffer (w=%d, h=%d)", rect.left, rect.top, rect.right, rect.bottom, this->width, this->height); return BAD_VALUE; } status_t res = getBufferMapper().lockYCbCr(handle, usage, rect, ycbcr); return res; }
9,251
125,702
0
void RenderViewHostImpl::RemoveObserver(RenderViewHostObserver* observer) { observers_.RemoveObserver(observer); }
9,252
118,385
0
AffiliationFetcher::~AffiliationFetcher() { }
9,253
124,482
0
void RenderBlock::addPercentHeightDescendant(RenderBox* descendant) { insertIntoTrackedRendererMaps(descendant, gPercentHeightDescendantsMap, gPercentHeightContainerMap); }
9,254
155,646
0
bool AuthenticatorTouchIdIncognitoBumpSheetModel::IsAcceptButtonVisible() const { return true; }
9,255
148,146
0
void V8TestObject::VoidMethodSequenceStringArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_voidMethodSequenceStringArg"); test_object_v8_internal::VoidMethodSequenceStringArgMethod(info); }
9,256
62,926
0
static int set_invariant_sys_reg(u64 id, void __user *uaddr) { struct sys_reg_params params; const struct sys_reg_desc *r; int err; u64 val = 0; /* Make sure high bits are 0 for 32-bit regs */ if (!index_to_params(id, &params)) return -ENOENT; r = find_reg(&params, invariant_sys_regs, ARRAY_SIZE(invariant_sys_regs)); if (!r) return -ENOENT; err = reg_from_user(&val, uaddr, id); if (err) return err; /* This is what we mean by invariant: you can't change it. */ if (r->val != val) return -EINVAL; return 0; }
9,257
68,183
0
packet_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen) { struct sock *sk = sock->sk; struct packet_sock *po = pkt_sk(sk); int ret; if (level != SOL_PACKET) return -ENOPROTOOPT; switch (optname) { case PACKET_ADD_MEMBERSHIP: case PACKET_DROP_MEMBERSHIP: { struct packet_mreq_max mreq; int len = optlen; memset(&mreq, 0, sizeof(mreq)); if (len < sizeof(struct packet_mreq)) return -EINVAL; if (len > sizeof(mreq)) len = sizeof(mreq); if (copy_from_user(&mreq, optval, len)) return -EFAULT; if (len < (mreq.mr_alen + offsetof(struct packet_mreq, mr_address))) return -EINVAL; if (optname == PACKET_ADD_MEMBERSHIP) ret = packet_mc_add(sk, &mreq); else ret = packet_mc_drop(sk, &mreq); return ret; } case PACKET_RX_RING: case PACKET_TX_RING: { union tpacket_req_u req_u; int len; switch (po->tp_version) { case TPACKET_V1: case TPACKET_V2: len = sizeof(req_u.req); break; case TPACKET_V3: default: len = sizeof(req_u.req3); break; } if (optlen < len) return -EINVAL; if (copy_from_user(&req_u.req, optval, len)) return -EFAULT; return packet_set_ring(sk, &req_u, 0, optname == PACKET_TX_RING); } case PACKET_COPY_THRESH: { int val; if (optlen != sizeof(val)) return -EINVAL; if (copy_from_user(&val, optval, sizeof(val))) return -EFAULT; pkt_sk(sk)->copy_thresh = val; return 0; } case PACKET_VERSION: { int val; if (optlen != sizeof(val)) return -EINVAL; if (copy_from_user(&val, optval, sizeof(val))) return -EFAULT; switch (val) { case TPACKET_V1: case TPACKET_V2: case TPACKET_V3: break; default: return -EINVAL; } lock_sock(sk); if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) { ret = -EBUSY; } else { po->tp_version = val; ret = 0; } release_sock(sk); return ret; } case PACKET_RESERVE: { unsigned int val; if (optlen != sizeof(val)) return -EINVAL; if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) return -EBUSY; if (copy_from_user(&val, optval, sizeof(val))) return -EFAULT; po->tp_reserve = val; return 0; } case PACKET_LOSS: { unsigned int val; if (optlen != sizeof(val)) return -EINVAL; if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) return -EBUSY; if (copy_from_user(&val, optval, sizeof(val))) return -EFAULT; po->tp_loss = !!val; return 0; } case PACKET_AUXDATA: { int val; if (optlen < sizeof(val)) return -EINVAL; if (copy_from_user(&val, optval, sizeof(val))) return -EFAULT; po->auxdata = !!val; return 0; } case PACKET_ORIGDEV: { int val; if (optlen < sizeof(val)) return -EINVAL; if (copy_from_user(&val, optval, sizeof(val))) return -EFAULT; po->origdev = !!val; return 0; } case PACKET_VNET_HDR: { int val; if (sock->type != SOCK_RAW) return -EINVAL; if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) return -EBUSY; if (optlen < sizeof(val)) return -EINVAL; if (copy_from_user(&val, optval, sizeof(val))) return -EFAULT; po->has_vnet_hdr = !!val; return 0; } case PACKET_TIMESTAMP: { int val; if (optlen != sizeof(val)) return -EINVAL; if (copy_from_user(&val, optval, sizeof(val))) return -EFAULT; po->tp_tstamp = val; return 0; } case PACKET_FANOUT: { int val; if (optlen != sizeof(val)) return -EINVAL; if (copy_from_user(&val, optval, sizeof(val))) return -EFAULT; return fanout_add(sk, val & 0xffff, val >> 16); } case PACKET_FANOUT_DATA: { if (!po->fanout) return -EINVAL; return fanout_set_data(po, optval, optlen); } case PACKET_TX_HAS_OFF: { unsigned int val; if (optlen != sizeof(val)) return -EINVAL; if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) return -EBUSY; if (copy_from_user(&val, optval, sizeof(val))) return -EFAULT; po->tp_tx_has_off = !!val; return 0; } case PACKET_QDISC_BYPASS: { int val; if (optlen != sizeof(val)) return -EINVAL; if (copy_from_user(&val, optval, sizeof(val))) return -EFAULT; po->xmit = val ? packet_direct_xmit : dev_queue_xmit; return 0; } default: return -ENOPROTOOPT; } }
9,258
129,498
0
ScopedTextureBinder::ScopedTextureBinder(ContextState* state, GLuint id, GLenum target) : state_(state), target_(target) { ScopedGLErrorSuppressor suppressor( "ScopedTextureBinder::ctor", state_->GetErrorState()); glActiveTexture(GL_TEXTURE0); glBindTexture(target, id); }
9,259
5,166
0
PHP_FUNCTION(pg_lo_seek) { zval *pgsql_id = NULL; zend_long result, offset = 0, whence = SEEK_CUR; pgLofp *pgsql; int argc = ZEND_NUM_ARGS(); if (zend_parse_parameters(argc, "rl|l", &pgsql_id, &offset, &whence) == FAILURE) { return; } if (whence != SEEK_SET && whence != SEEK_CUR && whence != SEEK_END) { php_error_docref(NULL, E_WARNING, "Invalid whence parameter"); return; } ZEND_FETCH_RESOURCE(pgsql, pgLofp *, pgsql_id, -1, "PostgreSQL large object", le_lofp); #if HAVE_PG_LO64 if (PQserverVersion((PGconn *)pgsql->conn) >= 90300) { result = lo_lseek64((PGconn *)pgsql->conn, pgsql->lofd, offset, (int)whence); } else { result = lo_lseek((PGconn *)pgsql->conn, pgsql->lofd, (int)offset, (int)whence); } #else result = lo_lseek((PGconn *)pgsql->conn, pgsql->lofd, offset, whence); #endif if (result > -1) { RETURN_TRUE; } else { RETURN_FALSE; } }
9,260
7,992
0
static VncBasicInfo *vnc_basic_info_get_from_server_addr(int fd) { struct sockaddr_storage sa; socklen_t salen; salen = sizeof(sa); if (getsockname(fd, (struct sockaddr*)&sa, &salen) < 0) { return NULL; } return vnc_basic_info_get(&sa, salen); }
9,261
163,425
0
RenderThreadImpl::PendingFrameCreate::~PendingFrameCreate() { }
9,262
73,328
0
static void calc_matrix(double mat[4][4], const double *mat_freq, const int *index) { for (int i = 0; i < 4; ++i) { mat[i][i] = mat_freq[2 * index[i]] + 3 * mat_freq[0] - 4 * mat_freq[index[i]]; for (int j = i + 1; j < 4; ++j) mat[i][j] = mat[j][i] = mat_freq[index[i] + index[j]] + mat_freq[index[j] - index[i]] + 2 * (mat_freq[0] - mat_freq[index[i]] - mat_freq[index[j]]); } for (int k = 0; k < 4; ++k) { int ip = k, jp = k; // pivot double z = 1 / mat[ip][jp]; mat[ip][jp] = 1; for (int i = 0; i < 4; ++i) { if (i == ip) continue; double mul = mat[i][jp] * z; mat[i][jp] = 0; for (int j = 0; j < 4; ++j) mat[i][j] -= mat[ip][j] * mul; } for (int j = 0; j < 4; ++j) mat[ip][j] *= z; } }
9,263
105,610
0
void DispatchCommand(Command* const command, const std::string& method, Response* response) { if (!command->Init(response)) return; if (method == "POST") { command->ExecutePost(response); } else if (method == "GET") { command->ExecuteGet(response); } else if (method == "DELETE") { command->ExecuteDelete(response); } else { NOTREACHED(); } }
9,264
93,789
0
virDomainFSInfoFree(virDomainFSInfoPtr info) { size_t i; if (!info) return; VIR_FREE(info->mountpoint); VIR_FREE(info->name); VIR_FREE(info->fstype); for (i = 0; i < info->ndevAlias; i++) VIR_FREE(info->devAlias[i]); VIR_FREE(info->devAlias); VIR_FREE(info); }
9,265
87,287
0
static MagickBooleanType TraceArc(MVGInfo *mvg_info,const PointInfo start, const PointInfo end,const PointInfo degrees) { PointInfo center, radius; center.x=0.5*(end.x+start.x); center.y=0.5*(end.y+start.y); radius.x=fabs(center.x-start.x); radius.y=fabs(center.y-start.y); return(TraceEllipse(mvg_info,center,radius,degrees)); }
9,266
107,950
0
void LinkInfoBar::Layout() { InfoBar::Layout(); gfx::Size icon_ps = icon_->GetPreferredSize(); icon_->SetBounds(kHorizontalPadding, OffsetY(this, icon_ps), icon_ps.width(), icon_ps.height()); int label_1_x = icon_->bounds().right() + kIconLabelSpacing; int available_width = GetAvailableWidth() - label_1_x; gfx::Size label_1_ps = label_1_->GetPreferredSize(); label_1_->SetBounds(label_1_x, OffsetY(this, label_1_ps), label_1_ps.width(), label_1_ps.height()); gfx::Size link_ps = link_->GetPreferredSize(); bool has_second_label = !label_2_->GetText().empty(); if (has_second_label) { link_->SetBounds(label_1_->bounds().right(), OffsetY(this, link_ps), link_ps.width(), link_ps.height()); } else { link_->SetBounds(label_1_x + available_width - link_ps.width(), OffsetY(this, link_ps), link_ps.width(), link_ps.height()); } gfx::Size label_2_ps = label_2_->GetPreferredSize(); label_2_->SetBounds(link_->bounds().right(), OffsetY(this, label_2_ps), label_2_ps.width(), label_2_ps.height()); }
9,267
29,367
0
static void SendATCommand(struct mp_port *mtpt) { unsigned char ch[] = {0x61,0x74,0x0d,0x0a,0x0}; unsigned char lineControl; unsigned char i=0; unsigned char Divisor = 0xc; lineControl = serial_inp(mtpt,UART_LCR); serial_outp(mtpt,UART_LCR,(lineControl | UART_LCR_DLAB)); serial_outp(mtpt,UART_DLL,(Divisor & 0xff)); serial_outp(mtpt,UART_DLM,(Divisor & 0xff00)>>8); //baudrate is 4800 serial_outp(mtpt,UART_LCR,lineControl); serial_outp(mtpt,UART_LCR,0x03); // N-8-1 serial_outp(mtpt,UART_FCR,7); serial_outp(mtpt,UART_MCR,0x3); while(ch[i]){ while((serial_inp(mtpt,UART_LSR) & 0x60) !=0x60){ ; } serial_outp(mtpt,0,ch[i++]); } }// end of SendATCommand()
9,268
182,822
1
do_prefetch_tables (const void *gcmM, size_t gcmM_size) { prefetch_table(gcmM, gcmM_size); prefetch_table(gcmR, sizeof(gcmR)); }
9,269
30,473
0
static void __exit rose_exit(void) { int i; remove_proc_entry("rose", init_net.proc_net); remove_proc_entry("rose_neigh", init_net.proc_net); remove_proc_entry("rose_nodes", init_net.proc_net); remove_proc_entry("rose_routes", init_net.proc_net); rose_loopback_clear(); rose_rt_free(); ax25_protocol_release(AX25_P_ROSE); ax25_linkfail_release(&rose_linkfail_notifier); if (ax25cmp(&rose_callsign, &null_ax25_address) != 0) ax25_listen_release(&rose_callsign, NULL); #ifdef CONFIG_SYSCTL rose_unregister_sysctl(); #endif unregister_netdevice_notifier(&rose_dev_notifier); sock_unregister(PF_ROSE); for (i = 0; i < rose_ndevs; i++) { struct net_device *dev = dev_rose[i]; if (dev) { unregister_netdev(dev); free_netdev(dev); } } kfree(dev_rose); proto_unregister(&rose_proto); }
9,270
140,237
0
void BluetoothRemoteGATTServer::ConnectCallback( ScriptPromiseResolver* resolver, mojom::blink::WebBluetoothResult result) { if (!resolver->getExecutionContext() || resolver->getExecutionContext()->isContextDestroyed()) return; if (result == mojom::blink::WebBluetoothResult::SUCCESS) { setConnected(true); resolver->resolve(this); } else { resolver->reject(BluetoothError::take(resolver, result)); } }
9,271
112,033
0
void CreateFolderInBob() { WriteTransaction trans(FROM_HERE, UNITTEST, directory()); MutableEntry bob(&trans, syncable::GET_BY_ID, GetOnlyEntryWithName(&trans, TestIdFactory::root(), "bob")); CHECK(bob.good()); MutableEntry entry2(&trans, syncable::CREATE, bob.Get(syncable::ID), "bob"); CHECK(entry2.good()); entry2.Put(syncable::IS_DIR, true); entry2.Put(syncable::IS_UNSYNCED, true); entry2.Put(syncable::SPECIFICS, DefaultBookmarkSpecifics()); }
9,272
62,274
0
is_ubik(uint32_t opcode) { if ((opcode >= VOTE_LOW && opcode <= VOTE_HIGH) || (opcode >= DISK_LOW && opcode <= DISK_HIGH)) return(1); else return(0); }
9,273
132,900
0
void RenderWidgetHostViewAura::AcceleratedSurfacePostSubBuffer( const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params_in_pixel, int gpu_host_id) { gfx::Rect damage_rect(params_in_pixel.x, params_in_pixel.y, params_in_pixel.width, params_in_pixel.height); BufferPresentedCallback ack_callback = base::Bind(&AcknowledgeBufferForGpu, params_in_pixel.route_id, gpu_host_id, params_in_pixel.mailbox_name); BuffersSwapped(params_in_pixel.surface_size, damage_rect, params_in_pixel.surface_scale_factor, params_in_pixel.mailbox_name, params_in_pixel.latency_info, ack_callback); }
9,274
133,369
0
void WindowTreeHostManager::PostDisplayConfigurationChange() { focus_activation_store_->Restore(); DisplayManager* display_manager = GetDisplayManager(); display::DisplayLayoutStore* layout_store = display_manager->layout_store(); if (display_manager->num_connected_displays() > 1) { display::DisplayIdList list = display_manager->GetCurrentDisplayIdList(); const display::DisplayLayout& layout = layout_store->GetRegisteredDisplayLayout(list); layout_store->UpdateMultiDisplayState( list, display_manager->IsInMirrorMode(), layout.default_unified); if (display::Screen::GetScreen()->GetNumDisplays() > 1) { SetPrimaryDisplayId(layout.primary_id == display::Display::kInvalidDisplayID ? list[0] : layout.primary_id); } } for (const display::Display& display : display_manager->active_display_list()) { bool output_is_secure = !display_manager->IsInMirrorMode() && display.IsInternal(); GetAshWindowTreeHostForDisplayId(display.id()) ->AsWindowTreeHost() ->compositor() ->SetOutputIsSecure(output_is_secure); } FOR_EACH_OBSERVER(Observer, observers_, OnDisplayConfigurationChanged()); UpdateMouseLocationAfterDisplayChange(); }
9,275
107,562
0
void ewk_view_mouse_link_hover_in(Evas_Object* ewkView, void* data) { evas_object_smart_callback_call(ewkView, "link,hover,in", data); }
9,276
123,524
0
BlobURLRequestJob::~BlobURLRequestJob() { STLDeleteValues(&index_to_reader_); }
9,277
175,398
0
int res_inverse(vorbis_dsp_state *vd,vorbis_info_residue *info, ogg_int32_t **in,int *nonzero,int ch){ int i,j,k,s,used=0; codec_setup_info *ci=(codec_setup_info *)vd->vi->codec_setup; codebook *phrasebook=ci->book_param+info->groupbook; int samples_per_partition=info->grouping; int partitions_per_word=phrasebook->dim; int pcmend=ci->blocksizes[vd->W]; if(info->type<2){ int max=pcmend>>1; int end=(info->end<max?info->end:max); int n=end-info->begin; if(n>0){ int partvals=n/samples_per_partition; int partwords=(partvals+partitions_per_word-1)/partitions_per_word; for(i=0;i<ch;i++) if(nonzero[i]) in[used++]=in[i]; ch=used; if(used){ char **partword=(char **)_ogg_calloc(ch,sizeof(*partword)); if(partword==NULL)goto cleanup1; for(j=0;j<ch;j++){ partword[j]=(char *)_ogg_malloc(partwords*partitions_per_word* sizeof(*partword[j])); if(partword[j]==NULL)goto cleanup1; } for(s=0;s<info->stages;s++){ for(i=0;i<partvals;){ if(s==0){ /* fetch the partition word for each channel */ partword[0][i+partitions_per_word-1]=1; for(k=partitions_per_word-2;k>=0;k--) partword[0][i+k]=partword[0][i+k+1]*info->partitions; for(j=1;j<ch;j++) for(k=partitions_per_word-1;k>=0;k--) partword[j][i+k]=partword[j-1][i+k]; for(j=0;j<ch;j++){ int temp=vorbis_book_decode(phrasebook,&vd->opb); if(temp==-1)goto cleanup1; /* this can be done quickly in assembly due to the quotient always being at most six bits */ for(k=0;k<partitions_per_word;k++){ ogg_uint32_t div=partword[j][i+k]; partword[j][i+k]= (div == 0) ? 0 : (temp / div); temp-=partword[j][i+k]*div; } } } /* now we decode residual values for the partitions */ for(k=0;k<partitions_per_word && i<partvals;k++,i++) for(j=0;j<ch;j++){ long offset=info->begin+i*samples_per_partition; int idx = (int)partword[j][i]; if(idx < info->partitions && info->stagemasks[idx]&(1<<s)){ codebook *stagebook=ci->book_param+ info->stagebooks[(partword[j][i]<<3)+s]; if(info->type){ if(vorbis_book_decodev_add(stagebook,in[j]+offset,&vd->opb, samples_per_partition,-8)==-1) goto cleanup1; }else{ if(vorbis_book_decodevs_add(stagebook,in[j]+offset,&vd->opb, samples_per_partition,-8)==-1) goto cleanup1; } } } } } cleanup1: if(partword){ for(j=0;j<ch;j++){ if(partword[j])_ogg_free(partword[j]); } _ogg_free(partword); } } } }else{ int max=(pcmend*ch)>>1; int end=(info->end<max?info->end:max); int n=end-info->begin; if(n>0){ int partvals=n/samples_per_partition; int partwords=(partvals+partitions_per_word-1)/partitions_per_word; char *partword= (char *)_ogg_malloc(partwords*partitions_per_word*sizeof(*partword)); if(partword==NULL)goto cleanup2; int beginoff=info->begin/ch; for(i=0;i<ch;i++)if(nonzero[i])break; if(i==ch)goto cleanup2; /* no nonzero vectors */ samples_per_partition/=ch; for(s=0;s<info->stages;s++){ for(i=0;i<partvals;){ if(s==0){ int temp; partword[i+partitions_per_word-1]=1; for(k=partitions_per_word-2;k>=0;k--) partword[i+k]=partword[i+k+1]*info->partitions; /* fetch the partition word */ temp=vorbis_book_decode(phrasebook,&vd->opb); if(temp==-1)goto cleanup2; /* this can be done quickly in assembly due to the quotient always being at most six bits */ for(k=0;k<partitions_per_word;k++){ ogg_uint32_t div=partword[i+k]; partword[i+k]= (div == 0) ? 0 : (temp / div); temp-=partword[i+k]*div; } } /* now we decode residual values for the partitions */ for(k=0;k<partitions_per_word && i<partvals;k++,i++){ if(partword[i] >= 0 && partword[i] < info->partitions && (info->stagemasks[(int)partword[i]] & (1 << s))){ codebook *stagebook=ci->book_param+ info->stagebooks[(partword[i]<<3)+s]; if(vorbis_book_decodevv_add(stagebook,in, i*samples_per_partition+beginoff,ch, &vd->opb, samples_per_partition,-8)==-1) goto cleanup2; } } } } cleanup2: if(partword)_ogg_free(partword); } } return 0; }
9,278
60,272
0
static int proc_keys_open(struct inode *inode, struct file *file) { return seq_open(file, &proc_keys_ops); }
9,279
43,127
0
static int vhost_scsi_release(struct inode *inode, struct file *f) { struct vhost_scsi *vs = f->private_data; struct vhost_scsi_target t; mutex_lock(&vs->dev.mutex); memcpy(t.vhost_wwpn, vs->vs_vhost_wwpn, sizeof(t.vhost_wwpn)); mutex_unlock(&vs->dev.mutex); vhost_scsi_clear_endpoint(vs, &t); vhost_dev_stop(&vs->dev); vhost_dev_cleanup(&vs->dev, false); /* Jobs can re-queue themselves in evt kick handler. Do extra flush. */ vhost_scsi_flush(vs); kfree(vs->dev.vqs); kvfree(vs); return 0; }
9,280
185,205
1
bool WebRtcAudioRenderer::Initialize(WebRtcAudioRendererSource* source) { base::AutoLock auto_lock(lock_); DCHECK_EQ(state_, UNINITIALIZED); DCHECK(source); DCHECK(!sink_); DCHECK(!source_); sink_ = AudioDeviceFactory::NewOutputDevice(); DCHECK(sink_); // Ask the browser for the default audio output hardware sample-rate. // This request is based on a synchronous IPC message. int sample_rate = GetAudioOutputSampleRate(); DVLOG(1) << "Audio output hardware sample rate: " << sample_rate; UMA_HISTOGRAM_ENUMERATION("WebRTC.AudioOutputSampleRate", sample_rate, media::kUnexpectedAudioSampleRate); // Verify that the reported output hardware sample rate is supported // on the current platform. if (std::find(&kValidOutputRates[0], &kValidOutputRates[0] + arraysize(kValidOutputRates), sample_rate) == &kValidOutputRates[arraysize(kValidOutputRates)]) { DLOG(ERROR) << sample_rate << " is not a supported output rate."; return false; } media::ChannelLayout channel_layout = media::CHANNEL_LAYOUT_STEREO; int buffer_size = 0; // Windows #if defined(OS_WIN) // Always use stereo rendering on Windows. channel_layout = media::CHANNEL_LAYOUT_STEREO; // Render side: AUDIO_PCM_LOW_LATENCY is based on the Core Audio (WASAPI) // API which was introduced in Windows Vista. For lower Windows versions, // a callback-driven Wave implementation is used instead. An output buffer // size of 10ms works well for WASAPI but 30ms is needed for Wave. // Use different buffer sizes depending on the current hardware sample rate. if (sample_rate == 96000 || sample_rate == 48000) { buffer_size = (sample_rate / 100); } else { // We do run at 44.1kHz at the actual audio layer, but ask for frames // at 44.0kHz to ensure that we can feed them to the webrtc::VoiceEngine. // TODO(henrika): figure out why we seem to need 20ms here for glitch- // free audio. buffer_size = 2 * 440; } // Windows XP and lower can't cope with 10 ms output buffer size. // It must be extended to 30 ms (60 ms will be used internally by WaveOut). // Note that we can't use media::CoreAudioUtil::IsSupported() here since it // tries to load the Audioses.dll and it will always fail in the render // process. if (base::win::GetVersion() < base::win::VERSION_VISTA) { buffer_size = 3 * buffer_size; DLOG(WARNING) << "Extending the output buffer size by a factor of three " << "since Windows XP has been detected."; } #elif defined(OS_MACOSX) channel_layout = media::CHANNEL_LAYOUT_MONO; // Render side: AUDIO_PCM_LOW_LATENCY on Mac OS X is based on a callback- // driven Core Audio implementation. Tests have shown that 10ms is a suitable // frame size to use, both for 48kHz and 44.1kHz. // Use different buffer sizes depending on the current hardware sample rate. if (sample_rate == 48000) { buffer_size = 480; } else { // We do run at 44.1kHz at the actual audio layer, but ask for frames // at 44.0kHz to ensure that we can feed them to the webrtc::VoiceEngine. buffer_size = 440; } #elif defined(OS_LINUX) || defined(OS_OPENBSD) channel_layout = media::CHANNEL_LAYOUT_MONO; // Based on tests using the current ALSA implementation in Chrome, we have // found that 10ms buffer size on the output side works fine. buffer_size = 480; #else DLOG(ERROR) << "Unsupported platform"; return false; #endif // Store utilized parameters to ensure that we can check them // after a successful initialization. params_.Reset(media::AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, sample_rate, 16, buffer_size); // Allocate local audio buffers based on the parameters above. // It is assumed that each audio sample contains 16 bits and each // audio frame contains one or two audio samples depending on the // number of channels. buffer_.reset(new int16[params_.frames_per_buffer() * params_.channels()]); source_ = source; source->SetRenderFormat(params_); // Configure the audio rendering client and start the rendering. sink_->Initialize(params_, this); sink_->SetSourceRenderView(source_render_view_id_); sink_->Start(); state_ = PAUSED; UMA_HISTOGRAM_ENUMERATION("WebRTC.AudioOutputChannelLayout", channel_layout, media::CHANNEL_LAYOUT_MAX); UMA_HISTOGRAM_ENUMERATION("WebRTC.AudioOutputFramesPerBuffer", buffer_size, kUnexpectedAudioBufferSize); AddHistogramFramesPerBuffer(buffer_size); return true; }
9,281
51,653
0
static void airspy_cleanup_queued_bufs(struct airspy *s) { unsigned long flags; dev_dbg(s->dev, "\n"); spin_lock_irqsave(&s->queued_bufs_lock, flags); while (!list_empty(&s->queued_bufs)) { struct airspy_frame_buf *buf; buf = list_entry(s->queued_bufs.next, struct airspy_frame_buf, list); list_del(&buf->list); vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); } spin_unlock_irqrestore(&s->queued_bufs_lock, flags); }
9,282
98,537
0
void AutomationProvider::PrintAsync(int tab_handle) { NOTIMPLEMENTED(); }
9,283
185,659
1
WebsiteSettings* website_settings() { if (!website_settings_.get()) { website_settings_.reset(new WebsiteSettings( mock_ui(), profile(), tab_specific_content_settings(), infobar_service(), url(), ssl(), cert_store())); } return website_settings_.get(); }
9,284
102,547
0
virtual void RunWork() { if (!file_util::PathExists(file_path_)) { set_error_code(base::PLATFORM_FILE_ERROR_NOT_FOUND); return; } if (!file_util::Delete(file_path_, recursive_)) { if (!recursive_ && !file_util::IsDirectoryEmpty(file_path_)) { set_error_code(base::PLATFORM_FILE_ERROR_NOT_EMPTY); return; } set_error_code(base::PLATFORM_FILE_ERROR_FAILED); } }
9,285
76,698
0
static void t1_mark_glyphs(void) { char *glyph; struct avl_traverser t; cs_entry *ptr; if (t1_synthetic || fd_cur->all_glyphs) { /*tex Mark everything. */ if (cs_tab != NULL) for (ptr = cs_tab; ptr < cs_ptr; ptr++) if (ptr->valid) ptr->used = true; if (subr_tab != NULL) { for (ptr = subr_tab; ptr - subr_tab < subr_size; ptr++) if (ptr->valid) ptr->used = true; subr_max = subr_size - 1; } return; } mark_cs(notdef); avl_t_init(&t, fd_cur->gl_tree); for (glyph = (char *) avl_t_first(&t, fd_cur->gl_tree); glyph != NULL; glyph = (char *) avl_t_next(&t)) { mark_cs(glyph); } if (subr_tab != NULL) for (subr_max = -1, ptr = subr_tab; ptr - subr_tab < subr_size; ptr++) if (ptr->used && ptr - subr_tab > subr_max) subr_max = (int) (ptr - subr_tab); }
9,286
10,318
0
gray_split_cubic( FT_Vector* base ) { TPos a, b, c, d; base[6].x = base[3].x; c = base[1].x; d = base[2].x; base[1].x = a = ( base[0].x + c ) / 2; base[5].x = b = ( base[3].x + d ) / 2; c = ( c + d ) / 2; base[2].x = a = ( a + c ) / 2; base[4].x = b = ( b + c ) / 2; base[3].x = ( a + b ) / 2; base[6].y = base[3].y; c = base[1].y; d = base[2].y; base[1].y = a = ( base[0].y + c ) / 2; base[5].y = b = ( base[3].y + d ) / 2; c = ( c + d ) / 2; base[2].y = a = ( a + c ) / 2; base[4].y = b = ( b + c ) / 2; base[3].y = ( a + b ) / 2; }
9,287
106,654
0
bool WebPageProxy::supportsTextEncoding() const { return !m_mainFrameHasCustomRepresentation && m_mainFrame && !m_mainFrame->isDisplayingStandaloneImageDocument(); }
9,288
6,280
0
PHP_FUNCTION(strftime) { php_strftime(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); }
9,289
64,860
0
IW_IMPL(int) iw_write_bmp_file(struct iw_context *ctx, struct iw_iodescr *iodescr) { struct iwbmpwcontext wctx; int retval=0; struct iw_image img1; iw_zeromem(&img1,sizeof(struct iw_image)); iw_zeromem(&wctx,sizeof(struct iwbmpwcontext)); wctx.ctx = ctx; wctx.include_file_header = 1; wctx.iodescr=iodescr; iw_get_output_image(ctx,&img1); wctx.img = &img1; if(wctx.img->imgtype==IW_IMGTYPE_PALETTE) { wctx.pal = iw_get_output_palette(ctx); if(!wctx.pal) goto done; } iw_get_output_colorspace(ctx,&wctx.csdescr); if(!iwbmp_write_main(&wctx)) { iw_set_error(ctx,"BMP write failed"); goto done; } retval=1; done: return retval; }
9,290
53,723
0
static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) { struct ipv6_pinfo *np = inet6_sk(sk); struct tcp_sock *tp; struct sk_buff *opt_skb = NULL; /* Imagine: socket is IPv6. IPv4 packet arrives, goes to IPv4 receive handler and backlogged. From backlog it always goes here. Kerboom... Fortunately, tcp_rcv_established and rcv_established handle them correctly, but it is not case with tcp_v6_hnd_req and tcp_v6_send_reset(). --ANK */ if (skb->protocol == htons(ETH_P_IP)) return tcp_v4_do_rcv(sk, skb); if (sk_filter(sk, skb)) goto discard; /* * socket locking is here for SMP purposes as backlog rcv * is currently called with bh processing disabled. */ /* Do Stevens' IPV6_PKTOPTIONS. Yes, guys, it is the only place in our code, where we may make it not affecting IPv4. The rest of code is protocol independent, and I do not like idea to uglify IPv4. Actually, all the idea behind IPV6_PKTOPTIONS looks not very well thought. For now we latch options, received in the last packet, enqueued by tcp. Feel free to propose better solution. --ANK (980728) */ if (np->rxopt.all) opt_skb = skb_clone(skb, sk_gfp_atomic(sk, GFP_ATOMIC)); if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */ struct dst_entry *dst = sk->sk_rx_dst; sock_rps_save_rxhash(sk, skb); sk_mark_napi_id(sk, skb); if (dst) { if (inet_sk(sk)->rx_dst_ifindex != skb->skb_iif || dst->ops->check(dst, np->rx_dst_cookie) == NULL) { dst_release(dst); sk->sk_rx_dst = NULL; } } tcp_rcv_established(sk, skb, tcp_hdr(skb), skb->len); if (opt_skb) goto ipv6_pktoptions; return 0; } if (tcp_checksum_complete(skb)) goto csum_err; if (sk->sk_state == TCP_LISTEN) { struct sock *nsk = tcp_v6_cookie_check(sk, skb); if (!nsk) goto discard; if (nsk != sk) { sock_rps_save_rxhash(nsk, skb); sk_mark_napi_id(nsk, skb); if (tcp_child_process(sk, nsk, skb)) goto reset; if (opt_skb) __kfree_skb(opt_skb); return 0; } } else sock_rps_save_rxhash(sk, skb); if (tcp_rcv_state_process(sk, skb)) goto reset; if (opt_skb) goto ipv6_pktoptions; return 0; reset: tcp_v6_send_reset(sk, skb); discard: if (opt_skb) __kfree_skb(opt_skb); kfree_skb(skb); return 0; csum_err: TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_CSUMERRORS); TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_INERRS); goto discard; ipv6_pktoptions: /* Do you ask, what is it? 1. skb was enqueued by tcp. 2. skb is added to tail of read queue, rather than out of order. 3. socket is not in passive state. 4. Finally, it really contains options, which user wants to receive. */ tp = tcp_sk(sk); if (TCP_SKB_CB(opt_skb)->end_seq == tp->rcv_nxt && !((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN))) { if (np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo) np->mcast_oif = tcp_v6_iif(opt_skb); if (np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim) np->mcast_hops = ipv6_hdr(opt_skb)->hop_limit; if (np->rxopt.bits.rxflow || np->rxopt.bits.rxtclass) np->rcv_flowinfo = ip6_flowinfo(ipv6_hdr(opt_skb)); if (np->repflow) np->flow_label = ip6_flowlabel(ipv6_hdr(opt_skb)); if (ipv6_opt_accepted(sk, opt_skb, &TCP_SKB_CB(opt_skb)->header.h6)) { skb_set_owner_r(opt_skb, sk); opt_skb = xchg(&np->pktoptions, opt_skb); } else { __kfree_skb(opt_skb); opt_skb = xchg(&np->pktoptions, NULL); } } kfree_skb(opt_skb); return 0; }
9,291
89,253
0
static int residue_decode(vorb *f, Codebook *book, float *target, int offset, int n, int rtype) { int k; if (rtype == 0) { int step = n / book->dimensions; for (k=0; k < step; ++k) if (!codebook_decode_step(f, book, target+offset+k, n-offset-k, step)) return FALSE; } else { for (k=0; k < n; ) { if (!codebook_decode(f, book, target+offset, n-k)) return FALSE; k += book->dimensions; offset += book->dimensions; } } return TRUE; }
9,292
178,183
1
get_caller_uid (GDBusMethodInvocation *context, gint *uid) { PolkitSubject *subject; PolkitSubject *process; subject = polkit_system_bus_name_new (g_dbus_method_invocation_get_sender (context)); process = polkit_system_bus_name_get_process_sync (POLKIT_SYSTEM_BUS_NAME (subject), NULL, NULL); if (!process) { g_object_unref (subject); return FALSE; } *uid = polkit_unix_process_get_uid (POLKIT_UNIX_PROCESS (process)); g_object_unref (subject); g_object_unref (process); return TRUE; }
9,293
1,668
0
gx_dc_colored_masked_get_dev_halftone(const gx_device_color * pdevc) { return pdevc->colors.colored.c_ht; }
9,294
61,436
0
static int mov_read_fiel(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; unsigned mov_field_order; enum AVFieldOrder decoded_field_order = AV_FIELD_UNKNOWN; if (c->fc->nb_streams < 1) // will happen with jp2 files return 0; st = c->fc->streams[c->fc->nb_streams-1]; if (atom.size < 2) return AVERROR_INVALIDDATA; mov_field_order = avio_rb16(pb); if ((mov_field_order & 0xFF00) == 0x0100) decoded_field_order = AV_FIELD_PROGRESSIVE; else if ((mov_field_order & 0xFF00) == 0x0200) { switch (mov_field_order & 0xFF) { case 0x01: decoded_field_order = AV_FIELD_TT; break; case 0x06: decoded_field_order = AV_FIELD_BB; break; case 0x09: decoded_field_order = AV_FIELD_TB; break; case 0x0E: decoded_field_order = AV_FIELD_BT; break; } } if (decoded_field_order == AV_FIELD_UNKNOWN && mov_field_order) { av_log(NULL, AV_LOG_ERROR, "Unknown MOV field order 0x%04x\n", mov_field_order); } st->codecpar->field_order = decoded_field_order; return 0; }
9,295
45,158
0
static char *req_uri_field(request_rec *r) { return r->uri; }
9,296
100,254
0
NetworkLibrary* NetworkLibrary::GetImpl(bool stub) { if (stub) return new NetworkLibraryStubImpl(); else return new NetworkLibraryImpl(); }
9,297
25,422
0
void *set_vi_handler(int n, vi_handler_t addr) { return set_vi_srs_handler(n, addr, 0); }
9,298
48,070
0
static bool nested_host_cr0_valid(struct kvm_vcpu *vcpu, unsigned long val) { u64 fixed0 = to_vmx(vcpu)->nested.nested_vmx_cr0_fixed0; u64 fixed1 = to_vmx(vcpu)->nested.nested_vmx_cr0_fixed1; return fixed_bits_valid(val, fixed0, fixed1); }
9,299