idx
int64
func
string
target
int64
165,757
xps_parse_path_geometry(xps_document *doc, xps_resource *dict, fz_xml *root, int stroking, int *fill_rule) { fz_xml *node; char *figures_att; char *fill_rule_att; char *transform_att; fz_xml *transform_tag = NULL; fz_xml *figures_tag = NULL; /* only used by resource */ fz_matrix transform; fz_path *path; figures_att = fz_xml_att(root, "Figures"); fill_rule_att = fz_xml_att(root, "FillRule"); transform_att = fz_xml_att(root, "Transform"); for (node = fz_xml_down(root); node; node = fz_xml_next(node)) { if (!strcmp(fz_xml_tag(node), "PathGeometry.Transform")) transform_tag = fz_xml_down(node); } xps_resolve_resource_reference(doc, dict, &transform_att, &transform_tag, NULL); xps_resolve_resource_reference(doc, dict, &figures_att, &figures_tag, NULL); if (fill_rule_att) { if (!strcmp(fill_rule_att, "NonZero")) *fill_rule = 1; if (!strcmp(fill_rule_att, "EvenOdd")) *fill_rule = 0; } transform = fz_identity; if (transform_att) xps_parse_render_transform(doc, transform_att, &transform); if (transform_tag) xps_parse_matrix_transform(doc, transform_tag, &transform); if (figures_att) path = xps_parse_abbreviated_geometry(doc, figures_att, fill_rule); else path = fz_new_path(doc->ctx); if (figures_tag) xps_parse_path_figure(doc->ctx, path, figures_tag, stroking); for (node = fz_xml_down(root); node; node = fz_xml_next(node)) { if (!strcmp(fz_xml_tag(node), "PathFigure")) xps_parse_path_figure(doc->ctx, path, node, stroking); } if (transform_att || transform_tag) fz_transform_path(doc->ctx, path, &transform); return path; }
0
183,542
bool BrowserRootView::CanDrop(const ui::OSExchangeData& data) { if (!tabstrip() || !tabstrip()->visible()) return false; if (data.HasURL()) return true; return GetPasteAndGoURL(data, NULL); }
0
67,718
dist_pl(PG_FUNCTION_ARGS) { Point *pt = PG_GETARG_POINT_P(0); LINE *line = PG_GETARG_LINE_P(1); PG_RETURN_FLOAT8(dist_pl_internal(pt, line)); }
0
52,849
R_API void r_core_bin_export_info_rad(RCore *core) { Sdb *db = NULL; char *flagname = NULL, *offset = NULL; RBinFile *bf = r_bin_cur (core->bin); if (!bf) { return; } db = sdb_ns (bf->sdb, "info", 0);; if (db) { SdbListIter *iter; SdbKv *kv; r_cons_printf ("fs format\n"); // iterate over all keys SdbList *ls = sdb_foreach_list (db, false); ls_foreach (ls, iter, kv) { char *k = sdbkv_key (kv); char *v = sdbkv_value (kv); char *dup = strdup (k); //printf ("?e (%s) (%s)\n", k, v); if ((flagname = strstr (dup, ".offset"))) { *flagname = 0; flagname = dup; r_cons_printf ("f %s @ %s\n", flagname, v); free (offset); offset = strdup (v); } if ((flagname = strstr (dup, ".cparse"))) { r_cons_printf ("\"td %s\"\n", v); } free (dup); } R_FREE (offset); ls_foreach (ls, iter, kv) { char *k = sdbkv_key (kv); char *v = sdbkv_value (kv); char *dup = strdup (k); if ((flagname = strstr (dup, ".format"))) { *flagname = 0; if (!offset) { offset = strdup ("0"); } flagname = dup; r_cons_printf ("pf.%s %s\n", flagname, v); } free (dup); } ls_foreach (ls, iter, kv) { char *k = sdbkv_key (kv); char *v = sdbkv_value (kv); char *dup = strdup (k); if ((flagname = strstr (dup, ".format"))) { *flagname = 0; if (!offset) { offset = strdup ("0"); } flagname = dup; int fmtsize = r_print_format_struct_size (core->print, v, 0, 0); char *offset_key = r_str_newf ("%s.offset", flagname); const char *off = sdb_const_get (db, offset_key, 0); free (offset_key); if (off) { r_cons_printf ("Cf %d %s @ %s\n", fmtsize, v, off); } } if ((flagname = strstr (dup, ".size"))) { *flagname = 0; flagname = dup; r_cons_printf ("fl %s %s\n", flagname, v); } free (dup); } free (offset); } }
0
274,211
static const char *nfs_readdir_copy_name(const char *name, unsigned int len) { const char *ret = kmemdup_nul(name, len, GFP_KERNEL); /* * Avoid a kmemleak false positive. The pointer to the name is stored * in a page cache page which kmemleak does not scan. */ if (ret != NULL) kmemleak_not_leak(ret); return ret; }
0
341,256
void virtqueue_get_avail_bytes(VirtQueue *vq, unsigned int *in_bytes, unsigned int *out_bytes, unsigned max_in_bytes, unsigned max_out_bytes) { unsigned int idx; unsigned int total_bufs, in_total, out_total; idx = vq->last_avail_idx; total_bufs = in_total = out_total = 0; while (virtqueue_num_heads(vq, idx)) { unsigned int max, num_bufs, indirect = 0; hwaddr desc_pa; int i; max = vq->vring.num; num_bufs = total_bufs; i = virtqueue_get_head(vq, idx++); desc_pa = vq->vring.desc; if (vring_desc_flags(desc_pa, i) & VRING_DESC_F_INDIRECT) { if (vring_desc_len(desc_pa, i) % sizeof(VRingDesc)) { error_report("Invalid size for indirect buffer table"); exit(1); } /* If we've got too many, that implies a descriptor loop. */ if (num_bufs >= max) { error_report("Looped descriptor"); exit(1); } /* loop over the indirect descriptor table */ indirect = 1; max = vring_desc_len(desc_pa, i) / sizeof(VRingDesc); num_bufs = i = 0; desc_pa = vring_desc_addr(desc_pa, i); } do { /* If we've got too many, that implies a descriptor loop. */ if (++num_bufs > max) { error_report("Looped descriptor"); exit(1); } if (vring_desc_flags(desc_pa, i) & VRING_DESC_F_WRITE) { in_total += vring_desc_len(desc_pa, i); } else { out_total += vring_desc_len(desc_pa, i); } if (in_total >= max_in_bytes && out_total >= max_out_bytes) { goto done; } } while ((i = virtqueue_next_desc(desc_pa, i, max)) != max); if (!indirect) total_bufs = num_bufs; else total_bufs++; } done: if (in_bytes) { *in_bytes = in_total; } if (out_bytes) { *out_bytes = out_total; } }
0
347,559
ext4_read_block_bitmap_nowait(struct super_block *sb, ext4_group_t block_group) { struct ext4_group_desc *desc; struct buffer_head *bh; ext4_fsblk_t bitmap_blk; int err; desc = ext4_get_group_desc(sb, block_group, NULL); if (!desc) return ERR_PTR(-EFSCORRUPTED); bitmap_blk = ext4_block_bitmap(sb, desc); bh = sb_getblk(sb, bitmap_blk); if (unlikely(!bh)) { ext4_error(sb, "Cannot get buffer for block bitmap - " "block_group = %u, block_bitmap = %llu", block_group, bitmap_blk); return ERR_PTR(-ENOMEM); } if (bitmap_uptodate(bh)) goto verify; lock_buffer(bh); if (bitmap_uptodate(bh)) { unlock_buffer(bh); goto verify; } ext4_lock_group(sb, block_group); if (desc->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) { err = ext4_init_block_bitmap(sb, bh, block_group, desc); set_bitmap_uptodate(bh); set_buffer_uptodate(bh); set_buffer_verified(bh); ext4_unlock_group(sb, block_group); unlock_buffer(bh); if (err) { ext4_error(sb, "Failed to init block bitmap for group " "%u: %d", block_group, err); goto out; } goto verify; } ext4_unlock_group(sb, block_group); if (buffer_uptodate(bh)) { /* * if not uninit if bh is uptodate, * bitmap is also uptodate */ set_bitmap_uptodate(bh); unlock_buffer(bh); goto verify; } /* * submit the buffer_head for reading */ set_buffer_new(bh); trace_ext4_read_block_bitmap_load(sb, block_group); bh->b_end_io = ext4_end_bitmap_read; get_bh(bh); submit_bh(REQ_OP_READ, REQ_META | REQ_PRIO, bh); return bh; verify: err = ext4_validate_block_bitmap(sb, desc, block_group, bh); if (err) goto out; return bh; out: put_bh(bh); return ERR_PTR(err); }
1
475,489
static unsigned long gfn_to_hva_many(struct kvm_memory_slot *slot, gfn_t gfn, gfn_t *nr_pages) { return __gfn_to_hva_many(slot, gfn, nr_pages, true);
0
11,113
AccessibilityOrientation AXNodeObject::orientation() const { const AtomicString& ariaOrientation = getAOMPropertyOrARIAAttribute(AOMStringProperty::kOrientation); AccessibilityOrientation orientation = AccessibilityOrientationUndefined; if (equalIgnoringCase(ariaOrientation, "horizontal")) orientation = AccessibilityOrientationHorizontal; else if (equalIgnoringCase(ariaOrientation, "vertical")) orientation = AccessibilityOrientationVertical; switch (roleValue()) { case ComboBoxRole: case ListBoxRole: case MenuRole: case ScrollBarRole: case TreeRole: if (orientation == AccessibilityOrientationUndefined) orientation = AccessibilityOrientationVertical; return orientation; case MenuBarRole: case SliderRole: case SplitterRole: case TabListRole: case ToolbarRole: if (orientation == AccessibilityOrientationUndefined) orientation = AccessibilityOrientationHorizontal; return orientation; case RadioGroupRole: case TreeGridRole: case TableRole: return orientation; default: return AXObject::orientation(); } }
1
374,320
plperl_event_trigger_handler(PG_FUNCTION_ARGS) { plperl_proc_desc *prodesc; SV *svTD; ErrorContextCallback pl_error_context; /* Connect to SPI manager */ if (SPI_connect() != SPI_OK_CONNECT) elog(ERROR, "could not connect to SPI manager"); /* Find or compile the function */ prodesc = compile_plperl_function(fcinfo->flinfo->fn_oid, false, true); current_call_data->prodesc = prodesc; increment_prodesc_refcount(prodesc); /* Set a callback for error reporting */ pl_error_context.callback = plperl_exec_callback; pl_error_context.previous = error_context_stack; pl_error_context.arg = prodesc->proname; error_context_stack = &pl_error_context; activate_interpreter(prodesc->interp); svTD = plperl_event_trigger_build_args(fcinfo); plperl_call_perl_event_trigger_func(prodesc, fcinfo, svTD); if (SPI_finish() != SPI_OK_FINISH) elog(ERROR, "SPI_finish() failed"); /* Restore the previous error callback */ error_context_stack = pl_error_context.previous; SvREFCNT_dec(svTD); return; }
0
184,364
void GraphicsContext::setPlatformShouldAntialias(bool enable) { if (paintingDisabled()) return; platformContext()->setUseAntialiasing(enable); }
0
34,762
f_test_garbagecollect_now(typval_T *argvars UNUSED, typval_T *rettv UNUSED) { // This is dangerous, any Lists and Dicts used internally may be freed // while still in use. if (!get_vim_var_nr(VV_TESTING)) emsg(_(e_calling_test_garbagecollect_now_while_v_testing_is_not_set)); else garbage_collect(TRUE); }
0
294,153
TEST_F(HTTPDownstreamSessionTest, SingleBytesWithBody) { InSequence enforceOrder; auto handler = addSimpleNiceHandler(); handler->expectHeaders([&] (std::shared_ptr<HTTPMessage> msg) { const HTTPHeaders& hdrs = msg->getHeaders(); EXPECT_EQ(3, hdrs.size()); EXPECT_TRUE(hdrs.exists("host")); EXPECT_TRUE(hdrs.exists("content-length")); EXPECT_TRUE(hdrs.exists("myheader")); EXPECT_FALSE(msg->getIsChunked()); EXPECT_FALSE(msg->getIsUpgraded()); EXPECT_EQ("/somepath.php?param=foo", msg->getURL()); EXPECT_EQ("/somepath.php", msg->getPath()); EXPECT_EQ("param=foo", msg->getQueryString()); EXPECT_EQ(1, msg->getHTTPVersion().first); EXPECT_EQ(1, msg->getHTTPVersion().second); }); EXPECT_CALL(*handler, onBody(_)) .WillOnce(ExpectString("1")) .WillOnce(ExpectString("2")) .WillOnce(ExpectString("3")) .WillOnce(ExpectString("4")) .WillOnce(ExpectString("5")); onEOMTerminateHandlerExpectShutdown(*handler); addSingleByteReads("POST /somepath.php?param=foo HTTP/1.1\r\n" "Host: example.com\r\n" "MyHeader: FooBar\r\n" "Content-Length: 5\r\n" "\r\n" "12345"); transport_->addReadEOF(milliseconds(0)); transport_->startReadEvents(); eventBase_.loop(); }
0
339,299
static av_cold int vdadec_init(AVCodecContext *avctx) { VDADecoderContext *ctx = avctx->priv_data; struct vda_context *vda_ctx = &ctx->vda_ctx; OSStatus status; int ret; ctx->h264_initialized = 0; /* init pix_fmts of codec */ if (!ff_h264_vda_decoder.pix_fmts) { if (kCFCoreFoundationVersionNumber < kCFCoreFoundationVersionNumber10_7) ff_h264_vda_decoder.pix_fmts = vda_pixfmts_prior_10_7; else ff_h264_vda_decoder.pix_fmts = vda_pixfmts; /* init vda */ memset(vda_ctx, 0, sizeof(struct vda_context)); vda_ctx->width = avctx->width; vda_ctx->height = avctx->height; vda_ctx->format = 'avc1'; vda_ctx->use_sync_decoding = 1; vda_ctx->use_ref_buffer = 1; ctx->pix_fmt = avctx->get_format(avctx, avctx->codec->pix_fmts); switch (ctx->pix_fmt) { case AV_PIX_FMT_UYVY422: vda_ctx->cv_pix_fmt_type = '2vuy'; break; case AV_PIX_FMT_YUYV422: vda_ctx->cv_pix_fmt_type = 'yuvs'; break; case AV_PIX_FMT_NV12: vda_ctx->cv_pix_fmt_type = '420v'; break; case AV_PIX_FMT_YUV420P: vda_ctx->cv_pix_fmt_type = 'y420'; break; default: av_log(avctx, AV_LOG_ERROR, "Unsupported pixel format: %d\n", avctx->pix_fmt); status = ff_vda_create_decoder(vda_ctx, avctx->extradata, avctx->extradata_size); if (status != kVDADecoderNoErr) { av_log(avctx, AV_LOG_ERROR, "Failed to init VDA decoder: %d.\n", status); /* init H.264 decoder */ set_context(avctx); ret = ff_h264_decoder.init(avctx); restore_context(avctx); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Failed to open H.264 decoder.\n"); ctx->h264_initialized = 1; return 0; failed: vdadec_close(avctx); return -1;
1
332,061
int main(int argc, char* argv[]) { FILE *f[2]; uint8_t *buf[2], *plane[2][3]; int *temp; uint64_t ssd[3] = {0,0,0}; double ssim[3] = {0,0,0}; int frame_size, w, h; int frames, seek; int i; if( argc<4 || 2 != sscanf(argv[3], "%dx%d", &w, &h) ) { printf("tiny_ssim <file1.yuv> <file2.yuv> <width>x<height> [<seek>]\n"); return -1; } f[0] = fopen(argv[1], "rb"); f[1] = fopen(argv[2], "rb"); sscanf(argv[3], "%dx%d", &w, &h); frame_size = w*h*3/2; for( i=0; i<2; i++ ) { buf[i] = malloc(frame_size); plane[i][0] = buf[i]; plane[i][1] = plane[i][0] + w*h; plane[i][2] = plane[i][1] + w*h/4; } temp = malloc((2*w+12)*sizeof(*temp)); seek = argc<5 ? 0 : atoi(argv[4]); fseek(f[seek<0], seek < 0 ? -seek : seek, SEEK_SET); for( frames=0;; frames++ ) { uint64_t ssd_one[3]; double ssim_one[3]; if( fread(buf[0], frame_size, 1, f[0]) != 1) break; if( fread(buf[1], frame_size, 1, f[1]) != 1) break; for( i=0; i<3; i++ ) { ssd_one[i] = ssd_plane ( plane[0][i], plane[1][i], w*h>>2*!!i ); ssim_one[i] = ssim_plane( plane[0][i], w>>!!i, plane[1][i], w>>!!i, w>>!!i, h>>!!i, temp, NULL ); ssd[i] += ssd_one[i]; ssim[i] += ssim_one[i]; } printf("Frame %d | ", frames); print_results(ssd_one, ssim_one, 1, w, h); printf(" \r"); fflush(stdout); } if( !frames ) return 0; printf("Total %d frames | ", frames); print_results(ssd, ssim, frames, w, h); printf("\n"); return 0; }
1
306,512
mymono_metadata_type_hash (MonoType *t1) { guint hash; hash = t1->type; hash |= t1->byref << 6; /* do not collide with t1->type values */ switch (t1->type) { case MONO_TYPE_VALUETYPE: case MONO_TYPE_CLASS: case MONO_TYPE_SZARRAY: /* check if the distribution is good enough */ return ((hash << 5) - hash) ^ mono_aligned_addr_hash (t1->data.klass); case MONO_TYPE_PTR: return ((hash << 5) - hash) ^ mymono_metadata_type_hash (t1->data.type); case MONO_TYPE_GENERICINST: { int i; MonoGenericInst *inst = t1->data.generic_class->context.class_inst; hash += g_str_hash (t1->data.generic_class->container_class->name); hash *= 13; for (i = 0; i < inst->type_argc; ++i) { hash += mymono_metadata_type_hash (inst->type_argv [i]); hash *= 13; } return hash; } case MONO_TYPE_VAR: case MONO_TYPE_MVAR: return ((hash << 5) - hash) ^ GPOINTER_TO_UINT (t1->data.generic_param); } return hash; }
0
84,613
TEST_F(SslServerContextImplTicketTest, CRLSuccess) { const std::string yaml = R"EOF( common_tls_context: tls_certificates: certificate_chain: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_dns_cert.pem" private_key: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_dns_key.pem" validation_context: trusted_ca: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/ca_cert.pem" crl: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/ca_cert.crl" )EOF"; EXPECT_NO_THROW(loadConfigYaml(yaml)); }
0
154,883
TEST_F(EnvoyQuicProofSourceTest, UnexpectedPrivateKey) { EXPECT_CALL(listen_socket_, ioHandle()); EXPECT_CALL(filter_chain_manager_, findFilterChain(_)) .WillOnce(Invoke([&](const Network::ConnectionSocket&) { return &filter_chain_; })); EXPECT_CALL(filter_chain_, transportSocketFactory()) .WillRepeatedly(ReturnRef(*transport_socket_factory_)); Ssl::MockTlsCertificateConfig tls_cert_config; std::vector<std::reference_wrapper<const Envoy::Ssl::TlsCertificateConfig>> tls_cert_configs{ std::reference_wrapper<const Envoy::Ssl::TlsCertificateConfig>(tls_cert_config)}; EXPECT_CALL(*mock_context_config_, tlsCertificates()).WillRepeatedly(Return(tls_cert_configs)); EXPECT_CALL(*mock_context_config_, isReady()).WillOnce(Return(true)); std::string rsa_pkey_1024_len(R"(-----BEGIN RSA PRIVATE KEY----- MIICWwIBAAKBgQC79hDq/OwN3ke3EF6Ntdi9R+VSrl9MStk992l1us8lZhq+e0zU OlvxbUeZ8wyVkzs1gqI1it1IwF+EpdGhHhjggZjg040GD3HWSuyCzpHh+nLwJxtQ D837PCg0zl+TnKv1YjY3I1F3trGhIqfd2B6pgaJ4hpr+0hdqnKP0Htd4DwIDAQAB AoGASNypUD59Tx70k+1fifWNMEq3heacgJmfPxsyoXWqKSg8g8yOStLYo20mTXJf VXg+go7CTJkpELOqE2SoL5nYMD0D/YIZCgDx85k0GWHdA6udNn4to95ZTeZPrBHx T0QNQHnZI3A7RwLinO60IRY0NYzhkTEBxIuvIY6u0DVbrAECQQDpshbxK3DHc7Yi Au7BUsxP8RbG4pP5IIVoD4YvJuwUkdrfrwejqTdkfchJJc+Gu/+h8vy7eASPHLLT NBk5wFoPAkEAzeaKnx0CgNs0RX4+sSF727FroD98VUM38OFEJQ6U9OAWGvaKd8ey yAYUjR2Sl5ZRyrwWv4IqyWgUGhZqNG0CAQJAPTjjm8DGpenhcB2WkNzxG4xMbEQV gfGMIYvXmmi29liTn4AKH00IbvIo00jtih2cRcATh8VUZG2fR4dhiGik7wJAWSwS NwzaS7IjtkERp6cHvELfiLxV/Zsp/BGjcKUbD96I1E6X834ySHyRo/f9x9bbP4Es HO6j1yxTIGU6w8++AQJACdFPnRidOaj5oJmcZq0s6WGTYfegjTOKgi5KQzO0FTwG qGm130brdD+1U1EJnEFmleLZ/W6mEi3MxcKpWOpTqQ== -----END RSA PRIVATE KEY-----)"); EXPECT_CALL(tls_cert_config, privateKey()).WillOnce(ReturnRef(rsa_pkey_1024_len)); std::string signature; proof_source_.ComputeTlsSignature( server_address_, client_address_, hostname_, SSL_SIGN_RSA_PSS_RSAE_SHA256, "payload", std::make_unique<TestSignatureCallback>(false, filter_chain_, signature)); }
0
403,377
mysql_refresh(MYSQL *mysql,uint options) { uchar bits[1]; DBUG_ENTER("mysql_refresh"); bits[0]= (uchar) options; DBUG_RETURN(simple_command(mysql, COM_REFRESH, bits, 1, 0)); }
0
63,827
static URI_INLINE const URI_CHAR * URI_FUNC(ParseIpLit2)( URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory) { if (first >= afterLast) { URI_FUNC(StopSyntax)(state, first, memory); return NULL; } switch (*first) { case _UT('v'): { const URI_CHAR * const afterIpFuture = URI_FUNC(ParseIpFuture)(state, first, afterLast, memory); if (afterIpFuture == NULL) { return NULL; } if ((afterIpFuture >= afterLast) || (*afterIpFuture != _UT(']'))) { URI_FUNC(StopSyntax)(state, first, memory); return NULL; } return afterIpFuture + 1; } case _UT(':'): case _UT(']'): case URI_SET_HEXDIG: state->uri->hostData.ip6 = memory->malloc(memory, 1 * sizeof(UriIp6)); /* Freed when stopping on parse error */ if (state->uri->hostData.ip6 == NULL) { URI_FUNC(StopMalloc)(state, memory); return NULL; } return URI_FUNC(ParseIPv6address2)(state, first, afterLast, memory); default: URI_FUNC(StopSyntax)(state, first, memory); return NULL; } }
0
317,627
RefCountedMemory* ChromeWebUIControllerFactory::GetFaviconResourceBytes( const GURL& page_url) const { if (page_url.host() == extension_misc::kBookmarkManagerId) return BookmarksUI::GetFaviconResourceBytes(); if (page_url.SchemeIs(chrome::kExtensionScheme)) { NOTREACHED(); return NULL; } if (!content::GetContentClient()->HasWebUIScheme(page_url)) return NULL; #if defined(OS_WIN) if (page_url.host() == chrome::kChromeUIConflictsHost) return ConflictsUI::GetFaviconResourceBytes(); #endif if (page_url.host() == chrome::kChromeUICrashesHost) return CrashesUI::GetFaviconResourceBytes(); if (page_url.host() == chrome::kChromeUIHistoryHost) return HistoryUI::GetFaviconResourceBytes(); if (page_url.host() == chrome::kChromeUIFlagsHost) return FlagsUI::GetFaviconResourceBytes(); if (page_url.host() == chrome::kChromeUISessionsHost) return SessionsUI::GetFaviconResourceBytes(); if (page_url.host() == chrome::kChromeUIFlashHost) return FlashUI::GetFaviconResourceBytes(); #if !defined(OS_ANDROID) if (page_url.host() == chrome::kChromeUIDownloadsHost) return DownloadsUI::GetFaviconResourceBytes(); if (page_url.host() == chrome::kChromeUISettingsHost) return OptionsUI::GetFaviconResourceBytes(); if (page_url.host() == chrome::kChromeUISettingsFrameHost) return options2::OptionsUI::GetFaviconResourceBytes(); #endif if (page_url.host() == chrome::kChromeUIPluginsHost) return PluginsUI::GetFaviconResourceBytes(); return NULL; }
0
2,256
error_t ssiProcessExecCommand(HttpConnection *connection, const char_t *tag, size_t length) { char_t *separator; char_t *attribute; char_t *value; //First, check whether CGI is supported by the server if(connection->settings->cgiCallback == NULL) return ERROR_INVALID_TAG; //Discard invalid SSI directives if(length < 4 || length >= HTTP_SERVER_BUFFER_SIZE) return ERROR_INVALID_TAG; //Skip the SSI exec command (4 bytes) osMemcpy(connection->buffer, tag + 4, length - 4); //Ensure the resulting string is NULL-terminated connection->buffer[length - 4] = '\0'; //Check whether a separator is present separator = strchr(connection->buffer, '='); //Separator not found? if(!separator) return ERROR_INVALID_TAG; //Split the tag *separator = '\0'; //Get attribute name and value attribute = strTrimWhitespace(connection->buffer); value = strTrimWhitespace(separator + 1); //Remove leading simple or double quote if(value[0] == '\'' || value[0] == '\"') value++; //Get the length of the attribute value length = osStrlen(value); //Remove trailing simple or double quote if(length > 0) { if(value[length - 1] == '\'' || value[length - 1] == '\"') value[length - 1] = '\0'; } //Enforce attribute name if(osStrcasecmp(attribute, "cgi") && osStrcasecmp(attribute, "cmd") && osStrcasecmp(attribute, "cmd_argument")) return ERROR_INVALID_TAG; //Check the length of the CGI parameter if(osStrlen(value) > HTTP_SERVER_CGI_PARAM_MAX_LEN) return ERROR_INVALID_TAG; //The scratch buffer may be altered by the user-defined callback. //So the CGI parameter must be copied prior to function invocation osStrcpy(connection->cgiParam, value); //Invoke user-defined callback return connection->settings->cgiCallback(connection, connection->cgiParam); }
1
182,206
internalEntityProcessor(XML_Parser parser, const char *s, const char *end, const char **nextPtr) { ENTITY *entity; const char *textStart, *textEnd; const char *next; enum XML_Error result; OPEN_INTERNAL_ENTITY *openEntity = parser->m_openInternalEntities; if (!openEntity) return XML_ERROR_UNEXPECTED_STATE; entity = openEntity->entity; textStart = ((char *)entity->textPtr) + entity->processed; textEnd = (char *)(entity->textPtr + entity->textLen); /* Set a safe default value in case 'next' does not get set */ next = textStart; #ifdef XML_DTD if (entity->is_param) { int tok = XmlPrologTok(parser->m_internalEncoding, textStart, textEnd, &next); result = doProlog(parser, parser->m_internalEncoding, textStart, textEnd, tok, next, &next, XML_FALSE); } else #endif /* XML_DTD */ result = doContent(parser, openEntity->startTagLevel, parser->m_internalEncoding, textStart, textEnd, &next, XML_FALSE); if (result != XML_ERROR_NONE) return result; else if (textEnd != next && parser->m_parsingStatus.parsing == XML_SUSPENDED) { entity->processed = (int)(next - (char *)entity->textPtr); return result; } else { entity->open = XML_FALSE; parser->m_openInternalEntities = openEntity->next; /* put openEntity back in list of free instances */ openEntity->next = parser->m_freeInternalEntities; parser->m_freeInternalEntities = openEntity; } #ifdef XML_DTD if (entity->is_param) { int tok; parser->m_processor = prologProcessor; tok = XmlPrologTok(parser->m_encoding, s, end, &next); return doProlog(parser, parser->m_encoding, s, end, tok, next, nextPtr, (XML_Bool)!parser->m_parsingStatus.finalBuffer); } else #endif /* XML_DTD */ { parser->m_processor = contentProcessor; /* see externalEntityContentProcessor vs contentProcessor */ return doContent(parser, parser->m_parentParser ? 1 : 0, parser->m_encoding, s, end, nextPtr, (XML_Bool)!parser->m_parsingStatus.finalBuffer); } }
0
498,553
transformAlterTableStmt(Oid relid, AlterTableStmt *stmt, const char *queryString) { Relation rel; ParseState *pstate; CreateStmtContext cxt; List *result; List *save_alist; ListCell *lcmd, *l; List *newcmds = NIL; bool skipValidation = true; AlterTableCmd *newcmd; RangeTblEntry *rte; /* * We must not scribble on the passed-in AlterTableStmt, so copy it. (This * is overkill, but easy.) */ stmt = copyObject(stmt); /* Caller is responsible for locking the relation */ rel = relation_open(relid, NoLock); /* Set up pstate */ pstate = make_parsestate(NULL); pstate->p_sourcetext = queryString; rte = addRangeTableEntryForRelation(pstate, rel, NULL, false, true); addRTEtoQuery(pstate, rte, false, true, true); /* Set up CreateStmtContext */ cxt.pstate = pstate; if (stmt->relkind == OBJECT_FOREIGN_TABLE) { cxt.stmtType = "ALTER FOREIGN TABLE"; cxt.isforeign = true; } else { cxt.stmtType = "ALTER TABLE"; cxt.isforeign = false; } cxt.relation = stmt->relation; cxt.rel = rel; cxt.inhRelations = NIL; cxt.isalter = true; cxt.hasoids = false; /* need not be right */ cxt.columns = NIL; cxt.ckconstraints = NIL; cxt.fkconstraints = NIL; cxt.ixconstraints = NIL; cxt.likeclauses = NIL; cxt.extstats = NIL; cxt.blist = NIL; cxt.alist = NIL; cxt.pkey = NULL; cxt.ispartitioned = (rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE); cxt.partbound = NULL; cxt.ofType = false; /* * The only subtypes that currently require parse transformation handling * are ADD COLUMN, ADD CONSTRAINT and SET DATA TYPE. These largely re-use * code from CREATE TABLE. */ foreach(lcmd, stmt->cmds) { AlterTableCmd *cmd = (AlterTableCmd *) lfirst(lcmd); switch (cmd->subtype) { case AT_AddColumn: case AT_AddColumnToView: { ColumnDef *def = castNode(ColumnDef, cmd->def); transformColumnDefinition(&cxt, def); /* * If the column has a non-null default, we can't skip * validation of foreign keys. */ if (def->raw_default != NULL) skipValidation = false; /* * All constraints are processed in other ways. Remove the * original list */ def->constraints = NIL; newcmds = lappend(newcmds, cmd); break; } case AT_AddConstraint: /* * The original AddConstraint cmd node doesn't go to newcmds */ if (IsA(cmd->def, Constraint)) { transformTableConstraint(&cxt, (Constraint *) cmd->def); if (((Constraint *) cmd->def)->contype == CONSTR_FOREIGN) skipValidation = false; } else elog(ERROR, "unrecognized node type: %d", (int) nodeTag(cmd->def)); break; case AT_ProcessedConstraint: /* * Already-transformed ADD CONSTRAINT, so just make it look * like the standard case. */ cmd->subtype = AT_AddConstraint; newcmds = lappend(newcmds, cmd); break; case AT_AlterColumnType: { ColumnDef *def = (ColumnDef *) cmd->def; AttrNumber attnum; /* * For ALTER COLUMN TYPE, transform the USING clause if * one was specified. */ if (def->raw_default) { def->cooked_default = transformExpr(pstate, def->raw_default, EXPR_KIND_ALTER_COL_TRANSFORM); } /* * For identity column, create ALTER SEQUENCE command to * change the data type of the sequence. */ attnum = get_attnum(relid, cmd->name); /* * if attribute not found, something will error about it * later */ if (attnum > 0 && get_attidentity(relid, attnum)) { Oid seq_relid = getOwnedSequence(relid, attnum); Oid typeOid = typenameTypeId(pstate, def->typeName); AlterSeqStmt *altseqstmt = makeNode(AlterSeqStmt); altseqstmt->sequence = makeRangeVar(get_namespace_name(get_rel_namespace(seq_relid)), get_rel_name(seq_relid), -1); altseqstmt->options = list_make1(makeDefElem("as", (Node *) makeTypeNameFromOid(typeOid, -1), -1)); altseqstmt->for_identity = true; cxt.blist = lappend(cxt.blist, altseqstmt); } newcmds = lappend(newcmds, cmd); break; } case AT_AddIdentity: { Constraint *def = castNode(Constraint, cmd->def); ColumnDef *newdef = makeNode(ColumnDef); AttrNumber attnum; newdef->colname = cmd->name; newdef->identity = def->generated_when; cmd->def = (Node *) newdef; attnum = get_attnum(relid, cmd->name); /* * if attribute not found, something will error about it * later */ if (attnum != InvalidAttrNumber) generateSerialExtraStmts(&cxt, newdef, get_atttype(relid, attnum), def->options, true, NULL, NULL); newcmds = lappend(newcmds, cmd); break; } case AT_SetIdentity: { /* * Create an ALTER SEQUENCE statement for the internal * sequence of the identity column. */ ListCell *lc; List *newseqopts = NIL; List *newdef = NIL; List *seqlist; AttrNumber attnum; /* * Split options into those handled by ALTER SEQUENCE and * those for ALTER TABLE proper. */ foreach(lc, castNode(List, cmd->def)) { DefElem *def = lfirst_node(DefElem, lc); if (strcmp(def->defname, "generated") == 0) newdef = lappend(newdef, def); else newseqopts = lappend(newseqopts, def); } attnum = get_attnum(relid, cmd->name); if (attnum) { seqlist = getOwnedSequences(relid, attnum); if (seqlist) { AlterSeqStmt *seqstmt; Oid seq_relid; seqstmt = makeNode(AlterSeqStmt); seq_relid = linitial_oid(seqlist); seqstmt->sequence = makeRangeVar(get_namespace_name(get_rel_namespace(seq_relid)), get_rel_name(seq_relid), -1); seqstmt->options = newseqopts; seqstmt->for_identity = true; seqstmt->missing_ok = false; cxt.alist = lappend(cxt.alist, seqstmt); } } /* * If column was not found or was not an identity column, * we just let the ALTER TABLE command error out later. */ cmd->def = (Node *) newdef; newcmds = lappend(newcmds, cmd); break; } case AT_AttachPartition: case AT_DetachPartition: { PartitionCmd *partcmd = (PartitionCmd *) cmd->def; transformPartitionCmd(&cxt, partcmd); /* assign transformed value of the partition bound */ partcmd->bound = cxt.partbound; } newcmds = lappend(newcmds, cmd); break; default: newcmds = lappend(newcmds, cmd); break; } } /* * transformIndexConstraints wants cxt.alist to contain only index * statements, so transfer anything we already have into save_alist * immediately. */ save_alist = cxt.alist; cxt.alist = NIL; /* Postprocess constraints */ transformIndexConstraints(&cxt); transformFKConstraints(&cxt, skipValidation, true); transformCheckConstraints(&cxt, false); /* * Push any index-creation commands into the ALTER, so that they can be * scheduled nicely by tablecmds.c. Note that tablecmds.c assumes that * the IndexStmt attached to an AT_AddIndex or AT_AddIndexConstraint * subcommand has already been through transformIndexStmt. */ foreach(l, cxt.alist) { IndexStmt *idxstmt = lfirst_node(IndexStmt, l); idxstmt = transformIndexStmt(relid, idxstmt, queryString); newcmd = makeNode(AlterTableCmd); newcmd->subtype = OidIsValid(idxstmt->indexOid) ? AT_AddIndexConstraint : AT_AddIndex; newcmd->def = (Node *) idxstmt; newcmds = lappend(newcmds, newcmd); } cxt.alist = NIL; /* Append any CHECK or FK constraints to the commands list */ foreach(l, cxt.ckconstraints) { newcmd = makeNode(AlterTableCmd); newcmd->subtype = AT_AddConstraint; newcmd->def = (Node *) lfirst(l); newcmds = lappend(newcmds, newcmd); } foreach(l, cxt.fkconstraints) { newcmd = makeNode(AlterTableCmd); newcmd->subtype = AT_AddConstraint; newcmd->def = (Node *) lfirst(l); newcmds = lappend(newcmds, newcmd); } /* Append extended statistic objects */ transformExtendedStatistics(&cxt); /* Close rel */ relation_close(rel, NoLock); /* * Output results. */ stmt->cmds = newcmds; result = lappend(cxt.blist, stmt); result = list_concat(result, cxt.alist); result = list_concat(result, save_alist); return result; }
0
249,018
Extension::SyncType Extension::GetSyncType() const { if (!IsSyncable()) { return SYNC_TYPE_NONE; } if (!ManifestURL::GetUpdateURL(this).is_empty() && !UpdatesFromGallery()) return SYNC_TYPE_NONE; if (!plugins().empty()) { return SYNC_TYPE_NONE; } switch (GetType()) { case Manifest::TYPE_EXTENSION: return SYNC_TYPE_EXTENSION; case Manifest::TYPE_USER_SCRIPT: if (UpdatesFromGallery()) return SYNC_TYPE_EXTENSION; else return SYNC_TYPE_NONE; case Manifest::TYPE_HOSTED_APP: case Manifest::TYPE_LEGACY_PACKAGED_APP: case Manifest::TYPE_PLATFORM_APP: return SYNC_TYPE_APP; default: return SYNC_TYPE_NONE; } }
0
36,348
wkbConvCurvePolygonToShape(wkbObj *w, shapeObj *shape) { int type, i, ncomponents; int failures = 0; int was_poly = ( shape->type == MS_SHAPE_POLYGON ); /*endian = */wkbReadChar(w); type = wkbTypeMap(w,wkbReadInt(w)); ncomponents = wkbReadInt(w); if( type != WKB_CURVEPOLYGON ) return MS_FAILURE; /* Lower the allowed dimensionality so we can * catch the linear ring components */ shape->type = MS_SHAPE_LINE; for ( i = 0; i < ncomponents; i++ ) { if ( wkbConvGeometryToShape(w, shape) == MS_FAILURE ) { wkbSkipGeometry(w); failures++; } } /* Go back to expected dimensionality */ if ( was_poly) shape->type = MS_SHAPE_POLYGON; if ( failures == ncomponents ) return MS_FAILURE; else return MS_SUCCESS; }
0
497,297
static int ff_layout_write_done_cb(struct rpc_task *task, struct nfs_pgio_header *hdr) { loff_t end_offs = 0; int err; if (task->tk_status < 0) { ff_layout_io_track_ds_error(hdr->lseg, hdr->pgio_mirror_idx, hdr->args.offset, hdr->args.count, &hdr->res.op_status, OP_WRITE, task->tk_status); trace_ff_layout_write_error(hdr); } err = ff_layout_async_handle_error(task, hdr->args.context->state, hdr->ds_clp, hdr->lseg, hdr->pgio_mirror_idx); trace_nfs4_pnfs_write(hdr, err); clear_bit(NFS_IOHDR_RESEND_PNFS, &hdr->flags); clear_bit(NFS_IOHDR_RESEND_MDS, &hdr->flags); switch (err) { case -NFS4ERR_RESET_TO_PNFS: set_bit(NFS_IOHDR_RESEND_PNFS, &hdr->flags); return task->tk_status; case -NFS4ERR_RESET_TO_MDS: set_bit(NFS_IOHDR_RESEND_MDS, &hdr->flags); return task->tk_status; case -EAGAIN: return -EAGAIN; } if (hdr->res.verf->committed == NFS_FILE_SYNC || hdr->res.verf->committed == NFS_DATA_SYNC) end_offs = hdr->mds_offset + (loff_t)hdr->res.count; /* Note: if the write is unstable, don't set end_offs until commit */ ff_layout_set_layoutcommit(hdr->inode, hdr->lseg, end_offs); /* zero out fattr since we don't care DS attr at all */ hdr->fattr.valid = 0; if (task->tk_status >= 0) nfs_writeback_update_inode(hdr); return 0; }
0
441,760
static inline unsigned php_unicode_tolower_full( unsigned code, enum mbfl_no_encoding enc, unsigned *out) { code = php_unicode_tolower_raw(code, enc); if (UNEXPECTED(code > 0xffffff)) { unsigned len = code >> 24; const unsigned *p = &_uccase_extra_table[code & 0xffffff]; memcpy(out, p + 1, len * sizeof(unsigned)); return len; } *out = code; return 1; }
0
134,503
usm_get_userList(void) { return userList; }
0
218,354
bool FeatureInfo::IsWebGL1OrES2Context() const { return IsWebGL1OrES2ContextType(context_type_); }
0
209,331
virtual void AddObserver(Observer* observer) { virtual void AddObserver(InputMethodLibrary::Observer* observer) { if (!observers_.size()) { observer->FirstObserverIsAdded(this); } observers_.AddObserver(observer); }
0
291,121
void trace_buffered_event_enable(void) { struct ring_buffer_event *event; struct page *page; int cpu; WARN_ON_ONCE(!mutex_is_locked(&event_mutex)); if (trace_buffered_event_ref++) return; for_each_tracing_cpu(cpu) { page = alloc_pages_node(cpu_to_node(cpu), GFP_KERNEL | __GFP_NORETRY, 0); if (!page) goto failed; event = page_address(page); memset(event, 0, sizeof(*event)); per_cpu(trace_buffered_event, cpu) = event; preempt_disable(); if (cpu == smp_processor_id() && this_cpu_read(trace_buffered_event) != per_cpu(trace_buffered_event, cpu)) WARN_ON_ONCE(1); preempt_enable(); } return; failed: trace_buffered_event_disable(); }
0
171,740
Eina_Bool ewk_view_user_scalable_get(const Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); return priv->settings.zoomRange.userScalable; }
0
55,438
void rfbSendInteractionCaps(rfbClientPtr cl) { rfbInteractionCapsMsg intr_caps; rfbCapabilityInfo enc_list[N_ENC_CAPS]; int i; /* Fill in the header structure sent prior to capability lists. */ intr_caps.nServerMessageTypes = Swap16IfLE(N_SMSG_CAPS); intr_caps.nClientMessageTypes = Swap16IfLE(N_CMSG_CAPS); intr_caps.nEncodingTypes = Swap16IfLE(N_ENC_CAPS); intr_caps.pad = 0; /* Supported server->client message types. */ /* For future file transfer support: i = 0; SetCapInfo(&smsg_list[i++], rfbFileListData, rfbTightVncVendor); SetCapInfo(&smsg_list[i++], rfbFileDownloadData, rfbTightVncVendor); SetCapInfo(&smsg_list[i++], rfbFileUploadCancel, rfbTightVncVendor); SetCapInfo(&smsg_list[i++], rfbFileDownloadFailed, rfbTightVncVendor); if (i != N_SMSG_CAPS) { rfbLog("rfbSendInteractionCaps: assertion failed, i != N_SMSG_CAPS\n"); rfbCloseClient(cl); return; } */ /* Supported client->server message types. */ /* For future file transfer support: i = 0; SetCapInfo(&cmsg_list[i++], rfbFileListRequest, rfbTightVncVendor); SetCapInfo(&cmsg_list[i++], rfbFileDownloadRequest, rfbTightVncVendor); SetCapInfo(&cmsg_list[i++], rfbFileUploadRequest, rfbTightVncVendor); SetCapInfo(&cmsg_list[i++], rfbFileUploadData, rfbTightVncVendor); SetCapInfo(&cmsg_list[i++], rfbFileDownloadCancel, rfbTightVncVendor); SetCapInfo(&cmsg_list[i++], rfbFileUploadFailed, rfbTightVncVendor); if (i != N_CMSG_CAPS) { rfbLog("rfbSendInteractionCaps: assertion failed, i != N_CMSG_CAPS\n"); rfbCloseClient(cl); return; } */ /* Encoding types. */ i = 0; SetCapInfo(&enc_list[i++], rfbEncodingCopyRect, rfbStandardVendor); SetCapInfo(&enc_list[i++], rfbEncodingRRE, rfbStandardVendor); SetCapInfo(&enc_list[i++], rfbEncodingCoRRE, rfbStandardVendor); SetCapInfo(&enc_list[i++], rfbEncodingHextile, rfbStandardVendor); SetCapInfo(&enc_list[i++], rfbEncodingZlib, rfbTridiaVncVendor); SetCapInfo(&enc_list[i++], rfbEncodingZRLE, rfbTridiaVncVendor); SetCapInfo(&enc_list[i++], rfbEncodingZYWRLE, rfbTridiaVncVendor); SetCapInfo(&enc_list[i++], rfbEncodingTight, rfbTightVncVendor); SetCapInfo(&enc_list[i++], rfbEncodingCompressLevel0, rfbTightVncVendor); SetCapInfo(&enc_list[i++], rfbEncodingQualityLevel0, rfbTightVncVendor); SetCapInfo(&enc_list[i++], rfbEncodingFineQualityLevel0, rfbTurboVncVendor); SetCapInfo(&enc_list[i++], rfbEncodingSubsamp1X, rfbTurboVncVendor); SetCapInfo(&enc_list[i++], rfbEncodingXCursor, rfbTightVncVendor); SetCapInfo(&enc_list[i++], rfbEncodingRichCursor, rfbTightVncVendor); SetCapInfo(&enc_list[i++], rfbEncodingPointerPos, rfbTightVncVendor); SetCapInfo(&enc_list[i++], rfbEncodingLastRect, rfbTightVncVendor); SetCapInfo(&enc_list[i++], rfbGIIServer, rfbGIIVendor); if (i != N_ENC_CAPS) { rfbLog("rfbSendInteractionCaps: assertion failed, i != N_ENC_CAPS\n"); rfbCloseClient(cl); return; } /* Send header and capability lists */ if (WriteExact(cl, (char *)&intr_caps, sz_rfbInteractionCapsMsg) < 0 || WriteExact(cl, (char *)&enc_list[0], sz_rfbCapabilityInfo * N_ENC_CAPS) < 0) { rfbLogPerror("rfbSendInteractionCaps: write"); rfbCloseClient(cl); return; } /* Dispatch client input to rfbProcessClientNormalMessage(). */ cl->state = RFB_NORMAL; }
0
311,665
void webkit_web_view_unmark_text_matches(WebKitWebView* webView) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); return core(webView)->unmarkAllTextMatches(); }
0
185,903
void GDataDirectoryService::RemoveEntryFromResourceMap(GDataEntry* entry) { resource_map_.erase(entry->resource_id()); }
0
195,341
static const char *getpassf(const char *filename) { STRUCT_STAT st; char buffer[512], *p; int n; if (!filename) return NULL; if (strcmp(filename, "-") == 0) { n = fgets(buffer, sizeof buffer, stdin) == NULL ? -1 : (int)strlen(buffer); } else { int fd; if ((fd = open(filename,O_RDONLY)) < 0) { rsyserr(FERROR, errno, "could not open password file %s", filename); exit_cleanup(RERR_SYNTAX); } if (do_stat(filename, &st) == -1) { rsyserr(FERROR, errno, "stat(%s)", filename); exit_cleanup(RERR_SYNTAX); } if ((st.st_mode & 06) != 0) { rprintf(FERROR, "ERROR: password file must not be other-accessible\n"); exit_cleanup(RERR_SYNTAX); } if (MY_UID() == 0 && st.st_uid != 0) { rprintf(FERROR, "ERROR: password file must be owned by root when running as root\n"); exit_cleanup(RERR_SYNTAX); } n = read(fd, buffer, sizeof buffer - 1); close(fd); } if (n > 0) { buffer[n] = '\0'; if ((p = strtok(buffer, "\n\r")) != NULL) return strdup(p); } rprintf(FERROR, "ERROR: failed to read a password from %s\n", filename); exit_cleanup(RERR_SYNTAX); }
0
36,761
ActiveStreamEncoderFilter(FilterManager& parent, StreamEncoderFilterSharedPtr filter, FilterMatchStateSharedPtr match_state, bool dual_filter) : ActiveStreamFilterBase(parent, dual_filter, std::move(match_state)), handle_(filter) {}
0
176,174
static inline int put_dwords(EHCIState *ehci, uint32_t addr, uint32_t *buf, int num) { int i; if (!ehci->as) { ehci_raise_irq(ehci, USBSTS_HSE); ehci->usbcmd &= ~USBCMD_RUNSTOP; trace_usb_ehci_dma_error(); return -1; } for (i = 0; i < num; i++, buf++, addr += sizeof(*buf)) { uint32_t tmp = cpu_to_le32(*buf); dma_memory_write(ehci->as, addr, &tmp, sizeof(tmp)); } return num; }
0
367,086
static int selinux_task_setrlimit(unsigned int resource, struct rlimit *new_rlim) { struct rlimit *old_rlim = current->signal->rlim + resource; /* Control the ability to change the hard limit (whether lowering or raising it), so that the hard limit can later be used as a safe reset point for the soft limit upon context transitions. See selinux_bprm_committing_creds. */ if (old_rlim->rlim_max != new_rlim->rlim_max) return current_has_perm(current, PROCESS__SETRLIMIT); return 0; }
0
50,416
TypedValue HHVM_FUNCTION(array_merge_recursive, int64_t numArgs, const Variant& array1, const Variant& array2 /* = null_variant */, const Array& args /* = null array */) { getCheckedArray(array1); auto in1 = array1.asCArrRef(); auto ret = Array::attach(MixedArray::MakeReserveLike(in1.get(), 0)); PointerSet seen; php_array_merge_recursive(seen, false, ret, arr_array1); assert(seen.empty()); if (UNLIKELY(numArgs < 2)) return tvReturn(std::move(ret)); getCheckedArray(array2); php_array_merge_recursive(seen, false, ret, arr_array2); assert(seen.empty()); for (ArrayIter iter(args); iter; ++iter) { Variant v = iter.second(); if (!v.isArray()) { throw_expected_array_exception("array_merge_recursive"); return make_tv<KindOfNull>(); } const Array& arr_v = v.asCArrRef(); php_array_merge_recursive(seen, false, ret, arr_v); assert(seen.empty()); } return tvReturn(std::move(ret)); }
0
432,266
static void __vhost_vq_meta_reset(struct vhost_virtqueue *vq) { int j; for (j = 0; j < VHOST_NUM_ADDRS; j++) vq->meta_iotlb[j] = NULL; }
0
454,963
TEST_F(QueryPlannerTest, BasicSkipNoIndex) { addIndex(BSON("a" << 1)); runQuerySkipNToReturn(BSON("x" << 5), 3, 0); ASSERT_EQUALS(getNumSolutions(), 1U); assertSolutionExists("{skip: {n: 3, node: {cscan: {dir: 1, filter: {x: 5}}}}}"); }
0
282,155
WebInsecureRequestPolicy FrameLoader::getInsecureRequestPolicy() const { Frame* parentFrame = m_frame->tree().parent(); if (!parentFrame) return kLeaveInsecureRequestsAlone; return parentFrame->securityContext()->getInsecureRequestPolicy(); }
0
443,412
gen_dns_msg(struct regional* region, struct query_info* q, size_t num) { struct dns_msg* msg = (struct dns_msg*)regional_alloc(region, sizeof(struct dns_msg)); if(!msg) return NULL; memcpy(&msg->qinfo, q, sizeof(struct query_info)); msg->qinfo.qname = regional_alloc_init(region, q->qname, q->qname_len); if(!msg->qinfo.qname) return NULL; /* allocate replyinfo struct and rrset key array separately */ msg->rep = (struct reply_info*)regional_alloc(region, sizeof(struct reply_info) - sizeof(struct rrset_ref)); if(!msg->rep) return NULL; if(num > RR_COUNT_MAX) return NULL; /* integer overflow protection */ msg->rep->rrsets = (struct ub_packed_rrset_key**) regional_alloc(region, num * sizeof(struct ub_packed_rrset_key*)); if(!msg->rep->rrsets) return NULL; return msg; }
0
321,669
static void scsi_remove_request(SCSIDiskReq *r) { qemu_free(r->iov.iov_base); scsi_req_free(&r->req); }
1
285,122
static int CMSError(int ecode, const char *msg) { error(-1,const_cast<char *>(msg)); return 1; }
0
138,654
static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) { struct vcpu_vmx *vmx = to_vmx(vcpu); struct shared_msr_entry *msr; int ret = 0; u32 msr_index = msr_info->index; u64 data = msr_info->data; switch (msr_index) { case MSR_EFER: ret = kvm_set_msr_common(vcpu, msr_info); break; #ifdef CONFIG_X86_64 case MSR_FS_BASE: vmx_segment_cache_clear(vmx); vmcs_writel(GUEST_FS_BASE, data); break; case MSR_GS_BASE: vmx_segment_cache_clear(vmx); vmcs_writel(GUEST_GS_BASE, data); break; case MSR_KERNEL_GS_BASE: vmx_load_host_state(vmx); vmx->msr_guest_kernel_gs_base = data; break; #endif case MSR_IA32_SYSENTER_CS: vmcs_write32(GUEST_SYSENTER_CS, data); break; case MSR_IA32_SYSENTER_EIP: vmcs_writel(GUEST_SYSENTER_EIP, data); break; case MSR_IA32_SYSENTER_ESP: vmcs_writel(GUEST_SYSENTER_ESP, data); break; case MSR_IA32_BNDCFGS: if (!vmx_mpx_supported()) return 1; vmcs_write64(GUEST_BNDCFGS, data); break; case MSR_IA32_TSC: kvm_write_tsc(vcpu, msr_info); break; case MSR_IA32_CR_PAT: if (vmcs_config.vmentry_ctrl & VM_ENTRY_LOAD_IA32_PAT) { if (!kvm_mtrr_valid(vcpu, MSR_IA32_CR_PAT, data)) return 1; vmcs_write64(GUEST_IA32_PAT, data); vcpu->arch.pat = data; break; } ret = kvm_set_msr_common(vcpu, msr_info); break; case MSR_IA32_TSC_ADJUST: ret = kvm_set_msr_common(vcpu, msr_info); break; case MSR_IA32_FEATURE_CONTROL: if (!nested_vmx_allowed(vcpu) || (to_vmx(vcpu)->nested.msr_ia32_feature_control & FEATURE_CONTROL_LOCKED && !msr_info->host_initiated)) return 1; vmx->nested.msr_ia32_feature_control = data; if (msr_info->host_initiated && data == 0) vmx_leave_nested(vcpu); break; case MSR_IA32_VMX_BASIC ... MSR_IA32_VMX_VMFUNC: return 1; /* they are read-only */ case MSR_TSC_AUX: if (!vmx->rdtscp_enabled) return 1; /* Check reserved bit, higher 32 bits should be zero */ if ((data >> 32) != 0) return 1; /* Otherwise falls through */ default: msr = find_msr_entry(vmx, msr_index); if (msr) { msr->data = data; if (msr - vmx->guest_msrs < vmx->save_nmsrs) { preempt_disable(); kvm_set_shared_msr(msr->index, msr->data, msr->mask); preempt_enable(); } break; } ret = kvm_set_msr_common(vcpu, msr_info); } return ret; }
0
411,503
CImg<T>& _priority_queue_remove(unsigned int& siz) { (*this)(0,0) = (*this)(--siz,0); (*this)(0,1) = (*this)(siz,1); (*this)(0,2) = (*this)(siz,2); (*this)(0,3) = (*this)(siz,3); const float value = (*this)(0,0); for (unsigned int pos = 0, left = 0, right = 0; ((right=2*(pos + 1),(left=right - 1))<siz && value<(*this)(left,0)) || (right<siz && value<(*this)(right,0));) { if (right<siz) { if ((*this)(left,0)>(*this)(right,0)) { cimg::swap((*this)(pos,0),(*this)(left,0)); cimg::swap((*this)(pos,1),(*this)(left,1)); cimg::swap((*this)(pos,2),(*this)(left,2)); cimg::swap((*this)(pos,3),(*this)(left,3)); pos = left; } else { cimg::swap((*this)(pos,0),(*this)(right,0)); cimg::swap((*this)(pos,1),(*this)(right,1)); cimg::swap((*this)(pos,2),(*this)(right,2)); cimg::swap((*this)(pos,3),(*this)(right,3)); pos = right; } } else { cimg::swap((*this)(pos,0),(*this)(left,0)); cimg::swap((*this)(pos,1),(*this)(left,1)); cimg::swap((*this)(pos,2),(*this)(left,2)); cimg::swap((*this)(pos,3),(*this)(left,3)); pos = left; } } return *this;
0
465,192
static inline bool kvm_vcpu_mapped(struct kvm_host_map *map) { return !!map->hva; }
0
413,199
static bool ldb_kv_index_unique(struct ldb_context *ldb, struct ldb_kv_private *ldb_kv, const char *attr) { const struct ldb_schema_attribute *a; if (ldb_kv->cache->GUID_index_attribute != NULL) { if (ldb_attr_cmp(attr, ldb_kv->cache->GUID_index_attribute) == 0) { return true; } } if (ldb_attr_dn(attr) == 0) { return true; } a = ldb_schema_attribute_by_name(ldb, attr); if (a->flags & LDB_ATTR_FLAG_UNIQUE_INDEX) { return true; } return false; }
0
159,869
guint32 mono_declsec_flags_from_method (MonoMethod *method) { if (method->flags & METHOD_ATTRIBUTE_HAS_SECURITY) { /* FIXME: No cache (for the moment) */ guint32 idx = mono_method_get_index (method); idx <<= MONO_HAS_DECL_SECURITY_BITS; idx |= MONO_HAS_DECL_SECURITY_METHODDEF; return mono_declsec_get_flags (method->klass->image, idx); } return 0;
0
247,906
xmlXPathNodeLeading (xmlNodeSetPtr nodes, xmlNodePtr node) { xmlXPathNodeSetSort(nodes); return(xmlXPathNodeLeadingSorted(nodes, node)); }
0
238,436
void InputHandler::setInputModeEnabled(bool active) { FocusLog(LogLevelInfo, "InputHandler::setInputModeEnabled '%s', override is '%s'" , active ? "true" : "false" , m_webPage->m_dumpRenderTree || Platform::Settings::instance()->alwaysShowKeyboardOnFocus() ? "true" : "false"); m_inputModeEnabled = active; if (isInputModeEnabled() && isActiveTextEdit() && !m_currentFocusElement->document()->frame()->selection()->isFocused()) m_currentFocusElement->document()->frame()->selection()->setFocused(true); }
0
334,351
static int svag_read_header(AVFormatContext *s) { unsigned size, align; AVStream *st; avio_skip(s->pb, 4); st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); size = avio_rl32(s->pb); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = AV_CODEC_ID_ADPCM_PSX; st->codec->sample_rate = avio_rl32(s->pb); if (st->codec->sample_rate <= 0) return AVERROR_INVALIDDATA; st->codec->channels = avio_rl32(s->pb); if (st->codec->channels <= 0) return AVERROR_INVALIDDATA; st->duration = size / (16 * st->codec->channels) * 28; align = avio_rl32(s->pb); if (align <= 0 || align > INT_MAX / st->codec->channels) return AVERROR_INVALIDDATA; st->codec->block_align = align * st->codec->channels; avio_skip(s->pb, 0x800 - avio_tell(s->pb)); avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate); return 0; }
1
327,417
void virtio_scsi_dataplane_stop(VirtIOSCSI *s) { BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s))); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s); int i; /* Better luck next time. */ if (s->dataplane_fenced) { s->dataplane_fenced = false; return; } if (!s->dataplane_started || s->dataplane_stopping) { return; } s->dataplane_stopping = true; assert(s->ctx == iothread_get_aio_context(vs->conf.iothread)); aio_context_acquire(s->ctx); aio_set_event_notifier(s->ctx, &s->ctrl_vring->host_notifier, false, NULL); aio_set_event_notifier(s->ctx, &s->event_vring->host_notifier, false, NULL); for (i = 0; i < vs->conf.num_queues; i++) { aio_set_event_notifier(s->ctx, &s->cmd_vrings[i]->host_notifier, false, NULL); } blk_drain_all(); /* ensure there are no in-flight requests */ aio_context_release(s->ctx); /* Sync vring state back to virtqueue so that non-dataplane request * processing can continue when we disable the host notifier below. */ virtio_scsi_vring_teardown(s); for (i = 0; i < vs->conf.num_queues + 2; i++) { k->set_host_notifier(qbus->parent, i, false); } /* Clean up guest notifier (irq) */ k->set_guest_notifiers(qbus->parent, vs->conf.num_queues + 2, false); s->dataplane_stopping = false; s->dataplane_started = false; }
0
351,170
libxlDomainShutdownThread(void *opaque) { struct libxlShutdownThreadInfo *shutdown_info = opaque; virDomainObj *vm = shutdown_info->vm; libxl_event *ev = shutdown_info->event; libxlDriverPrivate *driver = shutdown_info->driver; virObjectEvent *dom_event = NULL; libxl_shutdown_reason xl_reason = ev->u.domain_shutdown.shutdown_reason; g_autoptr(libxlDriverConfig) cfg = libxlDriverConfigGet(driver); libxl_domain_config d_config; libxl_domain_config_init(&d_config); if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0) goto cleanup; if (xl_reason == LIBXL_SHUTDOWN_REASON_POWEROFF) { virDomainObjSetState(vm, VIR_DOMAIN_SHUTOFF, VIR_DOMAIN_SHUTOFF_SHUTDOWN); dom_event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN); switch ((virDomainLifecycleAction) vm->def->onPoweroff) { case VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY: libxlDomainShutdownHandleDestroy(driver, vm); goto endjob; case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART: case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME: libxlDomainShutdownHandleRestart(driver, vm); goto endjob; case VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE: case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY: case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_RESTART: case VIR_DOMAIN_LIFECYCLE_ACTION_LAST: goto endjob; } } else if (xl_reason == LIBXL_SHUTDOWN_REASON_CRASH) { virDomainObjSetState(vm, VIR_DOMAIN_SHUTOFF, VIR_DOMAIN_SHUTOFF_CRASHED); dom_event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_CRASHED); switch ((virDomainLifecycleAction) vm->def->onCrash) { case VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY: libxlDomainShutdownHandleDestroy(driver, vm); goto endjob; case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART: case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME: libxlDomainShutdownHandleRestart(driver, vm); goto endjob; case VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE: case VIR_DOMAIN_LIFECYCLE_ACTION_LAST: goto endjob; case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY: libxlDomainAutoCoreDump(driver, vm); libxlDomainShutdownHandleDestroy(driver, vm); goto endjob; case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_RESTART: libxlDomainAutoCoreDump(driver, vm); libxlDomainShutdownHandleRestart(driver, vm); goto endjob; } } else if (xl_reason == LIBXL_SHUTDOWN_REASON_REBOOT) { virDomainObjSetState(vm, VIR_DOMAIN_SHUTOFF, VIR_DOMAIN_SHUTOFF_SHUTDOWN); dom_event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN); switch ((virDomainLifecycleAction) vm->def->onReboot) { case VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY: libxlDomainShutdownHandleDestroy(driver, vm); goto endjob; case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART: case VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME: libxlDomainShutdownHandleRestart(driver, vm); goto endjob; case VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE: case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY: case VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_RESTART: case VIR_DOMAIN_LIFECYCLE_ACTION_LAST: goto endjob; } } else if (xl_reason == LIBXL_SHUTDOWN_REASON_SOFT_RESET) { libxlDomainObjPrivate *priv = vm->privateData; if (libxlRetrieveDomainConfigurationWrapper(cfg->ctx, vm->def->id, &d_config) != 0) { VIR_ERROR(_("Failed to retrieve config for VM '%s'. " "Unable to perform soft reset. Destroying VM"), vm->def->name); libxlDomainShutdownHandleDestroy(driver, vm); goto endjob; } if (priv->deathW) { libxl_evdisable_domain_death(cfg->ctx, priv->deathW); priv->deathW = NULL; } if (libxl_domain_soft_reset(cfg->ctx, &d_config, vm->def->id, NULL, NULL) != 0) { VIR_ERROR(_("Failed to soft reset VM '%s'. Destroying VM"), vm->def->name); libxlDomainShutdownHandleDestroy(driver, vm); goto endjob; } libxl_evenable_domain_death(cfg->ctx, vm->def->id, 0, &priv->deathW); libxlDomainUnpauseWrapper(cfg->ctx, vm->def->id); } else { VIR_INFO("Unhandled shutdown_reason %d", xl_reason); } endjob: libxlDomainObjEndJob(driver, vm); cleanup: virDomainObjEndAPI(&vm); virObjectEventStateQueue(driver->domainEventState, dom_event); libxl_event_free(cfg->ctx, ev); VIR_FREE(shutdown_info); libxl_domain_config_dispose(&d_config); }
1
478,183
CImg(const unsigned int size_x, std::initializer_list<t> values, const bool repeat_values=true):_width(0),_height(0),_depth(0),_spectrum(0),_is_shared(false),_data(0) { assign(size_x); _cimg_constructor_cpp11(repeat_values); }
0
164,128
static void uipc_flush_ch_locked(tUIPC_CH_ID ch_id) { char buf[UIPC_FLUSH_BUFFER_SIZE]; struct pollfd pfd; int ret; pfd.events = POLLIN; pfd.fd = uipc_main.ch[ch_id].fd; if (uipc_main.ch[ch_id].fd == UIPC_DISCONNECTED) { BTIF_TRACE_EVENT("%s() - fd disconnected. Exiting", __FUNCTION__); return; } while (1) { ret = TEMP_FAILURE_RETRY(poll(&pfd, 1, 1)); BTIF_TRACE_VERBOSE("%s() - polling fd %d, revents: 0x%x, ret %d", __FUNCTION__, pfd.fd, pfd.revents, ret); if (pfd.revents & (POLLERR|POLLHUP)) { BTIF_TRACE_EVENT("%s() - POLLERR or POLLHUP. Exiting", __FUNCTION__); return; } if (ret <= 0) { BTIF_TRACE_EVENT("%s() - error (%d). Exiting", __FUNCTION__, ret); return; } /* read sufficiently large buffer to ensure flush empties socket faster than it is getting refilled */ TEMP_FAILURE_RETRY(read(pfd.fd, &buf, UIPC_FLUSH_BUFFER_SIZE)); } }
0
8,101
decode_bytes_with_escapes(struct compiling *c, const node *n, const char *s, size_t len) { return PyBytes_DecodeEscape(s, len, NULL, 0, NULL); }
1
278,715
void CL_InitDownloads( void ) { #ifndef PRE_RELEASE_DEMO char missingfiles[1024]; char *dir = FS_ShiftStr( AUTOUPDATE_DIR, AUTOUPDATE_DIR_SHIFT ); if ( autoupdateStarted && NET_CompareAdr( cls.autoupdateServer, clc.serverAddress ) ) { if ( strlen( cl_updatefiles->string ) > 4 ) { Q_strncpyz( autoupdateFilename, cl_updatefiles->string, sizeof( autoupdateFilename ) ); Q_strncpyz( clc.downloadList, va( "@%s/%s@%s/%s", dir, cl_updatefiles->string, dir, cl_updatefiles->string ), MAX_INFO_STRING ); clc.state = CA_CONNECTED; CL_NextDownload(); return; } } else { if ( !(cl_allowDownload->integer & DLF_ENABLE) ) { if ( FS_ComparePaks( missingfiles, sizeof( missingfiles ), qfalse ) ) { Cvar_Set( "com_missingFiles", missingfiles ); } else { Cvar_Set( "com_missingFiles", "" ); } Com_Printf( "\nWARNING: You are missing some files referenced by the server:\n%s" "You might not be able to join the game\n" "Go to the setting menu to turn on autodownload, or get the file elsewhere\n\n", missingfiles ); } else if ( FS_ComparePaks( clc.downloadList, sizeof( clc.downloadList ), qtrue ) ) { Com_Printf( CL_TranslateStringBuf( "Need paks: %s\n" ), clc.downloadList ); if ( *clc.downloadList ) { clc.state = CA_CONNECTED; *clc.downloadTempName = *clc.downloadName = 0; Cvar_Set( "cl_downloadName", "" ); CL_NextDownload(); return; } } } #endif CL_DownloadsComplete(); }
0
400,801
pdf14_compute_group_device_int_rect(const gs_matrix *ctm, const gs_rect *pbbox, gs_int_rect *rect) { gs_rect dev_bbox; int code; code = gs_bbox_transform(pbbox, ctm, &dev_bbox); if (code < 0) return code; rect->p.x = (int)floor(dev_bbox.p.x); rect->p.y = (int)floor(dev_bbox.p.y); rect->q.x = (int)ceil(dev_bbox.q.x); rect->q.y = (int)ceil(dev_bbox.q.y); return 0; }
0
159,614
void encode(bufferlist& bl) const { __u8 struct_v = 2; ::encode(struct_v, bl); ::encode(auid, bl); ::encode(key, bl); ::encode(caps, bl); }
0
470,739
int svm_allocate_nested(struct vcpu_svm *svm) { struct page *hsave_page; if (svm->nested.initialized) return 0; hsave_page = alloc_page(GFP_KERNEL_ACCOUNT | __GFP_ZERO); if (!hsave_page) return -ENOMEM; svm->nested.hsave = page_address(hsave_page); svm->nested.msrpm = svm_vcpu_alloc_msrpm(); if (!svm->nested.msrpm) goto err_free_hsave; svm_vcpu_init_msrpm(&svm->vcpu, svm->nested.msrpm); svm->nested.initialized = true; return 0; err_free_hsave: __free_page(hsave_page); return -ENOMEM; }
0
287,624
validate_event(struct pmu_hw_events *hw_events, struct perf_event *event) { struct arm_pmu *armpmu = to_arm_pmu(event->pmu); struct hw_perf_event fake_event = event->hw; struct pmu *leader_pmu = event->group_leader->pmu; if (is_software_event(event)) return 1; if (event->pmu != leader_pmu || event->state < PERF_EVENT_STATE_OFF) return 1; if (event->state == PERF_EVENT_STATE_OFF && !event->attr.enable_on_exec) return 1; return armpmu->get_event_idx(hw_events, &fake_event) >= 0; }
1
344,873
file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((unused)), const void *buf, size_t nb) { int m = 0, rv = 0, looks_text = 0; int mime = ms->flags & MAGIC_MIME; const unsigned char *ubuf = CAST(const unsigned char *, buf); unichar *u8buf = NULL; size_t ulen; const char *code = NULL; const char *code_mime = "binary"; const char *type = "application/octet-stream"; const char *def = "data"; if (nb == 0) { def = "empty"; type = "application/x-empty"; goto simple; } else if (nb == 1) { def = "very short file (no magic)"; goto simple; } if ((ms->flags & MAGIC_NO_CHECK_ENCODING) == 0) { looks_text = file_encoding(ms, ubuf, nb, &u8buf, &ulen, &code, &code_mime, &type); } #ifdef __EMX__ if ((ms->flags & MAGIC_NO_CHECK_APPTYPE) == 0 && inname) { switch (file_os2_apptype(ms, inname, buf, nb)) { case -1: return -1; case 0: break; default: return 1; } } #endif #if HAVE_FORK /* try compression stuff */ if ((ms->flags & MAGIC_NO_CHECK_COMPRESS) == 0) if ((m = file_zmagic(ms, fd, inname, ubuf, nb)) != 0) { if ((ms->flags & MAGIC_DEBUG) != 0) (void)fprintf(stderr, "zmagic %d\n", m); goto done_encoding; } #endif /* Check if we have a tar file */ if ((ms->flags & MAGIC_NO_CHECK_TAR) == 0) if ((m = file_is_tar(ms, ubuf, nb)) != 0) { if ((ms->flags & MAGIC_DEBUG) != 0) (void)fprintf(stderr, "tar %d\n", m); goto done; } /* Check if we have a CDF file */ if ((ms->flags & MAGIC_NO_CHECK_CDF) == 0) if ((m = file_trycdf(ms, fd, ubuf, nb)) != 0) { if ((ms->flags & MAGIC_DEBUG) != 0) (void)fprintf(stderr, "cdf %d\n", m); goto done; } /* try soft magic tests */ if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0) if ((m = file_softmagic(ms, ubuf, nb, BINTEST, looks_text)) != 0) { if ((ms->flags & MAGIC_DEBUG) != 0) (void)fprintf(stderr, "softmagic %d\n", m); #ifdef BUILTIN_ELF if ((ms->flags & MAGIC_NO_CHECK_ELF) == 0 && m == 1 && nb > 5 && fd != -1) { /* * We matched something in the file, so this * *might* be an ELF file, and the file is at * least 5 bytes long, so if it's an ELF file * it has at least one byte past the ELF magic * number - try extracting information from the * ELF headers that cannot easily * be * extracted with rules in the magic file. */ if ((m = file_tryelf(ms, fd, ubuf, nb)) != 0) if ((ms->flags & MAGIC_DEBUG) != 0) (void)fprintf(stderr, "elf %d\n", m); } #endif goto done; } /* try text properties */ if ((ms->flags & MAGIC_NO_CHECK_TEXT) == 0) { if ((m = file_ascmagic(ms, ubuf, nb, looks_text)) != 0) { if ((ms->flags & MAGIC_DEBUG) != 0) (void)fprintf(stderr, "ascmagic %d\n", m); goto done; } /* try to discover text encoding */ if ((ms->flags & MAGIC_NO_CHECK_ENCODING) == 0) { if (looks_text == 0) if ((m = file_ascmagic_with_encoding( ms, ubuf, nb, u8buf, ulen, code, type, looks_text)) != 0) { if ((ms->flags & MAGIC_DEBUG) != 0) (void)fprintf(stderr, "ascmagic/enc %d\n", m); goto done; } } } simple: /* give up */ m = 1; if ((!mime || (mime & MAGIC_MIME_TYPE)) && file_printf(ms, "%s", mime ? type : def) == -1) { rv = -1; } done: if ((ms->flags & MAGIC_MIME_ENCODING) != 0) { if (ms->flags & MAGIC_MIME_TYPE) if (file_printf(ms, "; charset=") == -1) rv = -1; if (file_printf(ms, "%s", code_mime) == -1) rv = -1; } done_encoding: free(u8buf); if (rv) return rv; return m; }
1
448,036
int ssh_buffer_add_ssh_string(struct ssh_buffer_struct *buffer, struct ssh_string_struct *string) { uint32_t len = 0; if (string == NULL) { return -1; } len = ssh_string_len(string); if (ssh_buffer_add_data(buffer, string, len + sizeof(uint32_t)) < 0) { return -1; } return 0; }
0
237,451
static gboolean webkit_navigation_request_handled(GSignalInvocationHint* ihint, GValue* returnAccu, const GValue* handlerReturn, gpointer dummy) { WebKitNavigationResponse navigationResponse = (WebKitNavigationResponse)g_value_get_enum(handlerReturn); g_value_set_enum(returnAccu, navigationResponse); if (navigationResponse != WEBKIT_NAVIGATION_RESPONSE_ACCEPT) return FALSE; return TRUE; }
0
392,038
http_CollectHdr(struct http *hp, const char *hdr) { unsigned u, v, ml, f = 0, x; char *b = NULL, *e = NULL; for (u = HTTP_HDR_FIRST; u < hp->nhd; u++) { while (u < hp->nhd && http_IsHdr(&hp->hd[u], hdr)) { Tcheck(hp->hd[u]); if (f == 0) { /* Found first header, just record the fact */ f = u; break; } if (b == NULL) { /* Found second header, start our collection */ ml = WS_Reserve(hp->ws, 0); b = hp->ws->f; e = b + ml; x = Tlen(hp->hd[f]); if (b + x < e) { memcpy(b, hp->hd[f].b, x); b += x; } else b = e; } AN(b); AN(e); /* Append the Nth header we found */ if (b < e) *b++ = ','; x = Tlen(hp->hd[u]) - *hdr; if (b + x < e) { memcpy(b, hp->hd[u].b + *hdr, x); b += x; } else b = e; /* Shift remaining headers up one slot */ for (v = u; v < hp->nhd - 1; v++) hp->hd[v] = hp->hd[v + 1]; hp->nhd--; } } if (b == NULL) return; AN(e); if (b >= e) { WS_Release(hp->ws, 0); return; } *b = '\0'; hp->hd[f].b = hp->ws->f; hp->hd[f].e = b; WS_ReleaseP(hp->ws, b + 1); }
0
111,413
int __export rad_packet_add_int(struct rad_packet_t *pack, const char *vendor_name, const char *name, int val) { struct rad_attr_t *ra; struct rad_dict_attr_t *attr; struct rad_dict_vendor_t *vendor; if (pack->len + (vendor_name ? 8 : 2) + 4 >= REQ_LENGTH_MAX) return -1; if (vendor_name) { vendor = rad_dict_find_vendor_name(vendor_name); if (!vendor) return -1; attr = rad_dict_find_vendor_attr(vendor, name); } else { vendor = NULL; attr = rad_dict_find_attr(name); } if (!attr) return -1; ra = mempool_alloc(attr_pool); if (!ra) return -1; memset(ra, 0, sizeof(*ra)); ra->vendor = vendor; ra->attr = attr; ra->len = 4; ra->val.integer = val; ra->raw = &ra->val; list_add_tail(&ra->entry, &pack->attrs); pack->len += (vendor_name ? 8 : 2) + 4; return 0; }
0
345,631
Utf8DecoderBase::Utf8DecoderBase() : unbuffered_start_(NULL), utf16_length_(0), last_byte_of_buffer_unused_(false) {}
1
176,630
ShellWindowFrameView::~ShellWindowFrameView() { }
0
126,836
smtp_getnameinfo_cb(void *arg, int gaierrno, const char *host, const char *serv) { struct smtp_session *s = arg; struct addrinfo hints; if (gaierrno) { (void)strlcpy(s->rdns, "<unknown>", sizeof(s->rdns)); if (gaierrno == EAI_NODATA || gaierrno == EAI_NONAME) s->fcrdns = 0; else { log_warnx("getnameinfo: %s: %s", ss_to_text(&s->ss), gai_strerror(gaierrno)); s->fcrdns = -1; } smtp_lookup_servername(s); return; } (void)strlcpy(s->rdns, host, sizeof(s->rdns)); memset(&hints, 0, sizeof(hints)); hints.ai_family = s->ss.ss_family; hints.ai_socktype = SOCK_STREAM; resolver_getaddrinfo(s->rdns, NULL, &hints, smtp_getaddrinfo_cb, s); }
0
455,865
Value ExpressionSubstrBytes::evaluate(const Document& root, Variables* variables) const { Value pString(_children[0]->evaluate(root, variables)); Value pLower(_children[1]->evaluate(root, variables)); Value pLength(_children[2]->evaluate(root, variables)); string str = pString.coerceToString(); uassert(16034, str::stream() << getOpName() << ": starting index must be a numeric type (is BSON type " << typeName(pLower.getType()) << ")", (pLower.getType() == NumberInt || pLower.getType() == NumberLong || pLower.getType() == NumberDouble)); uassert(16035, str::stream() << getOpName() << ": length must be a numeric type (is BSON type " << typeName(pLength.getType()) << ")", (pLength.getType() == NumberInt || pLength.getType() == NumberLong || pLength.getType() == NumberDouble)); const long long signedLower = pLower.coerceToLong(); uassert(50752, str::stream() << getOpName() << ": starting index must be non-negative (got: " << signedLower << ")", signedLower >= 0); const string::size_type lower = static_cast<string::size_type>(signedLower); // If the passed length is negative, we should return the rest of the string. const long long signedLength = pLength.coerceToLong(); const string::size_type length = signedLength < 0 ? str.length() : static_cast<string::size_type>(signedLength); uassert(28656, str::stream() << getOpName() << ": Invalid range, starting index is a UTF-8 continuation byte.", (lower >= str.length() || !str::isUTF8ContinuationByte(str[lower]))); // Check the byte after the last character we'd return. If it is a continuation byte, that // means we're in the middle of a UTF-8 character. uassert( 28657, str::stream() << getOpName() << ": Invalid range, ending index is in the middle of a UTF-8 character.", (lower + length >= str.length() || !str::isUTF8ContinuationByte(str[lower + length]))); if (lower >= str.length()) { // If lower > str.length() then string::substr() will throw out_of_range, so return an // empty string if lower is not a valid string index. return Value(StringData()); } return Value(str.substr(lower, length)); }
0
57,276
static void module_enable_ro(const struct module *mod, bool after_init) { if (!rodata_enabled) return; set_vm_flush_reset_perms(mod->core_layout.base); set_vm_flush_reset_perms(mod->init_layout.base); frob_text(&mod->core_layout, set_memory_ro); frob_rodata(&mod->core_layout, set_memory_ro); frob_text(&mod->init_layout, set_memory_ro); frob_rodata(&mod->init_layout, set_memory_ro); if (after_init) frob_ro_after_init(&mod->core_layout, set_memory_ro); }
0
351,882
__read_extent_tree_block(const char *function, unsigned int line, struct inode *inode, ext4_fsblk_t pblk, int depth, int flags) { struct buffer_head *bh; int err; gfp_t gfp_flags = __GFP_MOVABLE | GFP_NOFS; if (flags & EXT4_EX_NOFAIL) gfp_flags |= __GFP_NOFAIL; bh = sb_getblk_gfp(inode->i_sb, pblk, gfp_flags); if (unlikely(!bh)) return ERR_PTR(-ENOMEM); if (!bh_uptodate_or_lock(bh)) { trace_ext4_ext_load_extent(inode, pblk, _RET_IP_); err = bh_submit_read(bh); if (err < 0) goto errout; } if (buffer_verified(bh) && !(flags & EXT4_EX_FORCE_CACHE)) return bh; if (!ext4_has_feature_journal(inode->i_sb) || (inode->i_ino != le32_to_cpu(EXT4_SB(inode->i_sb)->s_es->s_journal_inum))) { err = __ext4_ext_check(function, line, inode, ext_block_hdr(bh), depth, pblk); if (err) goto errout; } set_buffer_verified(bh); /* * If this is a leaf block, cache all of its entries */ if (!(flags & EXT4_EX_NOCACHE) && depth == 0) { struct ext4_extent_header *eh = ext_block_hdr(bh); ext4_cache_extents(inode, eh); } return bh; errout: put_bh(bh); return ERR_PTR(err); }
1
15,671
static int dissect_h225_UnregistrationReject ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h225_UnregistrationReject , UnregistrationReject_sequence ) ; return offset ; }
0
295,744
static void bond_mc_del(struct bonding *bond, void *addr) { if (USES_PRIMARY(bond->params.mode)) { /* write lock already acquired */ if (bond->curr_active_slave) dev_mc_del(bond->curr_active_slave->dev, addr); } else { struct slave *slave; int i; bond_for_each_slave(bond, slave, i) { dev_mc_del(slave->dev, addr); } } }
0
67,167
int prism2_wds_del(local_info_t *local, u8 *remote_addr, int rtnl_locked, int do_not_remove) { unsigned long flags; struct list_head *ptr; struct hostap_interface *iface, *selected = NULL; write_lock_irqsave(&local->iface_lock, flags); list_for_each(ptr, &local->hostap_interfaces) { iface = list_entry(ptr, struct hostap_interface, list); if (iface->type != HOSTAP_INTERFACE_WDS) continue; if (memcmp(iface->u.wds.remote_addr, remote_addr, ETH_ALEN) == 0) { selected = iface; break; } } if (selected && !do_not_remove) list_del(&selected->list); write_unlock_irqrestore(&local->iface_lock, flags); if (selected) { if (do_not_remove) memset(selected->u.wds.remote_addr, 0, ETH_ALEN); else { hostap_remove_interface(selected->dev, rtnl_locked, 0); local->wds_connections--; } } return selected ? 0 : -ENODEV; }
0
211,354
ttwu_do_activate(struct rq *rq, struct task_struct *p, int wake_flags, struct pin_cookie cookie) { int en_flags = ENQUEUE_WAKEUP; lockdep_assert_held(&rq->lock); #ifdef CONFIG_SMP if (p->sched_contributes_to_load) rq->nr_uninterruptible--; if (wake_flags & WF_MIGRATED) en_flags |= ENQUEUE_MIGRATED; #endif ttwu_activate(rq, p, en_flags); ttwu_do_wakeup(rq, p, wake_flags, cookie); }
0
518,544
bool memcpy_field_possible(const Field *from) const { return Field_str::memcpy_field_possible(from) && !compression_method() == !from->compression_method() && !table->copy_blobs; }
0
206,521
bool TemplateURLRef::EncodeFormData(const PostParams& post_params, PostContent* post_content) const { if (post_params.empty()) return true; if (!post_content) return false; const char kUploadDataMIMEType[] = "multipart/form-data; boundary="; std::string boundary = net::GenerateMimeMultipartBoundary(); post_content->first = kUploadDataMIMEType; post_content->first += boundary; std::string* post_data = &post_content->second; post_data->clear(); for (const auto& param : post_params) { DCHECK(!param.name.empty()); net::AddMultipartValueForUpload(param.name, param.value, boundary, param.content_type, post_data); } net::AddMultipartFinalDelimiterForUpload(boundary, post_data); return true; }
0
430,930
int cpia2_usb_stream_start(struct camera_data *cam, unsigned int alternate) { int ret; int old_alt; if(cam->streaming) return 0; if (cam->flush) { int i; DBG("Flushing buffers\n"); for(i=0; i<cam->num_frames; ++i) { cam->buffers[i].status = FRAME_EMPTY; cam->buffers[i].length = 0; } cam->curbuff = &cam->buffers[0]; cam->workbuff = cam->curbuff->next; cam->flush = false; } old_alt = cam->params.camera_state.stream_mode; cam->params.camera_state.stream_mode = 0; ret = cpia2_usb_change_streaming_alternate(cam, alternate); if (ret < 0) { int ret2; ERR("cpia2_usb_change_streaming_alternate() = %d!\n", ret); cam->params.camera_state.stream_mode = old_alt; ret2 = set_alternate(cam, USBIF_CMDONLY); if (ret2 < 0) { ERR("cpia2_usb_change_streaming_alternate(%d) =%d has already failed. Then tried to call set_alternate(USBIF_CMDONLY) = %d.\n", alternate, ret, ret2); } } else { cam->frame_count = 0; cam->streaming = 1; ret = cpia2_usb_stream_resume(cam); } return ret; }
0
172,734
ofport_set_usage(struct ofproto *ofproto, ofp_port_t ofp_port, long long int last_used) { struct ofport_usage *usage; HMAP_FOR_EACH_IN_BUCKET (usage, hmap_node, hash_ofp_port(ofp_port), &ofproto->ofport_usage) { if (usage->ofp_port == ofp_port) { usage->last_used = last_used; return; } } ovs_assert(last_used == LLONG_MAX); usage = xmalloc(sizeof *usage); usage->ofp_port = ofp_port; usage->last_used = last_used; hmap_insert(&ofproto->ofport_usage, &usage->hmap_node, hash_ofp_port(ofp_port)); }
0
415,448
uint WavInFile::getBytesPerSample() const { return getNumChannels() * getNumBits() / 8; }
0
490,914
void io_flush(int flush_type) { if (iobuf.out.len > iobuf.out_empty_len) { if (flush_type == FULL_FLUSH) /* flush everything in the output buffers */ perform_io(iobuf.out.size - iobuf.out_empty_len, PIO_NEED_OUTROOM); else if (flush_type == NORMAL_FLUSH) /* flush at least 1 byte */ perform_io(iobuf.out.size - iobuf.out.len + 1, PIO_NEED_OUTROOM); /* MSG_FLUSH: flush iobuf.msg only */ } if (iobuf.msg.len) perform_io(iobuf.msg.size, PIO_NEED_MSGROOM); }
0
523,480
bool parse_sql(THD *thd, Parser_state *parser_state, Object_creation_ctx *creation_ctx, bool do_pfs_digest) { bool ret_value; DBUG_ENTER("parse_sql"); DBUG_ASSERT(thd->m_parser_state == NULL); DBUG_ASSERT(thd->lex->m_sql_cmd == NULL); MYSQL_QUERY_PARSE_START(thd->query()); /* Backup creation context. */ Object_creation_ctx *backup_ctx= NULL; if (creation_ctx) backup_ctx= creation_ctx->set_n_backup(thd); /* Set parser state. */ thd->m_parser_state= parser_state; parser_state->m_digest_psi= NULL; parser_state->m_lip.m_digest= NULL; if (do_pfs_digest) { /* Start Digest */ parser_state->m_digest_psi= MYSQL_DIGEST_START(thd->m_statement_psi); if (parser_state->m_digest_psi != NULL) { /* If either: - the caller wants to compute a digest - the performance schema wants to compute a digest set the digest listener in the lexer. */ parser_state->m_lip.m_digest= thd->m_digest; parser_state->m_lip.m_digest->m_digest_storage.m_charset_number= thd->charset()->number; } } /* Parse the query. */ bool mysql_parse_status= ((thd->variables.sql_mode & MODE_ORACLE) ? ORAparse(thd) : MYSQLparse(thd)) != 0; DBUG_ASSERT(opt_bootstrap || mysql_parse_status || thd->lex->select_stack_top == 0); thd->lex->current_select= thd->lex->first_select_lex(); /* Check that if MYSQLparse() failed either thd->is_error() is set, or an internal error handler is set. The assert will not catch a situation where parsing fails without an error reported if an error handler exists. The problem is that the error handler might have intercepted the error, so thd->is_error() is not set. However, there is no way to be 100% sure here (the error handler might be for other errors than parsing one). */ DBUG_ASSERT(!mysql_parse_status || thd->is_error() || thd->get_internal_handler()); /* Reset parser state. */ thd->m_parser_state= NULL; /* Restore creation context. */ if (creation_ctx) creation_ctx->restore_env(thd, backup_ctx); /* That's it. */ ret_value= mysql_parse_status || thd->is_fatal_error; if ((ret_value == 0) && (parser_state->m_digest_psi != NULL)) { /* On parsing success, record the digest in the performance schema. */ DBUG_ASSERT(do_pfs_digest); DBUG_ASSERT(thd->m_digest != NULL); MYSQL_DIGEST_END(parser_state->m_digest_psi, & thd->m_digest->m_digest_storage); } MYSQL_QUERY_PARSE_DONE(ret_value); DBUG_RETURN(ret_value); }
0
86,013
void kvm_ioapic_clear_all(struct kvm_ioapic *ioapic, int irq_source_id) { int i; spin_lock(&ioapic->lock); for (i = 0; i < KVM_IOAPIC_NUM_PINS; i++) __clear_bit(irq_source_id, &ioapic->irq_states[i]); spin_unlock(&ioapic->lock); }
0
407,492
static int dcc_send_one_file(int queue, const char *target, const char *fname, IRC_SERVER_REC *server, CHAT_DCC_REC *chat, int passive) { struct stat st; char *str; char host[MAX_IP_LEN]; int hfile, port = 0; SEND_DCC_REC *dcc; IPADDR own_ip; GIOChannel *handle; if (dcc_find_request(DCC_SEND_TYPE, target, fname)) { signal_emit("dcc error send exists", 2, target, fname); return FALSE; } str = dcc_send_get_file(fname); hfile = open(str, O_RDONLY); g_free(str); if (hfile == -1) { signal_emit("dcc error file open", 3, target, fname, GINT_TO_POINTER(errno)); return FALSE; } if (fstat(hfile, &st) < 0) { g_warning("fstat() failed: %s", strerror(errno)); close(hfile); return FALSE; } /* start listening (only if passive == FALSE )*/ if (passive == FALSE) { handle = dcc_listen(chat != NULL ? chat->handle : net_sendbuffer_handle(server->handle), &own_ip, &port); if (handle == NULL) { close(hfile); g_warning("dcc_listen() failed: %s", strerror(errno)); return FALSE; } } else { handle = NULL; } str = g_path_get_basename(fname); /* Replace all the spaces with underscore so that lesser intelligent clients can communicate.. */ if (settings_get_bool("dcc_send_replace_space_with_underscore")) g_strdelimit(str, " ", '_'); dcc = dcc_send_create(server, chat, target, str); g_free(str); if (dcc == NULL) { g_warn_if_reached(); return FALSE; } dcc->handle = handle; dcc->port = port; dcc->size = st.st_size; dcc->fhandle = hfile; dcc->queue = queue; dcc->file_quoted = strchr(fname, ' ') != NULL; if (!passive) { dcc->tagconn = g_input_add(handle, G_INPUT_READ, (GInputFunction) dcc_send_connected, dcc); } /* Generate an ID for this send if using passive protocol */ if (passive) { dcc->pasv_id = rand() % 64; } /* send DCC request */ signal_emit("dcc request send", 1, dcc); dcc_ip2str(&own_ip, host); if (passive == FALSE) { str = g_strdup_printf(dcc->file_quoted ? "DCC SEND \"%s\" %s %d %"PRIuUOFF_T : "DCC SEND %s %s %d %"PRIuUOFF_T, dcc->arg, host, port, dcc->size); } else { str = g_strdup_printf(dcc->file_quoted ? "DCC SEND \"%s\" 16843009 0 %"PRIuUOFF_T" %d" : "DCC SEND %s 16843009 0 %"PRIuUOFF_T" %d", dcc->arg, dcc->size, dcc->pasv_id); } dcc_ctcp_message(server, target, chat, FALSE, str); g_free(str); return TRUE; }
0
252,063
bool venc_dev::venc_loaded_stop() { return true; }
0
282,064
int GetTabPixel(int x, int y) const { const int* tab_pixels = reinterpret_cast<int*>(tab_bitmap_.getPixels()); if (!tab_pixels || x >= tab_bitmap_.width() || y >= tab_bitmap_.height()) return 0xFFFFFFFF; return 0xFF000000 | tab_pixels[y * tab_bitmap_.width() + x]; }
0
500,298
QPDFAcroFormDocumentHelper::QPDFAcroFormDocumentHelper(QPDF& qpdf) : QPDFDocumentHelper(qpdf), m(new Members()) { }
0
176,320
_eXosip_is_public_address (const char *c_address) { return (0 != strncmp (c_address, "192.168", 7) && 0 != strncmp (c_address, "10.", 3) && 0 != strncmp (c_address, "172.16.", 7) && 0 != strncmp (c_address, "172.17.", 7) && 0 != strncmp (c_address, "172.18.", 7) && 0 != strncmp (c_address, "172.19.", 7) && 0 != strncmp (c_address, "172.20.", 7) && 0 != strncmp (c_address, "172.21.", 7) && 0 != strncmp (c_address, "172.22.", 7) && 0 != strncmp (c_address, "172.23.", 7) && 0 != strncmp (c_address, "172.24.", 7) && 0 != strncmp (c_address, "172.25.", 7) && 0 != strncmp (c_address, "172.26.", 7) && 0 != strncmp (c_address, "172.27.", 7) && 0 != strncmp (c_address, "172.28.", 7) && 0 != strncmp (c_address, "172.29.", 7) && 0 != strncmp (c_address, "172.30.", 7) && 0 != strncmp (c_address, "172.31.", 7) && 0 != strncmp (c_address, "169.254", 7)); }
0
274,001
static struct page *try_to_merge_two_pages(struct rmap_item *rmap_item, struct page *page, struct rmap_item *tree_rmap_item, struct page *tree_page) { int err; err = try_to_merge_with_ksm_page(rmap_item, page, NULL); if (!err) { err = try_to_merge_with_ksm_page(tree_rmap_item, tree_page, page); /* * If that fails, we have a ksm page with only one pte * pointing to it: so break it. */ if (err) break_cow(rmap_item); } return err ? NULL : page; }
0
10,604
gs_call_interp(i_ctx_t **pi_ctx_p, ref * pref, int user_errors, int *pexit_code, ref * perror_object) { ref *epref = pref; ref doref; ref *perrordict; ref error_name; int code, ccode; ref saref; i_ctx_t *i_ctx_p = *pi_ctx_p; int *gc_signal = &imemory_system->gs_lib_ctx->gcsignal; *pexit_code = 0; *gc_signal = 0; ialloc_reset_requested(idmemory); again: /* Avoid a dangling error object that might get traced by a future GC. */ make_null(perror_object); o_stack.requested = e_stack.requested = d_stack.requested = 0; while (*gc_signal) { /* Some routine below triggered a GC. */ gs_gc_root_t epref_root; *gc_signal = 0; /* Make sure that doref will get relocated properly if */ /* a garbage collection happens with epref == &doref. */ gs_register_ref_root(imemory_system, &epref_root, (void **)&epref, "gs_call_interp(epref)"); code = interp_reclaim(pi_ctx_p, -1); i_ctx_p = *pi_ctx_p; gs_unregister_root(imemory_system, &epref_root, "gs_call_interp(epref)"); if (code < 0) return code; } code = interp(pi_ctx_p, epref, perror_object); i_ctx_p = *pi_ctx_p; if (!r_has_type(&i_ctx_p->error_object, t__invalid)) { *perror_object = i_ctx_p->error_object; make_t(&i_ctx_p->error_object, t__invalid); } /* Prevent a dangling reference to the GC signal in ticks_left */ /* in the frame of interp, but be prepared to do a GC if */ /* an allocation in this routine asks for it. */ *gc_signal = 0; set_gc_signal(i_ctx_p, 1); if (esp < esbot) /* popped guard entry */ esp = esbot; switch (code) { case gs_error_Fatal: *pexit_code = 255; return code; case gs_error_Quit: *perror_object = osp[-1]; *pexit_code = code = osp->value.intval; osp -= 2; return (code == 0 ? gs_error_Quit : code < 0 && code > -100 ? code : gs_error_Fatal); case gs_error_InterpreterExit: return 0; case gs_error_ExecStackUnderflow: /****** WRONG -- must keep mark blocks intact ******/ ref_stack_pop_block(&e_stack); doref = *perror_object; epref = &doref; goto again; case gs_error_VMreclaim: /* Do the GC and continue. */ /* We ignore the return value here, if it fails here * we'll call it again having jumped to the "again" label. * Where, assuming it fails again, we'll handle the error. */ (void)interp_reclaim(pi_ctx_p, (osp->value.intval == 2 ? avm_global : avm_local)); i_ctx_p = *pi_ctx_p; make_oper(&doref, 0, zpop); epref = &doref; goto again; case gs_error_NeedInput: case gs_error_interrupt: return code; } /* Adjust osp in case of operand stack underflow */ if (osp < osbot - 1) osp = osbot - 1; /* We have to handle stack over/underflow specially, because */ /* we might be able to recover by adding or removing a block. */ switch (code) { case gs_error_dictstackoverflow: /* We don't have to handle this specially: */ /* The only places that could generate it */ /* use check_dstack, which does a ref_stack_extend, */ /* so if` we get this error, it's a real one. */ if (osp >= ostop) { if ((ccode = ref_stack_extend(&o_stack, 1)) < 0) return ccode; } /* Skip system dictionaries for CET 20-02-02 */ ccode = copy_stack(i_ctx_p, &d_stack, min_dstack_size, &saref); if (ccode < 0) return ccode; ref_stack_pop_to(&d_stack, min_dstack_size); dict_set_top(); *++osp = saref; break; case gs_error_dictstackunderflow: if (ref_stack_pop_block(&d_stack) >= 0) { dict_set_top(); doref = *perror_object; epref = &doref; goto again; } break; case gs_error_execstackoverflow: /* We don't have to handle this specially: */ /* The only places that could generate it */ /* use check_estack, which does a ref_stack_extend, */ /* so if we get this error, it's a real one. */ if (osp >= ostop) { if ((ccode = ref_stack_extend(&o_stack, 1)) < 0) return ccode; } ccode = copy_stack(i_ctx_p, &e_stack, 0, &saref); if (ccode < 0) return ccode; { uint count = ref_stack_count(&e_stack); uint limit = ref_stack_max_count(&e_stack) - ES_HEADROOM; if (count > limit) { /* * If there is an e-stack mark within MIN_BLOCK_ESTACK of * the new top, cut the stack back to remove the mark. */ int skip = count - limit; int i; for (i = skip; i < skip + MIN_BLOCK_ESTACK; ++i) { const ref *ep = ref_stack_index(&e_stack, i); if (r_has_type_attrs(ep, t_null, a_executable)) { skip = i + 1; break; } } pop_estack(i_ctx_p, skip); } } *++osp = saref; break; case gs_error_stackoverflow: if (ref_stack_extend(&o_stack, o_stack.requested) >= 0) { /* We can't just re-execute the object, because */ /* it might be a procedure being pushed as a */ /* literal. We check for this case specially. */ doref = *perror_object; if (r_is_proc(&doref)) { *++osp = doref; make_null_proc(&doref); } epref = &doref; goto again; } ccode = copy_stack(i_ctx_p, &o_stack, 0, &saref); if (ccode < 0) return ccode; ref_stack_clear(&o_stack); *++osp = saref; break; case gs_error_stackunderflow: if (ref_stack_pop_block(&o_stack) >= 0) { doref = *perror_object; epref = &doref; goto again; } break; } if (user_errors < 0) return code; if (gs_errorname(i_ctx_p, code, &error_name) < 0) return code; /* out-of-range error code! */ /* We refer to gserrordict first, which is not accessible to Postcript jobs * If we're running with SAFERERRORS all the handlers are copied to gserrordict * so we'll always find the default one. If not SAFERERRORS, only gs specific * errors are in gserrordict. */ if (dict_find_string(systemdict, "gserrordict", &perrordict) <= 0 || (dict_find(perrordict, &error_name, &epref) <= 0 && (dict_find_string(systemdict, "errordict", &perrordict) <= 0 || dict_find(perrordict, &error_name, &epref) <= 0)) ) return code; /* error name not in errordict??? */ doref = *epref; epref = &doref; /* Push the error object on the operand stack if appropriate. */ if (!GS_ERROR_IS_INTERRUPT(code)) { /* Replace the error object if within an oparray or .errorexec. */ osp++; if (osp >= ostop) { } *osp = *perror_object; } *osp = *perror_object; errorexec_find(i_ctx_p, osp); /* If using SAFER, hand a name object to the error handler, rather than the executable * object/operator itself. */ if (i_ctx_p->LockFilePermissions) { code = obj_cvs(imemory, osp, buf + 2, 256, &rlen, (const byte **)&bufptr); if (code < 0) { const char *unknownstr = "--unknown--"; rlen = strlen(unknownstr); memcpy(buf, unknownstr, rlen); } else { buf[0] = buf[1] = buf[rlen + 2] = buf[rlen + 3] = '-'; rlen += 4; } code = name_ref(imemory, buf, rlen, osp, 1); if (code < 0) make_null(osp); } }
1
385,244
char *re_eprint(int err) { static char epbuf[100]; size_t len= my_regerror(REG_ITOA|err, (my_regex_t *)NULL, epbuf, sizeof(epbuf)); assert(len <= sizeof(epbuf)); return(epbuf); }
0
247,229
static void variadicNodeMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { if (UNLIKELY(info.Length() < 1)) { throwTypeError(ExceptionMessages::failedToExecute("variadicNodeMethod", "TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate()); return; } TestObject* imp = V8TestObject::toNative(info.Holder()); V8TRYCATCH_VOID(Node*, head, V8Node::toNativeWithTypeCheck(info.GetIsolate(), info[0])); Vector<RefPtr<Node> > tail; for (int i = 1; i < info.Length(); ++i) { if (!V8Node::hasInstance(info[i], info.GetIsolate())) { throwTypeError(ExceptionMessages::failedToExecute("variadicNodeMethod", "TestObject", "parameter 2 is not of type 'Node'."), info.GetIsolate()); return; } tail.append(V8Node::toNative(v8::Handle<v8::Object>::Cast(info[i]))); } imp->variadicNodeMethod(head, tail); }
0
86,018
do_exmode( int improved) // TRUE for "improved Ex" mode { int save_msg_scroll; int prev_msg_row; linenr_T prev_line; varnumber_T changedtick; if (improved) exmode_active = EXMODE_VIM; else exmode_active = EXMODE_NORMAL; State = MODE_NORMAL; may_trigger_modechanged(); // When using ":global /pat/ visual" and then "Q" we return to continue // the :global command. if (global_busy) return; save_msg_scroll = msg_scroll; ++RedrawingDisabled; // don't redisplay the window ++no_wait_return; // don't wait for return #ifdef FEAT_GUI // Ignore scrollbar and mouse events in Ex mode ++hold_gui_events; #endif msg(_("Entering Ex mode. Type \"visual\" to go to Normal mode.")); while (exmode_active) { // Check for a ":normal" command and no more characters left. if (ex_normal_busy > 0 && typebuf.tb_len == 0) { exmode_active = FALSE; break; } msg_scroll = TRUE; need_wait_return = FALSE; ex_pressedreturn = FALSE; ex_no_reprint = FALSE; changedtick = CHANGEDTICK(curbuf); prev_msg_row = msg_row; prev_line = curwin->w_cursor.lnum; if (improved) { cmdline_row = msg_row; do_cmdline(NULL, getexline, NULL, 0); } else do_cmdline(NULL, getexmodeline, NULL, DOCMD_NOWAIT); lines_left = Rows - 1; if ((prev_line != curwin->w_cursor.lnum || changedtick != CHANGEDTICK(curbuf)) && !ex_no_reprint) { if (curbuf->b_ml.ml_flags & ML_EMPTY) emsg(_(e_empty_buffer)); else { if (ex_pressedreturn) { // go up one line, to overwrite the ":<CR>" line, so the // output doesn't contain empty lines. msg_row = prev_msg_row; if (prev_msg_row == Rows - 1) msg_row--; } msg_col = 0; print_line_no_prefix(curwin->w_cursor.lnum, FALSE, FALSE); msg_clr_eos(); } } else if (ex_pressedreturn && !ex_no_reprint) // must be at EOF { if (curbuf->b_ml.ml_flags & ML_EMPTY) emsg(_(e_empty_buffer)); else emsg(_(e_at_end_of_file)); } } #ifdef FEAT_GUI --hold_gui_events; #endif --RedrawingDisabled; --no_wait_return; update_screen(CLEAR); need_wait_return = FALSE; msg_scroll = save_msg_scroll; }
0
282,953
bool GDataFile::FromProto(const GDataEntryProto& proto) { DCHECK(!proto.file_info().is_directory()); if (!GDataEntry::FromProto(proto)) return false; thumbnail_url_ = GURL(proto.file_specific_info().thumbnail_url()); alternate_url_ = GURL(proto.file_specific_info().alternate_url()); content_mime_type_ = proto.file_specific_info().content_mime_type(); file_md5_ = proto.file_specific_info().file_md5(); document_extension_ = proto.file_specific_info().document_extension(); is_hosted_document_ = proto.file_specific_info().is_hosted_document(); return true; }
0
160,068
static int StreamTcpTest22 (void) { StreamTcpThread stt; struct in_addr addr; char os_policy_name[10] = "windows"; const char *ip_addr; TcpStream stream; Packet *p = SCMalloc(SIZE_OF_PACKET); if (unlikely(p == NULL)) return 0; IPV4Hdr ipv4h; int ret = 0; memset(&addr, 0, sizeof(addr)); memset(&stream, 0, sizeof(stream)); memset(p, 0, SIZE_OF_PACKET); memset(&ipv4h, 0, sizeof(ipv4h)); StreamTcpUTInit(&stt.ra_ctx); SCHInfoCleanResources(); /* Load the config string in to parser */ ConfCreateContextBackup(); ConfInit(); ConfYamlLoadString(dummy_conf_string1, strlen(dummy_conf_string1)); /* Get the IP address as string and add it to Host info tree for lookups */ ip_addr = StreamTcpParseOSPolicy(os_policy_name); SCHInfoAddHostOSInfo(os_policy_name, ip_addr, -1); p->dst.family = AF_INET; p->ip4h = &ipv4h; addr.s_addr = inet_addr("123.231.2.1"); p->dst.address.address_un_data32[0] = addr.s_addr; StreamTcpSetOSPolicy(&stream, p); if (stream.os_policy != OS_POLICY_DEFAULT) { printf("expected os_policy: %"PRIu8" but received %"PRIu8"\n", (uint8_t)OS_POLICY_DEFAULT, stream.os_policy); goto end; } ret = 1; end: ConfDeInit(); ConfRestoreContextBackup(); SCFree(p); StreamTcpUTDeinit(stt.ra_ctx); return ret; }
0