unique_id
int64
13
189k
target
int64
0
1
code
stringlengths
20
241k
__index_level_0__
int64
0
18.9k
186,788
1
bool VaapiVideoDecodeAccelerator::VaapiH264Accelerator::SubmitFrameMetadata( const H264SPS* sps, const H264PPS* pps, const H264DPB& dpb, const H264Picture::Vector& ref_pic_listp0, const H264Picture::Vector& ref_pic_listb0, const H264Picture::Vector& ref_pic_listb1, const scoped_refptr<H264Picture>& pic) { VAPictureParameterBufferH264 pic_param; memset(&pic_param, 0, sizeof(pic_param)); #define FROM_SPS_TO_PP(a) pic_param.a = sps->a #define FROM_SPS_TO_PP2(a, b) pic_param.b = sps->a FROM_SPS_TO_PP2(pic_width_in_mbs_minus1, picture_width_in_mbs_minus1); FROM_SPS_TO_PP2(pic_height_in_map_units_minus1, picture_height_in_mbs_minus1); FROM_SPS_TO_PP(bit_depth_luma_minus8); FROM_SPS_TO_PP(bit_depth_chroma_minus8); #undef FROM_SPS_TO_PP #undef FROM_SPS_TO_PP2 #define FROM_SPS_TO_PP_SF(a) pic_param.seq_fields.bits.a = sps->a #define FROM_SPS_TO_PP_SF2(a, b) pic_param.seq_fields.bits.b = sps->a FROM_SPS_TO_PP_SF(chroma_format_idc); FROM_SPS_TO_PP_SF2(separate_colour_plane_flag, residual_colour_transform_flag); FROM_SPS_TO_PP_SF(gaps_in_frame_num_value_allowed_flag); FROM_SPS_TO_PP_SF(frame_mbs_only_flag); FROM_SPS_TO_PP_SF(mb_adaptive_frame_field_flag); FROM_SPS_TO_PP_SF(direct_8x8_inference_flag); pic_param.seq_fields.bits.MinLumaBiPredSize8x8 = (sps->level_idc >= 31); FROM_SPS_TO_PP_SF(log2_max_frame_num_minus4); FROM_SPS_TO_PP_SF(pic_order_cnt_type); FROM_SPS_TO_PP_SF(log2_max_pic_order_cnt_lsb_minus4); FROM_SPS_TO_PP_SF(delta_pic_order_always_zero_flag); #undef FROM_SPS_TO_PP_SF #undef FROM_SPS_TO_PP_SF2 #define FROM_PPS_TO_PP(a) pic_param.a = pps->a FROM_PPS_TO_PP(pic_init_qp_minus26); FROM_PPS_TO_PP(pic_init_qs_minus26); FROM_PPS_TO_PP(chroma_qp_index_offset); FROM_PPS_TO_PP(second_chroma_qp_index_offset); #undef FROM_PPS_TO_PP #define FROM_PPS_TO_PP_PF(a) pic_param.pic_fields.bits.a = pps->a #define FROM_PPS_TO_PP_PF2(a, b) pic_param.pic_fields.bits.b = pps->a FROM_PPS_TO_PP_PF(entropy_coding_mode_flag); FROM_PPS_TO_PP_PF(weighted_pred_flag); FROM_PPS_TO_PP_PF(weighted_bipred_idc); FROM_PPS_TO_PP_PF(transform_8x8_mode_flag); pic_param.pic_fields.bits.field_pic_flag = 0; FROM_PPS_TO_PP_PF(constrained_intra_pred_flag); FROM_PPS_TO_PP_PF2(bottom_field_pic_order_in_frame_present_flag, pic_order_present_flag); FROM_PPS_TO_PP_PF(deblocking_filter_control_present_flag); FROM_PPS_TO_PP_PF(redundant_pic_cnt_present_flag); pic_param.pic_fields.bits.reference_pic_flag = pic->ref; #undef FROM_PPS_TO_PP_PF #undef FROM_PPS_TO_PP_PF2 pic_param.frame_num = pic->frame_num; InitVAPicture(&pic_param.CurrPic); FillVAPicture(&pic_param.CurrPic, pic); for (int i = 0; i < 16; ++i) InitVAPicture(&pic_param.ReferenceFrames[i]); FillVARefFramesFromDPB(dpb, pic_param.ReferenceFrames, arraysize(pic_param.ReferenceFrames)); pic_param.num_ref_frames = sps->max_num_ref_frames; if (!vaapi_wrapper_->SubmitBuffer(VAPictureParameterBufferType, sizeof(pic_param), &pic_param)) return false; VAIQMatrixBufferH264 iq_matrix_buf; memset(&iq_matrix_buf, 0, sizeof(iq_matrix_buf)); if (pps->pic_scaling_matrix_present_flag) { for (int i = 0; i < 6; ++i) { for (int j = 0; j < 16; ++j) iq_matrix_buf.ScalingList4x4[i][kZigzagScan4x4[j]] = pps->scaling_list4x4[i][j]; } for (int i = 0; i < 2; ++i) { for (int j = 0; j < 64; ++j) iq_matrix_buf.ScalingList8x8[i][kZigzagScan8x8[j]] = pps->scaling_list8x8[i][j]; } } else { for (int i = 0; i < 6; ++i) { for (int j = 0; j < 16; ++j) iq_matrix_buf.ScalingList4x4[i][kZigzagScan4x4[j]] = sps->scaling_list4x4[i][j]; } for (int i = 0; i < 2; ++i) { for (int j = 0; j < 64; ++j) iq_matrix_buf.ScalingList8x8[i][kZigzagScan8x8[j]] = sps->scaling_list8x8[i][j]; } } return vaapi_wrapper_->SubmitBuffer(VAIQMatrixBufferType, sizeof(iq_matrix_buf), &iq_matrix_buf); }
2,600
51,378
0
PHP_FUNCTION(mb_ereg_replace) { _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0, 0); }
2,601
158,090
0
ContentSettingsClient& LocalFrameClientImpl::GetContentSettingsClient() { return web_frame_->GetContentSettingsClient(); }
2,602
130,034
0
std::string SerializeSeedBase64(const variations::VariationsSeed& seed) { std::string serialized_seed = SerializeSeed(seed); std::string base64_serialized_seed; base::Base64Encode(Compress(serialized_seed), &base64_serialized_seed); return base64_serialized_seed; }
2,603
7,791
0
static inline __maybe_unused void h2c_error(struct h2c *h2c, enum h2_err err) { h2c->errcode = err; h2c->st0 = H2_CS_ERROR; }
2,604
115,046
0
TestingAutomationProvider::TestingAutomationProvider(Profile* profile) : AutomationProvider(profile), #if defined(TOOLKIT_VIEWS) popup_menu_waiter_(NULL), #endif #if defined(OS_CHROMEOS) power_manager_observer_(NULL), #endif redirect_query_(0) { BrowserList::AddObserver(this); registrar_.Add(this, chrome::NOTIFICATION_SESSION_END, content::NotificationService::AllSources()); #if defined(OS_CHROMEOS) AddChromeosObservers(); #endif }
2,605
129,888
0
PassRefPtrWillBeRawPtr<SpeechSynthesis> SpeechSynthesis::create(ExecutionContext* context) { return adoptRefWillBeRefCountedGarbageCollected(new SpeechSynthesis(context)); }
2,606
34,132
0
static int hci_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) { struct sock *sk = sock->sk; void __user *argp = (void __user *) arg; int err; BT_DBG("cmd %x arg %lx", cmd, arg); switch (cmd) { case HCIGETDEVLIST: return hci_get_dev_list(argp); case HCIGETDEVINFO: return hci_get_dev_info(argp); case HCIGETCONNLIST: return hci_get_conn_list(argp); case HCIDEVUP: if (!capable(CAP_NET_ADMIN)) return -EACCES; return hci_dev_open(arg); case HCIDEVDOWN: if (!capable(CAP_NET_ADMIN)) return -EACCES; return hci_dev_close(arg); case HCIDEVRESET: if (!capable(CAP_NET_ADMIN)) return -EACCES; return hci_dev_reset(arg); case HCIDEVRESTAT: if (!capable(CAP_NET_ADMIN)) return -EACCES; return hci_dev_reset_stat(arg); case HCISETSCAN: case HCISETAUTH: case HCISETENCRYPT: case HCISETPTYPE: case HCISETLINKPOL: case HCISETLINKMODE: case HCISETACLMTU: case HCISETSCOMTU: if (!capable(CAP_NET_ADMIN)) return -EACCES; return hci_dev_cmd(cmd, argp); case HCIINQUIRY: return hci_inquiry(argp); default: lock_sock(sk); err = hci_sock_bound_ioctl(sk, cmd, arg); release_sock(sk); return err; } }
2,607
71,430
0
MagickExport void GetMagickMemoryMethods( AcquireMemoryHandler *acquire_memory_handler, ResizeMemoryHandler *resize_memory_handler, DestroyMemoryHandler *destroy_memory_handler) { assert(acquire_memory_handler != (AcquireMemoryHandler *) NULL); assert(resize_memory_handler != (ResizeMemoryHandler *) NULL); assert(destroy_memory_handler != (DestroyMemoryHandler *) NULL); *acquire_memory_handler=memory_methods.acquire_memory_handler; *resize_memory_handler=memory_methods.resize_memory_handler; *destroy_memory_handler=memory_methods.destroy_memory_handler; }
2,608
165,711
0
void FileReaderLoader::Failed(FileErrorCode error_code, FailureType type) { DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, failure_histogram, ("Storage.Blob.FileReaderLoader.FailureType", static_cast<int>(FailureType::kCount))); if (error_code_ != FileErrorCode::kOK) return; error_code_ = error_code; failure_histogram.Count(static_cast<int>(type)); Cleanup(); if (client_) client_->DidFail(error_code_); }
2,609
57,606
0
long keyctl_keyring_clear(key_serial_t ringid) { key_ref_t keyring_ref; long ret; keyring_ref = lookup_user_key(ringid, KEY_LOOKUP_CREATE, KEY_NEED_WRITE); if (IS_ERR(keyring_ref)) { ret = PTR_ERR(keyring_ref); /* Root is permitted to invalidate certain special keyrings */ if (capable(CAP_SYS_ADMIN)) { keyring_ref = lookup_user_key(ringid, 0, 0); if (IS_ERR(keyring_ref)) goto error; if (test_bit(KEY_FLAG_ROOT_CAN_CLEAR, &key_ref_to_ptr(keyring_ref)->flags)) goto clear; goto error_put; } goto error; } clear: ret = keyring_clear(key_ref_to_ptr(keyring_ref)); error_put: key_ref_put(keyring_ref); error: return ret; }
2,610
45,902
0
static u64 l3hash(u64 p1, u64 p2, u64 k1, u64 k2, u64 len) { u64 rh, rl, t, z = 0; /* fully reduce (p1,p2)+(len,0) mod p127 */ t = p1 >> 63; p1 &= m63; ADD128(p1, p2, len, t); /* At this point, (p1,p2) is at most 2^127+(len<<64) */ t = (p1 > m63) + ((p1 == m63) && (p2 == m64)); ADD128(p1, p2, z, t); p1 &= m63; /* compute (p1,p2)/(2^64-2^32) and (p1,p2)%(2^64-2^32) */ t = p1 + (p2 >> 32); t += (t >> 32); t += (u32)t > 0xfffffffeu; p1 += (t >> 32); p2 += (p1 << 32); /* compute (p1+k1)%p64 and (p2+k2)%p64 */ p1 += k1; p1 += (0 - (p1 < k1)) & 257; p2 += k2; p2 += (0 - (p2 < k2)) & 257; /* compute (p1+k1)*(p2+k2)%p64 */ MUL64(rh, rl, p1, p2); t = rh >> 56; ADD128(t, rl, z, rh); rh <<= 8; ADD128(t, rl, z, rh); t += t << 8; rl += t; rl += (0 - (rl < t)) & 257; rl += (0 - (rl > p64-1)) & 257; return rl; }
2,611
117,048
0
void WriteString16ToPickle(Pickle& pickle, int* bytes_written, int max_bytes, const string16& str) { int num_bytes = str.size() * sizeof(char16); if (*bytes_written + num_bytes < max_bytes) { *bytes_written += num_bytes; pickle.WriteString16(str); } else { pickle.WriteString16(string16()); } }
2,612
85,640
0
static void hns_xgmac_init(void *mac_drv) { struct mac_driver *drv = (struct mac_driver *)mac_drv; struct dsaf_device *dsaf_dev = (struct dsaf_device *)dev_get_drvdata(drv->dev); u32 port = drv->mac_id; dsaf_dev->misc_op->xge_srst(dsaf_dev, port, 0); mdelay(100); dsaf_dev->misc_op->xge_srst(dsaf_dev, port, 1); mdelay(100); hns_xgmac_lf_rf_control_init(drv); hns_xgmac_exc_irq_en(drv, 0); hns_xgmac_pma_fec_enable(drv, 0x0, 0x0); hns_xgmac_disable(mac_drv, MAC_COMM_MODE_RX_AND_TX); }
2,613
168,337
0
void PaintBackgroundAttachedMode(gfx::Canvas* canvas, const ui::ThemeProvider* theme_provider, const gfx::Rect& bounds, const gfx::Point& background_origin) { canvas->DrawColor(theme_provider->GetColor(ThemeProperties::COLOR_TOOLBAR)); if (theme_provider->HasCustomImage(IDR_THEME_TOOLBAR)) { canvas->TileImageInt(*theme_provider->GetImageSkiaNamed(IDR_THEME_TOOLBAR), background_origin.x(), background_origin.y(), bounds.x(), bounds.y(), bounds.width(), bounds.height()); } }
2,614
148,541
0
void WebContentsImpl::RequestFindMatchRects(int current_version) { GetOrCreateFindRequestManager()->RequestFindMatchRects(current_version); }
2,615
95,802
0
static pack_t *FS_LoadZipFile(const char *zipfile, const char *basename ) { fileInPack_t *buildBuffer; pack_t *pack; unzFile uf; int err; unz_global_info gi; char filename_inzip[MAX_ZPATH]; unz_file_info file_info; int i, len; long hash; int fs_numHeaderLongs; int *fs_headerLongs; char *namePtr; fs_numHeaderLongs = 0; uf = unzOpen( zipfile ); err = unzGetGlobalInfo( uf,&gi ); if ( err != UNZ_OK ) { return NULL; } fs_packFiles += gi.number_entry; len = 0; unzGoToFirstFile( uf ); for ( i = 0; i < gi.number_entry; i++ ) { err = unzGetCurrentFileInfo( uf, &file_info, filename_inzip, sizeof( filename_inzip ), NULL, 0, NULL, 0 ); if ( err != UNZ_OK ) { break; } len += strlen( filename_inzip ) + 1; unzGoToNextFile( uf ); } buildBuffer = Z_Malloc( ( gi.number_entry * sizeof( fileInPack_t ) ) + len ); namePtr = ( (char *) buildBuffer ) + gi.number_entry * sizeof( fileInPack_t ); fs_headerLongs = Z_Malloc( ( gi.number_entry + 1 ) * sizeof(int) ); fs_headerLongs[ fs_numHeaderLongs++ ] = LittleLong( fs_checksumFeed ); for ( i = 1; i <= MAX_FILEHASH_SIZE; i <<= 1 ) { if ( i > gi.number_entry ) { break; } } pack = Z_Malloc( sizeof( pack_t ) + i * sizeof( fileInPack_t * ) ); pack->hashSize = i; pack->hashTable = ( fileInPack_t ** )( ( (char *) pack ) + sizeof( pack_t ) ); for ( i = 0; i < pack->hashSize; i++ ) { pack->hashTable[i] = NULL; } Q_strncpyz( pack->pakFilename, zipfile, sizeof( pack->pakFilename ) ); Q_strncpyz( pack->pakBasename, basename, sizeof( pack->pakBasename ) ); if ( strlen( pack->pakBasename ) > 4 && !Q_stricmp( pack->pakBasename + strlen( pack->pakBasename ) - 4, ".pk3" ) ) { pack->pakBasename[strlen( pack->pakBasename ) - 4] = 0; } pack->handle = uf; pack->numfiles = gi.number_entry; unzGoToFirstFile( uf ); for ( i = 0; i < gi.number_entry; i++ ) { err = unzGetCurrentFileInfo( uf, &file_info, filename_inzip, sizeof( filename_inzip ), NULL, 0, NULL, 0 ); if ( err != UNZ_OK ) { break; } if ( file_info.uncompressed_size > 0 ) { fs_headerLongs[fs_numHeaderLongs++] = LittleLong( file_info.crc ); } Q_strlwr( filename_inzip ); hash = FS_HashFileName( filename_inzip, pack->hashSize ); buildBuffer[i].name = namePtr; strcpy( buildBuffer[i].name, filename_inzip ); namePtr += strlen( filename_inzip ) + 1; buildBuffer[i].pos = unzGetOffset(uf); buildBuffer[i].len = file_info.uncompressed_size; buildBuffer[i].next = pack->hashTable[hash]; pack->hashTable[hash] = &buildBuffer[i]; unzGoToNextFile( uf ); } pack->checksum = Com_BlockChecksum( &fs_headerLongs[ 1 ], sizeof(*fs_headerLongs) * ( fs_numHeaderLongs - 1 ) ); pack->pure_checksum = Com_BlockChecksum( fs_headerLongs, sizeof(*fs_headerLongs) * fs_numHeaderLongs ); pack->checksum = LittleLong( pack->checksum ); pack->pure_checksum = LittleLong( pack->pure_checksum ); Z_Free( fs_headerLongs ); pack->buildBuffer = buildBuffer; return pack; }
2,616
181,793
1
static Image *ReadWMFImage(const ImageInfo *image_info,ExceptionInfo *exception) { double bounding_height, bounding_width, image_height, image_height_inch, image_width, image_width_inch, resolution_y, resolution_x, units_per_inch; float wmf_width, wmf_height; Image *image; unsigned long wmf_options_flags = 0; wmf_error_t wmf_error; wmf_magick_t *ddata = 0; wmfAPI *API = 0; wmfAPI_Options wmf_api_options; wmfD_Rect bbox; image=AcquireImage(image_info); if (OpenBlob(image_info,image,ReadBinaryBlobMode,exception) == MagickFalse) { if (image->debug != MagickFalse) { (void) LogMagickEvent(CoderEvent,GetMagickModule(), " OpenBlob failed"); (void) LogMagickEvent(CoderEvent,GetMagickModule(), "leave ReadWMFImage()"); } image=DestroyImageList(image); return((Image *) NULL); } /* * Create WMF API * */ /* Register callbacks */ wmf_options_flags |= WMF_OPT_FUNCTION; (void) ResetMagickMemory(&wmf_api_options, 0, sizeof(wmf_api_options)); wmf_api_options.function = ipa_functions; /* Ignore non-fatal errors */ wmf_options_flags |= WMF_OPT_IGNORE_NONFATAL; wmf_error = wmf_api_create(&API, wmf_options_flags, &wmf_api_options); if (wmf_error != wmf_E_None) { if (API) wmf_api_destroy(API); if (image->debug != MagickFalse) { (void) LogMagickEvent(CoderEvent,GetMagickModule(), " wmf_api_create failed"); (void) LogMagickEvent(CoderEvent,GetMagickModule(), "leave ReadWMFImage()"); } ThrowReaderException(DelegateError,"UnableToInitializeWMFLibrary"); } /* Register progress monitor */ wmf_status_function(API,image,magick_progress_callback); ddata=WMF_MAGICK_GetData(API); ddata->image=image; ddata->image_info=image_info; ddata->draw_info=CloneDrawInfo(image_info,(const DrawInfo *) NULL); ddata->draw_info->font=(char *) RelinquishMagickMemory(ddata->draw_info->font); ddata->draw_info->text=(char *) RelinquishMagickMemory(ddata->draw_info->text); #if defined(MAGICKCORE_WMFLITE_DELEGATE) /* Must initialize font subystem for WMFlite interface */ lite_font_init (API,&wmf_api_options); /* similar to wmf_ipa_font_init in src/font.c */ /* wmf_arg_fontdirs (API,options); */ /* similar to wmf_arg_fontdirs in src/wmf.c */ #endif /* * Open BLOB input via libwmf API * */ wmf_error = wmf_bbuf_input(API,ipa_blob_read,ipa_blob_seek, ipa_blob_tell,(void*)image); if (wmf_error != wmf_E_None) { wmf_api_destroy(API); if (image->debug != MagickFalse) { (void) LogMagickEvent(CoderEvent,GetMagickModule(), " wmf_bbuf_input failed"); (void) LogMagickEvent(CoderEvent,GetMagickModule(), "leave ReadWMFImage()"); } ThrowFileException(exception,FileOpenError,"UnableToOpenFile", image->filename); image=DestroyImageList(image); return((Image *) NULL); } /* * Scan WMF file * */ if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Scanning WMF to obtain bounding box"); wmf_error=wmf_scan(API, 0, &bbox); if (wmf_error != wmf_E_None) { wmf_api_destroy(API); if (image->debug != MagickFalse) { (void) LogMagickEvent(CoderEvent,GetMagickModule(), " wmf_scan failed with wmf_error %d", wmf_error); (void) LogMagickEvent(CoderEvent,GetMagickModule(), "leave ReadWMFImage()"); } ThrowReaderException(DelegateError,"FailedToScanFile"); } /* * Compute dimensions and scale factors * */ ddata->bbox=bbox; /* User specified resolution */ resolution_y=DefaultResolution; if (image->y_resolution != 0.0) { resolution_y = image->y_resolution; if (image->units == PixelsPerCentimeterResolution) resolution_y *= CENTIMETERS_PER_INCH; } resolution_x=DefaultResolution; if (image->x_resolution != 0.0) { resolution_x = image->x_resolution; if (image->units == PixelsPerCentimeterResolution) resolution_x *= CENTIMETERS_PER_INCH; } /* Obtain output size expressed in metafile units */ wmf_error=wmf_size(API,&wmf_width,&wmf_height); if (wmf_error != wmf_E_None) { wmf_api_destroy(API); if (image->debug != MagickFalse) { (void) LogMagickEvent(CoderEvent,GetMagickModule(), " wmf_size failed with wmf_error %d", wmf_error); (void) LogMagickEvent(CoderEvent,GetMagickModule(), "leave ReadWMFImage()"); } ThrowReaderException(DelegateError,"FailedToComputeOutputSize"); } /* Obtain (or guess) metafile units */ if ((API)->File->placeable) units_per_inch=(API)->File->pmh->Inch; else if ( (wmf_width*wmf_height) < 1024*1024) units_per_inch=POINTS_PER_INCH; /* MM_TEXT */ else units_per_inch=TWIPS_PER_INCH; /* MM_TWIPS */ /* Calculate image width and height based on specified DPI resolution */ image_width_inch = (double) wmf_width / units_per_inch; image_height_inch = (double) wmf_height / units_per_inch; image_width = image_width_inch * resolution_x; image_height = image_height_inch * resolution_y; /* Compute bounding box scale factors and origin translations * * This all just a hack since libwmf does not currently seem to * provide the mapping between LOGICAL coordinates and DEVICE * coordinates. This mapping is necessary in order to know * where to place the logical bounding box within the image. * */ bounding_width = bbox.BR.x - bbox.TL.x; bounding_height = bbox.BR.y - bbox.TL.y; ddata->scale_x = image_width/bounding_width; ddata->translate_x = 0-bbox.TL.x; ddata->rotate = 0; /* Heuristic: guess that if the vertical coordinates mostly span negative values, then the image must be inverted. */ if ( fabs(bbox.BR.y) > fabs(bbox.TL.y) ) { /* Normal (Origin at top left of image) */ ddata->scale_y = (image_height/bounding_height); ddata->translate_y = 0-bbox.TL.y; } else { /* Inverted (Origin at bottom left of image) */ ddata->scale_y = (-image_height/bounding_height); ddata->translate_y = 0-bbox.BR.y; } if (image->debug != MagickFalse) { (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Placeable metafile: %s", (API)->File->placeable ? "Yes" : "No"); (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Size in metafile units: %gx%g",wmf_width,wmf_height); (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Metafile units/inch: %g",units_per_inch); (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Size in inches: %gx%g", image_width_inch,image_height_inch); (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Bounding Box: %g,%g %g,%g", bbox.TL.x, bbox.TL.y, bbox.BR.x, bbox.BR.y); (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Bounding width x height: %gx%g",bounding_width, bounding_height); (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Output resolution: %gx%g",resolution_x,resolution_y); (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Image size: %gx%g",image_width,image_height); (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Bounding box scale factor: %g,%g",ddata->scale_x, ddata->scale_y); (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Translation: %g,%g", ddata->translate_x, ddata->translate_y); } #if 0 #if 0 { typedef struct _wmfPlayer_t wmfPlayer_t; struct _wmfPlayer_t { wmfPen default_pen; wmfBrush default_brush; wmfFont default_font; wmfDC* dc; /* current dc */ }; wmfDC *dc; #define WMF_ELICIT_DC(API) (((wmfPlayer_t*)((API)->player_data))->dc) dc = WMF_ELICIT_DC(API); printf("dc->Window.Ox = %d\n", dc->Window.Ox); printf("dc->Window.Oy = %d\n", dc->Window.Oy); printf("dc->Window.width = %d\n", dc->Window.width); printf("dc->Window.height = %d\n", dc->Window.height); printf("dc->pixel_width = %g\n", dc->pixel_width); printf("dc->pixel_height = %g\n", dc->pixel_height); #if defined(MAGICKCORE_WMFLITE_DELEGATE) /* Only in libwmf 0.3 */ printf("dc->Ox = %.d\n", dc->Ox); printf("dc->Oy = %.d\n", dc->Oy); printf("dc->width = %.d\n", dc->width); printf("dc->height = %.d\n", dc->height); #endif } #endif #endif /* * Create canvas image * */ image->rows=(unsigned long) ceil(image_height); image->columns=(unsigned long) ceil(image_width); if (image_info->ping != MagickFalse) { wmf_api_destroy(API); (void) CloseBlob(image); if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "leave ReadWMFImage()"); return(GetFirstImageInList(image)); } if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Creating canvas image with size %lux%lu",(unsigned long) image->rows, (unsigned long) image->columns); /* * Set solid background color */ { image->background_color = image_info->background_color; if (image->background_color.opacity != OpaqueOpacity) image->matte = MagickTrue; (void) SetImageBackgroundColor(image); } /* * Play file to generate Vector drawing commands * */ if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Playing WMF to prepare vectors"); wmf_error = wmf_play(API, 0, &bbox); if (wmf_error != wmf_E_None) { wmf_api_destroy(API); if (image->debug != MagickFalse) { (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Playing WMF failed with wmf_error %d", wmf_error); (void) LogMagickEvent(CoderEvent,GetMagickModule(), "leave ReadWMFImage()"); } ThrowReaderException(DelegateError,"FailedToRenderFile"); } /* * Scribble on canvas image * */ if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Rendering WMF vectors"); DrawRender(ddata->draw_wand); if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(),"leave ReadWMFImage()"); /* Cleanup allocated data */ wmf_api_destroy(API); (void) CloseBlob(image); /* Return image */ return image; }
2,617
181,311
1
static struct svc_serv *nfs_callback_create_svc(int minorversion) { struct nfs_callback_data *cb_info = &nfs_callback_info[minorversion]; struct svc_serv *serv; struct svc_serv_ops *sv_ops; /* * Check whether we're already up and running. */ if (cb_info->serv) { /* * Note: increase service usage, because later in case of error * svc_destroy() will be called. */ svc_get(cb_info->serv); return cb_info->serv; } switch (minorversion) { case 0: sv_ops = nfs4_cb_sv_ops[0]; break; default: sv_ops = nfs4_cb_sv_ops[1]; } if (sv_ops == NULL) return ERR_PTR(-ENOTSUPP); /* * Sanity check: if there's no task, * we should be the first user ... */ if (cb_info->users) printk(KERN_WARNING "nfs_callback_create_svc: no kthread, %d users??\n", cb_info->users); serv = svc_create(&nfs4_callback_program, NFS4_CALLBACK_BUFSIZE, sv_ops); if (!serv) { printk(KERN_ERR "nfs_callback_create_svc: create service failed\n"); return ERR_PTR(-ENOMEM); } cb_info->serv = serv; /* As there is only one thread we need to over-ride the * default maximum of 80 connections */ serv->sv_maxconn = 1024; dprintk("nfs_callback_create_svc: service created\n"); return serv; }
2,618
174,217
0
status_t Camera3Device::RequestThread::flush() { ATRACE_CALL(); Mutex::Autolock l(mFlushLock); if (mHal3Device->common.version >= CAMERA_DEVICE_API_VERSION_3_1) { return mHal3Device->ops->flush(mHal3Device); } return -ENOTSUP; }
2,619
95,131
0
static void cmd_append(char *tag, char *name, const char *cur_name) { int c; static struct buf arg; time_t now = time(NULL); quota_t qdiffs[QUOTA_NUMRESOURCES] = QUOTA_DIFFS_INITIALIZER; unsigned size; int sync_seen = 0; int r; int i; struct appendstate appendstate; unsigned long uidvalidity = 0; long doappenduid = 0; const char *parseerr = NULL, *url = NULL; struct appendstage *curstage; mbentry_t *mbentry = NULL; /* See if we can append */ char *intname = mboxname_from_external(name, &imapd_namespace, imapd_userid); r = mlookup(tag, name, intname, &mbentry); if (!r && (mbentry->mbtype & MBTYPE_REMOTE)) { /* remote mailbox */ struct backend *s = NULL; if (supports_referrals) { imapd_refer(tag, mbentry->server, name); /* Eat the argument */ eatline(imapd_in, prot_getc(imapd_in)); mboxlist_entry_free(&mbentry); free(intname); return; } s = proxy_findserver(mbentry->server, &imap_protocol, proxy_userid, &backend_cached, &backend_current, &backend_inbox, imapd_in); if (!s) r = IMAP_SERVER_UNAVAILABLE; mboxlist_entry_free(&mbentry); imapd_check(s, 0); if (!r) { int is_active = 1; s->context = (void*) &is_active; if (imapd_index) { const char *mboxname = index_mboxname(imapd_index); prot_printf(s->out, "%s Localappend {" SIZE_T_FMT "+}\r\n%s" " {" SIZE_T_FMT "+}\r\n%s ", tag, strlen(name), name, strlen(mboxname), mboxname); } else { prot_printf(s->out, "%s Localappend {" SIZE_T_FMT "+}\r\n%s" " \"\" ", tag, strlen(name), name); } if (!(r = pipe_command(s, 16384))) { pipe_including_tag(s, tag, 0); } s->context = NULL; } else { eatline(imapd_in, prot_getc(imapd_in)); } if (r) { prot_printf(imapd_out, "%s NO %s\r\n", tag, prot_error(imapd_in) ? prot_error(imapd_in) : error_message(r)); } free(intname); return; } mboxlist_entry_free(&mbentry); /* local mailbox */ if (!r) { qdiffs[QUOTA_MESSAGE] = 1; r = append_check(intname, imapd_authstate, ACL_INSERT, ignorequota ? NULL : qdiffs); } if (r) { eatline(imapd_in, ' '); prot_printf(imapd_out, "%s NO %s%s\r\n", tag, (r == IMAP_MAILBOX_NONEXISTENT && mboxlist_createmailboxcheck(intname, 0, 0, imapd_userisadmin, imapd_userid, imapd_authstate, NULL, NULL, 0) == 0) ? "[TRYCREATE] " : "", error_message(r)); free(intname); return; } c = ' '; /* just parsed a space */ /* we loop, to support MULTIAPPEND */ while (!r && c == ' ') { curstage = xzmalloc(sizeof(*curstage)); ptrarray_push(&stages, curstage); /* now parsing "append-opts" in the ABNF */ /* Parse flags */ c = getword(imapd_in, &arg); if (c == '(' && !arg.s[0]) { strarray_init(&curstage->flags); do { c = getword(imapd_in, &arg); if (!curstage->flags.count && !arg.s[0] && c == ')') break; /* empty list */ if (!isokflag(arg.s, &sync_seen)) { parseerr = "Invalid flag in Append command"; r = IMAP_PROTOCOL_ERROR; goto done; } strarray_append(&curstage->flags, arg.s); } while (c == ' '); if (c != ')') { parseerr = "Missing space or ) after flag name in Append command"; r = IMAP_PROTOCOL_ERROR; goto done; } c = prot_getc(imapd_in); if (c != ' ') { parseerr = "Missing space after flag list in Append command"; r = IMAP_PROTOCOL_ERROR; goto done; } c = getword(imapd_in, &arg); } /* Parse internaldate */ if (c == '\"' && !arg.s[0]) { prot_ungetc(c, imapd_in); c = getdatetime(&(curstage->internaldate)); if (c != ' ') { parseerr = "Invalid date-time in Append command"; r = IMAP_PROTOCOL_ERROR; goto done; } c = getword(imapd_in, &arg); } /* try to parse a sequence of "append-ext" */ for (;;) { if (!strcasecmp(arg.s, "ANNOTATION")) { /* RFC5257 */ if (c != ' ') { parseerr = "Missing annotation data in Append command"; r = IMAP_PROTOCOL_ERROR; goto done; } c = parse_annotate_store_data(tag, /*permessage_flag*/1, &curstage->annotations); if (c == EOF) { eatline(imapd_in, c); goto cleanup; } qdiffs[QUOTA_ANNOTSTORAGE] += sizeentryatts(curstage->annotations); c = getword(imapd_in, &arg); } else break; /* not a known extension keyword */ } /* Stage the message */ curstage->f = append_newstage(intname, now, stages.count, &(curstage->stage)); if (!curstage->f) { r = IMAP_IOERROR; goto done; } /* now parsing "append-data" in the ABNF */ if (!strcasecmp(arg.s, "CATENATE")) { if (c != ' ' || (c = prot_getc(imapd_in) != '(')) { parseerr = "Missing message part(s) in Append command"; r = IMAP_PROTOCOL_ERROR; goto done; } /* Catenate the message part(s) to stage */ size = 0; r = append_catenate(curstage->f, cur_name, &size, &(curstage->binary), &parseerr, &url); if (r) goto done; } else { /* Read size from literal */ r = getliteralsize(arg.s, c, &size, &(curstage->binary), &parseerr); if (!r && size == 0) r = IMAP_ZERO_LENGTH_LITERAL; if (r) goto done; /* Copy message to stage */ r = message_copy_strict(imapd_in, curstage->f, size, curstage->binary); } qdiffs[QUOTA_STORAGE] += size; /* If this is a non-BINARY message, close the stage file. * Otherwise, leave it open so we can encode the binary parts. * * XXX For BINARY MULTIAPPEND, we may have to close the stage files * anyways to avoid too many open files. */ if (!curstage->binary) { fclose(curstage->f); curstage->f = NULL; } /* if we see a SP, we're trying to append more than one message */ /* Parse newline terminating command */ c = prot_getc(imapd_in); } done: if (r) { eatline(imapd_in, c); } else { /* we should be looking at the end of the line */ if (c == '\r') c = prot_getc(imapd_in); if (c != '\n') { parseerr = "junk after literal"; r = IMAP_PROTOCOL_ERROR; eatline(imapd_in, c); } } /* Append from the stage(s) */ if (!r) { qdiffs[QUOTA_MESSAGE] = stages.count; r = append_setup(&appendstate, intname, imapd_userid, imapd_authstate, ACL_INSERT, ignorequota ? NULL : qdiffs, &imapd_namespace, (imapd_userisadmin || imapd_userisproxyadmin), EVENT_MESSAGE_APPEND); } if (!r) { struct body *body; doappenduid = (appendstate.myrights & ACL_READ); uidvalidity = append_uidvalidity(&appendstate); for (i = 0; !r && i < stages.count ; i++) { curstage = stages.data[i]; body = NULL; if (curstage->binary) { r = message_parse_binary_file(curstage->f, &body); fclose(curstage->f); curstage->f = NULL; } if (!r) { r = append_fromstage(&appendstate, &body, curstage->stage, curstage->internaldate, &curstage->flags, 0, curstage->annotations); } if (body) { /* Note: either the calls to message_parse_binary_file() * or append_fromstage() above, may create a body. */ message_free_body(body); free(body); body = NULL; } } if (!r) { r = append_commit(&appendstate); } else { append_abort(&appendstate); } } imapd_check(NULL, 1); if (r == IMAP_PROTOCOL_ERROR && parseerr) { prot_printf(imapd_out, "%s BAD %s\r\n", tag, parseerr); } else if (r == IMAP_BADURL) { prot_printf(imapd_out, "%s NO [BADURL \"%s\"] %s\r\n", tag, url, parseerr); } else if (r) { prot_printf(imapd_out, "%s NO %s%s\r\n", tag, (r == IMAP_MAILBOX_NONEXISTENT && mboxlist_createmailboxcheck(intname, 0, 0, imapd_userisadmin, imapd_userid, imapd_authstate, NULL, NULL, 0) == 0) ? "[TRYCREATE] " : r == IMAP_MESSAGE_TOO_LARGE ? "[TOOBIG]" : "", error_message(r)); } else if (doappenduid) { /* is this a space seperated list or sequence list? */ prot_printf(imapd_out, "%s OK [APPENDUID %lu ", tag, uidvalidity); if (appendstate.nummsg == 1) { prot_printf(imapd_out, "%u", appendstate.baseuid); } else { prot_printf(imapd_out, "%u:%u", appendstate.baseuid, appendstate.baseuid + appendstate.nummsg - 1); } prot_printf(imapd_out, "] %s\r\n", error_message(IMAP_OK_COMPLETED)); } else { prot_printf(imapd_out, "%s OK %s\r\n", tag, error_message(IMAP_OK_COMPLETED)); } cleanup: /* Cleanup the stage(s) */ while ((curstage = ptrarray_pop(&stages))) { if (curstage->f != NULL) fclose(curstage->f); append_removestage(curstage->stage); strarray_fini(&curstage->flags); freeentryatts(curstage->annotations); free(curstage); } free(intname); ptrarray_fini(&stages); }
2,620
137,149
0
bool Textfield::AcceleratorPressed(const ui::Accelerator& accelerator) { ui::KeyEvent event( accelerator.key_state() == ui::Accelerator::KeyState::PRESSED ? ui::ET_KEY_PRESSED : ui::ET_KEY_RELEASED, accelerator.key_code(), accelerator.modifiers()); ExecuteTextEditCommand(GetCommandForKeyEvent(event)); return true; }
2,621
136,538
0
DisplayItem& PaintController::MoveItemFromCurrentListToNewList(size_t index) { items_moved_into_new_list_.resize( current_paint_artifact_.GetDisplayItemList().size()); items_moved_into_new_list_[index] = new_display_item_list_.size(); return new_display_item_list_.AppendByMoving( current_paint_artifact_.GetDisplayItemList()[index]); }
2,622
137,272
0
bool Textfield::PasteSelectionClipboard() { DCHECK(performing_user_action_); DCHECK(!read_only()); const base::string16 selection_clipboard_text = GetSelectionClipboardText(); if (selection_clipboard_text.empty()) return false; model_->InsertText(selection_clipboard_text); return true; }
2,623
26,257
0
int alloc_rt_sched_group(struct task_group *tg, struct task_group *parent) { struct rt_rq *rt_rq; struct sched_rt_entity *rt_se; int i; tg->rt_rq = kzalloc(sizeof(rt_rq) * nr_cpu_ids, GFP_KERNEL); if (!tg->rt_rq) goto err; tg->rt_se = kzalloc(sizeof(rt_se) * nr_cpu_ids, GFP_KERNEL); if (!tg->rt_se) goto err; init_rt_bandwidth(&tg->rt_bandwidth, ktime_to_ns(def_rt_bandwidth.rt_period), 0); for_each_possible_cpu(i) { rt_rq = kzalloc_node(sizeof(struct rt_rq), GFP_KERNEL, cpu_to_node(i)); if (!rt_rq) goto err; rt_se = kzalloc_node(sizeof(struct sched_rt_entity), GFP_KERNEL, cpu_to_node(i)); if (!rt_se) goto err_free_rq; init_tg_rt_entry(tg, rt_rq, rt_se, i, parent->rt_se[i]); } return 1; err_free_rq: kfree(rt_rq); err: return 0; }
2,624
48,031
0
static int handle_invvpid(struct kvm_vcpu *vcpu) { struct vcpu_vmx *vmx = to_vmx(vcpu); u32 vmx_instruction_info; unsigned long type, types; gva_t gva; struct x86_exception e; int vpid; if (!(vmx->nested.nested_vmx_secondary_ctls_high & SECONDARY_EXEC_ENABLE_VPID) || !(vmx->nested.nested_vmx_vpid_caps & VMX_VPID_INVVPID_BIT)) { kvm_queue_exception(vcpu, UD_VECTOR); return 1; } if (!nested_vmx_check_permission(vcpu)) return 1; vmx_instruction_info = vmcs_read32(VMX_INSTRUCTION_INFO); type = kvm_register_readl(vcpu, (vmx_instruction_info >> 28) & 0xf); types = (vmx->nested.nested_vmx_vpid_caps & VMX_VPID_EXTENT_SUPPORTED_MASK) >> 8; if (type >= 32 || !(types & (1 << type))) { nested_vmx_failValid(vcpu, VMXERR_INVALID_OPERAND_TO_INVEPT_INVVPID); return kvm_skip_emulated_instruction(vcpu); } /* according to the intel vmx instruction reference, the memory * operand is read even if it isn't needed (e.g., for type==global) */ if (get_vmx_mem_address(vcpu, vmcs_readl(EXIT_QUALIFICATION), vmx_instruction_info, false, &gva)) return 1; if (kvm_read_guest_virt(&vcpu->arch.emulate_ctxt, gva, &vpid, sizeof(u32), &e)) { kvm_inject_page_fault(vcpu, &e); return 1; } switch (type) { case VMX_VPID_EXTENT_INDIVIDUAL_ADDR: case VMX_VPID_EXTENT_SINGLE_CONTEXT: case VMX_VPID_EXTENT_SINGLE_NON_GLOBAL: if (!vpid) { nested_vmx_failValid(vcpu, VMXERR_INVALID_OPERAND_TO_INVEPT_INVVPID); return kvm_skip_emulated_instruction(vcpu); } break; case VMX_VPID_EXTENT_ALL_CONTEXT: break; default: WARN_ON_ONCE(1); return kvm_skip_emulated_instruction(vcpu); } __vmx_flush_tlb(vcpu, vmx->nested.vpid02); nested_vmx_succeed(vcpu); return kvm_skip_emulated_instruction(vcpu); }
2,625
169,912
0
xsltFreeKeyTable(xsltKeyTablePtr keyt) { if (keyt == NULL) return; if (keyt->name != NULL) xmlFree(keyt->name); if (keyt->nameURI != NULL) xmlFree(keyt->nameURI); if (keyt->keys != NULL) xmlHashFree(keyt->keys, (xmlHashDeallocator) xmlXPathFreeNodeSet); memset(keyt, -1, sizeof(xsltKeyTable)); xmlFree(keyt); }
2,626
68,467
0
int ip_cmsg_send(struct sock *sk, struct msghdr *msg, struct ipcm_cookie *ipc, bool allow_ipv6) { int err, val; struct cmsghdr *cmsg; struct net *net = sock_net(sk); for_each_cmsghdr(cmsg, msg) { if (!CMSG_OK(msg, cmsg)) return -EINVAL; #if IS_ENABLED(CONFIG_IPV6) if (allow_ipv6 && cmsg->cmsg_level == SOL_IPV6 && cmsg->cmsg_type == IPV6_PKTINFO) { struct in6_pktinfo *src_info; if (cmsg->cmsg_len < CMSG_LEN(sizeof(*src_info))) return -EINVAL; src_info = (struct in6_pktinfo *)CMSG_DATA(cmsg); if (!ipv6_addr_v4mapped(&src_info->ipi6_addr)) return -EINVAL; ipc->oif = src_info->ipi6_ifindex; ipc->addr = src_info->ipi6_addr.s6_addr32[3]; continue; } #endif if (cmsg->cmsg_level == SOL_SOCKET) { err = __sock_cmsg_send(sk, msg, cmsg, &ipc->sockc); if (err) return err; continue; } if (cmsg->cmsg_level != SOL_IP) continue; switch (cmsg->cmsg_type) { case IP_RETOPTS: err = cmsg->cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr)); /* Our caller is responsible for freeing ipc->opt */ err = ip_options_get(net, &ipc->opt, CMSG_DATA(cmsg), err < 40 ? err : 40); if (err) return err; break; case IP_PKTINFO: { struct in_pktinfo *info; if (cmsg->cmsg_len != CMSG_LEN(sizeof(struct in_pktinfo))) return -EINVAL; info = (struct in_pktinfo *)CMSG_DATA(cmsg); ipc->oif = info->ipi_ifindex; ipc->addr = info->ipi_spec_dst.s_addr; break; } case IP_TTL: if (cmsg->cmsg_len != CMSG_LEN(sizeof(int))) return -EINVAL; val = *(int *)CMSG_DATA(cmsg); if (val < 1 || val > 255) return -EINVAL; ipc->ttl = val; break; case IP_TOS: if (cmsg->cmsg_len == CMSG_LEN(sizeof(int))) val = *(int *)CMSG_DATA(cmsg); else if (cmsg->cmsg_len == CMSG_LEN(sizeof(u8))) val = *(u8 *)CMSG_DATA(cmsg); else return -EINVAL; if (val < 0 || val > 255) return -EINVAL; ipc->tos = val; ipc->priority = rt_tos2priority(ipc->tos); break; default: return -EINVAL; } } return 0; }
2,627
106,812
0
IntRect RenderBox::absoluteContentBox() const { IntRect rect = contentBoxRect(); FloatPoint absPos = localToAbsolute(FloatPoint()); rect.move(absPos.x(), absPos.y()); return rect; }
2,628
20,941
0
cdf_read_summary_info(const cdf_info_t *info, const cdf_header_t *h, const cdf_sat_t *sat, const cdf_sat_t *ssat, const cdf_stream_t *sst, const cdf_dir_t *dir, cdf_stream_t *scn) { size_t i; const cdf_directory_t *d; static const char name[] = "\05SummaryInformation"; for (i = dir->dir_len; i > 0; i--) if (dir->dir_tab[i - 1].d_type == CDF_DIR_TYPE_USER_STREAM && cdf_namecmp(name, dir->dir_tab[i - 1].d_name, sizeof(name)) == 0) break; if (i == 0) { DPRINTF(("Cannot find summary information section\n")); errno = ESRCH; return -1; } d = &dir->dir_tab[i - 1]; return cdf_read_sector_chain(info, h, sat, ssat, sst, d->d_stream_first_sector, d->d_size, scn); }
2,629
136,568
0
CreateTransformWithCompositorElementId( const CompositorElementId& compositor_element_id) { TransformPaintPropertyNode::State state; state.compositor_element_id = compositor_element_id; return TransformPaintPropertyNode::Create(TransformPaintPropertyNode::Root(), std::move(state)); }
2,630
108,580
0
void FontCache::getTraitsInFamily(const AtomicString& familyName, Vector<unsigned>& traitsMasks) { HWndDC hdc(0); LOGFONT logFont; logFont.lfCharSet = DEFAULT_CHARSET; unsigned familyLength = min(familyName.length(), static_cast<unsigned>(LF_FACESIZE - 1)); familyName.string().copyTo(logFont.lfFaceName, 0, familyLength); logFont.lfFaceName[familyLength] = 0; logFont.lfPitchAndFamily = 0; TraitsInFamilyProcData procData(familyName); EnumFontFamiliesEx(hdc, &logFont, traitsInFamilyEnumProc, reinterpret_cast<LPARAM>(&procData), 0); copyToVector(procData.m_traitsMasks, traitsMasks); }
2,631
49,673
0
static ssize_t disk_capability_show(struct device *dev, struct device_attribute *attr, char *buf) { struct gendisk *disk = dev_to_disk(dev); return sprintf(buf, "%x\n", disk->flags); }
2,632
26,831
0
static ssize_t oom_adjust_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { struct task_struct *task; char buffer[PROC_NUMBUF]; int oom_adjust; unsigned long flags; int err; memset(buffer, 0, sizeof(buffer)); if (count > sizeof(buffer) - 1) count = sizeof(buffer) - 1; if (copy_from_user(buffer, buf, count)) { err = -EFAULT; goto out; } err = kstrtoint(strstrip(buffer), 0, &oom_adjust); if (err) goto out; if ((oom_adjust < OOM_ADJUST_MIN || oom_adjust > OOM_ADJUST_MAX) && oom_adjust != OOM_DISABLE) { err = -EINVAL; goto out; } task = get_proc_task(file->f_path.dentry->d_inode); if (!task) { err = -ESRCH; goto out; } task_lock(task); if (!task->mm) { err = -EINVAL; goto err_task_lock; } if (!lock_task_sighand(task, &flags)) { err = -ESRCH; goto err_task_lock; } if (oom_adjust < task->signal->oom_adj && !capable(CAP_SYS_RESOURCE)) { err = -EACCES; goto err_sighand; } if (oom_adjust != task->signal->oom_adj) { if (oom_adjust == OOM_DISABLE) atomic_inc(&task->mm->oom_disable_count); if (task->signal->oom_adj == OOM_DISABLE) atomic_dec(&task->mm->oom_disable_count); } /* * Warn that /proc/pid/oom_adj is deprecated, see * Documentation/feature-removal-schedule.txt. */ printk_once(KERN_WARNING "%s (%d): /proc/%d/oom_adj is deprecated, " "please use /proc/%d/oom_score_adj instead.\n", current->comm, task_pid_nr(current), task_pid_nr(task), task_pid_nr(task)); task->signal->oom_adj = oom_adjust; /* * Scale /proc/pid/oom_score_adj appropriately ensuring that a maximum * value is always attainable. */ if (task->signal->oom_adj == OOM_ADJUST_MAX) task->signal->oom_score_adj = OOM_SCORE_ADJ_MAX; else task->signal->oom_score_adj = (oom_adjust * OOM_SCORE_ADJ_MAX) / -OOM_DISABLE; err_sighand: unlock_task_sighand(task, &flags); err_task_lock: task_unlock(task); put_task_struct(task); out: return err < 0 ? err : count; }
2,633
103,753
0
bool RenderThread::IsRegisteredExtension( const std::string& v8_extension_name) const { return v8_extensions_.find(v8_extension_name) != v8_extensions_.end(); }
2,634
60,021
0
static struct tty_driver *usb_console_device(struct console *co, int *index) { struct tty_driver **p = (struct tty_driver **)co->data; if (!*p) return NULL; *index = co->index; return *p; }
2,635
137,873
0
MediaControlOverlayEnclosureElement::preDispatchEventHandler(Event* event) { if (event && (event->type() == EventTypeNames::click || event->type() == EventTypeNames::touchstart)) mediaControls().showOverlayCastButtonIfNeeded(); return MediaControlDivElement::preDispatchEventHandler(event); }
2,636
138,525
0
void WorkerThread::terminateV8Execution() { ASSERT(isMainThread()); m_workerGlobalScope->script()->willScheduleExecutionTermination(); v8::V8::TerminateExecution(m_isolate); }
2,637
80,656
0
GF_Err uuid_Read(GF_Box *s, GF_BitStream *bs) { u32 bytesToRead; GF_UnknownUUIDBox *ptr = (GF_UnknownUUIDBox *)s; if (ptr->size > 0xFFFFFFFF) return GF_ISOM_INVALID_FILE; bytesToRead = (u32) (ptr->size); if (bytesToRead) { ptr->data = (char*)gf_malloc(bytesToRead); if (ptr->data == NULL ) return GF_OUT_OF_MEM; ptr->dataSize = bytesToRead; gf_bs_read_data(bs, ptr->data, ptr->dataSize); } return GF_OK; }
2,638
50,400
0
static struct posix_acl *reiserfs_posix_acl_from_disk(const void *value, size_t size) { const char *end = (char *)value + size; int n, count; struct posix_acl *acl; if (!value) return NULL; if (size < sizeof(reiserfs_acl_header)) return ERR_PTR(-EINVAL); if (((reiserfs_acl_header *) value)->a_version != cpu_to_le32(REISERFS_ACL_VERSION)) return ERR_PTR(-EINVAL); value = (char *)value + sizeof(reiserfs_acl_header); count = reiserfs_acl_count(size); if (count < 0) return ERR_PTR(-EINVAL); if (count == 0) return NULL; acl = posix_acl_alloc(count, GFP_NOFS); if (!acl) return ERR_PTR(-ENOMEM); for (n = 0; n < count; n++) { reiserfs_acl_entry *entry = (reiserfs_acl_entry *) value; if ((char *)value + sizeof(reiserfs_acl_entry_short) > end) goto fail; acl->a_entries[n].e_tag = le16_to_cpu(entry->e_tag); acl->a_entries[n].e_perm = le16_to_cpu(entry->e_perm); switch (acl->a_entries[n].e_tag) { case ACL_USER_OBJ: case ACL_GROUP_OBJ: case ACL_MASK: case ACL_OTHER: value = (char *)value + sizeof(reiserfs_acl_entry_short); break; case ACL_USER: value = (char *)value + sizeof(reiserfs_acl_entry); if ((char *)value > end) goto fail; acl->a_entries[n].e_uid = make_kuid(&init_user_ns, le32_to_cpu(entry->e_id)); break; case ACL_GROUP: value = (char *)value + sizeof(reiserfs_acl_entry); if ((char *)value > end) goto fail; acl->a_entries[n].e_gid = make_kgid(&init_user_ns, le32_to_cpu(entry->e_id)); break; default: goto fail; } } if (value != end) goto fail; return acl; fail: posix_acl_release(acl); return ERR_PTR(-EINVAL); }
2,639
142,807
0
bool HTMLMediaElement::HasClosedCaptions() const { if (!text_tracks_) return false; for (unsigned i = 0; i < text_tracks_->length(); ++i) { if (text_tracks_->AnonymousIndexedGetter(i)->CanBeRendered()) return true; } return false; }
2,640
124,346
0
MessageService::MessageService( LazyBackgroundTaskQueue* queue) : lazy_background_task_queue_(queue), weak_factory_(this) { registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, content::NotificationService::AllBrowserContextsAndSources()); registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, content::NotificationService::AllBrowserContextsAndSources()); }
2,641
39,589
0
void aio_complete(struct kiocb *iocb, long res, long res2) { struct kioctx *ctx = iocb->ki_ctx; struct aio_ring *ring; struct io_event *ev_page, *event; unsigned long flags; unsigned tail, pos; /* * Special case handling for sync iocbs: * - events go directly into the iocb for fast handling * - the sync task with the iocb in its stack holds the single iocb * ref, no other paths have a way to get another ref * - the sync task helpfully left a reference to itself in the iocb */ if (is_sync_kiocb(iocb)) { iocb->ki_user_data = res; smp_wmb(); iocb->ki_ctx = ERR_PTR(-EXDEV); wake_up_process(iocb->ki_obj.tsk); return; } if (iocb->ki_list.next) { unsigned long flags; spin_lock_irqsave(&ctx->ctx_lock, flags); list_del(&iocb->ki_list); spin_unlock_irqrestore(&ctx->ctx_lock, flags); } /* * Add a completion event to the ring buffer. Must be done holding * ctx->completion_lock to prevent other code from messing with the tail * pointer since we might be called from irq context. */ spin_lock_irqsave(&ctx->completion_lock, flags); tail = ctx->tail; pos = tail + AIO_EVENTS_OFFSET; if (++tail >= ctx->nr_events) tail = 0; ev_page = kmap_atomic(ctx->ring_pages[pos / AIO_EVENTS_PER_PAGE]); event = ev_page + pos % AIO_EVENTS_PER_PAGE; event->obj = (u64)(unsigned long)iocb->ki_obj.user; event->data = iocb->ki_user_data; event->res = res; event->res2 = res2; kunmap_atomic(ev_page); flush_dcache_page(ctx->ring_pages[pos / AIO_EVENTS_PER_PAGE]); pr_debug("%p[%u]: %p: %p %Lx %lx %lx\n", ctx, tail, iocb, iocb->ki_obj.user, iocb->ki_user_data, res, res2); /* after flagging the request as done, we * must never even look at it again */ smp_wmb(); /* make event visible before updating tail */ ctx->tail = tail; ring = kmap_atomic(ctx->ring_pages[0]); ring->tail = tail; kunmap_atomic(ring); flush_dcache_page(ctx->ring_pages[0]); spin_unlock_irqrestore(&ctx->completion_lock, flags); pr_debug("added to ring %p at [%u]\n", iocb, tail); /* * Check if the user asked us to deliver the result through an * eventfd. The eventfd_signal() function is safe to be called * from IRQ context. */ if (iocb->ki_eventfd != NULL) eventfd_signal(iocb->ki_eventfd, 1); /* everything turned out well, dispose of the aiocb. */ kiocb_free(iocb); put_reqs_available(ctx, 1); /* * We have to order our ring_info tail store above and test * of the wait list below outside the wait lock. This is * like in wake_up_bit() where clearing a bit has to be * ordered with the unlocked test. */ smp_mb(); if (waitqueue_active(&ctx->wait)) wake_up(&ctx->wait); percpu_ref_put(&ctx->reqs); }
2,642
166,045
0
void RTCPeerConnectionHandler::getStats( const scoped_refptr<LocalRTCStatsRequest>& request) { DCHECK(task_runner_->RunsTasksInCurrentSequence()); TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::getStats"); rtc::scoped_refptr<webrtc::StatsObserver> observer( new rtc::RefCountedObject<StatsResponse>(request, task_runner_)); rtc::scoped_refptr<webrtc::MediaStreamTrackInterface> selector; if (request->hasSelector()) { auto track_adapter_ref = track_adapter_map_->GetLocalTrackAdapter(request->component()); if (!track_adapter_ref) { track_adapter_ref = track_adapter_map_->GetRemoteTrackAdapter(request->component()); } if (track_adapter_ref) selector = track_adapter_ref->webrtc_track(); } GetStats(observer, webrtc::PeerConnectionInterface::kStatsOutputLevelStandard, std::move(selector)); }
2,643
69,196
0
ZEND_API uint32_t ZEND_FASTCALL zend_hash_iterator_add(HashTable *ht, HashPosition pos) { HashTableIterator *iter = EG(ht_iterators); HashTableIterator *end = iter + EG(ht_iterators_count); uint32_t idx; if (EXPECTED(ht->u.v.nIteratorsCount != 255)) { ht->u.v.nIteratorsCount++; } while (iter != end) { if (iter->ht == NULL) { iter->ht = ht; iter->pos = pos; idx = iter - EG(ht_iterators); if (idx + 1 > EG(ht_iterators_used)) { EG(ht_iterators_used) = idx + 1; } return idx; } iter++; } if (EG(ht_iterators) == EG(ht_iterators_slots)) { EG(ht_iterators) = emalloc(sizeof(HashTableIterator) * (EG(ht_iterators_count) + 8)); memcpy(EG(ht_iterators), EG(ht_iterators_slots), sizeof(HashTableIterator) * EG(ht_iterators_count)); } else { EG(ht_iterators) = erealloc(EG(ht_iterators), sizeof(HashTableIterator) * (EG(ht_iterators_count) + 8)); } iter = EG(ht_iterators) + EG(ht_iterators_count); EG(ht_iterators_count) += 8; iter->ht = ht; iter->pos = pos; memset(iter + 1, 0, sizeof(HashTableIterator) * 7); idx = iter - EG(ht_iterators); EG(ht_iterators_used) = idx + 1; return idx; }
2,644
42,026
0
static inline struct shmid_kernel *shm_obtain_object(struct ipc_namespace *ns, int id) { struct kern_ipc_perm *ipcp = ipc_obtain_object_idr(&shm_ids(ns), id); if (IS_ERR(ipcp)) return ERR_CAST(ipcp); return container_of(ipcp, struct shmid_kernel, shm_perm); }
2,645
67,491
0
static int fsmMkdirs(rpmfiles files, rpmfs fs, rpmPlugins plugins) { DNLI_t dnli = dnlInitIterator(files, fs, 0); struct stat sb; const char *dpath; int dc = rpmfilesDC(files); int rc = 0; int i; int ldnlen = 0; int ldnalloc = 0; char * ldn = NULL; short * dnlx = NULL; dnlx = (dc ? xcalloc(dc, sizeof(*dnlx)) : NULL); if (dnlx != NULL) while ((dpath = dnlNextIterator(dnli)) != NULL) { size_t dnlen = strlen(dpath); char * te, dn[dnlen+1]; dc = dnli->isave; if (dc < 0) continue; dnlx[dc] = dnlen; if (dnlen <= 1) continue; if (dnlen <= ldnlen && rstreq(dpath, ldn)) continue; /* Copy as we need to modify the string */ (void) stpcpy(dn, dpath); /* Assume '/' directory exists, "mkdir -p" for others if non-existent */ for (i = 1, te = dn + 1; *te != '\0'; te++, i++) { if (*te != '/') continue; *te = '\0'; /* Already validated? */ if (i < ldnlen && (ldn[i] == '/' || ldn[i] == '\0') && rstreqn(dn, ldn, i)) { *te = '/'; /* Move pre-existing path marker forward. */ dnlx[dc] = (te - dn); continue; } /* Validate next component of path. */ rc = fsmStat(dn, 1, &sb); /* lstat */ *te = '/'; /* Directory already exists? */ if (rc == 0 && S_ISDIR(sb.st_mode)) { /* Move pre-existing path marker forward. */ dnlx[dc] = (te - dn); } else if (rc == RPMERR_ENOENT) { *te = '\0'; mode_t mode = S_IFDIR | (_dirPerms & 07777); rpmFsmOp op = (FA_CREATE|FAF_UNOWNED); /* Run fsm file pre hook for all plugins */ rc = rpmpluginsCallFsmFilePre(plugins, NULL, dn, mode, op); if (!rc) rc = fsmMkdir(dn, mode); if (!rc) { rc = rpmpluginsCallFsmFilePrepare(plugins, NULL, dn, dn, mode, op); } /* Run fsm file post hook for all plugins */ rpmpluginsCallFsmFilePost(plugins, NULL, dn, mode, op, rc); if (!rc) { rpmlog(RPMLOG_DEBUG, "%s directory created with perms %04o\n", dn, (unsigned)(mode & 07777)); } *te = '/'; } if (rc) break; } if (rc) break; /* Save last validated path. */ if (ldnalloc < (dnlen + 1)) { ldnalloc = dnlen + 100; ldn = xrealloc(ldn, ldnalloc); } if (ldn != NULL) { /* XXX can't happen */ strcpy(ldn, dn); ldnlen = dnlen; } } free(dnlx); free(ldn); dnlFreeIterator(dnli); return rc; }
2,646
187,311
1
_exsltDateAdd (exsltDateValPtr dt, exsltDateValPtr dur) { exsltDateValPtr ret; long carry, tempdays, temp; exsltDateValDatePtr r, d; exsltDateValDurationPtr u; if ((dt == NULL) || (dur == NULL)) return NULL; ret = exsltDateCreateDate(dt->type); if (ret == NULL) return NULL; r = &(ret->value.date); d = &(dt->value.date); u = &(dur->value.dur); /* normalization * if (d->mon == 0) d->mon = 1; /* normalize for time zone offset */ u->sec -= (d->tzo * 60); /* changed from + to - (bug 153000) */ d->tzo = 0; /* normalization * if (d->day == 0) d->day = 1; /* month */ carry = d->mon + u->mon; r->mon = (unsigned int)MODULO_RANGE(carry, 1, 13); carry = (long)FQUOTIENT_RANGE(carry, 1, 13); /* year (may be modified later) */ r->year = d->year + carry; if (r->year == 0) { if (d->year > 0) r->year--; else r->year++; } /* time zone */ r->tzo = d->tzo; r->tz_flag = d->tz_flag; /* seconds */ r->sec = d->sec + u->sec; carry = (long)FQUOTIENT((long)r->sec, 60); if (r->sec != 0.0) { r->sec = MODULO(r->sec, 60.0); } /* minute */ carry += d->min; r->min = (unsigned int)MODULO(carry, 60); carry = (long)FQUOTIENT(carry, 60); /* hours */ carry += d->hour; r->hour = (unsigned int)MODULO(carry, 24); carry = (long)FQUOTIENT(carry, 24); /* * days * Note we use tempdays because the temporary values may need more * than 5 bits */ if ((VALID_YEAR(r->year)) && (VALID_MONTH(r->mon)) && (d->day > MAX_DAYINMONTH(r->year, r->mon))) tempdays = MAX_DAYINMONTH(r->year, r->mon); else if (d->day < 1) tempdays = 1; else tempdays = d->day; tempdays += u->day + carry; while (1) { if (tempdays < 1) { long tmon = (long)MODULO_RANGE((int)r->mon-1, 1, 13); long tyr = r->year + (long)FQUOTIENT_RANGE((int)r->mon-1, 1, 13); if (tyr == 0) tyr--; /* * Coverity detected an overrun in daysInMonth * of size 12 at position 12 with index variable "((r)->mon - 1)" */ if (tmon < 0) tmon = 0; if (tmon > 12) tmon = 12; tempdays += MAX_DAYINMONTH(tyr, tmon); carry = -1; } else if (tempdays > (long)MAX_DAYINMONTH(r->year, r->mon)) { tempdays = tempdays - MAX_DAYINMONTH(r->year, r->mon); carry = 1; } else break; temp = r->mon + carry; r->mon = (unsigned int)MODULO_RANGE(temp, 1, 13); r->year = r->year + (long)FQUOTIENT_RANGE(temp, 1, 13); if (r->year == 0) { if (temp < 1) r->year--; else r->year++; } } r->day = tempdays; /* * adjust the date/time type to the date values */ if (ret->type != XS_DATETIME) { if ((r->hour) || (r->min) || (r->sec)) ret->type = XS_DATETIME; else if (ret->type != XS_DATE) { if (r->day != 1) ret->type = XS_DATE; else if ((ret->type != XS_GYEARMONTH) && (r->mon != 1)) ret->type = XS_GYEARMONTH; } } return ret; }
2,647
36,282
0
SYSCALL_DEFINE3(mkdirat, int, dfd, const char __user *, pathname, umode_t, mode) { struct dentry *dentry; struct path path; int error; unsigned int lookup_flags = LOOKUP_DIRECTORY; retry: dentry = user_path_create(dfd, pathname, &path, lookup_flags); if (IS_ERR(dentry)) return PTR_ERR(dentry); if (!IS_POSIXACL(path.dentry->d_inode)) mode &= ~current_umask(); error = security_path_mkdir(&path, dentry, mode); if (!error) error = vfs_mkdir(path.dentry->d_inode, dentry, mode); done_path_create(&path, dentry); if (retry_estale(error, lookup_flags)) { lookup_flags |= LOOKUP_REVAL; goto retry; } return error; }
2,648
140,229
0
const WTF::AtomicString& BluetoothRemoteGATTCharacteristic::interfaceName() const { return EventTargetNames::BluetoothRemoteGATTCharacteristic; }
2,649
25,487
0
void ptrace_disable(struct task_struct *child) { /* make sure the single step bit is not set. */ user_disable_single_step(child); }
2,650
65,654
0
nfsd_forget_delegations(struct list_head *reaplist) { struct nfs4_client *clp; struct nfs4_delegation *dp, *next; list_for_each_entry_safe(dp, next, reaplist, dl_recall_lru) { list_del_init(&dp->dl_recall_lru); clp = dp->dl_stid.sc_client; revoke_delegation(dp); put_client(clp); } }
2,651
92,273
0
XML_SetDefaultHandlerExpand(XML_Parser parser, XML_DefaultHandler handler) { if (parser == NULL) return; parser->m_defaultHandler = handler; parser->m_defaultExpandInternalEntities = XML_TRUE; }
2,652
17,258
0
CatalogueStartListFontsWithInfo(pointer client, FontPathElementPtr fpe, char *pat, int len, int max, pointer *privatep) { return CatalogueStartListFonts(client, fpe, pat, len, max, privatep, 0); }
2,653
86,313
0
void unregister_pernet_subsys(struct pernet_operations *ops) { mutex_lock(&net_mutex); unregister_pernet_operations(ops); mutex_unlock(&net_mutex); }
2,654
153,246
0
bool DesktopWindowTreeHostX11::IsActive() const { bool is_active = (has_window_focus_ || has_pointer_focus_) && !ignore_keyboard_input_; DCHECK(!is_active || window_mapped_in_server_); DCHECK(!has_window_focus_ || !has_pointer_focus_); return is_active; }
2,655
149,354
0
void BinaryUploadService::OnGetResponse(Request* request, DeepScanningClientResponse response) { if (!IsActive(request)) return; if (response.has_dlp_scan_verdict()) { received_dlp_verdicts_[request].reset(response.release_dlp_scan_verdict()); } if (response.has_malware_scan_verdict()) { received_malware_verdicts_[request].reset( response.release_malware_scan_verdict()); } MaybeFinishRequest(request); }
2,656
184,312
1
IPC::PlatformFileForTransit ProxyChannelDelegate::ShareHandleWithRemote( base::PlatformFile handle, const IPC::SyncChannel& channel, bool should_close_source) { return content::BrokerGetFileHandleForProcess(handle, channel.peer_pid(), should_close_source); }
2,657
187,936
1
WORD32 ih264d_cavlc_4x4res_block_totalcoeff_2to10(UWORD32 u4_isdc, UWORD32 u4_total_coeff_trail_one, /*!<TotalCoefficients<<16+trailingones*/ dec_bit_stream_t *ps_bitstrm) { UWORD32 u4_total_zeroes; WORD32 i; UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer; UWORD32 u4_bitstream_offset = ps_bitstrm->u4_ofst; UWORD32 u4_trailing_ones = u4_total_coeff_trail_one & 0xFFFF; UWORD32 u4_total_coeff = u4_total_coeff_trail_one >> 16; WORD16 i2_level_arr[16]; tu_sblk4x4_coeff_data_t *ps_tu_4x4; WORD16 *pi2_coeff_data; dec_struct_t *ps_dec = (dec_struct_t *)ps_bitstrm->pv_codec_handle; ps_tu_4x4 = (tu_sblk4x4_coeff_data_t *)ps_dec->pv_parse_tu_coeff_data; ps_tu_4x4->u2_sig_coeff_map = 0; pi2_coeff_data = &ps_tu_4x4->ai2_level[0]; i = u4_total_coeff - 1; if(u4_trailing_ones) { /*********************************************************************/ /* Decode Trailing Ones */ /* read the sign of T1's and put them in level array */ /*********************************************************************/ UWORD32 u4_signs, u4_cnt = u4_trailing_ones; WORD16 (*ppi2_trlone_lkup)[3] = (WORD16 (*)[3])gai2_ih264d_trailing_one_level; WORD16 *pi2_trlone_lkup; GETBITS(u4_signs, u4_bitstream_offset, pu4_bitstrm_buf, u4_cnt); pi2_trlone_lkup = ppi2_trlone_lkup[(1 << u4_cnt) - 2 + u4_signs]; while(u4_cnt--) i2_level_arr[i--] = *pi2_trlone_lkup++; } /****************************************************************/ /* Decoding Levels Begins */ /****************************************************************/ if(i >= 0) { /****************************************************************/ /* First level is decoded outside the loop as it has lot of */ /* special cases. */ /****************************************************************/ UWORD32 u4_lev_suffix, u4_suffix_len, u4_lev_suffix_size; WORD32 u2_lev_code, u2_abs_value; UWORD32 u4_lev_prefix; /***************************************************************/ /* u4_suffix_len = 0, Find leading zeros in next 32 bits */ /***************************************************************/ FIND_ONE_IN_STREAM_32(u4_lev_prefix, u4_bitstream_offset, pu4_bitstrm_buf); /*********************************************************/ /* Special decoding case when trailing ones are 3 */ /*********************************************************/ u2_lev_code = MIN(15, u4_lev_prefix); u2_lev_code += (3 == u4_trailing_ones) ? 0 : 2; if(14 == u4_lev_prefix) u4_lev_suffix_size = 4; else if(15 <= u4_lev_prefix) { u2_lev_code += 15; u4_lev_suffix_size = u4_lev_prefix - 3; } else u4_lev_suffix_size = 0; //HP_LEVEL_PREFIX if(16 <= u4_lev_prefix) { u2_lev_code += ((1 << (u4_lev_prefix - 3)) - 4096); } if(u4_lev_suffix_size) { GETBITS(u4_lev_suffix, u4_bitstream_offset, pu4_bitstrm_buf, u4_lev_suffix_size); u2_lev_code += u4_lev_suffix; } u2_abs_value = (u2_lev_code + 2) >> 1; /*********************************************************/ /* If Level code is odd, level is negative else positive */ /*********************************************************/ i2_level_arr[i--] = (u2_lev_code & 1) ? -u2_abs_value : u2_abs_value; u4_suffix_len = (u2_abs_value > 3) ? 2 : 1; /*********************************************************/ /* Now loop over the remaining levels */ /*********************************************************/ while(i >= 0) { /***************************************************************/ /* Find leading zeros in next 32 bits */ /***************************************************************/ FIND_ONE_IN_STREAM_32(u4_lev_prefix, u4_bitstream_offset, pu4_bitstrm_buf); u4_lev_suffix_size = (15 <= u4_lev_prefix) ? (u4_lev_prefix - 3) : u4_suffix_len; /*********************************************************/ /* Compute level code using prefix and suffix */ /*********************************************************/ GETBITS(u4_lev_suffix, u4_bitstream_offset, pu4_bitstrm_buf, u4_lev_suffix_size); u2_lev_code = (MIN(15,u4_lev_prefix) << u4_suffix_len) + u4_lev_suffix; //HP_LEVEL_PREFIX if(16 <= u4_lev_prefix) { u2_lev_code += ((1 << (u4_lev_prefix - 3)) - 4096); } u2_abs_value = (u2_lev_code + 2) >> 1; /*********************************************************/ /* If Level code is odd, level is negative else positive */ /*********************************************************/ i2_level_arr[i--] = (u2_lev_code & 1) ? -u2_abs_value : u2_abs_value; /*********************************************************/ /* Increment suffix length if required */ /*********************************************************/ u4_suffix_len += (u4_suffix_len < 6) ? (u2_abs_value > (3 << (u4_suffix_len - 1))) : 0; } /****************************************************************/ /* Decoding Levels Ends */ /****************************************************************/ } /****************************************************************/ /* Decoding total zeros as in section 9.2.3, table 9.7 */ /****************************************************************/ { UWORD32 u4_index; const UWORD8 (*ppu1_total_zero_lkup)[64] = (const UWORD8 (*)[64])gau1_ih264d_table_total_zero_2to10; NEXTBITS(u4_index, u4_bitstream_offset, pu4_bitstrm_buf, 6); u4_total_zeroes = ppu1_total_zero_lkup[u4_total_coeff - 2][u4_index]; FLUSHBITS(u4_bitstream_offset, (u4_total_zeroes >> 4)); u4_total_zeroes &= 0xf; } /**************************************************************/ /* Decode the runs and form the coefficient buffer */ /**************************************************************/ { const UWORD8 *pu1_table_runbefore; UWORD32 u4_run; WORD32 k; UWORD32 u4_scan_pos = u4_total_coeff + u4_total_zeroes - 1 + u4_isdc; WORD32 u4_zeroes_left = u4_total_zeroes; k = u4_total_coeff - 1; /**************************************************************/ /* Decoding Runs Begin for zeros left > 6 */ /**************************************************************/ while((u4_zeroes_left > 6) && k) { UWORD32 u4_code; NEXTBITS(u4_code, u4_bitstream_offset, pu4_bitstrm_buf, 3); if(u4_code != 0) { FLUSHBITS(u4_bitstream_offset, 3); u4_run = (7 - u4_code); } else { FIND_ONE_IN_STREAM_LEN(u4_code, u4_bitstream_offset, pu4_bitstrm_buf, 11); u4_run = (4 + u4_code); } SET_BIT(ps_tu_4x4->u2_sig_coeff_map, u4_scan_pos); *pi2_coeff_data++ = i2_level_arr[k--]; u4_zeroes_left -= u4_run; u4_scan_pos -= (u4_run + 1); } /**************************************************************/ /* Decoding Runs for 0 < zeros left <=6 */ /**************************************************************/ pu1_table_runbefore = (UWORD8 *)gau1_ih264d_table_run_before; while((u4_zeroes_left > 0) && k) { UWORD32 u4_code; NEXTBITS(u4_code, u4_bitstream_offset, pu4_bitstrm_buf, 3); u4_code = pu1_table_runbefore[u4_code + (u4_zeroes_left << 3)]; u4_run = u4_code >> 2; FLUSHBITS(u4_bitstream_offset, (u4_code & 0x03)); SET_BIT(ps_tu_4x4->u2_sig_coeff_map, u4_scan_pos); *pi2_coeff_data++ = i2_level_arr[k--]; u4_zeroes_left -= u4_run; u4_scan_pos -= (u4_run + 1); } /**************************************************************/ /* Decoding Runs End */ /**************************************************************/ /**************************************************************/ /* Copy the remaining coefficients */ /**************************************************************/ if(u4_zeroes_left < 0) return -1; while(k >= 0) { SET_BIT(ps_tu_4x4->u2_sig_coeff_map, u4_scan_pos); *pi2_coeff_data++ = i2_level_arr[k--]; u4_scan_pos--; } } { WORD32 offset; offset = (UWORD8 *)pi2_coeff_data - (UWORD8 *)ps_tu_4x4; offset = ALIGN4(offset); ps_dec->pv_parse_tu_coeff_data = (void *)((UWORD8 *)ps_dec->pv_parse_tu_coeff_data + offset); } ps_bitstrm->u4_ofst = u4_bitstream_offset; return 0; }
2,658
121,208
0
String HTMLInputElement::localizeValue(const String& proposedValue) const { if (proposedValue.isNull()) return proposedValue; return m_inputType->localizeValue(proposedValue); }
2,659
124,567
0
void RenderBlock::insertIntoTrackedRendererMaps(RenderBox* descendant, TrackedDescendantsMap*& descendantsMap, TrackedContainerMap*& containerMap) { if (!descendantsMap) { descendantsMap = new TrackedDescendantsMap; containerMap = new TrackedContainerMap; } TrackedRendererListHashSet* descendantSet = descendantsMap->get(this); if (!descendantSet) { descendantSet = new TrackedRendererListHashSet; descendantsMap->set(this, adoptPtr(descendantSet)); } bool added = descendantSet->add(descendant).isNewEntry; if (!added) { ASSERT(containerMap->get(descendant)); ASSERT(containerMap->get(descendant)->contains(this)); return; } HashSet<RenderBlock*>* containerSet = containerMap->get(descendant); if (!containerSet) { containerSet = new HashSet<RenderBlock*>; containerMap->set(descendant, adoptPtr(containerSet)); } ASSERT(!containerSet->contains(this)); containerSet->add(this); }
2,660
87,515
0
unsigned char lodepng_chunk_safetocopy(const unsigned char* chunk) { return((chunk[7] & 32) != 0); }
2,661
118,161
0
void WebContentsAndroid::ShowImeIfNeeded(JNIEnv* env, jobject obj) { RenderViewHost* host = web_contents_->GetRenderViewHost(); if (!host) return; host->Send(new ViewMsg_ShowImeIfNeeded(host->GetRoutingID())); }
2,662
159,194
0
void DownloadItemImpl::SetLastAccessTime(base::Time last_access_time) { last_access_time_ = last_access_time; UpdateObservers(); }
2,663
40,332
0
static void atrtr_device_down(struct net_device *dev) { struct atalk_route **r = &atalk_routes; struct atalk_route *tmp; write_lock_bh(&atalk_routes_lock); while ((tmp = *r) != NULL) { if (tmp->dev == dev) { *r = tmp->next; dev_put(dev); kfree(tmp); } else r = &tmp->next; } write_unlock_bh(&atalk_routes_lock); if (atrtr_default.dev == dev) atrtr_set_default(NULL); }
2,664
73,532
0
static inline MagickOffsetType *ReadPSDRLEOffsets(Image *image, const PSDInfo *psd_info,const size_t size) { MagickOffsetType *offsets; ssize_t y; offsets=(MagickOffsetType *) AcquireQuantumMemory(size,sizeof(*offsets)); if(offsets != (MagickOffsetType *) NULL) { for (y=0; y < (ssize_t) size; y++) { if (psd_info->version == 1) offsets[y]=(MagickOffsetType) ReadBlobShort(image); else offsets[y]=(MagickOffsetType) ReadBlobLong(image); } } return offsets; }
2,665
17,201
0
void BrowserContextDelegateTraits::Destruct(const BrowserContextDelegate* x) { if (content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) { delete x; return; } if (!content::BrowserThread::DeleteSoon(content::BrowserThread::UI, FROM_HERE, x)) { LOG(ERROR) << "BrowserContextDelegate won't be deleted. This could be due to it " "being leaked until after Chromium shutdown has begun"; } }
2,666
148,849
0
bool RenderFrameHostManager::CanSubframeSwapProcess( const GURL& dest_url, SiteInstance* source_instance, SiteInstance* dest_instance, bool was_server_redirect) { DCHECK(!source_instance || !dest_instance); if (!SiteIsolationPolicy::AreCrossProcessFramesPossible()) return false; GURL resolved_url = dest_url; if (url::Origin(resolved_url).unique()) { if (source_instance) { resolved_url = source_instance->GetSiteURL(); } else if (dest_instance) { resolved_url = dest_instance->GetSiteURL(); } else { if (!was_server_redirect) return false; } } if (!IsRendererTransferNeededForNavigation(render_frame_host_.get(), resolved_url)) { DCHECK(!dest_instance || dest_instance == render_frame_host_->GetSiteInstance()); return false; } return true; }
2,667
176,861
0
static bool initNative(JNIEnv* env, jobject obj) { ALOGV("%s:",__FUNCTION__); sJniAdapterServiceObj = env->NewGlobalRef(obj); sJniCallbacksObj = env->NewGlobalRef(env->GetObjectField(obj, sJniCallbacksField)); if (sBluetoothInterface) { int ret = sBluetoothInterface->init(&sBluetoothCallbacks); if (ret != BT_STATUS_SUCCESS) { ALOGE("Error while setting the callbacks: %d\n", ret); sBluetoothInterface = NULL; return JNI_FALSE; } ret = sBluetoothInterface->set_os_callouts(&sBluetoothOsCallouts); if (ret != BT_STATUS_SUCCESS) { ALOGE("Error while setting Bluetooth callouts: %d\n", ret); sBluetoothInterface->cleanup(); sBluetoothInterface = NULL; return JNI_FALSE; } if ( (sBluetoothSocketInterface = (btsock_interface_t *) sBluetoothInterface->get_profile_interface(BT_PROFILE_SOCKETS_ID)) == NULL) { ALOGE("Error getting socket interface"); } return JNI_TRUE; } return JNI_FALSE; }
2,668
19,808
0
static int _nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsinfo *fsinfo) { struct nfs4_fsinfo_arg args = { .fh = fhandle, .bitmask = server->attr_bitmask, }; struct nfs4_fsinfo_res res = { .fsinfo = fsinfo, }; struct rpc_message msg = { .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_FSINFO], .rpc_argp = &args, .rpc_resp = &res, }; return nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0); }
2,669
59,273
0
static struct mm_struct *dup_mm(struct task_struct *tsk) { struct mm_struct *mm, *oldmm = current->mm; int err; mm = allocate_mm(); if (!mm) goto fail_nomem; memcpy(mm, oldmm, sizeof(*mm)); if (!mm_init(mm, tsk, mm->user_ns)) goto fail_nomem; err = dup_mmap(mm, oldmm); if (err) goto free_pt; mm->hiwater_rss = get_mm_rss(mm); mm->hiwater_vm = mm->total_vm; if (mm->binfmt && !try_module_get(mm->binfmt->module)) goto free_pt; return mm; free_pt: /* don't put binfmt in mmput, we haven't got module yet */ mm->binfmt = NULL; mmput(mm); fail_nomem: return NULL; }
2,670
114,647
0
void WebPluginDelegateProxy::Paint(WebKit::WebCanvas* canvas, const gfx::Rect& damaged_rect) { gfx::Rect rect = damaged_rect.Intersect(plugin_rect_); if (!channel_host_ || !channel_host_->channel_valid()) { PaintSadPlugin(canvas, rect); return; } if (!uses_shared_bitmaps_) return; if (!front_buffer_canvas()) return; #if WEBKIT_USING_SKIA if (!skia::SupportsPlatformPaint(canvas)) { DLOG(WARNING) << "Could not paint plugin"; return; } skia::ScopedPlatformPaint scoped_platform_paint(canvas); gfx::NativeDrawingContext context = scoped_platform_paint.GetPlatformSurface(); #elif WEBKIT_USING_CG gfx::NativeDrawingContext context = canvas; #endif gfx::Rect offset_rect = rect; offset_rect.Offset(-plugin_rect_.x(), -plugin_rect_.y()); gfx::Rect canvas_rect = offset_rect; #if defined(OS_MACOSX) FlipRectVerticallyWithHeight(&canvas_rect, plugin_rect_.height()); #endif bool background_changed = false; if (background_store_.canvas.get() && BackgroundChanged(context, rect)) { background_changed = true; BlitContextToCanvas(background_store_.canvas.get(), canvas_rect, context, rect.origin()); } if (background_changed || !transport_store_painted_.Contains(offset_rect)) { Send(new PluginMsg_Paint(instance_id_, offset_rect)); UpdateFrontBuffer(offset_rect, false); } #if defined(OS_MACOSX) CGContextSaveGState(context); CGContextScaleCTM(context, 1, -1); rect.set_y(-rect.bottom()); #endif BlitCanvasToContext(context, rect, front_buffer_canvas(), offset_rect.origin()); #if defined(OS_MACOSX) CGContextRestoreGState(context); #endif if (invalidate_pending_) { invalidate_pending_ = false; Send(new PluginMsg_DidPaint(instance_id_)); } }
2,671
5,264
0
void zend_shared_alloc_unlock(void) { /* Destroy translation table */ zend_hash_destroy(&xlat_table); ZCG(locked) = 0; #ifndef ZEND_WIN32 if (fcntl(lock_file, F_SETLK, &mem_write_unlock) == -1) { zend_accel_error(ACCEL_LOG_ERROR, "Cannot remove lock - %s (%d)", strerror(errno), errno); } #ifdef ZTS tsrm_mutex_unlock(zts_lock); #endif #else zend_shared_alloc_unlock_win32(); #endif }
2,672
5,996
0
e1000e_intrmgr_stop_timer(E1000IntrDelayTimer *timer) { if (timer->running) { timer_del(timer->timer); timer->running = false; } }
2,673
182,950
1
static void setup_remaining_vcs(int src_fd, unsigned src_idx, bool utf8) { struct console_font_op cfo = { .op = KD_FONT_OP_GET, .width = UINT_MAX, .height = UINT_MAX, .charcount = UINT_MAX, }; struct unimapinit adv = {}; struct unimapdesc unimapd; _cleanup_free_ struct unipair* unipairs = NULL; _cleanup_free_ void *fontbuf = NULL; unsigned i; int r; unipairs = new(struct unipair, USHRT_MAX); if (!unipairs) { log_oom(); return; } /* get metadata of the current font (width, height, count) */ r = ioctl(src_fd, KDFONTOP, &cfo); if (r < 0) log_warning_errno(errno, "KD_FONT_OP_GET failed while trying to get the font metadata: %m"); else { /* verify parameter sanity first */ if (cfo.width > 32 || cfo.height > 32 || cfo.charcount > 512) log_warning("Invalid font metadata - width: %u (max 32), height: %u (max 32), count: %u (max 512)", cfo.width, cfo.height, cfo.charcount); else { /* * Console fonts supported by the kernel are limited in size to 32 x 32 and maximum 512 * characters. Thus with 1 bit per pixel it requires up to 65536 bytes. The height always * requires 32 per glyph, regardless of the actual height - see the comment above #define * max_font_size 65536 in drivers/tty/vt/vt.c for more details. */ fontbuf = malloc_multiply((cfo.width + 7) / 8 * 32, cfo.charcount); if (!fontbuf) { log_oom(); return; } /* get fonts from the source console */ cfo.data = fontbuf; r = ioctl(src_fd, KDFONTOP, &cfo); if (r < 0) log_warning_errno(errno, "KD_FONT_OP_GET failed while trying to read the font data: %m"); else { unimapd.entries = unipairs; unimapd.entry_ct = USHRT_MAX; r = ioctl(src_fd, GIO_UNIMAP, &unimapd); if (r < 0) log_warning_errno(errno, "GIO_UNIMAP failed while trying to read unicode mappings: %m"); else cfo.op = KD_FONT_OP_SET; } } } if (cfo.op != KD_FONT_OP_SET) log_warning("Fonts will not be copied to remaining consoles"); for (i = 1; i <= 63; i++) { char ttyname[sizeof("/dev/tty63")]; _cleanup_close_ int fd_d = -1; if (i == src_idx || verify_vc_allocation(i) < 0) continue; /* try to open terminal */ xsprintf(ttyname, "/dev/tty%u", i); fd_d = open_terminal(ttyname, O_RDWR|O_CLOEXEC|O_NOCTTY); if (fd_d < 0) { log_warning_errno(fd_d, "Unable to open tty%u, fonts will not be copied: %m", i); continue; } if (verify_vc_kbmode(fd_d) < 0) continue; toggle_utf8(ttyname, fd_d, utf8); if (cfo.op != KD_FONT_OP_SET) continue; r = ioctl(fd_d, KDFONTOP, &cfo); if (r < 0) { int last_errno, mode; /* The fonts couldn't have been copied. It might be due to the * terminal being in graphical mode. In this case the kernel * returns -EINVAL which is too generic for distinguishing this * specific case. So we need to retrieve the terminal mode and if * the graphical mode is in used, let's assume that something else * is using the terminal and the failure was expected as we * shouldn't have tried to copy the fonts. */ last_errno = errno; if (ioctl(fd_d, KDGETMODE, &mode) >= 0 && mode != KD_TEXT) log_debug("KD_FONT_OP_SET skipped: tty%u is not in text mode", i); else log_warning_errno(last_errno, "KD_FONT_OP_SET failed, fonts will not be copied to tty%u: %m", i); continue; } /* * copy unicode translation table unimapd is a ushort count and a pointer * to an array of struct unipair { ushort, ushort } */ r = ioctl(fd_d, PIO_UNIMAPCLR, &adv); if (r < 0) { log_warning_errno(errno, "PIO_UNIMAPCLR failed, unimaps might be incorrect for tty%u: %m", i); continue; } r = ioctl(fd_d, PIO_UNIMAP, &unimapd); if (r < 0) { log_warning_errno(errno, "PIO_UNIMAP failed, unimaps might be incorrect for tty%u: %m", i); continue; } log_debug("Font and unimap successfully copied to %s", ttyname); } }
2,674
140,881
0
ControllerConnectionProxy::ControllerConnectionProxy( blink::WebPresentationConnection* controller_connection) : PresentationConnectionProxy(controller_connection) {}
2,675
9,054
0
static inline void vmxnet3_ring_init(PCIDevice *d, Vmxnet3Ring *ring, hwaddr pa, size_t size, size_t cell_size, bool zero_region) { ring->pa = pa; ring->size = size; ring->cell_size = cell_size; ring->gen = VMXNET3_INIT_GEN; ring->next = 0; if (zero_region) { vmw_shmem_set(d, pa, 0, size * cell_size); } }
2,676
37,246
0
static void vmx_get_cs_db_l_bits(struct kvm_vcpu *vcpu, int *db, int *l) { u32 ar = vmx_read_guest_seg_ar(to_vmx(vcpu), VCPU_SREG_CS); *db = (ar >> 14) & 1; *l = (ar >> 13) & 1; }
2,677
51,460
0
static int gdImageTileGet (gdImagePtr im, int x, int y) { int srcx, srcy; int tileColor,p; if (!im->tile) { return -1; } srcx = x % gdImageSX(im->tile); srcy = y % gdImageSY(im->tile); p = gdImageGetPixel(im->tile, srcx, srcy); if (im->trueColor) { if (im->tile->trueColor) { tileColor = p; } else { tileColor = gdTrueColorAlpha( gdImageRed(im->tile,p), gdImageGreen(im->tile,p), gdImageBlue (im->tile,p), gdImageAlpha (im->tile,p)); } } else { if (im->tile->trueColor) { tileColor = gdImageColorResolveAlpha(im, gdTrueColorGetRed (p), gdTrueColorGetGreen (p), gdTrueColorGetBlue (p), gdTrueColorGetAlpha (p)); } else { tileColor = p; tileColor = gdImageColorResolveAlpha(im, gdImageRed (im->tile,p), gdImageGreen (im->tile,p), gdImageBlue (im->tile,p), gdImageAlpha (im->tile,p)); } } return tileColor; }
2,678
68,496
0
server_http_authenticate(struct server_config *srv_conf, struct client *clt) { char decoded[1024]; FILE *fp = NULL; struct http_descriptor *desc = clt->clt_descreq; const struct auth *auth = srv_conf->auth; struct kv *ba, key; size_t linesize = 0; ssize_t linelen; int ret = -1; char *line = NULL, *user = NULL, *pass = NULL; char *clt_user = NULL, *clt_pass = NULL; memset(decoded, 0, sizeof(decoded)); key.kv_key = "Authorization"; if ((ba = kv_find(&desc->http_headers, &key)) == NULL || ba->kv_value == NULL) goto done; if (strncmp(ba->kv_value, "Basic ", strlen("Basic ")) != 0) goto done; if (b64_pton(strchr(ba->kv_value, ' ') + 1, (uint8_t *)decoded, sizeof(decoded)) <= 0) goto done; if ((clt_pass = strchr(decoded, ':')) == NULL) goto done; clt_user = decoded; *clt_pass++ = '\0'; if ((clt->clt_remote_user = strdup(clt_user)) == NULL) goto done; if (clt_pass == NULL) goto done; if ((fp = fopen(auth->auth_htpasswd, "r")) == NULL) goto done; while ((linelen = getline(&line, &linesize, fp)) != -1) { if (line[linelen - 1] == '\n') line[linelen - 1] = '\0'; user = line; pass = strchr(line, ':'); if (pass == NULL) { explicit_bzero(line, linelen); continue; } *pass++ = '\0'; if (strcmp(clt_user, user) != 0) { explicit_bzero(line, linelen); continue; } if (crypt_checkpass(clt_pass, pass) == 0) { explicit_bzero(line, linelen); ret = 0; break; } } done: free(line); if (fp != NULL) fclose(fp); if (ba != NULL && ba->kv_value != NULL) { explicit_bzero(ba->kv_value, strlen(ba->kv_value)); explicit_bzero(decoded, sizeof(decoded)); } return (ret); }
2,679
147,563
0
static void NamedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info) { ExceptionState exception_state( info.GetIsolate(), ExceptionState::kEnumerationContext, "TestObject"); TestObject* impl = V8TestObject::ToImpl(info.Holder()); Vector<String> names; impl->NamedPropertyEnumerator(names, exception_state); if (exception_state.HadException()) return; V8SetReturnValue(info, ToV8(names, info.Holder(), info.GetIsolate()).As<v8::Array>()); }
2,680
153,704
0
GLint GLES2Implementation::GetProgramResourceLocation( GLuint program, GLenum program_interface, const char* name) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetProgramResourceLocation(" << program << ", " << program_interface << ", " << name << ")"); TRACE_EVENT0("gpu", "GLES2::GetProgramResourceLocation"); GLint location = share_group_->program_info_manager()->GetProgramResourceLocation( this, program, program_interface, name); GPU_CLIENT_LOG("returned " << location); CheckGLError(); return location; }
2,681
17,469
0
ProcXvQueryEncodings(ClientPtr client) { xvEncodingInfo einfo; xvQueryEncodingsReply rep; int totalSize; int nameSize; XvPortPtr pPort; int ne; XvEncodingPtr pe; REQUEST(xvQueryEncodingsReq); REQUEST_SIZE_MATCH(xvQueryEncodingsReq); VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess); rep = (xvQueryEncodingsReply) { .type = X_Reply, .sequenceNumber = client->sequence, .num_encodings = pPort->pAdaptor->nEncodings }; /* FOR EACH ENCODING ADD UP THE BYTES FOR ENCODING NAMES */ ne = pPort->pAdaptor->nEncodings; pe = pPort->pAdaptor->pEncodings; totalSize = ne * sz_xvEncodingInfo; while (ne--) { totalSize += pad_to_int32(strlen(pe->name)); pe++; } rep.length = bytes_to_int32(totalSize); _WriteQueryEncodingsReply(client, &rep); ne = pPort->pAdaptor->nEncodings; pe = pPort->pAdaptor->pEncodings; while (ne--) { einfo.encoding = pe->id; einfo.name_size = nameSize = strlen(pe->name); einfo.width = pe->width; einfo.height = pe->height; einfo.rate.numerator = pe->rate.numerator; einfo.rate.denominator = pe->rate.denominator; _WriteEncodingInfo(client, &einfo); WriteToClient(client, nameSize, pe->name); pe++; } return Success; }
2,682
107,153
0
WebCore::IntRect LayerTreeHostQt::visibleContentsRect() const { return m_visibleContentsRect; }
2,683
133,902
0
bool FormAssociatedElement::stepMismatch() const { return false; }
2,684
34,173
0
static void __ip_vs_del_service(struct ip_vs_service *svc) { struct ip_vs_dest *dest, *nxt; struct ip_vs_scheduler *old_sched; struct ip_vs_pe *old_pe; struct netns_ipvs *ipvs = net_ipvs(svc->net); pr_info("%s: enter\n", __func__); /* Count only IPv4 services for old get/setsockopt interface */ if (svc->af == AF_INET) ipvs->num_services--; ip_vs_stop_estimator(svc->net, &svc->stats); /* Unbind scheduler */ old_sched = svc->scheduler; ip_vs_unbind_scheduler(svc); ip_vs_scheduler_put(old_sched); /* Unbind persistence engine */ old_pe = svc->pe; ip_vs_unbind_pe(svc); ip_vs_pe_put(old_pe); /* Unbind app inc */ if (svc->inc) { ip_vs_app_inc_put(svc->inc); svc->inc = NULL; } /* * Unlink the whole destination list */ list_for_each_entry_safe(dest, nxt, &svc->destinations, n_list) { __ip_vs_unlink_dest(svc, dest, 0); __ip_vs_del_dest(svc->net, dest); } /* * Update the virtual service counters */ if (svc->port == FTPPORT) atomic_dec(&ipvs->ftpsvc_counter); else if (svc->port == 0) atomic_dec(&ipvs->nullsvc_counter); /* * Free the service if nobody refers to it */ if (atomic_read(&svc->refcnt) == 0) { IP_VS_DBG_BUF(3, "Removing service %u/%s:%u usecnt=%d\n", svc->fwmark, IP_VS_DBG_ADDR(svc->af, &svc->addr), ntohs(svc->port), atomic_read(&svc->usecnt)); free_percpu(svc->stats.cpustats); kfree(svc); } /* decrease the module use count */ ip_vs_use_count_dec(); }
2,685
100,295
0
static std::string SafeString(const char* s) { return s ? std::string(s) : std::string(); }
2,686
147,274
0
void V8TestObject::CallWithThisValueMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_callWithThisValue"); test_object_v8_internal::CallWithThisValueMethod(info); }
2,687
35,930
0
int net_ratelimit(void) { return __ratelimit(&net_ratelimit_state); }
2,688
95,913
0
int FS_FindVM(void **startSearch, char *found, int foundlen, const char *name, int enableDll) { searchpath_t *search, *lastSearch; directory_t *dir; pack_t *pack; char dllName[MAX_OSPATH], qvmName[MAX_OSPATH]; char *netpath; if(!fs_searchpaths) Com_Error(ERR_FATAL, "Filesystem call made without initialization"); if(enableDll) Q_strncpyz(dllName, Sys_GetDLLName(name), sizeof(dllName)); Com_sprintf(qvmName, sizeof(qvmName), "vm/%s.sp.qvm", name); lastSearch = *startSearch; if(*startSearch == NULL) search = fs_searchpaths; else search = lastSearch->next; while(search) { if(search->dir && !fs_numServerPaks) { dir = search->dir; if(enableDll) { netpath = FS_BuildOSPath(dir->path, dir->gamedir, dllName); if(FS_FileInPathExists(netpath)) { Q_strncpyz(found, netpath, foundlen); *startSearch = search; return VMI_NATIVE; } } if(FS_FOpenFileReadDir(qvmName, search, NULL, qfalse, qfalse) > 0) { *startSearch = search; return VMI_COMPILED; } } else if(search->pack) { pack = search->pack; if(lastSearch && lastSearch->pack) { if(!FS_FilenameCompare(lastSearch->pack->pakPathname, pack->pakPathname)) { search = search->next; continue; } } if(FS_FOpenFileReadDir(qvmName, search, NULL, qfalse, qfalse) > 0) { *startSearch = search; return VMI_COMPILED; } } search = search->next; } return -1; }
2,689
84,132
0
static struct blkcg_gq *blkg_alloc(struct blkcg *blkcg, struct request_queue *q, gfp_t gfp_mask) { struct blkcg_gq *blkg; int i; /* alloc and init base part */ blkg = kzalloc_node(sizeof(*blkg), gfp_mask, q->node); if (!blkg) return NULL; if (blkg_rwstat_init(&blkg->stat_bytes, gfp_mask) || blkg_rwstat_init(&blkg->stat_ios, gfp_mask)) goto err_free; blkg->q = q; INIT_LIST_HEAD(&blkg->q_node); blkg->blkcg = blkcg; atomic_set(&blkg->refcnt, 1); /* root blkg uses @q->root_rl, init rl only for !root blkgs */ if (blkcg != &blkcg_root) { if (blk_init_rl(&blkg->rl, q, gfp_mask)) goto err_free; blkg->rl.blkg = blkg; } for (i = 0; i < BLKCG_MAX_POLS; i++) { struct blkcg_policy *pol = blkcg_policy[i]; struct blkg_policy_data *pd; if (!blkcg_policy_enabled(q, pol)) continue; /* alloc per-policy data and attach it to blkg */ pd = pol->pd_alloc_fn(gfp_mask, q->node); if (!pd) goto err_free; blkg->pd[i] = pd; pd->blkg = blkg; pd->plid = i; } return blkg; err_free: blkg_free(blkg); return NULL; }
2,690
46,433
0
xfs_dir_open( struct inode *inode, struct file *file) { struct xfs_inode *ip = XFS_I(inode); int mode; int error; error = xfs_file_open(inode, file); if (error) return error; /* * If there are any blocks, read-ahead block 0 as we're almost * certain to have the next operation be a read there. */ mode = xfs_ilock_data_map_shared(ip); if (ip->i_d.di_nextents > 0) xfs_dir3_data_readahead(NULL, ip, 0, -1); xfs_iunlock(ip, mode); return 0; }
2,691
3,789
0
_dbus_get_autolaunch_address (const char *scope, DBusString *address, DBusError *error) { HANDLE mutex; STARTUPINFOA si; PROCESS_INFORMATION pi; dbus_bool_t retval = FALSE; LPSTR lpFile; char dbus_exe_path[MAX_PATH]; char dbus_args[MAX_PATH * 2]; const char * daemon_name = DBUS_DAEMON_NAME ".exe"; DBusString shm_name; _DBUS_ASSERT_ERROR_IS_CLEAR (error); if (!_dbus_get_shm_name(&shm_name,scope)) { dbus_set_error_const (error, DBUS_ERROR_FAILED, "could not determine shm name"); return FALSE; } mutex = _dbus_global_lock ( cDBusAutolaunchMutex ); if (_dbus_daemon_already_runs(address,&shm_name,scope)) { _dbus_verbose( "found running dbus daemon at %s\n", _dbus_string_get_const_data (&shm_name) ); retval = TRUE; goto out; } if (!SearchPathA(NULL, daemon_name, NULL, sizeof(dbus_exe_path), dbus_exe_path, &lpFile)) { HMODULE hmod; char dbus_module_path[MAX_PATH]; DWORD rc; _dbus_verbose( "did not found dbus daemon executable on default search path, " "trying path where dbus shared library is located"); hmod = _dbus_win_get_dll_hmodule(); rc = GetModuleFileNameA(hmod, dbus_module_path, sizeof(dbus_module_path)); if (rc <= 0) { dbus_set_error_const (error, DBUS_ERROR_FAILED, "could not retrieve dbus shared library file name"); retval = FALSE; goto out; } else { char *ext_idx = strrchr(dbus_module_path, '\\'); if (ext_idx) *ext_idx = '\0'; if (!SearchPathA(dbus_module_path, daemon_name, NULL, sizeof(dbus_exe_path), dbus_exe_path, &lpFile)) { dbus_set_error_const (error, DBUS_ERROR_FAILED, "could not find dbus-daemon executable"); retval = FALSE; printf ("please add the path to %s to your PATH environment variable\n", daemon_name); printf ("or start the daemon manually\n\n"); goto out; } _dbus_verbose( "found dbus daemon executable at %s",dbus_module_path); } } ZeroMemory( &si, sizeof(si) ); si.cb = sizeof(si); ZeroMemory( &pi, sizeof(pi) ); _snprintf(dbus_args, sizeof(dbus_args) - 1, "\"%s\" %s", dbus_exe_path, " --session"); if(CreateProcessA(dbus_exe_path, dbus_args, NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi)) { CloseHandle (pi.hThread); CloseHandle (pi.hProcess); retval = _dbus_get_autolaunch_shm( address, &shm_name ); if (retval == FALSE) dbus_set_error_const (error, DBUS_ERROR_FAILED, "Failed to get autolaunch address from launched dbus-daemon"); } else { dbus_set_error_const (error, DBUS_ERROR_FAILED, "Failed to launch dbus-daemon"); retval = FALSE; } out: if (retval) _DBUS_ASSERT_ERROR_IS_CLEAR (error); else _DBUS_ASSERT_ERROR_IS_SET (error); _dbus_global_unlock (mutex); return retval; }
2,692
47,467
0
static void adf_chr_drv_destroy(void) { device_destroy(adt_ctl_drv.drv_class, MKDEV(adt_ctl_drv.major, 0)); cdev_del(&adt_ctl_drv.drv_cdev); class_destroy(adt_ctl_drv.drv_class); unregister_chrdev_region(MKDEV(adt_ctl_drv.major, 0), 1); }
2,693
65,558
0
void nfsd4_bump_seqid(struct nfsd4_compound_state *cstate, __be32 nfserr) { struct nfs4_stateowner *so = cstate->replay_owner; if (nfserr == nfserr_replay_me) return; if (!seqid_mutating_err(ntohl(nfserr))) { nfsd4_cstate_clear_replay(cstate); return; } if (!so) return; if (so->so_is_open_owner) release_last_closed_stateid(openowner(so)); so->so_seqid++; return; }
2,694
45,906
0
static u64 vmac(unsigned char m[], unsigned int mbytes, const unsigned char n[16], u64 *tagl, struct vmac_ctx_t *ctx) { u64 *in_n, *out_p; u64 p, h; int i; in_n = ctx->__vmac_ctx.cached_nonce; out_p = ctx->__vmac_ctx.cached_aes; i = n[15] & 1; if ((*(u64 *)(n+8) != in_n[1]) || (*(u64 *)(n) != in_n[0])) { in_n[0] = *(u64 *)(n); in_n[1] = *(u64 *)(n+8); ((unsigned char *)in_n)[15] &= 0xFE; crypto_cipher_encrypt_one(ctx->child, (unsigned char *)out_p, (unsigned char *)in_n); ((unsigned char *)in_n)[15] |= (unsigned char)(1-i); } p = be64_to_cpup(out_p + i); h = vhash(m, mbytes, (u64 *)0, &ctx->__vmac_ctx); return le64_to_cpu(p + h); }
2,695
61,342
0
static av_cold int json_init(WriterContext *wctx) { JSONContext *json = wctx->priv; json->item_sep = json->compact ? ", " : ",\n"; json->item_start_end = json->compact ? " " : "\n"; return 0; }
2,696
30,530
0
static void __exit llc2_exit(void) { llc_station_exit(); llc_remove_pack(LLC_DEST_SAP); llc_remove_pack(LLC_DEST_CONN); sock_unregister(PF_LLC); llc_proc_exit(); llc_sysctl_exit(); proto_unregister(&llc_proto); }
2,697
35,098
0
struct page *follow_trans_huge_pmd(struct mm_struct *mm, unsigned long addr, pmd_t *pmd, unsigned int flags) { struct page *page = NULL; assert_spin_locked(&mm->page_table_lock); if (flags & FOLL_WRITE && !pmd_write(*pmd)) goto out; page = pmd_page(*pmd); VM_BUG_ON(!PageHead(page)); if (flags & FOLL_TOUCH) { pmd_t _pmd; /* * We should set the dirty bit only for FOLL_WRITE but * for now the dirty bit in the pmd is meaningless. * And if the dirty bit will become meaningful and * we'll only set it with FOLL_WRITE, an atomic * set_bit will be required on the pmd to set the * young bit, instead of the current set_pmd_at. */ _pmd = pmd_mkyoung(pmd_mkdirty(*pmd)); set_pmd_at(mm, addr & HPAGE_PMD_MASK, pmd, _pmd); } page += (addr & ~HPAGE_PMD_MASK) >> PAGE_SHIFT; VM_BUG_ON(!PageCompound(page)); if (flags & FOLL_GET) get_page(page); out: return page; }
2,698
17,852
0
static int local_closedir(FsContext *ctx, V9fsFidOpenState *fs) { return closedir(fs->dir.stream); }
2,699