unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
115,011 | 0 | void TestingAutomationProvider::ReparentBookmark(int handle,
int64 id,
int64 new_parent_id,
int index,
bool* success) {
if (browser_tracker_->ContainsHandle(handle)) {
Browser* browser = browser_tracker_->GetResource(handle);
if (browser) {
BookmarkModel* model = browser->profile()->GetBookmarkModel();
if (!model->IsLoaded()) {
*success = false;
return;
}
const BookmarkNode* node = model->GetNodeByID(id);
DCHECK(node);
const BookmarkNode* new_parent = model->GetNodeByID(new_parent_id);
DCHECK(new_parent);
if (node && new_parent) {
model->Move(node, new_parent, index);
*success = true;
}
}
}
*success = false;
}
| 3,200 |
7,742 | 0 | static void coroutine_fn v9fs_xattrwalk(void *opaque)
{
int64_t size;
V9fsString name;
ssize_t err = 0;
size_t offset = 7;
int32_t fid, newfid;
V9fsFidState *file_fidp;
V9fsFidState *xattr_fidp = NULL;
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
v9fs_string_init(&name);
err = pdu_unmarshal(pdu, offset, "dds", &fid, &newfid, &name);
if (err < 0) {
goto out_nofid;
}
trace_v9fs_xattrwalk(pdu->tag, pdu->id, fid, newfid, name.data);
file_fidp = get_fid(pdu, fid);
if (file_fidp == NULL) {
err = -ENOENT;
goto out_nofid;
}
xattr_fidp = alloc_fid(s, newfid);
if (xattr_fidp == NULL) {
err = -EINVAL;
goto out;
}
v9fs_path_copy(&xattr_fidp->path, &file_fidp->path);
if (!v9fs_string_size(&name)) {
/*
* listxattr request. Get the size first
*/
size = v9fs_co_llistxattr(pdu, &xattr_fidp->path, NULL, 0);
if (size < 0) {
err = size;
clunk_fid(s, xattr_fidp->fid);
goto out;
}
/*
* Read the xattr value
*/
xattr_fidp->fs.xattr.len = size;
xattr_fidp->fid_type = P9_FID_XATTR;
xattr_fidp->fs.xattr.xattrwalk_fid = true;
if (size) {
xattr_fidp->fs.xattr.value = g_malloc(size);
err = v9fs_co_llistxattr(pdu, &xattr_fidp->path,
xattr_fidp->fs.xattr.value,
xattr_fidp->fs.xattr.len);
if (err < 0) {
clunk_fid(s, xattr_fidp->fid);
goto out;
}
}
err = pdu_marshal(pdu, offset, "q", size);
if (err < 0) {
goto out;
}
err += offset;
} else {
/*
* specific xattr fid. We check for xattr
* presence also collect the xattr size
*/
size = v9fs_co_lgetxattr(pdu, &xattr_fidp->path,
&name, NULL, 0);
if (size < 0) {
err = size;
clunk_fid(s, xattr_fidp->fid);
goto out;
}
/*
* Read the xattr value
*/
xattr_fidp->fs.xattr.len = size;
xattr_fidp->fid_type = P9_FID_XATTR;
xattr_fidp->fs.xattr.xattrwalk_fid = true;
if (size) {
xattr_fidp->fs.xattr.value = g_malloc(size);
err = v9fs_co_lgetxattr(pdu, &xattr_fidp->path,
&name, xattr_fidp->fs.xattr.value,
xattr_fidp->fs.xattr.len);
if (err < 0) {
clunk_fid(s, xattr_fidp->fid);
goto out;
}
}
err = pdu_marshal(pdu, offset, "q", size);
if (err < 0) {
goto out;
}
err += offset;
}
trace_v9fs_xattrwalk_return(pdu->tag, pdu->id, size);
out:
put_fid(pdu, file_fidp);
if (xattr_fidp) {
put_fid(pdu, xattr_fidp);
}
out_nofid:
pdu_complete(pdu, err);
v9fs_string_free(&name);
}
| 3,201 |
25,891 | 0 | static int genregs32_set(struct task_struct *target,
const struct user_regset *regset,
unsigned int pos, unsigned int count,
const void *kbuf, const void __user *ubuf)
{
int ret = 0;
if (kbuf) {
const compat_ulong_t *k = kbuf;
while (count >= sizeof(*k) && !ret) {
ret = putreg32(target, pos, *k++);
count -= sizeof(*k);
pos += sizeof(*k);
}
} else {
const compat_ulong_t __user *u = ubuf;
while (count >= sizeof(*u) && !ret) {
compat_ulong_t word;
ret = __get_user(word, u++);
if (ret)
break;
ret = putreg32(target, pos, word);
count -= sizeof(*u);
pos += sizeof(*u);
}
}
return ret;
}
| 3,202 |
112,322 | 0 | void ResourceDispatcherHostImpl::ClearLoginDelegateForRequest(
net::URLRequest* request) {
ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request);
if (info) {
ResourceLoader* loader = GetLoader(info->GetGlobalRequestID());
if (loader)
loader->ClearLoginDelegate();
}
}
| 3,203 |
155,672 | 0 | void AuthenticatorBlePowerOnAutomaticSheetModel::OnAccept() {
busy_powering_on_ble_ = true;
dialog_model()->OnSheetModelDidChange();
dialog_model()->PowerOnBleAdapter();
}
| 3,204 |
23,491 | 0 | static int nfs4_xdr_enc_secinfo_no_name(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs41_secinfo_no_name_args *args)
{
struct compound_hdr hdr = {
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
};
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putrootfh(xdr, &hdr);
encode_secinfo_no_name(xdr, args, &hdr);
encode_nops(&hdr);
return 0;
}
| 3,205 |
110,361 | 0 | Plugin::~Plugin() {
int64_t shutdown_start = NaClGetTimeOfDayMicroseconds();
PLUGIN_PRINTF(("Plugin::~Plugin (this=%p, scriptable_plugin=%p)\n",
static_cast<void*>(this),
static_cast<void*>(scriptable_plugin())));
pnacl_coordinator_.reset(NULL);
if (ppapi_proxy_ != NULL) {
HistogramTimeLarge(
"NaCl.ModuleUptime.Normal",
(shutdown_start - ready_time_) / NACL_MICROS_PER_MILLI);
}
url_downloaders_.erase(url_downloaders_.begin(), url_downloaders_.end());
ShutdownProxy();
ScriptablePlugin* scriptable_plugin_ = scriptable_plugin();
ScriptablePlugin::Unref(&scriptable_plugin_);
ShutDownSubprocesses();
delete wrapper_factory_;
delete[] argv_;
delete[] argn_;
HistogramTimeSmall(
"NaCl.Perf.ShutdownTime.Total",
(NaClGetTimeOfDayMicroseconds() - shutdown_start)
/ NACL_MICROS_PER_MILLI);
PLUGIN_PRINTF(("Plugin::~Plugin (this=%p, return)\n",
static_cast<void*>(this)));
}
| 3,206 |
168,926 | 0 | std::string DevToolsAgentHostImpl::GetParentId() {
return std::string();
}
| 3,207 |
152,244 | 0 | void RenderFrameImpl::DidAccessInitialDocument() {
DCHECK(!frame_->Parent());
if (!has_accessed_initial_document_) {
NavigationState* navigation_state =
NavigationState::FromDocumentLoader(frame_->GetDocumentLoader());
if (!navigation_state->request_committed()) {
Send(new FrameHostMsg_DidAccessInitialDocument(routing_id_));
}
}
has_accessed_initial_document_ = true;
}
| 3,208 |
102,998 | 0 | void TabStripModel::SelectNextTab() {
SelectRelativeTab(true);
}
| 3,209 |
157,714 | 0 | void WebContentsImpl::AddDestructionObserver(WebContentsImpl* web_contents) {
if (!ContainsKey(destruction_observers_, web_contents)) {
destruction_observers_[web_contents] =
std::make_unique<DestructionObserver>(this, web_contents);
}
}
| 3,210 |
78,151 | 0 | static int asepcos_activate_file(sc_card_t *card, int fileid, int is_ef)
{
int r, type = is_ef != 0 ? 2 : 1;
sc_apdu_t apdu;
u8 sbuf[2];
sbuf[0] = (fileid >> 8) & 0xff;
sbuf[1] = fileid & 0xff;
sc_format_apdu(card, &apdu, SC_APDU_CASE_3_SHORT, 0x44, type, 0x00);
apdu.lc = 2;
apdu.datalen = 2;
apdu.data = sbuf;
r = sc_transmit_apdu(card, &apdu);
SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, r, "APDU transmit failed");
return sc_check_sw(card, apdu.sw1, apdu.sw2);
}
| 3,211 |
73,484 | 0 | MagickExport const IndexPacket *GetVirtualIndexesFromNexus(const Cache cache,
NexusInfo *nexus_info)
{
CacheInfo
*magick_restrict cache_info;
assert(cache != (Cache) NULL);
cache_info=(CacheInfo *) cache;
assert(cache_info->signature == MagickSignature);
if (cache_info->storage_class == UndefinedClass)
return((IndexPacket *) NULL);
return(nexus_info->indexes);
}
| 3,212 |
19,938 | 0 | static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle,
struct nfs_fsinfo *info)
{
struct nfs4_exception exception = { };
int err;
do {
err = _nfs4_lookup_root(server, fhandle, info);
switch (err) {
case 0:
case -NFS4ERR_WRONGSEC:
break;
default:
err = nfs4_handle_exception(server, err, &exception);
}
} while (exception.retry);
return err;
}
| 3,213 |
64,834 | 0 | static void my_skip_input_data_fn(j_decompress_ptr cinfo, long num_bytes)
{
struct iwjpegrcontext *rctx = (struct iwjpegrcontext*)cinfo->src;
size_t bytes_still_to_skip;
size_t nbytes;
int ret;
size_t bytesread;
if(num_bytes<=0) return;
bytes_still_to_skip = (size_t)num_bytes;
while(bytes_still_to_skip>0) {
if(rctx->pub.bytes_in_buffer>0) {
nbytes = rctx->pub.bytes_in_buffer;
if(nbytes>bytes_still_to_skip)
nbytes = bytes_still_to_skip;
rctx->pub.bytes_in_buffer -= nbytes;
rctx->pub.next_input_byte += nbytes;
bytes_still_to_skip -= nbytes;
}
if(bytes_still_to_skip<1) return;
ret = (*rctx->iodescr->read_fn)(rctx->ctx,rctx->iodescr,
rctx->buffer,rctx->buffer_len,&bytesread);
if(!ret) bytesread=0;
rctx->pub.next_input_byte = rctx->buffer;
rctx->pub.bytes_in_buffer = bytesread;
}
}
| 3,214 |
141,978 | 0 | AutofillDriver* AutofillExternalDelegate::GetAutofillDriver() {
return driver_;
}
| 3,215 |
77,098 | 0 | put_reg_load(struct ofpbuf *openflow,
const struct mf_subfield *dst, uint64_t value)
{
ovs_assert(dst->n_bits <= 64);
struct nx_action_reg_load *narl = put_NXAST_REG_LOAD(openflow);
narl->ofs_nbits = nxm_encode_ofs_nbits(dst->ofs, dst->n_bits);
narl->dst = htonl(nxm_header_from_mff(dst->field));
narl->value = htonll(value);
}
| 3,216 |
169,592 | 0 | void CastStreamingNativeHandler::StopCastRtpStream(
const v8::FunctionCallbackInfo<v8::Value>& args) {
CHECK_EQ(1, args.Length());
CHECK(args[0]->IsInt32());
const int transport_id = args[0]->ToInt32(args.GetIsolate())->Value();
CastRtpStream* transport = GetRtpStreamOrThrow(transport_id);
if (!transport)
return;
transport->Stop();
}
| 3,217 |
13,652 | 0 | static char *t_tob64(char *dst, const unsigned char *src, int size)
{
int c, pos = size % 3;
unsigned char b0 = 0, b1 = 0, b2 = 0, notleading = 0;
char *olddst = dst;
switch (pos) {
case 1:
b2 = src[0];
break;
case 2:
b1 = src[0];
b2 = src[1];
break;
}
while (1) {
c = (b0 & 0xfc) >> 2;
if (notleading || c != 0) {
*dst++ = b64table[c];
notleading = 1;
}
c = ((b0 & 3) << 4) | ((b1 & 0xf0) >> 4);
if (notleading || c != 0) {
*dst++ = b64table[c];
notleading = 1;
}
c = ((b1 & 0xf) << 2) | ((b2 & 0xc0) >> 6);
if (notleading || c != 0) {
*dst++ = b64table[c];
notleading = 1;
}
c = b2 & 0x3f;
if (notleading || c != 0) {
*dst++ = b64table[c];
notleading = 1;
}
if (pos >= size)
break;
else {
b0 = src[pos++];
b1 = src[pos++];
b2 = src[pos++];
}
}
*dst++ = '\0';
return olddst;
}
| 3,218 |
72,747 | 0 | static int jas_iccxyz_output(jas_iccattrval_t *attrval, jas_stream_t *out)
{
jas_iccxyz_t *xyz = &attrval->data.xyz;
if (jas_iccputuint32(out, xyz->x) ||
jas_iccputuint32(out, xyz->y) ||
jas_iccputuint32(out, xyz->z))
return -1;
return 0;
}
| 3,219 |
46,728 | 0 | static void aes_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
{
struct crypto_sparc64_aes_ctx *ctx = crypto_tfm_ctx(tfm);
ctx->ops->encrypt(&ctx->key[0], (const u32 *) src, (u32 *) dst);
}
| 3,220 |
38,598 | 0 | int sta_info_move_state(struct sta_info *sta,
enum ieee80211_sta_state new_state)
{
might_sleep();
if (sta->sta_state == new_state)
return 0;
/* check allowed transitions first */
switch (new_state) {
case IEEE80211_STA_NONE:
if (sta->sta_state != IEEE80211_STA_AUTH)
return -EINVAL;
break;
case IEEE80211_STA_AUTH:
if (sta->sta_state != IEEE80211_STA_NONE &&
sta->sta_state != IEEE80211_STA_ASSOC)
return -EINVAL;
break;
case IEEE80211_STA_ASSOC:
if (sta->sta_state != IEEE80211_STA_AUTH &&
sta->sta_state != IEEE80211_STA_AUTHORIZED)
return -EINVAL;
break;
case IEEE80211_STA_AUTHORIZED:
if (sta->sta_state != IEEE80211_STA_ASSOC)
return -EINVAL;
break;
default:
WARN(1, "invalid state %d", new_state);
return -EINVAL;
}
sta_dbg(sta->sdata, "moving STA %pM to state %d\n",
sta->sta.addr, new_state);
/*
* notify the driver before the actual changes so it can
* fail the transition
*/
if (test_sta_flag(sta, WLAN_STA_INSERTED)) {
int err = drv_sta_state(sta->local, sta->sdata, sta,
sta->sta_state, new_state);
if (err)
return err;
}
/* reflect the change in all state variables */
switch (new_state) {
case IEEE80211_STA_NONE:
if (sta->sta_state == IEEE80211_STA_AUTH)
clear_bit(WLAN_STA_AUTH, &sta->_flags);
break;
case IEEE80211_STA_AUTH:
if (sta->sta_state == IEEE80211_STA_NONE)
set_bit(WLAN_STA_AUTH, &sta->_flags);
else if (sta->sta_state == IEEE80211_STA_ASSOC)
clear_bit(WLAN_STA_ASSOC, &sta->_flags);
break;
case IEEE80211_STA_ASSOC:
if (sta->sta_state == IEEE80211_STA_AUTH) {
set_bit(WLAN_STA_ASSOC, &sta->_flags);
} else if (sta->sta_state == IEEE80211_STA_AUTHORIZED) {
if (sta->sdata->vif.type == NL80211_IFTYPE_AP ||
(sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
!sta->sdata->u.vlan.sta))
atomic_dec(&sta->sdata->bss->num_mcast_sta);
clear_bit(WLAN_STA_AUTHORIZED, &sta->_flags);
}
break;
case IEEE80211_STA_AUTHORIZED:
if (sta->sta_state == IEEE80211_STA_ASSOC) {
if (sta->sdata->vif.type == NL80211_IFTYPE_AP ||
(sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
!sta->sdata->u.vlan.sta))
atomic_inc(&sta->sdata->bss->num_mcast_sta);
set_bit(WLAN_STA_AUTHORIZED, &sta->_flags);
}
break;
default:
break;
}
sta->sta_state = new_state;
return 0;
}
| 3,221 |
2,882 | 0 | zcurrentstackprotect(i_ctx_t *i_ctx_p)
{
os_ptr op = osp;
ref *ep = oparray_find(i_ctx_p);
if (ep == 0)
return_error(gs_error_rangecheck);
push(1);
make_bool(op, ep->value.opproc == oparray_cleanup);
return 0;
}
| 3,222 |
141,597 | 0 | void EventBindings::MatchAgainstEventFilter(
const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::Isolate* isolate = args.GetIsolate();
typedef std::set<EventFilter::MatcherID> MatcherIDs;
EventFilter& event_filter = g_event_filter.Get();
std::string event_name = *v8::String::Utf8Value(args[0]);
EventFilteringInfo info =
ParseFromObject(args[1]->ToObject(isolate), isolate);
MatcherIDs matched_event_filters = event_filter.MatchEvent(
event_name, info, context()->GetRenderFrame()->GetRoutingID());
v8::Local<v8::Array> array(
v8::Array::New(isolate, matched_event_filters.size()));
int i = 0;
for (MatcherIDs::iterator it = matched_event_filters.begin();
it != matched_event_filters.end();
++it) {
array->Set(v8::Integer::New(isolate, i++), v8::Integer::New(isolate, *it));
}
args.GetReturnValue().Set(array);
}
| 3,223 |
60,936 | 0 | link_info_start (NautilusDirectory *directory,
NautilusFile *file,
gboolean *doing_io)
{
GFile *location;
gboolean nautilus_style_link;
LinkInfoReadState *state;
if (directory->details->link_info_read_state != NULL)
{
*doing_io = TRUE;
return;
}
if (!is_needy (file,
lacks_link_info,
REQUEST_LINK_INFO))
{
return;
}
*doing_io = TRUE;
/* Figure out if it is a link. */
nautilus_style_link = nautilus_file_is_nautilus_link (file);
location = nautilus_file_get_location (file);
/* If it's not a link we are done. If it is, we need to read it. */
if (!nautilus_style_link)
{
link_info_done (directory, file, NULL, NULL, NULL, FALSE, FALSE);
}
else
{
if (!async_job_start (directory, "link info"))
{
g_object_unref (location);
return;
}
state = g_new0 (LinkInfoReadState, 1);
state->directory = directory;
state->file = file;
state->cancellable = g_cancellable_new ();
directory->details->link_info_read_state = state;
g_file_load_contents_async (location,
state->cancellable,
link_info_nautilus_link_read_callback,
state);
}
g_object_unref (location);
}
| 3,224 |
1,249 | 0 | void Splash::flattenCurve(SplashCoord x0, SplashCoord y0,
SplashCoord x1, SplashCoord y1,
SplashCoord x2, SplashCoord y2,
SplashCoord x3, SplashCoord y3,
SplashCoord *matrix, SplashCoord flatness2,
SplashPath *fPath) {
SplashCoord cx[splashMaxCurveSplits + 1][3];
SplashCoord cy[splashMaxCurveSplits + 1][3];
int cNext[splashMaxCurveSplits + 1];
SplashCoord xl0, xl1, xl2, xr0, xr1, xr2, xr3, xx1, xx2, xh;
SplashCoord yl0, yl1, yl2, yr0, yr1, yr2, yr3, yy1, yy2, yh;
SplashCoord dx, dy, mx, my, tx, ty, d1, d2;
int p1, p2, p3;
p1 = 0;
p2 = splashMaxCurveSplits;
cx[p1][0] = x0; cy[p1][0] = y0;
cx[p1][1] = x1; cy[p1][1] = y1;
cx[p1][2] = x2; cy[p1][2] = y2;
cx[p2][0] = x3; cy[p2][0] = y3;
cNext[p1] = p2;
while (p1 < splashMaxCurveSplits) {
xl0 = cx[p1][0]; yl0 = cy[p1][0];
xx1 = cx[p1][1]; yy1 = cy[p1][1];
xx2 = cx[p1][2]; yy2 = cy[p1][2];
p2 = cNext[p1];
xr3 = cx[p2][0]; yr3 = cy[p2][0];
transform(matrix, (xl0 + xr3) * 0.5, (yl0 + yr3) * 0.5, &mx, &my);
transform(matrix, xx1, yy1, &tx, &ty);
dx = tx - mx;
dy = ty - my;
d1 = dx*dx + dy*dy;
transform(matrix, xx2, yy2, &tx, &ty);
dx = tx - mx;
dy = ty - my;
d2 = dx*dx + dy*dy;
if (p2 - p1 == 1 || (d1 <= flatness2 && d2 <= flatness2)) {
fPath->lineTo(xr3, yr3);
p1 = p2;
} else {
xl1 = (xl0 + xx1) * 0.5;
yl1 = (yl0 + yy1) * 0.5;
xh = (xx1 + xx2) * 0.5;
yh = (yy1 + yy2) * 0.5;
xl2 = (xl1 + xh) * 0.5;
yl2 = (yl1 + yh) * 0.5;
xr2 = (xx2 + xr3) * 0.5;
yr2 = (yy2 + yr3) * 0.5;
xr1 = (xh + xr2) * 0.5;
yr1 = (yh + yr2) * 0.5;
xr0 = (xl2 + xr1) * 0.5;
yr0 = (yl2 + yr1) * 0.5;
p3 = (p1 + p2) / 2;
cx[p1][1] = xl1; cy[p1][1] = yl1;
cx[p1][2] = xl2; cy[p1][2] = yl2;
cNext[p1] = p3;
cx[p3][0] = xr0; cy[p3][0] = yr0;
cx[p3][1] = xr1; cy[p3][1] = yr1;
cx[p3][2] = xr2; cy[p3][2] = yr2;
cNext[p3] = p2;
}
}
}
| 3,225 |
7,081 | 0 | tt_cmap10_get_info( TT_CMap cmap,
TT_CMapInfo *cmap_info )
{
FT_Byte* p = cmap->data + 8;
cmap_info->format = 10;
cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p );
return FT_Err_Ok;
}
| 3,226 |
178,394 | 1 | void *load_device_tree(const char *filename_path, int *sizep)
{
int dt_size;
int dt_file_load_size;
int ret;
void *fdt = NULL;
*sizep = 0;
dt_size = get_image_size(filename_path);
if (dt_size < 0) {
error_report("Unable to get size of device tree file '%s'",
filename_path);
goto fail;
}
/* Expand to 2x size to give enough room for manipulation. */
dt_size += 10000;
dt_size *= 2;
/* First allocate space in qemu for device tree */
fdt = g_malloc0(dt_size);
dt_file_load_size = load_image(filename_path, fdt);
if (dt_file_load_size < 0) {
error_report("Unable to open device tree file '%s'",
filename_path);
goto fail;
}
ret = fdt_open_into(fdt, fdt, dt_size);
if (ret) {
error_report("Unable to copy device tree in memory");
goto fail;
}
/* Check sanity of device tree */
if (fdt_check_header(fdt)) {
error_report("Device tree file loaded into memory is invalid: %s",
filename_path);
goto fail;
}
*sizep = dt_size;
return fdt;
fail:
g_free(fdt);
return NULL;
}
| 3,227 |
112,754 | 0 | void PrintPreviewHandler::HandleManagePrinters(const ListValue* /*args*/) {
++manage_printers_dialog_request_count_;
printing::PrinterManagerDialog::ShowPrinterManagerDialog();
}
| 3,228 |
66,434 | 0 | irc_ctcp_display_request (struct t_irc_server *server,
time_t date,
const char *command,
struct t_irc_channel *channel,
const char *nick,
const char *address,
const char *ctcp,
const char *arguments,
const char *reply)
{
/* CTCP blocked and user doesn't want to see message? then just return */
if (reply && !reply[0]
&& !weechat_config_boolean (irc_config_look_display_ctcp_blocked))
return;
weechat_printf_date_tags (
irc_msgbuffer_get_target_buffer (
server, nick, NULL, "ctcp",
(channel) ? channel->buffer : NULL),
date,
irc_protocol_tags (command, "irc_ctcp", NULL, address),
_("%sCTCP requested by %s%s%s: %s%s%s%s%s%s"),
weechat_prefix ("network"),
irc_nick_color_for_msg (server, 0, NULL, nick),
nick,
IRC_COLOR_RESET,
IRC_COLOR_CHAT_CHANNEL,
ctcp,
IRC_COLOR_RESET,
(arguments) ? " " : "",
(arguments) ? arguments : "",
(reply && !reply[0]) ? _(" (blocked)") : "");
}
| 3,229 |
135,557 | 0 | Range* Editor::FindStringAndScrollToVisible(const String& target,
Range* previous_match,
FindOptions options) {
Range* next_match = FindRangeOfString(
target, EphemeralRangeInFlatTree(previous_match), options);
if (!next_match)
return nullptr;
Node* first_node = next_match->FirstNode();
first_node->GetLayoutObject()->ScrollRectToVisible(
LayoutRect(next_match->BoundingBox()),
ScrollAlignment::kAlignCenterIfNeeded,
ScrollAlignment::kAlignCenterIfNeeded, kUserScroll);
first_node->GetDocument().SetSequentialFocusNavigationStartingPoint(
first_node);
return next_match;
}
| 3,230 |
82,728 | 0 | INST_HANDLER (las) { // LAS Z, Rd
int d = ((buf[0] >> 4) & 0xf) | ((buf[1] & 0x1) << 4);
__generic_ld_st (op, "ram", 'z', 1, 0, 0, 0); // 0: Read (RAMPZ:Z)
ESIL_A ("r%d,|,", d); // 0: (Z) | Rd
ESIL_A ("DUP,r%d,=,", d); // Rd = [0]
__generic_ld_st (op, "ram", 'z', 1, 0, 0, 1); // Store in RAM
}
| 3,231 |
85,891 | 0 | struct mapped_device *dm_get_md(dev_t dev)
{
struct mapped_device *md;
unsigned minor = MINOR(dev);
if (MAJOR(dev) != _major || minor >= (1 << MINORBITS))
return NULL;
spin_lock(&_minor_lock);
md = idr_find(&_minor_idr, minor);
if (md) {
if ((md == MINOR_ALLOCED ||
(MINOR(disk_devt(dm_disk(md))) != minor) ||
dm_deleting_md(md) ||
test_bit(DMF_FREEING, &md->flags))) {
md = NULL;
goto out;
}
dm_get(md);
}
out:
spin_unlock(&_minor_lock);
return md;
}
| 3,232 |
150,608 | 0 | void DataReductionProxyIOData::SetIgnoreLongTermBlackListRules(
bool ignore_long_term_black_list_rules) {
ui_task_runner_->PostTask(
FROM_HERE,
base::BindOnce(
&DataReductionProxyService::SetIgnoreLongTermBlackListRules, service_,
ignore_long_term_black_list_rules));
}
| 3,233 |
7,567 | 0 | static void cirrus_bitblt_reset(CirrusVGAState * s)
{
int need_update;
s->vga.gr[0x31] &=
~(CIRRUS_BLT_START | CIRRUS_BLT_BUSY | CIRRUS_BLT_FIFOUSED);
need_update = s->cirrus_srcptr != &s->cirrus_bltbuf[0]
|| s->cirrus_srcptr_end != &s->cirrus_bltbuf[0];
s->cirrus_srcptr = &s->cirrus_bltbuf[0];
s->cirrus_srcptr_end = &s->cirrus_bltbuf[0];
s->cirrus_srccounter = 0;
if (!need_update)
return;
cirrus_update_memory_access(s);
}
| 3,234 |
66,885 | 0 | int __weak phys_mem_access_prot_allowed(struct file *file,
unsigned long pfn, unsigned long size, pgprot_t *vma_prot)
{
return 1;
}
| 3,235 |
118,793 | 0 | KioskModeTest() {}
| 3,236 |
5,754 | 0 | static void xhci_set_ep_state(XHCIState *xhci, XHCIEPContext *epctx,
XHCIStreamContext *sctx, uint32_t state)
{
XHCIRing *ring = NULL;
uint32_t ctx[5];
uint32_t ctx2[2];
xhci_dma_read_u32s(xhci, epctx->pctx, ctx, sizeof(ctx));
ctx[0] &= ~EP_STATE_MASK;
ctx[0] |= state;
/* update ring dequeue ptr */
if (epctx->nr_pstreams) {
if (sctx != NULL) {
ring = &sctx->ring;
xhci_dma_read_u32s(xhci, sctx->pctx, ctx2, sizeof(ctx2));
ctx2[0] &= 0xe;
ctx2[0] |= sctx->ring.dequeue | sctx->ring.ccs;
ctx2[1] = (sctx->ring.dequeue >> 16) >> 16;
xhci_dma_write_u32s(xhci, sctx->pctx, ctx2, sizeof(ctx2));
}
} else {
ring = &epctx->ring;
}
if (ring) {
ctx[2] = ring->dequeue | ring->ccs;
ctx[3] = (ring->dequeue >> 16) >> 16;
DPRINTF("xhci: set epctx: " DMA_ADDR_FMT " state=%d dequeue=%08x%08x\n",
epctx->pctx, state, ctx[3], ctx[2]);
}
xhci_dma_write_u32s(xhci, epctx->pctx, ctx, sizeof(ctx));
if (epctx->state != state) {
trace_usb_xhci_ep_state(epctx->slotid, epctx->epid,
ep_state_name(epctx->state),
ep_state_name(state));
}
epctx->state = state;
}
| 3,237 |
68,893 | 0 | static void init_reap_node(int cpu)
{
per_cpu(slab_reap_node, cpu) = next_node_in(cpu_to_mem(cpu),
node_online_map);
}
| 3,238 |
5,835 | 0 | static inline void ehci_update_irq(EHCIState *s)
{
int level = 0;
if ((s->usbsts & USBINTR_MASK) & s->usbintr) {
level = 1;
}
trace_usb_ehci_irq(level, s->frindex, s->usbsts, s->usbintr);
qemu_set_irq(s->irq, level);
}
| 3,239 |
85,806 | 0 | static int ocfs2_find_rec(struct ocfs2_extent_list *el, u32 pos)
{
int i;
struct ocfs2_extent_rec *rec = NULL;
for (i = le16_to_cpu(el->l_next_free_rec) - 1; i >= 0; i--) {
rec = &el->l_recs[i];
if (le32_to_cpu(rec->e_cpos) < pos)
break;
}
return i;
}
| 3,240 |
88,868 | 0 | MagickExport MagickBooleanType AnnotateComponentGenesis(void)
{
if (annotate_semaphore == (SemaphoreInfo *) NULL)
annotate_semaphore=AllocateSemaphoreInfo();
return(MagickTrue);
}
| 3,241 |
125,349 | 0 | void GDataFileSystem::CreateDirectoryOnUIThread(
const FilePath& directory_path,
bool is_exclusive,
bool is_recursive,
const FileOperationCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
FilePath last_parent_dir_path;
FilePath first_missing_path;
GURL last_parent_dir_url;
FindMissingDirectoryResult result =
FindFirstMissingParentDirectory(directory_path,
&last_parent_dir_url,
&first_missing_path);
switch (result) {
case FOUND_INVALID: {
if (!callback.is_null()) {
MessageLoop::current()->PostTask(FROM_HERE,
base::Bind(callback, GDATA_FILE_ERROR_NOT_FOUND));
}
return;
}
case DIRECTORY_ALREADY_PRESENT: {
if (!callback.is_null()) {
MessageLoop::current()->PostTask(FROM_HERE,
base::Bind(callback,
is_exclusive ? GDATA_FILE_ERROR_EXISTS :
GDATA_FILE_OK));
}
return;
}
case FOUND_MISSING: {
break;
}
default: {
NOTREACHED();
break;
}
}
if (directory_path != first_missing_path && !is_recursive) {
if (!callback.is_null()) {
MessageLoop::current()->PostTask(FROM_HERE,
base::Bind(callback, GDATA_FILE_ERROR_NOT_FOUND));
}
return;
}
documents_service_->CreateDirectory(
last_parent_dir_url,
first_missing_path.BaseName().value(),
base::Bind(&GDataFileSystem::OnCreateDirectoryCompleted,
ui_weak_ptr_,
CreateDirectoryParams(
first_missing_path,
directory_path,
is_exclusive,
is_recursive,
callback)));
}
| 3,242 |
135,630 | 0 | void FrameSelection::DidSetSelectionDeprecated(
const SetSelectionData& options) {
const Document& current_document = GetDocument();
if (!GetSelectionInDOMTree().IsNone() && !options.DoNotSetFocus()) {
SetFocusedNodeIfNeeded();
if (!IsAvailable() || GetDocument() != current_document) {
NOTREACHED();
return;
}
}
frame_caret_->StopCaretBlinkTimer();
UpdateAppearance();
x_pos_for_vertical_arrow_navigation_ = NoXPosForVerticalArrowNavigation();
if (!options.DoNotSetFocus()) {
SelectFrameElementInParentIfFullySelected();
if (!IsAvailable() || GetDocument() != current_document) {
return;
}
}
const SetSelectionBy set_selection_by = options.GetSetSelectionBy();
NotifyTextControlOfSelectionChange(set_selection_by);
if (set_selection_by == SetSelectionBy::kUser) {
const CursorAlignOnScroll align = options.GetCursorAlignOnScroll();
ScrollAlignment alignment;
if (frame_->GetEditor()
.Behavior()
.ShouldCenterAlignWhenSelectionIsRevealed())
alignment = (align == CursorAlignOnScroll::kAlways)
? ScrollAlignment::kAlignCenterAlways
: ScrollAlignment::kAlignCenterIfNeeded;
else
alignment = (align == CursorAlignOnScroll::kAlways)
? ScrollAlignment::kAlignTopAlways
: ScrollAlignment::kAlignToEdgeIfNeeded;
RevealSelection(alignment, kRevealExtent);
}
NotifyAccessibilityForSelectionChange();
NotifyCompositorForSelectionChange();
NotifyEventHandlerForSelectionChange();
frame_->DomWindow()->EnqueueDocumentEvent(
Event::Create(EventTypeNames::selectionchange));
}
| 3,243 |
107,269 | 0 | void AutomationProvider::SelectAll(int tab_handle) {
RenderViewHost* view = GetViewForTab(tab_handle);
if (!view) {
NOTREACHED();
return;
}
view->SelectAll();
}
| 3,244 |
109,766 | 0 | void Document::processReferrerPolicy(const String& policy)
{
ASSERT(!policy.isNull());
m_referrerPolicy = ReferrerPolicyDefault;
if (equalIgnoringCase(policy, "never"))
m_referrerPolicy = ReferrerPolicyNever;
else if (equalIgnoringCase(policy, "always"))
m_referrerPolicy = ReferrerPolicyAlways;
else if (equalIgnoringCase(policy, "origin"))
m_referrerPolicy = ReferrerPolicyOrigin;
}
| 3,245 |
41,322 | 0 | static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
u32 index, int *nent, int maxnent)
{
unsigned f_nx = is_efer_nx() ? F(NX) : 0;
#ifdef CONFIG_X86_64
unsigned f_gbpages = (kvm_x86_ops->get_lpage_level() == PT_PDPE_LEVEL)
? F(GBPAGES) : 0;
unsigned f_lm = F(LM);
#else
unsigned f_gbpages = 0;
unsigned f_lm = 0;
#endif
unsigned f_rdtscp = kvm_x86_ops->rdtscp_supported() ? F(RDTSCP) : 0;
/* cpuid 1.edx */
const u32 kvm_supported_word0_x86_features =
F(FPU) | F(VME) | F(DE) | F(PSE) |
F(TSC) | F(MSR) | F(PAE) | F(MCE) |
F(CX8) | F(APIC) | 0 /* Reserved */ | F(SEP) |
F(MTRR) | F(PGE) | F(MCA) | F(CMOV) |
F(PAT) | F(PSE36) | 0 /* PSN */ | F(CLFLSH) |
0 /* Reserved, DS, ACPI */ | F(MMX) |
F(FXSR) | F(XMM) | F(XMM2) | F(SELFSNOOP) |
0 /* HTT, TM, Reserved, PBE */;
/* cpuid 0x80000001.edx */
const u32 kvm_supported_word1_x86_features =
F(FPU) | F(VME) | F(DE) | F(PSE) |
F(TSC) | F(MSR) | F(PAE) | F(MCE) |
F(CX8) | F(APIC) | 0 /* Reserved */ | F(SYSCALL) |
F(MTRR) | F(PGE) | F(MCA) | F(CMOV) |
F(PAT) | F(PSE36) | 0 /* Reserved */ |
f_nx | 0 /* Reserved */ | F(MMXEXT) | F(MMX) |
F(FXSR) | F(FXSR_OPT) | f_gbpages | f_rdtscp |
0 /* Reserved */ | f_lm | F(3DNOWEXT) | F(3DNOW);
/* cpuid 1.ecx */
const u32 kvm_supported_word4_x86_features =
F(XMM3) | F(PCLMULQDQ) | 0 /* DTES64, MONITOR */ |
0 /* DS-CPL, VMX, SMX, EST */ |
0 /* TM2 */ | F(SSSE3) | 0 /* CNXT-ID */ | 0 /* Reserved */ |
0 /* Reserved */ | F(CX16) | 0 /* xTPR Update, PDCM */ |
0 /* Reserved, DCA */ | F(XMM4_1) |
F(XMM4_2) | F(X2APIC) | F(MOVBE) | F(POPCNT) |
0 /* Reserved*/ | F(AES) | F(XSAVE) | 0 /* OSXSAVE */ | F(AVX) |
F(F16C);
/* cpuid 0x80000001.ecx */
const u32 kvm_supported_word6_x86_features =
F(LAHF_LM) | F(CMP_LEGACY) | 0 /*SVM*/ | 0 /* ExtApicSpace */ |
F(CR8_LEGACY) | F(ABM) | F(SSE4A) | F(MISALIGNSSE) |
F(3DNOWPREFETCH) | 0 /* OSVW */ | 0 /* IBS */ | F(XOP) |
0 /* SKINIT, WDT, LWP */ | F(FMA4) | F(TBM);
/* all calls to cpuid_count() should be made on the same cpu */
get_cpu();
do_cpuid_1_ent(entry, function, index);
++*nent;
switch (function) {
case 0:
entry->eax = min(entry->eax, (u32)0xd);
break;
case 1:
entry->edx &= kvm_supported_word0_x86_features;
cpuid_mask(&entry->edx, 0);
entry->ecx &= kvm_supported_word4_x86_features;
cpuid_mask(&entry->ecx, 4);
/* we support x2apic emulation even if host does not support
* it since we emulate x2apic in software */
entry->ecx |= F(X2APIC);
break;
/* function 2 entries are STATEFUL. That is, repeated cpuid commands
* may return different values. This forces us to get_cpu() before
* issuing the first command, and also to emulate this annoying behavior
* in kvm_emulate_cpuid() using KVM_CPUID_FLAG_STATE_READ_NEXT */
case 2: {
int t, times = entry->eax & 0xff;
entry->flags |= KVM_CPUID_FLAG_STATEFUL_FUNC;
entry->flags |= KVM_CPUID_FLAG_STATE_READ_NEXT;
for (t = 1; t < times && *nent < maxnent; ++t) {
do_cpuid_1_ent(&entry[t], function, 0);
entry[t].flags |= KVM_CPUID_FLAG_STATEFUL_FUNC;
++*nent;
}
break;
}
/* function 4 and 0xb have additional index. */
case 4: {
int i, cache_type;
entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
/* read more entries until cache_type is zero */
for (i = 1; *nent < maxnent; ++i) {
cache_type = entry[i - 1].eax & 0x1f;
if (!cache_type)
break;
do_cpuid_1_ent(&entry[i], function, i);
entry[i].flags |=
KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
++*nent;
}
break;
}
case 0xb: {
int i, level_type;
entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
/* read more entries until level_type is zero */
for (i = 1; *nent < maxnent; ++i) {
level_type = entry[i - 1].ecx & 0xff00;
if (!level_type)
break;
do_cpuid_1_ent(&entry[i], function, i);
entry[i].flags |=
KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
++*nent;
}
break;
}
case 0xd: {
int i;
entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
for (i = 1; *nent < maxnent; ++i) {
if (entry[i - 1].eax == 0 && i != 2)
break;
do_cpuid_1_ent(&entry[i], function, i);
entry[i].flags |=
KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
++*nent;
}
break;
}
case KVM_CPUID_SIGNATURE: {
char signature[12] = "KVMKVMKVM\0\0";
u32 *sigptr = (u32 *)signature;
entry->eax = 0;
entry->ebx = sigptr[0];
entry->ecx = sigptr[1];
entry->edx = sigptr[2];
break;
}
case KVM_CPUID_FEATURES:
entry->eax = (1 << KVM_FEATURE_CLOCKSOURCE) |
(1 << KVM_FEATURE_NOP_IO_DELAY) |
(1 << KVM_FEATURE_CLOCKSOURCE2) |
(1 << KVM_FEATURE_CLOCKSOURCE_STABLE_BIT);
entry->ebx = 0;
entry->ecx = 0;
entry->edx = 0;
break;
case 0x80000000:
entry->eax = min(entry->eax, 0x8000001a);
break;
case 0x80000001:
entry->edx &= kvm_supported_word1_x86_features;
cpuid_mask(&entry->edx, 1);
entry->ecx &= kvm_supported_word6_x86_features;
cpuid_mask(&entry->ecx, 6);
break;
}
kvm_x86_ops->set_supported_cpuid(function, entry);
put_cpu();
}
| 3,246 |
104,740 | 0 | bool AreURLsInPageNavigation(const GURL& existing_url, const GURL& new_url) {
if (existing_url == new_url || !new_url.has_ref()) {
return false;
}
url_canon::Replacements<char> replacements;
replacements.ClearRef();
return existing_url.ReplaceComponents(replacements) ==
new_url.ReplaceComponents(replacements);
}
| 3,247 |
137,346 | 0 | void MoveMouseTo(const gfx::Point& where) { mouse_position_ = where; }
| 3,248 |
107,642 | 0 | Eina_Bool ewk_view_setting_minimum_timer_interval_set(Evas_Object* ewkView, double interval)
{
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
if (fabs(priv->settings.domTimerInterval - interval) >= std::numeric_limits<double>::epsilon()) {
priv->pageSettings->setMinDOMTimerInterval(interval);
priv->settings.domTimerInterval = interval;
}
return true;
}
| 3,249 |
70,766 | 0 | evutil_vsnprintf(char *buf, size_t buflen, const char *format, va_list ap)
{
int r;
if (!buflen)
return 0;
#if defined(_MSC_VER) || defined(_WIN32)
r = _vsnprintf(buf, buflen, format, ap);
if (r < 0)
r = _vscprintf(format, ap);
#elif defined(sgi)
/* Make sure we always use the correct vsnprintf on IRIX */
extern int _xpg5_vsnprintf(char * __restrict,
__SGI_LIBC_NAMESPACE_QUALIFIER size_t,
const char * __restrict, /* va_list */ char *);
r = _xpg5_vsnprintf(buf, buflen, format, ap);
#else
r = vsnprintf(buf, buflen, format, ap);
#endif
buf[buflen-1] = '\0';
return r;
}
| 3,250 |
162,129 | 0 | static void Register(BrowserContext* browser_context,
RenderProcessHost* render_process_host,
const GURL& site_url) {
DCHECK(!site_url.is_empty());
if (!ShouldTrackProcessForSite(browser_context, render_process_host,
site_url))
return;
UnmatchedServiceWorkerProcessTracker* tracker =
static_cast<UnmatchedServiceWorkerProcessTracker*>(
browser_context->GetUserData(
kUnmatchedServiceWorkerProcessTrackerKey));
if (!tracker) {
tracker = new UnmatchedServiceWorkerProcessTracker();
browser_context->SetUserData(kUnmatchedServiceWorkerProcessTrackerKey,
base::WrapUnique(tracker));
}
tracker->RegisterProcessForSite(render_process_host, site_url);
}
| 3,251 |
97,071 | 0 | opj_pi_iterator_t *opj_pi_initialise_encode(const opj_image_t *p_image,
opj_cp_t *p_cp,
OPJ_UINT32 p_tile_no,
J2K_T2_MODE p_t2_mode )
{
/* loop*/
OPJ_UINT32 pino;
OPJ_UINT32 compno, resno;
/* to store w, h, dx and dy fro all components and resolutions*/
OPJ_UINT32 * l_tmp_data;
OPJ_UINT32 ** l_tmp_ptr;
/* encoding prameters to set*/
OPJ_UINT32 l_max_res;
OPJ_UINT32 l_max_prec;
OPJ_INT32 l_tx0,l_tx1,l_ty0,l_ty1;
OPJ_UINT32 l_dx_min,l_dy_min;
OPJ_UINT32 l_bound;
OPJ_UINT32 l_step_p , l_step_c , l_step_r , l_step_l ;
OPJ_UINT32 l_data_stride;
/* pointers*/
opj_pi_iterator_t *l_pi = 00;
opj_tcp_t *l_tcp = 00;
const opj_tccp_t *l_tccp = 00;
opj_pi_comp_t *l_current_comp = 00;
opj_image_comp_t * l_img_comp = 00;
opj_pi_iterator_t * l_current_pi = 00;
OPJ_UINT32 * l_encoding_value_ptr = 00;
/* preconditions in debug*/
assert(p_cp != 00);
assert(p_image != 00);
assert(p_tile_no < p_cp->tw * p_cp->th);
/* initializations*/
l_tcp = &p_cp->tcps[p_tile_no];
l_bound = l_tcp->numpocs+1;
l_data_stride = 4 * OPJ_J2K_MAXRLVLS;
l_tmp_data = (OPJ_UINT32*)opj_malloc(
l_data_stride * p_image->numcomps * sizeof(OPJ_UINT32));
if (! l_tmp_data) {
return 00;
}
l_tmp_ptr = (OPJ_UINT32**)opj_malloc(
p_image->numcomps * sizeof(OPJ_UINT32 *));
if (! l_tmp_ptr) {
opj_free(l_tmp_data);
return 00;
}
/* memory allocation for pi*/
l_pi = opj_pi_create(p_image,p_cp,p_tile_no);
if (!l_pi) {
opj_free(l_tmp_data);
opj_free(l_tmp_ptr);
return 00;
}
l_encoding_value_ptr = l_tmp_data;
/* update pointer array*/
for (compno = 0; compno < p_image->numcomps; ++compno) {
l_tmp_ptr[compno] = l_encoding_value_ptr;
l_encoding_value_ptr += l_data_stride;
}
/* get encoding parameters*/
opj_get_all_encoding_parameters(p_image,p_cp,p_tile_no,&l_tx0,&l_tx1,&l_ty0,&l_ty1,&l_dx_min,&l_dy_min,&l_max_prec,&l_max_res,l_tmp_ptr);
/* step calculations*/
l_step_p = 1;
l_step_c = l_max_prec * l_step_p;
l_step_r = p_image->numcomps * l_step_c;
l_step_l = l_max_res * l_step_r;
/* set values for first packet iterator*/
l_pi->tp_on = p_cp->m_specific_param.m_enc.m_tp_on;
l_current_pi = l_pi;
/* memory allocation for include*/
l_current_pi->include = (OPJ_INT16*) opj_calloc(l_tcp->numlayers * l_step_l, sizeof(OPJ_INT16));
if (!l_current_pi->include) {
opj_free(l_tmp_data);
opj_free(l_tmp_ptr);
opj_pi_destroy(l_pi, l_bound);
return 00;
}
/* special treatment for the first packet iterator*/
l_current_comp = l_current_pi->comps;
l_img_comp = p_image->comps;
l_tccp = l_tcp->tccps;
l_current_pi->tx0 = l_tx0;
l_current_pi->ty0 = l_ty0;
l_current_pi->tx1 = l_tx1;
l_current_pi->ty1 = l_ty1;
l_current_pi->dx = l_dx_min;
l_current_pi->dy = l_dy_min;
l_current_pi->step_p = l_step_p;
l_current_pi->step_c = l_step_c;
l_current_pi->step_r = l_step_r;
l_current_pi->step_l = l_step_l;
/* allocation for components and number of components has already been calculated by opj_pi_create */
for (compno = 0; compno < l_current_pi->numcomps; ++compno) {
opj_pi_resolution_t *l_res = l_current_comp->resolutions;
l_encoding_value_ptr = l_tmp_ptr[compno];
l_current_comp->dx = l_img_comp->dx;
l_current_comp->dy = l_img_comp->dy;
/* resolutions have already been initialized */
for (resno = 0; resno < l_current_comp->numresolutions; resno++) {
l_res->pdx = *(l_encoding_value_ptr++);
l_res->pdy = *(l_encoding_value_ptr++);
l_res->pw = *(l_encoding_value_ptr++);
l_res->ph = *(l_encoding_value_ptr++);
++l_res;
}
++l_current_comp;
++l_img_comp;
++l_tccp;
}
++l_current_pi;
for (pino = 1 ; pino<l_bound ; ++pino ) {
l_current_comp = l_current_pi->comps;
l_img_comp = p_image->comps;
l_tccp = l_tcp->tccps;
l_current_pi->tx0 = l_tx0;
l_current_pi->ty0 = l_ty0;
l_current_pi->tx1 = l_tx1;
l_current_pi->ty1 = l_ty1;
l_current_pi->dx = l_dx_min;
l_current_pi->dy = l_dy_min;
l_current_pi->step_p = l_step_p;
l_current_pi->step_c = l_step_c;
l_current_pi->step_r = l_step_r;
l_current_pi->step_l = l_step_l;
/* allocation for components and number of components has already been calculated by opj_pi_create */
for (compno = 0; compno < l_current_pi->numcomps; ++compno) {
opj_pi_resolution_t *l_res = l_current_comp->resolutions;
l_encoding_value_ptr = l_tmp_ptr[compno];
l_current_comp->dx = l_img_comp->dx;
l_current_comp->dy = l_img_comp->dy;
/* resolutions have already been initialized */
for (resno = 0; resno < l_current_comp->numresolutions; resno++) {
l_res->pdx = *(l_encoding_value_ptr++);
l_res->pdy = *(l_encoding_value_ptr++);
l_res->pw = *(l_encoding_value_ptr++);
l_res->ph = *(l_encoding_value_ptr++);
++l_res;
}
++l_current_comp;
++l_img_comp;
++l_tccp;
}
/* special treatment*/
l_current_pi->include = (l_current_pi-1)->include;
++l_current_pi;
}
opj_free(l_tmp_data);
l_tmp_data = 00;
opj_free(l_tmp_ptr);
l_tmp_ptr = 00;
if (l_tcp->POC && (OPJ_IS_CINEMA(p_cp->rsiz) || p_t2_mode == FINAL_PASS)) {
opj_pi_update_encode_poc_and_final(p_cp,p_tile_no,l_tx0,l_tx1,l_ty0,l_ty1,l_max_prec,l_max_res,l_dx_min,l_dy_min);
}
else {
opj_pi_update_encode_not_poc(p_cp,p_image->numcomps,p_tile_no,l_tx0,l_tx1,l_ty0,l_ty1,l_max_prec,l_max_res,l_dx_min,l_dy_min);
}
return l_pi;
}
| 3,252 |
152,762 | 0 | Histogram::~Histogram() {
}
| 3,253 |
100,478 | 0 | void WebSettingsImpl::setMinimumFontSize(int size)
{
m_settings->setMinimumFontSize(size);
}
| 3,254 |
137,400 | 0 | void RenderViewTest::Reload(const GURL& url) {
CommonNavigationParams common_params(
url, Referrer(), ui::PAGE_TRANSITION_LINK, FrameMsg_Navigate_Type::RELOAD,
true, false, base::TimeTicks(),
FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(),
PREVIEWS_UNSPECIFIED, base::TimeTicks::Now(), "GET", nullptr,
base::Optional<SourceLocation>(),
CSPDisposition::CHECK /* should_check_main_world_csp */,
false /* started_from_context_menu */, false /* has_user_gesture */);
RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
TestRenderFrame* frame =
static_cast<TestRenderFrame*>(impl->GetMainRenderFrame());
frame->Navigate(common_params, RequestNavigationParams());
FrameLoadWaiter(frame).Wait();
view_->GetWebView()->UpdateAllLifecyclePhases();
}
| 3,255 |
94,171 | 0 | static ssize_t tcm_loop_wwn_show_attr_version(
struct target_fabric_configfs *tf,
char *page)
{
return sprintf(page, "TCM Loopback Fabric module %s\n", TCM_LOOP_VERSION);
}
| 3,256 |
168,961 | 0 | void SharedWorkerDevToolsAgentHost::DetachSession(DevToolsSession* session) {
}
| 3,257 |
169,039 | 0 | void OfflinePageModelImpl::DeleteOrphanedArchives(
const std::set<base::FilePath>& archive_paths) {
std::set<base::FilePath> orphaned_archive_set(archive_paths);
for (const auto& id_page_pair : offline_pages_)
orphaned_archive_set.erase(id_page_pair.second.file_path);
if (orphaned_archive_set.empty())
return;
std::vector<base::FilePath> orphaned_archives(orphaned_archive_set.begin(),
orphaned_archive_set.end());
archive_manager_->DeleteMultipleArchives(
orphaned_archives,
base::Bind(&OfflinePageModelImpl::OnDeleteOrphanedArchivesDone,
weak_ptr_factory_.GetWeakPtr(), orphaned_archives));
}
| 3,258 |
13,587 | 0 | static HB_Error Load_PairPos( HB_GPOS_SubTable* st,
HB_Stream stream )
{
HB_Error error;
HB_PairPos* pp = &st->pair;
HB_UShort format1, format2;
HB_UInt cur_offset, new_offset, base_offset;
base_offset = FILE_Pos();
if ( ACCESS_Frame( 8L ) )
return error;
pp->PosFormat = GET_UShort();
new_offset = GET_UShort() + base_offset;
format1 = pp->ValueFormat1 = GET_UShort();
format2 = pp->ValueFormat2 = GET_UShort();
FORGET_Frame();
cur_offset = FILE_Pos();
if ( FILE_Seek( new_offset ) ||
( error = _HB_OPEN_Load_Coverage( &pp->Coverage, stream ) ) != HB_Err_Ok )
return error;
(void)FILE_Seek( cur_offset );
switch ( pp->PosFormat )
{
case 1:
error = Load_PairPos1( &pp->ppf.ppf1, format1, format2, stream );
if ( error )
goto Fail;
break;
case 2:
error = Load_PairPos2( &pp->ppf.ppf2, format1, format2, stream );
if ( error )
goto Fail;
break;
default:
return ERR(HB_Err_Invalid_SubTable_Format);
}
return HB_Err_Ok;
Fail:
_HB_OPEN_Free_Coverage( &pp->Coverage );
return error;
}
| 3,259 |
179,299 | 1 | static int shmem_remount_fs(struct super_block *sb, int *flags, char *data)
{
struct shmem_sb_info *sbinfo = SHMEM_SB(sb);
struct shmem_sb_info config = *sbinfo;
unsigned long inodes;
int error = -EINVAL;
if (shmem_parse_options(data, &config, true))
return error;
spin_lock(&sbinfo->stat_lock);
inodes = sbinfo->max_inodes - sbinfo->free_inodes;
if (percpu_counter_compare(&sbinfo->used_blocks, config.max_blocks) > 0)
goto out;
if (config.max_inodes < inodes)
goto out;
/*
* Those tests disallow limited->unlimited while any are in use;
* but we must separately disallow unlimited->limited, because
* in that case we have no record of how much is already in use.
*/
if (config.max_blocks && !sbinfo->max_blocks)
goto out;
if (config.max_inodes && !sbinfo->max_inodes)
goto out;
error = 0;
sbinfo->max_blocks = config.max_blocks;
sbinfo->max_inodes = config.max_inodes;
sbinfo->free_inodes = config.max_inodes - inodes;
mpol_put(sbinfo->mpol);
sbinfo->mpol = config.mpol; /* transfers initial ref *
out:
spin_unlock(&sbinfo->stat_lock);
return error;
}
| 3,260 |
123,290 | 0 | void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
GdkWindow* gdk_window =
gdk_display_get_default_group(gdk_display_get_default());
GetScreenInfoFromNativeWindow(gdk_window, results);
}
| 3,261 |
116,598 | 0 | bool RenderProcessImpl::UseInProcessPlugins() const {
return in_process_plugins_;
}
| 3,262 |
162,946 | 0 | void SetExplicitlyAllowedPorts(const std::string& allowed_ports) {
if (allowed_ports.empty())
return;
std::multiset<int> ports;
size_t last = 0;
size_t size = allowed_ports.size();
const std::string::value_type kComma = ',';
for (size_t i = 0; i <= size; ++i) {
if (i != size && !base::IsAsciiDigit(allowed_ports[i]) &&
(allowed_ports[i] != kComma))
return;
if (i == size || allowed_ports[i] == kComma) {
if (i > last) {
int port;
base::StringToInt(base::StringPiece(allowed_ports.begin() + last,
allowed_ports.begin() + i),
&port);
ports.insert(port);
}
last = i + 1;
}
}
g_explicitly_allowed_ports.Get() = ports;
}
| 3,263 |
60,188 | 0 | R_API int r_bin_object_delete(RBin *bin, ut32 binfile_id, ut32 binobj_id) {
RBinFile *binfile = NULL; //, *cbinfile = r_bin_cur (bin);
RBinObject *obj = NULL;
int res = false;
#if 0
if (binfile_id == UT32_MAX && binobj_id == UT32_MAX) {
return false;
}
#endif
if (binfile_id == -1) {
binfile = r_bin_file_find_by_object_id (bin, binobj_id);
obj = binfile? r_bin_file_object_find_by_id (binfile, binobj_id): NULL;
} else if (binobj_id == -1) {
binfile = r_bin_file_find_by_id (bin, binfile_id);
obj = binfile? binfile->o: NULL;
} else {
binfile = r_bin_file_find_by_id (bin, binfile_id);
obj = binfile? r_bin_file_object_find_by_id (binfile, binobj_id): NULL;
}
if (binfile && (r_list_length (binfile->objs) > 1)) {
binfile->o = NULL;
r_list_delete_data (binfile->objs, obj);
obj = (RBinObject *)r_list_get_n (binfile->objs, 0);
res = obj && binfile &&
r_bin_file_set_cur_binfile_obj (bin, binfile, obj);
}
return res;
}
| 3,264 |
173,460 | 0 | unsigned omx_vdec::omx_cmd_queue::get_q_msg_type()
{
return m_q[m_read].id;
}
| 3,265 |
95,496 | 0 | void Field_Clear( field_t *edit ) {
memset(edit->buffer, 0, MAX_EDIT_LINE);
edit->cursor = 0;
edit->scroll = 0;
}
| 3,266 |
10,409 | 0 | static void handle_ti(ESPState *s)
{
uint32_t dmalen, minlen;
if (s->dma && !s->dma_enabled) {
s->dma_cb = handle_ti;
return;
}
dmalen = s->rregs[ESP_TCLO];
dmalen |= s->rregs[ESP_TCMID] << 8;
dmalen |= s->rregs[ESP_TCHI] << 16;
if (dmalen==0) {
dmalen=0x10000;
}
s->dma_counter = dmalen;
if (s->do_cmd)
minlen = (dmalen < 32) ? dmalen : 32;
else if (s->ti_size < 0)
minlen = (dmalen < -s->ti_size) ? dmalen : -s->ti_size;
else
minlen = (dmalen < s->ti_size) ? dmalen : s->ti_size;
trace_esp_handle_ti(minlen);
if (s->dma) {
s->dma_left = minlen;
s->rregs[ESP_RSTAT] &= ~STAT_TC;
esp_do_dma(s);
} else if (s->do_cmd) {
trace_esp_handle_ti_cmd(s->cmdlen);
s->ti_size = 0;
s->cmdlen = 0;
s->do_cmd = 0;
do_cmd(s, s->cmdbuf);
return;
}
}
| 3,267 |
16,310 | 0 | static bool read_access(const char * filename ) {
return thisRemoteResource->allowRemoteReadFileAccess( filename );
}
| 3,268 |
57,960 | 0 | static void nf_tables_expr_destroy(const struct nft_ctx *ctx,
struct nft_expr *expr)
{
if (expr->ops->destroy)
expr->ops->destroy(ctx, expr);
module_put(expr->ops->type->owner);
}
| 3,269 |
48,654 | 0 | apr_status_t h2_session_pre_close(h2_session *session, int async)
{
ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, session->c,
"h2_session(%ld): pre_close", session->id);
dispatch_event(session, H2_SESSION_EV_PRE_CLOSE, 0,
(session->state == H2_SESSION_ST_IDLE)? "timeout" : NULL);
return APR_SUCCESS;
}
| 3,270 |
146,102 | 0 | ScriptValue WebGL2RenderingContextBase::getParameter(ScriptState* script_state,
GLenum pname) {
if (isContextLost())
return ScriptValue::CreateNull(script_state);
switch (pname) {
case GL_SHADING_LANGUAGE_VERSION: {
return WebGLAny(
script_state,
"WebGL GLSL ES 3.00 (" +
String(ContextGL()->GetString(GL_SHADING_LANGUAGE_VERSION)) +
")");
}
case GL_VERSION:
return WebGLAny(
script_state,
"WebGL 2.0 (" + String(ContextGL()->GetString(GL_VERSION)) + ")");
case GL_COPY_READ_BUFFER_BINDING:
return WebGLAny(script_state, bound_copy_read_buffer_.Get());
case GL_COPY_WRITE_BUFFER_BINDING:
return WebGLAny(script_state, bound_copy_write_buffer_.Get());
case GL_DRAW_FRAMEBUFFER_BINDING:
return WebGLAny(script_state, framebuffer_binding_.Get());
case GL_FRAGMENT_SHADER_DERIVATIVE_HINT:
return GetUnsignedIntParameter(script_state, pname);
case GL_MAX_3D_TEXTURE_SIZE:
return GetIntParameter(script_state, pname);
case GL_MAX_ARRAY_TEXTURE_LAYERS:
return GetIntParameter(script_state, pname);
case GC3D_MAX_CLIENT_WAIT_TIMEOUT_WEBGL:
return WebGLAny(script_state, kMaxClientWaitTimeout);
case GL_MAX_COLOR_ATTACHMENTS:
return GetIntParameter(script_state, pname);
case GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:
return GetInt64Parameter(script_state, pname);
case GL_MAX_COMBINED_UNIFORM_BLOCKS:
return GetIntParameter(script_state, pname);
case GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:
return GetInt64Parameter(script_state, pname);
case GL_MAX_DRAW_BUFFERS:
return GetIntParameter(script_state, pname);
case GL_MAX_ELEMENT_INDEX:
return GetInt64Parameter(script_state, pname);
case GL_MAX_ELEMENTS_INDICES:
return GetIntParameter(script_state, pname);
case GL_MAX_ELEMENTS_VERTICES:
return GetIntParameter(script_state, pname);
case GL_MAX_FRAGMENT_INPUT_COMPONENTS:
return GetIntParameter(script_state, pname);
case GL_MAX_FRAGMENT_UNIFORM_BLOCKS:
return GetIntParameter(script_state, pname);
case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS:
return GetIntParameter(script_state, pname);
case GL_MAX_PROGRAM_TEXEL_OFFSET:
return GetIntParameter(script_state, pname);
case GL_MAX_SAMPLES:
return GetIntParameter(script_state, pname);
case GL_MAX_SERVER_WAIT_TIMEOUT:
return GetInt64Parameter(script_state, pname);
case GL_MAX_TEXTURE_LOD_BIAS:
return GetFloatParameter(script_state, pname);
case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:
return GetIntParameter(script_state, pname);
case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:
return GetIntParameter(script_state, pname);
case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:
return GetIntParameter(script_state, pname);
case GL_MAX_UNIFORM_BLOCK_SIZE:
return GetInt64Parameter(script_state, pname);
case GL_MAX_UNIFORM_BUFFER_BINDINGS:
return GetIntParameter(script_state, pname);
case GL_MAX_VARYING_COMPONENTS:
return GetIntParameter(script_state, pname);
case GL_MAX_VERTEX_OUTPUT_COMPONENTS:
return GetIntParameter(script_state, pname);
case GL_MAX_VERTEX_UNIFORM_BLOCKS:
return GetIntParameter(script_state, pname);
case GL_MAX_VERTEX_UNIFORM_COMPONENTS:
return GetIntParameter(script_state, pname);
case GL_MIN_PROGRAM_TEXEL_OFFSET:
return GetIntParameter(script_state, pname);
case GL_PACK_ROW_LENGTH:
return GetIntParameter(script_state, pname);
case GL_PACK_SKIP_PIXELS:
return GetIntParameter(script_state, pname);
case GL_PACK_SKIP_ROWS:
return GetIntParameter(script_state, pname);
case GL_PIXEL_PACK_BUFFER_BINDING:
return WebGLAny(script_state, bound_pixel_pack_buffer_.Get());
case GL_PIXEL_UNPACK_BUFFER_BINDING:
return WebGLAny(script_state, bound_pixel_unpack_buffer_.Get());
case GL_RASTERIZER_DISCARD:
return GetBooleanParameter(script_state, pname);
case GL_READ_BUFFER: {
GLenum value = 0;
if (!isContextLost()) {
WebGLFramebuffer* read_framebuffer_binding =
GetFramebufferBinding(GL_READ_FRAMEBUFFER);
if (!read_framebuffer_binding)
value = read_buffer_of_default_framebuffer_;
else
value = read_framebuffer_binding->GetReadBuffer();
}
return WebGLAny(script_state, value);
}
case GL_READ_FRAMEBUFFER_BINDING:
return WebGLAny(script_state, read_framebuffer_binding_.Get());
case GL_SAMPLER_BINDING:
return WebGLAny(script_state, sampler_units_[active_texture_unit_].Get());
case GL_TEXTURE_BINDING_2D_ARRAY:
return WebGLAny(
script_state,
texture_units_[active_texture_unit_].texture2d_array_binding_.Get());
case GL_TEXTURE_BINDING_3D:
return WebGLAny(
script_state,
texture_units_[active_texture_unit_].texture3d_binding_.Get());
case GL_TRANSFORM_FEEDBACK_ACTIVE:
return GetBooleanParameter(script_state, pname);
case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
return WebGLAny(
script_state,
transform_feedback_binding_->GetBoundTransformFeedbackBuffer());
case GL_TRANSFORM_FEEDBACK_BINDING:
if (!transform_feedback_binding_->IsDefaultObject()) {
return WebGLAny(script_state, transform_feedback_binding_.Get());
}
return ScriptValue::CreateNull(script_state);
case GL_TRANSFORM_FEEDBACK_PAUSED:
return GetBooleanParameter(script_state, pname);
case GL_UNIFORM_BUFFER_BINDING:
return WebGLAny(script_state, bound_uniform_buffer_.Get());
case GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT:
return GetIntParameter(script_state, pname);
case GL_UNPACK_IMAGE_HEIGHT:
return GetIntParameter(script_state, pname);
case GL_UNPACK_ROW_LENGTH:
return GetIntParameter(script_state, pname);
case GL_UNPACK_SKIP_IMAGES:
return GetIntParameter(script_state, pname);
case GL_UNPACK_SKIP_PIXELS:
return GetIntParameter(script_state, pname);
case GL_UNPACK_SKIP_ROWS:
return GetIntParameter(script_state, pname);
case GL_TIMESTAMP_EXT:
if (ExtensionEnabled(kEXTDisjointTimerQueryWebGL2Name)) {
return WebGLAny(script_state, 0);
}
SynthesizeGLError(GL_INVALID_ENUM, "getParameter",
"invalid parameter name, "
"EXT_disjoint_timer_query_webgl2 not enabled");
return ScriptValue::CreateNull(script_state);
case GL_GPU_DISJOINT_EXT:
if (ExtensionEnabled(kEXTDisjointTimerQueryWebGL2Name)) {
return GetBooleanParameter(script_state, GL_GPU_DISJOINT_EXT);
}
SynthesizeGLError(GL_INVALID_ENUM, "getParameter",
"invalid parameter name, "
"EXT_disjoint_timer_query_webgl2 not enabled");
return ScriptValue::CreateNull(script_state);
default:
return WebGLRenderingContextBase::getParameter(script_state, pname);
}
}
| 3,271 |
47,162 | 0 | static int __init camellia_init(void)
{
return crypto_register_alg(&camellia_alg);
}
| 3,272 |
34,958 | 0 | static void rpc_final_put_task(struct rpc_task *task,
struct workqueue_struct *q)
{
if (q != NULL) {
INIT_WORK(&task->u.tk_work, rpc_async_release);
queue_work(q, &task->u.tk_work);
} else
rpc_free_task(task);
}
| 3,273 |
10,429 | 0 | static int megasas_dcmd_pd_get_info(MegasasState *s, MegasasCmd *cmd)
{
size_t dcmd_size = sizeof(struct mfi_pd_info);
uint16_t pd_id;
uint8_t target_id, lun_id;
SCSIDevice *sdev = NULL;
int retval = MFI_STAT_DEVICE_NOT_FOUND;
if (cmd->iov_size < dcmd_size) {
return MFI_STAT_INVALID_PARAMETER;
}
/* mbox0 has the ID */
pd_id = le16_to_cpu(cmd->frame->dcmd.mbox[0]);
target_id = (pd_id >> 8) & 0xFF;
lun_id = pd_id & 0xFF;
sdev = scsi_device_find(&s->bus, 0, target_id, lun_id);
trace_megasas_dcmd_pd_get_info(cmd->index, pd_id);
if (sdev) {
/* Submit inquiry */
retval = megasas_pd_get_info_submit(sdev, pd_id, cmd);
}
return retval;
}
| 3,274 |
3,131 | 0 | static int sepvalidate(i_ctx_t *i_ctx_p, ref *space, float *values, int num_comps)
{
os_ptr op = osp;
if (num_comps < 1)
return_error(gs_error_stackunderflow);
if (!r_has_type(op, t_integer) && !r_has_type(op, t_real))
return_error(gs_error_typecheck);
if (*values > 1.0)
*values = 1.0;
if (*values < 0.0)
*values = 0.0;
return 0;
}
| 3,275 |
131,388 | 0 | static void float32ArrayMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder());
v8SetReturnValue(info, imp->float32ArrayMethod());
}
| 3,276 |
52,091 | 0 | static int tipc_nl_compat_sk_dump(struct tipc_nl_compat_msg *msg,
struct nlattr **attrs)
{
int err;
u32 sock_ref;
struct nlattr *sock[TIPC_NLA_SOCK_MAX + 1];
if (!attrs[TIPC_NLA_SOCK])
return -EINVAL;
err = nla_parse_nested(sock, TIPC_NLA_SOCK_MAX, attrs[TIPC_NLA_SOCK],
NULL);
if (err)
return err;
sock_ref = nla_get_u32(sock[TIPC_NLA_SOCK_REF]);
tipc_tlv_sprintf(msg->rep, "%u:", sock_ref);
if (sock[TIPC_NLA_SOCK_CON]) {
u32 node;
struct nlattr *con[TIPC_NLA_CON_MAX + 1];
nla_parse_nested(con, TIPC_NLA_CON_MAX, sock[TIPC_NLA_SOCK_CON],
NULL);
node = nla_get_u32(con[TIPC_NLA_CON_NODE]);
tipc_tlv_sprintf(msg->rep, " connected to <%u.%u.%u:%u>",
tipc_zone(node),
tipc_cluster(node),
tipc_node(node),
nla_get_u32(con[TIPC_NLA_CON_SOCK]));
if (con[TIPC_NLA_CON_FLAG])
tipc_tlv_sprintf(msg->rep, " via {%u,%u}\n",
nla_get_u32(con[TIPC_NLA_CON_TYPE]),
nla_get_u32(con[TIPC_NLA_CON_INST]));
else
tipc_tlv_sprintf(msg->rep, "\n");
} else if (sock[TIPC_NLA_SOCK_HAS_PUBL]) {
tipc_tlv_sprintf(msg->rep, " bound to");
err = tipc_nl_compat_publ_dump(msg, sock_ref);
if (err)
return err;
}
tipc_tlv_sprintf(msg->rep, "\n");
return 0;
}
| 3,277 |
80,621 | 0 | GF_Err tsro_Size(GF_Box *s)
{
s->size += 4;
return GF_OK;
}
| 3,278 |
22,521 | 0 | static void resched_task(struct task_struct *p)
{
assert_raw_spin_locked(&task_rq(p)->lock);
set_tsk_need_resched(p);
}
| 3,279 |
29,642 | 0 | static void sctp_v6_from_skb(union sctp_addr *addr,struct sk_buff *skb,
int is_saddr)
{
__be16 *port;
struct sctphdr *sh;
port = &addr->v6.sin6_port;
addr->v6.sin6_family = AF_INET6;
addr->v6.sin6_flowinfo = 0; /* FIXME */
addr->v6.sin6_scope_id = ((struct inet6_skb_parm *)skb->cb)->iif;
sh = sctp_hdr(skb);
if (is_saddr) {
*port = sh->source;
addr->v6.sin6_addr = ipv6_hdr(skb)->saddr;
} else {
*port = sh->dest;
addr->v6.sin6_addr = ipv6_hdr(skb)->daddr;
}
}
| 3,280 |
23,919 | 0 | static void fr_timer(unsigned long arg)
{
struct net_device *dev = (struct net_device *)arg;
hdlc_device *hdlc = dev_to_hdlc(dev);
int i, cnt = 0, reliable;
u32 list;
if (state(hdlc)->settings.dce) {
reliable = state(hdlc)->request &&
time_before(jiffies, state(hdlc)->last_poll +
state(hdlc)->settings.t392 * HZ);
state(hdlc)->request = 0;
} else {
state(hdlc)->last_errors <<= 1; /* Shift the list */
if (state(hdlc)->request) {
if (state(hdlc)->reliable)
netdev_info(dev, "No LMI status reply received\n");
state(hdlc)->last_errors |= 1;
}
list = state(hdlc)->last_errors;
for (i = 0; i < state(hdlc)->settings.n393; i++, list >>= 1)
cnt += (list & 1); /* errors count */
reliable = (cnt < state(hdlc)->settings.n392);
}
if (state(hdlc)->reliable != reliable) {
netdev_info(dev, "Link %sreliable\n", reliable ? "" : "un");
fr_set_link_state(reliable, dev);
}
if (state(hdlc)->settings.dce)
state(hdlc)->timer.expires = jiffies +
state(hdlc)->settings.t392 * HZ;
else {
if (state(hdlc)->n391cnt)
state(hdlc)->n391cnt--;
fr_lmi_send(dev, state(hdlc)->n391cnt == 0);
state(hdlc)->last_poll = jiffies;
state(hdlc)->request = 1;
state(hdlc)->timer.expires = jiffies +
state(hdlc)->settings.t391 * HZ;
}
state(hdlc)->timer.function = fr_timer;
state(hdlc)->timer.data = arg;
add_timer(&state(hdlc)->timer);
}
| 3,281 |
106,177 | 0 | JSValue jsTestObjUnsignedLongLongAttr(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(slotBase));
UNUSED_PARAM(exec);
TestObj* impl = static_cast<TestObj*>(castedThis->impl());
JSValue result = jsNumber(impl->unsignedLongLongAttr());
return result;
}
| 3,282 |
4,834 | 0 | void FreeSprite(DeviceIntPtr dev)
{
if (DevHasCursor(dev) && dev->spriteInfo->sprite) {
if (dev->spriteInfo->sprite->current)
FreeCursor(dev->spriteInfo->sprite->current, None);
free(dev->spriteInfo->sprite->spriteTrace);
free(dev->spriteInfo->sprite);
}
dev->spriteInfo->sprite = NULL;
}
| 3,283 |
171,362 | 0 | void OMXCodec::setAMRFormat(bool isWAMR, int32_t bitRate) {
OMX_U32 portIndex = mIsEncoder ? kPortIndexOutput : kPortIndexInput;
OMX_AUDIO_PARAM_AMRTYPE def;
InitOMXParams(&def);
def.nPortIndex = portIndex;
status_t err =
mOMX->getParameter(mNode, OMX_IndexParamAudioAmr, &def, sizeof(def));
CHECK_EQ(err, (status_t)OK);
def.eAMRFrameFormat = OMX_AUDIO_AMRFrameFormatFSF;
def.eAMRBandMode = pickModeFromBitRate(isWAMR, bitRate);
err = mOMX->setParameter(mNode, OMX_IndexParamAudioAmr, &def, sizeof(def));
CHECK_EQ(err, (status_t)OK);
if (mIsEncoder) {
sp<MetaData> format = mSource->getFormat();
int32_t sampleRate;
int32_t numChannels;
CHECK(format->findInt32(kKeySampleRate, &sampleRate));
CHECK(format->findInt32(kKeyChannelCount, &numChannels));
setRawAudioFormat(kPortIndexInput, sampleRate, numChannels);
}
}
| 3,284 |
174,935 | 0 | status_t CameraClient::autoFocus() {
LOG1("autoFocus (pid %d)", getCallingPid());
Mutex::Autolock lock(mLock);
status_t result = checkPidAndHardware();
if (result != NO_ERROR) return result;
return mHardware->autoFocus();
}
| 3,285 |
42,277 | 0 | sg_open(struct inode *inode, struct file *filp)
{
int dev = iminor(inode);
int flags = filp->f_flags;
struct request_queue *q;
Sg_device *sdp;
Sg_fd *sfp;
int retval;
nonseekable_open(inode, filp);
if ((flags & O_EXCL) && (O_RDONLY == (flags & O_ACCMODE)))
return -EPERM; /* Can't lock it with read only access */
sdp = sg_get_dev(dev);
if (IS_ERR(sdp))
return PTR_ERR(sdp);
SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sdp,
"sg_open: flags=0x%x\n", flags));
/* This driver's module count bumped by fops_get in <linux/fs.h> */
/* Prevent the device driver from vanishing while we sleep */
retval = scsi_device_get(sdp->device);
if (retval)
goto sg_put;
retval = scsi_autopm_get_device(sdp->device);
if (retval)
goto sdp_put;
/* scsi_block_when_processing_errors() may block so bypass
* check if O_NONBLOCK. Permits SCSI commands to be issued
* during error recovery. Tread carefully. */
if (!((flags & O_NONBLOCK) ||
scsi_block_when_processing_errors(sdp->device))) {
retval = -ENXIO;
/* we are in error recovery for this device */
goto error_out;
}
mutex_lock(&sdp->open_rel_lock);
if (flags & O_NONBLOCK) {
if (flags & O_EXCL) {
if (sdp->open_cnt > 0) {
retval = -EBUSY;
goto error_mutex_locked;
}
} else {
if (sdp->exclude) {
retval = -EBUSY;
goto error_mutex_locked;
}
}
} else {
retval = open_wait(sdp, flags);
if (retval) /* -ERESTARTSYS or -ENODEV */
goto error_mutex_locked;
}
/* N.B. at this point we are holding the open_rel_lock */
if (flags & O_EXCL)
sdp->exclude = true;
if (sdp->open_cnt < 1) { /* no existing opens */
sdp->sgdebug = 0;
q = sdp->device->request_queue;
sdp->sg_tablesize = queue_max_segments(q);
}
sfp = sg_add_sfp(sdp);
if (IS_ERR(sfp)) {
retval = PTR_ERR(sfp);
goto out_undo;
}
filp->private_data = sfp;
sdp->open_cnt++;
mutex_unlock(&sdp->open_rel_lock);
retval = 0;
sg_put:
kref_put(&sdp->d_ref, sg_device_destroy);
return retval;
out_undo:
if (flags & O_EXCL) {
sdp->exclude = false; /* undo if error */
wake_up_interruptible(&sdp->open_wait);
}
error_mutex_locked:
mutex_unlock(&sdp->open_rel_lock);
error_out:
scsi_autopm_put_device(sdp->device);
sdp_put:
scsi_device_put(sdp->device);
goto sg_put;
}
| 3,286 |
101,910 | 0 | PrintDialogGtk::PrintDialogGtk(PrintingContextCairo* context)
: callback_(NULL),
context_(context),
dialog_(NULL),
gtk_settings_(NULL),
page_setup_(NULL),
printer_(NULL) {
}
| 3,287 |
74,156 | 0 | create_filegen_node(
int filegen_token,
attr_val_fifo * options
)
{
filegen_node *my_node;
my_node = emalloc_zero(sizeof(*my_node));
my_node->filegen_token = filegen_token;
my_node->options = options;
return my_node;
}
| 3,288 |
134,328 | 0 | bool TabStrip::EndDrag(EndDragReason reason) {
if (!drag_controller_.get())
return false;
bool started_drag = drag_controller_->started_drag();
drag_controller_->EndDrag(reason);
return started_drag;
}
| 3,289 |
154,396 | 0 | inline gl::GLApi* BackTexture::api() const {
return decoder_->api();
}
| 3,290 |
149,245 | 0 | void HTMLFormControlElement::Reset() {
SetAutofillState(WebAutofillState::kNotFilled);
ResetImpl();
}
| 3,291 |
115,307 | 0 | std::string ProcessIDN(const std::string& input) {
string16 input16;
input16.reserve(input.length());
input16.insert(input16.end(), input.begin(), input.end());
string16 output16;
output16.resize(input.length());
UErrorCode status = U_ZERO_ERROR;
int output_chars = uidna_IDNToUnicode(input16.data(), input.length(),
&output16[0], output16.length(),
UIDNA_DEFAULT, NULL, &status);
if (status == U_ZERO_ERROR) {
output16.resize(output_chars);
} else if (status != U_BUFFER_OVERFLOW_ERROR) {
return input;
} else {
output16.resize(output_chars);
output_chars = uidna_IDNToUnicode(input16.data(), input.length(),
&output16[0], output16.length(),
UIDNA_DEFAULT, NULL, &status);
if (status != U_ZERO_ERROR)
return input;
DCHECK_EQ(static_cast<size_t>(output_chars), output16.length());
output16.resize(output_chars); // Just to be safe.
}
if (input16 == output16)
return input; // Input did not contain any encoded data.
return l10n_util::GetStringFUTF8(IDS_CERT_INFO_IDN_VALUE_FORMAT,
input16, output16);
}
| 3,292 |
14,848 | 0 | void encode_finish()
{
TSRMLS_FETCH();
SOAP_GLOBAL(cur_uniq_ns) = 0;
SOAP_GLOBAL(cur_uniq_ref) = 0;
if (SOAP_GLOBAL(ref_map)) {
zend_hash_destroy(SOAP_GLOBAL(ref_map));
efree(SOAP_GLOBAL(ref_map));
SOAP_GLOBAL(ref_map) = NULL;
}
}
| 3,293 |
169,289 | 0 | void SynchronizeVisualPropertiesMessageFilter::OnUpdatedFrameRectOnUI(
const gfx::Rect& rect) {
last_rect_ = rect;
if (!screen_space_rect_received_) {
screen_space_rect_received_ = true;
screen_space_rect_run_loop_->QuitWhenIdle();
}
}
| 3,294 |
34,467 | 0 | int btrfs_end_transaction(struct btrfs_trans_handle *trans,
struct btrfs_root *root)
{
int ret;
ret = __btrfs_end_transaction(trans, root, 0);
if (ret)
return ret;
return 0;
}
| 3,295 |
89,091 | 0 | static short get_segment_selector(struct pt_regs *regs, int seg_reg_idx)
{
#ifdef CONFIG_X86_64
unsigned short sel;
switch (seg_reg_idx) {
case INAT_SEG_REG_IGNORE:
return 0;
case INAT_SEG_REG_CS:
return (unsigned short)(regs->cs & 0xffff);
case INAT_SEG_REG_SS:
return (unsigned short)(regs->ss & 0xffff);
case INAT_SEG_REG_DS:
savesegment(ds, sel);
return sel;
case INAT_SEG_REG_ES:
savesegment(es, sel);
return sel;
case INAT_SEG_REG_FS:
savesegment(fs, sel);
return sel;
case INAT_SEG_REG_GS:
savesegment(gs, sel);
return sel;
default:
return -EINVAL;
}
#else /* CONFIG_X86_32 */
struct kernel_vm86_regs *vm86regs = (struct kernel_vm86_regs *)regs;
if (v8086_mode(regs)) {
switch (seg_reg_idx) {
case INAT_SEG_REG_CS:
return (unsigned short)(regs->cs & 0xffff);
case INAT_SEG_REG_SS:
return (unsigned short)(regs->ss & 0xffff);
case INAT_SEG_REG_DS:
return vm86regs->ds;
case INAT_SEG_REG_ES:
return vm86regs->es;
case INAT_SEG_REG_FS:
return vm86regs->fs;
case INAT_SEG_REG_GS:
return vm86regs->gs;
case INAT_SEG_REG_IGNORE:
/* fall through */
default:
return -EINVAL;
}
}
switch (seg_reg_idx) {
case INAT_SEG_REG_CS:
return (unsigned short)(regs->cs & 0xffff);
case INAT_SEG_REG_SS:
return (unsigned short)(regs->ss & 0xffff);
case INAT_SEG_REG_DS:
return (unsigned short)(regs->ds & 0xffff);
case INAT_SEG_REG_ES:
return (unsigned short)(regs->es & 0xffff);
case INAT_SEG_REG_FS:
return (unsigned short)(regs->fs & 0xffff);
case INAT_SEG_REG_GS:
/*
* GS may or may not be in regs as per CONFIG_X86_32_LAZY_GS.
* The macro below takes care of both cases.
*/
return get_user_gs(regs);
case INAT_SEG_REG_IGNORE:
/* fall through */
default:
return -EINVAL;
}
#endif /* CONFIG_X86_64 */
}
| 3,296 |
147,926 | 0 | static void TestInterfaceOrNullAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Local<v8::Object> holder = info.Holder();
TestObject* impl = V8TestObject::ToImpl(holder);
V8SetReturnValueFast(info, WTF::GetPtr(impl->testInterfaceOrNullAttribute()), impl);
}
| 3,297 |
117,615 | 0 | void AllowExpiry() { should_expire_ = true; }
| 3,298 |
16,377 | 0 | pseudo_set_job_attr( const char *name, const char *expr, bool log )
{
RemoteResource *remote;
if (parallelMasterResource == NULL) {
remote = thisRemoteResource;
} else {
remote = parallelMasterResource;
}
if(Shadow->updateJobAttr(name,expr,log)) {
dprintf(D_SYSCALLS,"pseudo_set_job_attr(%s,%s) succeeded\n",name,expr);
ClassAd *ad = remote->getJobAd();
ASSERT(ad);
ad->AssignExpr(name,expr);
return 0;
} else {
dprintf(D_SYSCALLS,"pseudo_set_job_attr(%s,%s) failed\n",name,expr);
return -1;
}
}
| 3,299 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.