unique_id
int64
13
189k
target
int64
0
1
code
stringlengths
20
241k
__index_level_0__
int64
0
18.9k
137,983
0
void AXLayoutObject::setSelection(const AXRange& selection) { if (!getLayoutObject() || !selection.isValid()) return; AXObject* anchorObject = selection.anchorObject ? selection.anchorObject.get() : this; AXObject* focusObject = selection.focusObject ? selection.focusObject.get() : this; if (!isValidSelectionBound(anchorObject) || !isValidSelectionBound(focusObject)) { return; } if (anchorObject == focusObject && anchorObject->getLayoutObject()->isTextControl()) { TextControlElement* textControl = toLayoutTextControl(anchorObject->getLayoutObject()) ->textControlElement(); if (selection.anchorOffset <= selection.focusOffset) { textControl->setSelectionRange(selection.anchorOffset, selection.focusOffset, SelectionHasForwardDirection); } else { textControl->setSelectionRange(selection.focusOffset, selection.anchorOffset, SelectionHasBackwardDirection); } return; } LocalFrame* frame = getLayoutObject()->frame(); if (!frame) return; frame->document()->updateStyleAndLayoutIgnorePendingStylesheets(); VisiblePosition anchorVisiblePosition = toVisiblePosition(anchorObject, selection.anchorOffset); VisiblePosition focusVisiblePosition = toVisiblePosition(focusObject, selection.focusOffset); if (anchorVisiblePosition.isNull() || focusVisiblePosition.isNull()) return; frame->selection().setSelection( SelectionInDOMTree::Builder() .collapse(anchorVisiblePosition.toPositionWithAffinity()) .extend(focusVisiblePosition.deepEquivalent()) .build()); }
16,900
109,324
0
void InspectorPageAgent::setDeviceMetricsOverride(ErrorString* errorString, int width, int height, double deviceScaleFactor, bool fitWindow, const bool* optionalTextAutosizing) { const static long maxDimension = 10000000; if (width < 0 || height < 0 || width > maxDimension || height > maxDimension) { *errorString = "Width and height values must be positive, not greater than " + String::number(maxDimension); return; } if (!width ^ !height) { *errorString = "Both width and height must be either zero or non-zero at once"; return; } if (deviceScaleFactor <= 0) { *errorString = "deviceScaleFactor must be positive"; return; } bool textAutosizing = optionalTextAutosizing ? *optionalTextAutosizing : false; if (!deviceMetricsChanged(width, height, deviceScaleFactor, fitWindow, textAutosizing)) return; m_state->setLong(PageAgentState::pageAgentScreenWidthOverride, width); m_state->setLong(PageAgentState::pageAgentScreenHeightOverride, height); m_state->setDouble(PageAgentState::pageAgentDeviceScaleFactorOverride, deviceScaleFactor); m_state->setBoolean(PageAgentState::pageAgentFitWindow, fitWindow); m_state->setBoolean(PageAgentState::pageAgentTextAutosizingOverride, textAutosizing); updateViewMetrics(width, height, deviceScaleFactor, fitWindow, textAutosizing); }
16,901
101,685
0
void Browser::HideInstant() { window_->HideInstant(instant_->is_active()); }
16,902
135,817
0
const VisibleSelection& SelectionEditor::ComputeVisibleSelectionInDOMTree() const { DCHECK_EQ(GetFrame()->GetDocument(), GetDocument()); DCHECK_EQ(GetFrame(), GetDocument().GetFrame()); UpdateCachedVisibleSelectionIfNeeded(); if (cached_visible_selection_in_dom_tree_.IsNone()) return cached_visible_selection_in_dom_tree_; DCHECK_EQ(cached_visible_selection_in_dom_tree_.Base().GetDocument(), GetDocument()); return cached_visible_selection_in_dom_tree_; }
16,903
133,063
0
void CancelUnlockOperation() { cancel_unlock_ = true; }
16,904
82,229
0
SYSCALL_DEFINE5(getsockopt, int, fd, int, level, int, optname, char __user *, optval, int __user *, optlen) { return __sys_getsockopt(fd, level, optname, optval, optlen); }
16,905
46,682
0
static int xts_fallback_init(struct crypto_tfm *tfm) { const char *name = tfm->__crt_alg->cra_name; struct s390_xts_ctx *xts_ctx = crypto_tfm_ctx(tfm); xts_ctx->fallback = crypto_alloc_blkcipher(name, 0, CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK); if (IS_ERR(xts_ctx->fallback)) { pr_err("Allocating XTS fallback algorithm %s failed\n", name); return PTR_ERR(xts_ctx->fallback); } return 0; }
16,906
75,192
0
static void process_bin_stat(conn *c) { char *subcommand = binary_get_key(c); size_t nkey = c->binary_header.request.keylen; if (settings.verbose > 1) { int ii; fprintf(stderr, "<%d STATS ", c->sfd); for (ii = 0; ii < nkey; ++ii) { fprintf(stderr, "%c", subcommand[ii]); } fprintf(stderr, "\n"); } if (nkey == 0) { /* request all statistics */ server_stats(&append_stats, c); (void)get_stats(NULL, 0, &append_stats, c); } else if (strncmp(subcommand, "reset", 5) == 0) { stats_reset(); } else if (strncmp(subcommand, "settings", 8) == 0) { process_stat_settings(&append_stats, c); } else if (strncmp(subcommand, "detail", 6) == 0) { char *subcmd_pos = subcommand + 6; if (strncmp(subcmd_pos, " dump", 5) == 0) { int len; char *dump_buf = stats_prefix_dump(&len); if (dump_buf == NULL || len <= 0) { out_of_memory(c, "SERVER_ERROR Out of memory generating stats"); return ; } else { append_stats("detailed", strlen("detailed"), dump_buf, len, c); free(dump_buf); } } else if (strncmp(subcmd_pos, " on", 3) == 0) { settings.detail_enabled = 1; } else if (strncmp(subcmd_pos, " off", 4) == 0) { settings.detail_enabled = 0; } else { write_bin_error(c, PROTOCOL_BINARY_RESPONSE_KEY_ENOENT, NULL, 0); return; } } else { if (get_stats(subcommand, nkey, &append_stats, c)) { if (c->stats.buffer == NULL) { out_of_memory(c, "SERVER_ERROR Out of memory generating stats"); } else { write_and_free(c, c->stats.buffer, c->stats.offset); c->stats.buffer = NULL; } } else { write_bin_error(c, PROTOCOL_BINARY_RESPONSE_KEY_ENOENT, NULL, 0); } return; } /* Append termination package and start the transfer */ append_stats(NULL, 0, NULL, 0, c); if (c->stats.buffer == NULL) { out_of_memory(c, "SERVER_ERROR Out of memory preparing to send stats"); } else { write_and_free(c, c->stats.buffer, c->stats.offset); c->stats.buffer = NULL; } }
16,907
32,561
0
static void tg3_get_ethtool_stats(struct net_device *dev, struct ethtool_stats *estats, u64 *tmp_stats) { struct tg3 *tp = netdev_priv(dev); if (tp->hw_stats) tg3_get_estats(tp, (struct tg3_ethtool_stats *)tmp_stats); else memset(tmp_stats, 0, sizeof(struct tg3_ethtool_stats)); }
16,908
128,951
0
StateBase* handleError(Status errorStatus, const String& message, StateBase* state) { ASSERT(errorStatus != Success); m_status = errorStatus; m_errorMessage = message; while (state) { StateBase* tmp = state->nextState(); delete state; state = tmp; } return new ErrorState; }
16,909
88,585
0
static int get_next_eof(FILE *fp) { int match, c; const char buf[] = "%%EOF"; match = 0; while ((c = fgetc(fp)) != EOF) { if (c == buf[match]) ++match; else match = 0; if (match == 5) /* strlen("%%EOF") */ return ftell(fp) - 5; } return -1; }
16,910
58,730
0
static inline ssize_t do_tty_write( ssize_t (*write)(struct tty_struct *, struct file *, const unsigned char *, size_t), struct tty_struct *tty, struct file *file, const char __user *buf, size_t count) { ssize_t ret, written = 0; unsigned int chunk; ret = tty_write_lock(tty, file->f_flags & O_NDELAY); if (ret < 0) return ret; /* * We chunk up writes into a temporary buffer. This * simplifies low-level drivers immensely, since they * don't have locking issues and user mode accesses. * * But if TTY_NO_WRITE_SPLIT is set, we should use a * big chunk-size.. * * The default chunk-size is 2kB, because the NTTY * layer has problems with bigger chunks. It will * claim to be able to handle more characters than * it actually does. * * FIXME: This can probably go away now except that 64K chunks * are too likely to fail unless switched to vmalloc... */ chunk = 2048; if (test_bit(TTY_NO_WRITE_SPLIT, &tty->flags)) chunk = 65536; if (count < chunk) chunk = count; /* write_buf/write_cnt is protected by the atomic_write_lock mutex */ if (tty->write_cnt < chunk) { unsigned char *buf_chunk; if (chunk < 1024) chunk = 1024; buf_chunk = kmalloc(chunk, GFP_KERNEL); if (!buf_chunk) { ret = -ENOMEM; goto out; } kfree(tty->write_buf); tty->write_cnt = chunk; tty->write_buf = buf_chunk; } /* Do the write .. */ for (;;) { size_t size = count; if (size > chunk) size = chunk; ret = -EFAULT; if (copy_from_user(tty->write_buf, buf, size)) break; ret = write(tty, file, tty->write_buf, size); if (ret <= 0) break; written += ret; buf += ret; count -= ret; if (!count) break; ret = -ERESTARTSYS; if (signal_pending(current)) break; cond_resched(); } if (written) { struct inode *inode = file->f_path.dentry->d_inode; inode->i_mtime = current_fs_time(inode->i_sb); ret = written; } out: tty_write_unlock(tty); return ret; }
16,911
120,546
0
const AtomicString& Element::imageSourceURL() const { return getAttribute(srcAttr); }
16,912
117,198
0
bool Texture::AllocateStorage(const gfx::Size& size, GLenum format) { DCHECK_NE(id_, 0u); ScopedGLErrorSuppressor suppressor(decoder_); ScopedTexture2DBinder binder(decoder_, id_); WrappedTexImage2D(GL_TEXTURE_2D, 0, // mip level format, size.width(), size.height(), 0, // border format, GL_UNSIGNED_BYTE, NULL); size_ = size; bool success = glGetError() == GL_NO_ERROR; if (success) { uint32 image_size = 0; GLES2Util::ComputeImageDataSize( size.width(), size.height(), format, GL_UNSIGNED_BYTE, 4, &image_size); estimated_size_ = image_size; decoder_->UpdateBackbufferMemoryAccounting(); } return success; }
16,913
66,343
0
static void gen_inc(DisasContext *s1, TCGMemOp ot, int d, int c) { if (s1->prefix & PREFIX_LOCK) { tcg_gen_movi_tl(cpu_T0, c > 0 ? 1 : -1); tcg_gen_atomic_add_fetch_tl(cpu_T0, cpu_A0, cpu_T0, s1->mem_index, ot | MO_LE); } else { if (d != OR_TMP0) { gen_op_mov_v_reg(ot, cpu_T0, d); } else { gen_op_ld_v(s1, ot, cpu_T0, cpu_A0); } tcg_gen_addi_tl(cpu_T0, cpu_T0, (c > 0 ? 1 : -1)); gen_op_st_rm_T0_A0(s1, ot, d); } gen_compute_eflags_c(s1, cpu_cc_src); tcg_gen_mov_tl(cpu_cc_dst, cpu_T0); set_cc_op(s1, (c > 0 ? CC_OP_INCB : CC_OP_DECB) + ot); }
16,914
175,544
0
WORD32 ihevcd_get_total_pic_buf_size(codec_t *ps_codec, WORD32 wd, WORD32 ht) { WORD32 size; WORD32 num_luma_samples; WORD32 max_dpb_size; WORD32 num_samples; sps_t *ps_sps = (ps_codec->s_parse.ps_sps_base + ps_codec->i4_sps_id); /* Get maximum number of buffers for the current picture size */ max_dpb_size = ps_sps->ai1_sps_max_dec_pic_buffering[ps_sps->i1_sps_max_sub_layers - 1]; if(ps_codec->e_frm_out_mode != IVD_DECODE_FRAME_OUT) max_dpb_size += ps_sps->ai1_sps_max_num_reorder_pics[ps_sps->i1_sps_max_sub_layers - 1]; max_dpb_size++; /* Allocation is required for * (Wd + horz_pad) * (Ht + vert_pad) * (2 * max_dpb_size + 1) */ /* Account for padding area */ num_luma_samples = (wd + PAD_WD) * (ht + PAD_HT); /* Account for chroma */ num_samples = num_luma_samples * 3 / 2; /* Number of bytes in reference pictures */ size = num_samples * max_dpb_size; return size; }
16,915
94,504
0
static void rfcomm_tty_unthrottle(struct tty_struct *tty) { struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data; BT_DBG("tty %p dev %p", tty, dev); rfcomm_dlc_unthrottle(dev->dlc); }
16,916
130,740
0
static void enabledPerContextAttrAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) { TestObject* imp = V8TestObject::toNative(info.Holder()); v8SetReturnValueInt(info, imp->enabledPerContextAttr()); }
16,917
149,890
0
bool LayerTreeHostImpl::AnimationsPreserveAxisAlignment( const LayerImpl* layer) const { return mutator_host_->AnimationsPreserveAxisAlignment(layer->element_id()); }
16,918
151,512
0
bool WorkerFetchContext::ShouldBlockFetchAsCredentialedSubresource( const ResourceRequest& resource_request, const KURL& url) const { if ((!url.User().IsEmpty() || !url.Pass().IsEmpty()) && resource_request.GetRequestContext() != WebURLRequest::kRequestContextXMLHttpRequest) { if (Url().User() != url.User() || Url().Pass() != url.Pass()) { CountDeprecation( WebFeature::kRequestedSubresourceWithEmbeddedCredentials); if (RuntimeEnabledFeatures::BlockCredentialedSubresourcesEnabled()) return true; } } return false; }
16,919
70,143
0
TIFFReadDirEntryCheckRangeLong8Slong8(int64 value) { if (value < 0) return(TIFFReadDirEntryErrRange); else return(TIFFReadDirEntryErrOk); }
16,920
48,451
0
static void clear_empty_dir(struct ctl_dir *dir) { dir->header.ctl_table[0].child = NULL; }
16,921
86,902
0
TEE_Result syscall_obj_generate_key(unsigned long obj, unsigned long key_size, const struct utee_attribute *usr_params, unsigned long param_count) { TEE_Result res; struct tee_ta_session *sess; const struct tee_cryp_obj_type_props *type_props; struct tee_obj *o; struct tee_cryp_obj_secret *key; size_t byte_size; TEE_Attribute *params = NULL; res = tee_ta_get_current_session(&sess); if (res != TEE_SUCCESS) return res; res = tee_obj_get(to_user_ta_ctx(sess->ctx), tee_svc_uref_to_vaddr(obj), &o); if (res != TEE_SUCCESS) return res; /* Must be a transient object */ if ((o->info.handleFlags & TEE_HANDLE_FLAG_PERSISTENT) != 0) return TEE_ERROR_BAD_STATE; /* Must not be initialized already */ if ((o->info.handleFlags & TEE_HANDLE_FLAG_INITIALIZED) != 0) return TEE_ERROR_BAD_STATE; /* Find description of object */ type_props = tee_svc_find_type_props(o->info.objectType); if (!type_props) return TEE_ERROR_NOT_SUPPORTED; /* Check that maxKeySize follows restrictions */ if (key_size % type_props->quanta != 0) return TEE_ERROR_NOT_SUPPORTED; if (key_size < type_props->min_size) return TEE_ERROR_NOT_SUPPORTED; if (key_size > type_props->max_size) return TEE_ERROR_NOT_SUPPORTED; params = malloc(sizeof(TEE_Attribute) * param_count); if (!params) return TEE_ERROR_OUT_OF_MEMORY; res = copy_in_attrs(to_user_ta_ctx(sess->ctx), usr_params, param_count, params); if (res != TEE_SUCCESS) goto out; res = tee_svc_cryp_check_attr(ATTR_USAGE_GENERATE_KEY, type_props, params, param_count); if (res != TEE_SUCCESS) goto out; switch (o->info.objectType) { case TEE_TYPE_AES: case TEE_TYPE_DES: case TEE_TYPE_DES3: case TEE_TYPE_HMAC_MD5: case TEE_TYPE_HMAC_SHA1: case TEE_TYPE_HMAC_SHA224: case TEE_TYPE_HMAC_SHA256: case TEE_TYPE_HMAC_SHA384: case TEE_TYPE_HMAC_SHA512: case TEE_TYPE_GENERIC_SECRET: byte_size = key_size / 8; /* * We have to do it like this because the parity bits aren't * counted when telling the size of the key in bits. */ if (o->info.objectType == TEE_TYPE_DES || o->info.objectType == TEE_TYPE_DES3) { byte_size = (key_size + key_size / 7) / 8; } key = (struct tee_cryp_obj_secret *)o->attr; if (byte_size > key->alloc_size) { res = TEE_ERROR_EXCESS_DATA; goto out; } res = crypto_rng_read((void *)(key + 1), byte_size); if (res != TEE_SUCCESS) goto out; key->key_size = byte_size; /* Set bits for all known attributes for this object type */ o->have_attrs = (1 << type_props->num_type_attrs) - 1; break; case TEE_TYPE_RSA_KEYPAIR: res = tee_svc_obj_generate_key_rsa(o, type_props, key_size, params, param_count); if (res != TEE_SUCCESS) goto out; break; case TEE_TYPE_DSA_KEYPAIR: res = tee_svc_obj_generate_key_dsa(o, type_props, key_size); if (res != TEE_SUCCESS) goto out; break; case TEE_TYPE_DH_KEYPAIR: res = tee_svc_obj_generate_key_dh(o, type_props, key_size, params, param_count); if (res != TEE_SUCCESS) goto out; break; case TEE_TYPE_ECDSA_KEYPAIR: case TEE_TYPE_ECDH_KEYPAIR: res = tee_svc_obj_generate_key_ecc(o, type_props, key_size, params, param_count); if (res != TEE_SUCCESS) goto out; break; default: res = TEE_ERROR_BAD_FORMAT; } out: free(params); if (res == TEE_SUCCESS) { o->info.keySize = key_size; o->info.handleFlags |= TEE_HANDLE_FLAG_INITIALIZED; } return res; }
16,922
178,511
1
load(ImlibImage * im, ImlibProgressFunction progress, char progress_granularity, char immediate_load) { int rc; char p = ' ', numbers = 3, count = 0; int w = 0, h = 0, v = 255, c = 0; char buf[256]; FILE *f = NULL; if (im->data) return 0; f = fopen(im->real_file, "rb"); if (!f) return 0; /* can't use fgets(), because there might be * binary data after the header and there * needn't be a newline before the data, so * no chance to distinguish between end of buffer * and a binary 0. */ /* read the header info */ rc = 0; /* Error */ c = fgetc(f); if (c != 'P') goto quit; p = fgetc(f); if (p == '1' || p == '4') numbers = 2; /* bitimages don't have max value */ if ((p < '1') || (p > '8')) goto quit; count = 0; while (count < numbers) { c = fgetc(f); if (c == EOF) goto quit; /* eat whitespace */ while (isspace(c)) c = fgetc(f); /* if comment, eat that */ if (c == '#') { do c = fgetc(f); while (c != '\n' && c != EOF); } /* no comment -> proceed */ else { int i = 0; /* read numbers */ while (c != EOF && !isspace(c) && (i < 255)) { buf[i++] = c; c = fgetc(f); } if (i) { buf[i] = 0; count++; switch (count) { /* width */ case 1: w = atoi(buf); break; /* height */ case 2: h = atoi(buf); break; /* max value, only for color and greyscale */ case 3: v = atoi(buf); break; } } } } if ((v < 0) || (v > 255)) goto quit; im->w = w; im->h = h; if (!IMAGE_DIMENSIONS_OK(w, h)) goto quit; if (!im->format) { if (p == '8') SET_FLAG(im->flags, F_HAS_ALPHA); else UNSET_FLAG(im->flags, F_HAS_ALPHA); im->format = strdup("pnm"); } rc = 1; /* Ok */ if (((!im->data) && (im->loader)) || (immediate_load) || (progress)) { DATA8 *data = NULL; /* for the binary versions */ DATA8 *ptr = NULL; int *idata = NULL; /* for the ASCII versions */ int *iptr; char buf2[256]; DATA32 *ptr2; int i, j, x, y, pl = 0; char pper = 0; /* must set the im->data member before callign progress function */ ptr2 = im->data = malloc(w * h * sizeof(DATA32)); if (!im->data) goto quit_error; /* start reading the data */ switch (p) { case '1': /* ASCII monochrome */ buf[0] = 0; i = 0; for (y = 0; y < h; y++) { x = 0; while (x < w) { if (!buf[i]) /* fill buffer */ { if (!fgets(buf, 255, f)) goto quit_error; i = 0; } while (buf[i] && isspace(buf[i])) i++; if (buf[i]) { if (buf[i] == '1') *ptr2 = 0xff000000; else if (buf[i] == '0') *ptr2 = 0xffffffff; else goto quit_error; ptr2++; i++; } } if (progress && do_progress(im, progress, progress_granularity, &pper, &pl, y)) goto quit_progress; } break; case '2': /* ASCII greyscale */ idata = malloc(sizeof(int) * w); if (!idata) goto quit_error; buf[0] = 0; i = 0; j = 0; for (y = 0; y < h; y++) { iptr = idata; x = 0; while (x < w) { int k; /* check 4 chars ahead to see if we need to * fill the buffer */ for (k = 0; k < 4; k++) { if (!buf[i + k]) /* fill buffer */ { if (fseek(f, -k, SEEK_CUR) == -1 || !fgets(buf, 255, f)) goto quit_error; i = 0; break; } } while (buf[i] && isspace(buf[i])) i++; while (buf[i] && !isspace(buf[i])) buf2[j++] = buf[i++]; if (j) { buf2[j] = 0; *(iptr++) = atoi(buf2); j = 0; x++; } } iptr = idata; if (v == 255) { for (x = 0; x < w; x++) { *ptr2 = 0xff000000 | (iptr[0] << 16) | (iptr[0] << 8) | iptr[0]; ptr2++; iptr++; } } else { for (x = 0; x < w; x++) { *ptr2 = 0xff000000 | (((iptr[0] * 255) / v) << 16) | (((iptr[0] * 255) / v) << 8) | ((iptr[0] * 255) / v); ptr2++; iptr++; } } if (progress && do_progress(im, progress, progress_granularity, &pper, &pl, y)) goto quit_progress; } break; case '3': /* ASCII RGB */ idata = malloc(3 * sizeof(int) * w); if (!idata) goto quit_error; buf[0] = 0; i = 0; j = 0; for (y = 0; y < h; y++) { int w3 = 3 * w; iptr = idata; x = 0; while (x < w3) { int k; /* check 4 chars ahead to see if we need to * fill the buffer */ for (k = 0; k < 4; k++) { if (!buf[i + k]) /* fill buffer */ { if (fseek(f, -k, SEEK_CUR) == -1 || !fgets(buf, 255, f)) goto quit_error; i = 0; break; } } while (buf[i] && isspace(buf[i])) i++; while (buf[i] && !isspace(buf[i])) buf2[j++] = buf[i++]; if (j) { buf2[j] = 0; *(iptr++) = atoi(buf2); j = 0; x++; } } iptr = idata; if (v == 255) { for (x = 0; x < w; x++) { *ptr2 = 0xff000000 | (iptr[0] << 16) | (iptr[1] << 8) | iptr[2]; ptr2++; iptr += 3; } } else { for (x = 0; x < w; x++) { *ptr2 = 0xff000000 | (((iptr[0] * 255) / v) << 16) | (((iptr[1] * 255) / v) << 8) | ((iptr[2] * 255) / v); ptr2++; iptr += 3; } } if (progress && do_progress(im, progress, progress_granularity, &pper, &pl, y)) goto quit_progress; } break; case '4': /* binary 1bit monochrome */ data = malloc((w + 7) / 8 * sizeof(DATA8)); if (!data) goto quit_error; ptr2 = im->data; for (y = 0; y < h; y++) { if (!fread(data, (w + 7) / 8, 1, f)) goto quit_error; ptr = data; for (x = 0; x < w; x += 8) { j = (w - x >= 8) ? 8 : w - x; for (i = 0; i < j; i++) { if (ptr[0] & (0x80 >> i)) *ptr2 = 0xff000000; else *ptr2 = 0xffffffff; ptr2++; } ptr++; } if (progress && do_progress(im, progress, progress_granularity, &pper, &pl, y)) goto quit_progress; } break; case '5': /* binary 8bit grayscale GGGGGGGG */ data = malloc(1 * sizeof(DATA8) * w); if (!data) goto quit_error; ptr2 = im->data; for (y = 0; y < h; y++) { if (!fread(data, w * 1, 1, f)) break; ptr = data; if (v == 255) { for (x = 0; x < w; x++) { *ptr2 = 0xff000000 | (ptr[0] << 16) | (ptr[0] << 8) | ptr[0]; ptr2++; ptr++; } } else { for (x = 0; x < w; x++) { *ptr2 = 0xff000000 | (((ptr[0] * 255) / v) << 16) | (((ptr[0] * 255) / v) << 8) | ((ptr[0] * 255) / v); ptr2++; ptr++; } } if (progress && do_progress(im, progress, progress_granularity, &pper, &pl, y)) goto quit_progress; } break; case '6': /* 24bit binary RGBRGBRGB */ data = malloc(3 * sizeof(DATA8) * w); if (!data) goto quit_error; ptr2 = im->data; for (y = 0; y < h; y++) { if (!fread(data, w * 3, 1, f)) break; ptr = data; if (v == 255) { for (x = 0; x < w; x++) { *ptr2 = 0xff000000 | (ptr[0] << 16) | (ptr[1] << 8) | ptr[2]; ptr2++; ptr += 3; } } else { for (x = 0; x < w; x++) { *ptr2 = 0xff000000 | (((ptr[0] * 255) / v) << 16) | (((ptr[1] * 255) / v) << 8) | ((ptr[2] * 255) / v); ptr2++; ptr += 3; } } if (progress && do_progress(im, progress, progress_granularity, &pper, &pl, y)) goto quit_progress; } break; case '7': /* XV's 8bit 332 format */ data = malloc(1 * sizeof(DATA8) * w); if (!data) goto quit_error; ptr2 = im->data; for (y = 0; y < h; y++) { if (!fread(data, w * 1, 1, f)) break; ptr = data; for (x = 0; x < w; x++) { int r, g, b; r = (*ptr >> 5) & 0x7; g = (*ptr >> 2) & 0x7; b = (*ptr) & 0x3; *ptr2 = 0xff000000 | (((r << 21) | (r << 18) | (r << 15)) & 0xff0000) | (((g << 13) | (g << 10) | (g << 7)) & 0xff00) | ((b << 6) | (b << 4) | (b << 2) | (b << 0)); ptr2++; ptr++; } if (progress && do_progress(im, progress, progress_granularity, &pper, &pl, y)) goto quit_progress; } break; case '8': /* 24bit binary RGBARGBARGBA */ data = malloc(4 * sizeof(DATA8) * w); if (!data) goto quit_error; ptr2 = im->data; for (y = 0; y < h; y++) { if (!fread(data, w * 4, 1, f)) break; ptr = data; if (v == 255) { for (x = 0; x < w; x++) { *ptr2 = (ptr[3] << 24) | (ptr[0] << 16) | (ptr[1] << 8) | ptr[2]; ptr2++; ptr += 4; } } else { for (x = 0; x < w; x++) { *ptr2 = (((ptr[3] * 255) / v) << 24) | (((ptr[0] * 255) / v) << 16) | (((ptr[1] * 255) / v) << 8) | ((ptr[2] * 255) / v); ptr2++; ptr += 4; } } if (progress && do_progress(im, progress, progress_granularity, &pper, &pl, y)) goto quit_progress; } break; default: quit_error: rc = 0; break; quit_progress: rc = 2; break; } if (idata) free(idata); if (data) free(data); } quit: fclose(f); return rc; }
16,923
59,261
0
static void account_kernel_stack(struct task_struct *tsk, int account) { void *stack = task_stack_page(tsk); struct vm_struct *vm = task_stack_vm_area(tsk); BUILD_BUG_ON(IS_ENABLED(CONFIG_VMAP_STACK) && PAGE_SIZE % 1024 != 0); if (vm) { int i; BUG_ON(vm->nr_pages != THREAD_SIZE / PAGE_SIZE); for (i = 0; i < THREAD_SIZE / PAGE_SIZE; i++) { mod_zone_page_state(page_zone(vm->pages[i]), NR_KERNEL_STACK_KB, PAGE_SIZE / 1024 * account); } /* All stack pages belong to the same memcg. */ mod_memcg_page_state(vm->pages[0], MEMCG_KERNEL_STACK_KB, account * (THREAD_SIZE / 1024)); } else { /* * All stack pages are in the same zone and belong to the * same memcg. */ struct page *first_page = virt_to_page(stack); mod_zone_page_state(page_zone(first_page), NR_KERNEL_STACK_KB, THREAD_SIZE / 1024 * account); mod_memcg_page_state(first_page, MEMCG_KERNEL_STACK_KB, account * (THREAD_SIZE / 1024)); } }
16,924
125,692
0
void RenderViewHostImpl::OnTargetDropACK() { NotificationService::current()->Notify( NOTIFICATION_RENDER_VIEW_HOST_DID_RECEIVE_DRAG_TARGET_DROP_ACK, Source<RenderViewHost>(this), NotificationService::NoDetails()); }
16,925
130,189
0
void RenderFrameHostImpl::OnFrameFocused() { frame_tree_->SetFocusedFrame(frame_tree_node_); }
16,926
81,788
0
void streamDecodeID(void *buf, streamID *id) { uint64_t e[2]; memcpy(e,buf,sizeof(e)); id->ms = ntohu64(e[0]); id->seq = ntohu64(e[1]); }
16,927
13,125
0
static struct dyn_lease *find_lease_by_nip(uint32_t nip) { unsigned i; for (i = 0; i < server_config.max_leases; i++) if (g_leases[i].lease_nip == nip) return &g_leases[i]; return NULL; }
16,928
71,572
0
static MagickBooleanType WriteHRZImage(const ImageInfo *image_info,Image *image) { Image *hrz_image; MagickBooleanType status; register const PixelPacket *p; register ssize_t x, y; register unsigned char *q; ssize_t count; unsigned char *pixels; /* Open output image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); assert(image != (Image *) NULL); assert(image->signature == MagickSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception); if (status == MagickFalse) return(status); hrz_image=ResizeImage(image,256,240,image->filter,image->blur, &image->exception); if (hrz_image == (Image *) NULL) return(MagickFalse); (void) TransformImageColorspace(hrz_image,sRGBColorspace); /* Allocate memory for pixels. */ pixels=(unsigned char *) AcquireQuantumMemory((size_t) hrz_image->columns, 3*sizeof(*pixels)); if (pixels == (unsigned char *) NULL) { hrz_image=DestroyImage(hrz_image); ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed"); } /* Convert MIFF to HRZ raster pixels. */ for (y=0; y < (ssize_t) hrz_image->rows; y++) { p=GetVirtualPixels(hrz_image,0,y,hrz_image->columns,1,&image->exception); if (p == (PixelPacket *) NULL) break; q=pixels; for (x=0; x < (ssize_t) hrz_image->columns; x++) { *q++=ScaleQuantumToChar(GetPixelRed(p)/4); *q++=ScaleQuantumToChar(GetPixelGreen(p)/4); *q++=ScaleQuantumToChar(GetPixelBlue(p)/4); p++; } count=WriteBlob(image,(size_t) (q-pixels),pixels); if (count != (ssize_t) (q-pixels)) break; status=SetImageProgress(image,SaveImageTag,y,hrz_image->rows); if (status == MagickFalse) break; } pixels=(unsigned char *) RelinquishMagickMemory(pixels); hrz_image=DestroyImage(hrz_image); (void) CloseBlob(image); return(MagickTrue); }
16,929
63,902
0
COMPAT_SYSCALL_DEFINE2(timerfd_gettime, int, ufd, struct compat_itimerspec __user *, otmr) { struct itimerspec kotmr; int ret = do_timerfd_gettime(ufd, &kotmr); if (ret) return ret; return put_compat_itimerspec(otmr, &kotmr) ? -EFAULT: 0; }
16,930
95,401
0
MODRET auth_post_host(cmd_rec *cmd) { /* If the HOST command changed the main_server pointer, reinitialize * ourselves. */ if (session.prev_server != NULL) { int res; /* Remove the TimeoutLogin timer. */ pr_timer_remove(PR_TIMER_LOGIN, &auth_module); pr_event_unregister(&auth_module, "core.exit", auth_exit_ev); /* Reset the CreateHome setting. */ mkhome = FALSE; #ifdef PR_USE_LASTLOG /* Reset the UseLastLog setting. */ lastlog = FALSE; #endif /* PR_USE_LASTLOG */ res = auth_sess_init(); if (res < 0) { pr_session_disconnect(&auth_module, PR_SESS_DISCONNECT_SESSION_INIT_FAILED, NULL); } } return PR_DECLINED(cmd); }
16,931
84,906
0
SMB2_auth_kerberos(struct SMB2_sess_data *sess_data) { cifs_dbg(VFS, "Kerberos negotiated but upcall support disabled!\n"); sess_data->result = -EOPNOTSUPP; sess_data->func = NULL; }
16,932
81,674
0
get_message(struct mg_connection *conn, char *ebuf, size_t ebuf_len, int *err) { if (ebuf_len > 0) { ebuf[0] = '\0'; } *err = 0; reset_per_request_attributes(conn); if (!conn) { mg_snprintf(conn, NULL, /* No truncation check for ebuf */ ebuf, ebuf_len, "%s", "Internal error"); *err = 500; return 0; } /* Set the time the request was received. This value should be used for * timeouts. */ clock_gettime(CLOCK_MONOTONIC, &(conn->req_time)); conn->request_len = read_message(NULL, conn, conn->buf, conn->buf_size, &conn->data_len); DEBUG_ASSERT(conn->request_len < 0 || conn->data_len >= conn->request_len); if ((conn->request_len >= 0) && (conn->data_len < conn->request_len)) { mg_snprintf(conn, NULL, /* No truncation check for ebuf */ ebuf, ebuf_len, "%s", "Invalid message size"); *err = 500; return 0; } if ((conn->request_len == 0) && (conn->data_len == conn->buf_size)) { mg_snprintf(conn, NULL, /* No truncation check for ebuf */ ebuf, ebuf_len, "%s", "Message too large"); *err = 413; return 0; } if (conn->request_len <= 0) { if (conn->data_len > 0) { mg_snprintf(conn, NULL, /* No truncation check for ebuf */ ebuf, ebuf_len, "%s", "Malformed message"); *err = 400; } else { /* Server did not recv anything -> just close the connection */ conn->must_close = 1; mg_snprintf(conn, NULL, /* No truncation check for ebuf */ ebuf, ebuf_len, "%s", "No data received"); *err = 0; } return 0; } return 1; }
16,933
82,483
0
bool jsvIsNumeric(const JsVar *v) { return v && (v->flags&JSV_VARTYPEMASK)>=_JSV_NUMERIC_START && (v->flags&JSV_VARTYPEMASK)<=_JSV_NUMERIC_END; }
16,934
129,854
0
std::vector<const DictionaryValue*> FindTraceEntries( const ListValue& trace_parsed, const char* string_to_match) { std::vector<const DictionaryValue*> hits; size_t trace_parsed_count = trace_parsed.GetSize(); for (size_t i = 0; i < trace_parsed_count; i++) { const Value* value = NULL; trace_parsed.Get(i, &value); if (!value || value->GetType() != Value::TYPE_DICTIONARY) continue; const DictionaryValue* dict = static_cast<const DictionaryValue*>(value); if (IsStringInDict(string_to_match, dict)) hits.push_back(dict); } return hits; }
16,935
46,043
0
xdr_chrand3_arg(XDR *xdrs, chrand3_arg *objp) { if (!xdr_ui_4(xdrs, &objp->api_version)) { return (FALSE); } if (!xdr_krb5_principal(xdrs, &objp->princ)) { return (FALSE); } if (!xdr_krb5_boolean(xdrs, &objp->keepold)) { return (FALSE); } if (!xdr_array(xdrs, (caddr_t *)&objp->ks_tuple, (unsigned int*)&objp->n_ks_tuple, ~0, sizeof(krb5_key_salt_tuple), xdr_krb5_key_salt_tuple)) { return (FALSE); } return (TRUE); }
16,936
124,003
0
virtual void SetUpOnMainThread() { ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); ASSERT_NO_FATAL_FAILURE(SetupComponents()); chrome::FocusLocationBar(browser()); ViewID location_bar_focus_view_id = VIEW_ID_LOCATION_BAR; #if defined(USE_AURA) location_bar_focus_view_id = VIEW_ID_OMNIBOX; #endif ASSERT_TRUE(ui_test_utils::IsViewFocused(browser(), location_bar_focus_view_id)); }
16,937
148,158
0
void V8TestObject::VoidMethodStringArgVariadicStringArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_voidMethodStringArgVariadicStringArg"); test_object_v8_internal::VoidMethodStringArgVariadicStringArgMethod(info); }
16,938
136,931
0
bool HTMLInputElement::MatchesReadOnlyPseudoClass() const { return input_type_->SupportsReadOnly() && IsReadOnly(); }
16,939
135,998
0
bool ChildProcessSecurityPolicyImpl::CanCreateFileSystemFile( int child_id, const storage::FileSystemURL& url) { return HasPermissionsForFileSystemFile(child_id, url, CREATE_NEW_FILE_GRANT); }
16,940
54,488
0
static bool numamigrate_update_ratelimit(pg_data_t *pgdat, unsigned long nr_pages) { /* * Rate-limit the amount of data that is being migrated to a node. * Optimal placement is no good if the memory bus is saturated and * all the time is being spent migrating! */ if (time_after(jiffies, pgdat->numabalancing_migrate_next_window)) { spin_lock(&pgdat->numabalancing_migrate_lock); pgdat->numabalancing_migrate_nr_pages = 0; pgdat->numabalancing_migrate_next_window = jiffies + msecs_to_jiffies(migrate_interval_millisecs); spin_unlock(&pgdat->numabalancing_migrate_lock); } if (pgdat->numabalancing_migrate_nr_pages > ratelimit_pages) { trace_mm_numa_migrate_ratelimit(current, pgdat->node_id, nr_pages); return true; } /* * This is an unlocked non-atomic update so errors are possible. * The consequences are failing to migrate when we potentiall should * have which is not severe enough to warrant locking. If it is ever * a problem, it can be converted to a per-cpu counter. */ pgdat->numabalancing_migrate_nr_pages += nr_pages; return false; }
16,941
130,523
0
void DisplayItemList::addItemToIndexIfNeeded(const DisplayItem& displayItem, size_t index, DisplayItemIndicesByClientMap& displayItemIndicesByClient) { if (!displayItem.isCacheable()) return; DisplayItemIndicesByClientMap::iterator it = displayItemIndicesByClient.find(displayItem.client()); Vector<size_t>& indices = it == displayItemIndicesByClient.end() ? displayItemIndicesByClient.add(displayItem.client(), Vector<size_t>()).storedValue->value : it->value; indices.append(index); }
16,942
19,211
0
void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err) { struct sk_buff *skb; struct nlmsghdr *rep; struct nlmsgerr *errmsg; size_t payload = sizeof(*errmsg); /* error messages get the original request appened */ if (err) payload += nlmsg_len(nlh); skb = nlmsg_new(payload, GFP_KERNEL); if (!skb) { struct sock *sk; sk = netlink_lookup(sock_net(in_skb->sk), in_skb->sk->sk_protocol, NETLINK_CB(in_skb).pid); if (sk) { sk->sk_err = ENOBUFS; sk->sk_error_report(sk); sock_put(sk); } return; } rep = __nlmsg_put(skb, NETLINK_CB(in_skb).pid, nlh->nlmsg_seq, NLMSG_ERROR, payload, 0); errmsg = nlmsg_data(rep); errmsg->error = err; memcpy(&errmsg->msg, nlh, err ? nlh->nlmsg_len : sizeof(*nlh)); netlink_unicast(in_skb->sk, skb, NETLINK_CB(in_skb).pid, MSG_DONTWAIT); }
16,943
115,854
0
void NavigationController::RendererDidNavigateInPage( const ViewHostMsg_FrameNavigate_Params& params, bool* did_replace_entry) { DCHECK(content::PageTransitionIsMainFrame(params.transition)) << "WebKit should only tell us about in-page navs for the main frame."; NavigationEntry* existing_entry = GetEntryWithPageID( tab_contents_->GetSiteInstance(), params.page_id); existing_entry->set_url(params.url); if (existing_entry->update_virtual_url_with_url()) UpdateVirtualURLToURL(existing_entry, params.url); *did_replace_entry = true; if (pending_entry_) DiscardNonCommittedEntriesInternal(); last_committed_entry_index_ = GetEntryIndexWithPageID(tab_contents_->GetSiteInstance(), params.page_id); }
16,944
21,732
0
static int em_btc(struct x86_emulate_ctxt *ctxt) { emulate_2op_SrcV_nobyte(ctxt, "btc"); return X86EMUL_CONTINUE; }
16,945
115,825
0
void InitResource(SafeBrowsingService::UnsafeResource* resource, bool is_subresource, const GURL& url) { resource->client = this; resource->url = url; resource->is_subresource = is_subresource; resource->threat_type = SafeBrowsingService::URL_MALWARE; resource->render_process_host_id = contents()->GetRenderProcessHost()-> GetID(); resource->render_view_id = contents()->render_view_host()->routing_id(); }
16,946
131,483
0
static void nameAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); v8SetReturnValueString(info, imp->getNameAttribute(), info.GetIsolate()); }
16,947
14,266
0
MYSQLND_METHOD(mysqlnd_conn_data, free_options)(MYSQLND_CONN_DATA * conn TSRMLS_DC) { zend_bool pers = conn->persistent; if (conn->options->charset_name) { mnd_pefree(conn->options->charset_name, pers); conn->options->charset_name = NULL; } if (conn->options->auth_protocol) { mnd_pefree(conn->options->auth_protocol, pers); conn->options->auth_protocol = NULL; } if (conn->options->num_commands) { unsigned int i; for (i = 0; i < conn->options->num_commands; i++) { /* allocated with pestrdup */ mnd_pefree(conn->options->init_commands[i], pers); } mnd_pefree(conn->options->init_commands, pers); conn->options->init_commands = NULL; } if (conn->options->cfg_file) { mnd_pefree(conn->options->cfg_file, pers); conn->options->cfg_file = NULL; } if (conn->options->cfg_section) { mnd_pefree(conn->options->cfg_section, pers); conn->options->cfg_section = NULL; } }
16,948
74,206
0
getnetnum( const char *num, sockaddr_u *addr, int complain, enum gnn_type a_type /* ignored */ ) { NTP_REQUIRE(AF_UNSPEC == AF(addr) || AF_INET == AF(addr) || AF_INET6 == AF(addr)); if (!is_ip_address(num, AF(addr), addr)) return 0; if (IS_IPV6(addr) && !ipv6_works) return -1; # ifdef ISC_PLATFORM_HAVESALEN addr->sa.sa_len = SIZEOF_SOCKADDR(AF(addr)); # endif SET_PORT(addr, NTP_PORT); DPRINTF(2, ("getnetnum given %s, got %s\n", num, stoa(addr))); return 1; }
16,949
20,849
0
static int kvm_vm_ioctl_set_identity_map_addr(struct kvm *kvm, u64 ident_addr) { kvm->arch.ept_identity_map_addr = ident_addr; return 0; }
16,950
26,944
0
handle_t *ext4_journal_start_sb(struct super_block *sb, int nblocks) { journal_t *journal; if (sb->s_flags & MS_RDONLY) return ERR_PTR(-EROFS); vfs_check_frozen(sb, SB_FREEZE_TRANS); /* Special case here: if the journal has aborted behind our * backs (eg. EIO in the commit thread), then we still need to * take the FS itself readonly cleanly. */ journal = EXT4_SB(sb)->s_journal; if (journal) { if (is_journal_aborted(journal)) { ext4_abort(sb, "Detected aborted journal"); return ERR_PTR(-EROFS); } return jbd2_journal_start(journal, nblocks); } return ext4_get_nojournal(); }
16,951
106,095
0
JSValue jsTestObjCONST_VALUE_12(ExecState* exec, JSValue, const Identifier&) { UNUSED_PARAM(exec); return jsNumber(static_cast<int>(0x01)); }
16,952
117,255
0
gfx::Size GLES2DecoderImpl::GetBoundReadFrameBufferSize() { FramebufferManager::FramebufferInfo* framebuffer = GetFramebufferInfoForTarget(GL_READ_FRAMEBUFFER); if (framebuffer != NULL) { const FramebufferManager::FramebufferInfo::Attachment* attachment = framebuffer->GetAttachment(GL_COLOR_ATTACHMENT0); if (attachment) { return gfx::Size(attachment->width(), attachment->height()); } return gfx::Size(0, 0); } else if (offscreen_target_frame_buffer_.get()) { return offscreen_size_; } else { return surface_->GetSize(); } }
16,953
15,886
0
void msix_set_pending(PCIDevice *dev, unsigned int vector) { *msix_pending_byte(dev, vector) |= msix_pending_mask(vector); }
16,954
82,387
0
void jsvDumpLockedVars() { jsvGarbageCollect(); if (isMemoryBusy) return; isMemoryBusy = MEMBUSY_SYSTEM; JsVarRef i; for (i=1;i<=jsVarsSize;i++) { JsVar *var = jsvGetAddressOf(i); if ((var->flags&JSV_VARTYPEMASK) != JSV_UNUSED) { // if it is not unused var->flags |= (JsVarFlags)JSV_GARBAGE_COLLECT; if (jsvIsFlatString(var)) i = (JsVarRef)(i+jsvGetFlatStringBlocks(var)); } } jsvGarbageCollectMarkUsed(execInfo.root); for (i=1;i<=jsVarsSize;i++) { JsVar *var = jsvGetAddressOf(i); if ((var->flags&JSV_VARTYPEMASK) != JSV_UNUSED) { if (var->flags & JSV_GARBAGE_COLLECT) { jsvGarbageCollectMarkUsed(var); jsvTrace(var, 0); } } } isMemoryBusy = MEM_NOT_BUSY; }
16,955
144,900
0
void RenderWidgetHostViewAura::ExtendSelectionAndDelete( size_t before, size_t after) { RenderFrameHostImpl* rfh = GetFocusedFrame(); if (rfh) rfh->ExtendSelectionAndDelete(before, after); }
16,956
73,113
0
static FxInfo **DestroyFxThreadSet(FxInfo **fx_info) { register ssize_t i; assert(fx_info != (FxInfo **) NULL); for (i=0; i < (ssize_t) GetMagickResourceLimit(ThreadResource); i++) if (fx_info[i] != (FxInfo *) NULL) fx_info[i]=DestroyFxInfo(fx_info[i]); fx_info=(FxInfo **) RelinquishMagickMemory(fx_info); return(fx_info); }
16,957
20,506
0
static loff_t ext4_max_size(int blkbits, int has_huge_files) { loff_t res; loff_t upper_limit = MAX_LFS_FILESIZE; /* small i_blocks in vfs inode? */ if (!has_huge_files || sizeof(blkcnt_t) < sizeof(u64)) { /* * CONFIG_LBDAF is not enabled implies the inode * i_block represent total blocks in 512 bytes * 32 == size of vfs inode i_blocks * 8 */ upper_limit = (1LL << 32) - 1; /* total blocks in file system block size */ upper_limit >>= (blkbits - 9); upper_limit <<= blkbits; } /* * 32-bit extent-start container, ee_block. We lower the maxbytes * by one fs block, so ee_len can cover the extent of maximum file * size */ res = (1LL << 32) - 1; res <<= blkbits; /* Sanity check against vm- & vfs- imposed limits */ if (res > upper_limit) res = upper_limit; return res; }
16,958
15,401
0
bdfReadFont(FontPtr pFont, FontFilePtr file, int bit, int byte, int glyph, int scan) { bdfFileState state; xCharInfo *min, *max; BitmapFontPtr bitmapFont; pFont->fontPrivate = 0; bzero(&state, sizeof(bdfFileState)); bdfFileLineNum = 0; if (!bdfReadHeader(file, &state)) goto BAILOUT; bitmapFont = calloc(1, sizeof(BitmapFontRec)); if (!bitmapFont) { bdfError("Couldn't allocate bitmapFontRec (%d)\n", (int) sizeof(BitmapFontRec)); goto BAILOUT; } pFont->fontPrivate = (pointer) bitmapFont; bitmapFont->metrics = 0; bitmapFont->ink_metrics = 0; bitmapFont->bitmaps = 0; bitmapFont->encoding = 0; bitmapFont->pDefault = NULL; bitmapFont->bitmapExtra = calloc(1, sizeof(BitmapExtraRec)); if (!bitmapFont->bitmapExtra) { bdfError("Couldn't allocate bitmapExtra (%d)\n", (int) sizeof(BitmapExtraRec)); goto BAILOUT; } bitmapFont->bitmapExtra->glyphNames = 0; bitmapFont->bitmapExtra->sWidths = 0; if (!bdfReadProperties(file, pFont, &state)) goto BAILOUT; if (!bdfReadCharacters(file, pFont, &state, bit, byte, glyph, scan)) goto BAILOUT; if (state.haveDefaultCh) { unsigned int r, c, cols; r = pFont->info.defaultCh >> 8; c = pFont->info.defaultCh & 0xFF; if (pFont->info.firstRow <= r && r <= pFont->info.lastRow && pFont->info.firstCol <= c && c <= pFont->info.lastCol) { cols = pFont->info.lastCol - pFont->info.firstCol + 1; r = r - pFont->info.firstRow; c = c - pFont->info.firstCol; bitmapFont->pDefault = ACCESSENCODING(bitmapFont->encoding, r * cols + c); } } pFont->bit = bit; pFont->byte = byte; pFont->glyph = glyph; pFont->scan = scan; pFont->info.anamorphic = FALSE; pFont->info.cachable = TRUE; bitmapComputeFontBounds(pFont); if (FontCouldBeTerminal(&pFont->info)) { bdfPadToTerminal(pFont); bitmapComputeFontBounds(pFont); } FontComputeInfoAccelerators(&pFont->info); if (bitmapFont->bitmapExtra) FontComputeInfoAccelerators(&bitmapFont->bitmapExtra->info); if (pFont->info.constantMetrics) { if (!bitmapAddInkMetrics(pFont)) { bdfError("Failed to add bitmap ink metrics\n"); goto BAILOUT; } } if (bitmapFont->bitmapExtra) bitmapFont->bitmapExtra->info.inkMetrics = pFont->info.inkMetrics; bitmapComputeFontInkBounds(pFont); /* ComputeFontAccelerators (pFont); */ /* generate properties */ min = &pFont->info.ink_minbounds; max = &pFont->info.ink_maxbounds; if (state.xHeightProp && (state.xHeightProp->value == -1)) state.xHeightProp->value = state.exHeight ? state.exHeight : min->ascent; if (state.quadWidthProp && (state.quadWidthProp->value == -1)) state.quadWidthProp->value = state.digitCount ? (INT32) (state.digitWidths / state.digitCount) : (min->characterWidth + max->characterWidth) / 2; if (state.weightProp && (state.weightProp->value == -1)) state.weightProp->value = bitmapComputeWeight(pFont); pFont->get_glyphs = bitmapGetGlyphs; pFont->get_metrics = bitmapGetMetrics; pFont->unload_font = bdfUnloadFont; pFont->unload_glyphs = NULL; return Successful; BAILOUT: if (pFont->fontPrivate) bdfFreeFontBits (pFont); return AllocError; }
16,959
152,678
0
bool HTMLFormControlElement::supportsFocus() const { return !isDisabledFormControl(); }
16,960
158,368
0
void RenderWidgetHostImpl::SetPageFocus(bool focused) { is_focused_ = focused; if (!focused) { if (IsMouseLocked()) view_->UnlockMouse(); if (IsKeyboardLocked()) UnlockKeyboard(); if (auto* touch_emulator = GetExistingTouchEmulator()) touch_emulator->CancelTouch(); } else if (keyboard_lock_allowed_) { LockKeyboard(); } GetWidgetInputHandler()->SetFocus(focused); if (RenderViewHost::From(this) && delegate_) delegate_->ReplicatePageFocus(focused); }
16,961
58,550
0
BOOL nla_verify_header(wStream* s) { if ((s->pointer[0] == 0x30) && (s->pointer[1] & 0x80)) return TRUE; return FALSE; }
16,962
170,211
0
void ComponentUpdaterPolicyTest::FinishDefaultPolicy_GroupPolicyNotSupported() { VerifyExpectations(!kUpdateDisabled); cur_test_case_ = std::make_pair( &ComponentUpdaterPolicyTest::EnabledPolicy_GroupPolicySupported, &ComponentUpdaterPolicyTest::FinishEnabledPolicy_GroupPolicySupported); CallAsync(cur_test_case_.first); }
16,963
168,551
0
static char* sanitize_path(const char* path) { const char root_prefix[] = "\\\\.\\"; size_t j, size, root_size; char* ret_path = NULL; size_t add_root = 0; if (path == NULL) return NULL; size = safe_strlen(path)+1; root_size = sizeof(root_prefix)-1; if (!((size > 3) && (((path[0] == '\\') && (path[1] == '\\') && (path[3] == '\\')) || ((path[0] == '#') && (path[1] == '#') && (path[3] == '#'))))) { add_root = root_size; size += add_root; } if ((ret_path = (char*) calloc(size, 1)) == NULL) return NULL; safe_strcpy(&ret_path[add_root], size-add_root, path); for (j=0; j<root_size; j++) ret_path[j] = root_prefix[j]; for(j=root_size; j<size; j++) { ret_path[j] = (char)toupper((int)ret_path[j]); // Fix case too if (ret_path[j] == '\\') ret_path[j] = '#'; } return ret_path; }
16,964
59,976
0
static int get_min_max_with_quirks(struct usb_mixer_elem_info *cval, int default_min, struct snd_kcontrol *kctl) { /* for failsafe */ cval->min = default_min; cval->max = cval->min + 1; cval->res = 1; cval->dBmin = cval->dBmax = 0; if (cval->val_type == USB_MIXER_BOOLEAN || cval->val_type == USB_MIXER_INV_BOOLEAN) { cval->initialized = 1; } else { int minchn = 0; if (cval->cmask) { int i; for (i = 0; i < MAX_CHANNELS; i++) if (cval->cmask & (1 << i)) { minchn = i + 1; break; } } if (get_ctl_value(cval, UAC_GET_MAX, (cval->control << 8) | minchn, &cval->max) < 0 || get_ctl_value(cval, UAC_GET_MIN, (cval->control << 8) | minchn, &cval->min) < 0) { usb_audio_err(cval->head.mixer->chip, "%d:%d: cannot get min/max values for control %d (id %d)\n", cval->head.id, snd_usb_ctrl_intf(cval->head.mixer->chip), cval->control, cval->head.id); return -EINVAL; } if (get_ctl_value(cval, UAC_GET_RES, (cval->control << 8) | minchn, &cval->res) < 0) { cval->res = 1; } else { int last_valid_res = cval->res; while (cval->res > 1) { if (snd_usb_mixer_set_ctl_value(cval, UAC_SET_RES, (cval->control << 8) | minchn, cval->res / 2) < 0) break; cval->res /= 2; } if (get_ctl_value(cval, UAC_GET_RES, (cval->control << 8) | minchn, &cval->res) < 0) cval->res = last_valid_res; } if (cval->res == 0) cval->res = 1; /* Additional checks for the proper resolution * * Some devices report smaller resolutions than actually * reacting. They don't return errors but simply clip * to the lower aligned value. */ if (cval->min + cval->res < cval->max) { int last_valid_res = cval->res; int saved, test, check; get_cur_mix_raw(cval, minchn, &saved); for (;;) { test = saved; if (test < cval->max) test += cval->res; else test -= cval->res; if (test < cval->min || test > cval->max || snd_usb_set_cur_mix_value(cval, minchn, 0, test) || get_cur_mix_raw(cval, minchn, &check)) { cval->res = last_valid_res; break; } if (test == check) break; cval->res *= 2; } snd_usb_set_cur_mix_value(cval, minchn, 0, saved); } cval->initialized = 1; } if (kctl) volume_control_quirks(cval, kctl); /* USB descriptions contain the dB scale in 1/256 dB unit * while ALSA TLV contains in 1/100 dB unit */ cval->dBmin = (convert_signed_value(cval, cval->min) * 100) / 256; cval->dBmax = (convert_signed_value(cval, cval->max) * 100) / 256; if (cval->dBmin > cval->dBmax) { /* something is wrong; assume it's either from/to 0dB */ if (cval->dBmin < 0) cval->dBmax = 0; else if (cval->dBmin > 0) cval->dBmin = 0; if (cval->dBmin > cval->dBmax) { /* totally crap, return an error */ return -EINVAL; } } return 0; }
16,965
83,695
0
int git_index_remove_directory(git_index *index, const char *dir, int stage) { git_buf pfx = GIT_BUF_INIT; int error = 0; size_t pos; git_index_entry *entry; if (!(error = git_buf_sets(&pfx, dir)) && !(error = git_path_to_dir(&pfx))) index_find(&pos, index, pfx.ptr, pfx.size, GIT_INDEX_STAGE_ANY); while (!error) { entry = git_vector_get(&index->entries, pos); if (!entry || git__prefixcmp(entry->path, pfx.ptr) != 0) break; if (GIT_IDXENTRY_STAGE(entry) != stage) { ++pos; continue; } error = index_remove_entry(index, pos); /* removed entry at 'pos' so we don't need to increment */ } git_buf_free(&pfx); return error; }
16,966
134,331
0
void TabStrip::FileSupported(const GURL& url, bool supported) { if (drop_info_.get() && drop_info_->url == url) drop_info_->file_supported = supported; }
16,967
177,064
0
status_t SoftAVC::resetPlugin() { mIsInFlush = false; mReceivedEOS = false; memset(mTimeStamps, 0, sizeof(mTimeStamps)); memset(mTimeStampsValid, 0, sizeof(mTimeStampsValid)); /* Initialize both start and end times */ gettimeofday(&mTimeStart, NULL); gettimeofday(&mTimeEnd, NULL); return OK; }
16,968
2,063
0
static void full_header_set_msg_serial(SpiceDataHeaderOpaque *header, uint64_t serial) { ((SpiceDataHeader *)header->data)->serial = serial; }
16,969
104,627
0
bool Extension::IdIsValid(const std::string& id) { if (id.size() != (kIdSize * 2)) return false; std::string temp = StringToLowerASCII(id); for (size_t i = 0; i < temp.size(); i++) if (temp[i] < 'a' || temp[i] > 'p') return false; return true; }
16,970
147,119
0
DEFINE_TRACE(DocumentLoader) { visitor->Trace(frame_); visitor->Trace(fetcher_); visitor->Trace(main_resource_); visitor->Trace(history_item_); visitor->Trace(writer_); visitor->Trace(subresource_filter_); visitor->Trace(document_load_timing_); visitor->Trace(application_cache_host_); visitor->Trace(content_security_policy_); RawResourceClient::Trace(visitor); }
16,971
59,002
0
HTStream *HTMLToC(HTPresentation *pres GCC_UNUSED, HTParentAnchor *anchor, HTStream *sink) { HTStructured *html; if (sink) (*sink->isa->put_string) (sink, "/* "); /* Before even title */ html = HTML_new(anchor, WWW_PLAINTEXT, sink); html->comment_start = "/* "; html->comment_end = " */\n"; /* Must start in col 1 for cpp */ if (!sink) HTML_put_string(html, html->comment_start); CTRACE((tfp, "HTMLToC calling CacheThru_new\n")); return CacheThru_new(anchor, SGML_new(&HTML_dtd, anchor, html)); }
16,972
12,345
0
SPL_METHOD(Array, count) { long count; spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(getThis() TSRMLS_CC); if (zend_parse_parameters_none() == FAILURE) { return; } spl_array_object_count_elements_helper(intern, &count TSRMLS_CC); RETURN_LONG(count); } /* }}} */ static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, int fname_len, int use_arg) /* {{{ */
16,973
80,173
0
GF_Err hmhd_Write(GF_Box *s, GF_BitStream *bs) { GF_Err e; GF_HintMediaHeaderBox *ptr = (GF_HintMediaHeaderBox *)s; e = gf_isom_full_box_write(s, bs); if (e) return e; gf_bs_write_u16(bs, ptr->maxPDUSize); gf_bs_write_u16(bs, ptr->avgPDUSize); gf_bs_write_u32(bs, ptr->maxBitrate); gf_bs_write_u32(bs, ptr->avgBitrate); gf_bs_write_u32(bs, ptr->slidingAverageBitrate); return GF_OK; }
16,974
10,447
0
static void megasas_frame_set_scsi_status(MegasasState *s, unsigned long frame, uint8_t v) { PCIDevice *pci = &s->parent_obj; stb_pci_dma(pci, frame + offsetof(struct mfi_frame_header, scsi_status), v); }
16,975
54,785
0
void snd_usbmidi_input_stop(struct list_head *p) { struct snd_usb_midi *umidi; unsigned int i, j; umidi = list_entry(p, struct snd_usb_midi, list); if (!umidi->input_running) return; for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) { struct snd_usb_midi_endpoint *ep = &umidi->endpoints[i]; if (ep->in) for (j = 0; j < INPUT_URBS; ++j) usb_kill_urb(ep->in->urbs[j]); } umidi->input_running = 0; }
16,976
41,709
0
static void free_sa_defrag_extent(struct new_sa_defrag_extent *new) { struct old_sa_defrag_extent *old, *tmp; if (!new) return; list_for_each_entry_safe(old, tmp, &new->head, list) { list_del(&old->list); kfree(old); } kfree(new); }
16,977
3,018
0
static uint64_t vga_mem_read(void *opaque, hwaddr addr, unsigned size) { VGACommonState *s = opaque; return vga_mem_readb(s, addr); }
16,978
32,612
0
static void tg3_mdio_config_5785(struct tg3 *tp) { u32 val; struct phy_device *phydev; phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; switch (phydev->drv->phy_id & phydev->drv->phy_id_mask) { case PHY_ID_BCM50610: case PHY_ID_BCM50610M: val = MAC_PHYCFG2_50610_LED_MODES; break; case PHY_ID_BCMAC131: val = MAC_PHYCFG2_AC131_LED_MODES; break; case PHY_ID_RTL8211C: val = MAC_PHYCFG2_RTL8211C_LED_MODES; break; case PHY_ID_RTL8201E: val = MAC_PHYCFG2_RTL8201E_LED_MODES; break; default: return; } if (phydev->interface != PHY_INTERFACE_MODE_RGMII) { tw32(MAC_PHYCFG2, val); val = tr32(MAC_PHYCFG1); val &= ~(MAC_PHYCFG1_RGMII_INT | MAC_PHYCFG1_RXCLK_TO_MASK | MAC_PHYCFG1_TXCLK_TO_MASK); val |= MAC_PHYCFG1_RXCLK_TIMEOUT | MAC_PHYCFG1_TXCLK_TIMEOUT; tw32(MAC_PHYCFG1, val); return; } if (!tg3_flag(tp, RGMII_INBAND_DISABLE)) val |= MAC_PHYCFG2_EMODE_MASK_MASK | MAC_PHYCFG2_FMODE_MASK_MASK | MAC_PHYCFG2_GMODE_MASK_MASK | MAC_PHYCFG2_ACT_MASK_MASK | MAC_PHYCFG2_QUAL_MASK_MASK | MAC_PHYCFG2_INBAND_ENABLE; tw32(MAC_PHYCFG2, val); val = tr32(MAC_PHYCFG1); val &= ~(MAC_PHYCFG1_RXCLK_TO_MASK | MAC_PHYCFG1_TXCLK_TO_MASK | MAC_PHYCFG1_RGMII_EXT_RX_DEC | MAC_PHYCFG1_RGMII_SND_STAT_EN); if (!tg3_flag(tp, RGMII_INBAND_DISABLE)) { if (tg3_flag(tp, RGMII_EXT_IBND_RX_EN)) val |= MAC_PHYCFG1_RGMII_EXT_RX_DEC; if (tg3_flag(tp, RGMII_EXT_IBND_TX_EN)) val |= MAC_PHYCFG1_RGMII_SND_STAT_EN; } val |= MAC_PHYCFG1_RXCLK_TIMEOUT | MAC_PHYCFG1_TXCLK_TIMEOUT | MAC_PHYCFG1_RGMII_INT | MAC_PHYCFG1_TXC_DRV; tw32(MAC_PHYCFG1, val); val = tr32(MAC_EXT_RGMII_MODE); val &= ~(MAC_RGMII_MODE_RX_INT_B | MAC_RGMII_MODE_RX_QUALITY | MAC_RGMII_MODE_RX_ACTIVITY | MAC_RGMII_MODE_RX_ENG_DET | MAC_RGMII_MODE_TX_ENABLE | MAC_RGMII_MODE_TX_LOWPWR | MAC_RGMII_MODE_TX_RESET); if (!tg3_flag(tp, RGMII_INBAND_DISABLE)) { if (tg3_flag(tp, RGMII_EXT_IBND_RX_EN)) val |= MAC_RGMII_MODE_RX_INT_B | MAC_RGMII_MODE_RX_QUALITY | MAC_RGMII_MODE_RX_ACTIVITY | MAC_RGMII_MODE_RX_ENG_DET; if (tg3_flag(tp, RGMII_EXT_IBND_TX_EN)) val |= MAC_RGMII_MODE_TX_ENABLE | MAC_RGMII_MODE_TX_LOWPWR | MAC_RGMII_MODE_TX_RESET; } tw32(MAC_EXT_RGMII_MODE, val); }
16,979
150,836
0
blink::mojom::WebBluetoothResult TranslateGATTErrorAndRecord( device::BluetoothRemoteGattService::GattErrorCode error_code, UMAGATTOperation operation) { switch (error_code) { case device::BluetoothRemoteGattService::GATT_ERROR_UNKNOWN: RecordGATTOperationOutcome(operation, UMAGATTOperationOutcome::UNKNOWN); return blink::mojom::WebBluetoothResult::GATT_UNKNOWN_ERROR; case device::BluetoothRemoteGattService::GATT_ERROR_FAILED: RecordGATTOperationOutcome(operation, UMAGATTOperationOutcome::FAILED); return blink::mojom::WebBluetoothResult::GATT_UNKNOWN_FAILURE; case device::BluetoothRemoteGattService::GATT_ERROR_IN_PROGRESS: RecordGATTOperationOutcome(operation, UMAGATTOperationOutcome::IN_PROGRESS); return blink::mojom::WebBluetoothResult::GATT_OPERATION_IN_PROGRESS; case device::BluetoothRemoteGattService::GATT_ERROR_INVALID_LENGTH: RecordGATTOperationOutcome(operation, UMAGATTOperationOutcome::INVALID_LENGTH); return blink::mojom::WebBluetoothResult::GATT_INVALID_ATTRIBUTE_LENGTH; case device::BluetoothRemoteGattService::GATT_ERROR_NOT_PERMITTED: RecordGATTOperationOutcome(operation, UMAGATTOperationOutcome::NOT_PERMITTED); return blink::mojom::WebBluetoothResult::GATT_NOT_PERMITTED; case device::BluetoothRemoteGattService::GATT_ERROR_NOT_AUTHORIZED: RecordGATTOperationOutcome(operation, UMAGATTOperationOutcome::NOT_AUTHORIZED); return blink::mojom::WebBluetoothResult::GATT_NOT_AUTHORIZED; case device::BluetoothRemoteGattService::GATT_ERROR_NOT_PAIRED: RecordGATTOperationOutcome(operation, UMAGATTOperationOutcome::NOT_PAIRED); return blink::mojom::WebBluetoothResult::GATT_NOT_PAIRED; case device::BluetoothRemoteGattService::GATT_ERROR_NOT_SUPPORTED: RecordGATTOperationOutcome(operation, UMAGATTOperationOutcome::NOT_SUPPORTED); return blink::mojom::WebBluetoothResult::GATT_NOT_SUPPORTED; } NOTREACHED(); return blink::mojom::WebBluetoothResult::GATT_UNTRANSLATED_ERROR_CODE; }
16,980
444
0
pdf_drop_cmap_imp(fz_context *ctx, fz_storable *cmap_) { pdf_cmap *cmap = (pdf_cmap *)cmap_; pdf_drop_cmap(ctx, cmap->usecmap); fz_free(ctx, cmap->ranges); fz_free(ctx, cmap->xranges); fz_free(ctx, cmap->mranges); fz_free(ctx, cmap->dict); fz_free(ctx, cmap->tree); fz_free(ctx, cmap); }
16,981
95,293
0
AcpiNsLocal ( ACPI_OBJECT_TYPE Type) { ACPI_FUNCTION_TRACE (NsLocal); if (!AcpiUtValidObjectType (Type)) { /* Type code out of range */ ACPI_WARNING ((AE_INFO, "Invalid Object Type 0x%X", Type)); return_UINT32 (ACPI_NS_NORMAL); } return_UINT32 (AcpiGbl_NsProperties[Type] & ACPI_NS_LOCAL); }
16,982
121,821
0
static ImageEventSender& beforeLoadEventSender() { DEFINE_STATIC_LOCAL(ImageEventSender, sender, (eventNames().beforeloadEvent)); return sender; }
16,983
45,370
0
tree_mod_log_search(struct btrfs_fs_info *fs_info, u64 start, u64 min_seq) { return __tree_mod_log_search(fs_info, start, min_seq, 0); }
16,984
71,092
0
cmsBool WriteOneMLUC(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, _cmsDICelem* e, cmsUInt32Number i, const cmsMLU* mlu, cmsUInt32Number BaseOffset) { cmsUInt32Number Before; if (mlu == NULL) { e ->Sizes[i] = 0; e ->Offsets[i] = 0; return TRUE; } Before = io ->Tell(io); e ->Offsets[i] = Before - BaseOffset; if (!Type_MLU_Write(self, io, (void*) mlu, 1)) return FALSE; e ->Sizes[i] = io ->Tell(io) - Before; return TRUE; }
16,985
149,022
0
static int btreeInvokeBusyHandler(void *pArg){ BtShared *pBt = (BtShared*)pArg; assert( pBt->db ); assert( sqlite3_mutex_held(pBt->db->mutex) ); return sqlite3InvokeBusyHandler(&pBt->db->busyHandler); }
16,986
39,642
0
int handle_early_requeue_pi_wakeup(struct futex_hash_bucket *hb, struct futex_q *q, union futex_key *key2, struct hrtimer_sleeper *timeout) { int ret = 0; /* * With the hb lock held, we avoid races while we process the wakeup. * We only need to hold hb (and not hb2) to ensure atomicity as the * wakeup code can't change q.key from uaddr to uaddr2 if we hold hb. * It can't be requeued from uaddr2 to something else since we don't * support a PI aware source futex for requeue. */ if (!match_futex(&q->key, key2)) { WARN_ON(q->lock_ptr && (&hb->lock != q->lock_ptr)); /* * We were woken prior to requeue by a timeout or a signal. * Unqueue the futex_q and determine which it was. */ plist_del(&q->list, &q->list.plist); /* Handle spurious wakeups gracefully */ ret = -EWOULDBLOCK; if (timeout && !timeout->task) ret = -ETIMEDOUT; else if (signal_pending(current)) ret = -ERESTARTNOINTR; } return ret; }
16,987
183,715
1
~OffScreenRootWindow() { if (!--refCount) { #if PLATFORM(QT) delete window; window = 0; #elif PLATFORM(EFL) XUnmapWindow(display, window); XDestroyWindow(display, window); #endif } }
16,988
126,250
0
void Browser::ToggleFullscreenModeForTab(WebContents* web_contents, bool enter_fullscreen) { fullscreen_controller_->ToggleFullscreenModeForTab(web_contents, enter_fullscreen); }
16,989
4,178
0
tt_cmap12_init( TT_CMap12 cmap, FT_Byte* table ) { cmap->cmap.data = table; table += 12; cmap->num_groups = FT_PEEK_ULONG( table ); cmap->valid = 0; return SFNT_Err_Ok; }
16,990
44,016
0
crm_buffer_add_char(char **buffer, int *offset, int *max, char c) { buffer_print(*buffer, *max, *offset, "%c", c); }
16,991
26,609
0
static void ip6_copy_metadata(struct sk_buff *to, struct sk_buff *from) { to->pkt_type = from->pkt_type; to->priority = from->priority; to->protocol = from->protocol; skb_dst_drop(to); skb_dst_set(to, dst_clone(skb_dst(from))); to->dev = from->dev; to->mark = from->mark; #ifdef CONFIG_NET_SCHED to->tc_index = from->tc_index; #endif nf_copy(to, from); #if defined(CONFIG_NETFILTER_XT_TARGET_TRACE) || \ defined(CONFIG_NETFILTER_XT_TARGET_TRACE_MODULE) to->nf_trace = from->nf_trace; #endif skb_copy_secmark(to, from); }
16,992
36,035
0
static void __udf_clear_extent_cache(struct inode *inode) { struct udf_inode_info *iinfo = UDF_I(inode); if (iinfo->cached_extent.lstart != -1) { brelse(iinfo->cached_extent.epos.bh); iinfo->cached_extent.lstart = -1; } }
16,993
19,845
0
static void nfs41_call_priv_sync_prepare(struct rpc_task *task, void *calldata) { rpc_task_set_priority(task, RPC_PRIORITY_PRIVILEGED); nfs41_call_sync_prepare(task, calldata); }
16,994
28,275
0
finish_realms() { int i; for (i = 0; i < kdc_numrealms; i++) { finish_realm(kdc_realmlist[i]); kdc_realmlist[i] = 0; } kdc_numrealms = 0; }
16,995
27,820
0
static int br_multicast_ipv4_rcv(struct net_bridge *br, struct net_bridge_port *port, struct sk_buff *skb) { struct sk_buff *skb2 = skb; struct iphdr *iph; struct igmphdr *ih; unsigned len; unsigned offset; int err; /* We treat OOM as packet loss for now. */ if (!pskb_may_pull(skb, sizeof(*iph))) return -EINVAL; iph = ip_hdr(skb); if (iph->ihl < 5 || iph->version != 4) return -EINVAL; if (!pskb_may_pull(skb, ip_hdrlen(skb))) return -EINVAL; iph = ip_hdr(skb); if (unlikely(ip_fast_csum((u8 *)iph, iph->ihl))) return -EINVAL; if (iph->protocol != IPPROTO_IGMP) return 0; len = ntohs(iph->tot_len); if (skb->len < len || len < ip_hdrlen(skb)) return -EINVAL; if (skb->len > len) { skb2 = skb_clone(skb, GFP_ATOMIC); if (!skb2) return -ENOMEM; err = pskb_trim_rcsum(skb2, len); if (err) goto err_out; } len -= ip_hdrlen(skb2); offset = skb_network_offset(skb2) + ip_hdrlen(skb2); __skb_pull(skb2, offset); skb_reset_transport_header(skb2); err = -EINVAL; if (!pskb_may_pull(skb2, sizeof(*ih))) goto out; switch (skb2->ip_summed) { case CHECKSUM_COMPLETE: if (!csum_fold(skb2->csum)) break; /* fall through */ case CHECKSUM_NONE: skb2->csum = 0; if (skb_checksum_complete(skb2)) goto out; } err = 0; BR_INPUT_SKB_CB(skb)->igmp = 1; ih = igmp_hdr(skb2); switch (ih->type) { case IGMP_HOST_MEMBERSHIP_REPORT: case IGMPV2_HOST_MEMBERSHIP_REPORT: BR_INPUT_SKB_CB(skb2)->mrouters_only = 1; err = br_ip4_multicast_add_group(br, port, ih->group); break; case IGMPV3_HOST_MEMBERSHIP_REPORT: err = br_ip4_multicast_igmp3_report(br, port, skb2); break; case IGMP_HOST_MEMBERSHIP_QUERY: err = br_ip4_multicast_query(br, port, skb2); break; case IGMP_HOST_LEAVE_MESSAGE: br_ip4_multicast_leave_group(br, port, ih->group); break; } out: __skb_push(skb2, offset); err_out: if (skb2 != skb) kfree_skb(skb2); return err; }
16,996
102,201
0
void SyncManager::TriggerOnIncomingNotificationForTest( const syncable::ModelTypeBitSet& model_types) { syncable::ModelTypePayloadMap model_types_with_payloads = syncable::ModelTypePayloadMapFromBitSet(model_types, std::string()); data_->OnIncomingNotification(model_types_with_payloads); }
16,997
178,766
1
int hugetlb_reserve_pages(struct inode *inode, long from, long to, struct vm_area_struct *vma, vm_flags_t vm_flags) { long ret, chg; struct hstate *h = hstate_inode(inode); struct hugepage_subpool *spool = subpool_inode(inode); /* * Only apply hugepage reservation if asked. At fault time, an * attempt will be made for VM_NORESERVE to allocate a page * without using reserves */ if (vm_flags & VM_NORESERVE) return 0; /* * Shared mappings base their reservation on the number of pages that * are already allocated on behalf of the file. Private mappings need * to reserve the full area even if read-only as mprotect() may be * called to make the mapping read-write. Assume !vma is a shm mapping */ if (!vma || vma->vm_flags & VM_MAYSHARE) chg = region_chg(&inode->i_mapping->private_list, from, to); else { struct resv_map *resv_map = resv_map_alloc(); if (!resv_map) return -ENOMEM; chg = to - from; set_vma_resv_map(vma, resv_map); set_vma_resv_flags(vma, HPAGE_RESV_OWNER); } if (chg < 0) return chg; /* There must be enough pages in the subpool for the mapping */ if (hugepage_subpool_get_pages(spool, chg)) return -ENOSPC; /* * Check enough hugepages are available for the reservation. * Hand the pages back to the subpool if there are not */ ret = hugetlb_acct_memory(h, chg); if (ret < 0) { hugepage_subpool_put_pages(spool, chg); return ret; } /* * Account for the reservations made. Shared mappings record regions * that have reservations as they are shared by multiple VMAs. * When the last VMA disappears, the region map says how much * the reservation was and the page cache tells how much of * the reservation was consumed. Private mappings are per-VMA and * only the consumed reservations are tracked. When the VMA * disappears, the original reservation is the VMA size and the * consumed reservations are stored in the map. Hence, nothing * else has to be done for private mappings here */ if (!vma || vma->vm_flags & VM_MAYSHARE) region_add(&inode->i_mapping->private_list, from, to); return 0; }
16,998
15,667
0
static void ssi_sd_save(QEMUFile *f, void *opaque) { SSISlave *ss = SSI_SLAVE(opaque); ssi_sd_state *s = (ssi_sd_state *)opaque; int i; qemu_put_be32(f, s->mode); qemu_put_be32(f, s->cmd); for (i = 0; i < 4; i++) qemu_put_be32(f, s->cmdarg[i]); for (i = 0; i < 5; i++) qemu_put_be32(f, s->response[i]); qemu_put_be32(f, s->arglen); qemu_put_be32(f, s->response_pos); qemu_put_be32(f, s->stopping); qemu_put_be32(f, ss->cs); }
16,999