unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
101,258 | 0 | void ExpectUnsyncedDeletion() {
EXPECT_EQ(metahandle_, GetMetahandleOfTag());
EXPECT_TRUE(Get(metahandle_, IS_DEL));
EXPECT_FALSE(Get(metahandle_, SERVER_IS_DEL));
EXPECT_TRUE(Get(metahandle_, IS_UNSYNCED));
EXPECT_FALSE(Get(metahandle_, IS_UNAPPLIED_UPDATE));
EXPECT_LT(0, Get(metahandle_, BASE_VERSION));
EXPECT_LT(0, Get(metahandle_, SERVER_VERSION));
}
| 16,300 |
164,342 | 0 | ExtensionFunction::ResponseAction WindowsRemoveFunction::Run() {
std::unique_ptr<windows::Remove::Params> params(
windows::Remove::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
Browser* browser = nullptr;
std::string error;
if (!windows_util::GetBrowserFromWindowID(this, params->window_id,
WindowController::kNoWindowFilter,
&browser, &error)) {
return RespondNow(Error(error));
}
#if defined(OS_CHROMEOS)
if (ash::IsWindowTrustedPinned(browser->window()) &&
!ExtensionHasLockedFullscreenPermission(extension())) {
return RespondNow(
Error(tabs_constants::kMissingLockWindowFullscreenPrivatePermission));
}
#endif
WindowController* controller = browser->extension_window_controller();
WindowController::Reason reason;
if (!controller->CanClose(&reason)) {
return RespondNow(Error(reason == WindowController::REASON_NOT_EDITABLE
? tabs_constants::kTabStripNotEditableError
: kUnknownErrorDoNotUse));
}
controller->window()->Close();
return RespondNow(NoArguments());
}
| 16,301 |
116,865 | 0 | void TestWebKitPlatformSupport::GetPlugins(
bool refresh, std::vector<webkit::WebPluginInfo>* plugins) {
if (refresh)
webkit::npapi::PluginList::Singleton()->RefreshPlugins();
webkit::npapi::PluginList::Singleton()->GetPlugins(plugins);
const FilePath::StringType kPluginBlackList[] = {
FILE_PATH_LITERAL("npapi_layout_test_plugin.dll"),
FILE_PATH_LITERAL("WebKitTestNetscapePlugIn.plugin"),
FILE_PATH_LITERAL("libnpapi_layout_test_plugin.so"),
};
for (int i = plugins->size() - 1; i >= 0; --i) {
webkit::WebPluginInfo plugin_info = plugins->at(i);
for (size_t j = 0; j < arraysize(kPluginBlackList); ++j) {
if (plugin_info.path.BaseName() == FilePath(kPluginBlackList[j])) {
plugins->erase(plugins->begin() + i);
}
}
}
}
| 16,302 |
168,115 | 0 | void CreateTestCreditCards() {
CreditCard credit_card1;
test::SetCreditCardInfo(&credit_card1, "Elvis Presley",
"4234567890123456", // Visa
"04", "2999", "1");
credit_card1.set_guid("00000000-0000-0000-0000-000000000004");
credit_card1.set_use_count(10);
credit_card1.set_use_date(AutofillClock::Now() -
base::TimeDelta::FromDays(5));
personal_data_.AddCreditCard(credit_card1);
CreditCard credit_card2;
test::SetCreditCardInfo(&credit_card2, "Buddy Holly",
"5187654321098765", // Mastercard
"10", "2998", "1");
credit_card2.set_guid("00000000-0000-0000-0000-000000000005");
credit_card2.set_use_count(5);
credit_card2.set_use_date(AutofillClock::Now() -
base::TimeDelta::FromDays(4));
personal_data_.AddCreditCard(credit_card2);
CreditCard credit_card3;
test::SetCreditCardInfo(&credit_card3, "", "", "", "", "");
credit_card3.set_guid("00000000-0000-0000-0000-000000000006");
personal_data_.AddCreditCard(credit_card3);
}
| 16,303 |
121,771 | 0 | int UDPSocketLibevent::SetMulticastLoopbackMode(bool loopback) {
DCHECK(CalledOnValidThread());
if (is_connected())
return ERR_SOCKET_IS_CONNECTED;
if (loopback)
socket_options_ |= SOCKET_OPTION_MULTICAST_LOOP;
else
socket_options_ &= ~SOCKET_OPTION_MULTICAST_LOOP;
return OK;
}
| 16,304 |
44,943 | 0 | xfs_attr3_leaf_unbalance(
struct xfs_da_state *state,
struct xfs_da_state_blk *drop_blk,
struct xfs_da_state_blk *save_blk)
{
struct xfs_attr_leafblock *drop_leaf = drop_blk->bp->b_addr;
struct xfs_attr_leafblock *save_leaf = save_blk->bp->b_addr;
struct xfs_attr3_icleaf_hdr drophdr;
struct xfs_attr3_icleaf_hdr savehdr;
struct xfs_attr_leaf_entry *entry;
struct xfs_mount *mp = state->mp;
trace_xfs_attr_leaf_unbalance(state->args);
drop_leaf = drop_blk->bp->b_addr;
save_leaf = save_blk->bp->b_addr;
xfs_attr3_leaf_hdr_from_disk(&drophdr, drop_leaf);
xfs_attr3_leaf_hdr_from_disk(&savehdr, save_leaf);
entry = xfs_attr3_leaf_entryp(drop_leaf);
/*
* Save last hashval from dying block for later Btree fixup.
*/
drop_blk->hashval = be32_to_cpu(entry[drophdr.count - 1].hashval);
/*
* Check if we need a temp buffer, or can we do it in place.
* Note that we don't check "leaf" for holes because we will
* always be dropping it, toosmall() decided that for us already.
*/
if (savehdr.holes == 0) {
/*
* dest leaf has no holes, so we add there. May need
* to make some room in the entry array.
*/
if (xfs_attr3_leaf_order(save_blk->bp, &savehdr,
drop_blk->bp, &drophdr)) {
xfs_attr3_leaf_moveents(drop_leaf, &drophdr, 0,
save_leaf, &savehdr, 0,
drophdr.count, mp);
} else {
xfs_attr3_leaf_moveents(drop_leaf, &drophdr, 0,
save_leaf, &savehdr,
savehdr.count, drophdr.count, mp);
}
} else {
/*
* Destination has holes, so we make a temporary copy
* of the leaf and add them both to that.
*/
struct xfs_attr_leafblock *tmp_leaf;
struct xfs_attr3_icleaf_hdr tmphdr;
tmp_leaf = kmem_zalloc(state->blocksize, KM_SLEEP);
/*
* Copy the header into the temp leaf so that all the stuff
* not in the incore header is present and gets copied back in
* once we've moved all the entries.
*/
memcpy(tmp_leaf, save_leaf, xfs_attr3_leaf_hdr_size(save_leaf));
memset(&tmphdr, 0, sizeof(tmphdr));
tmphdr.magic = savehdr.magic;
tmphdr.forw = savehdr.forw;
tmphdr.back = savehdr.back;
tmphdr.firstused = state->blocksize;
/* write the header to the temp buffer to initialise it */
xfs_attr3_leaf_hdr_to_disk(tmp_leaf, &tmphdr);
if (xfs_attr3_leaf_order(save_blk->bp, &savehdr,
drop_blk->bp, &drophdr)) {
xfs_attr3_leaf_moveents(drop_leaf, &drophdr, 0,
tmp_leaf, &tmphdr, 0,
drophdr.count, mp);
xfs_attr3_leaf_moveents(save_leaf, &savehdr, 0,
tmp_leaf, &tmphdr, tmphdr.count,
savehdr.count, mp);
} else {
xfs_attr3_leaf_moveents(save_leaf, &savehdr, 0,
tmp_leaf, &tmphdr, 0,
savehdr.count, mp);
xfs_attr3_leaf_moveents(drop_leaf, &drophdr, 0,
tmp_leaf, &tmphdr, tmphdr.count,
drophdr.count, mp);
}
memcpy(save_leaf, tmp_leaf, state->blocksize);
savehdr = tmphdr; /* struct copy */
kmem_free(tmp_leaf);
}
xfs_attr3_leaf_hdr_to_disk(save_leaf, &savehdr);
xfs_trans_log_buf(state->args->trans, save_blk->bp, 0,
state->blocksize - 1);
/*
* Copy out last hashval in each block for B-tree code.
*/
entry = xfs_attr3_leaf_entryp(save_leaf);
save_blk->hashval = be32_to_cpu(entry[savehdr.count - 1].hashval);
}
| 16,305 |
71,368 | 0 | int git_smart__download_pack(
git_transport *transport,
git_repository *repo,
git_transfer_progress *stats,
git_transfer_progress_cb transfer_progress_cb,
void *progress_payload)
{
transport_smart *t = (transport_smart *)transport;
gitno_buffer *buf = &t->buffer;
git_odb *odb;
struct git_odb_writepack *writepack = NULL;
int error = 0;
struct network_packetsize_payload npp = {0};
memset(stats, 0, sizeof(git_transfer_progress));
if (transfer_progress_cb) {
npp.callback = transfer_progress_cb;
npp.payload = progress_payload;
npp.stats = stats;
t->packetsize_cb = &network_packetsize;
t->packetsize_payload = &npp;
/* We might have something in the buffer already from negotiate_fetch */
if (t->buffer.offset > 0 && !t->cancelled.val)
if (t->packetsize_cb(t->buffer.offset, t->packetsize_payload))
git_atomic_set(&t->cancelled, 1);
}
if ((error = git_repository_odb__weakptr(&odb, repo)) < 0 ||
((error = git_odb_write_pack(&writepack, odb, transfer_progress_cb, progress_payload)) != 0))
goto done;
/*
* If the remote doesn't support the side-band, we can feed
* the data directly to the pack writer. Otherwise, we need to
* check which one belongs there.
*/
if (!t->caps.side_band && !t->caps.side_band_64k) {
error = no_sideband(t, writepack, buf, stats);
goto done;
}
do {
git_pkt *pkt = NULL;
/* Check cancellation before network call */
if (t->cancelled.val) {
giterr_clear();
error = GIT_EUSER;
goto done;
}
if ((error = recv_pkt(&pkt, buf)) >= 0) {
/* Check cancellation after network call */
if (t->cancelled.val) {
giterr_clear();
error = GIT_EUSER;
} else if (pkt->type == GIT_PKT_PROGRESS) {
if (t->progress_cb) {
git_pkt_progress *p = (git_pkt_progress *) pkt;
error = t->progress_cb(p->data, p->len, t->message_cb_payload);
}
} else if (pkt->type == GIT_PKT_DATA) {
git_pkt_data *p = (git_pkt_data *) pkt;
if (p->len)
error = writepack->append(writepack, p->data, p->len, stats);
} else if (pkt->type == GIT_PKT_FLUSH) {
/* A flush indicates the end of the packfile */
git__free(pkt);
break;
}
}
git__free(pkt);
if (error < 0)
goto done;
} while (1);
/*
* Trailing execution of transfer_progress_cb, if necessary...
* Only the callback through the npp datastructure currently
* updates the last_fired_bytes value. It is possible that
* progress has already been reported with the correct
* "received_bytes" value, but until (if?) this is unified
* then we will report progress again to be sure that the
* correct last received_bytes value is reported.
*/
if (npp.callback && npp.stats->received_bytes > npp.last_fired_bytes) {
error = npp.callback(npp.stats, npp.payload);
if (error != 0)
goto done;
}
error = writepack->commit(writepack, stats);
done:
if (writepack)
writepack->free(writepack);
if (transfer_progress_cb) {
t->packetsize_cb = NULL;
t->packetsize_payload = NULL;
}
return error;
}
| 16,306 |
111,068 | 0 | BackingStoreClient* WebPagePrivate::backingStoreClient() const
{
return m_backingStoreClient;
}
| 16,307 |
88,576 | 0 | MagickExport ssize_t WriteBlobMSBSignedShort(Image *image,
const signed short value)
{
union
{
unsigned short
unsigned_value;
signed short
signed_value;
} quantum;
unsigned char
buffer[2];
assert(image != (Image *) NULL);
assert(image->signature == MagickCoreSignature);
quantum.signed_value=value;
buffer[0]=(unsigned char) (quantum.unsigned_value >> 8);
buffer[1]=(unsigned char) quantum.unsigned_value;
return(WriteBlobStream(image,2,buffer));
}
| 16,308 |
122,058 | 0 | void Shell::PlatformSetTitle(const base::string16& title) {
}
| 16,309 |
79,461 | 0 | void nntp_article_status(struct Context *ctx, struct Header *hdr, char *group, anum_t anum)
{
struct NntpData *nntp_data = ctx->data;
if (group)
nntp_data = mutt_hash_find(nntp_data->nserv->groups_hash, group);
if (!nntp_data)
return;
for (unsigned int i = 0; i < nntp_data->newsrc_len; i++)
{
if ((anum >= nntp_data->newsrc_ent[i].first) &&
(anum <= nntp_data->newsrc_ent[i].last))
{
/* can't use mutt_set_flag() because mx_update_context()
didn't called yet */
hdr->read = true;
return;
}
}
/* article was not cached yet, it's new */
if (anum > nntp_data->last_cached)
return;
/* article isn't read but cached, it's old */
if (MarkOld)
hdr->old = true;
}
| 16,310 |
25,591 | 0 | static int fcnvds(struct sh_fpu_soft_struct *fregs, int n)
{
FP_DECL_EX;
FP_DECL_D(Fn);
FP_DECL_S(Fr);
UNPACK_D(Fn, DRn);
FP_CONV(S, D, 1, 2, Fr, Fn);
PACK_S(FPUL, Fr);
return 0;
}
| 16,311 |
178,938 | 1 | __u32 secure_ipv6_id(const __be32 daddr[4])
{
const struct keydata *keyptr;
__u32 hash[4];
keyptr = get_keyptr();
hash[0] = (__force __u32)daddr[0];
hash[1] = (__force __u32)daddr[1];
hash[2] = (__force __u32)daddr[2];
hash[3] = (__force __u32)daddr[3];
return half_md4_transform(hash, keyptr->secret);
}
| 16,312 |
104,662 | 0 | UninstalledExtensionInfo::~UninstalledExtensionInfo() {}
| 16,313 |
132,210 | 0 | void GetRedirectChain(WebDataSource* ds, std::vector<GURL>* result) {
const WebURL& blank_url = GURL(url::kAboutBlankURL);
WebVector<WebURL> urls;
ds->redirectChain(urls);
result->reserve(urls.size());
for (size_t i = 0; i < urls.size(); ++i) {
if (urls[i] != GURL(kSwappedOutURL))
result->push_back(urls[i]);
else
result->push_back(blank_url);
}
}
| 16,314 |
60,355 | 0 | process_extended_statvfs(u_int32_t id)
{
char *path;
struct statvfs st;
int r;
if ((r = sshbuf_get_cstring(iqueue, &path, NULL)) != 0)
fatal("%s: buffer error: %s", __func__, ssh_err(r));
debug3("request %u: statvfs", id);
logit("statvfs \"%s\"", path);
if (statvfs(path, &st) != 0)
send_status(id, errno_to_portable(errno));
else
send_statvfs(id, &st);
free(path);
}
| 16,315 |
161,049 | 0 | UIDNAWrapper() {
UErrorCode err = U_ZERO_ERROR;
value = uidna_openUTS46(UIDNA_CHECK_BIDI, &err);
CHECK(U_SUCCESS(err)) << "failed to open UTS46 data with error: "
<< u_errorName(err)
<< ". If you see this error message in a test "
<< "environment your test environment likely lacks "
<< "the required data tables for libicu. See "
<< "https://crbug.com/778929.";
}
| 16,316 |
150,270 | 0 | InputEngine::~InputEngine() {}
| 16,317 |
47,384 | 0 | static void xeta_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
{
u32 y, z, sum = 0;
u32 limit = XTEA_DELTA * XTEA_ROUNDS;
struct xtea_ctx *ctx = crypto_tfm_ctx(tfm);
const __le32 *in = (const __le32 *)src;
__le32 *out = (__le32 *)dst;
y = le32_to_cpu(in[0]);
z = le32_to_cpu(in[1]);
while (sum != limit) {
y += (z << 4 ^ z >> 5) + (z ^ sum) + ctx->KEY[sum&3];
sum += XTEA_DELTA;
z += (y << 4 ^ y >> 5) + (y ^ sum) + ctx->KEY[sum>>11 &3];
}
out[0] = cpu_to_le32(y);
out[1] = cpu_to_le32(z);
}
| 16,318 |
68,097 | 0 | static Sdb *get_sdb (RBinObject *o) {
if (!o || !o->bin_obj) {
return NULL;
}
struct r_bin_dex_obj_t *bin = (struct r_bin_dex_obj_t *) o->bin_obj;
if (bin->kv) {
return bin->kv;
}
return NULL;
}
| 16,319 |
113,800 | 0 | void PrintWebViewHelper::UpdateFrameAndViewFromCssPageLayout(
WebFrame* frame,
const WebNode& node,
PrepareFrameAndViewForPrint* prepare,
const PrintMsg_Print_Params& params,
bool ignore_css_margins) {
if (PrintingNodeOrPdfFrame(frame, node))
return;
PrintMsg_Print_Params print_params = CalculatePrintParamsForCss(
frame, 0, params, ignore_css_margins,
ignore_css_margins && params.fit_to_paper_size, NULL);
prepare->UpdatePrintParams(print_params);
}
| 16,320 |
166,576 | 0 | void BrowserCommandController::UpdateSharedCommandsForIncognitoAvailability(
CommandUpdater* command_updater,
Profile* profile) {
const bool guest_session = profile->IsGuestSession();
IncognitoModePrefs::Availability incognito_availability =
IncognitoModePrefs::GetAvailability(profile->GetPrefs());
command_updater->UpdateCommandEnabled(
IDC_NEW_WINDOW,
incognito_availability != IncognitoModePrefs::FORCED);
command_updater->UpdateCommandEnabled(
IDC_NEW_INCOGNITO_WINDOW,
incognito_availability != IncognitoModePrefs::DISABLED && !guest_session);
const bool forced_incognito =
incognito_availability == IncognitoModePrefs::FORCED ||
guest_session; // Guest always runs in Incognito mode.
command_updater->UpdateCommandEnabled(
IDC_SHOW_BOOKMARK_MANAGER,
browser_defaults::bookmarks_enabled && !forced_incognito);
extensions::ExtensionService* extension_service =
extensions::ExtensionSystem::Get(profile)->extension_service();
const bool enable_extensions =
extension_service && extension_service->extensions_enabled();
command_updater->UpdateCommandEnabled(IDC_MANAGE_EXTENSIONS,
enable_extensions && !forced_incognito);
command_updater->UpdateCommandEnabled(IDC_IMPORT_SETTINGS, !forced_incognito);
command_updater->UpdateCommandEnabled(IDC_OPTIONS,
!forced_incognito || guest_session);
command_updater->UpdateCommandEnabled(IDC_SHOW_SIGNIN, !forced_incognito);
}
| 16,321 |
24,426 | 0 | int proc_dointvec_minmax(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
return -ENOSYS;
}
| 16,322 |
188,279 | 1 | long Cluster::CreateBlock(
long long id,
long long pos, //absolute pos of payload
long long size,
long long discard_padding)
{
assert((id == 0x20) || (id == 0x23)); //BlockGroup or SimpleBlock
if (m_entries_count < 0) //haven't parsed anything yet
{
assert(m_entries == NULL);
assert(m_entries_size == 0);
m_entries_size = 1024;
m_entries = new BlockEntry*[m_entries_size];
m_entries_count = 0;
}
else
{
assert(m_entries);
assert(m_entries_size > 0);
assert(m_entries_count <= m_entries_size);
if (m_entries_count >= m_entries_size)
{
const long entries_size = 2 * m_entries_size;
BlockEntry** const entries = new BlockEntry*[entries_size];
assert(entries);
BlockEntry** src = m_entries;
BlockEntry** const src_end = src + m_entries_count;
BlockEntry** dst = entries;
while (src != src_end)
*dst++ = *src++;
delete[] m_entries;
m_entries = entries;
m_entries_size = entries_size;
}
}
if (id == 0x20) //BlockGroup ID
return CreateBlockGroup(pos, size, discard_padding);
else //SimpleBlock ID
return CreateSimpleBlock(pos, size);
}
| 16,323 |
91,987 | 0 | blk_init_queue_node(request_fn_proc *rfn, spinlock_t *lock, int node_id)
{
struct request_queue *q;
q = blk_alloc_queue_node(GFP_KERNEL, node_id, lock);
if (!q)
return NULL;
q->request_fn = rfn;
if (blk_init_allocated_queue(q) < 0) {
blk_cleanup_queue(q);
return NULL;
}
return q;
}
| 16,324 |
122,537 | 0 | void InspectorClientImpl::stopGPUEventsRecording()
{
if (WebDevToolsAgentImpl* agent = devToolsAgent())
agent->stopGPUEventsRecording();
}
| 16,325 |
19,227 | 0 | static void netlink_destroy_callback(struct netlink_callback *cb)
{
kfree_skb(cb->skb);
kfree(cb);
}
| 16,326 |
40,963 | 0 | int lh_table_insert(struct lh_table *t, void *k, const void *v)
{
unsigned long h, n;
t->inserts++;
if(t->count >= t->size * LH_LOAD_FACTOR) lh_table_resize(t, t->size * 2);
h = t->hash_fn(k);
n = h % t->size;
while( 1 ) {
if(t->table[n].k == LH_EMPTY || t->table[n].k == LH_FREED) break;
t->collisions++;
if ((int)++n == t->size) n = 0;
}
t->table[n].k = k;
t->table[n].v = v;
t->count++;
if(t->head == NULL) {
t->head = t->tail = &t->table[n];
t->table[n].next = t->table[n].prev = NULL;
} else {
t->tail->next = &t->table[n];
t->table[n].prev = t->tail;
t->table[n].next = NULL;
t->tail = &t->table[n];
}
return 0;
}
| 16,327 |
137,823 | 0 | MediaControlPlayButtonElement::MediaControlPlayButtonElement(
MediaControls& mediaControls)
: MediaControlInputElement(mediaControls, MediaPlayButton) {}
| 16,328 |
97,878 | 0 | RenderView* RenderView::Create(
RenderThreadBase* render_thread,
gfx::NativeViewId parent_hwnd,
int32 opener_id,
const RendererPreferences& renderer_prefs,
const WebPreferences& webkit_prefs,
SharedRenderViewCounter* counter,
int32 routing_id,
int64 session_storage_namespace_id,
const string16& frame_name) {
DCHECK(routing_id != MSG_ROUTING_NONE);
scoped_refptr<RenderView> view = new RenderView(render_thread, webkit_prefs,
session_storage_namespace_id);
view->Init(parent_hwnd,
opener_id,
renderer_prefs,
counter,
routing_id,
frame_name); // adds reference
return view;
}
| 16,329 |
18,325 | 0 | builtins() {
unsigned int i,
len = LENGTH(cmdlist);
GString *command_list = g_string_new("");
for (i = 0; i < len; i++) {
g_string_append(command_list, cmdlist[i].key);
g_string_append_c(command_list, ' ');
}
send_event(BUILTINS, command_list->str, NULL);
g_string_free(command_list, TRUE);
}
| 16,330 |
111,337 | 0 | void WebPagePrivate::setCompositorDrawsRootLayer(bool compositorDrawsRootLayer)
{
#if USE(ACCELERATED_COMPOSITING)
if (m_page->settings()->forceCompositingMode() == compositorDrawsRootLayer)
return;
m_page->settings()->setForceCompositingMode(compositorDrawsRootLayer);
if (!m_mainFrame)
return;
if (FrameView* view = m_mainFrame->view())
view->updateCompositingLayers();
#endif
}
| 16,331 |
118,495 | 0 | void RenderFrameImpl::didClearWindowObject(blink::WebLocalFrame* frame,
int world_id) {
DCHECK(!frame_ || frame_ == frame);
render_view_->didClearWindowObject(frame, world_id);
if (world_id)
return;
if (render_view_->GetEnabledBindings() & BINDINGS_POLICY_DOM_AUTOMATION)
DomAutomationController::Install(this, frame);
FOR_EACH_OBSERVER(RenderFrameObserver, observers_,
DidClearWindowObject(world_id));
}
| 16,332 |
123,402 | 0 | void RenderWidgetHostViewGuest::SetTakesFocusOnlyOnMouseDown(bool flag) {
NOTIMPLEMENTED();
}
| 16,333 |
11,795 | 0 | partition_modify_completed_cb (DBusGMethodInvocation *context,
Device *device,
gboolean job_was_cancelled,
int status,
const char *stderr,
const char *stdout,
gpointer user_data)
{
ModifyPartitionData *data = user_data;
/* poke the kernel so we can reread the data */
device_generate_kernel_change_event (data->enclosing_device);
device_generate_kernel_change_event (data->device);
if (WEXITSTATUS (status) == 0 && !job_was_cancelled)
{
/* update local copy, don't wait for the kernel */
device_set_partition_type (device, data->type);
device_set_partition_label (device, data->label);
device_set_partition_flags (device, data->flags);
drain_pending_changes (device, FALSE);
dbus_g_method_return (context);
}
else
{
if (job_was_cancelled)
{
throw_error (context, ERROR_CANCELLED, "Job was cancelled");
}
else
{
throw_error (context,
ERROR_FAILED,
"Error modifying partition: helper exited with exit code %d: %s",
WEXITSTATUS (status),
stderr);
}
}
}
| 16,334 |
65,893 | 0 | nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp,
char *name, int len, struct svc_fh *tfhp)
{
struct dentry *ddir, *dnew, *dold;
struct inode *dirp;
__be32 err;
int host_err;
err = fh_verify(rqstp, ffhp, S_IFDIR, NFSD_MAY_CREATE);
if (err)
goto out;
err = fh_verify(rqstp, tfhp, 0, NFSD_MAY_NOP);
if (err)
goto out;
err = nfserr_isdir;
if (d_is_dir(tfhp->fh_dentry))
goto out;
err = nfserr_perm;
if (!len)
goto out;
err = nfserr_exist;
if (isdotent(name, len))
goto out;
host_err = fh_want_write(tfhp);
if (host_err) {
err = nfserrno(host_err);
goto out;
}
fh_lock_nested(ffhp, I_MUTEX_PARENT);
ddir = ffhp->fh_dentry;
dirp = d_inode(ddir);
dnew = lookup_one_len(name, ddir, len);
host_err = PTR_ERR(dnew);
if (IS_ERR(dnew))
goto out_nfserr;
dold = tfhp->fh_dentry;
err = nfserr_noent;
if (d_really_is_negative(dold))
goto out_dput;
host_err = vfs_link(dold, dirp, dnew, NULL);
if (!host_err) {
err = nfserrno(commit_metadata(ffhp));
if (!err)
err = nfserrno(commit_metadata(tfhp));
} else {
if (host_err == -EXDEV && rqstp->rq_vers == 2)
err = nfserr_acces;
else
err = nfserrno(host_err);
}
out_dput:
dput(dnew);
out_unlock:
fh_unlock(ffhp);
fh_drop_write(tfhp);
out:
return err;
out_nfserr:
err = nfserrno(host_err);
goto out_unlock;
}
| 16,335 |
43,345 | 0 | void CLASS parse_phase_one (int base)
{
unsigned entries, tag, len, data, save, i, j, c;
float romm_cam[3][3];
char *cp;
memset (&ph1, 0, sizeof ph1);
fseek (ifp, base, SEEK_SET);
order = get4() & 0xffff;
if (get4() >> 8 != 0x526177) return; /* "Raw" */
fseek (ifp, get4()+base, SEEK_SET);
entries = get4();
get4();
while (entries--) {
tag = get4();
fseek (ifp, 4, SEEK_CUR);
len = get4();
data = get4();
save = ftell(ifp);
fseek (ifp, base+data, SEEK_SET);
switch (tag) {
case 0x100: flip = "0653"[data & 3]-'0'; break;
case 0x106:
for (i=0; i < 3; i++)
for (j=0; j < 3; j++)
romm_cam[i][j] = getreal(11);
romm_coeff (romm_cam);
break;
case 0x107:
FORC3 cam_mul[c] = getreal(11);
break;
case 0x108: raw_width = data; break;
case 0x109: raw_height = data; break;
case 0x10a: left_margin = data; break;
case 0x10b: top_margin = data; break;
case 0x10c: width = data; break;
case 0x10d: height = data; break;
case 0x10e: ph1.format = data; break;
case 0x10f: data_offset = data+base; break;
case 0x110: meta_offset = data+base;
meta_length = len; break;
case 0x112: ph1.key_off = save - 4; break;
case 0x210: ph1.tag_210 = int_to_float(data); break;
case 0x21a: ph1.tag_21a = data; break;
case 0x21c: strip_offset = data+base; break;
case 0x21d: ph1.black = data; break;
case 0x222: ph1.split_col = data - left_margin; break;
case 0x223: ph1.black_off = data+base; break;
case 0x301:
model[63] = 0;
fread (model, 1, 63, ifp);
if ((cp = strstr(model," camera"))) *cp = 0;
}
fseek (ifp, save, SEEK_SET);
}
load_raw = ph1.format < 3 ?
&CLASS phase_one_load_raw : &CLASS phase_one_load_raw_c;
maximum = 0xffff;
strcpy (make, "Phase One");
if (model[0]) return;
switch (raw_height) {
case 2060: strcpy (model,"LightPhase"); break;
case 2682: strcpy (model,"H 10"); break;
case 4128: strcpy (model,"H 20"); break;
case 5488: strcpy (model,"H 25"); break;
}
}
| 16,336 |
96,892 | 0 | int splice_grow_spd(const struct pipe_inode_info *pipe, struct splice_pipe_desc *spd)
{
unsigned int buffers = READ_ONCE(pipe->buffers);
spd->nr_pages_max = buffers;
if (buffers <= PIPE_DEF_BUFFERS)
return 0;
spd->pages = kmalloc_array(buffers, sizeof(struct page *), GFP_KERNEL);
spd->partial = kmalloc_array(buffers, sizeof(struct partial_page),
GFP_KERNEL);
if (spd->pages && spd->partial)
return 0;
kfree(spd->pages);
kfree(spd->partial);
return -ENOMEM;
}
| 16,337 |
154,786 | 0 | error::Error GLES2DecoderPassthroughImpl::DoScheduleCALayerCHROMIUM(
GLuint contents_texture_id,
const GLfloat* contents_rect,
GLuint background_color,
GLuint edge_aa_mask,
const GLfloat* bounds_rect) {
NOTIMPLEMENTED();
return error::kNoError;
}
| 16,338 |
154,703 | 0 | error::Error GLES2DecoderPassthroughImpl::DoGetSamplerParameterfv(
GLuint sampler,
GLenum pname,
GLsizei bufsize,
GLsizei* length,
GLfloat* params) {
api()->glGetSamplerParameterfvRobustANGLEFn(
GetSamplerServiceID(sampler, resources_), pname, bufsize, length, params);
return error::kNoError;
}
| 16,339 |
133,599 | 0 | void WebContentsImpl::OnEnumerateDirectory(int request_id,
const base::FilePath& path) {
if (!delegate_)
return;
ChildProcessSecurityPolicyImpl* policy =
ChildProcessSecurityPolicyImpl::GetInstance();
if (policy->CanReadFile(GetRenderProcessHost()->GetID(), path))
delegate_->EnumerateDirectory(this, request_id, path);
}
| 16,340 |
5,404 | 0 | static void Ins_LTEQ( INS_ARG )
{ (void)exc;
if ( args[0] <= args[1] )
args[0] = 1;
else
args[0] = 0;
}
| 16,341 |
35,829 | 0 | static struct sctp_chunk *_sctp_make_chunk(const struct sctp_association *asoc,
__u8 type, __u8 flags, int paylen)
{
struct sctp_chunk *retval;
sctp_chunkhdr_t *chunk_hdr;
struct sk_buff *skb;
struct sock *sk;
/* No need to allocate LL here, as this is only a chunk. */
skb = alloc_skb(WORD_ROUND(sizeof(sctp_chunkhdr_t) + paylen),
GFP_ATOMIC);
if (!skb)
goto nodata;
/* Make room for the chunk header. */
chunk_hdr = (sctp_chunkhdr_t *)skb_put(skb, sizeof(sctp_chunkhdr_t));
chunk_hdr->type = type;
chunk_hdr->flags = flags;
chunk_hdr->length = htons(sizeof(sctp_chunkhdr_t));
sk = asoc ? asoc->base.sk : NULL;
retval = sctp_chunkify(skb, asoc, sk);
if (!retval) {
kfree_skb(skb);
goto nodata;
}
retval->chunk_hdr = chunk_hdr;
retval->chunk_end = ((__u8 *)chunk_hdr) + sizeof(struct sctp_chunkhdr);
/* Determine if the chunk needs to be authenticated */
if (sctp_auth_send_cid(type, asoc))
retval->auth = 1;
return retval;
nodata:
return NULL;
}
| 16,342 |
44,585 | 0 | int lxc_clear_environment(struct lxc_conf *c)
{
struct lxc_list *it,*next;
lxc_list_for_each_safe(it, &c->environment, next) {
lxc_list_del(it);
free(it->elem);
free(it);
}
return 0;
}
| 16,343 |
116,867 | 0 | size_t TestWebKitPlatformSupport::audioHardwareBufferSize() {
return 128;
}
| 16,344 |
167,188 | 0 | void HTMLMediaElement::enterPictureInPicture(
WebMediaPlayer::PipWindowSizeCallback callback) {
if (GetWebMediaPlayer())
GetWebMediaPlayer()->EnterPictureInPicture(std::move(callback));
}
| 16,345 |
15,399 | 0 | bdfPadToTerminal(FontPtr pFont)
{
BitmapFontPtr bitmapFont;
BitmapExtraPtr bitmapExtra;
int i;
int new_size;
CharInfoRec new;
int w,
h;
bitmapFont = (BitmapFontPtr) pFont->fontPrivate;
bzero(&new, sizeof(CharInfoRec));
new.metrics.ascent = pFont->info.fontAscent;
new.metrics.descent = pFont->info.fontDescent;
new.metrics.leftSideBearing = 0;
new.metrics.rightSideBearing = pFont->info.minbounds.characterWidth;
new.metrics.characterWidth = new.metrics.rightSideBearing;
new_size = BYTES_FOR_GLYPH(&new, pFont->glyph);
for (i = 0; i < bitmapFont->num_chars; i++) {
new.bits = malloc(new_size);
if (!new.bits) {
bdfError("Couldn't allocate bits (%d)\n", new_size);
return FALSE;
}
FontCharReshape(pFont, &bitmapFont->metrics[i], &new);
new.metrics.attributes = bitmapFont->metrics[i].metrics.attributes;
free(bitmapFont->metrics[i].bits);
bitmapFont->metrics[i] = new;
}
bitmapExtra = bitmapFont->bitmapExtra;
if (bitmapExtra) {
w = GLYPHWIDTHPIXELS(&new);
h = GLYPHHEIGHTPIXELS(&new);
for (i = 0; i < GLYPHPADOPTIONS; i++)
bitmapExtra->bitmapsSizes[i] = bitmapFont->num_chars *
(BYTES_PER_ROW(w, 1 << i) * h);
}
return TRUE;
}
| 16,346 |
162,662 | 0 | bool CanonicalizePort(const base::char16* spec,
const Component& port,
int default_port_for_scheme,
CanonOutput* output,
Component* out_port) {
return DoPort<base::char16, base::char16>(spec, port, default_port_for_scheme,
output, out_port);
}
| 16,347 |
110,040 | 0 | PassRefPtr<HTMLOptionsCollection> HTMLSelectElement::options()
{
return static_cast<HTMLOptionsCollection*>(ensureCachedHTMLCollection(SelectOptions).get());
}
| 16,348 |
83,583 | 0 | static BOOL update_send_cache_bitmap(rdpContext* context,
const CACHE_BITMAP_ORDER* cache_bitmap)
{
wStream* s;
size_t bm, em;
BYTE orderType;
int headerLength;
int inf;
UINT16 extraFlags;
INT16 orderLength;
rdpUpdate* update = context->update;
extraFlags = 0;
headerLength = 6;
orderType = cache_bitmap->compressed ?
ORDER_TYPE_CACHE_BITMAP_COMPRESSED : ORDER_TYPE_BITMAP_UNCOMPRESSED;
inf = update_approximate_cache_bitmap_order(cache_bitmap,
cache_bitmap->compressed,
&extraFlags);
update_check_flush(context, headerLength + inf);
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_order(s, cache_bitmap, cache_bitmap->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;
}
| 16,349 |
58,070 | 0 | static struct cuse_conn *fc_to_cc(struct fuse_conn *fc)
{
return container_of(fc, struct cuse_conn, fc);
}
| 16,350 |
81,349 | 0 | static int set_tracer_option(struct trace_array *tr, char *cmp, int neg)
{
struct tracer *trace = tr->current_trace;
struct tracer_flags *tracer_flags = trace->flags;
struct tracer_opt *opts = NULL;
int i;
for (i = 0; tracer_flags->opts[i].name; i++) {
opts = &tracer_flags->opts[i];
if (strcmp(cmp, opts->name) == 0)
return __set_tracer_option(tr, trace->flags, opts, neg);
}
return -EINVAL;
}
| 16,351 |
133,170 | 0 | void HWNDMessageHandler::SetSize(const gfx::Size& size) {
SetWindowPos(hwnd(), NULL, 0, 0, size.width(), size.height(),
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);
}
| 16,352 |
177,616 | 0 | int get_vp9_frame_buffer(void *user_priv, size_t min_size,
vpx_codec_frame_buffer_t *fb) {
ExternalFrameBufferList *const fb_list =
reinterpret_cast<ExternalFrameBufferList*>(user_priv);
return fb_list->GetFreeFrameBuffer(min_size, fb);
}
| 16,353 |
49,326 | 0 | static void fwnet_free_ptask(struct fwnet_packet_task *ptask)
{
dev_kfree_skb_any(ptask->skb);
kmem_cache_free(fwnet_packet_task_cache, ptask);
}
| 16,354 |
13,908 | 0 | void dtls1_reset_seq_numbers(SSL *s, int rw)
{
unsigned char *seq;
unsigned int seq_bytes = sizeof(s->rlayer.read_sequence);
if (rw & SSL3_CC_READ) {
seq = s->rlayer.read_sequence;
s->rlayer.d->r_epoch++;
memcpy(&s->rlayer.d->bitmap, &s->rlayer.d->next_bitmap,
sizeof(s->rlayer.d->bitmap));
memset(&s->rlayer.d->next_bitmap, 0, sizeof(s->rlayer.d->next_bitmap));
/*
* We must not use any buffered messages received from the previous
* epoch
*/
dtls1_clear_received_buffer(s);
} else {
seq = s->rlayer.write_sequence;
memcpy(s->rlayer.d->last_write_sequence, seq,
sizeof(s->rlayer.write_sequence));
s->rlayer.d->w_epoch++;
}
memset(seq, 0, seq_bytes);
}
| 16,355 |
186,915 | 1 | void CompileFromResponseCallback(
const v8::FunctionCallbackInfo<v8::Value>& args) {
ExceptionState exception_state(args.GetIsolate(),
ExceptionState::kExecutionContext,
"WebAssembly", "compile");
ExceptionToRejectPromiseScope reject_promise_scope(args, exception_state);
ScriptState* script_state = ScriptState::ForRelevantRealm(args);
if (!ExecutionContext::From(script_state)) {
V8SetReturnValue(args, ScriptPromise().V8Value());
return;
}
if (args.Length() < 1 || !args[0]->IsObject() ||
!V8Response::hasInstance(args[0], args.GetIsolate())) {
V8SetReturnValue(
args,
ScriptPromise::Reject(
script_state, V8ThrowException::CreateTypeError(
script_state->GetIsolate(),
"An argument must be provided, which must be a"
"Response or Promise<Response> object"))
.V8Value());
return;
}
Response* response = V8Response::ToImpl(v8::Local<v8::Object>::Cast(args[0]));
if (response->MimeType() != "application/wasm") {
V8SetReturnValue(
args,
ScriptPromise::Reject(
script_state,
V8ThrowException::CreateTypeError(
script_state->GetIsolate(),
"Incorrect response MIME type. Expected 'application/wasm'."))
.V8Value());
return;
}
v8::Local<v8::Value> promise;
if (response->IsBodyLocked() || response->bodyUsed()) {
promise = ScriptPromise::Reject(script_state,
V8ThrowException::CreateTypeError(
script_state->GetIsolate(),
"Cannot compile WebAssembly.Module "
"from an already read Response"))
.V8Value();
} else {
if (response->BodyBuffer()) {
FetchDataLoaderAsWasmModule* loader =
new FetchDataLoaderAsWasmModule(script_state);
promise = loader->GetPromise();
response->BodyBuffer()->StartLoading(loader, new WasmDataLoaderClient());
} else {
promise = ScriptPromise::Reject(script_state,
V8ThrowException::CreateTypeError(
script_state->GetIsolate(),
"Response object has a null body."))
.V8Value();
}
}
V8SetReturnValue(args, promise);
}
| 16,356 |
13,571 | 0 | static HB_Error Load_ChainContextPos3( HB_ChainContextPosFormat3* ccpf3,
HB_Stream stream )
{
HB_Error error;
HB_UShort n, nb, ni, nl, m, count;
HB_UShort backtrack_count, input_count, lookahead_count;
HB_UInt cur_offset, new_offset, base_offset;
HB_Coverage* b;
HB_Coverage* i;
HB_Coverage* l;
HB_PosLookupRecord* plr;
base_offset = FILE_Pos() - 2L;
if ( ACCESS_Frame( 2L ) )
return error;
ccpf3->BacktrackGlyphCount = GET_UShort();
FORGET_Frame();
ccpf3->BacktrackCoverage = NULL;
backtrack_count = ccpf3->BacktrackGlyphCount;
if ( ALLOC_ARRAY( ccpf3->BacktrackCoverage, backtrack_count,
HB_Coverage ) )
return error;
b = ccpf3->BacktrackCoverage;
for ( nb = 0; nb < backtrack_count; nb++ )
{
if ( ACCESS_Frame( 2L ) )
goto Fail4;
new_offset = GET_UShort() + base_offset;
FORGET_Frame();
cur_offset = FILE_Pos();
if ( FILE_Seek( new_offset ) ||
( error = _HB_OPEN_Load_Coverage( &b[nb], stream ) ) != HB_Err_Ok )
goto Fail4;
(void)FILE_Seek( cur_offset );
}
if ( ACCESS_Frame( 2L ) )
goto Fail4;
ccpf3->InputGlyphCount = GET_UShort();
FORGET_Frame();
ccpf3->InputCoverage = NULL;
input_count = ccpf3->InputGlyphCount;
if ( ALLOC_ARRAY( ccpf3->InputCoverage, input_count, HB_Coverage ) )
goto Fail4;
i = ccpf3->InputCoverage;
for ( ni = 0; ni < input_count; ni++ )
{
if ( ACCESS_Frame( 2L ) )
goto Fail3;
new_offset = GET_UShort() + base_offset;
FORGET_Frame();
cur_offset = FILE_Pos();
if ( FILE_Seek( new_offset ) ||
( error = _HB_OPEN_Load_Coverage( &i[ni], stream ) ) != HB_Err_Ok )
goto Fail3;
(void)FILE_Seek( cur_offset );
}
if ( ACCESS_Frame( 2L ) )
goto Fail3;
ccpf3->LookaheadGlyphCount = GET_UShort();
FORGET_Frame();
ccpf3->LookaheadCoverage = NULL;
lookahead_count = ccpf3->LookaheadGlyphCount;
if ( ALLOC_ARRAY( ccpf3->LookaheadCoverage, lookahead_count,
HB_Coverage ) )
goto Fail3;
l = ccpf3->LookaheadCoverage;
for ( nl = 0; nl < lookahead_count; nl++ )
{
if ( ACCESS_Frame( 2L ) )
goto Fail2;
new_offset = GET_UShort() + base_offset;
FORGET_Frame();
cur_offset = FILE_Pos();
if ( FILE_Seek( new_offset ) ||
( error = _HB_OPEN_Load_Coverage( &l[nl], stream ) ) != HB_Err_Ok )
goto Fail2;
(void)FILE_Seek( cur_offset );
}
if ( ACCESS_Frame( 2L ) )
goto Fail2;
ccpf3->PosCount = GET_UShort();
FORGET_Frame();
ccpf3->PosLookupRecord = NULL;
count = ccpf3->PosCount;
if ( ALLOC_ARRAY( ccpf3->PosLookupRecord, count, HB_PosLookupRecord ) )
goto Fail2;
plr = ccpf3->PosLookupRecord;
if ( ACCESS_Frame( count * 4L ) )
goto Fail1;
for ( n = 0; n < count; n++ )
{
plr[n].SequenceIndex = GET_UShort();
plr[n].LookupListIndex = GET_UShort();
}
FORGET_Frame();
return HB_Err_Ok;
Fail1:
FREE( plr );
Fail2:
for ( m = 0; m < nl; m++ )
_HB_OPEN_Free_Coverage( &l[m] );
FREE( l );
Fail3:
for ( m = 0; m < ni; m++ )
_HB_OPEN_Free_Coverage( &i[m] );
FREE( i );
Fail4:
for ( m = 0; m < nb; m++ )
_HB_OPEN_Free_Coverage( &b[m] );
FREE( b );
return error;
}
| 16,357 |
62,332 | 0 | print_lcp_config_options(netdissect_options *ndo,
const u_char *p, int length)
{
int len, opt;
if (length < 2)
return 0;
ND_TCHECK2(*p, 2);
len = p[1];
opt = p[0];
if (length < len)
return 0;
if (len < 2) {
if ((opt >= LCPOPT_MIN) && (opt <= LCPOPT_MAX))
ND_PRINT((ndo, "\n\t %s Option (0x%02x), length %u (length bogus, should be >= 2)",
lcpconfopts[opt], opt, len));
else
ND_PRINT((ndo, "\n\tunknown LCP option 0x%02x", opt));
return 0;
}
if ((opt >= LCPOPT_MIN) && (opt <= LCPOPT_MAX))
ND_PRINT((ndo, "\n\t %s Option (0x%02x), length %u", lcpconfopts[opt], opt, len));
else {
ND_PRINT((ndo, "\n\tunknown LCP option 0x%02x", opt));
return len;
}
switch (opt) {
case LCPOPT_VEXT:
if (len < 6) {
ND_PRINT((ndo, " (length bogus, should be >= 6)"));
return len;
}
ND_TCHECK_24BITS(p + 2);
ND_PRINT((ndo, ": Vendor: %s (%u)",
tok2str(oui_values,"Unknown",EXTRACT_24BITS(p+2)),
EXTRACT_24BITS(p + 2)));
#if 0
ND_TCHECK(p[5]);
ND_PRINT((ndo, ", kind: 0x%02x", p[5]));
ND_PRINT((ndo, ", Value: 0x"));
for (i = 0; i < len - 6; i++) {
ND_TCHECK(p[6 + i]);
ND_PRINT((ndo, "%02x", p[6 + i]));
}
#endif
break;
case LCPOPT_MRU:
if (len != 4) {
ND_PRINT((ndo, " (length bogus, should be = 4)"));
return len;
}
ND_TCHECK_16BITS(p + 2);
ND_PRINT((ndo, ": %u", EXTRACT_16BITS(p + 2)));
break;
case LCPOPT_ACCM:
if (len != 6) {
ND_PRINT((ndo, " (length bogus, should be = 6)"));
return len;
}
ND_TCHECK_32BITS(p + 2);
ND_PRINT((ndo, ": 0x%08x", EXTRACT_32BITS(p + 2)));
break;
case LCPOPT_AP:
if (len < 4) {
ND_PRINT((ndo, " (length bogus, should be >= 4)"));
return len;
}
ND_TCHECK_16BITS(p + 2);
ND_PRINT((ndo, ": %s", tok2str(ppptype2str, "Unknown Auth Proto (0x04x)", EXTRACT_16BITS(p + 2))));
switch (EXTRACT_16BITS(p+2)) {
case PPP_CHAP:
ND_TCHECK(p[4]);
ND_PRINT((ndo, ", %s", tok2str(authalg_values, "Unknown Auth Alg %u", p[4])));
break;
case PPP_PAP: /* fall through */
case PPP_EAP:
case PPP_SPAP:
case PPP_SPAP_OLD:
break;
default:
print_unknown_data(ndo, p, "\n\t", len);
}
break;
case LCPOPT_QP:
if (len < 4) {
ND_PRINT((ndo, " (length bogus, should be >= 4)"));
return 0;
}
ND_TCHECK_16BITS(p+2);
if (EXTRACT_16BITS(p+2) == PPP_LQM)
ND_PRINT((ndo, ": LQR"));
else
ND_PRINT((ndo, ": unknown"));
break;
case LCPOPT_MN:
if (len != 6) {
ND_PRINT((ndo, " (length bogus, should be = 6)"));
return 0;
}
ND_TCHECK_32BITS(p + 2);
ND_PRINT((ndo, ": 0x%08x", EXTRACT_32BITS(p + 2)));
break;
case LCPOPT_PFC:
break;
case LCPOPT_ACFC:
break;
case LCPOPT_LD:
if (len != 4) {
ND_PRINT((ndo, " (length bogus, should be = 4)"));
return 0;
}
ND_TCHECK_16BITS(p + 2);
ND_PRINT((ndo, ": 0x%04x", EXTRACT_16BITS(p + 2)));
break;
case LCPOPT_CBACK:
if (len < 3) {
ND_PRINT((ndo, " (length bogus, should be >= 3)"));
return 0;
}
ND_PRINT((ndo, ": "));
ND_TCHECK(p[2]);
ND_PRINT((ndo, ": Callback Operation %s (%u)",
tok2str(ppp_callback_values, "Unknown", p[2]),
p[2]));
break;
case LCPOPT_MLMRRU:
if (len != 4) {
ND_PRINT((ndo, " (length bogus, should be = 4)"));
return 0;
}
ND_TCHECK_16BITS(p + 2);
ND_PRINT((ndo, ": %u", EXTRACT_16BITS(p + 2)));
break;
case LCPOPT_MLED:
if (len < 3) {
ND_PRINT((ndo, " (length bogus, should be >= 3)"));
return 0;
}
ND_TCHECK(p[2]);
switch (p[2]) { /* class */
case MEDCLASS_NULL:
ND_PRINT((ndo, ": Null"));
break;
case MEDCLASS_LOCAL:
ND_PRINT((ndo, ": Local")); /* XXX */
break;
case MEDCLASS_IPV4:
if (len != 7) {
ND_PRINT((ndo, " (length bogus, should be = 7)"));
return 0;
}
ND_TCHECK2(*(p + 3), 4);
ND_PRINT((ndo, ": IPv4 %s", ipaddr_string(ndo, p + 3)));
break;
case MEDCLASS_MAC:
if (len != 9) {
ND_PRINT((ndo, " (length bogus, should be = 9)"));
return 0;
}
ND_TCHECK2(*(p + 3), 6);
ND_PRINT((ndo, ": MAC %s", etheraddr_string(ndo, p + 3)));
break;
case MEDCLASS_MNB:
ND_PRINT((ndo, ": Magic-Num-Block")); /* XXX */
break;
case MEDCLASS_PSNDN:
ND_PRINT((ndo, ": PSNDN")); /* XXX */
break;
default:
ND_PRINT((ndo, ": Unknown class %u", p[2]));
break;
}
break;
/* XXX: to be supported */
#if 0
case LCPOPT_DEP6:
case LCPOPT_FCSALT:
case LCPOPT_SDP:
case LCPOPT_NUMMODE:
case LCPOPT_DEP12:
case LCPOPT_DEP14:
case LCPOPT_DEP15:
case LCPOPT_DEP16:
case LCPOPT_MLSSNHF:
case LCPOPT_PROP:
case LCPOPT_DCEID:
case LCPOPT_MPP:
case LCPOPT_LCPAOPT:
case LCPOPT_COBS:
case LCPOPT_PE:
case LCPOPT_MLHF:
case LCPOPT_I18N:
case LCPOPT_SDLOS:
case LCPOPT_PPPMUX:
break;
#endif
default:
/*
* Unknown option; dump it as raw bytes now if we're
* not going to do so below.
*/
if (ndo->ndo_vflag < 2)
print_unknown_data(ndo, &p[2], "\n\t ", len - 2);
break;
}
if (ndo->ndo_vflag > 1)
print_unknown_data(ndo, &p[2], "\n\t ", len - 2); /* exclude TLV header */
return len;
trunc:
ND_PRINT((ndo, "[|lcp]"));
return 0;
}
| 16,358 |
45,375 | 0 | static inline void tree_mod_log_write_unlock(struct btrfs_fs_info *fs_info)
{
write_unlock(&fs_info->tree_mod_log_lock);
}
| 16,359 |
156,089 | 0 | bool StartsWithCommandLineGoogleBaseURL(const GURL& url) {
const GURL& base_url(CommandLineGoogleBaseURL());
return base_url.is_valid() &&
base::StartsWith(url.possibly_invalid_spec(), base_url.spec(),
base::CompareCase::SENSITIVE);
}
| 16,360 |
21,980 | 0 | raptor_libxml_validation_warning(void* user_data, const char *msg, ...)
{
va_list args;
raptor_sax2* sax2 = (raptor_sax2*)user_data;
int prefix_length = RAPTOR_GOOD_CAST(int, strlen(xml_validation_warning_prefix));
int length;
char *nmsg;
int msg_len;
va_start(args, msg);
raptor_libxml_update_document_locator(sax2, sax2->locator);
msg_len = RAPTOR_BAD_CAST(int, strlen(msg));
length = prefix_length + msg_len + 1;
nmsg = RAPTOR_MALLOC(char*, length);
if(nmsg) {
memcpy(nmsg, xml_validation_warning_prefix, prefix_length); /* Do not copy NUL */
memcpy(nmsg + prefix_length, msg, msg_len + 1); /* Copy NUL */
if(nmsg[length-2] == '\n')
nmsg[length-2]='\0';
}
raptor_log_error_varargs(sax2->world,
RAPTOR_LOG_LEVEL_WARN,
sax2->locator,
nmsg ? nmsg : msg,
args);
if(nmsg)
RAPTOR_FREE(char*, nmsg);
va_end(args);
}
| 16,361 |
164,489 | 0 | static int bindText(
sqlite3_stmt *pStmt, /* The statement to bind against */
int i, /* Index of the parameter to bind */
const void *zData, /* Pointer to the data to be bound */
int nData, /* Number of bytes of data to be bound */
void (*xDel)(void*), /* Destructor for the data */
u8 encoding /* Encoding for the data */
){
Vdbe *p = (Vdbe *)pStmt;
Mem *pVar;
int rc;
rc = vdbeUnbind(p, i);
if( rc==SQLITE_OK ){
if( zData!=0 ){
pVar = &p->aVar[i-1];
rc = sqlite3VdbeMemSetStr(pVar, zData, nData, encoding, xDel);
if( rc==SQLITE_OK && encoding!=0 ){
rc = sqlite3VdbeChangeEncoding(pVar, ENC(p->db));
}
if( rc ){
sqlite3Error(p->db, rc);
rc = sqlite3ApiExit(p->db, rc);
}
}
sqlite3_mutex_leave(p->db->mutex);
}else if( xDel!=SQLITE_STATIC && xDel!=SQLITE_TRANSIENT ){
xDel((void*)zData);
}
return rc;
}
| 16,362 |
149,228 | 0 | HTMLFormControlElement::HTMLFormControlElement(const QualifiedName& tag_name,
Document& document)
: HTMLElement(tag_name, document),
autofill_state_(WebAutofillState::kNotFilled),
blocks_form_submission_(false) {
SetHasCustomStyleCallbacks();
static unsigned next_free_unique_id = 0;
unique_renderer_form_control_id_ = next_free_unique_id++;
}
| 16,363 |
163,569 | 0 | htmlAutoClose(htmlParserCtxtPtr ctxt, const xmlChar * newtag)
{
while ((newtag != NULL) && (ctxt->name != NULL) &&
(htmlCheckAutoClose(newtag, ctxt->name))) {
if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
ctxt->sax->endElement(ctxt->userData, ctxt->name);
htmlnamePop(ctxt);
}
if (newtag == NULL) {
htmlAutoCloseOnEnd(ctxt);
return;
}
while ((newtag == NULL) && (ctxt->name != NULL) &&
((xmlStrEqual(ctxt->name, BAD_CAST "head")) ||
(xmlStrEqual(ctxt->name, BAD_CAST "body")) ||
(xmlStrEqual(ctxt->name, BAD_CAST "html")))) {
if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
ctxt->sax->endElement(ctxt->userData, ctxt->name);
htmlnamePop(ctxt);
}
}
| 16,364 |
140,891 | 0 | DEFINE_INLINE_TRACE() { visitor->trace(m_PresentationConnection); }
| 16,365 |
123,491 | 0 | void SafeBrowsingBlockingPageV2::PopulateMultipleThreatStringDictionary(
DictionaryValue* strings) {
NOTREACHED();
}
| 16,366 |
46,977 | 0 | static int ghash_async_init_tfm(struct crypto_tfm *tfm)
{
struct cryptd_ahash *cryptd_tfm;
struct ghash_async_ctx *ctx = crypto_tfm_ctx(tfm);
cryptd_tfm = cryptd_alloc_ahash("__ghash-pclmulqdqni", 0, 0);
if (IS_ERR(cryptd_tfm))
return PTR_ERR(cryptd_tfm);
ctx->cryptd_tfm = cryptd_tfm;
crypto_ahash_set_reqsize(__crypto_ahash_cast(tfm),
sizeof(struct ahash_request) +
crypto_ahash_reqsize(&cryptd_tfm->base));
return 0;
}
| 16,367 |
54,023 | 0 | static ssize_t ims_pcu_ofn_reg_data_store(struct device *dev,
struct device_attribute *dattr,
const char *buf, size_t count)
{
struct usb_interface *intf = to_usb_interface(dev);
struct ims_pcu *pcu = usb_get_intfdata(intf);
int error;
u8 value;
error = kstrtou8(buf, 0, &value);
if (error)
return error;
mutex_lock(&pcu->cmd_mutex);
error = ims_pcu_write_ofn_config(pcu, pcu->ofn_reg_addr, value);
mutex_unlock(&pcu->cmd_mutex);
return error ?: count;
}
| 16,368 |
171,464 | 0 | size_t ASessionDescription::countTracks() const {
return mTracks.size();
}
| 16,369 |
98,452 | 0 | void SearchProviderTest::SetUp() {
SearchProvider::set_query_suggest_immediately(true);
profile_.CreateHistoryService(true, false);
profile_.CreateTemplateURLModel();
TemplateURLModel* turl_model = profile_.GetTemplateURLModel();
default_t_url_ = new TemplateURL();
default_t_url_->SetURL("http://defaultturl/{searchTerms}", 0, 0);
default_t_url_->SetSuggestionsURL("http://defaultturl2/{searchTerms}", 0, 0);
turl_model->Add(default_t_url_);
turl_model->SetDefaultSearchProvider(default_t_url_);
TemplateURL::IDType default_provider_id = default_t_url_->id();
ASSERT_NE(0, default_provider_id);
HistoryService* history =
profile_.GetHistoryService(Profile::EXPLICIT_ACCESS);
term1_url_ = GURL(default_t_url_->url()->ReplaceSearchTerms(
*default_t_url_, UTF16ToWide(term1_), 0, std::wstring()));
history->AddPageWithDetails(term1_url_, string16(), 1, 1,
base::Time::Now(), false);
history->SetKeywordSearchTermsForURL(term1_url_, default_t_url_->id(),
term1_);
keyword_t_url_ = new TemplateURL();
keyword_t_url_->set_keyword(L"k");
keyword_t_url_->SetURL("http://keyword/{searchTerms}", 0, 0);
keyword_t_url_->SetSuggestionsURL("http://suggest_keyword/{searchTerms}", 0,
0);
profile_.GetTemplateURLModel()->Add(keyword_t_url_);
ASSERT_NE(0, keyword_t_url_->id());
keyword_url_ = GURL(keyword_t_url_->url()->ReplaceSearchTerms(
*keyword_t_url_, UTF16ToWide(keyword_term_), 0, std::wstring()));
history->AddPageWithDetails(keyword_url_, string16(), 1, 1,
base::Time::Now(), false);
history->SetKeywordSearchTermsForURL(keyword_url_, keyword_t_url_->id(),
keyword_term_);
provider_ = new SearchProvider(this, &profile_);
URLFetcher::set_factory(&test_factory_);
}
| 16,370 |
135,042 | 0 | AppCacheBackendImpl::AppCacheBackendImpl()
: service_(NULL),
frontend_(NULL),
process_id_(0) {
}
| 16,371 |
183,256 | 1 | void *Sys_LoadDll(const char *name, qboolean useSystemLib)
{
void *dllhandle;
if(useSystemLib)
Com_Printf("Trying to load \"%s\"...\n", name);
if(!useSystemLib || !(dllhandle = Sys_LoadLibrary(name)))
{
const char *topDir;
char libPath[MAX_OSPATH];
topDir = Sys_BinaryPath();
if(!*topDir)
topDir = ".";
Com_Printf("Trying to load \"%s\" from \"%s\"...\n", name, topDir);
Com_sprintf(libPath, sizeof(libPath), "%s%c%s", topDir, PATH_SEP, name);
if(!(dllhandle = Sys_LoadLibrary(libPath)))
{
const char *basePath = Cvar_VariableString("fs_basepath");
if(!basePath || !*basePath)
basePath = ".";
if(FS_FilenameCompare(topDir, basePath))
{
Com_Printf("Trying to load \"%s\" from \"%s\"...\n", name, basePath);
Com_sprintf(libPath, sizeof(libPath), "%s%c%s", basePath, PATH_SEP, name);
dllhandle = Sys_LoadLibrary(libPath);
}
if(!dllhandle)
Com_Printf("Loading \"%s\" failed\n", name);
}
}
return dllhandle;
}
| 16,372 |
154,261 | 0 | error::Error GLES2DecoderImpl::HandlePathCommandsCHROMIUM(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
static const char kFunctionName[] = "glPathCommandsCHROMIUM";
const volatile gles2::cmds::PathCommandsCHROMIUM& c =
*static_cast<const volatile gles2::cmds::PathCommandsCHROMIUM*>(cmd_data);
if (!features().chromium_path_rendering)
return error::kUnknownCommand;
GLuint service_id = 0;
if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) {
LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName,
"invalid path name");
return error::kNoError;
}
GLsizei num_commands = static_cast<GLsizei>(c.numCommands);
if (num_commands < 0) {
LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "numCommands < 0");
return error::kNoError;
}
GLsizei num_coords = static_cast<uint32_t>(c.numCoords);
if (num_coords < 0) {
LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "numCoords < 0");
return error::kNoError;
}
GLenum coord_type = static_cast<uint32_t>(c.coordType);
if (!validators_->path_coord_type.IsValid(static_cast<GLint>(coord_type))) {
LOCAL_SET_GL_ERROR(GL_INVALID_ENUM, kFunctionName, "invalid coordType");
return error::kNoError;
}
std::unique_ptr<GLubyte[]> commands;
base::CheckedNumeric<GLsizei> num_coords_expected = 0;
if (num_commands > 0) {
uint32_t commands_shm_id = static_cast<uint32_t>(c.commands_shm_id);
uint32_t commands_shm_offset = static_cast<uint32_t>(c.commands_shm_offset);
if (commands_shm_id != 0 || commands_shm_offset != 0) {
const GLubyte* shared_commands = GetSharedMemoryAs<const GLubyte*>(
commands_shm_id, commands_shm_offset, num_commands);
if (shared_commands) {
commands.reset(new GLubyte[num_commands]);
memcpy(commands.get(), shared_commands, num_commands);
}
}
if (!commands)
return error::kOutOfBounds;
for (GLsizei i = 0; i < num_commands; ++i) {
switch (commands[i]) {
case GL_CLOSE_PATH_CHROMIUM:
break;
case GL_MOVE_TO_CHROMIUM:
case GL_LINE_TO_CHROMIUM:
num_coords_expected += 2;
break;
case GL_QUADRATIC_CURVE_TO_CHROMIUM:
num_coords_expected += 4;
break;
case GL_CUBIC_CURVE_TO_CHROMIUM:
num_coords_expected += 6;
break;
case GL_CONIC_CURVE_TO_CHROMIUM:
num_coords_expected += 5;
break;
default:
LOCAL_SET_GL_ERROR(GL_INVALID_ENUM, kFunctionName, "invalid command");
return error::kNoError;
}
}
}
if (!num_coords_expected.IsValid() ||
num_coords != num_coords_expected.ValueOrDefault(0)) {
LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName,
"numCoords does not match commands");
return error::kNoError;
}
const void* coords = nullptr;
if (num_coords > 0) {
uint32_t coords_size = 0;
uint32_t coord_type_size =
GLES2Util::GetGLTypeSizeForPathCoordType(coord_type);
if (!base::CheckMul(num_coords, coord_type_size)
.AssignIfValid(&coords_size))
return error::kOutOfBounds;
uint32_t coords_shm_id = static_cast<uint32_t>(c.coords_shm_id);
uint32_t coords_shm_offset = static_cast<uint32_t>(c.coords_shm_offset);
if (coords_shm_id != 0 || coords_shm_offset != 0)
coords = GetSharedMemoryAs<const void*>(coords_shm_id, coords_shm_offset,
coords_size);
if (!coords)
return error::kOutOfBounds;
}
api()->glPathCommandsNVFn(service_id, num_commands, commands.get(),
num_coords, coord_type, coords);
return error::kNoError;
}
| 16,373 |
20,808 | 0 | void kvm_requeue_exception(struct kvm_vcpu *vcpu, unsigned nr)
{
kvm_multiple_exception(vcpu, nr, false, 0, true);
}
| 16,374 |
26,568 | 0 | static int packet_recv_error(struct sock *sk, struct msghdr *msg, int len)
{
struct sock_exterr_skb *serr;
struct sk_buff *skb, *skb2;
int copied, err;
err = -EAGAIN;
skb = skb_dequeue(&sk->sk_error_queue);
if (skb == NULL)
goto out;
copied = skb->len;
if (copied > len) {
msg->msg_flags |= MSG_TRUNC;
copied = len;
}
err = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied);
if (err)
goto out_free_skb;
sock_recv_timestamp(msg, sk, skb);
serr = SKB_EXT_ERR(skb);
put_cmsg(msg, SOL_PACKET, PACKET_TX_TIMESTAMP,
sizeof(serr->ee), &serr->ee);
msg->msg_flags |= MSG_ERRQUEUE;
err = copied;
/* Reset and regenerate socket error */
spin_lock_bh(&sk->sk_error_queue.lock);
sk->sk_err = 0;
if ((skb2 = skb_peek(&sk->sk_error_queue)) != NULL) {
sk->sk_err = SKB_EXT_ERR(skb2)->ee.ee_errno;
spin_unlock_bh(&sk->sk_error_queue.lock);
sk->sk_error_report(sk);
} else
spin_unlock_bh(&sk->sk_error_queue.lock);
out_free_skb:
kfree_skb(skb);
out:
return err;
}
| 16,375 |
34,705 | 0 | int __init br_netfilter_init(void)
{
int ret;
ret = dst_entries_init(&fake_dst_ops);
if (ret < 0)
return ret;
ret = nf_register_hooks(br_nf_ops, ARRAY_SIZE(br_nf_ops));
if (ret < 0) {
dst_entries_destroy(&fake_dst_ops);
return ret;
}
#ifdef CONFIG_SYSCTL
brnf_sysctl_header = register_sysctl_paths(brnf_path, brnf_table);
if (brnf_sysctl_header == NULL) {
printk(KERN_WARNING
"br_netfilter: can't register to sysctl.\n");
nf_unregister_hooks(br_nf_ops, ARRAY_SIZE(br_nf_ops));
dst_entries_destroy(&fake_dst_ops);
return -ENOMEM;
}
#endif
printk(KERN_NOTICE "Bridge firewalling registered\n");
return 0;
}
| 16,376 |
90,671 | 0 | static const char *checkstring(js_State *J, int idx)
{
if (!js_iscoercible(J, idx))
js_typeerror(J, "string function called on null or undefined");
return js_tostring(J, idx);
}
| 16,377 |
153,778 | 0 | void GLES2Implementation::OnGpuControlErrorMessage(const char* message,
int32_t id) {
SendErrorMessage(message, id);
}
| 16,378 |
75,585 | 0 | static void hwahc_op_endpoint_disable(struct usb_hcd *usb_hcd,
struct usb_host_endpoint *ep)
{
struct wusbhc *wusbhc = usb_hcd_to_wusbhc(usb_hcd);
struct hwahc *hwahc = container_of(wusbhc, struct hwahc, wusbhc);
rpipe_ep_disable(&hwahc->wa, ep);
}
| 16,379 |
65,167 | 0 | static void sctp_v6_get_dst(struct sctp_transport *t, union sctp_addr *saddr,
struct flowi *fl, struct sock *sk)
{
struct sctp_association *asoc = t->asoc;
struct dst_entry *dst = NULL;
struct flowi6 *fl6 = &fl->u.ip6;
struct sctp_bind_addr *bp;
struct ipv6_pinfo *np = inet6_sk(sk);
struct sctp_sockaddr_entry *laddr;
union sctp_addr *daddr = &t->ipaddr;
union sctp_addr dst_saddr;
struct in6_addr *final_p, final;
__u8 matchlen = 0;
sctp_scope_t scope;
memset(fl6, 0, sizeof(struct flowi6));
fl6->daddr = daddr->v6.sin6_addr;
fl6->fl6_dport = daddr->v6.sin6_port;
fl6->flowi6_proto = IPPROTO_SCTP;
if (ipv6_addr_type(&daddr->v6.sin6_addr) & IPV6_ADDR_LINKLOCAL)
fl6->flowi6_oif = daddr->v6.sin6_scope_id;
pr_debug("%s: dst=%pI6 ", __func__, &fl6->daddr);
if (asoc)
fl6->fl6_sport = htons(asoc->base.bind_addr.port);
if (saddr) {
fl6->saddr = saddr->v6.sin6_addr;
fl6->fl6_sport = saddr->v6.sin6_port;
pr_debug("src=%pI6 - ", &fl6->saddr);
}
rcu_read_lock();
final_p = fl6_update_dst(fl6, rcu_dereference(np->opt), &final);
rcu_read_unlock();
dst = ip6_dst_lookup_flow(sk, fl6, final_p);
if (!asoc || saddr)
goto out;
bp = &asoc->base.bind_addr;
scope = sctp_scope(daddr);
/* ip6_dst_lookup has filled in the fl6->saddr for us. Check
* to see if we can use it.
*/
if (!IS_ERR(dst)) {
/* Walk through the bind address list and look for a bind
* address that matches the source address of the returned dst.
*/
sctp_v6_to_addr(&dst_saddr, &fl6->saddr, htons(bp->port));
rcu_read_lock();
list_for_each_entry_rcu(laddr, &bp->address_list, list) {
if (!laddr->valid || laddr->state == SCTP_ADDR_DEL ||
(laddr->state != SCTP_ADDR_SRC &&
!asoc->src_out_of_asoc_ok))
continue;
/* Do not compare against v4 addrs */
if ((laddr->a.sa.sa_family == AF_INET6) &&
(sctp_v6_cmp_addr(&dst_saddr, &laddr->a))) {
rcu_read_unlock();
goto out;
}
}
rcu_read_unlock();
/* None of the bound addresses match the source address of the
* dst. So release it.
*/
dst_release(dst);
dst = NULL;
}
/* Walk through the bind address list and try to get the
* best source address for a given destination.
*/
rcu_read_lock();
list_for_each_entry_rcu(laddr, &bp->address_list, list) {
struct dst_entry *bdst;
__u8 bmatchlen;
if (!laddr->valid ||
laddr->state != SCTP_ADDR_SRC ||
laddr->a.sa.sa_family != AF_INET6 ||
scope > sctp_scope(&laddr->a))
continue;
fl6->saddr = laddr->a.v6.sin6_addr;
fl6->fl6_sport = laddr->a.v6.sin6_port;
final_p = fl6_update_dst(fl6, rcu_dereference(np->opt), &final);
bdst = ip6_dst_lookup_flow(sk, fl6, final_p);
if (!IS_ERR(bdst) &&
ipv6_chk_addr(dev_net(bdst->dev),
&laddr->a.v6.sin6_addr, bdst->dev, 1)) {
if (!IS_ERR_OR_NULL(dst))
dst_release(dst);
dst = bdst;
break;
}
bmatchlen = sctp_v6_addr_match_len(daddr, &laddr->a);
if (matchlen > bmatchlen)
continue;
if (!IS_ERR_OR_NULL(dst))
dst_release(dst);
dst = bdst;
matchlen = bmatchlen;
}
rcu_read_unlock();
out:
if (!IS_ERR_OR_NULL(dst)) {
struct rt6_info *rt;
rt = (struct rt6_info *)dst;
t->dst = dst;
t->dst_cookie = rt6_get_cookie(rt);
pr_debug("rt6_dst:%pI6/%d rt6_src:%pI6\n",
&rt->rt6i_dst.addr, rt->rt6i_dst.plen,
&fl6->saddr);
} else {
t->dst = NULL;
pr_debug("no route\n");
}
}
| 16,380 |
128,396 | 0 | void RenderLayerScrollableArea::drawPlatformResizerImage(GraphicsContext* context, IntRect resizerCornerRect)
{
float deviceScaleFactor = blink::deviceScaleFactor(box().frame());
RefPtr<Image> resizeCornerImage;
IntSize cornerResizerSize;
if (deviceScaleFactor >= 2) {
DEFINE_STATIC_REF(Image, resizeCornerImageHiRes, (Image::loadPlatformResource("textAreaResizeCorner@2x")));
resizeCornerImage = resizeCornerImageHiRes;
cornerResizerSize = resizeCornerImage->size();
cornerResizerSize.scale(0.5f);
} else {
DEFINE_STATIC_REF(Image, resizeCornerImageLoRes, (Image::loadPlatformResource("textAreaResizeCorner")));
resizeCornerImage = resizeCornerImageLoRes;
cornerResizerSize = resizeCornerImage->size();
}
if (box().style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) {
context->save();
context->translate(resizerCornerRect.x() + cornerResizerSize.width(), resizerCornerRect.y() + resizerCornerRect.height() - cornerResizerSize.height());
context->scale(-1.0, 1.0);
context->drawImage(resizeCornerImage.get(), IntRect(IntPoint(), cornerResizerSize));
context->restore();
return;
}
IntRect imageRect(resizerCornerRect.maxXMaxYCorner() - cornerResizerSize, cornerResizerSize);
context->drawImage(resizeCornerImage.get(), imageRect);
}
| 16,381 |
144,073 | 0 | png_set_benign_errors(png_structp png_ptr, int allowed)
{
png_debug(1, "in png_set_benign_errors");
if (allowed)
png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN;
else
png_ptr->flags &= ~PNG_FLAG_BENIGN_ERRORS_WARN;
}
| 16,382 |
24,981 | 0 | int CIFSSMBRenameOpenFile(const int xid, struct cifs_tcon *pTcon,
int netfid, const char *target_name,
const struct nls_table *nls_codepage, int remap)
{
struct smb_com_transaction2_sfi_req *pSMB = NULL;
struct smb_com_transaction2_sfi_rsp *pSMBr = NULL;
struct set_file_rename *rename_info;
char *data_offset;
char dummy_string[30];
int rc = 0;
int bytes_returned = 0;
int len_of_str;
__u16 params, param_offset, offset, count, byte_count;
cFYI(1, "Rename to File by handle");
rc = smb_init(SMB_COM_TRANSACTION2, 15, pTcon, (void **) &pSMB,
(void **) &pSMBr);
if (rc)
return rc;
params = 6;
pSMB->MaxSetupCount = 0;
pSMB->Reserved = 0;
pSMB->Flags = 0;
pSMB->Timeout = 0;
pSMB->Reserved2 = 0;
param_offset = offsetof(struct smb_com_transaction2_sfi_req, Fid) - 4;
offset = param_offset + params;
data_offset = (char *) (&pSMB->hdr.Protocol) + offset;
rename_info = (struct set_file_rename *) data_offset;
pSMB->MaxParameterCount = cpu_to_le16(2);
pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB from sess */
pSMB->SetupCount = 1;
pSMB->Reserved3 = 0;
pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION);
byte_count = 3 /* pad */ + params;
pSMB->ParameterCount = cpu_to_le16(params);
pSMB->TotalParameterCount = pSMB->ParameterCount;
pSMB->ParameterOffset = cpu_to_le16(param_offset);
pSMB->DataOffset = cpu_to_le16(offset);
/* construct random name ".cifs_tmp<inodenum><mid>" */
rename_info->overwrite = cpu_to_le32(1);
rename_info->root_fid = 0;
/* unicode only call */
if (target_name == NULL) {
sprintf(dummy_string, "cifs%x", pSMB->hdr.Mid);
len_of_str = cifsConvertToUCS((__le16 *)rename_info->target_name,
dummy_string, 24, nls_codepage, remap);
} else {
len_of_str = cifsConvertToUCS((__le16 *)rename_info->target_name,
target_name, PATH_MAX, nls_codepage,
remap);
}
rename_info->target_name_len = cpu_to_le32(2 * len_of_str);
count = 12 /* sizeof(struct set_file_rename) */ + (2 * len_of_str);
byte_count += count;
pSMB->DataCount = cpu_to_le16(count);
pSMB->TotalDataCount = pSMB->DataCount;
pSMB->Fid = netfid;
pSMB->InformationLevel =
cpu_to_le16(SMB_SET_FILE_RENAME_INFORMATION);
pSMB->Reserved4 = 0;
inc_rfc1001_len(pSMB, byte_count);
pSMB->ByteCount = cpu_to_le16(byte_count);
rc = SendReceive(xid, pTcon->ses, (struct smb_hdr *) pSMB,
(struct smb_hdr *) pSMBr, &bytes_returned, 0);
cifs_stats_inc(&pTcon->num_t2renames);
if (rc)
cFYI(1, "Send error in Rename (by file handle) = %d", rc);
cifs_buf_release(pSMB);
/* Note: On -EAGAIN error only caller can retry on handle based calls
since file handle passed in no longer valid */
return rc;
}
| 16,383 |
50,953 | 0 | static struct mountpoint *lock_mount(struct path *path)
{
struct vfsmount *mnt;
struct dentry *dentry = path->dentry;
retry:
inode_lock(dentry->d_inode);
if (unlikely(cant_mount(dentry))) {
inode_unlock(dentry->d_inode);
return ERR_PTR(-ENOENT);
}
namespace_lock();
mnt = lookup_mnt(path);
if (likely(!mnt)) {
struct mountpoint *mp = lookup_mountpoint(dentry);
if (!mp)
mp = new_mountpoint(dentry);
if (IS_ERR(mp)) {
namespace_unlock();
inode_unlock(dentry->d_inode);
return mp;
}
return mp;
}
namespace_unlock();
inode_unlock(path->dentry->d_inode);
path_put(path);
path->mnt = mnt;
dentry = path->dentry = dget(mnt->mnt_root);
goto retry;
}
| 16,384 |
167,700 | 0 | void WebRuntimeFeatures::EnableDisplayCutoutAPI(bool enable) {
RuntimeEnabledFeatures::SetDisplayCutoutAPIEnabled(enable);
}
| 16,385 |
81,727 | 0 | void ff_init_block_index(MpegEncContext *s){ //FIXME maybe rename
const int linesize = s->current_picture.f->linesize[0]; //not s->linesize as this would be wrong for field pics
const int uvlinesize = s->current_picture.f->linesize[1];
const int width_of_mb = (4 + (s->avctx->bits_per_raw_sample > 8)) - s->avctx->lowres;
const int height_of_mb = 4 - s->avctx->lowres;
s->block_index[0]= s->b8_stride*(s->mb_y*2 ) - 2 + s->mb_x*2;
s->block_index[1]= s->b8_stride*(s->mb_y*2 ) - 1 + s->mb_x*2;
s->block_index[2]= s->b8_stride*(s->mb_y*2 + 1) - 2 + s->mb_x*2;
s->block_index[3]= s->b8_stride*(s->mb_y*2 + 1) - 1 + s->mb_x*2;
s->block_index[4]= s->mb_stride*(s->mb_y + 1) + s->b8_stride*s->mb_height*2 + s->mb_x - 1;
s->block_index[5]= s->mb_stride*(s->mb_y + s->mb_height + 2) + s->b8_stride*s->mb_height*2 + s->mb_x - 1;
s->dest[0] = s->current_picture.f->data[0] + (int)((s->mb_x - 1U) << width_of_mb);
s->dest[1] = s->current_picture.f->data[1] + (int)((s->mb_x - 1U) << (width_of_mb - s->chroma_x_shift));
s->dest[2] = s->current_picture.f->data[2] + (int)((s->mb_x - 1U) << (width_of_mb - s->chroma_x_shift));
if(!(s->pict_type==AV_PICTURE_TYPE_B && s->avctx->draw_horiz_band && s->picture_structure==PICT_FRAME))
{
if(s->picture_structure==PICT_FRAME){
s->dest[0] += s->mb_y * linesize << height_of_mb;
s->dest[1] += s->mb_y * uvlinesize << (height_of_mb - s->chroma_y_shift);
s->dest[2] += s->mb_y * uvlinesize << (height_of_mb - s->chroma_y_shift);
}else{
s->dest[0] += (s->mb_y>>1) * linesize << height_of_mb;
s->dest[1] += (s->mb_y>>1) * uvlinesize << (height_of_mb - s->chroma_y_shift);
s->dest[2] += (s->mb_y>>1) * uvlinesize << (height_of_mb - s->chroma_y_shift);
av_assert1((s->mb_y&1) == (s->picture_structure == PICT_BOTTOM_FIELD));
}
}
}
| 16,386 |
122,820 | 0 | CompositorSwapClient(ui::Compositor* compositor,
GpuProcessTransportFactory* factory)
: compositor_(compositor),
factory_(factory) {
}
| 16,387 |
7,418 | 0 | ZEND_API void zend_ts_hash_copy_to_hash(HashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor)
{
begin_read(source);
zend_hash_copy(target, TS_HASH(source), pCopyConstructor);
end_read(source);
}
| 16,388 |
59,871 | 0 | static int test_unaligned_bulk(
struct usbtest_dev *tdev,
int pipe,
unsigned length,
int iterations,
unsigned transfer_flags,
const char *label)
{
int retval;
struct urb *urb = usbtest_alloc_urb(testdev_to_usbdev(tdev),
pipe, length, transfer_flags, 1, 0, simple_callback);
if (!urb)
return -ENOMEM;
retval = simple_io(tdev, urb, iterations, 0, 0, label);
simple_free_urb(urb);
return retval;
}
| 16,389 |
66,344 | 0 | static inline void gen_ins(DisasContext *s, TCGMemOp ot)
{
if (s->tb->cflags & CF_USE_ICOUNT) {
gen_io_start();
}
gen_string_movl_A0_EDI(s);
/* Note: we must do this dummy write first to be restartable in
case of page fault. */
tcg_gen_movi_tl(cpu_T0, 0);
gen_op_st_v(s, ot, cpu_T0, cpu_A0);
tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_regs[R_EDX]);
tcg_gen_andi_i32(cpu_tmp2_i32, cpu_tmp2_i32, 0xffff);
gen_helper_in_func(ot, cpu_T0, cpu_tmp2_i32);
gen_op_st_v(s, ot, cpu_T0, cpu_A0);
gen_op_movl_T0_Dshift(ot);
gen_op_add_reg_T0(s->aflag, R_EDI);
gen_bpt_io(s, cpu_tmp2_i32, ot);
if (s->tb->cflags & CF_USE_ICOUNT) {
gen_io_end();
}
}
| 16,390 |
125,520 | 0 | void GDataDirectory::RemoveChildDirectories() {
for (GDataDirectoryCollection::iterator iter = child_directories_.begin();
iter != child_directories_.end(); ++iter) {
GDataDirectory* dir = iter->second;
dir->RemoveChildren();
if (directory_service_)
directory_service_->RemoveEntryFromResourceMap(dir);
}
STLDeleteValues(&child_directories_);
child_directories_.clear();
}
| 16,391 |
146,039 | 0 | WebGLTexture* WebGL2RenderingContextBase::ValidateTexture3DBinding(
const char* function_name,
GLenum target) {
WebGLTexture* tex = nullptr;
switch (target) {
case GL_TEXTURE_2D_ARRAY:
tex = texture_units_[active_texture_unit_].texture2d_array_binding_.Get();
break;
case GL_TEXTURE_3D:
tex = texture_units_[active_texture_unit_].texture3d_binding_.Get();
break;
default:
SynthesizeGLError(GL_INVALID_ENUM, function_name,
"invalid texture target");
return nullptr;
}
if (!tex)
SynthesizeGLError(GL_INVALID_OPERATION, function_name,
"no texture bound to target");
return tex;
}
| 16,392 |
176,334 | 0 | static MaybeHandle<FixedArray> PrependElementIndicesImpl(
Handle<JSObject> object, Handle<FixedArrayBase> backing_store,
Handle<FixedArray> keys, GetKeysConversion convert,
PropertyFilter filter) {
Isolate* isolate = object->GetIsolate();
uint32_t nof_property_keys = keys->length();
uint32_t initial_list_length =
Subclass::GetMaxNumberOfEntries(*object, *backing_store);
initial_list_length += nof_property_keys;
if (initial_list_length > FixedArray::kMaxLength ||
initial_list_length < nof_property_keys) {
return isolate->Throw<FixedArray>(isolate->factory()->NewRangeError(
MessageTemplate::kInvalidArrayLength));
}
MaybeHandle<FixedArray> raw_array =
isolate->factory()->TryNewFixedArray(initial_list_length);
Handle<FixedArray> combined_keys;
if (!raw_array.ToHandle(&combined_keys)) {
if (IsHoleyElementsKind(kind())) {
initial_list_length =
Subclass::NumberOfElementsImpl(*object, *backing_store);
initial_list_length += nof_property_keys;
}
combined_keys = isolate->factory()->NewFixedArray(initial_list_length);
}
uint32_t nof_indices = 0;
bool needs_sorting =
IsDictionaryElementsKind(kind()) || IsSloppyArgumentsElements(kind());
combined_keys = Subclass::DirectCollectElementIndicesImpl(
isolate, object, backing_store,
needs_sorting ? GetKeysConversion::kKeepNumbers : convert, filter,
combined_keys, &nof_indices);
if (needs_sorting) {
SortIndices(combined_keys, nof_indices);
if (convert == GetKeysConversion::kConvertToString) {
for (uint32_t i = 0; i < nof_indices; i++) {
Handle<Object> index_string = isolate->factory()->Uint32ToString(
combined_keys->get(i)->Number());
combined_keys->set(i, *index_string);
}
}
}
CopyObjectToObjectElements(*keys, FAST_ELEMENTS, 0, *combined_keys,
FAST_ELEMENTS, nof_indices, nof_property_keys);
if (IsHoleyElementsKind(kind()) || IsSloppyArgumentsElements(kind())) {
int final_size = nof_indices + nof_property_keys;
DCHECK_LE(final_size, combined_keys->length());
combined_keys->Shrink(final_size);
}
return combined_keys;
}
| 16,393 |
118,729 | 0 | String HTMLDocument::designMode() const
{
return inDesignMode() ? "on" : "off";
}
| 16,394 |
155,422 | 0 | void ChromeContentBrowserClient::OpenURL(
content::SiteInstance* site_instance,
const content::OpenURLParams& params,
const base::RepeatingCallback<void(content::WebContents*)>& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(ShouldAllowOpenURL(site_instance, params.url));
content::BrowserContext* browser_context = site_instance->GetBrowserContext();
#if defined(OS_ANDROID)
ServiceTabLauncher::GetInstance()->LaunchTab(browser_context, params,
callback);
#else
NavigateParams nav_params(Profile::FromBrowserContext(browser_context),
params.url, params.transition);
nav_params.FillNavigateParamsFromOpenURLParams(params);
nav_params.user_gesture = params.user_gesture;
Navigate(&nav_params);
callback.Run(nav_params.navigated_or_inserted_contents);
#endif
}
| 16,395 |
88,514 | 0 | MagickExport int ErrorBlob(const Image *image)
{
BlobInfo
*magick_restrict blob_info;
assert(image != (Image *) NULL);
assert(image->signature == MagickCoreSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
assert(image->blob != (BlobInfo *) NULL);
assert(image->blob->type != UndefinedStream);
blob_info=image->blob;
switch (blob_info->type)
{
case UndefinedStream:
case StandardStream:
break;
case FileStream:
case PipeStream:
{
blob_info->error=ferror(blob_info->file_info.file);
break;
}
case ZipStream:
{
#if defined(MAGICKCORE_ZLIB_DELEGATE)
(void) gzerror(blob_info->file_info.gzfile,&blob_info->error);
#endif
break;
}
case BZipStream:
{
#if defined(MAGICKCORE_BZLIB_DELEGATE)
(void) BZ2_bzerror(blob_info->file_info.bzfile,&blob_info->error);
#endif
break;
}
case FifoStream:
{
blob_info->error=0;
break;
}
case BlobStream:
break;
}
return(blob_info->error);
}
| 16,396 |
73,637 | 0 | MagickExport const PixelPacket *GetVirtualPixelQueue(const Image *image)
{
CacheInfo
*restrict cache_info;
const int
id = GetOpenMPThreadId();
assert(image != (const Image *) NULL);
assert(image->signature == MagickSignature);
assert(image->cache != (Cache) NULL);
cache_info=(CacheInfo *) image->cache;
assert(cache_info->signature == MagickSignature);
if (cache_info->methods.get_virtual_pixels_handler !=
(GetVirtualPixelsHandler) NULL)
return(cache_info->methods.get_virtual_pixels_handler(image));
assert(id < (int) cache_info->number_threads);
return(GetVirtualPixelsNexus(cache_info,cache_info->nexus_info[id]));
}
| 16,397 |
86,388 | 0 | int hugetlb_reserve_pages(struct inode *inode,
long from, long to,
struct vm_area_struct *vma,
vm_flags_t vm_flags)
{
long ret, chg;
struct hstate *h = hstate_inode(inode);
struct hugepage_subpool *spool = subpool_inode(inode);
struct resv_map *resv_map;
long gbl_reserve;
/*
* Only apply hugepage reservation if asked. At fault time, an
* attempt will be made for VM_NORESERVE to allocate a page
* without using reserves
*/
if (vm_flags & VM_NORESERVE)
return 0;
/*
* Shared mappings base their reservation on the number of pages that
* are already allocated on behalf of the file. Private mappings need
* to reserve the full area even if read-only as mprotect() may be
* called to make the mapping read-write. Assume !vma is a shm mapping
*/
if (!vma || vma->vm_flags & VM_MAYSHARE) {
resv_map = inode_resv_map(inode);
chg = region_chg(resv_map, from, to);
} else {
resv_map = resv_map_alloc();
if (!resv_map)
return -ENOMEM;
chg = to - from;
set_vma_resv_map(vma, resv_map);
set_vma_resv_flags(vma, HPAGE_RESV_OWNER);
}
if (chg < 0) {
ret = chg;
goto out_err;
}
/*
* There must be enough pages in the subpool for the mapping. If
* the subpool has a minimum size, there may be some global
* reservations already in place (gbl_reserve).
*/
gbl_reserve = hugepage_subpool_get_pages(spool, chg);
if (gbl_reserve < 0) {
ret = -ENOSPC;
goto out_err;
}
/*
* Check enough hugepages are available for the reservation.
* Hand the pages back to the subpool if there are not
*/
ret = hugetlb_acct_memory(h, gbl_reserve);
if (ret < 0) {
/* put back original number of pages, chg */
(void)hugepage_subpool_put_pages(spool, chg);
goto out_err;
}
/*
* Account for the reservations made. Shared mappings record regions
* that have reservations as they are shared by multiple VMAs.
* When the last VMA disappears, the region map says how much
* the reservation was and the page cache tells how much of
* the reservation was consumed. Private mappings are per-VMA and
* only the consumed reservations are tracked. When the VMA
* disappears, the original reservation is the VMA size and the
* consumed reservations are stored in the map. Hence, nothing
* else has to be done for private mappings here
*/
if (!vma || vma->vm_flags & VM_MAYSHARE) {
long add = region_add(resv_map, from, to);
if (unlikely(chg > add)) {
/*
* pages in this range were added to the reserve
* map between region_chg and region_add. This
* indicates a race with alloc_huge_page. Adjust
* the subpool and reserve counts modified above
* based on the difference.
*/
long rsv_adjust;
rsv_adjust = hugepage_subpool_put_pages(spool,
chg - add);
hugetlb_acct_memory(h, -rsv_adjust);
}
}
return 0;
out_err:
if (!vma || vma->vm_flags & VM_MAYSHARE)
/* Don't call region_abort if region_chg failed */
if (chg >= 0)
region_abort(resv_map, from, to);
if (vma && is_vma_resv_set(vma, HPAGE_RESV_OWNER))
kref_put(&resv_map->refs, resv_map_release);
return ret;
}
| 16,398 |
159,658 | 0 | bool RenderFrameHostManager::ShouldTransitionCrossSite() {
return !base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kSingleProcess);
}
| 16,399 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.