unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
161,228 | 0 | void DevToolsSession::InspectElement(const gfx::Point& point) {
if (session_ptr_)
session_ptr_->InspectElement(point);
}
| 18,400 |
7,274 | 0 | static int sapi_fcgi_read_post(char *buffer, uint count_bytes TSRMLS_DC)
{
uint read_bytes = 0;
int tmp_read_bytes;
fcgi_request *request = (fcgi_request*) SG(server_context);
count_bytes = MIN(count_bytes, (uint) SG(request_info).content_length - SG(read_post_bytes));
while (read_bytes < count_bytes) {
tmp_read_bytes = fcgi_read(request, buffer + read_bytes, count_bytes - read_bytes);
if (tmp_read_bytes <= 0) {
break;
}
read_bytes += tmp_read_bytes;
}
return read_bytes;
}
| 18,401 |
105,339 | 0 | void AutofillManager::ImportFormData(const FormStructure& submitted_form) {
const CreditCard* imported_credit_card;
if (!personal_data_->ImportFormData(submitted_form, &imported_credit_card))
return;
scoped_ptr<const CreditCard> scoped_credit_card(imported_credit_card);
if (imported_credit_card && tab_contents()) {
tab_contents_wrapper_->AddInfoBar(
new AutofillCCInfoBarDelegate(tab_contents(),
scoped_credit_card.release(),
personal_data_,
metric_logger_.get()));
}
}
| 18,402 |
174,061 | 0 | int main(int argc, char **argv)
{
i32 instCount, instRunning;
i32 i;
u32 maxNumPics;
u32 strmLen;
H264SwDecRet ret;
u32 numErrors = 0;
u32 cropDisplay = 0;
u32 disableOutputReordering = 0;
FILE *finput;
Decoder **decoder;
char outFileName[256] = "out.yuv";
if ( argc > 1 && strcmp(argv[1], "-T") == 0 )
{
fprintf(stderr, "%s\n", tagName);
return 0;
}
if (argc < 2)
{
DEBUG((
"Usage: %s [-Nn] [-Ooutfile] [-P] [-U] [-C] [-R] [-T] file1.264 [file2.264] .. [fileN.264]\n",
argv[0]));
DEBUG(("\t-Nn forces decoding to stop after n pictures\n"));
#if defined(_NO_OUT)
DEBUG(("\t-Ooutfile output writing disabled at compile time\n"));
#else
DEBUG(("\t-Ooutfile write output to \"outfile\" (default out.yuv)\n"));
DEBUG(("\t-Onone does not write output\n"));
#endif
DEBUG(("\t-C display cropped image (default decoded image)\n"));
DEBUG(("\t-R disable DPB output reordering\n"));
DEBUG(("\t-T to print tag name and exit\n"));
exit(100);
}
instCount = argc - 1;
/* read command line arguments */
maxNumPics = 0;
for (i = 1; i < (argc-1); i++)
{
if ( strncmp(argv[i], "-N", 2) == 0 )
{
maxNumPics = (u32)atoi(argv[i]+2);
instCount--;
}
else if ( strncmp(argv[i], "-O", 2) == 0 )
{
strcpy(outFileName, argv[i]+2);
instCount--;
}
else if ( strcmp(argv[i], "-C") == 0 )
{
cropDisplay = 1;
instCount--;
}
else if ( strcmp(argv[i], "-R") == 0 )
{
disableOutputReordering = 1;
instCount--;
}
}
if (instCount < 1)
{
DEBUG(("No input files\n"));
exit(100);
}
/* allocate memory for multiple decoder instances
* one instance for every stream file */
decoder = (Decoder **)malloc(sizeof(Decoder*)*(u32)instCount);
if (decoder == NULL)
{
DEBUG(("Unable to allocate memory\n"));
exit(100);
}
/* prepare each decoder instance */
for (i = 0; i < instCount; i++)
{
decoder[i] = (Decoder *)calloc(1, sizeof(Decoder));
/* open input file */
finput = fopen(argv[argc-instCount+i],"rb");
if (finput == NULL)
{
DEBUG(("Unable to open input file <%s>\n", argv[argc-instCount+i]));
exit(100);
}
DEBUG(("Reading input file[%d] %s\n", i, argv[argc-instCount+i]));
/* read input stream to buffer */
fseek(finput,0L,SEEK_END);
strmLen = (u32)ftell(finput);
rewind(finput);
decoder[i]->byteStrmStart = (u8 *)malloc(sizeof(u8)*strmLen);
if (decoder[i]->byteStrmStart == NULL)
{
DEBUG(("Unable to allocate memory\n"));
exit(100);
}
fread(decoder[i]->byteStrmStart, sizeof(u8), strmLen, finput);
fclose(finput);
/* open output file */
if (strcmp(outFileName, "none") != 0)
{
#if defined(_NO_OUT)
decoder[i]->foutput = NULL;
#else
sprintf(decoder[i]->outFileName, "%s%i", outFileName, i);
decoder[i]->foutput = fopen(decoder[i]->outFileName, "wb");
if (decoder[i]->foutput == NULL)
{
DEBUG(("Unable to open output file\n"));
exit(100);
}
#endif
}
ret = H264SwDecInit(&(decoder[i]->decInst), disableOutputReordering);
if (ret != H264SWDEC_OK)
{
DEBUG(("Init failed %d\n", ret));
exit(100);
}
decoder[i]->decInput.pStream = decoder[i]->byteStrmStart;
decoder[i]->decInput.dataLen = strmLen;
decoder[i]->decInput.intraConcealmentMethod = 0;
}
/* main decoding loop */
do
{
/* decode once using each instance */
for (i = 0; i < instCount; i++)
{
ret = H264SwDecDecode(decoder[i]->decInst,
&(decoder[i]->decInput),
&(decoder[i]->decOutput));
switch(ret)
{
case H264SWDEC_HDRS_RDY_BUFF_NOT_EMPTY:
ret = H264SwDecGetInfo(decoder[i]->decInst,
&(decoder[i]->decInfo));
if (ret != H264SWDEC_OK)
exit(1);
if (cropDisplay && decoder[i]->decInfo.croppingFlag)
{
DEBUG(("Decoder[%d] Cropping params: (%d, %d) %dx%d\n",
i,
decoder[i]->decInfo.cropParams.cropLeftOffset,
decoder[i]->decInfo.cropParams.cropTopOffset,
decoder[i]->decInfo.cropParams.cropOutWidth,
decoder[i]->decInfo.cropParams.cropOutHeight));
}
DEBUG(("Decoder[%d] Width %d Height %d\n", i,
decoder[i]->decInfo.picWidth,
decoder[i]->decInfo.picHeight));
DEBUG(("Decoder[%d] videoRange %d, matricCoefficients %d\n",
i, decoder[i]->decInfo.videoRange,
decoder[i]->decInfo.matrixCoefficients));
decoder[i]->decInput.dataLen -=
(u32)(decoder[i]->decOutput.pStrmCurrPos -
decoder[i]->decInput.pStream);
decoder[i]->decInput.pStream =
decoder[i]->decOutput.pStrmCurrPos;
break;
case H264SWDEC_PIC_RDY_BUFF_NOT_EMPTY:
decoder[i]->decInput.dataLen -=
(u32)(decoder[i]->decOutput.pStrmCurrPos -
decoder[i]->decInput.pStream);
decoder[i]->decInput.pStream =
decoder[i]->decOutput.pStrmCurrPos;
/* fall through */
case H264SWDEC_PIC_RDY:
if (ret == H264SWDEC_PIC_RDY)
decoder[i]->decInput.dataLen = 0;
ret = H264SwDecGetInfo(decoder[i]->decInst,
&(decoder[i]->decInfo));
if (ret != H264SWDEC_OK)
exit(1);
while (H264SwDecNextPicture(decoder[i]->decInst,
&(decoder[i]->decPicture), 0) == H264SWDEC_PIC_RDY)
{
decoder[i]->picNumber++;
numErrors += decoder[i]->decPicture.nbrOfErrMBs;
DEBUG(("Decoder[%d] PIC %d, type %s, concealed %d\n",
i, decoder[i]->picNumber,
decoder[i]->decPicture.isIdrPicture
? "IDR" : "NON-IDR",
decoder[i]->decPicture.nbrOfErrMBs));
fflush(stdout);
CropWriteOutput(decoder[i]->foutput,
(u8*)decoder[i]->decPicture.pOutputPicture,
cropDisplay, &(decoder[i]->decInfo));
}
if (maxNumPics && decoder[i]->picNumber == maxNumPics)
decoder[i]->decInput.dataLen = 0;
break;
case H264SWDEC_STRM_PROCESSED:
case H264SWDEC_STRM_ERR:
case H264SWDEC_PARAM_ERR:
decoder[i]->decInput.dataLen = 0;
break;
default:
DEBUG(("Decoder[%d] FATAL ERROR\n", i));
exit(10);
break;
}
}
/* check if any of the instances is still running (=has more data) */
instRunning = instCount;
for (i = 0; i < instCount; i++)
{
if (decoder[i]->decInput.dataLen == 0)
instRunning--;
}
} while (instRunning);
/* get last frames and close each instance */
for (i = 0; i < instCount; i++)
{
while (H264SwDecNextPicture(decoder[i]->decInst,
&(decoder[i]->decPicture), 1) == H264SWDEC_PIC_RDY)
{
decoder[i]->picNumber++;
DEBUG(("Decoder[%d] PIC %d, type %s, concealed %d\n",
i, decoder[i]->picNumber,
decoder[i]->decPicture.isIdrPicture
? "IDR" : "NON-IDR",
decoder[i]->decPicture.nbrOfErrMBs));
fflush(stdout);
CropWriteOutput(decoder[i]->foutput,
(u8*)decoder[i]->decPicture.pOutputPicture,
cropDisplay, &(decoder[i]->decInfo));
}
H264SwDecRelease(decoder[i]->decInst);
if (decoder[i]->foutput)
fclose(decoder[i]->foutput);
free(decoder[i]->byteStrmStart);
free(decoder[i]);
}
free(decoder);
if (numErrors)
return 1;
else
return 0;
}
| 18,403 |
142,021 | 0 | void TheMethod() {}
| 18,404 |
148,401 | 0 | void WebContentsImpl::GetNFC(device::mojom::NFCRequest request) {
if (!nfc_host_)
nfc_host_.reset(new NFCHost(this));
nfc_host_->GetNFC(std::move(request));
}
| 18,405 |
169,199 | 0 | RenderFrameHost* ConvertToRenderFrameHost(WebContents* web_contents) {
return web_contents->GetMainFrame();
}
| 18,406 |
188,496 | 1 | int main(int argc, char **argv) {
int frame_cnt = 0;
FILE *outfile = NULL;
vpx_codec_ctx_t codec;
VpxVideoReader *reader = NULL;
const VpxVideoInfo *info = NULL;
const VpxInterface *decoder = NULL;
exec_name = argv[0];
if (argc != 3)
die("Invalid number of arguments.");
reader = vpx_video_reader_open(argv[1]);
if (!reader)
die("Failed to open %s for reading.", argv[1]);
if (!(outfile = fopen(argv[2], "wb")))
die("Failed to open %s for writing.", argv[2]);
info = vpx_video_reader_get_info(reader);
decoder = get_vpx_decoder_by_fourcc(info->codec_fourcc);
if (!decoder)
die("Unknown input codec.");
printf("Using %s\n", vpx_codec_iface_name(decoder->interface()));
if (vpx_codec_dec_init(&codec, decoder->interface(), NULL, 0))
die_codec(&codec, "Failed to initialize decoder");
while (vpx_video_reader_read_frame(reader)) {
vpx_codec_iter_t iter = NULL;
vpx_image_t *img = NULL;
size_t frame_size = 0;
const unsigned char *frame = vpx_video_reader_get_frame(reader,
&frame_size);
if (vpx_codec_decode(&codec, frame, (unsigned int)frame_size, NULL, 0))
die_codec(&codec, "Failed to decode frame");
while ((img = vpx_codec_get_frame(&codec, &iter)) != NULL) {
unsigned char digest[16];
get_image_md5(img, digest);
print_md5(outfile, digest);
fprintf(outfile, " img-%dx%d-%04d.i420\n",
img->d_w, img->d_h, ++frame_cnt);
}
}
printf("Processed %d frames.\n", frame_cnt);
if (vpx_codec_destroy(&codec))
die_codec(&codec, "Failed to destroy codec.");
vpx_video_reader_close(reader);
fclose(outfile);
return EXIT_SUCCESS;
}
| 18,407 |
80,123 | 0 | GF_Err fiin_Write(GF_Box *s, GF_BitStream *bs)
{
GF_Err e;
FDItemInformationBox *ptr = (FDItemInformationBox *) s;
if (!s) return GF_BAD_PARAM;
e = gf_isom_full_box_write(s, bs);
if (e) return e;
gf_bs_write_u16(bs, gf_list_count(ptr->partition_entries) );
e = gf_isom_box_array_write(s, ptr->partition_entries, bs);
if (e) return e;
if (ptr->session_info) gf_isom_box_write((GF_Box*)ptr->session_info, bs);
if (ptr->group_id_to_name) gf_isom_box_write((GF_Box*)ptr->group_id_to_name, bs);
return GF_OK;
}
| 18,408 |
22,429 | 0 | static inline void free_fair_sched_group(struct task_group *tg)
{
}
| 18,409 |
127,928 | 0 | void BrowserViewRenderer::ClearView() {
TRACE_EVENT_INSTANT0("android_webview",
"BrowserViewRenderer::ClearView",
TRACE_EVENT_SCOPE_THREAD);
if (clear_view_)
return;
clear_view_ = true;
PostInvalidateWithFallback();
}
| 18,410 |
1,361 | 0 | static struct packet *rpc_req(struct nfs_priv *npriv, int rpc_prog,
int rpc_proc, uint32_t *data, int datalen)
{
struct rpc_call pkt;
unsigned short dport;
int ret;
unsigned char *payload = net_udp_get_payload(npriv->con);
int nfserr;
int tries = 0;
npriv->rpc_id++;
pkt.id = hton32(npriv->rpc_id);
pkt.type = hton32(MSG_CALL);
pkt.rpcvers = hton32(2); /* use RPC version 2 */
pkt.prog = hton32(rpc_prog);
pkt.proc = hton32(rpc_proc);
debug("%s: prog: %d, proc: %d\n", __func__, rpc_prog, rpc_proc);
if (rpc_prog == PROG_PORTMAP) {
dport = SUNRPC_PORT;
pkt.vers = hton32(2);
} else if (rpc_prog == PROG_MOUNT) {
dport = npriv->mount_port;
pkt.vers = hton32(3);
} else {
dport = npriv->nfs_port;
pkt.vers = hton32(3);
}
memcpy(payload, &pkt, sizeof(pkt));
memcpy(payload + sizeof(pkt), data, datalen * sizeof(uint32_t));
npriv->con->udp->uh_dport = hton16(dport);
nfs_timer_start = get_time_ns();
again:
ret = net_udp_send(npriv->con,
sizeof(pkt) + datalen * sizeof(uint32_t));
if (ret) {
if (is_timeout(nfs_timer_start, NFS_TIMEOUT)) {
tries++;
if (tries == NFS_MAX_RESEND)
return ERR_PTR(-ETIMEDOUT);
}
goto again;
}
nfs_timer_start = get_time_ns();
nfs_state = STATE_START;
while (nfs_state != STATE_DONE) {
if (ctrlc())
return ERR_PTR(-EINTR);
net_poll();
if (is_timeout(nfs_timer_start, NFS_TIMEOUT)) {
tries++;
if (tries == NFS_MAX_RESEND)
return ERR_PTR(-ETIMEDOUT);
goto again;
}
ret = rpc_check_reply(npriv->nfs_packet, rpc_prog,
npriv->rpc_id, &nfserr);
if (!ret) {
if (rpc_prog == PROG_NFS && nfserr) {
free(npriv->nfs_packet);
return ERR_PTR(nfserr);
} else {
return npriv->nfs_packet;
}
}
}
return npriv->nfs_packet;
}
| 18,411 |
142,181 | 0 | Message GetNextMessage() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (messages_.empty()) {
base::RunLoop run_loop;
quit_closure_ = run_loop.QuitClosure();
run_loop.Run();
}
DCHECK(!messages_.empty());
const Message next = messages_.front();
messages_.pop_front();
return next;
}
| 18,412 |
88,115 | 0 | build_encrypt_ctxt(struct smb2_encryption_neg_context *pneg_ctxt)
{
pneg_ctxt->ContextType = SMB2_ENCRYPTION_CAPABILITIES;
pneg_ctxt->DataLength = cpu_to_le16(4); /* Cipher Count + le16 cipher */
pneg_ctxt->CipherCount = cpu_to_le16(1);
/* pneg_ctxt->Ciphers[0] = SMB2_ENCRYPTION_AES128_GCM;*/ /* not supported yet */
pneg_ctxt->Ciphers[0] = SMB2_ENCRYPTION_AES128_CCM;
}
| 18,413 |
186,219 | 1 | void ObjectBackedNativeHandler::Router(
const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::Isolate* isolate = args.GetIsolate();
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Object> data = args.Data().As<v8::Object>();
v8::Local<v8::Context> context = isolate->GetCurrentContext();
v8::Local<v8::Value> handler_function_value;
v8::Local<v8::Value> feature_name_value;
// See comment in header file for why we do this.
if (!GetPrivate(context, data, kHandlerFunction, &handler_function_value) ||
handler_function_value->IsUndefined() ||
!GetPrivate(context, data, kFeatureName, &feature_name_value) ||
!feature_name_value->IsString()) {
ScriptContext* script_context =
ScriptContextSet::GetContextByV8Context(context);
console::Error(script_context ? script_context->GetRenderFrame() : nullptr,
"Extension view no longer exists");
return;
}
// We can't access the ScriptContextSet on a worker thread. Luckily, we also
// don't inject many bindings into worker threads.
// TODO(devlin): Figure out a way around this.
if (content::WorkerThread::GetCurrentId() == 0) {
ScriptContext* script_context =
ScriptContextSet::GetContextByV8Context(context);
v8::Local<v8::String> feature_name_string =
feature_name_value->ToString(context).ToLocalChecked();
std::string feature_name = *v8::String::Utf8Value(feature_name_string);
// TODO(devlin): Eventually, we should fail if either script_context is null
// or feature_name is empty.
if (script_context &&
!feature_name.empty() &&
!script_context->GetAvailability(feature_name).is_available()) {
return;
}
}
// This CHECK is *important*. Otherwise, we'll go around happily executing
// something random. See crbug.com/548273.
CHECK(handler_function_value->IsExternal());
static_cast<HandlerFunction*>(
handler_function_value.As<v8::External>()->Value())->Run(args);
// Verify that the return value, if any, is accessible by the context.
v8::ReturnValue<v8::Value> ret = args.GetReturnValue();
v8::Local<v8::Value> ret_value = ret.Get();
if (ret_value->IsObject() && !ret_value->IsNull() &&
!ContextCanAccessObject(context, v8::Local<v8::Object>::Cast(ret_value),
true)) {
NOTREACHED() << "Insecure return value";
ret.SetUndefined();
}
}
| 18,414 |
85,690 | 0 | static int hns_nic_init_irq(struct hns_nic_priv *priv)
{
struct hnae_handle *h = priv->ae_handle;
struct hns_nic_ring_data *rd;
int i;
int ret;
int cpu;
for (i = 0; i < h->q_num * 2; i++) {
rd = &priv->ring_data[i];
if (rd->ring->irq_init_flag == RCB_IRQ_INITED)
break;
snprintf(rd->ring->ring_name, RCB_RING_NAME_LEN,
"%s-%s%d", priv->netdev->name,
(is_tx_ring(rd->ring) ? "tx" : "rx"), rd->queue_index);
rd->ring->ring_name[RCB_RING_NAME_LEN - 1] = '\0';
ret = request_irq(rd->ring->irq,
hns_irq_handle, 0, rd->ring->ring_name, rd);
if (ret) {
netdev_err(priv->netdev, "request irq(%d) fail\n",
rd->ring->irq);
return ret;
}
disable_irq(rd->ring->irq);
cpu = hns_nic_init_affinity_mask(h->q_num, i,
rd->ring, &rd->mask);
if (cpu_online(cpu))
irq_set_affinity_hint(rd->ring->irq,
&rd->mask);
rd->ring->irq_init_flag = RCB_IRQ_INITED;
}
return 0;
}
| 18,415 |
138,428 | 0 | bool Document::isPrivilegedContext(String& errorMessage, const PrivilegeContextCheck privilegeContextCheck) const
{
if (securityContext().isSandboxed(SandboxOrigin)) {
if (!SecurityOrigin::create(url())->isPotentiallyTrustworthy(errorMessage))
return false;
} else {
if (!securityOrigin()->isPotentiallyTrustworthy(errorMessage))
return false;
}
if (privilegeContextCheck == StandardPrivilegeCheck) {
Document* context = parentDocument();
while (context) {
if (!context->isSrcdocDocument()) {
if (context->securityContext().isSandboxed(SandboxOrigin)) {
RefPtr<SecurityOrigin> origin = SecurityOrigin::create(context->url());
if (!origin->isPotentiallyTrustworthy(errorMessage))
return false;
} else {
if (!context->securityOrigin()->isPotentiallyTrustworthy(errorMessage))
return false;
}
}
context = context->parentDocument();
}
}
return true;
}
| 18,416 |
3,828 | 0 | static void dump_backtrace()
{
HANDLE hCurrentThread;
HANDLE hThread;
DWORD dwThreadId;
DuplicateHandle(GetCurrentProcess(), GetCurrentThread(),
GetCurrentProcess(), &hCurrentThread, 0, FALSE, DUPLICATE_SAME_ACCESS);
hThread = CreateThread(NULL, 0, dump_thread_proc, (LPVOID)hCurrentThread,
0, &dwThreadId);
WaitForSingleObject(hThread, INFINITE);
CloseHandle(hThread);
CloseHandle(hCurrentThread);
}
| 18,417 |
58,027 | 0 | nft_rule_activate_next(struct net *net, struct nft_rule *rule)
{
/* Now inactive, will be active in the future */
rule->genmask = (1 << net->nft.gencursor);
}
| 18,418 |
187,878 | 1 | long long Segment::ParseHeaders() {
// Outermost (level 0) segment object has been constructed,
// and pos designates start of payload. We need to find the
// inner (level 1) elements.
long long total, available;
const int status = m_pReader->Length(&total, &available);
if (status < 0) // error
return status;
assert((total < 0) || (available <= total));
const long long segment_stop = (m_size < 0) ? -1 : m_start + m_size;
assert((segment_stop < 0) || (total < 0) || (segment_stop <= total));
assert((segment_stop < 0) || (m_pos <= segment_stop));
for (;;) {
if ((total >= 0) && (m_pos >= total))
break;
if ((segment_stop >= 0) && (m_pos >= segment_stop))
break;
long long pos = m_pos;
const long long element_start = pos;
if ((pos + 1) > available)
return (pos + 1);
long len;
long long result = GetUIntLength(m_pReader, pos, len);
if (result < 0) // error
return result;
if (result > 0) // underflow (weird)
return (pos + 1);
if ((segment_stop >= 0) && ((pos + len) > segment_stop))
return E_FILE_FORMAT_INVALID;
if ((pos + len) > available)
return pos + len;
const long long idpos = pos;
const long long id = ReadUInt(m_pReader, idpos, len);
if (id < 0) // error
return id;
if (id == 0x0F43B675) // Cluster ID
break;
pos += len; // consume ID
if ((pos + 1) > available)
return (pos + 1);
// Read Size
result = GetUIntLength(m_pReader, pos, len);
if (result < 0) // error
return result;
if (result > 0) // underflow (weird)
return (pos + 1);
if ((segment_stop >= 0) && ((pos + len) > segment_stop))
return E_FILE_FORMAT_INVALID;
if ((pos + len) > available)
return pos + len;
const long long size = ReadUInt(m_pReader, pos, len);
if (size < 0) // error
return size;
pos += len; // consume length of size of element
const long long element_size = size + pos - element_start;
// Pos now points to start of payload
if ((segment_stop >= 0) && ((pos + size) > segment_stop))
return E_FILE_FORMAT_INVALID;
// We read EBML elements either in total or nothing at all.
if ((pos + size) > available)
return pos + size;
if (id == 0x0549A966) { // Segment Info ID
if (m_pInfo)
return E_FILE_FORMAT_INVALID;
m_pInfo = new (std::nothrow)
SegmentInfo(this, pos, size, element_start, element_size);
if (m_pInfo == NULL)
return -1;
const long status = m_pInfo->Parse();
if (status)
return status;
} else if (id == 0x0654AE6B) { // Tracks ID
if (m_pTracks)
return E_FILE_FORMAT_INVALID;
m_pTracks = new (std::nothrow)
Tracks(this, pos, size, element_start, element_size);
if (m_pTracks == NULL)
return -1;
const long status = m_pTracks->Parse();
if (status)
return status;
} else if (id == 0x0C53BB6B) { // Cues ID
if (m_pCues == NULL) {
m_pCues = new (std::nothrow)
Cues(this, pos, size, element_start, element_size);
if (m_pCues == NULL)
return -1;
}
} else if (id == 0x014D9B74) { // SeekHead ID
if (m_pSeekHead == NULL) {
m_pSeekHead = new (std::nothrow)
SeekHead(this, pos, size, element_start, element_size);
if (m_pSeekHead == NULL)
return -1;
const long status = m_pSeekHead->Parse();
if (status)
return status;
}
} else if (id == 0x0043A770) { // Chapters ID
if (m_pChapters == NULL) {
m_pChapters = new (std::nothrow)
Chapters(this, pos, size, element_start, element_size);
if (m_pChapters == NULL)
return -1;
const long status = m_pChapters->Parse();
if (status)
return status;
}
}
m_pos = pos + size; // consume payload
}
assert((segment_stop < 0) || (m_pos <= segment_stop));
if (m_pInfo == NULL) // TODO: liberalize this behavior
return E_FILE_FORMAT_INVALID;
if (m_pTracks == NULL)
return E_FILE_FORMAT_INVALID;
return 0; // success
}
| 18,419 |
15,108 | 0 | PHP_FUNCTION(imagesetbrush)
{
zval *IM, *TILE;
gdImagePtr im, tile;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr", &IM, &TILE) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, "Image", le_gd);
ZEND_FETCH_RESOURCE(tile, gdImagePtr, &TILE, -1, "Image", le_gd);
gdImageSetBrush(im, tile);
RETURN_TRUE;
}
| 18,420 |
65,963 | 0 | xprt_rdma_bc_free(struct rpc_task *task)
{
struct rpc_rqst *rqst = task->tk_rqstp;
kfree(rqst->rq_rbuffer);
}
| 18,421 |
16,292 | 0 | void SafeSock::resetStat()
{
_noMsgs = 0;
_whole = 0;
_deleted = 0;
_avgSwhole = 0;
_avgSdeleted = 0;
}
| 18,422 |
81,689 | 0 | static int vbg_create_input_device(struct vbg_dev *gdev)
{
struct input_dev *input;
input = devm_input_allocate_device(gdev->dev);
if (!input)
return -ENOMEM;
input->id.bustype = BUS_PCI;
input->id.vendor = VBOX_VENDORID;
input->id.product = VMMDEV_DEVICEID;
input->open = vbg_input_open;
input->close = vbg_input_close;
input->dev.parent = gdev->dev;
input->name = "VirtualBox mouse integration";
input_set_abs_params(input, ABS_X, VMMDEV_MOUSE_RANGE_MIN,
VMMDEV_MOUSE_RANGE_MAX, 0, 0);
input_set_abs_params(input, ABS_Y, VMMDEV_MOUSE_RANGE_MIN,
VMMDEV_MOUSE_RANGE_MAX, 0, 0);
input_set_capability(input, EV_KEY, BTN_MOUSE);
input_set_drvdata(input, gdev);
gdev->input = input;
return input_register_device(gdev->input);
}
| 18,423 |
111,947 | 0 | void ProfileSyncService::UpdateLastSyncedTime() {
last_synced_time_ = base::Time::Now();
sync_prefs_.SetLastSyncedTime(last_synced_time_);
}
| 18,424 |
142,207 | 0 | bool PrepareDcimTestEntries(Profile* profile) {
if (!CreateRootDirectory(profile))
return false;
CreateEntry(AddEntriesMessage::TestEntryInfo(AddEntriesMessage::DIRECTORY,
"", "DCIM"));
CreateEntry(AddEntriesMessage::TestEntryInfo(AddEntriesMessage::FILE,
"image2.png", "image2.png")
.SetMimeType("image/png"));
CreateEntry(AddEntriesMessage::TestEntryInfo(
AddEntriesMessage::FILE, "image3.jpg", "DCIM/image3.jpg")
.SetMimeType("image/png"));
CreateEntry(AddEntriesMessage::TestEntryInfo(AddEntriesMessage::FILE,
"text.txt", "DCIM/hello.txt")
.SetMimeType("text/plain"));
base::RunLoop().RunUntilIdle();
return true;
}
| 18,425 |
48,301 | 0 | PixarLogFixupTags(TIFF* tif)
{
(void) tif;
return (1);
}
| 18,426 |
147,751 | 0 | static void ReadonlyTestInterfaceEmptyAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Local<v8::Object> holder = info.Holder();
TestObject* impl = V8TestObject::ToImpl(holder);
TestInterfaceEmpty* cpp_value(WTF::GetPtr(impl->readonlyTestInterfaceEmptyAttribute()));
if (cpp_value && DOMDataStore::SetReturnValue(info.GetReturnValue(), cpp_value))
return;
v8::Local<v8::Value> v8_value(ToV8(cpp_value, holder, info.GetIsolate()));
static const V8PrivateProperty::SymbolKey kKeepAliveKey;
V8PrivateProperty::GetSymbol(info.GetIsolate(), kKeepAliveKey)
.Set(holder, v8_value);
V8SetReturnValue(info, v8_value);
}
| 18,427 |
104,872 | 0 | bool Extension::LoadUserScriptHelper(const DictionaryValue* content_script,
int definition_index,
int flags,
std::string* error,
UserScript* result) {
URLPattern::ParseOption parse_strictness =
(flags & STRICT_ERROR_CHECKS ? URLPattern::PARSE_STRICT
: URLPattern::PARSE_LENIENT);
if (content_script->HasKey(keys::kRunAt)) {
std::string run_location;
if (!content_script->GetString(keys::kRunAt, &run_location)) {
*error = ExtensionErrorUtils::FormatErrorMessage(errors::kInvalidRunAt,
base::IntToString(definition_index));
return false;
}
if (run_location == values::kRunAtDocumentStart) {
result->set_run_location(UserScript::DOCUMENT_START);
} else if (run_location == values::kRunAtDocumentEnd) {
result->set_run_location(UserScript::DOCUMENT_END);
} else if (run_location == values::kRunAtDocumentIdle) {
result->set_run_location(UserScript::DOCUMENT_IDLE);
} else {
*error = ExtensionErrorUtils::FormatErrorMessage(errors::kInvalidRunAt,
base::IntToString(definition_index));
return false;
}
}
if (content_script->HasKey(keys::kAllFrames)) {
bool all_frames = false;
if (!content_script->GetBoolean(keys::kAllFrames, &all_frames)) {
*error = ExtensionErrorUtils::FormatErrorMessage(
errors::kInvalidAllFrames, base::IntToString(definition_index));
return false;
}
result->set_match_all_frames(all_frames);
}
ListValue* matches = NULL;
if (!content_script->GetList(keys::kMatches, &matches)) {
*error = ExtensionErrorUtils::FormatErrorMessage(errors::kInvalidMatches,
base::IntToString(definition_index));
return false;
}
if (matches->GetSize() == 0) {
*error = ExtensionErrorUtils::FormatErrorMessage(errors::kInvalidMatchCount,
base::IntToString(definition_index));
return false;
}
for (size_t j = 0; j < matches->GetSize(); ++j) {
std::string match_str;
if (!matches->GetString(j, &match_str)) {
*error = ExtensionErrorUtils::FormatErrorMessage(
errors::kInvalidMatch,
base::IntToString(definition_index),
base::IntToString(j),
errors::kExpectString);
return false;
}
URLPattern pattern(UserScript::kValidUserScriptSchemes);
if (CanExecuteScriptEverywhere())
pattern.set_valid_schemes(URLPattern::SCHEME_ALL);
URLPattern::ParseResult parse_result = pattern.Parse(match_str,
parse_strictness);
if (parse_result != URLPattern::PARSE_SUCCESS) {
*error = ExtensionErrorUtils::FormatErrorMessage(
errors::kInvalidMatch,
base::IntToString(definition_index),
base::IntToString(j),
URLPattern::GetParseResultString(parse_result));
return false;
}
if (pattern.MatchesScheme(chrome::kFileScheme) &&
!CanExecuteScriptEverywhere()) {
wants_file_access_ = true;
if (!(flags & ALLOW_FILE_ACCESS))
pattern.set_valid_schemes(
pattern.valid_schemes() & ~URLPattern::SCHEME_FILE);
}
result->add_url_pattern(pattern);
}
if (content_script->HasKey(keys::kExcludeMatches)) { // optional
ListValue* exclude_matches = NULL;
if (!content_script->GetList(keys::kExcludeMatches, &exclude_matches)) {
*error = ExtensionErrorUtils::FormatErrorMessage(
errors::kInvalidExcludeMatches,
base::IntToString(definition_index));
return false;
}
for (size_t j = 0; j < exclude_matches->GetSize(); ++j) {
std::string match_str;
if (!exclude_matches->GetString(j, &match_str)) {
*error = ExtensionErrorUtils::FormatErrorMessage(
errors::kInvalidExcludeMatch,
base::IntToString(definition_index),
base::IntToString(j),
errors::kExpectString);
return false;
}
URLPattern pattern(UserScript::kValidUserScriptSchemes);
if (CanExecuteScriptEverywhere())
pattern.set_valid_schemes(URLPattern::SCHEME_ALL);
URLPattern::ParseResult parse_result = pattern.Parse(match_str,
parse_strictness);
if (parse_result != URLPattern::PARSE_SUCCESS) {
*error = ExtensionErrorUtils::FormatErrorMessage(
errors::kInvalidExcludeMatch,
base::IntToString(definition_index), base::IntToString(j),
URLPattern::GetParseResultString(parse_result));
return false;
}
result->add_exclude_url_pattern(pattern);
}
}
if (!LoadGlobsHelper(content_script, definition_index, keys::kIncludeGlobs,
error, &UserScript::add_glob, result)) {
return false;
}
if (!LoadGlobsHelper(content_script, definition_index, keys::kExcludeGlobs,
error, &UserScript::add_exclude_glob, result)) {
return false;
}
ListValue* js = NULL;
if (content_script->HasKey(keys::kJs) &&
!content_script->GetList(keys::kJs, &js)) {
*error = ExtensionErrorUtils::FormatErrorMessage(errors::kInvalidJsList,
base::IntToString(definition_index));
return false;
}
ListValue* css = NULL;
if (content_script->HasKey(keys::kCss) &&
!content_script->GetList(keys::kCss, &css)) {
*error = ExtensionErrorUtils::FormatErrorMessage(errors::kInvalidCssList,
base::IntToString(definition_index));
return false;
}
if (((js ? js->GetSize() : 0) + (css ? css->GetSize() : 0)) == 0) {
*error = ExtensionErrorUtils::FormatErrorMessage(errors::kMissingFile,
base::IntToString(definition_index));
return false;
}
if (js) {
for (size_t script_index = 0; script_index < js->GetSize();
++script_index) {
Value* value;
std::string relative;
if (!js->Get(script_index, &value) || !value->GetAsString(&relative)) {
*error = ExtensionErrorUtils::FormatErrorMessage(errors::kInvalidJs,
base::IntToString(definition_index),
base::IntToString(script_index));
return false;
}
GURL url = GetResourceURL(relative);
ExtensionResource resource = GetResource(relative);
result->js_scripts().push_back(UserScript::File(
resource.extension_root(), resource.relative_path(), url));
}
}
if (css) {
for (size_t script_index = 0; script_index < css->GetSize();
++script_index) {
Value* value;
std::string relative;
if (!css->Get(script_index, &value) || !value->GetAsString(&relative)) {
*error = ExtensionErrorUtils::FormatErrorMessage(errors::kInvalidCss,
base::IntToString(definition_index),
base::IntToString(script_index));
return false;
}
GURL url = GetResourceURL(relative);
ExtensionResource resource = GetResource(relative);
result->css_scripts().push_back(UserScript::File(
resource.extension_root(), resource.relative_path(), url));
}
}
return true;
}
| 18,428 |
172,892 | 0 | void do_cleanup(char UNUSED *p)
{
bdt_cleanup();
}
| 18,429 |
81,250 | 0 | static int allocate_cmdlines_buffer(unsigned int val,
struct saved_cmdlines_buffer *s)
{
s->map_cmdline_to_pid = kmalloc_array(val,
sizeof(*s->map_cmdline_to_pid),
GFP_KERNEL);
if (!s->map_cmdline_to_pid)
return -ENOMEM;
s->saved_cmdlines = kmalloc_array(TASK_COMM_LEN, val, GFP_KERNEL);
if (!s->saved_cmdlines) {
kfree(s->map_cmdline_to_pid);
return -ENOMEM;
}
s->cmdline_idx = 0;
s->cmdline_num = val;
memset(&s->map_pid_to_cmdline, NO_CMDLINE_MAP,
sizeof(s->map_pid_to_cmdline));
memset(s->map_cmdline_to_pid, NO_CMDLINE_MAP,
val * sizeof(*s->map_cmdline_to_pid));
return 0;
}
| 18,430 |
173,456 | 0 | OMX_BUFFERHEADERTYPE* omx_vdec::allocate_color_convert_buf::get_il_buf_hdr()
{
if (!omx) {
DEBUG_PRINT_ERROR("Invalid param get_buf_hdr");
return NULL;
}
if (!enabled)
return omx->m_out_mem_ptr;
return m_out_mem_ptr_client;
}
| 18,431 |
31,001 | 0 | void __rtnl_link_unregister(struct rtnl_link_ops *ops)
{
struct net *net;
for_each_net(net) {
__rtnl_kill_links(net, ops);
}
list_del(&ops->list);
}
| 18,432 |
127,177 | 0 | DaemonProcess::DaemonProcess(
scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
const base::Closure& stopped_callback)
: Stoppable(caller_task_runner, stopped_callback),
caller_task_runner_(caller_task_runner),
io_task_runner_(io_task_runner),
next_terminal_id_(0) {
DCHECK(caller_task_runner->BelongsToCurrentThread());
}
| 18,433 |
17,424 | 0 | UninstallSaverColormap(ScreenPtr pScreen)
{
SetupScreen(pScreen);
ColormapPtr pCmap;
int rc;
if (pPriv && pPriv->installedMap != None) {
rc = dixLookupResourceByType((void **) &pCmap, pPriv->installedMap,
RT_COLORMAP, serverClient,
DixUninstallAccess);
if (rc == Success)
(*pCmap->pScreen->UninstallColormap) (pCmap);
pPriv->installedMap = None;
CheckScreenPrivate(pScreen);
}
}
| 18,434 |
31,712 | 0 | SYSCALL_DEFINE2(rt_sigsuspend, sigset_t __user *, unewset, size_t, sigsetsize)
{
sigset_t newset;
/* XXX: Don't preclude handling different sized sigset_t's. */
if (sigsetsize != sizeof(sigset_t))
return -EINVAL;
if (copy_from_user(&newset, unewset, sizeof(newset)))
return -EFAULT;
return sigsuspend(&newset);
}
| 18,435 |
152,755 | 0 | void Histogram::WriteAsciiBucketContext(const int64_t past,
const Count current,
const int64_t remaining,
const uint32_t i,
std::string* output) const {
double scaled_sum = (past + current + remaining) / 100.0;
WriteAsciiBucketValue(current, scaled_sum, output);
if (0 < i) {
double percentage = past / scaled_sum;
StringAppendF(output, " {%3.1f%%}", percentage);
}
}
| 18,436 |
121,305 | 0 | void HTMLInputElement::willChangeForm()
{
removeFromRadioButtonGroup();
HTMLTextFormControlElement::willChangeForm();
}
| 18,437 |
176,759 | 0 | status_t Parcel::readString16Vector(
std::unique_ptr<std::vector<std::unique_ptr<String16>>>* val) const {
return readNullableTypedVector(val, &Parcel::readString16);
}
| 18,438 |
154,506 | 0 | void GLES2DecoderPassthroughImpl::RestoreAllExternalTextureBindingsIfNeeded() {}
| 18,439 |
33,908 | 0 | mainloop_add_fd(
const char *name, int priority, int fd, void *userdata, struct mainloop_fd_callbacks *callbacks)
{
mainloop_io_t *client = NULL;
if(fd > 0) {
client = calloc(1, sizeof(mainloop_io_t));
client->name = strdup(name);
client->userdata = userdata;
if(callbacks) {
client->destroy_fn = callbacks->destroy;
client->dispatch_fn_io = callbacks->dispatch;
}
client->channel = g_io_channel_unix_new(fd);
client->source = g_io_add_watch_full(
client->channel, priority, (G_IO_IN|G_IO_HUP|G_IO_NVAL|G_IO_ERR),
mainloop_gio_callback, client, mainloop_gio_destroy);
/* Now that mainloop now holds a reference to adaptor->channel,
* thanks to g_io_add_watch_full(), drop ours from g_io_channel_unix_new().
*
* This means that adaptor->channel will be free'd by:
* g_main_context_dispatch() or g_source_remove()
* -> g_source_destroy_internal()
* -> g_source_callback_unref()
* shortly after mainloop_gio_destroy() completes
*/
g_io_channel_unref(client->channel);
crm_trace("Added connection %d for %s[%p].%d %d", client->source, client->name, client, fd, mainloop_gio_refcount(client));
}
return client;
}
| 18,440 |
156,376 | 0 | void DebuggerGetTargetsFunction::SendTargetList(
const content::DevToolsAgentHost::List& target_list) {
std::unique_ptr<base::ListValue> result(new base::ListValue());
for (size_t i = 0; i < target_list.size(); ++i)
result->Append(SerializeTarget(target_list[i]));
SetResult(std::move(result));
SendResponse(true);
}
| 18,441 |
181,151 | 1 | static Image *ReadOneJNGImage(MngInfo *mng_info,
const ImageInfo *image_info, ExceptionInfo *exception)
{
Image
*alpha_image,
*color_image,
*image,
*jng_image;
ImageInfo
*alpha_image_info,
*color_image_info;
MagickBooleanType
logging;
int
unique_filenames;
ssize_t
y;
MagickBooleanType
status;
png_uint_32
jng_height,
jng_width;
png_byte
jng_color_type,
jng_image_sample_depth,
jng_image_compression_method,
jng_image_interlace_method,
jng_alpha_sample_depth,
jng_alpha_compression_method,
jng_alpha_filter_method,
jng_alpha_interlace_method;
register const PixelPacket
*s;
register ssize_t
i,
x;
register PixelPacket
*q;
register unsigned char
*p;
unsigned int
read_JSEP,
reading_idat;
size_t
length;
jng_alpha_compression_method=0;
jng_alpha_sample_depth=8;
jng_color_type=0;
jng_height=0;
jng_width=0;
alpha_image=(Image *) NULL;
color_image=(Image *) NULL;
alpha_image_info=(ImageInfo *) NULL;
color_image_info=(ImageInfo *) NULL;
unique_filenames=0;
logging=LogMagickEvent(CoderEvent,GetMagickModule(),
" Enter ReadOneJNGImage()");
image=mng_info->image;
if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL)
{
/*
Allocate next image structure.
*/
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" AcquireNextImage()");
AcquireNextImage(image_info,image);
if (GetNextImageInList(image) == (Image *) NULL)
return(DestroyImageList(image));
image=SyncNextImageInList(image);
}
mng_info->image=image;
/*
Signature bytes have already been read.
*/
read_JSEP=MagickFalse;
reading_idat=MagickFalse;
for (;;)
{
char
type[MaxTextExtent];
unsigned char
*chunk;
unsigned int
count;
/*
Read a new JNG chunk.
*/
status=SetImageProgress(image,LoadImagesTag,TellBlob(image),
2*GetBlobSize(image));
if (status == MagickFalse)
break;
type[0]='\0';
(void) ConcatenateMagickString(type,"errr",MaxTextExtent);
length=ReadBlobMSBLong(image);
count=(unsigned int) ReadBlob(image,4,(unsigned char *) type);
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Reading JNG chunk type %c%c%c%c, length: %.20g",
type[0],type[1],type[2],type[3],(double) length);
if (length > PNG_UINT_31_MAX || count == 0)
ThrowReaderException(CorruptImageError,"CorruptImage");
p=NULL;
chunk=(unsigned char *) NULL;
if (length != 0)
{
chunk=(unsigned char *) AcquireQuantumMemory(length+MagickPathExtent,
sizeof(*chunk));
if (chunk == (unsigned char *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
for (i=0; i < (ssize_t) length; i++)
{
int
c;
c=ReadBlobByte(image);
if (c == EOF)
break;
chunk[i]=(unsigned char) c;
}
p=chunk;
}
(void) ReadBlobMSBLong(image); /* read crc word */
if (memcmp(type,mng_JHDR,4) == 0)
{
if (length == 16)
{
jng_width=(size_t) ((p[0] << 24) | (p[1] << 16) |
(p[2] << 8) | p[3]);
jng_height=(size_t) ((p[4] << 24) | (p[5] << 16) |
(p[6] << 8) | p[7]);
if ((jng_width == 0) || (jng_height == 0))
ThrowReaderException(CorruptImageError,"NegativeOrZeroImageSize");
jng_color_type=p[8];
jng_image_sample_depth=p[9];
jng_image_compression_method=p[10];
jng_image_interlace_method=p[11];
image->interlace=jng_image_interlace_method != 0 ? PNGInterlace :
NoInterlace;
jng_alpha_sample_depth=p[12];
jng_alpha_compression_method=p[13];
jng_alpha_filter_method=p[14];
jng_alpha_interlace_method=p[15];
if (logging != MagickFalse)
{
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" jng_width: %16lu, jng_height: %16lu\n"
" jng_color_type: %16d, jng_image_sample_depth: %3d\n"
" jng_image_compression_method:%3d",
(unsigned long) jng_width, (unsigned long) jng_height,
jng_color_type, jng_image_sample_depth,
jng_image_compression_method);
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" jng_image_interlace_method: %3d"
" jng_alpha_sample_depth: %3d",
jng_image_interlace_method,
jng_alpha_sample_depth);
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" jng_alpha_compression_method:%3d\n"
" jng_alpha_filter_method: %3d\n"
" jng_alpha_interlace_method: %3d",
jng_alpha_compression_method,
jng_alpha_filter_method,
jng_alpha_interlace_method);
}
}
if (length != 0)
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
if ((reading_idat == MagickFalse) && (read_JSEP == MagickFalse) &&
((memcmp(type,mng_JDAT,4) == 0) || (memcmp(type,mng_JdAA,4) == 0) ||
(memcmp(type,mng_IDAT,4) == 0) || (memcmp(type,mng_JDAA,4) == 0)))
{
/*
o create color_image
o open color_blob, attached to color_image
o if (color type has alpha)
open alpha_blob, attached to alpha_image
*/
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Creating color_blob.");
color_image_info=(ImageInfo *)AcquireMagickMemory(sizeof(ImageInfo));
if (color_image_info == (ImageInfo *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
GetImageInfo(color_image_info);
color_image=AcquireImage(color_image_info);
if (color_image == (Image *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
(void) AcquireUniqueFilename(color_image->filename);
unique_filenames++;
status=OpenBlob(color_image_info,color_image,WriteBinaryBlobMode,
exception);
if (status == MagickFalse)
{
color_image=DestroyImage(color_image);
return(DestroyImageList(image));
}
if ((image_info->ping == MagickFalse) && (jng_color_type >= 12))
{
alpha_image_info=(ImageInfo *)
AcquireMagickMemory(sizeof(ImageInfo));
if (alpha_image_info == (ImageInfo *) NULL)
{
color_image=DestroyImage(color_image);
ThrowReaderException(ResourceLimitError,
"MemoryAllocationFailed");
}
GetImageInfo(alpha_image_info);
alpha_image=AcquireImage(alpha_image_info);
if (alpha_image == (Image *) NULL)
{
alpha_image_info=DestroyImageInfo(alpha_image_info);
color_image=DestroyImage(color_image);
ThrowReaderException(ResourceLimitError,
"MemoryAllocationFailed");
}
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Creating alpha_blob.");
(void) AcquireUniqueFilename(alpha_image->filename);
unique_filenames++;
status=OpenBlob(alpha_image_info,alpha_image,WriteBinaryBlobMode,
exception);
if (status == MagickFalse)
{
alpha_image=DestroyImage(alpha_image);
alpha_image_info=DestroyImageInfo(alpha_image_info);
color_image=DestroyImage(color_image);
return(DestroyImageList(image));
}
if (jng_alpha_compression_method == 0)
{
unsigned char
data[18];
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Writing IHDR chunk to alpha_blob.");
(void) WriteBlob(alpha_image,8,(const unsigned char *)
"\211PNG\r\n\032\n");
(void) WriteBlobMSBULong(alpha_image,13L);
PNGType(data,mng_IHDR);
LogPNGChunk(logging,mng_IHDR,13L);
PNGLong(data+4,jng_width);
PNGLong(data+8,jng_height);
data[12]=jng_alpha_sample_depth;
data[13]=0; /* color_type gray */
data[14]=0; /* compression method 0 */
data[15]=0; /* filter_method 0 */
data[16]=0; /* interlace_method 0 */
(void) WriteBlob(alpha_image,17,data);
(void) WriteBlobMSBULong(alpha_image,crc32(0,data,17));
}
}
reading_idat=MagickTrue;
}
if (memcmp(type,mng_JDAT,4) == 0)
{
/* Copy chunk to color_image->blob */
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Copying JDAT chunk data to color_blob.");
if (length != 0)
{
(void) WriteBlob(color_image,length,chunk);
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
}
continue;
}
if (memcmp(type,mng_IDAT,4) == 0)
{
png_byte
data[5];
/* Copy IDAT header and chunk data to alpha_image->blob */
if (alpha_image != NULL && image_info->ping == MagickFalse)
{
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Copying IDAT chunk data to alpha_blob.");
(void) WriteBlobMSBULong(alpha_image,(size_t) length);
PNGType(data,mng_IDAT);
LogPNGChunk(logging,mng_IDAT,length);
(void) WriteBlob(alpha_image,4,data);
(void) WriteBlob(alpha_image,length,chunk);
(void) WriteBlobMSBULong(alpha_image,
crc32(crc32(0,data,4),chunk,(uInt) length));
}
if (length != 0)
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
if ((memcmp(type,mng_JDAA,4) == 0) || (memcmp(type,mng_JdAA,4) == 0))
{
/* Copy chunk data to alpha_image->blob */
if (alpha_image != NULL && image_info->ping == MagickFalse)
{
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Copying JDAA chunk data to alpha_blob.");
(void) WriteBlob(alpha_image,length,chunk);
}
if (length != 0)
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
if (memcmp(type,mng_JSEP,4) == 0)
{
read_JSEP=MagickTrue;
if (length != 0)
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
if (memcmp(type,mng_bKGD,4) == 0)
{
if (length == 2)
{
image->background_color.red=ScaleCharToQuantum(p[1]);
image->background_color.green=image->background_color.red;
image->background_color.blue=image->background_color.red;
}
if (length == 6)
{
image->background_color.red=ScaleCharToQuantum(p[1]);
image->background_color.green=ScaleCharToQuantum(p[3]);
image->background_color.blue=ScaleCharToQuantum(p[5]);
}
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
if (memcmp(type,mng_gAMA,4) == 0)
{
if (length == 4)
image->gamma=((float) mng_get_long(p))*0.00001;
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
if (memcmp(type,mng_cHRM,4) == 0)
{
if (length == 32)
{
image->chromaticity.white_point.x=0.00001*mng_get_long(p);
image->chromaticity.white_point.y=0.00001*mng_get_long(&p[4]);
image->chromaticity.red_primary.x=0.00001*mng_get_long(&p[8]);
image->chromaticity.red_primary.y=0.00001*mng_get_long(&p[12]);
image->chromaticity.green_primary.x=0.00001*mng_get_long(&p[16]);
image->chromaticity.green_primary.y=0.00001*mng_get_long(&p[20]);
image->chromaticity.blue_primary.x=0.00001*mng_get_long(&p[24]);
image->chromaticity.blue_primary.y=0.00001*mng_get_long(&p[28]);
}
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
if (memcmp(type,mng_sRGB,4) == 0)
{
if (length == 1)
{
image->rendering_intent=
Magick_RenderingIntent_from_PNG_RenderingIntent(p[0]);
image->gamma=1.000f/2.200f;
image->chromaticity.red_primary.x=0.6400f;
image->chromaticity.red_primary.y=0.3300f;
image->chromaticity.green_primary.x=0.3000f;
image->chromaticity.green_primary.y=0.6000f;
image->chromaticity.blue_primary.x=0.1500f;
image->chromaticity.blue_primary.y=0.0600f;
image->chromaticity.white_point.x=0.3127f;
image->chromaticity.white_point.y=0.3290f;
}
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
if (memcmp(type,mng_oFFs,4) == 0)
{
if (length > 8)
{
image->page.x=(ssize_t) mng_get_long(p);
image->page.y=(ssize_t) mng_get_long(&p[4]);
if ((int) p[8] != 0)
{
image->page.x/=10000;
image->page.y/=10000;
}
}
if (length != 0)
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
if (memcmp(type,mng_pHYs,4) == 0)
{
if (length > 8)
{
image->x_resolution=(double) mng_get_long(p);
image->y_resolution=(double) mng_get_long(&p[4]);
if ((int) p[8] == PNG_RESOLUTION_METER)
{
image->units=PixelsPerCentimeterResolution;
image->x_resolution=image->x_resolution/100.0f;
image->y_resolution=image->y_resolution/100.0f;
}
}
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
#if 0
if (memcmp(type,mng_iCCP,4) == 0)
{
/* To do: */
if (length != 0)
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
#endif
if (length != 0)
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
if (memcmp(type,mng_IEND,4))
continue;
break;
}
/* IEND found */
/*
Finish up reading image data:
o read main image from color_blob.
o close color_blob.
o if (color_type has alpha)
if alpha_encoding is PNG
read secondary image from alpha_blob via ReadPNG
if alpha_encoding is JPEG
read secondary image from alpha_blob via ReadJPEG
o close alpha_blob.
o copy intensity of secondary image into
opacity samples of main image.
o destroy the secondary image.
*/
if (color_image_info == (ImageInfo *) NULL)
{
assert(color_image == (Image *) NULL);
assert(alpha_image == (Image *) NULL);
return(DestroyImageList(image));
}
if (color_image == (Image *) NULL)
{
assert(alpha_image == (Image *) NULL);
return(DestroyImageList(image));
}
(void) SeekBlob(color_image,0,SEEK_SET);
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Reading jng_image from color_blob.");
assert(color_image_info != (ImageInfo *) NULL);
(void) FormatLocaleString(color_image_info->filename,MaxTextExtent,"%s",
color_image->filename);
color_image_info->ping=MagickFalse; /* To do: avoid this */
jng_image=ReadImage(color_image_info,exception);
(void) RelinquishUniqueFileResource(color_image->filename);
unique_filenames--;
color_image=DestroyImage(color_image);
color_image_info=DestroyImageInfo(color_image_info);
if (jng_image == (Image *) NULL)
return(DestroyImageList(image));
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Copying jng_image pixels to main image.");
image->columns=jng_width;
image->rows=jng_height;
length=image->columns*sizeof(PixelPacket);
status=SetImageExtent(image,image->columns,image->rows);
if (status == MagickFalse)
{
InheritException(exception,&image->exception);
return(DestroyImageList(image));
}
for (y=0; y < (ssize_t) image->rows; y++)
{
s=GetVirtualPixels(jng_image,0,y,image->columns,1,&image->exception);
q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
(void) CopyMagickMemory(q,s,length);
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
}
jng_image=DestroyImage(jng_image);
if (image_info->ping == MagickFalse)
{
if (jng_color_type >= 12)
{
if (jng_alpha_compression_method == 0)
{
png_byte
data[5];
(void) WriteBlobMSBULong(alpha_image,0x00000000L);
PNGType(data,mng_IEND);
LogPNGChunk(logging,mng_IEND,0L);
(void) WriteBlob(alpha_image,4,data);
(void) WriteBlobMSBULong(alpha_image,crc32(0,data,4));
}
(void) SeekBlob(alpha_image,0,SEEK_SET);
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Reading opacity from alpha_blob.");
(void) FormatLocaleString(alpha_image_info->filename,MaxTextExtent,
"%s",alpha_image->filename);
jng_image=ReadImage(alpha_image_info,exception);
if (jng_image != (Image *) NULL)
for (y=0; y < (ssize_t) image->rows; y++)
{
s=GetVirtualPixels(jng_image,0,y,image->columns,1,
&image->exception);
q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
if (image->matte != MagickFalse)
for (x=(ssize_t) image->columns; x != 0; x--,q++,s++)
SetPixelOpacity(q,QuantumRange-
GetPixelRed(s));
else
for (x=(ssize_t) image->columns; x != 0; x--,q++,s++)
{
SetPixelAlpha(q,GetPixelRed(s));
if (GetPixelOpacity(q) != OpaqueOpacity)
image->matte=MagickTrue;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
}
(void) RelinquishUniqueFileResource(alpha_image->filename);
unique_filenames--;
alpha_image=DestroyImage(alpha_image);
alpha_image_info=DestroyImageInfo(alpha_image_info);
if (jng_image != (Image *) NULL)
jng_image=DestroyImage(jng_image);
}
}
/* Read the JNG image. */
if (mng_info->mng_type == 0)
{
mng_info->mng_width=jng_width;
mng_info->mng_height=jng_height;
}
if (image->page.width == 0 && image->page.height == 0)
{
image->page.width=jng_width;
image->page.height=jng_height;
}
if (image->page.x == 0 && image->page.y == 0)
{
image->page.x=mng_info->x_off[mng_info->object_id];
image->page.y=mng_info->y_off[mng_info->object_id];
}
else
{
image->page.y=mng_info->y_off[mng_info->object_id];
}
mng_info->image_found++;
status=SetImageProgress(image,LoadImagesTag,2*TellBlob(image),
2*GetBlobSize(image));
if (status == MagickFalse)
return(DestroyImageList(image));
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" exit ReadOneJNGImage(); unique_filenames=%d",unique_filenames);
return(image);
}
| 18,442 |
1,549 | 0 | zget_device_params(i_ctx_t *i_ctx_p, bool is_hardware)
{
os_ptr op = osp;
ref rkeys;
gx_device *dev;
stack_param_list list;
int code;
ref *pmark;
check_read_type(op[-1], t_device);
if(!r_has_type(op, t_null)) {
check_type(*op, t_dictionary);
}
rkeys = *op;
dev = op[-1].value.pdevice;
if (op[-1].value.pdevice == NULL)
/* This can happen if we invalidated devices on the stack by calling nulldevice after they were pushed */
return_error(gs_error_undefined);
pop(1);
stack_param_list_write(&list, &o_stack, &rkeys, iimemory);
code = gs_get_device_or_hardware_params(dev, (gs_param_list *) & list,
is_hardware);
if (code < 0) {
/* We have to put back the top argument. */
if (list.count > 0)
ref_stack_pop(&o_stack, list.count * 2 - 1);
else
ref_stack_push(&o_stack, 1);
*osp = rkeys;
return code;
}
pmark = ref_stack_index(&o_stack, list.count * 2);
make_mark(pmark);
return 0;
}
| 18,443 |
26,353 | 0 | static inline int task_running(struct rq *rq, struct task_struct *p)
{
#ifdef CONFIG_SMP
return p->on_cpu;
#else
return task_current(rq, p);
#endif
}
| 18,444 |
123,074 | 0 | void RenderWidgetHostImpl::UpdateVSyncParameters(base::TimeTicks timebase,
base::TimeDelta interval) {
Send(new ViewMsg_UpdateVSyncParameters(GetRoutingID(), timebase, interval));
}
| 18,445 |
9,262 | 0 | static unsigned virtqueue_read_next_desc(VirtIODevice *vdev, VRingDesc *desc,
hwaddr desc_pa, unsigned int max)
{
unsigned int next;
/* If this descriptor says it doesn't chain, we're done. */
if (!(desc->flags & VRING_DESC_F_NEXT)) {
return max;
}
/* Check they're not leading us off end of descriptors. */
next = desc->next;
/* Make sure compiler knows to grab that: we don't want it changing! */
smp_wmb();
if (next >= max) {
error_report("Desc next is %u", next);
exit(1);
}
vring_desc_read(vdev, desc, desc_pa, next);
return next;
}
| 18,446 |
102,184 | 0 | void SyncManager::SyncInternal::SetExtraChangeRecordData(int64 id,
syncable::ModelType type, ChangeReorderBuffer* buffer,
Cryptographer* cryptographer, const syncable::EntryKernel& original,
bool existed_before, bool exists_now) {
if (!exists_now && existed_before) {
sync_pb::EntitySpecifics original_specifics(original.ref(SPECIFICS));
if (type == syncable::PASSWORDS) {
scoped_ptr<sync_pb::PasswordSpecificsData> data(
DecryptPasswordSpecifics(original_specifics, cryptographer));
if (!data.get()) {
NOTREACHED();
return;
}
buffer->SetExtraDataForId(id, new ExtraPasswordChangeRecordData(*data));
} else if (original_specifics.has_encrypted()) {
const sync_pb::EncryptedData& encrypted = original_specifics.encrypted();
if (!cryptographer->Decrypt(encrypted, &original_specifics)) {
NOTREACHED();
return;
}
}
buffer->SetSpecificsForId(id, original_specifics);
}
}
| 18,447 |
63,198 | 0 | int ff_amf_read_number(GetByteContext *bc, double *val)
{
uint64_t read;
if (bytestream2_get_byte(bc) != AMF_DATA_TYPE_NUMBER)
return AVERROR_INVALIDDATA;
read = bytestream2_get_be64(bc);
*val = av_int2double(read);
return 0;
}
| 18,448 |
42,328 | 0 | int kern_path(const char *name, unsigned int flags, struct path *path)
{
struct nameidata nd;
struct filename *filename = getname_kernel(name);
int res = PTR_ERR(filename);
if (!IS_ERR(filename)) {
res = filename_lookup(AT_FDCWD, filename, flags, &nd);
putname(filename);
if (!res)
*path = nd.path;
}
return res;
}
| 18,449 |
26,932 | 0 | static int taskstats_user_cmd(struct sk_buff *skb, struct genl_info *info)
{
if (info->attrs[TASKSTATS_CMD_ATTR_REGISTER_CPUMASK])
return cmd_attr_register_cpumask(info);
else if (info->attrs[TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK])
return cmd_attr_deregister_cpumask(info);
else if (info->attrs[TASKSTATS_CMD_ATTR_PID])
return cmd_attr_pid(info);
else if (info->attrs[TASKSTATS_CMD_ATTR_TGID])
return cmd_attr_tgid(info);
else
return -EINVAL;
}
| 18,450 |
42,116 | 0 | mm_zfree(struct mm_master *mm, void *address)
{
mm_free(mm, address);
}
| 18,451 |
61,068 | 0 | get_link_name (const char *name,
int count,
int max_length)
{
const char *format;
char *result;
int unshortened_length;
gboolean use_count;
g_assert (name != NULL);
if (count < 0)
{
g_warning ("bad count in get_link_name");
count = 0;
}
if (count <= 2)
{
/* Handle special cases for low numbers.
* Perhaps for some locales we will need to add more.
*/
switch (count)
{
default:
{
g_assert_not_reached ();
/* fall through */
}
case 0:
{
/* duplicate original file name */
format = "%s";
}
break;
case 1:
{
/* appended to new link file */
format = _("Link to %s");
}
break;
case 2:
{
/* appended to new link file */
format = _("Another link to %s");
}
break;
}
use_count = FALSE;
}
else
{
/* Handle special cases for the first few numbers of each ten.
* For locales where getting this exactly right is difficult,
* these can just be made all the same as the general case below.
*/
switch (count % 10)
{
case 1:
{
/* Localizers: Feel free to leave out the "st" suffix
* if there's no way to do that nicely for a
* particular language.
*/
format = _("%'dst link to %s");
}
break;
case 2:
{
/* appended to new link file */
format = _("%'dnd link to %s");
}
break;
case 3:
{
/* appended to new link file */
format = _("%'drd link to %s");
}
break;
default:
{
/* appended to new link file */
format = _("%'dth link to %s");
}
break;
}
use_count = TRUE;
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
if (use_count)
{
result = g_strdup_printf (format, count, name);
}
else
{
result = g_strdup_printf (format, name);
}
if (max_length > 0 && (unshortened_length = strlen (result)) > max_length)
{
char *new_name;
new_name = shorten_utf8_string (name, unshortened_length - max_length);
if (new_name)
{
g_free (result);
if (use_count)
{
result = g_strdup_printf (format, count, new_name);
}
else
{
result = g_strdup_printf (format, new_name);
}
g_assert (strlen (result) <= max_length);
g_free (new_name);
}
}
#pragma GCC diagnostic pop
return result;
}
| 18,452 |
127,501 | 0 | inline J_COLOR_SPACE rgbOutputColorSpace() { return JCS_RGB; }
| 18,453 |
121,131 | 0 | HTMLElement* HTMLInputElement::containerElement() const
{
return m_inputType->containerElement();
}
| 18,454 |
58,954 | 0 | static void l2cap_raw_recv(struct l2cap_conn *conn, struct sk_buff *skb)
{
struct l2cap_chan_list *l = &conn->chan_list;
struct sk_buff *nskb;
struct sock *sk;
BT_DBG("conn %p", conn);
read_lock(&l->lock);
for (sk = l->head; sk; sk = l2cap_pi(sk)->next_c) {
if (sk->sk_type != SOCK_RAW)
continue;
/* Don't send frame to the socket it came from */
if (skb->sk == sk)
continue;
nskb = skb_clone(skb, GFP_ATOMIC);
if (!nskb)
continue;
if (sock_queue_rcv_skb(sk, nskb))
kfree_skb(nskb);
}
read_unlock(&l->lock);
}
| 18,455 |
159,072 | 0 | void ChromeDownloadManagerDelegate::RequestConfirmation(
DownloadItem* download,
const base::FilePath& suggested_path,
DownloadConfirmationReason reason,
const DownloadTargetDeterminerDelegate::ConfirmationCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(!download->IsTransient());
#if defined(OS_ANDROID)
switch (reason) {
case DownloadConfirmationReason::NONE:
NOTREACHED();
return;
case DownloadConfirmationReason::TARGET_PATH_NOT_WRITEABLE:
DownloadManagerService::OnDownloadCanceled(
download, DownloadController::CANCEL_REASON_NO_EXTERNAL_STORAGE);
callback.Run(DownloadConfirmationResult::CANCELED, base::FilePath());
return;
case DownloadConfirmationReason::NAME_TOO_LONG:
case DownloadConfirmationReason::TARGET_NO_SPACE:
case DownloadConfirmationReason::SAVE_AS:
case DownloadConfirmationReason::PREFERENCE:
callback.Run(DownloadConfirmationResult::CONTINUE_WITHOUT_CONFIRMATION,
suggested_path);
return;
case DownloadConfirmationReason::TARGET_CONFLICT:
if (download->GetWebContents()) {
android::ChromeDuplicateDownloadInfoBarDelegate::Create(
InfoBarService::FromWebContents(download->GetWebContents()),
download, suggested_path, callback);
return;
}
case DownloadConfirmationReason::UNEXPECTED:
DownloadManagerService::OnDownloadCanceled(
download,
DownloadController::CANCEL_REASON_CANNOT_DETERMINE_DOWNLOAD_TARGET);
callback.Run(DownloadConfirmationResult::CANCELED, base::FilePath());
return;
}
#else // !OS_ANDROID
DownloadFilePicker::ShowFilePicker(download, suggested_path, callback);
#endif // !OS_ANDROID
}
| 18,456 |
69,540 | 0 | int key_reject_and_link(struct key *key,
unsigned timeout,
unsigned error,
struct key *keyring,
struct key *authkey)
{
struct assoc_array_edit *edit;
struct timespec now;
int ret, awaken, link_ret = 0;
key_check(key);
key_check(keyring);
awaken = 0;
ret = -EBUSY;
if (keyring)
link_ret = __key_link_begin(keyring, &key->index_key, &edit);
mutex_lock(&key_construction_mutex);
/* can't instantiate twice */
if (!test_bit(KEY_FLAG_INSTANTIATED, &key->flags)) {
/* mark the key as being negatively instantiated */
atomic_inc(&key->user->nikeys);
key->type_data.reject_error = -error;
smp_wmb();
set_bit(KEY_FLAG_NEGATIVE, &key->flags);
set_bit(KEY_FLAG_INSTANTIATED, &key->flags);
now = current_kernel_time();
key->expiry = now.tv_sec + timeout;
key_schedule_gc(key->expiry + key_gc_delay);
if (test_and_clear_bit(KEY_FLAG_USER_CONSTRUCT, &key->flags))
awaken = 1;
ret = 0;
/* and link it into the destination keyring */
if (keyring && link_ret == 0)
__key_link(key, &edit);
/* disable the authorisation key */
if (authkey)
key_revoke(authkey);
}
mutex_unlock(&key_construction_mutex);
if (keyring)
__key_link_end(keyring, &key->index_key, edit);
/* wake up anyone waiting for a key to be constructed */
if (awaken)
wake_up_bit(&key->flags, KEY_FLAG_USER_CONSTRUCT);
return ret == 0 ? link_ret : ret;
}
| 18,457 |
94,342 | 0 | SYSCALL_DEFINE1(unshare, unsigned long, unshare_flags)
{
int err = 0;
struct fs_struct *fs, *new_fs = NULL;
struct sighand_struct *new_sigh = NULL;
struct mm_struct *mm, *new_mm = NULL, *active_mm = NULL;
struct files_struct *fd, *new_fd = NULL;
struct nsproxy *new_nsproxy = NULL;
int do_sysvsem = 0;
check_unshare_flags(&unshare_flags);
/* Return -EINVAL for all unsupported flags */
err = -EINVAL;
if (unshare_flags & ~(CLONE_THREAD|CLONE_FS|CLONE_NEWNS|CLONE_SIGHAND|
CLONE_VM|CLONE_FILES|CLONE_SYSVSEM|
CLONE_NEWUTS|CLONE_NEWIPC|CLONE_NEWNET))
goto bad_unshare_out;
/*
* CLONE_NEWIPC must also detach from the undolist: after switching
* to a new ipc namespace, the semaphore arrays from the old
* namespace are unreachable.
*/
if (unshare_flags & (CLONE_NEWIPC|CLONE_SYSVSEM))
do_sysvsem = 1;
if ((err = unshare_thread(unshare_flags)))
goto bad_unshare_out;
if ((err = unshare_fs(unshare_flags, &new_fs)))
goto bad_unshare_cleanup_thread;
if ((err = unshare_sighand(unshare_flags, &new_sigh)))
goto bad_unshare_cleanup_fs;
if ((err = unshare_vm(unshare_flags, &new_mm)))
goto bad_unshare_cleanup_sigh;
if ((err = unshare_fd(unshare_flags, &new_fd)))
goto bad_unshare_cleanup_vm;
if ((err = unshare_nsproxy_namespaces(unshare_flags, &new_nsproxy,
new_fs)))
goto bad_unshare_cleanup_fd;
if (new_fs || new_mm || new_fd || do_sysvsem || new_nsproxy) {
if (do_sysvsem) {
/*
* CLONE_SYSVSEM is equivalent to sys_exit().
*/
exit_sem(current);
}
if (new_nsproxy) {
switch_task_namespaces(current, new_nsproxy);
new_nsproxy = NULL;
}
task_lock(current);
if (new_fs) {
fs = current->fs;
write_lock(&fs->lock);
current->fs = new_fs;
if (--fs->users)
new_fs = NULL;
else
new_fs = fs;
write_unlock(&fs->lock);
}
if (new_mm) {
mm = current->mm;
active_mm = current->active_mm;
current->mm = new_mm;
current->active_mm = new_mm;
activate_mm(active_mm, new_mm);
new_mm = mm;
}
if (new_fd) {
fd = current->files;
current->files = new_fd;
new_fd = fd;
}
task_unlock(current);
}
if (new_nsproxy)
put_nsproxy(new_nsproxy);
bad_unshare_cleanup_fd:
if (new_fd)
put_files_struct(new_fd);
bad_unshare_cleanup_vm:
if (new_mm)
mmput(new_mm);
bad_unshare_cleanup_sigh:
if (new_sigh)
if (atomic_dec_and_test(&new_sigh->count))
kmem_cache_free(sighand_cachep, new_sigh);
bad_unshare_cleanup_fs:
if (new_fs)
free_fs_struct(new_fs);
bad_unshare_cleanup_thread:
bad_unshare_out:
return err;
}
| 18,458 |
122,130 | 0 | void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestorLayer, RenderLayer* layer, OverlapMap* overlapMap, CompositingRecursionData& currentRecursionData, bool& descendantHas3DTransform, Vector<RenderLayer*>& unclippedDescendants)
{
layer->stackingNode()->updateLayerListsIfNeeded();
if (overlapMap)
overlapMap->geometryMap().pushMappingsToAncestor(layer, ancestorLayer);
layer->setHasCompositingDescendant(false);
layer->setHasNonCompositedChild(false);
CompositingReasons reasonsToComposite = CompositingReasonNone;
CompositingReasons directReasons = directReasonsForCompositing(layer);
if (currentRecursionData.m_compositingAncestor && currentRecursionData.m_compositingAncestor->renderer()->isVideo())
directReasons |= CompositingReasonLayerForVideoOverlay;
if (canBeComposited(layer))
reasonsToComposite |= directReasons;
CompositingReasons overlapCompositingReason = currentRecursionData.m_subtreeIsCompositing ? CompositingReasonAssumedOverlap : CompositingReasonNone;
if (m_renderView->compositorDrivenAcceleratedScrollingEnabled()) {
Vector<size_t> unclippedDescendantsToRemove;
for (size_t i = 0; i < unclippedDescendants.size(); i++) {
RenderLayer* unclippedDescendant = unclippedDescendants.at(i);
if (unclippedDescendant->renderer()->containingBlock() == layer->renderer()) {
unclippedDescendantsToRemove.append(i);
continue;
}
if (layer->scrollsWithRespectTo(unclippedDescendant))
reasonsToComposite |= CompositingReasonAssumedOverlap;
}
for (size_t i = 0; i < unclippedDescendantsToRemove.size(); i++)
unclippedDescendants.remove(unclippedDescendantsToRemove.at(unclippedDescendantsToRemove.size() - i - 1));
if (reasonsToComposite & CompositingReasonOutOfFlowClipping)
unclippedDescendants.append(layer);
}
bool haveComputedBounds = false;
IntRect absBounds;
if (overlapMap && !overlapMap->isEmpty() && currentRecursionData.m_testingOverlap && !requiresCompositingOrSquashing(directReasons)) {
absBounds = enclosingIntRect(overlapMap->geometryMap().absoluteRect(layer->overlapBounds()));
if (absBounds.isEmpty())
absBounds.setSize(IntSize(1, 1));
haveComputedBounds = true;
overlapCompositingReason = overlapMap->overlapsLayers(absBounds) ? CompositingReasonOverlap : CompositingReasonNone;
}
reasonsToComposite |= overlapCompositingReason;
if (currentRecursionData.m_mostRecentCompositedLayer && requiresSquashing(reasonsToComposite)
&& layer->scrollsWithRespectTo(currentRecursionData.m_mostRecentCompositedLayer))
reasonsToComposite |= CompositingReasonOverlapsWithoutSquashingTarget;
CompositingRecursionData childRecursionData(currentRecursionData);
childRecursionData.m_subtreeIsCompositing = false;
bool willBeCompositedOrSquashed = canBeComposited(layer) && requiresCompositingOrSquashing(reasonsToComposite);
if (willBeCompositedOrSquashed) {
currentRecursionData.m_subtreeIsCompositing = true;
childRecursionData.m_compositingAncestor = layer;
if (overlapMap)
overlapMap->beginNewOverlapTestingContext();
childRecursionData.m_testingOverlap = true;
}
#if !ASSERT_DISABLED
LayerListMutationDetector mutationChecker(layer->stackingNode());
#endif
bool anyDescendantHas3DTransform = false;
bool willHaveForegroundLayer = false;
if (layer->stackingNode()->isStackingContainer()) {
RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), NegativeZOrderChildren);
while (RenderLayerStackingNode* curNode = iterator.next()) {
computeCompositingRequirements(layer, curNode->layer(), overlapMap, childRecursionData, anyDescendantHas3DTransform, unclippedDescendants);
if (childRecursionData.m_subtreeIsCompositing) {
reasonsToComposite |= CompositingReasonNegativeZIndexChildren;
if (!willBeCompositedOrSquashed) {
childRecursionData.m_compositingAncestor = layer;
overlapMap->beginNewOverlapTestingContext();
willBeCompositedOrSquashed = true;
willHaveForegroundLayer = true;
if (overlapMap) {
overlapMap->geometryMap().pushMappingsToAncestor(curNode->layer(), layer);
IntRect childAbsBounds = enclosingIntRect(overlapMap->geometryMap().absoluteRect(curNode->layer()->overlapBounds()));
bool boundsComputed = true;
overlapMap->beginNewOverlapTestingContext();
addToOverlapMap(*overlapMap, curNode->layer(), childAbsBounds, boundsComputed);
overlapMap->finishCurrentOverlapTestingContext();
overlapMap->geometryMap().popMappingsToAncestor(layer);
}
}
}
}
}
if (overlapMap && willHaveForegroundLayer) {
ASSERT(willBeCompositedOrSquashed);
overlapMap->finishCurrentOverlapTestingContext();
overlapMap->beginNewOverlapTestingContext();
childRecursionData.m_testingOverlap = true;
}
if (requiresCompositing(reasonsToComposite)) {
currentRecursionData.m_mostRecentCompositedLayer = layer;
childRecursionData.m_mostRecentCompositedLayer = layer;
}
RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), NormalFlowChildren | PositiveZOrderChildren);
while (RenderLayerStackingNode* curNode = iterator.next())
computeCompositingRequirements(layer, curNode->layer(), overlapMap, childRecursionData, anyDescendantHas3DTransform, unclippedDescendants);
currentRecursionData.m_mostRecentCompositedLayer = childRecursionData.m_mostRecentCompositedLayer;
if (layer->isRootLayer()) {
if (inCompositingMode() && m_hasAcceleratedCompositing)
willBeCompositedOrSquashed = true;
}
if (overlapMap && childRecursionData.m_compositingAncestor && !childRecursionData.m_compositingAncestor->isRootLayer())
addToOverlapMap(*overlapMap, layer, absBounds, haveComputedBounds);
if (layer->stackingNode()->isStackingContext()) {
layer->setShouldIsolateCompositedDescendants(childRecursionData.m_hasUnisolatedCompositedBlendingDescendant);
} else {
layer->setShouldIsolateCompositedDescendants(false);
currentRecursionData.m_hasUnisolatedCompositedBlendingDescendant = childRecursionData.m_hasUnisolatedCompositedBlendingDescendant;
}
CompositingReasons subtreeCompositingReasons = subtreeReasonsForCompositing(layer->renderer(), childRecursionData.m_subtreeIsCompositing, anyDescendantHas3DTransform);
reasonsToComposite |= subtreeCompositingReasons;
if (!willBeCompositedOrSquashed && canBeComposited(layer) && requiresCompositingOrSquashing(subtreeCompositingReasons)) {
childRecursionData.m_compositingAncestor = layer;
if (overlapMap) {
overlapMap->beginNewOverlapTestingContext();
addToOverlapMapRecursive(*overlapMap, layer);
}
willBeCompositedOrSquashed = true;
}
if (layer->reflectionInfo()) {
CompositingReasons reflectionCompositingReason = willBeCompositedOrSquashed ? CompositingReasonReflectionOfCompositedParent : CompositingReasonNone;
layer->reflectionInfo()->reflectionLayer()->setCompositingReasons(layer->reflectionInfo()->reflectionLayer()->compositingReasons() | reflectionCompositingReason);
}
if (childRecursionData.m_subtreeIsCompositing)
currentRecursionData.m_subtreeIsCompositing = true;
if (willBeCompositedOrSquashed && layer->blendInfo().hasBlendMode())
currentRecursionData.m_hasUnisolatedCompositedBlendingDescendant = true;
layer->setHasCompositingDescendant(childRecursionData.m_subtreeIsCompositing);
bool isCompositedClippingLayer = canBeComposited(layer) && (reasonsToComposite & CompositingReasonClipsCompositingDescendants);
if ((!childRecursionData.m_testingOverlap && !isCompositedClippingLayer) || isRunningAcceleratedTransformAnimation(layer->renderer()))
currentRecursionData.m_testingOverlap = false;
if (overlapMap && childRecursionData.m_compositingAncestor == layer && !layer->isRootLayer())
overlapMap->finishCurrentOverlapTestingContext();
if (layer->isRootLayer()) {
if (childRecursionData.m_subtreeIsCompositing || requiresCompositingOrSquashing(reasonsToComposite) || m_forceCompositingMode) {
willBeCompositedOrSquashed = true;
reasonsToComposite |= CompositingReasonRoot;
} else {
enableCompositingMode(false);
willBeCompositedOrSquashed = false;
reasonsToComposite = CompositingReasonNone;
}
}
if (requiresCompositing(reasonsToComposite))
currentRecursionData.m_mostRecentCompositedLayer = layer;
layer->setCompositingReasons(reasonsToComposite);
if (!willBeCompositedOrSquashed && layer->parent())
layer->parent()->setHasNonCompositedChild(true);
descendantHas3DTransform |= anyDescendantHas3DTransform || layer->has3DTransform();
if (overlapMap)
overlapMap->geometryMap().popMappingsToAncestor(ancestorLayer);
}
| 18,459 |
7,410 | 0 | static void end_write(TsHashTable *ht)
{
#ifdef ZTS
tsrm_mutex_unlock(ht->mx_writer);
#endif
}
| 18,460 |
154,080 | 0 | void GLES2DecoderImpl::DoUniform1iv(GLint fake_location,
GLsizei count,
const volatile GLint* values) {
GLenum type = 0;
GLint real_location = -1;
if (!PrepForSetUniformByLocation(fake_location,
"glUniform1iv",
Program::kUniform1i,
&real_location,
&type,
&count)) {
return;
}
auto values_copy = std::make_unique<GLint[]>(count);
GLint* safe_values = values_copy.get();
std::copy(values, values + count, safe_values);
if (type == GL_SAMPLER_2D || type == GL_SAMPLER_2D_RECT_ARB ||
type == GL_SAMPLER_CUBE || type == GL_SAMPLER_EXTERNAL_OES) {
if (!state_.current_program->SetSamplers(
state_.texture_units.size(), fake_location, count, safe_values)) {
LOCAL_SET_GL_ERROR(
GL_INVALID_VALUE, "glUniform1iv", "texture unit out of range");
return;
}
}
api()->glUniform1ivFn(real_location, count, safe_values);
}
| 18,461 |
117,672 | 0 | BrowserInit::LaunchWithProfile::~LaunchWithProfile() {
}
| 18,462 |
28,765 | 0 | void kvm_apic_write_nodecode(struct kvm_vcpu *vcpu, u32 offset)
{
u32 val = 0;
/* hw has done the conditional check and inst decode */
offset &= 0xff0;
apic_reg_read(vcpu->arch.apic, offset, 4, &val);
/* TODO: optimize to just emulate side effect w/o one more write */
apic_reg_write(vcpu->arch.apic, offset, val);
}
| 18,463 |
12,169 | 0 | void XMLRPC_SetValueBase64(XMLRPC_VALUE value, const char* s, int len) {
if(value && s) {
simplestring_clear(&value->str);
(len > 0) ? simplestring_addn(&value->str, s, len) :
simplestring_add(&value->str, s);
value->type = xmlrpc_base64;
}
}
| 18,464 |
66,169 | 0 | static int mailimf_comma_parse(const char * message, size_t length,
size_t * indx)
{
return mailimf_unstrict_char_parse(message, length, indx, ',');
}
| 18,465 |
3,331 | 0 | static uint32_t fdctrl_read_main_status(FDCtrl *fdctrl)
{
uint32_t retval = fdctrl->msr;
fdctrl->dsr &= ~FD_DSR_PWRDOWN;
fdctrl->dor |= FD_DOR_nRESET;
FLOPPY_DPRINTF("main status register: 0x%02x\n", retval);
return retval;
}
| 18,466 |
82,758 | 0 | INST_HANDLER (sbix) { // SBIC A, b
int a = (buf[0] >> 3) & 0x1f;
int b = buf[0] & 0x07;
RAnalOp next_op;
RStrBuf *io_port;
op->type2 = 0;
op->val = a;
op->family = R_ANAL_OP_FAMILY_IO;
avr_op_analyze (anal,
&next_op,
op->addr + op->size, buf + op->size,
len - op->size,
cpu);
r_strbuf_fini (&next_op.esil);
op->jump = op->addr + next_op.size + 2;
op->cycles = 1; // XXX: This is a bug, because depends on eval state,
io_port = __generic_io_dest (a, 0, cpu);
ESIL_A ("%d,1,<<,%s,&,", b, io_port); // IO(A,b)
ESIL_A ((buf[1] & 0xe) == 0xc
? "!," // SBIC => branch if 0
: "!,!,"); // SBIS => branch if 1
ESIL_A ("?{,%"PFMT64d",pc,=,},", op->jump); // ?true => jmp
r_strbuf_free (io_port);
}
| 18,467 |
66,261 | 0 | vbf_stp_fetchend(struct worker *wrk, struct busyobj *bo)
{
AZ(bo->vfc->failed);
VFP_Close(bo->vfc);
AZ(ObjSetU64(wrk, bo->fetch_objcore, OA_LEN,
bo->fetch_objcore->boc->len_so_far));
if (bo->do_stream)
assert(bo->fetch_objcore->boc->state == BOS_STREAM);
else {
assert(bo->fetch_objcore->boc->state == BOS_REQ_DONE);
HSH_Unbusy(wrk, bo->fetch_objcore);
}
/* Recycle the backend connection before setting BOS_FINISHED to
give predictable backend reuse behavior for varnishtest */
VDI_Finish(bo->wrk, bo);
ObjSetState(wrk, bo->fetch_objcore, BOS_FINISHED);
VSLb_ts_busyobj(bo, "BerespBody", W_TIM_real(wrk));
if (bo->stale_oc != NULL)
HSH_Kill(bo->stale_oc);
return (F_STP_DONE);
}
| 18,468 |
144,747 | 0 | void NoopLocalSiteCharacteristicsDatabase::ClearDatabase() {}
| 18,469 |
24,865 | 0 | static void process_slab(struct loc_track *t, struct kmem_cache *s,
struct page *page, enum track_item alloc)
{
void *addr = page_address(page);
DECLARE_BITMAP(map, page->objects);
void *p;
bitmap_zero(map, page->objects);
for_each_free_object(p, s, page->freelist)
set_bit(slab_index(p, s, addr), map);
for_each_object(p, s, addr, page->objects)
if (!test_bit(slab_index(p, s, addr), map))
add_location(t, s, get_track(s, p, alloc));
}
| 18,470 |
33,087 | 0 | static int build_acquire(struct sk_buff *skb, struct xfrm_state *x,
struct xfrm_tmpl *xt, struct xfrm_policy *xp,
int dir)
{
__u32 seq = xfrm_get_acqseq();
struct xfrm_user_acquire *ua;
struct nlmsghdr *nlh;
int err;
nlh = nlmsg_put(skb, 0, 0, XFRM_MSG_ACQUIRE, sizeof(*ua), 0);
if (nlh == NULL)
return -EMSGSIZE;
ua = nlmsg_data(nlh);
memcpy(&ua->id, &x->id, sizeof(ua->id));
memcpy(&ua->saddr, &x->props.saddr, sizeof(ua->saddr));
memcpy(&ua->sel, &x->sel, sizeof(ua->sel));
copy_to_user_policy(xp, &ua->policy, dir);
ua->aalgos = xt->aalgos;
ua->ealgos = xt->ealgos;
ua->calgos = xt->calgos;
ua->seq = x->km.seq = seq;
err = copy_to_user_tmpl(xp, skb);
if (!err)
err = copy_to_user_state_sec_ctx(x, skb);
if (!err)
err = copy_to_user_policy_type(xp->type, skb);
if (!err)
err = xfrm_mark_put(skb, &xp->mark);
if (err) {
nlmsg_cancel(skb, nlh);
return err;
}
return nlmsg_end(skb, nlh);
}
| 18,471 |
95,936 | 0 | qboolean FS_idPak(char *pak, char *base, int numPaks)
{
int i;
for ( i = 0; i < NUM_ID_PAKS; i++ ) {
if ( !FS_FilenameCompare( pak, va( "%s/pak%d", base, i ) ) ) {
break;
}
if ( !FS_FilenameCompare( pak, va( "%s/mp_pak%d",base,i ) ) ) {
break;
}
if ( !FS_FilenameCompare( pak, va( "%s/sp_pak%d",base,i + 1) ) ) {
break;
}
}
if ( i < numPaks ) {
return qtrue;
}
return qfalse;
}
| 18,472 |
166,749 | 0 | Address LargeObjectArena::LazySweepPages(size_t allocation_size,
size_t gc_info_index) {
Address result = nullptr;
size_t swept_size = 0;
while (!SweepingCompleted()) {
BasePage* page = first_unswept_page_;
if (page->IsEmpty()) {
swept_size += static_cast<LargeObjectPage*>(page)->PayloadSize();
page->Unlink(&first_unswept_page_);
page->RemoveFromHeap();
if (swept_size >= allocation_size) {
result = DoAllocateLargeObjectPage(allocation_size, gc_info_index);
DCHECK(result);
break;
}
} else {
page->Sweep();
page->Unlink(&first_unswept_page_);
page->Link(&first_page_);
page->MarkAsSwept();
}
}
return result;
}
| 18,473 |
185,993 | 1 | void AppControllerImpl::BindRequest(mojom::AppControllerRequest request) {
bindings_.AddBinding(this, std::move(request));
}
| 18,474 |
117,809 | 0 | static void enabledAtRuntimeAttr2AttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
INC_STATS("DOM.TestObj.enabledAtRuntimeAttr2._set");
TestObj* imp = V8TestObj::toNative(info.Holder());
int v = toInt32(value);
imp->setEnabledAtRuntimeAttr2(v);
return;
}
| 18,475 |
117,599 | 0 | VolumeBubble* VolumeBubble::GetInstance() {
return Singleton<VolumeBubble>::get();
}
| 18,476 |
181,581 | 1 | static MagickBooleanType SyncExifProfile(Image *image, StringInfo *profile)
{
#define MaxDirectoryStack 16
#define EXIF_DELIMITER "\n"
#define EXIF_NUM_FORMATS 12
#define TAG_EXIF_OFFSET 0x8769
#define TAG_INTEROP_OFFSET 0xa005
typedef struct _DirectoryInfo
{
unsigned char
*directory;
size_t
entry;
} DirectoryInfo;
DirectoryInfo
directory_stack[MaxDirectoryStack];
EndianType
endian;
size_t
entry,
length,
number_entries;
SplayTreeInfo
*exif_resources;
ssize_t
id,
level,
offset;
static int
format_bytes[] = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8};
unsigned char
*directory,
*exif;
/*
Set EXIF resolution tag.
*/
length=GetStringInfoLength(profile);
exif=GetStringInfoDatum(profile);
if (length < 16)
return(MagickFalse);
id=(ssize_t) ReadProfileShort(LSBEndian,exif);
if ((id != 0x4949) && (id != 0x4D4D))
{
while (length != 0)
{
if (ReadProfileByte(&exif,&length) != 0x45)
continue;
if (ReadProfileByte(&exif,&length) != 0x78)
continue;
if (ReadProfileByte(&exif,&length) != 0x69)
continue;
if (ReadProfileByte(&exif,&length) != 0x66)
continue;
if (ReadProfileByte(&exif,&length) != 0x00)
continue;
if (ReadProfileByte(&exif,&length) != 0x00)
continue;
break;
}
if (length < 16)
return(MagickFalse);
id=(ssize_t) ReadProfileShort(LSBEndian,exif);
}
endian=LSBEndian;
if (id == 0x4949)
endian=LSBEndian;
else
if (id == 0x4D4D)
endian=MSBEndian;
else
return(MagickFalse);
if (ReadProfileShort(endian,exif+2) != 0x002a)
return(MagickFalse);
/*
This the offset to the first IFD.
*/
offset=(ssize_t) ReadProfileLong(endian,exif+4);
if ((offset < 0) || ((size_t) offset >= length))
return(MagickFalse);
directory=exif+offset;
level=0;
entry=0;
exif_resources=NewSplayTree((int (*)(const void *,const void *)) NULL,
(void *(*)(void *)) NULL,(void *(*)(void *)) NULL);
do
{
if (level > 0)
{
level--;
directory=directory_stack[level].directory;
entry=directory_stack[level].entry;
}
if ((directory < exif) || (directory > (exif+length-2)))
break;
/*
Determine how many entries there are in the current IFD.
*/
number_entries=ReadProfileShort(endian,directory);
for ( ; entry < number_entries; entry++)
{
register unsigned char
*p,
*q;
size_t
number_bytes;
ssize_t
components,
format,
tag_value;
q=(unsigned char *) (directory+2+(12*entry));
if (q > (exif+length-12))
break; /* corrupt EXIF */
if (GetValueFromSplayTree(exif_resources,q) == q)
break;
(void) AddValueToSplayTree(exif_resources,q,q);
tag_value=(ssize_t) ReadProfileShort(endian,q);
format=(ssize_t) ReadProfileShort(endian,q+2);
if ((format < 0) || ((format-1) >= EXIF_NUM_FORMATS))
break;
components=(ssize_t) ReadProfileLong(endian,q+4);
if (components < 0)
break; /* corrupt EXIF */
number_bytes=(size_t) components*format_bytes[format];
if ((ssize_t) number_bytes < components)
break; /* prevent overflow */
if (number_bytes <= 4)
p=q+8;
else
{
/*
The directory entry contains an offset.
*/
offset=(ssize_t) ReadProfileLong(endian,q+8);
if ((ssize_t) (offset+number_bytes) < offset)
continue; /* prevent overflow *
if ((size_t) (offset+number_bytes) > length)
continue;
p=(unsigned char *) (exif+offset);
}
switch (tag_value)
{
case 0x011a:
{
(void) WriteProfileLong(endian,(size_t) (image->x_resolution+0.5),p);
(void) WriteProfileLong(endian,1UL,p+4);
break;
}
case 0x011b:
{
(void) WriteProfileLong(endian,(size_t) (image->y_resolution+0.5),p);
(void) WriteProfileLong(endian,1UL,p+4);
break;
}
case 0x0112:
{
if (number_bytes == 4)
{
(void) WriteProfileLong(endian,(size_t) image->orientation,p);
break;
}
(void) WriteProfileShort(endian,(unsigned short) image->orientation,
p);
break;
}
case 0x0128:
{
if (number_bytes == 4)
{
(void) WriteProfileLong(endian,(size_t) (image->units+1),p);
break;
}
(void) WriteProfileShort(endian,(unsigned short) (image->units+1),p);
break;
}
default:
break;
}
if ((tag_value == TAG_EXIF_OFFSET) || (tag_value == TAG_INTEROP_OFFSET))
{
offset=(ssize_t) ReadProfileLong(endian,p);
if (((size_t) offset < length) && (level < (MaxDirectoryStack-2)))
{
directory_stack[level].directory=directory;
entry++;
directory_stack[level].entry=entry;
level++;
directory_stack[level].directory=exif+offset;
directory_stack[level].entry=0;
level++;
if ((directory+2+(12*number_entries)) > (exif+length))
break;
offset=(ssize_t) ReadProfileLong(endian,directory+2+(12*
number_entries));
if ((offset != 0) && ((size_t) offset < length) &&
(level < (MaxDirectoryStack-2)))
{
directory_stack[level].directory=exif+offset;
directory_stack[level].entry=0;
level++;
}
}
break;
}
}
} while (level > 0);
exif_resources=DestroySplayTree(exif_resources);
return(MagickTrue);
}
| 18,477 |
64,472 | 0 | R_API const char* r_config_desc(RConfig *cfg, const char *name, const char *desc) {
RConfigNode *node = r_config_node_get (cfg, name);
return r_config_node_desc (node, desc);
}
| 18,478 |
1,385 | 0 | XcursorScanTheme (const char *theme, const char *name)
{
FILE *f = NULL;
char *full;
char *dir;
const char *path;
char *inherits = NULL;
const char *i;
if (!theme || !name)
return NULL;
/*
* Scan this theme
*/
for (path = XcursorLibraryPath ();
path && f == NULL;
path = _XcursorNextPath (path))
{
dir = _XcursorBuildThemeDir (path, theme);
if (dir)
{
full = _XcursorBuildFullname (dir, "cursors", name);
if (full)
{
f = fopen (full, "r");
free (full);
}
if (!f && !inherits)
{
full = _XcursorBuildFullname (dir, "", "index.theme");
if (full)
{
inherits = _XcursorThemeInherits (full);
free (full);
}
}
free (dir);
}
}
/*
* Recurse to scan inherited themes
*/
for (i = inherits; i && f == NULL; i = _XcursorNextPath (i))
f = XcursorScanTheme (i, name);
if (inherits != NULL)
free (inherits);
return f;
}
| 18,479 |
143,677 | 0 | void RenderWidgetHostImpl::OnSnapshotDataReceived(int snapshot_id,
const unsigned char* data,
size_t size) {
PendingSnapshotMap::iterator it = pending_browser_snapshots_.begin();
while (it != pending_browser_snapshots_.end()) {
if (it->first <= snapshot_id) {
it->second.Run(data, size);
pending_browser_snapshots_.erase(it++);
} else {
++it;
}
}
}
| 18,480 |
141,466 | 0 | IntRect PaintLayerScrollableArea::RectForVerticalScrollbar(
const IntRect& border_box_rect) const {
if (!HasVerticalScrollbar())
return IntRect();
const IntRect& scroll_corner = ScrollCornerRect();
return IntRect(
VerticalScrollbarStart(border_box_rect.X(), border_box_rect.MaxX()),
border_box_rect.Y() + GetLayoutBox()->BorderTop().ToInt(),
VerticalScrollbar()->ScrollbarThickness(),
border_box_rect.Height() -
(GetLayoutBox()->BorderTop() + GetLayoutBox()->BorderBottom())
.ToInt() -
scroll_corner.Height());
}
| 18,481 |
52,741 | 0 | static int snd_timer_user_tselect(struct file *file,
struct snd_timer_select __user *_tselect)
{
struct snd_timer_user *tu;
struct snd_timer_select tselect;
char str[32];
int err = 0;
tu = file->private_data;
if (tu->timeri) {
snd_timer_close(tu->timeri);
tu->timeri = NULL;
}
if (copy_from_user(&tselect, _tselect, sizeof(tselect))) {
err = -EFAULT;
goto __err;
}
sprintf(str, "application %i", current->pid);
if (tselect.id.dev_class != SNDRV_TIMER_CLASS_SLAVE)
tselect.id.dev_sclass = SNDRV_TIMER_SCLASS_APPLICATION;
err = snd_timer_open(&tu->timeri, str, &tselect.id, current->pid);
if (err < 0)
goto __err;
kfree(tu->queue);
tu->queue = NULL;
kfree(tu->tqueue);
tu->tqueue = NULL;
if (tu->tread) {
tu->tqueue = kmalloc(tu->queue_size * sizeof(struct snd_timer_tread),
GFP_KERNEL);
if (tu->tqueue == NULL)
err = -ENOMEM;
} else {
tu->queue = kmalloc(tu->queue_size * sizeof(struct snd_timer_read),
GFP_KERNEL);
if (tu->queue == NULL)
err = -ENOMEM;
}
if (err < 0) {
snd_timer_close(tu->timeri);
tu->timeri = NULL;
} else {
tu->timeri->flags |= SNDRV_TIMER_IFLG_FAST;
tu->timeri->callback = tu->tread
? snd_timer_user_tinterrupt : snd_timer_user_interrupt;
tu->timeri->ccallback = snd_timer_user_ccallback;
tu->timeri->callback_data = (void *)tu;
tu->timeri->disconnect = snd_timer_user_disconnect;
}
__err:
return err;
}
| 18,482 |
117,021 | 0 | gfx::Rect GetWindowRect(GdkWindow* window) {
gint width = gdk_window_get_width(window);
gint height = gdk_window_get_height(window);
return gfx::Rect(width, height);
}
| 18,483 |
108,984 | 0 | void RenderViewImpl::OnSetWindowVisibility(bool visible) {
std::set<WebPluginDelegateProxy*>::iterator plugin_it;
for (plugin_it = plugin_delegates_.begin();
plugin_it != plugin_delegates_.end(); ++plugin_it) {
(*plugin_it)->SetContainerVisibility(visible);
}
}
| 18,484 |
176,504 | 0 | IHEVCD_ERROR_T ihevcd_parse_coding_quadtree(codec_t *ps_codec,
WORD32 x0,
WORD32 y0,
WORD32 log2_cb_size,
WORD32 ct_depth)
{
IHEVCD_ERROR_T ret = (IHEVCD_ERROR_T)IHEVCD_SUCCESS;
sps_t *ps_sps;
pps_t *ps_pps;
WORD32 split_cu_flag;
WORD32 x1, y1;
WORD32 cu_pos_x;
WORD32 cu_pos_y;
bitstrm_t *ps_bitstrm = &ps_codec->s_parse.s_bitstrm;
cab_ctxt_t *ps_cabac = &ps_codec->s_parse.s_cabac;
WORD32 cb_size = 1 << log2_cb_size;
ps_sps = ps_codec->s_parse.ps_sps;
ps_pps = ps_codec->s_parse.ps_pps;
/* Compute CU position with respect to current CTB in (8x8) units */
cu_pos_x = (x0 - (ps_codec->s_parse.i4_ctb_x << ps_sps->i1_log2_ctb_size)) >> 3;
cu_pos_y = (y0 - (ps_codec->s_parse.i4_ctb_y << ps_sps->i1_log2_ctb_size)) >> 3;
ps_codec->s_parse.s_cu.i4_pos_x = cu_pos_x;
ps_codec->s_parse.s_cu.i4_pos_y = cu_pos_y;
ps_codec->s_parse.s_cu.i4_log2_cb_size = log2_cb_size;
ps_codec->s_parse.i4_ct_depth = ct_depth;
{
UWORD32 *pu4_ct_depth_top = ps_codec->s_parse.pu4_ct_depth_top;
UWORD32 u4_ct_depth_left = ps_codec->s_parse.u4_ct_depth_left;
UWORD32 u4_ct_depth_top = 0;
UWORD32 u4_mask;
UWORD32 u4_top_mask, u4_left_mask;
WORD32 ctxt_idx;
UWORD32 u4_min_cu_x = x0 / 8;
UWORD32 u4_min_cu_y = y0 / 8;
pu4_ct_depth_top += (u4_min_cu_x / 16);
if(((x0 + (1 << log2_cb_size)) <= ps_sps->i2_pic_width_in_luma_samples) &&
((y0 + (1 << log2_cb_size)) <= ps_sps->i2_pic_height_in_luma_samples) &&
(log2_cb_size > ps_sps->i1_log2_min_coding_block_size))
{
ctxt_idx = IHEVC_CAB_SPLIT_CU_FLAG;
/* Split cu context increment is decided based on left and top Coding tree
* depth which is stored at frame level
*/
/* Check if the CTB is in first row in the current slice or tile */
if((0 != cu_pos_y) ||
((0 != ps_codec->s_parse.i4_ctb_slice_y) &&
(0 != ps_codec->s_parse.i4_ctb_tile_y)))
{
u4_ct_depth_top = *pu4_ct_depth_top;
u4_ct_depth_top >>= ((u4_min_cu_x % 16) * 2);
u4_ct_depth_top &= 3;
if((WORD32)u4_ct_depth_top > ct_depth)
ctxt_idx++;
}
/* Check if the CTB is in first column in the current slice or tile */
/*****************************************************************/
/* If cu_pos_x is non-zero then left is available */
/* If cu_pos_x is zero then ensure both the following are true */
/* Current CTB is not the first CTB in a tile row */
/* Current CTB is not the first CTB in a slice */
/*****************************************************************/
if((0 != cu_pos_x) ||
(((0 != ps_codec->s_parse.i4_ctb_slice_x) || (0 != ps_codec->s_parse.i4_ctb_slice_y)) &&
(0 != ps_codec->s_parse.i4_ctb_tile_x)))
{
u4_ct_depth_left >>= ((u4_min_cu_y % 16) * 2);
u4_ct_depth_left &= 3;
if((WORD32)u4_ct_depth_left > ct_depth)
ctxt_idx++;
}
TRACE_CABAC_CTXT("split_cu_flag", ps_cabac->u4_range, ctxt_idx);
split_cu_flag = ihevcd_cabac_decode_bin(ps_cabac, ps_bitstrm, ctxt_idx);
AEV_TRACE("split_cu_flag", split_cu_flag, ps_cabac->u4_range);
}
else
{
if(log2_cb_size > ps_sps->i1_log2_min_coding_block_size)
split_cu_flag = 1;
else
split_cu_flag = 0;
}
if(0 == split_cu_flag)
{
/* Update top ct_depth */
u4_ct_depth_top = *pu4_ct_depth_top;
/* Since Max cb_size is 64, maximum of 8 bits will be set or reset */
/* Also since Coding block will be within 64x64 grid, only 8bits within a WORD32
* need to be updated. These 8 bits will not cross 8 bit boundaries
*/
u4_mask = DUP_LSB_11(cb_size / 8);
u4_top_mask = u4_mask << ((u4_min_cu_x % 16) * 2);
u4_ct_depth_top &= ~u4_top_mask;
if(ct_depth)
{
u4_top_mask = gau4_ct_depth_mask[ct_depth] & u4_mask;
u4_top_mask = u4_top_mask << ((u4_min_cu_x % 16) * 2);
u4_ct_depth_top |= u4_top_mask;
}
*pu4_ct_depth_top = u4_ct_depth_top;
/* Update left ct_depth */
u4_ct_depth_left = ps_codec->s_parse.u4_ct_depth_left;
u4_left_mask = u4_mask << ((u4_min_cu_y % 16) * 2);
u4_ct_depth_left &= ~u4_left_mask;
if(ct_depth)
{
u4_left_mask = gau4_ct_depth_mask[ct_depth] & u4_mask;
u4_left_mask = u4_left_mask << ((u4_min_cu_y % 16) * 2);
u4_ct_depth_left |= u4_left_mask;
}
ps_codec->s_parse.u4_ct_depth_left = u4_ct_depth_left;
}
}
if((ps_pps->i1_cu_qp_delta_enabled_flag) &&
(log2_cb_size >= ps_pps->i1_log2_min_cu_qp_delta_size))
{
ps_codec->s_parse.i4_is_cu_qp_delta_coded = 0;
ps_codec->s_parse.i4_cu_qp_delta = 0;
}
if(split_cu_flag)
{
x1 = x0 + ((1 << log2_cb_size) >> 1);
y1 = y0 + ((1 << log2_cb_size) >> 1);
ret = ihevcd_parse_coding_quadtree(ps_codec, x0, y0, log2_cb_size - 1, ct_depth + 1);
RETURN_IF((IHEVCD_ERROR_T)IHEVCD_SUCCESS != ret, ret);
/* At frame boundaries coding quadtree nodes are sent only if they fall within the frame */
if(x1 < ps_sps->i2_pic_width_in_luma_samples)
{
ret = ihevcd_parse_coding_quadtree(ps_codec, x1, y0, log2_cb_size - 1, ct_depth + 1);
RETURN_IF((IHEVCD_ERROR_T)IHEVCD_SUCCESS != ret, ret);
}
if(y1 < ps_sps->i2_pic_height_in_luma_samples)
{
ret = ihevcd_parse_coding_quadtree(ps_codec, x0, y1, log2_cb_size - 1, ct_depth + 1);
RETURN_IF((IHEVCD_ERROR_T)IHEVCD_SUCCESS != ret, ret);
}
if((x1 < ps_sps->i2_pic_width_in_luma_samples) &&
(y1 < ps_sps->i2_pic_height_in_luma_samples))
{
ret = ihevcd_parse_coding_quadtree(ps_codec, x1, y1, log2_cb_size - 1, ct_depth + 1);
RETURN_IF((IHEVCD_ERROR_T)IHEVCD_SUCCESS != ret, ret);
}
}
else
{
/* Set current group QP if current CU is aligned with the group */
{
WORD32 cu_pos_x = ps_codec->s_parse.s_cu.i4_pos_x << 3;
WORD32 cu_pos_y = ps_codec->s_parse.s_cu.i4_pos_y << 3;
WORD32 qpg_x = (cu_pos_x - (cu_pos_x & ((1 << ps_pps->i1_log2_min_cu_qp_delta_size) - 1)));
WORD32 qpg_y = (cu_pos_y - (cu_pos_y & ((1 << ps_pps->i1_log2_min_cu_qp_delta_size) - 1)));
if((cu_pos_x == qpg_x) &&
(cu_pos_y == qpg_y))
{
ps_codec->s_parse.u4_qpg = ps_codec->s_parse.u4_qp;
ps_codec->s_parse.s_cu.i4_cu_qp_delta = 0;
}
}
ret = ihevcd_parse_coding_unit(ps_codec, x0, y0, log2_cb_size);
RETURN_IF((IHEVCD_ERROR_T)IHEVCD_SUCCESS != ret, ret);
if(ps_pps->i1_cu_qp_delta_enabled_flag)
{
WORD32 qp_pred, qp_left, qp_top;
WORD32 cu_pos_x;
WORD32 cu_pos_y;
WORD32 qpg_x;
WORD32 qpg_y;
WORD32 i, j;
WORD32 qp;
WORD32 cur_cu_offset;
tu_t *ps_tu = ps_codec->s_parse.ps_tu;
WORD32 cb_size = 1 << ps_codec->s_parse.s_cu.i4_log2_cb_size;
cu_pos_x = ps_codec->s_parse.s_cu.i4_pos_x << 3;
cu_pos_y = ps_codec->s_parse.s_cu.i4_pos_y << 3;
qpg_x = (cu_pos_x - (cu_pos_x & ((1 << ps_pps->i1_log2_min_cu_qp_delta_size) - 1))) >> 3;
qpg_y = (cu_pos_y - (cu_pos_y & ((1 << ps_pps->i1_log2_min_cu_qp_delta_size) - 1))) >> 3;
/*previous coded Qp*/
qp_left = ps_codec->s_parse.u4_qpg;
qp_top = ps_codec->s_parse.u4_qpg;
if(qpg_x > 0)
{
qp_left = ps_codec->s_parse.ai1_8x8_cu_qp[qpg_x - 1 + (qpg_y * 8)];
}
if(qpg_y > 0)
{
qp_top = ps_codec->s_parse.ai1_8x8_cu_qp[qpg_x + ((qpg_y - 1) * 8)];
}
qp_pred = (qp_left + qp_top + 1) >> 1;
/* Since qp_pred + ps_codec->s_parse.s_cu.i4_cu_qp_delta can be negative,
52 is added before taking modulo 52 */
qp = (qp_pred + ps_codec->s_parse.s_cu.i4_cu_qp_delta + 52) % 52;
cur_cu_offset = (cu_pos_x >> 3) + cu_pos_y;
for(i = 0; i < (cb_size >> 3); i++)
{
for(j = 0; j < (cb_size >> 3); j++)
{
ps_codec->s_parse.ai1_8x8_cu_qp[cur_cu_offset + (i * 8) + j] = qp;
}
}
ps_codec->s_parse.u4_qp = qp;
ps_codec->s_parse.s_cu.i4_qp = qp;
/* When change in QP is signaled, update the QP in TUs that are already parsed in the CU */
{
tu_t *ps_tu_tmp;
ps_tu_tmp = ps_tu - ps_codec->s_parse.s_cu.i4_tu_cnt;
ps_tu->b7_qp = ps_codec->s_parse.u4_qp;
while(ps_tu_tmp != ps_tu)
{
ps_tu_tmp->b7_qp = ps_codec->s_parse.u4_qp;
ps_tu_tmp++;
}
}
if(ps_codec->s_parse.s_cu.i4_cu_qp_delta)
{
WORD32 ctb_indx;
ctb_indx = ps_codec->s_parse.i4_ctb_x + ps_sps->i2_pic_wd_in_ctb * ps_codec->s_parse.i4_ctb_y;
ps_codec->s_parse.s_bs_ctxt.pu1_pic_qp_const_in_ctb[ctb_indx >> 3] &= (~(1 << (ctb_indx & 7)));
}
}
}
return ret;
}
| 18,485 |
156,401 | 0 | void PageHandler::GotManifest(std::unique_ptr<GetAppManifestCallback> callback,
const GURL& manifest_url,
blink::mojom::ManifestDebugInfoPtr debug_info) {
std::unique_ptr<Array<Page::AppManifestError>> errors =
Array<Page::AppManifestError>::create();
bool failed = true;
if (debug_info) {
failed = false;
for (const auto& error : debug_info->errors) {
errors->addItem(Page::AppManifestError::Create()
.SetMessage(error->message)
.SetCritical(error->critical)
.SetLine(error->line)
.SetColumn(error->column)
.Build());
if (error->critical)
failed = true;
}
}
callback->sendSuccess(
manifest_url.possibly_invalid_spec(), std::move(errors),
failed ? Maybe<std::string>() : debug_info->raw_manifest);
}
| 18,486 |
122,086 | 0 | APIPermissionInfo::~APIPermissionInfo() { }
| 18,487 |
33,951 | 0 | print_node_summary(pe_working_set_t * data_set, gboolean operations)
{
xmlNode *lrm_rsc = NULL;
xmlNode *rsc_entry = NULL;
xmlNode *node_state = NULL;
xmlNode *cib_status = get_object_root(XML_CIB_TAG_STATUS, data_set->input);
if (operations) {
print_as("\nOperations:\n");
} else {
print_as("\nMigration summary:\n");
}
for (node_state = __xml_first_child(cib_status); node_state != NULL;
node_state = __xml_next(node_state)) {
if (crm_str_eq((const char *)node_state->name, XML_CIB_TAG_STATE, TRUE)) {
node_t *node = pe_find_node_id(data_set->nodes, ID(node_state));
if (node == NULL || node->details->online == FALSE) {
continue;
}
print_as("* Node %s: ", crm_element_value(node_state, XML_ATTR_UNAME));
print_as("\n");
lrm_rsc = find_xml_node(node_state, XML_CIB_TAG_LRM, FALSE);
lrm_rsc = find_xml_node(lrm_rsc, XML_LRM_TAG_RESOURCES, FALSE);
for (rsc_entry = __xml_first_child(lrm_rsc); rsc_entry != NULL;
rsc_entry = __xml_next(rsc_entry)) {
if (crm_str_eq((const char *)rsc_entry->name, XML_LRM_TAG_RESOURCE, TRUE)) {
if (operations) {
print_rsc_history(data_set, node, rsc_entry);
} else {
const char *rsc_id = crm_element_value(rsc_entry, XML_ATTR_ID);
resource_t *rsc = pe_find_resource(data_set->resources, rsc_id);
if (rsc) {
print_rsc_summary(data_set, node, rsc, FALSE);
} else {
print_as(" %s: orphan\n", rsc_id);
}
}
}
}
}
}
}
| 18,488 |
180,664 | 1 | static void init_once(void *foo)
{
struct ext4_inode_info *ei = (struct ext4_inode_info *) foo;
INIT_LIST_HEAD(&ei->i_orphan);
init_rwsem(&ei->xattr_sem);
init_rwsem(&ei->i_data_sem);
inode_init_once(&ei->vfs_inode);
}
| 18,489 |
137,681 | 0 | void PrintPreviewDialogController::RemoveObservers(WebContents* contents) {
registrar_.Remove(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
content::Source<WebContents>(contents));
registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
content::Source<NavigationController>(&contents->GetController()));
content::Source<content::RenderProcessHost> rph_source(
contents->GetMainFrame()->GetProcess());
if (registrar_.IsRegistered(this,
content::NOTIFICATION_RENDERER_PROCESS_CLOSED, rph_source)) {
if (host_contents_count_map_[contents->GetMainFrame()->GetProcess()] == 1) {
registrar_.Remove(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED,
rph_source);
host_contents_count_map_.erase(contents->GetMainFrame()->GetProcess());
} else {
--host_contents_count_map_[contents->GetMainFrame()->GetProcess()];
}
}
}
| 18,490 |
38,091 | 0 | static int firm_set_rts(struct usb_serial_port *port, __u8 onoff)
{
struct whiteheat_set_rdb rts_command;
rts_command.port = port->port_number + 1;
rts_command.state = onoff;
return firm_send_command(port, WHITEHEAT_SET_RTS,
(__u8 *)&rts_command, sizeof(rts_command));
}
| 18,491 |
88,226 | 0 | XML_SetNotStandaloneHandler(XML_Parser parser,
XML_NotStandaloneHandler handler) {
if (parser != NULL)
parser->m_notStandaloneHandler = handler;
}
| 18,492 |
29,671 | 0 | static void free_area(struct pstore *ps)
{
if (ps->area)
vfree(ps->area);
ps->area = NULL;
if (ps->zero_area)
vfree(ps->zero_area);
ps->zero_area = NULL;
if (ps->header_area)
vfree(ps->header_area);
ps->header_area = NULL;
}
| 18,493 |
475 | 0 | static void pdf_run_CS(fz_context *ctx, pdf_processor *proc, const char *name, fz_colorspace *colorspace)
{
pdf_run_processor *pr = (pdf_run_processor *)proc;
pr->dev->flags &= ~FZ_DEVFLAG_STROKECOLOR_UNDEFINED;
if (!strcmp(name, "Pattern"))
pdf_set_pattern(ctx, pr, PDF_STROKE, NULL, NULL);
else
pdf_set_colorspace(ctx, pr, PDF_STROKE, colorspace);
}
| 18,494 |
134,990 | 0 | void AppCacheUpdateJob::CancelAllUrlFetches() {
for (PendingUrlFetches::iterator it = pending_url_fetches_.begin();
it != pending_url_fetches_.end(); ++it) {
delete it->second;
}
url_fetches_completed_ +=
pending_url_fetches_.size() + urls_to_fetch_.size();
pending_url_fetches_.clear();
urls_to_fetch_.clear();
}
| 18,495 |
121,740 | 0 | void ServiceWorkerScriptContext::OnMessageReceived(
int request_id,
const IPC::Message& message) {
DCHECK_EQ(kInvalidRequestId, current_request_id_);
current_request_id_ = request_id;
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(ServiceWorkerScriptContext, message)
IPC_MESSAGE_HANDLER(ServiceWorkerMsg_InstallEvent, OnInstallEvent)
IPC_MESSAGE_HANDLER(ServiceWorkerMsg_FetchEvent, OnFetchEvent)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
DCHECK(handled);
current_request_id_ = kInvalidRequestId;
}
| 18,496 |
87,397 | 0 | static int xen_memory_notifier(struct notifier_block *nb, unsigned long val, void *v)
{
if (val == MEM_ONLINE)
schedule_delayed_work(&balloon_worker, 0);
return NOTIFY_OK;
}
| 18,497 |
79,118 | 0 | _pango_Is_Emoji_Keycap_Base (gunichar ch)
{
return (ch >= '0' && ch <= '9') || ch == '#' || ch == '*';
}
| 18,498 |
49,133 | 0 | s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag,
const u8 *vndr_ie_buf, u32 vndr_ie_len)
{
struct brcmf_if *ifp;
struct vif_saved_ie *saved_ie;
s32 err = 0;
u8 *iovar_ie_buf;
u8 *curr_ie_buf;
u8 *mgmt_ie_buf = NULL;
int mgmt_ie_buf_len;
u32 *mgmt_ie_len;
u32 del_add_ie_buf_len = 0;
u32 total_ie_buf_len = 0;
u32 parsed_ie_buf_len = 0;
struct parsed_vndr_ies old_vndr_ies;
struct parsed_vndr_ies new_vndr_ies;
struct parsed_vndr_ie_info *vndrie_info;
s32 i;
u8 *ptr;
int remained_buf_len;
if (!vif)
return -ENODEV;
ifp = vif->ifp;
saved_ie = &vif->saved_ie;
brcmf_dbg(TRACE, "bsscfgidx %d, pktflag : 0x%02X\n", ifp->bsscfgidx,
pktflag);
iovar_ie_buf = kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL);
if (!iovar_ie_buf)
return -ENOMEM;
curr_ie_buf = iovar_ie_buf;
switch (pktflag) {
case BRCMF_VNDR_IE_PRBREQ_FLAG:
mgmt_ie_buf = saved_ie->probe_req_ie;
mgmt_ie_len = &saved_ie->probe_req_ie_len;
mgmt_ie_buf_len = sizeof(saved_ie->probe_req_ie);
break;
case BRCMF_VNDR_IE_PRBRSP_FLAG:
mgmt_ie_buf = saved_ie->probe_res_ie;
mgmt_ie_len = &saved_ie->probe_res_ie_len;
mgmt_ie_buf_len = sizeof(saved_ie->probe_res_ie);
break;
case BRCMF_VNDR_IE_BEACON_FLAG:
mgmt_ie_buf = saved_ie->beacon_ie;
mgmt_ie_len = &saved_ie->beacon_ie_len;
mgmt_ie_buf_len = sizeof(saved_ie->beacon_ie);
break;
case BRCMF_VNDR_IE_ASSOCREQ_FLAG:
mgmt_ie_buf = saved_ie->assoc_req_ie;
mgmt_ie_len = &saved_ie->assoc_req_ie_len;
mgmt_ie_buf_len = sizeof(saved_ie->assoc_req_ie);
break;
default:
err = -EPERM;
brcmf_err("not suitable type\n");
goto exit;
}
if (vndr_ie_len > mgmt_ie_buf_len) {
err = -ENOMEM;
brcmf_err("extra IE size too big\n");
goto exit;
}
/* parse and save new vndr_ie in curr_ie_buff before comparing it */
if (vndr_ie_buf && vndr_ie_len && curr_ie_buf) {
ptr = curr_ie_buf;
brcmf_parse_vndr_ies(vndr_ie_buf, vndr_ie_len, &new_vndr_ies);
for (i = 0; i < new_vndr_ies.count; i++) {
vndrie_info = &new_vndr_ies.ie_info[i];
memcpy(ptr + parsed_ie_buf_len, vndrie_info->ie_ptr,
vndrie_info->ie_len);
parsed_ie_buf_len += vndrie_info->ie_len;
}
}
if (mgmt_ie_buf && *mgmt_ie_len) {
if (parsed_ie_buf_len && (parsed_ie_buf_len == *mgmt_ie_len) &&
(memcmp(mgmt_ie_buf, curr_ie_buf,
parsed_ie_buf_len) == 0)) {
brcmf_dbg(TRACE, "Previous mgmt IE equals to current IE\n");
goto exit;
}
/* parse old vndr_ie */
brcmf_parse_vndr_ies(mgmt_ie_buf, *mgmt_ie_len, &old_vndr_ies);
/* make a command to delete old ie */
for (i = 0; i < old_vndr_ies.count; i++) {
vndrie_info = &old_vndr_ies.ie_info[i];
brcmf_dbg(TRACE, "DEL ID : %d, Len: %d , OUI:%02x:%02x:%02x\n",
vndrie_info->vndrie.id,
vndrie_info->vndrie.len,
vndrie_info->vndrie.oui[0],
vndrie_info->vndrie.oui[1],
vndrie_info->vndrie.oui[2]);
del_add_ie_buf_len = brcmf_vndr_ie(curr_ie_buf, pktflag,
vndrie_info->ie_ptr,
vndrie_info->ie_len,
"del");
curr_ie_buf += del_add_ie_buf_len;
total_ie_buf_len += del_add_ie_buf_len;
}
}
*mgmt_ie_len = 0;
/* Add if there is any extra IE */
if (mgmt_ie_buf && parsed_ie_buf_len) {
ptr = mgmt_ie_buf;
remained_buf_len = mgmt_ie_buf_len;
/* make a command to add new ie */
for (i = 0; i < new_vndr_ies.count; i++) {
vndrie_info = &new_vndr_ies.ie_info[i];
/* verify remained buf size before copy data */
if (remained_buf_len < (vndrie_info->vndrie.len +
VNDR_IE_VSIE_OFFSET)) {
brcmf_err("no space in mgmt_ie_buf: len left %d",
remained_buf_len);
break;
}
remained_buf_len -= (vndrie_info->ie_len +
VNDR_IE_VSIE_OFFSET);
brcmf_dbg(TRACE, "ADDED ID : %d, Len: %d, OUI:%02x:%02x:%02x\n",
vndrie_info->vndrie.id,
vndrie_info->vndrie.len,
vndrie_info->vndrie.oui[0],
vndrie_info->vndrie.oui[1],
vndrie_info->vndrie.oui[2]);
del_add_ie_buf_len = brcmf_vndr_ie(curr_ie_buf, pktflag,
vndrie_info->ie_ptr,
vndrie_info->ie_len,
"add");
/* save the parsed IE in wl struct */
memcpy(ptr + (*mgmt_ie_len), vndrie_info->ie_ptr,
vndrie_info->ie_len);
*mgmt_ie_len += vndrie_info->ie_len;
curr_ie_buf += del_add_ie_buf_len;
total_ie_buf_len += del_add_ie_buf_len;
}
}
if (total_ie_buf_len) {
err = brcmf_fil_bsscfg_data_set(ifp, "vndr_ie", iovar_ie_buf,
total_ie_buf_len);
if (err)
brcmf_err("vndr ie set error : %d\n", err);
}
exit:
kfree(iovar_ie_buf);
return err;
}
| 18,499 |
Subsets and Splits