unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
9,011 | 0 | static bool vmxnet3_interrupt_asserted(VMXNET3State *s, int lidx)
{
return s->interrupt_states[lidx].is_asserted;
}
| 4,200 |
188,370 | 1 | long long BlockGroup::GetNextTimeCode() const
{
return m_next;
}
| 4,201 |
172,980 | 0 | static int rpng2_x_load_bg_image(void)
{
uch *src;
char *dest;
uch r1, r2, g1, g2, b1, b2;
uch r1_inv, r2_inv, g1_inv, g2_inv, b1_inv, b2_inv;
int k, hmax, max;
int xidx, yidx, yidx_max;
int even_odd_vert, even_odd_horiz, even_odd;
int invert_gradient2 = (bg[pat].type & 0x08);
int invert_column;
int ximage_rowbytes = ximage->bytes_per_line;
ulg i, row;
ulg pixel;
/*---------------------------------------------------------------------------
Allocate buffer for fake background image to be used with transparent
images; if this fails, revert to plain background color.
---------------------------------------------------------------------------*/
bg_rowbytes = 3 * rpng2_info.width;
bg_data = (uch *)malloc(bg_rowbytes * rpng2_info.height);
if (!bg_data) {
fprintf(stderr, PROGNAME
": unable to allocate memory for background image\n");
bg_image = 0;
return 1;
}
bgscale = (pat == 0)? 8 : bgscale_default;
yidx_max = bgscale - 1;
/*---------------------------------------------------------------------------
Vertical gradients (ramps) in NxN squares, alternating direction and
colors (N == bgscale).
---------------------------------------------------------------------------*/
if ((bg[pat].type & 0x07) == 0) {
uch r1_min = rgb[bg[pat].rgb1_min].r;
uch g1_min = rgb[bg[pat].rgb1_min].g;
uch b1_min = rgb[bg[pat].rgb1_min].b;
uch r2_min = rgb[bg[pat].rgb2_min].r;
uch g2_min = rgb[bg[pat].rgb2_min].g;
uch b2_min = rgb[bg[pat].rgb2_min].b;
int r1_diff = rgb[bg[pat].rgb1_max].r - r1_min;
int g1_diff = rgb[bg[pat].rgb1_max].g - g1_min;
int b1_diff = rgb[bg[pat].rgb1_max].b - b1_min;
int r2_diff = rgb[bg[pat].rgb2_max].r - r2_min;
int g2_diff = rgb[bg[pat].rgb2_max].g - g2_min;
int b2_diff = rgb[bg[pat].rgb2_max].b - b2_min;
for (row = 0; row < rpng2_info.height; ++row) {
yidx = (int)(row % bgscale);
even_odd_vert = (int)((row / bgscale) & 1);
r1 = r1_min + (r1_diff * yidx) / yidx_max;
g1 = g1_min + (g1_diff * yidx) / yidx_max;
b1 = b1_min + (b1_diff * yidx) / yidx_max;
r1_inv = r1_min + (r1_diff * (yidx_max-yidx)) / yidx_max;
g1_inv = g1_min + (g1_diff * (yidx_max-yidx)) / yidx_max;
b1_inv = b1_min + (b1_diff * (yidx_max-yidx)) / yidx_max;
r2 = r2_min + (r2_diff * yidx) / yidx_max;
g2 = g2_min + (g2_diff * yidx) / yidx_max;
b2 = b2_min + (b2_diff * yidx) / yidx_max;
r2_inv = r2_min + (r2_diff * (yidx_max-yidx)) / yidx_max;
g2_inv = g2_min + (g2_diff * (yidx_max-yidx)) / yidx_max;
b2_inv = b2_min + (b2_diff * (yidx_max-yidx)) / yidx_max;
dest = (char *)bg_data + row*bg_rowbytes;
for (i = 0; i < rpng2_info.width; ++i) {
even_odd_horiz = (int)((i / bgscale) & 1);
even_odd = even_odd_vert ^ even_odd_horiz;
invert_column =
(even_odd_horiz && (bg[pat].type & 0x10));
if (even_odd == 0) { /* gradient #1 */
if (invert_column) {
*dest++ = r1_inv;
*dest++ = g1_inv;
*dest++ = b1_inv;
} else {
*dest++ = r1;
*dest++ = g1;
*dest++ = b1;
}
} else { /* gradient #2 */
if ((invert_column && invert_gradient2) ||
(!invert_column && !invert_gradient2))
{
*dest++ = r2; /* not inverted or */
*dest++ = g2; /* doubly inverted */
*dest++ = b2;
} else {
*dest++ = r2_inv;
*dest++ = g2_inv; /* singly inverted */
*dest++ = b2_inv;
}
}
}
}
/*---------------------------------------------------------------------------
Soft gradient-diamonds with scale = bgscale. Code contributed by Adam
M. Costello.
---------------------------------------------------------------------------*/
} else if ((bg[pat].type & 0x07) == 1) {
hmax = (bgscale-1)/2; /* half the max weight of a color */
max = 2*hmax; /* the max weight of a color */
r1 = rgb[bg[pat].rgb1_max].r;
g1 = rgb[bg[pat].rgb1_max].g;
b1 = rgb[bg[pat].rgb1_max].b;
r2 = rgb[bg[pat].rgb2_max].r;
g2 = rgb[bg[pat].rgb2_max].g;
b2 = rgb[bg[pat].rgb2_max].b;
for (row = 0; row < rpng2_info.height; ++row) {
yidx = (int)(row % bgscale);
if (yidx > hmax)
yidx = bgscale-1 - yidx;
dest = (char *)bg_data + row*bg_rowbytes;
for (i = 0; i < rpng2_info.width; ++i) {
xidx = (int)(i % bgscale);
if (xidx > hmax)
xidx = bgscale-1 - xidx;
k = xidx + yidx;
*dest++ = (k*r1 + (max-k)*r2) / max;
*dest++ = (k*g1 + (max-k)*g2) / max;
*dest++ = (k*b1 + (max-k)*b2) / max;
}
}
/*---------------------------------------------------------------------------
Radial "starburst" with azimuthal sinusoids; [eventually number of sinu-
soids will equal bgscale?]. This one is slow but very cool. Code con-
tributed by Pieter S. van der Meulen (originally in Smalltalk).
---------------------------------------------------------------------------*/
} else if ((bg[pat].type & 0x07) == 2) {
uch ch;
int ii, x, y, hw, hh, grayspot;
double freq, rotate, saturate, gray, intensity;
double angle=0.0, aoffset=0.0, maxDist, dist;
double red=0.0, green=0.0, blue=0.0, hue, s, v, f, p, q, t;
fprintf(stderr, "%s: computing radial background...",
PROGNAME);
fflush(stderr);
hh = (int)(rpng2_info.height / 2);
hw = (int)(rpng2_info.width / 2);
/* variables for radial waves:
* aoffset: number of degrees to rotate hue [CURRENTLY NOT USED]
* freq: number of color beams originating from the center
* grayspot: size of the graying center area (anti-alias)
* rotate: rotation of the beams as a function of radius
* saturate: saturation of beams' shape azimuthally
*/
angle = CLIP(angle, 0.0, 360.0);
grayspot = CLIP(bg[pat].bg_gray, 1, (hh + hw));
freq = MAX((double)bg[pat].bg_freq, 0.0);
saturate = (double)bg[pat].bg_bsat * 0.1;
rotate = (double)bg[pat].bg_brot * 0.1;
gray = 0.0;
intensity = 0.0;
maxDist = (double)((hw*hw) + (hh*hh));
for (row = 0; row < rpng2_info.height; ++row) {
y = (int)(row - hh);
dest = (char *)bg_data + row*bg_rowbytes;
for (i = 0; i < rpng2_info.width; ++i) {
x = (int)(i - hw);
angle = (x == 0)? PI_2 : atan((double)y / (double)x);
gray = (double)MAX(ABS(y), ABS(x)) / grayspot;
gray = MIN(1.0, gray);
dist = (double)((x*x) + (y*y)) / maxDist;
intensity = cos((angle+(rotate*dist*PI)) * freq) *
gray * saturate;
intensity = (MAX(MIN(intensity,1.0),-1.0) + 1.0) * 0.5;
hue = (angle + PI) * INV_PI_360 + aoffset;
s = gray * ((double)(ABS(x)+ABS(y)) / (double)(hw + hh));
s = MIN(MAX(s,0.0), 1.0);
v = MIN(MAX(intensity,0.0), 1.0);
if (s == 0.0) {
ch = (uch)(v * 255.0);
*dest++ = ch;
*dest++ = ch;
*dest++ = ch;
} else {
if ((hue < 0.0) || (hue >= 360.0))
hue -= (((int)(hue / 360.0)) * 360.0);
hue /= 60.0;
ii = (int)hue;
f = hue - (double)ii;
p = (1.0 - s) * v;
q = (1.0 - (s * f)) * v;
t = (1.0 - (s * (1.0 - f))) * v;
if (ii == 0) { red = v; green = t; blue = p; }
else if (ii == 1) { red = q; green = v; blue = p; }
else if (ii == 2) { red = p; green = v; blue = t; }
else if (ii == 3) { red = p; green = q; blue = v; }
else if (ii == 4) { red = t; green = p; blue = v; }
else if (ii == 5) { red = v; green = p; blue = q; }
*dest++ = (uch)(red * 255.0);
*dest++ = (uch)(green * 255.0);
*dest++ = (uch)(blue * 255.0);
}
}
}
fprintf(stderr, "done.\n");
fflush(stderr);
}
/*---------------------------------------------------------------------------
Blast background image to display buffer before beginning PNG decode.
---------------------------------------------------------------------------*/
if (depth == 24 || depth == 32) {
ulg red, green, blue;
int bpp = ximage->bits_per_pixel;
for (row = 0; row < rpng2_info.height; ++row) {
src = bg_data + row*bg_rowbytes;
dest = ximage->data + row*ximage_rowbytes;
if (bpp == 32) { /* slightly optimized version */
for (i = rpng2_info.width; i > 0; --i) {
red = *src++;
green = *src++;
blue = *src++;
pixel = (red << RShift) |
(green << GShift) |
(blue << BShift);
/* recall that we set ximage->byte_order = MSBFirst above */
*dest++ = (char)((pixel >> 24) & 0xff);
*dest++ = (char)((pixel >> 16) & 0xff);
*dest++ = (char)((pixel >> 8) & 0xff);
*dest++ = (char)( pixel & 0xff);
}
} else {
for (i = rpng2_info.width; i > 0; --i) {
red = *src++;
green = *src++;
blue = *src++;
pixel = (red << RShift) |
(green << GShift) |
(blue << BShift);
/* recall that we set ximage->byte_order = MSBFirst above */
/* GRR BUG? this assumes bpp == 24 & bits are packed low */
/* (probably need to use RShift, RMask, etc.) */
*dest++ = (char)((pixel >> 16) & 0xff);
*dest++ = (char)((pixel >> 8) & 0xff);
*dest++ = (char)( pixel & 0xff);
}
}
}
} else if (depth == 16) {
ush red, green, blue;
for (row = 0; row < rpng2_info.height; ++row) {
src = bg_data + row*bg_rowbytes;
dest = ximage->data + row*ximage_rowbytes;
for (i = rpng2_info.width; i > 0; --i) {
red = ((ush)(*src) << 8); ++src;
green = ((ush)(*src) << 8); ++src;
blue = ((ush)(*src) << 8); ++src;
pixel = ((red >> RShift) & RMask) |
((green >> GShift) & GMask) |
((blue >> BShift) & BMask);
/* recall that we set ximage->byte_order = MSBFirst above */
*dest++ = (char)((pixel >> 8) & 0xff);
*dest++ = (char)( pixel & 0xff);
}
}
} else /* depth == 8 */ {
/* GRR: add 8-bit support */
}
XPutImage(display, window, gc, ximage, 0, 0, 0, 0, rpng2_info.width,
rpng2_info.height);
return 0;
} /* end function rpng2_x_load_bg_image() */
| 4,202 |
103,678 | 0 | void BrowserRenderProcessHost::OnSavedPageAsMHTML(int job_id, bool success) {
content::GetContentClient()->browser()->GetMHTMLGenerationManager()->
MHTMLGenerated(job_id, success);
}
| 4,203 |
138,180 | 0 | bool AXObject::lastKnownIsIgnoredValue() {
if (m_lastKnownIsIgnoredValue == DefaultBehavior)
m_lastKnownIsIgnoredValue =
accessibilityIsIgnored() ? IgnoreObject : IncludeObject;
return m_lastKnownIsIgnoredValue == IgnoreObject;
}
| 4,204 |
53,468 | 0 | archive_read_support_format_rar_capabilities(struct archive_read * a)
{
(void)a; /* UNUSED */
return (ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_DATA
| ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_METADATA);
}
| 4,205 |
178,060 | 1 | sfnt_init_face( FT_Stream stream,
TT_Face face,
FT_Int face_instance_index,
FT_Int num_params,
FT_Parameter* params )
{
FT_Error error;
FT_Memory memory = face->root.memory;
FT_Library library = face->root.driver->root.library;
SFNT_Service sfnt;
FT_Int face_index;
/* for now, parameters are unused */
FT_UNUSED( num_params );
FT_UNUSED( params );
sfnt = (SFNT_Service)face->sfnt;
if ( !sfnt )
{
sfnt = (SFNT_Service)FT_Get_Module_Interface( library, "sfnt" );
if ( !sfnt )
{
FT_ERROR(( "sfnt_init_face: cannot access `sfnt' module\n" ));
return FT_THROW( Missing_Module );
}
face->sfnt = sfnt;
face->goto_table = sfnt->goto_table;
}
FT_FACE_FIND_GLOBAL_SERVICE( face, face->psnames, POSTSCRIPT_CMAPS );
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
if ( !face->mm )
{
/* we want the MM interface from the `truetype' module only */
FT_Module tt_module = FT_Get_Module( library, "truetype" );
face->mm = ft_module_get_service( tt_module,
FT_SERVICE_ID_MULTI_MASTERS,
0 );
}
if ( !face->var )
{
/* we want the metrics variations interface */
/* from the `truetype' module only */
FT_Module tt_module = FT_Get_Module( library, "truetype" );
face->var = ft_module_get_service( tt_module,
FT_SERVICE_ID_METRICS_VARIATIONS,
0 );
}
#endif
FT_TRACE2(( "SFNT driver\n" ));
error = sfnt_open_font( stream, face );
if ( error )
return error;
/* Stream may have changed in sfnt_open_font. */
stream = face->root.stream;
FT_TRACE2(( "sfnt_init_face: %08p, %d\n", face, face_instance_index ));
face_index = FT_ABS( face_instance_index ) & 0xFFFF;
/* value -(N+1) requests information on index N */
if ( face_instance_index < 0 )
face_index--;
if ( face_index >= face->ttc_header.count )
{
if ( face_instance_index >= 0 )
return FT_THROW( Invalid_Argument );
else
face_index = 0;
}
if ( FT_STREAM_SEEK( face->ttc_header.offsets[face_index] ) )
return error;
/* check whether we have a valid TrueType file */
error = sfnt->load_font_dir( face, stream );
if ( error )
return error;
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
{
FT_ULong fvar_len;
FT_ULong version;
FT_ULong offset;
FT_UShort num_axes;
FT_UShort axis_size;
FT_UShort num_instances;
FT_UShort instance_size;
FT_Int instance_index;
FT_Byte* default_values = NULL;
FT_Byte* instance_values = NULL;
face->is_default_instance = 1;
instance_index = FT_ABS( face_instance_index ) >> 16;
/* test whether current face is a GX font with named instances */
if ( face->goto_table( face, TTAG_fvar, stream, &fvar_len ) ||
fvar_len < 20 ||
FT_READ_ULONG( version ) ||
FT_READ_USHORT( offset ) ||
FT_STREAM_SKIP( 2 ) /* reserved */ ||
FT_READ_USHORT( num_axes ) ||
FT_READ_USHORT( axis_size ) ||
FT_READ_USHORT( num_instances ) ||
FT_READ_USHORT( instance_size ) )
{
version = 0;
offset = 0;
num_axes = 0;
axis_size = 0;
num_instances = 0;
instance_size = 0;
}
/* check that the data is bound by the table length */
if ( version != 0x00010000UL ||
axis_size != 20 ||
num_axes == 0 ||
/* `num_axes' limit implied by 16-bit `instance_size' */
num_axes > 0x3FFE ||
!( instance_size == 4 + 4 * num_axes ||
instance_size == 6 + 4 * num_axes ) ||
/* `num_instances' limit implied by limited range of name IDs */
num_instances > 0x7EFF ||
offset +
axis_size * num_axes +
instance_size * num_instances > fvar_len )
num_instances = 0;
else
face->variation_support |= TT_FACE_FLAG_VAR_FVAR;
/*
* As documented in the OpenType specification, an entry for the
* default instance may be omitted in the named instance table. In
* particular this means that even if there is no named instance
* table in the font we actually do have a named instance, namely the
* default instance.
*
* For consistency, we always want the default instance in our list
* of named instances. If it is missing, we try to synthesize it
* later on. Here, we have to adjust `num_instances' accordingly.
*/
if ( !( FT_ALLOC( default_values, num_axes * 2 ) ||
FT_ALLOC( instance_values, num_axes * 2 ) ) )
{
/* the current stream position is 16 bytes after the table start */
FT_ULong array_start = FT_STREAM_POS() - 16 + offset;
FT_ULong default_value_offset, instance_offset;
FT_Byte* p;
FT_UInt i;
default_value_offset = array_start + 8;
p = default_values;
for ( i = 0; i < num_axes; i++ )
{
(void)FT_STREAM_READ_AT( default_value_offset, p, 2 );
default_value_offset += axis_size;
p += 2;
}
instance_offset = array_start + axis_size * num_axes + 4;
for ( i = 0; i < num_instances; i++ )
{
(void)FT_STREAM_READ_AT( instance_offset,
instance_values,
num_axes * 2 );
if ( !ft_memcmp( default_values, instance_values, num_axes * 2 ) )
break;
instance_offset += instance_size;
}
if ( i == num_instances )
{
/* no default instance in named instance table; */
/* we thus have to synthesize it */
num_instances++;
}
}
FT_FREE( default_values );
FT_FREE( instance_values );
/* we don't support Multiple Master CFFs yet *
if ( face->goto_table( face, TTAG_glyf, stream, 0 ) &&
!face->goto_table( face, TTAG_CFF, stream, 0 ) )
num_instances = 0;
if ( instance_index > num_instances )
{
if ( face_instance_index >= 0 )
return FT_THROW( Invalid_Argument );
else
num_instances = 0;
}
face->root.style_flags = (FT_Long)num_instances << 16;
}
#endif
face->root.num_faces = face->ttc_header.count;
face->root.face_index = face_instance_index;
return error;
}
| 4,206 |
175,710 | 0 | FLACParser::~FLACParser()
{
ALOGV("FLACParser::~FLACParser");
if (mDecoder != NULL) {
FLAC__stream_decoder_delete(mDecoder);
mDecoder = NULL;
}
}
| 4,207 |
34,556 | 0 | static inline struct sk_buff *macvtap_alloc_skb(struct sock *sk, size_t prepad,
size_t len, size_t linear,
int noblock, int *err)
{
struct sk_buff *skb;
/* Under a page? Don't bother with paged skb. */
if (prepad + len < PAGE_SIZE || !linear)
linear = len;
skb = sock_alloc_send_pskb(sk, prepad + linear, len - linear, noblock,
err);
if (!skb)
return NULL;
skb_reserve(skb, prepad);
skb_put(skb, linear);
skb->data_len = len - linear;
skb->len += len - linear;
return skb;
}
| 4,208 |
174,249 | 0 | status_t Camera3Device::RequestThread::prepareHalRequests() {
ATRACE_CALL();
for (auto& nextRequest : mNextRequests) {
sp<CaptureRequest> captureRequest = nextRequest.captureRequest;
camera3_capture_request_t* halRequest = &nextRequest.halRequest;
Vector<camera3_stream_buffer_t>* outputBuffers = &nextRequest.outputBuffers;
halRequest->frame_number = captureRequest->mResultExtras.frameNumber;
status_t res = insertTriggers(captureRequest);
if (res < 0) {
SET_ERR("RequestThread: Unable to insert triggers "
"(capture request %d, HAL device: %s (%d)",
halRequest->frame_number, strerror(-res), res);
return INVALID_OPERATION;
}
int triggerCount = res;
bool triggersMixedIn = (triggerCount > 0 || mPrevTriggers > 0);
mPrevTriggers = triggerCount;
if (mPrevRequest != captureRequest || triggersMixedIn) {
/**
* HAL workaround:
* Insert a dummy trigger ID if a trigger is set but no trigger ID is
*/
res = addDummyTriggerIds(captureRequest);
if (res != OK) {
SET_ERR("RequestThread: Unable to insert dummy trigger IDs "
"(capture request %d, HAL device: %s (%d)",
halRequest->frame_number, strerror(-res), res);
return INVALID_OPERATION;
}
/**
* The request should be presorted so accesses in HAL
* are O(logn). Sidenote, sorting a sorted metadata is nop.
*/
captureRequest->mSettings.sort();
halRequest->settings = captureRequest->mSettings.getAndLock();
mPrevRequest = captureRequest;
ALOGVV("%s: Request settings are NEW", __FUNCTION__);
IF_ALOGV() {
camera_metadata_ro_entry_t e = camera_metadata_ro_entry_t();
find_camera_metadata_ro_entry(
halRequest->settings,
ANDROID_CONTROL_AF_TRIGGER,
&e
);
if (e.count > 0) {
ALOGV("%s: Request (frame num %d) had AF trigger 0x%x",
__FUNCTION__,
halRequest->frame_number,
e.data.u8[0]);
}
}
} else {
ALOGVV("%s: Request settings are REUSED",
__FUNCTION__);
}
uint32_t totalNumBuffers = 0;
if (captureRequest->mInputStream != NULL) {
halRequest->input_buffer = &captureRequest->mInputBuffer;
totalNumBuffers += 1;
} else {
halRequest->input_buffer = NULL;
}
outputBuffers->insertAt(camera3_stream_buffer_t(), 0,
captureRequest->mOutputStreams.size());
halRequest->output_buffers = outputBuffers->array();
for (size_t i = 0; i < captureRequest->mOutputStreams.size(); i++) {
res = captureRequest->mOutputStreams.editItemAt(i)->
getBuffer(&outputBuffers->editItemAt(i));
if (res != OK) {
ALOGE("RequestThread: Can't get output buffer, skipping request:"
" %s (%d)", strerror(-res), res);
return TIMED_OUT;
}
halRequest->num_output_buffers++;
}
totalNumBuffers += halRequest->num_output_buffers;
sp<Camera3Device> parent = mParent.promote();
if (parent == NULL) {
CLOGE("RequestThread: Parent is gone");
return INVALID_OPERATION;
}
res = parent->registerInFlight(halRequest->frame_number,
totalNumBuffers, captureRequest->mResultExtras,
/*hasInput*/halRequest->input_buffer != NULL,
captureRequest->mAeTriggerCancelOverride);
ALOGVV("%s: registered in flight requestId = %" PRId32 ", frameNumber = %" PRId64
", burstId = %" PRId32 ".",
__FUNCTION__,
captureRequest->mResultExtras.requestId, captureRequest->mResultExtras.frameNumber,
captureRequest->mResultExtras.burstId);
if (res != OK) {
SET_ERR("RequestThread: Unable to register new in-flight request:"
" %s (%d)", strerror(-res), res);
return INVALID_OPERATION;
}
}
return OK;
}
| 4,209 |
15,631 | 0 | static void scoop_write(void *opaque, hwaddr addr,
uint64_t value, unsigned size)
{
ScoopInfo *s = (ScoopInfo *) opaque;
value &= 0xffff;
switch (addr & 0x3f) {
case SCOOP_MCR:
s->mcr = value;
break;
case SCOOP_CDR:
s->cdr = value;
break;
case SCOOP_CPR:
s->power = value;
if (value & 0x80)
s->power |= 0x8040;
break;
case SCOOP_CCR:
s->ccr = value;
break;
case SCOOP_IRR_IRM:
s->irr = value;
break;
case SCOOP_IMR:
s->imr = value;
break;
case SCOOP_ISR:
s->isr = value;
break;
case SCOOP_GPCR:
s->gpio_dir = value;
scoop_gpio_handler_update(s);
break;
case SCOOP_GPWR:
case SCOOP_GPRR: /* GPRR is probably R/O in real HW */
s->gpio_level = value & s->gpio_dir;
scoop_gpio_handler_update(s);
break;
default:
zaurus_printf("Bad register offset " REG_FMT "\n", (unsigned long)addr);
}
}
| 4,210 |
67,839 | 0 | DefragContextNew(void)
{
DefragContext *dc;
dc = SCCalloc(1, sizeof(*dc));
if (unlikely(dc == NULL))
return NULL;
/* Initialize the pool of trackers. */
intmax_t tracker_pool_size;
if (!ConfGetInt("defrag.trackers", &tracker_pool_size) || tracker_pool_size == 0) {
tracker_pool_size = DEFAULT_DEFRAG_HASH_SIZE;
}
/* Initialize the pool of frags. */
intmax_t frag_pool_size;
if (!ConfGetInt("defrag.max-frags", &frag_pool_size) || frag_pool_size == 0) {
frag_pool_size = DEFAULT_DEFRAG_POOL_SIZE;
}
intmax_t frag_pool_prealloc = frag_pool_size / 2;
dc->frag_pool = PoolInit(frag_pool_size, frag_pool_prealloc,
sizeof(Frag),
NULL, DefragFragInit, dc, NULL, NULL);
if (dc->frag_pool == NULL) {
SCLogError(SC_ERR_MEM_ALLOC,
"Defrag: Failed to initialize fragment pool.");
exit(EXIT_FAILURE);
}
if (SCMutexInit(&dc->frag_pool_lock, NULL) != 0) {
SCLogError(SC_ERR_MUTEX,
"Defrag: Failed to initialize frag pool mutex.");
exit(EXIT_FAILURE);
}
/* Set the default timeout. */
intmax_t timeout;
if (!ConfGetInt("defrag.timeout", &timeout)) {
dc->timeout = TIMEOUT_DEFAULT;
}
else {
if (timeout < TIMEOUT_MIN) {
SCLogError(SC_ERR_INVALID_ARGUMENT,
"defrag: Timeout less than minimum allowed value.");
exit(EXIT_FAILURE);
}
else if (timeout > TIMEOUT_MAX) {
SCLogError(SC_ERR_INVALID_ARGUMENT,
"defrag: Tiemout greater than maximum allowed value.");
exit(EXIT_FAILURE);
}
dc->timeout = timeout;
}
SCLogDebug("Defrag Initialized:");
SCLogDebug("\tTimeout: %"PRIuMAX, (uintmax_t)dc->timeout);
SCLogDebug("\tMaximum defrag trackers: %"PRIuMAX, tracker_pool_size);
SCLogDebug("\tPreallocated defrag trackers: %"PRIuMAX, tracker_pool_size);
SCLogDebug("\tMaximum fragments: %"PRIuMAX, (uintmax_t)frag_pool_size);
SCLogDebug("\tPreallocated fragments: %"PRIuMAX, (uintmax_t)frag_pool_prealloc);
return dc;
}
| 4,211 |
111,175 | 0 | bool WebPagePrivate::hasVirtualViewport() const
{
return !m_virtualViewportSize.isEmpty();
}
| 4,212 |
25,485 | 0 | static long ppc_del_hwdebug(struct task_struct *child, long addr, long data)
{
#ifdef CONFIG_PPC_ADV_DEBUG_REGS
int rc;
if (data <= 4)
rc = del_instruction_bp(child, (int)data);
else
rc = del_dac(child, (int)data - 4);
if (!rc) {
if (!DBCR_ACTIVE_EVENTS(child->thread.dbcr0,
child->thread.dbcr1)) {
child->thread.dbcr0 &= ~DBCR0_IDM;
child->thread.regs->msr &= ~MSR_DE;
}
}
return rc;
#else
if (data != 1)
return -EINVAL;
if (child->thread.dabr == 0)
return -ENOENT;
child->thread.dabr = 0;
return 0;
#endif
}
| 4,213 |
85,809 | 0 | static int ocfs2_init_file_private(struct inode *inode, struct file *file)
{
struct ocfs2_file_private *fp;
fp = kzalloc(sizeof(struct ocfs2_file_private), GFP_KERNEL);
if (!fp)
return -ENOMEM;
fp->fp_file = file;
mutex_init(&fp->fp_mutex);
ocfs2_file_lock_res_init(&fp->fp_flock, fp);
file->private_data = fp;
return 0;
}
| 4,214 |
166,453 | 0 | void RecordParallelizableDownloadStats(
size_t bytes_downloaded_with_parallel_streams,
base::TimeDelta time_with_parallel_streams,
size_t bytes_downloaded_without_parallel_streams,
base::TimeDelta time_without_parallel_streams,
bool uses_parallel_requests) {
RecordParallelizableDownloadAverageStats(
bytes_downloaded_with_parallel_streams +
bytes_downloaded_without_parallel_streams,
time_with_parallel_streams + time_without_parallel_streams);
int64_t bandwidth_without_parallel_streams = 0;
if (bytes_downloaded_without_parallel_streams > 0) {
bandwidth_without_parallel_streams = CalculateBandwidthBytesPerSecond(
bytes_downloaded_without_parallel_streams,
time_without_parallel_streams);
if (uses_parallel_requests) {
RecordBandwidthMetric(
"Download.ParallelizableDownloadBandwidth."
"WithParallelRequestsSingleStream",
bandwidth_without_parallel_streams);
} else {
RecordBandwidthMetric(
"Download.ParallelizableDownloadBandwidth."
"WithoutParallelRequests",
bandwidth_without_parallel_streams);
}
}
if (!uses_parallel_requests)
return;
base::TimeDelta time_saved;
if (bytes_downloaded_with_parallel_streams > 0) {
int64_t bandwidth_with_parallel_streams = CalculateBandwidthBytesPerSecond(
bytes_downloaded_with_parallel_streams, time_with_parallel_streams);
RecordBandwidthMetric(
"Download.ParallelizableDownloadBandwidth."
"WithParallelRequestsMultipleStreams",
bandwidth_with_parallel_streams);
if (bandwidth_without_parallel_streams > 0) {
time_saved = base::TimeDelta::FromMilliseconds(
1000.0 * bytes_downloaded_with_parallel_streams /
bandwidth_without_parallel_streams) -
time_with_parallel_streams;
}
}
int kMillisecondsPerHour =
base::checked_cast<int>(base::Time::kMillisecondsPerSecond * 60 * 60);
if (time_saved >= base::TimeDelta()) {
UMA_HISTOGRAM_CUSTOM_COUNTS(
"Download.EstimatedTimeSavedWithParallelDownload",
time_saved.InMilliseconds(), 0, kMillisecondsPerHour, 50);
} else {
UMA_HISTOGRAM_CUSTOM_COUNTS(
"Download.EstimatedTimeWastedWithParallelDownload",
-time_saved.InMilliseconds(), 0, kMillisecondsPerHour, 50);
}
}
| 4,215 |
62,455 | 0 | parsefh(netdissect_options *ndo,
register const uint32_t *dp, int v3)
{
u_int len;
if (v3) {
ND_TCHECK(dp[0]);
len = EXTRACT_32BITS(dp) / 4;
dp++;
} else
len = NFSX_V2FH / 4;
if (ND_TTEST2(*dp, len * sizeof(*dp))) {
nfs_printfh(ndo, dp, len);
return (dp + len);
}
trunc:
return (NULL);
}
| 4,216 |
185,160 | 1 | void RenderBlockFlow::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
{
RenderBlock::styleDidChange(diff, oldStyle);
// After our style changed, if we lose our ability to propagate floats into next sibling
// blocks, then we need to find the top most parent containing that overhanging float and
// then mark its descendants with floats for layout and clear all floats from its next
// sibling blocks that exist in our floating objects list. See bug 56299 and 62875.
bool canPropagateFloatIntoSibling = !isFloatingOrOutOfFlowPositioned() && !avoidsFloats();
if (diff == StyleDifferenceLayout && s_canPropagateFloatIntoSibling && !canPropagateFloatIntoSibling && hasOverhangingFloats()) {
RenderBlockFlow* parentBlockFlow = this;
const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
FloatingObjectSetIterator end = floatingObjectSet.end();
for (RenderObject* curr = parent(); curr && !curr->isRenderView(); curr = curr->parent()) {
if (curr->isRenderBlockFlow()) {
RenderBlockFlow* currBlock = toRenderBlockFlow(curr);
if (currBlock->hasOverhangingFloats()) {
for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) {
RenderBox* renderer = (*it)->renderer();
if (currBlock->hasOverhangingFloat(renderer)) {
parentBlockFlow = currBlock;
break;
}
}
}
}
}
parentBlockFlow->markAllDescendantsWithFloatsForLayout();
parentBlockFlow->markSiblingsWithFloatsForLayout();
}
if (diff == StyleDifferenceLayout || !oldStyle)
createOrDestroyMultiColumnFlowThreadIfNeeded();
}
| 4,217 |
24,276 | 0 | static int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
unsigned short type,
const void *daddr, const void *saddr,
unsigned int len)
{
struct vlan_hdr *vhdr;
unsigned int vhdrlen = 0;
u16 vlan_tci = 0;
int rc;
if (!(vlan_dev_info(dev)->flags & VLAN_FLAG_REORDER_HDR)) {
vhdr = (struct vlan_hdr *) skb_push(skb, VLAN_HLEN);
vlan_tci = vlan_dev_info(dev)->vlan_id;
vlan_tci |= vlan_dev_get_egress_qos_mask(dev, skb);
vhdr->h_vlan_TCI = htons(vlan_tci);
/*
* Set the protocol type. For a packet of type ETH_P_802_3/2 we
* put the length in here instead.
*/
if (type != ETH_P_802_3 && type != ETH_P_802_2)
vhdr->h_vlan_encapsulated_proto = htons(type);
else
vhdr->h_vlan_encapsulated_proto = htons(len);
skb->protocol = htons(ETH_P_8021Q);
type = ETH_P_8021Q;
vhdrlen = VLAN_HLEN;
}
/* Before delegating work to the lower layer, enter our MAC-address */
if (saddr == NULL)
saddr = dev->dev_addr;
/* Now make the underlying real hard header */
dev = vlan_dev_info(dev)->real_dev;
rc = dev_hard_header(skb, dev, type, daddr, saddr, len + vhdrlen);
if (rc > 0)
rc += vhdrlen;
return rc;
}
| 4,218 |
22,105 | 0 | do_group_exit(int exit_code)
{
struct signal_struct *sig = current->signal;
BUG_ON(exit_code & 0x80); /* core dumps don't get here */
if (signal_group_exit(sig))
exit_code = sig->group_exit_code;
else if (!thread_group_empty(current)) {
struct sighand_struct *const sighand = current->sighand;
spin_lock_irq(&sighand->siglock);
if (signal_group_exit(sig))
/* Another thread got here before we took the lock. */
exit_code = sig->group_exit_code;
else {
sig->group_exit_code = exit_code;
sig->flags = SIGNAL_GROUP_EXIT;
zap_other_threads(current);
}
spin_unlock_irq(&sighand->siglock);
}
do_exit(exit_code);
/* NOTREACHED */
}
| 4,219 |
128,094 | 0 | void SynchronousCompositorImpl::UpdateNeedsBeginFrames() {
rwhva_->OnSetNeedsBeginFrames(is_active_ && renderer_needs_begin_frames_);
}
| 4,220 |
71,040 | 0 | void* Type_ProfileSequenceId_Dup(struct _cms_typehandler_struct* self, const void* Ptr, cmsUInt32Number n)
{
return (void*) cmsDupProfileSequenceDescription((cmsSEQ*) Ptr);
cmsUNUSED_PARAMETER(n);
cmsUNUSED_PARAMETER(self);
}
| 4,221 |
122,181 | 0 | void RenderLayerCompositor::repaintOnCompositingChange(RenderLayer* layer)
{
if (layer->renderer() != m_renderView && !layer->renderer()->parent())
return;
RenderLayerModelObject* repaintContainer = layer->renderer()->containerForRepaint();
if (!repaintContainer)
repaintContainer = m_renderView;
layer->repainter().repaintIncludingNonCompositingDescendants(repaintContainer);
}
| 4,222 |
154,335 | 0 | void GLES2DecoderImpl::RenderbufferStorageMultisampleHelper(
GLenum target,
GLsizei samples,
GLenum internal_format,
GLsizei width,
GLsizei height,
ForcedMultisampleMode mode) {
if (samples == 0) {
api()->glRenderbufferStorageEXTFn(target, internal_format, width, height);
return;
}
if (mode == kForceExtMultisampledRenderToTexture) {
api()->glRenderbufferStorageMultisampleEXTFn(
target, samples, internal_format, width, height);
} else {
api()->glRenderbufferStorageMultisampleFn(target, samples, internal_format,
width, height);
}
}
| 4,223 |
119,803 | 0 | void NavigationControllerImpl::PruneAllButVisible() {
PruneAllButVisibleInternal();
DCHECK_NE(-1, last_committed_entry_index_);
NavigationEntryImpl* entry =
NavigationEntryImpl::FromNavigationEntry(GetActiveEntry());
web_contents_->SetHistoryLengthAndPrune(
entry->site_instance(), 0, entry->GetPageID());
}
| 4,224 |
153,927 | 0 | void GLES2DecoderImpl::DeleteBuffersHelper(GLsizei n,
const volatile GLuint* client_ids) {
for (GLsizei ii = 0; ii < n; ++ii) {
GLuint client_id = client_ids[ii];
Buffer* buffer = GetBuffer(client_id);
if (buffer && !buffer->IsDeleted()) {
if (buffer->GetMappedRange()) {
GLenum target = buffer->initial_target();
Buffer* currently_bound =
buffer_manager()->GetBufferInfoForTarget(&state_, target);
if (currently_bound != buffer) {
api()->glBindBufferFn(target, buffer->service_id());
}
UnmapBufferHelper(buffer, target);
if (currently_bound != buffer) {
api()->glBindBufferFn(
target, currently_bound ? currently_bound->service_id() : 0);
}
}
state_.RemoveBoundBuffer(buffer);
buffer_manager()->RemoveBuffer(client_id);
}
}
}
| 4,225 |
112,028 | 0 | void ConflictResolver::IgnoreLocalChanges(MutableEntry* entry) {
entry->Put(syncable::IS_UNSYNCED, false);
}
| 4,226 |
136,082 | 0 | WebsiteSettingsPopupAndroid::~WebsiteSettingsPopupAndroid() {}
| 4,227 |
52,159 | 0 | PHPAPI PHP_FUNCTION(fwrite)
{
zval *arg1;
char *arg2;
int arg2len;
int ret;
int num_bytes;
long arg3 = 0;
char *buffer = NULL;
php_stream *stream;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &arg1, &arg2, &arg2len, &arg3) == FAILURE) {
RETURN_FALSE;
}
if (ZEND_NUM_ARGS() == 2) {
num_bytes = arg2len;
} else {
num_bytes = MAX(0, MIN((int)arg3, arg2len));
}
if (!num_bytes) {
RETURN_LONG(0);
}
PHP_STREAM_TO_ZVAL(stream, &arg1);
ret = php_stream_write(stream, buffer ? buffer : arg2, num_bytes);
if (buffer) {
efree(buffer);
}
RETURN_LONG(ret);
}
| 4,228 |
104,136 | 0 | error::Error GLES2DecoderImpl::HandleGetShaderPrecisionFormat(
uint32 immediate_data_size, const gles2::GetShaderPrecisionFormat& c) {
GLenum shader_type = static_cast<GLenum>(c.shadertype);
GLenum precision_type = static_cast<GLenum>(c.precisiontype);
typedef gles2::GetShaderPrecisionFormat::Result Result;
Result* result = GetSharedMemoryAs<Result*>(
c.result_shm_id, c.result_shm_offset, sizeof(*result));
if (!result) {
return error::kOutOfBounds;
}
if (result->success != 0) {
return error::kInvalidArguments;
}
if (!validators_->shader_type.IsValid(shader_type)) {
SetGLError(GL_INVALID_ENUM,
"glGetShaderPrecisionFormat: shader_type GL_INVALID_ENUM");
return error::kNoError;
}
if (!validators_->shader_precision.IsValid(precision_type)) {
SetGLError(GL_INVALID_ENUM,
"glGetShaderPrecisionFormat: precision_type GL_INVALID_ENUM");
return error::kNoError;
}
result->success = 1; // true
switch (precision_type) {
case GL_LOW_INT:
case GL_MEDIUM_INT:
case GL_HIGH_INT:
result->min_range = -31;
result->max_range = 31;
result->precision = 0;
break;
case GL_LOW_FLOAT:
case GL_MEDIUM_FLOAT:
case GL_HIGH_FLOAT:
result->min_range = -62;
result->max_range = 62;
result->precision = -16;
break;
default:
NOTREACHED();
break;
}
return error::kNoError;
}
| 4,229 |
179,817 | 1 | iakerb_gss_delete_sec_context(OM_uint32 *minor_status,
gss_ctx_id_t *context_handle,
gss_buffer_t output_token)
{
OM_uint32 major_status = GSS_S_COMPLETE;
if (output_token != GSS_C_NO_BUFFER) {
output_token->length = 0;
output_token->value = NULL;
}
*minor_status = 0;
if (*context_handle != GSS_C_NO_CONTEXT) {
iakerb_ctx_id_t iakerb_ctx = (iakerb_ctx_id_t)*context_handle;
if (iakerb_ctx->magic == KG_IAKERB_CONTEXT) {
iakerb_release_context(iakerb_ctx);
*context_handle = GSS_C_NO_CONTEXT;
} else {
assert(iakerb_ctx->magic == KG_CONTEXT);
major_status = krb5_gss_delete_sec_context(minor_status,
context_handle,
output_token);
}
}
return major_status;
}
| 4,230 |
160,650 | 0 | void RenderFrameImpl::OnCopyToFindPboard() {
if (frame_->HasSelection()) {
if (!clipboard_host_) {
auto* platform = RenderThreadImpl::current_blink_platform_impl();
platform->GetConnector()->BindInterface(platform->GetBrowserServiceName(),
&clipboard_host_);
}
base::string16 selection = frame_->SelectionAsText().Utf16();
clipboard_host_->WriteStringToFindPboard(selection);
}
}
| 4,231 |
114,536 | 0 | void WebPluginProxy::CreateDIBAndCanvasFromHandle(
const TransportDIB::Handle& dib_handle,
const gfx::Rect& window_rect,
scoped_ptr<TransportDIB>* dib_out,
scoped_ptr<skia::PlatformCanvas>* canvas_out) {
TransportDIB* dib = TransportDIB::Map(dib_handle);
skia::PlatformCanvas* canvas = NULL;
if (dib) {
canvas = dib->GetPlatformCanvas(window_rect.width(), window_rect.height());
}
dib_out->reset(dib);
canvas_out->reset(canvas);
}
| 4,232 |
114,583 | 0 | base::WaitableEvent* RenderThreadImpl::GetShutDownEvent() {
return ChildProcess::current()->GetShutDownEvent();
}
| 4,233 |
133,878 | 0 | FormAssociatedElement::FormAssociatedElement()
: m_form(0)
{
}
| 4,234 |
118,928 | 0 | const std::string& WebContentsImpl::GetUserAgentOverride() const {
return renderer_preferences_.user_agent_override;
}
| 4,235 |
130,756 | 0 | static void enforcedRangeLongLongAttrAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
TestObjectV8Internal::enforcedRangeLongLongAttrAttributeSetter(jsValue, info);
TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
}
| 4,236 |
122,217 | 0 | CompositingReasons RenderLayerCompositor::subtreeReasonsForCompositing(RenderObject* renderer, bool hasCompositedDescendants, bool has3DTransformedDescendants) const
{
CompositingReasons subtreeReasons = CompositingReasonNone;
RenderLayer* layer = toRenderBoxModelObject(renderer)->layer();
if (hasCompositedDescendants) {
if (layer->transform())
subtreeReasons |= CompositingReasonTransformWithCompositedDescendants;
if (layer->shouldIsolateCompositedDescendants()) {
ASSERT(layer->stackingNode()->isStackingContext());
subtreeReasons |= CompositingReasonIsolateCompositedDescendants;
}
ASSERT((renderer->isTransparent() || renderer->hasMask() || renderer->hasFilter() || renderer->hasBlendMode()) == renderer->createsGroup());
if (renderer->isTransparent())
subtreeReasons |= CompositingReasonOpacityWithCompositedDescendants;
if (renderer->hasMask())
subtreeReasons |= CompositingReasonMaskWithCompositedDescendants;
if (renderer->hasFilter())
subtreeReasons |= CompositingReasonFilterWithCompositedDescendants;
if (renderer->hasBlendMode())
subtreeReasons |= CompositingReasonBlendingWithCompositedDescendants;
if (renderer->hasReflection())
subtreeReasons |= CompositingReasonReflectionWithCompositedDescendants;
if (renderer->hasClipOrOverflowClip())
subtreeReasons |= CompositingReasonClipsCompositingDescendants;
}
if (has3DTransformedDescendants) {
if (renderer->style()->transformStyle3D() == TransformStyle3DPreserve3D)
subtreeReasons |= CompositingReasonPreserve3D;
if (renderer->style()->hasPerspective())
subtreeReasons |= CompositingReasonPerspective;
}
return subtreeReasons;
}
| 4,237 |
141,397 | 0 | Scrollbar* PaintLayerScrollableArea::ScrollbarManager::CreateScrollbar(
ScrollbarOrientation orientation) {
DCHECK(orientation == kHorizontalScrollbar ? !h_bar_is_attached_
: !v_bar_is_attached_);
Scrollbar* scrollbar = nullptr;
const LayoutObject& style_source =
ScrollbarStyleSource(*ScrollableArea()->GetLayoutBox());
bool has_custom_scrollbar_style =
style_source.StyleRef().HasPseudoStyle(kPseudoIdScrollbar);
if (has_custom_scrollbar_style) {
DCHECK(style_source.GetNode() && style_source.GetNode()->IsElementNode());
scrollbar = LayoutScrollbar::CreateCustomScrollbar(
ScrollableArea(), orientation, ToElement(style_source.GetNode()));
} else {
ScrollbarControlSize scrollbar_size = kRegularScrollbar;
if (style_source.StyleRef().HasAppearance()) {
scrollbar_size = LayoutTheme::GetTheme().ScrollbarControlSizeForPart(
style_source.StyleRef().Appearance());
}
scrollbar = Scrollbar::Create(ScrollableArea(), orientation, scrollbar_size,
&ScrollableArea()
->GetLayoutBox()
->GetFrame()
->GetPage()
->GetChromeClient());
}
ScrollableArea()->GetLayoutBox()->GetDocument().View()->AddScrollbar(
scrollbar);
return scrollbar;
}
| 4,238 |
23,529 | 0 | void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p)
{
struct kvec *iov = buf->head;
int scratch_len = buf->buflen - buf->page_len - buf->tail[0].iov_len;
BUG_ON(scratch_len < 0);
xdr->buf = buf;
xdr->iov = iov;
xdr->p = (__be32 *)((char *)iov->iov_base + iov->iov_len);
xdr->end = (__be32 *)((char *)iov->iov_base + scratch_len);
BUG_ON(iov->iov_len > scratch_len);
if (p != xdr->p && p != NULL) {
size_t len;
BUG_ON(p < xdr->p || p > xdr->end);
len = (char *)p - (char *)xdr->p;
xdr->p = p;
buf->len += len;
iov->iov_len += len;
}
}
| 4,239 |
44,939 | 0 | xfs_attr3_leaf_split(
struct xfs_da_state *state,
struct xfs_da_state_blk *oldblk,
struct xfs_da_state_blk *newblk)
{
xfs_dablk_t blkno;
int error;
trace_xfs_attr_leaf_split(state->args);
/*
* Allocate space for a new leaf node.
*/
ASSERT(oldblk->magic == XFS_ATTR_LEAF_MAGIC);
error = xfs_da_grow_inode(state->args, &blkno);
if (error)
return(error);
error = xfs_attr3_leaf_create(state->args, blkno, &newblk->bp);
if (error)
return(error);
newblk->blkno = blkno;
newblk->magic = XFS_ATTR_LEAF_MAGIC;
/*
* Rebalance the entries across the two leaves.
* NOTE: rebalance() currently depends on the 2nd block being empty.
*/
xfs_attr3_leaf_rebalance(state, oldblk, newblk);
error = xfs_da3_blk_link(state, oldblk, newblk);
if (error)
return(error);
/*
* Save info on "old" attribute for "atomic rename" ops, leaf_add()
* modifies the index/blkno/rmtblk/rmtblkcnt fields to show the
* "new" attrs info. Will need the "old" info to remove it later.
*
* Insert the "new" entry in the correct block.
*/
if (state->inleaf) {
trace_xfs_attr_leaf_add_old(state->args);
error = xfs_attr3_leaf_add(oldblk->bp, state->args);
} else {
trace_xfs_attr_leaf_add_new(state->args);
error = xfs_attr3_leaf_add(newblk->bp, state->args);
}
/*
* Update last hashval in each block since we added the name.
*/
oldblk->hashval = xfs_attr_leaf_lasthash(oldblk->bp, NULL);
newblk->hashval = xfs_attr_leaf_lasthash(newblk->bp, NULL);
return(error);
}
| 4,240 |
17,176 | 0 | void OxideQQuickWebView::setUrl(const QUrl& url) {
Q_D(OxideQQuickWebView);
QUrl old_url = this->url();
if (!d->proxy_) {
d->construct_props_->load_html = false;
d->construct_props_->url = url;
d->construct_props_->html.clear();
} else {
d->proxy_->setUrl(url);
}
if (this->url() != old_url) {
emit urlChanged();
}
}
| 4,241 |
45,958 | 0 | string_modifier_check(struct magic_set *ms, struct magic *m)
{
if ((ms->flags & MAGIC_CHECK) == 0)
return 0;
if ((m->type != FILE_REGEX || (m->str_flags & REGEX_LINE_COUNT) == 0) &&
(m->type != FILE_PSTRING && (m->str_flags & PSTRING_LEN) != 0)) {
file_magwarn(ms,
"'/BHhLl' modifiers are only allowed for pascal strings\n");
return -1;
}
switch (m->type) {
case FILE_BESTRING16:
case FILE_LESTRING16:
if (m->str_flags != 0) {
file_magwarn(ms,
"no modifiers allowed for 16-bit strings\n");
return -1;
}
break;
case FILE_STRING:
case FILE_PSTRING:
if ((m->str_flags & REGEX_OFFSET_START) != 0) {
file_magwarn(ms,
"'/%c' only allowed on regex and search\n",
CHAR_REGEX_OFFSET_START);
return -1;
}
break;
case FILE_SEARCH:
if (m->str_range == 0) {
file_magwarn(ms,
"missing range; defaulting to %d\n",
STRING_DEFAULT_RANGE);
m->str_range = STRING_DEFAULT_RANGE;
return -1;
}
break;
case FILE_REGEX:
if ((m->str_flags & STRING_COMPACT_WHITESPACE) != 0) {
file_magwarn(ms, "'/%c' not allowed on regex\n",
CHAR_COMPACT_WHITESPACE);
return -1;
}
if ((m->str_flags & STRING_COMPACT_OPTIONAL_WHITESPACE) != 0) {
file_magwarn(ms, "'/%c' not allowed on regex\n",
CHAR_COMPACT_OPTIONAL_WHITESPACE);
return -1;
}
break;
default:
file_magwarn(ms, "coding error: m->type=%d\n",
m->type);
return -1;
}
return 0;
}
| 4,242 |
56,197 | 0 | armpmu_start(struct perf_event *event, int flags)
{
struct arm_pmu *armpmu = to_arm_pmu(event->pmu);
struct hw_perf_event *hwc = &event->hw;
/*
* ARM pmu always has to reprogram the period, so ignore
* PERF_EF_RELOAD, see the comment below.
*/
if (flags & PERF_EF_RELOAD)
WARN_ON_ONCE(!(hwc->state & PERF_HES_UPTODATE));
hwc->state = 0;
/*
* Set the period again. Some counters can't be stopped, so when we
* were stopped we simply disabled the IRQ source and the counter
* may have been left counting. If we don't do this step then we may
* get an interrupt too soon or *way* too late if the overflow has
* happened since disabling.
*/
armpmu_event_set_period(event, hwc, hwc->idx);
armpmu->enable(hwc, hwc->idx);
}
| 4,243 |
184,517 | 1 | void ChromeInvalidationClient::ReissueRegistrations(
invalidation::InvalidationClient* client,
const std::string& prefix,
int prefix_length) {
DCHECK(CalledOnValidThread());
DVLOG(1) << "AllRegistrationsLost";
registration_manager_->MarkAllRegistrationsLost();
}
| 4,244 |
66,663 | 0 | static int __init crypto_ccm_module_init(void)
{
int err;
err = crypto_register_template(&crypto_cbcmac_tmpl);
if (err)
goto out;
err = crypto_register_template(&crypto_ccm_base_tmpl);
if (err)
goto out_undo_cbcmac;
err = crypto_register_template(&crypto_ccm_tmpl);
if (err)
goto out_undo_base;
err = crypto_register_template(&crypto_rfc4309_tmpl);
if (err)
goto out_undo_ccm;
out:
return err;
out_undo_ccm:
crypto_unregister_template(&crypto_ccm_tmpl);
out_undo_base:
crypto_unregister_template(&crypto_ccm_base_tmpl);
out_undo_cbcmac:
crypto_register_template(&crypto_cbcmac_tmpl);
goto out;
}
| 4,245 |
115,651 | 0 | void ChromotingHost::OnStateChange(
SignalStrategy::StatusObserver::State state) {
DCHECK(context_->network_message_loop()->BelongsToCurrentThread());
if (state == SignalStrategy::StatusObserver::CONNECTED) {
LOG(INFO) << "Host connected as " << local_jid_;
protocol::JingleSessionManager* server =
new protocol::JingleSessionManager(context_->network_message_loop());
server->set_allow_local_ips(true);
HostKeyPair key_pair;
CHECK(key_pair.Load(config_))
<< "Failed to load server authentication data";
server->Init(local_jid_, signal_strategy_.get(), this,
key_pair.CopyPrivateKey(), key_pair.GenerateCertificate(),
allow_nat_traversal_);
session_manager_.reset(server);
for (StatusObserverList::iterator it = status_observers_.begin();
it != status_observers_.end(); ++it) {
(*it)->OnSignallingConnected(signal_strategy_.get(), local_jid_);
}
} else if (state == SignalStrategy::StatusObserver::CLOSED) {
LOG(INFO) << "Host disconnected from talk network.";
for (StatusObserverList::iterator it = status_observers_.begin();
it != status_observers_.end(); ++it) {
(*it)->OnSignallingDisconnected();
}
}
}
| 4,246 |
143,022 | 0 | void BaseAudioContext::ResolvePromisesForUnpause() {
DCHECK(IsAudioThread());
AssertGraphOwner();
if (!is_resolving_resume_promises_ && resume_resolvers_.size() > 0) {
is_resolving_resume_promises_ = true;
ScheduleMainThreadCleanup();
}
}
| 4,247 |
21,850 | 0 | static bool valid_cr(int nr)
{
switch (nr) {
case 0:
case 2 ... 4:
case 8:
return true;
default:
return false;
}
}
| 4,248 |
6,367 | 0 | e1000_link_up(E1000State *s)
{
s->mac_reg[STATUS] |= E1000_STATUS_LU;
s->phy_reg[PHY_STATUS] |= MII_SR_LINK_STATUS;
}
| 4,249 |
108,065 | 0 | void GLES2DecoderImpl::DoCompressedTexSubImage2D(
GLenum target,
GLint level,
GLint xoffset,
GLint yoffset,
GLsizei width,
GLsizei height,
GLenum format,
GLsizei image_size,
const void * data) {
TextureManager::TextureInfo* info = GetTextureInfoForTarget(target);
if (!info) {
SetGLError(GL_INVALID_OPERATION,
"glCompressedTexSubImage2D: unknown texture for target");
return;
}
GLenum type = 0;
GLenum dummy = 0;
if (!info->GetLevelType(target, level, &type, &dummy) ||
!info->ValidForTexture(
target, level, xoffset, yoffset, width, height, format, type)) {
SetGLError(GL_INVALID_VALUE,
"glCompressdTexSubImage2D: bad dimensions.");
return;
}
glCompressedTexSubImage2D(
target, level, xoffset, yoffset, width, height, format, image_size, data);
}
| 4,250 |
88,957 | 0 | ModuleExport void UnregisterPNMImage(void)
{
(void) UnregisterMagickInfo("PAM");
(void) UnregisterMagickInfo("PBM");
(void) UnregisterMagickInfo("PGM");
(void) UnregisterMagickInfo("PNM");
(void) UnregisterMagickInfo("PPM");
}
| 4,251 |
182,718 | 1 | double GetGPMFSampleRate(size_t handle, uint32_t fourcc, uint32_t flags)
{
mp4object *mp4 = (mp4object *)handle;
if (mp4 == NULL) return 0.0;
GPMF_stream metadata_stream, *ms = &metadata_stream;
uint32_t teststart = 0;
uint32_t testend = mp4->indexcount;
double rate = 0.0;
if (mp4->indexcount < 1)
return 0.0;
if (mp4->indexcount > 3) // samples after first and before last are statistically the best, avoiding camera start up or shutdown anomollies.
{
teststart++;
testend--;
}
uint32_t *payload = GetPayload(handle, NULL, teststart); // second payload
uint32_t payloadsize = GetPayloadSize(handle, teststart);
int32_t ret = GPMF_Init(ms, payload, payloadsize);
if (ret != GPMF_OK)
goto cleanup;
{
uint32_t startsamples = 0;
uint32_t endsamples = 0;
uint32_t missing_samples = 0;
while (ret == GPMF_OK && GPMF_OK != GPMF_FindNext(ms, fourcc, GPMF_RECURSE_LEVELS))
{
missing_samples = 1;
teststart++;
payload = GetPayload(handle, payload, teststart); // second last payload
payloadsize = GetPayloadSize(handle, teststart);
ret = GPMF_Init(ms, payload, payloadsize);
}
if (missing_samples)
{
teststart++; //samples after sensor start are statistically the best
payload = GetPayload(handle, payload, teststart);
payloadsize = GetPayloadSize(handle, teststart);
ret = GPMF_Init(ms, payload, payloadsize);
}
if (ret == GPMF_OK)
{
uint32_t samples = GPMF_Repeat(ms);
GPMF_stream find_stream;
GPMF_CopyState(ms, &find_stream);
if (!(flags & GPMF_SAMPLE_RATE_PRECISE) && GPMF_OK == GPMF_FindPrev(&find_stream, GPMF_KEY_TOTAL_SAMPLES, GPMF_CURRENT_LEVEL))
{
startsamples = BYTESWAP32(*(uint32_t *)GPMF_RawData(&find_stream)) - samples;
payload = GetPayload(handle, payload, testend); // second last payload
payloadsize = GetPayloadSize(handle, testend);
ret = GPMF_Init(ms, payload, payloadsize);
if (ret != GPMF_OK)
goto cleanup;
if (GPMF_OK == GPMF_FindNext(ms, fourcc, GPMF_RECURSE_LEVELS))
{
GPMF_CopyState(ms, &find_stream);
if (GPMF_OK == GPMF_FindPrev(&find_stream, GPMF_KEY_TOTAL_SAMPLES, GPMF_CURRENT_LEVEL))
{
endsamples = BYTESWAP32(*(uint32_t *)GPMF_RawData(&find_stream));
rate = (double)(endsamples - startsamples) / (mp4->metadatalength * ((double)(testend - teststart + 1)) / (double)mp4->indexcount);
goto cleanup;
}
}
rate = (double)(samples) / (mp4->metadatalength * ((double)(testend - teststart + 1)) / (double)mp4->indexcount);
}
else // for increased precision, for older GPMF streams sometimes missing the total sample count
{
uint32_t payloadpos = 0, payloadcount = 0;
double slope, top = 0.0, bot = 0.0, meanX = 0, meanY = 0;
uint32_t *repeatarray = malloc(mp4->indexcount * 4 + 4);
memset(repeatarray, 0, mp4->indexcount * 4 + 4);
samples = 0;
for (payloadpos = teststart; payloadpos < testend; payloadcount++, payloadpos++)
{
payload = GetPayload(handle, payload, payloadpos); // second last payload
payloadsize = GetPayloadSize(handle, payloadpos);
ret = GPMF_Init(ms, payload, payloadsize);
if (ret != GPMF_OK)
goto cleanup;
if (GPMF_OK == GPMF_FindNext(ms, fourcc, GPMF_RECURSE_LEVELS))
{
GPMF_stream find_stream2;
GPMF_CopyState(ms, &find_stream2);
if (GPMF_OK == GPMF_FindNext(&find_stream2, fourcc, GPMF_CURRENT_LEVEL)) // Count the instances, not the repeats
{
if (repeatarray)
{
float in, out;
do
{
samples++;
} while (GPMF_OK == GPMF_FindNext(ms, fourcc, GPMF_CURRENT_LEVEL));
repeatarray[payloadpos] = samples;
meanY += (double)samples;
GetPayloadTime(handle, payloadpos, &in, &out);
meanX += out;
}
}
else
{
uint32_t repeat = GPMF_Repeat(ms);
samples += repeat;
if (repeatarray)
{
float in, out;
repeatarray[payloadpos] = samples;
meanY += (double)samples;
GetPayloadTime(handle, payloadpos, &in, &out);
meanX += out;
}
}
}
}
// Compute the line of best fit for a jitter removed sample rate.
// This does assume an unchanging clock, even though the IMU data can thermally impacted causing small clock changes.
// TODO: Next enhancement would be a low order polynominal fit the compensate for any thermal clock drift.
if (repeatarray)
{
meanY /= (double)payloadcount;
meanX /= (double)payloadcount;
for (payloadpos = teststart; payloadpos < testend; payloadpos++)
{
float in, out;
GetPayloadTime(handle, payloadpos, &in, &out);
top += ((double)out - meanX)*((double)repeatarray[payloadpos] - meanY);
bot += ((double)out - meanX)*((double)out - meanX);
}
slope = top / bot;
#if 0
// This sample code might be useful for compare data latency between channels.
{
double intercept;
intercept = meanY - slope*meanX;
printf("%c%c%c%c start offset = %f (%.3fms)\n", PRINTF_4CC(fourcc), intercept, 1000.0 * intercept / slope);
}
#endif
rate = slope;
}
else
{
rate = (double)(samples) / (mp4->metadatalength * ((double)(testend - teststart + 1)) / (double)mp4->indexcount);
}
free(repeatarray);
goto cleanup;
}
}
}
cleanup:
if (payload)
{
FreePayload(payload);
payload = NULL;
}
return rate;
}
| 4,252 |
72,684 | 0 | jas_iccattrval_t *jas_iccattrval_clone(jas_iccattrval_t *attrval)
{
++attrval->refcnt;
return attrval;
}
| 4,253 |
140,089 | 0 | void HTMLMediaElement::selectMediaResource() {
BLINK_MEDIA_LOG << "selectMediaResource(" << (void*)this << ")";
enum Mode { Object, Attribute, Children, Nothing };
Mode mode = Nothing;
if (m_srcObject) {
mode = Object;
} else if (fastHasAttribute(srcAttr)) {
mode = Attribute;
} else if (HTMLSourceElement* element =
Traversal<HTMLSourceElement>::firstChild(*this)) {
mode = Children;
m_nextChildNodeToConsider = element;
m_currentSourceNode = nullptr;
} else {
m_loadState = WaitingForSource;
setShouldDelayLoadEvent(false);
setNetworkState(kNetworkEmpty);
updateDisplayState();
BLINK_MEDIA_LOG << "selectMediaResource(" << (void*)this
<< "), nothing to load";
return;
}
setNetworkState(kNetworkLoading);
scheduleEvent(EventTypeNames::loadstart);
switch (mode) {
case Object:
loadSourceFromObject();
BLINK_MEDIA_LOG << "selectMediaResource(" << (void*)this
<< ", using 'srcObject' attribute";
break;
case Attribute:
loadSourceFromAttribute();
BLINK_MEDIA_LOG << "selectMediaResource(" << (void*)this
<< "), using 'src' attribute url";
break;
case Children:
loadNextSourceChild();
BLINK_MEDIA_LOG << "selectMediaResource(" << (void*)this
<< "), using source element";
break;
default:
NOTREACHED();
}
}
| 4,254 |
74,505 | 0 | struct regulator *regulator_get_exclusive(struct device *dev, const char *id)
{
return _regulator_get(dev, id, true, false);
}
| 4,255 |
38,114 | 0 | static int lg_input_mapped(struct hid_device *hdev, struct hid_input *hi,
struct hid_field *field, struct hid_usage *usage,
unsigned long **bit, int *max)
{
struct lg_drv_data *drv_data = hid_get_drvdata(hdev);
if ((drv_data->quirks & LG_BAD_RELATIVE_KEYS) && usage->type == EV_KEY &&
(field->flags & HID_MAIN_ITEM_RELATIVE))
field->flags &= ~HID_MAIN_ITEM_RELATIVE;
if ((drv_data->quirks & LG_DUPLICATE_USAGES) && (usage->type == EV_KEY ||
usage->type == EV_REL || usage->type == EV_ABS))
clear_bit(usage->code, *bit);
/* Ensure that Logitech wheels are not given a default fuzz/flat value */
if (usage->type == EV_ABS && (usage->code == ABS_X ||
usage->code == ABS_Y || usage->code == ABS_Z ||
usage->code == ABS_RZ)) {
switch (hdev->product) {
case USB_DEVICE_ID_LOGITECH_WHEEL:
case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL:
case USB_DEVICE_ID_LOGITECH_DFP_WHEEL:
case USB_DEVICE_ID_LOGITECH_G25_WHEEL:
case USB_DEVICE_ID_LOGITECH_DFGT_WHEEL:
case USB_DEVICE_ID_LOGITECH_G27_WHEEL:
case USB_DEVICE_ID_LOGITECH_WII_WHEEL:
case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2:
case USB_DEVICE_ID_LOGITECH_VIBRATION_WHEEL:
field->application = HID_GD_MULTIAXIS;
break;
default:
break;
}
}
return 0;
}
| 4,256 |
166,211 | 0 | void MediaStreamManager::HandleRequestDone(const std::string& label,
DeviceRequest* request) {
DCHECK(RequestDone(*request));
DVLOG(1) << "HandleRequestDone("
<< ", {label = " << label << "})";
switch (request->request_type()) {
case MEDIA_OPEN_DEVICE_PEPPER_ONLY:
FinalizeOpenDevice(label, request);
OnStreamStarted(label);
break;
case MEDIA_GENERATE_STREAM: {
FinalizeGenerateStream(label, request);
break;
}
case MEDIA_DEVICE_UPDATE:
OnStreamStarted(label);
break;
default:
NOTREACHED();
break;
}
}
| 4,257 |
144,754 | 0 | TabVisibility ContentVisibilityToRCVisibility(content::Visibility visibility) {
if (visibility == content::Visibility::VISIBLE)
return TabVisibility::kForeground;
return TabVisibility::kBackground;
}
| 4,258 |
144,367 | 0 | ExtensionInstallPrompt::GetLocalizedExtensionForDisplay(
const base::DictionaryValue* manifest,
int flags,
const std::string& id,
const std::string& localized_name,
const std::string& localized_description,
std::string* error) {
scoped_ptr<base::DictionaryValue> localized_manifest;
if (!localized_name.empty() || !localized_description.empty()) {
localized_manifest.reset(manifest->DeepCopy());
if (!localized_name.empty()) {
localized_manifest->SetString(extensions::manifest_keys::kName,
localized_name);
}
if (!localized_description.empty()) {
localized_manifest->SetString(extensions::manifest_keys::kDescription,
localized_description);
}
}
return Extension::Create(
base::FilePath(),
Manifest::INTERNAL,
localized_manifest.get() ? *localized_manifest.get() : *manifest,
flags,
id,
error);
}
| 4,259 |
141,208 | 0 | static void RunAutofocusTask(ExecutionContext* context) {
if (!context)
return;
Document* document = To<Document>(context);
if (Element* element = document->AutofocusElement()) {
document->SetAutofocusElement(nullptr);
element->focus();
}
}
| 4,260 |
45,111 | 0 | static apr_status_t lua_write_body(request_rec *r, apr_file_t *file, apr_off_t *size)
{
apr_status_t rc = OK;
if ((rc = ap_setup_client_block(r, REQUEST_CHUNKED_ERROR)))
return rc;
if (ap_should_client_block(r)) {
char argsbuffer[HUGE_STRING_LEN];
apr_off_t rsize,
len_read,
rpos = 0;
apr_off_t length = r->remaining;
*size = length;
while ((len_read =
ap_get_client_block(r, argsbuffer,
sizeof(argsbuffer))) > 0) {
if ((rpos + len_read) > length)
rsize = (apr_size_t) length - rpos;
else
rsize = len_read;
rc = apr_file_write_full(file, argsbuffer, (apr_size_t) rsize,
NULL);
if (rc != APR_SUCCESS)
return rc;
rpos += rsize;
}
}
return rc;
}
| 4,261 |
69,340 | 0 | static int aes_xts_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
const unsigned char *in, size_t len)
{
EVP_AES_XTS_CTX *xctx = EVP_C_DATA(EVP_AES_XTS_CTX,ctx);
if (!xctx->xts.key1 || !xctx->xts.key2)
return 0;
if (!out || !in || len < AES_BLOCK_SIZE)
return 0;
if (xctx->stream)
(*xctx->stream) (in, out, len,
xctx->xts.key1, xctx->xts.key2,
EVP_CIPHER_CTX_iv_noconst(ctx));
else if (CRYPTO_xts128_encrypt(&xctx->xts, EVP_CIPHER_CTX_iv_noconst(ctx),
in, out, len,
EVP_CIPHER_CTX_encrypting(ctx)))
return 0;
return 1;
}
| 4,262 |
60,929 | 0 | lacks_mount (NautilusFile *file)
{
return (!file->details->mount_is_up_to_date &&
(
/* Unix mountpoint, could be a GMount */
file->details->is_mountpoint ||
/* The toplevel directory of something */
(file->details->type == G_FILE_TYPE_DIRECTORY &&
nautilus_file_is_self_owned (file)) ||
/* Mountable, could be a mountpoint */
(file->details->type == G_FILE_TYPE_MOUNTABLE)
)
);
}
| 4,263 |
166,895 | 0 | void Performance::NotifyNavigationTimingToObservers() {
if (!navigation_timing_)
navigation_timing_ = CreateNavigationTimingInstance();
if (navigation_timing_)
NotifyObserversOfEntry(*navigation_timing_);
}
| 4,264 |
177,103 | 0 | void SoftAMRWBEncoder::onQueueFilled(OMX_U32 /* portIndex */) {
if (mSignalledError) {
return;
}
List<BufferInfo *> &inQueue = getPortQueue(0);
List<BufferInfo *> &outQueue = getPortQueue(1);
size_t numBytesPerInputFrame = kNumSamplesPerFrame * sizeof(int16_t);
for (;;) {
while (mInputSize < numBytesPerInputFrame) {
if (mSawInputEOS || inQueue.empty()) {
return;
}
BufferInfo *inInfo = *inQueue.begin();
OMX_BUFFERHEADERTYPE *inHeader = inInfo->mHeader;
const void *inData = inHeader->pBuffer + inHeader->nOffset;
size_t copy = numBytesPerInputFrame - mInputSize;
if (copy > inHeader->nFilledLen) {
copy = inHeader->nFilledLen;
}
if (mInputSize == 0) {
mInputTimeUs = inHeader->nTimeStamp;
}
memcpy((uint8_t *)mInputFrame + mInputSize, inData, copy);
mInputSize += copy;
inHeader->nOffset += copy;
inHeader->nFilledLen -= copy;
inHeader->nTimeStamp +=
(copy * 1000000ll / kSampleRate) / sizeof(int16_t);
if (inHeader->nFilledLen == 0) {
if (inHeader->nFlags & OMX_BUFFERFLAG_EOS) {
ALOGV("saw input EOS");
mSawInputEOS = true;
memset((uint8_t *)mInputFrame + mInputSize,
0,
numBytesPerInputFrame - mInputSize);
mInputSize = numBytesPerInputFrame;
}
inQueue.erase(inQueue.begin());
inInfo->mOwnedByUs = false;
notifyEmptyBufferDone(inHeader);
inData = NULL;
inHeader = NULL;
inInfo = NULL;
}
}
if (outQueue.empty()) {
return;
}
BufferInfo *outInfo = *outQueue.begin();
OMX_BUFFERHEADERTYPE *outHeader = outInfo->mHeader;
uint8_t *outPtr = outHeader->pBuffer + outHeader->nOffset;
size_t outAvailable = outHeader->nAllocLen - outHeader->nOffset;
VO_CODECBUFFER inputData;
memset(&inputData, 0, sizeof(inputData));
inputData.Buffer = (unsigned char *) mInputFrame;
inputData.Length = mInputSize;
CHECK_EQ(VO_ERR_NONE,
mApiHandle->SetInputData(mEncoderHandle, &inputData));
VO_CODECBUFFER outputData;
memset(&outputData, 0, sizeof(outputData));
VO_AUDIO_OUTPUTINFO outputInfo;
memset(&outputInfo, 0, sizeof(outputInfo));
outputData.Buffer = outPtr;
outputData.Length = outAvailable;
VO_U32 ret = mApiHandle->GetOutputData(
mEncoderHandle, &outputData, &outputInfo);
CHECK(ret == VO_ERR_NONE || ret == VO_ERR_INPUT_BUFFER_SMALL);
outHeader->nFilledLen = outputData.Length;
outHeader->nFlags = OMX_BUFFERFLAG_ENDOFFRAME;
if (mSawInputEOS) {
outHeader->nFlags = OMX_BUFFERFLAG_EOS;
}
outHeader->nTimeStamp = mInputTimeUs;
#if 0
ALOGI("sending %ld bytes of data (time = %lld us, flags = 0x%08lx)",
outHeader->nFilledLen, mInputTimeUs, outHeader->nFlags);
hexdump(outHeader->pBuffer + outHeader->nOffset, outHeader->nFilledLen);
#endif
outQueue.erase(outQueue.begin());
outInfo->mOwnedByUs = false;
notifyFillBufferDone(outHeader);
outHeader = NULL;
outInfo = NULL;
mInputSize = 0;
}
}
| 4,265 |
179,356 | 1 | static int llc_ui_getname(struct socket *sock, struct sockaddr *uaddr,
int *uaddrlen, int peer)
{
struct sockaddr_llc sllc;
struct sock *sk = sock->sk;
struct llc_sock *llc = llc_sk(sk);
int rc = 0;
memset(&sllc, 0, sizeof(sllc));
lock_sock(sk);
if (sock_flag(sk, SOCK_ZAPPED))
goto out;
*uaddrlen = sizeof(sllc);
memset(uaddr, 0, *uaddrlen);
if (peer) {
rc = -ENOTCONN;
if (sk->sk_state != TCP_ESTABLISHED)
goto out;
if(llc->dev)
sllc.sllc_arphrd = llc->dev->type;
sllc.sllc_sap = llc->daddr.lsap;
memcpy(&sllc.sllc_mac, &llc->daddr.mac, IFHWADDRLEN);
} else {
rc = -EINVAL;
if (!llc->sap)
goto out;
sllc.sllc_sap = llc->sap->laddr.lsap;
if (llc->dev) {
sllc.sllc_arphrd = llc->dev->type;
memcpy(&sllc.sllc_mac, llc->dev->dev_addr,
IFHWADDRLEN);
}
}
rc = 0;
sllc.sllc_family = AF_LLC;
memcpy(uaddr, &sllc, sizeof(sllc));
out:
release_sock(sk);
return rc;
}
| 4,266 |
13,087 | 0 | cf2_getScaleAndHintFlag( CFF_Decoder* decoder,
CF2_Fixed* x_scale,
CF2_Fixed* y_scale,
FT_Bool* hinted,
FT_Bool* scaled )
{
FT_ASSERT( decoder && decoder->builder.glyph );
/* note: FreeType scale includes a factor of 64 */
*hinted = decoder->builder.glyph->hint;
*scaled = decoder->builder.glyph->scaled;
if ( *hinted )
{
*x_scale = FT_DivFix( decoder->builder.glyph->x_scale,
cf2_intToFixed( 64 ) );
*y_scale = FT_DivFix( decoder->builder.glyph->y_scale,
cf2_intToFixed( 64 ) );
}
else
{
/* for unhinted outlines, `cff_slot_load' does the scaling, */
/* thus render at `unity' scale */
*x_scale = 0x0400; /* 1/64 as 16.16 */
*y_scale = 0x0400;
}
}
| 4,267 |
154,973 | 0 | void WebGLRenderingContextBase::PrintWarningToConsole(const String& message) {
if (!canvas())
return;
canvas()->GetDocument().AddConsoleMessage(
ConsoleMessage::Create(mojom::ConsoleMessageSource::kRendering,
mojom::ConsoleMessageLevel::kWarning, message));
}
| 4,268 |
148,130 | 0 | void V8TestObject::VoidMethodOptionalDictionaryArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_voidMethodOptionalDictionaryArg");
test_object_v8_internal::VoidMethodOptionalDictionaryArgMethod(info);
}
| 4,269 |
17,021 | 0 | WebContext::~WebContext() {
if (context_.get()) {
context_->SetDelegate(nullptr);
MediaCaptureDevicesContext::Get(context_.get())->set_client(nullptr);
}
}
| 4,270 |
33,498 | 0 | static ssize_t shmem_file_aio_read(struct kiocb *iocb,
const struct iovec *iov, unsigned long nr_segs, loff_t pos)
{
struct file *filp = iocb->ki_filp;
ssize_t retval;
unsigned long seg;
size_t count;
loff_t *ppos = &iocb->ki_pos;
retval = generic_segment_checks(iov, &nr_segs, &count, VERIFY_WRITE);
if (retval)
return retval;
for (seg = 0; seg < nr_segs; seg++) {
read_descriptor_t desc;
desc.written = 0;
desc.arg.buf = iov[seg].iov_base;
desc.count = iov[seg].iov_len;
if (desc.count == 0)
continue;
desc.error = 0;
do_shmem_file_read(filp, ppos, &desc, file_read_actor);
retval += desc.written;
if (desc.error) {
retval = retval ?: desc.error;
break;
}
if (desc.count > 0)
break;
}
return retval;
}
| 4,271 |
133,755 | 0 | int EncodeSSLConnectionStatus(int cipher_suite,
int compression,
int version) {
return ((cipher_suite & SSL_CONNECTION_CIPHERSUITE_MASK) <<
SSL_CONNECTION_CIPHERSUITE_SHIFT) |
((compression & SSL_CONNECTION_COMPRESSION_MASK) <<
SSL_CONNECTION_COMPRESSION_SHIFT) |
((version & SSL_CONNECTION_VERSION_MASK) <<
SSL_CONNECTION_VERSION_SHIFT);
}
| 4,272 |
79,110 | 0 | user_cert_trusted_ca(struct ssh *ssh, struct passwd *pw, struct sshkey *key,
struct sshauthopt **authoptsp)
{
char *ca_fp, *principals_file = NULL;
const char *reason;
struct sshauthopt *principals_opts = NULL, *cert_opts = NULL;
struct sshauthopt *final_opts = NULL;
int r, ret = 0, found_principal = 0, use_authorized_principals;
if (authoptsp != NULL)
*authoptsp = NULL;
if (!sshkey_is_cert(key) || options.trusted_user_ca_keys == NULL)
return 0;
if ((ca_fp = sshkey_fingerprint(key->cert->signature_key,
options.fingerprint_hash, SSH_FP_DEFAULT)) == NULL)
return 0;
if ((r = sshkey_in_file(key->cert->signature_key,
options.trusted_user_ca_keys, 1, 0)) != 0) {
debug2("%s: CA %s %s is not listed in %s: %s", __func__,
sshkey_type(key->cert->signature_key), ca_fp,
options.trusted_user_ca_keys, ssh_err(r));
goto out;
}
/*
* If AuthorizedPrincipals is in use, then compare the certificate
* principals against the names in that file rather than matching
* against the username.
*/
if ((principals_file = authorized_principals_file(pw)) != NULL) {
if (match_principals_file(ssh, pw, principals_file,
key->cert, &principals_opts))
found_principal = 1;
}
/* Try querying command if specified */
if (!found_principal && match_principals_command(ssh, pw, key,
&principals_opts))
found_principal = 1;
/* If principals file or command is specified, then require a match */
use_authorized_principals = principals_file != NULL ||
options.authorized_principals_command != NULL;
if (!found_principal && use_authorized_principals) {
reason = "Certificate does not contain an authorized principal";
goto fail_reason;
}
if (use_authorized_principals && principals_opts == NULL)
fatal("%s: internal error: missing principals_opts", __func__);
if (sshkey_cert_check_authority(key, 0, 1,
use_authorized_principals ? NULL : pw->pw_name, &reason) != 0)
goto fail_reason;
/* Check authority from options in key and from principals file/cmd */
if ((cert_opts = sshauthopt_from_cert(key)) == NULL) {
reason = "Invalid certificate options";
goto fail_reason;
}
if (auth_authorise_keyopts(ssh, pw, cert_opts, 0, "cert") != 0) {
reason = "Refused by certificate options";
goto fail_reason;
}
if (principals_opts == NULL) {
final_opts = cert_opts;
cert_opts = NULL;
} else {
if (auth_authorise_keyopts(ssh, pw, principals_opts, 0,
"principals") != 0) {
reason = "Refused by certificate principals options";
goto fail_reason;
}
if ((final_opts = sshauthopt_merge(principals_opts,
cert_opts, &reason)) == NULL) {
fail_reason:
error("%s", reason);
auth_debug_add("%s", reason);
goto out;
}
}
/* Success */
verbose("Accepted certificate ID \"%s\" (serial %llu) signed by "
"%s CA %s via %s", key->cert->key_id,
(unsigned long long)key->cert->serial,
sshkey_type(key->cert->signature_key), ca_fp,
options.trusted_user_ca_keys);
if (authoptsp != NULL) {
*authoptsp = final_opts;
final_opts = NULL;
}
ret = 1;
out:
sshauthopt_free(principals_opts);
sshauthopt_free(cert_opts);
sshauthopt_free(final_opts);
free(principals_file);
free(ca_fp);
return ret;
}
| 4,273 |
74,450 | 0 | static int _regulator_disable(struct regulator_dev *rdev)
{
int ret = 0;
if (WARN(rdev->use_count <= 0,
"unbalanced disables for %s\n", rdev_get_name(rdev)))
return -EIO;
/* are we the last user and permitted to disable ? */
if (rdev->use_count == 1 &&
(rdev->constraints && !rdev->constraints->always_on)) {
/* we are last user */
if (_regulator_can_change_status(rdev)) {
ret = _regulator_do_disable(rdev);
if (ret < 0) {
rdev_err(rdev, "failed to disable\n");
return ret;
}
_notifier_call_chain(rdev, REGULATOR_EVENT_DISABLE,
NULL);
}
rdev->use_count = 0;
} else if (rdev->use_count > 1) {
if (rdev->constraints &&
(rdev->constraints->valid_ops_mask &
REGULATOR_CHANGE_DRMS))
drms_uA_update(rdev);
rdev->use_count--;
}
return ret;
}
| 4,274 |
96,343 | 0 | ProcessUDPHeader(tTcpIpPacketParsingResult _res, PVOID pIpHeader, ULONG len, USHORT ipHeaderSize)
{
tTcpIpPacketParsingResult res = _res;
ULONG udpDataStart = ipHeaderSize + sizeof(UDPHeader);
res.TcpUdp = ppresIsUDP;
res.XxpIpHeaderSize = udpDataStart;
if (len >= udpDataStart)
{
UDPHeader *pUdpHeader = (UDPHeader *)RtlOffsetToPointer(pIpHeader, ipHeaderSize);
USHORT datagramLength = swap_short(pUdpHeader->udp_length);
res.xxpStatus = ppresXxpKnown;
res.xxpFull = TRUE;
DPrintf(2, ("udp: len %d, datagramLength %d\n", len, datagramLength));
}
else
{
res.xxpFull = FALSE;
res.xxpStatus = ppresXxpIncomplete;
}
return res;
}
| 4,275 |
118,172 | 0 | SkColor DialogNotification::GetBackgroundColor() const {
switch (type_) {
case DialogNotification::WALLET_USAGE_CONFIRMATION:
return SkColorSetRGB(0xf5, 0xf5, 0xf5);
case DialogNotification::REQUIRED_ACTION:
case DialogNotification::WALLET_ERROR:
return SkColorSetRGB(0xfc, 0xf3, 0xbf);
case DialogNotification::DEVELOPER_WARNING:
case DialogNotification::SECURITY_WARNING:
return kWarningColor;
case DialogNotification::NONE:
return SK_ColorTRANSPARENT;
}
NOTREACHED();
return SK_ColorTRANSPARENT;
}
| 4,276 |
118,765 | 0 | bool ContainerNode::getLowerRightCorner(FloatPoint& point) const
{
if (!renderer())
return false;
RenderObject* o = renderer();
if (!o->isInline() || o->isReplaced()) {
RenderBox* box = toRenderBox(o);
point = o->localToAbsolute(LayoutPoint(box->size()), UseTransforms);
return true;
}
while (o) {
if (o->lastChild()) {
o = o->lastChild();
} else if (o->previousSibling()) {
o = o->previousSibling();
} else {
RenderObject* prev = 0;
while (!prev) {
o = o->parent();
if (!o)
return false;
prev = o->previousSibling();
}
o = prev;
}
ASSERT(o);
if (o->isText() || o->isReplaced()) {
point = FloatPoint();
if (o->isText()) {
RenderText* text = toRenderText(o);
IntRect linesBox = text->linesBoundingBox();
if (!linesBox.maxX() && !linesBox.maxY())
continue;
point.moveBy(linesBox.maxXMaxYCorner());
} else {
RenderBox* box = toRenderBox(o);
point.moveBy(box->frameRect().maxXMaxYCorner());
}
point = o->container()->localToAbsolute(point, UseTransforms);
return true;
}
}
return true;
}
| 4,277 |
134,150 | 0 | void InputMethodLinuxX11::OnDidChangeFocusedClient(
TextInputClient* focused_before,
TextInputClient* focused) {
input_method_context_->Reset();
input_method_context_->OnTextInputTypeChanged(
focused ? focused->GetTextInputType() : TEXT_INPUT_TYPE_NONE);
InputMethodBase::OnDidChangeFocusedClient(focused_before, focused);
}
| 4,278 |
354 | 0 | fz_colorspace_type(fz_context *ctx, fz_colorspace *cs)
{
return cs ? cs->type : FZ_COLORSPACE_NONE;
}
| 4,279 |
139,520 | 0 | static bool ExecuteUnderline(LocalFrame& frame,
Event*,
EditorCommandSource source,
const String&) {
CSSIdentifierValue* underline = CSSIdentifierValue::Create(CSSValueUnderline);
return ExecuteToggleStyleInList(
frame, source, InputEvent::InputType::kFormatUnderline,
CSSPropertyWebkitTextDecorationsInEffect, underline);
}
| 4,280 |
65,145 | 0 | static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
int addr_len)
{
struct sockaddr_in6 *usin = (struct sockaddr_in6 *) uaddr;
struct inet_sock *inet = inet_sk(sk);
struct inet_connection_sock *icsk = inet_csk(sk);
struct ipv6_pinfo *np = inet6_sk(sk);
struct tcp_sock *tp = tcp_sk(sk);
struct in6_addr *saddr = NULL, *final_p, final;
struct ipv6_txoptions *opt;
struct flowi6 fl6;
struct dst_entry *dst;
int addr_type;
int err;
struct inet_timewait_death_row *tcp_death_row = &sock_net(sk)->ipv4.tcp_death_row;
if (addr_len < SIN6_LEN_RFC2133)
return -EINVAL;
if (usin->sin6_family != AF_INET6)
return -EAFNOSUPPORT;
memset(&fl6, 0, sizeof(fl6));
if (np->sndflow) {
fl6.flowlabel = usin->sin6_flowinfo&IPV6_FLOWINFO_MASK;
IP6_ECN_flow_init(fl6.flowlabel);
if (fl6.flowlabel&IPV6_FLOWLABEL_MASK) {
struct ip6_flowlabel *flowlabel;
flowlabel = fl6_sock_lookup(sk, fl6.flowlabel);
if (!flowlabel)
return -EINVAL;
fl6_sock_release(flowlabel);
}
}
/*
* connect() to INADDR_ANY means loopback (BSD'ism).
*/
if (ipv6_addr_any(&usin->sin6_addr)) {
if (ipv6_addr_v4mapped(&sk->sk_v6_rcv_saddr))
ipv6_addr_set_v4mapped(htonl(INADDR_LOOPBACK),
&usin->sin6_addr);
else
usin->sin6_addr = in6addr_loopback;
}
addr_type = ipv6_addr_type(&usin->sin6_addr);
if (addr_type & IPV6_ADDR_MULTICAST)
return -ENETUNREACH;
if (addr_type&IPV6_ADDR_LINKLOCAL) {
if (addr_len >= sizeof(struct sockaddr_in6) &&
usin->sin6_scope_id) {
/* If interface is set while binding, indices
* must coincide.
*/
if (sk->sk_bound_dev_if &&
sk->sk_bound_dev_if != usin->sin6_scope_id)
return -EINVAL;
sk->sk_bound_dev_if = usin->sin6_scope_id;
}
/* Connect to link-local address requires an interface */
if (!sk->sk_bound_dev_if)
return -EINVAL;
}
if (tp->rx_opt.ts_recent_stamp &&
!ipv6_addr_equal(&sk->sk_v6_daddr, &usin->sin6_addr)) {
tp->rx_opt.ts_recent = 0;
tp->rx_opt.ts_recent_stamp = 0;
tp->write_seq = 0;
}
sk->sk_v6_daddr = usin->sin6_addr;
np->flow_label = fl6.flowlabel;
/*
* TCP over IPv4
*/
if (addr_type & IPV6_ADDR_MAPPED) {
u32 exthdrlen = icsk->icsk_ext_hdr_len;
struct sockaddr_in sin;
SOCK_DEBUG(sk, "connect: ipv4 mapped\n");
if (__ipv6_only_sock(sk))
return -ENETUNREACH;
sin.sin_family = AF_INET;
sin.sin_port = usin->sin6_port;
sin.sin_addr.s_addr = usin->sin6_addr.s6_addr32[3];
icsk->icsk_af_ops = &ipv6_mapped;
sk->sk_backlog_rcv = tcp_v4_do_rcv;
#ifdef CONFIG_TCP_MD5SIG
tp->af_specific = &tcp_sock_ipv6_mapped_specific;
#endif
err = tcp_v4_connect(sk, (struct sockaddr *)&sin, sizeof(sin));
if (err) {
icsk->icsk_ext_hdr_len = exthdrlen;
icsk->icsk_af_ops = &ipv6_specific;
sk->sk_backlog_rcv = tcp_v6_do_rcv;
#ifdef CONFIG_TCP_MD5SIG
tp->af_specific = &tcp_sock_ipv6_specific;
#endif
goto failure;
}
np->saddr = sk->sk_v6_rcv_saddr;
return err;
}
if (!ipv6_addr_any(&sk->sk_v6_rcv_saddr))
saddr = &sk->sk_v6_rcv_saddr;
fl6.flowi6_proto = IPPROTO_TCP;
fl6.daddr = sk->sk_v6_daddr;
fl6.saddr = saddr ? *saddr : np->saddr;
fl6.flowi6_oif = sk->sk_bound_dev_if;
fl6.flowi6_mark = sk->sk_mark;
fl6.fl6_dport = usin->sin6_port;
fl6.fl6_sport = inet->inet_sport;
fl6.flowi6_uid = sk->sk_uid;
opt = rcu_dereference_protected(np->opt, lockdep_sock_is_held(sk));
final_p = fl6_update_dst(&fl6, opt, &final);
security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
dst = ip6_dst_lookup_flow(sk, &fl6, final_p);
if (IS_ERR(dst)) {
err = PTR_ERR(dst);
goto failure;
}
if (!saddr) {
saddr = &fl6.saddr;
sk->sk_v6_rcv_saddr = *saddr;
}
/* set the source address */
np->saddr = *saddr;
inet->inet_rcv_saddr = LOOPBACK4_IPV6;
sk->sk_gso_type = SKB_GSO_TCPV6;
ip6_dst_store(sk, dst, NULL, NULL);
icsk->icsk_ext_hdr_len = 0;
if (opt)
icsk->icsk_ext_hdr_len = opt->opt_flen +
opt->opt_nflen;
tp->rx_opt.mss_clamp = IPV6_MIN_MTU - sizeof(struct tcphdr) - sizeof(struct ipv6hdr);
inet->inet_dport = usin->sin6_port;
tcp_set_state(sk, TCP_SYN_SENT);
err = inet6_hash_connect(tcp_death_row, sk);
if (err)
goto late_failure;
sk_set_txhash(sk);
if (likely(!tp->repair)) {
if (!tp->write_seq)
tp->write_seq = secure_tcpv6_seq(np->saddr.s6_addr32,
sk->sk_v6_daddr.s6_addr32,
inet->inet_sport,
inet->inet_dport);
tp->tsoffset = secure_tcpv6_ts_off(np->saddr.s6_addr32,
sk->sk_v6_daddr.s6_addr32);
}
if (tcp_fastopen_defer_connect(sk, &err))
return err;
if (err)
goto late_failure;
err = tcp_connect(sk);
if (err)
goto late_failure;
return 0;
late_failure:
tcp_set_state(sk, TCP_CLOSE);
failure:
inet->inet_dport = 0;
sk->sk_route_caps = 0;
return err;
}
| 4,281 |
177,456 | 0 | long ContentEncoding::ParseCompressionEntry(long long start, long long size,
IMkvReader* pReader,
ContentCompression* compression) {
assert(pReader);
assert(compression);
long long pos = start;
const long long stop = start + size;
bool valid = false;
while (pos < stop) {
long long id, size;
const long status = ParseElementHeader(pReader, pos, stop, id, size);
if (status < 0) // error
return status;
if (id == 0x254) {
long long algo = UnserializeUInt(pReader, pos, size);
if (algo < 0)
return E_FILE_FORMAT_INVALID;
compression->algo = algo;
valid = true;
} else if (id == 0x255) {
if (size <= 0)
return E_FILE_FORMAT_INVALID;
const size_t buflen = static_cast<size_t>(size);
unsigned char* buf = SafeArrayAlloc<unsigned char>(1, buflen);
if (buf == NULL)
return -1;
const int read_status =
pReader->Read(pos, static_cast<long>(buflen), buf);
if (read_status) {
delete[] buf;
return status;
}
compression->settings = buf;
compression->settings_len = buflen;
}
pos += size; // consume payload
if (pos > stop)
return E_FILE_FORMAT_INVALID;
}
if (!valid)
return E_FILE_FORMAT_INVALID;
return 0;
}
| 4,282 |
112,737 | 0 | PrintPreviewDataSource::~PrintPreviewDataSource() {
}
| 4,283 |
147,753 | 0 | static void ReadonlyWindowAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Local<v8::Object> holder = info.Holder();
TestObject* impl = V8TestObject::ToImpl(holder);
V8SetReturnValueFast(info, WTF::GetPtr(impl->readonlyWindowAttribute()), impl);
}
| 4,284 |
172,220 | 0 | void UIPC_Init(void *p_data)
{
UNUSED(p_data);
BTIF_TRACE_DEBUG("UIPC_Init");
memset(&uipc_main, 0, sizeof(tUIPC_MAIN));
uipc_main_init();
uipc_start_main_server_thread();
}
| 4,285 |
87,492 | 0 | static void hash_cleanup(Hash* hash)
{
free(hash->head);
free(hash->val);
free(hash->chain);
free(hash->zeros);
free(hash->headz);
free(hash->chainz);
}
| 4,286 |
57,810 | 0 | int x86_set_memory_region(struct kvm *kvm, int id, gpa_t gpa, u32 size)
{
int r;
mutex_lock(&kvm->slots_lock);
r = __x86_set_memory_region(kvm, id, gpa, size);
mutex_unlock(&kvm->slots_lock);
return r;
}
| 4,287 |
109,506 | 0 | SkPoint GetHeaderFooterPosition(
float webkit_scale_factor,
const printing::PageSizeMargins& page_layout,
printing::HorizontalHeaderFooterPosition horizontal_position,
printing::VerticalHeaderFooterPosition vertical_position,
double offset_to_baseline,
double text_width_in_points) {
SkScalar x = 0;
switch (horizontal_position) {
case printing::LEFT: {
x = printing::kSettingHeaderFooterInterstice - page_layout.margin_left;
break;
}
case printing::RIGHT: {
x = page_layout.content_width + page_layout.margin_right -
printing::kSettingHeaderFooterInterstice - text_width_in_points;
break;
}
case printing::CENTER: {
SkScalar available_width = printing::GetHeaderFooterSegmentWidth(
page_layout.margin_left + page_layout.margin_right +
page_layout.content_width);
x = available_width - page_layout.margin_left +
(available_width - text_width_in_points) / 2;
break;
}
default: {
NOTREACHED();
}
}
SkScalar y = 0;
switch (vertical_position) {
case printing::TOP:
y = printing::kSettingHeaderFooterInterstice -
page_layout.margin_top - offset_to_baseline;
break;
case printing::BOTTOM:
y = page_layout.margin_bottom + page_layout.content_height -
printing::kSettingHeaderFooterInterstice - offset_to_baseline;
break;
default:
NOTREACHED();
}
SkPoint point = SkPoint::Make(x / webkit_scale_factor,
y / webkit_scale_factor);
return point;
}
| 4,288 |
143,292 | 0 | void Document::updateStyleAndLayout()
{
DCHECK(isMainThread());
ScriptForbiddenScope forbidScript;
FrameView* frameView = view();
if (frameView && frameView->isInPerformLayout()) {
ASSERT_NOT_REACHED();
return;
}
if (HTMLFrameOwnerElement* owner = localOwner())
owner->document().updateStyleAndLayout();
updateStyleAndLayoutTree();
if (!isActive())
return;
if (frameView->needsLayout())
frameView->layout();
if (lifecycle().state() < DocumentLifecycle::LayoutClean)
lifecycle().advanceTo(DocumentLifecycle::LayoutClean);
}
| 4,289 |
151,154 | 0 | void InspectorNetworkAgent::DidChangeResourcePriority(
unsigned long identifier,
ResourceLoadPriority load_priority) {
String request_id = IdentifiersFactory::RequestId(identifier);
GetFrontend()->resourceChangedPriority(request_id,
ResourcePriorityJSON(load_priority),
MonotonicallyIncreasingTime());
}
| 4,290 |
77,265 | 0 | handle_set_config(struct ofconn *ofconn, const struct ofp_header *oh)
{
struct ofproto *ofproto = ofconn_get_ofproto(ofconn);
struct ofputil_switch_config config;
enum ofperr error;
error = ofputil_decode_set_config(oh, &config);
if (error) {
return error;
}
if (ofconn_get_type(ofconn) != OFCONN_PRIMARY
|| ofconn_get_role(ofconn) != OFPCR12_ROLE_SLAVE) {
enum ofputil_frag_handling cur = ofproto->frag_handling;
enum ofputil_frag_handling next = config.frag;
if (cur != next) {
if (ofproto->ofproto_class->set_frag_handling(ofproto, next)) {
ofproto->frag_handling = next;
} else {
VLOG_WARN_RL(&rl, "%s: unsupported fragment handling mode %s",
ofproto->name,
ofputil_frag_handling_to_string(next));
}
}
}
if (config.invalid_ttl_to_controller >= 0) {
ofconn_set_invalid_ttl_to_controller(ofconn,
config.invalid_ttl_to_controller);
}
ofconn_set_miss_send_len(ofconn, config.miss_send_len);
return 0;
}
| 4,291 |
144,624 | 0 | void WebContentsImpl::OnUserInteraction(const blink::WebInputEvent::Type type) {
FOR_EACH_OBSERVER(WebContentsObserver, observers_,
DidGetUserInteraction(type));
}
| 4,292 |
162,726 | 0 | void BaseRenderingContext2D::drawImage(
ScriptState* script_state,
const CanvasImageSourceUnion& image_source,
double x,
double y,
ExceptionState& exception_state) {
CanvasImageSource* image_source_internal =
ToImageSourceInternal(image_source, exception_state);
if (!image_source_internal)
return;
FloatSize default_object_size(Width(), Height());
FloatSize source_rect_size =
image_source_internal->ElementSize(default_object_size);
FloatSize dest_rect_size =
image_source_internal->DefaultDestinationSize(default_object_size);
drawImage(script_state, image_source_internal, 0, 0, source_rect_size.Width(),
source_rect_size.Height(), x, y, dest_rect_size.Width(),
dest_rect_size.Height(), exception_state);
}
| 4,293 |
186,036 | 1 | PasswordGenerationUIData GetTestGenerationUIData2() {
PasswordForm form;
form.form_data = autofill::FormData();
form.form_data.action = GURL("http://www.example2.com/accounts/Login");
form.form_data.origin = GURL("http://www.example2.com/accounts/LoginAuth");
PasswordGenerationUIData data;
data.password_form = form;
data.generation_element = ASCIIToUTF16("testelement2");
data.max_length = 11;
return data;
}
| 4,294 |
152,999 | 0 | void PDFiumEngine::Form_Print(IPDF_JSPLATFORM* param,
FPDF_BOOL ui,
int start,
int end,
FPDF_BOOL silent,
FPDF_BOOL shrink_to_fit,
FPDF_BOOL print_as_image,
FPDF_BOOL reverse,
FPDF_BOOL annotations) {
PDFiumEngine* engine = static_cast<PDFiumEngine*>(param);
engine->client_->Print();
}
| 4,295 |
64,853 | 0 | static int decode_v2_header(struct iwbmprcontext *rctx, const iw_byte *buf)
{
unsigned int nplanes;
rctx->width = iw_get_ui16le(&buf[4]);
rctx->height = iw_get_ui16le(&buf[6]);
nplanes = iw_get_ui16le(&buf[8]);
if(nplanes!=1) return 0;
rctx->bitcount = iw_get_ui16le(&buf[10]);
if(rctx->bitcount!=1 && rctx->bitcount!=4 &&
rctx->bitcount!=8 && rctx->bitcount!=24)
{
return 0;
}
if(rctx->bitcount<=8) {
size_t palette_start, palette_end;
rctx->palette_entries = 1<<rctx->bitcount;
rctx->palette_nbytes = 3*rctx->palette_entries;
palette_start = rctx->fileheader_size + rctx->infoheader_size;
palette_end = palette_start + rctx->palette_nbytes;
if(rctx->bfOffBits >= palette_start+3 && rctx->bfOffBits < palette_end) {
rctx->palette_entries = (unsigned int)((rctx->bfOffBits - palette_start)/3);
rctx->palette_nbytes = 3*rctx->palette_entries;
}
}
return 1;
}
| 4,296 |
91,214 | 0 | channel_handler(struct ipmi_smi *intf, struct ipmi_recv_msg *msg)
{
int rv = 0;
int ch;
unsigned int set = intf->curr_working_cset;
struct ipmi_channel *chans;
if ((msg->addr.addr_type == IPMI_SYSTEM_INTERFACE_ADDR_TYPE)
&& (msg->msg.netfn == IPMI_NETFN_APP_RESPONSE)
&& (msg->msg.cmd == IPMI_GET_CHANNEL_INFO_CMD)) {
/* It's the one we want */
if (msg->msg.data[0] != 0) {
/* Got an error from the channel, just go on. */
if (msg->msg.data[0] == IPMI_INVALID_COMMAND_ERR) {
/*
* If the MC does not support this
* command, that is legal. We just
* assume it has one IPMB at channel
* zero.
*/
intf->wchannels[set].c[0].medium
= IPMI_CHANNEL_MEDIUM_IPMB;
intf->wchannels[set].c[0].protocol
= IPMI_CHANNEL_PROTOCOL_IPMB;
intf->channel_list = intf->wchannels + set;
intf->channels_ready = true;
wake_up(&intf->waitq);
goto out;
}
goto next_channel;
}
if (msg->msg.data_len < 4) {
/* Message not big enough, just go on. */
goto next_channel;
}
ch = intf->curr_channel;
chans = intf->wchannels[set].c;
chans[ch].medium = msg->msg.data[2] & 0x7f;
chans[ch].protocol = msg->msg.data[3] & 0x1f;
next_channel:
intf->curr_channel++;
if (intf->curr_channel >= IPMI_MAX_CHANNELS) {
intf->channel_list = intf->wchannels + set;
intf->channels_ready = true;
wake_up(&intf->waitq);
} else {
intf->channel_list = intf->wchannels + set;
intf->channels_ready = true;
rv = send_channel_info_cmd(intf, intf->curr_channel);
}
if (rv) {
/* Got an error somehow, just give up. */
dev_warn(intf->si_dev,
"Error sending channel information for channel %d: %d\n",
intf->curr_channel, rv);
intf->channel_list = intf->wchannels + set;
intf->channels_ready = true;
wake_up(&intf->waitq);
}
}
out:
return;
}
| 4,297 |
62,679 | 0 | static Image *ReadINLINEImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
Image
*image;
MagickBooleanType
status;
register size_t
i;
size_t
quantum;
ssize_t
count;
unsigned char
*inline_image;
/*
Open image file.
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
if (image_info->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
if (LocaleNCompare(image_info->filename,"data:",5) == 0)
{
char
*filename;
Image
*data_image;
filename=AcquireString("data:");
(void) ConcatenateMagickString(filename,image_info->filename,
MaxTextExtent);
data_image=ReadInlineImage(image_info,filename,exception);
filename=DestroyString(filename);
return(data_image);
}
image=AcquireImage(image_info);
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == MagickFalse)
{
image=DestroyImageList(image);
return((Image *) NULL);
}
quantum=MagickMin((size_t) GetBlobSize(image),MagickMaxBufferExtent);
if (quantum == 0)
quantum=MagickMaxBufferExtent;
inline_image=(unsigned char *) AcquireQuantumMemory(quantum,
sizeof(*inline_image));
count=0;
for (i=0; inline_image != (unsigned char *) NULL; i+=count)
{
count=(ssize_t) ReadBlob(image,quantum,inline_image+i);
if (count <= 0)
{
count=0;
if (errno != EINTR)
break;
}
if (~((size_t) i) < (quantum+1))
{
inline_image=(unsigned char *) RelinquishMagickMemory(inline_image);
break;
}
inline_image=(unsigned char *) ResizeQuantumMemory(inline_image,i+count+
quantum+1,sizeof(*inline_image));
}
if (inline_image == (unsigned char *) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),
ResourceLimitError,"MemoryAllocationFailed","`%s'",image->filename);
return((Image *) NULL);
}
inline_image[i+count]='\0';
image=DestroyImageList(image);
image=ReadInlineImage(image_info,(char *) inline_image,exception);
inline_image=(unsigned char *) RelinquishMagickMemory(inline_image);
return(image);
}
| 4,298 |
185,512 | 1 | aura::Window* PartialMagnificationController::GetCurrentRootWindow() {
aura::Window::Windows root_windows = Shell::GetAllRootWindows();
for (aura::Window::Windows::const_iterator iter = root_windows.begin();
iter != root_windows.end(); ++iter) {
aura::Window* root_window = *iter;
if (root_window->ContainsPointInRoot(
root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot()))
return root_window;
}
return NULL;
}
| 4,299 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.