unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
|---|---|---|---|
6,921
| 0
|
smp_fetch_rqver(const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct http_txn *txn;
char *ptr;
int len;
CHECK_HTTP_MESSAGE_FIRST();
txn = smp->strm->txn;
len = txn->req.sl.rq.v_l;
ptr = txn->req.chn->buf->p + txn->req.sl.rq.v;
while ((len-- > 0) && (*ptr++ != '/'));
if (len <= 0)
return 0;
smp->data.type = SMP_T_STR;
smp->data.u.str.str = ptr;
smp->data.u.str.len = len;
smp->flags = SMP_F_VOL_1ST | SMP_F_CONST;
return 1;
}
| 11,700
|
122,419
| 0
|
void HTMLTextAreaElement::accessKeyAction(bool)
{
focus();
}
| 11,701
|
173,542
| 0
|
static int fx_process(effect_handle_t self,
audio_buffer_t *inBuffer,
audio_buffer_t *outBuffer)
{
struct effect_s *effect = (struct effect_s *)self;
struct session_s *session;
if (effect == NULL) {
ALOGV("fx_process() ERROR effect == NULL");
return -EINVAL;
}
if (inBuffer == NULL || inBuffer->raw == NULL ||
outBuffer == NULL || outBuffer->raw == NULL) {
ALOGW("fx_process() ERROR bad pointer");
return -EINVAL;
}
session = (struct session_s *)effect->session;
session->processed_msk |= (1<<effect->id);
if ((session->processed_msk & session->enabled_msk) == session->enabled_msk) {
effect->session->processed_msk = 0;
return 0;
} else
return -ENODATA;
}
| 11,702
|
115,891
| 0
|
Evas_Object* ewk_frame_child_find(Evas_Object* ewkFrame, const char* name)
{
EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, 0);
EINA_SAFETY_ON_NULL_RETURN_VAL(name, 0);
EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame, 0);
WTF::String frameName = WTF::String::fromUTF8(name);
return EWKPrivate::kitFrame(smartData->frame->tree()->find(WTF::AtomicString(frameName)));
}
| 11,703
|
32,524
| 0
|
static int tg3_do_test_dma(struct tg3 *tp, u32 *buf, dma_addr_t buf_dma,
int size, int to_device)
{
struct tg3_internal_buffer_desc test_desc;
u32 sram_dma_descs;
int i, ret;
sram_dma_descs = NIC_SRAM_DMA_DESC_POOL_BASE;
tw32(FTQ_RCVBD_COMP_FIFO_ENQDEQ, 0);
tw32(FTQ_RCVDATA_COMP_FIFO_ENQDEQ, 0);
tw32(RDMAC_STATUS, 0);
tw32(WDMAC_STATUS, 0);
tw32(BUFMGR_MODE, 0);
tw32(FTQ_RESET, 0);
test_desc.addr_hi = ((u64) buf_dma) >> 32;
test_desc.addr_lo = buf_dma & 0xffffffff;
test_desc.nic_mbuf = 0x00002100;
test_desc.len = size;
/*
* HP ZX1 was seeing test failures for 5701 cards running at 33Mhz
* the *second* time the tg3 driver was getting loaded after an
* initial scan.
*
* Broadcom tells me:
* ...the DMA engine is connected to the GRC block and a DMA
* reset may affect the GRC block in some unpredictable way...
* The behavior of resets to individual blocks has not been tested.
*
* Broadcom noted the GRC reset will also reset all sub-components.
*/
if (to_device) {
test_desc.cqid_sqid = (13 << 8) | 2;
tw32_f(RDMAC_MODE, RDMAC_MODE_ENABLE);
udelay(40);
} else {
test_desc.cqid_sqid = (16 << 8) | 7;
tw32_f(WDMAC_MODE, WDMAC_MODE_ENABLE);
udelay(40);
}
test_desc.flags = 0x00000005;
for (i = 0; i < (sizeof(test_desc) / sizeof(u32)); i++) {
u32 val;
val = *(((u32 *)&test_desc) + i);
pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR,
sram_dma_descs + (i * sizeof(u32)));
pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_DATA, val);
}
pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0);
if (to_device)
tw32(FTQ_DMA_HIGH_READ_FIFO_ENQDEQ, sram_dma_descs);
else
tw32(FTQ_DMA_HIGH_WRITE_FIFO_ENQDEQ, sram_dma_descs);
ret = -ENODEV;
for (i = 0; i < 40; i++) {
u32 val;
if (to_device)
val = tr32(FTQ_RCVBD_COMP_FIFO_ENQDEQ);
else
val = tr32(FTQ_RCVDATA_COMP_FIFO_ENQDEQ);
if ((val & 0xffff) == sram_dma_descs) {
ret = 0;
break;
}
udelay(100);
}
return ret;
}
| 11,704
|
101,204
| 0
|
void LogServerError(const CommitResponse_EntryResponse& res) {
if (res.has_error_message())
LOG(WARNING) << " " << res.error_message();
else
LOG(WARNING) << " No detailed error message returned from server";
}
| 11,705
|
129,599
| 0
|
LayoutSVGTransformableContainer::LayoutSVGTransformableContainer(SVGGraphicsElement* node)
: LayoutSVGContainer(node)
, m_needsTransformUpdate(true)
{
}
| 11,706
|
49,538
| 0
|
static inline int do_tuner_callback(struct dvb_frontend *fe, int cmd, int arg)
{
struct xc2028_data *priv = fe->tuner_priv;
/* analog side (tuner-core) uses i2c_adap->algo_data.
* digital side is not guaranteed to have algo_data defined.
*
* digital side will always have fe->dvb defined.
* analog side (tuner-core) doesn't (yet) define fe->dvb.
*/
return (!fe->callback) ? -EINVAL :
fe->callback(((fe->dvb) && (fe->dvb->priv)) ?
fe->dvb->priv : priv->i2c_props.adap->algo_data,
DVB_FRONTEND_COMPONENT_TUNER, cmd, arg);
}
| 11,707
|
73,790
| 0
|
uint64_t getCurrentTimeInMs() {
return myCurrentTime;
}
| 11,708
|
122,405
| 0
|
void HTMLSelectElement::optionSelectionStateChanged(HTMLOptionElement* option, bool optionIsSelected)
{
ASSERT(option->ownerSelectElement() == this);
if (optionIsSelected)
selectOption(option->index());
else if (!usesMenuList() || multiple())
selectOption(-1);
else
selectOption(nextSelectableListIndex(-1));
}
| 11,709
|
142,079
| 0
|
HRESULT CGaiaCredentialBase::SetCheckboxValue(DWORD field_id, BOOL bChecked) {
return E_NOTIMPL;
}
| 11,710
|
10,663
| 0
|
Ins_SDPVTL( TT_ExecContext exc,
FT_Long* args )
{
FT_Long A, B, C;
FT_UShort p1, p2; /* was FT_Int in pas type ERROR */
FT_Byte opcode = exc->opcode;
p1 = (FT_UShort)args[1];
p2 = (FT_UShort)args[0];
if ( BOUNDS( p2, exc->zp1.n_points ) ||
BOUNDS( p1, exc->zp2.n_points ) )
{
if ( exc->pedantic_hinting )
exc->error = FT_THROW( Invalid_Reference );
return;
}
{
FT_Vector* v1 = exc->zp1.org + p2;
FT_Vector* v2 = exc->zp2.org + p1;
A = SUB_LONG( v1->x, v2->x );
B = SUB_LONG( v1->y, v2->y );
/* If v1 == v2, SDPvTL behaves the same as */
/* SVTCA[X], respectively. */
/* */
/* Confirmed by Greg Hitchcock. */
if ( A == 0 && B == 0 )
{
A = 0x4000;
opcode = 0;
}
}
if ( ( opcode & 1 ) != 0 )
{
C = B; /* counter clockwise rotation */
B = A;
A = NEG_LONG( C );
}
Normalize( A, B, &exc->GS.dualVector );
{
FT_Vector* v1 = exc->zp1.cur + p2;
FT_Vector* v2 = exc->zp2.cur + p1;
A = SUB_LONG( v1->x, v2->x );
B = SUB_LONG( v1->y, v2->y );
if ( A == 0 && B == 0 )
{
A = 0x4000;
opcode = 0;
}
}
if ( ( opcode & 1 ) != 0 )
{
C = B; /* counter clockwise rotation */
B = A;
A = NEG_LONG( C );
}
Normalize( A, B, &exc->GS.projVector );
Compute_Funcs( exc );
}
| 11,711
|
181,345
| 1
|
int svc_rdma_map_xdr(struct svcxprt_rdma *xprt,
struct xdr_buf *xdr,
struct svc_rdma_req_map *vec,
bool write_chunk_present)
{
int sge_no;
u32 sge_bytes;
u32 page_bytes;
u32 page_off;
int page_no;
if (xdr->len !=
(xdr->head[0].iov_len + xdr->page_len + xdr->tail[0].iov_len)) {
pr_err("svcrdma: %s: XDR buffer length error\n", __func__);
return -EIO;
}
/* Skip the first sge, this is for the RPCRDMA header *
sge_no = 1;
/* Head SGE *
vec->sge[sge_no].iov_base = xdr->head[0].iov_base;
vec->sge[sge_no].iov_len = xdr->head[0].iov_len;
sge_no++;
/* pages SGE *
page_no = 0;
page_bytes = xdr->page_len;
page_off = xdr->page_base;
while (page_bytes) {
vec->sge[sge_no].iov_base =
page_address(xdr->pages[page_no]) + page_off;
sge_bytes = min_t(u32, page_bytes, (PAGE_SIZE - page_off));
page_bytes -= sge_bytes;
vec->sge[sge_no].iov_len = sge_bytes;
sge_no++;
page_no++;
page_off = 0; /* reset for next time through loop *
}
/* Tail SGE *
if (xdr->tail[0].iov_len) {
unsigned char *base = xdr->tail[0].iov_base;
size_t len = xdr->tail[0].iov_len;
u32 xdr_pad = xdr_padsize(xdr->page_len);
if (write_chunk_present && xdr_pad) {
base += xdr_pad;
len -= xdr_pad;
}
if (len) {
vec->sge[sge_no].iov_base = base;
vec->sge[sge_no].iov_len = len;
sge_no++;
}
}
dprintk("svcrdma: %s: sge_no %d page_no %d "
"page_base %u page_len %u head_len %zu tail_len %zu\n",
__func__, sge_no, page_no, xdr->page_base, xdr->page_len,
xdr->head[0].iov_len, xdr->tail[0].iov_len);
vec->count = sge_no;
return 0;
}
| 11,712
|
96,706
| 0
|
WandExport MagickBooleanType MagickCommandGenesis(ImageInfo *image_info,
MagickCommand command,int argc,char **argv,char **metadata,
ExceptionInfo *exception)
{
char
client_name[MaxTextExtent],
*option;
double
duration,
serial;
MagickBooleanType
concurrent,
regard_warnings,
status;
register ssize_t
i;
size_t
iterations,
number_threads;
ssize_t
n;
(void) setlocale(LC_ALL,"");
(void) setlocale(LC_NUMERIC,"C");
GetPathComponent(argv[0],TailPath,client_name);
(void) SetClientName(client_name);
concurrent=MagickFalse;
duration=(-1.0);
iterations=1;
status=MagickTrue;
regard_warnings=MagickFalse;
for (i=1; i < (ssize_t) (argc-1); i++)
{
option=argv[i];
if ((strlen(option) == 1) || ((*option != '-') && (*option != '+')))
continue;
if (LocaleCompare("-bench",option) == 0)
iterations=StringToUnsignedLong(argv[++i]);
if (LocaleCompare("-concurrent",option) == 0)
concurrent=MagickTrue;
if (LocaleCompare("-debug",option) == 0)
(void) SetLogEventMask(argv[++i]);
if (LocaleCompare("-distribute-cache",option) == 0)
{
DistributePixelCacheServer(StringToInteger(argv[++i]),exception);
exit(0);
}
if (LocaleCompare("-duration",option) == 0)
duration=StringToDouble(argv[++i],(char **) NULL);
if (LocaleCompare("-regard-warnings",option) == 0)
regard_warnings=MagickTrue;
}
if (iterations == 1)
{
char
*text;
text=(char *) NULL;
status=command(image_info,argc,argv,&text,exception);
if (exception->severity != UndefinedException)
{
if ((exception->severity > ErrorException) ||
(regard_warnings != MagickFalse))
status=MagickFalse;
CatchException(exception);
}
if (text != (char *) NULL)
{
if (metadata != (char **) NULL)
(void) ConcatenateString(&(*metadata),text);
text=DestroyString(text);
}
return(status);
}
number_threads=GetOpenMPMaximumThreads();
serial=0.0;
for (n=1; n <= (ssize_t) number_threads; n++)
{
double
e,
parallel,
user_time;
TimerInfo
*timer;
(void) SetMagickResourceLimit(ThreadResource,(MagickSizeType) n);
timer=AcquireTimerInfo();
if (concurrent == MagickFalse)
{
for (i=0; i < (ssize_t) iterations; i++)
{
char
*text;
text=(char *) NULL;
if (status == MagickFalse)
continue;
if (duration > 0)
{
if (GetElapsedTime(timer) > duration)
continue;
(void) ContinueTimer(timer);
}
status=command(image_info,argc,argv,&text,exception);
if (exception->severity != UndefinedException)
{
if ((exception->severity > ErrorException) ||
(regard_warnings != MagickFalse))
status=MagickFalse;
CatchException(exception);
}
if (text != (char *) NULL)
{
if (metadata != (char **) NULL)
(void) ConcatenateString(&(*metadata),text);
text=DestroyString(text);
}
}
}
else
{
SetOpenMPNested(1);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
# pragma omp parallel for shared(status)
#endif
for (i=0; i < (ssize_t) iterations; i++)
{
char
*text;
text=(char *) NULL;
if (status == MagickFalse)
continue;
if (duration > 0)
{
if (GetElapsedTime(timer) > duration)
continue;
(void) ContinueTimer(timer);
}
status=command(image_info,argc,argv,&text,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
# pragma omp critical (MagickCore_MagickCommandGenesis)
#endif
{
if (exception->severity != UndefinedException)
{
if ((exception->severity > ErrorException) ||
(regard_warnings != MagickFalse))
status=MagickFalse;
CatchException(exception);
}
if (text != (char *) NULL)
{
if (metadata != (char **) NULL)
(void) ConcatenateString(&(*metadata),text);
text=DestroyString(text);
}
}
}
}
user_time=GetUserTime(timer);
parallel=GetElapsedTime(timer);
e=1.0;
if (n == 1)
serial=parallel;
else
e=((1.0/(1.0/((serial/(serial+parallel))+(1.0-(serial/(serial+parallel)))/
(double) n)))-(1.0/(double) n))/(1.0-1.0/(double) n);
(void) FormatLocaleFile(stderr,
" Performance[%.20g]: %.20gi %0.3fips %0.6fe %0.6fu %lu:%02lu.%03lu\n",
(double) n,(double) iterations,(double) iterations/parallel,e,user_time,
(unsigned long) (parallel/60.0),(unsigned long) floor(fmod(parallel,
60.0)),(unsigned long) (1000.0*(parallel-floor(parallel))+0.5));
timer=DestroyTimerInfo(timer);
}
return(status);
}
| 11,713
|
23,357
| 0
|
static void encode_getattr_one(struct xdr_stream *xdr, uint32_t bitmap, struct compound_hdr *hdr)
{
__be32 *p;
p = reserve_space(xdr, 12);
*p++ = cpu_to_be32(OP_GETATTR);
*p++ = cpu_to_be32(1);
*p = cpu_to_be32(bitmap);
hdr->nops++;
hdr->replen += decode_getattr_maxsz;
}
| 11,714
|
168,102
| 0
|
void AutofillManager::UploadFormDataAsyncCallback(
const FormStructure* submitted_form,
const TimeTicks& load_time,
const TimeTicks& interaction_time,
const TimeTicks& submission_time,
bool observed_submission) {
if (submitted_form->ShouldRunHeuristics() ||
submitted_form->ShouldBeQueried()) {
submitted_form->LogQualityMetrics(
load_time, interaction_time, submission_time,
form_interactions_ukm_logger_.get(), did_show_suggestions_,
observed_submission);
}
if (submitted_form->ShouldBeUploaded())
UploadFormData(*submitted_form, observed_submission);
}
| 11,715
|
134,619
| 0
|
bool OSExchangeDataProviderAura::HasString() const {
return (formats_ & OSExchangeData::STRING) != 0;
}
| 11,716
|
177,302
| 0
|
static OMX_U32 setPFramesSpacing(int32_t iFramesInterval, int32_t frameRate) {
if (iFramesInterval < 0) {
return 0xFFFFFFFF;
} else if (iFramesInterval == 0) {
return 0;
}
OMX_U32 ret = frameRate * iFramesInterval;
return ret;
}
| 11,717
|
54,211
| 0
|
static int acm_tty_put_char(struct tty_struct *tty, unsigned char ch)
{
struct acm *acm = tty->driver_data;
struct acm_wb *cur;
int wbn;
unsigned long flags;
overflow:
cur = acm->putbuffer;
if (!cur) {
spin_lock_irqsave(&acm->write_lock, flags);
wbn = acm_wb_alloc(acm);
if (wbn >= 0) {
cur = &acm->wb[wbn];
acm->putbuffer = cur;
}
spin_unlock_irqrestore(&acm->write_lock, flags);
if (!cur)
return 0;
}
if (cur->len == acm->writesize) {
acm_tty_flush_chars(tty);
goto overflow;
}
cur->buf[cur->len++] = ch;
return 1;
}
| 11,718
|
73,698
| 0
|
static int spl_object_storage_compare_objects(zval *o1, zval *o2) /* {{{ */
{
zend_object *zo1 = (zend_object *)Z_OBJ_P(o1);
zend_object *zo2 = (zend_object *)Z_OBJ_P(o2);
if (zo1->ce != spl_ce_SplObjectStorage || zo2->ce != spl_ce_SplObjectStorage) {
return 1;
}
return zend_hash_compare(&(Z_SPLOBJSTORAGE_P(o1))->storage, &(Z_SPLOBJSTORAGE_P(o2))->storage, (compare_func_t)spl_object_storage_compare_info, 0);
}
/* }}} */
| 11,719
|
175,825
| 0
|
static struct VP8D_COMP * create_decompressor(VP8D_CONFIG *oxcf)
{
VP8D_COMP *pbi = vpx_memalign(32, sizeof(VP8D_COMP));
if (!pbi)
return NULL;
memset(pbi, 0, sizeof(VP8D_COMP));
if (setjmp(pbi->common.error.jmp))
{
pbi->common.error.setjmp = 0;
remove_decompressor(pbi);
return 0;
}
pbi->common.error.setjmp = 1;
vp8_create_common(&pbi->common);
pbi->common.current_video_frame = 0;
pbi->ready_for_new_data = 1;
/* vp8cx_init_de_quantizer() is first called here. Add check in frame_init_dequantizer() to avoid
* unnecessary calling of vp8cx_init_de_quantizer() for every frame.
*/
vp8cx_init_de_quantizer(pbi);
vp8_loop_filter_init(&pbi->common);
pbi->common.error.setjmp = 0;
#if CONFIG_ERROR_CONCEALMENT
pbi->ec_enabled = oxcf->error_concealment;
pbi->overlaps = NULL;
#else
(void)oxcf;
pbi->ec_enabled = 0;
#endif
/* Error concealment is activated after a key frame has been
* decoded without errors when error concealment is enabled.
*/
pbi->ec_active = 0;
pbi->decoded_key_frame = 0;
/* Independent partitions is activated when a frame updates the
* token probability table to have equal probabilities over the
* PREV_COEF context.
*/
pbi->independent_partitions = 0;
vp8_setup_block_dptrs(&pbi->mb);
once(initialize_dec);
return pbi;
}
| 11,720
|
39,228
| 0
|
PHP_FUNCTION(imagecreatefromwebp)
{
_php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_WEBP, "WEBP", gdImageCreateFromWebp, gdImageCreateFromWebpCtx);
}
| 11,721
|
67,831
| 0
|
void DefragTrackerMoveToSpare(DefragTracker *h)
{
DefragTrackerEnqueue(&defragtracker_spare_q, h);
(void) SC_ATOMIC_SUB(defragtracker_counter, 1);
}
| 11,722
|
168,016
| 0
|
void FrameLoader::LoadInSameDocument(
const KURL& url,
scoped_refptr<SerializedScriptValue> state_object,
WebFrameLoadType frame_load_type,
HistoryItem* history_item,
ClientRedirectPolicy client_redirect,
Document* initiating_document) {
DCHECK(!state_object || frame_load_type == WebFrameLoadType::kBackForward);
DetachDocumentLoader(provisional_document_loader_);
if (!frame_->GetPage())
return;
SaveScrollState();
KURL old_url = frame_->GetDocument()->Url();
bool hash_change = EqualIgnoringFragmentIdentifier(url, old_url) &&
url.FragmentIdentifier() != old_url.FragmentIdentifier();
if (hash_change) {
frame_->GetEventHandler().StopAutoscroll();
frame_->DomWindow()->EnqueueHashchangeEvent(old_url, url);
}
document_loader_->SetIsClientRedirect(client_redirect ==
ClientRedirectPolicy::kClientRedirect);
if (history_item)
document_loader_->SetItemForHistoryNavigation(history_item);
UpdateForSameDocumentNavigation(url, kSameDocumentNavigationDefault, nullptr,
kScrollRestorationAuto, frame_load_type,
initiating_document);
ClearInitialScrollState();
frame_->GetDocument()->CheckCompleted();
std::unique_ptr<HistoryItem::ViewState> view_state;
if (history_item && history_item->GetViewState()) {
view_state =
std::make_unique<HistoryItem::ViewState>(*history_item->GetViewState());
}
frame_->DomWindow()->StatePopped(state_object
? std::move(state_object)
: SerializedScriptValue::NullValue());
if (history_item) {
RestoreScrollPositionAndViewState(
frame_load_type, true /* is_same_document */, view_state.get(),
history_item->ScrollRestorationType());
}
ProcessFragment(url, frame_load_type, kNavigationWithinSameDocument);
TakeObjectSnapshot();
}
| 11,723
|
150,324
| 0
|
void PasswordAutofillAgent::PasswordValueGatekeeper::OnUserGesture() {
if (was_user_gesture_seen_)
return;
was_user_gesture_seen_ = true;
for (WebInputElement& element : elements_)
ShowValue(&element);
elements_.clear();
}
| 11,724
|
105,539
| 0
|
bool SendGetAppModalDialogMessageJSONRequest(
AutomationMessageSender* sender,
std::string* message,
std::string* error_msg) {
DictionaryValue dict;
dict.SetString("command", "GetAppModalDialogMessage");
DictionaryValue reply_dict;
if (!SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg))
return false;
return reply_dict.GetString("message", message);
}
| 11,725
|
110,076
| 0
|
bool HTMLSelectElement::valueMissing() const
{
if (!willValidate())
return false;
if (!isRequired())
return false;
int firstSelectionIndex = selectedIndex();
return firstSelectionIndex < 0 || (!firstSelectionIndex && hasPlaceholderLabelOption());
}
| 11,726
|
52,475
| 0
|
static void set_orig_addr(struct msghdr *m, struct tipc_msg *msg)
{
DECLARE_SOCKADDR(struct sockaddr_tipc *, addr, m->msg_name);
if (addr) {
addr->family = AF_TIPC;
addr->addrtype = TIPC_ADDR_ID;
memset(&addr->addr, 0, sizeof(addr->addr));
addr->addr.id.ref = msg_origport(msg);
addr->addr.id.node = msg_orignode(msg);
addr->addr.name.domain = 0; /* could leave uninitialized */
addr->scope = 0; /* could leave uninitialized */
m->msg_namelen = sizeof(struct sockaddr_tipc);
}
}
| 11,727
|
60,900
| 0
|
filesystem_info_state_free (FilesystemInfoState *state)
{
g_object_unref (state->cancellable);
g_free (state);
}
| 11,728
|
98,767
| 0
|
void DidReceiveData(const char* buffer, int length, int data_offset) {
DCHECK(channel_ != NULL);
DCHECK_GT(length, 0);
std::vector<char> data;
data.resize(static_cast<size_t>(length));
memcpy(&data.front(), buffer, length);
scoped_refptr<PluginChannelHost> channel_ref(channel_);
channel_->Send(new PluginMsg_DidReceiveData(instance_id_, resource_id_,
data, data_offset));
}
| 11,729
|
176,256
| 0
|
explicit FastSloppyArgumentsElementsAccessor(const char* name)
: SloppyArgumentsElementsAccessor<
FastSloppyArgumentsElementsAccessor,
FastHoleyObjectElementsAccessor,
ElementsKindTraits<FAST_SLOPPY_ARGUMENTS_ELEMENTS> >(name) {}
| 11,730
|
77,448
| 0
|
is_delimiter(unsigned char c)
{
return isspace(c) || c == ',';
}
| 11,731
|
103,377
| 0
|
void CapturerMac::DisplaysReconfiguredCallback(
CGDirectDisplayID display,
CGDisplayChangeSummaryFlags flags,
void *user_parameter) {
if (display == CGMainDisplayID()) {
CapturerMac *capturer = reinterpret_cast<CapturerMac *>(user_parameter);
if (flags & kCGDisplayBeginConfigurationFlag) {
capturer->EnableCapture(false);
} else {
capturer->EnableCapture(true);
capturer->ScreenConfigurationChanged();
}
}
}
| 11,732
|
161,907
| 0
|
MarginType GetMarginsForPdf(blink::WebLocalFrame* frame,
const blink::WebNode& node,
const PrintMsg_Print_Params& params) {
return PDFShouldDisableScaling(frame, node, params, false)
? NO_MARGINS
: PRINTABLE_AREA_MARGINS;
}
| 11,733
|
43,965
| 0
|
static inline void read_dev_bar(struct pci_dev *dev,
struct pci_bar_info *bar_info, int offset,
u32 len_mask)
{
int pos;
struct resource *res = dev->resource;
if (offset == PCI_ROM_ADDRESS || offset == PCI_ROM_ADDRESS1)
pos = PCI_ROM_RESOURCE;
else {
pos = (offset - PCI_BASE_ADDRESS_0) / 4;
if (pos && ((res[pos - 1].flags & (PCI_BASE_ADDRESS_SPACE |
PCI_BASE_ADDRESS_MEM_TYPE_MASK)) ==
(PCI_BASE_ADDRESS_SPACE_MEMORY |
PCI_BASE_ADDRESS_MEM_TYPE_64))) {
bar_info->val = res[pos - 1].start >> 32;
bar_info->len_val = res[pos - 1].end >> 32;
return;
}
}
bar_info->val = res[pos].start |
(res[pos].flags & PCI_REGION_FLAG_MASK);
bar_info->len_val = resource_size(&res[pos]);
}
| 11,734
|
37,265
| 0
|
static void vmx_inject_nmi(struct kvm_vcpu *vcpu)
{
struct vcpu_vmx *vmx = to_vmx(vcpu);
if (is_guest_mode(vcpu))
return;
if (!cpu_has_virtual_nmis()) {
/*
* Tracking the NMI-blocked state in software is built upon
* finding the next open IRQ window. This, in turn, depends on
* well-behaving guests: They have to keep IRQs disabled at
* least as long as the NMI handler runs. Otherwise we may
* cause NMI nesting, maybe breaking the guest. But as this is
* highly unlikely, we can live with the residual risk.
*/
vmx->soft_vnmi_blocked = 1;
vmx->vnmi_blocked_time = 0;
}
++vcpu->stat.nmi_injections;
vmx->nmi_known_unmasked = false;
if (vmx->rmode.vm86_active) {
if (kvm_inject_realmode_interrupt(vcpu, NMI_VECTOR, 0) != EMULATE_DONE)
kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu);
return;
}
vmcs_write32(VM_ENTRY_INTR_INFO_FIELD,
INTR_TYPE_NMI_INTR | INTR_INFO_VALID_MASK | NMI_VECTOR);
}
| 11,735
|
27,214
| 0
|
SYSCALL_DEFINE1(osf_brk, unsigned long, brk)
{
unsigned long retval = sys_brk(brk);
if (brk && brk != retval)
retval = -ENOMEM;
return retval;
}
| 11,736
|
123,231
| 0
|
void RenderWidgetHostViewAura::OnWindowDestroying() {
#if defined(OS_WIN)
HWND parent = NULL;
if (!window_->GetRootWindow() || host_->is_hidden()) {
parent = ui::GetHiddenWindow();
} else {
parent = window_->GetRootWindow()->GetAcceleratedWidget();
}
LPARAM lparam = reinterpret_cast<LPARAM>(this);
EnumChildWindows(parent, WindowDestroyingCallback, lparam);
#endif
}
| 11,737
|
105,799
| 0
|
void Label::SetAllowCharacterBreak(bool allow_character_break) {
if (allow_character_break != allow_character_break_) {
allow_character_break_ = allow_character_break;
text_size_valid_ = false;
PreferredSizeChanged();
SchedulePaint();
}
}
| 11,738
|
157,115
| 0
|
void ResourceMultiBufferDataProvider::DidFail(const WebURLError& error) {
DVLOG(1) << "didFail: reason=" << error.reason();
DCHECK(active_loader_.get());
active_loader_.reset();
if (retries_ < kMaxRetries && pos_ != 0) {
retries_++;
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE,
base::Bind(&ResourceMultiBufferDataProvider::Start,
weak_factory_.GetWeakPtr()),
base::TimeDelta::FromMilliseconds(
kLoaderFailedRetryDelayMs + kAdditionalDelayPerRetryMs * retries_));
} else {
url_data_->Fail();
}
}
| 11,739
|
37,692
| 0
|
struct assoc_array_edit *assoc_array_clear(struct assoc_array *array,
const struct assoc_array_ops *ops)
{
struct assoc_array_edit *edit;
pr_devel("-->%s()\n", __func__);
if (!array->root)
return NULL;
edit = kzalloc(sizeof(struct assoc_array_edit), GFP_KERNEL);
if (!edit)
return ERR_PTR(-ENOMEM);
edit->array = array;
edit->ops = ops;
edit->set[1].ptr = &array->root;
edit->set[1].to = NULL;
edit->excised_subtree = array->root;
edit->ops_for_excised_subtree = ops;
pr_devel("all gone\n");
return edit;
}
| 11,740
|
133,856
| 0
|
HFSBTreeIterator::HFSBTreeIterator()
: stream_(),
header_(),
leaf_records_read_(0),
current_leaf_records_read_(0),
current_leaf_number_(0),
read_current_leaf_(false),
leaf_data_(),
current_leaf_offset_(0),
current_leaf_() {
}
| 11,741
|
51,709
| 0
|
static const wbxml_decoding *get_wbxml_decoding_from_content_type (
const char *content_type, tvbuff_t *tvb, guint32 offset)
{
const wbxml_decoding *map = NULL;
DebugLog(("get_wbxml_decoding_from_content_type: content_type = [%s]\n",
content_type));
if (content_type && content_type[0]) {
const wbxml_literal_list *item = content_type_list;
while (item && item->content_type) {
if (g_ascii_strcasecmp(content_type, item->content_type) == 0) {
/* Try the discriminator */
if (item->discriminator != NULL) {
map = item->discriminator(tvb, offset);
}
if (map == NULL) {
map = item->map;
}
break;
}
item++;
}
}
return map;
}
| 11,742
|
181,640
| 1
|
OJPEGDecode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
{
OJPEGState* sp=(OJPEGState*)tif->tif_data;
(void)s;
if (sp->libjpeg_jpeg_query_style==0)
{
if (OJPEGDecodeRaw(tif,buf,cc)==0)
return(0);
}
else
{
if (OJPEGDecodeScanlines(tif,buf,cc)==0)
return(0);
}
return(1);
}
| 11,743
|
6,509
| 0
|
_bdf_list_ensure( _bdf_list_t* list,
unsigned long num_items ) /* same as _bdf_list_t.used */
{
FT_Error error = BDF_Err_Ok;
if ( num_items > list->size )
{
unsigned long oldsize = list->size; /* same as _bdf_list_t.size */
unsigned long newsize = oldsize + ( oldsize >> 1 ) + 5;
unsigned long bigsize = (unsigned long)( FT_INT_MAX / sizeof ( char* ) );
FT_Memory memory = list->memory;
if ( oldsize == bigsize )
{
error = BDF_Err_Out_Of_Memory;
goto Exit;
}
else if ( newsize < oldsize || newsize > bigsize )
newsize = bigsize;
if ( FT_RENEW_ARRAY( list->field, oldsize, newsize ) )
goto Exit;
list->size = newsize;
}
Exit:
return error;
}
| 11,744
|
122,622
| 0
|
static void ConvertHexadecimalToIDAlphabet(std::string* id) {
for (size_t i = 0; i < id->size(); ++i) {
int val;
if (base::HexStringToInt(base::StringPiece(id->begin() + i,
id->begin() + i + 1),
&val)) {
(*id)[i] = val + 'a';
} else {
(*id)[i] = 'a';
}
}
}
| 11,745
|
46,972
| 0
|
static bool is_blacklisted_cpu(void)
{
if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
return false;
if (boot_cpu_data.x86 == 0x0f) {
/*
* On Pentium 4, des3_ede-x86_64 is slower than generic C
* implementation because use of 64bit rotates (which are really
* slow on P4). Therefore blacklist P4s.
*/
return true;
}
return false;
}
| 11,746
|
13,782
| 0
|
ZEND_API int zend_declare_property_double(zend_class_entry *ce, const char *name, int name_length, double value, int access_type TSRMLS_DC) /* {{{ */
{
zval *property;
if (ce->type & ZEND_INTERNAL_CLASS) {
ALLOC_PERMANENT_ZVAL(property);
} else {
ALLOC_ZVAL(property);
}
INIT_PZVAL(property);
ZVAL_DOUBLE(property, value);
return zend_declare_property(ce, name, name_length, property, access_type TSRMLS_CC);
}
/* }}} */
| 11,747
|
47,179
| 0
|
void __cast6_decrypt(struct cast6_ctx *c, u8 *outbuf, const u8 *inbuf)
{
const __be32 *src = (const __be32 *)inbuf;
__be32 *dst = (__be32 *)outbuf;
u32 block[4];
u32 *Km;
u8 *Kr;
block[0] = be32_to_cpu(src[0]);
block[1] = be32_to_cpu(src[1]);
block[2] = be32_to_cpu(src[2]);
block[3] = be32_to_cpu(src[3]);
Km = c->Km[11]; Kr = c->Kr[11]; Q(block, Kr, Km);
Km = c->Km[10]; Kr = c->Kr[10]; Q(block, Kr, Km);
Km = c->Km[9]; Kr = c->Kr[9]; Q(block, Kr, Km);
Km = c->Km[8]; Kr = c->Kr[8]; Q(block, Kr, Km);
Km = c->Km[7]; Kr = c->Kr[7]; Q(block, Kr, Km);
Km = c->Km[6]; Kr = c->Kr[6]; Q(block, Kr, Km);
Km = c->Km[5]; Kr = c->Kr[5]; QBAR(block, Kr, Km);
Km = c->Km[4]; Kr = c->Kr[4]; QBAR(block, Kr, Km);
Km = c->Km[3]; Kr = c->Kr[3]; QBAR(block, Kr, Km);
Km = c->Km[2]; Kr = c->Kr[2]; QBAR(block, Kr, Km);
Km = c->Km[1]; Kr = c->Kr[1]; QBAR(block, Kr, Km);
Km = c->Km[0]; Kr = c->Kr[0]; QBAR(block, Kr, Km);
dst[0] = cpu_to_be32(block[0]);
dst[1] = cpu_to_be32(block[1]);
dst[2] = cpu_to_be32(block[2]);
dst[3] = cpu_to_be32(block[3]);
}
| 11,748
|
159,252
| 0
|
base::FilePath GetTemporaryDownloadDirectory() {
std::unique_ptr<base::Environment> env(base::Environment::Create());
return base::nix::GetXDGDirectory(env.get(), "XDG_DATA_HOME", ".local/share");
}
| 11,749
|
64,104
| 0
|
static void snd_msndmidi_input_trigger(struct snd_rawmidi_substream *substream,
int up)
{
unsigned long flags;
struct snd_msndmidi *mpu;
snd_printdd("snd_msndmidi_input_trigger(, %i)\n", up);
mpu = substream->rmidi->private_data;
spin_lock_irqsave(&mpu->input_lock, flags);
if (up) {
if (!test_and_set_bit(MSNDMIDI_MODE_BIT_INPUT_TRIGGER,
&mpu->mode))
snd_msndmidi_input_drop(mpu);
} else {
clear_bit(MSNDMIDI_MODE_BIT_INPUT_TRIGGER, &mpu->mode);
}
spin_unlock_irqrestore(&mpu->input_lock, flags);
if (up)
snd_msndmidi_input_read(mpu);
}
| 11,750
|
79,737
| 0
|
png_handle_iTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
{
png_const_charp errmsg = NULL;
png_bytep buffer;
png_uint_32 prefix_length;
png_debug(1, "in png_handle_iTXt");
#ifdef PNG_USER_LIMITS_SUPPORTED
if (png_ptr->user_chunk_cache_max != 0)
{
if (png_ptr->user_chunk_cache_max == 1)
{
png_crc_finish(png_ptr, length);
return;
}
if (--png_ptr->user_chunk_cache_max == 1)
{
png_crc_finish(png_ptr, length);
png_chunk_benign_error(png_ptr, "no space in chunk cache");
return;
}
}
#endif
if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
png_chunk_error(png_ptr, "missing IHDR");
if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
png_ptr->mode |= PNG_AFTER_IDAT;
buffer = png_read_buffer(png_ptr, length+1, 1/*warn*/);
if (buffer == NULL)
{
png_crc_finish(png_ptr, length);
png_chunk_benign_error(png_ptr, "out of memory");
return;
}
png_crc_read(png_ptr, buffer, length);
if (png_crc_finish(png_ptr, 0) != 0)
return;
/* First the keyword. */
for (prefix_length=0;
prefix_length < length && buffer[prefix_length] != 0;
++prefix_length)
/* Empty loop */ ;
/* Perform a basic check on the keyword length here. */
if (prefix_length > 79 || prefix_length < 1)
errmsg = "bad keyword";
/* Expect keyword, compression flag, compression type, language, translated
* keyword (both may be empty but are 0 terminated) then the text, which may
* be empty.
*/
else if (prefix_length + 5 > length)
errmsg = "truncated";
else if (buffer[prefix_length+1] == 0 ||
(buffer[prefix_length+1] == 1 &&
buffer[prefix_length+2] == PNG_COMPRESSION_TYPE_BASE))
{
int compressed = buffer[prefix_length+1] != 0;
png_uint_32 language_offset, translated_keyword_offset;
png_alloc_size_t uncompressed_length = 0;
/* Now the language tag */
prefix_length += 3;
language_offset = prefix_length;
for (; prefix_length < length && buffer[prefix_length] != 0;
++prefix_length)
/* Empty loop */ ;
/* WARNING: the length may be invalid here, this is checked below. */
translated_keyword_offset = ++prefix_length;
for (; prefix_length < length && buffer[prefix_length] != 0;
++prefix_length)
/* Empty loop */ ;
/* prefix_length should now be at the trailing '\0' of the translated
* keyword, but it may already be over the end. None of this arithmetic
* can overflow because chunks are at most 2^31 bytes long, but on 16-bit
* systems the available allocation may overflow.
*/
++prefix_length;
if (compressed == 0 && prefix_length <= length)
uncompressed_length = length - prefix_length;
else if (compressed != 0 && prefix_length < length)
{
uncompressed_length = PNG_SIZE_MAX;
/* TODO: at present png_decompress_chunk imposes a single application
* level memory limit, this should be split to different values for
* iCCP and text chunks.
*/
if (png_decompress_chunk(png_ptr, length, prefix_length,
&uncompressed_length, 1/*terminate*/) == Z_STREAM_END)
buffer = png_ptr->read_buffer;
else
errmsg = png_ptr->zstream.msg;
}
else
errmsg = "truncated";
if (errmsg == NULL)
{
png_text text;
buffer[uncompressed_length+prefix_length] = 0;
if (compressed == 0)
text.compression = PNG_ITXT_COMPRESSION_NONE;
else
text.compression = PNG_ITXT_COMPRESSION_zTXt;
text.key = (png_charp)buffer;
text.lang = (png_charp)buffer + language_offset;
text.lang_key = (png_charp)buffer + translated_keyword_offset;
text.text = (png_charp)buffer + prefix_length;
text.text_length = 0;
text.itxt_length = uncompressed_length;
if (png_set_text_2(png_ptr, info_ptr, &text, 1) != 0)
errmsg = "insufficient memory";
}
}
else
errmsg = "bad compression info";
if (errmsg != NULL)
png_chunk_benign_error(png_ptr, errmsg);
}
| 11,751
|
110,124
| 0
|
views::Widget* ShellWindowViews::GetWidget() {
return window_;
}
| 11,752
|
127,478
| 0
|
inline J_DCT_METHOD dctMethod() { return JDCT_ISLOW; }
| 11,753
|
8,231
| 0
|
static void v9fs_rename(void *opaque)
{
int32_t fid;
ssize_t err = 0;
size_t offset = 7;
V9fsString name;
int32_t newdirfid;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
v9fs_string_init(&name);
err = pdu_unmarshal(pdu, offset, "dds", &fid, &newdirfid, &name);
if (err < 0) {
goto out_nofid;
}
if (name_is_illegal(name.data)) {
err = -ENOENT;
goto out_nofid;
}
if (!strcmp(".", name.data) || !strcmp("..", name.data)) {
err = -EISDIR;
goto out_nofid;
}
fidp = get_fid(pdu, fid);
if (fidp == NULL) {
err = -ENOENT;
goto out_nofid;
}
BUG_ON(fidp->fid_type != P9_FID_NONE);
/* if fs driver is not path based, return EOPNOTSUPP */
if (!(pdu->s->ctx.export_flags & V9FS_PATHNAME_FSCONTEXT)) {
err = -EOPNOTSUPP;
goto out;
}
v9fs_path_write_lock(s);
err = v9fs_complete_rename(pdu, fidp, newdirfid, &name);
v9fs_path_unlock(s);
if (!err) {
err = offset;
}
out:
put_fid(pdu, fidp);
out_nofid:
pdu_complete(pdu, err);
v9fs_string_free(&name);
}
| 11,754
|
168,663
| 0
|
void IndexedDBTransaction::TaskQueue::clear() {
while (!queue_.empty())
queue_.pop();
}
| 11,755
|
92,667
| 0
|
static int select_idle_core(struct task_struct *p, struct sched_domain *sd, int target)
{
struct cpumask *cpus = this_cpu_cpumask_var_ptr(select_idle_mask);
int core, cpu;
if (!static_branch_likely(&sched_smt_present))
return -1;
if (!test_idle_cores(target, false))
return -1;
cpumask_and(cpus, sched_domain_span(sd), &p->cpus_allowed);
for_each_cpu_wrap(core, cpus, target) {
bool idle = true;
for_each_cpu(cpu, cpu_smt_mask(core)) {
cpumask_clear_cpu(cpu, cpus);
if (!available_idle_cpu(cpu))
idle = false;
}
if (idle)
return core;
}
/*
* Failed to find an idle core; stop looking for one.
*/
set_idle_cores(target, 0);
return -1;
}
| 11,756
|
6,441
| 0
|
const char* menu_cache_item_get_file_basename( MenuCacheItem* item )
{
return item->file_name;
}
| 11,757
|
113,849
| 0
|
void AudioManagerBase::ShowAudioInputSettings() {
}
| 11,758
|
61,398
| 0
|
static int mov_metadata_track_or_disc_number(MOVContext *c, AVIOContext *pb,
unsigned len, const char *key)
{
char buf[16];
short current, total = 0;
avio_rb16(pb); // unknown
current = avio_rb16(pb);
if (len >= 6)
total = avio_rb16(pb);
if (!total)
snprintf(buf, sizeof(buf), "%d", current);
else
snprintf(buf, sizeof(buf), "%d/%d", current, total);
c->fc->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED;
av_dict_set(&c->fc->metadata, key, buf, 0);
return 0;
}
| 11,759
|
83,436
| 0
|
load_chalresp_state(FILE *f, CR_STATE *state, bool verbose, FILE *debug_file)
{
/*
* Load the current challenge and expected response information from a file handle.
*
* Format is hex(challenge):hex(response):slot num
*/
char challenge_hex[CR_CHALLENGE_SIZE * 2 + 1], response_hex[CR_RESPONSE_SIZE * 2 + 1];
char salt_hex[CR_SALT_SIZE * 2 + 1];
unsigned int iterations;
int slot;
int r;
if (! f)
goto out;
/* XXX not ideal with hard coded lengths in this scan string.
* 126 corresponds to twice the size of CR_CHALLENGE_SIZE,
* 40 is twice the size of CR_RESPONSE_SIZE
* (twice because we hex encode the challenge and response)
*/
r = fscanf(f, "v2:%126[0-9a-z]:%40[0-9a-z]:%64[0-9a-z]:%d:%d", challenge_hex, response_hex, salt_hex, &iterations, &slot);
if(r == 5) {
if (! yubikey_hex_p(salt_hex)) {
D(debug_file, "Invalid salt hex input : %s", salt_hex);
goto out;
}
if(verbose) {
D(debug_file, "Challenge: %s, hashed response: %s, salt: %s, iterations: %d, slot: %d",
challenge_hex, response_hex, salt_hex, iterations, slot);
}
yubikey_hex_decode(state->salt, salt_hex, sizeof(state->salt));
state->salt_len = strlen(salt_hex) / 2;
} else {
rewind(f);
r = fscanf(f, "v1:%126[0-9a-z]:%40[0-9a-z]:%d", challenge_hex, response_hex, &slot);
if (r != 3) {
D(debug_file, "Could not parse contents of chalresp_state file (%i)", r);
goto out;
}
if (verbose) {
D(debug_file, "Challenge: %s, expected response: %s, slot: %d", challenge_hex, response_hex, slot);
}
iterations = CR_DEFAULT_ITERATIONS;
}
state->iterations = iterations;
if (! yubikey_hex_p(challenge_hex)) {
D(debug_file, "Invalid challenge hex input : %s", challenge_hex);
goto out;
}
if (! yubikey_hex_p(response_hex)) {
D(debug_file, "Invalid expected response hex input : %s", response_hex);
goto out;
}
if (slot != 1 && slot != 2) {
D(debug_file, "Invalid slot input : %i", slot);
goto out;
}
yubikey_hex_decode(state->challenge, challenge_hex, sizeof(state->challenge));
state->challenge_len = strlen(challenge_hex) / 2;
yubikey_hex_decode(state->response, response_hex, sizeof(state->response));
state->response_len = strlen(response_hex) / 2;
state->slot = slot;
return 1;
out:
return 0;
}
| 11,760
|
134,208
| 0
|
bool IsKeyEvent(const base::NativeEvent& native_event) {
return native_event.message == WM_KEYDOWN ||
native_event.message == WM_SYSKEYDOWN ||
native_event.message == WM_CHAR ||
native_event.message == WM_KEYUP ||
native_event.message == WM_SYSKEYUP;
}
| 11,761
|
31,145
| 0
|
static void fb_rotate_logo_ccw(const u8 *in, u8 *out, u32 width, u32 height)
{
int i, j, w = width - 1;
for (i = 0; i < height; i++)
for (j = 0; j < width; j++)
out[height * (w - j) + i] = *in++;
}
| 11,762
|
7,892
| 0
|
static int addnumber(JF, double value)
{
int i;
for (i = 0; i < F->numlen; ++i)
if (F->numtab[i] == value)
return i;
if (F->numlen >= F->numcap) {
F->numcap = F->numcap ? F->numcap * 2 : 16;
F->numtab = js_realloc(J, F->numtab, F->numcap * sizeof *F->numtab);
}
F->numtab[F->numlen] = value;
return F->numlen++;
}
| 11,763
|
14,761
| 0
|
PHP_FUNCTION(pg_send_execute)
{
zval *pgsql_link;
zval *pv_param_arr, **tmp;
int num_params = 0;
char **params = NULL;
char *stmtname;
int stmtname_len, id = -1;
PGconn *pgsql;
PGresult *res;
int leftover = 0;
int ret;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsa", &pgsql_link, &stmtname, &stmtname_len, &pv_param_arr) == FAILURE) {
return;
}
if (pgsql_link == NULL && id == -1) {
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
if (PQ_SETNONBLOCKING(pgsql, 1)) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to nonblocking mode");
RETURN_FALSE;
}
while ((res = PQgetResult(pgsql))) {
PQclear(res);
leftover = 1;
}
if (leftover) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "There are results on this connection. Call pg_get_result() until it returns FALSE");
}
zend_hash_internal_pointer_reset(Z_ARRVAL_P(pv_param_arr));
num_params = zend_hash_num_elements(Z_ARRVAL_P(pv_param_arr));
if (num_params > 0) {
int i = 0;
params = (char **)safe_emalloc(sizeof(char *), num_params, 0);
for(i = 0; i < num_params; i++) {
if (zend_hash_get_current_data(Z_ARRVAL_P(pv_param_arr), (void **) &tmp) == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING,"Error getting parameter");
_php_pgsql_free_params(params, num_params);
RETURN_FALSE;
}
if (Z_TYPE_PP(tmp) == IS_NULL) {
params[i] = NULL;
} else {
zval tmp_val = **tmp;
zval_copy_ctor(&tmp_val);
convert_to_string(&tmp_val);
if (Z_TYPE(tmp_val) != IS_STRING) {
php_error_docref(NULL TSRMLS_CC, E_WARNING,"Error converting parameter");
zval_dtor(&tmp_val);
_php_pgsql_free_params(params, num_params);
RETURN_FALSE;
}
params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRLEN(tmp_val));
zval_dtor(&tmp_val);
}
zend_hash_move_forward(Z_ARRVAL_P(pv_param_arr));
}
}
if (!PQsendQueryPrepared(pgsql, stmtname, num_params, (const char * const *)params, NULL, NULL, 0)) {
if ((PGG(auto_reset_persistent) & 2) && PQstatus(pgsql) != CONNECTION_OK) {
PQreset(pgsql);
}
if (!PQsendQueryPrepared(pgsql, stmtname, num_params, (const char * const *)params, NULL, NULL, 0)) {
_php_pgsql_free_params(params, num_params);
RETURN_FALSE;
}
}
_php_pgsql_free_params(params, num_params);
/* Wait to finish sending buffer */
while ((ret = PQflush(pgsql))) {
if (ret == -1) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Could not empty postgres send buffer");
break;
}
usleep(10000);
}
if (PQ_SETNONBLOCKING(pgsql, 0)) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to blocking mode");
}
RETURN_TRUE;
}
| 11,764
|
50,753
| 0
|
static int network_receive (void) /* {{{ */
{
char buffer[network_config_packet_size];
int buffer_len;
int i;
int status = 0;
receive_list_entry_t *private_list_head;
receive_list_entry_t *private_list_tail;
uint64_t private_list_length;
assert (listen_sockets_num > 0);
private_list_head = NULL;
private_list_tail = NULL;
private_list_length = 0;
while (listen_loop == 0)
{
status = poll (listen_sockets_pollfd, listen_sockets_num, -1);
if (status <= 0)
{
char errbuf[1024];
if (errno == EINTR)
continue;
ERROR ("network plugin: poll(2) failed: %s",
sstrerror (errno, errbuf, sizeof (errbuf)));
break;
}
for (i = 0; (i < listen_sockets_num) && (status > 0); i++)
{
receive_list_entry_t *ent;
if ((listen_sockets_pollfd[i].revents
& (POLLIN | POLLPRI)) == 0)
continue;
status--;
buffer_len = recv (listen_sockets_pollfd[i].fd,
buffer, sizeof (buffer),
0 /* no flags */);
if (buffer_len < 0)
{
char errbuf[1024];
status = (errno != 0) ? errno : -1;
ERROR ("network plugin: recv(2) failed: %s",
sstrerror (errno, errbuf, sizeof (errbuf)));
break;
}
stats_octets_rx += ((uint64_t) buffer_len);
stats_packets_rx++;
/* TODO: Possible performance enhancement: Do not free
* these entries in the dispatch thread but put them in
* another list, so we don't have to allocate more and
* more of these structures. */
ent = malloc (sizeof (receive_list_entry_t));
if (ent == NULL)
{
ERROR ("network plugin: malloc failed.");
status = ENOMEM;
break;
}
memset (ent, 0, sizeof (receive_list_entry_t));
ent->data = malloc (network_config_packet_size);
if (ent->data == NULL)
{
sfree (ent);
ERROR ("network plugin: malloc failed.");
status = ENOMEM;
break;
}
ent->fd = listen_sockets_pollfd[i].fd;
ent->next = NULL;
memcpy (ent->data, buffer, buffer_len);
ent->data_len = buffer_len;
if (private_list_head == NULL)
private_list_head = ent;
else
private_list_tail->next = ent;
private_list_tail = ent;
private_list_length++;
/* Do not block here. Blocking here has led to
* insufficient performance in the past. */
if (pthread_mutex_trylock (&receive_list_lock) == 0)
{
assert (((receive_list_head == NULL) && (receive_list_length == 0))
|| ((receive_list_head != NULL) && (receive_list_length != 0)));
if (receive_list_head == NULL)
receive_list_head = private_list_head;
else
receive_list_tail->next = private_list_head;
receive_list_tail = private_list_tail;
receive_list_length += private_list_length;
pthread_cond_signal (&receive_list_cond);
pthread_mutex_unlock (&receive_list_lock);
private_list_head = NULL;
private_list_tail = NULL;
private_list_length = 0;
}
status = 0;
} /* for (listen_sockets_pollfd) */
if (status != 0)
break;
} /* while (listen_loop == 0) */
/* Make sure everything is dispatched before exiting. */
if (private_list_head != NULL)
{
pthread_mutex_lock (&receive_list_lock);
if (receive_list_head == NULL)
receive_list_head = private_list_head;
else
receive_list_tail->next = private_list_head;
receive_list_tail = private_list_tail;
receive_list_length += private_list_length;
pthread_cond_signal (&receive_list_cond);
pthread_mutex_unlock (&receive_list_lock);
}
return (status);
} /* }}} int network_receive */
| 11,765
|
6,396
| 0
|
static PHP_GINIT_FUNCTION(exif)
{
exif_globals->encode_unicode = NULL;
exif_globals->decode_unicode_be = NULL;
exif_globals->decode_unicode_le = NULL;
exif_globals->encode_jis = NULL;
exif_globals->decode_jis_be = NULL;
exif_globals->decode_jis_le = NULL;
}
| 11,766
|
84,146
| 0
|
int blkg_print_stat_ios_recursive(struct seq_file *sf, void *v)
{
blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)),
blkg_prfill_rwstat_field_recursive,
(void *)seq_cft(sf)->private,
offsetof(struct blkcg_gq, stat_ios), true);
return 0;
}
| 11,767
|
60,735
| 0
|
get_key(krb5_context context, pkinit_identity_crypto_context id_cryptoctx,
char *filename, const char *fsname, EVP_PKEY **retkey,
const char *password)
{
EVP_PKEY *pkey = NULL;
BIO *tmp = NULL;
struct get_key_cb_data cb_data;
int code;
krb5_error_code retval;
if (filename == NULL || retkey == NULL)
return EINVAL;
tmp = BIO_new(BIO_s_file());
if (tmp == NULL)
return ENOMEM;
code = BIO_read_filename(tmp, filename);
if (code == 0) {
retval = errno;
goto cleanup;
}
cb_data.context = context;
cb_data.id_cryptoctx = id_cryptoctx;
cb_data.filename = filename;
cb_data.fsname = fsname;
cb_data.password = password;
pkey = PEM_read_bio_PrivateKey(tmp, NULL, get_key_cb, &cb_data);
if (pkey == NULL && !id_cryptoctx->defer_id_prompt) {
retval = EIO;
pkiDebug("failed to read private key from %s\n", filename);
goto cleanup;
}
*retkey = pkey;
retval = 0;
cleanup:
if (tmp != NULL)
BIO_free(tmp);
return retval;
}
| 11,768
|
59,175
| 0
|
static bool try_match_pkt_pointers(const struct bpf_insn *insn,
struct bpf_reg_state *dst_reg,
struct bpf_reg_state *src_reg,
struct bpf_verifier_state *this_branch,
struct bpf_verifier_state *other_branch)
{
if (BPF_SRC(insn->code) != BPF_X)
return false;
switch (BPF_OP(insn->code)) {
case BPF_JGT:
if ((dst_reg->type == PTR_TO_PACKET &&
src_reg->type == PTR_TO_PACKET_END) ||
(dst_reg->type == PTR_TO_PACKET_META &&
reg_is_init_pkt_pointer(src_reg, PTR_TO_PACKET))) {
/* pkt_data' > pkt_end, pkt_meta' > pkt_data */
find_good_pkt_pointers(this_branch, dst_reg,
dst_reg->type, false);
} else if ((dst_reg->type == PTR_TO_PACKET_END &&
src_reg->type == PTR_TO_PACKET) ||
(reg_is_init_pkt_pointer(dst_reg, PTR_TO_PACKET) &&
src_reg->type == PTR_TO_PACKET_META)) {
/* pkt_end > pkt_data', pkt_data > pkt_meta' */
find_good_pkt_pointers(other_branch, src_reg,
src_reg->type, true);
} else {
return false;
}
break;
case BPF_JLT:
if ((dst_reg->type == PTR_TO_PACKET &&
src_reg->type == PTR_TO_PACKET_END) ||
(dst_reg->type == PTR_TO_PACKET_META &&
reg_is_init_pkt_pointer(src_reg, PTR_TO_PACKET))) {
/* pkt_data' < pkt_end, pkt_meta' < pkt_data */
find_good_pkt_pointers(other_branch, dst_reg,
dst_reg->type, true);
} else if ((dst_reg->type == PTR_TO_PACKET_END &&
src_reg->type == PTR_TO_PACKET) ||
(reg_is_init_pkt_pointer(dst_reg, PTR_TO_PACKET) &&
src_reg->type == PTR_TO_PACKET_META)) {
/* pkt_end < pkt_data', pkt_data > pkt_meta' */
find_good_pkt_pointers(this_branch, src_reg,
src_reg->type, false);
} else {
return false;
}
break;
case BPF_JGE:
if ((dst_reg->type == PTR_TO_PACKET &&
src_reg->type == PTR_TO_PACKET_END) ||
(dst_reg->type == PTR_TO_PACKET_META &&
reg_is_init_pkt_pointer(src_reg, PTR_TO_PACKET))) {
/* pkt_data' >= pkt_end, pkt_meta' >= pkt_data */
find_good_pkt_pointers(this_branch, dst_reg,
dst_reg->type, true);
} else if ((dst_reg->type == PTR_TO_PACKET_END &&
src_reg->type == PTR_TO_PACKET) ||
(reg_is_init_pkt_pointer(dst_reg, PTR_TO_PACKET) &&
src_reg->type == PTR_TO_PACKET_META)) {
/* pkt_end >= pkt_data', pkt_data >= pkt_meta' */
find_good_pkt_pointers(other_branch, src_reg,
src_reg->type, false);
} else {
return false;
}
break;
case BPF_JLE:
if ((dst_reg->type == PTR_TO_PACKET &&
src_reg->type == PTR_TO_PACKET_END) ||
(dst_reg->type == PTR_TO_PACKET_META &&
reg_is_init_pkt_pointer(src_reg, PTR_TO_PACKET))) {
/* pkt_data' <= pkt_end, pkt_meta' <= pkt_data */
find_good_pkt_pointers(other_branch, dst_reg,
dst_reg->type, false);
} else if ((dst_reg->type == PTR_TO_PACKET_END &&
src_reg->type == PTR_TO_PACKET) ||
(reg_is_init_pkt_pointer(dst_reg, PTR_TO_PACKET) &&
src_reg->type == PTR_TO_PACKET_META)) {
/* pkt_end <= pkt_data', pkt_data <= pkt_meta' */
find_good_pkt_pointers(this_branch, src_reg,
src_reg->type, true);
} else {
return false;
}
break;
default:
return false;
}
return true;
}
| 11,769
|
69,841
| 0
|
channel_flush_from_first_active_circuit(channel_t *chan, int max)
{
circuitmux_t *cmux = NULL;
int n_flushed = 0;
cell_queue_t *queue;
circuit_t *circ;
or_circuit_t *or_circ;
int streams_blocked;
packed_cell_t *cell;
/* Get the cmux */
tor_assert(chan);
tor_assert(chan->cmux);
cmux = chan->cmux;
/* Main loop: pick a circuit, send a cell, update the cmux */
while (n_flushed < max) {
circ = circuitmux_get_first_active_circuit(cmux);
/* If it returns NULL, no cells left to send */
if (!circ) break;
assert_cmux_ok_paranoid(chan);
if (circ->n_chan == chan) {
queue = &circ->n_chan_cells;
streams_blocked = circ->streams_blocked_on_n_chan;
} else {
or_circ = TO_OR_CIRCUIT(circ);
tor_assert(or_circ->p_chan == chan);
queue = &TO_OR_CIRCUIT(circ)->p_chan_cells;
streams_blocked = circ->streams_blocked_on_p_chan;
}
/* Circuitmux told us this was active, so it should have cells */
tor_assert(queue->n > 0);
/*
* Get just one cell here; once we've sent it, that can change the circuit
* selection, so we have to loop around for another even if this circuit
* has more than one.
*/
cell = cell_queue_pop(queue);
/* Calculate the exact time that this cell has spent in the queue. */
if (get_options()->CellStatistics && !CIRCUIT_IS_ORIGIN(circ)) {
uint32_t msec_waiting;
struct timeval tvnow;
or_circ = TO_OR_CIRCUIT(circ);
tor_gettimeofday_cached(&tvnow);
msec_waiting = ((uint32_t)tv_to_msec(&tvnow)) - cell->inserted_time;
or_circ->total_cell_waiting_time += msec_waiting;
or_circ->processed_cells++;
}
/* If we just flushed our queue and this circuit is used for a
* tunneled directory request, possibly advance its state. */
if (queue->n == 0 && chan->dirreq_id)
geoip_change_dirreq_state(chan->dirreq_id,
DIRREQ_TUNNELED,
DIRREQ_CIRC_QUEUE_FLUSHED);
/* Now send the cell */
channel_write_packed_cell(chan, cell);
cell = NULL;
/*
* Don't packed_cell_free_unchecked(cell) here because the channel will
* do so when it gets out of the channel queue (probably already did, in
* which case that was an immediate double-free bug).
*/
/* Update the counter */
++n_flushed;
/*
* Now update the cmux; tell it we've just sent a cell, and how many
* we have left.
*/
circuitmux_notify_xmit_cells(cmux, circ, 1);
circuitmux_set_num_cells(cmux, circ, queue->n);
if (queue->n == 0)
log_debug(LD_GENERAL, "Made a circuit inactive.");
/* Is the cell queue low enough to unblock all the streams that are waiting
* to write to this circuit? */
if (streams_blocked && queue->n <= CELL_QUEUE_LOWWATER_SIZE)
set_streams_blocked_on_circ(circ, chan, 0, 0); /* unblock streams */
/* If n_flushed < max still, loop around and pick another circuit */
}
/* Okay, we're done sending now */
assert_cmux_ok_paranoid(chan);
return n_flushed;
}
| 11,770
|
160,237
| 0
|
std::string GetRequestStringForPNACL(const std::string& fragment) const {
return RequestString(test_page_url_ + fragment, "navigate", "include") +
RequestString(GetURL("/pnacl_url_loader.nmf"), "same-origin",
"same-origin") +
RequestString(GetURL("/pnacl_url_loader_newlib_pnacl.pexe"),
"same-origin", "same-origin");
}
| 11,771
|
143,187
| 0
|
void Document::enqueueScrollEventForNode(Node* target)
{
Event* scrollEvent = target->isDocumentNode() ? Event::createBubble(EventTypeNames::scroll) : Event::create(EventTypeNames::scroll);
scrollEvent->setTarget(target);
ensureScriptedAnimationController().enqueuePerFrameEvent(scrollEvent);
}
| 11,772
|
38,395
| 0
|
static int cm_init_qp_rts_attr(struct cm_id_private *cm_id_priv,
struct ib_qp_attr *qp_attr,
int *qp_attr_mask)
{
unsigned long flags;
int ret;
spin_lock_irqsave(&cm_id_priv->lock, flags);
switch (cm_id_priv->id.state) {
/* Allow transition to RTS before sending REP */
case IB_CM_REQ_RCVD:
case IB_CM_MRA_REQ_SENT:
case IB_CM_REP_RCVD:
case IB_CM_MRA_REP_SENT:
case IB_CM_REP_SENT:
case IB_CM_MRA_REP_RCVD:
case IB_CM_ESTABLISHED:
if (cm_id_priv->id.lap_state == IB_CM_LAP_UNINIT) {
*qp_attr_mask = IB_QP_STATE | IB_QP_SQ_PSN;
qp_attr->sq_psn = be32_to_cpu(cm_id_priv->sq_psn);
switch (cm_id_priv->qp_type) {
case IB_QPT_RC:
case IB_QPT_XRC_INI:
*qp_attr_mask |= IB_QP_RETRY_CNT | IB_QP_RNR_RETRY |
IB_QP_MAX_QP_RD_ATOMIC;
qp_attr->retry_cnt = cm_id_priv->retry_count;
qp_attr->rnr_retry = cm_id_priv->rnr_retry_count;
qp_attr->max_rd_atomic = cm_id_priv->initiator_depth;
/* fall through */
case IB_QPT_XRC_TGT:
*qp_attr_mask |= IB_QP_TIMEOUT;
qp_attr->timeout = cm_id_priv->av.timeout;
break;
default:
break;
}
if (cm_id_priv->alt_av.ah_attr.dlid) {
*qp_attr_mask |= IB_QP_PATH_MIG_STATE;
qp_attr->path_mig_state = IB_MIG_REARM;
}
} else {
*qp_attr_mask = IB_QP_ALT_PATH | IB_QP_PATH_MIG_STATE;
qp_attr->alt_port_num = cm_id_priv->alt_av.port->port_num;
qp_attr->alt_pkey_index = cm_id_priv->alt_av.pkey_index;
qp_attr->alt_timeout = cm_id_priv->alt_av.timeout;
qp_attr->alt_ah_attr = cm_id_priv->alt_av.ah_attr;
qp_attr->path_mig_state = IB_MIG_REARM;
}
ret = 0;
break;
default:
ret = -EINVAL;
break;
}
spin_unlock_irqrestore(&cm_id_priv->lock, flags);
return ret;
}
| 11,773
|
134,016
| 0
|
void ExtensionAppItem::Move(const ExtensionAppItem* prev,
const ExtensionAppItem* next) {
if (!prev && !next)
return; // No reordering necessary
extensions::ExtensionPrefs* prefs = extensions::ExtensionPrefs::Get(profile_);
extensions::AppSorting* sorting = GetAppSorting(profile_);
syncer::StringOrdinal page;
std::string prev_id, next_id;
if (!prev) {
next_id = next->extension_id();
page = sorting->GetPageOrdinal(next_id);
} else if (!next) {
prev_id = prev->extension_id();
page = sorting->GetPageOrdinal(prev_id);
} else {
prev_id = prev->extension_id();
page = sorting->GetPageOrdinal(prev_id);
if (page.Equals(sorting->GetPageOrdinal(next->extension_id())))
next_id = next->extension_id();
}
prefs->SetAppDraggedByUser(extension_id_);
sorting->SetPageOrdinal(extension_id_, page);
sorting->OnExtensionMoved(extension_id_, prev_id, next_id);
UpdatePositionFromExtensionOrdering();
}
| 11,774
|
119,399
| 0
|
RenderThreadImpl::HistogramCustomizer::HistogramCustomizer() {
custom_histograms_.insert("V8.MemoryExternalFragmentationTotal");
custom_histograms_.insert("V8.MemoryHeapSampleTotalCommitted");
custom_histograms_.insert("V8.MemoryHeapSampleTotalUsed");
}
| 11,775
|
2,651
| 0
|
sn_array_end(void *state)
{
StripnullState *_state = (StripnullState *) state;
appendStringInfoCharMacro(_state->strval, ']');
}
| 11,776
|
63,917
| 0
|
static int timerfd_release(struct inode *inode, struct file *file)
{
struct timerfd_ctx *ctx = file->private_data;
timerfd_remove_cancel(ctx);
if (isalarm(ctx))
alarm_cancel(&ctx->t.alarm);
else
hrtimer_cancel(&ctx->t.tmr);
kfree_rcu(ctx, rcu);
return 0;
}
| 11,777
|
25,545
| 0
|
void die(const char * str, struct pt_regs * regs, long err)
{
static int die_counter;
oops_enter();
spin_lock_irq(&die_lock);
console_verbose();
bust_spinlocks(1);
printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
print_modules();
show_regs(regs);
printk("Process: %s (pid: %d, stack limit = %p)\n", current->comm,
task_pid_nr(current), task_stack_page(current) + 1);
if (!user_mode(regs) || in_interrupt())
dump_mem("Stack: ", regs->regs[15], THREAD_SIZE +
(unsigned long)task_stack_page(current));
notify_die(DIE_OOPS, str, regs, err, 255, SIGSEGV);
bust_spinlocks(0);
add_taint(TAINT_DIE);
spin_unlock_irq(&die_lock);
oops_exit();
if (kexec_should_crash(current))
crash_kexec(regs);
if (in_interrupt())
panic("Fatal exception in interrupt");
if (panic_on_oops)
panic("Fatal exception");
do_exit(SIGSEGV);
}
| 11,778
|
173,820
| 0
|
OMX_ERRORTYPE omx_video::empty_this_buffer(OMX_IN OMX_HANDLETYPE hComp,
OMX_IN OMX_BUFFERHEADERTYPE* buffer)
{
OMX_ERRORTYPE ret1 = OMX_ErrorNone;
unsigned int nBufferIndex ;
DEBUG_PRINT_LOW("ETB: buffer = %p, buffer->pBuffer[%p]", buffer, buffer->pBuffer);
if (m_state == OMX_StateInvalid) {
DEBUG_PRINT_ERROR("ERROR: Empty this buffer in Invalid State");
return OMX_ErrorInvalidState;
}
if (buffer == NULL || (buffer->nSize != sizeof(OMX_BUFFERHEADERTYPE))) {
DEBUG_PRINT_ERROR("ERROR: omx_video::etb--> buffer is null or buffer size is invalid");
return OMX_ErrorBadParameter;
}
if (buffer->nVersion.nVersion != OMX_SPEC_VERSION) {
DEBUG_PRINT_ERROR("ERROR: omx_video::etb--> OMX Version Invalid");
return OMX_ErrorVersionMismatch;
}
if (buffer->nInputPortIndex != (OMX_U32)PORT_INDEX_IN) {
DEBUG_PRINT_ERROR("ERROR: Bad port index to call empty_this_buffer");
return OMX_ErrorBadPortIndex;
}
if (!m_sInPortDef.bEnabled) {
DEBUG_PRINT_ERROR("ERROR: Cannot call empty_this_buffer while I/P port is disabled");
return OMX_ErrorIncorrectStateOperation;
}
nBufferIndex = buffer - ((!meta_mode_enable)?m_inp_mem_ptr:meta_buffer_hdr);
if (nBufferIndex > m_sInPortDef.nBufferCountActual ) {
DEBUG_PRINT_ERROR("ERROR: ETB: Invalid buffer index[%d]", nBufferIndex);
return OMX_ErrorBadParameter;
}
m_etb_count++;
DEBUG_PRINT_LOW("DBG: i/p nTimestamp = %u", (unsigned)buffer->nTimeStamp);
post_event ((unsigned long)hComp,(unsigned long)buffer,m_input_msg_id);
return OMX_ErrorNone;
}
| 11,779
|
183,218
| 1
|
static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
const uint8_t *buf, int buf_size)
{
ParseContext *pc = &dctx->pc;
uint64_t state = pc->state64;
int pic_found = pc->frame_start_found;
int i = 0;
if (!pic_found) {
for (i = 0; i < buf_size; i++) {
state = (state << 8) | buf[i];
if (ff_dnxhd_check_header_prefix(state & 0xffffffffff00LL) != 0) {
i++;
pic_found = 1;
dctx->cur_byte = 0;
dctx->remaining = 0;
break;
}
}
}
if (pic_found && !dctx->remaining) {
if (!buf_size) /* EOF considered as end of frame */
return 0;
for (; i < buf_size; i++) {
dctx->cur_byte++;
state = (state << 8) | buf[i];
if (dctx->cur_byte == 24) {
dctx->h = (state >> 32) & 0xFFFF;
} else if (dctx->cur_byte == 26) {
dctx->w = (state >> 32) & 0xFFFF;
} else if (dctx->cur_byte == 42) {
int cid = (state >> 32) & 0xFFFFFFFF;
if (cid <= 0)
continue;
dctx->remaining = avpriv_dnxhd_get_frame_size(cid);
if (dctx->remaining <= 0) {
dctx->remaining = dnxhd_get_hr_frame_size(cid, dctx->w, dctx->h);
if (dctx->remaining <= 0)
return dctx->remaining;
}
if (buf_size - i + 47 >= dctx->remaining) {
int remaining = dctx->remaining;
pc->frame_start_found = 0;
pc->state64 = -1;
dctx->cur_byte = 0;
dctx->remaining = 0;
return remaining;
} else {
dctx->remaining -= buf_size;
}
}
}
} else if (pic_found) {
if (dctx->remaining > buf_size) {
dctx->remaining -= buf_size;
} else {
int remaining = dctx->remaining;
pc->frame_start_found = 0;
pc->state64 = -1;
dctx->cur_byte = 0;
dctx->remaining = 0;
return remaining;
}
}
pc->frame_start_found = pic_found;
pc->state64 = state;
return END_NOT_FOUND;
}
| 11,780
|
10,931
| 0
|
static int exif_file_sections_free(image_info_type *ImageInfo)
{
int i;
if (ImageInfo->file.count) {
for (i=0; i<ImageInfo->file.count; i++) {
EFREE_IF(ImageInfo->file.list[i].data);
}
}
EFREE_IF(ImageInfo->file.list);
ImageInfo->file.count = 0;
return TRUE;
}
| 11,781
|
129,584
| 0
|
LayoutSVGResourceMarker::LayoutSVGResourceMarker(SVGMarkerElement* node)
: LayoutSVGResourceContainer(node)
{
}
| 11,782
|
178,872
| 1
|
static struct nfs4_opendata *nfs4_opendata_alloc(struct path *path,
struct nfs4_state_owner *sp, int flags,
const struct iattr *attrs)
{
struct dentry *parent = dget_parent(path->dentry);
struct inode *dir = parent->d_inode;
struct nfs_server *server = NFS_SERVER(dir);
struct nfs4_opendata *p;
p = kzalloc(sizeof(*p), GFP_KERNEL);
if (p == NULL)
goto err;
p->o_arg.seqid = nfs_alloc_seqid(&sp->so_seqid);
if (p->o_arg.seqid == NULL)
goto err_free;
p->path.mnt = mntget(path->mnt);
p->path.dentry = dget(path->dentry);
p->dir = parent;
p->owner = sp;
atomic_inc(&sp->so_count);
p->o_arg.fh = NFS_FH(dir);
p->o_arg.open_flags = flags,
p->o_arg.clientid = server->nfs_client->cl_clientid;
p->o_arg.id = sp->so_owner_id.id;
p->o_arg.name = &p->path.dentry->d_name;
p->o_arg.server = server;
p->o_arg.bitmask = server->attr_bitmask;
p->o_arg.claim = NFS4_OPEN_CLAIM_NULL;
if (flags & O_EXCL) {
u32 *s = (u32 *) p->o_arg.u.verifier.data;
s[0] = jiffies;
s[1] = current->pid;
} else if (flags & O_CREAT) {
p->o_arg.u.attrs = &p->attrs;
memcpy(&p->attrs, attrs, sizeof(p->attrs));
}
p->c_arg.fh = &p->o_res.fh;
p->c_arg.stateid = &p->o_res.stateid;
p->c_arg.seqid = p->o_arg.seqid;
nfs4_init_opendata_res(p);
kref_init(&p->kref);
return p;
err_free:
kfree(p);
err:
dput(parent);
return NULL;
}
| 11,783
|
158,201
| 0
|
void Start(
std::unique_ptr<network::SharedURLLoaderFactoryInfo>
network_loader_factory_info,
ServiceWorkerNavigationHandleCore* service_worker_navigation_handle_core,
AppCacheNavigationHandleCore* appcache_handle_core,
std::unique_ptr<NavigationRequestInfo> request_info,
std::unique_ptr<NavigationUIData> navigation_ui_data,
network::mojom::URLLoaderFactoryPtrInfo factory_for_webui,
int frame_tree_node_id,
std::unique_ptr<service_manager::Connector> connector) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
DCHECK(base::FeatureList::IsEnabled(network::features::kNetworkService));
DCHECK(!started_);
global_request_id_ = MakeGlobalRequestID();
frame_tree_node_id_ = frame_tree_node_id;
started_ = true;
web_contents_getter_ =
base::Bind(&GetWebContentsFromFrameTreeNodeID, frame_tree_node_id);
navigation_ui_data_ = std::move(navigation_ui_data);
DCHECK(network_loader_factory_info);
network_loader_factory_ = network::SharedURLLoaderFactory::Create(
std::move(network_loader_factory_info));
if (resource_request_->request_body) {
GetBodyBlobDataHandles(resource_request_->request_body.get(),
resource_context_, &blob_handles_);
}
if (factory_for_webui.is_valid()) {
url_loader_ = ThrottlingURLLoader::CreateLoaderAndStart(
base::MakeRefCounted<network::WrapperSharedURLLoaderFactory>(
std::move(factory_for_webui)),
CreateURLLoaderThrottles(), 0 /* routing_id */,
global_request_id_.request_id, network::mojom::kURLLoadOptionNone,
resource_request_.get(), this, kNavigationUrlLoaderTrafficAnnotation,
base::ThreadTaskRunnerHandle::Get());
return;
}
if (request_info->common_params.url.SchemeIsBlob() &&
request_info->blob_url_loader_factory) {
url_loader_ = ThrottlingURLLoader::CreateLoaderAndStart(
network::SharedURLLoaderFactory::Create(
std::move(request_info->blob_url_loader_factory)),
CreateURLLoaderThrottles(), 0 /* routing_id */,
global_request_id_.request_id, network::mojom::kURLLoadOptionNone,
resource_request_.get(), this, kNavigationUrlLoaderTrafficAnnotation,
base::ThreadTaskRunnerHandle::Get());
return;
}
if (service_worker_navigation_handle_core) {
std::unique_ptr<NavigationLoaderInterceptor> service_worker_interceptor =
CreateServiceWorkerInterceptor(*request_info,
service_worker_navigation_handle_core);
if (service_worker_interceptor)
interceptors_.push_back(std::move(service_worker_interceptor));
}
if (appcache_handle_core) {
std::unique_ptr<NavigationLoaderInterceptor> appcache_interceptor =
AppCacheRequestHandler::InitializeForMainResourceNetworkService(
*resource_request_, appcache_handle_core->host()->GetWeakPtr(),
network_loader_factory_);
if (appcache_interceptor)
interceptors_.push_back(std::move(appcache_interceptor));
}
if (signed_exchange_utils::IsSignedExchangeHandlingEnabled()) {
interceptors_.push_back(std::make_unique<SignedExchangeRequestHandler>(
url::Origin::Create(request_info->common_params.url),
request_info->common_params.url,
GetURLLoaderOptions(request_info->is_main_frame),
request_info->frame_tree_node_id,
request_info->devtools_navigation_token,
request_info->devtools_frame_token, request_info->report_raw_headers,
request_info->begin_params->load_flags, network_loader_factory_,
base::BindRepeating(
&URLLoaderRequestController::CreateURLLoaderThrottles,
base::Unretained(this))));
}
std::vector<std::unique_ptr<URLLoaderRequestInterceptor>>
browser_interceptors = GetContentClient()
->browser()
->WillCreateURLLoaderRequestInterceptors(
navigation_ui_data_.get(),
request_info->frame_tree_node_id);
if (!browser_interceptors.empty()) {
for (auto& browser_interceptor : browser_interceptors) {
interceptors_.push_back(
std::make_unique<NavigationLoaderInterceptorBrowserContainer>(
std::move(browser_interceptor)));
}
}
Restart();
}
| 11,784
|
93,101
| 0
|
sec_generate_keys(uint8 * client_random, uint8 * server_random, int rc4_key_size)
{
uint8 pre_master_secret[48];
uint8 master_secret[48];
uint8 key_block[48];
/* Construct pre-master secret */
memcpy(pre_master_secret, client_random, 24);
memcpy(pre_master_secret + 24, server_random, 24);
/* Generate master secret and then key material */
sec_hash_48(master_secret, pre_master_secret, client_random, server_random, 'A');
sec_hash_48(key_block, master_secret, client_random, server_random, 'X');
/* First 16 bytes of key material is MAC secret */
memcpy(g_sec_sign_key, key_block, 16);
/* Generate export keys from next two blocks of 16 bytes */
sec_hash_16(g_sec_decrypt_key, &key_block[16], client_random, server_random);
sec_hash_16(g_sec_encrypt_key, &key_block[32], client_random, server_random);
if (rc4_key_size == 1)
{
logger(Protocol, Debug, "sec_generate_keys(), 40-bit encryption enabled");
sec_make_40bit(g_sec_sign_key);
sec_make_40bit(g_sec_decrypt_key);
sec_make_40bit(g_sec_encrypt_key);
g_rc4_key_len = 8;
}
else
{
logger(Protocol, Debug,
"sec_generate_key(), rc_4_key_size == %d, 128-bit encryption enabled",
rc4_key_size);
g_rc4_key_len = 16;
}
/* Save initial RC4 keys as update keys */
memcpy(g_sec_decrypt_update_key, g_sec_decrypt_key, 16);
memcpy(g_sec_encrypt_update_key, g_sec_encrypt_key, 16);
/* Initialise RC4 state arrays */
rdssl_rc4_set_key(&g_rc4_decrypt_key, g_sec_decrypt_key, g_rc4_key_len);
rdssl_rc4_set_key(&g_rc4_encrypt_key, g_sec_encrypt_key, g_rc4_key_len);
}
| 11,785
|
49,690
| 0
|
void disk_part_iter_init(struct disk_part_iter *piter, struct gendisk *disk,
unsigned int flags)
{
struct disk_part_tbl *ptbl;
rcu_read_lock();
ptbl = rcu_dereference(disk->part_tbl);
piter->disk = disk;
piter->part = NULL;
if (flags & DISK_PITER_REVERSE)
piter->idx = ptbl->len - 1;
else if (flags & (DISK_PITER_INCL_PART0 | DISK_PITER_INCL_EMPTY_PART0))
piter->idx = 0;
else
piter->idx = 1;
piter->flags = flags;
rcu_read_unlock();
}
| 11,786
|
152,101
| 0
|
void RenderFrameHostImpl::SwapOut(
RenderFrameProxyHost* proxy,
bool is_loading) {
TRACE_EVENT_ASYNC_BEGIN1("navigation", "RenderFrameHostImpl::SwapOut", this,
"frame_tree_node",
frame_tree_node_->frame_tree_node_id());
if (unload_state_ != UnloadState::NotRun) {
NOTREACHED() << "RFH should be in default state when calling SwapOut.";
return;
}
if (swapout_event_monitor_timeout_) {
swapout_event_monitor_timeout_->Start(base::TimeDelta::FromMilliseconds(
RenderViewHostImpl::kUnloadTimeoutMS));
}
CHECK(proxy);
is_waiting_for_swapout_ack_ = true;
unload_state_ = UnloadState::InProgress;
if (IsRenderFrameLive()) {
FrameReplicationState replication_state =
proxy->frame_tree_node()->current_replication_state();
Send(new FrameMsg_SwapOut(routing_id_, proxy->GetRoutingID(), is_loading,
replication_state));
proxy->set_render_frame_proxy_created(true);
StartPendingDeletionOnSubtree();
}
PendingDeletionCheckCompletedOnSubtree();
if (web_ui())
web_ui()->RenderFrameHostSwappingOut();
web_bluetooth_services_.clear();
}
| 11,787
|
179,359
| 1
|
static int dev_ifconf(struct net *net, struct compat_ifconf __user *uifc32)
{
struct compat_ifconf ifc32;
struct ifconf ifc;
struct ifconf __user *uifc;
struct compat_ifreq __user *ifr32;
struct ifreq __user *ifr;
unsigned int i, j;
int err;
if (copy_from_user(&ifc32, uifc32, sizeof(struct compat_ifconf)))
return -EFAULT;
if (ifc32.ifcbuf == 0) {
ifc32.ifc_len = 0;
ifc.ifc_len = 0;
ifc.ifc_req = NULL;
uifc = compat_alloc_user_space(sizeof(struct ifconf));
} else {
size_t len = ((ifc32.ifc_len / sizeof(struct compat_ifreq)) + 1) *
sizeof(struct ifreq);
uifc = compat_alloc_user_space(sizeof(struct ifconf) + len);
ifc.ifc_len = len;
ifr = ifc.ifc_req = (void __user *)(uifc + 1);
ifr32 = compat_ptr(ifc32.ifcbuf);
for (i = 0; i < ifc32.ifc_len; i += sizeof(struct compat_ifreq)) {
if (copy_in_user(ifr, ifr32, sizeof(struct compat_ifreq)))
return -EFAULT;
ifr++;
ifr32++;
}
}
if (copy_to_user(uifc, &ifc, sizeof(struct ifconf)))
return -EFAULT;
err = dev_ioctl(net, SIOCGIFCONF, uifc);
if (err)
return err;
if (copy_from_user(&ifc, uifc, sizeof(struct ifconf)))
return -EFAULT;
ifr = ifc.ifc_req;
ifr32 = compat_ptr(ifc32.ifcbuf);
for (i = 0, j = 0;
i + sizeof(struct compat_ifreq) <= ifc32.ifc_len && j < ifc.ifc_len;
i += sizeof(struct compat_ifreq), j += sizeof(struct ifreq)) {
if (copy_in_user(ifr32, ifr, sizeof(struct compat_ifreq)))
return -EFAULT;
ifr32++;
ifr++;
}
if (ifc32.ifcbuf == 0) {
/* Translate from 64-bit structure multiple to
* a 32-bit one.
*/
i = ifc.ifc_len;
i = ((i / sizeof(struct ifreq)) * sizeof(struct compat_ifreq));
ifc32.ifc_len = i;
} else {
ifc32.ifc_len = i;
}
if (copy_to_user(uifc32, &ifc32, sizeof(struct compat_ifconf)))
return -EFAULT;
return 0;
}
| 11,788
|
23,453
| 0
|
static void nfs4_xdr_enc_access(struct rpc_rqst *req, struct xdr_stream *xdr,
const struct nfs4_accessargs *args)
{
struct compound_hdr hdr = {
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
};
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->fh, &hdr);
encode_access(xdr, args->access, &hdr);
encode_getfattr(xdr, args->bitmask, &hdr);
encode_nops(&hdr);
}
| 11,789
|
117,796
| 0
|
static v8::Handle<v8::Value> createAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.TestObj.create._get");
TestObj* imp = V8TestObj::toNative(info.Holder());
return v8Boolean(imp->isCreate());
}
| 11,790
|
187,304
| 1
|
bool SiteInstanceImpl::ShouldLockToOrigin(BrowserContext* browser_context,
GURL site_url) {
// Don't lock to origin in --single-process mode, since this mode puts
// cross-site pages into the same process.
if (RenderProcessHost::run_renderer_in_process())
return false;
if (!DoesSiteRequireDedicatedProcess(browser_context, site_url))
return false;
// Guest processes cannot be locked to their site because guests always have
// a fixed SiteInstance. The site of GURLs a guest loads doesn't match that
// SiteInstance. So we skip locking the guest process to the site.
// TODO(ncarter): Remove this exclusion once we can make origin lock per
// RenderFrame routing id.
if (site_url.SchemeIs(content::kGuestScheme))
return false;
// TODO(creis, nick) https://crbug.com/510588 Chrome UI pages use the same
// site (chrome://chrome), so they can't be locked because the site being
// loaded doesn't match the SiteInstance.
if (site_url.SchemeIs(content::kChromeUIScheme))
return false;
// TODO(creis, nick): Until we can handle sites with effective URLs at the
// call sites of ChildProcessSecurityPolicy::CanAccessDataForOrigin, we
// must give the embedder a chance to exempt some sites to avoid process
// kills.
if (!GetContentClient()->browser()->ShouldLockToOrigin(browser_context,
site_url)) {
return false;
}
return true;
}
| 11,791
|
160,178
| 0
|
int MemBackendImpl::DoomEntriesSince(Time initial_time,
const CompletionCallback& callback) {
return DoomEntriesBetween(initial_time, Time::Max(), callback);
}
| 11,792
|
16,139
| 0
|
GahpServer::command_use_cached_proxy( GahpProxyInfo *new_proxy )
{
static const char *command = "USE_CACHED_PROXY";
if (m_commands_supported->contains_anycase(command)==FALSE) {
return false;
}
if ( new_proxy == NULL ) {
return false;
}
std::string buf;
int x = sprintf(buf,"%s %d",command,new_proxy->proxy->id);
ASSERT( x > 0 );
write_line(buf.c_str());
Gahp_Args result;
read_argv(result);
if ( result.argc == 0 || result.argv[0][0] != 'S' ) {
char *reason;
if ( result.argc > 1 ) {
reason = result.argv[1];
} else {
reason = "Unspecified error";
}
dprintf(D_ALWAYS,"GAHP command '%s' failed: %s\n",command,reason);
return false;
}
return true;
}
| 11,793
|
129,515
| 0
|
bool GLES2DecoderImpl::ValidateRenderbufferStorageMultisample(
GLsizei samples,
GLenum internalformat,
GLsizei width,
GLsizei height) {
if (samples > renderbuffer_manager()->max_samples()) {
LOCAL_SET_GL_ERROR(
GL_INVALID_VALUE,
"glRenderbufferStorageMultisample", "samples too large");
return false;
}
if (width > renderbuffer_manager()->max_renderbuffer_size() ||
height > renderbuffer_manager()->max_renderbuffer_size()) {
LOCAL_SET_GL_ERROR(
GL_INVALID_VALUE,
"glRenderbufferStorageMultisample", "dimensions too large");
return false;
}
uint32 estimated_size = 0;
if (!renderbuffer_manager()->ComputeEstimatedRenderbufferSize(
width, height, samples, internalformat, &estimated_size)) {
LOCAL_SET_GL_ERROR(
GL_OUT_OF_MEMORY,
"glRenderbufferStorageMultisample", "dimensions too large");
return false;
}
if (!EnsureGPUMemoryAvailable(estimated_size)) {
LOCAL_SET_GL_ERROR(
GL_OUT_OF_MEMORY,
"glRenderbufferStorageMultisample", "out of memory");
return false;
}
return true;
}
| 11,794
|
164,366
| 0
|
bool WindowsCreateFunction::ShouldOpenIncognitoWindow(
const windows::Create::Params::CreateData* create_data,
std::vector<GURL>* urls,
std::string* error) {
Profile* profile = Profile::FromBrowserContext(browser_context());
const IncognitoModePrefs::Availability incognito_availability =
IncognitoModePrefs::GetAvailability(profile->GetPrefs());
bool incognito = false;
if (create_data && create_data->incognito) {
incognito = *create_data->incognito;
if (incognito && incognito_availability == IncognitoModePrefs::DISABLED) {
*error = tabs_constants::kIncognitoModeIsDisabled;
return false;
}
if (!incognito && incognito_availability == IncognitoModePrefs::FORCED) {
*error = tabs_constants::kIncognitoModeIsForced;
return false;
}
} else if (incognito_availability == IncognitoModePrefs::FORCED) {
incognito = true;
}
if (incognito && !profile->IsGuestSession()) {
std::string first_url_erased;
for (size_t i = 0; i < urls->size();) {
if (IsURLAllowedInIncognito((*urls)[i], profile)) {
i++;
} else {
if (first_url_erased.empty())
first_url_erased = (*urls)[i].spec();
urls->erase(urls->begin() + i);
}
}
if (urls->empty() && !first_url_erased.empty()) {
*error = ErrorUtils::FormatErrorMessage(
tabs_constants::kURLsNotAllowedInIncognitoError, first_url_erased);
return false;
}
}
return incognito;
}
| 11,795
|
57,014
| 0
|
static void sctp_do_ecn_ce_work(struct sctp_association *asoc,
__u32 lowest_tsn)
{
/* Save the TSN away for comparison when we receive CWR */
asoc->last_ecne_tsn = lowest_tsn;
asoc->need_ecne = 1;
}
| 11,796
|
40,014
| 0
|
cifs_strict_readv(struct kiocb *iocb, const struct iovec *iov,
unsigned long nr_segs, loff_t pos)
{
struct inode *inode = file_inode(iocb->ki_filp);
struct cifsInodeInfo *cinode = CIFS_I(inode);
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct cifsFileInfo *cfile = (struct cifsFileInfo *)
iocb->ki_filp->private_data;
struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
int rc = -EACCES;
/*
* In strict cache mode we need to read from the server all the time
* if we don't have level II oplock because the server can delay mtime
* change - so we can't make a decision about inode invalidating.
* And we can also fail with pagereading if there are mandatory locks
* on pages affected by this read but not on the region from pos to
* pos+len-1.
*/
if (!CIFS_CACHE_READ(cinode))
return cifs_user_readv(iocb, iov, nr_segs, pos);
if (cap_unix(tcon->ses) &&
(CIFS_UNIX_FCNTL_CAP & le64_to_cpu(tcon->fsUnixInfo.Capability)) &&
((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOPOSIXBRL) == 0))
return generic_file_aio_read(iocb, iov, nr_segs, pos);
/*
* We need to hold the sem to be sure nobody modifies lock list
* with a brlock that prevents reading.
*/
down_read(&cinode->lock_sem);
if (!cifs_find_lock_conflict(cfile, pos, iov_length(iov, nr_segs),
tcon->ses->server->vals->shared_lock_type,
NULL, CIFS_READ_OP))
rc = generic_file_aio_read(iocb, iov, nr_segs, pos);
up_read(&cinode->lock_sem);
return rc;
}
| 11,797
|
5,361
| 0
|
static void Ins_ABS( INS_ARG )
{ (void)exc;
args[0] = ABS( args[0] );
}
| 11,798
|
104,670
| 0
|
scoped_refptr<Extension> LoadExtension(DictionaryValue* value,
std::string* error) {
return LoadExtensionWithLocation(value, Extension::INTERNAL, false, error);
}
| 11,799
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.