unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
186,683 | 1 | void HeapAllocator::backingFree(void* address) {
if (!address)
return;
ThreadState* state = ThreadState::current();
if (state->sweepForbidden())
return;
ASSERT(!state->isInGC());
// Don't promptly free large objects because their page is never reused.
// Don't free backings allocated on other threads.
BasePage* page = pageFromObject(address);
if (page->isLargeObjectPage() || page->arena()->getThreadState() != state)
return;
HeapObjectHeader* header = HeapObjectHeader::fromPayload(address);
ASSERT(header->checkHeader());
NormalPageArena* arena = static_cast<NormalPage*>(page)->arenaForNormalPage();
state->promptlyFreed(header->gcInfoIndex());
arena->promptlyFreeObject(header);
}
| 14,000 |
54,499 | 0 | static int mov_metadata_gnre(MOVContext *c, AVIOContext *pb,
unsigned len, const char *key)
{
short genre;
char buf[20];
avio_r8(pb); // unknown
genre = avio_r8(pb);
if (genre < 1 || genre > ID3v1_GENRE_MAX)
return 0;
snprintf(buf, sizeof(buf), "%s", ff_id3v1_genre_str[genre-1]);
av_dict_set(&c->fc->metadata, key, buf, 0);
return 0;
}
| 14,001 |
39,914 | 0 | void skb_queue_tail(struct sk_buff_head *list, struct sk_buff *newsk)
{
unsigned long flags;
spin_lock_irqsave(&list->lock, flags);
__skb_queue_tail(list, newsk);
spin_unlock_irqrestore(&list->lock, flags);
}
| 14,002 |
169,026 | 0 | void OfflinePageModelTaskified::RemovePagesMatchingUrlAndNamespace(
const OfflinePageItem& page) {
auto task = DeletePageTask::CreateTaskDeletingForPageLimit(
store_.get(),
base::BindOnce(&OfflinePageModelTaskified::OnDeleteDone,
weak_ptr_factory_.GetWeakPtr(),
base::Bind([](DeletePageResult result) {})),
policy_controller_.get(), page);
task_queue_.AddTask(std::move(task));
}
| 14,003 |
187,901 | 1 | void SoftAMR::onQueueFilled(OMX_U32 /* portIndex */) {
List<BufferInfo *> &inQueue = getPortQueue(0);
List<BufferInfo *> &outQueue = getPortQueue(1);
if (mSignalledError || mOutputPortSettingsChange != NONE) {
return;
}
while (!inQueue.empty() && !outQueue.empty()) {
BufferInfo *inInfo = *inQueue.begin();
OMX_BUFFERHEADERTYPE *inHeader = inInfo->mHeader;
BufferInfo *outInfo = *outQueue.begin();
OMX_BUFFERHEADERTYPE *outHeader = outInfo->mHeader;
if (inHeader->nFlags & OMX_BUFFERFLAG_EOS) {
inQueue.erase(inQueue.begin());
inInfo->mOwnedByUs = false;
notifyEmptyBufferDone(inHeader);
outHeader->nFilledLen = 0;
outHeader->nFlags = OMX_BUFFERFLAG_EOS;
outQueue.erase(outQueue.begin());
outInfo->mOwnedByUs = false;
notifyFillBufferDone(outHeader);
return;
}
if (inHeader->nOffset == 0) {
mAnchorTimeUs = inHeader->nTimeStamp;
mNumSamplesOutput = 0;
}
const uint8_t *inputPtr = inHeader->pBuffer + inHeader->nOffset;
int32_t numBytesRead;
if (mMode == MODE_NARROW) {
numBytesRead =
AMRDecode(mState,
(Frame_Type_3GPP)((inputPtr[0] >> 3) & 0x0f),
(UWord8 *)&inputPtr[1],
reinterpret_cast<int16_t *>(outHeader->pBuffer),
MIME_IETF);
if (numBytesRead == -1) {
ALOGE("PV AMR decoder AMRDecode() call failed");
notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL);
mSignalledError = true;
return;
}
++numBytesRead; // Include the frame type header byte.
if (static_cast<size_t>(numBytesRead) > inHeader->nFilledLen) {
notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL);
mSignalledError = true;
return;
}
} else {
int16 mode = ((inputPtr[0] >> 3) & 0x0f);
if (mode >= 10 && mode <= 13) {
ALOGE("encountered illegal frame type %d in AMR WB content.",
mode);
notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL);
mSignalledError = true;
return;
}
size_t frameSize = getFrameSize(mode);
CHECK_GE(inHeader->nFilledLen, frameSize);
int16_t *outPtr = (int16_t *)outHeader->pBuffer;
if (mode >= 9) {
memset(outPtr, 0, kNumSamplesPerFrameWB * sizeof(int16_t));
} else if (mode < 9) {
int16 frameType;
RX_State_wb rx_state;
mime_unsorting(
const_cast<uint8_t *>(&inputPtr[1]),
mInputSampleBuffer,
&frameType, &mode, 1, &rx_state);
int16_t numSamplesOutput;
pvDecoder_AmrWb(
mode, mInputSampleBuffer,
outPtr,
&numSamplesOutput,
mDecoderBuf, frameType, mDecoderCookie);
CHECK_EQ((int)numSamplesOutput, (int)kNumSamplesPerFrameWB);
for (int i = 0; i < kNumSamplesPerFrameWB; ++i) {
/* Delete the 2 LSBs (14-bit output) */
outPtr[i] &= 0xfffC;
}
}
numBytesRead = frameSize;
}
inHeader->nOffset += numBytesRead;
inHeader->nFilledLen -= numBytesRead;
outHeader->nFlags = 0;
outHeader->nOffset = 0;
if (mMode == MODE_NARROW) {
outHeader->nFilledLen = kNumSamplesPerFrameNB * sizeof(int16_t);
outHeader->nTimeStamp =
mAnchorTimeUs
+ (mNumSamplesOutput * 1000000ll) / kSampleRateNB;
mNumSamplesOutput += kNumSamplesPerFrameNB;
} else {
outHeader->nFilledLen = kNumSamplesPerFrameWB * sizeof(int16_t);
outHeader->nTimeStamp =
mAnchorTimeUs
+ (mNumSamplesOutput * 1000000ll) / kSampleRateWB;
mNumSamplesOutput += kNumSamplesPerFrameWB;
}
if (inHeader->nFilledLen == 0) {
inInfo->mOwnedByUs = false;
inQueue.erase(inQueue.begin());
inInfo = NULL;
notifyEmptyBufferDone(inHeader);
inHeader = NULL;
}
outInfo->mOwnedByUs = false;
outQueue.erase(outQueue.begin());
outInfo = NULL;
notifyFillBufferDone(outHeader);
outHeader = NULL;
++mInputBufferCount;
}
}
| 14,004 |
24,721 | 0 | asmlinkage long sys_gettimeofday(struct timeval __user *tv,
struct timezone __user *tz)
{
if (likely(tv != NULL)) {
struct timeval ktv;
do_gettimeofday(&ktv);
if (copy_to_user(tv, &ktv, sizeof(ktv)))
return -EFAULT;
}
if (unlikely(tz != NULL)) {
if (copy_to_user(tz, &sys_tz, sizeof(sys_tz)))
return -EFAULT;
}
return 0;
}
| 14,005 |
4,145 | 0 | void Splash::setOverprintMask(Guint overprintMask, GBool additive) {
state->overprintMask = overprintMask;
state->overprintAdditive = additive;
}
| 14,006 |
55,634 | 0 | asmlinkage __visible void __sched schedule(void)
{
struct task_struct *tsk = current;
sched_submit_work(tsk);
do {
preempt_disable();
__schedule(false);
sched_preempt_enable_no_resched();
} while (need_resched());
}
| 14,007 |
13,152 | 0 | xps_parse_rectangle(xps_document *doc, char *text, fz_rect *rect)
{
float args[4];
char *s = text;
int i;
args[0] = 0; args[1] = 0;
args[2] = 1; args[3] = 1;
for (i = 0; i < 4 && *s; i++)
{
args[i] = fz_atof(s);
while (*s && *s != ',')
s++;
if (*s == ',')
s++;
}
rect->x0 = args[0];
rect->y0 = args[1];
rect->x1 = args[0] + args[2];
rect->y1 = args[1] + args[3];
}
| 14,008 |
78,325 | 0 | coolkey_v1_get_attribute_record_len(const u8 *attr, size_t buf_len)
{
size_t attribute_len = sizeof(coolkey_attribute_header_t);
size_t len = 0;
int r;
r = coolkey_v1_get_attribute_len(attr, buf_len, &len, 1);
if (r < 0) {
return buf_len; /* skip to the end, ignore the rest of the record */
}
return MIN(buf_len,attribute_len+len);
}
| 14,009 |
121,473 | 0 | void DevToolsWindow::UpdateTheme() {
ThemeService* tp = ThemeServiceFactory::GetForProfile(profile_);
DCHECK(tp);
std::string command("InspectorFrontendAPI.setToolbarColors(\"" +
SkColorToRGBAString(tp->GetColor(ThemeProperties::COLOR_TOOLBAR)) +
"\", \"" +
SkColorToRGBAString(tp->GetColor(ThemeProperties::COLOR_BOOKMARK_TEXT)) +
"\")");
web_contents_->GetRenderViewHost()->ExecuteJavascriptInWebFrame(
base::string16(), base::ASCIIToUTF16(command));
}
| 14,010 |
174,480 | 0 | virtual status_t signRSA(Vector<uint8_t> const &sessionId,
String8 const &algorithm,
Vector<uint8_t> const &message,
Vector<uint8_t> const &wrappedKey,
Vector<uint8_t> &signature) {
Parcel data, reply;
data.writeInterfaceToken(IDrm::getInterfaceDescriptor());
writeVector(data, sessionId);
data.writeString8(algorithm);
writeVector(data, message);
writeVector(data, wrappedKey);
status_t status = remote()->transact(SIGN_RSA, data, &reply);
if (status != OK) {
return status;
}
readVector(reply, signature);
return reply.readInt32();
}
| 14,011 |
64,034 | 0 | static HuffReader *get_huffman_group(WebPContext *s, ImageContext *img,
int x, int y)
{
ImageContext *gimg = &s->image[IMAGE_ROLE_ENTROPY];
int group = 0;
if (gimg->size_reduction > 0) {
int group_x = x >> gimg->size_reduction;
int group_y = y >> gimg->size_reduction;
int g0 = GET_PIXEL_COMP(gimg->frame, group_x, group_y, 1);
int g1 = GET_PIXEL_COMP(gimg->frame, group_x, group_y, 2);
group = g0 << 8 | g1;
}
return &img->huffman_groups[group * HUFFMAN_CODES_PER_META_CODE];
}
| 14,012 |
55,847 | 0 | static void __proc_set_tty(struct tty_struct *tty)
{
unsigned long flags;
spin_lock_irqsave(&tty->ctrl_lock, flags);
/*
* The session and fg pgrp references will be non-NULL if
* tiocsctty() is stealing the controlling tty
*/
put_pid(tty->session);
put_pid(tty->pgrp);
tty->pgrp = get_pid(task_pgrp(current));
spin_unlock_irqrestore(&tty->ctrl_lock, flags);
tty->session = get_pid(task_session(current));
if (current->signal->tty) {
tty_debug(tty, "current tty %s not NULL!!\n",
current->signal->tty->name);
tty_kref_put(current->signal->tty);
}
put_pid(current->signal->tty_old_pgrp);
current->signal->tty = tty_kref_get(tty);
current->signal->tty_old_pgrp = NULL;
}
| 14,013 |
10,496 | 0 | static void iscsi_allocationmap_set(IscsiLun *iscsilun, int64_t sector_num,
int nb_sectors)
{
if (iscsilun->allocationmap == NULL) {
return;
}
bitmap_set(iscsilun->allocationmap,
sector_num / iscsilun->cluster_sectors,
DIV_ROUND_UP(nb_sectors, iscsilun->cluster_sectors));
}
| 14,014 |
143,650 | 0 | void RenderWidgetHostImpl::Init() {
DCHECK(process_->HasConnection());
renderer_initialized_ = true;
if (view_) {
Send(new ViewMsg_SetSurfaceIdNamespace(routing_id_,
view_->GetSurfaceIdNamespace()));
}
SendScreenRects();
WasResized();
if (owner_delegate_)
owner_delegate_->RenderWidgetDidInit();
}
| 14,015 |
167,827 | 0 | void DownloadRequestLimiter::SetOnCanDownloadDecidedCallbackForTesting(
Callback callback) {
on_can_download_decided_callback_ = callback;
}
| 14,016 |
177,610 | 0 | virtual void PreDecodeFrameHook(
const libvpx_test::CompressedVideoSource &video,
libvpx_test::Decoder *decoder) {
if (num_buffers_ > 0 && video.frame_number() == 0) {
ASSERT_TRUE(fb_list_.CreateBufferList(num_buffers_));
ASSERT_EQ(VPX_CODEC_OK,
decoder->SetFrameBufferFunctions(
GetVP9FrameBuffer, ReleaseVP9FrameBuffer, this));
}
}
| 14,017 |
89,293 | 0 | int fpga_reset(void)
{
int ret = 0;
u8 resets;
if (!check_boco2()) {
/* we do not have BOCO2, this is not really used */
return 0;
}
/* if we have skipped, we only want to reset the PCIe part */
resets = skip ? PCIE_RST : PCIE_RST | TRAFFIC_RST;
ret = boco_clear_bits(PRST1, resets);
if (ret)
return ret;
/* small delay for the pulse */
udelay(10);
ret = boco_set_bits(PRST1, resets);
if (ret)
return ret;
return 0;
}
| 14,018 |
43,725 | 0 | static void ndisc_send_skb(struct sk_buff *skb,
const struct in6_addr *daddr,
const struct in6_addr *saddr)
{
struct dst_entry *dst = skb_dst(skb);
struct net *net = dev_net(skb->dev);
struct sock *sk = net->ipv6.ndisc_sk;
struct inet6_dev *idev;
int err;
struct icmp6hdr *icmp6h = icmp6_hdr(skb);
u8 type;
type = icmp6h->icmp6_type;
if (!dst) {
struct flowi6 fl6;
icmpv6_flow_init(sk, &fl6, type, saddr, daddr, skb->dev->ifindex);
dst = icmp6_dst_alloc(skb->dev, &fl6);
if (IS_ERR(dst)) {
kfree_skb(skb);
return;
}
skb_dst_set(skb, dst);
}
icmp6h->icmp6_cksum = csum_ipv6_magic(saddr, daddr, skb->len,
IPPROTO_ICMPV6,
csum_partial(icmp6h,
skb->len, 0));
ip6_nd_hdr(skb, saddr, daddr, inet6_sk(sk)->hop_limit, skb->len);
rcu_read_lock();
idev = __in6_dev_get(dst->dev);
IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUT, skb->len);
err = NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT, skb, NULL, dst->dev,
dst_output);
if (!err) {
ICMP6MSGOUT_INC_STATS(net, idev, type);
ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTMSGS);
}
rcu_read_unlock();
}
| 14,019 |
179,011 | 1 | static void perf_swevent_overflow(struct perf_event *event, u64 overflow,
int nmi, struct perf_sample_data *data,
struct pt_regs *regs)
{
struct hw_perf_event *hwc = &event->hw;
int throttle = 0;
data->period = event->hw.last_period;
if (!overflow)
overflow = perf_swevent_set_period(event);
if (hwc->interrupts == MAX_INTERRUPTS)
return;
for (; overflow; overflow--) {
if (__perf_event_overflow(event, nmi, throttle,
data, regs)) {
/*
* We inhibit the overflow from happening when
* hwc->interrupts == MAX_INTERRUPTS.
*/
break;
}
throttle = 1;
}
}
| 14,020 |
113,283 | 0 | NativePanelTesting* NativePanelTesting::Create(NativePanel* native_panel) {
return new NativePanelTestingWin(static_cast<PanelBrowserView*>(
native_panel));
}
| 14,021 |
163,178 | 0 | void ExecuteScriptAndCheckPDFNavigation(
RenderFrameHost* rfh,
const std::string& javascript,
ExpectedNavigationStatus expected_navigation_status) {
const GURL original_url(shell()->web_contents()->GetLastCommittedURL());
const std::string expected_message =
(expected_navigation_status == NAVIGATION_ALLOWED)
? std::string()
: kDataUrlBlockedPattern;
std::unique_ptr<ConsoleObserverDelegate> console_delegate;
if (!expected_message.empty()) {
console_delegate.reset(new ConsoleObserverDelegate(
shell()->web_contents(), expected_message));
shell()->web_contents()->SetDelegate(console_delegate.get());
}
TestNavigationObserver navigation_observer(shell()->web_contents());
EXPECT_TRUE(ExecuteScript(rfh, javascript));
if (console_delegate) {
console_delegate->Wait();
shell()->web_contents()->SetDelegate(nullptr);
}
switch (expected_navigation_status) {
case NAVIGATION_ALLOWED:
navigation_observer.Wait();
EXPECT_TRUE(shell()->web_contents()->GetLastCommittedURL().SchemeIs(
url::kDataScheme));
EXPECT_TRUE(navigation_observer.last_navigation_url().SchemeIs(
url::kDataScheme));
EXPECT_TRUE(navigation_observer.last_navigation_succeeded());
break;
case NAVIGATION_BLOCKED:
EXPECT_EQ(original_url, shell()->web_contents()->GetLastCommittedURL());
EXPECT_FALSE(navigation_observer.last_navigation_succeeded());
break;
default:
NOTREACHED();
}
}
| 14,022 |
61,774 | 0 | static int cine_read_probe(AVProbeData *p)
{
int HeaderSize;
if (p->buf[0] == 'C' && p->buf[1] == 'I' && // Type
(HeaderSize = AV_RL16(p->buf + 2)) >= 0x2C && // HeaderSize
AV_RL16(p->buf + 4) <= CC_UNINT && // Compression
AV_RL16(p->buf + 6) <= 1 && // Version
AV_RL32(p->buf + 20) && // ImageCount
AV_RL32(p->buf + 24) >= HeaderSize && // OffImageHeader
AV_RL32(p->buf + 28) >= HeaderSize && // OffSetup
AV_RL32(p->buf + 32) >= HeaderSize) // OffImageOffsets
return AVPROBE_SCORE_MAX;
return 0;
}
| 14,023 |
6,625 | 0 | lib_file_open_search_with_combine(gs_file_path_ptr lib_path, const gs_memory_t *mem, i_ctx_t *i_ctx_p,
const char *fname, uint flen, char *buffer, int blen, uint *pclen, ref *pfile,
gx_io_device *iodev, bool starting_arg_file, char *fmode)
{
stream *s;
const gs_file_path *pfpath = lib_path;
uint pi;
for (pi = 0; pi < r_size(&pfpath->list); ++pi) {
const ref *prdir = pfpath->list.value.refs + pi;
const char *pstr = (const char *)prdir->value.const_bytes;
uint plen = r_size(prdir), blen1 = blen;
gs_parsed_file_name_t pname;
gp_file_name_combine_result r;
/* We need to concatenate and parse the file name here
* if this path has a %device% prefix. */
if (pstr[0] == '%') {
int code;
/* We concatenate directly since gp_file_name_combine_*
* rules are not correct for other devices such as %rom% */
code = gs_parse_file_name(&pname, pstr, plen, mem);
if (code < 0)
continue;
if (blen < max(pname.len, plen) + flen)
return_error(gs_error_limitcheck);
memcpy(buffer, pname.fname, pname.len);
memcpy(buffer+pname.len, fname, flen);
code = pname.iodev->procs.open_file(pname.iodev, buffer, pname.len + flen, fmode,
&s, (gs_memory_t *)mem);
if (code < 0)
continue;
make_stream_file(pfile, s, "r");
/* fill in the buffer with the device concatenated */
memcpy(buffer, pstr, plen);
memcpy(buffer+plen, fname, flen);
*pclen = plen + flen;
return 0;
} else {
r = gp_file_name_combine(pstr, plen,
fname, flen, false, buffer, &blen1);
if (r != gp_combine_success)
continue;
if (iodev_os_open_file(iodev, (const char *)buffer, blen1, (const char *)fmode,
&s, (gs_memory_t *)mem) == 0) {
if (starting_arg_file ||
check_file_permissions_aux(i_ctx_p, buffer, blen1) >= 0) {
*pclen = blen1;
make_stream_file(pfile, s, "r");
return 0;
}
sclose(s);
return_error(gs_error_invalidfileaccess);
}
}
}
return 1;
}
| 14,024 |
47,803 | 0 | int snd_pcm_add_chmap_ctls(struct snd_pcm *pcm, int stream,
const struct snd_pcm_chmap_elem *chmap,
int max_channels,
unsigned long private_value,
struct snd_pcm_chmap **info_ret)
{
struct snd_pcm_chmap *info;
struct snd_kcontrol_new knew = {
.iface = SNDRV_CTL_ELEM_IFACE_PCM,
.access = SNDRV_CTL_ELEM_ACCESS_READ |
SNDRV_CTL_ELEM_ACCESS_TLV_READ |
SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK,
.info = pcm_chmap_ctl_info,
.get = pcm_chmap_ctl_get,
.tlv.c = pcm_chmap_ctl_tlv,
};
int err;
info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info)
return -ENOMEM;
info->pcm = pcm;
info->stream = stream;
info->chmap = chmap;
info->max_channels = max_channels;
if (stream == SNDRV_PCM_STREAM_PLAYBACK)
knew.name = "Playback Channel Map";
else
knew.name = "Capture Channel Map";
knew.device = pcm->device;
knew.count = pcm->streams[stream].substream_count;
knew.private_value = private_value;
info->kctl = snd_ctl_new1(&knew, info);
if (!info->kctl) {
kfree(info);
return -ENOMEM;
}
info->kctl->private_free = pcm_chmap_ctl_private_free;
err = snd_ctl_add(pcm->card, info->kctl);
if (err < 0)
return err;
pcm->streams[stream].chmap_kctl = info->kctl;
if (info_ret)
*info_ret = info;
return 0;
}
| 14,025 |
141,672 | 0 | double getDoubleFromMap(v8::Local<v8::Map> map, const String16& key, double defaultValue)
{
v8::Local<v8::String> v8Key = toV8String(m_isolate, key);
if (!map->Has(m_context, v8Key).FromMaybe(false))
return defaultValue;
v8::Local<v8::Value> intValue;
if (!map->Get(m_context, v8Key).ToLocal(&intValue))
return defaultValue;
return intValue.As<v8::Number>()->Value();
}
| 14,026 |
77,114 | 0 | OVS_EXCLUDED(ofproto_mutex)
{
struct ofport *ofport, *next_ofport;
struct ofport_usage *usage;
if (!p) {
return;
}
if (p->meters) {
meter_delete(p, 1, p->meter_features.max_meters);
p->meter_features.max_meters = 0;
free(p->meters);
p->meters = NULL;
}
ofproto_flush__(p);
HMAP_FOR_EACH_SAFE (ofport, next_ofport, hmap_node, &p->ports) {
ofport_destroy(ofport, del);
}
HMAP_FOR_EACH_POP (usage, hmap_node, &p->ofport_usage) {
free(usage);
}
p->ofproto_class->destruct(p, del);
/* We should not postpone this because it involves deleting a listening
* socket which we may want to reopen soon. 'connmgr' may be used by other
* threads only if they take the ofproto_mutex and read a non-NULL
* 'ofproto->connmgr'. */
ovs_mutex_lock(&ofproto_mutex);
connmgr_destroy(p->connmgr);
p->connmgr = NULL;
ovs_mutex_unlock(&ofproto_mutex);
/* Destroying rules is deferred, must have 'ofproto' around for them. */
ovsrcu_postpone(ofproto_destroy_defer__, p);
}
| 14,027 |
63,526 | 0 | void mq_clear_sbinfo(struct ipc_namespace *ns)
{
ns->mq_mnt->mnt_sb->s_fs_info = NULL;
}
| 14,028 |
53,364 | 0 | get_parameters(struct iperf_test *test)
{
int r = 0;
cJSON *j;
cJSON *j_p;
j = JSON_read(test->ctrl_sck);
if (j == NULL) {
i_errno = IERECVPARAMS;
r = -1;
} else {
if (test->debug) {
printf("get_parameters:\n%s\n", cJSON_Print(j));
}
if ((j_p = cJSON_GetObjectItem(j, "tcp")) != NULL)
set_protocol(test, Ptcp);
if ((j_p = cJSON_GetObjectItem(j, "udp")) != NULL)
set_protocol(test, Pudp);
if ((j_p = cJSON_GetObjectItem(j, "omit")) != NULL)
test->omit = j_p->valueint;
if ((j_p = cJSON_GetObjectItem(j, "server_affinity")) != NULL)
test->server_affinity = j_p->valueint;
if ((j_p = cJSON_GetObjectItem(j, "time")) != NULL)
test->duration = j_p->valueint;
if ((j_p = cJSON_GetObjectItem(j, "num")) != NULL)
test->settings->bytes = j_p->valueint;
if ((j_p = cJSON_GetObjectItem(j, "blockcount")) != NULL)
test->settings->blocks = j_p->valueint;
if ((j_p = cJSON_GetObjectItem(j, "MSS")) != NULL)
test->settings->mss = j_p->valueint;
if ((j_p = cJSON_GetObjectItem(j, "nodelay")) != NULL)
test->no_delay = 1;
if ((j_p = cJSON_GetObjectItem(j, "parallel")) != NULL)
test->num_streams = j_p->valueint;
if ((j_p = cJSON_GetObjectItem(j, "reverse")) != NULL)
iperf_set_test_reverse(test, 1);
if ((j_p = cJSON_GetObjectItem(j, "window")) != NULL)
test->settings->socket_bufsize = j_p->valueint;
if ((j_p = cJSON_GetObjectItem(j, "len")) != NULL)
test->settings->blksize = j_p->valueint;
if ((j_p = cJSON_GetObjectItem(j, "bandwidth")) != NULL)
test->settings->rate = j_p->valueint;
if ((j_p = cJSON_GetObjectItem(j, "burst")) != NULL)
test->settings->burst = j_p->valueint;
if ((j_p = cJSON_GetObjectItem(j, "TOS")) != NULL)
test->settings->tos = j_p->valueint;
if ((j_p = cJSON_GetObjectItem(j, "flowlabel")) != NULL)
test->settings->flowlabel = j_p->valueint;
if ((j_p = cJSON_GetObjectItem(j, "title")) != NULL)
test->title = strdup(j_p->valuestring);
if ((j_p = cJSON_GetObjectItem(j, "congestion")) != NULL)
test->congestion = strdup(j_p->valuestring);
if ((j_p = cJSON_GetObjectItem(j, "get_server_output")) != NULL)
iperf_set_test_get_server_output(test, 1);
if (test->sender && test->protocol->id == Ptcp && has_tcpinfo_retransmits())
test->sender_has_retransmits = 1;
cJSON_Delete(j);
}
return r;
}
| 14,029 |
144,228 | 0 | void LockContentsView::UpdateEasyUnlockIconForUser(const AccountId& user) {
LoginBigUserView* big_view =
TryToFindBigUser(user, false /*require_auth_active*/);
if (!big_view || !big_view->auth_user())
return;
UserState* state = FindStateForUser(user);
DCHECK(state);
if (!state->easy_unlock_state) {
big_view->auth_user()->SetEasyUnlockIcon(mojom::EasyUnlockIconId::NONE,
base::string16());
return;
}
base::string16 accessibility_label = state->easy_unlock_state->aria_label;
if (accessibility_label.empty())
accessibility_label = state->easy_unlock_state->tooltip;
big_view->auth_user()->SetEasyUnlockIcon(state->easy_unlock_state->icon,
accessibility_label);
}
| 14,030 |
186,313 | 1 | void MediaControlsProgressView::HandleSeeking(
const gfx::Point& location_in_bar) {
double seek_to_progress =
static_cast<double>(location_in_bar.x()) / progress_bar_->width();
seek_callback_.Run(seek_to_progress);
}
| 14,031 |
155,891 | 0 | std::vector<gfx::Image> GetImagesForAccounts(
const std::vector<AccountInfo>& accounts,
Profile* profile) {
AccountTrackerService* tracker_service =
AccountTrackerServiceFactory::GetForProfile(profile);
std::vector<gfx::Image> images;
for (auto account : accounts) {
images.push_back(tracker_service->GetAccountImage(account.account_id));
}
return images;
}
| 14,032 |
17,174 | 0 | void OxideQQuickWebView::setRestoreState(const QString& state) {
Q_D(OxideQQuickWebView);
if (d->proxy_) {
qWarning() <<
"OxideQQuickWebView: restoreState must be provided during construction";
return;
}
d->construct_props_->restore_state =
QByteArray::fromBase64(state.toLocal8Bit());
}
| 14,033 |
99,881 | 0 | void WebPluginDelegateProxy::OnCancelDocumentLoad() {
plugin_->CancelDocumentLoad();
}
| 14,034 |
94,818 | 0 | MagickExport MagickBooleanType SyncAuthenticPixels(Image *image,
ExceptionInfo *exception)
{
CacheInfo
*magick_restrict cache_info;
const int
id = GetOpenMPThreadId();
MagickBooleanType
status;
assert(image != (Image *) NULL);
assert(image->signature == MagickCoreSignature);
assert(image->cache != (Cache) NULL);
cache_info=(CacheInfo *) image->cache;
assert(cache_info->signature == MagickCoreSignature);
if (cache_info->methods.sync_authentic_pixels_handler !=
(SyncAuthenticPixelsHandler) NULL)
{
status=cache_info->methods.sync_authentic_pixels_handler(image,
exception);
return(status);
}
assert(id < (int) cache_info->number_threads);
status=SyncAuthenticPixelCacheNexus(image,cache_info->nexus_info[id],
exception);
return(status);
}
| 14,035 |
125,115 | 0 | PluginProcessHost* PluginServiceImpl::FindOrStartNpapiPluginProcess(
int render_process_id,
const FilePath& plugin_path) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
if (filter_ && !filter_->CanLoadPlugin(render_process_id, plugin_path))
return NULL;
PluginProcessHost* plugin_host = FindNpapiPluginProcess(plugin_path);
if (plugin_host)
return plugin_host;
webkit::WebPluginInfo info;
if (!GetPluginInfoByPath(plugin_path, &info)) {
return NULL;
}
scoped_ptr<PluginProcessHost> new_host(new PluginProcessHost());
if (!new_host->Init(info)) {
NOTREACHED(); // Init is not expected to fail.
return NULL;
}
return new_host.release();
}
| 14,036 |
82,320 | 0 | JsVar *jspeConditionalExpression() {
return __jspeConditionalExpression(jspeBinaryExpression());
}
| 14,037 |
96,407 | 0 | int main(int argc, char **argv)
{
/* I18n */
setlocale(LC_ALL, "");
#if ENABLE_NLS
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
#endif
abrt_init(argv);
/* Can't keep these strings/structs static: _() doesn't support that */
const char *program_usage_string = _(
"& [-vusoxm] [-d DIR]/[-D] [FILE]\n"
"\n"
"Extract oops from FILE (or standard input)"
);
enum {
OPT_v = 1 << 0,
OPT_s = 1 << 1,
OPT_o = 1 << 2,
OPT_d = 1 << 3,
OPT_D = 1 << 4,
OPT_u = 1 << 5,
OPT_x = 1 << 6,
OPT_t = 1 << 7,
OPT_m = 1 << 8,
};
char *problem_dir = NULL;
/* Keep enum above and order of options below in sync! */
struct options program_options[] = {
OPT__VERBOSE(&g_verbose),
OPT_BOOL( 's', NULL, NULL, _("Log to syslog")),
OPT_BOOL( 'o', NULL, NULL, _("Print found oopses on standard output")),
/* oopses don't contain any sensitive info, and even
* the old koops app was showing the oopses to all users
*/
OPT_STRING('d', NULL, &debug_dumps_dir, "DIR", _("Create new problem directory in DIR for every oops found")),
OPT_BOOL( 'D', NULL, NULL, _("Same as -d DumpLocation, DumpLocation is specified in abrt.conf")),
OPT_STRING('u', NULL, &problem_dir, "PROBLEM", _("Save the extracted information in PROBLEM")),
OPT_BOOL( 'x', NULL, NULL, _("Make the problem directory world readable")),
OPT_BOOL( 't', NULL, NULL, _("Throttle problem directory creation to 1 per second")),
OPT_BOOL( 'm', NULL, NULL, _("Print search string(s) to stdout and exit")),
OPT_END()
};
unsigned opts = parse_opts(argc, argv, program_options, program_usage_string);
export_abrt_envvars(0);
msg_prefix = g_progname;
if ((opts & OPT_s) || getenv("ABRT_SYSLOG"))
{
logmode = LOGMODE_JOURNAL;
}
if (opts & OPT_m)
{
map_string_t *settings = new_map_string();
load_abrt_plugin_conf_file("oops.conf", settings);
int only_fatal_mce = 1;
try_get_map_string_item_as_bool(settings, "OnlyFatalMCE", &only_fatal_mce);
free_map_string(settings);
if (only_fatal_mce)
{
regex_t mce_re;
if (regcomp(&mce_re, "^Machine .*$", REG_NOSUB) != 0)
perror_msg_and_die(_("Failed to compile regex"));
const regex_t *filter[] = { &mce_re, NULL };
koops_print_suspicious_strings_filtered(filter);
regfree(&mce_re);
}
else
koops_print_suspicious_strings();
return 1;
}
if (opts & OPT_D)
{
if (opts & OPT_d)
show_usage_and_die(program_usage_string, program_options);
load_abrt_conf();
debug_dumps_dir = g_settings_dump_location;
g_settings_dump_location = NULL;
free_abrt_conf_data();
}
argv += optind;
if (argv[0])
xmove_fd(xopen(argv[0], O_RDONLY), STDIN_FILENO);
world_readable_dump = (opts & OPT_x);
throttle_dd_creation = (opts & OPT_t);
unsigned errors = 0;
GList *oops_list = NULL;
scan_syslog_file(&oops_list, STDIN_FILENO);
int oops_cnt = g_list_length(oops_list);
if (oops_cnt != 0)
{
log("Found oopses: %d", oops_cnt);
if (opts & OPT_o)
{
int i = 0;
while (i < oops_cnt)
{
char *kernel_bt = (char*)g_list_nth_data(oops_list, i++);
char *tainted_short = kernel_tainted_short(kernel_bt);
if (tainted_short)
log("Kernel is tainted '%s'", tainted_short);
free(tainted_short);
printf("\nVersion: %s", kernel_bt);
}
}
if (opts & (OPT_d|OPT_D))
{
if (opts & OPT_D)
{
load_abrt_conf();
debug_dumps_dir = g_settings_dump_location;
}
log("Creating problem directories");
errors = create_oops_dump_dirs(oops_list, oops_cnt);
if (errors)
log("%d errors while dumping oopses", errors);
/*
* This marker in syslog file prevents us from
* re-parsing old oopses. The only problem is that we
* can't be sure here that the file we are watching
* is the same file where syslog(xxx) stuff ends up.
*/
syslog(LOG_WARNING,
"Reported %u kernel oopses to Abrt",
oops_cnt
);
}
if (opts & OPT_u)
{
log("Updating problem directory");
switch (oops_cnt)
{
case 1:
{
struct dump_dir *dd = dd_opendir(problem_dir, /*open for writing*/0);
if (dd)
{
save_oops_data_in_dump_dir(dd, (char *)oops_list->data, /*no proc modules*/NULL);
dd_close(dd);
}
}
break;
default:
error_msg(_("Can't update the problem: more than one oops found"));
break;
}
}
}
list_free_with_free(oops_list);
/* If we are run by a log watcher, this delays log rescan
* (because log watcher waits to us to terminate)
* and possibly prevents dreaded "abrt storm".
*/
int unreported_cnt = oops_cnt - MAX_DUMPED_DD_COUNT;
if (unreported_cnt > 0 && throttle_dd_creation)
{
/* Quadratic throttle time growth, but careful to not overflow in "n*n" */
int n = unreported_cnt > 30 ? 30 : unreported_cnt;
n = n * n;
if (n > 9)
log(_("Sleeping for %d seconds"), n);
sleep(n); /* max 15 mins */
}
return errors;
}
| 14,038 |
71,990 | 0 | static int CompareEdges(const void *x,const void *y)
{
register const EdgeInfo
*p,
*q;
/*
Compare two edges.
*/
p=(const EdgeInfo *) x;
q=(const EdgeInfo *) y;
if ((p->points[0].y-DrawEpsilon) > q->points[0].y)
return(1);
if ((p->points[0].y+DrawEpsilon) < q->points[0].y)
return(-1);
if ((p->points[0].x-DrawEpsilon) > q->points[0].x)
return(1);
if ((p->points[0].x+DrawEpsilon) < q->points[0].x)
return(-1);
if (((p->points[1].x-p->points[0].x)*(q->points[1].y-q->points[0].y)-
(p->points[1].y-p->points[0].y)*(q->points[1].x-q->points[0].x)) > 0.0)
return(1);
return(-1);
}
| 14,039 |
45,016 | 0 | static int assign_eip_far(struct x86_emulate_ctxt *ctxt, ulong dst,
const struct desc_struct *cs_desc)
{
enum x86emul_mode mode = ctxt->mode;
#ifdef CONFIG_X86_64
if (ctxt->mode >= X86EMUL_MODE_PROT32 && cs_desc->l) {
u64 efer = 0;
ctxt->ops->get_msr(ctxt, MSR_EFER, &efer);
if (efer & EFER_LMA)
mode = X86EMUL_MODE_PROT64;
}
#endif
if (mode == X86EMUL_MODE_PROT16 || mode == X86EMUL_MODE_PROT32)
mode = cs_desc->d ? X86EMUL_MODE_PROT32 : X86EMUL_MODE_PROT16;
return assign_eip(ctxt, dst, mode);
}
| 14,040 |
70,392 | 0 | int jas_matrix_cmp(jas_matrix_t *mat0, jas_matrix_t *mat1)
{
int i;
int j;
if (mat0->numrows_ != mat1->numrows_ || mat0->numcols_ !=
mat1->numcols_) {
return 1;
}
for (i = 0; i < mat0->numrows_; i++) {
for (j = 0; j < mat0->numcols_; j++) {
if (jas_matrix_get(mat0, i, j) != jas_matrix_get(mat1, i, j)) {
return 1;
}
}
}
return 0;
}
| 14,041 |
128,051 | 0 | static void SetForceAuxiliaryBitmapRendering(
JNIEnv* env,
const JavaParamRef<jclass>&,
jboolean force_auxiliary_bitmap_rendering) {
g_force_auxiliary_bitmap_rendering = force_auxiliary_bitmap_rendering;
}
| 14,042 |
177,252 | 0 | void ACodec::onFrameRendered(int64_t mediaTimeUs, nsecs_t systemNano) {
if (mRenderTracker.onFrameRendered(mediaTimeUs, systemNano) != OK) {
mRenderTracker.dumpRenderQueue();
}
}
| 14,043 |
156,916 | 0 | void DocumentLoader::SetHistoryItemStateForCommit(
HistoryItem* old_item,
WebFrameLoadType load_type,
HistoryNavigationType navigation_type) {
if (!history_item_ || !IsBackForwardLoadType(load_type))
history_item_ = HistoryItem::Create();
history_item_->SetURL(UrlForHistory());
history_item_->SetReferrer(SecurityPolicy::GenerateReferrer(
request_.GetReferrerPolicy(), history_item_->Url(),
request_.HttpReferrer()));
history_item_->SetFormInfoFromRequest(request_);
if (!old_item || IsBackForwardLoadType(load_type))
return;
WebHistoryCommitType history_commit_type = LoadTypeToCommitType(load_type);
if (navigation_type == HistoryNavigationType::kDifferentDocument &&
(history_commit_type != kWebHistoryInertCommit ||
!EqualIgnoringFragmentIdentifier(old_item->Url(), history_item_->Url())))
return;
history_item_->SetDocumentSequenceNumber(old_item->DocumentSequenceNumber());
history_item_->CopyViewStateFrom(old_item);
history_item_->SetScrollRestorationType(old_item->ScrollRestorationType());
if (history_commit_type == kWebHistoryInertCommit &&
(navigation_type == HistoryNavigationType::kHistoryApi ||
old_item->Url() == history_item_->Url())) {
history_item_->SetStateObject(old_item->StateObject());
history_item_->SetItemSequenceNumber(old_item->ItemSequenceNumber());
}
}
| 14,044 |
53,078 | 0 | static void __user *u64_to_ptr(__u64 val)
{
return (void __user *) (unsigned long) val;
}
| 14,045 |
160,199 | 0 | void PDFiumEngine::CalculateVisiblePages() {
if (!doc_loader_)
return;
pending_pages_.clear();
doc_loader_->ClearPendingRequests();
std::vector<int> formerly_visible_pages;
std::swap(visible_pages_, formerly_visible_pages);
pp::Rect visible_rect(plugin_size_);
for (int i = 0; i < static_cast<int>(pages_.size()); ++i) {
if (visible_rect.Intersects(GetPageScreenRect(i))) {
visible_pages_.push_back(i);
if (CheckPageAvailable(i, &pending_pages_)) {
auto it = std::find(formerly_visible_pages.begin(),
formerly_visible_pages.end(), i);
if (it == formerly_visible_pages.end())
client_->NotifyPageBecameVisible(pages_[i]->GetPageFeatures());
}
} else {
if (defer_page_unload_) {
deferred_page_unloads_.push_back(i);
} else {
pages_[i]->Unload();
}
if (static_cast<int>(i) == last_page_mouse_down_)
last_page_mouse_down_ = -1;
}
}
form_highlights_.clear();
int most_visible_page = visible_pages_.empty() ? -1 : visible_pages_.front();
if (most_visible_page != -1 && !pages_.empty() &&
most_visible_page < static_cast<int>(pages_.size()) - 1) {
pp::Rect rc_first =
visible_rect.Intersect(GetPageScreenRect(most_visible_page));
pp::Rect rc_next =
visible_rect.Intersect(GetPageScreenRect(most_visible_page + 1));
if (rc_next.height() > rc_first.height())
most_visible_page++;
}
SetCurrentPage(most_visible_page);
}
| 14,046 |
115,441 | 0 | static inline bool isLocalFileScheme(WKStringRef scheme)
{
return WKStringIsEqualToUTF8CStringIgnoringCase(scheme, "file");
}
| 14,047 |
52,697 | 0 | static struct snd_timer_instance *snd_timer_instance_new(char *owner,
struct snd_timer *timer)
{
struct snd_timer_instance *timeri;
timeri = kzalloc(sizeof(*timeri), GFP_KERNEL);
if (timeri == NULL)
return NULL;
timeri->owner = kstrdup(owner, GFP_KERNEL);
if (! timeri->owner) {
kfree(timeri);
return NULL;
}
INIT_LIST_HEAD(&timeri->open_list);
INIT_LIST_HEAD(&timeri->active_list);
INIT_LIST_HEAD(&timeri->ack_list);
INIT_LIST_HEAD(&timeri->slave_list_head);
INIT_LIST_HEAD(&timeri->slave_active_head);
timeri->timer = timer;
if (timer && !try_module_get(timer->module)) {
kfree(timeri->owner);
kfree(timeri);
return NULL;
}
return timeri;
}
| 14,048 |
180,033 | 1 | sctp_disposition_t sctp_sf_ootb(struct net *net,
const struct sctp_endpoint *ep,
const struct sctp_association *asoc,
const sctp_subtype_t type,
void *arg,
sctp_cmd_seq_t *commands)
{
struct sctp_chunk *chunk = arg;
struct sk_buff *skb = chunk->skb;
sctp_chunkhdr_t *ch;
sctp_errhdr_t *err;
__u8 *ch_end;
int ootb_shut_ack = 0;
int ootb_cookie_ack = 0;
SCTP_INC_STATS(net, SCTP_MIB_OUTOFBLUES);
ch = (sctp_chunkhdr_t *) chunk->chunk_hdr;
do {
/* Report violation if the chunk is less then minimal */
if (ntohs(ch->length) < sizeof(sctp_chunkhdr_t))
return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
commands);
/* Now that we know we at least have a chunk header,
* do things that are type appropriate.
*/
if (SCTP_CID_SHUTDOWN_ACK == ch->type)
ootb_shut_ack = 1;
/* RFC 2960, Section 3.3.7
* Moreover, under any circumstances, an endpoint that
* receives an ABORT MUST NOT respond to that ABORT by
* sending an ABORT of its own.
*/
if (SCTP_CID_ABORT == ch->type)
return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
/* RFC 8.4, 7) If the packet contains a "Stale cookie" ERROR
* or a COOKIE ACK the SCTP Packet should be silently
* discarded.
*/
if (SCTP_CID_COOKIE_ACK == ch->type)
ootb_cookie_ack = 1;
if (SCTP_CID_ERROR == ch->type) {
sctp_walk_errors(err, ch) {
if (SCTP_ERROR_STALE_COOKIE == err->cause) {
ootb_cookie_ack = 1;
break;
}
}
}
/* Report violation if chunk len overflows *
ch_end = ((__u8 *)ch) + SCTP_PAD4(ntohs(ch->length));
if (ch_end > skb_tail_pointer(skb))
return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
commands);
ch = (sctp_chunkhdr_t *) ch_end;
} while (ch_end < skb_tail_pointer(skb));
if (ootb_shut_ack)
return sctp_sf_shut_8_4_5(net, ep, asoc, type, arg, commands);
else if (ootb_cookie_ack)
return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
else
return sctp_sf_tabort_8_4_8(net, ep, asoc, type, arg, commands);
}
| 14,049 |
73,542 | 0 | static inline const unsigned char *ReadResourceLong(const unsigned char *p,
unsigned int *quantum)
{
*quantum=(size_t) (*p++ << 24);
*quantum|=(size_t) (*p++ << 16);
*quantum|=(size_t) (*p++ << 8);
*quantum|=(size_t) (*p++ << 0);
return(p);
}
| 14,050 |
151,260 | 0 | bool InspectorPageAgent::SharedBufferContent(RefPtr<const SharedBuffer> buffer,
const String& mime_type,
const String& text_encoding_name,
String* result,
bool* base64_encoded) {
if (!buffer)
return false;
String text_content;
std::unique_ptr<TextResourceDecoder> decoder =
CreateResourceTextDecoder(mime_type, text_encoding_name);
WTF::TextEncoding encoding(text_encoding_name);
const SharedBuffer::DeprecatedFlatData flat_buffer(std::move(buffer));
if (decoder) {
text_content = decoder->Decode(flat_buffer.Data(), flat_buffer.size());
text_content = text_content + decoder->Flush();
} else if (encoding.IsValid()) {
text_content = encoding.Decode(flat_buffer.Data(), flat_buffer.size());
}
MaybeEncodeTextContent(text_content, flat_buffer.Data(), flat_buffer.size(),
result, base64_encoded);
return true;
}
| 14,051 |
121,828 | 0 | void ImageLoader::dispatchPendingEvent(ImageEventSender* eventSender)
{
ASSERT(eventSender == &beforeLoadEventSender() || eventSender == &loadEventSender() || eventSender == &errorEventSender());
const AtomicString& eventType = eventSender->eventType();
if (eventType == eventNames().beforeloadEvent)
dispatchPendingBeforeLoadEvent();
if (eventType == eventNames().loadEvent)
dispatchPendingLoadEvent();
if (eventType == eventNames().errorEvent)
dispatchPendingErrorEvent();
}
| 14,052 |
102,847 | 0 | PluginObserver::~PluginObserver() {
}
| 14,053 |
13,474 | 0 | void js_replace(js_State* J, int idx)
{
idx = idx < 0 ? TOP + idx : BOT + idx;
if (idx < BOT || idx >= TOP)
js_error(J, "stack error!");
STACK[idx] = STACK[--TOP];
}
| 14,054 |
75,716 | 0 | const URI_TYPE(Uri) * source, UriMemoryManager * memory) {
if (source->pathHead == NULL) {
/* No path component */
dest->pathHead = NULL;
dest->pathTail = NULL;
} else {
/* Copy list but not the text contained */
URI_TYPE(PathSegment) * sourceWalker = source->pathHead;
URI_TYPE(PathSegment) * destPrev = NULL;
do {
URI_TYPE(PathSegment) * cur = memory->malloc(memory, sizeof(URI_TYPE(PathSegment)));
if (cur == NULL) {
/* Fix broken list */
if (destPrev != NULL) {
destPrev->next = NULL;
}
return URI_FALSE; /* Raises malloc error */
}
/* From this functions usage we know that *
* the dest URI cannot be uri->owner */
cur->text = sourceWalker->text;
if (destPrev == NULL) {
/* First segment ever */
dest->pathHead = cur;
} else {
destPrev->next = cur;
}
destPrev = cur;
sourceWalker = sourceWalker->next;
} while (sourceWalker != NULL);
dest->pathTail = destPrev;
dest->pathTail->next = NULL;
}
dest->absolutePath = source->absolutePath;
return URI_TRUE;
}
| 14,055 |
85,085 | 0 | void read_frame_header(decoder_info_t *dec_info, stream_t *stream) {
frame_info_t *frame_info = &dec_info->frame_info;
frame_info->frame_type = get_flc(1, stream);
frame_info->qp = get_flc(8, stream);
frame_info->num_intra_modes = get_flc(4, stream);
if (frame_info->frame_type != I_FRAME) {
frame_info->num_ref = get_flc(2, stream) + 1;
int r;
for (r = 0; r < frame_info->num_ref; r++) {
frame_info->ref_array[r] = get_flc(6, stream) - 1;
}
if (frame_info->num_ref == 2 && frame_info->ref_array[0] == -1) {
frame_info->ref_array[frame_info->num_ref++] = get_flc(5, stream) - 1;
}
}
else {
frame_info->num_ref = 0;
}
frame_info->display_frame_num = get_flc(16, stream);
#if CDEF
dec_info->cdef_damping[1] = dec_info->cdef_damping[0] = get_flc(2, stream) + 3;
dec_info->cdef_bits = get_flc(2, stream);
for (int i = 0; i < (1 << dec_info->cdef_bits); i++) {
dec_info->cdef_presets[i].pri_strength[0] = get_flc(4, stream);
dec_info->cdef_presets[i].skip_condition[0] = get_flc(1, stream);
dec_info->cdef_presets[i].sec_strength[0] = get_flc(2, stream);
if (dec_info->subsample != 400) {
dec_info->cdef_presets[i].pri_strength[1] = get_flc(4, stream);
dec_info->cdef_presets[i].skip_condition[1] = get_flc(1, stream);
dec_info->cdef_presets[i].sec_strength[1] = get_flc(2, stream);
}
}
#endif
}
| 14,056 |
184,744 | 1 | static void webkitWebViewBaseContainerAdd(GtkContainer* container, GtkWidget* widget)
{
WebKitWebViewBase* webView = WEBKIT_WEB_VIEW_BASE(container);
WebKitWebViewBasePrivate* priv = webView->priv;
if (WEBKIT_IS_WEB_VIEW_BASE(widget)
&& WebInspectorProxy::isInspectorPage(WEBKIT_WEB_VIEW_BASE(widget)->priv->pageProxy.get())) {
ASSERT(!priv->inspectorView);
priv->inspectorView = widget;
priv->inspectorViewHeight = gMinimumAttachedInspectorHeight;
} else {
GtkAllocation childAllocation;
gtk_widget_get_allocation(widget, &childAllocation);
priv->children.set(widget, childAllocation);
}
gtk_widget_set_parent(widget, GTK_WIDGET(container));
}
| 14,057 |
156,621 | 0 | void NavigatorImpl::LogResourceRequestTime(base::TimeTicks timestamp,
const GURL& url) {
if (navigation_data_ && navigation_data_->url_ == url) {
navigation_data_->url_job_start_time_ = timestamp;
UMA_HISTOGRAM_TIMES(
"Navigation.TimeToURLJobStart",
navigation_data_->url_job_start_time_ - navigation_data_->start_time_);
}
}
| 14,058 |
154,026 | 0 | void GLES2DecoderImpl::DoGetVertexAttribfv(GLuint index,
GLenum pname,
GLfloat* params,
GLsizei params_size) {
DoGetVertexAttribImpl<GLfloat>(index, pname, params);
}
| 14,059 |
98,872 | 0 | void WebSocket::DetachDelegate() {
if (!delegate_)
return;
delegate_ = NULL;
Close();
}
| 14,060 |
132,170 | 0 | void RenderViewTest::SimulateUserInputChangeForElement(
blink::WebInputElement* input,
const std::string& new_value) {
ASSERT_TRUE(base::IsStringASCII(new_value));
while (!input->focused())
input->document().frame()->view()->advanceFocus(false);
size_t previous_length = input->value().length();
for (size_t i = 0; i < previous_length; ++i)
SimulateUserTypingASCIICharacter(ui::VKEY_BACK, false);
EXPECT_TRUE(input->value().utf8().empty());
for (size_t i = 0; i < new_value.size(); ++i)
SimulateUserTypingASCIICharacter(new_value[i], false);
EXPECT_EQ(new_value, input->value().utf8().substr(0, new_value.length()));
base::MessageLoop::current()->RunUntilIdle();
}
| 14,061 |
183,495 | 1 | ResourceDispatcherHost::~ResourceDispatcherHost() {
AsyncResourceHandler::GlobalCleanup();
STLDeleteValues(&pending_requests_);
user_script_listener_->ShutdownMainThread();
// Clear blocked requests if any left.
// Note that we have to do this in 2 passes as we cannot call
// CancelBlockedRequestsForRoute while iterating over
// blocked_requests_map_, as it modifies it.
std::set<ProcessRouteIDs> ids;
for (BlockedRequestMap::const_iterator iter = blocked_requests_map_.begin();
iter != blocked_requests_map_.end(); ++iter) {
std::pair<std::set<ProcessRouteIDs>::iterator, bool> result =
ids.insert(iter->first);
// We should not have duplicates.
DCHECK(result.second);
}
for (std::set<ProcessRouteIDs>::const_iterator iter = ids.begin();
iter != ids.end(); ++iter) {
CancelBlockedRequestsForRoute(iter->first, iter->second);
}
}
| 14,062 |
16,735 | 0 | static void str_init_source(j_decompress_ptr cinfo)
{
}
| 14,063 |
185,493 | 1 | void HWNDMessageHandler::Init(HWND parent, const gfx::Rect& bounds) {
TRACE_EVENT0("views", "HWNDMessageHandler::Init");
GetMonitorAndRects(bounds.ToRECT(), &last_monitor_, &last_monitor_rect_,
&last_work_area_);
WindowImpl::Init(parent, bounds);
}
| 14,064 |
146,124 | 0 | void WebGL2RenderingContextBase::resumeTransformFeedback() {
if (isContextLost())
return;
if (transform_feedback_binding_ &&
transform_feedback_binding_->GetProgram() != current_program_) {
SynthesizeGLError(GL_INVALID_OPERATION, "resumeTransformFeedback",
"the program object is not active");
return;
}
ContextGL()->ResumeTransformFeedback();
}
| 14,065 |
102,860 | 0 | void RenderMenuList::didUpdateActiveOption(int optionIndex)
{
if (!AXObjectCache::accessibilityEnabled())
return;
if (m_lastActiveIndex == optionIndex)
return;
m_lastActiveIndex = optionIndex;
HTMLSelectElement* select = toHTMLSelectElement(node());
int listIndex = select->optionToListIndex(optionIndex);
if (listIndex < 0 || listIndex >= static_cast<int>(select->listItems().size()))
return;
ASSERT(select->listItems()[listIndex]);
if (AccessibilityMenuList* menuList = static_cast<AccessibilityMenuList*>(document()->axObjectCache()->get(this)))
menuList->didUpdateActiveOption(optionIndex);
}
| 14,066 |
56,724 | 0 | static void kill_ioctx(struct mm_struct *mm, struct kioctx *ctx,
struct completion *requests_done)
{
if (!atomic_xchg(&ctx->dead, 1)) {
struct kioctx_table *table;
spin_lock(&mm->ioctx_lock);
rcu_read_lock();
table = rcu_dereference(mm->ioctx_table);
WARN_ON(ctx != table->table[ctx->id]);
table->table[ctx->id] = NULL;
rcu_read_unlock();
spin_unlock(&mm->ioctx_lock);
/* percpu_ref_kill() will do the necessary call_rcu() */
wake_up_all(&ctx->wait);
/*
* It'd be more correct to do this in free_ioctx(), after all
* the outstanding kiocbs have finished - but by then io_destroy
* has already returned, so io_setup() could potentially return
* -EAGAIN with no ioctxs actually in use (as far as userspace
* could tell).
*/
aio_nr_sub(ctx->max_reqs);
if (ctx->mmap_size)
vm_munmap(ctx->mmap_base, ctx->mmap_size);
ctx->requests_done = requests_done;
percpu_ref_kill(&ctx->users);
} else {
if (requests_done)
complete(requests_done);
}
}
| 14,067 |
149,550 | 0 | GURL GetDataURLWithContent(const std::string& content) {
std::string encoded_content;
base::Base64Encode(content, &encoded_content);
std::string data_uri_content = "data:text/html;base64," + encoded_content;
return GURL(data_uri_content);
}
| 14,068 |
89,215 | 0 | remove_opt_anc_info(OptAnc* to, int anc)
{
if (is_left(anc))
to->left &= ~anc;
else
to->right &= ~anc;
}
| 14,069 |
99,579 | 0 | bool VectorContains(const std::vector<std::string>& data,
const std::string& str) {
return std::find(data.begin(), data.end(), str) != data.end();
}
| 14,070 |
143,366 | 0 | void Job::DispatchAlertOrErrorOnOriginThread(bool is_alert,
int line_number,
const base::string16& message) {
CheckIsOnOriginThread();
if (cancelled_.IsSet())
return;
if (is_alert) {
VLOG(1) << "PAC-alert: " << message;
bindings_->Alert(message);
} else {
if (line_number == -1)
VLOG(1) << "PAC-error: " << message;
else
VLOG(1) << "PAC-error: " << "line: " << line_number << ": " << message;
bindings_->OnError(line_number, message);
}
}
| 14,071 |
35,479 | 0 | ieee80211_tx_h_encrypt(struct ieee80211_tx_data *tx)
{
if (!tx->key)
return TX_CONTINUE;
switch (tx->key->conf.cipher) {
case WLAN_CIPHER_SUITE_WEP40:
case WLAN_CIPHER_SUITE_WEP104:
return ieee80211_crypto_wep_encrypt(tx);
case WLAN_CIPHER_SUITE_TKIP:
return ieee80211_crypto_tkip_encrypt(tx);
case WLAN_CIPHER_SUITE_CCMP:
return ieee80211_crypto_ccmp_encrypt(tx);
case WLAN_CIPHER_SUITE_AES_CMAC:
return ieee80211_crypto_aes_cmac_encrypt(tx);
default:
return ieee80211_crypto_hw_encrypt(tx);
}
return TX_DROP;
}
| 14,072 |
11,028 | 0 | init_uncompress( compress_filter_context_t *zfx, z_stream *zs )
{
int rc;
/****************
* PGP uses a windowsize of 13 bits. Using a negative value for
* it forces zlib not to expect a zlib header. This is a
* undocumented feature Peter Gutmann told me about.
*
* We must use 15 bits for the inflator because CryptoEx uses 15
* bits thus the output would get scrambled w/o error indication
* if we would use 13 bits. For the uncompressing this does not
* matter at all.
*/
if( (rc = zfx->algo == 1? inflateInit2( zs, -15)
: inflateInit( zs )) != Z_OK ) {
log_fatal("zlib problem: %s\n", zs->msg? zs->msg :
rc == Z_MEM_ERROR ? "out of core" :
rc == Z_VERSION_ERROR ? "invalid lib version" :
"unknown error" );
}
zfx->inbufsize = 2048;
zfx->inbuf = xmalloc( zfx->inbufsize );
zs->avail_in = 0;
}
| 14,073 |
56,164 | 0 | static struct sock *__rfcomm_get_listen_sock_by_addr(u8 channel, bdaddr_t *src)
{
struct sock *sk = NULL;
sk_for_each(sk, &rfcomm_sk_list.head) {
if (rfcomm_pi(sk)->channel != channel)
continue;
if (bacmp(&rfcomm_pi(sk)->src, src))
continue;
if (sk->sk_state == BT_BOUND || sk->sk_state == BT_LISTEN)
break;
}
return sk ? sk : NULL;
}
| 14,074 |
17,326 | 0 | set_default_lang ()
{
char *v;
v = get_string_value ("LC_ALL");
set_locale_var ("LC_ALL", v);
v = get_string_value ("LANG");
set_lang ("LANG", v);
}
| 14,075 |
96,981 | 0 | struct page *alloc_huge_page_node(struct hstate *h, int nid)
{
gfp_t gfp_mask = htlb_alloc_mask(h);
struct page *page = NULL;
if (nid != NUMA_NO_NODE)
gfp_mask |= __GFP_THISNODE;
spin_lock(&hugetlb_lock);
if (h->free_huge_pages - h->resv_huge_pages > 0)
page = dequeue_huge_page_nodemask(h, gfp_mask, nid, NULL);
spin_unlock(&hugetlb_lock);
if (!page)
page = alloc_migrate_huge_page(h, gfp_mask, nid, NULL);
return page;
}
| 14,076 |
19,144 | 0 | static int tcp_v6_md5_hash_pseudoheader(struct tcp_md5sig_pool *hp,
const struct in6_addr *daddr,
const struct in6_addr *saddr, int nbytes)
{
struct tcp6_pseudohdr *bp;
struct scatterlist sg;
bp = &hp->md5_blk.ip6;
/* 1. TCP pseudo-header (RFC2460) */
ipv6_addr_copy(&bp->saddr, saddr);
ipv6_addr_copy(&bp->daddr, daddr);
bp->protocol = cpu_to_be32(IPPROTO_TCP);
bp->len = cpu_to_be32(nbytes);
sg_init_one(&sg, bp, sizeof(*bp));
return crypto_hash_update(&hp->md5_desc, &sg, sizeof(*bp));
}
| 14,077 |
33,129 | 0 | static inline size_t xfrm_acquire_msgsize(struct xfrm_state *x,
struct xfrm_policy *xp)
{
return NLMSG_ALIGN(sizeof(struct xfrm_user_acquire))
+ nla_total_size(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr)
+ nla_total_size(sizeof(struct xfrm_mark))
+ nla_total_size(xfrm_user_sec_ctx_size(x->security))
+ userpolicy_type_attrsize();
}
| 14,078 |
15,276 | 0 | PHP_FUNCTION(stream_set_write_buffer)
{
zval *arg1;
int ret;
long arg2;
size_t buff;
php_stream *stream;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &arg1, &arg2) == FAILURE) {
RETURN_FALSE;
}
php_stream_from_zval(stream, &arg1);
buff = arg2;
/* if buff is 0 then set to non-buffered */
if (buff == 0) {
ret = php_stream_set_option(stream, PHP_STREAM_OPTION_WRITE_BUFFER, PHP_STREAM_BUFFER_NONE, NULL);
} else {
ret = php_stream_set_option(stream, PHP_STREAM_OPTION_WRITE_BUFFER, PHP_STREAM_BUFFER_FULL, &buff);
}
RETURN_LONG(ret == 0 ? 0 : EOF);
}
| 14,079 |
19,901 | 0 | static int nfs4_do_open_reclaim(struct nfs_open_context *ctx, struct nfs4_state *state)
{
struct nfs_server *server = NFS_SERVER(state->inode);
struct nfs4_exception exception = { };
int err;
do {
err = _nfs4_do_open_reclaim(ctx, state);
if (err != -NFS4ERR_DELAY)
break;
nfs4_handle_exception(server, err, &exception);
} while (exception.retry);
return err;
}
| 14,080 |
23,358 | 0 | encode_getattr_three(struct xdr_stream *xdr,
uint32_t bm0, uint32_t bm1, uint32_t bm2,
struct compound_hdr *hdr)
{
__be32 *p;
p = reserve_space(xdr, 4);
*p = cpu_to_be32(OP_GETATTR);
if (bm2) {
p = reserve_space(xdr, 16);
*p++ = cpu_to_be32(3);
*p++ = cpu_to_be32(bm0);
*p++ = cpu_to_be32(bm1);
*p = cpu_to_be32(bm2);
} else if (bm1) {
p = reserve_space(xdr, 12);
*p++ = cpu_to_be32(2);
*p++ = cpu_to_be32(bm0);
*p = cpu_to_be32(bm1);
} else {
p = reserve_space(xdr, 8);
*p++ = cpu_to_be32(1);
*p = cpu_to_be32(bm0);
}
hdr->nops++;
hdr->replen += decode_getattr_maxsz;
}
| 14,081 |
18,636 | 0 | int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen,
unsigned int flags, struct timespec *timeout)
{
int fput_needed, err, datagrams;
struct socket *sock;
struct mmsghdr __user *entry;
struct compat_mmsghdr __user *compat_entry;
struct msghdr msg_sys;
struct timespec end_time;
if (timeout &&
poll_select_set_timeout(&end_time, timeout->tv_sec,
timeout->tv_nsec))
return -EINVAL;
datagrams = 0;
sock = sockfd_lookup_light(fd, &err, &fput_needed);
if (!sock)
return err;
err = sock_error(sock->sk);
if (err)
goto out_put;
entry = mmsg;
compat_entry = (struct compat_mmsghdr __user *)mmsg;
while (datagrams < vlen) {
/*
* No need to ask LSM for more than the first datagram.
*/
if (MSG_CMSG_COMPAT & flags) {
err = __sys_recvmsg(sock, (struct msghdr __user *)compat_entry,
&msg_sys, flags & ~MSG_WAITFORONE,
datagrams);
if (err < 0)
break;
err = __put_user(err, &compat_entry->msg_len);
++compat_entry;
} else {
err = __sys_recvmsg(sock, (struct msghdr __user *)entry,
&msg_sys, flags & ~MSG_WAITFORONE,
datagrams);
if (err < 0)
break;
err = put_user(err, &entry->msg_len);
++entry;
}
if (err)
break;
++datagrams;
/* MSG_WAITFORONE turns on MSG_DONTWAIT after one packet */
if (flags & MSG_WAITFORONE)
flags |= MSG_DONTWAIT;
if (timeout) {
ktime_get_ts(timeout);
*timeout = timespec_sub(end_time, *timeout);
if (timeout->tv_sec < 0) {
timeout->tv_sec = timeout->tv_nsec = 0;
break;
}
/* Timeout, return less than vlen datagrams */
if (timeout->tv_nsec == 0 && timeout->tv_sec == 0)
break;
}
/* Out of band data, return right away */
if (msg_sys.msg_flags & MSG_OOB)
break;
}
out_put:
fput_light(sock->file, fput_needed);
if (err == 0)
return datagrams;
if (datagrams != 0) {
/*
* We may return less entries than requested (vlen) if the
* sock is non block and there aren't enough datagrams...
*/
if (err != -EAGAIN) {
/*
* ... or if recvmsg returns an error after we
* received some datagrams, where we record the
* error to return on the next call or if the
* app asks about it using getsockopt(SO_ERROR).
*/
sock->sk->sk_err = -err;
}
return datagrams;
}
return err;
}
| 14,082 |
151,041 | 0 | void DevToolsUIBindings::StopIndexing(int index_request_id) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
IndexingJobsMap::iterator it = indexing_jobs_.find(index_request_id);
if (it == indexing_jobs_.end())
return;
it->second->Stop();
indexing_jobs_.erase(it);
}
| 14,083 |
61,752 | 0 | int tcp_peek_len(struct socket *sock)
{
return tcp_inq(sock->sk);
}
| 14,084 |
155,580 | 0 | base::string16 AuthenticatorClientPinTapAgainSheetModel::GetStepDescription()
const {
return l10n_util::GetStringUTF16(IDS_WEBAUTHN_PIN_TAP_AGAIN_DESCRIPTION);
}
| 14,085 |
57,010 | 0 | static void sctp_cmd_setup_t4(sctp_cmd_seq_t *cmds,
struct sctp_association *asoc,
struct sctp_chunk *chunk)
{
struct sctp_transport *t;
t = sctp_assoc_choose_alter_transport(asoc, chunk->transport);
asoc->timeouts[SCTP_EVENT_TIMEOUT_T4_RTO] = t->rto;
chunk->transport = t;
}
| 14,086 |
23,773 | 0 | static int bond_xmit_hash_policy_l2(struct sk_buff *skb, int count)
{
struct ethhdr *data = (struct ethhdr *)skb->data;
return (data->h_dest[5] ^ data->h_source[5]) % count;
}
| 14,087 |
89,210 | 0 | print_optimize_info(FILE* f, regex_t* reg)
{
static const char* on[] = { "NONE", "STR",
"STR_FAST", "STR_FAST_STEP_FORWARD",
"STR_CASE_FOLD_FAST", "STR_CASE_FOLD", "MAP" };
fprintf(f, "optimize: %s\n", on[reg->optimize]);
fprintf(f, " anchor: "); print_anchor(f, reg->anchor);
if ((reg->anchor & ANCR_END_BUF_MASK) != 0)
print_distance_range(f, reg->anchor_dmin, reg->anchor_dmax);
fprintf(f, "\n");
if (reg->optimize) {
fprintf(f, " sub anchor: "); print_anchor(f, reg->sub_anchor);
fprintf(f, "\n");
}
fprintf(f, "\n");
if (reg->exact) {
UChar *p;
fprintf(f, "exact: [");
for (p = reg->exact; p < reg->exact_end; p++) {
fputc(*p, f);
}
fprintf(f, "]: length: %ld\n", (reg->exact_end - reg->exact));
}
else if (reg->optimize & OPTIMIZE_MAP) {
int c, i, n = 0;
for (i = 0; i < CHAR_MAP_SIZE; i++)
if (reg->map[i]) n++;
fprintf(f, "map: n=%d\n", n);
if (n > 0) {
c = 0;
fputc('[', f);
for (i = 0; i < CHAR_MAP_SIZE; i++) {
if (reg->map[i] != 0) {
if (c > 0) fputs(", ", f);
c++;
if (ONIGENC_MBC_MAXLEN(reg->enc) == 1 &&
ONIGENC_IS_CODE_PRINT(reg->enc, (OnigCodePoint )i))
fputc(i, f);
else
fprintf(f, "%d", i);
}
}
fprintf(f, "]\n");
}
}
}
| 14,088 |
146,904 | 0 | void Document::open() {
DCHECK(!ImportLoader());
if (frame_) {
if (ScriptableDocumentParser* parser = GetScriptableDocumentParser()) {
if (parser->IsParsing()) {
if (parser->IsExecutingScript())
return;
if (!parser->WasCreatedByScript() && parser->HasInsertionPoint())
return;
}
}
if (frame_->Loader().HasProvisionalNavigation()) {
frame_->Loader().StopAllLoaders();
if (frame_->Client() &&
frame_->GetSettings()->GetBrowserSideNavigationEnabled()) {
frame_->Client()->AbortClientNavigation();
}
}
}
RemoveAllEventListenersRecursively();
ResetTreeScope();
if (frame_)
frame_->Selection().Clear();
ImplicitOpen(kForceSynchronousParsing);
if (ScriptableDocumentParser* parser = GetScriptableDocumentParser())
parser->SetWasCreatedByScript(true);
if (frame_)
frame_->Loader().DidExplicitOpen();
}
| 14,089 |
51,959 | 0 | SpoolssGetJob_q(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree *tree, dcerpc_info *di, guint8 *drep)
{
dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
guint32 level, jobid;
/* Parse packet */
offset = dissect_nt_policy_hnd(
tvb, offset, pinfo, tree, di, drep, hf_hnd, NULL, NULL,
FALSE, FALSE);
offset = dissect_ndr_uint32(
tvb, offset, pinfo, tree, di, drep, hf_job_id, &jobid);
offset = dissect_ndr_uint32(
tvb, offset, pinfo, tree, di, drep, hf_level, &level);
/* GetJob() stores the level in se_data */
if(!pinfo->fd->flags.visited){
dcv->se_data = GUINT_TO_POINTER((int)level);
}
col_append_fstr(pinfo->cinfo, COL_INFO, ", level %d, jobid %d",
level, jobid);
offset = dissect_spoolss_buffer(tvb, offset, pinfo, tree, di, drep, NULL);
offset = dissect_ndr_uint32(
tvb, offset, pinfo, tree, di, drep, hf_offered, NULL);
return offset;
}
| 14,090 |
161,968 | 0 | void PrepareFrameAndViewForPrint::StartPrinting() {
ResizeForPrinting();
blink::WebView* web_view = frame_.view();
web_view->GetSettings()->SetShouldPrintBackgrounds(should_print_backgrounds_);
expected_pages_count_ =
frame()->PrintBegin(web_print_params_, node_to_print_);
is_printing_started_ = true;
}
| 14,091 |
96,001 | 0 | void CL_StopVideo_f( void )
{
CL_CloseAVI( );
}
| 14,092 |
45,575 | 0 | static int crypto_ccm_decrypt(struct aead_request *req)
{
struct crypto_aead *aead = crypto_aead_reqtfm(req);
struct crypto_ccm_ctx *ctx = crypto_aead_ctx(aead);
struct crypto_ccm_req_priv_ctx *pctx = crypto_ccm_reqctx(req);
struct ablkcipher_request *abreq = &pctx->abreq;
struct scatterlist *dst;
unsigned int authsize = crypto_aead_authsize(aead);
unsigned int cryptlen = req->cryptlen;
u8 *authtag = pctx->auth_tag;
u8 *odata = pctx->odata;
u8 *iv = req->iv;
int err;
if (cryptlen < authsize)
return -EINVAL;
cryptlen -= authsize;
err = crypto_ccm_check_iv(iv);
if (err)
return err;
pctx->flags = aead_request_flags(req);
scatterwalk_map_and_copy(authtag, req->src, cryptlen, authsize, 0);
memset(iv + 15 - iv[0], 0, iv[0] + 1);
sg_init_table(pctx->src, 2);
sg_set_buf(pctx->src, authtag, 16);
scatterwalk_sg_chain(pctx->src, 2, req->src);
dst = pctx->src;
if (req->src != req->dst) {
sg_init_table(pctx->dst, 2);
sg_set_buf(pctx->dst, authtag, 16);
scatterwalk_sg_chain(pctx->dst, 2, req->dst);
dst = pctx->dst;
}
ablkcipher_request_set_tfm(abreq, ctx->ctr);
ablkcipher_request_set_callback(abreq, pctx->flags,
crypto_ccm_decrypt_done, req);
ablkcipher_request_set_crypt(abreq, pctx->src, dst, cryptlen + 16, iv);
err = crypto_ablkcipher_decrypt(abreq);
if (err)
return err;
err = crypto_ccm_auth(req, req->dst, cryptlen);
if (err)
return err;
/* verify */
if (crypto_memneq(authtag, odata, authsize))
return -EBADMSG;
return err;
}
| 14,093 |
126,584 | 0 | void TabStripGtk::StopAnimation() {
if (active_animation_.get())
active_animation_->Stop();
}
| 14,094 |
183,933 | 1 | virtual void AddObserver(Observer* observer) {
if (!observers_.size()) {
observer->FirstObserverIsAdded(this);
}
observers_.AddObserver(observer);
}
| 14,095 |
169,533 | 0 | void AutomationInternalCustomBindings::OnMessageReceived(
const IPC::Message& message) {
IPC_BEGIN_MESSAGE_MAP(AutomationInternalCustomBindings, message)
IPC_MESSAGE_HANDLER(ExtensionMsg_AccessibilityEvent, OnAccessibilityEvent)
IPC_END_MESSAGE_MAP()
}
| 14,096 |
54,608 | 0 | static int __init snd_hrtimer_init(void)
{
struct snd_timer *timer;
int err;
resolution = hrtimer_resolution;
/* Create a new timer and set up the fields */
err = snd_timer_global_new("hrtimer", SNDRV_TIMER_GLOBAL_HRTIMER,
&timer);
if (err < 0)
return err;
timer->module = THIS_MODULE;
strcpy(timer->name, "HR timer");
timer->hw = hrtimer_hw;
timer->hw.resolution = resolution;
timer->hw.ticks = NANO_SEC / resolution;
err = snd_timer_global_register(timer);
if (err < 0) {
snd_timer_global_free(timer);
return err;
}
mytimer = timer; /* remember this */
return 0;
}
| 14,097 |
137,410 | 0 | void RenderViewTest::SetUp() {
test_io_thread_ =
std::make_unique<base::TestIOThread>(base::TestIOThread::kAutoStart);
ipc_support_ = std::make_unique<mojo::edk::ScopedIPCSupport>(
test_io_thread_->task_runner(),
mojo::edk::ScopedIPCSupport::ShutdownPolicy::FAST);
if (!render_thread_)
render_thread_ = std::make_unique<MockRenderThread>();
blink_platform_impl_.Initialize();
service_manager::BinderRegistry empty_registry;
blink::Initialize(blink_platform_impl_.Get(), &empty_registry);
content_client_.reset(CreateContentClient());
content_browser_client_.reset(CreateContentBrowserClient());
content_renderer_client_.reset(CreateContentRendererClient());
SetContentClient(content_client_.get());
SetBrowserClientForTesting(content_browser_client_.get());
SetRendererClientForTesting(content_renderer_client_.get());
#if defined(OS_WIN)
SetDWriteFontProxySenderForTesting(CreateFakeCollectionSender());
#endif
#if defined(OS_MACOSX)
autorelease_pool_ = std::make_unique<base::mac::ScopedNSAutoreleasePool>();
#endif
command_line_ =
std::make_unique<base::CommandLine>(base::CommandLine::NO_PROGRAM);
field_trial_list_ = std::make_unique<base::FieldTrialList>(nullptr);
base::FieldTrialList::CreateTrialsFromCommandLine(
*command_line_, switches::kFieldTrialHandle, -1);
params_ = std::make_unique<MainFunctionParams>(*command_line_);
platform_ = std::make_unique<RendererMainPlatformDelegate>(*params_);
platform_->PlatformInitialize();
std::string flags("--expose-gc");
v8::V8::SetFlagsFromString(flags.c_str(), static_cast<int>(flags.size()));
RenderThreadImpl::RegisterSchemes();
RenderThreadImpl::SetRendererBlinkPlatformImplForTesting(
blink_platform_impl_.Get());
if (!ui::ResourceBundle::HasSharedInstance()) {
ui::ResourceBundle::InitSharedInstanceWithLocale(
"en-US", nullptr, ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES);
}
compositor_deps_ = std::make_unique<FakeCompositorDependencies>();
mock_process_ = std::make_unique<MockRenderProcess>();
mojom::CreateViewParamsPtr view_params = mojom::CreateViewParams::New();
view_params->opener_frame_route_id = MSG_ROUTING_NONE;
view_params->window_was_created_with_opener = false;
view_params->renderer_preferences = RendererPreferences();
view_params->web_preferences = WebPreferences();
view_params->view_id = render_thread_->GetNextRoutingID();
view_params->main_frame_widget_routing_id = view_params->view_id;
view_params->main_frame_routing_id = render_thread_->GetNextRoutingID();
render_thread_->PassInitialInterfaceProviderRequestForFrame(
view_params->main_frame_routing_id,
mojo::MakeRequest(&view_params->main_frame_interface_provider));
view_params->session_storage_namespace_id = kInvalidSessionStorageNamespaceId;
view_params->swapped_out = false;
view_params->replicated_frame_state = FrameReplicationState();
view_params->proxy_routing_id = MSG_ROUTING_NONE;
view_params->hidden = false;
view_params->never_visible = false;
view_params->initial_size = *InitialSizeParams();
view_params->enable_auto_resize = false;
view_params->min_size = gfx::Size();
view_params->max_size = gfx::Size();
view_ = RenderViewImpl::Create(compositor_deps_.get(), std::move(view_params),
RenderWidget::ShowCallback(),
base::ThreadTaskRunnerHandle::Get());
}
| 14,098 |
162,125 | 0 | void RenderProcessHost::PostTaskWhenProcessIsReady(base::OnceClosure task) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(!task.is_null());
new RenderProcessHostIsReadyObserver(this, std::move(task));
}
| 14,099 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.