idx
int64 | func
string | target
int64 |
|---|---|---|
118,975
|
static __poll_t hci_uart_tty_poll(struct tty_struct *tty,
struct file *filp, poll_table *wait)
{
return 0;
}
| 0
|
432,800
|
next_trim (void *nxdata, uint32_t count, uint64_t offset, uint32_t flags,
int *err)
{
struct b_conn *b_conn = nxdata;
return backend_trim (b_conn->b, b_conn->conn, count, offset, flags, err);
}
| 0
|
513,514
|
reexec_in_user_namespace (int ready, char *pause_pid_file_path, char *file_to_read, int outputfd)
{
int ret;
pid_t pid;
char b;
pid_t ppid = getpid ();
char **argv;
char uid[16];
char gid[16];
char *listen_fds = NULL;
char *listen_pid = NULL;
bool do_socket_activation = false;
char *cwd = getcwd (NULL, 0);
sigset_t sigset, oldsigset;
if (cwd == NULL)
{
fprintf (stderr, "error getting current working directory: %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
listen_pid = getenv("LISTEN_PID");
listen_fds = getenv("LISTEN_FDS");
if (listen_pid != NULL && listen_fds != NULL)
{
if (strtol(listen_pid, NULL, 10) == getpid())
do_socket_activation = true;
}
sprintf (uid, "%d", geteuid ());
sprintf (gid, "%d", getegid ());
pid = syscall_clone (CLONE_NEWUSER|CLONE_NEWNS|SIGCHLD, NULL);
if (pid < 0)
{
fprintf (stderr, "cannot clone: %s\n", strerror (errno));
check_proc_sys_userns_file (_max_user_namespaces);
check_proc_sys_userns_file (_unprivileged_user_namespaces);
}
if (pid)
{
if (do_socket_activation)
{
long num_fds;
num_fds = strtol (listen_fds, NULL, 10);
if (num_fds != LONG_MIN && num_fds != LONG_MAX)
{
int f;
for (f = 3; f < num_fds + 3; f++)
if (open_files_set == NULL || FD_ISSET (f % FD_SETSIZE, &(open_files_set[f / FD_SETSIZE])))
close (f);
}
unsetenv ("LISTEN_PID");
unsetenv ("LISTEN_FDS");
unsetenv ("LISTEN_FDNAMES");
}
return pid;
}
if (sigfillset (&sigset) < 0)
{
fprintf (stderr, "cannot fill sigset: %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
if (sigdelset (&sigset, SIGCHLD) < 0)
{
fprintf (stderr, "cannot sigdelset(SIGCHLD): %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
if (sigdelset (&sigset, SIGTERM) < 0)
{
fprintf (stderr, "cannot sigdelset(SIGTERM): %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
if (sigprocmask (SIG_BLOCK, &sigset, &oldsigset) < 0)
{
fprintf (stderr, "cannot block signals: %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
argv = get_cmd_line_args (ppid);
if (argv == NULL)
{
fprintf (stderr, "cannot read argv: %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
if (do_socket_activation)
{
char s[32];
sprintf (s, "%d", getpid());
setenv ("LISTEN_PID", s, true);
}
setenv ("_CONTAINERS_USERNS_CONFIGURED", "init", 1);
setenv ("_CONTAINERS_ROOTLESS_UID", uid, 1);
setenv ("_CONTAINERS_ROOTLESS_GID", gid, 1);
ret = TEMP_FAILURE_RETRY (read (ready, &b, 1));
if (ret < 0)
{
fprintf (stderr, "cannot read from sync pipe: %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
if (b != '0')
_exit (EXIT_FAILURE);
if (syscall_setresgid (0, 0, 0) < 0)
{
fprintf (stderr, "cannot setresgid: %s\n", strerror (errno));
TEMP_FAILURE_RETRY (write (ready, "1", 1));
_exit (EXIT_FAILURE);
}
if (syscall_setresuid (0, 0, 0) < 0)
{
fprintf (stderr, "cannot setresuid: %s\n", strerror (errno));
TEMP_FAILURE_RETRY (write (ready, "1", 1));
_exit (EXIT_FAILURE);
}
if (chdir (cwd) < 0)
{
fprintf (stderr, "cannot chdir: %s\n", strerror (errno));
TEMP_FAILURE_RETRY (write (ready, "1", 1));
_exit (EXIT_FAILURE);
}
free (cwd);
if (pause_pid_file_path && pause_pid_file_path[0] != '\0')
{
if (create_pause_process (pause_pid_file_path, argv) < 0)
{
TEMP_FAILURE_RETRY (write (ready, "2", 1));
_exit (EXIT_FAILURE);
}
}
ret = TEMP_FAILURE_RETRY (write (ready, "0", 1));
if (ret < 0)
{
fprintf (stderr, "cannot write to ready pipe: %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
close (ready);
if (sigprocmask (SIG_SETMASK, &oldsigset, NULL) < 0)
{
fprintf (stderr, "cannot block signals: %s\n", strerror (errno));
_exit (EXIT_FAILURE);
}
if (file_to_read && file_to_read[0])
{
ret = copy_file_to_fd (file_to_read, outputfd);
close (outputfd);
_exit (ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
execvp (argv[0], argv);
_exit (EXIT_FAILURE);
}
| 0
|
109,669
|
void ksz9131DisableIrq(NetInterface *interface)
{
//Disable PHY transceiver interrupts
if(interface->extIntDriver != NULL)
{
interface->extIntDriver->disableIrq();
}
}
| 0
|
318,648
|
static int lag_decode_zero_run_line(LagarithContext *l, uint8_t *dst,
const uint8_t *src, const uint8_t *src_end,
int width, int esc_count)
{
int i = 0;
int count;
uint8_t zero_run = 0;
const uint8_t *src_start = src;
uint8_t mask1 = -(esc_count < 2);
uint8_t mask2 = -(esc_count < 3);
uint8_t *end = dst + (width - 2);
output_zeros:
if (l->zeros_rem) {
count = FFMIN(l->zeros_rem, width - i);
if (end - dst < count) {
av_log(l->avctx, AV_LOG_ERROR, "Too many zeros remaining.\n");
return AVERROR_INVALIDDATA;
}
memset(dst, 0, count);
l->zeros_rem -= count;
dst += count;
}
while (dst < end) {
i = 0;
while (!zero_run && dst + i < end) {
i++;
if (i+2 >= src_end - src)
return AVERROR_INVALIDDATA;
zero_run =
!(src[i] | (src[i + 1] & mask1) | (src[i + 2] & mask2));
}
if (zero_run) {
zero_run = 0;
i += esc_count;
memcpy(dst, src, i);
dst += i;
l->zeros_rem = lag_calc_zero_run(src[i]);
src += i + 1;
goto output_zeros;
} else {
memcpy(dst, src, i);
src += i;
dst += i;
}
}
return src - src_start;
}
| 1
|
165,002
|
static void lsi_memcpy(LSIState *s, uint32_t dest, uint32_t src, int count)
{
int n;
uint8_t buf[LSI_BUF_SIZE];
trace_lsi_memcpy(dest, src, count);
while (count) {
n = (count > LSI_BUF_SIZE) ? LSI_BUF_SIZE : count;
lsi_mem_read(s, src, buf, n);
lsi_mem_write(s, dest, buf, n);
src += n;
dest += n;
count -= n;
}
}
| 0
|
2,468
|
static struct sk_buff *xfrm_state_netlink(struct sk_buff *in_skb,
struct xfrm_state *x, u32 seq)
{
struct xfrm_dump_info info;
struct sk_buff *skb;
skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC);
if (!skb)
return ERR_PTR(-ENOMEM);
info.in_skb = in_skb;
info.out_skb = skb;
info.nlmsg_seq = seq;
info.nlmsg_flags = 0;
if (dump_one_state(x, 0, &info)) {
kfree_skb(skb);
return NULL;
}
return skb;
}
| 1
|
199,698
|
void GLES2DecoderImpl::DoRenderbufferStorageMultisampleCHROMIUM(
GLenum target, GLsizei samples, GLenum internalformat,
GLsizei width, GLsizei height) {
Renderbuffer* renderbuffer = GetRenderbufferInfoForTarget(GL_RENDERBUFFER);
if (!renderbuffer) {
LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION,
"glRenderbufferStorageMultisampleCHROMIUM",
"no renderbuffer bound");
return;
}
if (!ValidateRenderbufferStorageMultisample(
samples, internalformat, width, height)) {
return;
}
GLenum impl_format =
renderbuffer_manager()->InternalRenderbufferFormatToImplFormat(
internalformat);
LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(
"glRenderbufferStorageMultisampleCHROMIUM");
RenderbufferStorageMultisampleWithWorkaround(target, samples, impl_format,
width, height, kDoNotForce);
GLenum error =
LOCAL_PEEK_GL_ERROR("glRenderbufferStorageMultisampleCHROMIUM");
if (error == GL_NO_ERROR) {
if (workarounds().validate_multisample_buffer_allocation) {
if (!VerifyMultisampleRenderbufferIntegrity(
renderbuffer->service_id(), impl_format)) {
LOCAL_SET_GL_ERROR(
GL_OUT_OF_MEMORY,
"glRenderbufferStorageMultisampleCHROMIUM", "out of memory");
return;
}
}
renderbuffer_manager()->SetInfoAndInvalidate(renderbuffer, samples,
internalformat, width, height);
}
}
| 0
|
163,152
|
void Browser::SelectNextTab() {
UserMetrics::RecordAction(UserMetricsAction("SelectNextTab"));
tab_handler_->GetTabStripModel()->SelectNextTab();
}
| 0
|
298,919
|
static void scrub_free_parity(struct scrub_parity *sparity)
{
struct scrub_ctx *sctx = sparity->sctx;
struct scrub_page *curr, *next;
int nbits;
nbits = bitmap_weight(sparity->ebitmap, sparity->nsectors);
if (nbits) {
spin_lock(&sctx->stat_lock);
sctx->stat.read_errors += nbits;
sctx->stat.uncorrectable_errors += nbits;
spin_unlock(&sctx->stat_lock);
}
list_for_each_entry_safe(curr, next, &sparity->spages, list) {
list_del_init(&curr->list);
scrub_page_put(curr);
}
kfree(sparity);
}
| 0
|
73,407
|
PHP_FUNCTION(imagesetbrush)
{
zval *IM, *TILE;
gdImagePtr im, tile;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr", &IM, &TILE) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, "Image", le_gd);
ZEND_FETCH_RESOURCE(tile, gdImagePtr, &TILE, -1, "Image", le_gd);
gdImageSetBrush(im, tile);
RETURN_TRUE;
}
| 0
|
246,715
|
HTMLImportLoader* Document::ImportLoader() const {
if (!imports_controller_)
return 0;
return imports_controller_->LoaderFor(*this);
}
| 0
|
357,739
|
static struct sock *sk_prot_alloc(struct proto *prot, gfp_t priority,
int family)
{
struct sock *sk;
struct kmem_cache *slab;
slab = prot->slab;
if (slab != NULL)
sk = kmem_cache_alloc(slab, priority);
else
sk = kmalloc(prot->obj_size, priority);
if (sk != NULL) {
if (security_sk_alloc(sk, family, priority))
goto out_free;
if (!try_module_get(prot->owner))
goto out_free_sec;
}
return sk;
out_free_sec:
security_sk_free(sk);
out_free:
if (slab != NULL)
kmem_cache_free(slab, sk);
else
kfree(sk);
return NULL;
}
| 0
|
247,402
|
SProcRenderSetPictureFilter (ClientPtr client)
{
register int n;
REQUEST (xRenderSetPictureFilterReq);
REQUEST_AT_LEAST_SIZE (xRenderSetPictureFilterReq);
swaps(&stuff->length, n);
swapl(&stuff->picture, n);
swaps(&stuff->nbytes, n);
return (*ProcRenderVector[stuff->renderReqType]) (client);
}
| 0
|
193,941
|
static void set_load_weight(struct task_struct *p)
{
int prio = p->static_prio - MAX_RT_PRIO;
struct load_weight *load = &p->se.load;
/*
* SCHED_IDLE tasks get minimal weight:
*/
if (idle_policy(p->policy)) {
load->weight = scale_load(WEIGHT_IDLEPRIO);
load->inv_weight = WMULT_IDLEPRIO;
return;
}
load->weight = scale_load(sched_prio_to_weight[prio]);
load->inv_weight = sched_prio_to_wmult[prio];
}
| 0
|
359,788
|
utils_mac_valid (const struct ether_addr *addr)
{
guint8 invalid1[ETH_ALEN] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
guint8 invalid2[ETH_ALEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
guint8 invalid3[ETH_ALEN] = {0x44, 0x44, 0x44, 0x44, 0x44, 0x44};
guint8 invalid4[ETH_ALEN] = {0x00, 0x30, 0xb4, 0x00, 0x00, 0x00}; /* prism54 dummy MAC */
g_return_val_if_fail (addr != NULL, FALSE);
/* Compare the AP address the card has with invalid ethernet MAC addresses. */
if (!memcmp (addr->ether_addr_octet, &invalid1, ETH_ALEN))
return FALSE;
if (!memcmp (addr->ether_addr_octet, &invalid2, ETH_ALEN))
return FALSE;
if (!memcmp (addr->ether_addr_octet, &invalid3, ETH_ALEN))
return FALSE;
if (!memcmp (addr->ether_addr_octet, &invalid4, ETH_ALEN))
return FALSE;
if (addr->ether_addr_octet[0] & 1) /* Multicast addresses */
return FALSE;
return TRUE;
}
| 0
|
175,303
|
ExtensionFunctionDispatcher::ExtensionFunctionDispatcher(Profile* profile,
Delegate* delegate)
: profile_(profile),
delegate_(delegate) {
}
| 0
|
90,415
|
static OPJ_BOOL opj_j2k_write_mct_record(opj_j2k_t *p_j2k,
opj_mct_data_t * p_mct_record,
struct opj_stream_private *p_stream,
struct opj_event_mgr * p_manager)
{
OPJ_UINT32 l_mct_size;
OPJ_BYTE * l_current_data = 00;
OPJ_UINT32 l_tmp;
/* preconditions */
assert(p_j2k != 00);
assert(p_manager != 00);
assert(p_stream != 00);
l_mct_size = 10 + p_mct_record->m_data_size;
if (l_mct_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size) {
OPJ_BYTE *new_header_tile_data = (OPJ_BYTE *) opj_realloc(
p_j2k->m_specific_param.m_encoder.m_header_tile_data, l_mct_size);
if (! new_header_tile_data) {
opj_free(p_j2k->m_specific_param.m_encoder.m_header_tile_data);
p_j2k->m_specific_param.m_encoder.m_header_tile_data = NULL;
p_j2k->m_specific_param.m_encoder.m_header_tile_data_size = 0;
opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to write MCT marker\n");
return OPJ_FALSE;
}
p_j2k->m_specific_param.m_encoder.m_header_tile_data = new_header_tile_data;
p_j2k->m_specific_param.m_encoder.m_header_tile_data_size = l_mct_size;
}
l_current_data = p_j2k->m_specific_param.m_encoder.m_header_tile_data;
opj_write_bytes(l_current_data, J2K_MS_MCT,
2); /* MCT */
l_current_data += 2;
opj_write_bytes(l_current_data, l_mct_size - 2,
2); /* Lmct */
l_current_data += 2;
opj_write_bytes(l_current_data, 0,
2); /* Zmct */
l_current_data += 2;
/* only one marker atm */
l_tmp = (p_mct_record->m_index & 0xff) | (p_mct_record->m_array_type << 8) |
(p_mct_record->m_element_type << 10);
opj_write_bytes(l_current_data, l_tmp, 2);
l_current_data += 2;
opj_write_bytes(l_current_data, 0,
2); /* Ymct */
l_current_data += 2;
memcpy(l_current_data, p_mct_record->m_data, p_mct_record->m_data_size);
if (opj_stream_write_data(p_stream,
p_j2k->m_specific_param.m_encoder.m_header_tile_data, l_mct_size,
p_manager) != l_mct_size) {
return OPJ_FALSE;
}
return OPJ_TRUE;
}
| 0
|
338,207
|
static int pci_add_option_rom(PCIDevice *pdev, bool is_default_rom)
{
int size;
char *path;
void *ptr;
char name[32];
const VMStateDescription *vmsd;
if (!pdev->romfile)
return 0;
if (strlen(pdev->romfile) == 0)
return 0;
if (!pdev->rom_bar) {
/*
* Load rom via fw_cfg instead of creating a rom bar,
* for 0.11 compatibility.
*/
int class = pci_get_word(pdev->config + PCI_CLASS_DEVICE);
if (class == 0x0300) {
rom_add_vga(pdev->romfile);
} else {
rom_add_option(pdev->romfile, -1);
}
return 0;
}
path = qemu_find_file(QEMU_FILE_TYPE_BIOS, pdev->romfile);
if (path == NULL) {
path = g_strdup(pdev->romfile);
}
size = get_image_size(path);
if (size < 0) {
error_report("%s: failed to find romfile \"%s\"",
__FUNCTION__, pdev->romfile);
g_free(path);
return -1;
}
if (size & (size - 1)) {
size = 1 << qemu_fls(size);
}
vmsd = qdev_get_vmsd(DEVICE(pdev));
if (vmsd) {
snprintf(name, sizeof(name), "%s.rom", vmsd->name);
} else {
snprintf(name, sizeof(name), "%s.rom", object_get_typename(OBJECT(pdev)));
}
pdev->has_rom = true;
memory_region_init_ram(&pdev->rom, name, size);
vmstate_register_ram(&pdev->rom, &pdev->qdev);
ptr = memory_region_get_ram_ptr(&pdev->rom);
load_image(path, ptr);
g_free(path);
if (is_default_rom) {
/* Only the default rom images will be patched (if needed). */
pci_patch_ids(pdev, ptr, size);
}
qemu_put_ram_ptr(ptr);
pci_register_bar(pdev, PCI_ROM_SLOT, 0, &pdev->rom);
return 0;
}
| 0
|
303,648
|
Variant HHVM_FUNCTION(imagecreatetruecolor, int64_t width, int64_t height) {
gdImagePtr im;
if (width <= 0 || height <= 0 || width >= INT_MAX || height >= INT_MAX) {
raise_warning("Invalid image dimensions");
return false;
}
im = gdImageCreateTrueColor(width, height);
if (!im) {
return false;
}
return Variant(req::make<Image>(im));
}
| 0
|
246,740
|
void RenderBlock::layoutRunsAndFloatsInRange(LineLayoutState& layoutState, InlineBidiResolver& resolver, const InlineIterator& cleanLineStart, const BidiStatus& cleanLineBidiStatus, unsigned consecutiveHyphenatedLines)
{
RenderStyle* styleToUse = style();
bool paginated = view()->layoutState() && view()->layoutState()->isPaginated();
LineMidpointState& lineMidpointState = resolver.midpointState();
InlineIterator end = resolver.position();
bool checkForEndLineMatch = layoutState.endLine();
RenderTextInfo renderTextInfo;
VerticalPositionCache verticalPositionCache;
LineBreaker lineBreaker(this);
LayoutUnit absoluteLogicalTop;
ShapeInsideInfo* shapeInsideInfo = layoutShapeInsideInfo();
if (shapeInsideInfo) {
ASSERT(shapeInsideInfo->owner() == this || allowsShapeInsideInfoSharing());
if (shapeInsideInfo != this->shapeInsideInfo()) {
absoluteLogicalTop = logicalTop();
}
if (logicalHeight() + absoluteLogicalTop < shapeInsideInfo->shapeLogicalTop()) {
LayoutUnit logicalHeight = shapeInsideInfo->shapeLogicalTop() - absoluteLogicalTop;
if (layoutState.flowThread())
logicalHeight -= shapeInsideInfo->owner()->borderAndPaddingBefore();
setLogicalHeight(logicalHeight);
}
}
while (!end.atEnd()) {
if (checkForEndLineMatch) {
layoutState.setEndLineMatched(matchedEndLine(layoutState, resolver, cleanLineStart, cleanLineBidiStatus));
if (layoutState.endLineMatched()) {
resolver.setPosition(InlineIterator(resolver.position().root(), 0, 0), 0);
break;
}
}
lineMidpointState.reset();
layoutState.lineInfo().setEmpty(true);
layoutState.lineInfo().resetRunsFromLeadingWhitespace();
const InlineIterator oldEnd = end;
bool isNewUBAParagraph = layoutState.lineInfo().previousLineBrokeCleanly();
FloatingObject* lastFloatFromPreviousLine = (containsFloats()) ? m_floatingObjects->set().last() : 0;
updateShapeAndSegmentsForCurrentLine(shapeInsideInfo, absoluteLogicalTop, layoutState);
WordMeasurements wordMeasurements;
end = lineBreaker.nextLineBreak(resolver, layoutState.lineInfo(), renderTextInfo, lastFloatFromPreviousLine, consecutiveHyphenatedLines, wordMeasurements);
renderTextInfo.m_lineBreakIterator.resetPriorContext();
if (resolver.position().atEnd()) {
resolver.runs().deleteRuns();
resolver.markCurrentRunEmpty(); // FIXME: This can probably be replaced by an ASSERT (or just removed).
layoutState.setCheckForFloatsFromLastLine(true);
resolver.setPosition(InlineIterator(resolver.position().root(), 0, 0), 0);
break;
}
if (adjustLogicalLineTopAndLogicalHeightIfNeeded(shapeInsideInfo, absoluteLogicalTop, layoutState, resolver, lastFloatFromPreviousLine, end, wordMeasurements))
continue;
ASSERT(end != resolver.position());
if (layoutState.lineInfo().isEmpty()) {
if (lastRootBox())
lastRootBox()->setLineBreakInfo(end.m_obj, end.m_pos, resolver.status());
} else {
VisualDirectionOverride override = (styleToUse->rtlOrdering() == VisualOrder ? (styleToUse->direction() == LTR ? VisualLeftToRightOverride : VisualRightToLeftOverride) : NoVisualOverride);
if (isNewUBAParagraph && styleToUse->unicodeBidi() == Plaintext && !resolver.context()->parent()) {
TextDirection direction = determinePlaintextDirectionality(resolver.position().root(), resolver.position().object(), resolver.position().offset());
resolver.setStatus(BidiStatus(direction, isOverride(styleToUse->unicodeBidi())));
}
BidiRunList<BidiRun>& bidiRuns = resolver.runs();
constructBidiRunsForLine(this, resolver, bidiRuns, end, override, layoutState.lineInfo().previousLineBrokeCleanly());
ASSERT(resolver.position() == end);
BidiRun* trailingSpaceRun = !layoutState.lineInfo().previousLineBrokeCleanly() ? handleTrailingSpaces(bidiRuns, resolver.context()) : 0;
if (bidiRuns.runCount() && lineBreaker.lineWasHyphenated()) {
bidiRuns.logicallyLastRun()->m_hasHyphen = true;
consecutiveHyphenatedLines++;
} else
consecutiveHyphenatedLines = 0;
LayoutUnit oldLogicalHeight = logicalHeight();
RootInlineBox* lineBox = createLineBoxesFromBidiRuns(resolver.status().context->level(), bidiRuns, end, layoutState.lineInfo(), verticalPositionCache, trailingSpaceRun, wordMeasurements);
bidiRuns.deleteRuns();
resolver.markCurrentRunEmpty(); // FIXME: This can probably be replaced by an ASSERT (or just removed).
if (lineBox) {
lineBox->setLineBreakInfo(end.m_obj, end.m_pos, resolver.status());
if (layoutState.usesRepaintBounds())
layoutState.updateRepaintRangeFromBox(lineBox);
if (paginated) {
LayoutUnit adjustment = 0;
adjustLinePositionForPagination(lineBox, adjustment, layoutState.flowThread());
if (adjustment) {
LayoutUnit oldLineWidth = availableLogicalWidthForLine(oldLogicalHeight, layoutState.lineInfo().isFirstLine());
lineBox->adjustBlockDirectionPosition(adjustment);
if (layoutState.usesRepaintBounds())
layoutState.updateRepaintRangeFromBox(lineBox);
if (availableLogicalWidthForLine(oldLogicalHeight + adjustment, layoutState.lineInfo().isFirstLine()) != oldLineWidth) {
lineBox->deleteLine();
end = restartLayoutRunsAndFloatsInRange(oldLogicalHeight, oldLogicalHeight + adjustment, lastFloatFromPreviousLine, resolver, oldEnd);
continue;
}
setLogicalHeight(lineBox->lineBottomWithLeading());
}
if (layoutState.flowThread())
lineBox->setContainingRegion(regionAtBlockOffset(lineBox->lineTopWithLeading()));
}
}
}
for (size_t i = 0; i < lineBreaker.positionedObjects().size(); ++i)
setStaticPositions(this, lineBreaker.positionedObjects()[i]);
if (!layoutState.lineInfo().isEmpty()) {
layoutState.lineInfo().setFirstLine(false);
newLine(lineBreaker.clear());
}
if (m_floatingObjects && lastRootBox()) {
const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
FloatingObjectSetIterator it = floatingObjectSet.begin();
FloatingObjectSetIterator end = floatingObjectSet.end();
if (layoutState.lastFloat()) {
FloatingObjectSetIterator lastFloatIterator = floatingObjectSet.find(layoutState.lastFloat());
ASSERT(lastFloatIterator != end);
++lastFloatIterator;
it = lastFloatIterator;
}
for (; it != end; ++it) {
FloatingObject* f = *it;
appendFloatingObjectToLastLine(f);
ASSERT(f->renderer() == layoutState.floats()[layoutState.floatIndex()].object);
if (layoutState.floats()[layoutState.floatIndex()].rect != f->frameRect())
checkForEndLineMatch = false;
layoutState.setFloatIndex(layoutState.floatIndex() + 1);
}
layoutState.setLastFloat(!floatingObjectSet.isEmpty() ? floatingObjectSet.last() : 0);
}
lineMidpointState.reset();
resolver.setPosition(end, numberOfIsolateAncestors(end));
}
if (paginated && !style()->hasAutoWidows()) {
RootInlineBox* lineBox = lastRootBox();
RootInlineBox* firstLineInBlock = firstRootBox();
int numLinesHanging = 1;
while (lineBox && lineBox != firstLineInBlock && !lineBox->isFirstAfterPageBreak()) {
++numLinesHanging;
lineBox = lineBox->prevRootBox();
}
if (!lineBox || !lineBox->isFirstAfterPageBreak() || lineBox == firstLineInBlock)
return;
if (numLinesHanging < style()->widows()) {
int numLinesNeeded = style()->widows() - numLinesHanging;
RootInlineBox* currentFirstLineOfNewPage = lineBox;
lineBox = lineBox->prevRootBox();
int numLinesInPreviousPage = 1;
while (lineBox && lineBox != firstLineInBlock && !lineBox->isFirstAfterPageBreak()) {
++numLinesInPreviousPage;
lineBox = lineBox->prevRootBox();
}
int orphans = style()->hasAutoOrphans() ? style()->initialOrphans() : style()->orphans();
int numLinesAvailable = numLinesInPreviousPage - orphans;
if (numLinesAvailable <= 0)
return;
int numLinesToTake = min(numLinesAvailable, numLinesNeeded);
lineBox = currentFirstLineOfNewPage;
for (int i = 0; i < numLinesToTake; ++i)
lineBox = lineBox->prevRootBox();
setBreakAtLineToAvoidWidow(lineBox);
markLinesDirtyInBlockRange(lastRootBox()->lineBottomWithLeading(), lineBox->lineBottomWithLeading(), lineBox);
}
}
}
| 0
|
415,750
|
static char *find_line(char *buf_start, char *buf_end, char *name,
char *net_type, char *net_link, char *net_dev,
bool *owner, bool *found, bool *keep)
{
char *end_of_line, *end_of_word, *line;
while (buf_start < buf_end) {
size_t len;
char netdev_name[IFNAMSIZ];
*found = false;
*keep = true;
*owner = false;
end_of_line = get_eol(buf_start, buf_end);
if (end_of_line >= buf_end)
return NULL;
line = buf_start;
if (*buf_start == '#')
goto next;
while ((buf_start < buf_end) && isblank(*buf_start))
buf_start++;
/* Check whether the line contains the caller's name. */
end_of_word = get_eow(buf_start, buf_end);
/* corrupt db */
if (!end_of_word)
return NULL;
if (strncmp(buf_start, name, strlen(name)))
*found = false;
*owner = true;
buf_start = end_of_word + 1;
while ((buf_start < buf_end) && isblank(*buf_start))
buf_start++;
/* Check whether line is of the right network type. */
end_of_word = get_eow(buf_start, buf_end);
/* corrupt db */
if (!end_of_word)
return NULL;
if (strncmp(buf_start, net_type, strlen(net_type)))
*found = false;
buf_start = end_of_word + 1;
while ((buf_start < buf_end) && isblank(*buf_start))
buf_start++;
/* Check whether line is contains the right link. */
end_of_word = get_eow(buf_start, buf_end);
/* corrupt db */
if (!end_of_word)
return NULL;
if (strncmp(buf_start, net_link, strlen(net_link)))
*found = false;
buf_start = end_of_word + 1;
while ((buf_start < buf_end) && isblank(*buf_start))
buf_start++;
/* Check whether line contains the right network device. */
end_of_word = get_eow(buf_start, buf_end);
/* corrupt db */
if (!end_of_word)
return NULL;
len = end_of_word - buf_start;
/* corrupt db */
if (len >= IFNAMSIZ)
return NULL;
memcpy(netdev_name, buf_start, len);
netdev_name[len] = '\0';
*keep = lxc_nic_exists(netdev_name);
if (net_dev && !strcmp(netdev_name, net_dev))
*found = true;
return line;
next:
buf_start = end_of_line + 1;
}
return NULL;
}
| 0
|
206,944
|
PHP_FUNCTION(connection_aborted)
{
RETURN_LONG(PG(connection_status) & PHP_CONNECTION_ABORTED);
}
| 0
|
254,449
|
ContentSecurityPolicy::~ContentSecurityPolicy() {}
| 0
|
339,839
|
static int add_tonal_components(float *spectrum, int num_components,
TonalComponent *components)
{
int i, j, last_pos = -1;
float *input, *output;
for (i = 0; i < num_components; i++) {
last_pos = FFMAX(components[i].pos + components[i].num_coefs, last_pos);
input = components[i].coef;
output = &spectrum[components[i].pos];
for (j = 0; j < components[i].num_coefs; j++)
output[i] += input[i];
}
return last_pos;
}
| 0
|
518,486
|
static int add_keyword_path(String *str, const char *keyword,
const char *path)
{
char temp_path[FN_REFLEN];
strcpy(temp_path, path);
#ifdef __WIN__
/* Convert \ to / to be able to create table on unix */
char *pos, *end;
size_t length= strlen(temp_path);
for (pos= temp_path, end= pos+length ; pos < end ; pos++)
{
if (*pos == '\\')
*pos = '/';
}
#endif
/*
If the partition file name with its "#P#" identifier
is found after the last slash, truncate that filename.
*/
truncate_partition_filename(temp_path);
return add_keyword_string(str, keyword, true, temp_path);
}
| 0
|
445,893
|
static UINT video_control_on_close(IWTSVirtualChannelCallback* pChannelCallback)
{
free(pChannelCallback);
return CHANNEL_RC_OK;
}
| 0
|
346,209
|
char *get_56_lenc_string(char **buffer,
size_t *max_bytes_available,
size_t *string_length)
{
static char empty_string[1]= { '\0' };
char *begin= *buffer;
if (*max_bytes_available == 0)
return NULL;
/*
If the length encoded string has the length 0
the total size of the string is only one byte long (the size byte)
*/
if (*begin == 0)
{
*string_length= 0;
--*max_bytes_available;
++*buffer;
/*
Return a pointer to the \0 character so the return value will be
an empty string.
*/
return empty_string;
}
*string_length= (size_t)net_field_length_ll((uchar **)buffer);
size_t len_len= (size_t)(*buffer - begin);
if (*string_length + len_len > *max_bytes_available)
return NULL;
*max_bytes_available -= *string_length + len_len;
*buffer += *string_length;
return (char *)(begin + len_len);
}
| 1
|
37,481
|
TRIO_PUBLIC void trio_locale_set_decimal_point TRIO_ARGS1((decimalPoint), char* decimalPoint)
{
#if defined(USE_LOCALE)
if (NULL == internalLocaleValues)
{
TrioSetLocale();
}
#endif
internalDecimalPointLength = trio_length(decimalPoint);
if (internalDecimalPointLength == 1)
{
internalDecimalPoint = *decimalPoint;
}
else
{
internalDecimalPoint = NIL;
trio_copy_max(internalDecimalPointString, sizeof(internalDecimalPointString), decimalPoint);
}
}
| 0
|
371,857
|
fr_archive_progress_cb (FrArchive *archive,
double fraction,
FrWindow *window)
{
window->priv->progress_pulse = (fraction < 0.0);
if (! window->priv->progress_pulse) {
fraction = CLAMP (fraction, 0.0, 1.0);
if (window->priv->progress_dialog != NULL)
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (window->priv->pd_progress_bar), fraction);
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (window->priv->progress_bar), fraction);
if ((archive != NULL) && (fr_archive_progress_get_total_files (archive) > 0)) {
char *message = NULL;
int remaining_files;
remaining_files = fr_archive_progress_get_total_files (archive) - fr_archive_progress_get_completed_files (archive);
switch (window->priv->action) {
case FR_ACTION_ADDING_FILES:
case FR_ACTION_EXTRACTING_FILES:
case FR_ACTION_DELETING_FILES:
case FR_ACTION_UPDATING_FILES:
if (remaining_files > 0)
message = g_strdup_printf (ngettext ("%d file remaining",
"%'d files remaining",
remaining_files), remaining_files);
else
message = g_strdup (_("Please wait…"));
break;
default:
break;
}
if (message != NULL) {
fr_archive_message (archive, message);
g_free (message);
}
}
if (fraction == 1.0)
gtk_widget_hide (window->priv->pd_progress_box);
else
gtk_widget_show (window->priv->pd_progress_box);
window->priv->pd_last_fraction = fraction;
g_signal_emit (G_OBJECT (window),
fr_window_signals[PROGRESS],
0,
window->priv->pd_last_fraction,
window->priv->pd_last_message);
#ifdef LOG_PROGRESS
g_print ("progress > %2.2f\n", fraction);
#endif
}
return TRUE;
}
| 0
|
398,773
|
gst_qtdemux_chain (GstPad * sinkpad, GstObject * parent, GstBuffer * inbuf)
{
GstQTDemux *demux;
demux = GST_QTDEMUX (parent);
GST_DEBUG_OBJECT (demux,
"Received buffer pts:%" GST_TIME_FORMAT " dts:%" GST_TIME_FORMAT
" offset:%" G_GUINT64_FORMAT " size:%" G_GSIZE_FORMAT " demux offset:%"
G_GUINT64_FORMAT, GST_TIME_ARGS (GST_BUFFER_PTS (inbuf)),
GST_TIME_ARGS (GST_BUFFER_DTS (inbuf)), GST_BUFFER_OFFSET (inbuf),
gst_buffer_get_size (inbuf), demux->offset);
if (GST_BUFFER_FLAG_IS_SET (inbuf, GST_BUFFER_FLAG_DISCONT)) {
gboolean is_gap_input = FALSE;
gint i;
GST_DEBUG_OBJECT (demux, "Got DISCONT, marking all streams as DISCONT");
for (i = 0; i < demux->n_streams; i++) {
demux->streams[i]->discont = TRUE;
}
/* Check if we can land back on our feet in the case where upstream is
* handling the seeking/pushing of samples with gaps in between (like
* in the case of trick-mode DASH for example) */
if (demux->upstream_format_is_time
&& GST_BUFFER_OFFSET (inbuf) != GST_BUFFER_OFFSET_NONE) {
gint i;
for (i = 0; i < demux->n_streams; i++) {
guint32 res;
GST_LOG_OBJECT (demux,
"Stream #%d , checking if offset %" G_GUINT64_FORMAT
" is a sample start", i, GST_BUFFER_OFFSET (inbuf));
res =
gst_qtdemux_find_index_for_given_media_offset_linear (demux,
demux->streams[i], GST_BUFFER_OFFSET (inbuf));
if (res != -1) {
QtDemuxSample *sample = &demux->streams[i]->samples[res];
GST_LOG_OBJECT (demux,
"Checking if sample %d from stream %d is valid (offset:%"
G_GUINT64_FORMAT " size:%" G_GUINT32_FORMAT ")", res, i,
sample->offset, sample->size);
if (sample->offset == GST_BUFFER_OFFSET (inbuf)) {
GST_LOG_OBJECT (demux,
"new buffer corresponds to a valid sample : %" G_GUINT32_FORMAT,
res);
is_gap_input = TRUE;
/* We can go back to standard playback mode */
demux->state = QTDEMUX_STATE_MOVIE;
/* Remember which sample this stream is at */
demux->streams[i]->sample_index = res;
/* Finally update all push-based values to the expected values */
demux->neededbytes = demux->streams[i]->samples[res].size;
demux->todrop = 0;
demux->offset = GST_BUFFER_OFFSET (inbuf);
}
}
}
if (!is_gap_input) {
/* Reset state if it's a real discont */
demux->neededbytes = 16;
demux->state = QTDEMUX_STATE_INITIAL;
demux->offset = GST_BUFFER_OFFSET (inbuf);
}
}
/* Reverse fragmented playback, need to flush all we have before
* consuming a new fragment.
* The samples array have the timestamps calculated by accumulating the
* durations but this won't work for reverse playback of fragments as
* the timestamps of a subsequent fragment should be smaller than the
* previously received one. */
if (!is_gap_input && demux->fragmented && demux->segment.rate < 0) {
gst_qtdemux_process_adapter (demux, TRUE);
for (i = 0; i < demux->n_streams; i++)
gst_qtdemux_stream_flush_samples_data (demux, demux->streams[i]);
}
}
gst_adapter_push (demux->adapter, inbuf);
GST_DEBUG_OBJECT (demux,
"pushing in inbuf %p, neededbytes:%u, available:%" G_GSIZE_FORMAT, inbuf,
demux->neededbytes, gst_adapter_available (demux->adapter));
return gst_qtdemux_process_adapter (demux, FALSE);
}
| 0
|
352,488
|
static CURLcode hsts_create(struct hsts *h,
const char *hostname,
bool subdomains,
curl_off_t expires)
{
struct stsentry *sts = hsts_entry();
if(!sts)
return CURLE_OUT_OF_MEMORY;
sts->expires = expires;
sts->includeSubDomains = subdomains;
sts->host = strdup(hostname);
if(!sts->host) {
free(sts);
return CURLE_OUT_OF_MEMORY;
}
Curl_llist_insert_next(&h->list, h->list.tail, sts, &sts->node);
return CURLE_OK;
}
| 1
|
52,917
|
static URI_INLINE const URI_CHAR * URI_FUNC(ParsePathAbsNoLeadSlash)(
URI_TYPE(ParserState) * state, const URI_CHAR * first,
const URI_CHAR * afterLast, UriMemoryManager * memory) {
if (first >= afterLast) {
return afterLast;
}
switch (*first) {
case _UT('!'):
case _UT('$'):
case _UT('%'):
case _UT('&'):
case _UT('('):
case _UT(')'):
case _UT('-'):
case _UT('*'):
case _UT(','):
case _UT('.'):
case _UT(':'):
case _UT(';'):
case _UT('@'):
case _UT('\''):
case _UT('_'):
case _UT('~'):
case _UT('+'):
case _UT('='):
case URI_SET_DIGIT:
case URI_SET_ALPHA:
{
const URI_CHAR * const afterSegmentNz
= URI_FUNC(ParseSegmentNz)(state, first, afterLast, memory);
if (afterSegmentNz == NULL) {
return NULL;
}
if (!URI_FUNC(PushPathSegment)(state, first, afterSegmentNz, memory)) { /* SEGMENT BOTH */
URI_FUNC(StopMalloc)(state, memory);
return NULL;
}
return URI_FUNC(ParseZeroMoreSlashSegs)(state, afterSegmentNz, afterLast, memory);
}
default:
return first;
}
}
| 0
|
470,551
|
tape_clear_rest_of_block (int out_file_des)
{
write_nuls_to_file (io_block_size - output_size, out_file_des,
tape_buffered_write);
}
| 0
|
396,285
|
ZEND_API int add_property_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, int duplicate TSRMLS_DC) /* {{{ */
{
zval *tmp;
zval *z_key;
if (UNEXPECTED(length > INT_MAX)) {
zend_error_noreturn(E_ERROR, "String overflow, max size is %d", INT_MAX);
}
MAKE_STD_ZVAL(tmp);
ZVAL_STRINGL(tmp, str, length, duplicate);
MAKE_STD_ZVAL(z_key);
ZVAL_STRINGL(z_key, key, key_len-1, 1);
Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp, 0 TSRMLS_CC);
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
zval_ptr_dtor(&z_key);
return SUCCESS;
}
| 0
|
122,146
|
TaskHandle_t xQueueGetMutexHolderFromISR( QueueHandle_t xSemaphore )
{
TaskHandle_t pxReturn;
configASSERT( xSemaphore );
/* Mutexes cannot be used in interrupt service routines, so the mutex
* holder should not change in an ISR, and therefore a critical section is
* not required here. */
if( ( ( Queue_t * ) xSemaphore )->uxQueueType == queueQUEUE_IS_MUTEX )
{
pxReturn = ( ( Queue_t * ) xSemaphore )->u.xSemaphore.xMutexHolder;
}
else
{
pxReturn = NULL;
}
return pxReturn;
} /*lint !e818 xSemaphore cannot be a pointer to const because it is a typedef. */
| 0
|
440,459
|
static bool vxlan_group_used(struct vxlan_net *vn, struct vxlan_dev *dev)
{
struct vxlan_dev *vxlan;
struct vxlan_sock *sock4;
#if IS_ENABLED(CONFIG_IPV6)
struct vxlan_sock *sock6;
#endif
unsigned short family = dev->default_dst.remote_ip.sa.sa_family;
sock4 = rtnl_dereference(dev->vn4_sock);
/* The vxlan_sock is only used by dev, leaving group has
* no effect on other vxlan devices.
*/
if (family == AF_INET && sock4 && refcount_read(&sock4->refcnt) == 1)
return false;
#if IS_ENABLED(CONFIG_IPV6)
sock6 = rtnl_dereference(dev->vn6_sock);
if (family == AF_INET6 && sock6 && refcount_read(&sock6->refcnt) == 1)
return false;
#endif
list_for_each_entry(vxlan, &vn->vxlan_list, next) {
if (!netif_running(vxlan->dev) || vxlan == dev)
continue;
if (family == AF_INET &&
rtnl_dereference(vxlan->vn4_sock) != sock4)
continue;
#if IS_ENABLED(CONFIG_IPV6)
if (family == AF_INET6 &&
rtnl_dereference(vxlan->vn6_sock) != sock6)
continue;
#endif
if (!vxlan_addr_equal(&vxlan->default_dst.remote_ip,
&dev->default_dst.remote_ip))
continue;
if (vxlan->default_dst.remote_ifindex !=
dev->default_dst.remote_ifindex)
continue;
return true;
}
return false;
}
| 0
|
448,081
|
void ocfs2_unlock_and_free_pages(struct page **pages, int num_pages)
{
int i;
for(i = 0; i < num_pages; i++) {
if (pages[i]) {
unlock_page(pages[i]);
mark_page_accessed(pages[i]);
page_cache_release(pages[i]);
}
}
}
| 0
|
303,571
|
nfs4_find_client_ident(struct net *net, int cb_ident)
{
struct nfs_client *clp;
struct nfs_net *nn = net_generic(net, nfs_net_id);
spin_lock(&nn->nfs_client_lock);
clp = idr_find(&nn->cb_ident_idr, cb_ident);
if (clp)
refcount_inc(&clp->cl_count);
spin_unlock(&nn->nfs_client_lock);
return clp;
}
| 0
|
57,397
|
static void set_extent_mask_and_shift(struct ecryptfs_crypt_stat *crypt_stat)
{
int extent_size_tmp;
crypt_stat->extent_mask = 0xFFFFFFFF;
crypt_stat->extent_shift = 0;
if (crypt_stat->extent_size == 0)
return;
extent_size_tmp = crypt_stat->extent_size;
while ((extent_size_tmp & 0x01) == 0) {
extent_size_tmp >>= 1;
crypt_stat->extent_mask <<= 1;
crypt_stat->extent_shift++;
}
}
| 0
|
271,368
|
void jpc_qmfb_split_row(jpc_fix_t *a, int numcols, int parity)
{
int bufsize = JPC_CEILDIVPOW2(numcols, 1);
jpc_fix_t splitbuf[QMFB_SPLITBUFSIZE];
jpc_fix_t *buf = splitbuf;
register jpc_fix_t *srcptr;
register jpc_fix_t *dstptr;
register int n;
register int m;
int hstartcol;
/* Get a buffer. */
if (bufsize > QMFB_SPLITBUFSIZE) {
if (!(buf = jas_alloc2(bufsize, sizeof(jpc_fix_t)))) {
/* We have no choice but to commit suicide in this case. */
abort();
}
}
if (numcols >= 2) {
hstartcol = (numcols + 1 - parity) >> 1;
// ORIGINAL (WRONG): m = (parity) ? hstartcol : (numcols - hstartcol);
m = numcols - hstartcol;
/* Save the samples destined for the highpass channel. */
n = m;
dstptr = buf;
srcptr = &a[1 - parity];
while (n-- > 0) {
*dstptr = *srcptr;
++dstptr;
srcptr += 2;
}
/* Copy the appropriate samples into the lowpass channel. */
dstptr = &a[1 - parity];
srcptr = &a[2 - parity];
n = numcols - m - (!parity);
while (n-- > 0) {
*dstptr = *srcptr;
++dstptr;
srcptr += 2;
}
/* Copy the saved samples into the highpass channel. */
dstptr = &a[hstartcol];
srcptr = buf;
n = m;
while (n-- > 0) {
*dstptr = *srcptr;
++dstptr;
++srcptr;
}
}
/* If the split buffer was allocated on the heap, free this memory. */
if (buf != splitbuf) {
jas_free(buf);
}
}
| 0
|
462,079
|
void *zrealloc_usable(void *ptr, size_t size, size_t *usable) {
ptr = ztryrealloc_usable(ptr, size, usable);
if (!ptr && size != 0) zmalloc_oom_handler(size);
return ptr;
}
| 0
|
492,895
|
static int bio_copy_user_iov(struct request *rq, struct rq_map_data *map_data,
struct iov_iter *iter, gfp_t gfp_mask)
{
struct bio_map_data *bmd;
struct page *page;
struct bio *bio;
int i = 0, ret;
int nr_pages;
unsigned int len = iter->count;
unsigned int offset = map_data ? offset_in_page(map_data->offset) : 0;
bmd = bio_alloc_map_data(iter, gfp_mask);
if (!bmd)
return -ENOMEM;
/*
* We need to do a deep copy of the iov_iter including the iovecs.
* The caller provided iov might point to an on-stack or otherwise
* shortlived one.
*/
bmd->is_our_pages = !map_data;
bmd->is_null_mapped = (map_data && map_data->null_mapped);
nr_pages = bio_max_segs(DIV_ROUND_UP(offset + len, PAGE_SIZE));
ret = -ENOMEM;
bio = bio_kmalloc(gfp_mask, nr_pages);
if (!bio)
goto out_bmd;
bio->bi_opf |= req_op(rq);
if (map_data) {
nr_pages = 1 << map_data->page_order;
i = map_data->offset / PAGE_SIZE;
}
while (len) {
unsigned int bytes = PAGE_SIZE;
bytes -= offset;
if (bytes > len)
bytes = len;
if (map_data) {
if (i == map_data->nr_entries * nr_pages) {
ret = -ENOMEM;
goto cleanup;
}
page = map_data->pages[i / nr_pages];
page += (i % nr_pages);
i++;
} else {
page = alloc_page(GFP_NOIO | gfp_mask);
if (!page) {
ret = -ENOMEM;
goto cleanup;
}
}
if (bio_add_pc_page(rq->q, bio, page, bytes, offset) < bytes) {
if (!map_data)
__free_page(page);
break;
}
len -= bytes;
offset = 0;
}
if (map_data)
map_data->offset += bio->bi_iter.bi_size;
/*
* success
*/
if ((iov_iter_rw(iter) == WRITE &&
(!map_data || !map_data->null_mapped)) ||
(map_data && map_data->from_user)) {
ret = bio_copy_from_iter(bio, iter);
if (ret)
goto cleanup;
} else {
if (bmd->is_our_pages)
zero_fill_bio(bio);
iov_iter_advance(iter, bio->bi_iter.bi_size);
}
bio->bi_private = bmd;
ret = blk_rq_append_bio(rq, bio);
if (ret)
goto cleanup;
return 0;
cleanup:
if (!map_data)
bio_free_pages(bio);
bio_put(bio);
out_bmd:
kfree(bmd);
return ret;
}
| 0
|
23,262
|
void set_server_version ( void ) {
char * version_end = server_version + sizeof ( server_version ) - 1 ;
char * end = strxnmov ( server_version , sizeof ( server_version ) - 1 , MYSQL_SERVER_VERSION , MYSQL_SERVER_SUFFIX_STR , NullS ) ;
# ifdef EMBEDDED_LIBRARY end = strnmov ( end , "-embedded" , ( version_end - end ) ) ;
# endif # ifndef DBUG_OFF if ( ! strstr ( MYSQL_SERVER_SUFFIX_STR , "-debug" ) ) end = strnmov ( end , "-debug" , ( version_end - end ) ) ;
# endif if ( opt_log || opt_slow_log || opt_bin_log ) strnmov ( end , "-log" , ( version_end - end ) ) ;
* end = 0 ;
}
| 0
|
1,121
|
static ossl_inline t2 * sk_ ## t1 ## _pop ( STACK_OF ( t1 ) * sk ) {
return ( t2 * ) OPENSSL_sk_pop ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _shift ( STACK_OF ( t1 ) * sk ) {
return ( t2 * ) OPENSSL_sk_shift ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline void sk_ ## t1 ## _pop_free ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _freefunc freefunc ) {
OPENSSL_sk_pop_free ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_freefunc ) freefunc ) ;
}
static ossl_inline int sk_ ## t1 ## _insert ( STACK_OF ( t1 ) * sk , t2 * ptr , int idx ) {
return OPENSSL_sk_insert ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr , idx ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _set ( STACK_OF ( t1 ) * sk , int idx , t2 * ptr ) {
return ( t2 * ) OPENSSL_sk_set ( ( OPENSSL_STACK * ) sk , idx , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _find ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _find_ex ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find_ex ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline void sk_ ## t1 ## _sort ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_sort ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline int sk_ ## t1 ## _is_sorted ( const STACK_OF ( t1 ) * sk ) {
return OPENSSL_sk_is_sorted ( ( const OPENSSL_STACK * ) sk ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _dup ( const STACK_OF ( t1 ) * sk ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_dup ( ( const OPENSSL_STACK * ) sk ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _deep_copy ( const STACK_OF ( t1 ) * sk , sk_ ## t1 ## _copyfunc copyfunc , sk_ ## t1 ## _freefunc freefunc ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_deep_copy ( ( const OPENSSL_STACK * ) sk , ( OPENSSL_sk_copyfunc ) copyfunc , ( OPENSSL_sk_freefunc ) freefunc ) ;
}
static ossl_inline sk_ ## t1 ## _compfunc sk_ ## t1 ## _set_cmp_func ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _compfunc compare ) {
return ( sk_ ## t1 ## _compfunc ) OPENSSL_sk_set_cmp_func ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_compfunc ) compare ) ;
}
# define DEFINE_SPECIAL_STACK_OF ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , t2 , t2 ) # define DEFINE_STACK_OF ( t ) SKM_DEFINE_STACK_OF ( t , t , t ) # define DEFINE_SPECIAL_STACK_OF_CONST ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , const t2 , t2 ) # define DEFINE_STACK_OF_CONST ( t ) SKM_DEFINE_STACK_OF ( t , const t , t ) typedef char * OPENSSL_STRING ;
typedef const char * OPENSSL_CSTRING ;
DEFINE_SPECIAL_STACK_OF ( OPENSSL_STRING , char )
| 1
|
216,519
|
error::Error GLES2DecoderImpl::HandleStencilFillPathCHROMIUM(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
static const char kFunctionName[] = "glStencilFillPathCHROMIUM";
const volatile gles2::cmds::StencilFillPathCHROMIUM& c =
*static_cast<const volatile gles2::cmds::StencilFillPathCHROMIUM*>(
cmd_data);
if (!features().chromium_path_rendering)
return error::kUnknownCommand;
PathCommandValidatorContext v(this, kFunctionName);
GLenum fill_mode = GL_COUNT_UP_CHROMIUM;
GLuint mask = 0;
if (!v.GetFillModeAndMask(c, &fill_mode, &mask))
return v.error();
GLuint service_id = 0;
if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) {
return error::kNoError;
}
if (!CheckBoundDrawFramebufferValid(kFunctionName))
return error::kNoError;
ApplyDirtyState();
api()->glStencilFillPathNVFn(service_id, fill_mode, mask);
return error::kNoError;
}
| 0
|
364,736
|
httpServeObjectStreamHandler(int status,
FdEventHandlerPtr event,
StreamRequestPtr srequest)
{
return httpServeObjectStreamHandlerCommon(1, status, event, srequest);
}
| 0
|
283,401
|
std::string FormatLog(const char* fmt, va_list args) {
std::string msg = base::StringPrintV(fmt, args);
if (!msg.empty() && msg[msg.size() - 1] == '\n')
msg.erase(msg.end() - 1, msg.end());
return msg;
}
| 0
|
452,459
|
static void k_unicode(struct vc_data *vc, unsigned int value, char up_flag)
{
if (up_flag)
return; /* no action, if this is a key release */
if (diacr)
value = handle_diacr(vc, value);
if (dead_key_next) {
dead_key_next = false;
diacr = value;
return;
}
if (kbd->kbdmode == VC_UNICODE)
to_utf8(vc, value);
else {
int c = conv_uni_to_8bit(value);
if (c != -1)
put_queue(vc, c);
}
}
| 0
|
381,470
|
build_key_sequence (gcry_mpi_t *kparms, int mode, size_t *r_length)
{
int rc, i;
size_t needed, n;
unsigned char *plain, *p;
size_t plainlen;
size_t outseqlen, oidseqlen, octstrlen, inseqlen;
needed = 3; /* The version integer with value 0. */
for (i=0; kparms[i]; i++)
{
n = 0;
rc = gcry_mpi_print (GCRYMPI_FMT_STD, NULL, 0, &n, kparms[i]);
if (rc)
{
log_error ("error formatting parameter: %s\n", gpg_strerror (rc));
return NULL;
}
needed += n;
n = compute_tag_length (n);
if (!n)
return NULL;
needed += n;
}
if (i != 8)
{
log_error ("invalid parameters for p12_build\n");
return NULL;
}
/* Now this all goes into a sequence. */
inseqlen = needed;
n = compute_tag_length (needed);
if (!n)
return NULL;
needed += n;
if (mode != 2)
{
/* Encapsulate all into an octet string. */
octstrlen = needed;
n = compute_tag_length (needed);
if (!n)
return NULL;
needed += n;
/* Prepend the object identifier sequence. */
oidseqlen = 2 + DIM (oid_rsaEncryption) + 2;
needed += 2 + oidseqlen;
/* The version number. */
needed += 3;
/* And finally put the whole thing into a sequence. */
outseqlen = needed;
n = compute_tag_length (needed);
if (!n)
return NULL;
needed += n;
}
/* allocate 8 extra bytes for padding */
plain = gcry_malloc_secure (needed+8);
if (!plain)
{
log_error ("error allocating encryption buffer\n");
return NULL;
}
/* And now fill the plaintext buffer. */
p = plain;
if (mode != 2)
{
p = store_tag_length (p, TAG_SEQUENCE, outseqlen);
/* Store version. */
*p++ = TAG_INTEGER;
*p++ = 1;
*p++ = 0;
/* Store object identifier sequence. */
p = store_tag_length (p, TAG_SEQUENCE, oidseqlen);
p = store_tag_length (p, TAG_OBJECT_ID, DIM (oid_rsaEncryption));
memcpy (p, oid_rsaEncryption, DIM (oid_rsaEncryption));
p += DIM (oid_rsaEncryption);
*p++ = TAG_NULL;
*p++ = 0;
/* Start with the octet string. */
p = store_tag_length (p, TAG_OCTET_STRING, octstrlen);
}
p = store_tag_length (p, TAG_SEQUENCE, inseqlen);
/* Store the key parameters. */
*p++ = TAG_INTEGER;
*p++ = 1;
*p++ = 0;
for (i=0; kparms[i]; i++)
{
n = 0;
rc = gcry_mpi_print (GCRYMPI_FMT_STD, NULL, 0, &n, kparms[i]);
if (rc)
{
log_error ("oops: error formatting parameter: %s\n",
gpg_strerror (rc));
gcry_free (plain);
return NULL;
}
p = store_tag_length (p, TAG_INTEGER, n);
n = plain + needed - p;
rc = gcry_mpi_print (GCRYMPI_FMT_STD, p, n, &n, kparms[i]);
if (rc)
{
log_error ("oops: error storing parameter: %s\n",
gpg_strerror (rc));
gcry_free (plain);
return NULL;
}
p += n;
}
plainlen = p - plain;
assert (needed == plainlen);
if (!mode)
{
/* Append some pad characters; we already allocated extra space. */
n = 8 - plainlen % 8;
for (i=0; i < n; i++, plainlen++)
*p++ = n;
}
*r_length = plainlen;
return plain;
}
| 0
|
239,671
|
testing::AssertionResult ScriptAllowedExclusivelyOnTab(
const Extension* extension,
const std::set<GURL>& allowed_urls,
int tab_id) {
std::vector<std::string> errors;
for (const GURL& url : urls_) {
AccessType access = GetExtensionAccess(extension, url, tab_id);
AccessType expected_access =
allowed_urls.count(url) ? ALLOWED_SCRIPT_ONLY : DISALLOWED;
if (access != expected_access) {
errors.push_back(
base::StringPrintf("Error for url '%s': expected %d, found %d",
url.spec().c_str(), expected_access, access));
}
}
if (!errors.empty())
return testing::AssertionFailure() << base::JoinString(errors, "\n");
return testing::AssertionSuccess();
}
| 0
|
69,970
|
static void br_multicast_router_expired(unsigned long data)
{
struct net_bridge_port *port = (void *)data;
struct net_bridge *br = port->br;
spin_lock(&br->multicast_lock);
if (port->multicast_router != 1 ||
timer_pending(&port->multicast_router_timer) ||
hlist_unhashed(&port->rlist))
goto out;
hlist_del_init_rcu(&port->rlist);
out:
spin_unlock(&br->multicast_lock);
}
| 0
|
120,214
|
static int esp4_rcv_cb(struct sk_buff *skb, int err)
{
return 0;
}
| 0
|
346,788
|
static bool check_solid_tile(VncState *vs, int x, int y, int w, int h,
uint32_t* color, bool samecolor)
{
VncDisplay *vd = vs->vd;
switch(vd->server->pf.bytes_per_pixel) {
case 4:
return check_solid_tile32(vs, x, y, w, h, color, samecolor);
case 2:
return check_solid_tile16(vs, x, y, w, h, color, samecolor);
default:
return check_solid_tile8(vs, x, y, w, h, color, samecolor);
}
}
| 1
|
459,595
|
dissect_kafka_describe_log_dirs_response_topic(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
int offset, kafka_api_version_t api_version)
{
proto_item *subti, *subsubti;
proto_tree *subtree, *subsubtree;
int topic_start, topic_len;
subtree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_kafka_topic, &subti, "Topic");
offset = dissect_kafka_string(subtree, hf_kafka_topic_name, tvb, pinfo, offset, 0, &topic_start, &topic_len);
subsubtree = proto_tree_add_subtree(subtree, tvb, offset, -1, ett_kafka_partitions, &subsubti, "Partitions");
offset = dissect_kafka_array(subsubtree, tvb, pinfo, offset, 0, api_version,
&dissect_kafka_describe_log_dirs_response_partition, NULL);
proto_item_set_end(subti, tvb, offset);
proto_item_append_text(subti, " (Name=%s)",
tvb_get_string_enc(wmem_packet_scope(), tvb,
topic_start, topic_len, ENC_UTF_8));
return offset;
}
| 0
|
325,162
|
static void adb_register_types(void)
{
type_register_static(&adb_bus_type_info);
type_register_static(&adb_device_type_info);
type_register_static(&adb_kbd_type_info);
type_register_static(&adb_mouse_type_info);
}
| 1
|
523,925
|
auth_request_lookup_credentials_finish(enum passdb_result result,
const unsigned char *credentials,
size_t size,
struct auth_request *request)
{
const char *error;
if (passdb_template_export(request->passdb->override_fields_tmpl,
request, &error) < 0) {
e_error(authdb_event(request),
"Failed to expand override_fields: %s", error);
result = PASSDB_RESULT_INTERNAL_FAILURE;
}
if (!auth_request_handle_passdb_callback(&result, request)) {
/* try next passdb */
if (request->fields.skip_password_check &&
request->fields.delayed_credentials == NULL && size > 0) {
/* passdb continue* rule after a successful lookup.
remember these credentials and use them later on. */
auth_request_set_delayed_credentials(request,
credentials, size);
}
auth_request_lookup_credentials(request,
request->wanted_credentials_scheme,
request->private_callback.lookup_credentials);
} else {
if (request->fields.delayed_credentials != NULL && size == 0) {
/* we did multiple passdb lookups, but the last one
didn't provide any credentials (e.g. just wanted to
add some extra fields). so use the first passdb's
credentials instead. */
credentials = request->fields.delayed_credentials;
size = request->fields.delayed_credentials_size;
}
if (request->set->debug_passwords &&
result == PASSDB_RESULT_OK) {
e_debug(authdb_event(request),
"Credentials: %s",
binary_to_hex(credentials, size));
}
if (result == PASSDB_RESULT_SCHEME_NOT_AVAILABLE &&
request->passdbs_seen_user_unknown) {
/* one of the passdbs accepted the scheme,
but the user was unknown there */
result = PASSDB_RESULT_USER_UNKNOWN;
}
request->passdb_result = result;
request->private_callback.
lookup_credentials(result, credentials, size, request);
}
}
| 0
|
244,632
|
void WebLocalFrameImpl::SetIsolatedWorldContentSecurityPolicy(
int world_id,
const WebString& policy) {
DCHECK(GetFrame());
DOMWrapperWorld::SetIsolatedWorldContentSecurityPolicy(world_id, policy);
}
| 0
|
492,978
|
static int ssl_ciphersuite_match( mbedtls_ssl_context *ssl, int suite_id,
const mbedtls_ssl_ciphersuite_t **ciphersuite_info )
{
const mbedtls_ssl_ciphersuite_t *suite_info;
#if defined(MBEDTLS_SSL_PROTO_TLS1_2) && \
defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED)
mbedtls_pk_type_t sig_type;
#endif
suite_info = mbedtls_ssl_ciphersuite_from_id( suite_id );
if( suite_info == NULL )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "should never happen" ) );
return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );
}
MBEDTLS_SSL_DEBUG_MSG( 3, ( "trying ciphersuite: %#04x (%s)",
(unsigned int) suite_id, suite_info->name ) );
if( suite_info->min_minor_ver > ssl->minor_ver ||
suite_info->max_minor_ver < ssl->minor_ver )
{
MBEDTLS_SSL_DEBUG_MSG( 3, ( "ciphersuite mismatch: version" ) );
return( 0 );
}
#if defined(MBEDTLS_SSL_PROTO_DTLS)
if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM &&
( suite_info->flags & MBEDTLS_CIPHERSUITE_NODTLS ) )
return( 0 );
#endif
#if defined(MBEDTLS_ARC4_C)
if( ssl->conf->arc4_disabled == MBEDTLS_SSL_ARC4_DISABLED &&
suite_info->cipher == MBEDTLS_CIPHER_ARC4_128 )
{
MBEDTLS_SSL_DEBUG_MSG( 3, ( "ciphersuite mismatch: rc4" ) );
return( 0 );
}
#endif
#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
if( suite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECJPAKE &&
( ssl->handshake->cli_exts & MBEDTLS_TLS_EXT_ECJPAKE_KKPP_OK ) == 0 )
{
MBEDTLS_SSL_DEBUG_MSG( 3, ( "ciphersuite mismatch: ecjpake "
"not configured or ext missing" ) );
return( 0 );
}
#endif
#if defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C)
if( mbedtls_ssl_ciphersuite_uses_ec( suite_info ) &&
( ssl->handshake->curves == NULL ||
ssl->handshake->curves[0] == NULL ) )
{
MBEDTLS_SSL_DEBUG_MSG( 3, ( "ciphersuite mismatch: "
"no common elliptic curve" ) );
return( 0 );
}
#endif
#if defined(MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED)
/* If the ciphersuite requires a pre-shared key and we don't
* have one, skip it now rather than failing later */
if( mbedtls_ssl_ciphersuite_uses_psk( suite_info ) &&
ssl_conf_has_psk_or_cb( ssl->conf ) == 0 )
{
MBEDTLS_SSL_DEBUG_MSG( 3, ( "ciphersuite mismatch: no pre-shared key" ) );
return( 0 );
}
#endif
#if defined(MBEDTLS_SSL_PROTO_TLS1_2) && \
defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED)
/* If the ciphersuite requires signing, check whether
* a suitable hash algorithm is present. */
if( ssl->minor_ver == MBEDTLS_SSL_MINOR_VERSION_3 )
{
sig_type = mbedtls_ssl_get_ciphersuite_sig_alg( suite_info );
if( sig_type != MBEDTLS_PK_NONE &&
mbedtls_ssl_sig_hash_set_find( &ssl->handshake->hash_algs, sig_type ) == MBEDTLS_MD_NONE )
{
MBEDTLS_SSL_DEBUG_MSG( 3, ( "ciphersuite mismatch: no suitable hash algorithm "
"for signature algorithm %u", (unsigned) sig_type ) );
return( 0 );
}
}
#endif /* MBEDTLS_SSL_PROTO_TLS1_2 &&
MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED */
#if defined(MBEDTLS_X509_CRT_PARSE_C)
/*
* Final check: if ciphersuite requires us to have a
* certificate/key of a particular type:
* - select the appropriate certificate if we have one, or
* - try the next ciphersuite if we don't
* This must be done last since we modify the key_cert list.
*/
if( ssl_pick_cert( ssl, suite_info ) != 0 )
{
MBEDTLS_SSL_DEBUG_MSG( 3, ( "ciphersuite mismatch: "
"no suitable certificate" ) );
return( 0 );
}
#endif
*ciphersuite_info = suite_info;
return( 0 );
}
| 0
|
351,885
|
void ext4_free_blocks(handle_t *handle, struct inode *inode,
struct buffer_head *bh, ext4_fsblk_t block,
unsigned long count, int flags)
{
struct buffer_head *bitmap_bh = NULL;
struct super_block *sb = inode->i_sb;
struct ext4_group_desc *gdp;
unsigned int overflow;
ext4_grpblk_t bit;
struct buffer_head *gd_bh;
ext4_group_t block_group;
struct ext4_sb_info *sbi;
struct ext4_buddy e4b;
unsigned int count_clusters;
int err = 0;
int ret;
might_sleep();
if (bh) {
if (block)
BUG_ON(block != bh->b_blocknr);
else
block = bh->b_blocknr;
}
sbi = EXT4_SB(sb);
if (!(flags & EXT4_FREE_BLOCKS_VALIDATED) &&
!ext4_data_block_valid(sbi, block, count)) {
ext4_error(sb, "Freeing blocks not in datazone - "
"block = %llu, count = %lu", block, count);
goto error_return;
}
ext4_debug("freeing block %llu\n", block);
trace_ext4_free_blocks(inode, block, count, flags);
if (bh && (flags & EXT4_FREE_BLOCKS_FORGET)) {
BUG_ON(count > 1);
ext4_forget(handle, flags & EXT4_FREE_BLOCKS_METADATA,
inode, bh, block);
}
/*
* If the extent to be freed does not begin on a cluster
* boundary, we need to deal with partial clusters at the
* beginning and end of the extent. Normally we will free
* blocks at the beginning or the end unless we are explicitly
* requested to avoid doing so.
*/
overflow = EXT4_PBLK_COFF(sbi, block);
if (overflow) {
if (flags & EXT4_FREE_BLOCKS_NOFREE_FIRST_CLUSTER) {
overflow = sbi->s_cluster_ratio - overflow;
block += overflow;
if (count > overflow)
count -= overflow;
else
return;
} else {
block -= overflow;
count += overflow;
}
}
overflow = EXT4_LBLK_COFF(sbi, count);
if (overflow) {
if (flags & EXT4_FREE_BLOCKS_NOFREE_LAST_CLUSTER) {
if (count > overflow)
count -= overflow;
else
return;
} else
count += sbi->s_cluster_ratio - overflow;
}
if (!bh && (flags & EXT4_FREE_BLOCKS_FORGET)) {
int i;
int is_metadata = flags & EXT4_FREE_BLOCKS_METADATA;
for (i = 0; i < count; i++) {
cond_resched();
if (is_metadata)
bh = sb_find_get_block(inode->i_sb, block + i);
ext4_forget(handle, is_metadata, inode, bh, block + i);
}
}
do_more:
overflow = 0;
ext4_get_group_no_and_offset(sb, block, &block_group, &bit);
if (unlikely(EXT4_MB_GRP_BBITMAP_CORRUPT(
ext4_get_group_info(sb, block_group))))
return;
/*
* Check to see if we are freeing blocks across a group
* boundary.
*/
if (EXT4_C2B(sbi, bit) + count > EXT4_BLOCKS_PER_GROUP(sb)) {
overflow = EXT4_C2B(sbi, bit) + count -
EXT4_BLOCKS_PER_GROUP(sb);
count -= overflow;
}
count_clusters = EXT4_NUM_B2C(sbi, count);
bitmap_bh = ext4_read_block_bitmap(sb, block_group);
if (IS_ERR(bitmap_bh)) {
err = PTR_ERR(bitmap_bh);
bitmap_bh = NULL;
goto error_return;
}
gdp = ext4_get_group_desc(sb, block_group, &gd_bh);
if (!gdp) {
err = -EIO;
goto error_return;
}
if (in_range(ext4_block_bitmap(sb, gdp), block, count) ||
in_range(ext4_inode_bitmap(sb, gdp), block, count) ||
in_range(block, ext4_inode_table(sb, gdp),
sbi->s_itb_per_group) ||
in_range(block + count - 1, ext4_inode_table(sb, gdp),
sbi->s_itb_per_group)) {
ext4_error(sb, "Freeing blocks in system zone - "
"Block = %llu, count = %lu", block, count);
/* err = 0. ext4_std_error should be a no op */
goto error_return;
}
BUFFER_TRACE(bitmap_bh, "getting write access");
err = ext4_journal_get_write_access(handle, bitmap_bh);
if (err)
goto error_return;
/*
* We are about to modify some metadata. Call the journal APIs
* to unshare ->b_data if a currently-committing transaction is
* using it
*/
BUFFER_TRACE(gd_bh, "get_write_access");
err = ext4_journal_get_write_access(handle, gd_bh);
if (err)
goto error_return;
#ifdef AGGRESSIVE_CHECK
{
int i;
for (i = 0; i < count_clusters; i++)
BUG_ON(!mb_test_bit(bit + i, bitmap_bh->b_data));
}
#endif
trace_ext4_mballoc_free(sb, inode, block_group, bit, count_clusters);
/* __GFP_NOFAIL: retry infinitely, ignore TIF_MEMDIE and memcg limit. */
err = ext4_mb_load_buddy_gfp(sb, block_group, &e4b,
GFP_NOFS|__GFP_NOFAIL);
if (err)
goto error_return;
/*
* We need to make sure we don't reuse the freed block until after the
* transaction is committed. We make an exception if the inode is to be
* written in writeback mode since writeback mode has weak data
* consistency guarantees.
*/
if (ext4_handle_valid(handle) &&
((flags & EXT4_FREE_BLOCKS_METADATA) ||
!ext4_should_writeback_data(inode))) {
struct ext4_free_data *new_entry;
/*
* We use __GFP_NOFAIL because ext4_free_blocks() is not allowed
* to fail.
*/
new_entry = kmem_cache_alloc(ext4_free_data_cachep,
GFP_NOFS|__GFP_NOFAIL);
new_entry->efd_start_cluster = bit;
new_entry->efd_group = block_group;
new_entry->efd_count = count_clusters;
new_entry->efd_tid = handle->h_transaction->t_tid;
ext4_lock_group(sb, block_group);
mb_clear_bits(bitmap_bh->b_data, bit, count_clusters);
ext4_mb_free_metadata(handle, &e4b, new_entry);
} else {
/* need to update group_info->bb_free and bitmap
* with group lock held. generate_buddy look at
* them with group lock_held
*/
if (test_opt(sb, DISCARD)) {
err = ext4_issue_discard(sb, block_group, bit, count,
NULL);
if (err && err != -EOPNOTSUPP)
ext4_msg(sb, KERN_WARNING, "discard request in"
" group:%d block:%d count:%lu failed"
" with %d", block_group, bit, count,
err);
} else
EXT4_MB_GRP_CLEAR_TRIMMED(e4b.bd_info);
ext4_lock_group(sb, block_group);
mb_clear_bits(bitmap_bh->b_data, bit, count_clusters);
mb_free_blocks(inode, &e4b, bit, count_clusters);
}
ret = ext4_free_group_clusters(sb, gdp) + count_clusters;
ext4_free_group_clusters_set(sb, gdp, ret);
ext4_block_bitmap_csum_set(sb, block_group, gdp, bitmap_bh);
ext4_group_desc_csum_set(sb, block_group, gdp);
ext4_unlock_group(sb, block_group);
if (sbi->s_log_groups_per_flex) {
ext4_group_t flex_group = ext4_flex_group(sbi, block_group);
atomic64_add(count_clusters,
&sbi_array_rcu_deref(sbi, s_flex_groups,
flex_group)->free_clusters);
}
/*
* on a bigalloc file system, defer the s_freeclusters_counter
* update to the caller (ext4_remove_space and friends) so they
* can determine if a cluster freed here should be rereserved
*/
if (!(flags & EXT4_FREE_BLOCKS_RERESERVE_CLUSTER)) {
if (!(flags & EXT4_FREE_BLOCKS_NO_QUOT_UPDATE))
dquot_free_block(inode, EXT4_C2B(sbi, count_clusters));
percpu_counter_add(&sbi->s_freeclusters_counter,
count_clusters);
}
ext4_mb_unload_buddy(&e4b);
/* We dirtied the bitmap block */
BUFFER_TRACE(bitmap_bh, "dirtied bitmap block");
err = ext4_handle_dirty_metadata(handle, NULL, bitmap_bh);
/* And the group descriptor block */
BUFFER_TRACE(gd_bh, "dirtied group descriptor block");
ret = ext4_handle_dirty_metadata(handle, NULL, gd_bh);
if (!err)
err = ret;
if (overflow && !err) {
block += count;
count = overflow;
put_bh(bitmap_bh);
goto do_more;
}
error_return:
brelse(bitmap_bh);
ext4_std_error(sb, err);
return;
}
| 1
|
128,446
|
const char *am_filepath_dirname(apr_pool_t *p, const char *path)
{
char *cp;
/*
* Try Unix and then Windows style. Borrowed from
* apr_match_glob(), it seems it cannot be made more
* portable.
*/
if (((cp = strrchr(path, (int)'/')) == NULL) &&
((cp = strrchr(path, (int)'\\')) == NULL))
return ".";
return apr_pstrndup(p, path, cp - path);
}
| 0
|
120,215
|
void DecimalQuantity::appendDigit(int8_t value, int32_t leadingZeros, bool appendAsInteger) {
U_ASSERT(leadingZeros >= 0);
// Zero requires special handling to maintain the invariant that the least-significant digit
// in the BCD is nonzero.
if (value == 0) {
if (appendAsInteger && precision != 0) {
scale += leadingZeros + 1;
}
return;
}
// Deal with trailing zeros
if (scale > 0) {
leadingZeros += scale;
if (appendAsInteger) {
scale = 0;
}
}
// Append digit
shiftLeft(leadingZeros + 1);
setDigitPos(0, value);
// Fix scale if in integer mode
if (appendAsInteger) {
scale += leadingZeros + 1;
}
}
| 0
|
433,764
|
read_block(FILE *fp, pcap_t *p, struct block_cursor *cursor, char *errbuf)
{
struct pcap_ng_sf *ps;
int status;
struct block_header bhdr;
struct block_trailer *btrlr;
u_char *bdata;
size_t data_remaining;
ps = p->priv;
status = read_bytes(fp, &bhdr, sizeof(bhdr), 0, errbuf);
if (status <= 0)
return (status); /* error or EOF */
if (p->swapped) {
bhdr.block_type = SWAPLONG(bhdr.block_type);
bhdr.total_length = SWAPLONG(bhdr.total_length);
}
/*
* Is this block "too small" - i.e., is it shorter than a block
* header plus a block trailer?
*/
if (bhdr.total_length < sizeof(struct block_header) +
sizeof(struct block_trailer)) {
pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
"block in pcapng dump file has a length of %u < %" PRIsize,
bhdr.total_length,
sizeof(struct block_header) + sizeof(struct block_trailer));
return (-1);
}
/*
* Is the block total length a multiple of 4?
*/
if ((bhdr.total_length % 4) != 0) {
/*
* No. Report that as an error.
*/
pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
"block in pcapng dump file has a length of %u that is not a multiple of 4" PRIsize,
bhdr.total_length);
return (-1);
}
/*
* Is the buffer big enough?
*/
if (p->bufsize < bhdr.total_length) {
/*
* No - make it big enough, unless it's too big, in
* which case we fail.
*/
void *bigger_buffer;
if (bhdr.total_length > ps->max_blocksize) {
pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "pcapng block size %u > maximum %u", bhdr.total_length,
ps->max_blocksize);
return (-1);
}
bigger_buffer = realloc(p->buffer, bhdr.total_length);
if (bigger_buffer == NULL) {
pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "out of memory");
return (-1);
}
p->buffer = bigger_buffer;
}
/*
* Copy the stuff we've read to the buffer, and read the rest
* of the block.
*/
memcpy(p->buffer, &bhdr, sizeof(bhdr));
bdata = (u_char *)p->buffer + sizeof(bhdr);
data_remaining = bhdr.total_length - sizeof(bhdr);
if (read_bytes(fp, bdata, data_remaining, 1, errbuf) == -1)
return (-1);
/*
* Get the block size from the trailer.
*/
btrlr = (struct block_trailer *)(bdata + data_remaining - sizeof (struct block_trailer));
if (p->swapped)
btrlr->total_length = SWAPLONG(btrlr->total_length);
/*
* Is the total length from the trailer the same as the total
* length from the header?
*/
if (bhdr.total_length != btrlr->total_length) {
/*
* No.
*/
pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
"block total length in header and trailer don't match");
return (-1);
}
/*
* Initialize the cursor.
*/
cursor->data = bdata;
cursor->data_remaining = data_remaining - sizeof(struct block_trailer);
cursor->block_type = bhdr.block_type;
return (1);
}
| 0
|
255,898
|
void PrintPreviewDataSource::Init() {
AddLocalizedString("title", IDS_PRINT_PREVIEW_TITLE);
AddLocalizedString("loading", IDS_PRINT_PREVIEW_LOADING);
AddLocalizedString("noPlugin", IDS_PRINT_PREVIEW_NO_PLUGIN);
AddLocalizedString("launchNativeDialog", IDS_PRINT_PREVIEW_NATIVE_DIALOG);
AddLocalizedString("previewFailed", IDS_PRINT_PREVIEW_FAILED);
AddLocalizedString("invalidPrinterSettings",
IDS_PRINT_PREVIEW_INVALID_PRINTER_SETTINGS);
AddLocalizedString("printButton", IDS_PRINT_PREVIEW_PRINT_BUTTON);
AddLocalizedString("saveButton", IDS_PRINT_PREVIEW_SAVE_BUTTON);
AddLocalizedString("cancelButton", IDS_PRINT_PREVIEW_CANCEL_BUTTON);
AddLocalizedString("printing", IDS_PRINT_PREVIEW_PRINTING);
AddLocalizedString("printingToPDFInProgress",
IDS_PRINT_PREVIEW_PRINTING_TO_PDF_IN_PROGRESS);
#if defined(OS_MACOSX)
AddLocalizedString("openingPDFInPreview",
IDS_PRINT_PREVIEW_OPENING_PDF_IN_PREVIEW);
#endif
AddLocalizedString("destinationLabel", IDS_PRINT_PREVIEW_DESTINATION_LABEL);
AddLocalizedString("copiesLabel", IDS_PRINT_PREVIEW_COPIES_LABEL);
AddLocalizedString("examplePageRangeText",
IDS_PRINT_PREVIEW_EXAMPLE_PAGE_RANGE_TEXT);
AddLocalizedString("layoutLabel", IDS_PRINT_PREVIEW_LAYOUT_LABEL);
AddLocalizedString("optionAllPages", IDS_PRINT_PREVIEW_OPTION_ALL_PAGES);
AddLocalizedString("optionBw", IDS_PRINT_PREVIEW_OPTION_BW);
AddLocalizedString("optionCollate", IDS_PRINT_PREVIEW_OPTION_COLLATE);
AddLocalizedString("optionColor", IDS_PRINT_PREVIEW_OPTION_COLOR);
AddLocalizedString("optionLandscape", IDS_PRINT_PREVIEW_OPTION_LANDSCAPE);
AddLocalizedString("optionPortrait", IDS_PRINT_PREVIEW_OPTION_PORTRAIT);
AddLocalizedString("optionTwoSided", IDS_PRINT_PREVIEW_OPTION_TWO_SIDED);
AddLocalizedString("pagesLabel", IDS_PRINT_PREVIEW_PAGES_LABEL);
AddLocalizedString("pageRangeTextBox", IDS_PRINT_PREVIEW_PAGE_RANGE_TEXT);
AddLocalizedString("pageRangeRadio", IDS_PRINT_PREVIEW_PAGE_RANGE_RADIO);
AddLocalizedString("printToPDF", IDS_PRINT_PREVIEW_PRINT_TO_PDF);
AddLocalizedString("printPreviewTitleFormat", IDS_PRINT_PREVIEW_TITLE_FORMAT);
AddLocalizedString("printPreviewSummaryFormatShort",
IDS_PRINT_PREVIEW_SUMMARY_FORMAT_SHORT);
AddLocalizedString("printPreviewSummaryFormatLong",
IDS_PRINT_PREVIEW_SUMMARY_FORMAT_LONG);
AddLocalizedString("printPreviewSheetsLabelSingular",
IDS_PRINT_PREVIEW_SHEETS_LABEL_SINGULAR);
AddLocalizedString("printPreviewSheetsLabelPlural",
IDS_PRINT_PREVIEW_SHEETS_LABEL_PLURAL);
AddLocalizedString("printPreviewPageLabelSingular",
IDS_PRINT_PREVIEW_PAGE_LABEL_SINGULAR);
AddLocalizedString("printPreviewPageLabelPlural",
IDS_PRINT_PREVIEW_PAGE_LABEL_PLURAL);
const string16 shortcut_text(UTF8ToUTF16(kAdvancedPrintShortcut));
#if defined(OS_CHROMEOS)
AddString("cloudPrintDialogOption", l10n_util::GetStringFUTF16(
IDS_PRINT_PREVIEW_CLOUD_DIALOG_OPTION,
l10n_util::GetStringUTF16(IDS_GOOGLE_CLOUD_PRINT),
shortcut_text));
AddLocalizedString("printWithCloudPrint",
IDS_PRINT_PREVIEW_MORE_PRINTERS);
#else
AddString("systemDialogOption", l10n_util::GetStringFUTF16(
IDS_PRINT_PREVIEW_SYSTEM_DIALOG_OPTION,
shortcut_text));
AddString("printWithCloudPrint", l10n_util::GetStringFUTF16(
IDS_PRINT_PREVIEW_PRINT_WITH_CLOUD_PRINT,
l10n_util::GetStringUTF16(IDS_GOOGLE_CLOUD_PRINT)));
#endif
#if defined(OS_MACOSX)
AddLocalizedString("openPdfInPreviewOption",
IDS_PRINT_PREVIEW_OPEN_PDF_IN_PREVIEW_APP);
#endif
AddString("printWithCloudPrintWait", l10n_util::GetStringFUTF16(
IDS_PRINT_PREVIEW_PRINT_WITH_CLOUD_PRINT_WAIT,
l10n_util::GetStringUTF16(IDS_GOOGLE_CLOUD_PRINT)));
AddLocalizedString("pageRangeInstruction",
IDS_PRINT_PREVIEW_PAGE_RANGE_INSTRUCTION);
AddLocalizedString("copiesInstruction", IDS_PRINT_PREVIEW_COPIES_INSTRUCTION);
AddLocalizedString("signIn", IDS_PRINT_PREVIEW_SIGN_IN);
AddLocalizedString("managePrinters", IDS_PRINT_PREVIEW_MANAGE_PRINTERS);
AddLocalizedString("incrementTitle", IDS_PRINT_PREVIEW_INCREMENT_TITLE);
AddLocalizedString("decrementTitle", IDS_PRINT_PREVIEW_DECREMENT_TITLE);
AddLocalizedString("printPagesLabel", IDS_PRINT_PREVIEW_PRINT_PAGES_LABEL);
AddLocalizedString("optionsLabel", IDS_PRINT_PREVIEW_OPTIONS_LABEL);
AddLocalizedString("optionHeaderFooter",
IDS_PRINT_PREVIEW_OPTION_HEADER_FOOTER);
AddLocalizedString("marginsLabel", IDS_PRINT_PREVIEW_MARGINS_LABEL);
AddLocalizedString("defaultMargins", IDS_PRINT_PREVIEW_DEFAULT_MARGINS);
AddLocalizedString("noMargins", IDS_PRINT_PREVIEW_NO_MARGINS);
AddLocalizedString("customMargins", IDS_PRINT_PREVIEW_CUSTOM_MARGINS);
AddLocalizedString("minimumMargins", IDS_PRINT_PREVIEW_MINIMUM_MARGINS);
AddLocalizedString("top", IDS_PRINT_PREVIEW_TOP_MARGIN_LABEL);
AddLocalizedString("bottom", IDS_PRINT_PREVIEW_BOTTOM_MARGIN_LABEL);
AddLocalizedString("left", IDS_PRINT_PREVIEW_LEFT_MARGIN_LABEL);
AddLocalizedString("right", IDS_PRINT_PREVIEW_RIGHT_MARGIN_LABEL);
set_json_path("strings.js");
add_resource_path("print_preview.js", IDR_PRINT_PREVIEW_JS);
set_default_resource(IDR_PRINT_PREVIEW_HTML);
}
| 1
|
117,342
|
xmlSetEntityReferenceFunc(xmlEntityReferenceFunc func)
{
xmlEntityRefFunc = func;
}
| 0
|
404,417
|
static void ipa_flood_interior(wmfAPI * API, wmfFlood_t * flood)
{
/* Save graphic wand */
(void) PushDrawingWand(WmfDrawingWand);
draw_fill_color_rgb(API,&(flood->color));
DrawColor(WmfDrawingWand,XC(flood->pt.x), YC(flood->pt.y),
FillToBorderMethod);
/* Restore graphic wand */
(void) PopDrawingWand(WmfDrawingWand);
}
| 0
|
319,786
|
static void apic_common_class_init(ObjectClass *klass, void *data)
{
ICCDeviceClass *idc = ICC_DEVICE_CLASS(klass);
DeviceClass *dc = DEVICE_CLASS(klass);
dc->vmsd = &vmstate_apic_common;
dc->reset = apic_reset_common;
dc->no_user = 1;
dc->props = apic_properties_common;
idc->init = apic_init_common;
}
| 1
|
155,344
|
DEFUN(defCSet, DEFAULT_CHARSET, "Change the default character encoding")
{
char *cs;
wc_ces charset;
cs = searchKeyData();
if (cs == NULL || *cs == '\0')
/* FIXME: gettextize? */
cs = inputStr("Default document charset: ",
wc_ces_to_charset(DocumentCharset));
charset = wc_guess_charset_short(cs, 0);
if (charset != 0)
DocumentCharset = charset;
displayBuffer(Currentbuf, B_NORMAL);
}
| 0
|
223,825
|
RenderFrameHostImpl::GetOrCreateBrowserAccessibilityManager() {
RenderWidgetHostViewBase* view = GetViewForAccessibility();
if (view &&
!browser_accessibility_manager_ &&
!no_create_browser_accessibility_manager_for_testing_) {
bool is_root_frame = !frame_tree_node()->parent();
browser_accessibility_manager_.reset(
view->CreateBrowserAccessibilityManager(this, is_root_frame));
}
return browser_accessibility_manager_.get();
}
| 0
|
23,655
|
const char * http_hdr_reason_lookup ( unsigned status ) {
# define HTTP_STATUS_ENTRY ( value , reason ) case value : return # reason switch ( status ) {
HTTP_STATUS_ENTRY ( 0 , None ) ;
HTTP_STATUS_ENTRY ( 100 , Continue ) ;
HTTP_STATUS_ENTRY ( 101 , Switching Protocols ) ;
HTTP_STATUS_ENTRY ( 102 , Processing ) ;
HTTP_STATUS_ENTRY ( 103 , Early Hints ) ;
HTTP_STATUS_ENTRY ( 200 , OK ) ;
HTTP_STATUS_ENTRY ( 201 , Created ) ;
HTTP_STATUS_ENTRY ( 202 , Accepted ) ;
HTTP_STATUS_ENTRY ( 203 , Non - Authoritative Information ) ;
HTTP_STATUS_ENTRY ( 204 , No Content ) ;
HTTP_STATUS_ENTRY ( 205 , Reset Content ) ;
HTTP_STATUS_ENTRY ( 206 , Partial Content ) ;
HTTP_STATUS_ENTRY ( 207 , Multi - Status ) ;
HTTP_STATUS_ENTRY ( 208 , Already Reported ) ;
HTTP_STATUS_ENTRY ( 226 , IM Used ) ;
HTTP_STATUS_ENTRY ( 300 , Multiple Choices ) ;
HTTP_STATUS_ENTRY ( 301 , Moved Permanently ) ;
HTTP_STATUS_ENTRY ( 302 , Found ) ;
HTTP_STATUS_ENTRY ( 303 , See Other ) ;
HTTP_STATUS_ENTRY ( 304 , Not Modified ) ;
HTTP_STATUS_ENTRY ( 305 , Use Proxy ) ;
HTTP_STATUS_ENTRY ( 307 , Temporary Redirect ) ;
HTTP_STATUS_ENTRY ( 308 , Permanent Redirect ) ;
HTTP_STATUS_ENTRY ( 400 , Bad Request ) ;
HTTP_STATUS_ENTRY ( 401 , Unauthorized ) ;
HTTP_STATUS_ENTRY ( 402 , Payment Required ) ;
HTTP_STATUS_ENTRY ( 403 , Forbidden ) ;
HTTP_STATUS_ENTRY ( 404 , Not Found ) ;
HTTP_STATUS_ENTRY ( 405 , Method Not Allowed ) ;
HTTP_STATUS_ENTRY ( 406 , Not Acceptable ) ;
HTTP_STATUS_ENTRY ( 407 , Proxy Authentication Required ) ;
HTTP_STATUS_ENTRY ( 408 , Request Timeout ) ;
HTTP_STATUS_ENTRY ( 409 , Conflict ) ;
HTTP_STATUS_ENTRY ( 410 , Gone ) ;
HTTP_STATUS_ENTRY ( 411 , Length Required ) ;
HTTP_STATUS_ENTRY ( 412 , Precondition Failed ) ;
HTTP_STATUS_ENTRY ( 413 , Request Entity Too Large ) ;
HTTP_STATUS_ENTRY ( 414 , Request - URI Too Long ) ;
HTTP_STATUS_ENTRY ( 415 , Unsupported Media Type ) ;
HTTP_STATUS_ENTRY ( 416 , Requested Range Not Satisfiable ) ;
HTTP_STATUS_ENTRY ( 417 , Expectation Failed ) ;
HTTP_STATUS_ENTRY ( 422 , Unprocessable Entity ) ;
HTTP_STATUS_ENTRY ( 423 , Locked ) ;
HTTP_STATUS_ENTRY ( 424 , Failed Dependency ) ;
HTTP_STATUS_ENTRY ( 426 , Upgrade Required ) ;
HTTP_STATUS_ENTRY ( 428 , Precondition Required ) ;
HTTP_STATUS_ENTRY ( 429 , Too Many Requests ) ;
HTTP_STATUS_ENTRY ( 431 , Request Header Fields Too Large ) ;
HTTP_STATUS_ENTRY ( 500 , Internal Server Error ) ;
HTTP_STATUS_ENTRY ( 501 , Not Implemented ) ;
HTTP_STATUS_ENTRY ( 502 , Bad Gateway ) ;
HTTP_STATUS_ENTRY ( 503 , Service Unavailable ) ;
HTTP_STATUS_ENTRY ( 504 , Gateway Timeout ) ;
HTTP_STATUS_ENTRY ( 505 , HTTP Version Not Supported ) ;
HTTP_STATUS_ENTRY ( 506 , Variant Also Negotiates ) ;
HTTP_STATUS_ENTRY ( 507 , Insufficient Storage ) ;
HTTP_STATUS_ENTRY ( 508 , Loop Detected ) ;
HTTP_STATUS_ENTRY ( 510 , Not Extended ) ;
HTTP_STATUS_ENTRY ( 511 , Network Authentication Required ) ;
}
# undef HTTP_STATUS_ENTRY return nullptr ;
}
| 0
|
410,338
|
MemIo::~MemIo()
{
if (p_->isMalloced_) {
std::free(p_->data_);
}
delete p_;
}
| 0
|
295,996
|
static int oidc_handle_logout(request_rec *r, oidc_cfg *c,
oidc_session_t *session) {
oidc_provider_t *provider = NULL;
/* pickup the command or URL where the user wants to go after logout */
char *url = NULL;
char *error_str = NULL;
char *error_description = NULL;
oidc_util_get_request_parameter(r, OIDC_REDIRECT_URI_REQUEST_LOGOUT, &url);
oidc_debug(r, "enter (url=%s)", url);
if (oidc_is_front_channel_logout(url)) {
return oidc_handle_logout_request(r, c, session, url);
} else if (oidc_is_back_channel_logout(url)) {
return oidc_handle_logout_backchannel(r, c);
}
if ((url == NULL) || (apr_strnatcmp(url, "") == 0)) {
url = c->default_slo_url;
} else {
/* do input validation on the logout parameter value */
if (oidc_validate_redirect_url(r, c, url, TRUE, &error_str,
&error_description) == FALSE) {
return oidc_util_html_send_error(r, c->error_template, error_str,
error_description,
HTTP_BAD_REQUEST);
}
}
oidc_get_provider_from_session(r, c, session, &provider);
if ((provider != NULL) && (provider->end_session_endpoint != NULL)) {
const char *id_token_hint = oidc_session_get_idtoken(r, session);
char *logout_request = apr_pstrdup(r->pool,
provider->end_session_endpoint);
if (id_token_hint != NULL) {
logout_request = apr_psprintf(r->pool, "%s%sid_token_hint=%s",
logout_request, strchr(logout_request ? logout_request : "",
OIDC_CHAR_QUERY) != NULL ?
OIDC_STR_AMP :
OIDC_STR_QUERY,
oidc_util_escape_string(r, id_token_hint));
}
if (url != NULL) {
logout_request = apr_psprintf(r->pool,
"%s%spost_logout_redirect_uri=%s", logout_request,
strchr(logout_request ? logout_request : "",
OIDC_CHAR_QUERY) != NULL ?
OIDC_STR_AMP :
OIDC_STR_QUERY,
oidc_util_escape_string(r, url));
}
url = logout_request;
}
return oidc_handle_logout_request(r, c, session, url);
}
| 0
|
477,308
|
static int ax88179_chk_eee(struct usbnet *dev)
{
struct ethtool_cmd ecmd = { .cmd = ETHTOOL_GSET };
struct ax88179_data *priv = (struct ax88179_data *)dev->data;
mii_ethtool_gset(&dev->mii, &ecmd);
if (ecmd.duplex & DUPLEX_FULL) {
int eee_lp, eee_cap, eee_adv;
u32 lp, cap, adv, supported = 0;
eee_cap = ax88179_phy_read_mmd_indirect(dev,
MDIO_PCS_EEE_ABLE,
MDIO_MMD_PCS);
if (eee_cap < 0) {
priv->eee_active = 0;
return false;
}
cap = mmd_eee_cap_to_ethtool_sup_t(eee_cap);
if (!cap) {
priv->eee_active = 0;
return false;
}
eee_lp = ax88179_phy_read_mmd_indirect(dev,
MDIO_AN_EEE_LPABLE,
MDIO_MMD_AN);
if (eee_lp < 0) {
priv->eee_active = 0;
return false;
}
eee_adv = ax88179_phy_read_mmd_indirect(dev,
MDIO_AN_EEE_ADV,
MDIO_MMD_AN);
if (eee_adv < 0) {
priv->eee_active = 0;
return false;
}
adv = mmd_eee_adv_to_ethtool_adv_t(eee_adv);
lp = mmd_eee_adv_to_ethtool_adv_t(eee_lp);
supported = (ecmd.speed == SPEED_1000) ?
SUPPORTED_1000baseT_Full :
SUPPORTED_100baseT_Full;
if (!(lp & adv & supported)) {
priv->eee_active = 0;
return false;
}
priv->eee_active = 1;
return true;
}
priv->eee_active = 0;
return false;
}
| 0
|
440,110
|
ModuleExport void UnregisterPS2Image(void)
{
(void) UnregisterMagickInfo("EPS2");
(void) UnregisterMagickInfo("PS2");
}
| 0
|
364,017
|
void get_agp_version(struct agp_bridge_data *bridge)
{
u32 ncapid;
/* Exit early if already set by errata workarounds. */
if (bridge->major_version != 0)
return;
pci_read_config_dword(bridge->dev, bridge->capndx, &ncapid);
bridge->major_version = (ncapid >> AGP_MAJOR_VERSION_SHIFT) & 0xf;
bridge->minor_version = (ncapid >> AGP_MINOR_VERSION_SHIFT) & 0xf;
}
| 0
|
327,280
|
build_fadt(GArray *table_data, BIOSLinker *linker, AcpiPmInfo *pm,
unsigned facs, unsigned dsdt,
const char *oem_id, const char *oem_table_id)
{
AcpiFadtDescriptorRev1 *fadt = acpi_data_push(table_data, sizeof(*fadt));
fadt->firmware_ctrl = cpu_to_le32(facs);
/* FACS address to be filled by Guest linker */
bios_linker_loader_add_pointer(linker, ACPI_BUILD_TABLE_FILE,
ACPI_BUILD_TABLE_FILE,
&fadt->firmware_ctrl,
sizeof fadt->firmware_ctrl);
fadt->dsdt = cpu_to_le32(dsdt);
/* DSDT address to be filled by Guest linker */
bios_linker_loader_add_pointer(linker, ACPI_BUILD_TABLE_FILE,
ACPI_BUILD_TABLE_FILE,
&fadt->dsdt,
sizeof fadt->dsdt);
fadt_setup(fadt, pm);
build_header(linker, table_data,
(void *)fadt, "FACP", sizeof(*fadt), 1, oem_id, oem_table_id);
}
| 0
|
245,793
|
mac_init (digest_hd_st* td, gnutls_mac_algorithm_t mac, opaque * secret, int secret_size,
int ver)
{
int ret = 0;
if (mac == GNUTLS_MAC_NULL)
{
gnutls_assert();
return GNUTLS_E_HASH_FAILED;
}
if (ver == GNUTLS_SSL3)
{ /* SSL 3.0 */
ret = _gnutls_mac_init_ssl3 (td, mac, secret, secret_size);
}
else
{ /* TLS 1.x */
ret = _gnutls_hmac_init (td, mac, secret, secret_size);
}
return ret;
}
| 0
|
227,656
|
horizontalAccumulate16(uint16 *wp, int n, int stride, uint16 *op,
uint16 *ToLinear16)
{
register unsigned int cr, cg, cb, ca, mask;
if (n >= stride) {
mask = CODE_MASK;
if (stride == 3) {
op[0] = ToLinear16[cr = (wp[0] & mask)];
op[1] = ToLinear16[cg = (wp[1] & mask)];
op[2] = ToLinear16[cb = (wp[2] & mask)];
n -= 3;
while (n > 0) {
wp += 3;
op += 3;
n -= 3;
op[0] = ToLinear16[(cr += wp[0]) & mask];
op[1] = ToLinear16[(cg += wp[1]) & mask];
op[2] = ToLinear16[(cb += wp[2]) & mask];
}
} else if (stride == 4) {
op[0] = ToLinear16[cr = (wp[0] & mask)];
op[1] = ToLinear16[cg = (wp[1] & mask)];
op[2] = ToLinear16[cb = (wp[2] & mask)];
op[3] = ToLinear16[ca = (wp[3] & mask)];
n -= 4;
while (n > 0) {
wp += 4;
op += 4;
n -= 4;
op[0] = ToLinear16[(cr += wp[0]) & mask];
op[1] = ToLinear16[(cg += wp[1]) & mask];
op[2] = ToLinear16[(cb += wp[2]) & mask];
op[3] = ToLinear16[(ca += wp[3]) & mask];
}
} else {
REPEAT(stride, *op = ToLinear16[*wp&mask]; wp++; op++)
n -= stride;
while (n > 0) {
REPEAT(stride,
wp[stride] += *wp; *op = ToLinear16[*wp&mask]; wp++; op++)
n -= stride;
}
}
}
}
| 0
|
303,768
|
static BOOL update_read_polyline_order(wStream* s, const ORDER_INFO* orderInfo,
POLYLINE_ORDER* polyline)
{
UINT16 word;
UINT32 new_num = polyline->numDeltaEntries;
ORDER_FIELD_COORD(1, polyline->xStart);
ORDER_FIELD_COORD(2, polyline->yStart);
ORDER_FIELD_BYTE(3, polyline->bRop2);
ORDER_FIELD_UINT16(4, word);
ORDER_FIELD_COLOR(orderInfo, s, 5, &polyline->penColor);
ORDER_FIELD_BYTE(6, new_num);
if (orderInfo->fieldFlags & ORDER_FIELD_07)
{
DELTA_POINT* new_points;
if (new_num == 0)
return FALSE;
if (Stream_GetRemainingLength(s) < 1)
{
WLog_ERR(TAG, "Stream_GetRemainingLength(s) < 1");
return FALSE;
}
Stream_Read_UINT8(s, polyline->cbData);
new_points = (DELTA_POINT*)realloc(polyline->points, sizeof(DELTA_POINT) * new_num);
if (!new_points)
{
WLog_ERR(TAG, "realloc(%" PRIu32 ") failed", new_num);
return FALSE;
}
polyline->points = new_points;
polyline->numDeltaEntries = new_num;
return update_read_delta_points(s, polyline->points, polyline->numDeltaEntries,
polyline->xStart, polyline->yStart);
}
return TRUE;
}
| 0
|
411,299
|
**/
CImg<T>& RGBtoXYZ(const bool use_D65=true) {
if (_spectrum!=3)
throw CImgInstanceException(_cimg_instance
"RGBtoXYZ(): Instance is not a RGB image.",
cimg_instance);
T *p1 = data(0,0,0,0), *p2 = data(0,0,0,1), *p3 = data(0,0,0,2);
const ulongT whd = (ulongT)_width*_height*_depth;
cimg_pragma_openmp(parallel for cimg_openmp_if(whd>=2048))
for (ulongT N = 0; N<whd; ++N) {
const Tfloat
R = (Tfloat)p1[N]/255,
G = (Tfloat)p2[N]/255,
B = (Tfloat)p3[N]/255;
if (use_D65) { // D65
p1[N] = (T)(0.4124564*R + 0.3575761*G + 0.1804375*B);
p2[N] = (T)(0.2126729*R + 0.7151522*G + 0.0721750*B);
p3[N] = (T)(0.0193339*R + 0.1191920*G + 0.9503041*B);
} else { // D50
p1[N] = (T)(0.43603516*R + 0.38511658*G + 0.14305115*B);
p2[N] = (T)(0.22248840*R + 0.71690369*G + 0.06060791*B);
p3[N] = (T)(0.01391602*R + 0.09706116*G + 0.71392822*B);
}
}
return *this;
| 0
|
75,154
|
void gf_media_get_sample_average_infos(GF_ISOFile *file, u32 Track, u32 *avgSize, u32 *MaxSize, u32 *TimeDelta, u32 *maxCTSDelta, u32 *const_duration, u32 *bandwidth)
{
u32 i, count, ts_diff;
u64 prevTS, tdelta;
Double bw;
GF_ISOSample *samp;
*avgSize = *MaxSize = 0;
*TimeDelta = 0;
*maxCTSDelta = 0;
bw = 0;
prevTS = 0;
tdelta = 0;
count = gf_isom_get_sample_count(file, Track);
if (!count) return;
*const_duration = 0;
for (i=0; i<count; i++) {
samp = gf_isom_get_sample_info(file, Track, i+1, NULL, NULL);
if (!samp) break;
//get the size
*avgSize += samp->dataLength;
if (*MaxSize < samp->dataLength) *MaxSize = samp->dataLength;
ts_diff = (u32) (samp->DTS+samp->CTS_Offset - prevTS);
//get the time
tdelta += ts_diff;
if (i==1) {
*const_duration = ts_diff;
} else if ( (i<count-1) && (*const_duration != ts_diff) ) {
*const_duration = 0;
}
prevTS = samp->DTS+samp->CTS_Offset;
bw += 8*samp->dataLength;
//get the CTS delta
if ((samp->CTS_Offset>=0) && ((u32)samp->CTS_Offset > *maxCTSDelta))
*maxCTSDelta = samp->CTS_Offset;
gf_isom_sample_del(&samp);
}
if (count>1) *TimeDelta = (u32) (tdelta/ (count-1) );
else *TimeDelta = (u32) tdelta;
*avgSize /= count;
bw *= gf_isom_get_media_timescale(file, Track);
bw /= (s64) gf_isom_get_media_duration(file, Track);
bw /= 1000;
(*bandwidth) = (u32) (bw+0.5);
//delta is NOT an average, we need to know exactly how many bits are
//needed to encode CTS-DTS for ANY samples
}
| 0
|
27,152
|
void ptvcursor_set_tree ( ptvcursor_t * ptvc , proto_tree * tree ) {
ptvc -> tree = tree ;
}
| 0
|
82,155
|
int split_huge_page(struct page *page)
{
struct anon_vma *anon_vma;
int ret = 1;
BUG_ON(!PageAnon(page));
anon_vma = page_lock_anon_vma(page);
if (!anon_vma)
goto out;
ret = 0;
if (!PageCompound(page))
goto out_unlock;
BUG_ON(!PageSwapBacked(page));
__split_huge_page(page, anon_vma);
count_vm_event(THP_SPLIT);
BUG_ON(PageCompound(page));
out_unlock:
page_unlock_anon_vma(anon_vma);
out:
return ret;
}
| 0
|
125,643
|
//! Return a pointer to a located pixel value \const.
const T* data(const unsigned int x, const unsigned int y=0, const unsigned int z=0, const unsigned int c=0) const {
return const_cast<CImg<T>*>(this)->data(x,y,z,c);
| 0
|
318,284
|
static int cms_copy_content(BIO *out, BIO *in, unsigned int flags)
{
unsigned char buf[4096];
int r = 0, i;
BIO *tmpout;
tmpout = cms_get_text_bio(out, flags);
if (tmpout == NULL) {
CMSerr(CMS_F_CMS_COPY_CONTENT, ERR_R_MALLOC_FAILURE);
goto err;
}
/* Read all content through chain to process digest, decrypt etc */
for (;;) {
i = BIO_read(in, buf, sizeof(buf));
if (i <= 0) {
if (BIO_method_type(in) == BIO_TYPE_CIPHER) {
if (!BIO_get_cipher_status(in))
goto err;
}
if (i < 0)
goto err;
break;
}
if (tmpout && (BIO_write(tmpout, buf, i) != i))
goto err;
}
if (flags & CMS_TEXT) {
if (!SMIME_text(tmpout, out)) {
CMSerr(CMS_F_CMS_COPY_CONTENT, CMS_R_SMIME_TEXT_ERROR);
goto err;
}
}
r = 1;
err:
if (tmpout != out)
BIO_free(tmpout);
return r;
}
| 0
|
43,463
|
base64_flush(TScreen *screen)
{
Char x;
TRACE(("base64_flush count %d, pad %d (%d)\n",
screen->base64_count,
screen->base64_pad,
screen->base64_pad & 3));
switch (screen->base64_count) {
case 0:
break;
case 2:
x = CharOf(base64_code[screen->base64_accu << 4]);
tty_vwrite(screen->respond, &x, 1);
break;
case 4:
x = CharOf(base64_code[screen->base64_accu << 2]);
tty_vwrite(screen->respond, &x, 1);
break;
}
if (screen->base64_pad & 3) {
tty_vwrite(screen->respond,
(const Char *) "===",
(unsigned) (3 - (screen->base64_pad & 3)));
}
screen->base64_count = 0;
screen->base64_accu = 0;
screen->base64_pad = 0;
}
| 0
|
164,519
|
error::Error GLES2DecoderPassthroughImpl::DoGetTexParameterfv(GLenum target,
GLenum pname,
GLsizei bufsize,
GLsizei* length,
GLfloat* params) {
api()->glGetTexParameterfvRobustANGLEFn(target, pname, bufsize, length,
params);
return error::kNoError;
}
| 0
|
485,857
|
sctp_disposition_t sctp_sf_ootb(const struct sctp_endpoint *ep,
const struct sctp_association *asoc,
const sctp_subtype_t type,
void *arg,
sctp_cmd_seq_t *commands)
{
struct sctp_chunk *chunk = arg;
struct sk_buff *skb = chunk->skb;
sctp_chunkhdr_t *ch;
__u8 *ch_end;
int ootb_shut_ack = 0;
SCTP_INC_STATS(SCTP_MIB_OUTOFBLUES);
ch = (sctp_chunkhdr_t *) chunk->chunk_hdr;
do {
/* Break out if chunk length is less then minimal. */
if (ntohs(ch->length) < sizeof(sctp_chunkhdr_t))
break;
ch_end = ((__u8 *)ch) + WORD_ROUND(ntohs(ch->length));
if (ch_end > skb->tail)
break;
if (SCTP_CID_SHUTDOWN_ACK == ch->type)
ootb_shut_ack = 1;
/* RFC 2960, Section 3.3.7
* Moreover, under any circumstances, an endpoint that
* receives an ABORT MUST NOT respond to that ABORT by
* sending an ABORT of its own.
*/
if (SCTP_CID_ABORT == ch->type)
return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
ch = (sctp_chunkhdr_t *) ch_end;
} while (ch_end < skb->tail);
if (ootb_shut_ack)
sctp_sf_shut_8_4_5(ep, asoc, type, arg, commands);
else
sctp_sf_tabort_8_4_8(ep, asoc, type, arg, commands);
return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
}
| 0
|
423,023
|
void __init tcp_init(void)
{
struct sk_buff *skb = NULL;
unsigned long limit;
int max_rshare, max_wshare, cnt;
unsigned int i;
BUILD_BUG_ON(sizeof(struct tcp_skb_cb) > sizeof(skb->cb));
percpu_counter_init(&tcp_sockets_allocated, 0);
percpu_counter_init(&tcp_orphan_count, 0);
tcp_hashinfo.bind_bucket_cachep =
kmem_cache_create("tcp_bind_bucket",
sizeof(struct inet_bind_bucket), 0,
SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
/* Size and allocate the main established and bind bucket
* hash tables.
*
* The methodology is similar to that of the buffer cache.
*/
tcp_hashinfo.ehash =
alloc_large_system_hash("TCP established",
sizeof(struct inet_ehash_bucket),
thash_entries,
17, /* one slot per 128 KB of memory */
0,
NULL,
&tcp_hashinfo.ehash_mask,
0,
thash_entries ? 0 : 512 * 1024);
for (i = 0; i <= tcp_hashinfo.ehash_mask; i++)
INIT_HLIST_NULLS_HEAD(&tcp_hashinfo.ehash[i].chain, i);
if (inet_ehash_locks_alloc(&tcp_hashinfo))
panic("TCP: failed to alloc ehash_locks");
tcp_hashinfo.bhash =
alloc_large_system_hash("TCP bind",
sizeof(struct inet_bind_hashbucket),
tcp_hashinfo.ehash_mask + 1,
17, /* one slot per 128 KB of memory */
0,
&tcp_hashinfo.bhash_size,
NULL,
0,
64 * 1024);
tcp_hashinfo.bhash_size = 1U << tcp_hashinfo.bhash_size;
for (i = 0; i < tcp_hashinfo.bhash_size; i++) {
spin_lock_init(&tcp_hashinfo.bhash[i].lock);
INIT_HLIST_HEAD(&tcp_hashinfo.bhash[i].chain);
}
cnt = tcp_hashinfo.ehash_mask + 1;
tcp_death_row.sysctl_max_tw_buckets = cnt / 2;
sysctl_tcp_max_orphans = cnt / 2;
sysctl_max_syn_backlog = max(128, cnt / 256);
tcp_init_mem();
/* Set per-socket limits to no more than 1/128 the pressure threshold */
limit = nr_free_buffer_pages() << (PAGE_SHIFT - 7);
max_wshare = min(4UL*1024*1024, limit);
max_rshare = min(6UL*1024*1024, limit);
sysctl_tcp_wmem[0] = SK_MEM_QUANTUM;
sysctl_tcp_wmem[1] = 16*1024;
sysctl_tcp_wmem[2] = max(64*1024, max_wshare);
sysctl_tcp_rmem[0] = SK_MEM_QUANTUM;
sysctl_tcp_rmem[1] = 87380;
sysctl_tcp_rmem[2] = max(87380, max_rshare);
pr_info("Hash tables configured (established %u bind %u)\n",
tcp_hashinfo.ehash_mask + 1, tcp_hashinfo.bhash_size);
tcp_metrics_init();
tcp_register_congestion_control(&tcp_reno);
tcp_tasklet_init();
}
| 0
|
441,458
|
void RGWPutObj_ObjStore_S3::send_response()
{
if (op_ret) {
set_req_state_err(s, op_ret);
dump_errno(s);
} else {
if (s->cct->_conf->rgw_s3_success_create_obj_status) {
op_ret = get_success_retcode(
s->cct->_conf->rgw_s3_success_create_obj_status);
set_req_state_err(s, op_ret);
}
if (copy_source.empty()) {
dump_errno(s);
dump_etag(s, etag);
dump_content_length(s, 0);
dump_header_if_nonempty(s, "x-amz-version-id", version_id);
for (auto &it : crypt_http_responses)
dump_header(s, it.first, it.second);
} else {
dump_errno(s);
dump_header_if_nonempty(s, "x-amz-version-id", version_id);
end_header(s, this, "application/xml");
dump_start(s);
struct tm tmp;
utime_t ut(mtime);
time_t secs = (time_t)ut.sec();
gmtime_r(&secs, &tmp);
char buf[TIME_BUF_SIZE];
s->formatter->open_object_section_in_ns("CopyPartResult",
"http://s3.amazonaws.com/doc/2006-03-01/");
if (strftime(buf, sizeof(buf), "%Y-%m-%dT%T.000Z", &tmp) > 0) {
s->formatter->dump_string("LastModified", buf);
}
s->formatter->dump_string("ETag", etag);
s->formatter->close_section();
rgw_flush_formatter_and_reset(s, s->formatter);
return;
}
}
if (s->system_request && !real_clock::is_zero(mtime)) {
dump_epoch_header(s, "Rgwx-Mtime", mtime);
}
end_header(s, this);
}
| 0
|
358,166
|
int readdir_search_pagecache(nfs_readdir_descriptor_t *desc)
{
int loop_count = 0;
int res;
/* Always search-by-index from the beginning of the cache */
if (*desc->dir_cookie == 0) {
dfprintk(DIRCACHE, "NFS: readdir_search_pagecache() searching for offset %Ld\n",
(long long)desc->file->f_pos);
desc->page_index = 0;
desc->entry->cookie = desc->entry->prev_cookie = 0;
desc->entry->eof = 0;
desc->current_index = 0;
} else
dfprintk(DIRCACHE, "NFS: readdir_search_pagecache() searching for cookie %Lu\n",
(unsigned long long)*desc->dir_cookie);
for (;;) {
res = find_dirent_page(desc);
if (res != -EAGAIN)
break;
/* Align to beginning of next page */
desc->page_index ++;
if (loop_count++ > 200) {
loop_count = 0;
schedule();
}
}
dfprintk(DIRCACHE, "NFS: %s: returns %d\n", __FUNCTION__, res);
return res;
}
| 0
|
482,030
|
static ssize_t smtcfb_write(struct fb_info *info, const char __user *buf,
size_t count, loff_t *ppos)
{
unsigned long p = *ppos;
u32 *buffer, *src;
u32 __iomem *dst;
int c, i, cnt = 0, err = 0;
unsigned long total_size;
if (!info || !info->screen_base)
return -ENODEV;
if (info->state != FBINFO_STATE_RUNNING)
return -EPERM;
total_size = info->screen_size;
if (total_size == 0)
total_size = info->fix.smem_len;
if (p > total_size)
return -EFBIG;
if (count > total_size) {
err = -EFBIG;
count = total_size;
}
if (count + p > total_size) {
if (!err)
err = -ENOSPC;
count = total_size - p;
}
buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, GFP_KERNEL);
if (!buffer)
return -ENOMEM;
dst = (u32 __iomem *)(info->screen_base + p);
if (info->fbops->fb_sync)
info->fbops->fb_sync(info);
while (count) {
c = (count > PAGE_SIZE) ? PAGE_SIZE : count;
src = buffer;
if (copy_from_user(src, buf, c)) {
err = -EFAULT;
break;
}
for (i = c >> 2; i--;) {
fb_writel(big_swap(*src), dst++);
src++;
}
if (c & 3) {
u8 *src8 = (u8 *)src;
u8 __iomem *dst8 = (u8 __iomem *)dst;
for (i = c & 3; i--;) {
if (i & 1) {
fb_writeb(*src8++, ++dst8);
} else {
fb_writeb(*src8++, --dst8);
dst8 += 2;
}
}
dst = (u32 __iomem *)dst8;
}
*ppos += c;
buf += c;
cnt += c;
count -= c;
}
kfree(buffer);
return (cnt) ? cnt : err;
}
| 0
|
97,968
|
static void mip6_addr_swap(struct sk_buff *skb)
{
struct ipv6hdr *iph = ipv6_hdr(skb);
struct inet6_skb_parm *opt = IP6CB(skb);
struct ipv6_destopt_hao *hao;
struct in6_addr tmp;
int off;
if (opt->dsthao) {
off = ipv6_find_tlv(skb, opt->dsthao, IPV6_TLV_HAO);
if (likely(off >= 0)) {
hao = (struct ipv6_destopt_hao *)
(skb_network_header(skb) + off);
tmp = iph->saddr;
iph->saddr = hao->addr;
hao->addr = tmp;
}
}
}
| 0
|
2,511
|
static int verify_one_dev_extent(struct btrfs_fs_info *fs_info,
u64 chunk_offset, u64 devid,
u64 physical_offset, u64 physical_len)
{
struct extent_map_tree *em_tree = &fs_info->mapping_tree.map_tree;
struct extent_map *em;
struct map_lookup *map;
struct btrfs_device *dev;
u64 stripe_len;
bool found = false;
int ret = 0;
int i;
read_lock(&em_tree->lock);
em = lookup_extent_mapping(em_tree, chunk_offset, 1);
read_unlock(&em_tree->lock);
if (!em) {
btrfs_err(fs_info,
"dev extent physical offset %llu on devid %llu doesn't have corresponding chunk",
physical_offset, devid);
ret = -EUCLEAN;
goto out;
}
map = em->map_lookup;
stripe_len = calc_stripe_length(map->type, em->len, map->num_stripes);
if (physical_len != stripe_len) {
btrfs_err(fs_info,
"dev extent physical offset %llu on devid %llu length doesn't match chunk %llu, have %llu expect %llu",
physical_offset, devid, em->start, physical_len,
stripe_len);
ret = -EUCLEAN;
goto out;
}
for (i = 0; i < map->num_stripes; i++) {
if (map->stripes[i].dev->devid == devid &&
map->stripes[i].physical == physical_offset) {
found = true;
if (map->verified_stripes >= map->num_stripes) {
btrfs_err(fs_info,
"too many dev extents for chunk %llu found",
em->start);
ret = -EUCLEAN;
goto out;
}
map->verified_stripes++;
break;
}
}
if (!found) {
btrfs_err(fs_info,
"dev extent physical offset %llu devid %llu has no corresponding chunk",
physical_offset, devid);
ret = -EUCLEAN;
}
/* Make sure no dev extent is beyond device bondary */
dev = btrfs_find_device(fs_info->fs_devices, devid, NULL, NULL);
if (!dev) {
btrfs_err(fs_info, "failed to find devid %llu", devid);
ret = -EUCLEAN;
goto out;
}
/* It's possible this device is a dummy for seed device */
if (dev->disk_total_bytes == 0) {
dev = find_device(fs_info->fs_devices->seed, devid, NULL);
if (!dev) {
btrfs_err(fs_info, "failed to find seed devid %llu",
devid);
ret = -EUCLEAN;
goto out;
}
}
if (physical_offset + physical_len > dev->disk_total_bytes) {
btrfs_err(fs_info,
"dev extent devid %llu physical offset %llu len %llu is beyond device boundary %llu",
devid, physical_offset, physical_len,
dev->disk_total_bytes);
ret = -EUCLEAN;
goto out;
}
out:
free_extent_map(em);
return ret;
}
| 1
|
122,605
|
enqueue_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *se) { }
| 0
|
461,365
|
int g_dhcp_server_start(GDHCPServer *dhcp_server)
{
GIOChannel *listener_channel;
int listener_sockfd;
if (dhcp_server->started)
return 0;
listener_sockfd = dhcp_l3_socket(SERVER_PORT,
dhcp_server->interface, AF_INET);
if (listener_sockfd < 0)
return -EIO;
listener_channel = g_io_channel_unix_new(listener_sockfd);
if (!listener_channel) {
close(listener_sockfd);
return -EIO;
}
dhcp_server->listener_sockfd = listener_sockfd;
dhcp_server->listener_channel = listener_channel;
g_io_channel_set_close_on_unref(listener_channel, TRUE);
dhcp_server->listener_watch =
g_io_add_watch_full(listener_channel, G_PRIORITY_HIGH,
G_IO_IN | G_IO_NVAL | G_IO_ERR | G_IO_HUP,
listener_event, dhcp_server,
NULL);
g_io_channel_unref(dhcp_server->listener_channel);
dhcp_server->started = TRUE;
return 0;
}
| 0
|
290,078
|
static afs_int32 isAMemberOf ( struct rx_call * call , afs_int32 uid , afs_int32 gid , afs_int32 * flag , afs_int32 * cid ) {
afs_int32 code ;
struct ubik_trans * tt ;
code = Initdb ( ) ;
if ( code != PRSUCCESS ) return code ;
code = ubik_BeginTransReadAny ( dbase , UBIK_READTRANS , & tt ) ;
if ( code ) return code ;
code = ubik_SetLock ( tt , 1 , 1 , LOCKREAD ) ;
if ( code ) ABORT_WITH ( tt , code ) ;
code = read_DbHeader ( tt ) ;
if ( code ) ABORT_WITH ( tt , code ) ;
{
afs_int32 uloc = FindByID ( tt , uid ) ;
afs_int32 gloc = FindByID ( tt , gid ) ;
struct prentry uentry , gentry ;
if ( ! uloc || ! gloc ) ABORT_WITH ( tt , PRNOENT ) ;
code = WhoIsThis ( call , tt , cid ) ;
if ( code ) ABORT_WITH ( tt , PRPERM ) ;
code = pr_ReadEntry ( tt , 0 , uloc , & uentry ) ;
if ( code ) ABORT_WITH ( tt , code ) ;
code = pr_ReadEntry ( tt , 0 , gloc , & gentry ) ;
if ( code ) ABORT_WITH ( tt , code ) ;
# if ! defined ( SUPERGROUPS ) if ( ( uentry . flags & PRGRP ) || ! ( gentry . flags & PRGRP ) ) ABORT_WITH ( tt , PRBADARG ) ;
# else if ( ! ( gentry . flags & PRGRP ) ) ABORT_WITH ( tt , PRBADARG ) ;
# endif if ( ! AccessOK ( tt , * cid , & uentry , 0 , PRP_MEMBER_ANY ) && ! AccessOK ( tt , * cid , & gentry , PRP_MEMBER_MEM , PRP_MEMBER_ANY ) ) ABORT_WITH ( tt , PRPERM ) ;
}
* flag = IsAMemberOf ( tt , uid , gid ) ;
code = ubik_EndTrans ( tt ) ;
return code ;
}
| 0
|
487,670
|
void SendToHost(v8::Isolate* isolate,
gin_helper::ErrorThrower thrower,
const std::string& channel,
v8::Local<v8::Value> arguments) {
if (!electron_ipc_remote_) {
thrower.ThrowError(kIPCMethodCalledAfterContextReleasedError);
return;
}
blink::CloneableMessage message;
if (!electron::SerializeV8Value(isolate, arguments, &message)) {
return;
}
electron_ipc_remote_->MessageHost(channel, std::move(message));
}
| 0
|
422,044
|
mail_config_ews_autodiscover_run_cb (GObject *source_object,
GAsyncResult *result,
gpointer user_data)
{
AsyncContext *async_context = user_data;
EMailConfigEwsAutodiscover *autodiscover;
EAlertSink *alert_sink;
GError *error = NULL;
EMailConfigServiceBackend *backend;
CamelSettings *settings;
autodiscover = async_context->autodiscover;
alert_sink = e_activity_get_alert_sink (async_context->activity);
mail_config_ews_autodiscover_finish (E_MAIL_CONFIG_EWS_AUTODISCOVER (source_object), result, &error);
backend = e_mail_config_ews_autodiscover_get_backend (autodiscover);
settings = e_mail_config_service_backend_get_settings (backend);
/*
* And unstop since we are back to the main thread.
*/
g_object_thaw_notify (G_OBJECT (settings));
if (e_activity_handle_cancellation (async_context->activity, error)) {
/* Do nothing, just free the error below */
} else if (g_error_matches (error, SOUP_HTTP_ERROR, SOUP_STATUS_SSL_FAILED) &&
async_context->certificate_pem && *async_context->certificate_pem && async_context->certificate_errors) {
ETrustPromptResponse response;
GtkWidget *parent;
const gchar *host;
parent = gtk_widget_get_toplevel (GTK_WIDGET (autodiscover));
if (!GTK_IS_WINDOW (parent))
parent = NULL;
host = camel_network_settings_get_host (CAMEL_NETWORK_SETTINGS (settings));
response = e_trust_prompt_run_modal (parent ? GTK_WINDOW (parent) : NULL,
E_SOURCE_EXTENSION_COLLECTION, _("Exchange Web Services"),
host, async_context->certificate_pem, async_context->certificate_errors,
error->message);
g_clear_error (&error);
if (response != E_TRUST_PROMPT_RESPONSE_UNKNOWN) {
GTlsCertificate *certificate;
certificate = g_tls_certificate_new_from_pem (async_context->certificate_pem, -1, &error);
if (certificate) {
ESourceWebdav *extension_webdav;
extension_webdav = e_source_get_extension (async_context->source, E_SOURCE_EXTENSION_WEBDAV_BACKEND);
e_source_webdav_update_ssl_trust (extension_webdav, host, certificate, response);
g_object_unref (certificate);
}
if (error) {
e_alert_submit (
alert_sink,
"ews:autodiscovery-error",
error->message, NULL);
}
}
if (response == E_TRUST_PROMPT_RESPONSE_ACCEPT ||
response == E_TRUST_PROMPT_RESPONSE_ACCEPT_TEMPORARILY) {
mail_config_ews_autodiscover_run (autodiscover);
}
} else if (error != NULL) {
e_alert_submit (
alert_sink,
"ews:autodiscovery-error",
error->message, NULL);
}
gtk_widget_set_sensitive (GTK_WIDGET (autodiscover), TRUE);
g_clear_error (&error);
}
| 0
|
51,976
|
static void kvmclock_update_fn(struct work_struct *work)
{
int i;
struct delayed_work *dwork = to_delayed_work(work);
struct kvm_arch *ka = container_of(dwork, struct kvm_arch,
kvmclock_update_work);
struct kvm *kvm = container_of(ka, struct kvm, arch);
struct kvm_vcpu *vcpu;
kvm_for_each_vcpu(i, vcpu, kvm) {
kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu);
kvm_vcpu_kick(vcpu);
}
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.