idx
int64
func
string
target
int64
289,246
static int snd_pcm_oss_capture_ready(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; if (atomic_read(&substream->mmap_count)) return runtime->oss.prev_hw_ptr_period != get_hw_ptr_period(runtime); else return snd_pcm_capture_avail(runtime) >= runtime->oss.period_frames; }
0
513,312
static bool sort_and_filter_keyuse(THD *thd, DYNAMIC_ARRAY *keyuse, bool skip_unprefixed_keyparts) { KEYUSE key_end, *prev, *save_pos, *use; uint found_eq_constant, i; DBUG_ASSERT(keyuse->elements); my_qsort(keyuse->buffer, keyuse->elements, sizeof(KEYUSE), (qsort_cmp) sort_keyuse); bzero((char*) &key_end, sizeof(key_end)); /* Add for easy testing */ if (insert_dynamic(keyuse, (uchar*) &key_end)) return TRUE; if (optimizer_flag(thd, OPTIMIZER_SWITCH_DERIVED_WITH_KEYS)) generate_derived_keys(keyuse); use= save_pos= dynamic_element(keyuse,0,KEYUSE*); prev= &key_end; found_eq_constant= 0; for (i=0 ; i < keyuse->elements-1 ; i++,use++) { if (!use->is_for_hash_join()) { if (!(use->used_tables & ~OUTER_REF_TABLE_BIT) && use->optimize != KEY_OPTIMIZE_REF_OR_NULL) use->table->const_key_parts[use->key]|= use->keypart_map; if (use->keypart != FT_KEYPART) { if (use->key == prev->key && use->table == prev->table) { if ((prev->keypart+1 < use->keypart && skip_unprefixed_keyparts) || (prev->keypart == use->keypart && found_eq_constant)) continue; /* remove */ } else if (use->keypart != 0 && skip_unprefixed_keyparts) continue; /* remove - first found must be 0 */ } prev= use; found_eq_constant= !use->used_tables; use->table->reginfo.join_tab->checked_keys.set_bit(use->key); } /* Old gcc used a memcpy(), which is undefined if save_pos==use: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19410 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39480 This also disables a valgrind warning, so better to have the test. */ if (save_pos != use) *save_pos= *use; /* Save ptr to first use */ if (!use->table->reginfo.join_tab->keyuse) use->table->reginfo.join_tab->keyuse= save_pos; save_pos++; } i= (uint) (save_pos-(KEYUSE*) keyuse->buffer); (void) set_dynamic(keyuse,(uchar*) &key_end,i); keyuse->elements= i; return FALSE; }
0
221,166
GF_Err gf_odf_tx3g_write(GF_TextSampleDescriptor *a, u8 **outData, u32 *outSize) { u32 j; void gpp_write_rgba(GF_BitStream *bs, u32 col); void gpp_write_box(GF_BitStream *bs, GF_BoxRecord *rec); void gpp_write_style(GF_BitStream *bs, GF_StyleRecord *rec); GF_BitStream *bs = gf_bs_new(NULL, 0, GF_BITSTREAM_WRITE); gf_bs_write_u8(bs, a->horiz_justif); gf_bs_write_u8(bs, a->vert_justif); gpp_write_rgba(bs, a->back_color); gpp_write_box(bs, &a->default_pos); gpp_write_style(bs, &a->default_style); gf_bs_write_u16(bs, a->font_count); for (j=0; j<a->font_count; j++) { gf_bs_write_u16(bs, a->fonts[j].fontID); if (a->fonts[j].fontName) { u32 len = (u32) strlen(a->fonts[j].fontName); gf_bs_write_u8(bs, len); gf_bs_write_data(bs, a->fonts[j].fontName, len); } else { gf_bs_write_u8(bs, 0); } } gf_bs_get_content(bs, outData, outSize); gf_bs_del(bs); return GF_OK; }
0
512,858
Item* Item_equal::get_first(JOIN_TAB *context, Item *field_item) { Item_equal_fields_iterator it(*this); Item *item; if (!field_item) return (it++); Field *field= ((Item_field *) (field_item->real_item()))->field; /* Of all equal fields, return the first one we can use. Normally, this is the field which belongs to the table that is the first in the join order. There is one exception to this: When semi-join materialization strategy is used, and the given field belongs to a table within the semi-join nest, we must pick the first field in the semi-join nest. Example: suppose we have a join order: ot1 ot2 SJ-Mat(it1 it2 it3) ot3 and equality ot2.col = it1.col = it2.col If we're looking for best substitute for 'it2.col', we should pick it1.col and not ot2.col. eliminate_item_equal() also has code that deals with equality substitution in presence of SJM nests. */ TABLE_LIST *emb_nest; if (context != NO_PARTICULAR_TAB) emb_nest= context->emb_sj_nest; else emb_nest= field->table->pos_in_table_list->embedding; if (emb_nest && emb_nest->sj_mat_info && emb_nest->sj_mat_info->is_used) { /* It's a field from an materialized semi-join. We can substitute it for - a constant item - a field from the same semi-join Find the first of such items: */ while ((item= it++)) { if (item->const_item() || it.get_curr_field()->table->pos_in_table_list->embedding == emb_nest) { /* If we found given field then return NULL to avoid unnecessary substitution. */ return (item != field_item) ? item : NULL; } } } else { /* The field is not in SJ-Materialization nest. We must return the first field in the join order. The field may be inside a semi-join nest, i.e a join order may look like this: SJ-Mat(it1 it2) ot1 ot2 where we're looking what to substitute ot2.col for. In this case we must still return it1.col, here's a proof why: First let's note that either it1.col or it2.col participates in subquery's IN-equality. It can't be otherwise, because materialization is only applicable to uncorrelated subqueries, so the only way we could infer "it1.col=ot1.col" is from the IN-equality. Ok, so IN-eqality has it1.col or it2.col on its inner side. it1.col is first such item in the join order, so it's not possible for SJ-Mat to be SJ-Materialization-lookup, it is SJ-Materialization-Scan. The scan part of this strategy will unpack value of it1.col=it2.col into it1.col (that's the first equal item inside the subquery), and we'll be able to get it from there. qed. */ return equal_items.head(); } // Shouldn't get here. DBUG_ASSERT(0); return NULL; }
0
299,900
local_scan_init(void) { #ifndef LOCAL_SCAN_HAS_OPTIONS log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN, "local_scan() options not supported: " "(LOCAL_SCAN_HAS_OPTIONS not defined in Local/Makefile)"); #else uschar *p; while ((p = get_config_line()) != NULL) { (void) readconf_handle_option(p, local_scan_options, local_scan_options_count, NULL, US"local_scan option \"%s\" unknown"); } #endif }
0
220,816
inline int SubscriptToIndex(const NdArrayDesc<5>& desc, int indexes[5]) { return indexes[0] * desc.strides[0] + indexes[1] * desc.strides[1] + indexes[2] * desc.strides[2] + indexes[3] * desc.strides[3] + indexes[4] * desc.strides[4]; }
0
244,113
GF_Err pcmC_box_size(GF_Box *s) { s->size += 2; return GF_OK; }
0
210,669
static Image *ReadBMPImage(const ImageInfo *image_info,ExceptionInfo *exception) { BMPInfo bmp_info; Image *image; IndexPacket index; MagickBooleanType status; MagickOffsetType offset, start_position; MemoryInfo *pixel_info; register IndexPacket *indexes; register PixelPacket *q; register ssize_t i, x; register unsigned char *p; size_t bit, bytes_per_line, length; ssize_t count, y; unsigned char magick[12], *pixels; unsigned int blue, green, offset_bits, red; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); image=AcquireImage(image_info); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } /* Determine if this a BMP file. */ (void) memset(&bmp_info,0,sizeof(bmp_info)); bmp_info.ba_offset=0; start_position=0; offset_bits=0; count=ReadBlob(image,2,magick); if (count != 2) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); do { LongPixelPacket shift; PixelPacket quantum_bits; /* Verify BMP identifier. */ if (bmp_info.ba_offset == 0) start_position=TellBlob(image)-2; bmp_info.ba_offset=0; while (LocaleNCompare((char *) magick,"BA",2) == 0) { bmp_info.file_size=ReadBlobLSBLong(image); bmp_info.ba_offset=ReadBlobLSBLong(image); bmp_info.offset_bits=ReadBlobLSBLong(image); count=ReadBlob(image,2,magick); if (count != 2) break; } if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule()," Magick: %c%c", magick[0],magick[1]); if ((count != 2) || ((LocaleNCompare((char *) magick,"BM",2) != 0) && (LocaleNCompare((char *) magick,"CI",2) != 0))) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); bmp_info.file_size=ReadBlobLSBLong(image); (void) ReadBlobLSBLong(image); if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " File_size in header: %u bytes",bmp_info.file_size); bmp_info.offset_bits=ReadBlobLSBLong(image); bmp_info.size=ReadBlobLSBLong(image); if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule()," BMP size: %u", bmp_info.size); if (bmp_info.size == 12) { /* OS/2 BMP image file. */ (void) CopyMagickString(image->magick,"BMP2",MaxTextExtent); bmp_info.width=(ssize_t) ((short) ReadBlobLSBShort(image)); bmp_info.height=(ssize_t) ((short) ReadBlobLSBShort(image)); bmp_info.planes=ReadBlobLSBShort(image); bmp_info.bits_per_pixel=ReadBlobLSBShort(image); bmp_info.x_pixels=0; bmp_info.y_pixels=0; bmp_info.number_colors=0; bmp_info.compression=BI_RGB; bmp_info.image_size=0; bmp_info.alpha_mask=0; if (image->debug != MagickFalse) { (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Format: OS/2 Bitmap"); (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Geometry: %.20gx%.20g",(double) bmp_info.width,(double) bmp_info.height); } } else { /* Microsoft Windows BMP image file. */ if (bmp_info.size < 40) ThrowReaderException(CorruptImageError,"NonOS2HeaderSizeError"); bmp_info.width=(ssize_t) ReadBlobLSBSignedLong(image); bmp_info.height=(ssize_t) ReadBlobLSBSignedLong(image); bmp_info.planes=ReadBlobLSBShort(image); bmp_info.bits_per_pixel=ReadBlobLSBShort(image); bmp_info.compression=ReadBlobLSBLong(image); bmp_info.image_size=ReadBlobLSBLong(image); bmp_info.x_pixels=ReadBlobLSBLong(image); bmp_info.y_pixels=ReadBlobLSBLong(image); bmp_info.number_colors=ReadBlobLSBLong(image); bmp_info.colors_important=ReadBlobLSBLong(image); if (image->debug != MagickFalse) { (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Format: MS Windows bitmap"); (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Geometry: %.20gx%.20g",(double) bmp_info.width,(double) bmp_info.height); (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Bits per pixel: %.20g",(double) bmp_info.bits_per_pixel); switch (bmp_info.compression) { case BI_RGB: { (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Compression: BI_RGB"); break; } case BI_RLE4: { (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Compression: BI_RLE4"); break; } case BI_RLE8: { (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Compression: BI_RLE8"); break; } case BI_BITFIELDS: { (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Compression: BI_BITFIELDS"); break; } case BI_PNG: { (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Compression: BI_PNG"); break; } case BI_JPEG: { (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Compression: BI_JPEG"); break; } default: { (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Compression: UNKNOWN (%u)",bmp_info.compression); } } (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Number of colors: %u",bmp_info.number_colors); } bmp_info.red_mask=ReadBlobLSBLong(image); bmp_info.green_mask=ReadBlobLSBLong(image); bmp_info.blue_mask=ReadBlobLSBLong(image); if (bmp_info.size > 40) { double gamma; /* Read color management information. */ bmp_info.alpha_mask=ReadBlobLSBLong(image); bmp_info.colorspace=ReadBlobLSBSignedLong(image); /* Decode 2^30 fixed point formatted CIE primaries. */ # define BMP_DENOM ((double) 0x40000000) bmp_info.red_primary.x=(double) ReadBlobLSBLong(image)/BMP_DENOM; bmp_info.red_primary.y=(double) ReadBlobLSBLong(image)/BMP_DENOM; bmp_info.red_primary.z=(double) ReadBlobLSBLong(image)/BMP_DENOM; bmp_info.green_primary.x=(double) ReadBlobLSBLong(image)/BMP_DENOM; bmp_info.green_primary.y=(double) ReadBlobLSBLong(image)/BMP_DENOM; bmp_info.green_primary.z=(double) ReadBlobLSBLong(image)/BMP_DENOM; bmp_info.blue_primary.x=(double) ReadBlobLSBLong(image)/BMP_DENOM; bmp_info.blue_primary.y=(double) ReadBlobLSBLong(image)/BMP_DENOM; bmp_info.blue_primary.z=(double) ReadBlobLSBLong(image)/BMP_DENOM; gamma=bmp_info.red_primary.x+bmp_info.red_primary.y+ bmp_info.red_primary.z; gamma=PerceptibleReciprocal(gamma); bmp_info.red_primary.x*=gamma; bmp_info.red_primary.y*=gamma; image->chromaticity.red_primary.x=bmp_info.red_primary.x; image->chromaticity.red_primary.y=bmp_info.red_primary.y; gamma=bmp_info.green_primary.x+bmp_info.green_primary.y+ bmp_info.green_primary.z; gamma=PerceptibleReciprocal(gamma); bmp_info.green_primary.x*=gamma; bmp_info.green_primary.y*=gamma; image->chromaticity.green_primary.x=bmp_info.green_primary.x; image->chromaticity.green_primary.y=bmp_info.green_primary.y; gamma=bmp_info.blue_primary.x+bmp_info.blue_primary.y+ bmp_info.blue_primary.z; gamma=PerceptibleReciprocal(gamma); bmp_info.blue_primary.x*=gamma; bmp_info.blue_primary.y*=gamma; image->chromaticity.blue_primary.x=bmp_info.blue_primary.x; image->chromaticity.blue_primary.y=bmp_info.blue_primary.y; /* Decode 16^16 fixed point formatted gamma_scales. */ bmp_info.gamma_scale.x=(double) ReadBlobLSBLong(image)/0x10000; bmp_info.gamma_scale.y=(double) ReadBlobLSBLong(image)/0x10000; bmp_info.gamma_scale.z=(double) ReadBlobLSBLong(image)/0x10000; /* Compute a single gamma from the BMP 3-channel gamma. */ image->gamma=(bmp_info.gamma_scale.x+bmp_info.gamma_scale.y+ bmp_info.gamma_scale.z)/3.0; } else (void) CopyMagickString(image->magick,"BMP3",MaxTextExtent); if (bmp_info.size > 108) { size_t intent; /* Read BMP Version 5 color management information. */ intent=ReadBlobLSBLong(image); switch ((int) intent) { case LCS_GM_BUSINESS: { image->rendering_intent=SaturationIntent; break; } case LCS_GM_GRAPHICS: { image->rendering_intent=RelativeIntent; break; } case LCS_GM_IMAGES: { image->rendering_intent=PerceptualIntent; break; } case LCS_GM_ABS_COLORIMETRIC: { image->rendering_intent=AbsoluteIntent; break; } } (void) ReadBlobLSBLong(image); /* Profile data */ (void) ReadBlobLSBLong(image); /* Profile size */ (void) ReadBlobLSBLong(image); /* Reserved byte */ } } if ((MagickSizeType) bmp_info.file_size > GetBlobSize(image)) (void) ThrowMagickException(exception,GetMagickModule(),CorruptImageError, "LengthAndFilesizeDoNotMatch","`%s'",image->filename); else if ((MagickSizeType) bmp_info.file_size < GetBlobSize(image)) (void) ThrowMagickException(exception,GetMagickModule(), CorruptImageWarning,"LengthAndFilesizeDoNotMatch","`%s'", image->filename); if (bmp_info.width <= 0) ThrowReaderException(CorruptImageError,"NegativeOrZeroImageSize"); if (bmp_info.height == 0) ThrowReaderException(CorruptImageError,"NegativeOrZeroImageSize"); if (bmp_info.planes != 1) ThrowReaderException(CorruptImageError,"StaticPlanesValueNotEqualToOne"); if ((bmp_info.bits_per_pixel != 1) && (bmp_info.bits_per_pixel != 4) && (bmp_info.bits_per_pixel != 8) && (bmp_info.bits_per_pixel != 16) && (bmp_info.bits_per_pixel != 24) && (bmp_info.bits_per_pixel != 32)) ThrowReaderException(CorruptImageError,"UnrecognizedBitsPerPixel"); if (bmp_info.bits_per_pixel < 16 && bmp_info.number_colors > (1U << bmp_info.bits_per_pixel)) ThrowReaderException(CorruptImageError,"UnrecognizedNumberOfColors"); if ((bmp_info.compression == 1) && (bmp_info.bits_per_pixel != 8)) ThrowReaderException(CorruptImageError,"UnrecognizedBitsPerPixel"); if ((bmp_info.compression == 2) && (bmp_info.bits_per_pixel != 4)) ThrowReaderException(CorruptImageError,"UnrecognizedBitsPerPixel"); if ((bmp_info.compression == 3) && (bmp_info.bits_per_pixel < 16)) ThrowReaderException(CorruptImageError,"UnrecognizedBitsPerPixel"); switch (bmp_info.compression) { case BI_RGB: image->compression=NoCompression; break; case BI_RLE8: case BI_RLE4: image->compression=RLECompression; break; case BI_BITFIELDS: break; case BI_JPEG: ThrowReaderException(CoderError,"JPEGCompressNotSupported"); case BI_PNG: ThrowReaderException(CoderError,"PNGCompressNotSupported"); default: ThrowReaderException(CorruptImageError,"UnrecognizedImageCompression"); } image->columns=(size_t) MagickAbsoluteValue(bmp_info.width); image->rows=(size_t) MagickAbsoluteValue(bmp_info.height); image->depth=bmp_info.bits_per_pixel <= 8 ? bmp_info.bits_per_pixel : 8; image->matte=((bmp_info.alpha_mask != 0) && (bmp_info.compression == BI_BITFIELDS)) ? MagickTrue : MagickFalse; if (bmp_info.bits_per_pixel < 16) { size_t one; image->storage_class=PseudoClass; image->colors=bmp_info.number_colors; one=1; if (image->colors == 0) image->colors=one << bmp_info.bits_per_pixel; } image->x_resolution=(double) bmp_info.x_pixels/100.0; image->y_resolution=(double) bmp_info.y_pixels/100.0; image->units=PixelsPerCentimeterResolution; if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0)) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) break; status=SetImageExtent(image,image->columns,image->rows); if (status == MagickFalse) { InheritException(exception,&image->exception); return(DestroyImageList(image)); } if (image->storage_class == PseudoClass) { unsigned char *bmp_colormap; size_t packet_size; /* Read BMP raster colormap. */ if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Reading colormap of %.20g colors",(double) image->colors); if (AcquireImageColormap(image,image->colors) == MagickFalse) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); bmp_colormap=(unsigned char *) AcquireQuantumMemory((size_t) image->colors,4*sizeof(*bmp_colormap)); if (bmp_colormap == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); if ((bmp_info.size == 12) || (bmp_info.size == 64)) packet_size=3; else packet_size=4; offset=SeekBlob(image,start_position+14+bmp_info.size,SEEK_SET); if (offset < 0) { bmp_colormap=(unsigned char *) RelinquishMagickMemory(bmp_colormap); ThrowReaderException(CorruptImageError,"ImproperImageHeader"); } count=ReadBlob(image,packet_size*image->colors,bmp_colormap); if (count != (ssize_t) (packet_size*image->colors)) { bmp_colormap=(unsigned char *) RelinquishMagickMemory(bmp_colormap); ThrowReaderException(CorruptImageError, "InsufficientImageDataInFile"); } p=bmp_colormap; for (i=0; i < (ssize_t) image->colors; i++) { image->colormap[i].blue=ScaleCharToQuantum(*p++); image->colormap[i].green=ScaleCharToQuantum(*p++); image->colormap[i].red=ScaleCharToQuantum(*p++); if (packet_size == 4) p++; } bmp_colormap=(unsigned char *) RelinquishMagickMemory(bmp_colormap); } /* Read image data. */ if (bmp_info.offset_bits == offset_bits) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); offset_bits=bmp_info.offset_bits; offset=SeekBlob(image,start_position+bmp_info.offset_bits,SEEK_SET); if (offset < 0) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); if (bmp_info.compression == BI_RLE4) bmp_info.bits_per_pixel<<=1; bytes_per_line=4*((image->columns*bmp_info.bits_per_pixel+31)/32); length=(size_t) bytes_per_line*image->rows; if (((MagickSizeType) length/8) > GetBlobSize(image)) ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile"); if ((bmp_info.compression == BI_RGB) || (bmp_info.compression == BI_BITFIELDS)) { pixel_info=AcquireVirtualMemory(image->rows,MagickMax(bytes_per_line, image->columns+256UL)*sizeof(*pixels)); if (pixel_info == (MemoryInfo *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info); if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Reading pixels (%.20g bytes)",(double) length); count=ReadBlob(image,length,pixels); if (count != (ssize_t) length) { pixel_info=RelinquishVirtualMemory(pixel_info); ThrowReaderException(CorruptImageError, "InsufficientImageDataInFile"); } } else { /* Convert run-length encoded raster pixels. */ pixel_info=AcquireVirtualMemory(image->rows,MagickMax(bytes_per_line, image->columns+256UL)*sizeof(*pixels)); if (pixel_info == (MemoryInfo *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info); status=DecodeImage(image,bmp_info.compression,pixels, image->columns*image->rows); if (status == MagickFalse) { pixel_info=RelinquishVirtualMemory(pixel_info); ThrowReaderException(CorruptImageError, "UnableToRunlengthDecodeImage"); } } /* Convert BMP raster image to pixel packets. */ if (bmp_info.compression == BI_RGB) { /* We should ignore the alpha value in BMP3 files but there have been reports about 32 bit files with alpha. We do a quick check to see if the alpha channel contains a value that is not zero (default value). If we find a non zero value we asume the program that wrote the file wants to use the alpha channel. */ if ((image->matte == MagickFalse) && (bmp_info.size == 40) && (bmp_info.bits_per_pixel == 32)) { bytes_per_line=4*(image->columns); for (y=(ssize_t) image->rows-1; y >= 0; y--) { p=pixels+(image->rows-y-1)*bytes_per_line; for (x=0; x < (ssize_t) image->columns; x++) { if (*(p+3) != 0) { image->matte=MagickTrue; y=-1; break; } p+=4; } } } bmp_info.alpha_mask=image->matte != MagickFalse ? 0xff000000U : 0U; bmp_info.red_mask=0x00ff0000U; bmp_info.green_mask=0x0000ff00U; bmp_info.blue_mask=0x000000ffU; if (bmp_info.bits_per_pixel == 16) { /* RGB555. */ bmp_info.red_mask=0x00007c00U; bmp_info.green_mask=0x000003e0U; bmp_info.blue_mask=0x0000001fU; } } (void) memset(&shift,0,sizeof(shift)); (void) memset(&quantum_bits,0,sizeof(quantum_bits)); if ((bmp_info.bits_per_pixel == 16) || (bmp_info.bits_per_pixel == 32)) { register size_t sample; /* Get shift and quantum bits info from bitfield masks. */ if (bmp_info.red_mask != 0) while (((bmp_info.red_mask << shift.red) & 0x80000000UL) == 0) { shift.red++; if (shift.red > 32U) break; } if (bmp_info.green_mask != 0) while (((bmp_info.green_mask << shift.green) & 0x80000000UL) == 0) { shift.green++; if (shift.green > 32U) break; } if (bmp_info.blue_mask != 0) while (((bmp_info.blue_mask << shift.blue) & 0x80000000UL) == 0) { shift.blue++; if (shift.blue > 32U) break; } if (bmp_info.alpha_mask != 0) while (((bmp_info.alpha_mask << shift.opacity) & 0x80000000UL) == 0) { shift.opacity++; if (shift.opacity > 32U) break; } sample=shift.red; while (((bmp_info.red_mask << sample) & 0x80000000UL) != 0) { sample++; if (sample > 32U) break; } quantum_bits.red=ClampToQuantum((MagickRealType) sample-shift.red); sample=shift.green; while (((bmp_info.green_mask << sample) & 0x80000000UL) != 0) { sample++; if (sample > 32U) break; } quantum_bits.green=ClampToQuantum((MagickRealType) sample-shift.green); sample=shift.blue; while (((bmp_info.blue_mask << sample) & 0x80000000UL) != 0) { sample++; if (sample > 32U) break; } quantum_bits.blue=ClampToQuantum((MagickRealType) sample-shift.blue); sample=shift.opacity; while (((bmp_info.alpha_mask << sample) & 0x80000000UL) != 0) { sample++; if (sample > 32U) break; } quantum_bits.opacity=ClampToQuantum((MagickRealType) sample- shift.opacity); } switch (bmp_info.bits_per_pixel) { case 1: { /* Convert bitmap scanline. */ for (y=(ssize_t) image->rows-1; y >= 0; y--) { p=pixels+(image->rows-y-1)*bytes_per_line; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) break; indexes=GetAuthenticIndexQueue(image); for (x=0; x < ((ssize_t) image->columns-7); x+=8) { for (bit=0; bit < 8; bit++) { index=(IndexPacket) (((*p) & (0x80 >> bit)) != 0 ? 0x01 : 0x00); SetPixelIndex(indexes+x+bit,index); q++; } p++; } if ((image->columns % 8) != 0) { for (bit=0; bit < (image->columns % 8); bit++) { index=(IndexPacket) (((*p) & (0x80 >> bit)) != 0 ? 0x01 : 0x00); SetPixelIndex(indexes+x+bit,index); } p++; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) (image->rows-y),image->rows); if (status == MagickFalse) break; } } (void) SyncImage(image); break; } case 4: { /* Convert PseudoColor scanline. */ for (y=(ssize_t) image->rows-1; y >= 0; y--) { p=pixels+(image->rows-y-1)*bytes_per_line; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) break; indexes=GetAuthenticIndexQueue(image); for (x=0; x < ((ssize_t) image->columns-1); x+=2) { (void) IsValidColormapIndex(image,(ssize_t) ((*p >> 4) & 0x0f), &index,exception); SetPixelIndex(indexes+x,index); (void) IsValidColormapIndex(image,(ssize_t) (*p & 0x0f),&index, exception); SetPixelIndex(indexes+x+1,index); p++; } if ((image->columns % 2) != 0) { (void) IsValidColormapIndex(image,(ssize_t) ((*p >> 4) & 0xf), &index,exception); SetPixelIndex(indexes+(x++),index); p++; } if (x < (ssize_t) image->columns) break; if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) (image->rows-y),image->rows); if (status == MagickFalse) break; } } (void) SyncImage(image); break; } case 8: { /* Convert PseudoColor scanline. */ if ((bmp_info.compression == BI_RLE8) || (bmp_info.compression == BI_RLE4)) bytes_per_line=image->columns; for (y=(ssize_t) image->rows-1; y >= 0; y--) { p=pixels+(image->rows-y-1)*bytes_per_line; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) break; indexes=GetAuthenticIndexQueue(image); for (x=(ssize_t) image->columns; x != 0; --x) { (void) IsValidColormapIndex(image,(ssize_t) *p,&index,exception); SetPixelIndex(indexes,index); indexes++; p++; q++; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; offset=(MagickOffsetType) (image->rows-y-1); if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) (image->rows-y),image->rows); if (status == MagickFalse) break; } } (void) SyncImage(image); break; } case 16: { unsigned int alpha, pixel; /* Convert bitfield encoded 16-bit PseudoColor scanline. */ if (bmp_info.compression != BI_RGB && bmp_info.compression != BI_BITFIELDS) { pixel_info=RelinquishVirtualMemory(pixel_info); ThrowReaderException(CorruptImageError, "UnrecognizedImageCompression"); } bytes_per_line=2*(image->columns+image->columns % 2); image->storage_class=DirectClass; for (y=(ssize_t) image->rows-1; y >= 0; y--) { p=pixels+(image->rows-y-1)*bytes_per_line; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) break; for (x=0; x < (ssize_t) image->columns; x++) { pixel=(unsigned int) (*p++); pixel|=(*p++) << 8; red=((pixel & bmp_info.red_mask) << shift.red) >> 16; if (quantum_bits.red == 5) red|=((red & 0xe000) >> 5); if (quantum_bits.red <= 8) red|=((red & 0xff00) >> 8); green=((pixel & bmp_info.green_mask) << shift.green) >> 16; if (quantum_bits.green == 5) green|=((green & 0xe000) >> 5); if (quantum_bits.green == 6) green|=((green & 0xc000) >> 6); if (quantum_bits.green <= 8) green|=((green & 0xff00) >> 8); blue=((pixel & bmp_info.blue_mask) << shift.blue) >> 16; if (quantum_bits.blue == 5) blue|=((blue & 0xe000) >> 5); if (quantum_bits.blue <= 8) blue|=((blue & 0xff00) >> 8); SetPixelRed(q,ScaleShortToQuantum((unsigned short) red)); SetPixelGreen(q,ScaleShortToQuantum((unsigned short) green)); SetPixelBlue(q,ScaleShortToQuantum((unsigned short) blue)); SetPixelOpacity(q,OpaqueOpacity); if (image->matte != MagickFalse) { alpha=((pixel & bmp_info.alpha_mask) << shift.opacity) >> 16; if (quantum_bits.opacity <= 8) alpha|=((alpha & 0xff00) >> 8); SetPixelAlpha(q,ScaleShortToQuantum((unsigned short) alpha)); } q++; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; offset=(MagickOffsetType) (image->rows-y-1); if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) (image->rows-y),image->rows); if (status == MagickFalse) break; } } break; } case 24: { /* Convert DirectColor scanline. */ bytes_per_line=4*((image->columns*24+31)/32); for (y=(ssize_t) image->rows-1; y >= 0; y--) { p=pixels+(image->rows-y-1)*bytes_per_line; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) break; for (x=0; x < (ssize_t) image->columns; x++) { SetPixelBlue(q,ScaleCharToQuantum(*p++)); SetPixelGreen(q,ScaleCharToQuantum(*p++)); SetPixelRed(q,ScaleCharToQuantum(*p++)); SetPixelOpacity(q,OpaqueOpacity); q++; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; offset=(MagickOffsetType) (image->rows-y-1); if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) (image->rows-y),image->rows); if (status == MagickFalse) break; } } break; } case 32: { /* Convert bitfield encoded DirectColor scanline. */ if ((bmp_info.compression != BI_RGB) && (bmp_info.compression != BI_BITFIELDS)) { pixel_info=RelinquishVirtualMemory(pixel_info); ThrowReaderException(CorruptImageError, "UnrecognizedImageCompression"); } bytes_per_line=4*(image->columns); for (y=(ssize_t) image->rows-1; y >= 0; y--) { unsigned int alpha, pixel; p=pixels+(image->rows-y-1)*bytes_per_line; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) break; for (x=0; x < (ssize_t) image->columns; x++) { pixel=(unsigned int) (*p++); pixel|=((unsigned int) *p++ << 8); pixel|=((unsigned int) *p++ << 16); pixel|=((unsigned int) *p++ << 24); red=((pixel & bmp_info.red_mask) << shift.red) >> 16; if (quantum_bits.red == 8) red|=(red >> 8); green=((pixel & bmp_info.green_mask) << shift.green) >> 16; if (quantum_bits.green == 8) green|=(green >> 8); blue=((pixel & bmp_info.blue_mask) << shift.blue) >> 16; if (quantum_bits.blue == 8) blue|=(blue >> 8); SetPixelRed(q,ScaleShortToQuantum((unsigned short) red)); SetPixelGreen(q,ScaleShortToQuantum((unsigned short) green)); SetPixelBlue(q,ScaleShortToQuantum((unsigned short) blue)); SetPixelAlpha(q,OpaqueOpacity); if (image->matte != MagickFalse) { alpha=((pixel & bmp_info.alpha_mask) << shift.opacity) >> 16; if (quantum_bits.opacity == 8) alpha|=(alpha >> 8); SetPixelAlpha(q,ScaleShortToQuantum((unsigned short) alpha)); } q++; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; offset=(MagickOffsetType) (image->rows-y-1); if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) (image->rows-y),image->rows); if (status == MagickFalse) break; } } break; } default: { pixel_info=RelinquishVirtualMemory(pixel_info); ThrowReaderException(CorruptImageError,"ImproperImageHeader"); } } pixel_info=RelinquishVirtualMemory(pixel_info); if (y > 0) break; if (EOFBlob(image) != MagickFalse) { ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile", image->filename); break; } if (bmp_info.height < 0) { Image *flipped_image; /* Correct image orientation. */ flipped_image=FlipImage(image,exception); if (flipped_image != (Image *) NULL) { DuplicateBlob(flipped_image,image); ReplaceImageInList(&image, flipped_image); image=flipped_image; } } /* Proceed to next image. */ if (image_info->number_scenes != 0) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) break; *magick='\0'; if (bmp_info.ba_offset != 0) { offset=SeekBlob(image,(MagickOffsetType) bmp_info.ba_offset,SEEK_SET); if (offset < 0) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); } count=ReadBlob(image,2,magick); if ((count == 2) && (IsBMP(magick,2) != MagickFalse)) { /* Acquire next image structure. */ AcquireNextImage(image_info,image); if (GetNextImageInList(image) == (Image *) NULL) { image=DestroyImageList(image); return((Image *) NULL); } image=SyncNextImageInList(image); status=SetImageProgress(image,LoadImagesTag,TellBlob(image), GetBlobSize(image)); if (status == MagickFalse) break; } } while (IsBMP(magick,2) != MagickFalse); (void) CloseBlob(image); return(GetFirstImageInList(image)); }
1
521,465
int64 getPosition() override { return pos; }
0
226,202
void chpl_box_del(GF_Box *s) { GF_ChapterListBox *ptr = (GF_ChapterListBox *) s; if (ptr == NULL) return; while (gf_list_count(ptr->list)) { GF_ChapterEntry *ce = (GF_ChapterEntry *)gf_list_get(ptr->list, 0); if (ce->name) gf_free(ce->name); gf_free(ce); gf_list_rem(ptr->list, 0); } gf_list_del(ptr->list); gf_free(ptr); }
0
232,833
explicit BoostedTreesQuantileStreamResourceFlushOp( OpKernelConstruction* const context) : OpKernel(context) { OP_REQUIRES_OK(context, context->GetAttr(kGenerateQuantiles, &generate_quantiles_)); }
0
383,310
gdImageColorResolveAlpha (gdImagePtr im, int r, int g, int b, int a) { int c; int ct = -1; int op = -1; long rd, gd, bd, ad, dist; long mindist = 4 * 255 * 255; /* init to max poss dist */ if (im->trueColor) { return gdTrueColorAlpha (r, g, b, a); } for (c = 0; c < im->colorsTotal; c++) { if (im->open[c]) { op = c; /* Save open slot */ continue; /* Color not in use */ } if (c == im->transparent) { /* don't ever resolve to the color that has * been designated as the transparent color */ continue; } rd = (long) (im->red[c] - r); gd = (long) (im->green[c] - g); bd = (long) (im->blue[c] - b); ad = (long) (im->alpha[c] - a); dist = rd * rd + gd * gd + bd * bd + ad * ad; if (dist < mindist) { if (dist == 0) { return c; /* Return exact match color */ } mindist = dist; ct = c; } } /* no exact match. We now know closest, but first try to allocate exact */ if (op == -1) { op = im->colorsTotal; if (op == gdMaxColors) { /* No room for more colors */ return ct; /* Return closest available color */ } im->colorsTotal++; } im->red[op] = r; im->green[op] = g; im->blue[op] = b; im->alpha[op] = a; im->open[op] = 0; return op; /* Return newly allocated color */ }
0
513,320
Item_func_trig_cond::add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, table_map usable_tables, SARGABLE_PARAM **sargables) { /* Subquery optimization: Conditions that are pushed down into subqueries are wrapped into Item_func_trig_cond. We process the wrapped condition but need to set cond_guard for KEYUSE elements generated from it. */ if (!join->group_list && !join->order && join->unit->item && join->unit->item->substype() == Item_subselect::IN_SUBS && !join->unit->is_union()) { KEY_FIELD *save= *key_fields; args[0]->add_key_fields(join, key_fields, and_level, usable_tables, sargables); // Indicate that this ref access candidate is for subquery lookup: for (; save != *key_fields; save++) save->cond_guard= get_trig_var(); } }
0
333,049
nfa_print_state(FILE *debugf, nfa_state_T *state) { garray_T indent; ga_init2(&indent, 1, 64); ga_append(&indent, '\0'); nfa_print_state2(debugf, state, &indent); ga_clear(&indent); }
0
212,955
static int ax25_release(struct socket *sock) { struct sock *sk = sock->sk; ax25_cb *ax25; ax25_dev *ax25_dev; if (sk == NULL) return 0; sock_hold(sk); lock_sock(sk); sock_orphan(sk); ax25 = sk_to_ax25(sk); ax25_dev = ax25->ax25_dev; if (sk->sk_type == SOCK_SEQPACKET) { switch (ax25->state) { case AX25_STATE_0: release_sock(sk); ax25_disconnect(ax25, 0); lock_sock(sk); ax25_destroy_socket(ax25); break; case AX25_STATE_1: case AX25_STATE_2: ax25_send_control(ax25, AX25_DISC, AX25_POLLON, AX25_COMMAND); release_sock(sk); ax25_disconnect(ax25, 0); lock_sock(sk); if (!sock_flag(ax25->sk, SOCK_DESTROY)) ax25_destroy_socket(ax25); break; case AX25_STATE_3: case AX25_STATE_4: ax25_clear_queues(ax25); ax25->n2count = 0; switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { case AX25_PROTO_STD_SIMPLEX: case AX25_PROTO_STD_DUPLEX: ax25_send_control(ax25, AX25_DISC, AX25_POLLON, AX25_COMMAND); ax25_stop_t2timer(ax25); ax25_stop_t3timer(ax25); ax25_stop_idletimer(ax25); break; #ifdef CONFIG_AX25_DAMA_SLAVE case AX25_PROTO_DAMA_SLAVE: ax25_stop_t3timer(ax25); ax25_stop_idletimer(ax25); break; #endif } ax25_calculate_t1(ax25); ax25_start_t1timer(ax25); ax25->state = AX25_STATE_2; sk->sk_state = TCP_CLOSE; sk->sk_shutdown |= SEND_SHUTDOWN; sk->sk_state_change(sk); sock_set_flag(sk, SOCK_DESTROY); break; default: break; } } else { sk->sk_state = TCP_CLOSE; sk->sk_shutdown |= SEND_SHUTDOWN; sk->sk_state_change(sk); ax25_destroy_socket(ax25); } if (ax25_dev) { dev_put_track(ax25_dev->dev, &ax25_dev->dev_tracker); ax25_dev_put(ax25_dev); } sock->sk = NULL; release_sock(sk); sock_put(sk); return 0; }
1
432,264
static bool addrrange_intersects(AddrRange r1, AddrRange r2) { return addrrange_contains(r1, r2.start) || addrrange_contains(r2, r1.start); }
0
459,120
static int tc_dump_chain(struct sk_buff *skb, struct netlink_callback *cb) { struct net *net = sock_net(skb->sk); struct nlattr *tca[TCA_MAX + 1]; struct Qdisc *q = NULL; struct tcf_block *block; struct tcmsg *tcm = nlmsg_data(cb->nlh); struct tcf_chain *chain; long index_start; long index; int err; if (nlmsg_len(cb->nlh) < sizeof(*tcm)) return skb->len; err = nlmsg_parse_deprecated(cb->nlh, sizeof(*tcm), tca, TCA_MAX, rtm_tca_policy, cb->extack); if (err) return err; if (tcm->tcm_ifindex == TCM_IFINDEX_MAGIC_BLOCK) { block = tcf_block_refcnt_get(net, tcm->tcm_block_index); if (!block) goto out; } else { const struct Qdisc_class_ops *cops; struct net_device *dev; unsigned long cl = 0; dev = __dev_get_by_index(net, tcm->tcm_ifindex); if (!dev) return skb->len; if (!tcm->tcm_parent) q = dev->qdisc; else q = qdisc_lookup(dev, TC_H_MAJ(tcm->tcm_parent)); if (!q) goto out; cops = q->ops->cl_ops; if (!cops) goto out; if (!cops->tcf_block) goto out; if (TC_H_MIN(tcm->tcm_parent)) { cl = cops->find(q, tcm->tcm_parent); if (cl == 0) goto out; } block = cops->tcf_block(q, cl, NULL); if (!block) goto out; if (tcf_block_shared(block)) q = NULL; } index_start = cb->args[0]; index = 0; mutex_lock(&block->lock); list_for_each_entry(chain, &block->chain_list, list) { if ((tca[TCA_CHAIN] && nla_get_u32(tca[TCA_CHAIN]) != chain->index)) continue; if (index < index_start) { index++; continue; } if (tcf_chain_held_by_acts_only(chain)) continue; err = tc_chain_fill_node(chain->tmplt_ops, chain->tmplt_priv, chain->index, net, skb, block, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWCHAIN); if (err <= 0) break; index++; } mutex_unlock(&block->lock); if (tcm->tcm_ifindex == TCM_IFINDEX_MAGIC_BLOCK) tcf_block_refcnt_put(block, true); cb->args[0] = index; out: /* If we did no progress, the error (EMSGSIZE) is real */ if (skb->len == 0 && err) return err; return skb->len; }
0
242,649
void isor_reader_get_sample(ISOMChannel *ch) { GF_Err e; u32 sample_desc_index; if (ch->sample) return; if (ch->next_track) { ch->track = ch->next_track; ch->next_track = 0; } if (ch->to_init) { init_reader(ch); sample_desc_index = ch->last_sample_desc_index; } else if (ch->speed < 0) { if (ch->last_state == GF_EOS) { ch->sample = NULL; return; } if (ch->static_sample->IsRAP) { ch->last_rap_sample_time = ch->sample_time; } e = gf_isom_get_sample_for_movie_time(ch->owner->mov, ch->track, ch->sample_time + 1, &sample_desc_index, GF_ISOM_SEARCH_FORWARD, &ch->static_sample, &ch->sample_num, NULL); if ((e==GF_EOS) || (ch->static_sample->IsRAP)) { if (!ch->last_rap_sample_time) { e = GF_EOS; } else { e = gf_isom_get_sample_for_movie_time(ch->owner->mov, ch->track, ch->last_rap_sample_time - 1, &sample_desc_index, GF_ISOM_SEARCH_SYNC_BACKWARD, &ch->static_sample, &ch->sample_num, NULL); } } if (e) { if ((e==GF_EOS) && !ch->owner->frag_type) { ch->last_state = GF_EOS; } ch->sample = NULL; return; } ch->sample = ch->static_sample; if (ch->sample->DTS == ch->sample_time) { if (!ch->owner->frag_type) { ch->last_state = GF_EOS; } } if (ch->sample) { ch->sample_time = ch->sample->DTS; } } else if (ch->has_edit_list) { u32 prev_sample = ch->sample_num; e = gf_isom_get_sample_for_movie_time(ch->owner->mov, ch->track, ch->sample_time + 1, &sample_desc_index, GF_ISOM_SEARCH_FORWARD, &ch->static_sample, &ch->sample_num, &ch->sample_data_offset); if (e == GF_OK) { ch->sample = ch->static_sample; /*we are in forced seek mode: fetch all samples before the one matching the sample time*/ if (ch->edit_sync_frame) { ch->edit_sync_frame++; if (ch->edit_sync_frame < ch->sample_num) { ch->sample = gf_isom_get_sample_ex(ch->owner->mov, ch->track, ch->edit_sync_frame, &sample_desc_index, ch->static_sample, &ch->sample_data_offset); ch->sample->DTS = ch->sample_time; ch->sample->CTS_Offset = 0; } else { ch->edit_sync_frame = 0; if (ch->sample) ch->sample_time = ch->sample->DTS; } } else { /*if we get the same sample, figure out next interesting time (current sample + DTS gap to next sample should be a good bet)*/ if (prev_sample == ch->sample_num) { if (ch->owner->frag_type && (ch->sample_num==gf_isom_get_sample_count(ch->owner->mov, ch->track))) { ch->sample = NULL; } else { u32 sample_num = ch->sample_num ? ch->sample_num : 1; if (sample_num >= gf_isom_get_sample_count(ch->owner->mov, ch->track) ) { //e = GF_EOS; } else { u32 time_diff = gf_isom_get_sample_duration(ch->owner->mov, ch->track, sample_num); e = gf_isom_get_sample_for_movie_time(ch->owner->mov, ch->track, ch->sample_time + time_diff, &sample_desc_index, GF_ISOM_SEARCH_FORWARD, &ch->static_sample, &ch->sample_num, &ch->sample_data_offset); if (e==GF_OK) { if (ch->sample_num == prev_sample) { ch->sample_time += time_diff; ch->sample = NULL; return; } else { ch->sample = ch->static_sample; } } } } } /*we jumped to another segment - if RAP is needed look for closest rap in decoding order and force seek mode*/ if (ch->sample && !ch->sample->IsRAP && ch->has_rap && (ch->sample_num != prev_sample+1)) { GF_ISOSample *found = ch->static_sample; u32 samp_num = ch->sample_num; ch->sample = NULL; e = gf_isom_get_sample_for_movie_time(ch->owner->mov, ch->track, ch->sample_time + 1, &sample_desc_index, GF_ISOM_SEARCH_SYNC_BACKWARD, &ch->static_sample, &ch->sample_num, &ch->sample_data_offset); if (e == GF_OK) ch->sample = ch->static_sample; /*if no sync point in the past, use the first non-sync for the given time*/ if (!ch->sample || !ch->sample->data) { ch->sample = ch->static_sample = found; ch->sample_time = ch->sample->DTS; ch->sample_num = samp_num; } else { ch->sample = ch->static_sample; ch->edit_sync_frame = ch->sample_num; ch->sample->DTS = ch->sample_time; ch->sample->CTS_Offset = 0; } } else { if (ch->sample) ch->sample_time = ch->sample->DTS; } } } } else { Bool do_fetch = GF_TRUE; ch->sample_num++; if (ch->sap_only) { Bool is_rap = gf_isom_get_sample_sync(ch->owner->mov, ch->track, ch->sample_num); if (!is_rap) { GF_ISOSampleRollType roll_type; gf_isom_get_sample_rap_roll_info(ch->owner->mov, ch->track, ch->sample_num, &is_rap, &roll_type, NULL); if (roll_type) is_rap = GF_TRUE; } if (!is_rap) { do_fetch = GF_FALSE; } else if (ch->sap_only==2) { ch->sap_only = 0; } } if (do_fetch) { if (ch->owner->nodata) { ch->sample = gf_isom_get_sample_info_ex(ch->owner->mov, ch->track, ch->sample_num, &sample_desc_index, &ch->sample_data_offset, ch->static_sample); } else { ch->sample = gf_isom_get_sample_ex(ch->owner->mov, ch->track, ch->sample_num, &sample_desc_index, ch->static_sample, &ch->sample_data_offset); } /*if sync shadow / carousel RAP skip*/ if (ch->sample && (ch->sample->IsRAP==RAP_REDUNDANT)) { ch->sample = NULL; ch->sample_num++; isor_reader_get_sample(ch); return; } } } //check scalable track change if (ch->sample && ch->sample->IsRAP && ch->next_track) { ch->track = ch->next_track; ch->next_track = 0; ch->sample = NULL; isor_reader_get_sample(ch); return; } if (!ch->sample) { u32 sample_count = gf_isom_get_sample_count(ch->owner->mov, ch->track); ch->sample_data_offset = 0; /*incomplete file - check if we're still downloading or not*/ if (gf_isom_get_missing_bytes(ch->owner->mov, ch->track)) { ch->last_state = GF_ISOM_INCOMPLETE_FILE; if (ch->owner->mem_load_mode==2) ch->owner->force_fetch = GF_TRUE; if (!ch->owner->input_loaded) { ch->last_state = GF_OK; if (!ch->has_edit_list && ch->sample_num) ch->sample_num--; } else { if (ch->to_init && ch->sample_num) { GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[IsoMedia] Failed to fetch initial sample %d for track %d\n")); ch->last_state = GF_ISOM_INVALID_FILE; } if (ch->sample_num >= gf_isom_get_sample_count(ch->owner->mov, ch->track)) { ch->last_state = GF_EOS; } } } else if (!ch->sample_num || ((ch->speed >= 0) && (ch->sample_num >= sample_count)) || ((ch->speed < 0) && (ch->sample_time == gf_isom_get_current_tfdt(ch->owner->mov, ch->track) )) ) { if (ch->owner->frag_type==1) { /*if sample cannot be found and file is fragmented, rewind sample*/ if (ch->sample_num) ch->sample_num--; ch->last_state = GF_EOS; } else if (ch->last_state != GF_EOS) { GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, ("[IsoMedia] Track #%d end of stream reached\n", ch->track)); ch->last_state = GF_EOS; if (ch->sample_num>sample_count) ch->sample_num = sample_count; } else { if (ch->sample_num>sample_count) ch->sample_num = sample_count; } } else { e = gf_isom_last_error(ch->owner->mov); GF_LOG((e==GF_ISOM_INCOMPLETE_FILE) ? GF_LOG_DEBUG : GF_LOG_WARNING, GF_LOG_DASH, ("[IsoMedia] Track #%d fail to fetch sample %d / %d: %s\n", ch->track, ch->sample_num, gf_isom_get_sample_count(ch->owner->mov, ch->track), gf_error_to_string(e) )); } return; } if (sample_desc_index != ch->last_sample_desc_index) { if (!ch->owner->stsd) { //we used sample entry 1 by default to setup, if no active prev sample (edit list might trigger this) //and new sample desc is 1, do not reconfigure if (!ch->last_sample_desc_index && (sample_desc_index==1)) { } else { ch->needs_pid_reconfig = GF_TRUE; } } ch->last_sample_desc_index = sample_desc_index; } ch->last_state = GF_OK; ch->au_duration = gf_isom_get_sample_duration(ch->owner->mov, ch->track, ch->sample_num); ch->sap_3 = GF_FALSE; ch->sap_4_type = 0; ch->roll = 0; ch->set_disc = ch->owner->clock_discontinuity ? 2 : 0; ch->owner->clock_discontinuity = 0; if (ch->sample) { gf_isom_get_sample_rap_roll_info(ch->owner->mov, ch->track, ch->sample_num, &ch->sap_3, &ch->sap_4_type, &ch->roll); /*still seeking or not ? 1- when speed is negative, the RAP found is "after" the seek point in playback order since we used backward RAP search: nothing to do 2- otherwise set DTS+CTS to start value */ if ((ch->speed < 0) || (ch->start <= ch->sample->DTS + ch->sample->CTS_Offset)) { ch->dts = ch->sample->DTS; ch->cts = ch->sample->DTS + ch->sample->CTS_Offset; ch->seek_flag = 0; } else { ch->cts = ch->start; ch->seek_flag = 1; ch->dts = ch->start; } if (ch->end && (ch->end < ch->sample->DTS + ch->sample->CTS_Offset + ch->au_duration)) { GF_LOG(GF_LOG_DEBUG, GF_LOG_DASH, ("[IsoMedia] End of Channel "LLD" (CTS "LLD")\n", ch->end, ch->sample->DTS + ch->sample->CTS_Offset)); ch->sample = NULL; ch->last_state = GF_EOS; ch->playing = 2; return; } } if (ch->owner->last_sender_ntp && ch->cts==ch->owner->cts_for_last_sender_ntp) { ch->sender_ntp = ch->owner->last_sender_ntp; ch->ntp_at_server_ntp = ch->owner->ntp_at_last_sender_ntp; } else if (ch->owner->last_sender_ntp && ch->dts==ch->owner->cts_for_last_sender_ntp) { ch->sender_ntp = ch->owner->last_sender_ntp; ch->ntp_at_server_ntp = ch->owner->ntp_at_last_sender_ntp; } else { ch->sender_ntp = ch->ntp_at_server_ntp = 0; } if (!ch->sample_num) return; gf_isom_get_sample_flags(ch->owner->mov, ch->track, ch->sample_num, &ch->isLeading, &ch->dependsOn, &ch->dependedOn, &ch->redundant); if (ch->is_encrypted) { /*in case of CENC: we write sample auxiliary information to slh->sai; its size is in saiz*/ if (gf_isom_is_cenc_media(ch->owner->mov, ch->track, ch->last_sample_desc_index)) { isor_update_cenc_info(ch, GF_FALSE); } else if (gf_isom_is_media_encrypted(ch->owner->mov, ch->track, ch->last_sample_desc_index)) { ch->pck_encrypted = GF_TRUE; } else { ch->pck_encrypted = GF_FALSE; } } if (ch->sample && ch->sample->nb_pack) ch->sample_num += ch->sample->nb_pack-1; }
0
409,522
term_rgb_color(char_u *s, guicolor_T rgb) { #define MAX_COLOR_STR_LEN 100 char buf[MAX_COLOR_STR_LEN]; if (*s == NUL) return; vim_snprintf(buf, MAX_COLOR_STR_LEN, (char *)s, RED(rgb), GREEN(rgb), BLUE(rgb)); #ifdef FEAT_VTP if (use_wt()) { out_flush(); buf[1] = '['; vtp_printf(buf); } else #endif OUT_STR(buf); }
0
437,693
int cx23888_ir_remove(struct cx23885_dev *dev) { struct v4l2_subdev *sd; struct cx23888_ir_state *state; sd = cx23885_find_hw(dev, CX23885_HW_888_IR); if (sd == NULL) return -ENODEV; cx23888_ir_rx_shutdown(sd); cx23888_ir_tx_shutdown(sd); state = to_state(sd); v4l2_device_unregister_subdev(sd); kfifo_free(&state->rx_kfifo); kfree(state); /* Nothing more to free() as state held the actual v4l2_subdev object */ return 0; }
0
238,385
njs_function_name_set(njs_vm_t *vm, njs_function_t *function, njs_value_t *name, const char *prefix) { u_char *p; size_t len, symbol; njs_int_t ret; njs_value_t value; njs_string_prop_t string; njs_object_prop_t *prop; njs_lvlhsh_query_t lhq; prop = njs_object_prop_alloc(vm, &njs_string_name, name, 0); if (njs_slow_path(prop == NULL)) { return NJS_ERROR; } symbol = 0; if (njs_is_symbol(&prop->value)) { symbol = 2; prop->value = *njs_symbol_description(&prop->value); } if (prefix != NULL || symbol != 0) { value = prop->value; (void) njs_string_prop(&string, &value); len = (prefix != NULL) ? njs_strlen(prefix) + 1: 0; p = njs_string_alloc(vm, &prop->value, string.size + len + symbol, string.length + len + symbol); if (njs_slow_path(p == NULL)) { return NJS_ERROR; } if (len != 0) { p = njs_cpymem(p, prefix, len - 1); *p++ = ' '; } if (symbol != 0) { *p++ = '['; } p = njs_cpymem(p, string.start, string.size); if (symbol != 0) { *p++ = ']'; } } prop->configurable = 1; lhq.key_hash = NJS_NAME_HASH; lhq.key = njs_str_value("name"); lhq.replace = 0; lhq.value = prop; lhq.proto = &njs_object_hash_proto; lhq.pool = vm->mem_pool; ret = njs_lvlhsh_insert(&function->object.hash, &lhq); if (njs_slow_path(ret != NJS_OK)) { njs_internal_error(vm, "lvlhsh insert failed"); return NJS_ERROR; } return NJS_OK; }
0
474,092
gbk_mbc_enc_len(const UChar* p, const UChar* e, OnigEncoding enc ARG_UNUSED) { int firstbyte = *p++; state_t s = trans[0][firstbyte]; #define RETURN(n) \ return s == ACCEPT ? ONIGENC_CONSTRUCT_MBCLEN_CHARFOUND(n) : \ ONIGENC_CONSTRUCT_MBCLEN_INVALID() if (s < 0) RETURN(1); if (p == e) return ONIGENC_CONSTRUCT_MBCLEN_NEEDMORE(EncLen_GBK[firstbyte]-1); s = trans[s][*p++]; RETURN(2); #undef RETURN }
0
313,840
nv_visual(cmdarg_T *cap) { if (cap->cmdchar == Ctrl_Q) cap->cmdchar = Ctrl_V; // 'v', 'V' and CTRL-V can be used while an operator is pending to make it // characterwise, linewise, or blockwise. if (cap->oap->op_type != OP_NOP) { motion_force = cap->oap->motion_force = cap->cmdchar; finish_op = FALSE; // operator doesn't finish now but later return; } VIsual_select = cap->arg; if (VIsual_active) // change Visual mode { if (VIsual_mode == cap->cmdchar) // stop visual mode end_visual_mode(); else // toggle char/block mode { // or char/line mode VIsual_mode = cap->cmdchar; showmode(); may_trigger_modechanged(); } redraw_curbuf_later(INVERTED); // update the inversion } else // start Visual mode { check_visual_highlight(); if (cap->count0 > 0 && resel_VIsual_mode != NUL) { // use previously selected part VIsual = curwin->w_cursor; VIsual_active = TRUE; VIsual_reselect = TRUE; if (!cap->arg) // start Select mode when 'selectmode' contains "cmd" may_start_select('c'); setmouse(); if (p_smd && msg_silent == 0) redraw_cmdline = TRUE; // show visual mode later // For V and ^V, we multiply the number of lines even if there // was only one -- webb if (resel_VIsual_mode != 'v' || resel_VIsual_line_count > 1) { curwin->w_cursor.lnum += resel_VIsual_line_count * cap->count0 - 1; check_cursor(); } VIsual_mode = resel_VIsual_mode; if (VIsual_mode == 'v') { if (resel_VIsual_line_count <= 1) { validate_virtcol(); curwin->w_curswant = curwin->w_virtcol + resel_VIsual_vcol * cap->count0 - 1; } else curwin->w_curswant = resel_VIsual_vcol; coladvance(curwin->w_curswant); } if (resel_VIsual_vcol == MAXCOL) { curwin->w_curswant = MAXCOL; coladvance((colnr_T)MAXCOL); } else if (VIsual_mode == Ctrl_V) { validate_virtcol(); curwin->w_curswant = curwin->w_virtcol + resel_VIsual_vcol * cap->count0 - 1; coladvance(curwin->w_curswant); } else curwin->w_set_curswant = TRUE; redraw_curbuf_later(INVERTED); // show the inversion } else { if (!cap->arg) // start Select mode when 'selectmode' contains "cmd" may_start_select('c'); n_start_visual_mode(cap->cmdchar); if (VIsual_mode != 'V' && *p_sel == 'e') ++cap->count1; // include one more char if (cap->count0 > 0 && --cap->count1 > 0) { // With a count select that many characters or lines. if (VIsual_mode == 'v' || VIsual_mode == Ctrl_V) nv_right(cap); else if (VIsual_mode == 'V') nv_down(cap); } } } }
0
411,901
router_parse_addr_policy_item_from_string(const char *s, int assume_action) { directory_token_t *tok = NULL; const char *cp, *eos; /* Longest possible policy is "accept ffff:ffff:..255/ffff:...255:0-65535". * But note that there can be an arbitrary amount of space between the * accept and the address:mask/port element. */ char line[TOR_ADDR_BUF_LEN*2 + 32]; addr_policy_t *r; memarea_t *area = NULL; s = eat_whitespace(s); if ((*s == '*' || TOR_ISDIGIT(*s)) && assume_action >= 0) { if (tor_snprintf(line, sizeof(line), "%s %s", assume_action == ADDR_POLICY_ACCEPT?"accept":"reject", s)<0) { log_warn(LD_DIR, "Policy %s is too long.", escaped(s)); return NULL; } cp = line; tor_strlower(line); } else { /* assume an already well-formed address policy line */ cp = s; } eos = cp + strlen(cp); area = memarea_new(); tok = get_next_token(area, &cp, eos, routerdesc_token_table); if (tok->tp == _ERR) { log_warn(LD_DIR, "Error reading address policy: %s", tok->error); goto err; } if (tok->tp != K_ACCEPT && tok->tp != K_ACCEPT6 && tok->tp != K_REJECT && tok->tp != K_REJECT6) { log_warn(LD_DIR, "Expected 'accept' or 'reject'."); goto err; } r = router_parse_addr_policy(tok); goto done; err: r = NULL; done: token_clear(tok); if (area) { DUMP_AREA(area, "policy item"); memarea_drop_all(area); } return r; }
0
513,221
bool sys_var_pluginvar::session_is_default(THD *thd) { uchar *value= plugin_var->flags & PLUGIN_VAR_THDLOCAL ? intern_sys_var_ptr(thd, *(int*) (plugin_var+1), true) : *(uchar**) (plugin_var+1); real_value_ptr(thd, OPT_SESSION); switch (plugin_var->flags & PLUGIN_VAR_TYPEMASK) { case PLUGIN_VAR_BOOL: return option.def_value == *(my_bool*)value; case PLUGIN_VAR_INT: return option.def_value == *(int*)value; case PLUGIN_VAR_LONG: case PLUGIN_VAR_ENUM: return option.def_value == *(long*)value; case PLUGIN_VAR_LONGLONG: case PLUGIN_VAR_SET: return option.def_value == *(longlong*)value; case PLUGIN_VAR_STR: { const char *a=(char*)option.def_value; const char *b=(char*)value; return (!a && !b) || (a && b && strcmp(a,b)); } case PLUGIN_VAR_DOUBLE: return getopt_ulonglong2double(option.def_value) == *(double*)value; } DBUG_ASSERT(0); return 0; }
0
359,610
bgp_update_receive (struct peer *peer, bgp_size_t size) { int ret; u_char *end; struct stream *s; struct attr attr; bgp_size_t attribute_len; bgp_size_t update_len; bgp_size_t withdraw_len; struct bgp_nlri update; struct bgp_nlri withdraw; struct bgp_nlri mp_update; struct bgp_nlri mp_withdraw; char attrstr[BUFSIZ] = ""; /* Status must be Established. */ if (peer->status != Established) { zlog_err ("%s [FSM] Update packet received under status %s", peer->host, LOOKUP (bgp_status_msg, peer->status)); bgp_notify_send (peer, BGP_NOTIFY_FSM_ERR, 0); return -1; } /* Set initial values. */ memset (&attr, 0, sizeof (struct attr)); memset (&update, 0, sizeof (struct bgp_nlri)); memset (&withdraw, 0, sizeof (struct bgp_nlri)); memset (&mp_update, 0, sizeof (struct bgp_nlri)); memset (&mp_withdraw, 0, sizeof (struct bgp_nlri)); s = peer->ibuf; end = stream_pnt (s) + size; /* RFC1771 6.3 If the Unfeasible Routes Length or Total Attribute Length is too large (i.e., if Unfeasible Routes Length + Total Attribute Length + 23 exceeds the message Length), then the Error Subcode is set to Malformed Attribute List. */ if (stream_pnt (s) + 2 > end) { zlog_err ("%s [Error] Update packet error" " (packet length is short for unfeasible length)", peer->host); bgp_notify_send (peer, BGP_NOTIFY_UPDATE_ERR, BGP_NOTIFY_UPDATE_MAL_ATTR); return -1; } /* Unfeasible Route Length. */ withdraw_len = stream_getw (s); /* Unfeasible Route Length check. */ if (stream_pnt (s) + withdraw_len > end) { zlog_err ("%s [Error] Update packet error" " (packet unfeasible length overflow %d)", peer->host, withdraw_len); bgp_notify_send (peer, BGP_NOTIFY_UPDATE_ERR, BGP_NOTIFY_UPDATE_MAL_ATTR); return -1; } /* Unfeasible Route packet format check. */ if (withdraw_len > 0) { ret = bgp_nlri_sanity_check (peer, AFI_IP, stream_pnt (s), withdraw_len); if (ret < 0) return -1; if (BGP_DEBUG (packet, PACKET_RECV)) zlog_debug ("%s [Update:RECV] Unfeasible NLRI received", peer->host); withdraw.afi = AFI_IP; withdraw.safi = SAFI_UNICAST; withdraw.nlri = stream_pnt (s); withdraw.length = withdraw_len; stream_forward_getp (s, withdraw_len); } /* Attribute total length check. */ if (stream_pnt (s) + 2 > end) { zlog_warn ("%s [Error] Packet Error" " (update packet is short for attribute length)", peer->host); bgp_notify_send (peer, BGP_NOTIFY_UPDATE_ERR, BGP_NOTIFY_UPDATE_MAL_ATTR); return -1; } /* Fetch attribute total length. */ attribute_len = stream_getw (s); /* Attribute length check. */ if (stream_pnt (s) + attribute_len > end) { zlog_warn ("%s [Error] Packet Error" " (update packet attribute length overflow %d)", peer->host, attribute_len); bgp_notify_send (peer, BGP_NOTIFY_UPDATE_ERR, BGP_NOTIFY_UPDATE_MAL_ATTR); return -1; } /* Parse attribute when it exists. */ if (attribute_len) { ret = bgp_attr_parse (peer, &attr, attribute_len, &mp_update, &mp_withdraw); if (ret < 0) return -1; } /* Logging the attribute. */ if (BGP_DEBUG (update, UPDATE_IN)) { ret= bgp_dump_attr (peer, &attr, attrstr, BUFSIZ); if (ret) zlog (peer->log, LOG_DEBUG, "%s rcvd UPDATE w/ attr: %s", peer->host, attrstr); } /* Network Layer Reachability Information. */ update_len = end - stream_pnt (s); if (update_len) { /* Check NLRI packet format and prefix length. */ ret = bgp_nlri_sanity_check (peer, AFI_IP, stream_pnt (s), update_len); if (ret < 0) return -1; /* Set NLRI portion to structure. */ update.afi = AFI_IP; update.safi = SAFI_UNICAST; update.nlri = stream_pnt (s); update.length = update_len; stream_forward_getp (s, update_len); } /* NLRI is processed only when the peer is configured specific Address Family and Subsequent Address Family. */ if (peer->afc[AFI_IP][SAFI_UNICAST]) { if (withdraw.length) bgp_nlri_parse (peer, NULL, &withdraw); if (update.length) { /* We check well-known attribute only for IPv4 unicast update. */ ret = bgp_attr_check (peer, &attr); if (ret < 0) return -1; bgp_nlri_parse (peer, &attr, &update); } if (mp_update.length && mp_update.afi == AFI_IP && mp_update.safi == SAFI_UNICAST) bgp_nlri_parse (peer, &attr, &mp_update); if (mp_withdraw.length && mp_withdraw.afi == AFI_IP && mp_withdraw.safi == SAFI_UNICAST) bgp_nlri_parse (peer, NULL, &mp_withdraw); if (! attribute_len && ! withdraw_len) { /* End-of-RIB received */ SET_FLAG (peer->af_sflags[AFI_IP][SAFI_UNICAST], PEER_STATUS_EOR_RECEIVED); /* NSF delete stale route */ if (peer->nsf[AFI_IP][SAFI_UNICAST]) bgp_clear_stale_route (peer, AFI_IP, SAFI_UNICAST); if (BGP_DEBUG (normal, NORMAL)) zlog (peer->log, LOG_DEBUG, "rcvd End-of-RIB for IPv4 Unicast from %s", peer->host); } } if (peer->afc[AFI_IP][SAFI_MULTICAST]) { if (mp_update.length && mp_update.afi == AFI_IP && mp_update.safi == SAFI_MULTICAST) bgp_nlri_parse (peer, &attr, &mp_update); if (mp_withdraw.length && mp_withdraw.afi == AFI_IP && mp_withdraw.safi == SAFI_MULTICAST) bgp_nlri_parse (peer, NULL, &mp_withdraw); if (! withdraw_len && mp_withdraw.afi == AFI_IP && mp_withdraw.safi == SAFI_MULTICAST && mp_withdraw.length == 0) { /* End-of-RIB received */ SET_FLAG (peer->af_sflags[AFI_IP][SAFI_MULTICAST], PEER_STATUS_EOR_RECEIVED); /* NSF delete stale route */ if (peer->nsf[AFI_IP][SAFI_MULTICAST]) bgp_clear_stale_route (peer, AFI_IP, SAFI_MULTICAST); if (BGP_DEBUG (normal, NORMAL)) zlog (peer->log, LOG_DEBUG, "rcvd End-of-RIB for IPv4 Multicast from %s", peer->host); } } if (peer->afc[AFI_IP6][SAFI_UNICAST]) { if (mp_update.length && mp_update.afi == AFI_IP6 && mp_update.safi == SAFI_UNICAST) bgp_nlri_parse (peer, &attr, &mp_update); if (mp_withdraw.length && mp_withdraw.afi == AFI_IP6 && mp_withdraw.safi == SAFI_UNICAST) bgp_nlri_parse (peer, NULL, &mp_withdraw); if (! withdraw_len && mp_withdraw.afi == AFI_IP6 && mp_withdraw.safi == SAFI_UNICAST && mp_withdraw.length == 0) { /* End-of-RIB received */ SET_FLAG (peer->af_sflags[AFI_IP6][SAFI_UNICAST], PEER_STATUS_EOR_RECEIVED); /* NSF delete stale route */ if (peer->nsf[AFI_IP6][SAFI_UNICAST]) bgp_clear_stale_route (peer, AFI_IP6, SAFI_UNICAST); if (BGP_DEBUG (normal, NORMAL)) zlog (peer->log, LOG_DEBUG, "rcvd End-of-RIB for IPv6 Unicast from %s", peer->host); } } if (peer->afc[AFI_IP6][SAFI_MULTICAST]) { if (mp_update.length && mp_update.afi == AFI_IP6 && mp_update.safi == SAFI_MULTICAST) bgp_nlri_parse (peer, &attr, &mp_update); if (mp_withdraw.length && mp_withdraw.afi == AFI_IP6 && mp_withdraw.safi == SAFI_MULTICAST) bgp_nlri_parse (peer, NULL, &mp_withdraw); if (! withdraw_len && mp_withdraw.afi == AFI_IP6 && mp_withdraw.safi == SAFI_MULTICAST && mp_withdraw.length == 0) { /* End-of-RIB received */ /* NSF delete stale route */ if (peer->nsf[AFI_IP6][SAFI_MULTICAST]) bgp_clear_stale_route (peer, AFI_IP6, SAFI_MULTICAST); if (BGP_DEBUG (update, UPDATE_IN)) zlog (peer->log, LOG_DEBUG, "rcvd End-of-RIB for IPv6 Multicast from %s", peer->host); } } if (peer->afc[AFI_IP][SAFI_MPLS_VPN]) { if (mp_update.length && mp_update.afi == AFI_IP && mp_update.safi == BGP_SAFI_VPNV4) bgp_nlri_parse_vpnv4 (peer, &attr, &mp_update); if (mp_withdraw.length && mp_withdraw.afi == AFI_IP && mp_withdraw.safi == BGP_SAFI_VPNV4) bgp_nlri_parse_vpnv4 (peer, NULL, &mp_withdraw); if (! withdraw_len && mp_withdraw.afi == AFI_IP && mp_withdraw.safi == BGP_SAFI_VPNV4 && mp_withdraw.length == 0) { /* End-of-RIB received */ if (BGP_DEBUG (update, UPDATE_IN)) zlog (peer->log, LOG_DEBUG, "rcvd End-of-RIB for VPNv4 Unicast from %s", peer->host); } } /* Everything is done. We unintern temporary structures which interned in bgp_attr_parse(). */ if (attr.aspath) aspath_unintern (attr.aspath); if (attr.community) community_unintern (attr.community); if (attr.extra) { if (attr.extra->ecommunity) ecommunity_unintern (attr.extra->ecommunity); if (attr.extra->cluster) cluster_unintern (attr.extra->cluster); if (attr.extra->transit) transit_unintern (attr.extra->transit); bgp_attr_extra_free (&attr); } /* If peering is stopped due to some reason, do not generate BGP event. */ if (peer->status != Established) return 0; /* Increment packet counter. */ peer->update_in++; peer->update_time = time (NULL); /* Generate BGP event. */ BGP_EVENT_ADD (peer, Receive_UPDATE_message); return 0; }
0
400,768
static ssize_t iter_xarray_get_pages_alloc(struct iov_iter *i, struct page ***pages, size_t maxsize, size_t *_start_offset) { struct page **p; unsigned nr, offset; pgoff_t index, count; size_t size = maxsize, actual; loff_t pos; if (!size) return 0; pos = i->xarray_start + i->iov_offset; index = pos >> PAGE_SHIFT; offset = pos & ~PAGE_MASK; *_start_offset = offset; count = 1; if (size > PAGE_SIZE - offset) { size -= PAGE_SIZE - offset; count += size >> PAGE_SHIFT; size &= ~PAGE_MASK; if (size) count++; } p = get_pages_array(count); if (!p) return -ENOMEM; *pages = p; nr = iter_xarray_populate_pages(p, i->xarray, index, count); if (nr == 0) return 0; actual = PAGE_SIZE * nr; actual -= offset; if (nr == count && size > 0) { unsigned last_offset = (nr > 1) ? 0 : offset; actual -= PAGE_SIZE - (last_offset + size); } return actual; }
0
379,670
R_API int r_anal_var_get_argnum(RAnalVar *var) { r_return_val_if_fail (var, -1); RAnal *anal = var->fcn->anal; if (!var->isarg || var->kind != R_ANAL_VAR_KIND_REG) { // TODO: support bp and sp too return -1; } if (!var->regname) { return -1; } RRegItem *reg = r_reg_get (anal->reg, var->regname, -1); if (!reg) { return -1; } int i; int arg_max = var->fcn->cc ? r_anal_cc_max_arg (anal, var->fcn->cc) : 0; for (i = 0; i < arg_max; i++) { const char *reg_arg = r_anal_cc_arg (anal, var->fcn->cc, i); if (reg_arg && !strcmp (reg->name, reg_arg)) { return i; } } return -1; }
0
254,729
njs_typed_array_get_i32(const void *a) { return *(const int32_t *) a; }
0
275,922
const uECC_word_t *uECC_curve_b(uECC_Curve curve) { return curve->b; }
0
212,810
regional_alloc(struct regional *r, size_t size) { size_t a = ALIGN_UP(size, ALIGNMENT); void *s; /* large objects */ if(a > REGIONAL_LARGE_OBJECT_SIZE) { s = malloc(ALIGNMENT + size); if(!s) return NULL; r->total_large += ALIGNMENT+size; *(char**)s = r->large_list; r->large_list = (char*)s; return (char*)s+ALIGNMENT; } /* create a new chunk */ if(a > r->available) { s = malloc(REGIONAL_CHUNK_SIZE); if(!s) return NULL; *(char**)s = r->next; r->next = (char*)s; r->data = (char*)s + ALIGNMENT; r->available = REGIONAL_CHUNK_SIZE - ALIGNMENT; } /* put in this chunk */ r->available -= a; s = r->data; r->data += a; return s; }
1
512,964
longlong Item_func_ge::val_int() { DBUG_ASSERT(fixed == 1); int value= cmp.compare(); return value >= 0 ? 1 : 0; }
0
445,930
encrypt_data_free (EncryptData *edata) { if (edata == NULL) return; if (edata->temp_new_file != NULL) { GFile *parent = g_file_get_parent (edata->temp_new_file); if (parent != NULL) _g_file_remove_directory (parent, NULL, NULL); _g_object_unref (parent); } _g_object_unref (edata->temp_new_file); _g_object_unref (edata->new_archive); _g_file_remove_directory (edata->temp_extraction_dir, NULL, NULL); _g_object_unref (edata->temp_extraction_dir); g_free (edata->password); g_free (edata); }
0
445,976
fr_window_action_new_archive (FrWindow *window) { GtkWidget *dialog; if (fr_window_present_dialog_if_created (window, "new_archive")) return; dialog = fr_new_archive_dialog_new (_("New Archive"), GTK_WINDOW (window), FR_NEW_ARCHIVE_ACTION_NEW_MANY_FILES, fr_window_get_open_default_dir (window), NULL, NULL); if ((fr_window_archive_is_present (window) && ! fr_window_is_batch_mode (window) ? NULL : GTK_WINDOW (window))) gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (new_archive_dialog_response_cb), window); fr_window_set_dialog (window, "new_archive", dialog); gtk_window_present (GTK_WINDOW (dialog)); }
0
312,422
qf_guess_filepath(qf_list_T *qfl, char_u *filename) { struct dir_stack_T *ds_ptr; struct dir_stack_T *ds_tmp; char_u *fullname; // no dirs on the stack - there's nothing we can do if (qfl->qf_dir_stack == NULL) return NULL; ds_ptr = qfl->qf_dir_stack->next; fullname = NULL; while (ds_ptr) { vim_free(fullname); fullname = concat_fnames(ds_ptr->dirname, filename, TRUE); // If concat_fnames failed, just go on. The worst thing that can happen // is that we delete the entire stack. if ((fullname != NULL) && (mch_getperm(fullname) >= 0)) break; ds_ptr = ds_ptr->next; } vim_free(fullname); // clean up all dirs we already left while (qfl->qf_dir_stack->next != ds_ptr) { ds_tmp = qfl->qf_dir_stack->next; qfl->qf_dir_stack->next = qfl->qf_dir_stack->next->next; vim_free(ds_tmp->dirname); vim_free(ds_tmp); } return ds_ptr == NULL ? NULL : ds_ptr->dirname; }
0
389,681
tv_get_string_buf_chk_strict(typval_T *varp, char_u *buf, int strict) { switch (varp->v_type) { case VAR_NUMBER: if (strict) { emsg(_(e_using_number_as_string)); break; } vim_snprintf((char *)buf, NUMBUFLEN, "%lld", (varnumber_T)varp->vval.v_number); return buf; case VAR_FUNC: case VAR_PARTIAL: emsg(_(e_using_funcref_as_string)); break; case VAR_LIST: emsg(_(e_using_list_as_string)); break; case VAR_DICT: emsg(_(e_using_dictionary_as_string)); break; case VAR_FLOAT: #ifdef FEAT_FLOAT if (strict) { emsg(_(e_using_float_as_string)); break; } vim_snprintf((char *)buf, NUMBUFLEN, "%g", varp->vval.v_float); return buf; #endif case VAR_STRING: if (varp->vval.v_string != NULL) return varp->vval.v_string; return (char_u *)""; case VAR_BOOL: case VAR_SPECIAL: STRCPY(buf, get_var_special_name(varp->vval.v_number)); return buf; case VAR_BLOB: emsg(_(e_using_blob_as_string)); break; case VAR_JOB: #ifdef FEAT_JOB_CHANNEL if (in_vim9script()) { semsg(_(e_using_invalid_value_as_string_str), "job"); break; } return job_to_string_buf(varp, buf); #endif break; case VAR_CHANNEL: #ifdef FEAT_JOB_CHANNEL if (in_vim9script()) { semsg(_(e_using_invalid_value_as_string_str), "channel"); break; } return channel_to_string_buf(varp, buf); #endif break; case VAR_VOID: emsg(_(e_cannot_use_void_value)); break; case VAR_UNKNOWN: case VAR_ANY: case VAR_INSTR: semsg(_(e_using_invalid_value_as_string_str), vartype_name(varp->v_type)); break; } return NULL; }
0
336,145
static int ip6gre_tunnel_init(struct net_device *dev) { struct ip6_tnl *tunnel; int ret; ret = ip6gre_tunnel_init_common(dev); if (ret) return ret; tunnel = netdev_priv(dev); memcpy(dev->dev_addr, &tunnel->parms.laddr, sizeof(struct in6_addr)); memcpy(dev->broadcast, &tunnel->parms.raddr, sizeof(struct in6_addr)); if (ipv6_addr_any(&tunnel->parms.raddr)) dev->header_ops = &ip6gre_header_ops; return 0; }
0
521,468
void runTest() override { beginTest ("ZIP"); StringArray entryNames { "first", "second", "third" }; auto data = createZipMemoryBlock (entryNames); MemoryInputStream mi (data, false); ZipFile zip (mi); expectEquals (zip.getNumEntries(), entryNames.size()); for (auto& entryName : entryNames) { auto* entry = zip.getEntry (entryName); std::unique_ptr<InputStream> input (zip.createStreamForEntry (*entry)); expectEquals (input->readEntireStreamAsString(), entryName); } beginTest ("ZipSlip"); runZipSlipTest(); }
0
265,541
int mempool_create(size_t pool_item_size, size_t pool_initial_size, size_t pool_expansion_size, size_t pool_max_threshold_size, func_log_callback_type log_callback_func, int flags, MemoryPoolHandle *handle) { int rc; int bufs_to_allocate; struct mempool *pool = NULL; /* pool_max_threshold_size == 0 is possible when func_mem_available_callback_type is used. */ if (pool_item_size == 0 || pool_expansion_size == 0 || handle == NULL) { return S3_MEMPOOL_INVALID_ARG; } /* Minimum size of the pool's buffer will be sizeof pointer */ if (pool_item_size < sizeof(struct memory_pool_element)) { pool_item_size = sizeof(struct memory_pool_element); } *handle = NULL; pool = (struct mempool *)calloc(1, sizeof(struct mempool)); if (pool == NULL) { return S3_MEMPOOL_ERROR; } pool->flags |= flags; pool->mempool_item_size = pool_item_size; if (flags & CREATE_ALIGNED_MEMORY) { pool->alignment = MEMORY_ALIGNMENT; } if ((pool->flags & ENABLE_LOCKING) != 0) { rc = pthread_mutex_init(&pool->lock, NULL); if (rc != 0) { free(pool); return S3_MEMPOOL_ERROR; } } *handle = (MemoryPoolHandle)pool; pool->log_callback_func = log_callback_func; pool->expandable_size = pool_expansion_size; pool->max_memory_threshold = pool_max_threshold_size; /* Figure out the size of free list to be preallocated from given initial pool * size */ bufs_to_allocate = pool_initial_size / pool_item_size; /* Allocate the free list */ if (bufs_to_allocate > 0) { rc = freelist_allocate(pool, bufs_to_allocate); if (rc != 0) { goto fail; } } return 0; fail: mempool_destroy(handle); *handle = NULL; return S3_MEMPOOL_ERROR; }
0
409,486
find_first_tcap( char_u *name, int code) { struct builtin_term *p; for (p = find_builtin_term(name); p->bt_string != NULL; ++p) if (p->bt_entry == code) return p; return NULL; }
0
234,224
get_gdb_index_symbol_kind_name (gdb_index_symbol_kind kind) { /* See gdb/gdb-index.h. */ static const char * const kinds[] = { N_ ("no info"), N_ ("type"), N_ ("variable"), N_ ("function"), N_ ("other"), N_ ("unused5"), N_ ("unused6"), N_ ("unused7") }; return _ (kinds[kind]); }
0
484,788
static int xennet_open(struct net_device *dev) { struct netfront_info *np = netdev_priv(dev); unsigned int num_queues = dev->real_num_tx_queues; unsigned int i = 0; struct netfront_queue *queue = NULL; if (!np->queues || np->broken) return -ENODEV; for (i = 0; i < num_queues; ++i) { queue = &np->queues[i]; napi_enable(&queue->napi); spin_lock_bh(&queue->rx_lock); if (netif_carrier_ok(dev)) { xennet_alloc_rx_buffers(queue); queue->rx.sring->rsp_event = queue->rx.rsp_cons + 1; if (RING_HAS_UNCONSUMED_RESPONSES(&queue->rx)) napi_schedule(&queue->napi); } spin_unlock_bh(&queue->rx_lock); } netif_tx_start_all_queues(dev); return 0; }
0
229,223
void cql_server::response::write_long(int64_t n) { auto u = htonq(n); auto *s = reinterpret_cast<const int8_t*>(&u); _body.write(bytes_view(s, sizeof(u))); }
0
513,265
remove_const(JOIN *join,ORDER *first_order, COND *cond, bool change_list, bool *simple_order) { *simple_order= join->rollup.state == ROLLUP::STATE_NONE; if (join->only_const_tables()) return change_list ? 0 : first_order; // No need to sort ORDER *order,**prev_ptr, *tmp_order; table_map UNINIT_VAR(first_table); /* protected by first_is_base_table */ table_map not_const_tables= ~join->const_table_map; table_map ref; bool first_is_base_table= FALSE; DBUG_ENTER("remove_const"); /* Join tab is set after make_join_statistics() has been called. In case of one table with GROUP BY this function is called before join_tab is set for the GROUP_BY expression */ if (join->join_tab) { if (join->join_tab[join->const_tables].table) { first_table= join->join_tab[join->const_tables].table->map; first_is_base_table= TRUE; } /* Cleanup to avoid interference of calls of this function for ORDER BY and GROUP BY */ for (JOIN_TAB *tab= join->join_tab + join->const_tables; tab < join->join_tab + join->table_count; tab++) tab->cached_eq_ref_table= FALSE; *simple_order= *join->join_tab[join->const_tables].on_expr_ref ? 0 : 1; } else { first_is_base_table= FALSE; first_table= 0; // Not used, for gcc } prev_ptr= &first_order; /* NOTE: A variable of not_const_tables ^ first_table; breaks gcc 2.7 */ update_depend_map_for_order(join, first_order); for (order=first_order; order ; order=order->next) { table_map order_tables=order->item[0]->used_tables(); if (order->item[0]->with_sum_func || order->item[0]->with_window_func || /* If the outer table of an outer join is const (either by itself or after applying WHERE condition), grouping on a field from such a table will be optimized away and filesort without temporary table will be used unless we prevent that now. Filesort is not fit to handle joins and the join condition is not applied. We can't detect the case without an expensive test, however, so we force temporary table for all queries containing more than one table, ROLLUP, and an outer join. */ (join->table_count > 1 && join->rollup.state == ROLLUP::STATE_INITED && join->outer_join)) *simple_order=0; // Must do a temp table to sort else if (!(order_tables & not_const_tables)) { if (order->item[0]->has_subquery()) { /* Delay the evaluation of constant ORDER and/or GROUP expressions that contain subqueries until the execution phase. */ join->exec_const_order_group_cond.push_back(order->item[0], join->thd->mem_root); } DBUG_PRINT("info",("removing: %s", order->item[0]->full_name())); continue; } else { if (order_tables & (RAND_TABLE_BIT | OUTER_REF_TABLE_BIT)) *simple_order=0; else { if (cond && const_expression_in_where(cond,order->item[0])) { DBUG_PRINT("info",("removing: %s", order->item[0]->full_name())); continue; } if (first_is_base_table && (ref=order_tables & (not_const_tables ^ first_table))) { if (!(order_tables & first_table) && only_eq_ref_tables(join,first_order, ref)) { DBUG_PRINT("info",("removing: %s", order->item[0]->full_name())); continue; } /* UseMultipleEqualitiesToRemoveTempTable: Can use multiple-equalities here to check that ORDER BY columns can be used without tmp. table. */ bool can_subst_to_first_table= false; bool first_is_in_sjm_nest= false; if (first_is_base_table) { TABLE_LIST *tbl_for_first= join->join_tab[join->const_tables].table->pos_in_table_list; first_is_in_sjm_nest= tbl_for_first->sj_mat_info && tbl_for_first->sj_mat_info->is_used; } /* Currently we do not employ the optimization that uses multiple equalities for ORDER BY to remove tmp table in the case when the first table happens to be the result of materialization of a semi-join nest ( <=> first_is_in_sjm_nest == true). When a semi-join nest is materialized and scanned to look for possible matches in the remaining tables for every its row the fields from the result of materialization are copied into the record buffers of tables from the semi-join nest. So these copies are used to access the remaining tables rather than the fields from the result of materialization. Unfortunately now this so-called 'copy back' technique is supported only if the rows are scanned with the rr_sequential function, but not with other rr_* functions that are employed when the result of materialization is required to be sorted. TODO: either to support 'copy back' technique for the above case, or to get rid of this technique altogether. */ if (optimizer_flag(join->thd, OPTIMIZER_SWITCH_ORDERBY_EQ_PROP) && first_is_base_table && !first_is_in_sjm_nest && order->item[0]->real_item()->type() == Item::FIELD_ITEM && join->cond_equal) { table_map first_table_bit= join->join_tab[join->const_tables].table->map; Item *item= order->item[0]; /* TODO: equality substitution in the context of ORDER BY is sometimes allowed when it is not allowed in the general case. We make the below call for its side effect: it will locate the multiple equality the item belongs to and set item->item_equal accordingly. */ Item *res= item->propagate_equal_fields(join->thd, Value_source:: Context_identity(), join->cond_equal); Item_equal *item_eq; if ((item_eq= res->get_item_equal())) { Item *first= item_eq->get_first(NO_PARTICULAR_TAB, NULL); if (first->const_item() || first->used_tables() == first_table_bit) { can_subst_to_first_table= true; } } } if (!can_subst_to_first_table) { *simple_order=0; // Must do a temp table to sort } } } } /* Remove ORDER BY entries that we have seen before */ for (tmp_order= first_order; tmp_order != order; tmp_order= tmp_order->next) { if (tmp_order->item[0]->eq(order->item[0],1)) break; } if (tmp_order != order) continue; // Duplicate order by. Remove if (change_list) *prev_ptr= order; // use this entry prev_ptr= &order->next; } if (change_list) *prev_ptr=0; if (prev_ptr == &first_order) // Nothing to sort/group *simple_order=1; #ifndef DBUG_OFF if (join->thd->is_error()) DBUG_PRINT("error",("Error from remove_const")); #endif DBUG_PRINT("exit",("simple_order: %d",(int) *simple_order)); DBUG_RETURN(first_order); }
0
310,136
decode_X10_bstate(SCREEN *sp, MEVENT * eventp, unsigned intro) { bool result; int button = 0; int wheel = (intro & 96) == 96; eventp->bstate = 0; if (intro >= 96) { if (intro >= 160) { button = (int) (intro - 152); /* buttons 8-11 */ } else if (intro >= 96) { button = (int) (intro - 92); /* buttons 4-7 */ } } else { button = (intro & 3); } if (button > MAX_BUTTONS) { eventp->bstate = REPORT_MOUSE_POSITION; } else if (!handle_wheel(sp, eventp, (int) intro, wheel)) { /* * Release events aren't reported for individual buttons, just for * the button set as a whole. However, because there are normally * no mouse events under xterm that intervene between press and * release, we can infer the button actually released by looking at * the previous event. */ if (sp->_mouse_bstate & BUTTON_PRESSED) { int b; eventp->bstate = BUTTON_RELEASED; for (b = 1; b <= MAX_BUTTONS; ++b) { if (!(sp->_mouse_bstate & MASK_PRESS(b))) eventp->bstate &= ~MASK_RELEASE(b); } sp->_mouse_bstate = 0; } else { /* * xterm will return a stream of release-events to let the * application know where the mouse is going, if private mode * 1002 or 1003 is enabled. */ eventp->bstate = REPORT_MOUSE_POSITION; } } if (intro & 4) { eventp->bstate |= BUTTON_SHIFT; } if (intro & 8) { eventp->bstate |= BUTTON_ALT; } if (intro & 16) { eventp->bstate |= BUTTON_CTRL; } result = (eventp->bstate & REPORT_MOUSE_POSITION) ? TRUE : FALSE; return result; }
0
261,737
BufferRaw::Ptr RtmpProtocol::obtainBuffer(const void *data, size_t len) { auto buffer = _packet_pool.obtain2(); if (data && len) { buffer->assign((const char *) data, len); } return buffer; }
0
273,885
static void handle_SYST(ctrl_t *ctrl, char *arg) { char system[] = "215 UNIX Type: L8\r\n"; send_msg(ctrl->sd, system); }
0
506,429
rpa_check_message(const unsigned char *data, const unsigned char *end, const char **error) { const unsigned char *p = data; unsigned int len = 0; if (p + 2 > end) { *error = "message too short"; return NULL; } if (*p++ != ASN1_APPLICATION) { *error = "invalid data type"; return NULL; } if ((*p & 0x80) != 0) { unsigned int nbytes = *p++ & 0x7f; while (nbytes-- > 0) { if (p >= end) { *error = "invalid structure length"; return NULL; } len = (len << 8) | *p++; } } else len = *p++; if ((size_t)(end - p) != len) { *error = "structure length disagrees with data size"; return NULL; } if (p + sizeof(rpa_oid) > end) { *error = "not enough space for object id"; return NULL; } if (memcmp(p, rpa_oid, sizeof(rpa_oid)) != 0) { *error = "invalid object id"; return NULL; } return p + sizeof(rpa_oid); }
0
517,456
static void do_home_net(HttpResponse res) { char buf[STRLEN]; boolean_t on = true; boolean_t header = true; for (Service_T s = servicelist_conf; s; s = s->next_conf) { if (s->type != Service_Net) continue; if (header) { StringBuffer_append(res->outputbuffer, "<table id='header-row'>" "<tr>" "<th class='left first'>Net</th>" "<th class='left'>Status</th>" "<th class='right'>Upload</th>" "<th class='right'>Download</th>" "</tr>"); header = false; } StringBuffer_append(res->outputbuffer, "<tr %s>" "<td class='left'><a href='%s'>%s</a></td>" "<td class='left'>%s</td>", on ? "class='stripe'" : "", s->name, s->name, get_service_status(HTML, s, buf, sizeof(buf))); if (! Util_hasServiceStatus(s) || Link_getState(s->inf.net->stats) != 1) { StringBuffer_append(res->outputbuffer, "<td class='right'>-</td>"); StringBuffer_append(res->outputbuffer, "<td class='right'>-</td>"); } else { StringBuffer_append(res->outputbuffer, "<td class='right'>%s&#47;s</td>", Fmt_bytes2str(Link_getBytesOutPerSecond(s->inf.net->stats), buf)); StringBuffer_append(res->outputbuffer, "<td class='right'>%s&#47;s</td>", Fmt_bytes2str(Link_getBytesInPerSecond(s->inf.net->stats), buf)); } StringBuffer_append(res->outputbuffer, "</tr>"); on = ! on; } if (! header) StringBuffer_append(res->outputbuffer, "</table>"); }
0
225,552
TfLiteIntArray* TfLiteIntArrayCreate(int size) { size_t alloc_size = TfLiteIntArrayGetSizeInBytes(size); if (alloc_size <= 0) return NULL; TfLiteIntArray* ret = (TfLiteIntArray*)malloc(alloc_size); if (!ret) return ret; ret->size = size; return ret; }
0
218,798
static void XDrawBeveledButton(Display *display,const XWindowInfo *window_info, const XWidgetInfo *button_info) { int x, y; unsigned int width; XFontStruct *font_info; XRectangle crop_info; /* Draw matte. */ XDrawBevel(display,window_info,button_info); XSetMatteColor(display,window_info,button_info->raised); (void) XFillRectangle(display,window_info->id,window_info->widget_context, button_info->x,button_info->y,button_info->width,button_info->height); x=button_info->x-button_info->bevel_width-1; y=button_info->y-button_info->bevel_width-1; (void) XSetForeground(display,window_info->widget_context, window_info->pixel_info->trough_color.pixel); if (button_info->raised || (window_info->depth == 1)) (void) XDrawRectangle(display,window_info->id,window_info->widget_context, x,y,button_info->width+(button_info->bevel_width << 1)+1, button_info->height+(button_info->bevel_width << 1)+1); if (button_info->text == (char *) NULL) return; /* Set cropping region. */ crop_info.width=(unsigned short) button_info->width; crop_info.height=(unsigned short) button_info->height; crop_info.x=button_info->x; crop_info.y=button_info->y; /* Draw text. */ font_info=window_info->font_info; width=WidgetTextWidth(font_info,button_info->text); x=button_info->x+(QuantumMargin >> 1); if (button_info->center) x=button_info->x+(button_info->width >> 1)-(width >> 1); y=button_info->y+((button_info->height- (font_info->ascent+font_info->descent)) >> 1)+font_info->ascent; if ((int) button_info->width == (QuantumMargin >> 1)) { /* Option button-- write label to right of button. */ XSetTextColor(display,window_info,MagickTrue); x=button_info->x+button_info->width+button_info->bevel_width+ (QuantumMargin >> 1); (void) XDrawString(display,window_info->id,window_info->widget_context, x,y,button_info->text,Extent(button_info->text)); return; } (void) XSetClipRectangles(display,window_info->widget_context,0,0,&crop_info, 1,Unsorted); XSetTextColor(display,window_info,button_info->raised); (void) XDrawString(display,window_info->id,window_info->widget_context,x,y, button_info->text,Extent(button_info->text)); (void) XSetClipMask(display,window_info->widget_context,None); if (button_info->raised == MagickFalse) XDelay(display,SuspendTime << 2); }
0
245,166
read_mysql_variables(MYSQL *connection, const char *query, mysql_variable *vars, bool vertical_result) { MYSQL_RES *mysql_result = xb_mysql_query(connection, query, true); read_mysql_variables_from_result(mysql_result, vars, vertical_result); mysql_free_result(mysql_result); }
0
229,339
bool KernelCacheEnabled(const OpDef& op_def) { if (data::DatasetOpKernel::IsDatasetOp(op_def)) { return false; } // TODO(b/162540360): Revisit a way to mark kernels as uncachable once we have // 5+ kernels to exclude. return true; }
0
225,842
GF_Err dmed_box_write(GF_Box *s, GF_BitStream *bs) { GF_Err e; GF_DMEDBox *ptr = (GF_DMEDBox *)s; if (ptr == NULL) return GF_BAD_PARAM; e = gf_isom_box_write_header(s, bs); if (e) return e; gf_bs_write_u64(bs, ptr->nbBytes); return GF_OK; }
0
389,714
check_for_opt_buffer_or_dict_arg(typval_T *args, int idx) { if (args[idx].v_type != VAR_UNKNOWN && args[idx].v_type != VAR_STRING && args[idx].v_type != VAR_NUMBER && args[idx].v_type != VAR_DICT) { semsg(_(e_string_required_for_argument_nr), idx + 1); return FAIL; } return OK; }
0
261,931
njs_string_prototype_from_utf8(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs, njs_index_t unused) { ssize_t length; njs_int_t ret; njs_slice_prop_t slice; njs_string_prop_t string; ret = njs_string_object_validate(vm, njs_argument(args, 0)); if (njs_slow_path(ret != NJS_OK)) { return ret; } ret = njs_string_slice_prop(vm, &string, &slice, args, nargs); if (njs_slow_path(ret != NJS_OK)) { return ret; } if (string.length != 0) { /* ASCII or UTF8 string. */ return njs_string_slice(vm, &vm->retval, &string, &slice); } string.start += slice.start; length = njs_utf8_length(string.start, slice.length); if (length >= 0) { return njs_string_new(vm, &vm->retval, string.start, slice.length, length); } vm->retval = njs_value_null; return NJS_OK; }
0
336,678
static red::shared_ptr<RedVDIReadBuf> vdi_port_get_read_buf(RedCharDeviceVDIPort *dev) { if (dev->priv->num_read_buf >= REDS_VDI_PORT_NUM_RECEIVE_BUFFS) { return red::shared_ptr<RedVDIReadBuf>(); } dev->priv->num_read_buf++; return vdi_read_buf_new(dev); }
0
247,743
TEST_P(SslSocketTest, TicketSessionResumptionDifferentServerNames) { const std::string server_ctx_yaml1 = R"EOF( common_tls_context: tls_certificates: certificate_chain: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_dns_cert.pem" private_key: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_dns_key.pem" session_ticket_keys: keys: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/ticket_key_a" )EOF"; const std::string server_ctx_yaml2 = R"EOF( common_tls_context: tls_certificates: certificate_chain: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_dns_cert.pem" private_key: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_dns_key.pem" session_ticket_keys: keys: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/ticket_key_a" )EOF"; std::vector<std::string> server_names1 = {"server1.example.com"}; const std::string client_ctx_yaml = R"EOF( common_tls_context: )EOF"; testTicketSessionResumption(server_ctx_yaml1, server_names1, server_ctx_yaml2, {}, client_ctx_yaml, false, GetParam()); }
0
240,290
get_yank_register(int regname, int writing) { int i; int ret = FALSE; y_append = FALSE; if ((regname == 0 || regname == '"') && !writing && y_previous != NULL) { y_current = y_previous; return ret; } i = regname; if (VIM_ISDIGIT(i)) i -= '0'; else if (ASCII_ISLOWER(i)) i = CharOrdLow(i) + 10; else if (ASCII_ISUPPER(i)) { i = CharOrdUp(i) + 10; y_append = TRUE; } else if (regname == '-') i = DELETION_REGISTER; #ifdef FEAT_CLIPBOARD // When selection is not available, use register 0 instead of '*' else if (clip_star.available && regname == '*') { i = STAR_REGISTER; ret = TRUE; } // When clipboard is not available, use register 0 instead of '+' else if (clip_plus.available && regname == '+') { i = PLUS_REGISTER; ret = TRUE; } #endif #ifdef FEAT_DND else if (!writing && regname == '~') i = TILDE_REGISTER; #endif else // not 0-9, a-z, A-Z or '-': use register 0 i = 0; y_current = &(y_regs[i]); if (writing) // remember the register we write into for do_put() y_previous = y_current; return ret; }
0
282,855
int rsi_send_aggregation_params_frame(struct rsi_common *common, u16 tid, u16 ssn, u8 buf_size, u8 event, u8 sta_id) { struct sk_buff *skb = NULL; struct rsi_aggr_params *aggr_params; u16 frame_len = sizeof(struct rsi_aggr_params); skb = dev_alloc_skb(frame_len); if (!skb) { rsi_dbg(ERR_ZONE, "%s: Failed in allocation of skb\n", __func__); return -ENOMEM; } memset(skb->data, 0, frame_len); aggr_params = (struct rsi_aggr_params *)skb->data; rsi_dbg(MGMT_TX_ZONE, "%s: Sending AMPDU indication frame\n", __func__); rsi_set_len_qno(&aggr_params->desc_dword0.len_qno, 0, RSI_WIFI_MGMT_Q); aggr_params->desc_dword0.frame_type = AMPDU_IND; aggr_params->aggr_params = tid & RSI_AGGR_PARAMS_TID_MASK; aggr_params->peer_id = sta_id; if (event == STA_TX_ADDBA_DONE) { aggr_params->seq_start = cpu_to_le16(ssn); aggr_params->baw_size = cpu_to_le16(buf_size); aggr_params->aggr_params |= RSI_AGGR_PARAMS_START; } else if (event == STA_RX_ADDBA_DONE) { aggr_params->seq_start = cpu_to_le16(ssn); aggr_params->aggr_params |= (RSI_AGGR_PARAMS_START | RSI_AGGR_PARAMS_RX_AGGR); } else if (event == STA_RX_DELBA) { aggr_params->aggr_params |= RSI_AGGR_PARAMS_RX_AGGR; } skb_put(skb, frame_len); return rsi_send_internal_mgmt_frame(common, skb); }
0
224,470
static GF_Err gf_text_process_sub(GF_Filter *filter, GF_TXTIn *ctx) { u32 i, j, len, line; GF_TextSample *samp; Double ts_scale; char szLine[2048], szTime[20], szText[2048]; //same setup as for srt if (!ctx->is_setup) { ctx->is_setup = GF_TRUE; return txtin_setup_srt(filter, ctx); } if (!ctx->opid) return GF_NOT_SUPPORTED; if (!ctx->playstate) return GF_OK; else if (ctx->playstate==2) return GF_EOS; if (ctx->seek_state==1) { ctx->seek_state = 2; gf_fseek(ctx->src, 0, SEEK_SET); } if (ctx->fps.den && ctx->fps.num) { ts_scale = ((Double) ctx->fps.num) / ctx->fps.den; } else { ts_scale = 25; } line = 0; while (1) { char *sOK = gf_text_get_utf8_line(szLine, 2048, ctx->src, ctx->unicode_type); if (!sOK) break; REM_TRAIL_MARKS(szLine, "\r\n\t ") line++; len = (u32) strlen(szLine); if (!len) continue; i=0; if (szLine[i] != '{') { GF_LOG(GF_LOG_ERROR, GF_LOG_PARSER, ("[TXTIn] Bad SUB file (line %d): expecting \"{\" got \"%c\"\n", line, szLine[i])); continue; } while (szLine[i+1] && szLine[i+1]!='}') { szTime[i] = szLine[i+1]; i++; if (i>=19) break; } szTime[i] = 0; ctx->start = atoi(szTime); if (ctx->start < ctx->end) { GF_LOG(GF_LOG_WARNING, GF_LOG_PARSER, ("[TXTIn] corrupted SUB frame (line %d) - starts (at %d ms) before end of previous one (%d ms) - adjusting time stamps\n", line, ctx->start, ctx->end)); ctx->start = ctx->end; } j=i+2; i=0; if (szLine[i+j] != '{') { GF_LOG(GF_LOG_WARNING, GF_LOG_PARSER, ("[TXTIn] Bad SUB file - expecting \"{\" got \"%c\"\n", szLine[i])); continue; } while (szLine[i+1+j] && szLine[i+1+j]!='}') { szTime[i] = szLine[i+1+j]; i++; } szTime[i] = 0; ctx->end = atoi(szTime); j+=i+2; if (ctx->start > ctx->end) { GF_LOG(GF_LOG_WARNING, GF_LOG_PARSER, ("[TXTIn] corrupted SUB frame (line %d) - ends (at %d ms) before start of current frame (%d ms) - skipping\n", line, ctx->end, ctx->start)); continue; } if (ctx->start && ctx->first_samp) { samp = gf_isom_new_text_sample(); txtin_process_send_text_sample(ctx, samp, 0, (u32) (ts_scale*ctx->start), GF_TRUE); ctx->first_samp = GF_FALSE; gf_isom_delete_text_sample(samp); } for (i=j; i<len; i++) { if (szLine[i]=='|') { szText[i-j] = '\n'; } else { szText[i-j] = szLine[i]; } } szText[i-j] = 0; if (ctx->prev_end) { samp = gf_isom_new_text_sample(); txtin_process_send_text_sample(ctx, samp, (u64) (ts_scale*(s64)ctx->prev_end), (u32) (ts_scale*(ctx->start - ctx->prev_end)), GF_TRUE); gf_isom_delete_text_sample(samp); } samp = gf_isom_new_text_sample(); gf_isom_text_add_text(samp, szText, (u32) strlen(szText) ); txtin_process_send_text_sample(ctx, samp, (u64) (ts_scale*(s64)ctx->start), (u32) (ts_scale*(ctx->end - ctx->start)), GF_TRUE); gf_isom_delete_text_sample(samp); ctx->prev_end = ctx->end; gf_filter_pid_set_info(ctx->opid, GF_PROP_PID_DOWN_BYTES, &PROP_LONGUINT( gf_ftell(ctx->src )) ); if (gf_filter_pid_would_block(ctx->opid)) return GF_OK; } /*final flush*/ if (ctx->end && !ctx->noflush) { samp = gf_isom_new_text_sample(); txtin_process_send_text_sample(ctx, samp, (u64) (ts_scale*(s64)ctx->end), 0, GF_TRUE); gf_isom_delete_text_sample(samp); } gf_filter_pid_set_info_str( ctx->opid, "ttxt:last_dur", &PROP_UINT(0) ); return GF_EOS; }
0
101,676
void WebProcessProxy::didUpdateHistoryTitle(uint64_t pageID, const String& title, const String& url, uint64_t frameID) { WebPageProxy* page = webPage(pageID); if (!page) return; WebFrameProxy* frame = webFrame(frameID); MESSAGE_CHECK(frame); MESSAGE_CHECK(frame->page() == page); MESSAGE_CHECK_URL(url); m_context->historyClient().didUpdateHistoryTitle(m_context.get(), page, title, url, frame); }
0
463,198
static int rw_cb(const char *mailbox __attribute__((unused)), uint32_t uid __attribute__((unused)), const char *entry, const char *userid, const struct buf *value, const struct annotate_metadata *mdata __attribute__((unused)), void *rock) { annotate_state_t *state = (annotate_state_t *)rock; if (!userid[0] || !strcmp(userid, state->userid)) { output_entryatt(state, entry, userid, value); } return 0; }
0
436,065
static int io_statx_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) { if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL)) return -EINVAL; if (sqe->ioprio || sqe->buf_index) return -EINVAL; if (req->flags & REQ_F_FIXED_FILE) return -EBADF; req->statx.dfd = READ_ONCE(sqe->fd); req->statx.mask = READ_ONCE(sqe->len); req->statx.filename = u64_to_user_ptr(READ_ONCE(sqe->addr)); req->statx.buffer = u64_to_user_ptr(READ_ONCE(sqe->addr2)); req->statx.flags = READ_ONCE(sqe->statx_flags); return 0; }
0
328,880
R_API char *r_bin_java_build_obj_key(RBinJavaObj *bin) { char *cname = r_bin_java_get_this_class_name (bin); char *jvcname = cname? r_str_newf ("%d.%s.class", bin->id, cname) : r_str_newf ("%d._unknown_.class", bin->id); free (cname); return jvcname; }
0
513,363
join_read_last_key(JOIN_TAB *tab) { int error; TABLE *table= tab->table; if (!table->file->inited && (error= table->file->ha_index_init(tab->ref.key, tab->sorted))) { (void) report_error(table, error); return 1; } if (cp_buffer_from_ref(tab->join->thd, table, &tab->ref)) return -1; if ((error= table->file->prepare_index_key_scan_map(tab->ref.key_buff, make_prev_keypart_map(tab->ref.key_parts)))) { report_error(table,error); return -1; } if ((error= table->file->ha_index_read_map(table->record[0], tab->ref.key_buff, make_prev_keypart_map(tab->ref.key_parts), HA_READ_PREFIX_LAST))) { if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE) return report_error(table, error); return -1; /* purecov: inspected */ } return 0; }
0
253,998
static int vidioc_s_std(struct file *file, void *private_data, v4l2_std_id *_std) { v4l2_std_id req_std = 0, supported_std = 0; const v4l2_std_id all_std = V4L2_STD_ALL, no_std = 0; if (_std) { req_std = *_std; *_std = all_std; } /* we support everything in V4L2_STD_ALL, but not more... */ supported_std = (all_std & req_std); if (no_std == supported_std) return -EINVAL; return 0; }
0
477,383
R_API RBinJavaAttrInfo *r_bin_java_deprecated_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) { RBinJavaAttrInfo *attr = NULL; ut64 offset = 0; attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset); offset += 6; if (attr) { attr->type = R_BIN_JAVA_ATTR_TYPE_DEPRECATED_ATTR; attr->size = offset; } // IFDBG r_bin_java_print_deprecated_attr_summary(attr); return attr; }
0
338,136
bool WasmBinaryBuilder::maybeVisitTruncSat(Expression*& out, uint32_t code) { Unary* curr; switch (code) { case BinaryConsts::I32STruncSatF32: curr = allocator.alloc<Unary>(); curr->op = TruncSatSFloat32ToInt32; break; case BinaryConsts::I32UTruncSatF32: curr = allocator.alloc<Unary>(); curr->op = TruncSatUFloat32ToInt32; break; case BinaryConsts::I32STruncSatF64: curr = allocator.alloc<Unary>(); curr->op = TruncSatSFloat64ToInt32; break; case BinaryConsts::I32UTruncSatF64: curr = allocator.alloc<Unary>(); curr->op = TruncSatUFloat64ToInt32; break; case BinaryConsts::I64STruncSatF32: curr = allocator.alloc<Unary>(); curr->op = TruncSatSFloat32ToInt64; break; case BinaryConsts::I64UTruncSatF32: curr = allocator.alloc<Unary>(); curr->op = TruncSatUFloat32ToInt64; break; case BinaryConsts::I64STruncSatF64: curr = allocator.alloc<Unary>(); curr->op = TruncSatSFloat64ToInt64; break; case BinaryConsts::I64UTruncSatF64: curr = allocator.alloc<Unary>(); curr->op = TruncSatUFloat64ToInt64; break; default: return false; } BYN_TRACE("zz node: Unary (nontrapping float-to-int)\n"); curr->value = popNonVoidExpression(); curr->finalize(); out = curr; return true; }
0
508,899
bool st_select_lex::add_gorder_to_list(THD *thd, Item *item, bool asc) { return add_to_list(thd, gorder_list, item, asc); }
0
317,131
static int selinux_capset(struct cred *new, const struct cred *old, const kernel_cap_t *effective, const kernel_cap_t *inheritable, const kernel_cap_t *permitted) { return avc_has_perm(&selinux_state, cred_sid(old), cred_sid(new), SECCLASS_PROCESS, PROCESS__SETCAP, NULL); }
0
326,106
reginsert_nr(int op, long val, char_u *opnd) { char_u *src; char_u *dst; char_u *place; if (regcode == JUST_CALC_SIZE) { regsize += 7; return; } src = regcode; regcode += 7; dst = regcode; while (src > opnd) *--dst = *--src; place = opnd; // Op node, where operand used to be. *place++ = op; *place++ = NUL; *place++ = NUL; re_put_long(place, (long_u)val); }
0
225,797
void dimm_box_del(GF_Box *s) { gf_free((GF_DIMMBox *)s); }
0
259,181
static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom) { char tmp_key[AV_FOURCC_MAX_STRING_SIZE] = {0}; char key2[32], language[4] = {0}; char *str = NULL; const char *key = NULL; uint16_t langcode = 0; uint32_t data_type = 0, str_size, str_size_alloc; int (*parse)(MOVContext*, AVIOContext*, unsigned, const char*) = NULL; int raw = 0; int num = 0; switch (atom.type) { case MKTAG( '@','P','R','M'): key = "premiere_version"; raw = 1; break; case MKTAG( '@','P','R','Q'): key = "quicktime_version"; raw = 1; break; case MKTAG( 'X','M','P','_'): if (c->export_xmp) { key = "xmp"; raw = 1; } break; case MKTAG( 'a','A','R','T'): key = "album_artist"; break; case MKTAG( 'a','k','I','D'): key = "account_type"; parse = mov_metadata_int8_no_padding; break; case MKTAG( 'a','p','I','D'): key = "account_id"; break; case MKTAG( 'c','a','t','g'): key = "category"; break; case MKTAG( 'c','p','i','l'): key = "compilation"; parse = mov_metadata_int8_no_padding; break; case MKTAG( 'c','p','r','t'): key = "copyright"; break; case MKTAG( 'd','e','s','c'): key = "description"; break; case MKTAG( 'd','i','s','k'): key = "disc"; parse = mov_metadata_track_or_disc_number; break; case MKTAG( 'e','g','i','d'): key = "episode_uid"; parse = mov_metadata_int8_no_padding; break; case MKTAG( 'F','I','R','M'): key = "firmware"; raw = 1; break; case MKTAG( 'g','n','r','e'): key = "genre"; parse = mov_metadata_gnre; break; case MKTAG( 'h','d','v','d'): key = "hd_video"; parse = mov_metadata_int8_no_padding; break; case MKTAG( 'H','M','M','T'): return mov_metadata_hmmt(c, pb, atom.size); case MKTAG( 'k','e','y','w'): key = "keywords"; break; case MKTAG( 'l','d','e','s'): key = "synopsis"; break; case MKTAG( 'l','o','c','i'): return mov_metadata_loci(c, pb, atom.size); case MKTAG( 'm','a','n','u'): key = "make"; break; case MKTAG( 'm','o','d','l'): key = "model"; break; case MKTAG( 'p','c','s','t'): key = "podcast"; parse = mov_metadata_int8_no_padding; break; case MKTAG( 'p','g','a','p'): key = "gapless_playback"; parse = mov_metadata_int8_no_padding; break; case MKTAG( 'p','u','r','d'): key = "purchase_date"; break; case MKTAG( 'r','t','n','g'): key = "rating"; parse = mov_metadata_int8_no_padding; break; case MKTAG( 's','o','a','a'): key = "sort_album_artist"; break; case MKTAG( 's','o','a','l'): key = "sort_album"; break; case MKTAG( 's','o','a','r'): key = "sort_artist"; break; case MKTAG( 's','o','c','o'): key = "sort_composer"; break; case MKTAG( 's','o','n','m'): key = "sort_name"; break; case MKTAG( 's','o','s','n'): key = "sort_show"; break; case MKTAG( 's','t','i','k'): key = "media_type"; parse = mov_metadata_int8_no_padding; break; case MKTAG( 't','r','k','n'): key = "track"; parse = mov_metadata_track_or_disc_number; break; case MKTAG( 't','v','e','n'): key = "episode_id"; break; case MKTAG( 't','v','e','s'): key = "episode_sort"; parse = mov_metadata_int8_bypass_padding; break; case MKTAG( 't','v','n','n'): key = "network"; break; case MKTAG( 't','v','s','h'): key = "show"; break; case MKTAG( 't','v','s','n'): key = "season_number"; parse = mov_metadata_int8_bypass_padding; break; case MKTAG(0xa9,'A','R','T'): key = "artist"; break; case MKTAG(0xa9,'P','R','D'): key = "producer"; break; case MKTAG(0xa9,'a','l','b'): key = "album"; break; case MKTAG(0xa9,'a','u','t'): key = "artist"; break; case MKTAG(0xa9,'c','h','p'): key = "chapter"; break; case MKTAG(0xa9,'c','m','t'): key = "comment"; break; case MKTAG(0xa9,'c','o','m'): key = "composer"; break; case MKTAG(0xa9,'c','p','y'): key = "copyright"; break; case MKTAG(0xa9,'d','a','y'): key = "date"; break; case MKTAG(0xa9,'d','i','r'): key = "director"; break; case MKTAG(0xa9,'d','i','s'): key = "disclaimer"; break; case MKTAG(0xa9,'e','d','1'): key = "edit_date"; break; case MKTAG(0xa9,'e','n','c'): key = "encoder"; break; case MKTAG(0xa9,'f','m','t'): key = "original_format"; break; case MKTAG(0xa9,'g','e','n'): key = "genre"; break; case MKTAG(0xa9,'g','r','p'): key = "grouping"; break; case MKTAG(0xa9,'h','s','t'): key = "host_computer"; break; case MKTAG(0xa9,'i','n','f'): key = "comment"; break; case MKTAG(0xa9,'l','y','r'): key = "lyrics"; break; case MKTAG(0xa9,'m','a','k'): key = "make"; break; case MKTAG(0xa9,'m','o','d'): key = "model"; break; case MKTAG(0xa9,'n','a','m'): key = "title"; break; case MKTAG(0xa9,'o','p','e'): key = "original_artist"; break; case MKTAG(0xa9,'p','r','d'): key = "producer"; break; case MKTAG(0xa9,'p','r','f'): key = "performers"; break; case MKTAG(0xa9,'r','e','q'): key = "playback_requirements"; break; case MKTAG(0xa9,'s','r','c'): key = "original_source"; break; case MKTAG(0xa9,'s','t','3'): key = "subtitle"; break; case MKTAG(0xa9,'s','w','r'): key = "encoder"; break; case MKTAG(0xa9,'t','o','o'): key = "encoder"; break; case MKTAG(0xa9,'t','r','k'): key = "track"; break; case MKTAG(0xa9,'u','r','l'): key = "URL"; break; case MKTAG(0xa9,'w','r','n'): key = "warning"; break; case MKTAG(0xa9,'w','r','t'): key = "composer"; break; case MKTAG(0xa9,'x','y','z'): key = "location"; break; } retry: if (c->itunes_metadata && atom.size > 8) { int data_size = avio_rb32(pb); int tag = avio_rl32(pb); if (tag == MKTAG('d','a','t','a') && data_size <= atom.size && data_size >= 16) { data_type = avio_rb32(pb); // type avio_rb32(pb); // unknown str_size = data_size - 16; atom.size -= 16; if (!key && c->found_hdlr_mdta && c->meta_keys) { uint32_t index = av_bswap32(atom.type); // BE number has been read as LE if (index < c->meta_keys_count && index > 0) { key = c->meta_keys[index]; } else if (atom.type != MKTAG('c', 'o', 'v', 'r')) { av_log(c->fc, AV_LOG_WARNING, "The index of 'data' is out of range: %"PRId32" < 1 or >= %d.\n", index, c->meta_keys_count); } } if (atom.type == MKTAG('c', 'o', 'v', 'r') || (key && !strcmp(key, "com.apple.quicktime.artwork"))) { int ret = mov_read_covr(c, pb, data_type, str_size); if (ret < 0) { av_log(c->fc, AV_LOG_ERROR, "Error parsing cover art.\n"); return ret; } atom.size -= str_size; if (atom.size > 8) goto retry; return ret; } } else return 0; } else if (atom.size > 4 && key && !c->itunes_metadata && !raw) { str_size = avio_rb16(pb); // string length if (str_size > atom.size) { raw = 1; avio_seek(pb, -2, SEEK_CUR); av_log(c->fc, AV_LOG_WARNING, "UDTA parsing failed retrying raw\n"); goto retry; } langcode = avio_rb16(pb); ff_mov_lang_to_iso639(langcode, language); atom.size -= 4; } else str_size = atom.size; if (c->export_all && !key) { key = av_fourcc_make_string(tmp_key, atom.type); } if (!key) return 0; if (atom.size < 0 || str_size >= INT_MAX/2) return AVERROR_INVALIDDATA; // Allocates enough space if data_type is a int32 or float32 number, otherwise // worst-case requirement for output string in case of utf8 coded input num = (data_type >= 21 && data_type <= 23); str_size_alloc = (num ? 512 : (raw ? str_size : str_size * 2)) + 1; str = av_mallocz(str_size_alloc); if (!str) return AVERROR(ENOMEM); if (parse) parse(c, pb, str_size, key); else { if (!raw && (data_type == 3 || (data_type == 0 && (langcode < 0x400 || langcode == 0x7fff)))) { // MAC Encoded mov_read_mac_string(c, pb, str_size, str, str_size_alloc); } else if (data_type == 21) { // BE signed integer, variable size int val = 0; if (str_size == 1) val = (int8_t)avio_r8(pb); else if (str_size == 2) val = (int16_t)avio_rb16(pb); else if (str_size == 3) val = ((int32_t)(avio_rb24(pb)<<8))>>8; else if (str_size == 4) val = (int32_t)avio_rb32(pb); if (snprintf(str, str_size_alloc, "%d", val) >= str_size_alloc) { av_log(c->fc, AV_LOG_ERROR, "Failed to store the number (%d) in string.\n", val); av_free(str); return AVERROR_INVALIDDATA; } } else if (data_type == 22) { // BE unsigned integer, variable size unsigned int val = 0; if (str_size == 1) val = avio_r8(pb); else if (str_size == 2) val = avio_rb16(pb); else if (str_size == 3) val = avio_rb24(pb); else if (str_size == 4) val = avio_rb32(pb); if (snprintf(str, str_size_alloc, "%u", val) >= str_size_alloc) { av_log(c->fc, AV_LOG_ERROR, "Failed to store the number (%u) in string.\n", val); av_free(str); return AVERROR_INVALIDDATA; } } else if (data_type == 23 && str_size >= 4) { // BE float32 float val = av_int2float(avio_rb32(pb)); if (snprintf(str, str_size_alloc, "%f", val) >= str_size_alloc) { av_log(c->fc, AV_LOG_ERROR, "Failed to store the float32 number (%f) in string.\n", val); av_free(str); return AVERROR_INVALIDDATA; } } else if (data_type > 1 && data_type != 4) { // data_type can be 0 if not set at all above. data_type 1 means // UTF8 and 4 means "UTF8 sort". For any other type (UTF16 or e.g. // a picture), don't return it blindly in a string that is supposed // to be UTF8 text. av_log(c->fc, AV_LOG_WARNING, "Skipping unhandled metadata %s of type %d\n", key, data_type); av_free(str); return 0; } else { int ret = ffio_read_size(pb, str, str_size); if (ret < 0) { av_free(str); return ret; } str[str_size] = 0; } c->fc->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED; av_dict_set(&c->fc->metadata, key, str, 0); if (*language && strcmp(language, "und")) { snprintf(key2, sizeof(key2), "%s-%s", key, language); av_dict_set(&c->fc->metadata, key2, str, 0); } if (!strcmp(key, "encoder")) { int major, minor, micro; if (sscanf(str, "HandBrake %d.%d.%d", &major, &minor, &micro) == 3) { c->handbrake_version = 1000000*major + 1000*minor + micro; } } } av_freep(&str); return 0; }
0
477,283
int tipc_crypto_xmit(struct net *net, struct sk_buff **skb, struct tipc_bearer *b, struct tipc_media_addr *dst, struct tipc_node *__dnode) { struct tipc_crypto *__rx = tipc_node_crypto_rx(__dnode); struct tipc_crypto *tx = tipc_net(net)->crypto_tx; struct tipc_crypto_stats __percpu *stats = tx->stats; struct tipc_msg *hdr = buf_msg(*skb); struct tipc_key key = tx->key; struct tipc_aead *aead = NULL; u32 user = msg_user(hdr); u32 type = msg_type(hdr); int rc = -ENOKEY; u8 tx_key = 0; /* No encryption? */ if (!tx->working) return 0; /* Pending key if peer has active on it or probing time */ if (unlikely(key.pending)) { tx_key = key.pending; if (!tx->key_master && !key.active) goto encrypt; if (__rx && atomic_read(&__rx->peer_rx_active) == tx_key) goto encrypt; if (TIPC_SKB_CB(*skb)->xmit_type == SKB_PROBING) { pr_debug("%s: probing for key[%d]\n", tx->name, key.pending); goto encrypt; } if (user == LINK_CONFIG || user == LINK_PROTOCOL) tipc_crypto_clone_msg(net, *skb, b, dst, __dnode, SKB_PROBING); } /* Master key if this is a *vital* message or in grace period */ if (tx->key_master) { tx_key = KEY_MASTER; if (!key.active) goto encrypt; if (TIPC_SKB_CB(*skb)->xmit_type == SKB_GRACING) { pr_debug("%s: gracing for msg (%d %d)\n", tx->name, user, type); goto encrypt; } if (user == LINK_CONFIG || (user == LINK_PROTOCOL && type == RESET_MSG) || (user == MSG_CRYPTO && type == KEY_DISTR_MSG) || time_before(jiffies, tx->timer2 + TIPC_TX_GRACE_PERIOD)) { if (__rx && __rx->key_master && !atomic_read(&__rx->peer_rx_active)) goto encrypt; if (!__rx) { if (likely(!tx->legacy_user)) goto encrypt; tipc_crypto_clone_msg(net, *skb, b, dst, __dnode, SKB_GRACING); } } } /* Else, use the active key if any */ if (likely(key.active)) { tx_key = key.active; goto encrypt; } goto exit; encrypt: aead = tipc_aead_get(tx->aead[tx_key]); if (unlikely(!aead)) goto exit; rc = tipc_ehdr_build(net, aead, tx_key, *skb, __rx); if (likely(rc > 0)) rc = tipc_aead_encrypt(aead, *skb, b, dst, __dnode); exit: switch (rc) { case 0: this_cpu_inc(stats->stat[STAT_OK]); break; case -EINPROGRESS: case -EBUSY: this_cpu_inc(stats->stat[STAT_ASYNC]); *skb = NULL; return rc; default: this_cpu_inc(stats->stat[STAT_NOK]); if (rc == -ENOKEY) this_cpu_inc(stats->stat[STAT_NOKEYS]); else if (rc == -EKEYREVOKED) this_cpu_inc(stats->stat[STAT_BADKEYS]); kfree_skb(*skb); *skb = NULL; break; } tipc_aead_put(aead); return rc; }
0
512,376
Field *default_field() const { return m_default_field; }
0
344,268
static l_noret typeerror (lua_State *L, const TValue *o, const char *op, const char *extra) { const char *t = luaT_objtypename(L, o); luaG_runerror(L, "attempt to %s a %s value%s", op, t, extra); }
0
264,697
lexer_check_numbers (parser_context_t *context_p, /**< context */ const uint8_t **source_p, /**< source_pointer */ const uint8_t *source_end_p, /**< end of the source */ const ecma_char_t digit_max, /**< maximum of the number range */ const bool is_legacy) /**< is legacy octal number */ { #if !JERRY_ESNEXT JERRY_UNUSED (context_p); JERRY_UNUSED (is_legacy); #endif /* !JERRY_ESNEXT */ while (true) { while (*source_p < source_end_p && *source_p[0] >= LIT_CHAR_0 && *source_p[0] <= digit_max) { *source_p += 1; } #if JERRY_ESNEXT if (*source_p != source_end_p && *source_p[0] == LIT_CHAR_UNDERSCORE) { *source_p += 1; if (is_legacy || *source_p == source_end_p || *source_p[0] == LIT_CHAR_UNDERSCORE || *source_p[0] > digit_max || *source_p[0] < LIT_CHAR_0) { parser_raise_error (context_p, PARSER_ERR_INVALID_UNDERSCORE_IN_NUMBER); } continue; } #endif /* JERRY_ESNEXT */ break; } } /* lexer_check_numbers */
0
139,258
gfx::Point OverlayWindowViews::resize_handle_position_for_testing() const { return resize_handle_view_->origin(); }
0
181,944
gfx::Point OverlayWindowViews::close_image_position_for_testing() const { return close_controls_view_->origin(); }
0
276,904
static int do_i2c_nm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { return mod_i2c_mem (cmdtp, 0, flag, argc, argv); }
0
256,951
static bool ShouldTranspose(const TensorShape& input_shape, const std::vector<int>& permutation) { if (input_shape.dims() < 2) return false; for (int i = 0; i < permutation.size(); ++i) { if (permutation[i] != i) return true; } return false; }
0
221,128
GF_VVCConfig *gf_odf_vvc_cfg_read(u8 *dsi, u32 dsi_size) { GF_BitStream *bs = gf_bs_new(dsi, dsi_size, GF_BITSTREAM_READ); GF_VVCConfig *cfg = gf_odf_vvc_cfg_read_bs(bs); gf_bs_del(bs); return cfg; }
0
236,138
GF_Err text_box_size(GF_Box *s) { GF_TextSampleEntryBox *ptr = (GF_TextSampleEntryBox*)s; s->size += 8; /*base + this + string length*/ s->size += 43 + 1; if (ptr->textName) s->size += strlen(ptr->textName); return GF_OK; }
0
225,691
GF_Err dfla_box_size(GF_Box *s) { GF_FLACConfigBox *ptr = (GF_FLACConfigBox *) s; ptr->size += ptr->dataSize; return GF_OK;
0
466,148
static int em_mov(struct x86_emulate_ctxt *ctxt) { ctxt->dst.val = ctxt->src.val; return X86EMUL_CONTINUE; }
0
442,960
update_screen(int type_arg) { int type = type_arg; win_T *wp; static int did_intro = FALSE; #ifdef FEAT_GUI int did_one = FALSE; int did_undraw = FALSE; int gui_cursor_col = 0; int gui_cursor_row = 0; #endif int no_update = FALSE; int save_pum_will_redraw = pum_will_redraw; // Don't do anything if the screen structures are (not yet) valid. if (!screen_valid(TRUE)) return FAIL; if (type == VALID_NO_UPDATE) { no_update = TRUE; type = 0; } #ifdef FEAT_EVAL { buf_T *buf; // Before updating the screen, notify any listeners of changed text. FOR_ALL_BUFFERS(buf) invoke_listeners(buf); } #endif #ifdef FEAT_DIFF // May have postponed updating diffs. if (need_diff_redraw) diff_redraw(TRUE); #endif if (must_redraw) { if (type < must_redraw) // use maximal type type = must_redraw; // must_redraw is reset here, so that when we run into some weird // reason to redraw while busy redrawing (e.g., asynchronous // scrolling), or update_topline() in win_update() will cause a // scroll, the screen will be redrawn later or in win_update(). must_redraw = 0; } // May need to update w_lines[]. if (curwin->w_lines_valid == 0 && type < NOT_VALID #ifdef FEAT_TERMINAL && !term_do_update_window(curwin) #endif ) type = NOT_VALID; // Postpone the redrawing when it's not needed and when being called // recursively. if (!redrawing() || updating_screen) { redraw_later(type); // remember type for next time must_redraw = type; if (type > INVERTED_ALL) curwin->w_lines_valid = 0; // don't use w_lines[].wl_size now return FAIL; } updating_screen = TRUE; #ifdef FEAT_PROP_POPUP // Update popup_mask if needed. This may set w_redraw_top and w_redraw_bot // in some windows. may_update_popup_mask(type); #endif #ifdef FEAT_SYN_HL ++display_tick; // let syntax code know we're in a next round of // display updating #endif if (no_update) ++no_win_do_lines_ins; // if the screen was scrolled up when displaying a message, scroll it down if (msg_scrolled) { clear_cmdline = TRUE; if (msg_scrolled > Rows - 5) // clearing is faster type = CLEAR; else if (type != CLEAR) { check_for_delay(FALSE); if (screen_ins_lines(0, 0, msg_scrolled, (int)Rows, 0, NULL) == FAIL) type = CLEAR; FOR_ALL_WINDOWS(wp) { if (wp->w_winrow < msg_scrolled) { if (W_WINROW(wp) + wp->w_height > msg_scrolled && wp->w_redr_type < REDRAW_TOP && wp->w_lines_valid > 0 && wp->w_topline == wp->w_lines[0].wl_lnum) { wp->w_upd_rows = msg_scrolled - W_WINROW(wp); wp->w_redr_type = REDRAW_TOP; } else { wp->w_redr_type = NOT_VALID; if (W_WINROW(wp) + wp->w_height + wp->w_status_height <= msg_scrolled) wp->w_redr_status = TRUE; } } } if (!no_update) redraw_cmdline = TRUE; redraw_tabline = TRUE; } msg_scrolled = 0; need_wait_return = FALSE; } // reset cmdline_row now (may have been changed temporarily) compute_cmdrow(); // Check for changed highlighting if (need_highlight_changed) highlight_changed(); if (type == CLEAR) // first clear screen { screenclear(); // will reset clear_cmdline type = NOT_VALID; // must_redraw may be set indirectly, avoid another redraw later must_redraw = 0; } if (clear_cmdline) // going to clear cmdline (done below) check_for_delay(FALSE); #ifdef FEAT_LINEBREAK // Force redraw when width of 'number' or 'relativenumber' column // changes. if (curwin->w_redr_type < NOT_VALID && curwin->w_nrwidth != ((curwin->w_p_nu || curwin->w_p_rnu) ? number_width(curwin) : 0)) curwin->w_redr_type = NOT_VALID; #endif // Only start redrawing if there is really something to do. if (type == INVERTED) update_curswant(); if (curwin->w_redr_type < type && !((type == VALID && curwin->w_lines[0].wl_valid #ifdef FEAT_DIFF && curwin->w_topfill == curwin->w_old_topfill && curwin->w_botfill == curwin->w_old_botfill #endif && curwin->w_topline == curwin->w_lines[0].wl_lnum) || (type == INVERTED && VIsual_active && curwin->w_old_cursor_lnum == curwin->w_cursor.lnum && curwin->w_old_visual_mode == VIsual_mode && (curwin->w_valid & VALID_VIRTCOL) && curwin->w_old_curswant == curwin->w_curswant) )) curwin->w_redr_type = type; // Redraw the tab pages line if needed. if (redraw_tabline || type >= NOT_VALID) draw_tabline(); #ifdef FEAT_SYN_HL // Correct stored syntax highlighting info for changes in each displayed // buffer. Each buffer must only be done once. FOR_ALL_WINDOWS(wp) { if (wp->w_buffer->b_mod_set) { win_T *wwp; // Check if we already did this buffer. for (wwp = firstwin; wwp != wp; wwp = wwp->w_next) if (wwp->w_buffer == wp->w_buffer) break; if (wwp == wp && syntax_present(wp)) syn_stack_apply_changes(wp->w_buffer); } } #endif if (pum_redraw_in_same_position()) // Avoid flicker if the popup menu is going to be redrawn in the same // position. pum_will_redraw = TRUE; // Go from top to bottom through the windows, redrawing the ones that need // it. #if defined(FEAT_SEARCH_EXTRA) || defined(FEAT_CLIPBOARD) did_update_one_window = FALSE; #endif #ifdef FEAT_SEARCH_EXTRA screen_search_hl.rm.regprog = NULL; #endif FOR_ALL_WINDOWS(wp) { if (wp->w_redr_type != 0) { cursor_off(); #ifdef FEAT_GUI if (!did_one) { did_one = TRUE; // Remove the cursor before starting to do anything, because // scrolling may make it difficult to redraw the text under // it. // Also remove the cursor if it needs to be hidden due to an // ongoing cursor-less sleep. if (gui.in_use && (wp == curwin || cursor_is_sleeping())) { gui_cursor_col = gui.cursor_col; gui_cursor_row = gui.cursor_row; gui_undraw_cursor(); did_undraw = TRUE; } } #endif win_update(wp); } // redraw status line after the window to minimize cursor movement if (wp->w_redr_status) { cursor_off(); win_redr_status(wp, TRUE); // any popup menu will be redrawn below } } #if defined(FEAT_SEARCH_EXTRA) end_search_hl(); #endif // May need to redraw the popup menu. pum_will_redraw = save_pum_will_redraw; pum_may_redraw(); // Reset b_mod_set flags. Going through all windows is probably faster // than going through all buffers (there could be many buffers). FOR_ALL_WINDOWS(wp) wp->w_buffer->b_mod_set = FALSE; #ifdef FEAT_PROP_POPUP // Display popup windows on top of the windows and command line. update_popups(win_update); #endif #ifdef FEAT_TERMINAL FOR_ALL_WINDOWS(wp) // If this window contains a terminal, after redrawing all windows, the // dirty row range can be reset. term_did_update_window(wp); #endif after_updating_screen(TRUE); // Clear or redraw the command line. Done last, because scrolling may // mess up the command line. if (clear_cmdline || redraw_cmdline || redraw_mode) showmode(); if (no_update) --no_win_do_lines_ins; // May put up an introductory message when not editing a file if (!did_intro) maybe_intro_message(); did_intro = TRUE; #ifdef FEAT_GUI // Redraw the cursor and update the scrollbars when all screen updating is // done. if (gui.in_use) { if (did_undraw && !gui_mch_is_blink_off()) { mch_disable_flush(); out_flush(); // required before updating the cursor mch_enable_flush(); // Put the GUI position where the cursor was, gui_update_cursor() // uses that. gui.col = gui_cursor_col; gui.row = gui_cursor_row; gui.col = mb_fix_col(gui.col, gui.row); gui_update_cursor(FALSE, FALSE); gui_may_flush(); screen_cur_col = gui.col; screen_cur_row = gui.row; } else out_flush(); gui_update_scrollbars(FALSE); } #endif return OK; }
0
512,579
int cmp_item_time::cmp_not_null(const Value *val) { DBUG_ASSERT(!val->is_null()); DBUG_ASSERT(val->is_temporal()); return value != pack_time(&val->value.m_time); }
0
328,891
R_API char *r_bin_java_print_float_cp_stringify(RBinJavaCPTypeObj *obj) { ut32 size = 255, consumed = 0; char *value = malloc (size); if (value) { memset (value, 0, size); consumed = snprintf (value, size, "%d.0x%04"PFMT64x ".%s.%f", obj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name, R_BIN_JAVA_FLOAT (obj->info.cp_float.bytes.raw, 0)); if (consumed >= size - 1) { free (value); size += size >> 1; value = malloc (size); if (value) { memset (value, 0, size); (void)snprintf (value, size, "%d.0x%04"PFMT64x ".%s.%f", obj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name, R_BIN_JAVA_FLOAT (obj->info.cp_float.bytes.raw, 0)); } } } return value; }
0
90,786
InitializeTemporaryOriginsInfoTask( QuotaManager* manager, UsageTracker* temporary_usage_tracker) : DatabaseTaskBase(manager), has_registered_origins_(false) { DCHECK(temporary_usage_tracker); temporary_usage_tracker->GetCachedOrigins(&origins_); }
0
387,149
static MagickBooleanType SetGrayscaleImage(Image *image, ExceptionInfo *exception) { CacheView *image_view; MagickBooleanType status; PixelInfo *colormap; register ssize_t i; ssize_t *colormap_index, j, y; assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->type != GrayscaleType) (void) TransformImageColorspace(image,GRAYColorspace,exception); if (image->storage_class == PseudoClass) colormap_index=(ssize_t *) AcquireQuantumMemory(MagickMax(image->colors+1, MaxMap),sizeof(*colormap_index)); else colormap_index=(ssize_t *) AcquireQuantumMemory(MagickMax(MaxColormapSize+1, MaxMap),sizeof(*colormap_index)); if (colormap_index == (ssize_t *) NULL) ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed", image->filename); if (image->storage_class != PseudoClass) { (void) memset(colormap_index,(-1),MaxColormapSize* sizeof(*colormap_index)); if (AcquireImageColormap(image,MaxColormapSize,exception) == MagickFalse) { colormap_index=(ssize_t *) RelinquishMagickMemory(colormap_index); ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed", image->filename); } image->colors=0; status=MagickTrue; image_view=AcquireAuthenticCacheView(image,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static) shared(status) \ magick_number_threads(image,image,image->rows,1) #endif for (y=0; y < (ssize_t) image->rows; y++) { register Quantum *magick_restrict q; register ssize_t x; if (status == MagickFalse) continue; q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1, exception); if (q == (Quantum *) NULL) { status=MagickFalse; continue; } for (x=0; x < (ssize_t) image->columns; x++) { register size_t intensity; intensity=ScaleQuantumToMap(GetPixelRed(image,q)); if (colormap_index[intensity] < 0) { #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp critical (MagickCore_SetGrayscaleImage) #endif if (colormap_index[intensity] < 0) { colormap_index[intensity]=(ssize_t) image->colors; image->colormap[image->colors].red=(double) GetPixelRed(image,q); image->colormap[image->colors].green=(double) GetPixelGreen(image,q); image->colormap[image->colors].blue=(double) GetPixelBlue(image,q); image->colors++; } } SetPixelIndex(image,(Quantum) colormap_index[intensity],q); q+=GetPixelChannels(image); } if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse) status=MagickFalse; } image_view=DestroyCacheView(image_view); } for (i=0; i < (ssize_t) image->colors; i++) image->colormap[i].alpha=(double) i; qsort((void *) image->colormap,image->colors,sizeof(PixelInfo), IntensityCompare); colormap=(PixelInfo *) AcquireQuantumMemory(image->colors,sizeof(*colormap)); if (colormap == (PixelInfo *) NULL) { colormap_index=(ssize_t *) RelinquishMagickMemory(colormap_index); ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed", image->filename); } j=0; colormap[j]=image->colormap[0]; for (i=0; i < (ssize_t) image->colors; i++) { if (IsPixelInfoEquivalent(&colormap[j],&image->colormap[i]) == MagickFalse) { j++; colormap[j]=image->colormap[i]; } colormap_index[(ssize_t) image->colormap[i].alpha]=j; } image->colors=(size_t) (j+1); image->colormap=(PixelInfo *) RelinquishMagickMemory(image->colormap); image->colormap=colormap; status=MagickTrue; image_view=AcquireAuthenticCacheView(image,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static) shared(status) \ magick_number_threads(image,image,image->rows,1) #endif for (y=0; y < (ssize_t) image->rows; y++) { register Quantum *magick_restrict q; register ssize_t x; if (status == MagickFalse) continue; q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) { status=MagickFalse; continue; } for (x=0; x < (ssize_t) image->columns; x++) { SetPixelIndex(image,(Quantum) colormap_index[ScaleQuantumToMap( GetPixelIndex(image,q))],q); q+=GetPixelChannels(image); } if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse) status=MagickFalse; } image_view=DestroyCacheView(image_view); colormap_index=(ssize_t *) RelinquishMagickMemory(colormap_index); image->type=GrayscaleType; if (SetImageMonochrome(image,exception) != MagickFalse) image->type=BilevelType; return(status); }
0
326,099
save_se_one(save_se_T *savep, char_u **pp) { savep->se_u.ptr = *pp; *pp = rex.input; }
0
241,309
mrb_instance_new(mrb_state *mrb, mrb_value cv) { mrb_value obj, blk; const mrb_value *argv; mrb_int argc; mrb_sym init; mrb_get_args(mrb, "*!&", &argv, &argc, &blk); obj = mrb_instance_alloc(mrb, cv); init = MRB_SYM(initialize); if (!mrb_func_basic_p(mrb, obj, init, mrb_do_nothing)) { mrb_funcall_with_block(mrb, obj, init, argc, argv, blk); } return obj; }
0
393,536
static SQInteger base_dummy(HSQUIRRELVM SQ_UNUSED_ARG(v)) { return 0; }
0
265,537
int mempool_reserved_space(MemoryPoolHandle handle, size_t *free_bytes) { struct mempool *pool = (struct mempool *)handle; if ((pool == NULL) || (free_bytes == NULL)) { return S3_MEMPOOL_INVALID_ARG; } if (pool->flags & ENABLE_LOCKING) { pthread_mutex_lock(&pool->lock); } *free_bytes = pool->mempool_item_size * pool->free_bufs_in_pool; if ((pool->flags & ENABLE_LOCKING) != 0) { pthread_mutex_unlock(&pool->lock); } return 0; }
0
272,356
teardown_digests(cms_context *ctx) { struct digest *digests = ctx->digests; if (!digests) return; for (int i = 0; i < n_digest_params; i++) { if (digests[i].pk11ctx) { PK11_Finalize(digests[i].pk11ctx); PK11_DestroyContext(digests[i].pk11ctx, PR_TRUE); } if (digests[i].pe_digest) { /* XXX sure seems like we should be freeing it here, * but that's segfaulting, and we know it'll get * cleaned up with PORT_FreeArena a couple of lines * down. */ digests[i].pe_digest = NULL; } } PORT_Free(digests); ctx->digests = NULL; }
0
301,484
add_suggestion( suginfo_T *su, garray_T *gap, // either su_ga or su_sga char_u *goodword, int badlenarg, // len of bad word replaced with "goodword" int score, int altscore, int had_bonus, // value for st_had_bonus slang_T *slang, // language for sound folding int maxsf) // su_maxscore applies to soundfold score, // su_sfmaxscore to the total score. { int goodlen; // len of goodword changed int badlen; // len of bad word changed suggest_T *stp; suggest_T new_sug; int i; char_u *pgood, *pbad; // Minimize "badlen" for consistency. Avoids that changing "the the" to // "thee the" is added next to changing the first "the" the "thee". pgood = goodword + STRLEN(goodword); pbad = su->su_badptr + badlenarg; for (;;) { goodlen = (int)(pgood - goodword); badlen = (int)(pbad - su->su_badptr); if (goodlen <= 0 || badlen <= 0) break; MB_PTR_BACK(goodword, pgood); MB_PTR_BACK(su->su_badptr, pbad); if (has_mbyte) { if (mb_ptr2char(pgood) != mb_ptr2char(pbad)) break; } else if (*pgood != *pbad) break; } if (badlen == 0 && goodlen == 0) // goodword doesn't change anything; may happen for "the the" changing // the first "the" to itself. return; if (gap->ga_len == 0) i = -1; else { // Check if the word is already there. Also check the length that is // being replaced "thes," -> "these" is a different suggestion from // "thes" -> "these". stp = &SUG(*gap, 0); for (i = gap->ga_len; --i >= 0; ++stp) if (stp->st_wordlen == goodlen && stp->st_orglen == badlen && STRNCMP(stp->st_word, goodword, goodlen) == 0) { // Found it. Remember the word with the lowest score. if (stp->st_slang == NULL) stp->st_slang = slang; new_sug.st_score = score; new_sug.st_altscore = altscore; new_sug.st_had_bonus = had_bonus; if (stp->st_had_bonus != had_bonus) { // Only one of the two had the soundalike score computed. // Need to do that for the other one now, otherwise the // scores can't be compared. This happens because // suggest_try_change() doesn't compute the soundalike // word to keep it fast, while some special methods set // the soundalike score to zero. if (had_bonus) rescore_one(su, stp); else { new_sug.st_word = stp->st_word; new_sug.st_wordlen = stp->st_wordlen; new_sug.st_slang = stp->st_slang; new_sug.st_orglen = badlen; rescore_one(su, &new_sug); } } if (stp->st_score > new_sug.st_score) { stp->st_score = new_sug.st_score; stp->st_altscore = new_sug.st_altscore; stp->st_had_bonus = new_sug.st_had_bonus; } break; } } if (i < 0 && ga_grow(gap, 1) == OK) { // Add a suggestion. stp = &SUG(*gap, gap->ga_len); stp->st_word = vim_strnsave(goodword, goodlen); if (stp->st_word != NULL) { stp->st_wordlen = goodlen; stp->st_score = score; stp->st_altscore = altscore; stp->st_had_bonus = had_bonus; stp->st_orglen = badlen; stp->st_slang = slang; ++gap->ga_len; // If we have too many suggestions now, sort the list and keep // the best suggestions. if (gap->ga_len > SUG_MAX_COUNT(su)) { if (maxsf) su->su_sfmaxscore = cleanup_suggestions(gap, su->su_sfmaxscore, SUG_CLEAN_COUNT(su)); else su->su_maxscore = cleanup_suggestions(gap, su->su_maxscore, SUG_CLEAN_COUNT(su)); } } } }
0
391,637
static void defer_open(struct share_mode_lock *lck, struct timeval request_time, struct timeval timeout, struct smb_request *req, struct deferred_open_record *state) { DEBUG(10,("defer_open_sharing_error: time [%u.%06u] adding deferred " "open entry for mid %llu\n", (unsigned int)request_time.tv_sec, (unsigned int)request_time.tv_usec, (unsigned long long)req->mid)); if (!push_deferred_open_message_smb(req, request_time, timeout, state->id, (char *)state, sizeof(*state))) { TALLOC_FREE(lck); exit_server("push_deferred_open_message_smb failed"); } if (lck) { struct defer_open_state *watch_state; struct tevent_req *watch_req; bool ret; watch_state = talloc(req->sconn, struct defer_open_state); if (watch_state == NULL) { exit_server("talloc failed"); } watch_state->sconn = req->sconn; watch_state->mid = req->mid; DEBUG(10, ("defering mid %llu\n", (unsigned long long)req->mid)); watch_req = dbwrap_record_watch_send( watch_state, req->sconn->ev_ctx, lck->data->record, req->sconn->msg_ctx); if (watch_req == NULL) { exit_server("Could not watch share mode record"); } tevent_req_set_callback(watch_req, defer_open_done, watch_state); ret = tevent_req_set_endtime( watch_req, req->sconn->ev_ctx, timeval_sum(&request_time, &timeout)); SMB_ASSERT(ret); } }
0
430,335
static void *seq_buf_alloc(unsigned long size) { if (unlikely(size > MAX_RW_COUNT)) return NULL; return kvmalloc(size, GFP_KERNEL_ACCOUNT); }
0
294,554
dup_obj_as_complex(VALUE self) { get_d1a(self); if (simple_dat_p(adat)) { VALUE new = d_lite_s_alloc_complex(rb_obj_class(self)); { get_d1b(new); copy_simple_to_complex(new, &bdat->c, &adat->s); bdat->c.flags |= HAVE_DF | COMPLEX_DAT; return new; } } else { VALUE new = d_lite_s_alloc_complex(rb_obj_class(self)); { get_d1b(new); bdat->c = adat->c; RB_OBJ_WRITTEN(new, Qundef, bdat->c.nth); RB_OBJ_WRITTEN(new, Qundef, bdat->c.sf); return new; } } }
0