unique_id
int64
13
189k
target
int64
0
1
code
stringlengths
20
241k
__index_level_0__
int64
0
18.9k
86,081
0
static void __release_extent_node(struct f2fs_sb_info *sbi, struct extent_tree *et, struct extent_node *en) { spin_lock(&sbi->extent_lock); f2fs_bug_on(sbi, list_empty(&en->list)); list_del_init(&en->list); spin_unlock(&sbi->extent_lock); __detach_extent_node(sbi, et, en); }
3,100
96,386
0
int main(int argc, char **argv) { /* I18n */ setlocale(LC_ALL, ""); #if ENABLE_NLS bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); #endif abrt_init(argv); /* Can't keep these strings/structs static: _() doesn't support that */ const char *program_usage_string = _( "& [options]" ); enum { OPT_v = 1 << 0, OPT_u = 1 << 1, OPT_s = 1 << 2, OPT_p = 1 << 3, }; /* Keep enum above and order of options below in sync! */ struct options program_options[] = { OPT__VERBOSE(&g_verbose), OPT_INTEGER('u', NULL, &client_uid, _("Use NUM as client uid")), OPT_BOOL( 's', NULL, NULL , _("Log to syslog")), OPT_BOOL( 'p', NULL, NULL , _("Add program names to log")), OPT_END() }; unsigned opts = parse_opts(argc, argv, program_options, program_usage_string); export_abrt_envvars(opts & OPT_p); msg_prefix = xasprintf("%s[%u]", g_progname, getpid()); if (opts & OPT_s) { logmode = LOGMODE_JOURNAL; } /* Set up timeout handling */ /* Part 1 - need this to make SIGALRM interrupt syscalls * (as opposed to restarting them): I want read syscall to be interrupted */ struct sigaction sa; /* sa.sa_flags.SA_RESTART bit is clear: make signal interrupt syscalls */ memset(&sa, 0, sizeof(sa)); sa.sa_handler = dummy_handler; /* pity, SIG_DFL won't do */ sigaction(SIGALRM, &sa, NULL); /* Part 2 - set the timeout per se */ alarm(TIMEOUT); if (client_uid == (uid_t)-1L) { /* Get uid of the connected client */ struct ucred cr; socklen_t crlen = sizeof(cr); if (0 != getsockopt(STDIN_FILENO, SOL_SOCKET, SO_PEERCRED, &cr, &crlen)) perror_msg_and_die("getsockopt(SO_PEERCRED)"); if (crlen != sizeof(cr)) error_msg_and_die("%s: bad crlen %d", "getsockopt(SO_PEERCRED)", (int)crlen); client_uid = cr.uid; } load_abrt_conf(); int r = perform_http_xact(); if (r == 0) r = 200; free_abrt_conf_data(); printf("HTTP/1.1 %u \r\n\r\n", r); return (r >= 400); /* Error if 400+ */ }
3,101
80,366
0
void rtpo_del(GF_Box *s) { GF_RTPOBox *rtpo = (GF_RTPOBox *)s; gf_free(rtpo); }
3,102
161,213
0
static bool SniffBinary(const char* content, size_t size, bool* have_enough_content, std::string* result) { const bool is_truncated = TruncateSize(kMaxBytesToSniff, &size); std::string unused; if (CheckForMagicNumbers(content, size, kByteOrderMark, arraysize(kByteOrderMark), &unused)) { result->assign("text/plain"); return false; } if (LooksLikeBinary(content, size)) { result->assign("application/octet-stream"); return true; } *have_enough_content &= is_truncated; result->assign("text/plain"); return false; }
3,103
138,558
0
void V8ContextNativeHandler::GetAvailability( const v8::FunctionCallbackInfo<v8::Value>& args) { CHECK_EQ(args.Length(), 1); v8::Isolate* isolate = args.GetIsolate(); std::string api_name = *v8::String::Utf8Value(args[0]); Feature::Availability availability = context_->GetAvailability(api_name); v8::Local<v8::Object> ret = v8::Object::New(isolate); ret->Set(v8::String::NewFromUtf8(isolate, "is_available"), v8::Boolean::New(isolate, availability.is_available())); ret->Set(v8::String::NewFromUtf8(isolate, "message"), v8::String::NewFromUtf8(isolate, availability.message().c_str())); ret->Set(v8::String::NewFromUtf8(isolate, "result"), v8::Integer::New(isolate, availability.result())); args.GetReturnValue().Set(ret); }
3,104
60,526
0
int kvm_arch_vcpu_runnable(struct kvm_vcpu *v) { return !!(v->arch.pending_exceptions) || kvm_request_pending(v); }
3,105
53,794
0
static int __init parse_reservelow(char *p) { unsigned long long size; if (!p) return -EINVAL; size = memparse(p, &p); if (size < 4096) size = 4096; if (size > 640*1024) size = 640*1024; reserve_low = size; return 0; }
3,106
172,972
0
static int rpng2_win_load_bg_image() { uch *src, *dest; uch r1, r2, g1, g2, b1, b2; uch r1_inv, r2_inv, g1_inv, g2_inv, b1_inv, b2_inv; int k, hmax, max; int xidx, yidx, yidx_max = (bgscale-1); int even_odd_vert, even_odd_horiz, even_odd; int invert_gradient2 = (bg[pat].type & 0x08); int invert_column; ulg i, row; /*--------------------------------------------------------------------------- Allocate buffer for fake background image to be used with transparent images; if this fails, revert to plain background color. ---------------------------------------------------------------------------*/ bg_rowbytes = 3 * rpng2_info.width; bg_data = (uch *)malloc(bg_rowbytes * rpng2_info.height); if (!bg_data) { fprintf(stderr, PROGNAME ": unable to allocate memory for background image\n"); bg_image = 0; return 1; } /*--------------------------------------------------------------------------- Vertical gradients (ramps) in NxN squares, alternating direction and colors (N == bgscale). ---------------------------------------------------------------------------*/ if ((bg[pat].type & 0x07) == 0) { uch r1_min = rgb[bg[pat].rgb1_min].r; uch g1_min = rgb[bg[pat].rgb1_min].g; uch b1_min = rgb[bg[pat].rgb1_min].b; uch r2_min = rgb[bg[pat].rgb2_min].r; uch g2_min = rgb[bg[pat].rgb2_min].g; uch b2_min = rgb[bg[pat].rgb2_min].b; int r1_diff = rgb[bg[pat].rgb1_max].r - r1_min; int g1_diff = rgb[bg[pat].rgb1_max].g - g1_min; int b1_diff = rgb[bg[pat].rgb1_max].b - b1_min; int r2_diff = rgb[bg[pat].rgb2_max].r - r2_min; int g2_diff = rgb[bg[pat].rgb2_max].g - g2_min; int b2_diff = rgb[bg[pat].rgb2_max].b - b2_min; for (row = 0; row < rpng2_info.height; ++row) { yidx = row % bgscale; even_odd_vert = (row / bgscale) & 1; r1 = r1_min + (r1_diff * yidx) / yidx_max; g1 = g1_min + (g1_diff * yidx) / yidx_max; b1 = b1_min + (b1_diff * yidx) / yidx_max; r1_inv = r1_min + (r1_diff * (yidx_max-yidx)) / yidx_max; g1_inv = g1_min + (g1_diff * (yidx_max-yidx)) / yidx_max; b1_inv = b1_min + (b1_diff * (yidx_max-yidx)) / yidx_max; r2 = r2_min + (r2_diff * yidx) / yidx_max; g2 = g2_min + (g2_diff * yidx) / yidx_max; b2 = b2_min + (b2_diff * yidx) / yidx_max; r2_inv = r2_min + (r2_diff * (yidx_max-yidx)) / yidx_max; g2_inv = g2_min + (g2_diff * (yidx_max-yidx)) / yidx_max; b2_inv = b2_min + (b2_diff * (yidx_max-yidx)) / yidx_max; dest = bg_data + row*bg_rowbytes; for (i = 0; i < rpng2_info.width; ++i) { even_odd_horiz = (i / bgscale) & 1; even_odd = even_odd_vert ^ even_odd_horiz; invert_column = (even_odd_horiz && (bg[pat].type & 0x10)); if (even_odd == 0) { /* gradient #1 */ if (invert_column) { *dest++ = r1_inv; *dest++ = g1_inv; *dest++ = b1_inv; } else { *dest++ = r1; *dest++ = g1; *dest++ = b1; } } else { /* gradient #2 */ if ((invert_column && invert_gradient2) || (!invert_column && !invert_gradient2)) { *dest++ = r2; /* not inverted or */ *dest++ = g2; /* doubly inverted */ *dest++ = b2; } else { *dest++ = r2_inv; *dest++ = g2_inv; /* singly inverted */ *dest++ = b2_inv; } } } } /*--------------------------------------------------------------------------- Soft gradient-diamonds with scale = bgscale. Code contributed by Adam M. Costello. ---------------------------------------------------------------------------*/ } else if ((bg[pat].type & 0x07) == 1) { hmax = (bgscale-1)/2; /* half the max weight of a color */ max = 2*hmax; /* the max weight of a color */ r1 = rgb[bg[pat].rgb1_max].r; g1 = rgb[bg[pat].rgb1_max].g; b1 = rgb[bg[pat].rgb1_max].b; r2 = rgb[bg[pat].rgb2_max].r; g2 = rgb[bg[pat].rgb2_max].g; b2 = rgb[bg[pat].rgb2_max].b; for (row = 0; row < rpng2_info.height; ++row) { yidx = row % bgscale; if (yidx > hmax) yidx = bgscale-1 - yidx; dest = bg_data + row*bg_rowbytes; for (i = 0; i < rpng2_info.width; ++i) { xidx = i % bgscale; if (xidx > hmax) xidx = bgscale-1 - xidx; k = xidx + yidx; *dest++ = (k*r1 + (max-k)*r2) / max; *dest++ = (k*g1 + (max-k)*g2) / max; *dest++ = (k*b1 + (max-k)*b2) / max; } } /*--------------------------------------------------------------------------- Radial "starburst" with azimuthal sinusoids; [eventually number of sinu- soids will equal bgscale?]. This one is slow but very cool. Code con- tributed by Pieter S. van der Meulen (originally in Smalltalk). ---------------------------------------------------------------------------*/ } else if ((bg[pat].type & 0x07) == 2) { uch ch; int ii, x, y, hw, hh, grayspot; double freq, rotate, saturate, gray, intensity; double angle=0.0, aoffset=0.0, maxDist, dist; double red=0.0, green=0.0, blue=0.0, hue, s, v, f, p, q, t; fprintf(stderr, "%s: computing radial background...", PROGNAME); fflush(stderr); hh = rpng2_info.height / 2; hw = rpng2_info.width / 2; /* variables for radial waves: * aoffset: number of degrees to rotate hue [CURRENTLY NOT USED] * freq: number of color beams originating from the center * grayspot: size of the graying center area (anti-alias) * rotate: rotation of the beams as a function of radius * saturate: saturation of beams' shape azimuthally */ angle = CLIP(angle, 0.0, 360.0); grayspot = CLIP(bg[pat].bg_gray, 1, (hh + hw)); freq = MAX((double)bg[pat].bg_freq, 0.0); saturate = (double)bg[pat].bg_bsat * 0.1; rotate = (double)bg[pat].bg_brot * 0.1; gray = 0.0; intensity = 0.0; maxDist = (double)((hw*hw) + (hh*hh)); for (row = 0; row < rpng2_info.height; ++row) { y = row - hh; dest = bg_data + row*bg_rowbytes; for (i = 0; i < rpng2_info.width; ++i) { x = i - hw; angle = (x == 0)? PI_2 : atan((double)y / (double)x); gray = (double)MAX(ABS(y), ABS(x)) / grayspot; gray = MIN(1.0, gray); dist = (double)((x*x) + (y*y)) / maxDist; intensity = cos((angle+(rotate*dist*PI)) * freq) * gray * saturate; intensity = (MAX(MIN(intensity,1.0),-1.0) + 1.0) * 0.5; hue = (angle + PI) * INV_PI_360 + aoffset; s = gray * ((double)(ABS(x)+ABS(y)) / (double)(hw + hh)); s = MIN(MAX(s,0.0), 1.0); v = MIN(MAX(intensity,0.0), 1.0); if (s == 0.0) { ch = (uch)(v * 255.0); *dest++ = ch; *dest++ = ch; *dest++ = ch; } else { if ((hue < 0.0) || (hue >= 360.0)) hue -= (((int)(hue / 360.0)) * 360.0); hue /= 60.0; ii = (int)hue; f = hue - (double)ii; p = (1.0 - s) * v; q = (1.0 - (s * f)) * v; t = (1.0 - (s * (1.0 - f))) * v; if (ii == 0) { red = v; green = t; blue = p; } else if (ii == 1) { red = q; green = v; blue = p; } else if (ii == 2) { red = p; green = v; blue = t; } else if (ii == 3) { red = p; green = q; blue = v; } else if (ii == 4) { red = t; green = p; blue = v; } else if (ii == 5) { red = v; green = p; blue = q; } *dest++ = (uch)(red * 255.0); *dest++ = (uch)(green * 255.0); *dest++ = (uch)(blue * 255.0); } } } fprintf(stderr, "done.\n"); fflush(stderr); } /*--------------------------------------------------------------------------- Blast background image to display buffer before beginning PNG decode; calling function will handle invalidation and UpdateWindow() call. ---------------------------------------------------------------------------*/ for (row = 0; row < rpng2_info.height; ++row) { src = bg_data + row*bg_rowbytes; dest = wimage_data + row*wimage_rowbytes; for (i = rpng2_info.width; i > 0; --i) { r1 = *src++; g1 = *src++; b1 = *src++; *dest++ = b1; *dest++ = g1; /* note reverse order */ *dest++ = r1; } } return 0; } /* end function rpng2_win_load_bg_image() */
3,107
97,996
0
void RenderView::OnSetZoomLevelForLoadingURL(const GURL& url, int zoom_level) { host_zoom_levels_[url] = zoom_level; }
3,108
118,740
0
void HTMLDocument::setBodyAttribute(const QualifiedName& name, const AtomicString& value) { if (HTMLBodyElement* body = htmlBodyElement()) { if (body->fastGetAttribute(name) != value) body->setAttribute(name, value); } }
3,109
154,743
0
error::Error GLES2DecoderPassthroughImpl::DoIsTransformFeedback( GLuint transformfeedback, uint32_t* result) { *result = api()->glIsTransformFeedbackFn(GetTransformFeedbackServiceID( transformfeedback, &transform_feedback_id_map_)); return error::kNoError; }
3,110
5,655
0
ok_to_reverse (char const *format, ...) { bool r = false; if (noreverse || ! (force && verbosity == SILENT)) { va_list args; va_start (args, format); vsay (format, args); va_end (args); } if (noreverse) { say (" Skipping patch.\n"); skip_rest_of_patch = true; } else if (force) { if (verbosity != SILENT) say (" Applying it anyway.\n"); } else if (batch) { say (reverse ? " Ignoring -R.\n" : " Assuming -R.\n"); r = true; } else { ask (reverse ? " Ignore -R? [n] " : " Assume -R? [n] "); r = *buf == 'y'; if (! r) { ask ("Apply anyway? [n] "); if (*buf != 'y') { if (verbosity != SILENT) say ("Skipping patch.\n"); skip_rest_of_patch = true; } } } return r; }
3,111
65,603
0
static void nfsd4_hash_conn(struct nfsd4_conn *conn, struct nfsd4_session *ses) { struct nfs4_client *clp = ses->se_client; spin_lock(&clp->cl_lock); __nfsd4_hash_conn(conn, ses); spin_unlock(&clp->cl_lock); }
3,112
1,908
0
static RedsMigTargetClient* reds_mig_target_client_find(RedClient *client) { RingItem *item; RING_FOREACH(item, &reds->mig_target_clients) { RedsMigTargetClient *mig_client; mig_client = SPICE_CONTAINEROF(item, RedsMigTargetClient, link); if (mig_client->client == client) { return mig_client; } } return NULL; }
3,113
65,039
0
static int check_map_access_adj(struct bpf_verifier_env *env, u32 regno, int off, int size) { struct bpf_verifier_state *state = &env->cur_state; struct bpf_reg_state *reg = &state->regs[regno]; int err; /* We adjusted the register to this map value, so we * need to change off and size to min_value and max_value * respectively to make sure our theoretical access will be * safe. */ if (log_level) print_verifier_state(state); env->varlen_map_value_access = true; /* The minimum value is only important with signed * comparisons where we can't assume the floor of a * value is 0. If we are using signed variables for our * index'es we need to make sure that whatever we use * will have a set floor within our range. */ if (reg->min_value < 0) { verbose("R%d min value is negative, either use unsigned index or do a if (index >=0) check.\n", regno); return -EACCES; } err = check_map_access(env, regno, reg->min_value + off, size); if (err) { verbose("R%d min value is outside of the array range\n", regno); return err; } /* If we haven't set a max value then we need to bail * since we can't be sure we won't do bad things. */ if (reg->max_value == BPF_REGISTER_MAX_RANGE) { verbose("R%d unbounded memory access, make sure to bounds check any array access into a map\n", regno); return -EACCES; } return check_map_access(env, regno, reg->max_value + off, size); }
3,114
19,059
0
int compat_udp_setsockopt(struct sock *sk, int level, int optname, char __user *optval, unsigned int optlen) { if (level == SOL_UDP || level == SOL_UDPLITE) return udp_lib_setsockopt(sk, level, optname, optval, optlen, udp_push_pending_frames); return compat_ip_setsockopt(sk, level, optname, optval, optlen); }
3,115
53,914
0
static bool ndp_msg_check_opts(struct ndp_msg *msg) { unsigned char *ptr = ndp_msg_payload_opts(msg); size_t len = ndp_msg_payload_opts_len(msg); struct ndp_msg_opt_type_info *info; while (len > 0) { uint8_t cur_opt_raw_type = ptr[0]; unsigned int cur_opt_len = ptr[1] << 3; /* convert to bytes */ if (!cur_opt_len) return false; if (len < cur_opt_len) break; info = ndp_msg_opt_type_info_by_raw_type(cur_opt_raw_type); if (info) { if (cur_opt_len < info->raw_struct_size || (info->check_valid && !info->check_valid(ptr))) ptr[0] = __INVALID_OPT_TYPE_MAGIC; } ptr += cur_opt_len; len -= cur_opt_len; } return true; }
3,116
31,951
0
int perf_event_refresh(struct perf_event *event, int refresh) { /* * not supported on inherited events */ if (event->attr.inherit || !is_sampling_event(event)) return -EINVAL; atomic_add(refresh, &event->event_limit); perf_event_enable(event); return 0; }
3,117
68,342
0
static inline void perf_cgroup_sched_out(struct task_struct *task, struct task_struct *next) { struct perf_cgroup *cgrp1; struct perf_cgroup *cgrp2 = NULL; rcu_read_lock(); /* * we come here when we know perf_cgroup_events > 0 * we do not need to pass the ctx here because we know * we are holding the rcu lock */ cgrp1 = perf_cgroup_from_task(task, NULL); cgrp2 = perf_cgroup_from_task(next, NULL); /* * only schedule out current cgroup events if we know * that we are switching to a different cgroup. Otherwise, * do no touch the cgroup events. */ if (cgrp1 != cgrp2) perf_cgroup_switch(task, PERF_CGROUP_SWOUT); rcu_read_unlock(); }
3,118
106,005
0
bool JSTestInterfaceConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) { return getStaticPropertySlot<JSTestInterfaceConstructor, JSDOMWrapper>(exec, &JSTestInterfaceConstructorTable, jsCast<JSTestInterfaceConstructor*>(cell), propertyName, slot); }
3,119
70,402
0
int jas_seq2d_output(jas_matrix_t *matrix, FILE *out) { #define MAXLINELEN 80 int i; int j; jas_seqent_t x; char buf[MAXLINELEN + 1]; char sbuf[MAXLINELEN + 1]; int n; fprintf(out, "%d %d\n", jas_seq2d_xstart(matrix), jas_seq2d_ystart(matrix)); fprintf(out, "%d %d\n", jas_matrix_numcols(matrix), jas_matrix_numrows(matrix)); buf[0] = '\0'; for (i = 0; i < jas_matrix_numrows(matrix); ++i) { for (j = 0; j < jas_matrix_numcols(matrix); ++j) { x = jas_matrix_get(matrix, i, j); sprintf(sbuf, "%s%4ld", (strlen(buf) > 0) ? " " : "", JAS_CAST(long, x)); n = strlen(buf); if (n + strlen(sbuf) > MAXLINELEN) { fputs(buf, out); fputs("\n", out); buf[0] = '\0'; } strcat(buf, sbuf); if (j == jas_matrix_numcols(matrix) - 1) { fputs(buf, out); fputs("\n", out); buf[0] = '\0'; } } } fputs(buf, out); return 0; }
3,120
167,246
0
ConfirmInfoBarDelegate::~ConfirmInfoBarDelegate() { }
3,121
184,775
1
static v8::Handle<v8::Value> enabledAtRuntimeMethod2Callback(const v8::Arguments& args) { INC_STATS("DOM.TestObj.enabledAtRuntimeMethod2"); if (args.Length() < 1) return V8Proxy::throwNotEnoughArgumentsError(); TestObj* imp = V8TestObj::toNative(args.Holder()); EXCEPTION_BLOCK(int, intArg, V8int::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8int::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0); imp->enabledAtRuntimeMethod2(intArg); return v8::Handle<v8::Value>(); }
3,122
149,950
0
DrawMode LayerTreeHostImpl::GetDrawMode() const { if (resourceless_software_draw_) { return DRAW_MODE_RESOURCELESS_SOFTWARE; } else if (compositor_frame_sink_->context_provider()) { return DRAW_MODE_HARDWARE; } else { return DRAW_MODE_SOFTWARE; } }
3,123
76,981
0
ofpact_check__(enum ofputil_protocol *usable_protocols, struct ofpact *a, struct flow *flow, ofp_port_t max_ports, uint8_t table_id, uint8_t n_tables) { const struct ofpact_enqueue *enqueue; const struct mf_field *mf; switch (a->type) { case OFPACT_OUTPUT: return ofpact_check_output_port(ofpact_get_OUTPUT(a)->port, max_ports); case OFPACT_CONTROLLER: return 0; case OFPACT_ENQUEUE: enqueue = ofpact_get_ENQUEUE(a); if (ofp_to_u16(enqueue->port) >= ofp_to_u16(max_ports) && enqueue->port != OFPP_IN_PORT && enqueue->port != OFPP_LOCAL) { return OFPERR_OFPBAC_BAD_OUT_PORT; } return 0; case OFPACT_OUTPUT_REG: return mf_check_src(&ofpact_get_OUTPUT_REG(a)->src, flow); case OFPACT_OUTPUT_TRUNC: return ofpact_check_output_port(ofpact_get_OUTPUT_TRUNC(a)->port, max_ports); case OFPACT_BUNDLE: return bundle_check(ofpact_get_BUNDLE(a), max_ports, flow); case OFPACT_SET_VLAN_VID: /* Remember if we saw a vlan tag in the flow to aid translating to * OpenFlow 1.1+ if need be. */ ofpact_get_SET_VLAN_VID(a)->flow_has_vlan = (flow->vlan_tci & htons(VLAN_CFI)) == htons(VLAN_CFI); if (!(flow->vlan_tci & htons(VLAN_CFI)) && !ofpact_get_SET_VLAN_VID(a)->push_vlan_if_needed) { inconsistent_match(usable_protocols); } /* Temporary mark that we have a vlan tag. */ flow->vlan_tci |= htons(VLAN_CFI); return 0; case OFPACT_SET_VLAN_PCP: /* Remember if we saw a vlan tag in the flow to aid translating to * OpenFlow 1.1+ if need be. */ ofpact_get_SET_VLAN_PCP(a)->flow_has_vlan = (flow->vlan_tci & htons(VLAN_CFI)) == htons(VLAN_CFI); if (!(flow->vlan_tci & htons(VLAN_CFI)) && !ofpact_get_SET_VLAN_PCP(a)->push_vlan_if_needed) { inconsistent_match(usable_protocols); } /* Temporary mark that we have a vlan tag. */ flow->vlan_tci |= htons(VLAN_CFI); return 0; case OFPACT_STRIP_VLAN: if (!(flow->vlan_tci & htons(VLAN_CFI))) { inconsistent_match(usable_protocols); } /* Temporary mark that we have no vlan tag. */ flow->vlan_tci = htons(0); return 0; case OFPACT_PUSH_VLAN: if (flow->vlan_tci & htons(VLAN_CFI)) { /* Multiple VLAN headers not supported. */ return OFPERR_OFPBAC_BAD_TAG; } /* Temporary mark that we have a vlan tag. */ flow->vlan_tci |= htons(VLAN_CFI); return 0; case OFPACT_SET_ETH_SRC: case OFPACT_SET_ETH_DST: return 0; case OFPACT_SET_IPV4_SRC: case OFPACT_SET_IPV4_DST: if (flow->dl_type != htons(ETH_TYPE_IP)) { inconsistent_match(usable_protocols); } return 0; case OFPACT_SET_IP_DSCP: case OFPACT_SET_IP_ECN: case OFPACT_SET_IP_TTL: case OFPACT_DEC_TTL: if (!is_ip_any(flow)) { inconsistent_match(usable_protocols); } return 0; case OFPACT_SET_L4_SRC_PORT: case OFPACT_SET_L4_DST_PORT: if (!is_ip_any(flow) || (flow->nw_frag & FLOW_NW_FRAG_LATER) || (flow->nw_proto != IPPROTO_TCP && flow->nw_proto != IPPROTO_UDP && flow->nw_proto != IPPROTO_SCTP)) { inconsistent_match(usable_protocols); } /* Note on which transport protocol the port numbers are set. * This allows this set action to be converted to an OF1.2 set field * action. */ if (a->type == OFPACT_SET_L4_SRC_PORT) { ofpact_get_SET_L4_SRC_PORT(a)->flow_ip_proto = flow->nw_proto; } else { ofpact_get_SET_L4_DST_PORT(a)->flow_ip_proto = flow->nw_proto; } return 0; case OFPACT_REG_MOVE: return nxm_reg_move_check(ofpact_get_REG_MOVE(a), flow); case OFPACT_SET_FIELD: mf = ofpact_get_SET_FIELD(a)->field; /* Require OXM_OF_VLAN_VID to have an existing VLAN header. */ if (!mf_are_prereqs_ok(mf, flow, NULL) || (mf->id == MFF_VLAN_VID && !(flow->vlan_tci & htons(VLAN_CFI)))) { VLOG_WARN_RL(&rl, "set_field %s lacks correct prerequisities", mf->name); return OFPERR_OFPBAC_MATCH_INCONSISTENT; } /* Remember if we saw a vlan tag in the flow to aid translating to * OpenFlow 1.1 if need be. */ ofpact_get_SET_FIELD(a)->flow_has_vlan = (flow->vlan_tci & htons(VLAN_CFI)) == htons(VLAN_CFI); if (mf->id == MFF_VLAN_TCI) { /* The set field may add or remove the vlan tag, * Mark the status temporarily. */ flow->vlan_tci = ofpact_get_SET_FIELD(a)->value->be16; } return 0; case OFPACT_STACK_PUSH: return nxm_stack_push_check(ofpact_get_STACK_PUSH(a), flow); case OFPACT_STACK_POP: return nxm_stack_pop_check(ofpact_get_STACK_POP(a), flow); case OFPACT_SET_MPLS_LABEL: case OFPACT_SET_MPLS_TC: case OFPACT_SET_MPLS_TTL: case OFPACT_DEC_MPLS_TTL: if (!eth_type_mpls(flow->dl_type)) { inconsistent_match(usable_protocols); } return 0; case OFPACT_SET_TUNNEL: case OFPACT_SET_QUEUE: case OFPACT_POP_QUEUE: case OFPACT_RESUBMIT: return 0; case OFPACT_FIN_TIMEOUT: if (flow->nw_proto != IPPROTO_TCP) { inconsistent_match(usable_protocols); } return 0; case OFPACT_LEARN: return learn_check(ofpact_get_LEARN(a), flow); case OFPACT_CONJUNCTION: return 0; case OFPACT_MULTIPATH: return multipath_check(ofpact_get_MULTIPATH(a), flow); case OFPACT_NOTE: case OFPACT_EXIT: return 0; case OFPACT_PUSH_MPLS: flow->dl_type = ofpact_get_PUSH_MPLS(a)->ethertype; /* The packet is now MPLS and the MPLS payload is opaque. * Thus nothing can be assumed about the network protocol. * Temporarily mark that we have no nw_proto. */ flow->nw_proto = 0; return 0; case OFPACT_POP_MPLS: if (!eth_type_mpls(flow->dl_type)) { inconsistent_match(usable_protocols); } flow->dl_type = ofpact_get_POP_MPLS(a)->ethertype; return 0; case OFPACT_SAMPLE: return 0; case OFPACT_CLONE: { struct ofpact_nest *on = ofpact_get_CLONE(a); return ofpacts_check(on->actions, ofpact_nest_get_action_len(on), flow, max_ports, table_id, n_tables, usable_protocols); } case OFPACT_CT: { struct ofpact_conntrack *oc = ofpact_get_CT(a); if (!dl_type_is_ip_any(flow->dl_type) || (flow->ct_state & CS_INVALID && oc->flags & NX_CT_F_COMMIT) || (oc->alg == IPPORT_FTP && flow->nw_proto != IPPROTO_TCP) || (oc->alg == IPPORT_TFTP && flow->nw_proto != IPPROTO_UDP)) { /* We can't downgrade to OF1.0 and expect inconsistent CT actions * be silently discarded. Instead, datapath flow install fails, so * it is better to flag inconsistent CT actions as hard errors. */ return OFPERR_OFPBAC_MATCH_INCONSISTENT; } if (oc->zone_src.field) { return mf_check_src(&oc->zone_src, flow); } return ofpacts_check(oc->actions, ofpact_ct_get_action_len(oc), flow, max_ports, table_id, n_tables, usable_protocols); } case OFPACT_CT_CLEAR: return 0; case OFPACT_NAT: { struct ofpact_nat *on = ofpact_get_NAT(a); if (!dl_type_is_ip_any(flow->dl_type) || (on->range_af == AF_INET && flow->dl_type != htons(ETH_TYPE_IP)) || (on->range_af == AF_INET6 && flow->dl_type != htons(ETH_TYPE_IPV6))) { return OFPERR_OFPBAC_MATCH_INCONSISTENT; } return 0; } case OFPACT_CLEAR_ACTIONS: return 0; case OFPACT_WRITE_ACTIONS: { /* Use a temporary copy of 'usable_protocols' because we can't check * consistency of an action set. */ struct ofpact_nest *on = ofpact_get_WRITE_ACTIONS(a); enum ofputil_protocol p = *usable_protocols; return ofpacts_check(on->actions, ofpact_nest_get_action_len(on), flow, max_ports, table_id, n_tables, &p); } case OFPACT_WRITE_METADATA: return 0; case OFPACT_METER: { uint32_t mid = ofpact_get_METER(a)->meter_id; if (mid == 0 || mid > OFPM13_MAX) { return OFPERR_OFPMMFC_INVALID_METER; } return 0; } case OFPACT_GOTO_TABLE: { uint8_t goto_table = ofpact_get_GOTO_TABLE(a)->table_id; if ((table_id != 255 && goto_table <= table_id) || (n_tables != 255 && goto_table >= n_tables)) { return OFPERR_OFPBIC_BAD_TABLE_ID; } return 0; } case OFPACT_GROUP: return 0; case OFPACT_UNROLL_XLATE: /* UNROLL is an internal action that should never be seen via * OpenFlow. */ return OFPERR_OFPBAC_BAD_TYPE; case OFPACT_DEBUG_RECIRC: return 0; default: OVS_NOT_REACHED(); } }
3,124
13,354
0
OsAbort (void) { #ifndef __APPLE__ OsBlockSignals(); #endif abort(); }
3,125
105,199
0
String createMarkup(const Node* node, EChildrenOnly childrenOnly, Vector<Node*>* nodes, EAbsoluteURLs shouldResolveURLs, Vector<QualifiedName>* tagNamesToSkip) { if (!node) return ""; HTMLElement* deleteButtonContainerElement = 0; if (Frame* frame = node->document()->frame()) { deleteButtonContainerElement = frame->editor()->deleteButtonController()->containerElement(); if (node->isDescendantOf(deleteButtonContainerElement)) return ""; } MarkupAccumulator accumulator(nodes, shouldResolveURLs); return accumulator.serializeNodes(const_cast<Node*>(node), deleteButtonContainerElement, childrenOnly, tagNamesToSkip); }
3,126
136,191
0
inline uint32_t ReadUInt32(uint8_t* mem_bytes, int offset) { return static_cast<uint32_t>(mem_bytes[offset]) | (static_cast<uint32_t>(mem_bytes[offset + 1]) << 8) | (static_cast<uint32_t>(mem_bytes[offset + 2]) << 16) | (static_cast<uint32_t>(mem_bytes[offset + 3]) << 24); }
3,127
106,246
0
void setJSTestObjWithScriptStateAttribute(ExecState* exec, JSObject* thisObject, JSValue value) { JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject); TestObj* impl = static_cast<TestObj*>(castedThis->impl()); impl->setWithScriptStateAttribute(exec, value.toInt32(exec)); }
3,128
112,860
0
void GDataCache::ClearDirty(const std::string& resource_id, const std::string& md5, FileOperationType file_operation_type, base::PlatformFileError* error) { AssertOnSequencedWorkerPool(); DCHECK(error); scoped_ptr<CacheEntry> cache_entry = GetCacheEntry(resource_id, std::string()); if (!cache_entry.get() || cache_entry->sub_dir_type == CACHE_TYPE_PINNED) { LOG(WARNING) << "Can't clear dirty state of a file that wasn't cached: " << "res_id=" << resource_id << ", md5=" << md5; *error = base::PLATFORM_FILE_ERROR_NOT_FOUND; return; } if (!cache_entry->IsDirty()) { LOG(WARNING) << "Can't clear dirty state of a non-dirty file: res_id=" << resource_id << ", md5=" << md5; *error = base::PLATFORM_FILE_ERROR_INVALID_OPERATION; return; } DCHECK_EQ(CACHE_TYPE_PERSISTENT, cache_entry->sub_dir_type); FilePath source_path = GetCacheFilePath(resource_id, md5, cache_entry->sub_dir_type, CACHED_FILE_LOCALLY_MODIFIED); CacheSubDirectoryType sub_dir_type = cache_entry->IsPinned() ? CACHE_TYPE_PERSISTENT : CACHE_TYPE_TMP; FilePath dest_path = GetCacheFilePath(resource_id, md5, sub_dir_type, CACHED_FILE_FROM_SERVER); FilePath symlink_path = GetCacheFilePath(resource_id, std::string(), CACHE_TYPE_OUTGOING, CACHED_FILE_FROM_SERVER); *error = ModifyCacheState(source_path, dest_path, file_operation_type, symlink_path, false /* don't create symlink */); if (*error == base::PLATFORM_FILE_OK && cache_entry->IsPinned()) { symlink_path = GetCacheFilePath(resource_id, std::string(), CACHE_TYPE_PINNED, CACHED_FILE_FROM_SERVER); *error = ModifyCacheState(dest_path, // source path dest_path, // destination path file_operation_type, symlink_path, true /* create symlink */); } if (*error == base::PLATFORM_FILE_OK) { int cache_state = ClearCacheDirty(cache_entry->cache_state); metadata_->UpdateCache(resource_id, md5, sub_dir_type, cache_state); } }
3,129
75,631
0
static int read_new_config_info (WavpackContext *wpc, WavpackMetadata *wpmd) { int bytecnt = wpmd->byte_length; unsigned char *byteptr = (unsigned char *)wpmd->data; wpc->version_five = 1; // just having this block signals version 5.0 wpc->file_format = wpc->config.qmode = wpc->channel_layout = 0; if (wpc->channel_reordering) { free (wpc->channel_reordering); wpc->channel_reordering = NULL; } if (bytecnt >= 2) { wpc->file_format = *byteptr++; wpc->config.qmode = (wpc->config.qmode & ~0xff) | *byteptr++; bytecnt -= 2; if (bytecnt) { int nchans, i; wpc->channel_layout = (int32_t) *byteptr++ << 16; bytecnt--; if (bytecnt) { wpc->channel_layout += nchans = *byteptr++; bytecnt--; if (bytecnt) { if (bytecnt > nchans) return FALSE; wpc->channel_reordering = (unsigned char *)malloc (nchans); if (wpc->channel_reordering) { for (i = 0; i < nchans; ++i) if (bytecnt) { wpc->channel_reordering [i] = *byteptr++; if (wpc->channel_reordering [i] >= nchans) // make sure index is in range wpc->channel_reordering [i] = 0; bytecnt--; } else wpc->channel_reordering [i] = i; } } } else wpc->channel_layout += wpc->config.num_channels; } } return TRUE; }
3,130
99,488
0
static void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount, NPIdentifier *identifiers) { ASSERT(names); ASSERT(identifiers); if (!names || !identifiers) return; for (int32_t i = 0; i < nameCount; ++i) identifiers[i] = NPN_GetStringIdentifier(names[i]); }
3,131
71,826
0
static void ipa_draw_pixel(wmfAPI * API, wmfDrawPixel_t * draw_pixel) { /* Save graphic wand */ (void) PushDrawingWand(WmfDrawingWand); draw_stroke_color_string(WmfDrawingWand,"none"); draw_fill_color_rgb(API,&(draw_pixel->color)); DrawRectangle(WmfDrawingWand, XC(draw_pixel->pt.x), YC(draw_pixel->pt.y), XC(draw_pixel->pt.x + draw_pixel->pixel_width), YC(draw_pixel->pt.y + draw_pixel->pixel_height)); /* Restore graphic wand */ (void) PopDrawingWand(WmfDrawingWand); }
3,132
39,220
0
static int nfs_writepages_callback(struct page *page, struct writeback_control *wbc, void *data) { int ret; ret = nfs_do_writepage(page, wbc, data); unlock_page(page); return ret; }
3,133
11,931
0
CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags) { CMS_ContentInfo *cms; if (comp_nid <= 0) comp_nid = NID_zlib_compression; cms = cms_CompressedData_create(comp_nid); if (!cms) return NULL; if (!(flags & CMS_DETACHED)) CMS_set_detached(cms, 0); if ((flags & CMS_STREAM) || CMS_final(cms, in, NULL, flags)) return cms; CMS_ContentInfo_free(cms); return NULL; }
3,134
164,602
0
void IndexedDBDatabase::Clear(IndexedDBTransaction* transaction, int64_t object_store_id, scoped_refptr<IndexedDBCallbacks> callbacks) { DCHECK(transaction); IDB_TRACE1("IndexedDBDatabase::Clear", "txn.id", transaction->id()); DCHECK_NE(transaction->mode(), blink::mojom::IDBTransactionMode::ReadOnly); if (!ValidateObjectStoreId(object_store_id)) return; transaction->ScheduleTask(base::BindOnce(&IndexedDBDatabase::ClearOperation, this, object_store_id, callbacks)); }
3,135
67,902
0
static int file_read(jas_stream_obj_t *obj, char *buf, int cnt) { jas_stream_fileobj_t *fileobj; JAS_DBGLOG(100, ("file_read(%p, %p, %d)\n", obj, buf, cnt)); fileobj = JAS_CAST(jas_stream_fileobj_t *, obj); return read(fileobj->fd, buf, cnt); }
3,136
183,537
1
void Vp9Parser::ReadSegmentation() { segmentation_.update_map = false; segmentation_.update_data = false; segmentation_.enabled = reader_.ReadBool(); if (!segmentation_.enabled) return; segmentation_.update_map = reader_.ReadBool(); if (segmentation_.update_map) ReadSegmentationMap(); segmentation_.update_data = reader_.ReadBool(); if (segmentation_.update_data) ReadSegmentationData(); }
3,137
178,206
1
PHP_FUNCTION(grapheme_strpos) { unsigned char *haystack, *needle; int haystack_len, needle_len; unsigned char *found; long loffset = 0; int32_t offset = 0; int ret_pos; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_strpos: unable to parse input param", 0 TSRMLS_CC ); RETURN_FALSE; } if ( OUTSIDE_STRING(loffset, haystack_len) ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_strpos: Offset not contained in string", 1 TSRMLS_CC ); RETURN_FALSE; } /* we checked that it will fit: */ offset = (int32_t) loffset; /* the offset is 'grapheme count offset' so it still might be invalid - we'll check it later */ intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_strpos: Empty delimiter", 1 TSRMLS_CC ); RETURN_FALSE; }
3,138
13,037
0
compute_keygrip (gcry_md_hd_t md, gcry_sexp_t keyparms) { #define N_COMPONENTS 7 static const char names[N_COMPONENTS] = "pabgnhq"; gpg_err_code_t rc; gcry_sexp_t l1; gcry_mpi_t values[N_COMPONENTS]; int idx; char *curvename = NULL; int flags = 0; enum gcry_mpi_ec_models model = 0; enum ecc_dialects dialect = 0; /* Clear the values first. */ for (idx=0; idx < N_COMPONENTS; idx++) values[idx] = NULL; /* Look for flags. */ l1 = sexp_find_token (keyparms, "flags", 0); if (l1) { rc = _gcry_pk_util_parse_flaglist (l1, &flags, NULL); if (rc) goto leave; } /* Extract the parameters. */ if ((flags & PUBKEY_FLAG_PARAM)) { if ((flags & PUBKEY_FLAG_DJB_TWEAK)) rc = sexp_extract_param (keyparms, NULL, "p?a?b?g?n?h?/q", &values[0], &values[1], &values[2], &values[3], &values[4], &values[5], &values[6], NULL); else rc = sexp_extract_param (keyparms, NULL, "p?a?b?g?n?h?q", &values[0], &values[1], &values[2], &values[3], &values[4], &values[5], &values[6], NULL); } else { if ((flags & PUBKEY_FLAG_DJB_TWEAK)) rc = sexp_extract_param (keyparms, NULL, "/q", &values[6], NULL); else rc = sexp_extract_param (keyparms, NULL, "q", &values[6], NULL); } if (rc) goto leave; /* Check whether a curve parameter is available and use that to fill in missing values. */ sexp_release (l1); l1 = sexp_find_token (keyparms, "curve", 5); if (l1) { curvename = sexp_nth_string (l1, 1); if (curvename) { rc = _gcry_ecc_update_curve_param (curvename, &model, &dialect, &values[0], &values[1], &values[2], &values[3], &values[4], &values[5]); if (rc) goto leave; } } /* Guess required fields if a curve parameter has not been given. FIXME: This is a crude hacks. We need to fix that. */ if (!curvename) { model = ((flags & PUBKEY_FLAG_EDDSA) ? MPI_EC_EDWARDS : MPI_EC_WEIERSTRASS); dialect = ((flags & PUBKEY_FLAG_EDDSA) ? ECC_DIALECT_ED25519 : ECC_DIALECT_STANDARD); if (!values[5]) values[5] = mpi_const (MPI_C_ONE); } /* Check that all parameters are known and normalize all MPIs (that should not be required but we use an internal function later and thus we better make 100% sure that they are normalized). */ for (idx = 0; idx < N_COMPONENTS; idx++) if (!values[idx]) { rc = GPG_ERR_NO_OBJ; goto leave; } else _gcry_mpi_normalize (values[idx]); /* Uncompress the public key with the exception of EdDSA where compression is the default and we thus compute the keygrip using the compressed version. Because we don't support any non-eddsa compression, the only thing we need to do is to compress EdDSA. */ if ((flags & PUBKEY_FLAG_DJB_TWEAK)) { rc = _gcry_ecc_eddsa_ensure_compact (values[6], 256); if (rc) goto leave; } /* Hash them all. */ for (idx = 0; idx < N_COMPONENTS; idx++) { char buf[30]; if (idx == 5) continue; /* Skip cofactor. */ if (mpi_is_opaque (values[idx])) { const unsigned char *raw; unsigned int n; raw = mpi_get_opaque (values[idx], &n); n = (n + 7)/8; snprintf (buf, sizeof buf, "(1:%c%u:", names[idx], n); _gcry_md_write (md, buf, strlen (buf)); _gcry_md_write (md, raw, n); _gcry_md_write (md, ")", 1); } else { unsigned char *rawmpi; unsigned int rawmpilen; rawmpi = _gcry_mpi_get_buffer (values[idx], 0, &rawmpilen, NULL); if (!rawmpi) { rc = gpg_err_code_from_syserror (); goto leave; } snprintf (buf, sizeof buf, "(1:%c%u:", names[idx], rawmpilen); _gcry_md_write (md, buf, strlen (buf)); _gcry_md_write (md, rawmpi, rawmpilen); _gcry_md_write (md, ")", 1); xfree (rawmpi); } } leave: xfree (curvename); sexp_release (l1); for (idx = 0; idx < N_COMPONENTS; idx++) _gcry_mpi_release (values[idx]); return rc; #undef N_COMPONENTS }
3,139
43,502
0
void __kvm_migrate_pit_timer(struct kvm_vcpu *vcpu) { struct kvm_pit *pit = vcpu->kvm->arch.vpit; struct hrtimer *timer; if (!kvm_vcpu_is_bsp(vcpu) || !pit) return; timer = &pit->pit_state.pit_timer.timer; if (hrtimer_cancel(timer)) hrtimer_start_expires(timer, HRTIMER_MODE_ABS); }
3,140
91,931
0
static void f_midi_read_data(struct usb_ep *ep, int cable, uint8_t *data, int length) { struct f_midi *midi = ep->driver_data; struct snd_rawmidi_substream *substream = midi->out_substream[cable]; if (!substream) /* Nobody is listening - throw it on the floor. */ return; if (!test_bit(cable, &midi->out_triggered)) return; snd_rawmidi_receive(substream, data, length); }
3,141
2,969
0
pdf14_push_transparency_group(pdf14_ctx *ctx, gs_int_rect *rect, bool isolated, bool knockout, byte alpha, byte shape, gs_blend_mode_t blend_mode, bool idle, uint mask_id, int numcomps, bool cm_back_drop, cmm_profile_t *group_profile, cmm_profile_t *tos_profile, gs_gstate *pgs, gx_device *dev) { pdf14_buf *tos = ctx->stack; pdf14_buf *buf, *backdrop; bool has_shape, has_tags; if_debug1m('v', ctx->memory, "[v]pdf14_push_transparency_group, idle = %d\n", idle); /* We are going to use the shape in the knockout computation. If previous buffer has a shape or if this is a knockout then we will have a shape here */ has_shape = tos->has_shape || tos->knockout; /* If previous buffer has tags, then add tags here */ has_tags = tos->has_tags; /* If the group is NOT isolated we add in the alpha_g plane. This enables recompositing to be performed ala art_pdf_recomposite_group_8 so that the backdrop is only included one time in the computation. */ /* Order of buffer data is color data, followed by alpha channel, followed by shape (if present), then alpha_g (if present), then tags (if present) */ buf = pdf14_buf_new(rect, has_tags, !isolated, has_shape, idle, numcomps + 1, tos->num_spots, ctx->memory); if (buf == NULL) return_error(gs_error_VMerror); if_debug4m('v', ctx->memory, "[v]base buf: %d x %d, %d color channels, %d planes\n", buf->rect.q.x, buf->rect.q.y, buf->n_chan, buf->n_planes); buf->isolated = isolated; buf->knockout = knockout; buf->alpha = alpha; buf->shape = shape; buf->blend_mode = blend_mode; buf->mask_id = mask_id; buf->mask_stack = ctx->mask_stack; /* Save because the group rendering may set up another (nested) mask. */ ctx->mask_stack = NULL; /* Clean the mask field for rendering this group. See pdf14_pop_transparency_group how to handle it. */ buf->saved = tos; ctx->stack = buf; if (buf->data == NULL) return 0; if (idle) return 0; backdrop = pdf14_find_backdrop_buf(ctx); if (backdrop == NULL) { /* Note, don't clear out tags set by pdf14_buf_new == GS_UNKNOWN_TAG */ memset(buf->data, 0, buf->planestride * (buf->n_chan + (buf->has_shape ? 1 : 0) + (buf->has_alpha_g ? 1 : 0))); } else { if (!buf->knockout) { if (!cm_back_drop) { pdf14_preserve_backdrop(buf, tos, false); } else { /* We must have an non-isolated group with a mismatch in color spaces. In this case, we can't just copy the buffer but must CM it */ pdf14_preserve_backdrop_cm(buf, group_profile, tos, tos_profile, ctx->memory, pgs, dev, false); } } } /* If knockout, we have to maintain a copy of the backdrop in case we are drawing nonisolated groups on top of the knockout group. */ if (buf->knockout) { buf->backdrop = gs_alloc_bytes(ctx->memory, buf->planestride * buf->n_chan, "pdf14_push_transparency_group"); if (buf->backdrop == NULL) { return gs_throw(gs_error_VMerror, "Knockout backdrop allocation failed"); } if (buf->isolated) { /* We will have opaque backdrop for non-isolated compositing */ memset(buf->backdrop, 0, buf->planestride * buf->n_chan); } else { /* Save knockout backdrop for non-isolated compositing */ /* Note that we need to drill down through the non-isolated groups in our stack and make sure that we are not embedded in another knockout group */ pdf14_buf *check = tos; pdf14_buf *child = NULL; /* Needed so we can get profile */ cmm_profile_t *prev_knockout_profile; while (check != NULL) { if (check->isolated) break; if (check->knockout) { break; } child = check; check = check->saved; } /* Here we need to grab a back drop from a knockout parent group and potentially worry about color differences. */ if (check == NULL) { prev_knockout_profile = tos_profile; check = tos; } else { if (child == NULL) { prev_knockout_profile = tos_profile; } else { prev_knockout_profile = child->parent_color_info_procs->icc_profile; } } if (!cm_back_drop) { pdf14_preserve_backdrop(buf, check, false); } else { /* We must have an non-isolated group with a mismatch in color spaces. In this case, we can't just copy the buffer but must CM it */ pdf14_preserve_backdrop_cm(buf, group_profile, check, prev_knockout_profile, ctx->memory, pgs, dev, false); } memcpy(buf->backdrop, buf->data, buf->planestride * buf->n_chan); } #if RAW_DUMP /* Dump the current buffer to see what we have. */ dump_raw_buffer(ctx->stack->rect.q.y-ctx->stack->rect.p.y, ctx->stack->rowstride, buf->n_chan, ctx->stack->planestride, ctx->stack->rowstride, "KnockoutBackDrop", buf->backdrop); global_index++; #endif } else { buf->backdrop = NULL; } #if RAW_DUMP /* Dump the current buffer to see what we have. */ dump_raw_buffer(ctx->stack->rect.q.y-ctx->stack->rect.p.y, ctx->stack->rowstride, ctx->stack->n_planes, ctx->stack->planestride, ctx->stack->rowstride, "TransGroupPush", ctx->stack->data); global_index++; #endif return 0; }
3,142
87,857
0
code_exist_check(OnigCodePoint c, UChar* from, UChar* end, int ignore_escaped, ScanEnv* env) { int in_esc; OnigCodePoint code; OnigEncoding enc = env->enc; UChar* p = from; in_esc = 0; while (! PEND) { if (ignore_escaped && in_esc) { in_esc = 0; } else { PFETCH_S(code); if (code == c) return 1; if (code == MC_ESC(env->syntax)) in_esc = 1; } } return 0; }
3,143
126,790
0
const views::Widget* BrowserView::GetWidget() const { return View::GetWidget(); }
3,144
41,047
0
static int mk_security_check_hotlink(mk_ptr_t url, mk_ptr_t host, mk_ptr_t referer) { mk_ptr_t ref_host = parse_referer_host(referer); unsigned int domains_matched = 0; int i = 0; const char *curA, *curB; struct mk_list *head; struct mk_secure_deny_hotlink_t *entry; if (ref_host.data == NULL) { return 0; } else if (host.data == NULL) { mk_err("No host data."); return -1; } mk_list_foreach(head, &mk_secure_url) { entry = mk_list_entry(head, struct mk_secure_deny_hotlink_t, _head); i = mk_api->str_search_n(url.data, entry->criteria, MK_STR_INSENSITIVE, url.len); if (i >= 0) { break; } } if (i < 0) { return 0; } curA = host.data + host.len; curB = ref_host.data + ref_host.len; while (curA > host.data && curB > ref_host.data) { i++; curA--; curB--; if ((*curA == '.' && *curB == '.') || curA == host.data || curB == ref_host.data) { if (i < 1) { break; } else if (curA == host.data && !(curB == ref_host.data || *(curB - 1) == '.')) { break; } else if (curB == ref_host.data && !(curA == host.data || *(curA - 1) == '.')) { break; } else if (strncasecmp(curA, curB, i)) { break; } domains_matched += 1; i = 0; } } return domains_matched >= 2 ? 0 : -1; }
3,145
177,497
0
static void addRange(vector<uint32_t> &coverage, uint32_t start, uint32_t end) { #ifdef PRINTF_DEBUG printf("adding range %d-%d\n", start, end); #endif if (coverage.empty() || coverage.back() < start) { coverage.push_back(start); coverage.push_back(end); } else { coverage.back() = end; } }
3,146
14,832
0
mconvert(struct magic_set *ms, struct magic *m, int flip) { union VALUETYPE *p = &ms->ms_value; switch (cvt_flip(m->type, flip)) { case FILE_BYTE: cvt_8(p, m); return 1; case FILE_SHORT: cvt_16(p, m); return 1; case FILE_LONG: case FILE_DATE: case FILE_LDATE: cvt_32(p, m); return 1; case FILE_QUAD: case FILE_QDATE: case FILE_QLDATE: case FILE_QWDATE: cvt_64(p, m); return 1; case FILE_STRING: case FILE_BESTRING16: case FILE_LESTRING16: { /* Null terminate and eat *trailing* return */ p->s[sizeof(p->s) - 1] = '\0'; return 1; } case FILE_PSTRING: { size_t sz = file_pstring_length_size(m); char *ptr1 = p->s, *ptr2 = ptr1 + sz; size_t len = file_pstring_get_length(m, ptr1); sz = sizeof(p->s) - sz; /* maximum length of string */ if (len >= sz) { /* * The size of the pascal string length (sz) * is 1, 2, or 4. We need at least 1 byte for NUL * termination, but we've already truncated the * string by p->s, so we need to deduct sz. * Because we can use one of the bytes of the length * after we shifted as NUL termination. */ len = sz; } while (len--) *ptr1++ = *ptr2++; *ptr1 = '\0'; return 1; } case FILE_BESHORT: p->h = (short)((p->hs[0]<<8)|(p->hs[1])); cvt_16(p, m); return 1; case FILE_BELONG: case FILE_BEDATE: case FILE_BELDATE: p->l = (int32_t) ((p->hl[0]<<24)|(p->hl[1]<<16)|(p->hl[2]<<8)|(p->hl[3])); cvt_32(p, m); return 1; case FILE_BEQUAD: case FILE_BEQDATE: case FILE_BEQLDATE: case FILE_BEQWDATE: p->q = (uint64_t) (((uint64_t)p->hq[0]<<56)|((uint64_t)p->hq[1]<<48)| ((uint64_t)p->hq[2]<<40)|((uint64_t)p->hq[3]<<32)| ((uint64_t)p->hq[4]<<24)|((uint64_t)p->hq[5]<<16)| ((uint64_t)p->hq[6]<<8)|((uint64_t)p->hq[7])); cvt_64(p, m); return 1; case FILE_LESHORT: p->h = (short)((p->hs[1]<<8)|(p->hs[0])); cvt_16(p, m); return 1; case FILE_LELONG: case FILE_LEDATE: case FILE_LELDATE: p->l = (int32_t) ((p->hl[3]<<24)|(p->hl[2]<<16)|(p->hl[1]<<8)|(p->hl[0])); cvt_32(p, m); return 1; case FILE_LEQUAD: case FILE_LEQDATE: case FILE_LEQLDATE: case FILE_LEQWDATE: p->q = (uint64_t) (((uint64_t)p->hq[7]<<56)|((uint64_t)p->hq[6]<<48)| ((uint64_t)p->hq[5]<<40)|((uint64_t)p->hq[4]<<32)| ((uint64_t)p->hq[3]<<24)|((uint64_t)p->hq[2]<<16)| ((uint64_t)p->hq[1]<<8)|((uint64_t)p->hq[0])); cvt_64(p, m); return 1; case FILE_MELONG: case FILE_MEDATE: case FILE_MELDATE: p->l = (int32_t) ((p->hl[1]<<24)|(p->hl[0]<<16)|(p->hl[3]<<8)|(p->hl[2])); cvt_32(p, m); return 1; case FILE_FLOAT: cvt_float(p, m); return 1; case FILE_BEFLOAT: p->l = ((uint32_t)p->hl[0]<<24)|((uint32_t)p->hl[1]<<16)| ((uint32_t)p->hl[2]<<8) |((uint32_t)p->hl[3]); cvt_float(p, m); return 1; case FILE_LEFLOAT: p->l = ((uint32_t)p->hl[3]<<24)|((uint32_t)p->hl[2]<<16)| ((uint32_t)p->hl[1]<<8) |((uint32_t)p->hl[0]); cvt_float(p, m); return 1; case FILE_DOUBLE: cvt_double(p, m); return 1; case FILE_BEDOUBLE: p->q = ((uint64_t)p->hq[0]<<56)|((uint64_t)p->hq[1]<<48)| ((uint64_t)p->hq[2]<<40)|((uint64_t)p->hq[3]<<32)| ((uint64_t)p->hq[4]<<24)|((uint64_t)p->hq[5]<<16)| ((uint64_t)p->hq[6]<<8) |((uint64_t)p->hq[7]); cvt_double(p, m); return 1; case FILE_LEDOUBLE: p->q = ((uint64_t)p->hq[7]<<56)|((uint64_t)p->hq[6]<<48)| ((uint64_t)p->hq[5]<<40)|((uint64_t)p->hq[4]<<32)| ((uint64_t)p->hq[3]<<24)|((uint64_t)p->hq[2]<<16)| ((uint64_t)p->hq[1]<<8) |((uint64_t)p->hq[0]); cvt_double(p, m); return 1; case FILE_REGEX: case FILE_SEARCH: case FILE_DEFAULT: case FILE_NAME: case FILE_USE: return 1; default: file_magerror(ms, "invalid type %d in mconvert()", m->type); return 0; } }
3,147
29,183
0
static int nfs4_opendata_access(struct rpc_cred *cred, struct nfs4_opendata *opendata, struct nfs4_state *state, fmode_t fmode) { struct nfs_access_entry cache; u32 mask; /* access call failed or for some reason the server doesn't * support any access modes -- defer access call until later */ if (opendata->o_res.access_supported == 0) return 0; mask = 0; /* don't check MAY_WRITE - a newly created file may not have * write mode bits, but POSIX allows the creating process to write */ if (fmode & FMODE_READ) mask |= MAY_READ; if (fmode & FMODE_EXEC) mask |= MAY_EXEC; cache.cred = cred; cache.jiffies = jiffies; nfs_access_set_mask(&cache, opendata->o_res.access_result); nfs_access_add_cache(state->inode, &cache); if ((mask & ~cache.mask & (MAY_READ | MAY_EXEC)) == 0) return 0; /* even though OPEN succeeded, access is denied. Close the file */ nfs4_close_state(state, fmode); return -EACCES; }
3,148
185,693
1
void AddSimpleRectChunk(TestPaintArtifact& artifact) { artifact .Chunk(TransformPaintPropertyNode::Root(), ClipPaintPropertyNode::Root(), EffectPaintPropertyNode::Root()) .RectDrawing(FloatRect(100, 100, 200, 100), Color::kBlack); }
3,149
42,247
0
static int vq_log_access_ok(struct vhost_virtqueue *vq, void __user *log_base) { size_t s = vhost_has_feature(vq, VIRTIO_RING_F_EVENT_IDX) ? 2 : 0; return vq_memory_access_ok(log_base, vq->memory, vhost_has_feature(vq, VHOST_F_LOG_ALL)) && (!vq->log_used || log_access_ok(log_base, vq->log_addr, sizeof *vq->used + vq->num * sizeof *vq->used->ring + s)); }
3,150
181,521
1
static void llc_sap_rcv(struct llc_sap *sap, struct sk_buff *skb, struct sock *sk) { struct llc_sap_state_ev *ev = llc_sap_ev(skb); ev->type = LLC_SAP_EV_TYPE_PDU; ev->reason = 0; skb->sk = sk; llc_sap_state_process(sap, skb); }
3,151
60,031
0
static void fill_symbol_bind_and_type (struct r_bin_elf_symbol_t *ret, Elf_(Sym) *sym) { #define s_bind(x) ret->bind = x #define s_type(x) ret->type = x switch (ELF_ST_BIND(sym->st_info)) { case STB_LOCAL: s_bind ("LOCAL"); break; case STB_GLOBAL: s_bind ("GLOBAL"); break; case STB_WEAK: s_bind ("WEAK"); break; case STB_NUM: s_bind ("NUM"); break; case STB_LOOS: s_bind ("LOOS"); break; case STB_HIOS: s_bind ("HIOS"); break; case STB_LOPROC: s_bind ("LOPROC"); break; case STB_HIPROC: s_bind ("HIPROC"); break; default: s_bind ("UNKNOWN"); } switch (ELF_ST_TYPE (sym->st_info)) { case STT_NOTYPE: s_type ("NOTYPE"); break; case STT_OBJECT: s_type ("OBJECT"); break; case STT_FUNC: s_type ("FUNC"); break; case STT_SECTION: s_type ("SECTION"); break; case STT_FILE: s_type ("FILE"); break; case STT_COMMON: s_type ("COMMON"); break; case STT_TLS: s_type ("TLS"); break; case STT_NUM: s_type ("NUM"); break; case STT_LOOS: s_type ("LOOS"); break; case STT_HIOS: s_type ("HIOS"); break; case STT_LOPROC: s_type ("LOPROC"); break; case STT_HIPROC: s_type ("HIPROC"); break; default: s_type ("UNKNOWN"); } }
3,152
21,058
0
static int mem_cgroup_force_empty(struct mem_cgroup *memcg, bool free_all) { int ret; int node, zid, shrink; int nr_retries = MEM_CGROUP_RECLAIM_RETRIES; struct cgroup *cgrp = memcg->css.cgroup; css_get(&memcg->css); shrink = 0; /* should free all ? */ if (free_all) goto try_to_free; move_account: do { ret = -EBUSY; if (cgroup_task_count(cgrp) || !list_empty(&cgrp->children)) goto out; ret = -EINTR; if (signal_pending(current)) goto out; /* This is for making all *used* pages to be on LRU. */ lru_add_drain_all(); drain_all_stock_sync(memcg); ret = 0; mem_cgroup_start_move(memcg); for_each_node_state(node, N_HIGH_MEMORY) { for (zid = 0; !ret && zid < MAX_NR_ZONES; zid++) { enum lru_list l; for_each_lru(l) { ret = mem_cgroup_force_empty_list(memcg, node, zid, l); if (ret) break; } } if (ret) break; } mem_cgroup_end_move(memcg); memcg_oom_recover(memcg); /* it seems parent cgroup doesn't have enough mem */ if (ret == -ENOMEM) goto try_to_free; cond_resched(); /* "ret" should also be checked to ensure all lists are empty. */ } while (memcg->res.usage > 0 || ret); out: css_put(&memcg->css); return ret; try_to_free: /* returns EBUSY if there is a task or if we come here twice. */ if (cgroup_task_count(cgrp) || !list_empty(&cgrp->children) || shrink) { ret = -EBUSY; goto out; } /* we call try-to-free pages for make this cgroup empty */ lru_add_drain_all(); /* try to free all pages in this cgroup */ shrink = 1; while (nr_retries && memcg->res.usage > 0) { int progress; if (signal_pending(current)) { ret = -EINTR; goto out; } progress = try_to_free_mem_cgroup_pages(memcg, GFP_KERNEL, false); if (!progress) { nr_retries--; /* maybe some writeback is necessary */ congestion_wait(BLK_RW_ASYNC, HZ/10); } } lru_add_drain(); /* try move_account...there may be some *locked* pages. */ goto move_account; }
3,153
145,698
0
void ImageInputType::srcAttributeChanged() { if (!element().layoutObject()) return; element().ensureImageLoader().updateFromElement(ImageLoader::UpdateIgnorePreviousError); }
3,154
49,985
0
static inline long object_common1(UNSERIALIZE_PARAMETER, zend_class_entry *ce) { long elements; elements = parse_iv2((*p) + 2, p); (*p) += 2; if (ce->serialize == NULL) { object_init_ex(*rval, ce); } else { /* If this class implements Serializable, it should not land here but in object_custom(). The passed string obviously doesn't descend from the regular serializer. */ zend_error(E_WARNING, "Erroneous data format for unserializing '%s'", ce->name); return 0; } return elements; }
3,155
9,005
0
vmxnet3_inc_rx_consumption_counter(VMXNET3State *s, int qidx, int ridx) { vmxnet3_ring_inc(&s->rxq_descr[qidx].rx_ring[ridx]); }
3,156
177,136
0
OMX_ERRORTYPE SoftAVC::setDimensions() { ive_ctl_set_dimensions_ip_t s_dimensions_ip; ive_ctl_set_dimensions_op_t s_dimensions_op; IV_STATUS_T status; s_dimensions_ip.e_cmd = IVE_CMD_VIDEO_CTL; s_dimensions_ip.e_sub_cmd = IVE_CMD_CTL_SET_DIMENSIONS; s_dimensions_ip.u4_ht = mHeight; s_dimensions_ip.u4_wd = mWidth; s_dimensions_ip.u4_timestamp_high = -1; s_dimensions_ip.u4_timestamp_low = -1; s_dimensions_ip.u4_size = sizeof(ive_ctl_set_dimensions_ip_t); s_dimensions_op.u4_size = sizeof(ive_ctl_set_dimensions_op_t); status = ive_api_function(mCodecCtx, &s_dimensions_ip, &s_dimensions_op); if (status != IV_SUCCESS) { ALOGE("Unable to set frame dimensions = 0x%x\n", s_dimensions_op.u4_error_code); return OMX_ErrorUndefined; } return OMX_ErrorNone; }
3,157
184,001
1
void RegisterProperties(IBusPropList* ibus_prop_list) { DLOG(INFO) << "RegisterProperties" << (ibus_prop_list ? "" : " (clear)"); ImePropertyList prop_list; // our representation. if (ibus_prop_list) { // You can call // LOG(INFO) << "\n" << PrintPropList(ibus_prop_list, 0); // here to dump |ibus_prop_list|. if (!FlattenPropertyList(ibus_prop_list, &prop_list)) { // Clear properties on errors. RegisterProperties(NULL); return; } } // Notify the change. register_ime_properties_(language_library_, prop_list); }
3,158
50,287
0
static int send_udp(struct mt_packet *packet, int retransmit) { int sent_bytes; /* Clear keepalive counter */ keepalive_counter = 0; if (!use_raw_socket) { /* Init SendTo struct */ struct sockaddr_in socket_address; socket_address.sin_family = AF_INET; socket_address.sin_port = htons(MT_MACTELNET_PORT); socket_address.sin_addr.s_addr = htonl(INADDR_BROADCAST); sent_bytes = sendto(send_socket, packet->data, packet->size, 0, (struct sockaddr*)&socket_address, sizeof(socket_address)); } else { sent_bytes = net_send_udp(sockfd, active_interface, srcmac, dstmac, &sourceip, sourceport, &destip, MT_MACTELNET_PORT, packet->data, packet->size); } /* * Retransmit packet if no data is received within * retransmit_intervals milliseconds. */ if (retransmit) { int i; for (i = 0; i < MAX_RETRANSMIT_INTERVALS; ++i) { fd_set read_fds; int reads; struct timeval timeout; int interval = retransmit_intervals[i] * 1000; /* Init select */ FD_ZERO(&read_fds); FD_SET(insockfd, &read_fds); timeout.tv_sec = 0; timeout.tv_usec = interval; /* Wait for data or timeout */ reads = select(insockfd + 1, &read_fds, NULL, NULL, &timeout); if (reads && FD_ISSET(insockfd, &read_fds)) { unsigned char buff[MT_PACKET_LEN]; int result; bzero(buff, sizeof(buff)); result = recvfrom(insockfd, buff, sizeof(buff), 0, 0, 0); /* Handle incoming packets, waiting for an ack */ if (result > 0 && handle_packet(buff, result) == MT_PTYPE_ACK) { return sent_bytes; } } /* Retransmit */ send_udp(packet, 0); } if (is_a_tty && terminal_mode) { reset_term(); } fprintf(stderr, _("\nConnection timed out\n")); exit(1); } return sent_bytes; }
3,159
53,113
0
static __printf(1, 2) void verbose(const char *fmt, ...) { va_list args; if (log_level == 0 || log_len >= log_size - 1) return; va_start(args, fmt); log_len += vscnprintf(log_buf + log_len, log_size - log_len, fmt, args); va_end(args); }
3,160
71,741
0
static void SVGUnparsedEntityDeclaration(void *context,const xmlChar *name, const xmlChar *public_id,const xmlChar *system_id,const xmlChar *notation) { SVGInfo *svg_info; /* What to do when an unparsed entity declaration is parsed. */ (void) LogMagickEvent(CoderEvent,GetMagickModule(), " SAX.unparsedEntityDecl(%s, %s, %s, %s)",name, public_id != (xmlChar *) NULL ? (const char *) public_id : "none", system_id != (xmlChar *) NULL ? (const char *) system_id : "none",notation); svg_info=(SVGInfo *) context; (void) xmlAddDocEntity(svg_info->document,name, XML_EXTERNAL_GENERAL_UNPARSED_ENTITY,public_id,system_id,notation); }
3,161
165,253
0
FakeVoiceInteractionController* voice_interaction_controller() { return voice_interaction_controller_.get(); }
3,162
39,930
0
static void skb_ts_finish(struct ts_config *conf, struct ts_state *state) { skb_abort_seq_read(TS_SKB_CB(state)); }
3,163
30,538
0
static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen) { struct sockaddr_llc *addr = (struct sockaddr_llc *)uaddr; struct sock *sk = sock->sk; struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap; int rc = -EINVAL; dprintk("%s: binding %02X\n", __func__, addr->sllc_sap); if (unlikely(!sock_flag(sk, SOCK_ZAPPED) || addrlen != sizeof(*addr))) goto out; rc = -EAFNOSUPPORT; if (unlikely(addr->sllc_family != AF_LLC)) goto out; rc = -ENODEV; rcu_read_lock(); if (sk->sk_bound_dev_if) { llc->dev = dev_get_by_index_rcu(&init_net, sk->sk_bound_dev_if); if (llc->dev) { if (!addr->sllc_arphrd) addr->sllc_arphrd = llc->dev->type; if (llc_mac_null(addr->sllc_mac)) memcpy(addr->sllc_mac, llc->dev->dev_addr, IFHWADDRLEN); if (addr->sllc_arphrd != llc->dev->type || !llc_mac_match(addr->sllc_mac, llc->dev->dev_addr)) { rc = -EINVAL; llc->dev = NULL; } } } else llc->dev = dev_getbyhwaddr_rcu(&init_net, addr->sllc_arphrd, addr->sllc_mac); if (llc->dev) dev_hold(llc->dev); rcu_read_unlock(); if (!llc->dev) goto out; if (!addr->sllc_sap) { rc = -EUSERS; addr->sllc_sap = llc_ui_autoport(); if (!addr->sllc_sap) goto out; } sap = llc_sap_find(addr->sllc_sap); if (!sap) { sap = llc_sap_open(addr->sllc_sap, NULL); rc = -EBUSY; /* some other network layer is using the sap */ if (!sap) goto out; } else { struct llc_addr laddr, daddr; struct sock *ask; memset(&laddr, 0, sizeof(laddr)); memset(&daddr, 0, sizeof(daddr)); /* * FIXME: check if the address is multicast, * only SOCK_DGRAM can do this. */ memcpy(laddr.mac, addr->sllc_mac, IFHWADDRLEN); laddr.lsap = addr->sllc_sap; rc = -EADDRINUSE; /* mac + sap clash. */ ask = llc_lookup_established(sap, &daddr, &laddr); if (ask) { sock_put(ask); goto out_put; } } llc->laddr.lsap = addr->sllc_sap; memcpy(llc->laddr.mac, addr->sllc_mac, IFHWADDRLEN); memcpy(&llc->addr, addr, sizeof(llc->addr)); /* assign new connection to its SAP */ llc_sap_add_socket(sap, sk); sock_reset_flag(sk, SOCK_ZAPPED); rc = 0; out_put: llc_sap_put(sap); out: return rc; }
3,164
155,968
0
void DiceTurnSyncOnHelper::FinishSyncSetupAndDelete( LoginUIService::SyncConfirmationUIClosedResult result) { switch (result) { case LoginUIService::CONFIGURE_SYNC_FIRST: EnableUnifiedConsentIfNeeded(); delegate_->ShowSyncSettings(); break; case LoginUIService::SYNC_WITH_DEFAULT_SETTINGS: { browser_sync::ProfileSyncService* sync_service = GetProfileSyncService(); if (sync_service) { sync_service->SetFirstSetupComplete(); EnableUnifiedConsentIfNeeded(); } break; } case LoginUIService::ABORT_SIGNIN: signin_manager_->SignOutAndKeepAllAccounts( signin_metrics::ABORT_SIGNIN, signin_metrics::SignoutDelete::IGNORE_METRIC); AbortAndDelete(); return; } delete this; }
3,165
113,947
0
void RegistrationManager::MarkRegistrationLost( const invalidation::ObjectId& id) { DCHECK(CalledOnValidThread()); RegistrationStatusMap::const_iterator it = registration_statuses_.find(id); if (it == registration_statuses_.end()) { DLOG(WARNING) << "Attempt to mark non-existent registration for " << ObjectIdToString(id) << " as lost"; return; } if (!it->second->enabled) { return; } it->second->state = invalidation::InvalidationListener::UNREGISTERED; bool is_retry = !it->second->last_registration_request.is_null(); TryRegisterId(id, is_retry); }
3,166
107,665
0
unsigned int ewk_view_text_matches_mark(Evas_Object* ewkView, const char* string, Eina_Bool caseSensitive, Eina_Bool highlight, unsigned int limit) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); EINA_SAFETY_ON_NULL_RETURN_VAL(string, 0); WTF::TextCaseSensitivity sensitive; if (caseSensitive) sensitive = WTF::TextCaseSensitive; else sensitive = WTF::TextCaseInsensitive; return priv->page->markAllMatchesForText(String::fromUTF8(string), sensitive, highlight, limit); }
3,167
46,744
0
static int cbc_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) { struct camellia_sparc64_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); struct blkcipher_walk walk; cbc_crypt_op *op; const u64 *key; int err; op = camellia_sparc64_cbc_decrypt_3_grand_rounds; if (ctx->key_len != 16) op = camellia_sparc64_cbc_decrypt_4_grand_rounds; blkcipher_walk_init(&walk, dst, src, nbytes); err = blkcipher_walk_virt(desc, &walk); desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; key = &ctx->decrypt_key[0]; camellia_sparc64_load_keys(key, ctx->key_len); while ((nbytes = walk.nbytes)) { unsigned int block_len = nbytes & CAMELLIA_BLOCK_MASK; if (likely(block_len)) { const u64 *src64; u64 *dst64; src64 = (const u64 *)walk.src.virt.addr; dst64 = (u64 *) walk.dst.virt.addr; op(src64, dst64, block_len, key, (u64 *) walk.iv); } nbytes &= CAMELLIA_BLOCK_SIZE - 1; err = blkcipher_walk_done(desc, &walk, nbytes); } fprs_write(0); return err; }
3,168
125,436
0
void GDataFileSystem::RemoveEntryFromDirectoryOnFileSystem( const FileMoveCallback& callback, const FilePath& file_path, const FilePath& dir_path, GDataErrorCode status, const GURL& document_url) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); const GDataFileError error = util::GDataToGDataFileError(status); if (error != GDATA_FILE_OK) { if (!callback.is_null()) callback.Run(error, FilePath()); return; } GDataEntry* entry = directory_service_->FindEntryByPathSync(file_path); if (!entry) { if (!callback.is_null()) callback.Run(GDATA_FILE_ERROR_NOT_FOUND, FilePath()); return; } directory_service_->MoveEntryToDirectory( directory_service_->root()->GetFilePath(), entry, base::Bind(&GDataFileSystem::OnMoveEntryToDirectoryWithFileMoveCallback, ui_weak_ptr_, callback)); }
3,169
5,457
0
static void Ins_SPVTCA( INS_ARG ) { Short A, B; (void)args; if ( CUR.opcode & 1 ) A = 0x4000; else A = 0; B = A ^ 0x4000; CUR.GS.projVector.x = A; CUR.GS.dualVector.x = A; CUR.GS.projVector.y = B; CUR.GS.dualVector.y = B; COMPUTE_Funcs(); }
3,170
186,044
1
void ShelfWidget::DelegateView::UpdateOpaqueBackground() { const gfx::Rect local_bounds = GetLocalBounds(); gfx::Rect opaque_background_bounds = local_bounds; const Shelf* shelf = shelf_widget_->shelf(); const ShelfBackgroundType background_type = shelf_widget_->GetBackgroundType(); // If the app list is showing in clamshell mode, we should hide the shelf. // otherwise, we should show it again. This creates a 'blending' effect // between the two if (background_type == SHELF_BACKGROUND_APP_LIST) { opaque_background_.SetVisible(false); UpdateBackgroundBlur(); return; } if (!opaque_background_.visible()) opaque_background_.SetVisible(true); // Extend the opaque layer a little bit to handle "overshoot" gestures // gracefully (the user drags the shelf further than it can actually go). // That way: // 1) When the shelf has rounded corners, only two of them are visible, // 2) Even when the shelf is squared, it doesn't tear off the screen edge // when dragged away. // To achieve this, we extend the layer in the same direction where the shelf // is aligned (downwards for a bottom shelf, etc.). const int radius = kShelfRoundedCornerRadius; const int safety_margin = 3 * radius; opaque_background_bounds.Inset( -shelf->SelectValueForShelfAlignment(0, safety_margin, 0), 0, -shelf->SelectValueForShelfAlignment(0, 0, safety_margin), -shelf->SelectValueForShelfAlignment(safety_margin, 0, 0)); // Show rounded corners except in maximized and split modes. if (background_type == SHELF_BACKGROUND_MAXIMIZED || background_type == SHELF_BACKGROUND_SPLIT_VIEW) { mask_ = nullptr; opaque_background_.SetMaskLayer(nullptr); } else { if (!mask_) { mask_ = views::Painter::CreatePaintedLayer( views::Painter::CreateSolidRoundRectPainter(SK_ColorBLACK, radius)); mask_->layer()->SetFillsBoundsOpaquely(false); opaque_background_.SetMaskLayer(mask_->layer()); } if (mask_->layer()->bounds() != opaque_background_bounds) mask_->layer()->SetBounds(opaque_background_bounds); } opaque_background_.SetBounds(opaque_background_bounds); UpdateBackgroundBlur(); SchedulePaint(); }
3,171
118,526
0
void RenderFrameImpl::initializeChildFrame(const blink::WebRect& frame_rect, float scale_factor) { Send(new FrameHostMsg_InitializeChildFrame( routing_id_, frame_rect, scale_factor)); }
3,172
115,263
0
void OmniboxViewWin::OnRevertTemporaryText() { SetSelectionRange(original_selection_); TextChanged(); }
3,173
136,705
0
bool FrameSelection::Contains(const LayoutPoint& point) { if (!GetDocument().GetLayoutView()) return false; const VisibleSelectionInFlatTree& visible_selection = ComputeVisibleSelectionInFlatTree(); if (!visible_selection.IsRange()) return false; HitTestRequest request(HitTestRequest::kReadOnly | HitTestRequest::kActive); HitTestResult result(request, point); GetDocument().GetLayoutView()->HitTest(result); Node* inner_node = result.InnerNode(); if (!inner_node || !inner_node->GetLayoutObject()) return false; const VisiblePositionInFlatTree& visible_pos = CreateVisiblePosition(FromPositionInDOMTree<EditingInFlatTreeStrategy>( inner_node->GetLayoutObject()->PositionForPoint( result.LocalPoint()))); if (visible_pos.IsNull()) return false; const VisiblePositionInFlatTree& visible_start = visible_selection.VisibleStart(); const VisiblePositionInFlatTree& visible_end = visible_selection.VisibleEnd(); if (visible_start.IsNull() || visible_end.IsNull()) return false; const PositionInFlatTree& start = visible_start.DeepEquivalent(); const PositionInFlatTree& end = visible_end.DeepEquivalent(); const PositionInFlatTree& pos = visible_pos.DeepEquivalent(); return start.CompareTo(pos) <= 0 && pos.CompareTo(end) <= 0; }
3,174
6,386
0
set_rx_control(E1000State *s, int index, uint32_t val) { s->mac_reg[RCTL] = val; s->rxbuf_size = rxbufsize(val); s->rxbuf_min_shift = ((val / E1000_RCTL_RDMTS_QUAT) & 3) + 1; DBGOUT(RX, "RCTL: %d, mac_reg[RCTL] = 0x%x\n", s->mac_reg[RDT], s->mac_reg[RCTL]); qemu_flush_queued_packets(&s->nic->nc); }
3,175
181,608
1
static int asymmetric_key_match(const struct key *key, const struct key_match_data *match_data) { const struct asymmetric_key_subtype *subtype = asymmetric_key_subtype(key); const char *description = match_data->raw_data; const char *spec = description; const char *id; ptrdiff_t speclen; if (!subtype || !spec || !*spec) return 0; /* See if the full key description matches as is */ if (key->description && strcmp(key->description, description) == 0) return 1; /* All tests from here on break the criterion description into a * specifier, a colon and then an identifier. */ id = strchr(spec, ':'); if (!id) return 0; speclen = id - spec; id++; if (speclen == 2 && memcmp(spec, "id", 2) == 0) return asymmetric_keyid_match(asymmetric_key_id(key), id); if (speclen == subtype->name_len && memcmp(spec, subtype->name, speclen) == 0) return 1; return 0; }
3,176
82,432
0
long long jsvGetLongIntegerAndUnLock(JsVar *v) { long long i = jsvGetLongInteger(v); jsvUnLock(v); return i; }
3,177
135,324
0
void Document::pluginLoadingTimerFired(Timer<Document>*) { updateLayout(); }
3,178
156,005
0
void UnlockProfileAndHideLoginUI(const base::FilePath profile_path, InlineLoginHandlerImpl* handler) { if (!profile_path.empty()) { ProfileManager* profile_manager = g_browser_process->profile_manager(); if (profile_manager) { ProfileAttributesEntry* entry; if (profile_manager->GetProfileAttributesStorage() .GetProfileAttributesWithPath(profile_path, &entry)) { entry->SetIsSigninRequired(false); } } } if (handler) handler->CloseDialogFromJavascript(); UserManager::Hide(); }
3,179
142,507
0
ShelfLayoutManager* GetShelfLayoutManager() { return AshTestBase::GetPrimaryShelf()->shelf_layout_manager(); }
3,180
141,732
0
std::unique_ptr<V8StackTraceImpl> V8Debugger::createStackTrace(v8::Local<v8::StackTrace> stackTrace) { int contextGroupId = m_isolate->InContext() ? getGroupId(m_isolate->GetCurrentContext()) : 0; return V8StackTraceImpl::create(this, contextGroupId, stackTrace, V8StackTraceImpl::maxCallStackSizeToCapture); }
3,181
43,559
0
static int sctp_sendmsg(struct sock *sk, struct msghdr *msg, size_t msg_len) { struct net *net = sock_net(sk); struct sctp_sock *sp; struct sctp_endpoint *ep; struct sctp_association *new_asoc = NULL, *asoc = NULL; struct sctp_transport *transport, *chunk_tp; struct sctp_chunk *chunk; union sctp_addr to; struct sockaddr *msg_name = NULL; struct sctp_sndrcvinfo default_sinfo; struct sctp_sndrcvinfo *sinfo; struct sctp_initmsg *sinit; sctp_assoc_t associd = 0; sctp_cmsgs_t cmsgs = { NULL }; sctp_scope_t scope; bool fill_sinfo_ttl = false, wait_connect = false; struct sctp_datamsg *datamsg; int msg_flags = msg->msg_flags; __u16 sinfo_flags = 0; long timeo; int err; err = 0; sp = sctp_sk(sk); ep = sp->ep; pr_debug("%s: sk:%p, msg:%p, msg_len:%zu ep:%p\n", __func__, sk, msg, msg_len, ep); /* We cannot send a message over a TCP-style listening socket. */ if (sctp_style(sk, TCP) && sctp_sstate(sk, LISTENING)) { err = -EPIPE; goto out_nounlock; } /* Parse out the SCTP CMSGs. */ err = sctp_msghdr_parse(msg, &cmsgs); if (err) { pr_debug("%s: msghdr parse err:%x\n", __func__, err); goto out_nounlock; } /* Fetch the destination address for this packet. This * address only selects the association--it is not necessarily * the address we will send to. * For a peeled-off socket, msg_name is ignored. */ if (!sctp_style(sk, UDP_HIGH_BANDWIDTH) && msg->msg_name) { int msg_namelen = msg->msg_namelen; err = sctp_verify_addr(sk, (union sctp_addr *)msg->msg_name, msg_namelen); if (err) return err; if (msg_namelen > sizeof(to)) msg_namelen = sizeof(to); memcpy(&to, msg->msg_name, msg_namelen); msg_name = msg->msg_name; } sinit = cmsgs.init; if (cmsgs.sinfo != NULL) { memset(&default_sinfo, 0, sizeof(default_sinfo)); default_sinfo.sinfo_stream = cmsgs.sinfo->snd_sid; default_sinfo.sinfo_flags = cmsgs.sinfo->snd_flags; default_sinfo.sinfo_ppid = cmsgs.sinfo->snd_ppid; default_sinfo.sinfo_context = cmsgs.sinfo->snd_context; default_sinfo.sinfo_assoc_id = cmsgs.sinfo->snd_assoc_id; sinfo = &default_sinfo; fill_sinfo_ttl = true; } else { sinfo = cmsgs.srinfo; } /* Did the user specify SNDINFO/SNDRCVINFO? */ if (sinfo) { sinfo_flags = sinfo->sinfo_flags; associd = sinfo->sinfo_assoc_id; } pr_debug("%s: msg_len:%zu, sinfo_flags:0x%x\n", __func__, msg_len, sinfo_flags); /* SCTP_EOF or SCTP_ABORT cannot be set on a TCP-style socket. */ if (sctp_style(sk, TCP) && (sinfo_flags & (SCTP_EOF | SCTP_ABORT))) { err = -EINVAL; goto out_nounlock; } /* If SCTP_EOF is set, no data can be sent. Disallow sending zero * length messages when SCTP_EOF|SCTP_ABORT is not set. * If SCTP_ABORT is set, the message length could be non zero with * the msg_iov set to the user abort reason. */ if (((sinfo_flags & SCTP_EOF) && (msg_len > 0)) || (!(sinfo_flags & (SCTP_EOF|SCTP_ABORT)) && (msg_len == 0))) { err = -EINVAL; goto out_nounlock; } /* If SCTP_ADDR_OVER is set, there must be an address * specified in msg_name. */ if ((sinfo_flags & SCTP_ADDR_OVER) && (!msg->msg_name)) { err = -EINVAL; goto out_nounlock; } transport = NULL; pr_debug("%s: about to look up association\n", __func__); lock_sock(sk); /* If a msg_name has been specified, assume this is to be used. */ if (msg_name) { /* Look for a matching association on the endpoint. */ asoc = sctp_endpoint_lookup_assoc(ep, &to, &transport); if (!asoc) { /* If we could not find a matching association on the * endpoint, make sure that it is not a TCP-style * socket that already has an association or there is * no peeled-off association on another socket. */ if ((sctp_style(sk, TCP) && sctp_sstate(sk, ESTABLISHED)) || sctp_endpoint_is_peeled_off(ep, &to)) { err = -EADDRNOTAVAIL; goto out_unlock; } } } else { asoc = sctp_id2assoc(sk, associd); if (!asoc) { err = -EPIPE; goto out_unlock; } } if (asoc) { pr_debug("%s: just looked up association:%p\n", __func__, asoc); /* We cannot send a message on a TCP-style SCTP_SS_ESTABLISHED * socket that has an association in CLOSED state. This can * happen when an accepted socket has an association that is * already CLOSED. */ if (sctp_state(asoc, CLOSED) && sctp_style(sk, TCP)) { err = -EPIPE; goto out_unlock; } if (sinfo_flags & SCTP_EOF) { pr_debug("%s: shutting down association:%p\n", __func__, asoc); sctp_primitive_SHUTDOWN(net, asoc, NULL); err = 0; goto out_unlock; } if (sinfo_flags & SCTP_ABORT) { chunk = sctp_make_abort_user(asoc, msg, msg_len); if (!chunk) { err = -ENOMEM; goto out_unlock; } pr_debug("%s: aborting association:%p\n", __func__, asoc); sctp_primitive_ABORT(net, asoc, chunk); err = 0; goto out_unlock; } } /* Do we need to create the association? */ if (!asoc) { pr_debug("%s: there is no association yet\n", __func__); if (sinfo_flags & (SCTP_EOF | SCTP_ABORT)) { err = -EINVAL; goto out_unlock; } /* Check for invalid stream against the stream counts, * either the default or the user specified stream counts. */ if (sinfo) { if (!sinit || !sinit->sinit_num_ostreams) { /* Check against the defaults. */ if (sinfo->sinfo_stream >= sp->initmsg.sinit_num_ostreams) { err = -EINVAL; goto out_unlock; } } else { /* Check against the requested. */ if (sinfo->sinfo_stream >= sinit->sinit_num_ostreams) { err = -EINVAL; goto out_unlock; } } } /* * API 3.1.2 bind() - UDP Style Syntax * If a bind() or sctp_bindx() is not called prior to a * sendmsg() call that initiates a new association, the * system picks an ephemeral port and will choose an address * set equivalent to binding with a wildcard address. */ if (!ep->base.bind_addr.port) { if (sctp_autobind(sk)) { err = -EAGAIN; goto out_unlock; } } else { /* * If an unprivileged user inherits a one-to-many * style socket with open associations on a privileged * port, it MAY be permitted to accept new associations, * but it SHOULD NOT be permitted to open new * associations. */ if (ep->base.bind_addr.port < PROT_SOCK && !ns_capable(net->user_ns, CAP_NET_BIND_SERVICE)) { err = -EACCES; goto out_unlock; } } scope = sctp_scope(&to); new_asoc = sctp_association_new(ep, sk, scope, GFP_KERNEL); if (!new_asoc) { err = -ENOMEM; goto out_unlock; } asoc = new_asoc; err = sctp_assoc_set_bind_addr_from_ep(asoc, scope, GFP_KERNEL); if (err < 0) { err = -ENOMEM; goto out_free; } /* If the SCTP_INIT ancillary data is specified, set all * the association init values accordingly. */ if (sinit) { if (sinit->sinit_num_ostreams) { asoc->c.sinit_num_ostreams = sinit->sinit_num_ostreams; } if (sinit->sinit_max_instreams) { asoc->c.sinit_max_instreams = sinit->sinit_max_instreams; } if (sinit->sinit_max_attempts) { asoc->max_init_attempts = sinit->sinit_max_attempts; } if (sinit->sinit_max_init_timeo) { asoc->max_init_timeo = msecs_to_jiffies(sinit->sinit_max_init_timeo); } } /* Prime the peer's transport structures. */ transport = sctp_assoc_add_peer(asoc, &to, GFP_KERNEL, SCTP_UNKNOWN); if (!transport) { err = -ENOMEM; goto out_free; } } /* ASSERT: we have a valid association at this point. */ pr_debug("%s: we have a valid association\n", __func__); if (!sinfo) { /* If the user didn't specify SNDINFO/SNDRCVINFO, make up * one with some defaults. */ memset(&default_sinfo, 0, sizeof(default_sinfo)); default_sinfo.sinfo_stream = asoc->default_stream; default_sinfo.sinfo_flags = asoc->default_flags; default_sinfo.sinfo_ppid = asoc->default_ppid; default_sinfo.sinfo_context = asoc->default_context; default_sinfo.sinfo_timetolive = asoc->default_timetolive; default_sinfo.sinfo_assoc_id = sctp_assoc2id(asoc); sinfo = &default_sinfo; } else if (fill_sinfo_ttl) { /* In case SNDINFO was specified, we still need to fill * it with a default ttl from the assoc here. */ sinfo->sinfo_timetolive = asoc->default_timetolive; } /* API 7.1.7, the sndbuf size per association bounds the * maximum size of data that can be sent in a single send call. */ if (msg_len > sk->sk_sndbuf) { err = -EMSGSIZE; goto out_free; } if (asoc->pmtu_pending) sctp_assoc_pending_pmtu(sk, asoc); /* If fragmentation is disabled and the message length exceeds the * association fragmentation point, return EMSGSIZE. The I-D * does not specify what this error is, but this looks like * a great fit. */ if (sctp_sk(sk)->disable_fragments && (msg_len > asoc->frag_point)) { err = -EMSGSIZE; goto out_free; } /* Check for invalid stream. */ if (sinfo->sinfo_stream >= asoc->c.sinit_num_ostreams) { err = -EINVAL; goto out_free; } timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT); if (!sctp_wspace(asoc)) { err = sctp_wait_for_sndbuf(asoc, &timeo, msg_len); if (err) goto out_free; } /* If an address is passed with the sendto/sendmsg call, it is used * to override the primary destination address in the TCP model, or * when SCTP_ADDR_OVER flag is set in the UDP model. */ if ((sctp_style(sk, TCP) && msg_name) || (sinfo_flags & SCTP_ADDR_OVER)) { chunk_tp = sctp_assoc_lookup_paddr(asoc, &to); if (!chunk_tp) { err = -EINVAL; goto out_free; } } else chunk_tp = NULL; /* Auto-connect, if we aren't connected already. */ if (sctp_state(asoc, CLOSED)) { err = sctp_primitive_ASSOCIATE(net, asoc, NULL); if (err < 0) goto out_free; wait_connect = true; pr_debug("%s: we associated primitively\n", __func__); } /* Break the message into multiple chunks of maximum size. */ datamsg = sctp_datamsg_from_user(asoc, sinfo, &msg->msg_iter); if (IS_ERR(datamsg)) { err = PTR_ERR(datamsg); goto out_free; } /* Now send the (possibly) fragmented message. */ list_for_each_entry(chunk, &datamsg->chunks, frag_list) { sctp_chunk_hold(chunk); /* Do accounting for the write space. */ sctp_set_owner_w(chunk); chunk->transport = chunk_tp; } /* Send it to the lower layers. Note: all chunks * must either fail or succeed. The lower layer * works that way today. Keep it that way or this * breaks. */ err = sctp_primitive_SEND(net, asoc, datamsg); /* Did the lower layer accept the chunk? */ if (err) { sctp_datamsg_free(datamsg); goto out_free; } pr_debug("%s: we sent primitively\n", __func__); sctp_datamsg_put(datamsg); err = msg_len; if (unlikely(wait_connect)) { timeo = sock_sndtimeo(sk, msg_flags & MSG_DONTWAIT); sctp_wait_for_connect(asoc, &timeo); } /* If we are already past ASSOCIATE, the lower * layers are responsible for association cleanup. */ goto out_unlock; out_free: if (new_asoc) { sctp_unhash_established(asoc); sctp_association_free(asoc); } out_unlock: release_sock(sk); out_nounlock: return sctp_error(sk, msg_flags, err); #if 0 do_sock_err: if (msg_len) err = msg_len; else err = sock_error(sk); goto out; do_interrupted: if (msg_len) err = msg_len; goto out; #endif /* 0 */ }
3,182
89,823
0
static int parseSADSCP(const uint8_t *buf, pcp_info_t *pcp_msg_info) { pcp_msg_info->delay_tolerance = (buf[12]>>6)&3; pcp_msg_info->loss_tolerance = (buf[12]>>4)&3; pcp_msg_info->jitter_tolerance = (buf[12]>>2)&3; if (pcp_msg_info->delay_tolerance == 3 || pcp_msg_info->loss_tolerance == 3 || pcp_msg_info->jitter_tolerance == 3 ) { pcp_msg_info->result_code = PCP_ERR_MALFORMED_REQUEST; return 1; } pcp_msg_info->app_name = (const char *)(buf + 14); pcp_msg_info->app_name_len = buf[13]; return 0; }
3,183
147,678
0
void V8TestObject::PartiallyRuntimeEnabledOverloadedVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_partiallyRuntimeEnabledOverloadedVoidMethod"); test_object_v8_internal::PartiallyRuntimeEnabledOverloadedVoidMethodMethod(info); }
3,184
73,708
0
static void sasl_timeout_callback(struct Event* ev) { struct Client *cptr; assert(0 != ev_timer(ev)); assert(0 != t_data(ev_timer(ev))); if (ev_type(ev) == ET_EXPIRE) { cptr = (struct Client*) t_data(ev_timer(ev)); abort_sasl(cptr, 1); } }
3,185
163,847
0
void ExtensionBrowserTest::NavigateInRenderer(content::WebContents* contents, const GURL& url) { content::WaitForLoadStop(contents); bool result = false; content::WindowedNotificationObserver windowed_observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); ASSERT_TRUE(content::ExecuteScriptAndExtractBool( contents, "window.addEventListener('unload', function() {" " window.domAutomationController.send(true);" "}, false);" "window.location = '" + url.spec() + "';", &result)); ASSERT_TRUE(result); windowed_observer.Wait(); EXPECT_EQ(url, contents->GetController().GetLastCommittedEntry()->GetURL()); }
3,186
122,729
0
UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( const Extension* extension, const PermissionSet* permissions, Reason reason) : reason(reason), extension(extension), permissions(permissions) {}
3,187
147,833
0
void V8TestObject::SetterCallWithExecutionContextStringAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_setterCallWithExecutionContextStringAttribute_Getter"); test_object_v8_internal::SetterCallWithExecutionContextStringAttributeAttributeGetter(info); }
3,188
66,438
0
irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick, const char *arguments, char *message) { char *dcc_args, *pos, *pos_file, *pos_addr, *pos_port, *pos_size; char *pos_start_resume, *filename; struct t_infolist *infolist; struct t_infolist_item *item; char charset_modifier[256]; if (!arguments || !arguments[0]) return; if (strncmp (arguments, "SEND ", 5) == 0) { arguments += 5; while (arguments[0] == ' ') { arguments++; } dcc_args = strdup (arguments); if (!dcc_args) { weechat_printf ( server->buffer, _("%s%s: not enough memory for \"%s\" command"), weechat_prefix ("error"), IRC_PLUGIN_NAME, "privmsg"); return; } /* DCC filename */ pos_file = dcc_args; while (pos_file[0] == ' ') { pos_file++; } /* look for file size */ pos_size = strrchr (pos_file, ' '); if (!pos_size) { weechat_printf ( server->buffer, _("%s%s: cannot parse \"%s\" command"), weechat_prefix ("error"), IRC_PLUGIN_NAME, "privmsg"); free (dcc_args); return; } pos = pos_size; pos_size++; while (pos[0] == ' ') { pos--; } pos[1] = '\0'; /* look for DCC port */ pos_port = strrchr (pos_file, ' '); if (!pos_port) { weechat_printf ( server->buffer, _("%s%s: cannot parse \"%s\" command"), weechat_prefix ("error"), IRC_PLUGIN_NAME, "privmsg"); free (dcc_args); return; } pos = pos_port; pos_port++; while (pos[0] == ' ') { pos--; } pos[1] = '\0'; /* look for DCC IP address */ pos_addr = strrchr (pos_file, ' '); if (!pos_addr) { weechat_printf ( server->buffer, _("%s%s: cannot parse \"%s\" command"), weechat_prefix ("error"), IRC_PLUGIN_NAME, "privmsg"); free (dcc_args); return; } pos = pos_addr; pos_addr++; while (pos[0] == ' ') { pos--; } pos[1] = '\0'; /* remove double quotes around filename */ filename = irc_ctcp_dcc_filename_without_quotes (pos_file); /* add DCC file via xfer plugin */ infolist = weechat_infolist_new (); if (infolist) { item = weechat_infolist_new_item (infolist); if (item) { weechat_infolist_new_var_string (item, "plugin_name", weechat_plugin->name); weechat_infolist_new_var_string (item, "plugin_id", server->name); weechat_infolist_new_var_string (item, "type_string", "file_recv"); weechat_infolist_new_var_string (item, "protocol_string", "dcc"); weechat_infolist_new_var_string (item, "remote_nick", nick); weechat_infolist_new_var_string (item, "local_nick", server->nick); weechat_infolist_new_var_string (item, "filename", (filename) ? filename : pos_file); weechat_infolist_new_var_string (item, "size", pos_size); weechat_infolist_new_var_string (item, "proxy", IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_PROXY)); weechat_infolist_new_var_string (item, "remote_address", pos_addr); weechat_infolist_new_var_integer (item, "port", atoi (pos_port)); (void) weechat_hook_signal_send ("xfer_add", WEECHAT_HOOK_SIGNAL_POINTER, infolist); } weechat_infolist_free (infolist); } (void) weechat_hook_signal_send ("irc_dcc", WEECHAT_HOOK_SIGNAL_STRING, message); if (filename) free (filename); free (dcc_args); } else if (strncmp (arguments, "RESUME ", 7) == 0) { arguments += 7; while (arguments[0] == ' ') { arguments++; } dcc_args = strdup (arguments); if (!dcc_args) { weechat_printf ( server->buffer, _("%s%s: not enough memory for \"%s\" command"), weechat_prefix ("error"), IRC_PLUGIN_NAME, "privmsg"); return; } /* DCC filename */ pos_file = dcc_args; while (pos_file[0] == ' ') { pos_file++; } /* look for resume start position */ pos_start_resume = strrchr (pos_file, ' '); if (!pos_start_resume) { weechat_printf ( server->buffer, _("%s%s: cannot parse \"%s\" command"), weechat_prefix ("error"), IRC_PLUGIN_NAME, "privmsg"); free (dcc_args); return; } pos = pos_start_resume; pos_start_resume++; while (pos[0] == ' ') { pos--; } pos[1] = '\0'; /* look for DCC port */ pos_port = strrchr (pos_file, ' '); if (!pos_port) { weechat_printf ( server->buffer, _("%s%s: cannot parse \"%s\" command"), weechat_prefix ("error"), IRC_PLUGIN_NAME, "privmsg"); free (dcc_args); return; } pos = pos_port; pos_port++; while (pos[0] == ' ') { pos--; } pos[1] = '\0'; /* remove double quotes around filename */ filename = irc_ctcp_dcc_filename_without_quotes (pos_file); /* accept resume via xfer plugin */ infolist = weechat_infolist_new (); if (infolist) { item = weechat_infolist_new_item (infolist); if (item) { weechat_infolist_new_var_string (item, "plugin_name", weechat_plugin->name); weechat_infolist_new_var_string (item, "plugin_id", server->name); weechat_infolist_new_var_string (item, "type_string", "file_recv"); weechat_infolist_new_var_string (item, "filename", (filename) ? filename : pos_file); weechat_infolist_new_var_integer (item, "port", atoi (pos_port)); weechat_infolist_new_var_string (item, "start_resume", pos_start_resume); (void) weechat_hook_signal_send ("xfer_accept_resume", WEECHAT_HOOK_SIGNAL_POINTER, infolist); } weechat_infolist_free (infolist); } (void) weechat_hook_signal_send ("irc_dcc", WEECHAT_HOOK_SIGNAL_STRING, message); if (filename) free (filename); free (dcc_args); } else if (strncmp (arguments, "ACCEPT ", 7) == 0) { arguments += 7; while (arguments[0] == ' ') { arguments++; } dcc_args = strdup (arguments); if (!dcc_args) { weechat_printf ( server->buffer, _("%s%s: not enough memory for \"%s\" command"), weechat_prefix ("error"), IRC_PLUGIN_NAME, "privmsg"); return; } /* DCC filename */ pos_file = dcc_args; while (pos_file[0] == ' ') { pos_file++; } /* look for resume start position */ pos_start_resume = strrchr (pos_file, ' '); if (!pos_start_resume) { weechat_printf ( server->buffer, _("%s%s: cannot parse \"%s\" command"), weechat_prefix ("error"), IRC_PLUGIN_NAME, "privmsg"); free (dcc_args); return; } pos = pos_start_resume; pos_start_resume++; while (pos[0] == ' ') { pos--; } pos[1] = '\0'; /* look for DCC port */ pos_port = strrchr (pos_file, ' '); if (!pos_port) { weechat_printf ( server->buffer, _("%s%s: cannot parse \"%s\" command"), weechat_prefix ("error"), IRC_PLUGIN_NAME, "privmsg"); free (dcc_args); return; } pos = pos_port; pos_port++; while (pos[0] == ' ') { pos--; } pos[1] = '\0'; /* remove double quotes around filename */ filename = irc_ctcp_dcc_filename_without_quotes (pos_file); /* resume file via xfer plugin */ infolist = weechat_infolist_new (); if (infolist) { item = weechat_infolist_new_item (infolist); if (item) { weechat_infolist_new_var_string (item, "plugin_name", weechat_plugin->name); weechat_infolist_new_var_string (item, "plugin_id", server->name); weechat_infolist_new_var_string (item, "type_string", "file_recv"); weechat_infolist_new_var_string (item, "filename", (filename) ? filename : pos_file); weechat_infolist_new_var_integer (item, "port", atoi (pos_port)); weechat_infolist_new_var_string (item, "start_resume", pos_start_resume); (void) weechat_hook_signal_send ("xfer_start_resume", WEECHAT_HOOK_SIGNAL_POINTER, infolist); } weechat_infolist_free (infolist); } (void) weechat_hook_signal_send ("irc_dcc", WEECHAT_HOOK_SIGNAL_STRING, message); if (filename) free (filename); free (dcc_args); } else if (strncmp (arguments, "CHAT ", 5) == 0) { arguments += 5; while (arguments[0] == ' ') { arguments++; } dcc_args = strdup (arguments); if (!dcc_args) { weechat_printf ( server->buffer, _("%s%s: not enough memory for \"%s\" command"), weechat_prefix ("error"), IRC_PLUGIN_NAME, "privmsg"); return; } /* CHAT type */ pos_file = dcc_args; while (pos_file[0] == ' ') { pos_file++; } /* DCC IP address */ pos_addr = strchr (pos_file, ' '); if (!pos_addr) { weechat_printf ( server->buffer, _("%s%s: cannot parse \"%s\" command"), weechat_prefix ("error"), IRC_PLUGIN_NAME, "privmsg"); free (dcc_args); return; } pos_addr[0] = '\0'; pos_addr++; while (pos_addr[0] == ' ') { pos_addr++; } /* look for DCC port */ pos_port = strchr (pos_addr, ' '); if (!pos_port) { weechat_printf ( server->buffer, _("%s%s: cannot parse \"%s\" command"), weechat_prefix ("error"), IRC_PLUGIN_NAME, "privmsg"); free (dcc_args); return; } pos_port[0] = '\0'; pos_port++; while (pos_port[0] == ' ') { pos_port++; } if (weechat_strcasecmp (pos_file, "chat") != 0) { weechat_printf ( server->buffer, _("%s%s: unknown DCC CHAT type received from %s%s%s: \"%s\""), weechat_prefix ("error"), IRC_PLUGIN_NAME, irc_nick_color_for_msg (server, 0, NULL, nick), nick, IRC_COLOR_RESET, pos_file); free (dcc_args); return; } /* add DCC chat via xfer plugin */ infolist = weechat_infolist_new (); if (infolist) { item = weechat_infolist_new_item (infolist); if (item) { weechat_infolist_new_var_string (item, "plugin_name", weechat_plugin->name); weechat_infolist_new_var_string (item, "plugin_id", server->name); weechat_infolist_new_var_string (item, "type_string", "chat_recv"); weechat_infolist_new_var_string (item, "remote_nick", nick); weechat_infolist_new_var_string (item, "local_nick", server->nick); snprintf (charset_modifier, sizeof (charset_modifier), "irc.%s.%s", server->name, nick); weechat_infolist_new_var_string (item, "charset_modifier", charset_modifier); weechat_infolist_new_var_string (item, "proxy", IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_PROXY)); weechat_infolist_new_var_string (item, "remote_address", pos_addr); weechat_infolist_new_var_integer (item, "port", atoi (pos_port)); (void) weechat_hook_signal_send ("xfer_add", WEECHAT_HOOK_SIGNAL_POINTER, infolist); } weechat_infolist_free (infolist); } (void) weechat_hook_signal_send ("irc_dcc", WEECHAT_HOOK_SIGNAL_STRING, message); free (dcc_args); } }
3,189
178,169
1
write_message( RenderState state ) { ADisplay adisplay = (ADisplay)state->display.disp; if ( state->message == NULL ) { FontFace face = &state->faces[state->face_index]; int idx, total; idx = face->index; total = 1; while ( total + state->face_index < state->num_faces && face[total].filepath == face[0].filepath ) total++; total += idx; state->message = state->message0; if ( total > 1 ) sprintf( state->message0, "%s %d/%d @ %5.1fpt", state->filename, idx + 1, total, state->char_size ); else sprintf( state->message0, "%s @ %5.1fpt", state->filename, state->char_size ); } grWriteCellString( adisplay->bitmap, 0, DIM_Y - 10, state->message, adisplay->fore_color ); state->message = NULL; }
3,190
131,305
0
static void cssAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); v8SetReturnValueInt(info, imp->cssAttribute()); }
3,191
174,776
0
void impeg2d_flush_ext_and_user_data(dec_state_t *ps_dec) { UWORD32 u4_start_code; stream_t *ps_stream; ps_stream = &ps_dec->s_bit_stream; u4_start_code = impeg2d_bit_stream_nxt(ps_stream,START_CODE_LEN); while((u4_start_code == EXTENSION_START_CODE || u4_start_code == USER_DATA_START_CODE) && (ps_stream->u4_offset < ps_stream->u4_max_offset)) { impeg2d_bit_stream_flush(ps_stream,START_CODE_LEN); while(impeg2d_bit_stream_nxt(ps_stream,START_CODE_PREFIX_LEN) != START_CODE_PREFIX && (ps_stream->u4_offset < ps_stream->u4_max_offset)) { impeg2d_bit_stream_flush(ps_stream,8); } u4_start_code = impeg2d_bit_stream_nxt(ps_stream,START_CODE_LEN); } }
3,192
59,602
0
memParseTest(const char *filename, const char *result, const char *err ATTRIBUTE_UNUSED, int options ATTRIBUTE_UNUSED) { xmlDocPtr doc; const char *base; int size, res; nb_tests++; /* * load and parse the memory */ if (loadMem(filename, &base, &size) != 0) { fprintf(stderr, "Failed to load %s\n", filename); return(-1); } doc = xmlReadMemory(base, size, filename, NULL, 0); unloadMem(base); if (doc == NULL) { return(1); } xmlDocDumpMemory(doc, (xmlChar **) &base, &size); xmlFreeDoc(doc); res = compareFileMem(result, base, size); if ((base == NULL) || (res != 0)) { if (base != NULL) xmlFree((char *)base); fprintf(stderr, "Result for %s failed in %s\n", filename, result); return(-1); } xmlFree((char *)base); return(0); }
3,193
21,065
0
mem_cgroup_get_local_stat(struct mem_cgroup *memcg, struct mcs_total_stat *s) { s64 val; /* per cpu stat */ val = mem_cgroup_read_stat(memcg, MEM_CGROUP_STAT_CACHE); s->stat[MCS_CACHE] += val * PAGE_SIZE; val = mem_cgroup_read_stat(memcg, MEM_CGROUP_STAT_RSS); s->stat[MCS_RSS] += val * PAGE_SIZE; val = mem_cgroup_read_stat(memcg, MEM_CGROUP_STAT_FILE_MAPPED); s->stat[MCS_FILE_MAPPED] += val * PAGE_SIZE; val = mem_cgroup_read_events(memcg, MEM_CGROUP_EVENTS_PGPGIN); s->stat[MCS_PGPGIN] += val; val = mem_cgroup_read_events(memcg, MEM_CGROUP_EVENTS_PGPGOUT); s->stat[MCS_PGPGOUT] += val; if (do_swap_account) { val = mem_cgroup_read_stat(memcg, MEM_CGROUP_STAT_SWAPOUT); s->stat[MCS_SWAP] += val * PAGE_SIZE; } val = mem_cgroup_read_events(memcg, MEM_CGROUP_EVENTS_PGFAULT); s->stat[MCS_PGFAULT] += val; val = mem_cgroup_read_events(memcg, MEM_CGROUP_EVENTS_PGMAJFAULT); s->stat[MCS_PGMAJFAULT] += val; /* per zone stat */ val = mem_cgroup_nr_lru_pages(memcg, BIT(LRU_INACTIVE_ANON)); s->stat[MCS_INACTIVE_ANON] += val * PAGE_SIZE; val = mem_cgroup_nr_lru_pages(memcg, BIT(LRU_ACTIVE_ANON)); s->stat[MCS_ACTIVE_ANON] += val * PAGE_SIZE; val = mem_cgroup_nr_lru_pages(memcg, BIT(LRU_INACTIVE_FILE)); s->stat[MCS_INACTIVE_FILE] += val * PAGE_SIZE; val = mem_cgroup_nr_lru_pages(memcg, BIT(LRU_ACTIVE_FILE)); s->stat[MCS_ACTIVE_FILE] += val * PAGE_SIZE; val = mem_cgroup_nr_lru_pages(memcg, BIT(LRU_UNEVICTABLE)); s->stat[MCS_UNEVICTABLE] += val * PAGE_SIZE; }
3,194
185,834
1
void ObserverOnLogoAvailable(LogoObserver* observer, bool from_cache, LogoCallbackReason type, const base::Optional<Logo>& logo) { switch (type) { case LogoCallbackReason::DISABLED: case LogoCallbackReason::CANCELED: case LogoCallbackReason::FAILED: break; case LogoCallbackReason::REVALIDATED: // TODO(sfiera): double-check whether we should inform the observer of the // fresh metadata. break; case LogoCallbackReason::DETERMINED: observer->OnLogoAvailable(logo ? &logo.value() : nullptr, from_cache); break; } if (!from_cache) { observer->OnObserverRemoved(); } }
3,195
136,674
0
void FrameLoader::ProcessFragment(const KURL& url, FrameLoadType frame_load_type, LoadStartType load_start_type) { LocalFrameView* view = frame_->View(); if (!view) return; Frame* boundary_frame = url.HasFragmentIdentifier() ? frame_->FindUnsafeParentScrollPropagationBoundary() : nullptr; if (boundary_frame && boundary_frame->IsLocalFrame()) { ToLocalFrame(boundary_frame) ->View() ->SetSafeToPropagateScrollToParent(false); } bool should_scroll_to_fragment = (load_start_type == kNavigationWithinSameDocument && !IsBackForwardLoadType(frame_load_type)) || (!GetDocumentLoader()->GetInitialScrollState().did_restore_from_history && !(GetDocumentLoader()->GetHistoryItem() && GetDocumentLoader()->GetHistoryItem()->ScrollRestorationType() == kScrollRestorationManual)); view->ProcessUrlFragment(url, should_scroll_to_fragment ? LocalFrameView::kUrlFragmentScroll : LocalFrameView::kUrlFragmentDontScroll); if (boundary_frame && boundary_frame->IsLocalFrame()) ToLocalFrame(boundary_frame) ->View() ->SetSafeToPropagateScrollToParent(true); }
3,196
75,970
0
valid_path_cmp(const char *path, const char *valid_path) { for ( ; *path && *valid_path; path++, valid_path++) { if (!isalnum(*path)) { if (*valid_path != '_') return true; } else if (*path != *valid_path) return true; } return *path != *valid_path; }
3,197
29,522
0
static inline struct msg_msg *prepare_copy(void __user *buf, size_t bufsz) { struct msg_msg *copy; /* * Create dummy message to copy real message to. */ copy = load_msg(buf, bufsz); if (!IS_ERR(copy)) copy->m_ts = bufsz; return copy; }
3,198
183,242
1
static int get_default_root(pool *p, int allow_symlinks, char **root) { config_rec *c = NULL; char *dir = NULL; int res; c = find_config(main_server->conf, CONF_PARAM, "DefaultRoot", FALSE); while (c) { pr_signals_handle(); /* Check the groups acl */ if (c->argc < 2) { dir = c->argv[0]; break; } res = pr_expr_eval_group_and(((char **) c->argv)+1); if (res) { dir = c->argv[0]; break; } c = find_config_next(c, c->next, CONF_PARAM, "DefaultRoot", FALSE); } if (dir) { char *new_dir; /* Check for any expandable variables. */ new_dir = path_subst_uservar(p, &dir); if (new_dir != NULL) { dir = new_dir; } if (strncmp(dir, "/", 2) == 0) { dir = NULL; } else { char *realdir; int xerrno = 0; if (allow_symlinks == FALSE) { char *path, target_path[PR_TUNABLE_PATH_MAX + 1]; struct stat st; size_t pathlen; /* First, deal with any possible interpolation. dir_realpath() will * do this for us, but dir_realpath() ALSO automatically follows * symlinks, which is what we do NOT want to do here. */ path = dir; if (*path != '/') { if (*path == '~') { if (pr_fs_interpolate(dir, target_path, sizeof(target_path)-1) < 0) { return -1; } path = target_path; } } /* Note: lstat(2) is sensitive to the presence of a trailing slash on * the path, particularly in the case of a symlink to a directory. * Thus to get the correct test, we need to remove any trailing slash * that might be present. Subtle. */ pathlen = strlen(path); if (pathlen > 1 && path[pathlen-1] == '/') { path[pathlen-1] = '\0'; } pr_fs_clear_cache(); res = pr_fsio_lstat(path, &st); if (res < 0) { xerrno = errno; pr_log_pri(PR_LOG_WARNING, "error: unable to check %s: %s", path, strerror(xerrno)); errno = xerrno; return -1; } if (S_ISLNK(st.st_mode)) { pr_log_pri(PR_LOG_WARNING, "error: DefaultRoot %s is a symlink (denied by AllowChrootSymlinks " "config)", path); errno = EPERM; return -1; } } /* We need to be the final user here so that if the user has their home * directory with a mode the user proftpd is running (i.e. the User * directive) as can not traverse down, we can still have the default * root. */ PRIVS_USER realdir = dir_realpath(p, dir); xerrno = errno; PRIVS_RELINQUISH if (realdir) { dir = realdir; } else { /* Try to provide a more informative message. */ char interp_dir[PR_TUNABLE_PATH_MAX + 1]; memset(interp_dir, '\0', sizeof(interp_dir)); (void) pr_fs_interpolate(dir, interp_dir, sizeof(interp_dir)-1); pr_log_pri(PR_LOG_NOTICE, "notice: unable to use DefaultRoot '%s' [resolved to '%s']: %s", dir, interp_dir, strerror(xerrno)); errno = xerrno; } } } *root = dir; return 0; }
3,199