unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
37,651 | 0 | static bool nested_vmx_exit_handled_cr(struct kvm_vcpu *vcpu,
struct vmcs12 *vmcs12)
{
unsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION);
int cr = exit_qualification & 15;
int reg = (exit_qualification >> 8) & 15;
unsigned long val = kvm_register_read(vcpu, reg);
switch ((exit_qualification >> 4) & 3) {
case 0: /* mov to cr */
switch (cr) {
case 0:
if (vmcs12->cr0_guest_host_mask &
(val ^ vmcs12->cr0_read_shadow))
return 1;
break;
case 3:
if ((vmcs12->cr3_target_count >= 1 &&
vmcs12->cr3_target_value0 == val) ||
(vmcs12->cr3_target_count >= 2 &&
vmcs12->cr3_target_value1 == val) ||
(vmcs12->cr3_target_count >= 3 &&
vmcs12->cr3_target_value2 == val) ||
(vmcs12->cr3_target_count >= 4 &&
vmcs12->cr3_target_value3 == val))
return 0;
if (nested_cpu_has(vmcs12, CPU_BASED_CR3_LOAD_EXITING))
return 1;
break;
case 4:
if (vmcs12->cr4_guest_host_mask &
(vmcs12->cr4_read_shadow ^ val))
return 1;
break;
case 8:
if (nested_cpu_has(vmcs12, CPU_BASED_CR8_LOAD_EXITING))
return 1;
break;
}
break;
case 2: /* clts */
if ((vmcs12->cr0_guest_host_mask & X86_CR0_TS) &&
(vmcs12->cr0_read_shadow & X86_CR0_TS))
return 1;
break;
case 1: /* mov from cr */
switch (cr) {
case 3:
if (vmcs12->cpu_based_vm_exec_control &
CPU_BASED_CR3_STORE_EXITING)
return 1;
break;
case 8:
if (vmcs12->cpu_based_vm_exec_control &
CPU_BASED_CR8_STORE_EXITING)
return 1;
break;
}
break;
case 3: /* lmsw */
/*
* lmsw can change bits 1..3 of cr0, and only set bit 0 of
* cr0. Other attempted changes are ignored, with no exit.
*/
if (vmcs12->cr0_guest_host_mask & 0xe &
(val ^ vmcs12->cr0_read_shadow))
return 1;
if ((vmcs12->cr0_guest_host_mask & 0x1) &&
!(vmcs12->cr0_read_shadow & 0x1) &&
(val & 0x1))
return 1;
break;
}
return 0;
}
| 5,200 |
28,026 | 0 | int ff_mpeg4video_split(AVCodecContext *avctx,
const uint8_t *buf, int buf_size)
{
int i;
uint32_t state= -1;
for(i=0; i<buf_size; i++){
state= (state<<8) | buf[i];
if(state == 0x1B3 || state == 0x1B6)
return i-3;
}
return 0;
}
| 5,201 |
176,525 | 0 | xmlParse3986RelativeRef(xmlURIPtr uri, const char *str) {
int ret;
if ((*str == '/') && (*(str + 1) == '/')) {
str += 2;
ret = xmlParse3986Authority(uri, &str);
if (ret != 0) return(ret);
ret = xmlParse3986PathAbEmpty(uri, &str);
if (ret != 0) return(ret);
} else if (*str == '/') {
ret = xmlParse3986PathAbsolute(uri, &str);
if (ret != 0) return(ret);
} else if (ISA_PCHAR(str)) {
ret = xmlParse3986PathNoScheme(uri, &str);
if (ret != 0) return(ret);
} else {
/* path-empty is effectively empty */
if (uri != NULL) {
if (uri->path != NULL) xmlFree(uri->path);
uri->path = NULL;
}
}
if (*str == '?') {
str++;
ret = xmlParse3986Query(uri, &str);
if (ret != 0) return(ret);
}
if (*str == '#') {
str++;
ret = xmlParse3986Fragment(uri, &str);
if (ret != 0) return(ret);
}
if (*str != 0) {
xmlCleanURI(uri);
return(1);
}
return(0);
}
| 5,202 |
173,329 | 0 | uarb_copy(uarb to, uarb from, int idigits)
/* Copy a uarb, may reduce the digit count */
{
int d, odigits;
for (d=odigits=0; d<idigits; ++d)
if ((to[d] = from[d]) != 0)
odigits = d+1;
return odigits;
}
| 5,203 |
150,746 | 0 | bool focused() const { return focused_; }
| 5,204 |
48,976 | 0 | int udp_gro_complete(struct sk_buff *skb, int nhoff)
{
struct udp_offload_priv *uo_priv;
__be16 newlen = htons(skb->len - nhoff);
struct udphdr *uh = (struct udphdr *)(skb->data + nhoff);
int err = -ENOSYS;
uh->len = newlen;
rcu_read_lock();
uo_priv = rcu_dereference(udp_offload_base);
for (; uo_priv != NULL; uo_priv = rcu_dereference(uo_priv->next)) {
if (net_eq(read_pnet(&uo_priv->net), dev_net(skb->dev)) &&
uo_priv->offload->port == uh->dest &&
uo_priv->offload->callbacks.gro_complete)
break;
}
if (uo_priv) {
NAPI_GRO_CB(skb)->proto = uo_priv->offload->ipproto;
err = uo_priv->offload->callbacks.gro_complete(skb,
nhoff + sizeof(struct udphdr),
uo_priv->offload);
}
rcu_read_unlock();
if (skb->remcsum_offload)
skb_shinfo(skb)->gso_type |= SKB_GSO_TUNNEL_REMCSUM;
skb->encapsulation = 1;
skb_set_inner_mac_header(skb, nhoff + sizeof(struct udphdr));
return err;
}
| 5,205 |
83,564 | 0 | static BOOL update_read_bitmap_data(rdpUpdate* update, wStream* s,
BITMAP_DATA* bitmapData)
{
if (Stream_GetRemainingLength(s) < 18)
return FALSE;
Stream_Read_UINT16(s, bitmapData->destLeft);
Stream_Read_UINT16(s, bitmapData->destTop);
Stream_Read_UINT16(s, bitmapData->destRight);
Stream_Read_UINT16(s, bitmapData->destBottom);
Stream_Read_UINT16(s, bitmapData->width);
Stream_Read_UINT16(s, bitmapData->height);
Stream_Read_UINT16(s, bitmapData->bitsPerPixel);
Stream_Read_UINT16(s, bitmapData->flags);
Stream_Read_UINT16(s, bitmapData->bitmapLength);
if (bitmapData->flags & BITMAP_COMPRESSION)
{
if (!(bitmapData->flags & NO_BITMAP_COMPRESSION_HDR))
{
Stream_Read_UINT16(s,
bitmapData->cbCompFirstRowSize); /* cbCompFirstRowSize (2 bytes) */
Stream_Read_UINT16(s,
bitmapData->cbCompMainBodySize); /* cbCompMainBodySize (2 bytes) */
Stream_Read_UINT16(s, bitmapData->cbScanWidth); /* cbScanWidth (2 bytes) */
Stream_Read_UINT16(s,
bitmapData->cbUncompressedSize); /* cbUncompressedSize (2 bytes) */
bitmapData->bitmapLength = bitmapData->cbCompMainBodySize;
}
bitmapData->compressed = TRUE;
}
else
bitmapData->compressed = FALSE;
if (Stream_GetRemainingLength(s) < bitmapData->bitmapLength)
return FALSE;
if (bitmapData->bitmapLength > 0)
{
bitmapData->bitmapDataStream = malloc(bitmapData->bitmapLength);
if (!bitmapData->bitmapDataStream)
return FALSE;
memcpy(bitmapData->bitmapDataStream, Stream_Pointer(s), bitmapData->bitmapLength);
Stream_Seek(s, bitmapData->bitmapLength);
}
return TRUE;
}
| 5,206 |
66,045 | 0 | int yr_object_dict_set_item(
YR_OBJECT* object,
YR_OBJECT* item,
const char* key)
{
YR_OBJECT_DICTIONARY* dict;
int i;
int count;
assert(object->type == OBJECT_TYPE_DICTIONARY);
dict = ((YR_OBJECT_DICTIONARY*) object);
if (dict->items == NULL)
{
count = 64;
dict->items = (YR_DICTIONARY_ITEMS*) yr_malloc(
sizeof(YR_DICTIONARY_ITEMS) + count * sizeof(dict->items->objects[0]));
if (dict->items == NULL)
return ERROR_INSUFFICIENT_MEMORY;
memset(dict->items->objects, 0, count * sizeof(dict->items->objects[0]));
dict->items->free = count;
dict->items->used = 0;
}
else if (dict->items->free == 0)
{
count = dict->items->used * 2;
dict->items = (YR_DICTIONARY_ITEMS*) yr_realloc(
dict->items,
sizeof(YR_DICTIONARY_ITEMS) + count * sizeof(dict->items->objects[0]));
if (dict->items == NULL)
return ERROR_INSUFFICIENT_MEMORY;
for (i = dict->items->used; i < count; i++)
{
dict->items->objects[i].key = NULL;
dict->items->objects[i].obj = NULL;
}
dict->items->free = dict->items->used;
}
item->parent = object;
dict->items->objects[dict->items->used].key = yr_strdup(key);
dict->items->objects[dict->items->used].obj = item;
dict->items->used++;
dict->items->free--;
return ERROR_SUCCESS;
}
| 5,207 |
99,470 | 0 | bool NPJSObject::invoke(ExecState* exec, JSGlobalObject* globalObject, JSValue function, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)
{
CallData callData;
CallType callType = getCallData(function, callData);
if (callType == CallTypeNone)
return false;
MarkedArgumentBuffer argumentList;
for (uint32_t i = 0; i < argumentCount; ++i)
argumentList.append(m_objectMap->convertNPVariantToJSValue(exec, globalObject, arguments[i]));
exec->globalData().timeoutChecker.start();
JSValue value = JSC::call(exec, function, callType, callData, m_jsObject, argumentList);
exec->globalData().timeoutChecker.stop();
m_objectMap->convertJSValueToNPVariant(exec, value, *result);
exec->clearException();
return true;
}
| 5,208 |
34,928 | 0 | static void rpc_unregister_client(struct rpc_clnt *clnt)
{
spin_lock(&rpc_client_lock);
list_del(&clnt->cl_clients);
spin_unlock(&rpc_client_lock);
}
| 5,209 |
123,321 | 0 | static gboolean OnConfigureEvent(GtkWidget* widget,
GdkEventConfigure* event,
RenderWidgetHostViewGtk* host_view) {
host_view->MarkCachedWidgetCenterStale();
host_view->UpdateScreenInfo(host_view->GetNativeView());
return FALSE;
}
| 5,210 |
122,598 | 0 | ExtensionFunctionDispatcher::Delegate::GetAssociatedWebContents() const {
return NULL;
}
| 5,211 |
124,068 | 0 | bool ChromeContentBrowserClient::AllowPepperSocketAPI(
content::BrowserContext* browser_context,
const GURL& url,
const content::SocketPermissionRequest& params) {
if (!url.is_valid())
return false;
std::string host = url.host();
if (url.SchemeIs(extensions::kExtensionScheme) &&
allowed_socket_origins_.count(host)) {
return true;
}
Profile* profile = Profile::FromBrowserContext(browser_context);
const Extension* extension = NULL;
ExtensionService* extension_service = !profile ? NULL :
extensions::ExtensionSystem::Get(profile)->extension_service();
if (extension_service) {
extension = extension_service->extensions()->
GetExtensionOrAppByURL(ExtensionURLInfo(url));
}
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
std::string allowed_list =
command_line.GetSwitchValueASCII(switches::kAllowNaClSocketAPI);
if (allowed_list == "*") {
return extension &&
(extension->GetType() == Manifest::TYPE_LEGACY_PACKAGED_APP ||
extension->GetType() == Manifest::TYPE_PLATFORM_APP);
} else if (!allowed_list.empty()) {
base::StringTokenizer t(allowed_list, ",");
while (t.GetNext()) {
if (t.token() == host)
return true;
}
}
if (!extension)
return false;
extensions::SocketPermission::CheckParam extension_params(
params.type, params.host, params.port);
if (extension->CheckAPIPermissionWithParam(APIPermission::kSocket,
&extension_params))
return true;
return false;
}
| 5,212 |
35,602 | 0 | static void string_addr_inc(struct x86_emulate_ctxt *ctxt, int reg,
struct operand *op)
{
int df = (ctxt->eflags & EFLG_DF) ? -op->count : op->count;
register_address_increment(ctxt, reg_rmw(ctxt, reg), df * op->bytes);
op->addr.mem.ea = register_address(ctxt, reg_read(ctxt, reg));
}
| 5,213 |
97,430 | 0 | bool FrameLoader::isStopping() const
{
return activeDocumentLoader()->isStopping();
}
| 5,214 |
186,275 | 1 | void IndexedDBCursor::RemoveCursorFromTransaction() {
if (transaction_)
transaction_->UnregisterOpenCursor(this);
}
| 5,215 |
44,352 | 0 | static int ipv4_sysctl_rtcache_flush(struct ctl_table *__ctl, int write,
void __user *buffer,
size_t *lenp, loff_t *ppos)
{
struct net *net = (struct net *)__ctl->extra1;
if (write) {
rt_cache_flush(net);
fnhe_genid_bump(net);
return 0;
}
return -EINVAL;
}
| 5,216 |
3,314 | 0 | static void fdctrl_handle_powerdown_mode(FDCtrl *fdctrl, int direction)
{
fdctrl->pwrd = fdctrl->fifo[1];
fdctrl->fifo[0] = fdctrl->fifo[1];
fdctrl_set_fifo(fdctrl, 1);
}
| 5,217 |
25,158 | 0 | static void *rt_cache_seq_start(struct seq_file *seq, loff_t *pos)
{
struct rt_cache_iter_state *st = seq->private;
if (*pos)
return rt_cache_get_idx(seq, *pos - 1);
st->genid = rt_genid(seq_file_net(seq));
return SEQ_START_TOKEN;
}
| 5,218 |
29,397 | 0 | static void mp_send_xchar(struct tty_struct *tty, char ch)
{
struct sb_uart_state *state = tty->driver_data;
struct sb_uart_port *port = state->port;
unsigned long flags;
if (port->ops->send_xchar)
port->ops->send_xchar(port, ch);
else {
port->x_char = ch;
if (ch) {
spin_lock_irqsave(&port->lock, flags);
port->ops->start_tx(port);
spin_unlock_irqrestore(&port->lock, flags);
}
}
}
| 5,219 |
164,158 | 0 | void BasicFindMainResponseInDatabase() { BasicFindMainResponse(true); }
| 5,220 |
68,971 | 0 | static CPLXMLNode* FLTFindGeometryNode(CPLXMLNode* psXMLNode,
int* pbPoint,
int* pbLine,
int* pbPolygon)
{
CPLXMLNode *psGMLElement = NULL;
psGMLElement = CPLGetXMLNode(psXMLNode, "Point");
if (!psGMLElement)
psGMLElement = CPLGetXMLNode(psXMLNode, "PointType");
if (psGMLElement)
*pbPoint =1;
else {
psGMLElement= CPLGetXMLNode(psXMLNode, "Polygon");
if (psGMLElement)
*pbPolygon = 1;
else if ((psGMLElement= CPLGetXMLNode(psXMLNode, "MultiPolygon")))
*pbPolygon = 1;
else if ((psGMLElement= CPLGetXMLNode(psXMLNode, "Surface")))
*pbPolygon = 1;
else if ((psGMLElement= CPLGetXMLNode(psXMLNode, "MultiSurface")))
*pbPolygon = 1;
else if ((psGMLElement= CPLGetXMLNode(psXMLNode, "Box")))
*pbPolygon = 1;
else if ((psGMLElement= CPLGetXMLNode(psXMLNode, "LineString")))
*pbLine = 1;
else if ((psGMLElement= CPLGetXMLNode(psXMLNode, "MultiLineString")))
*pbLine = 1;
else if ((psGMLElement= CPLGetXMLNode(psXMLNode, "Curve")))
*pbLine = 1;
else if ((psGMLElement= CPLGetXMLNode(psXMLNode, "MultiCurve")))
*pbLine = 1;
else if ((psGMLElement= CPLGetXMLNode(psXMLNode, "MultiPoint")))
*pbPoint = 1;
}
return psGMLElement;
}
| 5,221 |
162,480 | 0 | void ImageResource::ReloadIfLoFiOrPlaceholderImage(
ResourceFetcher* fetcher,
ReloadLoFiOrPlaceholderPolicy policy) {
if (policy == kReloadIfNeeded && !ShouldReloadBrokenPlaceholder())
return;
DCHECK(!IsLoaded() ||
HasServerLoFiResponseHeaders(GetResponse()) ==
static_cast<bool>(GetResourceRequest().GetPreviewsState() &
WebURLRequest::kServerLoFiOn));
if (placeholder_option_ == PlaceholderOption::kDoNotReloadPlaceholder &&
!(GetResourceRequest().GetPreviewsState() & WebURLRequest::kServerLoFiOn))
return;
DCHECK(!is_scheduling_reload_);
is_scheduling_reload_ = true;
SetCachePolicyBypassingCache();
WebURLRequest::PreviewsState previews_state_for_reload =
WebURLRequest::kPreviewsNoTransform;
WebURLRequest::PreviewsState old_previews_state =
GetResourceRequest().GetPreviewsState();
if (policy == kReloadIfNeeded && (GetResourceRequest().GetPreviewsState() &
WebURLRequest::kClientLoFiOn)) {
previews_state_for_reload |= WebURLRequest::kClientLoFiAutoReload;
}
SetPreviewsState(previews_state_for_reload);
if (placeholder_option_ != PlaceholderOption::kDoNotReloadPlaceholder)
ClearRangeRequestHeader();
if (old_previews_state & WebURLRequest::kClientLoFiOn &&
policy != kReloadAlways) {
placeholder_option_ = PlaceholderOption::kShowAndDoNotReloadPlaceholder;
} else {
placeholder_option_ = PlaceholderOption::kDoNotReloadPlaceholder;
}
if (IsLoading()) {
Loader()->Cancel();
} else {
ClearData();
SetEncodedSize(0);
UpdateImage(nullptr, ImageResourceContent::kClearImageAndNotifyObservers,
false);
}
SetStatus(ResourceStatus::kNotStarted);
DCHECK(is_scheduling_reload_);
is_scheduling_reload_ = false;
fetcher->StartLoad(this);
}
| 5,222 |
66,388 | 0 | static inline void gen_pop_update(DisasContext *s, TCGMemOp ot)
{
gen_stack_update(s, 1 << ot);
}
| 5,223 |
134,028 | 0 | ExtensionAppModelBuilderTest() {}
| 5,224 |
26,093 | 0 | static int perf_event_mmap_match(struct perf_event *event,
struct perf_mmap_event *mmap_event,
int executable)
{
if (event->state < PERF_EVENT_STATE_INACTIVE)
return 0;
if (!event_filter_match(event))
return 0;
if ((!executable && event->attr.mmap_data) ||
(executable && event->attr.mmap))
return 1;
return 0;
}
| 5,225 |
24,778 | 0 | static int count_total(struct page *page)
{
return page->objects;
}
| 5,226 |
88,135 | 0 | smb2_plain_req_init(__le16 smb2_command, struct cifs_tcon *tcon,
void **request_buf, unsigned int *total_len)
{
int rc;
rc = smb2_reconnect(smb2_command, tcon);
if (rc)
return rc;
/* BB eventually switch this to SMB2 specific small buf size */
if (smb2_command == SMB2_SET_INFO)
*request_buf = cifs_buf_get();
else
*request_buf = cifs_small_buf_get();
if (*request_buf == NULL) {
/* BB should we add a retry in here if not a writepage? */
return -ENOMEM;
}
fill_small_buf(smb2_command, tcon,
(struct smb2_sync_hdr *)(*request_buf),
total_len);
if (tcon != NULL) {
uint16_t com_code = le16_to_cpu(smb2_command);
cifs_stats_inc(&tcon->stats.smb2_stats.smb2_com_sent[com_code]);
cifs_stats_inc(&tcon->num_smbs_sent);
}
return rc;
}
| 5,227 |
10,141 | 0 | Ins_NPUSHB( INS_ARG )
{
FT_UShort L, K;
L = (FT_UShort)CUR.code[CUR.IP + 1];
if ( BOUNDS( L, CUR.stackSize + 1 - CUR.top ) )
{
CUR.error = TT_Err_Stack_Overflow;
return;
}
for ( K = 1; K <= L; K++ )
args[K - 1] = CUR.code[CUR.IP + K + 1];
CUR.new_top += L;
}
| 5,228 |
95,664 | 0 | void CL_DemoFilename( int number, char *fileName, int fileNameSize ) {
int a,b,c,d;
if(number < 0 || number > 9999)
number = 9999;
a = number / 1000;
number -= a * 1000;
b = number / 100;
number -= b * 100;
c = number / 10;
number -= c * 10;
d = number;
Com_sprintf( fileName, fileNameSize, "demo%i%i%i%i"
, a, b, c, d );
}
| 5,229 |
88,422 | 0 | rpcapd_recv_msg_header(SOCKET sock, struct rpcap_header *headerp)
{
int nread;
char errbuf[PCAP_ERRBUF_SIZE]; // buffer for network errors
nread = sock_recv(sock, (char *) headerp, sizeof(struct rpcap_header),
SOCK_RECEIVEALL_YES|SOCK_EOF_ISNT_ERROR, errbuf, PCAP_ERRBUF_SIZE);
if (nread == -1)
{
rpcapd_log(LOGPRIO_ERROR, "Read from client failed: %s", errbuf);
return -1;
}
if (nread == 0)
{
return -2;
}
headerp->plen = ntohl(headerp->plen);
return 0;
}
| 5,230 |
65,025 | 0 | static int adjust_insn_aux_data(struct bpf_verifier_env *env, u32 prog_len,
u32 off, u32 cnt)
{
struct bpf_insn_aux_data *new_data, *old_data = env->insn_aux_data;
if (cnt == 1)
return 0;
new_data = vzalloc(sizeof(struct bpf_insn_aux_data) * prog_len);
if (!new_data)
return -ENOMEM;
memcpy(new_data, old_data, sizeof(struct bpf_insn_aux_data) * off);
memcpy(new_data + off + cnt - 1, old_data + off,
sizeof(struct bpf_insn_aux_data) * (prog_len - off - cnt + 1));
env->insn_aux_data = new_data;
vfree(old_data);
return 0;
}
| 5,231 |
104,026 | 0 | GLuint GLES2DecoderImpl::DoGetMaxValueInBufferCHROMIUM(
GLuint buffer_id, GLsizei count, GLenum type, GLuint offset) {
GLuint max_vertex_accessed = 0;
BufferManager::BufferInfo* info = GetBufferInfo(buffer_id);
if (!info) {
SetGLError(GL_INVALID_VALUE,
"GetMaxValueInBufferCHROMIUM: unknown buffer");
} else {
if (!info->GetMaxValueForRange(offset, count, type, &max_vertex_accessed)) {
SetGLError(
GL_INVALID_OPERATION,
"GetMaxValueInBufferCHROMIUM: range out of bounds for buffer");
}
}
return max_vertex_accessed;
}
| 5,232 |
80,753 | 0 | GF_Err grpl_dump(GF_Box *a, FILE * trace)
{
gf_isom_box_dump_start(a, "GroupListBox", trace);
fprintf(trace, ">\n");
gf_isom_box_dump_done("GroupListBox", a, trace);
return GF_OK;
}
| 5,233 |
103,763 | 0 | int32 RenderThread::RoutingIDForCurrentContext() {
int32 routing_id = MSG_ROUTING_CONTROL;
if (v8::Context::InContext()) {
WebFrame* frame = WebFrame::frameForCurrentContext();
if (frame) {
RenderView* view = RenderView::FromWebView(frame->view());
if (view)
routing_id = view->routing_id();
}
} else {
DLOG(WARNING) << "Not called within a script context!";
}
return routing_id;
}
| 5,234 |
150,912 | 0 | void FakeCentral::RemoveFakeDescriptor(const std::string& descriptor_id,
const std::string& characteristic_id,
const std::string& service_id,
const std::string& peripheral_address,
RemoveFakeDescriptorCallback callback) {
FakeRemoteGattCharacteristic* fake_remote_gatt_characteristic =
GetFakeRemoteGattCharacteristic(peripheral_address, service_id,
characteristic_id);
if (!fake_remote_gatt_characteristic) {
std::move(callback).Run(false);
return;
}
std::move(callback).Run(
fake_remote_gatt_characteristic->RemoveFakeDescriptor(descriptor_id));
}
| 5,235 |
150,849 | 0 | const BluetoothDevice* BluetoothAdapter::GetDevice(
const std::string& address) const {
std::string canonicalized_address =
BluetoothDevice::CanonicalizeAddress(address);
if (canonicalized_address.empty())
return nullptr;
auto iter = devices_.find(canonicalized_address);
if (iter != devices_.end())
return iter->second.get();
return nullptr;
}
| 5,236 |
6,934 | 0 | int val_hdr(struct arg *arg, char **err_msg)
{
if (arg && arg[1].type == ARGT_SINT && arg[1].data.sint < -MAX_HDR_HISTORY) {
memprintf(err_msg, "header occurrence must be >= %d", -MAX_HDR_HISTORY);
return 0;
}
return 1;
}
| 5,237 |
8,621 | 0 | static void vmsvga_update_display(void *opaque)
{
struct vmsvga_state_s *s = opaque;
DisplaySurface *surface;
bool dirty = false;
if (!s->enable) {
s->vga.hw_ops->gfx_update(&s->vga);
return;
}
vmsvga_check_size(s);
surface = qemu_console_surface(s->vga.con);
vmsvga_fifo_run(s);
vmsvga_update_rect_flush(s);
/*
* Is it more efficient to look at vram VGA-dirty bits or wait
* for the driver to issue SVGA_CMD_UPDATE?
*/
if (memory_region_is_logging(&s->vga.vram, DIRTY_MEMORY_VGA)) {
vga_sync_dirty_bitmap(&s->vga);
dirty = memory_region_get_dirty(&s->vga.vram, 0,
surface_stride(surface) * surface_height(surface),
DIRTY_MEMORY_VGA);
}
if (s->invalidated || dirty) {
s->invalidated = 0;
dpy_gfx_update(s->vga.con, 0, 0,
surface_width(surface), surface_height(surface));
}
if (dirty) {
memory_region_reset_dirty(&s->vga.vram, 0,
surface_stride(surface) * surface_height(surface),
DIRTY_MEMORY_VGA);
}
}
| 5,238 |
89,419 | 0 | void irc_servers_setup_deinit(void)
{
signal_remove("server setup fill reconn", (SIGNAL_FUNC) sig_server_setup_fill_reconn);
signal_remove("server setup fill connect", (SIGNAL_FUNC) sig_server_setup_fill_connect);
signal_remove("server setup fill chatnet", (SIGNAL_FUNC) sig_server_setup_fill_chatnet);
signal_remove("server setup read", (SIGNAL_FUNC) sig_server_setup_read);
signal_remove("server setup saved", (SIGNAL_FUNC) sig_server_setup_saved);
}
| 5,239 |
143,039 | 0 | DelayNode* BaseAudioContext::createDelay(ExceptionState& exception_state) {
DCHECK(IsMainThread());
return DelayNode::Create(*this, exception_state);
}
| 5,240 |
3,908 | 0 | MemStream::MemStream(char *bufA, Guint startA, Guint lengthA, Object *dictA):
BaseStream(dictA, lengthA) {
buf = bufA;
start = startA;
length = lengthA;
bufEnd = buf + start + length;
bufPtr = buf + start;
needFree = gFalse;
}
| 5,241 |
95,541 | 0 | static void S_AL_ScaleGain(src_t *chksrc, vec3_t origin)
{
float distance;
if(!chksrc->local)
distance = Distance(origin, lastListenerOrigin);
if(!chksrc->local && (distance -= s_alMaxDistance->value) > 0)
{
float scaleFactor;
if(distance >= s_alGraceDistance->value)
scaleFactor = 0.0f;
else
scaleFactor = 1.0f - distance / s_alGraceDistance->value;
scaleFactor *= chksrc->curGain;
if(chksrc->scaleGain != scaleFactor)
{
chksrc->scaleGain = scaleFactor;
S_AL_Gain(chksrc->alSource, chksrc->scaleGain);
}
}
else if(chksrc->scaleGain != chksrc->curGain)
{
chksrc->scaleGain = chksrc->curGain;
S_AL_Gain(chksrc->alSource, chksrc->scaleGain);
}
}
| 5,242 |
31,361 | 0 | struct shash_alg *shash_attr_alg(struct rtattr *rta, u32 type, u32 mask)
{
struct crypto_alg *alg;
alg = crypto_attr_alg2(rta, &crypto_shash_type, type, mask);
return IS_ERR(alg) ? ERR_CAST(alg) :
container_of(alg, struct shash_alg, base);
}
| 5,243 |
64,065 | 0 | static int avi_load_index(AVFormatContext *s)
{
AVIContext *avi = s->priv_data;
AVIOContext *pb = s->pb;
uint32_t tag, size;
int64_t pos = avio_tell(pb);
int64_t next;
int ret = -1;
if (avio_seek(pb, avi->movi_end, SEEK_SET) < 0)
goto the_end; // maybe truncated file
av_log(s, AV_LOG_TRACE, "movi_end=0x%"PRIx64"\n", avi->movi_end);
for (;;) {
tag = avio_rl32(pb);
size = avio_rl32(pb);
if (avio_feof(pb))
break;
next = avio_tell(pb) + size + (size & 1);
if (tag == MKTAG('i', 'd', 'x', '1') &&
avi_read_idx1(s, size) >= 0) {
avi->index_loaded=2;
ret = 0;
}else if (tag == MKTAG('L', 'I', 'S', 'T')) {
uint32_t tag1 = avio_rl32(pb);
if (tag1 == MKTAG('I', 'N', 'F', 'O'))
ff_read_riff_info(s, size - 4);
}else if (!ret)
break;
if (avio_seek(pb, next, SEEK_SET) < 0)
break; // something is wrong here
}
the_end:
avio_seek(pb, pos, SEEK_SET);
return ret;
}
| 5,244 |
40,600 | 0 | static void __fanout_unlink(struct sock *sk, struct packet_sock *po)
{
struct packet_fanout *f = po->fanout;
int i;
spin_lock(&f->lock);
for (i = 0; i < f->num_members; i++) {
if (f->arr[i] == sk)
break;
}
BUG_ON(i >= f->num_members);
f->arr[i] = f->arr[f->num_members - 1];
f->num_members--;
spin_unlock(&f->lock);
}
| 5,245 |
8,957 | 0 | static size_t net_tx_pkt_fetch_fragment(struct NetTxPkt *pkt,
int *src_idx, size_t *src_offset, struct iovec *dst, int *dst_idx)
{
size_t fetched = 0;
struct iovec *src = pkt->vec;
*dst_idx = NET_TX_PKT_FRAGMENT_HEADER_NUM;
while (fetched < IP_FRAG_ALIGN_SIZE(pkt->virt_hdr.gso_size)) {
/* no more place in fragment iov */
if (*dst_idx == NET_MAX_FRAG_SG_LIST) {
break;
}
/* no more data in iovec */
if (*src_idx == (pkt->payload_frags + NET_TX_PKT_PL_START_FRAG)) {
break;
}
dst[*dst_idx].iov_base = src[*src_idx].iov_base + *src_offset;
dst[*dst_idx].iov_len = MIN(src[*src_idx].iov_len - *src_offset,
IP_FRAG_ALIGN_SIZE(pkt->virt_hdr.gso_size) - fetched);
*src_offset += dst[*dst_idx].iov_len;
fetched += dst[*dst_idx].iov_len;
if (*src_offset == src[*src_idx].iov_len) {
*src_offset = 0;
(*src_idx)++;
}
(*dst_idx)++;
}
return fetched;
}
| 5,246 |
114,695 | 0 | double NetworkActionPredictor::CalculateConfidence(
const string16& user_text,
const AutocompleteMatch& match,
bool* is_in_db) const {
const DBCacheKey key = { user_text, match.destination_url };
*is_in_db = false;
if (user_text.length() < kMinimumUserTextLength)
return 0.0;
const DBCacheMap::const_iterator iter = db_cache_.find(key);
if (iter == db_cache_.end())
return 0.0;
*is_in_db = true;
return CalculateConfidenceForDbEntry(iter);
}
| 5,247 |
71,013 | 0 | cmsBool Type_MLU_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, void* Ptr, cmsUInt32Number nItems)
{
cmsMLU* mlu =(cmsMLU*) Ptr;
cmsUInt32Number HeaderSize;
cmsUInt32Number Len, Offset;
cmsUInt32Number i;
if (Ptr == NULL) {
if (!_cmsWriteUInt32Number(io, 0)) return FALSE;
if (!_cmsWriteUInt32Number(io, 12)) return FALSE;
return TRUE;
}
if (!_cmsWriteUInt32Number(io, mlu ->UsedEntries)) return FALSE;
if (!_cmsWriteUInt32Number(io, 12)) return FALSE;
HeaderSize = 12 * mlu ->UsedEntries + sizeof(_cmsTagBase);
for (i=0; i < mlu ->UsedEntries; i++) {
Len = mlu ->Entries[i].Len;
Offset = mlu ->Entries[i].StrW;
Len = (Len * sizeof(cmsUInt16Number)) / sizeof(wchar_t);
Offset = (Offset * sizeof(cmsUInt16Number)) / sizeof(wchar_t) + HeaderSize + 8;
if (!_cmsWriteUInt16Number(io, mlu ->Entries[i].Language)) return FALSE;
if (!_cmsWriteUInt16Number(io, mlu ->Entries[i].Country)) return FALSE;
if (!_cmsWriteUInt32Number(io, Len)) return FALSE;
if (!_cmsWriteUInt32Number(io, Offset)) return FALSE;
}
if (!_cmsWriteWCharArray(io, mlu ->PoolUsed / sizeof(wchar_t), (wchar_t*) mlu ->MemPool)) return FALSE;
return TRUE;
cmsUNUSED_PARAMETER(nItems);
cmsUNUSED_PARAMETER(self);
}
| 5,248 |
26,591 | 0 | int ptrace_getxregs(struct task_struct *child, void __user *uregs)
{
struct pt_regs *regs = task_pt_regs(child);
struct thread_info *ti = task_thread_info(child);
elf_xtregs_t __user *xtregs = uregs;
int ret = 0;
if (!access_ok(VERIFY_WRITE, uregs, sizeof(elf_xtregs_t)))
return -EIO;
#if XTENSA_HAVE_COPROCESSORS
/* Flush all coprocessor registers to memory. */
coprocessor_flush_all(ti);
ret |= __copy_to_user(&xtregs->cp0, &ti->xtregs_cp,
sizeof(xtregs_coprocessor_t));
#endif
ret |= __copy_to_user(&xtregs->opt, ®s->xtregs_opt,
sizeof(xtregs->opt));
ret |= __copy_to_user(&xtregs->user,&ti->xtregs_user,
sizeof(xtregs->user));
return ret ? -EFAULT : 0;
}
| 5,249 |
143,261 | 0 | void Document::setCookie(const String& value, ExceptionState& exceptionState)
{
if (settings() && !settings()->cookieEnabled())
return;
if (!getSecurityOrigin()->canAccessCookies()) {
if (isSandboxed(SandboxOrigin))
exceptionState.throwSecurityError("The document is sandboxed and lacks the 'allow-same-origin' flag.");
else if (url().protocolIs("data"))
exceptionState.throwSecurityError("Cookies are disabled inside 'data:' URLs.");
else
exceptionState.throwSecurityError("Access is denied for this document.");
return;
}
if (getSecurityOrigin()->hasSuborigin() && !getSecurityOrigin()->suborigin()->policyContains(Suborigin::SuboriginPolicyOptions::UnsafeCookies))
return;
KURL cookieURL = this->cookieURL();
if (cookieURL.isEmpty())
return;
setCookies(this, cookieURL, value);
}
| 5,250 |
5,044 | 0 | static int get_crl_delta(X509_STORE_CTX *ctx,
X509_CRL **pcrl, X509_CRL **pdcrl, X509 *x)
{
int ok;
X509 *issuer = NULL;
int crl_score = 0;
unsigned int reasons;
X509_CRL *crl = NULL, *dcrl = NULL;
STACK_OF(X509_CRL) *skcrl;
X509_NAME *nm = X509_get_issuer_name(x);
reasons = ctx->current_reasons;
ok = get_crl_sk(ctx, &crl, &dcrl,
&issuer, &crl_score, &reasons, ctx->crls);
if (ok)
goto done;
/* Lookup CRLs from store */
skcrl = ctx->lookup_crls(ctx, nm);
/* If no CRLs found and a near match from get_crl_sk use that */
if (!skcrl && crl)
goto done;
get_crl_sk(ctx, &crl, &dcrl, &issuer, &crl_score, &reasons, skcrl);
sk_X509_CRL_pop_free(skcrl, X509_CRL_free);
done:
/* If we got any kind of CRL use it and return success */
if (crl) {
ctx->current_issuer = issuer;
ctx->current_crl_score = crl_score;
ctx->current_reasons = reasons;
*pcrl = crl;
*pdcrl = dcrl;
return 1;
}
return 0;
}
| 5,251 |
181,255 | 1 | grub_ext2_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
{
struct grub_ext2_data *data = node->data;
struct grub_ext2_inode *inode = &node->inode;
int blknr = -1;
unsigned int blksz = EXT2_BLOCK_SIZE (data);
int log2_blksz = LOG2_EXT2_BLOCK_SIZE (data);
if (grub_le_to_cpu32(inode->flags) & EXT4_EXTENTS_FLAG)
{
#ifndef _MSC_VER
char buf[EXT2_BLOCK_SIZE (data)];
#else
char * buf = grub_malloc (EXT2_BLOCK_SIZE(data));
#endif
struct grub_ext4_extent_header *leaf;
struct grub_ext4_extent *ext;
int i;
leaf = grub_ext4_find_leaf (data, buf,
(struct grub_ext4_extent_header *) inode->blocks.dir_blocks,
fileblock);
if (! leaf)
{
grub_error (GRUB_ERR_BAD_FS, "invalid extent");
return -1;
}
ext = (struct grub_ext4_extent *) (leaf + 1);
for (i = 0; i < grub_le_to_cpu16 (leaf->entries); i++)
{
if (fileblock < grub_le_to_cpu32 (ext[i].block))
break;
}
if (--i >= 0)
{
fileblock -= grub_le_to_cpu32 (ext[i].block);
if (fileblock >= grub_le_to_cpu16 (ext[i].len))
return 0;
else
{
grub_disk_addr_t start;
start = grub_le_to_cpu16 (ext[i].start_hi);
start = (start << 32) + grub_le_to_cpu32 (ext[i].start);
return fileblock + start;
}
}
else
{
grub_error (GRUB_ERR_BAD_FS, "something wrong with extent");
return -1;
}
}
/* Direct blocks. */
if (fileblock < INDIRECT_BLOCKS)
blknr = grub_le_to_cpu32 (inode->blocks.dir_blocks[fileblock]);
/* Indirect. */
else if (fileblock < INDIRECT_BLOCKS + blksz / 4)
{
grub_uint32_t *indir;
indir = grub_malloc (blksz);
if (! indir)
return grub_errno;
if (grub_disk_read (data->disk,
((grub_disk_addr_t)
grub_le_to_cpu32 (inode->blocks.indir_block))
<< log2_blksz,
0, blksz, indir))
return grub_errno;
blknr = grub_le_to_cpu32 (indir[fileblock - INDIRECT_BLOCKS]);
grub_free (indir);
}
/* Double indirect. */
else if (fileblock < (grub_disk_addr_t)(INDIRECT_BLOCKS + blksz / 4) \
* (grub_disk_addr_t)(blksz / 4 + 1))
{
unsigned int perblock = blksz / 4;
unsigned int rblock = fileblock - (INDIRECT_BLOCKS
+ blksz / 4);
grub_uint32_t *indir;
indir = grub_malloc (blksz);
if (! indir)
return grub_errno;
if (grub_disk_read (data->disk,
((grub_disk_addr_t)
grub_le_to_cpu32 (inode->blocks.double_indir_block))
<< log2_blksz,
0, blksz, indir))
return grub_errno;
if (grub_disk_read (data->disk,
((grub_disk_addr_t)
grub_le_to_cpu32 (indir[rblock / perblock]))
<< log2_blksz,
0, blksz, indir))
return grub_errno;
blknr = grub_le_to_cpu32 (indir[rblock % perblock]);
grub_free (indir);
}
/* triple indirect. */
else
{
grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"ext2fs doesn't support triple indirect blocks");
}
return blknr;
}
| 5,252 |
127,210 | 0 | bool ConnectToExecutionServer(uint32 session_id,
base::win::ScopedHandle* pipe_out) {
string16 pipe_name;
FilePath winsta_path(base::GetNativeLibraryName(UTF8ToUTF16("winsta")));
base::ScopedNativeLibrary winsta(winsta_path);
if (winsta.is_valid()) {
PWINSTATIONQUERYINFORMATIONW win_station_query_information =
static_cast<PWINSTATIONQUERYINFORMATIONW>(
winsta.GetFunctionPointer("WinStationQueryInformationW"));
if (win_station_query_information) {
wchar_t name[MAX_PATH];
ULONG name_length;
if (win_station_query_information(0,
session_id,
kCreateProcessPipeNameClass,
name,
sizeof(name),
&name_length)) {
pipe_name.assign(name);
}
}
}
if (pipe_name.empty()) {
pipe_name = UTF8ToUTF16(
StringPrintf(kCreateProcessDefaultPipeNameFormat, session_id));
}
base::win::ScopedHandle pipe;
for (int i = 0; i < kPipeConnectMaxAttempts; ++i) {
pipe.Set(CreateFile(pipe_name.c_str(),
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
0,
NULL));
if (pipe.IsValid()) {
break;
}
if (GetLastError() != ERROR_PIPE_BUSY) {
break;
}
if (!WaitNamedPipe(pipe_name.c_str(), kPipeBusyWaitTimeoutMs)) {
break;
}
}
if (!pipe.IsValid()) {
LOG_GETLASTERROR(ERROR) << "Failed to connect to '" << pipe_name << "'";
return false;
}
*pipe_out = pipe.Pass();
return true;
}
| 5,253 |
22,678 | 0 | static int is_limited_pmc(int pmcnum)
{
return (ppmu->flags & PPMU_LIMITED_PMC5_6)
&& (pmcnum == 5 || pmcnum == 6);
}
| 5,254 |
127,384 | 0 | static inline bool isAtShadowBoundary(const Element* element)
{
if (!element)
return false;
ContainerNode* parentNode = element->parentNode();
return parentNode && parentNode->isShadowRoot();
}
| 5,255 |
132,526 | 0 | UsbTransferFunction::~UsbTransferFunction() {
}
| 5,256 |
13,972 | 0 | gsicc_init_iccmanager(gs_gstate * pgs)
{
int code = 0, k;
const char *pname;
int namelen;
gsicc_manager_t *iccmanager = pgs->icc_manager;
cmm_profile_t *profile;
for (k = 0; k < 4; k++) {
pname = default_profile_params[k].path;
namelen = strlen(pname);
switch(default_profile_params[k].default_type) {
case DEFAULT_GRAY:
profile = iccmanager->default_gray;
break;
case DEFAULT_RGB:
profile = iccmanager->default_rgb;
break;
case DEFAULT_CMYK:
profile = iccmanager->default_cmyk;
break;
default:
profile = NULL;
}
if (profile == NULL)
code = gsicc_set_profile(iccmanager, pname, namelen+1,
default_profile_params[k].default_type);
if (code < 0)
return gs_rethrow(code, "cannot find default icc profile");
}
#if CREATE_V2_DATA
/* Test bed for V2 creation from V4 */
for (int j = 2; j < 3; j++)
{
byte *data;
int size;
switch (default_profile_params[j].default_type) {
case DEFAULT_GRAY:
profile = iccmanager->default_gray;
break;
case DEFAULT_RGB:
profile = iccmanager->default_rgb;
break;
case DEFAULT_CMYK:
profile = iccmanager->default_cmyk;
break;
default:
profile = NULL;
}
gsicc_initialize_default_profile(profile);
data = gsicc_create_getv2buffer(pgs, profile, &size);
}
#endif
return 0;
}
| 5,257 |
38,020 | 0 | asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
{
long ret = 0;
/* Do the secure computing check first. */
if (secure_computing(regs->gprs[2])) {
/* seccomp failures shouldn't expose any additional code. */
ret = -1;
goto out;
}
/*
* The sysc_tracesys code in entry.S stored the system
* call number to gprs[2].
*/
if (test_thread_flag(TIF_SYSCALL_TRACE) &&
(tracehook_report_syscall_entry(regs) ||
regs->gprs[2] >= NR_syscalls)) {
/*
* Tracing decided this syscall should not happen or the
* debugger stored an invalid system call number. Skip
* the system call and the system call restart handling.
*/
clear_pt_regs_flag(regs, PIF_SYSCALL);
ret = -1;
}
if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
trace_sys_enter(regs, regs->gprs[2]);
audit_syscall_entry(is_compat_task() ?
AUDIT_ARCH_S390 : AUDIT_ARCH_S390X,
regs->gprs[2], regs->orig_gpr2,
regs->gprs[3], regs->gprs[4],
regs->gprs[5]);
out:
return ret ?: regs->gprs[2];
}
| 5,258 |
129,849 | 0 | DictionaryValue* TraceEventTestFixture::FindMatchingTraceEntry(
const JsonKeyValue* key_values) {
size_t trace_parsed_count = trace_parsed_.GetSize();
for (size_t i = 0; i < trace_parsed_count; i++) {
Value* value = NULL;
trace_parsed_.Get(i, &value);
if (!value || value->GetType() != Value::TYPE_DICTIONARY)
continue;
DictionaryValue* dict = static_cast<DictionaryValue*>(value);
if (IsAllKeyValueInDict(key_values, dict))
return dict;
}
return NULL;
}
| 5,259 |
171,776 | 0 | void btif_dm_read_energy_info()
{
#if (defined(BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
BTA_DmBleGetEnergyInfo(bta_energy_info_cb);
#endif
}
| 5,260 |
131,254 | 0 | static void callWithActiveWindowScriptWindowMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
TestObjectPythonV8Internal::callWithActiveWindowScriptWindowMethod(info);
TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
}
| 5,261 |
77,356 | 0 | ofproto_port_get_stp_stats(struct ofproto *ofproto, ofp_port_t ofp_port,
struct ofproto_port_stp_stats *s)
{
struct ofport *ofport = ofproto_get_port(ofproto, ofp_port);
if (!ofport) {
VLOG_WARN_RL(&rl, "%s: cannot get STP stats on nonexistent "
"port %"PRIu32, ofproto->name, ofp_port);
return ENODEV;
}
return (ofproto->ofproto_class->get_stp_port_stats
? ofproto->ofproto_class->get_stp_port_stats(ofport, s)
: EOPNOTSUPP);
}
| 5,262 |
35,359 | 0 | static int __net_init ipip6_fb_tunnel_init(struct net_device *dev)
{
struct ip_tunnel *tunnel = netdev_priv(dev);
struct iphdr *iph = &tunnel->parms.iph;
struct net *net = dev_net(dev);
struct sit_net *sitn = net_generic(net, sit_net_id);
tunnel->dev = dev;
strcpy(tunnel->parms.name, dev->name);
iph->version = 4;
iph->protocol = IPPROTO_IPV6;
iph->ihl = 5;
iph->ttl = 64;
dev->tstats = alloc_percpu(struct pcpu_tstats);
if (!dev->tstats)
return -ENOMEM;
dev_hold(dev);
sitn->tunnels_wc[0] = tunnel;
return 0;
}
| 5,263 |
157,779 | 0 | InterstitialPageImpl* WebContentsImpl::GetInterstitialPage() const {
return interstitial_page_;
}
| 5,264 |
96,741 | 0 | static int IntensityCompare(const void *x,const void *y)
{
const PixelChannels
*color_1,
*color_2;
double
distance;
register ssize_t
i;
color_1=(const PixelChannels *) x;
color_2=(const PixelChannels *) y;
distance=0.0;
for (i=0; i < MaxPixelChannels; i++)
distance+=color_1->channel[i]-(double) color_2->channel[i];
return(distance < 0 ? -1 : distance > 0 ? 1 : 0);
}
| 5,265 |
86,272 | 0 | struct net *copy_net_ns(unsigned long flags,
struct user_namespace *user_ns, struct net *old_net)
{
struct ucounts *ucounts;
struct net *net;
int rv;
if (!(flags & CLONE_NEWNET))
return get_net(old_net);
ucounts = inc_net_namespaces(user_ns);
if (!ucounts)
return ERR_PTR(-ENOSPC);
net = net_alloc();
if (!net) {
dec_net_namespaces(ucounts);
return ERR_PTR(-ENOMEM);
}
get_user_ns(user_ns);
rv = mutex_lock_killable(&net_mutex);
if (rv < 0) {
net_free(net);
dec_net_namespaces(ucounts);
put_user_ns(user_ns);
return ERR_PTR(rv);
}
net->ucounts = ucounts;
rv = setup_net(net, user_ns);
if (rv == 0) {
rtnl_lock();
list_add_tail_rcu(&net->list, &net_namespace_list);
rtnl_unlock();
}
mutex_unlock(&net_mutex);
if (rv < 0) {
dec_net_namespaces(ucounts);
put_user_ns(user_ns);
net_drop_ns(net);
return ERR_PTR(rv);
}
return net;
}
| 5,266 |
153,663 | 0 | bool GLES2Implementation::GetActiveUniformBlockNameHelper(GLuint program,
GLuint index,
GLsizei bufsize,
GLsizei* length,
char* name) {
DCHECK_LE(0, bufsize);
helper_->SetBucketSize(kResultBucketId, 0);
typedef cmds::GetActiveUniformBlockName::Result Result;
auto result = GetResultAs<Result>();
if (!result) {
return false;
}
*result = 0;
helper_->GetActiveUniformBlockName(program, index, kResultBucketId,
GetResultShmId(), result.offset());
WaitForCmd();
bool success = !!result;
if (success) {
GetResultNameHelper(bufsize, length, name);
}
return success;
}
| 5,267 |
158,707 | 0 | bool GLES2DecoderImpl::GetUniformSetup(GLuint program_id,
GLint fake_location,
uint32_t shm_id,
uint32_t shm_offset,
error::Error* error,
GLint* real_location,
GLuint* service_id,
SizedResult<T>** result_pointer,
GLenum* result_type,
GLsizei* result_size) {
DCHECK(error);
DCHECK(service_id);
DCHECK(result_pointer);
DCHECK(result_type);
DCHECK(result_size);
DCHECK(real_location);
*error = error::kNoError;
SizedResult<T>* result;
result = GetSharedMemoryAs<SizedResult<T>*>(
shm_id, shm_offset, SizedResult<T>::ComputeSize(0));
if (!result) {
*error = error::kOutOfBounds;
return false;
}
*result_pointer = result;
result->SetNumResults(0);
Program* program = GetProgramInfoNotShader(program_id, "glGetUniform");
if (!program) {
return false;
}
if (!program->IsValid()) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION, "glGetUniform", "program not linked");
return false;
}
*service_id = program->service_id();
GLint array_index = -1;
const Program::UniformInfo* uniform_info =
program->GetUniformInfoByFakeLocation(
fake_location, real_location, &array_index);
if (!uniform_info) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION, "glGetUniform", "unknown location");
return false;
}
GLenum type = uniform_info->type;
uint32_t num_elements = GLES2Util::GetElementCountForUniformType(type);
if (num_elements == 0) {
LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glGetUniform", "unknown type");
return false;
}
result = GetSharedMemoryAs<SizedResult<T>*>(
shm_id, shm_offset, SizedResult<T>::ComputeSize(num_elements));
if (!result) {
*error = error::kOutOfBounds;
return false;
}
result->SetNumResults(num_elements);
*result_size = num_elements * sizeof(T);
*result_type = type;
return true;
}
| 5,268 |
156,858 | 0 | Policy* Document::policy() {
if (!policy_)
policy_ = new DocumentPolicy(this);
return policy_.Get();
}
| 5,269 |
5,395 | 0 | static void Ins_IF( INS_ARG )
{
Int nIfs;
Bool Out;
if ( args[0] != 0 )
return;
nIfs = 1;
Out = 0;
do
{
if ( SKIP_Code() == FAILURE )
return;
switch ( CUR.opcode )
{
case 0x58: /* IF */
nIfs++;
break;
case 0x1b: /* ELSE */
Out = (nIfs == 1);
break;
case 0x59: /* EIF */
nIfs--;
Out = (nIfs == 0);
break;
}
} while ( Out == 0 );
}
| 5,270 |
33,483 | 0 | static inline struct page *shmem_alloc_page(gfp_t gfp,
struct shmem_inode_info *info, pgoff_t index)
{
return alloc_page(gfp);
}
| 5,271 |
27,153 | 0 | static inline void npidentifier_cache_create(void)
{
g_npidentifier_cache =
g_hash_table_new_full(NULL, NULL, NULL,
(GDestroyNotify)npidentifier_info_destroy);
}
| 5,272 |
126,444 | 0 | void BrowserWindowGtk::UnMaximize() {
gtk_window_util::UnMaximize(window_, bounds_, restored_bounds_);
}
| 5,273 |
8,153 | 0 | void Gfx::opSetLineWidth(Object args[], int numArgs) {
state->setLineWidth(args[0].getNum());
out->updateLineWidth(state);
}
| 5,274 |
64,826 | 0 | static void iwjpeg_read_saved_markers(struct iwjpegrcontext *rctx,
struct jpeg_decompress_struct *cinfo)
{
struct jpeg_marker_struct *mk;
const iw_byte *d;
mk = cinfo->marker_list;
while(mk) {
d = (const iw_byte*)mk->data;
if(mk->marker==0xe1) {
if(mk->data_length>=6 && d[0]=='E' && d[1]=='x' &&
d[2]=='i' && d[3]=='f' && d[4]==0)
{
iwjpeg_scan_exif(rctx, &d[6], mk->data_length-6);
}
}
mk = mk->next;
}
}
| 5,275 |
182,838 | 1 | upnp_redirect(const char * rhost, unsigned short eport,
const char * iaddr, unsigned short iport,
const char * protocol, const char * desc,
unsigned int leaseduration)
{
int proto, r;
char iaddr_old[32];
char rhost_old[32];
unsigned short iport_old;
struct in_addr address;
unsigned int timestamp;
proto = proto_atoi(protocol);
if(inet_aton(iaddr, &address) <= 0) {
syslog(LOG_ERR, "inet_aton(%s) FAILED", iaddr);
return -1;
}
if(!check_upnp_rule_against_permissions(upnppermlist, num_upnpperm,
eport, address, iport)) {
syslog(LOG_INFO, "redirection permission check failed for "
"%hu->%s:%hu %s", eport, iaddr, iport, protocol);
return -3;
}
/* IGDv1 (WANIPConnection:1 Service Template Version 1.01 / Nov 12, 2001)
* - 2.2.20.PortMappingDescription :
* Overwriting Previous / Existing Port Mappings:
* If the RemoteHost, ExternalPort, PortMappingProtocol and InternalClient
* are exactly the same as an existing mapping, the existing mapping values
* for InternalPort, PortMappingDescription, PortMappingEnabled and
* PortMappingLeaseDuration are overwritten.
* Rejecting a New Port Mapping:
* In cases where the RemoteHost, ExternalPort and PortMappingProtocol
* are the same as an existing mapping, but the InternalClient is
* different, the action is rejected with an appropriate error.
* Add or Reject New Port Mapping behavior based on vendor implementation:
* In cases where the ExternalPort, PortMappingProtocol and InternalClient
* are the same, but RemoteHost is different, the vendor can choose to
* support both mappings simultaneously, or reject the second mapping
* with an appropriate error.
*
* - 2.4.16.AddPortMapping
* This action creates a new port mapping or overwrites an existing
* mapping with the same internal client. If the ExternalPort and
* PortMappingProtocol pair is already mapped to another internal client,
* an error is returned.
*
* IGDv2 (WANIPConnection:2 Service Standardized DCP (SDCP) Sep 10, 2010)
* Protocol ExternalPort RemoteHost InternalClient Result
* = = ≠ ≠ Failure
* = = ≠ = Failure or success
* (vendor specific)
* = = = ≠ Failure
* = = = = Success (overwrite)
*/
rhost_old[0] = '\0';
r = get_redirect_rule(ext_if_name, eport, proto,
iaddr_old, sizeof(iaddr_old), &iport_old, 0, 0,
rhost_old, sizeof(rhost_old),
×tamp, 0, 0);
if(r == 0) {
if(strcmp(iaddr, iaddr_old)==0 &&
((rhost == NULL && rhost_old[0]=='\0') ||
(rhost && (strcmp(rhost, "*") == 0) && rhost_old[0]=='\0') ||
(rhost && (strcmp(rhost, rhost_old) == 0)))) {
syslog(LOG_INFO, "updating existing port mapping %hu %s (rhost '%s') => %s:%hu",
eport, protocol, rhost_old, iaddr_old, iport_old);
timestamp = (leaseduration > 0) ? upnp_time() + leaseduration : 0;
if(iport != iport_old) {
r = update_portmapping(ext_if_name, eport, proto, iport, desc, timestamp);
} else {
r = update_portmapping_desc_timestamp(ext_if_name, eport, proto, desc, timestamp);
}
#ifdef ENABLE_LEASEFILE
if(r == 0) {
lease_file_remove(eport, proto);
lease_file_add(eport, iaddr, iport, proto, desc, timestamp);
}
#endif /* ENABLE_LEASEFILE */
return r;
} else {
syslog(LOG_INFO, "port %hu %s (rhost '%s') already redirected to %s:%hu",
eport, protocol, rhost_old, iaddr_old, iport_old);
return -2;
}
#ifdef CHECK_PORTINUSE
} else if (port_in_use(ext_if_name, eport, proto, iaddr, iport) > 0) {
syslog(LOG_INFO, "port %hu protocol %s already in use",
eport, protocol);
return -4;
#endif /* CHECK_PORTINUSE */
} else {
timestamp = (leaseduration > 0) ? upnp_time() + leaseduration : 0;
syslog(LOG_INFO, "redirecting port %hu to %s:%hu protocol %s for: %s",
eport, iaddr, iport, protocol, desc);
return upnp_redirect_internal(rhost, eport, iaddr, iport, proto,
desc, timestamp);
}
}
| 5,276 |
107,809 | 0 | void Browser::RegisterAppPrefs(const std::string& app_name) {
static std::set<std::string>* g_app_names = NULL;
if (!g_app_names)
g_app_names = new std::set<std::string>;
if (g_app_names->find(app_name) != g_app_names->end())
return;
g_app_names->insert(app_name);
std::string window_pref(prefs::kBrowserWindowPlacement);
window_pref.append("_");
window_pref.append(app_name);
PrefService* prefs = g_browser_process->local_state();
DCHECK(prefs);
prefs->RegisterDictionaryPref(window_pref.c_str());
}
| 5,277 |
177,458 | 0 | long ContentEncoding::ParseContentEncodingEntry(long long start, long long size,
IMkvReader* pReader) {
assert(pReader);
long long pos = start;
const long long stop = start + size;
int compression_count = 0;
int encryption_count = 0;
while (pos < stop) {
long long id, size;
const long status = ParseElementHeader(pReader, pos, stop, id, size);
if (status < 0) // error
return status;
if (id == 0x1034) // ContentCompression ID
++compression_count;
if (id == 0x1035) // ContentEncryption ID
++encryption_count;
pos += size; // consume payload
if (pos > stop)
return E_FILE_FORMAT_INVALID;
}
if (compression_count <= 0 && encryption_count <= 0)
return -1;
if (compression_count > 0) {
compression_entries_ =
new (std::nothrow) ContentCompression*[compression_count];
if (!compression_entries_)
return -1;
compression_entries_end_ = compression_entries_;
}
if (encryption_count > 0) {
encryption_entries_ =
new (std::nothrow) ContentEncryption*[encryption_count];
if (!encryption_entries_) {
delete[] compression_entries_;
return -1;
}
encryption_entries_end_ = encryption_entries_;
}
pos = start;
while (pos < stop) {
long long id, size;
long status = ParseElementHeader(pReader, pos, stop, id, size);
if (status < 0) // error
return status;
if (id == 0x1031) {
encoding_order_ = UnserializeUInt(pReader, pos, size);
} else if (id == 0x1032) {
encoding_scope_ = UnserializeUInt(pReader, pos, size);
if (encoding_scope_ < 1)
return -1;
} else if (id == 0x1033) {
encoding_type_ = UnserializeUInt(pReader, pos, size);
} else if (id == 0x1034) {
ContentCompression* const compression =
new (std::nothrow) ContentCompression();
if (!compression)
return -1;
status = ParseCompressionEntry(pos, size, pReader, compression);
if (status) {
delete compression;
return status;
}
*compression_entries_end_++ = compression;
} else if (id == 0x1035) {
ContentEncryption* const encryption =
new (std::nothrow) ContentEncryption();
if (!encryption)
return -1;
status = ParseEncryptionEntry(pos, size, pReader, encryption);
if (status) {
delete encryption;
return status;
}
*encryption_entries_end_++ = encryption;
}
pos += size; // consume payload
if (pos > stop)
return E_FILE_FORMAT_INVALID;
}
if (pos != stop)
return E_FILE_FORMAT_INVALID;
return 0;
}
| 5,278 |
20,602 | 0 | int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
{
int r;
sigset_t sigsaved;
if (vcpu->sigset_active)
sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved);
if (unlikely(vcpu->arch.mp_state == KVM_MP_STATE_UNINITIALIZED)) {
kvm_vcpu_block(vcpu);
clear_bit(KVM_REQ_UNHALT, &vcpu->requests);
r = -EAGAIN;
goto out;
}
if (vcpu->mmio_needed) {
memcpy(vcpu->mmio_data, kvm_run->mmio.data, 8);
kvm_set_mmio_data(vcpu);
vcpu->mmio_read_completed = 1;
vcpu->mmio_needed = 0;
}
r = __vcpu_run(vcpu, kvm_run);
out:
if (vcpu->sigset_active)
sigprocmask(SIG_SETMASK, &sigsaved, NULL);
return r;
}
| 5,279 |
51,207 | 0 | next_CE(struct read_ce_queue *heap)
{
uint64_t a_offset, b_offset, c_offset;
int a, b, c;
struct read_ce_req tmp;
if (heap->cnt < 1)
return;
/*
* Move the last item in the heap to the root of the tree
*/
heap->reqs[0] = heap->reqs[--(heap->cnt)];
/*
* Rebalance the heap.
*/
a = 0; /* Starting element and its offset */
a_offset = heap->reqs[a].offset;
for (;;) {
b = a + a + 1; /* First child */
if (b >= heap->cnt)
return;
b_offset = heap->reqs[b].offset;
c = b + 1; /* Use second child if it is smaller. */
if (c < heap->cnt) {
c_offset = heap->reqs[c].offset;
if (c_offset < b_offset) {
b = c;
b_offset = c_offset;
}
}
if (a_offset <= b_offset)
return;
tmp = heap->reqs[a];
heap->reqs[a] = heap->reqs[b];
heap->reqs[b] = tmp;
a = b;
}
}
| 5,280 |
107,075 | 0 | void QQuickWebView::setUrl(const QUrl& url)
{
Q_D(QQuickWebView);
if (url.isEmpty())
return;
if (!isComponentComplete()) {
d->m_deferedUrlToLoad = url;
return;
}
d->webPageProxy->loadURL(url.toString());
}
| 5,281 |
115,727 | 0 | ACTION_P2(StopScreenRecorder, recorder, task) {
recorder->Stop(task);
}
| 5,282 |
117,645 | 0 | BrowserInit::LaunchWithProfile::LaunchWithProfile(
const FilePath& cur_dir,
const CommandLine& command_line,
BrowserInit* browser_init,
IsFirstRun is_first_run)
: cur_dir_(cur_dir),
command_line_(command_line),
profile_(NULL),
browser_init_(browser_init),
is_first_run_(is_first_run == IS_FIRST_RUN) {
}
| 5,283 |
111,437 | 0 | InputHandler::InputHandler(WebPagePrivate* page)
: m_webPage(page)
, m_currentFocusElement(0)
, m_inputModeEnabled(false)
, m_processingChange(false)
, m_shouldEnsureFocusTextElementVisibleOnSelectionChanged(false)
, m_currentFocusElementType(TextEdit)
, m_currentFocusElementTextEditMask(DEFAULT_STYLE)
, m_composingTextStart(0)
, m_composingTextEnd(0)
, m_pendingKeyboardVisibilityChange(NoChange)
, m_delayKeyboardVisibilityChange(false)
, m_request(0)
, m_processingTransactionId(-1)
, m_receivedBackspaceKeyDown(false)
, m_expectedKeyUpChar(0)
, m_didSpellCheckWord(false)
{
}
| 5,284 |
187,295 | 1 | void FileBrowserHandlerCustomBindings::GetExternalFileEntry(
const v8::FunctionCallbackInfo<v8::Value>& args) {
// TODO(zelidrag): Make this magic work on other platforms when file browser
// matures enough on ChromeOS.
#if defined(OS_CHROMEOS)
CHECK(args.Length() == 1);
CHECK(args[0]->IsObject());
v8::Local<v8::Object> file_def = args[0]->ToObject();
std::string file_system_name(
*v8::String::Utf8Value(file_def->Get(
v8::String::NewFromUtf8(args.GetIsolate(), "fileSystemName"))));
GURL file_system_root(
*v8::String::Utf8Value(file_def->Get(
v8::String::NewFromUtf8(args.GetIsolate(), "fileSystemRoot"))));
std::string file_full_path(
*v8::String::Utf8Value(file_def->Get(
v8::String::NewFromUtf8(args.GetIsolate(), "fileFullPath"))));
bool is_directory = file_def->Get(v8::String::NewFromUtf8(
args.GetIsolate(), "fileIsDirectory"))->ToBoolean()->Value();
blink::WebDOMFileSystem::EntryType entry_type =
is_directory ? blink::WebDOMFileSystem::EntryTypeDirectory
: blink::WebDOMFileSystem::EntryTypeFile;
blink::WebLocalFrame* webframe =
blink::WebLocalFrame::frameForContext(context()->v8_context());
args.GetReturnValue().Set(
blink::WebDOMFileSystem::create(
webframe,
blink::WebFileSystemTypeExternal,
blink::WebString::fromUTF8(file_system_name),
file_system_root)
.createV8Entry(blink::WebString::fromUTF8(file_full_path),
entry_type,
args.Holder(),
args.GetIsolate()));
#endif
}
| 5,285 |
46,601 | 0 | static int sha1_export(struct shash_desc *desc, void *out)
{
struct sha1_state *sctx = shash_desc_ctx(desc);
memcpy(out, sctx, sizeof(*sctx));
return 0;
}
| 5,286 |
180,309 | 1 | create_filesystem_object(struct archive_write_disk *a)
{
/* Create the entry. */
const char *linkname;
mode_t final_mode, mode;
int r;
/* We identify hard/symlinks according to the link names. */
/* Since link(2) and symlink(2) don't handle modes, we're done here. */
linkname = archive_entry_hardlink(a->entry);
if (linkname != NULL) {
#if !HAVE_LINK
return (EPERM);
#else
r = link(linkname, a->name) ? errno : 0;
/*
* New cpio and pax formats allow hardlink entries
* to carry data, so we may have to open the file
* for hardlink entries.
*
* If the hardlink was successfully created and
* the archive doesn't have carry data for it,
* consider it to be non-authoritative for meta data.
* This is consistent with GNU tar and BSD pax.
* If the hardlink does carry data, let the last
* archive entry decide ownership.
*/
if (r == 0 && a->filesize <= 0) {
a->todo = 0;
a->deferred = 0;
} else if (r == 0 && a->filesize > 0) {
a->fd = open(a->name,
O_WRONLY | O_TRUNC | O_BINARY | O_CLOEXEC);
__archive_ensure_cloexec_flag(a->fd);
if (a->fd < 0)
r = errno;
}
return (r);
#endif
}
linkname = archive_entry_symlink(a->entry);
if (linkname != NULL) {
#if HAVE_SYMLINK
return symlink(linkname, a->name) ? errno : 0;
#else
return (EPERM);
#endif
}
/*
* The remaining system calls all set permissions, so let's
* try to take advantage of that to avoid an extra chmod()
* call. (Recall that umask is set to zero right now!)
*/
/* Mode we want for the final restored object (w/o file type bits). */
final_mode = a->mode & 07777;
/*
* The mode that will actually be restored in this step. Note
* that SUID, SGID, etc, require additional work to ensure
* security, so we never restore them at this point.
*/
mode = final_mode & 0777 & ~a->user_umask;
switch (a->mode & AE_IFMT) {
default:
/* POSIX requires that we fall through here. */
/* FALLTHROUGH */
case AE_IFREG:
a->fd = open(a->name,
O_WRONLY | O_CREAT | O_EXCL | O_BINARY | O_CLOEXEC, mode);
__archive_ensure_cloexec_flag(a->fd);
r = (a->fd < 0);
break;
case AE_IFCHR:
#ifdef HAVE_MKNOD
/* Note: we use AE_IFCHR for the case label, and
* S_IFCHR for the mknod() call. This is correct. */
r = mknod(a->name, mode | S_IFCHR,
archive_entry_rdev(a->entry));
break;
#else
/* TODO: Find a better way to warn about our inability
* to restore a char device node. */
return (EINVAL);
#endif /* HAVE_MKNOD */
case AE_IFBLK:
#ifdef HAVE_MKNOD
r = mknod(a->name, mode | S_IFBLK,
archive_entry_rdev(a->entry));
break;
#else
/* TODO: Find a better way to warn about our inability
* to restore a block device node. */
return (EINVAL);
#endif /* HAVE_MKNOD */
case AE_IFDIR:
mode = (mode | MINIMUM_DIR_MODE) & MAXIMUM_DIR_MODE;
r = mkdir(a->name, mode);
if (r == 0) {
/* Defer setting dir times. */
a->deferred |= (a->todo & TODO_TIMES);
a->todo &= ~TODO_TIMES;
/* Never use an immediate chmod(). */
/* We can't avoid the chmod() entirely if EXTRACT_PERM
* because of SysV SGID inheritance. */
if ((mode != final_mode)
|| (a->flags & ARCHIVE_EXTRACT_PERM))
a->deferred |= (a->todo & TODO_MODE);
a->todo &= ~TODO_MODE;
}
break;
case AE_IFIFO:
#ifdef HAVE_MKFIFO
r = mkfifo(a->name, mode);
break;
#else
/* TODO: Find a better way to warn about our inability
* to restore a fifo. */
return (EINVAL);
#endif /* HAVE_MKFIFO */
}
/* All the system calls above set errno on failure. */
if (r)
return (errno);
/* If we managed to set the final mode, we've avoided a chmod(). */
if (mode == final_mode)
a->todo &= ~TODO_MODE;
return (0);
}
| 5,287 |
67,549 | 0 | static void mpage_release_unused_pages(struct mpage_da_data *mpd,
bool invalidate)
{
int nr_pages, i;
pgoff_t index, end;
struct pagevec pvec;
struct inode *inode = mpd->inode;
struct address_space *mapping = inode->i_mapping;
/* This is necessary when next_page == 0. */
if (mpd->first_page >= mpd->next_page)
return;
index = mpd->first_page;
end = mpd->next_page - 1;
if (invalidate) {
ext4_lblk_t start, last;
start = index << (PAGE_SHIFT - inode->i_blkbits);
last = end << (PAGE_SHIFT - inode->i_blkbits);
ext4_es_remove_extent(inode, start, last - start + 1);
}
pagevec_init(&pvec, 0);
while (index <= end) {
nr_pages = pagevec_lookup(&pvec, mapping, index, PAGEVEC_SIZE);
if (nr_pages == 0)
break;
for (i = 0; i < nr_pages; i++) {
struct page *page = pvec.pages[i];
if (page->index > end)
break;
BUG_ON(!PageLocked(page));
BUG_ON(PageWriteback(page));
if (invalidate) {
block_invalidatepage(page, 0, PAGE_SIZE);
ClearPageUptodate(page);
}
unlock_page(page);
}
index = pvec.pages[nr_pages - 1]->index + 1;
pagevec_release(&pvec);
}
}
| 5,288 |
10,628 | 0 | Ins_MIN( FT_Long* args )
{
if ( args[1] < args[0] )
args[0] = args[1];
}
| 5,289 |
61,967 | 0 | static bool skb_flow_dissector_uses_key(struct flow_dissector *flow_dissector,
enum flow_dissector_key_id key_id)
{
return flow_dissector->used_keys & (1 << key_id);
}
| 5,290 |
168,415 | 0 | bool TestBrowserWindow::IsBookmarkBarVisible() const {
return false;
}
| 5,291 |
172,109 | 0 | const hci_hal_t *hci_hal_h4_get_interface() {
vendor = vendor_get_interface();
return &interface;
}
| 5,292 |
106,530 | 0 | void WebPageProxy::forceRepaint(PassRefPtr<VoidCallback> prpCallback)
{
RefPtr<VoidCallback> callback = prpCallback;
if (!isValid()) {
callback->invalidate();
return;
}
uint64_t callbackID = callback->callbackID();
m_voidCallbacks.set(callbackID, callback.get());
process()->send(Messages::WebPage::ForceRepaint(callbackID), m_pageID);
}
| 5,293 |
138,631 | 0 | void RenderFrameHostImpl::AccessibilityPerformAction(
const ui::AXActionData& action_data) {
Send(new AccessibilityMsg_PerformAction(routing_id_, action_data));
}
| 5,294 |
79,708 | 0 | static void r_bin_mdmp_init_parsing(struct r_bin_mdmp_obj *obj) {
/* TODO: Handle unions, can we? */
/* FIXME: Why are we getting struct missing errors when it finds them */
sdb_set (obj->kv, "mdmp_mem_state.cparse",
"enum mdmp_mem_state { MEM_COMMIT=0x1000, "
"MEM_FREE=0x10000, MEM_RESERVE=0x02000 };", 0);
sdb_set (obj->kv, "mdmp_mem_type.cparse",
"enum mdmp_mem_type { MEM_IMAGE=0x1000000, "
"MEM_MAPPED=0x40000, MEM_PRIVATE=0x20000 };", 0);
sdb_set (obj->kv, "mdmp_page_protect.cparse",
"enum mdmp_page_protect { PAGE_NOACCESS=1, "
"PAGE_READONLY=2, PAGE_READWRITE=4, PAGE_WRITECOPY=8, "
"PAGE_EXECUTE=0x10, PAGE_EXECUTE_READ=0x20, "
"PAGE_EXECUTE_READWRITE=0x40, PAGE_EXECUTE_WRITECOPY=0x80, "
"PAGE_GUARD=0x100, PAGE_NOCACHE=0x200, "
"PAGE_WRITECOMBINE=0x400, PAGE_TARGETS_INVALID=0x40000000 };",
0);
sdb_set (obj->kv, "mdmp_misc1_flags.cparse",
"enum mdmp_misc1_flags { MINIDUMP_MISC1_PROCESS_ID=1, "
"MINIDUMP_MISC1_PROCESS_TIMES=2, "
"MINIDUMP_MISC1_PROCESSOR_POWER_INFO=4 };", 0);
sdb_set (obj->kv, "mdmp_processor_architecture.cparse",
"enum mdmp_processor_architecture { "
"PROCESSOR_ARCHITECTURE_INTEL=0, "
"PROCESSOR_ARCHITECTURE_ARM=5, "
"PROCESSOR_ARCHITECTURE_IA64=6, "
"PROCESSOR_ARCHITECTURE_AMD64=9, "
"PROCESSOR_ARCHITECTURE_UNKNOWN=0xffff };", 0);
sdb_set (obj->kv, "mdmp_product_type.cparse",
"enum mdmp_product_type { "
"VER_NT_WORKSTATION=1, VER_NT_DOMAIN_CONTROLLER=2, "
"VER_NT_SERVER=3 };", 0);
sdb_set (obj->kv, "mdmp_platform_id.cparse",
"enum mdmp_platform_id { "
"VER_PLATFORM_WIN32s=0, "
"VER_PLATFORM_WIN32_WINDOWS=1, "
"VER_PLATFORM_WIN32_NT=2 };", 0);
sdb_set (obj->kv, "mdmp_suite_mask.cparse",
"enum mdmp_suite_mask { "
"VER_SUITE_SMALLBUSINESS=1, VER_SUITE_ENTERPRISE=2, "
"VER_SUITE_BACKOFFICE=4, VER_SUITE_TERMINAL=0x10, "
"VER_SUITE_SMALLBUSINESS_RESTRICTED=0x20, "
"VER_SUITE_EMBEDDEDNT=0x40, VER_SUITE_DATACENTER=0x80, "
"VER_SUITE_SINGLEUSERTS=0x100, VER_SUITE_PERSONAL=0x200, "
"VER_SUITE_BLADE=0x400, VER_SUITE_STORAGE_SERVER=0x2000, "
"VER_SUITE_COMPUTE_SERVER=0x4000 };", 0);
sdb_set (obj->kv, "mdmp_callback_type.cparse",
"enum mdmp_type { ModuleCallback=0,"
"ThreadCallback=1, ThreadExCallback=2, "
"IncludeThreadCallback=3, IncludeModuleCallback=4, "
"MemoryCallback=5, CancelCallback=6, "
"WriteKernelMinidumpCallback=7, "
"KernelMinidumpStatusCallback=8, "
"RemoveMemoryCallback=9, "
"IncludeVmRegionCallback=10, "
"IoStartCallback=11, IoWriteAllCallback=12, "
"IoFinishCallback=13, ReadMemoryFailureCallback=14, "
"SecondaryFlagsCallback=15 };", 0);
sdb_set (obj->kv, "mdmp_exception_code.cparse",
"enum mdmp_exception_code { "
"DBG_CONTROL_C=0x40010005, "
"EXCEPTION_GUARD_PAGE_VIOLATION=0x80000001, "
"EXCEPTION_DATATYPE_MISALIGNMENT=0x80000002, "
"EXCEPTION_BREAKPOINT=0x80000003, "
"EXCEPTION_SINGLE_STEP=0x80000004, "
"EXCEPTION_ACCESS_VIOLATION=0xc0000005, "
"EXCEPTION_IN_PAGE_ERROR=0xc0000006, "
"EXCEPTION_INVALID_HANDLE=0xc0000008, "
"EXCEPTION_ILLEGAL_INSTRUCTION=0xc000001d, "
"EXCEPTION_NONCONTINUABLE_EXCEPTION=0xc0000025, "
"EXCEPTION_INVALID_DISPOSITION=0xc0000026, "
"EXCEPTION_ARRAY_BOUNDS_EXCEEDED=0xc000008c, "
"EXCEPTION_FLOAT_DENORMAL_OPERAND=0xc000008d, "
"EXCEPTION_FLOAT_DIVIDE_BY_ZERO=0xc000008e, "
"EXCEPTION_FLOAT_INEXACT_RESULT=0xc000008f, "
"EXCEPTION_FLOAT_INVALID_OPERATION=0xc0000090, "
"EXCEPTION_FLOAT_OVERFLOW=0xc0000091, "
"EXCEPTION_FLOAT_STACK_CHECK=0xc0000092, "
"EXCEPTION_FLOAT_UNDERFLOW=0xc0000093, "
"EXCEPTION_INTEGER_DIVIDE_BY_ZERO=0xc0000094, "
"EXCEPTION_INTEGER_OVERFLOW=0xc0000095, "
"EXCEPTION_PRIVILEGED_INSTRUCTION=0xc0000096, "
"EXCEPTION_STACK_OVERFLOW=0xc00000fd, "
"EXCEPTION_POSSIBLE_DEADLOCK=0xc0000194 };", 0);
sdb_set (obj->kv, "mdmp_exception_flags.cparse",
"enum mdmp_exception_flags { "
"EXCEPTION_CONTINUABLE=0, "
"EXCEPTION_NONCONTINUABLE=1 };", 0);
sdb_set (obj->kv, "mdmp_handle_object_information_type.cparse",
"enum mdmp_handle_object_information_type { "
"MiniHandleObjectInformationNone=0, "
"MiniThreadInformation1=1, MiniMutantInformation1=2, "
"MiniMutantInformation2=3, MiniMutantProcessInformation1=4, "
"MiniProcessInformation2=5 };", 0);
sdb_set (obj->kv, "mdmp_secondary_flags.cparse",
"enum mdmp_secondary_flags { "
"MiniSecondaryWithoutPowerInfo=0 };", 0);
sdb_set (obj->kv, "mdmp_stream_type.cparse",
"enum mdmp_stream_type { UnusedStream=0, "
"ReservedStream0=1, ReservedStream1=2, "
"ThreadListStream=3, ModuleListStream=4, "
"MemoryListStream=5, ExceptionStream=6, "
"SystemInfoStream=7, ThreadExListStream=8, "
"Memory64ListStream=9, CommentStreamA=10, "
"CommentStreamW=11, HandleDataStream=12, "
"FunctionTableStream=13, UnloadedModuleListStream=14, "
"MiscInfoStream=15, MemoryInfoListStream=16, "
"ThreadInfoListStream=17, "
"HandleOperationListStream=18, "
"LastReservedStream=0xffff };", 0);
sdb_set (obj->kv, "mdmp_type.cparse", "enum mdmp_type { "
"MiniDumpNormal=0x0, "
"MiniDumpWithDataSegs=0x1, "
"MiniDumpWithFullMemory=0x2, "
"MiniDumpWithHandleData=0x4, "
"MiniDumpFilterMemory=0x8, "
"MiniDumpScanMemory=0x10, "
"MiniDumpWithUnloadedModule=0x20, "
"MiniDumpWihinDirectlyReferencedMemory=0x40, "
"MiniDumpFilterWithModulePaths=0x80,"
"MiniDumpWithProcessThreadData=0x100, "
"MiniDumpWithPrivateReadWriteMemory=0x200, "
"MiniDumpWithoutOptionalDate=0x400, "
"MiniDumpWithFullMemoryInfo=0x800, "
"MiniDumpWithThreadInfo=0x1000, "
"MiniDumpWithCodeSegs=0x2000, "
"MiniDumpWithoutAuxiliaryState=0x4000, "
"MiniDumpWithFullAuxiliaryState=0x8000, "
"MiniDumpWithPrivateWriteCopyMemory=0x10000, "
"MiniDumpIgnoreInaccessibleMemory=0x20000, "
"MiniDumpWithTokenInformation=0x40000, "
"MiniDumpWithModuleHeaders=0x80000, "
"MiniDumpFilterTriage=0x100000, "
"MiniDumpValidTypeFlags=0x1fffff };", 0);
sdb_set (obj->kv, "mdmp_module_write_flags.cparse",
"enum mdmp_module_write_flags { "
"ModuleWriteModule=0, ModuleWriteDataSeg=2, "
"ModuleWriteMiscRecord=4, ModuleWriteCvRecord=8, "
"ModuleReferencedByMemory=0x10, ModuleWriteTlsData=0x20, "
"ModuleWriteCodeSegs=0x40 };", 0);
sdb_set (obj->kv, "mdmp_thread_write_flags.cparse",
"enum mdmp_thread_write_flags { "
"ThreadWriteThread=0, ThreadWriteStack=2, "
"ThreadWriteContext=4, ThreadWriteBackingStore=8, "
"ThreadWriteInstructionWindow=0x10, "
"ThreadWriteThreadData=0x20, "
"ThreadWriteThreadInfo=0x40 };", 0);
sdb_set (obj->kv, "mdmp_context_flags.cparse",
"enum mdmp_context_flags { CONTEXT_i386=0x10000, "
"CONTEXT_CONTROL=0x10001, CONTEXT_INTEGER=0x10002, "
"CONTEXT_SEGMENTS=0x10004, CONTEXT_FLOATING_POINT=0x10008, "
"CONTEXT_DEBUG_REGISTERS=0x10010, "
"CONTEXT_EXTENDED_REGISTERS=0x10020 };", 0);
sdb_set (obj->kv, "mdmp_location_descriptor.format",
"dd DataSize RVA", 0);
sdb_set (obj->kv, "mdmp_location_descriptor64.format",
"qq DataSize RVA", 0);
sdb_set (obj->kv, "mdmp_memory_descriptor.format", "q? "
"StartOfMemoryRange "
"(mdmp_location_descriptor)Memory", 0);
sdb_set (obj->kv, "mdmp_memory_descriptor64.format", "qq "
"StartOfMemoryRange DataSize", 0);
#if 0
/* TODO: Flag dependent thus not fully implemented */
sdb_set (obj->kv, "mdmp_context.format", "[4]B "
"(mdmp_context_flags)ContextFlags", 0);
#endif
sdb_set (obj->kv, "mdmp_vs_fixedfileinfo.format", "ddddddddddddd "
"dwSignature dwStrucVersion dwFileVersionMs "
"dwFileVersionLs dwProductVersionMs "
"dwProductVersionLs dwFileFlagsMask dwFileFlags "
"dwFileOs dwFileType dwFileSubtype dwFileDateMs "
"dwFileDateLs", 0);
sdb_set (obj->kv, "mdmp_string.format", "dZ Length Buffer", 0);
}
| 5,295 |
156,891 | 0 | DocumentInit& DocumentInit::WithOwnerDocument(Document* owner_document) {
DCHECK(!owner_document_);
owner_document_ = owner_document;
return *this;
}
| 5,296 |
47,576 | 0 | __ap_send(ap_qid_t qid, unsigned long long psmid, void *msg, size_t length,
unsigned int special)
{
typedef struct { char _[length]; } msgblock;
register unsigned long reg0 asm ("0") = qid | 0x40000000UL;
register struct ap_queue_status reg1 asm ("1");
register unsigned long reg2 asm ("2") = (unsigned long) msg;
register unsigned long reg3 asm ("3") = (unsigned long) length;
register unsigned long reg4 asm ("4") = (unsigned int) (psmid >> 32);
register unsigned long reg5 asm ("5") = psmid & 0xffffffff;
if (special == 1)
reg0 |= 0x400000UL;
asm volatile (
"0: .long 0xb2ad0042\n" /* NQAP */
" brc 2,0b"
: "+d" (reg0), "=d" (reg1), "+d" (reg2), "+d" (reg3)
: "d" (reg4), "d" (reg5), "m" (*(msgblock *) msg)
: "cc" );
return reg1;
}
| 5,297 |
73,826 | 0 | static ZEND_RESULT_CODE parse_idn(struct parse_state *state, size_t prev_len)
{
char *idn = NULL;
int rv = -1;
TSRMLS_FETCH_FROM_CTX(state->ts);
if (state->flags & PHP_HTTP_URL_PARSE_MBUTF8) {
rv = idna_to_ascii_8z(state->url.host, &idn, IDNA_ALLOW_UNASSIGNED|IDNA_USE_STD3_ASCII_RULES);
}
# ifdef PHP_HTTP_HAVE_WCHAR
else if (state->flags & PHP_HTTP_URL_PARSE_MBLOC) {
rv = idna_to_ascii_lz(state->url.host, &idn, IDNA_ALLOW_UNASSIGNED|IDNA_USE_STD3_ASCII_RULES);
}
# endif
if (rv != IDNA_SUCCESS) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to parse IDN; %s", idna_strerror(rv));
return FAILURE;
} else {
size_t idnlen = strlen(idn);
memcpy(state->url.host, idn, idnlen + 1);
free(idn);
state->offset += idnlen - prev_len;
return SUCCESS;
}
}
| 5,298 |
36,681 | 0 | bool stratum_send(struct pool *pool, char *s, ssize_t len)
{
enum send_ret ret = SEND_INACTIVE;
if (opt_protocol)
applog(LOG_DEBUG, "SEND: %s", s);
mutex_lock(&pool->stratum_lock);
if (pool->stratum_active)
ret = __stratum_send(pool, s, len);
mutex_unlock(&pool->stratum_lock);
/* This is to avoid doing applog under stratum_lock */
switch (ret) {
default:
case SEND_OK:
break;
case SEND_SELECTFAIL:
applog(LOG_DEBUG, "Write select failed on pool %d sock", pool->pool_no);
suspend_stratum(pool);
break;
case SEND_SENDFAIL:
applog(LOG_DEBUG, "Failed to send in stratum_send");
suspend_stratum(pool);
break;
case SEND_INACTIVE:
applog(LOG_DEBUG, "Stratum send failed due to no pool stratum_active");
break;
}
return (ret == SEND_OK);
}
| 5,299 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.