unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
|---|---|---|---|
41,887
| 0
|
static int snmp6_alloc_dev(struct inet6_dev *idev)
{
int i;
idev->stats.ipv6 = alloc_percpu(struct ipstats_mib);
if (!idev->stats.ipv6)
goto err_ip;
for_each_possible_cpu(i) {
struct ipstats_mib *addrconf_stats;
addrconf_stats = per_cpu_ptr(idev->stats.ipv6, i);
u64_stats_init(&addrconf_stats->syncp);
}
idev->stats.icmpv6dev = kzalloc(sizeof(struct icmpv6_mib_device),
GFP_KERNEL);
if (!idev->stats.icmpv6dev)
goto err_icmp;
idev->stats.icmpv6msgdev = kzalloc(sizeof(struct icmpv6msg_mib_device),
GFP_KERNEL);
if (!idev->stats.icmpv6msgdev)
goto err_icmpmsg;
return 0;
err_icmpmsg:
kfree(idev->stats.icmpv6dev);
err_icmp:
free_percpu(idev->stats.ipv6);
err_ip:
return -ENOMEM;
}
| 13,100
|
51,480
| 0
|
static int _vop_virtio_copy(struct vop_vdev *vdev, struct mic_copy_desc *copy)
{
int ret = 0;
u32 iovcnt = copy->iovcnt;
struct iovec iov;
struct iovec __user *u_iov = copy->iov;
void __user *ubuf = NULL;
struct vop_vringh *vvr = &vdev->vvr[copy->vr_idx];
struct vringh_kiov *riov = &vvr->riov;
struct vringh_kiov *wiov = &vvr->wiov;
struct vringh *vrh = &vvr->vrh;
u16 *head = &vvr->head;
struct mic_vring *vr = &vvr->vring;
size_t len = 0, out_len;
copy->out_len = 0;
/* Fetch a new IOVEC if all previous elements have been processed */
if (riov->i == riov->used && wiov->i == wiov->used) {
ret = vringh_getdesc_kern(vrh, riov, wiov,
head, GFP_KERNEL);
/* Check if there are available descriptors */
if (ret <= 0)
return ret;
}
while (iovcnt) {
if (!len) {
/* Copy over a new iovec from user space. */
ret = copy_from_user(&iov, u_iov, sizeof(*u_iov));
if (ret) {
ret = -EINVAL;
dev_err(vop_dev(vdev), "%s %d err %d\n",
__func__, __LINE__, ret);
break;
}
len = iov.iov_len;
ubuf = iov.iov_base;
}
/* Issue all the read descriptors first */
ret = vop_vringh_copy(vdev, riov, ubuf, len,
MIC_VRINGH_READ, copy->vr_idx, &out_len);
if (ret) {
dev_err(vop_dev(vdev), "%s %d err %d\n",
__func__, __LINE__, ret);
break;
}
len -= out_len;
ubuf += out_len;
copy->out_len += out_len;
/* Issue the write descriptors next */
ret = vop_vringh_copy(vdev, wiov, ubuf, len,
!MIC_VRINGH_READ, copy->vr_idx, &out_len);
if (ret) {
dev_err(vop_dev(vdev), "%s %d err %d\n",
__func__, __LINE__, ret);
break;
}
len -= out_len;
ubuf += out_len;
copy->out_len += out_len;
if (!len) {
/* One user space iovec is now completed */
iovcnt--;
u_iov++;
}
/* Exit loop if all elements in KIOVs have been processed. */
if (riov->i == riov->used && wiov->i == wiov->used)
break;
}
/*
* Update the used ring if a descriptor was available and some data was
* copied in/out and the user asked for a used ring update.
*/
if (*head != USHRT_MAX && copy->out_len && copy->update_used) {
u32 total = 0;
/* Determine the total data consumed */
total += vop_vringh_iov_consumed(riov);
total += vop_vringh_iov_consumed(wiov);
vringh_complete_kern(vrh, *head, total);
*head = USHRT_MAX;
if (vringh_need_notify_kern(vrh) > 0)
vringh_notify(vrh);
vringh_kiov_cleanup(riov);
vringh_kiov_cleanup(wiov);
/* Update avail idx for user space */
vr->info->avail_idx = vrh->last_avail_idx;
}
return ret;
}
| 13,101
|
17,378
| 0
|
ProcPanoramiXQueryVersion(ClientPtr client)
{
/* REQUEST(xPanoramiXQueryVersionReq); */
xPanoramiXQueryVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.majorVersion = SERVER_PANORAMIX_MAJOR_VERSION,
.minorVersion = SERVER_PANORAMIX_MINOR_VERSION
};
REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
}
WriteToClient(client, sizeof(xPanoramiXQueryVersionReply), &rep);
return Success;
}
| 13,102
|
29,809
| 0
|
bind_socket(struct TCP_Server_Info *server)
{
int rc = 0;
if (server->srcaddr.ss_family != AF_UNSPEC) {
/* Bind to the specified local IP address */
struct socket *socket = server->ssocket;
rc = socket->ops->bind(socket,
(struct sockaddr *) &server->srcaddr,
sizeof(server->srcaddr));
if (rc < 0) {
struct sockaddr_in *saddr4;
struct sockaddr_in6 *saddr6;
saddr4 = (struct sockaddr_in *)&server->srcaddr;
saddr6 = (struct sockaddr_in6 *)&server->srcaddr;
if (saddr6->sin6_family == AF_INET6)
cifs_dbg(VFS, "Failed to bind to: %pI6c, error: %d\n",
&saddr6->sin6_addr, rc);
else
cifs_dbg(VFS, "Failed to bind to: %pI4, error: %d\n",
&saddr4->sin_addr.s_addr, rc);
}
}
return rc;
}
| 13,103
|
165,656
| 0
|
const CLSID& GetElevatorClsid() {
return InstallDetails::Get().elevator_clsid();
}
| 13,104
|
21,805
| 0
|
static int emulate_nm(struct x86_emulate_ctxt *ctxt)
{
return emulate_exception(ctxt, NM_VECTOR, 0, false);
}
| 13,105
|
12,284
| 0
|
gpgsm_set_locale (void *engine, int category, const char *value)
{
engine_gpgsm_t gpgsm = engine;
gpgme_error_t err;
char *optstr;
char *catstr;
/* FIXME: If value is NULL, we need to reset the option to default.
But we can't do this. So we error out here. GPGSM needs support
for this. */
if (0)
;
#ifdef LC_CTYPE
else if (category == LC_CTYPE)
{
catstr = "lc-ctype";
if (!value && gpgsm->lc_ctype_set)
return gpg_error (GPG_ERR_INV_VALUE);
if (value)
gpgsm->lc_ctype_set = 1;
}
#endif
#ifdef LC_MESSAGES
else if (category == LC_MESSAGES)
{
catstr = "lc-messages";
if (!value && gpgsm->lc_messages_set)
return gpg_error (GPG_ERR_INV_VALUE);
if (value)
gpgsm->lc_messages_set = 1;
}
#endif /* LC_MESSAGES */
else
return gpg_error (GPG_ERR_INV_VALUE);
/* FIXME: Reset value to default. */
if (!value)
return 0;
if (asprintf (&optstr, "OPTION %s=%s", catstr, value) < 0)
err = gpg_error_from_syserror ();
else
{
err = assuan_transact (gpgsm->assuan_ctx, optstr, NULL, NULL,
NULL, NULL, NULL, NULL);
free (optstr);
}
return err;
}
| 13,106
|
160,500
| 0
|
WebContents* WebContents::Create(const WebContents::CreateParams& params) {
return WebContentsImpl::CreateWithOpener(params, FindOpenerRFH(params));
}
| 13,107
|
123,293
| 0
|
GdkCursor* GetMozSpinningCursor() {
static GdkCursor* moz_spinning_cursor = NULL;
if (!moz_spinning_cursor) {
const GdkColor fg = { 0, 0, 0, 0 };
const GdkColor bg = { 65535, 65535, 65535, 65535 };
GdkPixmap* source = gdk_bitmap_create_from_data(
NULL, reinterpret_cast<const gchar*>(moz_spinning_bits), 32, 32);
GdkPixmap* mask = gdk_bitmap_create_from_data(
NULL, reinterpret_cast<const gchar*>(moz_spinning_mask_bits), 32, 32);
moz_spinning_cursor =
gdk_cursor_new_from_pixmap(source, mask, &fg, &bg, 2, 2);
g_object_unref(source);
g_object_unref(mask);
}
return moz_spinning_cursor;
}
| 13,108
|
48,260
| 0
|
initCropMasks (struct crop_mask *cps)
{
int i;
cps->crop_mode = CROP_NONE;
cps->res_unit = RESUNIT_NONE;
cps->edge_ref = EDGE_TOP;
cps->width = 0;
cps->length = 0;
for (i = 0; i < 4; i++)
cps->margins[i] = 0.0;
cps->bufftotal = (uint32)0;
cps->combined_width = (uint32)0;
cps->combined_length = (uint32)0;
cps->rotation = (uint16)0;
cps->photometric = INVERT_DATA_AND_TAG;
cps->mirror = (uint16)0;
cps->invert = (uint16)0;
cps->zones = (uint32)0;
cps->regions = (uint32)0;
for (i = 0; i < MAX_REGIONS; i++)
{
cps->corners[i].X1 = 0.0;
cps->corners[i].X2 = 0.0;
cps->corners[i].Y1 = 0.0;
cps->corners[i].Y2 = 0.0;
cps->regionlist[i].x1 = 0;
cps->regionlist[i].x2 = 0;
cps->regionlist[i].y1 = 0;
cps->regionlist[i].y2 = 0;
cps->regionlist[i].width = 0;
cps->regionlist[i].length = 0;
cps->regionlist[i].buffsize = 0;
cps->regionlist[i].buffptr = NULL;
cps->zonelist[i].position = 0;
cps->zonelist[i].total = 0;
}
cps->exp_mode = ONE_FILE_COMPOSITE;
cps->img_mode = COMPOSITE_IMAGES;
}
| 13,109
|
8,919
| 0
|
void vrend_renderer_set_sub_ctx(struct vrend_context *ctx, int sub_ctx_id)
{
struct vrend_sub_context *sub;
/* find the sub ctx */
if (ctx->sub && ctx->sub->sub_ctx_id == sub_ctx_id)
return;
LIST_FOR_EACH_ENTRY(sub, &ctx->sub_ctxs, head) {
if (sub->sub_ctx_id == sub_ctx_id) {
ctx->sub = sub;
vrend_clicbs->make_current(0, sub->gl_context);
break;
}
}
}
| 13,110
|
171,571
| 0
|
String8 String8::getPathLeaf(void) const
{
const char* cp;
const char*const buf = mString;
cp = strrchr(buf, OS_PATH_SEPARATOR);
if (cp == NULL)
return String8(*this);
else
return String8(cp+1);
}
| 13,111
|
124,103
| 0
|
content::MediaObserver* ChromeContentBrowserClient::GetMediaObserver() {
return MediaCaptureDevicesDispatcher::GetInstance();
}
| 13,112
|
130,134
| 0
|
void HTMLBodyElement::setScrollLeft(int scrollLeft)
{
Document& document = this->document();
document.updateLayoutIgnorePendingStylesheets();
if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) {
RenderBox* render = renderBox();
if (!render)
return;
if (render->hasOverflowClip()) {
render->setScrollLeft(static_cast<int>(scrollLeft * render->style()->effectiveZoom()));
return;
}
if (!document.inQuirksMode())
return;
}
LocalFrame* frame = document.frame();
if (!frame)
return;
FrameView* view = frame->view();
if (!view)
return;
view->setScrollPosition(IntPoint(static_cast<int>(scrollLeft * frame->pageZoomFactor()), view->scrollY()));
}
| 13,113
|
49,963
| 0
|
void php_mysqlnd_stats_free_mem(void * _packet, zend_bool stack_allocation TSRMLS_DC)
{
MYSQLND_PACKET_STATS *p= (MYSQLND_PACKET_STATS *) _packet;
if (p->message) {
mnd_efree(p->message);
p->message = NULL;
}
if (!stack_allocation) {
mnd_pefree(p, p->header.persistent);
}
}
| 13,114
|
21,764
| 0
|
static int em_mov_rm_sreg(struct x86_emulate_ctxt *ctxt)
{
if (ctxt->modrm_reg > VCPU_SREG_GS)
return emulate_ud(ctxt);
ctxt->dst.val = get_segment_selector(ctxt, ctxt->modrm_reg);
return X86EMUL_CONTINUE;
}
| 13,115
|
122,316
| 0
|
HTMLDataListElement* HTMLInputElement::dataList() const
{
if (!m_hasNonEmptyList)
return 0;
if (!m_inputType->shouldRespectListAttribute())
return 0;
Element* element = treeScope().getElementById(fastGetAttribute(listAttr));
if (!element)
return 0;
if (!element->hasTagName(datalistTag))
return 0;
return toHTMLDataListElement(element);
}
| 13,116
|
68,660
| 0
|
_handle_receipt_received(xmpp_stanza_t *const stanza)
{
xmpp_stanza_t *receipt = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_RECEIPTS);
const char *name = xmpp_stanza_get_name(receipt);
if (g_strcmp0(name, "received") != 0) {
return;
}
const char *id = xmpp_stanza_get_id(receipt);
if (!id) {
return;
}
const char *fulljid = xmpp_stanza_get_from(stanza);
if (!fulljid) {
return;
}
Jid *jidp = jid_create(fulljid);
sv_ev_message_receipt(jidp->barejid, id);
jid_destroy(jidp);
}
| 13,117
|
30,051
| 0
|
static long vhost_net_reset_owner(struct vhost_net *n)
{
struct socket *tx_sock = NULL;
struct socket *rx_sock = NULL;
long err;
struct vhost_memory *memory;
mutex_lock(&n->dev.mutex);
err = vhost_dev_check_owner(&n->dev);
if (err)
goto done;
memory = vhost_dev_reset_owner_prepare();
if (!memory) {
err = -ENOMEM;
goto done;
}
vhost_net_stop(n, &tx_sock, &rx_sock);
vhost_net_flush(n);
vhost_dev_reset_owner(&n->dev, memory);
vhost_net_vq_reset(n);
done:
mutex_unlock(&n->dev.mutex);
if (tx_sock)
fput(tx_sock->file);
if (rx_sock)
fput(rx_sock->file);
return err;
}
| 13,118
|
4,988
| 0
|
void X509_STORE_CTX_free(X509_STORE_CTX *ctx)
{
if (!ctx)
return;
X509_STORE_CTX_cleanup(ctx);
OPENSSL_free(ctx);
}
| 13,119
|
94,295
| 0
|
GC_API void GC_CALL GC_incr_bytes_freed(size_t n)
{
GC_bytes_freed += n;
}
| 13,120
|
110,979
| 0
|
void RootWindowHostWin::PostNativeEvent(const base::NativeEvent& native_event) {
::PostMessage(
hwnd(), native_event.message, native_event.wParam, native_event.lParam);
}
| 13,121
|
83,840
| 0
|
static void mac80211_hwsim_flush(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
u32 queues, bool drop)
{
/* Not implemented, queues only on kernel side */
}
| 13,122
|
82,484
| 0
|
bool jsvIsObject(const JsVar *v) { return v && (((v->flags&JSV_VARTYPEMASK)==JSV_OBJECT) || ((v->flags&JSV_VARTYPEMASK)==JSV_ROOT)); }
| 13,123
|
28,654
| 0
|
void qeth_tx_timeout(struct net_device *dev)
{
struct qeth_card *card;
card = dev->ml_priv;
QETH_CARD_TEXT(card, 4, "txtimeo");
card->stats.tx_errors++;
qeth_schedule_recovery(card);
}
| 13,124
|
83,584
| 0
|
static BOOL update_send_cache_bitmap_v2(rdpContext* context,
CACHE_BITMAP_V2_ORDER* cache_bitmap_v2)
{
wStream* s;
size_t bm, em;
BYTE orderType;
int headerLength;
UINT16 extraFlags;
INT16 orderLength;
rdpUpdate* update = context->update;
extraFlags = 0;
headerLength = 6;
orderType = cache_bitmap_v2->compressed ?
ORDER_TYPE_BITMAP_COMPRESSED_V2 : ORDER_TYPE_BITMAP_UNCOMPRESSED_V2;
if (context->settings->NoBitmapCompressionHeader)
cache_bitmap_v2->flags |= CBR2_NO_BITMAP_COMPRESSION_HDR;
update_check_flush(context,
headerLength + update_approximate_cache_bitmap_v2_order(cache_bitmap_v2,
cache_bitmap_v2->compressed, &extraFlags));
s = update->us;
if (!s)
return FALSE;
bm = Stream_GetPosition(s);
if (!Stream_EnsureRemainingCapacity(s, headerLength))
return FALSE;
Stream_Seek(s, headerLength);
if (!update_write_cache_bitmap_v2_order(s, cache_bitmap_v2,
cache_bitmap_v2->compressed, &extraFlags))
return FALSE;
em = Stream_GetPosition(s);
orderLength = (em - bm) - 13;
Stream_SetPosition(s, bm);
Stream_Write_UINT8(s, ORDER_STANDARD |
ORDER_SECONDARY); /* controlFlags (1 byte) */
Stream_Write_UINT16(s, orderLength); /* orderLength (2 bytes) */
Stream_Write_UINT16(s, extraFlags); /* extraFlags (2 bytes) */
Stream_Write_UINT8(s, orderType); /* orderType (1 byte) */
Stream_SetPosition(s, em);
update->numberOrders++;
return TRUE;
}
| 13,125
|
2,043
| 0
|
static int parse_cred_line(char *line, char **target)
{
if (line == NULL || target == NULL)
goto parsing_err;
/* position target at first char of value */
*target = strchr(line, '=');
if (!*target)
goto parsing_err;
*target += 1;
/* tell the caller which value target points to */
if (strncasecmp("user", line, 4) == 0)
return CRED_USER;
if (strncasecmp("pass", line, 4) == 0)
return CRED_PASS;
if (strncasecmp("dom", line, 3) == 0)
return CRED_DOM;
parsing_err:
return CRED_UNPARSEABLE;
}
| 13,126
|
132,588
| 0
|
void WebKitTestController::OnTestFinished() {
test_phase_ = CLEAN_UP;
if (!printer_->output_finished())
printer_->PrintImageFooter();
RenderViewHost* render_view_host =
main_window_->web_contents()->GetRenderViewHost();
main_window_->web_contents()->ExitFullscreen();
base::MessageLoop::current()->PostTask(
FROM_HERE,
base::Bind(base::IgnoreResult(&WebKitTestController::Send),
base::Unretained(this),
new ShellViewMsg_Reset(render_view_host->GetRoutingID())));
}
| 13,127
|
150,343
| 0
|
void PasswordAutofillAgent::UpdateStateForTextChange(
const WebInputElement& element) {
if (!element.IsTextField())
return;
WebInputElement mutable_element = element; // We need a non-const.
const base::string16 element_value = element.Value().Utf16();
field_data_manager_.UpdateFieldDataMap(element, element_value,
FieldPropertiesFlags::USER_TYPED);
ProvisionallySavePassword(element.Form(), element, RESTRICTION_NONE);
if (element.IsPasswordFieldForAutofill()) {
auto iter = password_to_username_.find(element);
if (iter != password_to_username_.end()) {
web_input_to_password_info_[iter->second].password_was_edited_last = true;
mutable_element.SetAutofillState(WebAutofillState::kNotFilled);
}
GetPasswordManagerDriver()->UserModifiedPasswordField();
} else {
GetPasswordManagerDriver()->UserModifiedNonPasswordField(
element.UniqueRendererFormControlId(), element_value);
}
}
| 13,128
|
185,238
| 1
|
void TestPlaybackRate(double playback_rate) {
static const int kDefaultBufferSize = kSamplesPerSecond / 10;
static const int kDefaultFramesRequested = 5 * kSamplesPerSecond;
TestPlaybackRate(playback_rate, kDefaultBufferSize,
kDefaultFramesRequested);
}
| 13,129
|
8,488
| 0
|
void CSoundFile::LoopPattern(int nPat, int nRow)
{
if ((nPat < 0) || (nPat >= MAX_PATTERNS) || (!Patterns[nPat]))
{
m_dwSongFlags &= ~SONG_PATTERNLOOP;
} else
{
if ((nRow < 0) || (nRow >= PatternSize[nPat])) nRow = 0;
m_nPattern = nPat;
m_nRow = m_nNextRow = nRow;
m_nTickCount = m_nMusicSpeed;
m_nPatternDelay = 0;
m_nFrameDelay = 0;
m_nBufferCount = 0;
m_dwSongFlags |= SONG_PATTERNLOOP;
}
}
| 13,130
|
52,891
| 0
|
static unsigned int ib_uverbs_event_poll(struct file *filp,
struct poll_table_struct *wait)
{
unsigned int pollflags = 0;
struct ib_uverbs_event_file *file = filp->private_data;
poll_wait(filp, &file->poll_wait, wait);
spin_lock_irq(&file->lock);
if (!list_empty(&file->event_list))
pollflags = POLLIN | POLLRDNORM;
spin_unlock_irq(&file->lock);
return pollflags;
}
| 13,131
|
4,172
| 0
|
tt_cmap0_char_next( TT_CMap cmap,
FT_UInt32 *pchar_code )
{
FT_Byte* table = cmap->data;
FT_UInt32 charcode = *pchar_code;
FT_UInt32 result = 0;
FT_UInt gindex = 0;
table += 6; /* go to glyph IDs */
while ( ++charcode < 256 )
{
gindex = table[charcode];
if ( gindex != 0 )
{
result = charcode;
break;
}
}
*pchar_code = result;
return gindex;
}
| 13,132
|
133,996
| 0
|
void AppListSyncableService::TrackUninstalledDriveApp(
const std::string& drive_app_id) {
const std::string sync_id = GetDriveAppSyncId(drive_app_id);
SyncItem* sync_item = FindSyncItem(sync_id);
if (sync_item) {
DCHECK_EQ(sync_item->item_type,
sync_pb::AppListSpecifics::TYPE_REMOVE_DEFAULT_APP);
return;
}
sync_item = CreateSyncItem(
sync_id, sync_pb::AppListSpecifics::TYPE_REMOVE_DEFAULT_APP);
SendSyncChange(sync_item, SyncChange::ACTION_ADD);
}
| 13,133
|
23,948
| 0
|
static int airo_get_aplist(struct net_device *dev,
struct iw_request_info *info,
struct iw_point *dwrq,
char *extra)
{
struct airo_info *local = dev->ml_priv;
struct sockaddr *address = (struct sockaddr *) extra;
struct iw_quality *qual;
BSSListRid BSSList;
int i;
int loseSync = capable(CAP_NET_ADMIN) ? 1: -1;
qual = kmalloc(IW_MAX_AP * sizeof(*qual), GFP_KERNEL);
if (!qual)
return -ENOMEM;
for (i = 0; i < IW_MAX_AP; i++) {
u16 dBm;
if (readBSSListRid(local, loseSync, &BSSList))
break;
loseSync = 0;
memcpy(address[i].sa_data, BSSList.bssid, ETH_ALEN);
address[i].sa_family = ARPHRD_ETHER;
dBm = le16_to_cpu(BSSList.dBm);
if (local->rssi) {
qual[i].level = 0x100 - dBm;
qual[i].qual = airo_dbm_to_pct(local->rssi, dBm);
qual[i].updated = IW_QUAL_QUAL_UPDATED
| IW_QUAL_LEVEL_UPDATED
| IW_QUAL_DBM;
} else {
qual[i].level = (dBm + 321) / 2;
qual[i].qual = 0;
qual[i].updated = IW_QUAL_QUAL_INVALID
| IW_QUAL_LEVEL_UPDATED
| IW_QUAL_DBM;
}
qual[i].noise = local->wstats.qual.noise;
if (BSSList.index == cpu_to_le16(0xffff))
break;
}
if (!i) {
StatusRid status_rid; /* Card status info */
readStatusRid(local, &status_rid, 1);
for (i = 0;
i < min(IW_MAX_AP, 4) &&
(status_rid.bssid[i][0]
& status_rid.bssid[i][1]
& status_rid.bssid[i][2]
& status_rid.bssid[i][3]
& status_rid.bssid[i][4]
& status_rid.bssid[i][5])!=0xff &&
(status_rid.bssid[i][0]
| status_rid.bssid[i][1]
| status_rid.bssid[i][2]
| status_rid.bssid[i][3]
| status_rid.bssid[i][4]
| status_rid.bssid[i][5]);
i++) {
memcpy(address[i].sa_data,
status_rid.bssid[i], ETH_ALEN);
address[i].sa_family = ARPHRD_ETHER;
}
} else {
dwrq->flags = 1; /* Should be define'd */
memcpy(extra + sizeof(struct sockaddr)*i,
&qual, sizeof(struct iw_quality)*i);
}
dwrq->length = i;
kfree(qual);
return 0;
}
| 13,134
|
170,445
| 0
|
bool Parcel::hasFileDescriptors() const
{
if (!mFdsKnown) {
scanForFds();
}
return mHasFds;
}
| 13,135
|
73,144
| 0
|
buf_find_offset_of_char(buf_t *buf, char ch)
{
chunk_t *chunk;
off_t offset = 0;
for (chunk = buf->head; chunk; chunk = chunk->next) {
char *cp = memchr(chunk->data, ch, chunk->datalen);
if (cp)
return offset + (cp - chunk->data);
else
offset += chunk->datalen;
}
return -1;
}
| 13,136
|
160,906
| 0
|
const AtomicString& DOMWindow::InterfaceName() const {
return EventTargetNames::DOMWindow;
}
| 13,137
|
173,339
| 0
|
zlib_check(struct file *file, png_uint_32 offset)
/* Check the stream of zlib compressed data in either idat (if given) or (if
* not) chunk. In fact it is zlib_run that handles the difference in reading
* a single chunk and a list of IDAT chunks.
*
* In either case the input file must be positioned at the first byte of zlib
* compressed data (the first header byte).
*
* The return value is true on success, including the case where the zlib
* header may need to be rewritten, and false on an unrecoverable error.
*
* In the case of IDAT chunks 'offset' should be 0.
*/
{
fpos_t start_pos;
struct zlib zlib;
/* Record the start of the LZ data to allow a re-read. */
file_getpos(file, &start_pos);
/* First test the existing (file) window bits: */
if (zlib_init(&zlib, file->idat, file->chunk, 0/*window bits*/, offset))
{
int min_bits, max_bits, rc;
/* The first run using the existing window bits. */
rc = zlib_run(&zlib);
switch (rc)
{
case ZLIB_TOO_FAR_BACK:
/* too far back error */
file->status_code |= TOO_FAR_BACK;
min_bits = zlib.window_bits + 1;
max_bits = 15;
break;
case ZLIB_STREAM_END:
if (!zlib.global->optimize_zlib &&
zlib.window_bits == zlib.file_bits && !zlib.cksum)
{
/* The trivial case where the stream is ok and optimization was
* not requested.
*/
zlib_end(&zlib);
return 1;
}
max_bits = max_window_bits(zlib.uncompressed_bytes,
zlib.uncompressed_digits);
if (zlib.ok_bits < max_bits)
max_bits = zlib.ok_bits;
min_bits = 8;
/* cksum is set if there is an error in the zlib header checksum
* calculation in the original file (and this may be the only reason
* a rewrite is required). We can't rely on the file window bits in
* this case, so do the optimization anyway.
*/
if (zlib.cksum)
chunk_message(zlib.chunk, "zlib checkum");
break;
case ZLIB_OK:
/* Truncated stream; unrecoverable, gets converted to ZLIB_FATAL */
zlib.z.msg = PNGZ_MSG_CAST("[truncated]");
zlib_message(&zlib, 0/*expected*/);
/* FALL THROUGH */
default:
/* Unrecoverable error; skip the chunk; a zlib_message has already
* been output.
*/
zlib_end(&zlib);
return 0;
}
/* Optimize window bits or fix a too-far-back error. min_bits and
* max_bits have been set appropriately, ok_bits records the bit value
* known to work.
*/
while (min_bits < max_bits || max_bits < zlib.ok_bits/*if 16*/)
{
int test_bits = (min_bits + max_bits) >> 1;
if (zlib_reset(&zlib, test_bits))
{
file_setpos(file, &start_pos);
rc = zlib_run(&zlib);
switch (rc)
{
case ZLIB_TOO_FAR_BACK:
min_bits = test_bits+1;
if (min_bits > max_bits)
{
/* This happens when the stream really is damaged and it
* contains a distance code that addresses bytes before
* the start of the uncompressed data.
*/
assert(test_bits == 15);
/* Output the error that wasn't output before: */
if (zlib.z.msg == NULL)
zlib.z.msg = PNGZ_MSG_CAST(
"invalid distance too far back");
zlib_message(&zlib, 0/*stream error*/);
zlib_end(&zlib);
return 0;
}
break;
case ZLIB_STREAM_END: /* success */
max_bits = test_bits;
break;
default:
/* A fatal error; this happens if a too-far-back error was
* hiding a more serious error, zlib_advance has already
* output a zlib_message.
*/
zlib_end(&zlib);
return 0;
}
}
else /* inflateReset2 failed */
{
zlib_end(&zlib);
return 0;
}
}
/* The loop guarantees this */
assert(zlib.ok_bits == max_bits);
zlib_end(&zlib);
return 1;
}
else /* zlib initialization failed - skip the chunk */
{
zlib_end(&zlib);
return 0;
}
}
| 13,138
|
146,199
| 0
|
void WebGL2RenderingContextBase::uniform3uiv(
const WebGLUniformLocation* location,
const FlexibleUint32ArrayView& v,
GLuint src_offset,
GLuint src_length) {
if (isContextLost() ||
!ValidateUniformParameters<WTF::Uint32Array>("uniform3uiv", location, v,
3, src_offset, src_length))
return;
ContextGL()->Uniform3uiv(
location->Location(),
(src_length ? src_length : (v.length() - src_offset)) / 3,
v.DataMaybeOnStack() + src_offset);
}
| 13,139
|
91,254
| 0
|
static int i_ipmi_request(struct ipmi_user *user,
struct ipmi_smi *intf,
struct ipmi_addr *addr,
long msgid,
struct kernel_ipmi_msg *msg,
void *user_msg_data,
void *supplied_smi,
struct ipmi_recv_msg *supplied_recv,
int priority,
unsigned char source_address,
unsigned char source_lun,
int retries,
unsigned int retry_time_ms)
{
struct ipmi_smi_msg *smi_msg;
struct ipmi_recv_msg *recv_msg;
int rv = 0;
if (supplied_recv)
recv_msg = supplied_recv;
else {
recv_msg = ipmi_alloc_recv_msg();
if (recv_msg == NULL) {
rv = -ENOMEM;
goto out;
}
}
recv_msg->user_msg_data = user_msg_data;
if (supplied_smi)
smi_msg = (struct ipmi_smi_msg *) supplied_smi;
else {
smi_msg = ipmi_alloc_smi_msg();
if (smi_msg == NULL) {
ipmi_free_recv_msg(recv_msg);
rv = -ENOMEM;
goto out;
}
}
rcu_read_lock();
if (intf->in_shutdown) {
rv = -ENODEV;
goto out_err;
}
recv_msg->user = user;
if (user)
/* The put happens when the message is freed. */
kref_get(&user->refcount);
recv_msg->msgid = msgid;
/*
* Store the message to send in the receive message so timeout
* responses can get the proper response data.
*/
recv_msg->msg = *msg;
if (addr->addr_type == IPMI_SYSTEM_INTERFACE_ADDR_TYPE) {
rv = i_ipmi_req_sysintf(intf, addr, msgid, msg, smi_msg,
recv_msg, retries, retry_time_ms);
} else if (is_ipmb_addr(addr) || is_ipmb_bcast_addr(addr)) {
rv = i_ipmi_req_ipmb(intf, addr, msgid, msg, smi_msg, recv_msg,
source_address, source_lun,
retries, retry_time_ms);
} else if (is_lan_addr(addr)) {
rv = i_ipmi_req_lan(intf, addr, msgid, msg, smi_msg, recv_msg,
source_lun, retries, retry_time_ms);
} else {
/* Unknown address type. */
ipmi_inc_stat(intf, sent_invalid_commands);
rv = -EINVAL;
}
if (rv) {
out_err:
ipmi_free_smi_msg(smi_msg);
ipmi_free_recv_msg(recv_msg);
} else {
ipmi_debug_msg("Send", smi_msg->data, smi_msg->data_size);
smi_send(intf, intf->handlers, smi_msg, priority);
}
rcu_read_unlock();
out:
return rv;
}
| 13,140
|
10,625
| 0
|
Ins_MDAP( TT_ExecContext exc,
FT_Long* args )
{
FT_UShort point;
FT_F26Dot6 cur_dist;
FT_F26Dot6 distance;
point = (FT_UShort)args[0];
if ( BOUNDS( point, exc->zp0.n_points ) )
{
if ( exc->pedantic_hinting )
exc->error = FT_THROW( Invalid_Reference );
return;
}
if ( ( exc->opcode & 1 ) != 0 )
{
cur_dist = FAST_PROJECT( &exc->zp0.cur[point] );
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
if ( SUBPIXEL_HINTING_INFINALITY &&
exc->ignore_x_mode &&
exc->GS.freeVector.x != 0 )
distance = Round_None(
exc,
cur_dist,
exc->tt_metrics.compensations[0] ) - cur_dist;
else
#endif
distance = exc->func_round(
exc,
cur_dist,
exc->tt_metrics.compensations[0] ) - cur_dist;
}
else
distance = 0;
exc->func_move( exc, &exc->zp0, point, distance );
exc->GS.rp0 = point;
exc->GS.rp1 = point;
}
| 13,141
|
171,244
| 0
|
sp<SoundTriggerHwService::Model> SoundTriggerHwService::Module::getModel(
sound_model_handle_t handle)
{
sp<Model> model;
ssize_t index = mModels.indexOfKey(handle);
if (index >= 0) {
model = mModels.valueAt(index);
}
return model;
}
| 13,142
|
150,345
| 0
|
bool PasswordAutofillAgent::WasFormStructureChanged(
const FormStructureInfo& form_info) const {
if (form_info.unique_renderer_id == FormData::kNotSetFormRendererId)
return true;
auto cached_form = forms_structure_cache_.find(form_info.unique_renderer_id);
if (cached_form == forms_structure_cache_.end())
return true;
const FormStructureInfo& cached_form_info = cached_form->second;
if (form_info.fields.size() != cached_form_info.fields.size())
return true;
for (size_t i = 0; i < form_info.fields.size(); ++i) {
const FormFieldInfo& form_field = form_info.fields[i];
const FormFieldInfo& cached_form_field = cached_form_info.fields[i];
if (form_field.unique_renderer_id != cached_form_field.unique_renderer_id)
return true;
if (form_field.form_control_type != cached_form_field.form_control_type)
return true;
if (form_field.autocomplete_attribute !=
cached_form_field.autocomplete_attribute) {
return true;
}
if (form_field.is_focusable != cached_form_field.is_focusable)
return true;
}
return false;
}
| 13,143
|
128,934
| 0
|
void doWriteHmacKey(const blink::WebCryptoKey& key)
{
ASSERT(key.algorithm().paramsType() == blink::WebCryptoKeyAlgorithmParamsTypeHmac);
append(static_cast<uint8_t>(HmacKeyTag));
ASSERT(!(key.algorithm().hmacParams()->lengthBits() % 8));
doWriteUint32(key.algorithm().hmacParams()->lengthBits() / 8);
doWriteAlgorithmId(key.algorithm().hmacParams()->hash().id());
}
| 13,144
|
24,716
| 0
|
unsigned long msecs_to_jiffies(const unsigned int m)
{
/*
* Negative value, means infinite timeout:
*/
if ((int)m < 0)
return MAX_JIFFY_OFFSET;
#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)
/*
* HZ is equal to or smaller than 1000, and 1000 is a nice
* round multiple of HZ, divide with the factor between them,
* but round upwards:
*/
return (m + (MSEC_PER_SEC / HZ) - 1) / (MSEC_PER_SEC / HZ);
#elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC)
/*
* HZ is larger than 1000, and HZ is a nice round multiple of
* 1000 - simply multiply with the factor between them.
*
* But first make sure the multiplication result cannot
* overflow:
*/
if (m > jiffies_to_msecs(MAX_JIFFY_OFFSET))
return MAX_JIFFY_OFFSET;
return m * (HZ / MSEC_PER_SEC);
#else
/*
* Generic case - multiply, round and divide. But first
* check that if we are doing a net multiplication, that
* we wouldn't overflow:
*/
if (HZ > MSEC_PER_SEC && m > jiffies_to_msecs(MAX_JIFFY_OFFSET))
return MAX_JIFFY_OFFSET;
return ((u64)MSEC_TO_HZ_MUL32 * m + MSEC_TO_HZ_ADJ32)
>> MSEC_TO_HZ_SHR32;
#endif
}
| 13,145
|
66,929
| 0
|
static int decode_text_chunk(PNGDecContext *s, uint32_t length, int compressed,
AVDictionary **dict)
{
int ret, method;
const uint8_t *data = s->gb.buffer;
const uint8_t *data_end = data + length;
const uint8_t *keyword = data;
const uint8_t *keyword_end = memchr(keyword, 0, data_end - keyword);
uint8_t *kw_utf8 = NULL, *text, *txt_utf8 = NULL;
unsigned text_len;
AVBPrint bp;
if (!keyword_end)
return AVERROR_INVALIDDATA;
data = keyword_end + 1;
if (compressed) {
if (data == data_end)
return AVERROR_INVALIDDATA;
method = *(data++);
if (method)
return AVERROR_INVALIDDATA;
if ((ret = decode_zbuf(&bp, data, data_end)) < 0)
return ret;
text_len = bp.len;
av_bprint_finalize(&bp, (char **)&text);
if (!text)
return AVERROR(ENOMEM);
} else {
text = (uint8_t *)data;
text_len = data_end - text;
}
kw_utf8 = iso88591_to_utf8(keyword, keyword_end - keyword);
txt_utf8 = iso88591_to_utf8(text, text_len);
if (text != data)
av_free(text);
if (!(kw_utf8 && txt_utf8)) {
av_free(kw_utf8);
av_free(txt_utf8);
return AVERROR(ENOMEM);
}
av_dict_set(dict, kw_utf8, txt_utf8,
AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL);
return 0;
}
| 13,146
|
88,019
| 0
|
static void pf_req_sense(struct pf_unit *pf, int quiet)
{
char rs_cmd[12] =
{ ATAPI_REQ_SENSE, pf->lun << 5, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0 };
char buf[16];
int r;
r = pf_command(pf, rs_cmd, 16, "Request sense");
mdelay(1);
if (!r)
pf_completion(pf, buf, "Request sense");
if ((!r) && (!quiet))
printk("%s: Sense key: %x, ASC: %x, ASQ: %x\n",
pf->name, buf[2] & 0xf, buf[12], buf[13]);
}
| 13,147
|
55,242
| 0
|
static int create_composite_quirk(struct snd_usb_audio *chip,
struct usb_interface *iface,
struct usb_driver *driver,
const struct snd_usb_audio_quirk *quirk_comp)
{
int probed_ifnum = get_iface_desc(iface->altsetting)->bInterfaceNumber;
const struct snd_usb_audio_quirk *quirk;
int err;
for (quirk = quirk_comp->data; quirk->ifnum >= 0; ++quirk) {
iface = usb_ifnum_to_if(chip->dev, quirk->ifnum);
if (!iface)
continue;
if (quirk->ifnum != probed_ifnum &&
usb_interface_claimed(iface))
continue;
err = snd_usb_create_quirk(chip, iface, driver, quirk);
if (err < 0)
return err;
}
for (quirk = quirk_comp->data; quirk->ifnum >= 0; ++quirk) {
iface = usb_ifnum_to_if(chip->dev, quirk->ifnum);
if (!iface)
continue;
if (quirk->ifnum != probed_ifnum &&
!usb_interface_claimed(iface))
usb_driver_claim_interface(driver, iface, (void *)-1L);
}
return 0;
}
| 13,148
|
132,007
| 0
|
static void xmlAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
TestObjectPythonV8Internal::xmlAttributeAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
}
| 13,149
|
169,116
| 0
|
void StubOfflinePageModel::GetPagesRemovedOnCacheReset(
const MultipleOfflinePageItemCallback& callback) {}
| 13,150
|
142,177
| 0
|
std::string GetMimeType(const AddEntriesMessage::TestEntryInfo& entry) {
return entry.type == AddEntriesMessage::FILE
? entry.mime_type
: arc::kAndroidDirectoryMimeType;
}
| 13,151
|
2,490
| 0
|
void smbXcli_req_unset_pending(struct tevent_req *req)
{
struct smbXcli_req_state *state =
tevent_req_data(req,
struct smbXcli_req_state);
struct smbXcli_conn *conn = state->conn;
size_t num_pending = talloc_array_length(conn->pending);
size_t i;
TALLOC_FREE(state->write_req);
if (state->smb1.mid != 0) {
/*
* This is a [nt]trans[2] request which waits
* for more than one reply.
*/
return;
}
tevent_req_set_cleanup_fn(req, NULL);
if (num_pending == 1) {
/*
* The pending read_smb tevent_req is a child of
* conn->pending. So if nothing is pending anymore, we need to
* delete the socket read fde.
*/
TALLOC_FREE(conn->pending);
conn->read_smb_req = NULL;
return;
}
for (i=0; i<num_pending; i++) {
if (req == conn->pending[i]) {
break;
}
}
if (i == num_pending) {
/*
* Something's seriously broken. Just returning here is the
* right thing nevertheless, the point of this routine is to
* remove ourselves from conn->pending.
*/
return;
}
/*
* Remove ourselves from the conn->pending array
*/
for (; i < (num_pending - 1); i++) {
conn->pending[i] = conn->pending[i+1];
}
/*
* No NULL check here, we're shrinking by sizeof(void *), and
* talloc_realloc just adjusts the size for this.
*/
conn->pending = talloc_realloc(NULL, conn->pending, struct tevent_req *,
num_pending - 1);
return;
}
| 13,152
|
173,157
| 0
|
image_pixel_convert_PLTE(image_pixel *this)
{
if (this->colour_type == PNG_COLOR_TYPE_PALETTE)
{
if (this->have_tRNS)
{
this->colour_type = PNG_COLOR_TYPE_RGB_ALPHA;
this->have_tRNS = 0;
}
else
this->colour_type = PNG_COLOR_TYPE_RGB;
/* The bit depth of the row changes at this point too (notice that this is
* the row format, not the sample depth, which is separate.)
*/
this->bit_depth = 8;
}
}
| 13,153
|
57,712
| 0
|
void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
{
/* Address WBINVD may be executed by guest */
if (need_emulate_wbinvd(vcpu)) {
if (kvm_x86_ops->has_wbinvd_exit())
cpumask_set_cpu(cpu, vcpu->arch.wbinvd_dirty_mask);
else if (vcpu->cpu != -1 && vcpu->cpu != cpu)
smp_call_function_single(vcpu->cpu,
wbinvd_ipi, NULL, 1);
}
kvm_x86_ops->vcpu_load(vcpu, cpu);
/* Apply any externally detected TSC adjustments (due to suspend) */
if (unlikely(vcpu->arch.tsc_offset_adjustment)) {
adjust_tsc_offset_host(vcpu, vcpu->arch.tsc_offset_adjustment);
vcpu->arch.tsc_offset_adjustment = 0;
kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu);
}
if (unlikely(vcpu->cpu != cpu) || check_tsc_unstable()) {
s64 tsc_delta = !vcpu->arch.last_host_tsc ? 0 :
rdtsc() - vcpu->arch.last_host_tsc;
if (tsc_delta < 0)
mark_tsc_unstable("KVM discovered backwards TSC");
if (check_tsc_unstable()) {
u64 offset = kvm_compute_tsc_offset(vcpu,
vcpu->arch.last_guest_tsc);
kvm_x86_ops->write_tsc_offset(vcpu, offset);
vcpu->arch.tsc_catchup = 1;
}
/*
* On a host with synchronized TSC, there is no need to update
* kvmclock on vcpu->cpu migration
*/
if (!vcpu->kvm->arch.use_master_clock || vcpu->cpu == -1)
kvm_make_request(KVM_REQ_GLOBAL_CLOCK_UPDATE, vcpu);
if (vcpu->cpu != cpu)
kvm_migrate_timers(vcpu);
vcpu->cpu = cpu;
}
kvm_make_request(KVM_REQ_STEAL_UPDATE, vcpu);
}
| 13,154
|
110,885
| 0
|
void RootWindow::Init() {
compositor()->SetScaleAndSize(GetDeviceScaleFactorFromMonitor(this),
host_->GetBounds().size());
Window::Init(ui::LAYER_NOT_DRAWN);
last_mouse_location_ =
ui::ConvertPointToDIP(layer(), host_->QueryMouseLocation());
compositor()->SetRootLayer(layer());
SetBounds(
ui::ConvertRectToDIP(layer(), gfx::Rect(host_->GetBounds().size())));
Show();
host_->SetRootWindow(this);
}
| 13,155
|
145,950
| 0
|
bool AllRootWindowsHaveModalBackgroundsForContainer(int container_id) {
aura::Window::Windows containers =
wm::GetContainersFromAllRootWindows(container_id);
bool has_modal_screen = !containers.empty();
for (aura::Window* container : containers) {
has_modal_screen &= static_cast<SystemModalContainerLayoutManager*>(
container->layout_manager())
->has_window_dimmer();
}
return has_modal_screen;
}
| 13,156
|
124,838
| 0
|
void RenderBox::computeLogicalWidth(LogicalExtentComputedValues& computedValues) const
{
computedValues.m_extent = logicalWidth();
computedValues.m_position = logicalLeft();
computedValues.m_margins.m_start = marginStart();
computedValues.m_margins.m_end = marginEnd();
if (isOutOfFlowPositioned()) {
computePositionedLogicalWidth(computedValues);
return;
}
if (node() && view()->frameView() && view()->frameView()->layoutRoot(true) == this)
return;
if (hasOverrideWidth() && (style()->borderFit() == BorderFitLines || parent()->isFlexibleBoxIncludingDeprecated())) {
computedValues.m_extent = overrideLogicalContentWidth() + borderAndPaddingLogicalWidth();
return;
}
bool inVerticalBox = parent()->isDeprecatedFlexibleBox() && (parent()->style()->boxOrient() == VERTICAL);
bool stretching = (parent()->style()->boxAlign() == BSTRETCH);
bool treatAsReplaced = shouldComputeSizeAsReplaced() && (!inVerticalBox || !stretching);
RenderStyle* styleToUse = style();
Length logicalWidthLength = treatAsReplaced ? Length(computeReplacedLogicalWidth(), Fixed) : styleToUse->logicalWidth();
RenderBlock* cb = containingBlock();
LayoutUnit containerLogicalWidth = max<LayoutUnit>(0, containingBlockLogicalWidthForContent());
bool hasPerpendicularContainingBlock = cb->isHorizontalWritingMode() != isHorizontalWritingMode();
if (isInline() && !isInlineBlockOrInlineTable()) {
computedValues.m_margins.m_start = minimumValueForLength(styleToUse->marginStart(), containerLogicalWidth);
computedValues.m_margins.m_end = minimumValueForLength(styleToUse->marginEnd(), containerLogicalWidth);
if (treatAsReplaced)
computedValues.m_extent = max<LayoutUnit>(floatValueForLength(logicalWidthLength, 0) + borderAndPaddingLogicalWidth(), minPreferredLogicalWidth());
return;
}
if (treatAsReplaced)
computedValues.m_extent = logicalWidthLength.value() + borderAndPaddingLogicalWidth();
else {
LayoutUnit containerWidthInInlineDirection = containerLogicalWidth;
if (hasPerpendicularContainingBlock)
containerWidthInInlineDirection = perpendicularContainingBlockLogicalHeight();
LayoutUnit preferredWidth = computeLogicalWidthUsing(MainOrPreferredSize, styleToUse->logicalWidth(), containerWidthInInlineDirection, cb);
computedValues.m_extent = constrainLogicalWidthByMinMax(preferredWidth, containerWidthInInlineDirection, cb);
}
if (hasPerpendicularContainingBlock || isFloating() || isInline()) {
computedValues.m_margins.m_start = minimumValueForLength(styleToUse->marginStart(), containerLogicalWidth);
computedValues.m_margins.m_end = minimumValueForLength(styleToUse->marginEnd(), containerLogicalWidth);
} else {
bool hasInvertedDirection = cb->style()->isLeftToRightDirection() != style()->isLeftToRightDirection();
computeInlineDirectionMargins(cb, containerLogicalWidth, computedValues.m_extent,
hasInvertedDirection ? computedValues.m_margins.m_end : computedValues.m_margins.m_start,
hasInvertedDirection ? computedValues.m_margins.m_start : computedValues.m_margins.m_end);
}
if (!hasPerpendicularContainingBlock && containerLogicalWidth && containerLogicalWidth != (computedValues.m_extent + computedValues.m_margins.m_start + computedValues.m_margins.m_end)
&& !isFloating() && !isInline() && !cb->isFlexibleBoxIncludingDeprecated() && !cb->isRenderGrid()) {
LayoutUnit newMargin = containerLogicalWidth - computedValues.m_extent - cb->marginStartForChild(this);
bool hasInvertedDirection = cb->style()->isLeftToRightDirection() != style()->isLeftToRightDirection();
if (hasInvertedDirection)
computedValues.m_margins.m_start = newMargin;
else
computedValues.m_margins.m_end = newMargin;
}
if (styleToUse->textAutosizingMultiplier() != 1 && styleToUse->marginStart().type() == Fixed) {
Node* parentNode = generatingNode();
if (parentNode && (isHTMLOListElement(*parentNode) || isHTMLUListElement(*parentNode))) {
const float adjustedMargin = (1 - 1.0 / styleToUse->textAutosizingMultiplier()) * getMaxWidthListMarker(this);
bool hasInvertedDirection = cb->style()->isLeftToRightDirection() != style()->isLeftToRightDirection();
if (hasInvertedDirection)
computedValues.m_margins.m_end += adjustedMargin;
else
computedValues.m_margins.m_start += adjustedMargin;
}
}
}
| 13,157
|
115,594
| 0
|
void GraphicsContext::drawEllipse(const IntRect& elipseRect)
{
if (paintingDisabled())
return;
SkRect rect = elipseRect;
if (!isRectSkiaSafe(getCTM(), rect))
return;
SkPaint paint;
platformContext()->setupPaintForFilling(&paint);
platformContext()->canvas()->drawOval(rect, paint);
if (strokeStyle() != NoStroke) {
paint.reset();
platformContext()->setupPaintForStroking(&paint, &rect, 0);
platformContext()->canvas()->drawOval(rect, paint);
}
}
| 13,158
|
50,799
| 0
|
get_tmfromtime(struct tm *tm, time_t *t)
{
#if HAVE_LOCALTIME_R
tzset();
localtime_r(t, tm);
#elif HAVE__LOCALTIME64_S
_localtime64_s(tm, t);
#else
memcpy(tm, localtime(t), sizeof(*tm));
#endif
}
| 13,159
|
68,119
| 0
|
static apr_byte_t oidc_authorization_response_match_state(request_rec *r,
oidc_cfg *c, const char *state, struct oidc_provider_t **provider,
json_t **proto_state) {
oidc_debug(r, "enter (state=%s)", state);
if ((state == NULL) || (apr_strnatcmp(state, "") == 0)) {
oidc_error(r, "state parameter is not set");
return FALSE;
}
/* check the state parameter against what we stored in a cookie */
if (oidc_restore_proto_state(r, c, state, proto_state) == FALSE) {
oidc_error(r, "unable to restore state");
return FALSE;
}
*provider = oidc_get_provider_for_issuer(r, c,
json_string_value(json_object_get(*proto_state, "issuer")), FALSE);
return (*provider != NULL);
}
| 13,160
|
50,926
| 0
|
static struct mount *alloc_vfsmnt(const char *name)
{
struct mount *mnt = kmem_cache_zalloc(mnt_cache, GFP_KERNEL);
if (mnt) {
int err;
err = mnt_alloc_id(mnt);
if (err)
goto out_free_cache;
if (name) {
mnt->mnt_devname = kstrdup_const(name, GFP_KERNEL);
if (!mnt->mnt_devname)
goto out_free_id;
}
#ifdef CONFIG_SMP
mnt->mnt_pcp = alloc_percpu(struct mnt_pcp);
if (!mnt->mnt_pcp)
goto out_free_devname;
this_cpu_add(mnt->mnt_pcp->mnt_count, 1);
#else
mnt->mnt_count = 1;
mnt->mnt_writers = 0;
#endif
INIT_HLIST_NODE(&mnt->mnt_hash);
INIT_LIST_HEAD(&mnt->mnt_child);
INIT_LIST_HEAD(&mnt->mnt_mounts);
INIT_LIST_HEAD(&mnt->mnt_list);
INIT_LIST_HEAD(&mnt->mnt_expire);
INIT_LIST_HEAD(&mnt->mnt_share);
INIT_LIST_HEAD(&mnt->mnt_slave_list);
INIT_LIST_HEAD(&mnt->mnt_slave);
INIT_HLIST_NODE(&mnt->mnt_mp_list);
#ifdef CONFIG_FSNOTIFY
INIT_HLIST_HEAD(&mnt->mnt_fsnotify_marks);
#endif
init_fs_pin(&mnt->mnt_umount, drop_mountpoint);
}
return mnt;
#ifdef CONFIG_SMP
out_free_devname:
kfree_const(mnt->mnt_devname);
#endif
out_free_id:
mnt_free_id(mnt);
out_free_cache:
kmem_cache_free(mnt_cache, mnt);
return NULL;
}
| 13,161
|
144,526
| 0
|
RenderWidgetHostInputEventRouter* WebContentsImpl::GetInputEventRouter() {
if (!is_being_destroyed_ && GetOuterWebContents())
return GetOuterWebContents()->GetInputEventRouter();
if (!rwh_input_event_router_.get() && !is_being_destroyed_)
rwh_input_event_router_.reset(new RenderWidgetHostInputEventRouter);
return rwh_input_event_router_.get();
}
| 13,162
|
32,823
| 0
|
static int ppp_gidle(unsigned int fd, unsigned int cmd,
struct ppp_idle32 __user *idle32)
{
struct ppp_idle __user *idle;
__kernel_time_t xmit, recv;
int err;
idle = compat_alloc_user_space(sizeof(*idle));
err = sys_ioctl(fd, PPPIOCGIDLE, (unsigned long) idle);
if (!err) {
if (get_user(xmit, &idle->xmit_idle) ||
get_user(recv, &idle->recv_idle) ||
put_user(xmit, &idle32->xmit_idle) ||
put_user(recv, &idle32->recv_idle))
err = -EFAULT;
}
return err;
}
| 13,163
|
57,194
| 0
|
static int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
struct nfs_fattr *fattr, struct nfs4_label *label)
{
struct nfs4_exception exception = { };
int err;
do {
err = _nfs4_proc_getattr(server, fhandle, fattr, label);
trace_nfs4_getattr(server, fhandle, fattr, err);
err = nfs4_handle_exception(server, err,
&exception);
} while (exception.retry);
return err;
}
| 13,164
|
79,288
| 0
|
static void find_compressor(char * compressor_name, int len, MOVTrack *track)
{
AVDictionaryEntry *encoder;
int xdcam_res = (track->par->width == 1280 && track->par->height == 720)
|| (track->par->width == 1440 && track->par->height == 1080)
|| (track->par->width == 1920 && track->par->height == 1080);
if (track->mode == MODE_MOV &&
(encoder = av_dict_get(track->st->metadata, "encoder", NULL, 0))) {
av_strlcpy(compressor_name, encoder->value, 32);
} else if (track->par->codec_id == AV_CODEC_ID_MPEG2VIDEO && xdcam_res) {
int interlaced = track->par->field_order > AV_FIELD_PROGRESSIVE;
AVStream *st = track->st;
int rate = defined_frame_rate(NULL, st);
av_strlcatf(compressor_name, len, "XDCAM");
if (track->par->format == AV_PIX_FMT_YUV422P) {
av_strlcatf(compressor_name, len, " HD422");
} else if(track->par->width == 1440) {
av_strlcatf(compressor_name, len, " HD");
} else
av_strlcatf(compressor_name, len, " EX");
av_strlcatf(compressor_name, len, " %d%c", track->par->height, interlaced ? 'i' : 'p');
av_strlcatf(compressor_name, len, "%d", rate * (interlaced + 1));
}
}
| 13,165
|
93,754
| 0
|
virConnectListAllDomains(virConnectPtr conn,
virDomainPtr **domains,
unsigned int flags)
{
VIR_DEBUG("conn=%p, domains=%p, flags=%x", conn, domains, flags);
virResetLastError();
if (domains)
*domains = NULL;
virCheckConnectReturn(conn, -1);
if (conn->driver->connectListAllDomains) {
int ret;
ret = conn->driver->connectListAllDomains(conn, domains, flags);
if (ret < 0)
goto error;
return ret;
}
virReportUnsupportedError();
error:
virDispatchError(conn);
return -1;
}
| 13,166
|
183,889
| 1
|
Platform::IntPoint InRegionScrollableArea::calculateMaximumScrollPosition(const Platform::IntSize& viewportSize, const Platform::IntSize& contentsSize, float overscrollLimitFactor) const
{
// FIXME: Eventually we should support overscroll like iOS5 does.
ASSERT(!allowsOverscroll());
return Platform::IntPoint(std::max(contentsSize.width() - viewportSize.width(), 0) + overscrollLimitFactor,
std::max(contentsSize.height() - viewportSize.height(), 0) + overscrollLimitFactor);
}
| 13,167
|
176,544
| 0
|
namePop(xmlParserCtxtPtr ctxt)
{
const xmlChar *ret;
if ((ctxt == NULL) || (ctxt->nameNr <= 0))
return (NULL);
ctxt->nameNr--;
if (ctxt->nameNr > 0)
ctxt->name = ctxt->nameTab[ctxt->nameNr - 1];
else
ctxt->name = NULL;
ret = ctxt->nameTab[ctxt->nameNr];
ctxt->nameTab[ctxt->nameNr] = NULL;
return (ret);
}
| 13,168
|
165,470
| 0
|
CSSStyleSheet* Document::createEmptyCSSStyleSheet(
ScriptState* script_state,
ExceptionState& exception_state) {
return Document::createEmptyCSSStyleSheet(
script_state, CSSStyleSheetInit::Create(), exception_state);
}
| 13,169
|
20,624
| 0
|
static int kvm_handle_exit(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
{
u32 exit_reason = kvm_get_exit_reason(vcpu);
vcpu->arch.last_exit = exit_reason;
if (exit_reason < kvm_vti_max_exit_handlers
&& kvm_vti_exit_handlers[exit_reason])
return kvm_vti_exit_handlers[exit_reason](vcpu, kvm_run);
else {
kvm_run->exit_reason = KVM_EXIT_UNKNOWN;
kvm_run->hw.hardware_exit_reason = exit_reason;
}
return 0;
}
| 13,170
|
53,910
| 0
|
struct in6_addr *ndp_msg_addrto(struct ndp_msg *msg)
{
return &msg->addrto;
}
| 13,171
|
6,098
| 0
|
e1000e_write_ext_rx_descr(E1000ECore *core, uint8_t *desc,
struct NetRxPkt *pkt,
const E1000E_RSSInfo *rss_info,
uint16_t length)
{
union e1000_rx_desc_extended *d = (union e1000_rx_desc_extended *) desc;
memset(&d->wb, 0, sizeof(d->wb));
d->wb.upper.length = cpu_to_le16(length);
e1000e_build_rx_metadata(core, pkt, pkt != NULL,
rss_info,
&d->wb.lower.hi_dword.rss,
&d->wb.lower.mrq,
&d->wb.upper.status_error,
&d->wb.lower.hi_dword.csum_ip.ip_id,
&d->wb.upper.vlan);
}
| 13,172
|
18,204
| 0
|
void server_connect_unref(SERVER_CONNECT_REC *conn)
{
g_return_if_fail(IS_SERVER_CONNECT(conn));
if (--conn->refcount > 0)
return;
if (conn->refcount < 0) {
g_warning("Connection '%s' refcount = %d",
conn->tag, conn->refcount);
}
CHAT_PROTOCOL(conn)->destroy_server_connect(conn);
if (conn->connect_handle != NULL)
net_disconnect(conn->connect_handle);
g_free_not_null(conn->proxy);
g_free_not_null(conn->proxy_string);
g_free_not_null(conn->proxy_string_after);
g_free_not_null(conn->proxy_password);
g_free_not_null(conn->tag);
g_free_not_null(conn->address);
g_free_not_null(conn->chatnet);
g_free_not_null(conn->own_ip4);
g_free_not_null(conn->own_ip6);
g_free_not_null(conn->password);
g_free_not_null(conn->nick);
g_free_not_null(conn->username);
g_free_not_null(conn->realname);
g_free_not_null(conn->ssl_cert);
g_free_not_null(conn->ssl_pkey);
g_free_not_null(conn->ssl_cafile);
g_free_not_null(conn->ssl_capath);
g_free_not_null(conn->channels);
g_free_not_null(conn->away_reason);
conn->type = 0;
g_free(conn);
}
| 13,173
|
154,157
| 0
|
size_t GLES2DecoderImpl::GetCreatedBackTextureCountForTest() {
return create_back_texture_count_for_test_;
}
| 13,174
|
23,276
| 0
|
static int decode_attr_owner(struct xdr_stream *xdr, uint32_t *bitmap,
const struct nfs_server *server, uint32_t *uid, int may_sleep)
{
uint32_t len;
__be32 *p;
int ret = 0;
*uid = -2;
if (unlikely(bitmap[1] & (FATTR4_WORD1_OWNER - 1U)))
return -EIO;
if (likely(bitmap[1] & FATTR4_WORD1_OWNER)) {
p = xdr_inline_decode(xdr, 4);
if (unlikely(!p))
goto out_overflow;
len = be32_to_cpup(p);
p = xdr_inline_decode(xdr, len);
if (unlikely(!p))
goto out_overflow;
if (!may_sleep) {
/* do nothing */
} else if (len < XDR_MAX_NETOBJ) {
if (nfs_map_name_to_uid(server, (char *)p, len, uid) == 0)
ret = NFS_ATTR_FATTR_OWNER;
else
dprintk("%s: nfs_map_name_to_uid failed!\n",
__func__);
} else
dprintk("%s: name too long (%u)!\n",
__func__, len);
bitmap[1] &= ~FATTR4_WORD1_OWNER;
}
dprintk("%s: uid=%d\n", __func__, (int)*uid);
return ret;
out_overflow:
print_overflow_msg(__func__, xdr);
return -EIO;
}
| 13,175
|
58,452
| 0
|
server_get_network (server *serv, gboolean fallback)
{
/* check the network list */
if (serv->network)
return ((ircnet *)serv->network)->name;
/* check the network name given in 005 NETWORK=... */
if (serv->server_session && *serv->server_session->channel)
return serv->server_session->channel;
if (fallback)
return serv->servername;
return NULL;
}
| 13,176
|
54,035
| 0
|
static int ims_pcu_setup_buttons(struct ims_pcu *pcu,
const unsigned short *keymap,
size_t keymap_len)
{
struct ims_pcu_buttons *buttons = &pcu->buttons;
struct input_dev *input;
int i;
int error;
input = input_allocate_device();
if (!input) {
dev_err(pcu->dev,
"Not enough memory for input input device\n");
return -ENOMEM;
}
snprintf(buttons->name, sizeof(buttons->name),
"IMS PCU#%d Button Interface", pcu->device_no);
usb_make_path(pcu->udev, buttons->phys, sizeof(buttons->phys));
strlcat(buttons->phys, "/input0", sizeof(buttons->phys));
memcpy(buttons->keymap, keymap, sizeof(*keymap) * keymap_len);
input->name = buttons->name;
input->phys = buttons->phys;
usb_to_input_id(pcu->udev, &input->id);
input->dev.parent = &pcu->ctrl_intf->dev;
input->keycode = buttons->keymap;
input->keycodemax = ARRAY_SIZE(buttons->keymap);
input->keycodesize = sizeof(buttons->keymap[0]);
__set_bit(EV_KEY, input->evbit);
for (i = 0; i < IMS_PCU_KEYMAP_LEN; i++)
__set_bit(buttons->keymap[i], input->keybit);
__clear_bit(KEY_RESERVED, input->keybit);
error = input_register_device(input);
if (error) {
dev_err(pcu->dev,
"Failed to register buttons input device: %d\n",
error);
input_free_device(input);
return error;
}
buttons->input = input;
return 0;
}
| 13,177
|
170,491
| 0
|
void Parcel::remove(size_t /*start*/, size_t /*amt*/)
{
LOG_ALWAYS_FATAL("Parcel::remove() not yet implemented!");
}
| 13,178
|
164,454
| 0
|
static void addToBlockedList(sqlite3 *db){
sqlite3 **pp;
assertMutexHeld();
for(
pp=&sqlite3BlockedList;
*pp && (*pp)->xUnlockNotify!=db->xUnlockNotify;
pp=&(*pp)->pNextBlocked
);
db->pNextBlocked = *pp;
*pp = db;
}
| 13,179
|
140,250
| 0
|
ScriptPromise BluetoothRemoteGATTService::getCharacteristic(
ScriptState* scriptState,
const StringOrUnsignedLong& characteristic,
ExceptionState& exceptionState) {
String characteristicUUID =
BluetoothUUID::getCharacteristic(characteristic, exceptionState);
if (exceptionState.hadException())
return exceptionState.reject(scriptState);
return getCharacteristicsImpl(
scriptState, mojom::blink::WebBluetoothGATTQueryQuantity::SINGLE,
characteristicUUID);
}
| 13,180
|
115,565
| 0
|
void NetworkChangeNotifier::SetFactory(
NetworkChangeNotifierFactory* factory) {
CHECK(!g_network_change_notifier_factory);
g_network_change_notifier_factory = factory;
}
| 13,181
|
24,751
| 0
|
static int add_location(struct loc_track *t, struct kmem_cache *s,
const struct track *track)
{
long start, end, pos;
struct location *l;
void *caddr;
unsigned long age = jiffies - track->when;
start = -1;
end = t->count;
for ( ; ; ) {
pos = start + (end - start + 1) / 2;
/*
* There is nothing at "end". If we end up there
* we need to add something to before end.
*/
if (pos == end)
break;
caddr = t->loc[pos].addr;
if (track->addr == caddr) {
l = &t->loc[pos];
l->count++;
if (track->when) {
l->sum_time += age;
if (age < l->min_time)
l->min_time = age;
if (age > l->max_time)
l->max_time = age;
if (track->pid < l->min_pid)
l->min_pid = track->pid;
if (track->pid > l->max_pid)
l->max_pid = track->pid;
cpu_set(track->cpu, l->cpus);
}
node_set(page_to_nid(virt_to_page(track)), l->nodes);
return 1;
}
if (track->addr < caddr)
end = pos;
else
start = pos;
}
/*
* Not found. Insert new tracking element.
*/
if (t->count >= t->max && !alloc_loc_track(t, 2 * t->max, GFP_ATOMIC))
return 0;
l = t->loc + pos;
if (pos < t->count)
memmove(l + 1, l,
(t->count - pos) * sizeof(struct location));
t->count++;
l->count = 1;
l->addr = track->addr;
l->sum_time = age;
l->min_time = age;
l->max_time = age;
l->min_pid = track->pid;
l->max_pid = track->pid;
cpus_clear(l->cpus);
cpu_set(track->cpu, l->cpus);
nodes_clear(l->nodes);
node_set(page_to_nid(virt_to_page(track)), l->nodes);
return 1;
}
| 13,182
|
119,582
| 0
|
static inline void computeExpansionForJustifiedText(BidiRun* firstRun, BidiRun* trailingSpaceRun, Vector<unsigned, 16>& expansionOpportunities, unsigned expansionOpportunityCount, float& totalLogicalWidth, float availableLogicalWidth)
{
if (!expansionOpportunityCount || availableLogicalWidth <= totalLogicalWidth)
return;
size_t i = 0;
for (BidiRun* r = firstRun; r; r = r->next()) {
if (r->m_startsSegment)
break;
if (!r->m_box || r == trailingSpaceRun)
continue;
if (r->m_object->isText()) {
unsigned opportunitiesInRun = expansionOpportunities[i++];
ASSERT(opportunitiesInRun <= expansionOpportunityCount);
if (r->m_object->style()->collapseWhiteSpace()) {
InlineTextBox* textBox = toInlineTextBox(r->m_box);
int expansion = (availableLogicalWidth - totalLogicalWidth) * opportunitiesInRun / expansionOpportunityCount;
textBox->setExpansion(expansion);
totalLogicalWidth += expansion;
}
expansionOpportunityCount -= opportunitiesInRun;
if (!expansionOpportunityCount)
break;
}
}
}
| 13,183
|
144,358
| 0
|
void ExtensionInstallPrompt::ConfirmWebstoreInstall(
Delegate* delegate,
const Extension* extension,
const SkBitmap* icon,
const ShowDialogCallback& show_dialog_callback) {
extension_ = extension;
SetIcon(icon);
ConfirmInstall(delegate, extension, show_dialog_callback);
}
| 13,184
|
89,988
| 0
|
ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary_byReference(
ZSTD_CCtx* cctx, const void* dict, size_t dictSize)
{
return ZSTD_CCtx_loadDictionary_advanced(
cctx, dict, dictSize, ZSTD_dlm_byRef, ZSTD_dct_auto);
}
| 13,185
|
114,759
| 0
|
bool WaitForFinish() {
if (!finished_) {
waiting_ = true;
ui_test_utils::RunMessageLoop();
waiting_ = false;
}
return finished_;
}
| 13,186
|
10,059
| 0
|
event_bold_change( double delta )
{
status.bold_factor += delta;
if ( status.bold_factor > 0.1 )
status.bold_factor = 0.1;
else if ( status.bold_factor < -0.1 )
status.bold_factor = -0.1;
sprintf( status.header_buffer, "embolding factor changed to %.3f",
status.bold_factor );
status.header = status.header_buffer;
}
| 13,187
|
49,931
| 0
|
size_t php_mysqlnd_auth_write(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC)
{
zend_uchar buffer[AUTH_WRITE_BUFFER_LEN];
zend_uchar *p = buffer + MYSQLND_HEADER_SIZE; /* start after the header */
int len;
MYSQLND_PACKET_AUTH * packet= (MYSQLND_PACKET_AUTH *) _packet;
DBG_ENTER("php_mysqlnd_auth_write");
if (!packet->is_change_user_packet) {
int4store(p, packet->client_flags);
p+= 4;
int4store(p, packet->max_packet_size);
p+= 4;
int1store(p, packet->charset_no);
p++;
memset(p, 0, 23); /* filler */
p+= 23;
}
if (packet->send_auth_data || packet->is_change_user_packet) {
len = MIN(strlen(packet->user), MYSQLND_MAX_ALLOWED_USER_LEN);
memcpy(p, packet->user, len);
p+= len;
*p++ = '\0';
/* defensive coding */
if (packet->auth_data == NULL) {
packet->auth_data_len = 0;
}
if (packet->auth_data_len > 0xFF) {
const char * const msg = "Authentication data too long. "
"Won't fit into the buffer and will be truncated. Authentication will thus fail";
SET_CLIENT_ERROR(*conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, msg);
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", msg);
DBG_RETURN(0);
}
int1store(p, packet->auth_data_len);
++p;
/*!!!!! is the buffer big enough ??? */
if ((sizeof(buffer) - (p - buffer)) < packet->auth_data_len) {
DBG_ERR("the stack buffer was not enough!!");
DBG_RETURN(0);
}
if (packet->auth_data_len) {
memcpy(p, packet->auth_data, packet->auth_data_len);
p+= packet->auth_data_len;
}
if (packet->db) {
/* CLIENT_CONNECT_WITH_DB should have been set */
size_t real_db_len = MIN(MYSQLND_MAX_ALLOWED_DB_LEN, packet->db_len);
memcpy(p, packet->db, real_db_len);
p+= real_db_len;
*p++= '\0';
} else if (packet->is_change_user_packet) {
*p++= '\0';
}
/* no \0 for no DB */
if (packet->is_change_user_packet) {
if (packet->charset_no) {
int2store(p, packet->charset_no);
p+= 2;
}
}
if (packet->auth_plugin_name) {
size_t len = MIN(strlen(packet->auth_plugin_name), sizeof(buffer) - (p - buffer) - 1);
memcpy(p, packet->auth_plugin_name, len);
p+= len;
*p++= '\0';
}
if (packet->connect_attr && zend_hash_num_elements(packet->connect_attr)) {
HashPosition pos_value;
const char ** entry_value;
size_t ca_payload_len = 0;
zend_hash_internal_pointer_reset_ex(packet->connect_attr, &pos_value);
while (SUCCESS == zend_hash_get_current_data_ex(packet->connect_attr, (void **)&entry_value, &pos_value)) {
char *s_key;
unsigned int s_len;
unsigned long num_key;
size_t value_len = strlen(*entry_value);
if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(packet->connect_attr, &s_key, &s_len, &num_key, 0, &pos_value)) {
ca_payload_len += php_mysqlnd_net_store_length_size(s_len);
ca_payload_len += s_len;
ca_payload_len += php_mysqlnd_net_store_length_size(value_len);
ca_payload_len += value_len;
}
zend_hash_move_forward_ex(conn->options->connect_attr, &pos_value);
}
if ((sizeof(buffer) - (p - buffer)) >= (ca_payload_len + php_mysqlnd_net_store_length_size(ca_payload_len))) {
p = php_mysqlnd_net_store_length(p, ca_payload_len);
zend_hash_internal_pointer_reset_ex(packet->connect_attr, &pos_value);
while (SUCCESS == zend_hash_get_current_data_ex(packet->connect_attr, (void **)&entry_value, &pos_value)) {
char *s_key;
unsigned int s_len;
unsigned long num_key;
size_t value_len = strlen(*entry_value);
if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(packet->connect_attr, &s_key, &s_len, &num_key, 0, &pos_value)) {
/* copy key */
p = php_mysqlnd_net_store_length(p, s_len);
memcpy(p, s_key, s_len);
p+= s_len;
/* copy value */
p = php_mysqlnd_net_store_length(p, value_len);
memcpy(p, *entry_value, value_len);
p+= value_len;
}
zend_hash_move_forward_ex(conn->options->connect_attr, &pos_value);
}
} else {
/* cannot put the data - skip */
}
}
}
if (packet->is_change_user_packet) {
if (PASS != conn->m->simple_command(conn, COM_CHANGE_USER, buffer + MYSQLND_HEADER_SIZE, p - buffer - MYSQLND_HEADER_SIZE,
PROT_LAST /* the caller will handle the OK packet */,
packet->silent, TRUE TSRMLS_CC)) {
DBG_RETURN(0);
}
DBG_RETURN(p - buffer - MYSQLND_HEADER_SIZE);
} else {
size_t sent = conn->net->data->m.send_ex(conn->net, buffer, p - buffer - MYSQLND_HEADER_SIZE, conn->stats, conn->error_info TSRMLS_CC);
if (!sent) {
CONN_SET_STATE(conn, CONN_QUIT_SENT);
}
DBG_RETURN(sent);
}
}
| 13,188
|
63,893
| 0
|
static loff_t max_file_blocks(void)
{
loff_t result = (DEF_ADDRS_PER_INODE - F2FS_INLINE_XATTR_ADDRS);
loff_t leaf_count = ADDRS_PER_BLOCK;
/* two direct node blocks */
result += (leaf_count * 2);
/* two indirect node blocks */
leaf_count *= NIDS_PER_BLOCK;
result += (leaf_count * 2);
/* one double indirect node block */
leaf_count *= NIDS_PER_BLOCK;
result += leaf_count;
return result;
}
| 13,189
|
95,563
| 0
|
void S_AL_StreamDie( int stream )
{
if ((stream < 0) || (stream >= MAX_RAW_STREAMS))
return;
if(streamSourceHandles[stream] == -1)
return;
streamPlaying[stream] = qfalse;
qalSourceStop(streamSources[stream]);
S_AL_FreeStreamChannel(stream);
}
| 13,190
|
174,154
| 0
|
void OMX::invalidateNodeID(node_id node) {
Mutex::Autolock autoLock(mLock);
invalidateNodeID_l(node);
}
| 13,191
|
48,538
| 0
|
static size_t ion_debug_heap_total(struct ion_client *client,
unsigned int id)
{
size_t size = 0;
struct rb_node *n;
mutex_lock(&client->lock);
for (n = rb_first(&client->handles); n; n = rb_next(n)) {
struct ion_handle *handle = rb_entry(n,
struct ion_handle,
node);
if (handle->buffer->heap->id == id)
size += handle->buffer->size;
}
mutex_unlock(&client->lock);
return size;
}
| 13,192
|
96,915
| 0
|
void *tracing_cond_snapshot_data(struct trace_array *tr)
{
void *cond_data = NULL;
arch_spin_lock(&tr->max_lock);
if (tr->cond_snapshot)
cond_data = tr->cond_snapshot->cond_data;
arch_spin_unlock(&tr->max_lock);
return cond_data;
}
| 13,193
|
55,588
| 0
|
int sched_cpu_activate(unsigned int cpu)
{
struct rq *rq = cpu_rq(cpu);
unsigned long flags;
set_cpu_active(cpu, true);
if (sched_smp_initialized) {
sched_domains_numa_masks_set(cpu);
cpuset_cpu_active();
}
/*
* Put the rq online, if not already. This happens:
*
* 1) In the early boot process, because we build the real domains
* after all cpus have been brought up.
*
* 2) At runtime, if cpuset_cpu_active() fails to rebuild the
* domains.
*/
raw_spin_lock_irqsave(&rq->lock, flags);
if (rq->rd) {
BUG_ON(!cpumask_test_cpu(cpu, rq->rd->span));
set_rq_online(rq);
}
raw_spin_unlock_irqrestore(&rq->lock, flags);
update_max_interval();
return 0;
}
| 13,194
|
156,528
| 0
|
bool ChildProcessSecurityPolicyImpl::CanRedirectToURL(const GURL& url) {
if (!url.is_valid())
return false; // Can't redirect to invalid URLs.
const std::string& scheme = url.scheme();
if (scheme == kChromeErrorScheme)
return false;
if (IsPseudoScheme(scheme)) {
return url.IsAboutBlank();
}
return true;
}
| 13,195
|
99,905
| 0
|
void* NPN_GetJavaEnv() {
DLOG(INFO) << "NPN_GetJavaEnv is not implemented.";
return NULL;
}
| 13,196
|
166,038
| 0
|
void RTCPeerConnectionHandler::Stop() {
DCHECK(task_runner_->RunsTasksInCurrentSequence());
DVLOG(1) << "RTCPeerConnectionHandler::stop";
if (is_closed_ || !native_peer_connection_.get())
return; // Already stopped.
if (peer_connection_tracker_)
peer_connection_tracker_->TrackStop(this);
native_peer_connection_->Close();
is_closed_ = true;
}
| 13,197
|
31,868
| 0
|
static inline u32 tcp_cookie_work(const u32 *ws, const int n)
{
return ws[COOKIE_DIGEST_WORDS + ((COOKIE_MESSAGE_WORDS-1) & ws[n])];
}
| 13,198
|
144,816
| 0
|
void AllowState(LifecycleUnitState allowed_state) {
allowed_states_.insert(allowed_state);
}
| 13,199
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.