unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
|---|---|---|---|
54,672
| 0
|
static void get_client_info(struct snd_seq_client *cptr,
struct snd_seq_client_info *info)
{
info->client = cptr->number;
/* fill the info fields */
info->type = cptr->type;
strcpy(info->name, cptr->name);
info->filter = cptr->filter;
info->event_lost = cptr->event_lost;
memcpy(info->event_filter, cptr->event_filter, 32);
info->num_ports = cptr->num_ports;
memset(info->reserved, 0, sizeof(info->reserved));
}
| 10,800
|
73,099
| 0
|
BGD_DECLARE(void) gdSetErrorMethod(gdErrorMethod error_method)
{
gd_error_method = error_method;
}
| 10,801
|
91,360
| 0
|
static const char *CompositeOperatorToPSDBlendMode(Image *image)
{
switch (image->compose)
{
case ColorBurnCompositeOp:
return(image->endian == LSBEndian ? "vidi" : "idiv");
case ColorDodgeCompositeOp:
return(image->endian == LSBEndian ? " vid" : "div ");
case ColorizeCompositeOp:
return(image->endian == LSBEndian ? "rloc" : "colr");
case DarkenCompositeOp:
return(image->endian == LSBEndian ? "krad" : "dark");
case DifferenceCompositeOp:
return(image->endian == LSBEndian ? "ffid" : "diff");
case DissolveCompositeOp:
return(image->endian == LSBEndian ? "ssid" : "diss");
case ExclusionCompositeOp:
return(image->endian == LSBEndian ? "dums" : "smud");
case HardLightCompositeOp:
return(image->endian == LSBEndian ? "tiLh" : "hLit");
case HardMixCompositeOp:
return(image->endian == LSBEndian ? "xiMh" : "hMix");
case HueCompositeOp:
return(image->endian == LSBEndian ? " euh" : "hue ");
case LightenCompositeOp:
return(image->endian == LSBEndian ? "etil" : "lite");
case LinearBurnCompositeOp:
return(image->endian == LSBEndian ? "nrbl" : "lbrn");
case LinearDodgeCompositeOp:
return(image->endian == LSBEndian ? "gddl" : "lddg");
case LinearLightCompositeOp:
return(image->endian == LSBEndian ? "tiLl" : "lLit");
case LuminizeCompositeOp:
return(image->endian == LSBEndian ? " mul" : "lum ");
case MultiplyCompositeOp:
return(image->endian == LSBEndian ? " lum" : "mul ");
case OverlayCompositeOp:
return(image->endian == LSBEndian ? "revo" : "over");
case PinLightCompositeOp:
return(image->endian == LSBEndian ? "tiLp" : "pLit");
case SaturateCompositeOp:
return(image->endian == LSBEndian ? " tas" : "sat ");
case ScreenCompositeOp:
return(image->endian == LSBEndian ? "nrcs" : "scrn");
case SoftLightCompositeOp:
return(image->endian == LSBEndian ? "tiLs" : "sLit");
case VividLightCompositeOp:
return(image->endian == LSBEndian ? "tiLv" : "vLit");
case OverCompositeOp:
default:
return(image->endian == LSBEndian ? "mron" : "norm");
}
}
| 10,802
|
93,790
| 0
|
virDomainFSThaw(virDomainPtr dom,
const char **mountpoints,
unsigned int nmountpoints,
unsigned int flags)
{
VIR_DOMAIN_DEBUG(dom, "flags=%x", flags);
virResetLastError();
virCheckDomainReturn(dom, -1);
virCheckReadOnlyGoto(dom->conn->flags, error);
if (nmountpoints)
virCheckNonNullArgGoto(mountpoints, error);
else
virCheckNullArgGoto(mountpoints, error);
if (dom->conn->driver->domainFSThaw) {
int ret = dom->conn->driver->domainFSThaw(
dom, mountpoints, nmountpoints, flags);
if (ret < 0)
goto error;
return ret;
}
virReportUnsupportedError();
error:
virDispatchError(dom->conn);
return -1;
}
| 10,803
|
13,551
| 0
|
static HB_Error GPOS_Do_Glyph_Lookup( GPOS_Instance* gpi,
HB_UShort lookup_index,
HB_Buffer buffer,
HB_UShort context_length,
int nesting_level )
{
HB_Error error = HB_Err_Not_Covered;
HB_UShort i, flags, lookup_count;
HB_GPOSHeader* gpos = gpi->gpos;
HB_Lookup* lo;
int lookup_type;
nesting_level++;
if ( nesting_level > HB_MAX_NESTING_LEVEL )
return ERR(HB_Err_Not_Covered); /* ERR() call intended */
lookup_count = gpos->LookupList.LookupCount;
if (lookup_index >= lookup_count)
return error;
lo = &gpos->LookupList.Lookup[lookup_index];
flags = lo->LookupFlag;
lookup_type = lo->LookupType;
for ( i = 0; i < lo->SubTableCount; i++ )
{
HB_GPOS_SubTable *st = &lo->SubTable[i].st.gpos;
switch (lookup_type) {
case HB_GPOS_LOOKUP_SINGLE:
error = Lookup_SinglePos ( gpi, st, buffer, flags, context_length, nesting_level ); break;
case HB_GPOS_LOOKUP_PAIR:
error = Lookup_PairPos ( gpi, st, buffer, flags, context_length, nesting_level ); break;
case HB_GPOS_LOOKUP_CURSIVE:
error = Lookup_CursivePos ( gpi, st, buffer, flags, context_length, nesting_level ); break;
case HB_GPOS_LOOKUP_MARKBASE:
error = Lookup_MarkBasePos ( gpi, st, buffer, flags, context_length, nesting_level ); break;
case HB_GPOS_LOOKUP_MARKLIG:
error = Lookup_MarkLigPos ( gpi, st, buffer, flags, context_length, nesting_level ); break;
case HB_GPOS_LOOKUP_MARKMARK:
error = Lookup_MarkMarkPos ( gpi, st, buffer, flags, context_length, nesting_level ); break;
case HB_GPOS_LOOKUP_CONTEXT:
error = Lookup_ContextPos ( gpi, st, buffer, flags, context_length, nesting_level ); break;
case HB_GPOS_LOOKUP_CHAIN:
error = Lookup_ChainContextPos ( gpi, st, buffer, flags, context_length, nesting_level ); break;
/*case HB_GPOS_LOOKUP_EXTENSION:
error = Lookup_ExtensionPos ( gpi, st, buffer, flags, context_length, nesting_level ); break;*/
default:
error = HB_Err_Not_Covered;
}
/* Check whether we have a successful positioning or an error other
than HB_Err_Not_Covered */
if ( error != HB_Err_Not_Covered )
return error;
}
return HB_Err_Not_Covered;
}
| 10,804
|
181,092
| 1
|
juniper_pppoe_atm_print(netdissect_options *ndo,
const struct pcap_pkthdr *h, register const u_char *p)
{
struct juniper_l2info_t l2info;
uint16_t extracted_ethertype;
l2info.pictype = DLT_JUNIPER_PPPOE_ATM;
if (juniper_parse_header(ndo, p, h, &l2info) == 0)
return l2info.header_len;
p+=l2info.header_len;
extracted_ethertype = EXTRACT_16BITS(p);
/* this DLT contains nothing but raw PPPoE frames,
* prepended with a type field*/
if (ethertype_print(ndo, extracted_ethertype,
p+ETHERTYPE_LEN,
l2info.length-ETHERTYPE_LEN,
l2info.caplen-ETHERTYPE_LEN,
NULL, NULL) == 0)
/* ether_type not known, probably it wasn't one */
ND_PRINT((ndo, "unknown ethertype 0x%04x", extracted_ethertype));
return l2info.header_len;
}
| 10,805
|
64,035
| 0
|
static int huff_reader_build_canonical(HuffReader *r, int *code_lengths,
int alphabet_size)
{
int len = 0, sym, code = 0, ret;
int max_code_length = 0;
uint16_t *codes;
/* special-case 1 symbol since the vlc reader cannot handle it */
for (sym = 0; sym < alphabet_size; sym++) {
if (code_lengths[sym] > 0) {
len++;
code = sym;
if (len > 1)
break;
}
}
if (len == 1) {
r->nb_symbols = 1;
r->simple_symbols[0] = code;
r->simple = 1;
return 0;
}
for (sym = 0; sym < alphabet_size; sym++)
max_code_length = FFMAX(max_code_length, code_lengths[sym]);
if (max_code_length == 0 || max_code_length > MAX_HUFFMAN_CODE_LENGTH)
return AVERROR(EINVAL);
codes = av_malloc_array(alphabet_size, sizeof(*codes));
if (!codes)
return AVERROR(ENOMEM);
code = 0;
r->nb_symbols = 0;
for (len = 1; len <= max_code_length; len++) {
for (sym = 0; sym < alphabet_size; sym++) {
if (code_lengths[sym] != len)
continue;
codes[sym] = code++;
r->nb_symbols++;
}
code <<= 1;
}
if (!r->nb_symbols) {
av_free(codes);
return AVERROR_INVALIDDATA;
}
ret = init_vlc(&r->vlc, 8, alphabet_size,
code_lengths, sizeof(*code_lengths), sizeof(*code_lengths),
codes, sizeof(*codes), sizeof(*codes), 0);
if (ret < 0) {
av_free(codes);
return ret;
}
r->simple = 0;
av_free(codes);
return 0;
}
| 10,806
|
66,036
| 0
|
int yr_arena_write_string(
YR_ARENA* arena,
const char* string,
char** written_string)
{
return yr_arena_write_data(
arena,
(void*) string,
strlen(string) + 1,
(void**) written_string);
}
| 10,807
|
151,176
| 0
|
void Dispose() {
raw_data_ = nullptr;
delete this;
}
| 10,808
|
152,303
| 0
|
void RenderFrameImpl::ExecuteJavaScript(const base::string16& javascript) {
JavaScriptExecuteRequest(javascript, base::DoNothing());
}
| 10,809
|
127,869
| 0
|
static bool CheckSrt(const uint8* buffer, int buffer_size) {
RCHECK(buffer_size > 20);
int offset = StartsWith(buffer, buffer_size, UTF8_BYTE_ORDER_MARK) ? 3 : 0;
RCHECK(VerifyNumber(buffer, buffer_size, &offset, 100));
RCHECK(VerifyCharacters(buffer, buffer_size, &offset, '\n', '\r'));
while (VerifyCharacters(buffer, buffer_size, &offset, '\n', '\r')) {}
--offset; // Since VerifyCharacters() gobbled up the next non-CR/LF.
RCHECK(VerifyNumber(buffer, buffer_size, &offset, 100));
RCHECK(VerifyCharacters(buffer, buffer_size, &offset, ':', 0));
RCHECK(VerifyNumber(buffer, buffer_size, &offset, 2));
RCHECK(VerifyCharacters(buffer, buffer_size, &offset, ':', 0));
RCHECK(VerifyNumber(buffer, buffer_size, &offset, 2));
RCHECK(VerifyCharacters(buffer, buffer_size, &offset, ',', '.'));
RCHECK(VerifyNumber(buffer, buffer_size, &offset, 3));
RCHECK(VerifyCharacters(buffer, buffer_size, &offset, ' ', 0));
RCHECK(VerifyCharacters(buffer, buffer_size, &offset, '-', 0));
RCHECK(VerifyCharacters(buffer, buffer_size, &offset, '-', 0));
RCHECK(VerifyCharacters(buffer, buffer_size, &offset, '>', 0));
RCHECK(VerifyCharacters(buffer, buffer_size, &offset, ' ', 0));
RCHECK(VerifyNumber(buffer, buffer_size, &offset, 100));
RCHECK(VerifyCharacters(buffer, buffer_size, &offset, ':', 0));
RCHECK(VerifyNumber(buffer, buffer_size, &offset, 2));
RCHECK(VerifyCharacters(buffer, buffer_size, &offset, ':', 0));
RCHECK(VerifyNumber(buffer, buffer_size, &offset, 2));
RCHECK(VerifyCharacters(buffer, buffer_size, &offset, ',', '.'));
RCHECK(VerifyNumber(buffer, buffer_size, &offset, 3));
return true;
}
| 10,810
|
143,761
| 0
|
bool quit_called() const { return quit_called_; }
| 10,811
|
140,709
| 0
|
bool GLES2DecoderImpl::ClearLevel(
Texture* texture,
unsigned target,
int level,
unsigned internal_format,
unsigned format,
unsigned type,
int width,
int height,
bool is_texture_immutable) {
uint32 channels = GLES2Util::GetChannelsForFormat(format);
if (feature_info_->feature_flags().angle_depth_texture &&
(channels & GLES2Util::kDepth) != 0) {
GLuint fb = 0;
glGenFramebuffersEXT(1, &fb);
glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fb);
bool have_stencil = (channels & GLES2Util::kStencil) != 0;
GLenum attachment = have_stencil ? GL_DEPTH_STENCIL_ATTACHMENT :
GL_DEPTH_ATTACHMENT;
glFramebufferTexture2DEXT(GL_DRAW_FRAMEBUFFER_EXT, attachment, target,
texture->service_id(), level);
if (glCheckFramebufferStatusEXT(GL_DRAW_FRAMEBUFFER_EXT) !=
GL_FRAMEBUFFER_COMPLETE) {
return false;
}
glClearStencil(0);
state_.SetDeviceStencilMaskSeparate(GL_FRONT, kDefaultStencilMask);
state_.SetDeviceStencilMaskSeparate(GL_BACK, kDefaultStencilMask);
glClearDepth(1.0f);
state_.SetDeviceDepthMask(GL_TRUE);
state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false);
glClear(GL_DEPTH_BUFFER_BIT | (have_stencil ? GL_STENCIL_BUFFER_BIT : 0));
RestoreClearState();
glDeleteFramebuffersEXT(1, &fb);
Framebuffer* framebuffer =
GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT);
GLuint fb_service_id =
framebuffer ? framebuffer->service_id() : GetBackbufferServiceId();
glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fb_service_id);
return true;
}
static const uint32 kMaxZeroSize = 1024 * 1024 * 4;
uint32 size;
uint32 padded_row_size;
if (!GLES2Util::ComputeImageDataSizes(
width, height, 1, format, type, state_.unpack_alignment, &size,
NULL, &padded_row_size)) {
return false;
}
TRACE_EVENT1("gpu", "GLES2DecoderImpl::ClearLevel", "size", size);
int tile_height;
if (size > kMaxZeroSize) {
if (kMaxZeroSize < padded_row_size) {
return false;
}
DCHECK_GT(padded_row_size, 0U);
tile_height = kMaxZeroSize / padded_row_size;
if (!GLES2Util::ComputeImageDataSizes(
width, tile_height, 1, format, type, state_.unpack_alignment, &size,
NULL, NULL)) {
return false;
}
} else {
tile_height = height;
}
scoped_ptr<char[]> zero(new char[size]);
memset(zero.get(), 0, size);
glBindTexture(texture->target(), texture->service_id());
bool has_images = texture->HasImages();
GLint y = 0;
while (y < height) {
GLint h = y + tile_height > height ? height - y : tile_height;
if (is_texture_immutable || h != height || has_images) {
glTexSubImage2D(target, level, 0, y, width, h, format, type, zero.get());
} else {
glTexImage2D(
target, level, internal_format, width, h, 0, format, type,
zero.get());
}
y += tile_height;
}
TextureRef* bound_texture =
texture_manager()->GetTextureInfoForTarget(&state_, texture->target());
glBindTexture(texture->target(),
bound_texture ? bound_texture->service_id() : 0);
return true;
}
| 10,812
|
30,182
| 0
|
static int ftrace_module_notify_enter(struct notifier_block *self,
unsigned long val, void *data)
{
return 0;
}
| 10,813
|
62,912
| 0
|
static bool pmu_write_swinc_el0_disabled(struct kvm_vcpu *vcpu)
{
u64 reg = vcpu_sys_reg(vcpu, PMUSERENR_EL0);
return !((reg & (ARMV8_PMU_USERENR_SW | ARMV8_PMU_USERENR_EN))
|| vcpu_mode_priv(vcpu));
}
| 10,814
|
67,295
| 0
|
void d_delete(struct dentry * dentry)
{
struct inode *inode;
int isdir = 0;
/*
* Are we the only user?
*/
again:
spin_lock(&dentry->d_lock);
inode = dentry->d_inode;
isdir = S_ISDIR(inode->i_mode);
if (dentry->d_lockref.count == 1) {
if (!spin_trylock(&inode->i_lock)) {
spin_unlock(&dentry->d_lock);
cpu_relax();
goto again;
}
dentry->d_flags &= ~DCACHE_CANT_MOUNT;
dentry_unlink_inode(dentry);
fsnotify_nameremove(dentry, isdir);
return;
}
if (!d_unhashed(dentry))
__d_drop(dentry);
spin_unlock(&dentry->d_lock);
fsnotify_nameremove(dentry, isdir);
}
| 10,815
|
176,619
| 0
|
xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
int id = ctxt->input->id;
SKIP(3);
SKIP_BLANKS;
if (CMP7(CUR_PTR, 'I', 'N', 'C', 'L', 'U', 'D', 'E')) {
SKIP(7);
SKIP_BLANKS;
if (RAW != '[') {
xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL);
xmlHaltParser(ctxt);
return;
} else {
if (ctxt->input->id != id) {
xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY,
"All markup of the conditional section is not in the same entity\n",
NULL, NULL);
}
NEXT;
}
if (xmlParserDebugEntities) {
if ((ctxt->input != NULL) && (ctxt->input->filename))
xmlGenericError(xmlGenericErrorContext,
"%s(%d): ", ctxt->input->filename,
ctxt->input->line);
xmlGenericError(xmlGenericErrorContext,
"Entering INCLUDE Conditional Section\n");
}
while (((RAW != 0) && ((RAW != ']') || (NXT(1) != ']') ||
(NXT(2) != '>'))) && (ctxt->instate != XML_PARSER_EOF)) {
const xmlChar *check = CUR_PTR;
unsigned int cons = ctxt->input->consumed;
if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) {
xmlParseConditionalSections(ctxt);
} else if (IS_BLANK_CH(CUR)) {
NEXT;
} else if (RAW == '%') {
xmlParsePEReference(ctxt);
} else
xmlParseMarkupDecl(ctxt);
/*
* Pop-up of finished entities.
*/
while ((RAW == 0) && (ctxt->inputNr > 1))
xmlPopInput(ctxt);
if ((CUR_PTR == check) && (cons == ctxt->input->consumed)) {
xmlFatalErr(ctxt, XML_ERR_EXT_SUBSET_NOT_FINISHED, NULL);
xmlHaltParser(ctxt);
break;
}
}
if (xmlParserDebugEntities) {
if ((ctxt->input != NULL) && (ctxt->input->filename))
xmlGenericError(xmlGenericErrorContext,
"%s(%d): ", ctxt->input->filename,
ctxt->input->line);
xmlGenericError(xmlGenericErrorContext,
"Leaving INCLUDE Conditional Section\n");
}
} else if (CMP6(CUR_PTR, 'I', 'G', 'N', 'O', 'R', 'E')) {
int state;
xmlParserInputState instate;
int depth = 0;
SKIP(6);
SKIP_BLANKS;
if (RAW != '[') {
xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL);
xmlHaltParser(ctxt);
return;
} else {
if (ctxt->input->id != id) {
xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY,
"All markup of the conditional section is not in the same entity\n",
NULL, NULL);
}
NEXT;
}
if (xmlParserDebugEntities) {
if ((ctxt->input != NULL) && (ctxt->input->filename))
xmlGenericError(xmlGenericErrorContext,
"%s(%d): ", ctxt->input->filename,
ctxt->input->line);
xmlGenericError(xmlGenericErrorContext,
"Entering IGNORE Conditional Section\n");
}
/*
* Parse up to the end of the conditional section
* But disable SAX event generating DTD building in the meantime
*/
state = ctxt->disableSAX;
instate = ctxt->instate;
if (ctxt->recovery == 0) ctxt->disableSAX = 1;
ctxt->instate = XML_PARSER_IGNORE;
while (((depth >= 0) && (RAW != 0)) &&
(ctxt->instate != XML_PARSER_EOF)) {
if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) {
depth++;
SKIP(3);
continue;
}
if ((RAW == ']') && (NXT(1) == ']') && (NXT(2) == '>')) {
if (--depth >= 0) SKIP(3);
continue;
}
NEXT;
continue;
}
ctxt->disableSAX = state;
ctxt->instate = instate;
if (xmlParserDebugEntities) {
if ((ctxt->input != NULL) && (ctxt->input->filename))
xmlGenericError(xmlGenericErrorContext,
"%s(%d): ", ctxt->input->filename,
ctxt->input->line);
xmlGenericError(xmlGenericErrorContext,
"Leaving IGNORE Conditional Section\n");
}
} else {
xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID_KEYWORD, NULL);
xmlHaltParser(ctxt);
return;
}
if (RAW == 0)
SHRINK;
if (RAW == 0) {
xmlFatalErr(ctxt, XML_ERR_CONDSEC_NOT_FINISHED, NULL);
} else {
if (ctxt->input->id != id) {
xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY,
"All markup of the conditional section is not in the same entity\n",
NULL, NULL);
}
if ((ctxt-> instate != XML_PARSER_EOF) &&
((ctxt->input->cur + 3) <= ctxt->input->end))
SKIP(3);
}
}
| 10,816
|
174,686
| 0
|
WORD32 ih264d_ref_idx_reordering(dec_struct_t *ps_dec, UWORD8 uc_lx)
{
dpb_manager_t *ps_dpb_mgr = ps_dec->ps_dpb_mgr;
UWORD16 u4_cur_pic_num = ps_dec->ps_cur_slice->u2_frame_num;
/*< Maximum Picture Number Minus 1 */
UWORD16 ui_max_frame_num =
ps_dec->ps_cur_sps->u2_u4_max_pic_num_minus1 + 1;
WORD32 i;
UWORD32 ui_remapIdc, ui_nextUev;
WORD16 u2_pred_frame_num = u4_cur_pic_num;
WORD32 i_temp;
UWORD16 u2_def_mod_flag = 0; /* Flag to keep track of which indices have been remapped */
UWORD8 modCount = 0;
UWORD32 *pu4_bitstrm_buf = ps_dec->ps_bitstrm->pu4_buffer;
UWORD32 *pu4_bitstrm_ofst = &ps_dec->ps_bitstrm->u4_ofst;
dec_slice_params_t *ps_cur_slice = ps_dec->ps_cur_slice;
UWORD8 u1_field_pic_flag = ps_cur_slice->u1_field_pic_flag;
if(u1_field_pic_flag)
{
u4_cur_pic_num = u4_cur_pic_num * 2 + 1;
ui_max_frame_num = ui_max_frame_num * 2;
}
u2_pred_frame_num = u4_cur_pic_num;
ui_remapIdc = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
while(ui_remapIdc != 3)
{
ui_nextUev = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
if(ui_remapIdc != 2)
{
ui_nextUev = ui_nextUev + 1;
if(ui_remapIdc == 0)
{
i_temp = u2_pred_frame_num - ui_nextUev;
if(i_temp < 0)
i_temp += ui_max_frame_num;
}
else
{
i_temp = u2_pred_frame_num + ui_nextUev;
if(i_temp >= ui_max_frame_num)
i_temp -= ui_max_frame_num;
}
/* Find the dpb with the matching picNum (picNum==frameNum for framePic) */
if(i_temp > u4_cur_pic_num)
i_temp = i_temp - ui_max_frame_num;
for(i = 0; i < (ps_cur_slice->u1_initial_list_size[uc_lx]); i++)
{
if(ps_dpb_mgr->ps_init_dpb[uc_lx][i]->i4_pic_num == i_temp)
break;
}
if(i == (ps_cur_slice->u1_initial_list_size[uc_lx]))
{
UWORD32 i4_error_code;
i4_error_code = ERROR_DBP_MANAGER_T;
return i4_error_code;
}
u2_def_mod_flag |= (1 << i);
ps_dpb_mgr->ps_mod_dpb[uc_lx][modCount++] =
ps_dpb_mgr->ps_init_dpb[uc_lx][i];
u2_pred_frame_num = i_temp; //update predictor to be the picNum just obtained
}
else //2
{
UWORD8 u1_lt_idx = (UWORD8)ui_nextUev;
for(i = 0; i < (ps_cur_slice->u1_initial_list_size[uc_lx]); i++)
{
if(!ps_dpb_mgr->ps_init_dpb[uc_lx][i]->u1_is_short)
{
if(ps_dpb_mgr->ps_init_dpb[uc_lx][i]->u1_long_term_pic_num
== u1_lt_idx)
break;
}
}
if(i == (ps_cur_slice->u1_initial_list_size[uc_lx]))
{
UWORD32 i4_error_code;
i4_error_code = ERROR_DBP_MANAGER_T;
return i4_error_code;
}
u2_def_mod_flag |= (1 << i);
ps_dpb_mgr->ps_mod_dpb[uc_lx][modCount++] =
ps_dpb_mgr->ps_init_dpb[uc_lx][i];
}
ui_remapIdc = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
/* Get the remapping_idc - 0/1/2/3 */
}
for(i = 0; i < (ps_cur_slice->u1_num_ref_idx_lx_active[uc_lx]); i++)
{
if(!(u2_def_mod_flag & (1 << i)))
ps_dpb_mgr->ps_mod_dpb[uc_lx][modCount++] =
ps_dpb_mgr->ps_init_dpb[uc_lx][i];
}
return OK;
}
| 10,817
|
169,926
| 0
|
xsltNamespaceAlias(xsltStylesheetPtr style, xmlNodePtr node)
{
xmlChar *resultPrefix = NULL;
xmlChar *stylePrefix = NULL;
xmlNsPtr literalNs = NULL;
xmlNsPtr targetNs = NULL;
#ifdef XSLT_REFACTORED
xsltNsAliasPtr alias;
if ((style == NULL) || (node == NULL))
return;
/*
* SPEC XSLT 1.0:
* "If a namespace URI is declared to be an alias for multiple
* different namespace URIs, then the declaration with the highest
* import precedence is used. It is an error if there is more than
* one such declaration. An XSLT processor may signal the error;
* if it does not signal the error, it must recover by choosing,
* from amongst the declarations with the highest import precedence,
* the one that occurs last in the stylesheet."
*
* SPEC TODO: Check for the errors mentioned above.
*/
/*
* NOTE that the XSLT 2.0 also *does* use the NULL namespace if
* "#default" is used and there's no default namespace is scope.
* I.e., this is *not* an error.
* Most XSLT 1.0 implementations work this way.
* The XSLT 1.0 spec has nothing to say on the subject.
*/
/*
* Attribute "stylesheet-prefix".
*/
stylePrefix = xmlGetNsProp(node, (const xmlChar *)"stylesheet-prefix", NULL);
if (stylePrefix == NULL) {
xsltTransformError(NULL, style, node,
"The attribute 'stylesheet-prefix' is missing.\n");
return;
}
if (xmlStrEqual(stylePrefix, (const xmlChar *)"#default"))
literalNs = xmlSearchNs(node->doc, node, NULL);
else {
literalNs = xmlSearchNs(node->doc, node, stylePrefix);
if (literalNs == NULL) {
xsltTransformError(NULL, style, node,
"Attribute 'stylesheet-prefix': There's no namespace "
"declaration in scope for the prefix '%s'.\n",
stylePrefix);
goto error;
}
}
/*
* Attribute "result-prefix".
*/
resultPrefix = xmlGetNsProp(node, (const xmlChar *)"result-prefix", NULL);
if (resultPrefix == NULL) {
xsltTransformError(NULL, style, node,
"The attribute 'result-prefix' is missing.\n");
goto error;
}
if (xmlStrEqual(resultPrefix, (const xmlChar *)"#default"))
targetNs = xmlSearchNs(node->doc, node, NULL);
else {
targetNs = xmlSearchNs(node->doc, node, resultPrefix);
if (targetNs == NULL) {
xsltTransformError(NULL, style, node,
"Attribute 'result-prefix': There's no namespace "
"declaration in scope for the prefix '%s'.\n",
stylePrefix);
goto error;
}
}
/*
*
* Same alias for multiple different target namespace URIs:
* TODO: The one with the highest import precedence is used.
* Example:
* <xsl:namespace-alias stylesheet-prefix="foo"
* result-prefix="bar"/>
*
* <xsl:namespace-alias stylesheet-prefix="foo"
* result-prefix="zar"/>
*
* Same target namespace URI for multiple different aliases:
* All alias-definitions will be used.
* Example:
* <xsl:namespace-alias stylesheet-prefix="bar"
* result-prefix="foo"/>
*
* <xsl:namespace-alias stylesheet-prefix="zar"
* result-prefix="foo"/>
* Cases using #default:
* <xsl:namespace-alias stylesheet-prefix="#default"
* result-prefix="#default"/>
* TODO: Has this an effect at all?
*
* <xsl:namespace-alias stylesheet-prefix="foo"
* result-prefix="#default"/>
* From namespace to no namespace.
*
* <xsl:namespace-alias stylesheet-prefix="#default"
* result-prefix="foo"/>
* From no namespace to namespace.
*/
/*
* Store the ns-node in the alias-object.
*/
alias = xsltNewNsAlias(XSLT_CCTXT(style));
if (alias == NULL)
return;
alias->literalNs = literalNs;
alias->targetNs = targetNs;
XSLT_CCTXT(style)->hasNsAliases = 1;
#else /* XSLT_REFACTORED */
const xmlChar *literalNsName;
const xmlChar *targetNsName;
if ((style == NULL) || (node == NULL))
return;
stylePrefix = xmlGetNsProp(node, (const xmlChar *)"stylesheet-prefix", NULL);
if (stylePrefix == NULL) {
xsltTransformError(NULL, style, node,
"namespace-alias: stylesheet-prefix attribute missing\n");
return;
}
resultPrefix = xmlGetNsProp(node, (const xmlChar *)"result-prefix", NULL);
if (resultPrefix == NULL) {
xsltTransformError(NULL, style, node,
"namespace-alias: result-prefix attribute missing\n");
goto error;
}
if (xmlStrEqual(stylePrefix, (const xmlChar *)"#default")) {
literalNs = xmlSearchNs(node->doc, node, NULL);
if (literalNs == NULL) {
literalNsName = NULL;
} else
literalNsName = literalNs->href; /* Yes - set for nsAlias table */
} else {
literalNs = xmlSearchNs(node->doc, node, stylePrefix);
if ((literalNs == NULL) || (literalNs->href == NULL)) {
xsltTransformError(NULL, style, node,
"namespace-alias: prefix %s not bound to any namespace\n",
stylePrefix);
goto error;
} else
literalNsName = literalNs->href;
}
/*
* When "#default" is used for result, if a default namespace has not
* been explicitly declared the special value UNDEFINED_DEFAULT_NS is
* put into the nsAliases table
*/
if (xmlStrEqual(resultPrefix, (const xmlChar *)"#default")) {
targetNs = xmlSearchNs(node->doc, node, NULL);
if (targetNs == NULL) {
targetNsName = UNDEFINED_DEFAULT_NS;
} else
targetNsName = targetNs->href;
} else {
targetNs = xmlSearchNs(node->doc, node, resultPrefix);
if ((targetNs == NULL) || (targetNs->href == NULL)) {
xsltTransformError(NULL, style, node,
"namespace-alias: prefix %s not bound to any namespace\n",
resultPrefix);
goto error;
} else
targetNsName = targetNs->href;
}
/*
* Special case: if #default is used for
* the stylesheet-prefix (literal namespace) and there's no default
* namespace in scope, we'll use style->defaultAlias for this.
*/
if (literalNsName == NULL) {
if (targetNs != NULL) {
/*
* BUG TODO: Is it not sufficient to have only 1 field for
* this, since subsequently alias declarations will
* overwrite this.
* Example:
* <xsl:namespace-alias result-prefix="foo"
* stylesheet-prefix="#default"/>
* <xsl:namespace-alias result-prefix="bar"
* stylesheet-prefix="#default"/>
* The mapping for "foo" won't be visible anymore.
*/
style->defaultAlias = targetNs->href;
}
} else {
if (style->nsAliases == NULL)
style->nsAliases = xmlHashCreate(10);
if (style->nsAliases == NULL) {
xsltTransformError(NULL, style, node,
"namespace-alias: cannot create hash table\n");
goto error;
}
xmlHashAddEntry((xmlHashTablePtr) style->nsAliases,
literalNsName, (void *) targetNsName);
}
#endif /* else of XSLT_REFACTORED */
error:
if (stylePrefix != NULL)
xmlFree(stylePrefix);
if (resultPrefix != NULL)
xmlFree(resultPrefix);
}
| 10,818
|
174,242
| 0
|
void Camera3Device::notifyError(const camera3_error_msg_t &msg,
NotificationListener *listener) {
static const ICameraDeviceCallbacks::CameraErrorCode
halErrorMap[CAMERA3_MSG_NUM_ERRORS] = {
ICameraDeviceCallbacks::ERROR_CAMERA_INVALID_ERROR,
ICameraDeviceCallbacks::ERROR_CAMERA_DEVICE,
ICameraDeviceCallbacks::ERROR_CAMERA_REQUEST,
ICameraDeviceCallbacks::ERROR_CAMERA_RESULT,
ICameraDeviceCallbacks::ERROR_CAMERA_BUFFER
};
ICameraDeviceCallbacks::CameraErrorCode errorCode =
((msg.error_code >= 0) &&
(msg.error_code < CAMERA3_MSG_NUM_ERRORS)) ?
halErrorMap[msg.error_code] :
ICameraDeviceCallbacks::ERROR_CAMERA_INVALID_ERROR;
int streamId = 0;
if (msg.error_stream != NULL) {
Camera3Stream *stream =
Camera3Stream::cast(msg.error_stream);
streamId = stream->getId();
}
ALOGV("Camera %d: %s: HAL error, frame %d, stream %d: %d",
mId, __FUNCTION__, msg.frame_number,
streamId, msg.error_code);
CaptureResultExtras resultExtras;
switch (errorCode) {
case ICameraDeviceCallbacks::ERROR_CAMERA_DEVICE:
SET_ERR("Camera HAL reported serious device error");
break;
case ICameraDeviceCallbacks::ERROR_CAMERA_REQUEST:
case ICameraDeviceCallbacks::ERROR_CAMERA_RESULT:
case ICameraDeviceCallbacks::ERROR_CAMERA_BUFFER:
{
Mutex::Autolock l(mInFlightLock);
ssize_t idx = mInFlightMap.indexOfKey(msg.frame_number);
if (idx >= 0) {
InFlightRequest &r = mInFlightMap.editValueAt(idx);
r.requestStatus = msg.error_code;
resultExtras = r.resultExtras;
} else {
resultExtras.frameNumber = msg.frame_number;
ALOGE("Camera %d: %s: cannot find in-flight request on "
"frame %" PRId64 " error", mId, __FUNCTION__,
resultExtras.frameNumber);
}
}
if (listener != NULL) {
listener->notifyError(errorCode, resultExtras);
} else {
ALOGE("Camera %d: %s: no listener available", mId, __FUNCTION__);
}
break;
default:
SET_ERR("Unknown error message from HAL: %d", msg.error_code);
break;
}
}
| 10,819
|
145,917
| 0
|
aura::Window* CreatePanelWindow(const gfx::Rect& bounds) {
return CreatePanelWindowWithDelegate(nullptr, bounds);
}
| 10,820
|
94,719
| 0
|
gdImagePtr gdImageCreateFromWebpPtr (int size, void *data)
{
gdImagePtr im;
gdIOCtx *in = gdNewDynamicCtxEx(size, data, 0);
if (!in)
return 0;
im = gdImageCreateFromWebpCtx(in);
in->gd_free(in);
return im;
}
| 10,821
|
184,972
| 1
|
xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
int id = ctxt->input->id;
SKIP(3);
SKIP_BLANKS;
if (CMP7(CUR_PTR, 'I', 'N', 'C', 'L', 'U', 'D', 'E')) {
SKIP(7);
SKIP_BLANKS;
if (RAW != '[') {
xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL);
} else {
if (ctxt->input->id != id) {
xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY,
"All markup of the conditional section is not in the same entity\n",
NULL, NULL);
}
NEXT;
}
if (xmlParserDebugEntities) {
if ((ctxt->input != NULL) && (ctxt->input->filename))
xmlGenericError(xmlGenericErrorContext,
"%s(%d): ", ctxt->input->filename,
ctxt->input->line);
xmlGenericError(xmlGenericErrorContext,
"Entering INCLUDE Conditional Section\n");
}
while ((RAW != 0) && ((RAW != ']') || (NXT(1) != ']') ||
(NXT(2) != '>'))) {
const xmlChar *check = CUR_PTR;
unsigned int cons = ctxt->input->consumed;
if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) {
xmlParseConditionalSections(ctxt);
} else if (IS_BLANK_CH(CUR)) {
NEXT;
} else if (RAW == '%') {
xmlParsePEReference(ctxt);
} else
xmlParseMarkupDecl(ctxt);
/*
* Pop-up of finished entities.
*/
while ((RAW == 0) && (ctxt->inputNr > 1))
xmlPopInput(ctxt);
if ((CUR_PTR == check) && (cons == ctxt->input->consumed)) {
xmlFatalErr(ctxt, XML_ERR_EXT_SUBSET_NOT_FINISHED, NULL);
break;
}
}
if (xmlParserDebugEntities) {
if ((ctxt->input != NULL) && (ctxt->input->filename))
xmlGenericError(xmlGenericErrorContext,
"%s(%d): ", ctxt->input->filename,
ctxt->input->line);
xmlGenericError(xmlGenericErrorContext,
"Leaving INCLUDE Conditional Section\n");
}
} else if (CMP6(CUR_PTR, 'I', 'G', 'N', 'O', 'R', 'E')) {
int state;
xmlParserInputState instate;
int depth = 0;
SKIP(6);
SKIP_BLANKS;
if (RAW != '[') {
xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL);
} else {
if (ctxt->input->id != id) {
xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY,
"All markup of the conditional section is not in the same entity\n",
NULL, NULL);
}
NEXT;
}
if (xmlParserDebugEntities) {
if ((ctxt->input != NULL) && (ctxt->input->filename))
xmlGenericError(xmlGenericErrorContext,
"%s(%d): ", ctxt->input->filename,
ctxt->input->line);
xmlGenericError(xmlGenericErrorContext,
"Entering IGNORE Conditional Section\n");
}
/*
* Parse up to the end of the conditional section
* But disable SAX event generating DTD building in the meantime
*/
state = ctxt->disableSAX;
instate = ctxt->instate;
if (ctxt->recovery == 0) ctxt->disableSAX = 1;
ctxt->instate = XML_PARSER_IGNORE;
while ((depth >= 0) && (RAW != 0)) {
if ((RAW == '<') && (NXT(1) == '!') && (NXT(2) == '[')) {
depth++;
SKIP(3);
continue;
}
if ((RAW == ']') && (NXT(1) == ']') && (NXT(2) == '>')) {
if (--depth >= 0) SKIP(3);
continue;
}
NEXT;
continue;
}
ctxt->disableSAX = state;
ctxt->instate = instate;
if (xmlParserDebugEntities) {
if ((ctxt->input != NULL) && (ctxt->input->filename))
xmlGenericError(xmlGenericErrorContext,
"%s(%d): ", ctxt->input->filename,
ctxt->input->line);
xmlGenericError(xmlGenericErrorContext,
"Leaving IGNORE Conditional Section\n");
}
} else {
xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID_KEYWORD, NULL);
}
if (RAW == 0)
SHRINK;
if (RAW == 0) {
xmlFatalErr(ctxt, XML_ERR_CONDSEC_NOT_FINISHED, NULL);
} else {
if (ctxt->input->id != id) {
xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY,
"All markup of the conditional section is not in the same entity\n",
NULL, NULL);
}
SKIP(3);
}
}
| 10,822
|
67,485
| 0
|
static int fsmBackup(rpmfi fi, rpmFileAction action)
{
int rc = 0;
const char *suffix = NULL;
if (!(rpmfiFFlags(fi) & RPMFILE_GHOST)) {
switch (action) {
case FA_SAVE:
suffix = SUFFIX_RPMSAVE;
break;
case FA_BACKUP:
suffix = SUFFIX_RPMORIG;
break;
default:
break;
}
}
if (suffix) {
char * opath = fsmFsPath(fi, NULL);
char * path = fsmFsPath(fi, suffix);
rc = fsmRename(opath, path);
if (!rc) {
rpmlog(RPMLOG_WARNING, _("%s saved as %s\n"), opath, path);
}
free(path);
free(opath);
}
return rc;
}
| 10,823
|
153,276
| 0
|
Widget::MoveLoopResult DesktopWindowTreeHostX11::RunMoveLoop(
const gfx::Vector2d& drag_offset,
Widget::MoveLoopSource source,
Widget::MoveLoopEscapeBehavior escape_behavior) {
wm::WindowMoveSource window_move_source =
source == Widget::MOVE_LOOP_SOURCE_MOUSE ? wm::WINDOW_MOVE_SOURCE_MOUSE
: wm::WINDOW_MOVE_SOURCE_TOUCH;
if (x11_window_move_client_->RunMoveLoop(content_window(), drag_offset,
window_move_source) ==
wm::MOVE_SUCCESSFUL)
return Widget::MOVE_LOOP_SUCCESSFUL;
return Widget::MOVE_LOOP_CANCELED;
}
| 10,824
|
121,787
| 0
|
void UDPSocketWin::DidCompleteRead() {
DWORD num_bytes, flags;
BOOL ok = WSAGetOverlappedResult(socket_, &core_->read_overlapped_,
&num_bytes, FALSE, &flags);
WSAResetEvent(core_->read_overlapped_.hEvent);
int result = ok ? num_bytes : MapSystemError(WSAGetLastError());
if (recv_from_address_ && result >= 0) {
if (!ReceiveAddressToIPEndpoint(recv_from_address_))
result = ERR_ADDRESS_INVALID;
}
LogRead(result, core_->read_iobuffer_->data());
core_->read_iobuffer_ = NULL;
recv_from_address_ = NULL;
DoReadCallback(result);
}
| 10,825
|
77,173
| 0
|
OVS_REQUIRES(ofproto_mutex)
{
struct rule *rule;
RULE_COLLECTION_FOR_EACH (rule, rules) {
struct oftable *table = &ofproto->tables[rule->table_id];
/* Add rule back to ofproto data structures. */
ofproto_rule_insert__(ofproto, rule);
/* Restore table's rule count. */
table->n_flows++;
/* Restore the original visibility of the rule. */
cls_rule_restore_visibility(&rule->cr);
}
}
| 10,826
|
62,682
| 0
|
static unsigned char *DecodeImage(Image *blob,Image *image,
size_t bytes_per_line,const unsigned int bits_per_pixel,size_t *extent)
{
MagickSizeType
number_pixels;
register ssize_t
i;
register unsigned char
*p,
*q;
size_t
bytes_per_pixel,
length,
row_bytes,
scanline_length,
width;
ssize_t
count,
j,
y;
unsigned char
*pixels,
*scanline;
/*
Determine pixel buffer size.
*/
if (bits_per_pixel <= 8)
bytes_per_line&=0x7fff;
width=image->columns;
bytes_per_pixel=1;
if (bits_per_pixel == 16)
{
bytes_per_pixel=2;
width*=2;
}
else
if (bits_per_pixel == 32)
width*=image->matte != MagickFalse ? 4 : 3;
if (bytes_per_line == 0)
bytes_per_line=width;
row_bytes=(size_t) (image->columns | 0x8000);
if (image->storage_class == DirectClass)
row_bytes=(size_t) ((4*image->columns) | 0x8000);
/*
Allocate pixel and scanline buffer.
*/
pixels=(unsigned char *) AcquireQuantumMemory(image->rows,row_bytes*
sizeof(*pixels));
if (pixels == (unsigned char *) NULL)
return((unsigned char *) NULL);
*extent=row_bytes*image->rows*sizeof(*pixels);
(void) ResetMagickMemory(pixels,0,*extent);
scanline=(unsigned char *) AcquireQuantumMemory(row_bytes,2*
sizeof(*scanline));
if (scanline == (unsigned char *) NULL)
return((unsigned char *) NULL);
if (bytes_per_line < 8)
{
/*
Pixels are already uncompressed.
*/
for (y=0; y < (ssize_t) image->rows; y++)
{
q=pixels+y*width;
number_pixels=bytes_per_line;
count=ReadBlob(blob,(size_t) number_pixels,scanline);
if (count != (ssize_t) number_pixels)
{
(void) ThrowMagickException(&image->exception,GetMagickModule(),
CorruptImageError,"UnableToUncompressImage","`%s'",
image->filename);
break;
}
p=ExpandBuffer(scanline,&number_pixels,bits_per_pixel);
if ((q+number_pixels) > (pixels+(*extent)))
{
(void) ThrowMagickException(&image->exception,GetMagickModule(),
CorruptImageError,"UnableToUncompressImage","`%s'",
image->filename);
break;
}
(void) CopyMagickMemory(q,p,(size_t) number_pixels);
}
scanline=(unsigned char *) RelinquishMagickMemory(scanline);
return(pixels);
}
/*
Uncompress RLE pixels into uncompressed pixel buffer.
*/
for (y=0; y < (ssize_t) image->rows; y++)
{
q=pixels+y*width;
if (bytes_per_line > 200)
scanline_length=ReadBlobMSBShort(blob);
else
scanline_length=1UL*ReadBlobByte(blob);
if (scanline_length >= row_bytes)
{
(void) ThrowMagickException(&image->exception,GetMagickModule(),
CorruptImageError,"UnableToUncompressImage","`%s'",image->filename);
break;
}
count=ReadBlob(blob,scanline_length,scanline);
if (count != (ssize_t) scanline_length)
{
(void) ThrowMagickException(&image->exception,GetMagickModule(),
CorruptImageError,"UnableToUncompressImage","`%s'",image->filename);
break;
}
for (j=0; j < (ssize_t) scanline_length; )
if ((scanline[j] & 0x80) == 0)
{
length=(size_t) ((scanline[j] & 0xff)+1);
number_pixels=length*bytes_per_pixel;
p=ExpandBuffer(scanline+j+1,&number_pixels,bits_per_pixel);
if ((q-pixels+number_pixels) <= *extent)
(void) CopyMagickMemory(q,p,(size_t) number_pixels);
q+=number_pixels;
j+=(ssize_t) (length*bytes_per_pixel+1);
}
else
{
length=(size_t) (((scanline[j] ^ 0xff) & 0xff)+2);
number_pixels=bytes_per_pixel;
p=ExpandBuffer(scanline+j+1,&number_pixels,bits_per_pixel);
for (i=0; i < (ssize_t) length; i++)
{
if ((q-pixels+number_pixels) <= *extent)
(void) CopyMagickMemory(q,p,(size_t) number_pixels);
q+=number_pixels;
}
j+=(ssize_t) bytes_per_pixel+1;
}
}
scanline=(unsigned char *) RelinquishMagickMemory(scanline);
return(pixels);
}
| 10,827
|
5,244
| 0
|
PHP_PGSQL_API int php_pgsql_result2array(PGresult *pg_result, zval *ret_array)
{
zval row;
char *field_name;
size_t num_fields;
int pg_numrows, pg_row;
uint i;
assert(Z_TYPE_P(ret_array) == IS_ARRAY);
if ((pg_numrows = PQntuples(pg_result)) <= 0) {
return FAILURE;
}
for (pg_row = 0; pg_row < pg_numrows; pg_row++) {
array_init(&row);
for (i = 0, num_fields = PQnfields(pg_result); i < num_fields; i++) {
if (PQgetisnull(pg_result, pg_row, i)) {
field_name = PQfname(pg_result, i);
add_assoc_null(&row, field_name);
} else {
char *element = PQgetvalue(pg_result, pg_row, i);
if (element) {
const size_t element_len = strlen(element);
field_name = PQfname(pg_result, i);
add_assoc_stringl(&row, field_name, element, element_len);
}
}
}
add_index_zval(ret_array, pg_row, &row);
}
return SUCCESS;
}
| 10,828
|
11,424
| 0
|
fbFetchPixel_r3g3b2 (const FbBits *bits, int offset, miIndexedPtr indexed)
{
CARD32 pixel = READ((CARD8 *) bits + offset);
CARD32 r,g,b;
r = ((pixel & 0xe0) | ((pixel & 0xe0) >> 3) | ((pixel & 0xc0) >> 6)) << 16;
g = ((pixel & 0x1c) | ((pixel & 0x18) >> 3) | ((pixel & 0x1c) << 3)) << 8;
b = (((pixel & 0x03) ) |
((pixel & 0x03) << 2) |
((pixel & 0x03) << 4) |
((pixel & 0x03) << 6));
return (0xff000000 | r | g | b);
}
| 10,829
|
71,740
| 0
|
static void SVGStartElement(void *context,const xmlChar *name,
const xmlChar **attributes)
{
char
*color,
id[MaxTextExtent],
token[MaxTextExtent],
**tokens,
*units;
const char
*keyword,
*p,
*value;
int
number_tokens;
SVGInfo
*svg_info;
register ssize_t
i,
j;
/*
Called when an opening tag has been processed.
*/
(void) LogMagickEvent(CoderEvent,GetMagickModule()," SAX.startElement(%s",
name);
svg_info=(SVGInfo *) context;
svg_info->n++;
svg_info->scale=(double *) ResizeQuantumMemory(svg_info->scale,
svg_info->n+1UL,sizeof(*svg_info->scale));
if (svg_info->scale == (double *) NULL)
{
(void) ThrowMagickException(svg_info->exception,GetMagickModule(),
ResourceLimitError,"MemoryAllocationFailed","`%s'",name);
return;
}
svg_info->scale[svg_info->n]=svg_info->scale[svg_info->n-1];
color=AcquireString("none");
units=AcquireString("userSpaceOnUse");
value=(const char *) NULL;
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i+=2)
{
keyword=(const char *) attributes[i];
value=(const char *) attributes[i+1];
switch (*keyword)
{
case 'C':
case 'c':
{
if (LocaleCompare(keyword,"cx") == 0)
{
svg_info->element.cx=
GetUserSpaceCoordinateValue(svg_info,1,value);
break;
}
if (LocaleCompare(keyword,"cy") == 0)
{
svg_info->element.cy=
GetUserSpaceCoordinateValue(svg_info,-1,value);
break;
}
break;
}
case 'F':
case 'f':
{
if (LocaleCompare(keyword,"fx") == 0)
{
svg_info->element.major=
GetUserSpaceCoordinateValue(svg_info,1,value);
break;
}
if (LocaleCompare(keyword,"fy") == 0)
{
svg_info->element.minor=
GetUserSpaceCoordinateValue(svg_info,-1,value);
break;
}
break;
}
case 'H':
case 'h':
{
if (LocaleCompare(keyword,"height") == 0)
{
svg_info->bounds.height=
GetUserSpaceCoordinateValue(svg_info,-1,value);
break;
}
break;
}
case 'I':
case 'i':
{
if (LocaleCompare(keyword,"id") == 0)
{
(void) CopyMagickString(id,value,MaxTextExtent);
break;
}
break;
}
case 'R':
case 'r':
{
if (LocaleCompare(keyword,"r") == 0)
{
svg_info->element.angle=
GetUserSpaceCoordinateValue(svg_info,0,value);
break;
}
break;
}
case 'W':
case 'w':
{
if (LocaleCompare(keyword,"width") == 0)
{
svg_info->bounds.width=
GetUserSpaceCoordinateValue(svg_info,1,value);
break;
}
break;
}
case 'X':
case 'x':
{
if (LocaleCompare(keyword,"x") == 0)
{
svg_info->bounds.x=GetUserSpaceCoordinateValue(svg_info,1,value)-
svg_info->center.x;
break;
}
if (LocaleCompare(keyword,"x1") == 0)
{
svg_info->segment.x1=GetUserSpaceCoordinateValue(svg_info,1,
value);
break;
}
if (LocaleCompare(keyword,"x2") == 0)
{
svg_info->segment.x2=GetUserSpaceCoordinateValue(svg_info,1,
value);
break;
}
break;
}
case 'Y':
case 'y':
{
if (LocaleCompare(keyword,"y") == 0)
{
svg_info->bounds.y=GetUserSpaceCoordinateValue(svg_info,-1,value)-
svg_info->center.y;
break;
}
if (LocaleCompare(keyword,"y1") == 0)
{
svg_info->segment.y1=
GetUserSpaceCoordinateValue(svg_info,-1,value);
break;
}
if (LocaleCompare(keyword,"y2") == 0)
{
svg_info->segment.y2=
GetUserSpaceCoordinateValue(svg_info,-1,value);
break;
}
break;
}
default:
break;
}
}
if (strchr((char *) name,':') != (char *) NULL)
{
/*
Skip over namespace.
*/
for ( ; *name != ':'; name++) ;
name++;
}
switch (*name)
{
case 'C':
case 'c':
{
if (LocaleCompare((const char *) name,"circle") == 0)
{
(void) FormatLocaleFile(svg_info->file,"push graphic-context\n");
break;
}
if (LocaleCompare((const char *) name,"clipPath") == 0)
{
(void) FormatLocaleFile(svg_info->file,"push clip-path '%s'\n",id);
break;
}
break;
}
case 'D':
case 'd':
{
if (LocaleCompare((const char *) name,"defs") == 0)
{
(void) FormatLocaleFile(svg_info->file,"push defs\n");
break;
}
break;
}
case 'E':
case 'e':
{
if (LocaleCompare((const char *) name,"ellipse") == 0)
{
(void) FormatLocaleFile(svg_info->file,"push graphic-context\n");
break;
}
break;
}
case 'G':
case 'g':
{
if (LocaleCompare((const char *) name,"g") == 0)
{
(void) FormatLocaleFile(svg_info->file,"push graphic-context\n");
break;
}
break;
}
case 'I':
case 'i':
{
if (LocaleCompare((const char *) name,"image") == 0)
{
(void) FormatLocaleFile(svg_info->file,"push graphic-context\n");
break;
}
break;
}
case 'L':
case 'l':
{
if (LocaleCompare((const char *) name,"line") == 0)
{
(void) FormatLocaleFile(svg_info->file,"push graphic-context\n");
break;
}
if (LocaleCompare((const char *) name,"linearGradient") == 0)
{
(void) FormatLocaleFile(svg_info->file,
"push gradient '%s' linear %g,%g %g,%g\n",id,
svg_info->segment.x1,svg_info->segment.y1,svg_info->segment.x2,
svg_info->segment.y2);
break;
}
break;
}
case 'P':
case 'p':
{
if (LocaleCompare((const char *) name,"path") == 0)
{
(void) FormatLocaleFile(svg_info->file,"push graphic-context\n");
break;
}
if (LocaleCompare((const char *) name,"pattern") == 0)
{
(void) FormatLocaleFile(svg_info->file,
"push pattern '%s' %g,%g %g,%g\n",id,
svg_info->bounds.x,svg_info->bounds.y,svg_info->bounds.width,
svg_info->bounds.height);
break;
}
if (LocaleCompare((const char *) name,"polygon") == 0)
{
(void) FormatLocaleFile(svg_info->file,"push graphic-context\n");
break;
}
if (LocaleCompare((const char *) name,"polyline") == 0)
{
(void) FormatLocaleFile(svg_info->file,"push graphic-context\n");
break;
}
break;
}
case 'R':
case 'r':
{
if (LocaleCompare((const char *) name,"radialGradient") == 0)
{
(void) FormatLocaleFile(svg_info->file,
"push gradient '%s' radial %g,%g %g,%g %g\n",
id,svg_info->element.cx,svg_info->element.cy,
svg_info->element.major,svg_info->element.minor,
svg_info->element.angle);
break;
}
if (LocaleCompare((const char *) name,"rect") == 0)
{
(void) FormatLocaleFile(svg_info->file,"push graphic-context\n");
break;
}
break;
}
case 'S':
case 's':
{
if (LocaleCompare((const char *) name,"svg") == 0)
{
(void) FormatLocaleFile(svg_info->file,"push graphic-context\n");
break;
}
break;
}
case 'T':
case 't':
{
if (LocaleCompare((const char *) name,"text") == 0)
{
(void) FormatLocaleFile(svg_info->file,"push graphic-context\n");
svg_info->bounds.x=0.0;
svg_info->bounds.y=0.0;
svg_info->bounds.width=0.0;
svg_info->bounds.height=0.0;
break;
}
if (LocaleCompare((const char *) name,"tspan") == 0)
{
if (*svg_info->text != '\0')
{
DrawInfo
*draw_info;
TypeMetric
metrics;
char
*text;
text=EscapeString(svg_info->text,'\'');
(void) FormatLocaleFile(svg_info->file,"text %g,%g '%s'\n",
svg_info->bounds.x-svg_info->center.x,svg_info->bounds.y-
svg_info->center.y,text);
text=DestroyString(text);
draw_info=CloneDrawInfo(svg_info->image_info,(DrawInfo *) NULL);
draw_info->pointsize=svg_info->pointsize;
draw_info->text=AcquireString(svg_info->text);
(void) ConcatenateString(&draw_info->text," ");
GetTypeMetrics(svg_info->image,draw_info,&metrics);
svg_info->bounds.x+=metrics.width;
draw_info=DestroyDrawInfo(draw_info);
*svg_info->text='\0';
}
(void) FormatLocaleFile(svg_info->file,"push graphic-context\n");
break;
}
break;
}
default:
break;
}
if (attributes != (const xmlChar **) NULL)
for (i=0; (attributes[i] != (const xmlChar *) NULL); i+=2)
{
keyword=(const char *) attributes[i];
value=(const char *) attributes[i+1];
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" %s = %s",keyword,value);
switch (*keyword)
{
case 'A':
case 'a':
{
if (LocaleCompare(keyword,"angle") == 0)
{
(void) FormatLocaleFile(svg_info->file,"angle %g\n",
GetUserSpaceCoordinateValue(svg_info,0,value));
break;
}
break;
}
case 'C':
case 'c':
{
if (LocaleCompare(keyword,"clip-path") == 0)
{
(void) FormatLocaleFile(svg_info->file,"clip-path '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"clip-rule") == 0)
{
(void) FormatLocaleFile(svg_info->file,"clip-rule '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"clipPathUnits") == 0)
{
(void) CloneString(&units,value);
(void) FormatLocaleFile(svg_info->file,"clip-units '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"color") == 0)
{
(void) CloneString(&color,value);
break;
}
if (LocaleCompare(keyword,"cx") == 0)
{
svg_info->element.cx=
GetUserSpaceCoordinateValue(svg_info,1,value);
break;
}
if (LocaleCompare(keyword,"cy") == 0)
{
svg_info->element.cy=
GetUserSpaceCoordinateValue(svg_info,-1,value);
break;
}
break;
}
case 'D':
case 'd':
{
if (LocaleCompare(keyword,"d") == 0)
{
(void) CloneString(&svg_info->vertices,value);
break;
}
if (LocaleCompare(keyword,"dx") == 0)
{
svg_info->bounds.x+=GetUserSpaceCoordinateValue(svg_info,1,value);
break;
}
if (LocaleCompare(keyword,"dy") == 0)
{
svg_info->bounds.y+=
GetUserSpaceCoordinateValue(svg_info,-1,value);
break;
}
break;
}
case 'F':
case 'f':
{
if (LocaleCompare(keyword,"fill") == 0)
{
if (LocaleCompare(value,"currentColor") == 0)
{
(void) FormatLocaleFile(svg_info->file,"fill '%s'\n",color);
break;
}
(void) FormatLocaleFile(svg_info->file,"fill '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"fillcolor") == 0)
{
(void) FormatLocaleFile(svg_info->file,"fill '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"fill-rule") == 0)
{
(void) FormatLocaleFile(svg_info->file,"fill-rule '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"fill-opacity") == 0)
{
(void) FormatLocaleFile(svg_info->file,"fill-opacity '%s'\n",
value);
break;
}
if (LocaleCompare(keyword,"font-family") == 0)
{
(void) FormatLocaleFile(svg_info->file,"font-family '%s'\n",
value);
break;
}
if (LocaleCompare(keyword,"font-stretch") == 0)
{
(void) FormatLocaleFile(svg_info->file,"font-stretch '%s'\n",
value);
break;
}
if (LocaleCompare(keyword,"font-style") == 0)
{
(void) FormatLocaleFile(svg_info->file,"font-style '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"font-size") == 0)
{
svg_info->pointsize=GetUserSpaceCoordinateValue(svg_info,0,value);
(void) FormatLocaleFile(svg_info->file,"font-size %g\n",
svg_info->pointsize);
break;
}
if (LocaleCompare(keyword,"font-weight") == 0)
{
(void) FormatLocaleFile(svg_info->file,"font-weight '%s'\n",
value);
break;
}
break;
}
case 'G':
case 'g':
{
if (LocaleCompare(keyword,"gradientTransform") == 0)
{
AffineMatrix
affine,
current,
transform;
GetAffineMatrix(&transform);
(void) LogMagickEvent(CoderEvent,GetMagickModule()," ");
tokens=GetTransformTokens(context,value,&number_tokens);
for (j=0; j < (number_tokens-1); j+=2)
{
keyword=(char *) tokens[j];
if (keyword == (char *) NULL)
continue;
value=(char *) tokens[j+1];
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" %s: %s",keyword,value);
current=transform;
GetAffineMatrix(&affine);
switch (*keyword)
{
case 'M':
case 'm':
{
if (LocaleCompare(keyword,"matrix") == 0)
{
p=(const char *) value;
GetMagickToken(p,&p,token);
affine.sx=StringToDouble(value,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
affine.rx=StringToDouble(token,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
affine.ry=StringToDouble(token,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
affine.sy=StringToDouble(token,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
affine.tx=StringToDouble(token,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
affine.ty=StringToDouble(token,(char **) NULL);
break;
}
break;
}
case 'R':
case 'r':
{
if (LocaleCompare(keyword,"rotate") == 0)
{
double
angle;
angle=GetUserSpaceCoordinateValue(svg_info,0,value);
affine.sx=cos(DegreesToRadians(fmod(angle,360.0)));
affine.rx=sin(DegreesToRadians(fmod(angle,360.0)));
affine.ry=(-sin(DegreesToRadians(fmod(angle,360.0))));
affine.sy=cos(DegreesToRadians(fmod(angle,360.0)));
break;
}
break;
}
case 'S':
case 's':
{
if (LocaleCompare(keyword,"scale") == 0)
{
for (p=(const char *) value; *p != '\0'; p++)
if ((isspace((int) ((unsigned char) *p)) != 0) ||
(*p == ','))
break;
affine.sx=GetUserSpaceCoordinateValue(svg_info,1,value);
affine.sy=affine.sx;
if (*p != '\0')
affine.sy=
GetUserSpaceCoordinateValue(svg_info,-1,p+1);
svg_info->scale[svg_info->n]=ExpandAffine(&affine);
break;
}
if (LocaleCompare(keyword,"skewX") == 0)
{
affine.sx=svg_info->affine.sx;
affine.ry=tan(DegreesToRadians(fmod(
GetUserSpaceCoordinateValue(svg_info,1,value),
360.0)));
affine.sy=svg_info->affine.sy;
break;
}
if (LocaleCompare(keyword,"skewY") == 0)
{
affine.sx=svg_info->affine.sx;
affine.rx=tan(DegreesToRadians(fmod(
GetUserSpaceCoordinateValue(svg_info,-1,value),
360.0)));
affine.sy=svg_info->affine.sy;
break;
}
break;
}
case 'T':
case 't':
{
if (LocaleCompare(keyword,"translate") == 0)
{
for (p=(const char *) value; *p != '\0'; p++)
if ((isspace((int) ((unsigned char) *p)) != 0) ||
(*p == ','))
break;
affine.tx=GetUserSpaceCoordinateValue(svg_info,1,value);
affine.ty=affine.tx;
if (*p != '\0')
affine.ty=
GetUserSpaceCoordinateValue(svg_info,-1,p+1);
break;
}
break;
}
default:
break;
}
transform.sx=affine.sx*current.sx+affine.ry*current.rx;
transform.rx=affine.rx*current.sx+affine.sy*current.rx;
transform.ry=affine.sx*current.ry+affine.ry*current.sy;
transform.sy=affine.rx*current.ry+affine.sy*current.sy;
transform.tx=affine.tx*current.sx+affine.ty*current.ry+
current.tx;
transform.ty=affine.tx*current.rx+affine.ty*current.sy+
current.ty;
}
(void) FormatLocaleFile(svg_info->file,
"affine %g %g %g %g %g %g\n",transform.sx,
transform.rx,transform.ry,transform.sy,transform.tx,
transform.ty);
for (j=0; tokens[j] != (char *) NULL; j++)
tokens[j]=DestroyString(tokens[j]);
tokens=(char **) RelinquishMagickMemory(tokens);
break;
}
if (LocaleCompare(keyword,"gradientUnits") == 0)
{
(void) CloneString(&units,value);
(void) FormatLocaleFile(svg_info->file,"gradient-units '%s'\n",
value);
break;
}
break;
}
case 'H':
case 'h':
{
if (LocaleCompare(keyword,"height") == 0)
{
svg_info->bounds.height=
GetUserSpaceCoordinateValue(svg_info,-1,value);
break;
}
if (LocaleCompare(keyword,"href") == 0)
{
(void) CloneString(&svg_info->url,value);
break;
}
break;
}
case 'M':
case 'm':
{
if (LocaleCompare(keyword,"major") == 0)
{
svg_info->element.major=
GetUserSpaceCoordinateValue(svg_info,1,value);
break;
}
if (LocaleCompare(keyword,"minor") == 0)
{
svg_info->element.minor=
GetUserSpaceCoordinateValue(svg_info,-1,value);
break;
}
break;
}
case 'O':
case 'o':
{
if (LocaleCompare(keyword,"offset") == 0)
{
(void) CloneString(&svg_info->offset,value);
break;
}
if (LocaleCompare(keyword,"opacity") == 0)
{
(void) FormatLocaleFile(svg_info->file,"opacity '%s'\n",value);
break;
}
break;
}
case 'P':
case 'p':
{
if (LocaleCompare(keyword,"path") == 0)
{
(void) CloneString(&svg_info->url,value);
break;
}
if (LocaleCompare(keyword,"points") == 0)
{
(void) CloneString(&svg_info->vertices,value);
break;
}
break;
}
case 'R':
case 'r':
{
if (LocaleCompare(keyword,"r") == 0)
{
svg_info->element.major=
GetUserSpaceCoordinateValue(svg_info,1,value);
svg_info->element.minor=
GetUserSpaceCoordinateValue(svg_info,-1,value);
break;
}
if (LocaleCompare(keyword,"rotate") == 0)
{
double
angle;
angle=GetUserSpaceCoordinateValue(svg_info,0,value);
(void) FormatLocaleFile(svg_info->file,"translate %g,%g\n",
svg_info->bounds.x,svg_info->bounds.y);
svg_info->bounds.x=0;
svg_info->bounds.y=0;
(void) FormatLocaleFile(svg_info->file,"rotate %g\n",angle);
break;
}
if (LocaleCompare(keyword,"rx") == 0)
{
if (LocaleCompare((const char *) name,"ellipse") == 0)
svg_info->element.major=
GetUserSpaceCoordinateValue(svg_info,1,value);
else
svg_info->radius.x=
GetUserSpaceCoordinateValue(svg_info,1,value);
break;
}
if (LocaleCompare(keyword,"ry") == 0)
{
if (LocaleCompare((const char *) name,"ellipse") == 0)
svg_info->element.minor=
GetUserSpaceCoordinateValue(svg_info,-1,value);
else
svg_info->radius.y=
GetUserSpaceCoordinateValue(svg_info,-1,value);
break;
}
break;
}
case 'S':
case 's':
{
if (LocaleCompare(keyword,"stop-color") == 0)
{
(void) CloneString(&svg_info->stop_color,value);
break;
}
if (LocaleCompare(keyword,"stroke") == 0)
{
if (LocaleCompare(value,"currentColor") == 0)
{
(void) FormatLocaleFile(svg_info->file,"stroke '%s'\n",color);
break;
}
(void) FormatLocaleFile(svg_info->file,"stroke '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"stroke-antialiasing") == 0)
{
(void) FormatLocaleFile(svg_info->file,"stroke-antialias %d\n",
LocaleCompare(value,"true") == 0);
break;
}
if (LocaleCompare(keyword,"stroke-dasharray") == 0)
{
(void) FormatLocaleFile(svg_info->file,"stroke-dasharray %s\n",
value);
break;
}
if (LocaleCompare(keyword,"stroke-dashoffset") == 0)
{
(void) FormatLocaleFile(svg_info->file,"stroke-dashoffset %s\n",
value);
break;
}
if (LocaleCompare(keyword,"stroke-linecap") == 0)
{
(void) FormatLocaleFile(svg_info->file,"stroke-linecap '%s'\n",
value);
break;
}
if (LocaleCompare(keyword,"stroke-linejoin") == 0)
{
(void) FormatLocaleFile(svg_info->file,"stroke-linejoin '%s'\n",
value);
break;
}
if (LocaleCompare(keyword,"stroke-miterlimit") == 0)
{
(void) FormatLocaleFile(svg_info->file,"stroke-miterlimit '%s'\n",
value);
break;
}
if (LocaleCompare(keyword,"stroke-opacity") == 0)
{
(void) FormatLocaleFile(svg_info->file,"stroke-opacity '%s'\n",
value);
break;
}
if (LocaleCompare(keyword,"stroke-width") == 0)
{
(void) FormatLocaleFile(svg_info->file,"stroke-width %g\n",
GetUserSpaceCoordinateValue(svg_info,1,value));
break;
}
if (LocaleCompare(keyword,"style") == 0)
{
(void) LogMagickEvent(CoderEvent,GetMagickModule()," ");
tokens=GetStyleTokens(context,value,&number_tokens);
for (j=0; j < (number_tokens-1); j+=2)
{
keyword=(char *) tokens[j];
value=(char *) tokens[j+1];
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" %s: %s",keyword,value);
switch (*keyword)
{
case 'C':
case 'c':
{
if (LocaleCompare(keyword,"clip-path") == 0)
{
(void) FormatLocaleFile(svg_info->file,
"clip-path '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"clip-rule") == 0)
{
(void) FormatLocaleFile(svg_info->file,
"clip-rule '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"clipPathUnits") == 0)
{
(void) CloneString(&units,value);
(void) FormatLocaleFile(svg_info->file,
"clip-units '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"color") == 0)
{
(void) CloneString(&color,value);
break;
}
break;
}
case 'F':
case 'f':
{
if (LocaleCompare(keyword,"fill") == 0)
{
if (LocaleCompare(value,"currentColor") == 0)
{
(void) FormatLocaleFile(svg_info->file,
"fill '%s'\n",color);
break;
}
if (LocaleCompare(value,"#00000000") == 0)
(void) FormatLocaleFile(svg_info->file,
"fill '#000000'\n");
else
(void) FormatLocaleFile(svg_info->file,"fill '%s'\n",
value);
break;
}
if (LocaleCompare(keyword,"fillcolor") == 0)
{
(void) FormatLocaleFile(svg_info->file,"fill '%s'\n",
value);
break;
}
if (LocaleCompare(keyword,"fill-rule") == 0)
{
(void) FormatLocaleFile(svg_info->file,
"fill-rule '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"fill-opacity") == 0)
{
(void) FormatLocaleFile(svg_info->file,
"fill-opacity '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"font-family") == 0)
{
(void) FormatLocaleFile(svg_info->file,
"font-family '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"font-stretch") == 0)
{
(void) FormatLocaleFile(svg_info->file,
"font-stretch '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"font-style") == 0)
{
(void) FormatLocaleFile(svg_info->file,
"font-style '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"font-size") == 0)
{
svg_info->pointsize=GetUserSpaceCoordinateValue(
svg_info,0,value);
(void) FormatLocaleFile(svg_info->file,"font-size %g\n",
svg_info->pointsize);
break;
}
if (LocaleCompare(keyword,"font-weight") == 0)
{
(void) FormatLocaleFile(svg_info->file,
"font-weight '%s'\n",value);
break;
}
break;
}
case 'O':
case 'o':
{
if (LocaleCompare(keyword,"offset") == 0)
{
(void) FormatLocaleFile(svg_info->file,"offset %g\n",
GetUserSpaceCoordinateValue(svg_info,1,value));
break;
}
if (LocaleCompare(keyword,"opacity") == 0)
{
(void) FormatLocaleFile(svg_info->file,
"opacity '%s'\n",value);
break;
}
break;
}
case 'S':
case 's':
{
if (LocaleCompare(keyword,"stop-color") == 0)
{
(void) CloneString(&svg_info->stop_color,value);
break;
}
if (LocaleCompare(keyword,"stroke") == 0)
{
if (LocaleCompare(value,"currentColor") == 0)
{
(void) FormatLocaleFile(svg_info->file,
"stroke '%s'\n",color);
break;
}
if (LocaleCompare(value,"#00000000") == 0)
(void) FormatLocaleFile(svg_info->file,
"fill '#000000'\n");
else
(void) FormatLocaleFile(svg_info->file,
"stroke '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"stroke-antialiasing") == 0)
{
(void) FormatLocaleFile(svg_info->file,
"stroke-antialias %d\n",
LocaleCompare(value,"true") == 0);
break;
}
if (LocaleCompare(keyword,"stroke-dasharray") == 0)
{
(void) FormatLocaleFile(svg_info->file,
"stroke-dasharray %s\n",value);
break;
}
if (LocaleCompare(keyword,"stroke-dashoffset") == 0)
{
(void) FormatLocaleFile(svg_info->file,
"stroke-dashoffset %s\n",
value);
break;
}
if (LocaleCompare(keyword,"stroke-linecap") == 0)
{
(void) FormatLocaleFile(svg_info->file,
"stroke-linecap '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"stroke-linejoin") == 0)
{
(void) FormatLocaleFile(svg_info->file,
"stroke-linejoin '%s'\n",
value);
break;
}
if (LocaleCompare(keyword,"stroke-miterlimit") == 0)
{
(void) FormatLocaleFile(svg_info->file,
"stroke-miterlimit '%s'\n",
value);
break;
}
if (LocaleCompare(keyword,"stroke-opacity") == 0)
{
(void) FormatLocaleFile(svg_info->file,
"stroke-opacity '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"stroke-width") == 0)
{
(void) FormatLocaleFile(svg_info->file,
"stroke-width %g\n",
GetUserSpaceCoordinateValue(svg_info,1,value));
break;
}
break;
}
case 't':
case 'T':
{
if (LocaleCompare(keyword,"text-align") == 0)
{
(void) FormatLocaleFile(svg_info->file,
"text-align '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"text-anchor") == 0)
{
(void) FormatLocaleFile(svg_info->file,
"text-anchor '%s'\n",value);
break;
}
if (LocaleCompare(keyword,"text-decoration") == 0)
{
if (LocaleCompare(value,"underline") == 0)
(void) FormatLocaleFile(svg_info->file,
"decorate underline\n");
if (LocaleCompare(value,"line-through") == 0)
(void) FormatLocaleFile(svg_info->file,
"decorate line-through\n");
if (LocaleCompare(value,"overline") == 0)
(void) FormatLocaleFile(svg_info->file,
"decorate overline\n");
break;
}
if (LocaleCompare(keyword,"text-antialiasing") == 0)
{
(void) FormatLocaleFile(svg_info->file,
"text-antialias %d\n",
LocaleCompare(value,"true") == 0);
break;
}
break;
}
default:
break;
}
}
for (j=0; tokens[j] != (char *) NULL; j++)
tokens[j]=DestroyString(tokens[j]);
tokens=(char **) RelinquishMagickMemory(tokens);
break;
}
break;
}
case 'T':
case 't':
{
if (LocaleCompare(keyword,"text-align") == 0)
{
(void) FormatLocaleFile(svg_info->file,"text-align '%s'\n",
value);
break;
}
if (LocaleCompare(keyword,"text-anchor") == 0)
{
(void) FormatLocaleFile(svg_info->file,"text-anchor '%s'\n",
value);
break;
}
if (LocaleCompare(keyword,"text-decoration") == 0)
{
if (LocaleCompare(value,"underline") == 0)
(void) FormatLocaleFile(svg_info->file,"decorate underline\n");
if (LocaleCompare(value,"line-through") == 0)
(void) FormatLocaleFile(svg_info->file,
"decorate line-through\n");
if (LocaleCompare(value,"overline") == 0)
(void) FormatLocaleFile(svg_info->file,"decorate overline\n");
break;
}
if (LocaleCompare(keyword,"text-antialiasing") == 0)
{
(void) FormatLocaleFile(svg_info->file,"text-antialias %d\n",
LocaleCompare(value,"true") == 0);
break;
}
if (LocaleCompare(keyword,"transform") == 0)
{
AffineMatrix
affine,
current,
transform;
GetAffineMatrix(&transform);
(void) LogMagickEvent(CoderEvent,GetMagickModule()," ");
tokens=GetTransformTokens(context,value,&number_tokens);
for (j=0; j < (number_tokens-1); j+=2)
{
keyword=(char *) tokens[j];
value=(char *) tokens[j+1];
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" %s: %s",keyword,value);
current=transform;
GetAffineMatrix(&affine);
switch (*keyword)
{
case 'M':
case 'm':
{
if (LocaleCompare(keyword,"matrix") == 0)
{
p=(const char *) value;
GetMagickToken(p,&p,token);
affine.sx=StringToDouble(value,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
affine.rx=StringToDouble(token,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
affine.ry=StringToDouble(token,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
affine.sy=StringToDouble(token,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
affine.tx=StringToDouble(token,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
affine.ty=StringToDouble(token,(char **) NULL);
break;
}
break;
}
case 'R':
case 'r':
{
if (LocaleCompare(keyword,"rotate") == 0)
{
double
angle,
x,
y;
p=(const char *) value;
GetMagickToken(p,&p,token);
angle=StringToDouble(value,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
x=StringToDouble(token,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
y=StringToDouble(token,(char **) NULL);
affine.sx=cos(DegreesToRadians(fmod(angle,360.0)));
affine.rx=sin(DegreesToRadians(fmod(angle,360.0)));
affine.ry=(-sin(DegreesToRadians(fmod(angle,360.0))));
affine.sy=cos(DegreesToRadians(fmod(angle,360.0)));
affine.tx=x;
affine.ty=y;
svg_info->center.x=x;
svg_info->center.y=y;
break;
}
break;
}
case 'S':
case 's':
{
if (LocaleCompare(keyword,"scale") == 0)
{
for (p=(const char *) value; *p != '\0'; p++)
if ((isspace((int) ((unsigned char) *p)) != 0) ||
(*p == ','))
break;
affine.sx=GetUserSpaceCoordinateValue(svg_info,1,value);
affine.sy=affine.sx;
if (*p != '\0')
affine.sy=GetUserSpaceCoordinateValue(svg_info,-1,
p+1);
svg_info->scale[svg_info->n]=ExpandAffine(&affine);
break;
}
if (LocaleCompare(keyword,"skewX") == 0)
{
affine.sx=svg_info->affine.sx;
affine.ry=tan(DegreesToRadians(fmod(
GetUserSpaceCoordinateValue(svg_info,1,value),
360.0)));
affine.sy=svg_info->affine.sy;
break;
}
if (LocaleCompare(keyword,"skewY") == 0)
{
affine.sx=svg_info->affine.sx;
affine.rx=tan(DegreesToRadians(fmod(
GetUserSpaceCoordinateValue(svg_info,-1,value),
360.0)));
affine.sy=svg_info->affine.sy;
break;
}
break;
}
case 'T':
case 't':
{
if (LocaleCompare(keyword,"translate") == 0)
{
for (p=(const char *) value; *p != '\0'; p++)
if ((isspace((int) ((unsigned char) *p)) != 0) ||
(*p == ','))
break;
affine.tx=GetUserSpaceCoordinateValue(svg_info,1,value);
affine.ty=affine.tx;
if (*p != '\0')
affine.ty=GetUserSpaceCoordinateValue(svg_info,-1,
p+1);
break;
}
break;
}
default:
break;
}
transform.sx=affine.sx*current.sx+affine.ry*current.rx;
transform.rx=affine.rx*current.sx+affine.sy*current.rx;
transform.ry=affine.sx*current.ry+affine.ry*current.sy;
transform.sy=affine.rx*current.ry+affine.sy*current.sy;
transform.tx=affine.tx*current.sx+affine.ty*current.ry+
current.tx;
transform.ty=affine.tx*current.rx+affine.ty*current.sy+
current.ty;
}
(void) FormatLocaleFile(svg_info->file,
"affine %g %g %g %g %g %g\n",transform.sx,transform.rx,
transform.ry,transform.sy,transform.tx,transform.ty);
for (j=0; tokens[j] != (char *) NULL; j++)
tokens[j]=DestroyString(tokens[j]);
tokens=(char **) RelinquishMagickMemory(tokens);
break;
}
break;
}
case 'V':
case 'v':
{
if (LocaleCompare(keyword,"verts") == 0)
{
(void) CloneString(&svg_info->vertices,value);
break;
}
if (LocaleCompare(keyword,"viewBox") == 0)
{
p=(const char *) value;
GetMagickToken(p,&p,token);
svg_info->view_box.x=StringToDouble(token,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
svg_info->view_box.y=StringToDouble(token,(char **) NULL);
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
svg_info->view_box.width=StringToDouble(token,
(char **) NULL);
if (svg_info->bounds.width == 0)
svg_info->bounds.width=svg_info->view_box.width;
GetMagickToken(p,&p,token);
if (*token == ',')
GetMagickToken(p,&p,token);
svg_info->view_box.height=StringToDouble(token,
(char **) NULL);
if (svg_info->bounds.height == 0)
svg_info->bounds.height=svg_info->view_box.height;
break;
}
break;
}
case 'W':
case 'w':
{
if (LocaleCompare(keyword,"width") == 0)
{
svg_info->bounds.width=
GetUserSpaceCoordinateValue(svg_info,1,value);
break;
}
break;
}
case 'X':
case 'x':
{
if (LocaleCompare(keyword,"x") == 0)
{
svg_info->bounds.x=GetUserSpaceCoordinateValue(svg_info,1,value);
break;
}
if (LocaleCompare(keyword,"xlink:href") == 0)
{
(void) CloneString(&svg_info->url,value);
break;
}
if (LocaleCompare(keyword,"x1") == 0)
{
svg_info->segment.x1=
GetUserSpaceCoordinateValue(svg_info,1,value);
break;
}
if (LocaleCompare(keyword,"x2") == 0)
{
svg_info->segment.x2=
GetUserSpaceCoordinateValue(svg_info,1,value);
break;
}
break;
}
case 'Y':
case 'y':
{
if (LocaleCompare(keyword,"y") == 0)
{
svg_info->bounds.y=GetUserSpaceCoordinateValue(svg_info,-1,value);
break;
}
if (LocaleCompare(keyword,"y1") == 0)
{
svg_info->segment.y1=
GetUserSpaceCoordinateValue(svg_info,-1,value);
break;
}
if (LocaleCompare(keyword,"y2") == 0)
{
svg_info->segment.y2=
GetUserSpaceCoordinateValue(svg_info,-1,value);
break;
}
break;
}
default:
break;
}
}
if (LocaleCompare((const char *) name,"svg") == 0)
{
if (svg_info->document->encoding != (const xmlChar *) NULL)
(void) FormatLocaleFile(svg_info->file,"encoding \"%s\"\n",
(const char *) svg_info->document->encoding);
if (attributes != (const xmlChar **) NULL)
{
double
sx,
sy,
tx,
ty;
if ((svg_info->view_box.width == 0.0) ||
(svg_info->view_box.height == 0.0))
svg_info->view_box=svg_info->bounds;
svg_info->width=(size_t) floor(svg_info->bounds.width+0.5);
svg_info->height=(size_t) floor(svg_info->bounds.height+0.5);
(void) FormatLocaleFile(svg_info->file,"viewbox 0 0 %.20g %.20g\n",
(double) svg_info->width,(double) svg_info->height);
sx=(double) svg_info->width/svg_info->view_box.width;
sy=(double) svg_info->height/svg_info->view_box.height;
tx=svg_info->view_box.x != 0.0 ? (double) -sx*svg_info->view_box.x :
0.0;
ty=svg_info->view_box.y != 0.0 ? (double) -sy*svg_info->view_box.y :
0.0;
(void) FormatLocaleFile(svg_info->file,"affine %g 0 0 %g %g %g\n",
sx,sy,tx,ty);
}
}
(void) LogMagickEvent(CoderEvent,GetMagickModule()," )");
units=DestroyString(units);
if (color != (char *) NULL)
color=DestroyString(color);
}
| 10,830
|
174,734
| 0
|
static int vol_effect_get_descriptor(effect_handle_t self,
effect_descriptor_t *descriptor)
{
vol_listener_context_t *context = (vol_listener_context_t *)self;
ALOGV("%s Called ", __func__);
if (descriptor == NULL) {
ALOGE("%s: descriptor is NULL", __func__);
return -EINVAL;
}
*descriptor = *context->desc;
return 0;
}
| 10,831
|
176,087
| 0
|
void rfc_send_msc(tRFC_MCB* p_mcb, uint8_t dlci, bool is_command,
tPORT_CTRL* p_pars) {
uint8_t* p_data;
uint8_t signals;
uint8_t break_duration;
uint8_t len;
BT_HDR* p_buf = (BT_HDR*)osi_malloc(RFCOMM_CMD_BUF_SIZE);
signals = p_pars->modem_signal;
break_duration = p_pars->break_signal;
p_buf->offset = L2CAP_MIN_OFFSET + RFCOMM_CTRL_FRAME_LEN;
p_data = (uint8_t*)(p_buf + 1) + p_buf->offset;
if (break_duration)
len = RFCOMM_MX_MSC_LEN_WITH_BREAK;
else
len = RFCOMM_MX_MSC_LEN_NO_BREAK;
*p_data++ = RFCOMM_EA | RFCOMM_I_CR(is_command) | RFCOMM_MX_MSC;
*p_data++ = RFCOMM_EA | (len << 1);
*p_data++ = RFCOMM_EA | RFCOMM_CR_MASK | (dlci << RFCOMM_SHIFT_DLCI);
*p_data++ = RFCOMM_EA | ((p_pars->fc) ? RFCOMM_MSC_FC : 0) |
((signals & MODEM_SIGNAL_DTRDSR) ? RFCOMM_MSC_RTC : 0) |
((signals & MODEM_SIGNAL_RTSCTS) ? RFCOMM_MSC_RTR : 0) |
((signals & MODEM_SIGNAL_RI) ? RFCOMM_MSC_IC : 0) |
((signals & MODEM_SIGNAL_DCD) ? RFCOMM_MSC_DV : 0);
if (break_duration) {
*p_data++ = RFCOMM_EA | RFCOMM_MSC_BREAK_PRESENT_MASK |
(break_duration << RFCOMM_MSC_SHIFT_BREAK);
}
/* Total length is sizeof MSC data + mx header 2 */
p_buf->len = len + 2;
rfc_send_buf_uih(p_mcb, RFCOMM_MX_DLCI, p_buf);
}
| 10,832
|
16,799
| 0
|
static int alloc_refcount_block(BlockDriverState *bs,
int64_t cluster_index, uint16_t **refcount_block)
{
BDRVQcowState *s = bs->opaque;
unsigned int refcount_table_index;
int ret;
BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC);
/* Find the refcount block for the given cluster */
refcount_table_index = cluster_index >> (s->cluster_bits - REFCOUNT_SHIFT);
if (refcount_table_index < s->refcount_table_size) {
uint64_t refcount_block_offset =
s->refcount_table[refcount_table_index] & REFT_OFFSET_MASK;
/* If it's already there, we're done */
if (refcount_block_offset) {
return load_refcount_block(bs, refcount_block_offset,
(void**) refcount_block);
}
}
/*
* If we came here, we need to allocate something. Something is at least
* a cluster for the new refcount block. It may also include a new refcount
* table if the old refcount table is too small.
*
* Note that allocating clusters here needs some special care:
*
* - We can't use the normal qcow2_alloc_clusters(), it would try to
* increase the refcount and very likely we would end up with an endless
* recursion. Instead we must place the refcount blocks in a way that
* they can describe them themselves.
*
* - We need to consider that at this point we are inside update_refcounts
* and potentially doing an initial refcount increase. This means that
* some clusters have already been allocated by the caller, but their
* refcount isn't accurate yet. If we allocate clusters for metadata, we
* need to return -EAGAIN to signal the caller that it needs to restart
* the search for free clusters.
*
* - alloc_clusters_noref and qcow2_free_clusters may load a different
* refcount block into the cache
*/
*refcount_block = NULL;
/* We write to the refcount table, so we might depend on L2 tables */
ret = qcow2_cache_flush(bs, s->l2_table_cache);
if (ret < 0) {
return ret;
}
/* Allocate the refcount block itself and mark it as used */
int64_t new_block = alloc_clusters_noref(bs, s->cluster_size);
if (new_block < 0) {
return new_block;
}
#ifdef DEBUG_ALLOC2
fprintf(stderr, "qcow2: Allocate refcount block %d for %" PRIx64
" at %" PRIx64 "\n",
refcount_table_index, cluster_index << s->cluster_bits, new_block);
#endif
if (in_same_refcount_block(s, new_block, cluster_index << s->cluster_bits)) {
/* Zero the new refcount block before updating it */
ret = qcow2_cache_get_empty(bs, s->refcount_block_cache, new_block,
(void**) refcount_block);
if (ret < 0) {
goto fail_block;
}
memset(*refcount_block, 0, s->cluster_size);
/* The block describes itself, need to update the cache */
int block_index = (new_block >> s->cluster_bits) &
((1 << (s->cluster_bits - REFCOUNT_SHIFT)) - 1);
(*refcount_block)[block_index] = cpu_to_be16(1);
} else {
/* Described somewhere else. This can recurse at most twice before we
* arrive at a block that describes itself. */
ret = update_refcount(bs, new_block, s->cluster_size, 1,
QCOW2_DISCARD_NEVER);
if (ret < 0) {
goto fail_block;
}
ret = qcow2_cache_flush(bs, s->refcount_block_cache);
if (ret < 0) {
goto fail_block;
}
/* Initialize the new refcount block only after updating its refcount,
* update_refcount uses the refcount cache itself */
ret = qcow2_cache_get_empty(bs, s->refcount_block_cache, new_block,
(void**) refcount_block);
if (ret < 0) {
goto fail_block;
}
memset(*refcount_block, 0, s->cluster_size);
}
/* Now the new refcount block needs to be written to disk */
BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC_WRITE);
qcow2_cache_entry_mark_dirty(s->refcount_block_cache, *refcount_block);
ret = qcow2_cache_flush(bs, s->refcount_block_cache);
if (ret < 0) {
goto fail_block;
}
/* If the refcount table is big enough, just hook the block up there */
if (refcount_table_index < s->refcount_table_size) {
uint64_t data64 = cpu_to_be64(new_block);
BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC_HOOKUP);
ret = bdrv_pwrite_sync(bs->file,
s->refcount_table_offset + refcount_table_index * sizeof(uint64_t),
&data64, sizeof(data64));
if (ret < 0) {
goto fail_block;
}
s->refcount_table[refcount_table_index] = new_block;
/* The new refcount block may be where the caller intended to put its
* data, so let it restart the search. */
return -EAGAIN;
}
ret = qcow2_cache_put(bs, s->refcount_block_cache, (void**) refcount_block);
if (ret < 0) {
goto fail_block;
}
/*
* If we come here, we need to grow the refcount table. Again, a new
* refcount table needs some space and we can't simply allocate to avoid
* endless recursion.
*
* Therefore let's grab new refcount blocks at the end of the image, which
* will describe themselves and the new refcount table. This way we can
* reference them only in the new table and do the switch to the new
* refcount table at once without producing an inconsistent state in
* between.
*/
BLKDBG_EVENT(bs->file, BLKDBG_REFTABLE_GROW);
/* Calculate the number of refcount blocks needed so far */
uint64_t refcount_block_clusters = 1 << (s->cluster_bits - REFCOUNT_SHIFT);
uint64_t blocks_used = DIV_ROUND_UP(cluster_index, refcount_block_clusters);
/* And now we need at least one block more for the new metadata */
uint64_t table_size = next_refcount_table_size(s, blocks_used + 1);
uint64_t last_table_size;
uint64_t blocks_clusters;
do {
uint64_t table_clusters =
size_to_clusters(s, table_size * sizeof(uint64_t));
blocks_clusters = 1 +
((table_clusters + refcount_block_clusters - 1)
/ refcount_block_clusters);
uint64_t meta_clusters = table_clusters + blocks_clusters;
last_table_size = table_size;
table_size = next_refcount_table_size(s, blocks_used +
((meta_clusters + refcount_block_clusters - 1)
/ refcount_block_clusters));
} while (last_table_size != table_size);
#ifdef DEBUG_ALLOC2
fprintf(stderr, "qcow2: Grow refcount table %" PRId32 " => %" PRId64 "\n",
s->refcount_table_size, table_size);
#endif
/* Create the new refcount table and blocks */
uint64_t meta_offset = (blocks_used * refcount_block_clusters) *
s->cluster_size;
uint64_t table_offset = meta_offset + blocks_clusters * s->cluster_size;
uint16_t *new_blocks = g_malloc0(blocks_clusters * s->cluster_size);
uint64_t *new_table = g_malloc0(table_size * sizeof(uint64_t));
/* Fill the new refcount table */
memcpy(new_table, s->refcount_table,
s->refcount_table_size * sizeof(uint64_t));
new_table[refcount_table_index] = new_block;
int i;
for (i = 0; i < blocks_clusters; i++) {
new_table[blocks_used + i] = meta_offset + (i * s->cluster_size);
}
/* Fill the refcount blocks */
uint64_t table_clusters = size_to_clusters(s, table_size * sizeof(uint64_t));
int block = 0;
for (i = 0; i < table_clusters + blocks_clusters; i++) {
new_blocks[block++] = cpu_to_be16(1);
}
/* Write refcount blocks to disk */
BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC_WRITE_BLOCKS);
ret = bdrv_pwrite_sync(bs->file, meta_offset, new_blocks,
blocks_clusters * s->cluster_size);
g_free(new_blocks);
if (ret < 0) {
goto fail_table;
}
/* Write refcount table to disk */
for(i = 0; i < table_size; i++) {
cpu_to_be64s(&new_table[i]);
}
BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC_WRITE_TABLE);
ret = bdrv_pwrite_sync(bs->file, table_offset, new_table,
table_size * sizeof(uint64_t));
if (ret < 0) {
goto fail_table;
}
for(i = 0; i < table_size; i++) {
be64_to_cpus(&new_table[i]);
}
/* Hook up the new refcount table in the qcow2 header */
uint8_t data[12];
cpu_to_be64w((uint64_t*)data, table_offset);
cpu_to_be32w((uint32_t*)(data + 8), table_clusters);
BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC_SWITCH_TABLE);
ret = bdrv_pwrite_sync(bs->file, offsetof(QCowHeader, refcount_table_offset),
data, sizeof(data));
if (ret < 0) {
goto fail_table;
}
/* And switch it in memory */
uint64_t old_table_offset = s->refcount_table_offset;
uint64_t old_table_size = s->refcount_table_size;
g_free(s->refcount_table);
s->refcount_table = new_table;
s->refcount_table_size = table_size;
s->refcount_table_offset = table_offset;
/* Free old table. */
qcow2_free_clusters(bs, old_table_offset, old_table_size * sizeof(uint64_t),
QCOW2_DISCARD_OTHER);
ret = load_refcount_block(bs, new_block, (void**) refcount_block);
if (ret < 0) {
return ret;
}
/* If we were trying to do the initial refcount update for some cluster
* allocation, we might have used the same clusters to store newly
* allocated metadata. Make the caller search some new space. */
return -EAGAIN;
fail_table:
g_free(new_table);
fail_block:
if (*refcount_block != NULL) {
qcow2_cache_put(bs, s->refcount_block_cache, (void**) refcount_block);
}
return ret;
}
| 10,833
|
154,720
| 0
|
error::Error GLES2DecoderPassthroughImpl::DoGetUniformiv(GLuint program,
GLint location,
GLsizei bufsize,
GLsizei* length,
GLint* params) {
api()->glGetUniformivRobustANGLEFn(GetProgramServiceID(program, resources_),
location, bufsize * sizeof(*params),
length, params);
return error::kNoError;
}
| 10,834
|
47,522
| 0
|
static int ahash_sha1_init(struct ahash_request *req)
{
struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
struct hash_ctx *ctx = crypto_ahash_ctx(tfm);
ctx->config.data_format = HASH_DATA_8_BITS;
ctx->config.algorithm = HASH_ALGO_SHA1;
ctx->config.oper_mode = HASH_OPER_MODE_HASH;
ctx->digestsize = SHA1_DIGEST_SIZE;
return hash_init(req);
}
| 10,835
|
100,014
| 0
|
virtual void didFinishLoading(WebURLLoader*) {}
| 10,836
|
88,919
| 0
|
MagickExport MagickBooleanType EvaluateImage(Image *image,
const MagickEvaluateOperator op,const double value,ExceptionInfo *exception)
{
MagickBooleanType
status;
status=EvaluateImageChannel(image,CompositeChannels,op,value,exception);
return(status);
}
| 10,837
|
90,589
| 0
|
static int special_mapping_mremap(struct vm_area_struct *new_vma)
{
struct vm_special_mapping *sm = new_vma->vm_private_data;
if (WARN_ON_ONCE(current->mm != new_vma->vm_mm))
return -EFAULT;
if (sm->mremap)
return sm->mremap(sm, new_vma);
return 0;
}
| 10,838
|
184,933
| 1
|
void BluetoothDeviceChromeOS::UnregisterAgent() {
if (!agent_.get())
return;
DCHECK(pairing_delegate_);
DCHECK(pincode_callback_.is_null());
DCHECK(passkey_callback_.is_null());
DCHECK(confirmation_callback_.is_null());
pairing_delegate_->DismissDisplayOrConfirm();
pairing_delegate_ = NULL;
agent_.reset();
// Clean up after ourselves.
VLOG(1) << object_path_.value() << ": Unregistering pairing agent";
DBusThreadManager::Get()->GetBluetoothAgentManagerClient()->
UnregisterAgent(
dbus::ObjectPath(kAgentPath),
base::Bind(&base::DoNothing),
base::Bind(&BluetoothDeviceChromeOS::OnUnregisterAgentError,
weak_ptr_factory_.GetWeakPtr()));
}
| 10,839
|
110,672
| 0
|
TextureManager::TextureInfo* TextureManager::GetTextureInfo(
GLuint client_id) {
TextureInfoMap::iterator it = texture_infos_.find(client_id);
return it != texture_infos_.end() ? it->second : NULL;
}
| 10,840
|
33,817
| 0
|
static bool vhost_work_seq_done(struct vhost_dev *dev, struct vhost_work *work,
unsigned seq)
{
int left;
spin_lock_irq(&dev->work_lock);
left = seq - work->done_seq;
spin_unlock_irq(&dev->work_lock);
return left <= 0;
}
| 10,841
|
49,866
| 0
|
static void spl_array_it_get_current_key(zend_object_iterator *iter, zval *key TSRMLS_DC) /* {{{ */
{
spl_array_it *iterator = (spl_array_it *)iter;
spl_array_object *object = iterator->object;
HashTable *aht = spl_array_get_hash_table(object, 0 TSRMLS_CC);
if (object->ar_flags & SPL_ARRAY_OVERLOADED_KEY) {
zend_user_it_get_current_key(iter, key TSRMLS_CC);
} else {
if (spl_array_object_verify_pos_ex(object, aht, "ArrayIterator::current(): " TSRMLS_CC) == FAILURE) {
ZVAL_NULL(key);
} else {
zend_hash_get_current_key_zval_ex(aht, key, &object->pos);
}
}
}
/* }}} */
| 10,842
|
15,792
| 0
|
static int ssl3_add_cert_to_buf(BUF_MEM *buf, unsigned long *l, X509 *x)
{
int n;
unsigned char *p;
n=i2d_X509(x,NULL);
if (!BUF_MEM_grow_clean(buf,(int)(n+(*l)+3)))
{
SSLerr(SSL_F_SSL3_ADD_CERT_TO_BUF,ERR_R_BUF_LIB);
return(-1);
}
p=(unsigned char *)&(buf->data[*l]);
l2n3(n,p);
i2d_X509(x,&p);
*l+=n+3;
return(0);
}
| 10,843
|
83,361
| 0
|
static int ssl_parse_server_ecdh_params( mbedtls_ssl_context *ssl,
unsigned char **p,
unsigned char *end )
{
int ret = MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE;
/*
* Ephemeral ECDH parameters:
*
* struct {
* ECParameters curve_params;
* ECPoint public;
* } ServerECDHParams;
*/
if( ( ret = mbedtls_ecdh_read_params( &ssl->handshake->ecdh_ctx,
(const unsigned char **) p, end ) ) != 0 )
{
MBEDTLS_SSL_DEBUG_RET( 1, ( "mbedtls_ecdh_read_params" ), ret );
return( ret );
}
if( ssl_check_server_ecdh_params( ssl ) != 0 )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message (ECDHE curve)" ) );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
}
return( ret );
}
| 10,844
|
59,046
| 0
|
static int open_handlers(void)
{
struct dirent **dirent_list;
int num_handlers;
int num_good = 0;
int i;
num_handlers = scandir(handler_path, &dirent_list, is_handler, alphasort);
if (num_handlers == -1)
return -1;
for (i = 0; i < num_handlers; i++) {
char *path;
void *handle;
int (*handler_init)(void);
int ret;
ret = asprintf(&path, "%s/%s", handler_path, dirent_list[i]->d_name);
if (ret == -1) {
tcmu_err("ENOMEM\n");
continue;
}
handle = dlopen(path, RTLD_NOW|RTLD_LOCAL);
if (!handle) {
tcmu_err("Could not open handler at %s: %s\n", path, dlerror());
free(path);
continue;
}
handler_init = dlsym(handle, "handler_init");
if (!handler_init) {
tcmu_err("dlsym failure on %s\n", path);
free(path);
continue;
}
ret = handler_init();
free(path);
if (ret == 0)
num_good++;
}
for (i = 0; i < num_handlers; i++)
free(dirent_list[i]);
free(dirent_list);
return num_good;
}
| 10,845
|
110,282
| 0
|
void Plugin::BitcodeDidTranslateContinuation(int32_t pp_error) {
ErrorInfo error_info;
bool was_successful = LoadNaClModuleContinuationIntern(&error_info);
NaClLog(4, "Entered BitcodeDidTranslateContinuation\n");
UNREFERENCED_PARAMETER(pp_error);
if (was_successful) {
ReportLoadSuccess(LENGTH_IS_NOT_COMPUTABLE,
kUnknownBytes,
kUnknownBytes);
} else {
ReportLoadError(error_info);
}
}
| 10,846
|
187,810
| 1
|
OMX_ERRORTYPE omx_vdec::get_config(OMX_IN OMX_HANDLETYPE hComp,
OMX_IN OMX_INDEXTYPE configIndex,
OMX_INOUT OMX_PTR configData)
{
(void) hComp;
OMX_ERRORTYPE eRet = OMX_ErrorNone;
if (m_state == OMX_StateInvalid) {
DEBUG_PRINT_ERROR("Get Config in Invalid State");
return OMX_ErrorInvalidState;
}
switch ((unsigned long)configIndex) {
case OMX_QcomIndexConfigInterlaced: {
OMX_QCOM_CONFIG_INTERLACETYPE *configFmt =
(OMX_QCOM_CONFIG_INTERLACETYPE *) configData;
if (configFmt->nPortIndex == 1) {
if (configFmt->nIndex == 0) {
configFmt->eInterlaceType = OMX_QCOM_InterlaceFrameProgressive;
} else if (configFmt->nIndex == 1) {
configFmt->eInterlaceType =
OMX_QCOM_InterlaceInterleaveFrameTopFieldFirst;
} else if (configFmt->nIndex == 2) {
configFmt->eInterlaceType =
OMX_QCOM_InterlaceInterleaveFrameBottomFieldFirst;
} else {
DEBUG_PRINT_ERROR("get_config: OMX_QcomIndexConfigInterlaced:"
" NoMore Interlaced formats");
eRet = OMX_ErrorNoMore;
}
} else {
DEBUG_PRINT_ERROR("get_config: Bad port index %d queried on only o/p port",
(int)configFmt->nPortIndex);
eRet = OMX_ErrorBadPortIndex;
}
break;
}
case OMX_QcomIndexQueryNumberOfVideoDecInstance: {
QOMX_VIDEO_QUERY_DECODER_INSTANCES *decoderinstances =
(QOMX_VIDEO_QUERY_DECODER_INSTANCES*)configData;
decoderinstances->nNumOfInstances = 16;
/*TODO: How to handle this case */
break;
}
case OMX_QcomIndexConfigVideoFramePackingArrangement: {
if (drv_ctx.decoder_format == VDEC_CODECTYPE_H264) {
OMX_QCOM_FRAME_PACK_ARRANGEMENT *configFmt =
(OMX_QCOM_FRAME_PACK_ARRANGEMENT *) configData;
memcpy(configFmt, &m_frame_pack_arrangement,
sizeof(OMX_QCOM_FRAME_PACK_ARRANGEMENT));
} else {
DEBUG_PRINT_ERROR("get_config: Framepack data not supported for non H264 codecs");
}
break;
}
case OMX_IndexConfigCommonOutputCrop: {
OMX_CONFIG_RECTTYPE *rect = (OMX_CONFIG_RECTTYPE *) configData;
memcpy(rect, &rectangle, sizeof(OMX_CONFIG_RECTTYPE));
DEBUG_PRINT_HIGH("get_config: crop info: L: %u, T: %u, R: %u, B: %u",
rectangle.nLeft, rectangle.nTop,
rectangle.nWidth, rectangle.nHeight);
break;
}
case OMX_QcomIndexConfigPerfLevel: {
struct v4l2_control control;
OMX_QCOM_VIDEO_CONFIG_PERF_LEVEL *perf =
(OMX_QCOM_VIDEO_CONFIG_PERF_LEVEL *)configData;
control.id = V4L2_CID_MPEG_VIDC_SET_PERF_LEVEL;
if (ioctl(drv_ctx.video_driver_fd, VIDIOC_G_CTRL, &control) < 0) {
DEBUG_PRINT_ERROR("Failed getting performance level: %d", errno);
eRet = OMX_ErrorHardware;
}
if (eRet == OMX_ErrorNone) {
switch (control.value) {
case V4L2_CID_MPEG_VIDC_PERF_LEVEL_TURBO:
perf->ePerfLevel = OMX_QCOM_PerfLevelTurbo;
break;
default:
DEBUG_PRINT_HIGH("Unknown perf level %d, reporting Nominal instead", control.value);
/* Fall through */
case V4L2_CID_MPEG_VIDC_PERF_LEVEL_NOMINAL:
perf->ePerfLevel = OMX_QCOM_PerfLevelNominal;
break;
}
}
break;
}
default: {
DEBUG_PRINT_ERROR("get_config: unknown param %d",configIndex);
eRet = OMX_ErrorBadParameter;
}
}
return eRet;
}
| 10,847
|
14,281
| 0
|
MYSQLND_METHOD_PRIVATE(mysqlnd_conn_data, dtor)(MYSQLND_CONN_DATA * conn TSRMLS_DC)
{
DBG_ENTER("mysqlnd_conn_data::dtor");
DBG_INF_FMT("conn=%llu", conn->thread_id);
conn->m->free_contents(conn TSRMLS_CC);
conn->m->free_options(conn TSRMLS_CC);
if (conn->net) {
mysqlnd_net_free(conn->net, conn->stats, conn->error_info TSRMLS_CC);
conn->net = NULL;
}
if (conn->protocol) {
mysqlnd_protocol_free(conn->protocol TSRMLS_CC);
conn->protocol = NULL;
}
if (conn->stats) {
mysqlnd_stats_end(conn->stats);
}
mnd_pefree(conn, conn->persistent);
DBG_VOID_RETURN;
}
| 10,848
|
1,701
| 0
|
static RELOC_PTRS_BEGIN(pattern2_instance_reloc_ptrs) {
RELOC_PREFIX(st_pattern_instance);
RELOC_SUPER(gs_pattern2_instance_t, st_pattern2_template, templat);
} RELOC_PTRS_END
| 10,849
|
87,165
| 0
|
void *AllocateMemoryWithTimeout (size_t size, int retryDelay, int timeout)
{
LARGE_INTEGER waitInterval;
waitInterval.QuadPart = retryDelay * -10000;
ASSERT (KeGetCurrentIrql() <= APC_LEVEL);
ASSERT (retryDelay > 0 && retryDelay <= timeout);
while (TRUE)
{
void *memory = TCalloc (size);
if (memory)
return memory;
timeout -= retryDelay;
if (timeout <= 0)
break;
KeDelayExecutionThread (KernelMode, FALSE, &waitInterval);
}
return NULL;
}
| 10,850
|
46,975
| 0
|
static int ghash_async_final(struct ahash_request *req)
{
struct ahash_request *cryptd_req = ahash_request_ctx(req);
if (!irq_fpu_usable()) {
struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
struct ghash_async_ctx *ctx = crypto_ahash_ctx(tfm);
struct cryptd_ahash *cryptd_tfm = ctx->cryptd_tfm;
memcpy(cryptd_req, req, sizeof(*req));
ahash_request_set_tfm(cryptd_req, &cryptd_tfm->base);
return crypto_ahash_final(cryptd_req);
} else {
struct shash_desc *desc = cryptd_shash_desc(cryptd_req);
return crypto_shash_final(desc, req->result);
}
}
| 10,851
|
170,127
| 0
|
void PasswordAutofillAgent::DidStartProvisionalLoad() {
std::unique_ptr<RendererSavePasswordProgressLogger> logger;
if (logging_state_active_) {
logger.reset(new RendererSavePasswordProgressLogger(this, routing_id()));
logger->LogMessage(Logger::STRING_DID_START_PROVISIONAL_LOAD_METHOD);
}
const blink::WebLocalFrame* navigated_frame = render_frame()->GetWebFrame();
if (navigated_frame->parent()) {
if (logger)
logger->LogMessage(Logger::STRING_FRAME_NOT_MAIN_FRAME);
return;
}
content::DocumentState* document_state =
content::DocumentState::FromDataSource(
navigated_frame->provisionalDataSource());
content::NavigationState* navigation_state =
document_state->navigation_state();
ui::PageTransition type = navigation_state->GetTransitionType();
if (ui::PageTransitionIsWebTriggerable(type) &&
ui::PageTransitionIsNewNavigation(type) &&
!blink::WebUserGestureIndicator::isProcessingUserGesture()) {
if (provisionally_saved_form_) {
if (logger) {
logger->LogPasswordForm(
Logger::STRING_PROVISIONALLY_SAVED_FORM_FOR_FRAME,
*provisionally_saved_form_);
}
Send(new AutofillHostMsg_PasswordFormSubmitted(
routing_id(), *provisionally_saved_form_));
provisionally_saved_form_.reset();
} else {
ScopedVector<PasswordForm> possible_submitted_forms;
blink::WebVector<blink::WebFormElement> forms;
render_frame()->GetWebFrame()->document().forms(forms);
bool password_forms_found = false;
for (size_t i = 0; i < forms.size(); ++i) {
blink::WebFormElement form_element = forms[i];
if (logger) {
LogHTMLForm(logger.get(), Logger::STRING_FORM_FOUND_ON_PAGE,
form_element);
}
possible_submitted_forms.push_back(CreatePasswordFormFromWebForm(
form_element, &nonscript_modified_values_, &form_predictions_));
}
possible_submitted_forms.push_back(
CreatePasswordFormFromUnownedInputElements(
*render_frame()->GetWebFrame(),
&nonscript_modified_values_,
&form_predictions_));
for (const PasswordForm* password_form : possible_submitted_forms) {
if (password_form && !password_form->username_value.empty() &&
FormContainsNonDefaultPasswordValue(*password_form)) {
password_forms_found = true;
if (logger) {
logger->LogPasswordForm(Logger::STRING_PASSWORD_FORM_FOUND_ON_PAGE,
*password_form);
}
Send(new AutofillHostMsg_PasswordFormSubmitted(routing_id(),
*password_form));
break;
}
}
if (!password_forms_found && logger)
logger->LogMessage(Logger::STRING_PASSWORD_FORM_NOT_FOUND_ON_PAGE);
}
}
gatekeeper_.Reset();
}
| 10,852
|
77,732
| 0
|
parse_stack_prop(const struct ofpbuf *property, struct ofpbuf *stack)
{
unsigned int len = ofpbuf_msgsize(property);
if (len > sizeof(union mf_subvalue)) {
VLOG_WARN_RL(&bad_ofmsg_rl, "NXCPT_STACK property has bad length %u",
len);
return OFPERR_OFPBPC_BAD_LEN;
}
nx_stack_push_bottom(stack, property->msg, len);
return 0;
}
| 10,853
|
1,813
| 0
|
static void jffs2_iset_acl(struct inode *inode, struct posix_acl **i_acl, struct posix_acl *acl)
{
spin_lock(&inode->i_lock);
if (*i_acl != JFFS2_ACL_NOT_CACHED)
posix_acl_release(*i_acl);
*i_acl = posix_acl_dup(acl);
spin_unlock(&inode->i_lock);
}
| 10,854
|
136,215
| 0
|
bool SerializerMarkupAccumulator::shouldIgnoreAttribute(const Attribute& attribute)
{
PageSerializer::Delegate* delegate = m_serializer->delegate();
if (delegate)
return delegate->shouldIgnoreAttribute(attribute);
return MarkupAccumulator::shouldIgnoreAttribute(attribute);
}
| 10,855
|
81,993
| 0
|
static long long ustime(void) {
struct timeval tv;
long long ust;
gettimeofday(&tv, NULL);
ust = ((long long)tv.tv_sec)*1000000;
ust += tv.tv_usec;
return ust;
}
| 10,856
|
119,402
| 0
|
void RenderThreadImpl::IdleHandler() {
bool run_in_foreground_tab = (widget_count_ > hidden_widget_count_) &&
GetContentClient()->renderer()->
RunIdleHandlerWhenWidgetsHidden();
if (run_in_foreground_tab) {
IdleHandlerInForegroundTab();
return;
}
base::allocator::ReleaseFreeMemory();
bool continue_timer = !webkit_shared_timer_suspended_;
if (!v8::V8::IdleNotification()) {
continue_timer = true;
}
if (!base::DiscardableMemory::ReduceMemoryUsage()) {
continue_timer = true;
}
if (continue_timer) {
ScheduleIdleHandler(idle_notification_delay_in_ms_ +
1000000 / (idle_notification_delay_in_ms_ + 2000));
} else {
idle_timer_.Stop();
}
FOR_EACH_OBSERVER(RenderProcessObserver, observers_, IdleNotification());
}
| 10,857
|
71,903
| 0
|
static void TIFFReadPhotoshopLayers(Image* image,const ImageInfo *image_info,
ExceptionInfo *exception)
{
const char
*option;
const StringInfo
*layer_info;
Image
*layers;
PSDInfo
info;
register ssize_t
i;
if (GetImageListLength(image) != 1)
return;
if ((image_info->number_scenes == 1) && (image_info->scene == 0))
return;
option=GetImageOption(image_info,"tiff:ignore-layers");
if (option != (const char * ) NULL)
return;
layer_info=GetImageProfile(image,"tiff:37724");
if (layer_info == (const StringInfo *) NULL)
return;
for (i=0; i < (ssize_t) layer_info->length-8; i++)
{
if (LocaleNCompare((const char *) (layer_info->datum+i),
image->endian == MSBEndian ? "8BIM" : "MIB8",4) != 0)
continue;
i+=4;
if ((LocaleNCompare((const char *) (layer_info->datum+i),
image->endian == MSBEndian ? "Layr" : "ryaL",4) == 0) ||
(LocaleNCompare((const char *) (layer_info->datum+i),
image->endian == MSBEndian ? "LMsk" : "ksML",4) == 0) ||
(LocaleNCompare((const char *) (layer_info->datum+i),
image->endian == MSBEndian ? "Lr16" : "61rL",4) == 0) ||
(LocaleNCompare((const char *) (layer_info->datum+i),
image->endian == MSBEndian ? "Lr32" : "23rL",4) == 0))
break;
}
i+=4;
if (i >= (ssize_t) (layer_info->length-8))
return;
layers=CloneImage(image,image->columns,image->rows,MagickTrue,exception);
(void) DeleteImageProfile(layers,"tiff:37724");
AttachBlob(layers->blob,layer_info->datum,layer_info->length);
SeekBlob(layers,(MagickOffsetType) i,SEEK_SET);
info.version=1;
info.columns=layers->columns;
info.rows=layers->rows;
info.channels=(unsigned short) layers->number_channels;
/* Setting the mode to a value that won't change the colorspace */
info.mode=10;
ReadPSDLayers(layers,image_info,&info,MagickFalse,exception);
DeleteImageFromList(&layers);
if (layers != (Image *) NULL)
{
SetImageArtifact(image,"tiff:has-layers","true");
AppendImageToList(&image,layers);
while (layers != (Image *) NULL)
{
SetImageArtifact(layers,"tiff:has-layers","true");
DetachBlob(layers->blob);
layers=GetNextImageInList(layers);
}
}
}
| 10,858
|
47,809
| 0
|
int snd_pcm_hw_constraint_minmax(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,
unsigned int min, unsigned int max)
{
struct snd_pcm_hw_constraints *constrs = &runtime->hw_constraints;
struct snd_interval t;
t.min = min;
t.max = max;
t.openmin = t.openmax = 0;
t.integer = 0;
return snd_interval_refine(constrs_interval(constrs, var), &t);
}
| 10,859
|
99,361
| 0
|
PrintingContext::Result PrintingContext::OnError() {
ResetSettings();
return abort_printing_ ? CANCEL : FAILED;
}
| 10,860
|
178,177
| 1
|
ft_smooth_render_generic( FT_Renderer render,
FT_GlyphSlot slot,
FT_Render_Mode mode,
const FT_Vector* origin,
FT_Render_Mode required_mode )
{
FT_Error error;
FT_Outline* outline = NULL;
FT_BBox cbox;
FT_UInt width, height, height_org, width_org, pitch;
FT_Bitmap* bitmap;
FT_Memory memory;
FT_Int hmul = mode == FT_RENDER_MODE_LCD;
FT_Int vmul = mode == FT_RENDER_MODE_LCD_V;
FT_Pos x_shift, y_shift, x_left, y_top;
FT_Raster_Params params;
/* check glyph image format */
if ( slot->format != render->glyph_format )
{
error = Smooth_Err_Invalid_Argument;
goto Exit;
}
/* check mode */
if ( mode != required_mode )
return Smooth_Err_Cannot_Render_Glyph;
outline = &slot->outline;
/* translate the outline to the new origin if needed */
if ( origin )
FT_Outline_Translate( outline, origin->x, origin->y );
/* compute the control box, and grid fit it */
FT_Outline_Get_CBox( outline, &cbox );
cbox.xMin = FT_PIX_FLOOR( cbox.xMin );
cbox.yMin = FT_PIX_FLOOR( cbox.yMin );
cbox.xMax = FT_PIX_CEIL( cbox.xMax );
cbox.yMax = FT_PIX_CEIL( cbox.yMax );
width = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 );
height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 );
bitmap = &slot->bitmap;
memory = render->root.memory;
width_org = width;
height_org = height;
/* release old bitmap buffer */
if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
{
FT_FREE( bitmap->buffer );
slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
}
/* allocate new one */
pitch = width;
if ( hmul )
{
width = width * 3;
pitch = FT_PAD_CEIL( width, 4 );
}
if ( vmul )
height *= 3;
x_shift = (FT_Int) cbox.xMin;
y_shift = (FT_Int) cbox.yMin;
x_left = (FT_Int)( cbox.xMin >> 6 );
y_top = (FT_Int)( cbox.yMax >> 6 );
#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
if ( slot->library->lcd_filter_func )
{
FT_Int extra = slot->library->lcd_extra;
if ( hmul )
{
x_shift -= 64 * ( extra >> 1 );
width += 3 * extra;
pitch = FT_PAD_CEIL( width, 4 );
x_left -= extra >> 1;
}
if ( vmul )
{
y_shift -= 64 * ( extra >> 1 );
height += 3 * extra;
y_top += extra >> 1;
}
}
#endif
#if FT_UINT_MAX > 0xFFFFU
/* Required check is ( pitch * height < FT_ULONG_MAX ), */
/* but we care realistic cases only. Always pitch <= width. */
if ( width > 0xFFFFU || height > 0xFFFFU )
{
FT_ERROR(( "ft_smooth_render_generic: glyph too large: %d x %d\n",
width, height ));
return Smooth_Err_Raster_Overflow;
}
#endif
bitmap->pixel_mode = FT_PIXEL_MODE_GRAY;
bitmap->num_grays = 256;
bitmap->width = width;
bitmap->rows = height;
bitmap->pitch = pitch;
/* translate outline to render it into the bitmap */
FT_Outline_Translate( outline, -x_shift, -y_shift );
if ( FT_ALLOC( bitmap->buffer, (FT_ULong)pitch * height ) )
goto Exit;
slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
/* set up parameters */
params.target = bitmap;
params.source = outline;
params.flags = FT_RASTER_FLAG_AA;
#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
/* implode outline if needed */
{
FT_Vector* points = outline->points;
FT_Vector* points_end = points + outline->n_points;
FT_Vector* vec;
if ( hmul )
for ( vec = points; vec < points_end; vec++ )
vec->x *= 3;
if ( vmul )
for ( vec = points; vec < points_end; vec++ )
vec->y *= 3;
}
/* render outline into the bitmap */
error = render->raster_render( render->raster, ¶ms );
/* deflate outline if needed */
{
FT_Vector* points = outline->points;
FT_Vector* points_end = points + outline->n_points;
FT_Vector* vec;
if ( hmul )
for ( vec = points; vec < points_end; vec++ )
vec->x /= 3;
if ( vmul )
for ( vec = points; vec < points_end; vec++ )
vec->y /= 3;
}
if ( slot->library->lcd_filter_func )
slot->library->lcd_filter_func( bitmap, mode, slot->library );
#else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
/* render outline into bitmap */
error = render->raster_render( render->raster, ¶ms );
/* expand it horizontally */
if ( hmul )
{
FT_Byte* line = bitmap->buffer;
FT_UInt hh;
for ( hh = height_org; hh > 0; hh--, line += pitch )
{
FT_UInt xx;
FT_Byte* end = line + width;
for ( xx = width_org; xx > 0; xx-- )
{
FT_UInt pixel = line[xx-1];
end[-3] = (FT_Byte)pixel;
end[-2] = (FT_Byte)pixel;
end[-1] = (FT_Byte)pixel;
end -= 3;
}
}
}
/* expand it vertically */
if ( vmul )
{
FT_Byte* read = bitmap->buffer + ( height - height_org ) * pitch;
FT_Byte* write = bitmap->buffer;
FT_UInt hh;
for ( hh = height_org; hh > 0; hh-- )
{
ft_memcpy( write, read, pitch );
write += pitch;
ft_memcpy( write, read, pitch );
write += pitch;
ft_memcpy( write, read, pitch );
write += pitch;
read += pitch;
}
}
#endif /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
FT_Outline_Translate( outline, x_shift, y_shift );
/*
* XXX: on 16bit system, we return an error for huge bitmap
* to prevent an overflow.
*/
if ( x_left > FT_INT_MAX || y_top > FT_INT_MAX )
return Smooth_Err_Invalid_Pixel_Size;
if ( error )
goto Exit;
slot->format = FT_GLYPH_FORMAT_BITMAP;
slot->bitmap_left = (FT_Int)x_left;
slot->bitmap_top = (FT_Int)y_top;
Exit:
if ( outline && origin )
FT_Outline_Translate( outline, -origin->x, -origin->y );
return error;
}
| 10,861
|
172,788
| 0
|
sp<IMemory> MetadataRetrieverClient::extractAlbumArt()
{
ALOGV("extractAlbumArt");
Mutex::Autolock lock(mLock);
mAlbumArt.clear();
if (mRetriever == NULL) {
ALOGE("retriever is not initialized");
return NULL;
}
MediaAlbumArt *albumArt = mRetriever->extractAlbumArt();
if (albumArt == NULL) {
ALOGE("failed to extract an album art");
return NULL;
}
size_t size = sizeof(MediaAlbumArt) + albumArt->size();
sp<MemoryHeapBase> heap = new MemoryHeapBase(size, 0, "MetadataRetrieverClient");
if (heap == NULL) {
ALOGE("failed to create MemoryDealer object");
delete albumArt;
return NULL;
}
mAlbumArt = new MemoryBase(heap, 0, size);
if (mAlbumArt == NULL) {
ALOGE("not enough memory for MediaAlbumArt size=%u", size);
delete albumArt;
return NULL;
}
MediaAlbumArt::init((MediaAlbumArt *) mAlbumArt->pointer(),
albumArt->size(), albumArt->data());
delete albumArt; // We've taken our copy.
return mAlbumArt;
}
| 10,862
|
96,295
| 0
|
nfs_update_shareopts(sa_share_impl_t impl_share, const char *resource,
const char *shareopts)
{
char *shareopts_dup;
boolean_t needs_reshare = B_FALSE;
char *old_shareopts;
FSINFO(impl_share, nfs_fstype)->active =
nfs_is_share_active(impl_share);
old_shareopts = FSINFO(impl_share, nfs_fstype)->shareopts;
if (strcmp(shareopts, "on") == 0)
shareopts = "rw";
if (FSINFO(impl_share, nfs_fstype)->active && old_shareopts != NULL &&
strcmp(old_shareopts, shareopts) != 0) {
needs_reshare = B_TRUE;
nfs_disable_share(impl_share);
}
shareopts_dup = strdup(shareopts);
if (shareopts_dup == NULL)
return (SA_NO_MEMORY);
if (old_shareopts != NULL)
free(old_shareopts);
FSINFO(impl_share, nfs_fstype)->shareopts = shareopts_dup;
if (needs_reshare)
nfs_enable_share(impl_share);
return (SA_OK);
}
| 10,863
|
180,825
| 1
|
static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
{
struct inet_sock *inet = inet_sk(sk);
struct net *net = sock_net(sk);
struct ipcm_cookie ipc;
struct rtable *rt = NULL;
struct flowi4 fl4;
int free = 0;
__be32 daddr;
__be32 saddr;
u8 tos;
int err;
struct ip_options_data opt_copy;
struct raw_frag_vec rfv;
err = -EMSGSIZE;
if (len > 0xFFFF)
goto out;
/*
* Check the flags.
*/
err = -EOPNOTSUPP;
if (msg->msg_flags & MSG_OOB) /* Mirror BSD error message */
goto out; /* compatibility */
/*
* Get and verify the address.
*/
if (msg->msg_namelen) {
DECLARE_SOCKADDR(struct sockaddr_in *, usin, msg->msg_name);
err = -EINVAL;
if (msg->msg_namelen < sizeof(*usin))
goto out;
if (usin->sin_family != AF_INET) {
pr_info_once("%s: %s forgot to set AF_INET. Fix it!\n",
__func__, current->comm);
err = -EAFNOSUPPORT;
if (usin->sin_family)
goto out;
}
daddr = usin->sin_addr.s_addr;
/* ANK: I did not forget to get protocol from port field.
* I just do not know, who uses this weirdness.
* IP_HDRINCL is much more convenient.
*/
} else {
err = -EDESTADDRREQ;
if (sk->sk_state != TCP_ESTABLISHED)
goto out;
daddr = inet->inet_daddr;
}
ipc.sockc.tsflags = sk->sk_tsflags;
ipc.addr = inet->inet_saddr;
ipc.opt = NULL;
ipc.tx_flags = 0;
ipc.ttl = 0;
ipc.tos = -1;
ipc.oif = sk->sk_bound_dev_if;
if (msg->msg_controllen) {
err = ip_cmsg_send(sk, msg, &ipc, false);
if (unlikely(err)) {
kfree(ipc.opt);
goto out;
}
if (ipc.opt)
free = 1;
}
saddr = ipc.addr;
ipc.addr = daddr;
if (!ipc.opt) {
struct ip_options_rcu *inet_opt;
rcu_read_lock();
inet_opt = rcu_dereference(inet->inet_opt);
if (inet_opt) {
memcpy(&opt_copy, inet_opt,
sizeof(*inet_opt) + inet_opt->opt.optlen);
ipc.opt = &opt_copy.opt;
}
rcu_read_unlock();
}
if (ipc.opt) {
err = -EINVAL;
/* Linux does not mangle headers on raw sockets,
* so that IP options + IP_HDRINCL is non-sense.
*/
if (inet->hdrincl)
goto done;
if (ipc.opt->opt.srr) {
if (!daddr)
goto done;
daddr = ipc.opt->opt.faddr;
}
}
tos = get_rtconn_flags(&ipc, sk);
if (msg->msg_flags & MSG_DONTROUTE)
tos |= RTO_ONLINK;
if (ipv4_is_multicast(daddr)) {
if (!ipc.oif)
ipc.oif = inet->mc_index;
if (!saddr)
saddr = inet->mc_addr;
} else if (!ipc.oif)
ipc.oif = inet->uc_index;
flowi4_init_output(&fl4, ipc.oif, sk->sk_mark, tos,
RT_SCOPE_UNIVERSE,
inet->hdrincl ? IPPROTO_RAW : sk->sk_protocol,
inet_sk_flowi_flags(sk) |
(inet->hdrincl ? FLOWI_FLAG_KNOWN_NH : 0),
daddr, saddr, 0, 0, sk->sk_uid);
if (!inet->hdrincl) {
rfv.msg = msg;
rfv.hlen = 0;
err = raw_probe_proto_opt(&rfv, &fl4);
if (err)
goto done;
}
security_sk_classify_flow(sk, flowi4_to_flowi(&fl4));
rt = ip_route_output_flow(net, &fl4, sk);
if (IS_ERR(rt)) {
err = PTR_ERR(rt);
rt = NULL;
goto done;
}
err = -EACCES;
if (rt->rt_flags & RTCF_BROADCAST && !sock_flag(sk, SOCK_BROADCAST))
goto done;
if (msg->msg_flags & MSG_CONFIRM)
goto do_confirm;
back_from_confirm:
if (inet->hdrincl)
err = raw_send_hdrinc(sk, &fl4, msg, len,
&rt, msg->msg_flags, &ipc.sockc);
else {
sock_tx_timestamp(sk, ipc.sockc.tsflags, &ipc.tx_flags);
if (!ipc.addr)
ipc.addr = fl4.daddr;
lock_sock(sk);
err = ip_append_data(sk, &fl4, raw_getfrag,
&rfv, len, 0,
&ipc, &rt, msg->msg_flags);
if (err)
ip_flush_pending_frames(sk);
else if (!(msg->msg_flags & MSG_MORE)) {
err = ip_push_pending_frames(sk, &fl4);
if (err == -ENOBUFS && !inet->recverr)
err = 0;
}
release_sock(sk);
}
done:
if (free)
kfree(ipc.opt);
ip_rt_put(rt);
out:
if (err < 0)
return err;
return len;
do_confirm:
if (msg->msg_flags & MSG_PROBE)
dst_confirm_neigh(&rt->dst, &fl4.daddr);
if (!(msg->msg_flags & MSG_PROBE) || len)
goto back_from_confirm;
err = 0;
goto done;
}
| 10,864
|
134,420
| 0
|
void TabStrip::SetImmersiveStyle(bool enable) {
if (immersive_style_ == enable)
return;
immersive_style_ = enable;
}
| 10,865
|
28,137
| 0
|
static void fill_block8_c(uint8_t *block, uint8_t value, int line_size, int h)
{
int i;
for (i = 0; i < h; i++) {
memset(block, value, 8);
block += line_size;
}
}
| 10,866
|
161,803
| 0
|
void PlatformSensorProviderLinux::OnDeviceAdded(
mojom::SensorType type,
std::unique_ptr<SensorInfoLinux> sensor_device) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (base::ContainsKey(sensor_devices_by_type_, type)) {
DVLOG(1) << "Sensor ignored. Type " << type
<< ". Node: " << sensor_device->device_node;
return;
}
sensor_devices_by_type_[type] = std::move(sensor_device);
}
| 10,867
|
63,856
| 0
|
static ssize_t f2fs_attr_store(struct kobject *kobj, struct attribute *attr,
const char *buf, size_t len)
{
struct f2fs_sb_info *sbi = container_of(kobj, struct f2fs_sb_info,
s_kobj);
struct f2fs_attr *a = container_of(attr, struct f2fs_attr, attr);
return a->store ? a->store(a, sbi, buf, len) : 0;
}
| 10,868
|
66,064
| 0
|
static int omninet_write_room(struct tty_struct *tty)
{
struct usb_serial_port *port = tty->driver_data;
struct usb_serial *serial = port->serial;
struct usb_serial_port *wport = serial->port[1];
int room = 0; /* Default: no room */
if (test_bit(0, &wport->write_urbs_free))
room = wport->bulk_out_size - OMNINET_HEADERLEN;
dev_dbg(&port->dev, "%s - returns %d\n", __func__, room);
return room;
}
| 10,869
|
70,612
| 0
|
evdns_getaddrinfo_gotresolve(int result, char type, int count,
int ttl, void *addresses, void *arg)
{
int i;
struct getaddrinfo_subrequest *req = arg;
struct getaddrinfo_subrequest *other_req;
struct evdns_getaddrinfo_request *data;
struct evutil_addrinfo *res;
struct sockaddr_in sin;
struct sockaddr_in6 sin6;
struct sockaddr *sa;
int socklen, addrlen;
void *addrp;
int err;
int user_canceled;
EVUTIL_ASSERT(req->type == DNS_IPv4_A || req->type == DNS_IPv6_AAAA);
if (req->type == DNS_IPv4_A) {
data = EVUTIL_UPCAST(req, struct evdns_getaddrinfo_request, ipv4_request);
other_req = &data->ipv6_request;
} else {
data = EVUTIL_UPCAST(req, struct evdns_getaddrinfo_request, ipv6_request);
other_req = &data->ipv4_request;
}
/** Called from evdns_base_free() with @fail_requests == 1 */
if (result != DNS_ERR_SHUTDOWN) {
EVDNS_LOCK(data->evdns_base);
if (evdns_result_is_answer(result)) {
if (req->type == DNS_IPv4_A)
++data->evdns_base->getaddrinfo_ipv4_answered;
else
++data->evdns_base->getaddrinfo_ipv6_answered;
}
user_canceled = data->user_canceled;
if (other_req->r == NULL)
data->request_done = 1;
EVDNS_UNLOCK(data->evdns_base);
} else {
data->evdns_base = NULL;
user_canceled = data->user_canceled;
}
req->r = NULL;
if (result == DNS_ERR_CANCEL && ! user_canceled) {
/* Internal cancel request from timeout or internal error.
* we already answered the user. */
if (other_req->r == NULL)
free_getaddrinfo_request(data);
return;
}
if (data->user_cb == NULL) {
/* We already answered. XXXX This shouldn't be needed; see
* comments in evdns_getaddrinfo_timeout_cb */
free_getaddrinfo_request(data);
return;
}
if (result == DNS_ERR_NONE) {
if (count == 0)
err = EVUTIL_EAI_NODATA;
else
err = 0;
} else {
err = evdns_err_to_getaddrinfo_err(result);
}
if (err) {
/* Looks like we got an error. */
if (other_req->r) {
/* The other request is still working; maybe it will
* succeed. */
/* XXXX handle failure from set_timeout */
if (result != DNS_ERR_SHUTDOWN) {
evdns_getaddrinfo_set_timeout(data->evdns_base, data);
}
data->pending_error = err;
return;
}
if (user_canceled) {
data->user_cb(EVUTIL_EAI_CANCEL, NULL, data->user_data);
} else if (data->pending_result) {
/* If we have an answer waiting, and we weren't
* canceled, ignore this error. */
add_cname_to_reply(data, data->pending_result);
data->user_cb(0, data->pending_result, data->user_data);
data->pending_result = NULL;
} else {
if (data->pending_error)
err = getaddrinfo_merge_err(err,
data->pending_error);
data->user_cb(err, NULL, data->user_data);
}
free_getaddrinfo_request(data);
return;
} else if (user_canceled) {
if (other_req->r) {
/* The other request is still working; let it hit this
* callback with EVUTIL_EAI_CANCEL callback and report
* the failure. */
return;
}
data->user_cb(EVUTIL_EAI_CANCEL, NULL, data->user_data);
free_getaddrinfo_request(data);
return;
}
/* Looks like we got some answers. We should turn them into addrinfos
* and then either queue those or return them all. */
EVUTIL_ASSERT(type == DNS_IPv4_A || type == DNS_IPv6_AAAA);
if (type == DNS_IPv4_A) {
memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
sin.sin_port = htons(data->port);
sa = (struct sockaddr *)&sin;
socklen = sizeof(sin);
addrlen = 4;
addrp = &sin.sin_addr.s_addr;
} else {
memset(&sin6, 0, sizeof(sin6));
sin6.sin6_family = AF_INET6;
sin6.sin6_port = htons(data->port);
sa = (struct sockaddr *)&sin6;
socklen = sizeof(sin6);
addrlen = 16;
addrp = &sin6.sin6_addr.s6_addr;
}
res = NULL;
for (i=0; i < count; ++i) {
struct evutil_addrinfo *ai;
memcpy(addrp, ((char*)addresses)+i*addrlen, addrlen);
ai = evutil_new_addrinfo_(sa, socklen, &data->hints);
if (!ai) {
if (other_req->r) {
evdns_cancel_request(NULL, other_req->r);
}
data->user_cb(EVUTIL_EAI_MEMORY, NULL, data->user_data);
if (res)
evutil_freeaddrinfo(res);
if (other_req->r == NULL)
free_getaddrinfo_request(data);
return;
}
res = evutil_addrinfo_append_(res, ai);
}
if (other_req->r) {
/* The other request is still in progress; wait for it */
/* XXXX handle failure from set_timeout */
evdns_getaddrinfo_set_timeout(data->evdns_base, data);
data->pending_result = res;
return;
} else {
/* The other request is done or never started; append its
* results (if any) and return them. */
if (data->pending_result) {
if (req->type == DNS_IPv4_A)
res = evutil_addrinfo_append_(res,
data->pending_result);
else
res = evutil_addrinfo_append_(
data->pending_result, res);
data->pending_result = NULL;
}
/* Call the user callback. */
add_cname_to_reply(data, res);
data->user_cb(0, res, data->user_data);
/* Free data. */
free_getaddrinfo_request(data);
}
}
| 10,870
|
96,303
| 0
|
CParaNdisTX::CParaNdisTX()
{ }
| 10,871
|
121,243
| 0
|
void HTMLInputElement::setCanReceiveDroppedFiles(bool canReceiveDroppedFiles)
{
if (m_canReceiveDroppedFiles == canReceiveDroppedFiles)
return;
m_canReceiveDroppedFiles = canReceiveDroppedFiles;
if (renderer())
renderer()->updateFromElement();
}
| 10,872
|
114,884
| 0
|
void TestingAutomationProvider::FindInPage(
Browser* browser,
DictionaryValue* args,
IPC::Message* reply_message) {
std::string error_message;
TabContentsWrapper* tab_contents =
GetTabContentsWrapperFromDict(browser, args, &error_message);
if (!tab_contents) {
AutomationJSONReply(this, reply_message).SendError(error_message);
return;
}
string16 search_string;
bool forward;
bool match_case;
bool find_next;
if (!args->GetString("search_string", &search_string)) {
AutomationJSONReply(this, reply_message).
SendError("Must include search_string string.");
return;
}
if (!args->GetBoolean("forward", &forward)) {
AutomationJSONReply(this, reply_message).
SendError("Must include forward boolean.");
return;
}
if (!args->GetBoolean("match_case", &match_case)) {
AutomationJSONReply(this, reply_message).
SendError("Must include match_case boolean.");
return;
}
if (!args->GetBoolean("find_next", &find_next)) {
AutomationJSONReply(this, reply_message).
SendError("Must include find_next boolean.");
return;
}
SendFindRequest(tab_contents->web_contents(),
true,
search_string,
forward,
match_case,
find_next,
reply_message);
}
| 10,873
|
124,483
| 0
|
void RenderBlock::addVisualOverflowFromTheme()
{
if (!style()->hasAppearance())
return;
IntRect inflatedRect = pixelSnappedBorderBoxRect();
RenderTheme::theme().adjustRepaintRect(this, inflatedRect);
addVisualOverflow(inflatedRect);
}
| 10,874
|
34,461
| 0
|
int btrfs_add_dead_root(struct btrfs_root *root)
{
spin_lock(&root->fs_info->trans_lock);
list_add(&root->root_list, &root->fs_info->dead_roots);
spin_unlock(&root->fs_info->trans_lock);
return 0;
}
| 10,875
|
23,367
| 0
|
static void encode_link(struct xdr_stream *xdr, const struct qstr *name, struct compound_hdr *hdr)
{
__be32 *p;
p = reserve_space(xdr, 8 + name->len);
*p++ = cpu_to_be32(OP_LINK);
xdr_encode_opaque(p, name->name, name->len);
hdr->nops++;
hdr->replen += decode_link_maxsz;
}
| 10,876
|
58,377
| 0
|
static void dump_instr(const char *lvl, struct pt_regs *regs)
{
unsigned long addr = instruction_pointer(regs);
const int thumb = thumb_mode(regs);
const int width = thumb ? 4 : 8;
mm_segment_t fs;
char str[sizeof("00000000 ") * 5 + 2 + 1], *p = str;
int i;
/*
* We need to switch to kernel mode so that we can use __get_user
* to safely read from kernel space. Note that we now dump the
* code first, just in case the backtrace kills us.
*/
fs = get_fs();
set_fs(KERNEL_DS);
for (i = -4; i < 1 + !!thumb; i++) {
unsigned int val, bad;
if (thumb)
bad = __get_user(val, &((u16 *)addr)[i]);
else
bad = __get_user(val, &((u32 *)addr)[i]);
if (!bad)
p += sprintf(p, i == 0 ? "(%0*x) " : "%0*x ",
width, val);
else {
p += sprintf(p, "bad PC value");
break;
}
}
printk("%sCode: %s\n", lvl, str);
set_fs(fs);
}
| 10,877
|
56,626
| 0
|
static int write_end_fn(handle_t *handle, struct buffer_head *bh)
{
int ret;
if (!buffer_mapped(bh) || buffer_freed(bh))
return 0;
set_buffer_uptodate(bh);
ret = ext4_handle_dirty_metadata(handle, NULL, bh);
clear_buffer_meta(bh);
clear_buffer_prio(bh);
return ret;
}
| 10,878
|
43,008
| 0
|
static int virtnet_restore(struct virtio_device *vdev)
{
struct virtnet_info *vi = vdev->priv;
int err, i;
err = init_vqs(vi);
if (err)
return err;
virtio_device_ready(vdev);
if (netif_running(vi->dev)) {
for (i = 0; i < vi->curr_queue_pairs; i++)
if (!try_fill_recv(vi, &vi->rq[i], GFP_KERNEL))
schedule_delayed_work(&vi->refill, 0);
for (i = 0; i < vi->max_queue_pairs; i++)
virtnet_napi_enable(&vi->rq[i]);
}
netif_device_attach(vi->dev);
rtnl_lock();
virtnet_set_queues(vi, vi->curr_queue_pairs);
rtnl_unlock();
err = register_hotcpu_notifier(&vi->nb);
if (err)
return err;
return 0;
}
| 10,879
|
182,709
| 1
|
lmp_print(netdissect_options *ndo,
register const u_char *pptr, register u_int len)
{
const struct lmp_common_header *lmp_com_header;
const struct lmp_object_header *lmp_obj_header;
const u_char *tptr,*obj_tptr;
u_int tlen,lmp_obj_len,lmp_obj_ctype,obj_tlen;
int hexdump, ret;
u_int offset;
u_int link_type;
union { /* int to float conversion buffer */
float f;
uint32_t i;
} bw;
tptr=pptr;
lmp_com_header = (const struct lmp_common_header *)pptr;
ND_TCHECK(*lmp_com_header);
/*
* Sanity checking of the header.
*/
if (LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]) != LMP_VERSION) {
ND_PRINT((ndo, "LMP version %u packet not supported",
LMP_EXTRACT_VERSION(lmp_com_header->version_res[0])));
return;
}
/* in non-verbose mode just lets print the basic Message Type*/
if (ndo->ndo_vflag < 1) {
ND_PRINT((ndo, "LMPv%u %s Message, length: %u",
LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]),
tok2str(lmp_msg_type_values, "unknown (%u)",lmp_com_header->msg_type),
len));
return;
}
/* ok they seem to want to know everything - lets fully decode it */
tlen=EXTRACT_16BITS(lmp_com_header->length);
ND_PRINT((ndo, "\n\tLMPv%u, msg-type: %s, Flags: [%s], length: %u",
LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]),
tok2str(lmp_msg_type_values, "unknown, type: %u",lmp_com_header->msg_type),
bittok2str(lmp_header_flag_values,"none",lmp_com_header->flags),
tlen));
if (tlen < sizeof(const struct lmp_common_header)) {
ND_PRINT((ndo, " (too short)"));
return;
}
if (tlen > len) {
ND_PRINT((ndo, " (too long)"));
tlen = len;
}
tptr+=sizeof(const struct lmp_common_header);
tlen-=sizeof(const struct lmp_common_header);
while(tlen>0) {
/* did we capture enough for fully decoding the object header ? */
ND_TCHECK2(*tptr, sizeof(struct lmp_object_header));
lmp_obj_header = (const struct lmp_object_header *)tptr;
lmp_obj_len=EXTRACT_16BITS(lmp_obj_header->length);
lmp_obj_ctype=(lmp_obj_header->ctype)&0x7f;
ND_PRINT((ndo, "\n\t %s Object (%u), Class-Type: %s (%u) Flags: [%snegotiable], length: %u",
tok2str(lmp_obj_values,
"Unknown",
lmp_obj_header->class_num),
lmp_obj_header->class_num,
tok2str(lmp_ctype_values,
"Unknown",
((lmp_obj_header->class_num)<<8)+lmp_obj_ctype),
lmp_obj_ctype,
(lmp_obj_header->ctype)&0x80 ? "" : "non-",
lmp_obj_len));
if (lmp_obj_len < 4) {
ND_PRINT((ndo, " (too short)"));
return;
}
if ((lmp_obj_len % 4) != 0) {
ND_PRINT((ndo, " (not a multiple of 4)"));
return;
}
obj_tptr=tptr+sizeof(struct lmp_object_header);
obj_tlen=lmp_obj_len-sizeof(struct lmp_object_header);
/* did we capture enough for fully decoding the object ? */
ND_TCHECK2(*tptr, lmp_obj_len);
hexdump=FALSE;
switch(lmp_obj_header->class_num) {
case LMP_OBJ_CC_ID:
switch(lmp_obj_ctype) {
case LMP_CTYPE_LOC:
case LMP_CTYPE_RMT:
if (obj_tlen != 4) {
ND_PRINT((ndo, " (not correct for object)"));
break;
}
ND_PRINT((ndo, "\n\t Control Channel ID: %u (0x%08x)",
EXTRACT_32BITS(obj_tptr),
EXTRACT_32BITS(obj_tptr)));
break;
default:
hexdump=TRUE;
}
break;
case LMP_OBJ_LINK_ID:
case LMP_OBJ_INTERFACE_ID:
switch(lmp_obj_ctype) {
case LMP_CTYPE_IPV4_LOC:
case LMP_CTYPE_IPV4_RMT:
if (obj_tlen != 4) {
ND_PRINT((ndo, " (not correct for object)"));
break;
}
ND_PRINT((ndo, "\n\t IPv4 Link ID: %s (0x%08x)",
ipaddr_string(ndo, obj_tptr),
EXTRACT_32BITS(obj_tptr)));
break;
case LMP_CTYPE_IPV6_LOC:
case LMP_CTYPE_IPV6_RMT:
if (obj_tlen != 16) {
ND_PRINT((ndo, " (not correct for object)"));
break;
}
ND_PRINT((ndo, "\n\t IPv6 Link ID: %s (0x%08x)",
ip6addr_string(ndo, obj_tptr),
EXTRACT_32BITS(obj_tptr)));
break;
case LMP_CTYPE_UNMD_LOC:
case LMP_CTYPE_UNMD_RMT:
if (obj_tlen != 4) {
ND_PRINT((ndo, " (not correct for object)"));
break;
}
ND_PRINT((ndo, "\n\t Link ID: %u (0x%08x)",
EXTRACT_32BITS(obj_tptr),
EXTRACT_32BITS(obj_tptr)));
break;
default:
hexdump=TRUE;
}
break;
case LMP_OBJ_MESSAGE_ID:
switch(lmp_obj_ctype) {
case LMP_CTYPE_1:
if (obj_tlen != 4) {
ND_PRINT((ndo, " (not correct for object)"));
break;
}
ND_PRINT((ndo, "\n\t Message ID: %u (0x%08x)",
EXTRACT_32BITS(obj_tptr),
EXTRACT_32BITS(obj_tptr)));
break;
case LMP_CTYPE_2:
if (obj_tlen != 4) {
ND_PRINT((ndo, " (not correct for object)"));
break;
}
ND_PRINT((ndo, "\n\t Message ID Ack: %u (0x%08x)",
EXTRACT_32BITS(obj_tptr),
EXTRACT_32BITS(obj_tptr)));
break;
default:
hexdump=TRUE;
}
break;
case LMP_OBJ_NODE_ID:
switch(lmp_obj_ctype) {
case LMP_CTYPE_LOC:
case LMP_CTYPE_RMT:
if (obj_tlen != 4) {
ND_PRINT((ndo, " (not correct for object)"));
break;
}
ND_PRINT((ndo, "\n\t Node ID: %s (0x%08x)",
ipaddr_string(ndo, obj_tptr),
EXTRACT_32BITS(obj_tptr)));
break;
default:
hexdump=TRUE;
}
break;
case LMP_OBJ_CONFIG:
switch(lmp_obj_ctype) {
case LMP_CTYPE_HELLO_CONFIG:
if (obj_tlen != 4) {
ND_PRINT((ndo, " (not correct for object)"));
break;
}
ND_PRINT((ndo, "\n\t Hello Interval: %u\n\t Hello Dead Interval: %u",
EXTRACT_16BITS(obj_tptr),
EXTRACT_16BITS(obj_tptr+2)));
break;
default:
hexdump=TRUE;
}
break;
case LMP_OBJ_HELLO:
switch(lmp_obj_ctype) {
case LMP_CTYPE_HELLO:
if (obj_tlen != 8) {
ND_PRINT((ndo, " (not correct for object)"));
break;
}
ND_PRINT((ndo, "\n\t Tx Seq: %u, Rx Seq: %u",
EXTRACT_32BITS(obj_tptr),
EXTRACT_32BITS(obj_tptr+4)));
break;
default:
hexdump=TRUE;
}
break;
case LMP_OBJ_TE_LINK:
switch(lmp_obj_ctype) {
case LMP_CTYPE_IPV4:
if (obj_tlen != 12) {
ND_PRINT((ndo, " (not correct for object)"));
break;
}
ND_PRINT((ndo, "\n\t Flags: [%s]",
bittok2str(lmp_obj_te_link_flag_values,
"none",
EXTRACT_8BITS(obj_tptr))));
ND_PRINT((ndo, "\n\t Local Link-ID: %s (0x%08x)"
"\n\t Remote Link-ID: %s (0x%08x)",
ipaddr_string(ndo, obj_tptr+4),
EXTRACT_32BITS(obj_tptr+4),
ipaddr_string(ndo, obj_tptr+8),
EXTRACT_32BITS(obj_tptr+8)));
break;
case LMP_CTYPE_IPV6:
if (obj_tlen != 36) {
ND_PRINT((ndo, " (not correct for object)"));
break;
}
ND_PRINT((ndo, "\n\t Flags: [%s]",
bittok2str(lmp_obj_te_link_flag_values,
"none",
EXTRACT_8BITS(obj_tptr))));
ND_PRINT((ndo, "\n\t Local Link-ID: %s (0x%08x)"
"\n\t Remote Link-ID: %s (0x%08x)",
ip6addr_string(ndo, obj_tptr+4),
EXTRACT_32BITS(obj_tptr+4),
ip6addr_string(ndo, obj_tptr+20),
EXTRACT_32BITS(obj_tptr+20)));
break;
case LMP_CTYPE_UNMD:
if (obj_tlen != 12) {
ND_PRINT((ndo, " (not correct for object)"));
break;
}
ND_PRINT((ndo, "\n\t Flags: [%s]",
bittok2str(lmp_obj_te_link_flag_values,
"none",
EXTRACT_8BITS(obj_tptr))));
ND_PRINT((ndo, "\n\t Local Link-ID: %u (0x%08x)"
"\n\t Remote Link-ID: %u (0x%08x)",
EXTRACT_32BITS(obj_tptr+4),
EXTRACT_32BITS(obj_tptr+4),
EXTRACT_32BITS(obj_tptr+8),
EXTRACT_32BITS(obj_tptr+8)));
break;
default:
hexdump=TRUE;
}
break;
case LMP_OBJ_DATA_LINK:
switch(lmp_obj_ctype) {
case LMP_CTYPE_IPV4:
if (obj_tlen < 12) {
ND_PRINT((ndo, " (not correct for object)"));
break;
}
ND_PRINT((ndo, "\n\t Flags: [%s]",
bittok2str(lmp_obj_data_link_flag_values,
"none",
EXTRACT_8BITS(obj_tptr))));
ND_PRINT((ndo, "\n\t Local Interface ID: %s (0x%08x)"
"\n\t Remote Interface ID: %s (0x%08x)",
ipaddr_string(ndo, obj_tptr+4),
EXTRACT_32BITS(obj_tptr+4),
ipaddr_string(ndo, obj_tptr+8),
EXTRACT_32BITS(obj_tptr+8)));
ret = lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 12, 12);
if (ret == -1)
goto trunc;
if (ret == TRUE)
hexdump=TRUE;
break;
case LMP_CTYPE_IPV6:
if (obj_tlen < 36) {
ND_PRINT((ndo, " (not correct for object)"));
break;
}
ND_PRINT((ndo, "\n\t Flags: [%s]",
bittok2str(lmp_obj_data_link_flag_values,
"none",
EXTRACT_8BITS(obj_tptr))));
ND_PRINT((ndo, "\n\t Local Interface ID: %s (0x%08x)"
"\n\t Remote Interface ID: %s (0x%08x)",
ip6addr_string(ndo, obj_tptr+4),
EXTRACT_32BITS(obj_tptr+4),
ip6addr_string(ndo, obj_tptr+20),
EXTRACT_32BITS(obj_tptr+20)));
ret = lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 36, 36);
if (ret == -1)
goto trunc;
if (ret == TRUE)
hexdump=TRUE;
break;
case LMP_CTYPE_UNMD:
if (obj_tlen < 12) {
ND_PRINT((ndo, " (not correct for object)"));
break;
}
ND_PRINT((ndo, "\n\t Flags: [%s]",
bittok2str(lmp_obj_data_link_flag_values,
"none",
EXTRACT_8BITS(obj_tptr))));
ND_PRINT((ndo, "\n\t Local Interface ID: %u (0x%08x)"
"\n\t Remote Interface ID: %u (0x%08x)",
EXTRACT_32BITS(obj_tptr+4),
EXTRACT_32BITS(obj_tptr+4),
EXTRACT_32BITS(obj_tptr+8),
EXTRACT_32BITS(obj_tptr+8)));
ret = lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 12, 12);
if (ret == -1)
goto trunc;
if (ret == TRUE)
hexdump=TRUE;
break;
default:
hexdump=TRUE;
}
break;
case LMP_OBJ_VERIFY_BEGIN:
switch(lmp_obj_ctype) {
case LMP_CTYPE_1:
if (obj_tlen != 20) {
ND_PRINT((ndo, " (not correct for object)"));
break;
}
ND_PRINT((ndo, "\n\t Flags: %s",
bittok2str(lmp_obj_begin_verify_flag_values,
"none",
EXTRACT_16BITS(obj_tptr))));
ND_PRINT((ndo, "\n\t Verify Interval: %u",
EXTRACT_16BITS(obj_tptr+2)));
ND_PRINT((ndo, "\n\t Data links: %u",
EXTRACT_32BITS(obj_tptr+4)));
ND_PRINT((ndo, "\n\t Encoding type: %s",
tok2str(gmpls_encoding_values, "Unknown", *(obj_tptr+8))));
ND_PRINT((ndo, "\n\t Verify Transport Mechanism: %u (0x%x)%s",
EXTRACT_16BITS(obj_tptr+10),
EXTRACT_16BITS(obj_tptr+10),
EXTRACT_16BITS(obj_tptr+10)&8000 ? " (Payload test messages capable)" : ""));
bw.i = EXTRACT_32BITS(obj_tptr+12);
ND_PRINT((ndo, "\n\t Transmission Rate: %.3f Mbps",bw.f*8/1000000));
ND_PRINT((ndo, "\n\t Wavelength: %u",
EXTRACT_32BITS(obj_tptr+16)));
break;
default:
hexdump=TRUE;
}
break;
case LMP_OBJ_VERIFY_BEGIN_ACK:
switch(lmp_obj_ctype) {
case LMP_CTYPE_1:
if (obj_tlen != 4) {
ND_PRINT((ndo, " (not correct for object)"));
break;
}
ND_PRINT((ndo, "\n\t Verify Dead Interval: %u"
"\n\t Verify Transport Response: %u",
EXTRACT_16BITS(obj_tptr),
EXTRACT_16BITS(obj_tptr+2)));
break;
default:
hexdump=TRUE;
}
break;
case LMP_OBJ_VERIFY_ID:
switch(lmp_obj_ctype) {
case LMP_CTYPE_1:
if (obj_tlen != 4) {
ND_PRINT((ndo, " (not correct for object)"));
break;
}
ND_PRINT((ndo, "\n\t Verify ID: %u",
EXTRACT_32BITS(obj_tptr)));
break;
default:
hexdump=TRUE;
}
break;
case LMP_OBJ_CHANNEL_STATUS:
switch(lmp_obj_ctype) {
case LMP_CTYPE_IPV4:
offset = 0;
/* Decode pairs: <Interface_ID (4 bytes), Channel_status (4 bytes)> */
while (offset+8 <= obj_tlen) {
ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)",
ipaddr_string(ndo, obj_tptr+offset),
EXTRACT_32BITS(obj_tptr+offset)));
ND_PRINT((ndo, "\n\t\t Active: %s (%u)",
(EXTRACT_32BITS(obj_tptr+offset+4)>>31) ?
"Allocated" : "Non-allocated",
(EXTRACT_32BITS(obj_tptr+offset+4)>>31)));
ND_PRINT((ndo, "\n\t\t Direction: %s (%u)",
(EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1 ?
"Transmit" : "Receive",
(EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1));
ND_PRINT((ndo, "\n\t\t Channel Status: %s (%u)",
tok2str(lmp_obj_channel_status_values,
"Unknown",
EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF),
EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF));
offset+=8;
}
break;
case LMP_CTYPE_IPV6:
offset = 0;
/* Decode pairs: <Interface_ID (16 bytes), Channel_status (4 bytes)> */
while (offset+20 <= obj_tlen) {
ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)",
ip6addr_string(ndo, obj_tptr+offset),
EXTRACT_32BITS(obj_tptr+offset)));
ND_PRINT((ndo, "\n\t\t Active: %s (%u)",
(EXTRACT_32BITS(obj_tptr+offset+16)>>31) ?
"Allocated" : "Non-allocated",
(EXTRACT_32BITS(obj_tptr+offset+16)>>31)));
ND_PRINT((ndo, "\n\t\t Direction: %s (%u)",
(EXTRACT_32BITS(obj_tptr+offset+16)>>30)&0x1 ?
"Transmit" : "Receive",
(EXTRACT_32BITS(obj_tptr+offset+16)>>30)&0x1));
ND_PRINT((ndo, "\n\t\t Channel Status: %s (%u)",
tok2str(lmp_obj_channel_status_values,
"Unknown",
EXTRACT_32BITS(obj_tptr+offset+16)&0x3FFFFFF),
EXTRACT_32BITS(obj_tptr+offset+16)&0x3FFFFFF));
offset+=20;
}
break;
case LMP_CTYPE_UNMD:
offset = 0;
/* Decode pairs: <Interface_ID (4 bytes), Channel_status (4 bytes)> */
while (offset+8 <= obj_tlen) {
ND_PRINT((ndo, "\n\t Interface ID: %u (0x%08x)",
EXTRACT_32BITS(obj_tptr+offset),
EXTRACT_32BITS(obj_tptr+offset)));
ND_PRINT((ndo, "\n\t\t Active: %s (%u)",
(EXTRACT_32BITS(obj_tptr+offset+4)>>31) ?
"Allocated" : "Non-allocated",
(EXTRACT_32BITS(obj_tptr+offset+4)>>31)));
ND_PRINT((ndo, "\n\t\t Direction: %s (%u)",
(EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1 ?
"Transmit" : "Receive",
(EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1));
ND_PRINT((ndo, "\n\t\t Channel Status: %s (%u)",
tok2str(lmp_obj_channel_status_values,
"Unknown",
EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF),
EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF));
offset+=8;
}
break;
default:
hexdump=TRUE;
}
break;
case LMP_OBJ_CHANNEL_STATUS_REQ:
switch(lmp_obj_ctype) {
case LMP_CTYPE_IPV4:
offset = 0;
while (offset+4 <= obj_tlen) {
ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)",
ipaddr_string(ndo, obj_tptr+offset),
EXTRACT_32BITS(obj_tptr+offset)));
offset+=4;
}
break;
case LMP_CTYPE_IPV6:
offset = 0;
while (offset+16 <= obj_tlen) {
ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)",
ip6addr_string(ndo, obj_tptr+offset),
EXTRACT_32BITS(obj_tptr+offset)));
offset+=16;
}
break;
case LMP_CTYPE_UNMD:
offset = 0;
while (offset+4 <= obj_tlen) {
ND_PRINT((ndo, "\n\t Interface ID: %u (0x%08x)",
EXTRACT_32BITS(obj_tptr+offset),
EXTRACT_32BITS(obj_tptr+offset)));
offset+=4;
}
break;
default:
hexdump=TRUE;
}
break;
case LMP_OBJ_ERROR_CODE:
switch(lmp_obj_ctype) {
case LMP_CTYPE_BEGIN_VERIFY_ERROR:
if (obj_tlen != 4) {
ND_PRINT((ndo, " (not correct for object)"));
break;
}
ND_PRINT((ndo, "\n\t Error Code: %s",
bittok2str(lmp_obj_begin_verify_error_values,
"none",
EXTRACT_32BITS(obj_tptr))));
break;
case LMP_CTYPE_LINK_SUMMARY_ERROR:
if (obj_tlen != 4) {
ND_PRINT((ndo, " (not correct for object)"));
break;
}
ND_PRINT((ndo, "\n\t Error Code: %s",
bittok2str(lmp_obj_link_summary_error_values,
"none",
EXTRACT_32BITS(obj_tptr))));
break;
default:
hexdump=TRUE;
}
break;
case LMP_OBJ_SERVICE_CONFIG:
switch (lmp_obj_ctype) {
case LMP_CTYPE_SERVICE_CONFIG_SP:
if (obj_tlen != 4) {
ND_PRINT((ndo, " (not correct for object)"));
break;
}
ND_PRINT((ndo, "\n\t Flags: %s",
bittok2str(lmp_obj_service_config_sp_flag_values,
"none",
EXTRACT_8BITS(obj_tptr))));
ND_PRINT((ndo, "\n\t UNI Version: %u",
EXTRACT_8BITS(obj_tptr + 1)));
break;
case LMP_CTYPE_SERVICE_CONFIG_CPSA:
if (obj_tlen != 16) {
ND_PRINT((ndo, " (not correct for object)"));
break;
}
link_type = EXTRACT_8BITS(obj_tptr);
ND_PRINT((ndo, "\n\t Link Type: %s (%u)",
tok2str(lmp_sd_service_config_cpsa_link_type_values,
"Unknown", link_type),
link_type));
switch (link_type) {
case LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SDH:
ND_PRINT((ndo, "\n\t Signal Type: %s (%u)",
tok2str(lmp_sd_service_config_cpsa_signal_type_sdh_values,
"Unknown",
EXTRACT_8BITS(obj_tptr + 1)),
EXTRACT_8BITS(obj_tptr + 1)));
break;
case LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET:
ND_PRINT((ndo, "\n\t Signal Type: %s (%u)",
tok2str(lmp_sd_service_config_cpsa_signal_type_sonet_values,
"Unknown",
EXTRACT_8BITS(obj_tptr + 1)),
EXTRACT_8BITS(obj_tptr + 1)));
break;
}
ND_PRINT((ndo, "\n\t Transparency: %s",
bittok2str(lmp_obj_service_config_cpsa_tp_flag_values,
"none",
EXTRACT_8BITS(obj_tptr + 2))));
ND_PRINT((ndo, "\n\t Contiguous Concatenation Types: %s",
bittok2str(lmp_obj_service_config_cpsa_cct_flag_values,
"none",
EXTRACT_8BITS(obj_tptr + 3))));
ND_PRINT((ndo, "\n\t Minimum NCC: %u",
EXTRACT_16BITS(obj_tptr+4)));
ND_PRINT((ndo, "\n\t Maximum NCC: %u",
EXTRACT_16BITS(obj_tptr+6)));
ND_PRINT((ndo, "\n\t Minimum NVC:%u",
EXTRACT_16BITS(obj_tptr+8)));
ND_PRINT((ndo, "\n\t Maximum NVC:%u",
EXTRACT_16BITS(obj_tptr+10)));
ND_PRINT((ndo, "\n\t Local Interface ID: %s (0x%08x)",
ipaddr_string(ndo, obj_tptr+12),
EXTRACT_32BITS(obj_tptr+12)));
break;
case LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM:
if (obj_tlen != 8) {
ND_PRINT((ndo, " (not correct for object)"));
break;
}
ND_PRINT((ndo, "\n\t Transparency Flags: %s",
bittok2str(
lmp_obj_service_config_nsa_transparency_flag_values,
"none",
EXTRACT_32BITS(obj_tptr))));
ND_PRINT((ndo, "\n\t TCM Monitoring Flags: %s",
bittok2str(
lmp_obj_service_config_nsa_tcm_flag_values,
"none",
EXTRACT_8BITS(obj_tptr + 7))));
break;
case LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY:
if (obj_tlen != 4) {
ND_PRINT((ndo, " (not correct for object)"));
break;
}
ND_PRINT((ndo, "\n\t Diversity: Flags: %s",
bittok2str(
lmp_obj_service_config_nsa_network_diversity_flag_values,
"none",
EXTRACT_8BITS(obj_tptr + 3))));
break;
default:
hexdump = TRUE;
}
break;
default:
if (ndo->ndo_vflag <= 1)
print_unknown_data(ndo,obj_tptr,"\n\t ",obj_tlen);
break;
}
/* do we want to see an additionally hexdump ? */
if (ndo->ndo_vflag > 1 || hexdump==TRUE)
print_unknown_data(ndo,tptr+sizeof(struct lmp_object_header),"\n\t ",
lmp_obj_len-sizeof(struct lmp_object_header));
tptr+=lmp_obj_len;
tlen-=lmp_obj_len;
}
return;
trunc:
ND_PRINT((ndo, "\n\t\t packet exceeded snapshot"));
}
| 10,880
|
87,894
| 0
|
PAM_EXTERN int pam_sm_acct_mgmt(pam_handle_t * pamh, int flags, int argc,
const char **argv)
{
/* if the user has been authenticated (precondition of this call), then
* everything is OK. Yes, we explicitly don't want to check CRLs, OCSP or
* exparation of certificates (use pam_pkcs11 for this). */
return PAM_SUCCESS;
}
| 10,881
|
151,941
| 0
|
void FileSelectionCanceled() {
proxy_ = nullptr;
if (!render_frame_host_)
return;
std::move(callback_).Run(nullptr);
}
| 10,882
|
56,982
| 0
|
static void fuse_writepage_finish(struct fuse_conn *fc, struct fuse_req *req)
{
struct inode *inode = req->inode;
struct fuse_inode *fi = get_fuse_inode(inode);
struct backing_dev_info *bdi = inode_to_bdi(inode);
int i;
list_del(&req->writepages_entry);
for (i = 0; i < req->num_pages; i++) {
dec_wb_stat(&bdi->wb, WB_WRITEBACK);
dec_zone_page_state(req->pages[i], NR_WRITEBACK_TEMP);
wb_writeout_inc(&bdi->wb);
}
wake_up(&fi->page_waitq);
}
| 10,883
|
61,522
| 0
|
static void RemoveResolutionFromResourceBlock(StringInfo *bim_profile)
{
register const unsigned char
*p;
size_t
length;
unsigned char
*datum;
unsigned int
count,
long_sans;
unsigned short
id,
short_sans;
length=GetStringInfoLength(bim_profile);
if (length < 16)
return;
datum=GetStringInfoDatum(bim_profile);
for (p=datum; (p >= datum) && (p < (datum+length-16)); )
{
register unsigned char
*q;
ssize_t
cnt;
q=(unsigned char *) p;
if (LocaleNCompare((const char *) p,"8BIM",4) != 0)
return;
p=PushLongPixel(MSBEndian,p,&long_sans);
p=PushShortPixel(MSBEndian,p,&id);
p=PushShortPixel(MSBEndian,p,&short_sans);
p=PushLongPixel(MSBEndian,p,&count);
cnt=PSDQuantum(count);
if (cnt < 0)
return;
if ((id == 0x000003ed) && (cnt < (ssize_t) (length-12)))
{
(void) CopyMagickMemory(q,q+cnt+12,length-(cnt+12)-(q-datum));
SetStringInfoLength(bim_profile,length-(cnt+12));
break;
}
p+=count;
if ((count & 0x01) != 0)
p++;
}
}
| 10,884
|
24,182
| 0
|
ar6000_dset_open_req(
void *context,
u32 id,
u32 targHandle,
u32 targReplyFn,
u32 targReplyArg)
{
}
| 10,885
|
123,140
| 0
|
void RenderWidgetHostViewAndroid::UnlockMouse() {
NOTIMPLEMENTED();
}
| 10,886
|
175,142
| 0
|
void wifi_socket_set_local_port(struct nl_sock *sock, uint32_t port)
{
uint32_t pid = getpid() & 0x3FFFFF;
nl_socket_set_local_port(sock, pid + (port << 22));
}
| 10,887
|
72,740
| 0
|
static void jas_icctxtdesc_destroy(jas_iccattrval_t *attrval)
{
jas_icctxtdesc_t *txtdesc = &attrval->data.txtdesc;
if (txtdesc->ascdata) {
jas_free(txtdesc->ascdata);
txtdesc->ascdata = 0;
}
if (txtdesc->ucdata) {
jas_free(txtdesc->ucdata);
txtdesc->ucdata = 0;
}
}
| 10,888
|
47,561
| 0
|
static int __init ux500_hash_mod_init(void)
{
klist_init(&driver_data.device_list, NULL, NULL);
/* Initialize the semaphore to 0 devices (locked state) */
sema_init(&driver_data.device_allocation, 0);
return platform_driver_register(&hash_driver);
}
| 10,889
|
58,833
| 0
|
void remove_from_page_cache(struct page *page)
{
struct address_space *mapping = page->mapping;
BUG_ON(!PageLocked(page));
write_lock_irq(&mapping->tree_lock);
__remove_from_page_cache(page);
write_unlock_irq(&mapping->tree_lock);
}
| 10,890
|
39,502
| 0
|
do_bottom_half_rx(struct fst_card_info *card)
{
struct fst_port_info *port;
int pi;
int rx_count = 0;
/* Check for rx completions on all ports on this card */
dbg(DBG_RX, "do_bottom_half_rx\n");
for (pi = 0, port = card->ports; pi < card->nports; pi++, port++) {
if (!port->run)
continue;
while (!(FST_RDB(card, rxDescrRing[pi][port->rxpos].bits)
& DMA_OWN) && !(card->dmarx_in_progress)) {
if (rx_count > fst_max_reads) {
/*
* Don't spend forever in receive processing
* Schedule another event
*/
fst_q_work_item(&fst_work_intq, card->card_no);
tasklet_schedule(&fst_int_task);
break; /* Leave the loop */
}
fst_intr_rx(card, port);
rx_count++;
}
}
}
| 10,891
|
167,582
| 0
|
void SiteInstanceImpl::AddObserver(Observer* observer) {
observers_.AddObserver(observer);
}
| 10,892
|
7,379
| 0
|
check_format(struct magic_set *ms, struct magic *m)
{
char *ptr;
for (ptr = m->desc; *ptr; ptr++)
if (*ptr == '%')
break;
if (*ptr == '\0') {
/* No format string; ok */
return 1;
}
assert(file_nformats == file_nnames);
if (m->type >= file_nformats) {
file_magwarn(ms, "Internal error inconsistency between "
"m->type and format strings");
return -1;
}
if (file_formats[m->type] == FILE_FMT_NONE) {
file_magwarn(ms, "No format string for `%s' with description "
"`%s'", m->desc, file_names[m->type]);
return -1;
}
ptr++;
if (check_format_type(ptr, file_formats[m->type]) == -1) {
/*
* TODO: this error message is unhelpful if the format
* string is not one character long
*/
file_magwarn(ms, "Printf format `%c' is not valid for type "
"`%s' in description `%s'", *ptr ? *ptr : '?',
file_names[m->type], m->desc);
return -1;
}
for (; *ptr; ptr++) {
if (*ptr == '%') {
file_magwarn(ms,
"Too many format strings (should have at most one) "
"for `%s' with description `%s'",
file_names[m->type], m->desc);
return -1;
}
}
return 0;
}
| 10,893
|
118,886
| 0
|
WebContentsImpl* WebContentsImpl::GetCreatedWindow(int route_id) {
PendingContents::iterator iter = pending_contents_.find(route_id);
if (iter == pending_contents_.end()) {
return NULL;
}
WebContentsImpl* new_contents = iter->second;
pending_contents_.erase(route_id);
RemoveDestructionObserver(new_contents);
if (new_contents->GetRenderProcessHost()->IsGuest())
return new_contents;
if (!new_contents->GetRenderProcessHost()->HasConnection() ||
!new_contents->GetRenderViewHost()->GetView())
return NULL;
static_cast<RenderViewHostImpl*>(new_contents->GetRenderViewHost())->Init();
return new_contents;
}
| 10,894
|
55,426
| 0
|
static void flush_tlb_func(void *info)
{
struct flush_tlb_info *f = info;
inc_irq_stat(irq_tlb_count);
if (f->flush_mm != this_cpu_read(cpu_tlbstate.active_mm))
return;
if (!f->flush_end)
f->flush_end = f->flush_start + PAGE_SIZE;
count_vm_tlb_event(NR_TLB_REMOTE_FLUSH_RECEIVED);
if (this_cpu_read(cpu_tlbstate.state) == TLBSTATE_OK) {
if (f->flush_end == TLB_FLUSH_ALL) {
local_flush_tlb();
trace_tlb_flush(TLB_REMOTE_SHOOTDOWN, TLB_FLUSH_ALL);
} else {
unsigned long addr;
unsigned long nr_pages =
(f->flush_end - f->flush_start) / PAGE_SIZE;
addr = f->flush_start;
while (addr < f->flush_end) {
__flush_tlb_single(addr);
addr += PAGE_SIZE;
}
trace_tlb_flush(TLB_REMOTE_SHOOTDOWN, nr_pages);
}
} else
leave_mm(smp_processor_id());
}
| 10,895
|
128,395
| 0
|
void RenderLayerScrollableArea::destroyScrollbar(ScrollbarOrientation orientation)
{
RefPtr<Scrollbar>& scrollbar = orientation == HorizontalScrollbar ? m_hBar : m_vBar;
if (!scrollbar)
return;
if (!scrollbar->isCustomScrollbar())
willRemoveScrollbar(scrollbar.get(), orientation);
scrollbar->removeFromParent();
scrollbar->disconnectFromScrollableArea();
scrollbar = nullptr;
}
| 10,896
|
53,648
| 0
|
static ssize_t ndp_to_end_store(struct device *d, struct device_attribute *attr, const char *buf, size_t len)
{
struct usbnet *dev = netdev_priv(to_net_dev(d));
struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0];
bool enable;
if (strtobool(buf, &enable))
return -EINVAL;
/* no change? */
if (enable == (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END))
return len;
if (enable && !ctx->delayed_ndp16) {
ctx->delayed_ndp16 = kzalloc(ctx->max_ndp_size, GFP_KERNEL);
if (!ctx->delayed_ndp16)
return -ENOMEM;
}
/* flush pending data before changing flag */
netif_tx_lock_bh(dev->net);
usbnet_start_xmit(NULL, dev->net);
spin_lock_bh(&ctx->mtx);
if (enable)
ctx->drvflags |= CDC_NCM_FLAG_NDP_TO_END;
else
ctx->drvflags &= ~CDC_NCM_FLAG_NDP_TO_END;
spin_unlock_bh(&ctx->mtx);
netif_tx_unlock_bh(dev->net);
return len;
}
| 10,897
|
127,507
| 0
|
void skip_input_data(j_decompress_ptr jd, long num_bytes)
{
decoder_source_mgr *src = (decoder_source_mgr *)jd->src;
src->decoder->skipBytes(num_bytes);
}
| 10,898
|
92,549
| 0
|
static inline enum fbq_type fbq_classify_rq(struct rq *rq)
{
if (rq->nr_running > rq->nr_numa_running)
return regular;
if (rq->nr_running > rq->nr_preferred_running)
return remote;
return all;
}
| 10,899
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.