idx
int64
func
string
target
int64
129,679
static int ims_pcu_init_bootloader_mode(struct ims_pcu *pcu) { int error; error = ims_pcu_execute_bl_command(pcu, QUERY_DEVICE, NULL, 0, IMS_PCU_CMD_RESPONSE_TIMEOUT); if (error) { dev_err(pcu->dev, "Bootloader does not respond, aborting\n"); return error; } pcu->fw_start_addr = get_unaligned_le32(&pcu->cmd_buf[IMS_PCU_DATA_OFFSET + 11]); pcu->fw_end_addr = get_unaligned_le32(&pcu->cmd_buf[IMS_PCU_DATA_OFFSET + 15]); dev_info(pcu->dev, "Device is in bootloader mode (addr 0x%08x-0x%08x), requesting firmware\n", pcu->fw_start_addr, pcu->fw_end_addr); error = request_firmware_nowait(THIS_MODULE, true, IMS_PCU_FIRMWARE_NAME, pcu->dev, GFP_KERNEL, pcu, ims_pcu_process_async_firmware); if (error) { /* This error is not fatal, let userspace have another chance */ complete(&pcu->async_firmware_done); } return 0;
0
347,518
static const char *GetOpenCLCacheDirectory() { if (cache_directory == (char *) NULL) { if (cache_directory_lock == (SemaphoreInfo *) NULL) ActivateSemaphoreInfo(&cache_directory_lock); LockSemaphoreInfo(cache_directory_lock); if (cache_directory == (char *) NULL) { char *home, path[MagickPathExtent], *temp; MagickBooleanType status; struct stat attributes; temp=(char *) NULL; home=GetEnvironmentValue("MAGICK_OPENCL_CACHE_DIR"); if (home == (char *) NULL) { home=GetEnvironmentValue("XDG_CACHE_HOME"); if (home == (char *) NULL) home=GetEnvironmentValue("LOCALAPPDATA"); if (home == (char *) NULL) home=GetEnvironmentValue("APPDATA"); if (home == (char *) NULL) home=GetEnvironmentValue("USERPROFILE"); } if (home != (char *) NULL) { /* first check if $HOME exists */ (void) FormatLocaleString(path,MagickPathExtent,"%s",home); status=GetPathAttributes(path,&attributes); if (status == MagickFalse) status=MagickCreateDirectory(path); /* first check if $HOME/ImageMagick exists */ if (status != MagickFalse) { (void) FormatLocaleString(path,MagickPathExtent, "%s%sImageMagick",home,DirectorySeparator); status=GetPathAttributes(path,&attributes); if (status == MagickFalse) status=MagickCreateDirectory(path); } if (status != MagickFalse) { temp=(char*) AcquireMagickMemory(strlen(path)+1); CopyMagickString(temp,path,strlen(path)+1); } home=DestroyString(home); } else { home=GetEnvironmentValue("HOME"); if (home != (char *) NULL) { /* first check if $HOME/.cache exists */ (void) FormatLocaleString(path,MagickPathExtent,"%s%s.cache", home,DirectorySeparator); status=GetPathAttributes(path,&attributes); if (status == MagickFalse) status=MagickCreateDirectory(path); /* first check if $HOME/.cache/ImageMagick exists */ if (status != MagickFalse) { (void) FormatLocaleString(path,MagickPathExtent, "%s%s.cache%sImageMagick",home,DirectorySeparator, DirectorySeparator); status=GetPathAttributes(path,&attributes); if (status == MagickFalse) status=MagickCreateDirectory(path); } if (status != MagickFalse) { temp=(char*) AcquireMagickMemory(strlen(path)+1); CopyMagickString(temp,path,strlen(path)+1); } home=DestroyString(home); } } if (temp == (char *) NULL) temp=AcquireString("?"); cache_directory=temp; } UnlockSemaphoreInfo(cache_directory_lock); } if (*cache_directory == '?') return((const char *) NULL); return(cache_directory); }
1
9,105
char* dd_load_text_ext(const struct dump_dir *dd, const char *name, unsigned flags) { // if (!dd->locked) // error_msg_and_die("dump_dir is not opened"); /* bug */ /* Compat with old abrt dumps. Remove in abrt-2.1 */ if (strcmp(name, "release") == 0) name = FILENAME_OS_RELEASE; char *full_path = concat_path_file(dd->dd_dirname, name); char *ret = load_text_file(full_path, flags); free(full_path); return ret; }
1
91,949
smb2_async_readv(struct cifs_readdata *rdata) { int rc, flags = 0; char *buf; struct smb2_sync_hdr *shdr; struct cifs_io_parms io_parms; struct smb_rqst rqst = { .rq_iov = rdata->iov, .rq_nvec = 1 }; struct TCP_Server_Info *server; unsigned int total_len; cifs_dbg(FYI, "%s: offset=%llu bytes=%u\n", __func__, rdata->offset, rdata->bytes); io_parms.tcon = tlink_tcon(rdata->cfile->tlink); io_parms.offset = rdata->offset; io_parms.length = rdata->bytes; io_parms.persistent_fid = rdata->cfile->fid.persistent_fid; io_parms.volatile_fid = rdata->cfile->fid.volatile_fid; io_parms.pid = rdata->pid; server = io_parms.tcon->ses->server; rc = smb2_new_read_req( (void **) &buf, &total_len, &io_parms, rdata, 0, 0); if (rc) return rc; if (smb3_encryption_required(io_parms.tcon)) flags |= CIFS_TRANSFORM_REQ; rdata->iov[0].iov_base = buf; rdata->iov[0].iov_len = total_len; shdr = (struct smb2_sync_hdr *)buf; if (rdata->credits.value > 0) { shdr->CreditCharge = cpu_to_le16(DIV_ROUND_UP(rdata->bytes, SMB2_MAX_BUFFER_SIZE)); shdr->CreditRequest = cpu_to_le16(le16_to_cpu(shdr->CreditCharge) + 1); rc = adjust_credits(server, &rdata->credits, rdata->bytes); if (rc) goto async_readv_out; flags |= CIFS_HAS_CREDITS; } kref_get(&rdata->refcount); rc = cifs_call_async(io_parms.tcon->ses->server, &rqst, cifs_readv_receive, smb2_readv_callback, smb3_handle_read_data, rdata, flags, &rdata->credits); if (rc) { kref_put(&rdata->refcount, cifs_readdata_release); cifs_stats_fail_inc(io_parms.tcon, SMB2_READ_HE); trace_smb3_read_err(0 /* xid */, io_parms.persistent_fid, io_parms.tcon->tid, io_parms.tcon->ses->Suid, io_parms.offset, io_parms.length, rc); } async_readv_out: cifs_small_buf_release(buf); return rc; }
0
227,961
ttfFont *ttfFont__create(gs_font_dir *dir) { gs_memory_t *mem = dir->memory->stable_memory; ttfFont *ttf; if (dir->ttm == NULL) { gx_ttfMemory *m = gs_alloc_struct(mem, gx_ttfMemory, &st_gx_ttfMemory, "ttfFont__create(gx_ttfMemory)"); if (!m) return 0; m->super.alloc_struct = gx_ttfMemory__alloc_struct; m->super.alloc_bytes = gx_ttfMemory__alloc_bytes; m->super.free = gx_ttfMemory__free; m->memory = mem; dir->ttm = m; } if(ttfInterpreter__obtain(&dir->ttm->super, &dir->tti)) return 0; if(gx_san__obtain(mem, &dir->san)) return 0; ttf = gs_alloc_struct(mem, ttfFont, &st_ttfFont, "ttfFont__create"); if (ttf == NULL) return 0; #ifdef DEBUG ttfFont__init(ttf, &dir->ttm->super, DebugRepaint, (gs_debug_c('Y') ? DebugPrint : NULL), mem); #else ttfFont__init(ttf, &dir->ttm->super, DebugRepaint, NULL, mem); #endif return ttf; }
0
274,162
static int create_discard_cmd_control(struct f2fs_sb_info *sbi) { dev_t dev = sbi->sb->s_bdev->bd_dev; struct discard_cmd_control *dcc; int err = 0, i; if (SM_I(sbi)->dcc_info) { dcc = SM_I(sbi)->dcc_info; goto init_thread; } dcc = kzalloc(sizeof(struct discard_cmd_control), GFP_KERNEL); if (!dcc) return -ENOMEM; dcc->discard_granularity = DEFAULT_DISCARD_GRANULARITY; INIT_LIST_HEAD(&dcc->entry_list); for (i = 0; i < MAX_PLIST_NUM; i++) { INIT_LIST_HEAD(&dcc->pend_list[i]); if (i >= dcc->discard_granularity - 1) dcc->pend_list_tag[i] |= P_ACTIVE; } INIT_LIST_HEAD(&dcc->wait_list); mutex_init(&dcc->cmd_lock); atomic_set(&dcc->issued_discard, 0); atomic_set(&dcc->issing_discard, 0); atomic_set(&dcc->discard_cmd_cnt, 0); dcc->nr_discards = 0; dcc->max_discards = MAIN_SEGS(sbi) << sbi->log_blocks_per_seg; dcc->undiscard_blks = 0; dcc->root = RB_ROOT; init_waitqueue_head(&dcc->discard_wait_queue); SM_I(sbi)->dcc_info = dcc; init_thread: dcc->f2fs_issue_discard = kthread_run(issue_discard_thread, sbi, "f2fs_discard-%u:%u", MAJOR(dev), MINOR(dev)); if (IS_ERR(dcc->f2fs_issue_discard)) { err = PTR_ERR(dcc->f2fs_issue_discard); kfree(dcc); SM_I(sbi)->dcc_info = NULL; return err; } return err; }
0
168,069
void smp_decide_association_model(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) { uint8_t int_evt = 0; tSMP_INT_DATA smp_int_data; SMP_TRACE_DEBUG("%s Association Model = %d", __func__, p_cb->selected_association_model); switch (p_cb->selected_association_model) { case SMP_MODEL_ENCRYPTION_ONLY: /* TK = 0, go calculate Confirm */ if (p_cb->role == HCI_ROLE_MASTER && ((p_cb->peer_auth_req & SMP_AUTH_YN_BIT) != 0) && ((p_cb->loc_auth_req & SMP_AUTH_YN_BIT) == 0)) { SMP_TRACE_ERROR( "IO capability does not meet authentication requirement"); smp_int_data.status = SMP_PAIR_AUTH_FAIL; int_evt = SMP_AUTH_CMPL_EVT; } else { p_cb->sec_level = SMP_SEC_UNAUTHENTICATE; SMP_TRACE_EVENT("p_cb->sec_level =%d (SMP_SEC_UNAUTHENTICATE) ", p_cb->sec_level); tSMP_KEY key; key.key_type = SMP_KEY_TYPE_TK; key.p_data = p_cb->tk; smp_int_data.key = key; memset(p_cb->tk, 0, BT_OCTET16_LEN); /* TK, ready */ int_evt = SMP_KEY_READY_EVT; } break; case SMP_MODEL_PASSKEY: p_cb->sec_level = SMP_SEC_AUTHENTICATED; SMP_TRACE_EVENT("p_cb->sec_level =%d (SMP_SEC_AUTHENTICATED) ", p_cb->sec_level); p_cb->cb_evt = SMP_PASSKEY_REQ_EVT; int_evt = SMP_TK_REQ_EVT; break; case SMP_MODEL_OOB: SMP_TRACE_ERROR("Association Model = SMP_MODEL_OOB"); p_cb->sec_level = SMP_SEC_AUTHENTICATED; SMP_TRACE_EVENT("p_cb->sec_level =%d (SMP_SEC_AUTHENTICATED) ", p_cb->sec_level); p_cb->cb_evt = SMP_OOB_REQ_EVT; int_evt = SMP_TK_REQ_EVT; break; case SMP_MODEL_KEY_NOTIF: p_cb->sec_level = SMP_SEC_AUTHENTICATED; SMP_TRACE_DEBUG("Need to generate Passkey"); /* generate passkey and notify application */ smp_generate_passkey(p_cb, NULL); break; case SMP_MODEL_SEC_CONN_JUSTWORKS: case SMP_MODEL_SEC_CONN_NUM_COMP: case SMP_MODEL_SEC_CONN_PASSKEY_ENT: case SMP_MODEL_SEC_CONN_PASSKEY_DISP: case SMP_MODEL_SEC_CONN_OOB: int_evt = SMP_PUBL_KEY_EXCH_REQ_EVT; break; case SMP_MODEL_OUT_OF_RANGE: SMP_TRACE_ERROR("Association Model = SMP_MODEL_OUT_OF_RANGE (failed)"); smp_int_data.status = SMP_UNKNOWN_IO_CAP; int_evt = SMP_AUTH_CMPL_EVT; break; default: SMP_TRACE_ERROR( "Association Model = %d (SOMETHING IS WRONG WITH THE CODE)", p_cb->selected_association_model); smp_int_data.status = SMP_UNKNOWN_IO_CAP; int_evt = SMP_AUTH_CMPL_EVT; } SMP_TRACE_EVENT("sec_level=%d ", p_cb->sec_level); if (int_evt) smp_sm_event(p_cb, int_evt, &smp_int_data); }
0
151,947
const char *gf_m4a_object_type_name(u32 objectType) { switch (objectType) { case 0: return "MPEG-4 Audio Reserved"; case 1: return "MPEG-4 Audio AAC Main"; case 2: return "MPEG-4 Audio AAC LC"; case 3: return "MPEG-4 Audio AAC SSR"; case 4: return "MPEG-4 Audio AAC LTP"; case 5: return "MPEG-4 Audio SBR"; case 6: return "MPEG-4 Audio AAC Scalable"; case 7: return "MPEG-4 Audio TwinVQ"; case 8: return "MPEG-4 Audio CELP"; case 9: return "MPEG-4 Audio HVXC"; case 10: return "MPEG-4 Audio Reserved"; case 11: return "MPEG-4 Audio Reserved"; case 12: return "MPEG-4 Audio TTSI"; case 13: return "MPEG-4 Audio Main synthetic"; case 14: return "MPEG-4 Audio Wavetable synthesis"; case 15: return "MPEG-4 Audio General MIDI"; case 16: return "MPEG-4 Audio Algorithmic Synthesis and Audio FX"; case 17: return "MPEG-4 Audio ER AAC LC"; case 18: return "MPEG-4 Audio Reserved"; case 19: return "MPEG-4 Audio ER AAC LTP"; case 20: return "MPEG-4 Audio ER AAC scalable"; case 21: return "MPEG-4 Audio ER TwinVQ"; case 22: return "MPEG-4 Audio ER BSAC"; case 23: return "MPEG-4 Audio ER AAC LD"; case 24: return "MPEG-4 Audio ER CELP"; case 25: return "MPEG-4 Audio ER HVXC"; case 26: return "MPEG-4 Audio ER HILN"; case 27: return "MPEG-4 Audio ER Parametric"; case 28: return "MPEG-4 Audio SSC"; case 29: return "MPEG-4 Audio ParametricStereo"; case 30: return "MPEG-4 Audio Reserved"; case 31: return "MPEG-4 Audio Reserved"; case 32: return "MPEG-1 Audio Layer-1"; case 33: return "MPEG-1 Audio Layer-2"; case 34: return "MPEG-1 Audio Layer-3"; case 35: return "MPEG-4 Audio DST"; case 36: return "MPEG-4 Audio ALS"; default: return "MPEG-4 Audio Unknown"; } }
0
519,984
void set_first_query_block(Query_cache_block *first_query_block_arg) { first_query_block= first_query_block_arg; }
0
48,134
static unsigned int hiddev_poll(struct file *file, poll_table *wait) { struct hiddev_list *list = file->private_data; poll_wait(file, &list->hiddev->wait, wait); if (list->head != list->tail) return POLLIN | POLLRDNORM; if (!list->hiddev->exist) return POLLERR | POLLHUP; return 0; }
0
518,610
virtual void get_image(uchar *buff, uint length, CHARSET_INFO *cs) { memcpy(buff,ptr,length); }
0
80,881
static long region_del(struct resv_map *resv, long f, long t) { struct list_head *head = &resv->regions; struct file_region *rg, *trg; struct file_region *nrg = NULL; long del = 0; retry: spin_lock(&resv->lock); list_for_each_entry_safe(rg, trg, head, link) { /* * Skip regions before the range to be deleted. file_region * ranges are normally of the form [from, to). However, there * may be a "placeholder" entry in the map which is of the form * (from, to) with from == to. Check for placeholder entries * at the beginning of the range to be deleted. */ if (rg->to <= f && (rg->to != rg->from || rg->to != f)) continue; if (rg->from >= t) break; if (f > rg->from && t < rg->to) { /* Must split region */ /* * Check for an entry in the cache before dropping * lock and attempting allocation. */ if (!nrg && resv->region_cache_count > resv->adds_in_progress) { nrg = list_first_entry(&resv->region_cache, struct file_region, link); list_del(&nrg->link); resv->region_cache_count--; } if (!nrg) { spin_unlock(&resv->lock); nrg = kmalloc(sizeof(*nrg), GFP_KERNEL); if (!nrg) return -ENOMEM; goto retry; } del += t - f; /* New entry for end of split region */ nrg->from = t; nrg->to = rg->to; INIT_LIST_HEAD(&nrg->link); /* Original entry is trimmed */ rg->to = f; list_add(&nrg->link, &rg->link); nrg = NULL; break; } if (f <= rg->from && t >= rg->to) { /* Remove entire region */ del += rg->to - rg->from; list_del(&rg->link); kfree(rg); continue; } if (f <= rg->from) { /* Trim beginning of region */ del += t - rg->from; rg->from = t; } else { /* Trim end of region */ del += rg->to - f; rg->to = f; } } spin_unlock(&resv->lock); kfree(nrg); return del; }
0
494,910
static unsigned long snd_pcm_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags) { struct snd_pcm_file *pcm_file = file->private_data; struct snd_pcm_substream *substream = pcm_file->substream; struct snd_pcm_runtime *runtime = substream->runtime; unsigned long offset = pgoff << PAGE_SHIFT; switch (offset) { case SNDRV_PCM_MMAP_OFFSET_STATUS_NEW: return (unsigned long)runtime->status; case SNDRV_PCM_MMAP_OFFSET_CONTROL_NEW: return (unsigned long)runtime->control; default: return (unsigned long)runtime->dma_area + offset; } }
0
431,062
static int sisusb_write_memio_byte(struct sisusb_usb_data *sisusb, int type, u32 addr, u8 data) { struct sisusb_packet packet; packet.header = (1 << (addr & 3)) | (type << 6); packet.address = addr & ~3; packet.data = data << ((addr & 3) << 3); return sisusb_send_packet(sisusb, 10, &packet); }
0
307,033
GDataFileSystem::~GDataFileSystem() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); feed_loader_->RemoveObserver(this); documents_service_->CancelAll(); }
0
159,757
CACHE_BITMAP_V2_ORDER* copy_cache_bitmap_v2_order(rdpContext* context, const CACHE_BITMAP_V2_ORDER* order) { CACHE_BITMAP_V2_ORDER* dst = calloc(1, sizeof(CACHE_BITMAP_V2_ORDER)); if (!dst || !order) goto fail; *dst = *order; if (order->bitmapLength > 0) { dst->bitmapDataStream = malloc(order->bitmapLength); if (!dst->bitmapDataStream) goto fail; memcpy(dst->bitmapDataStream, order->bitmapDataStream, order->bitmapLength); } return dst; fail: free_cache_bitmap_v2_order(context, dst); return NULL; }
0
32,701
static void init_cv_nb10_header(SCV_NB10_HEADER* cv_nb10_header) { memset (cv_nb10_header, 0, sizeof (SCV_NB10_HEADER)); cv_nb10_header->free = (void (*)(struct SCV_NB10_HEADER*))free_cv_nb10_header; }
0
288,819
static void dissect_zcl_ota_file_version_field ( tvbuff_t * tvb , proto_tree * tree , guint * offset ) { static const int * file_version [ ] = { & hf_zbee_zcl_ota_file_version_appl_release , & hf_zbee_zcl_ota_file_version_appl_build , & hf_zbee_zcl_ota_file_version_stack_release , & hf_zbee_zcl_ota_file_version_stack_build , NULL } ; proto_tree_add_bitmask ( tree , tvb , * offset , hf_zbee_zcl_ota_file_version , ett_zbee_zcl_ota_file_version , file_version , ENC_BIG_ENDIAN ) ; * offset += 4 ; }
0
446,171
virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt, unsigned int flags) { char *p; virSecurityLabelDefPtr seclabel = NULL; p = virXMLPropStringLimit(ctxt->node, "model", VIR_SECURITY_MODEL_BUFLEN - 1); if (!(seclabel = virSecurityLabelDefNew(p))) goto error; VIR_FREE(p); /* set default value */ seclabel->type = VIR_DOMAIN_SECLABEL_DYNAMIC; p = virXMLPropStringLimit(ctxt->node, "type", VIR_SECURITY_LABEL_BUFLEN - 1); if (p) { seclabel->type = virDomainSeclabelTypeFromString(p); if (seclabel->type <= 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("invalid security type '%s'"), p); goto error; } } if (seclabel->type == VIR_DOMAIN_SECLABEL_STATIC || seclabel->type == VIR_DOMAIN_SECLABEL_NONE) seclabel->relabel = false; VIR_FREE(p); p = virXMLPropStringLimit(ctxt->node, "relabel", VIR_SECURITY_LABEL_BUFLEN-1); if (p) { if (virStringParseYesNo(p, &seclabel->relabel) < 0) { virReportError(VIR_ERR_XML_ERROR, _("invalid security relabel value %s"), p); goto error; } } VIR_FREE(p); if (seclabel->type == VIR_DOMAIN_SECLABEL_DYNAMIC && !seclabel->relabel) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("dynamic label type must use resource relabeling")); goto error; } if (seclabel->type == VIR_DOMAIN_SECLABEL_NONE && seclabel->relabel) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("resource relabeling is not compatible with 'none' label type")); goto error; } /* For the model 'none' none of the following labels is going to be * present. Hence, return now. */ if (STREQ_NULLABLE(seclabel->model, "none")) { if (flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) { /* Fix older configurations */ seclabel->type = VIR_DOMAIN_SECLABEL_NONE; seclabel->relabel = false; } else { if (seclabel->type != VIR_DOMAIN_SECLABEL_NONE) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unsupported type='%s' to model 'none'"), virDomainSeclabelTypeToString(seclabel->type)); goto error; } /* combination of relabel='yes' and type='static' * is checked a few lines above. */ } return seclabel; } /* Only parse label, if using static labels, or * if the 'live' VM XML is requested */ if (seclabel->type == VIR_DOMAIN_SECLABEL_STATIC || (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) && seclabel->type != VIR_DOMAIN_SECLABEL_NONE)) { p = virXPathStringLimit("string(./label[1])", VIR_SECURITY_LABEL_BUFLEN-1, ctxt); if (p == NULL) { virReportError(VIR_ERR_XML_ERROR, "%s", _("security label is missing")); goto error; } seclabel->label = g_steal_pointer(&p); } /* Only parse imagelabel, if requested live XML with relabeling */ if (seclabel->relabel && (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) && seclabel->type != VIR_DOMAIN_SECLABEL_NONE)) { p = virXPathStringLimit("string(./imagelabel[1])", VIR_SECURITY_LABEL_BUFLEN-1, ctxt); if (p == NULL) { virReportError(VIR_ERR_XML_ERROR, "%s", _("security imagelabel is missing")); goto error; } seclabel->imagelabel = g_steal_pointer(&p); } /* Only parse baselabel for dynamic label type */ if (seclabel->type == VIR_DOMAIN_SECLABEL_DYNAMIC) { p = virXPathStringLimit("string(./baselabel[1])", VIR_SECURITY_LABEL_BUFLEN-1, ctxt); seclabel->baselabel = g_steal_pointer(&p); } return seclabel; error: VIR_FREE(p); virSecurityLabelDefFree(seclabel); return NULL; }
0
147,443
static int write_reuc_extension(git_index *index, git_filebuf *file) { git_buf reuc_buf = GIT_BUF_INIT; git_vector *out = &index->reuc; git_index_reuc_entry *reuc; struct index_extension extension; size_t i; int error = 0; git_vector_foreach(out, i, reuc) { if ((error = create_reuc_extension_data(&reuc_buf, reuc)) < 0) goto done; } memset(&extension, 0x0, sizeof(struct index_extension)); memcpy(&extension.signature, INDEX_EXT_UNMERGED_SIG, 4); extension.extension_size = (uint32_t)reuc_buf.size; error = write_extension(file, &extension, &reuc_buf); git_buf_free(&reuc_buf); done: return error; }
0
188,771
bool is_showing() const { return static_cast<content::TestRenderWidgetHostView*>( GetRenderViewHostForTesting()->GetView())->is_showing(); }
0
244,234
BufferManager::BufferInfo* GetBufferInfoForTarget(GLenum target) { DCHECK(target == GL_ARRAY_BUFFER || target == GL_ELEMENT_ARRAY_BUFFER); BufferManager::BufferInfo* info = target == GL_ARRAY_BUFFER ? bound_array_buffer_ : bound_element_array_buffer_; return info; }
0
1,646
static void fmtint ( char * * sbuffer , char * * buffer , size_t * currlen , size_t * maxlen , LLONG value , int base , int min , int max , int flags ) { int signvalue = 0 ; const char * prefix = "" ; unsigned LLONG uvalue ; char convert [ DECIMAL_SIZE ( value ) + 3 ] ; int place = 0 ; int spadlen = 0 ; int zpadlen = 0 ; int caps = 0 ; if ( max < 0 ) max = 0 ; uvalue = value ; if ( ! ( flags & DP_F_UNSIGNED ) ) { if ( value < 0 ) { signvalue = '-' ; uvalue = - value ; } else if ( flags & DP_F_PLUS ) signvalue = '+' ; else if ( flags & DP_F_SPACE ) signvalue = ' ' ; } if ( flags & DP_F_NUM ) { if ( base == 8 ) prefix = "0" ; if ( base == 16 ) prefix = "0x" ; } if ( flags & DP_F_UP ) caps = 1 ; do { convert [ place ++ ] = ( caps ? "0123456789ABCDEF" : "0123456789abcdef" ) [ uvalue % ( unsigned ) base ] ; uvalue = ( uvalue / ( unsigned ) base ) ; } while ( uvalue && ( place < ( int ) sizeof ( convert ) ) ) ; if ( place == sizeof ( convert ) ) place -- ; convert [ place ] = 0 ; zpadlen = max - place ; spadlen = min - OSSL_MAX ( max , place ) - ( signvalue ? 1 : 0 ) - strlen ( prefix ) ; if ( zpadlen < 0 ) zpadlen = 0 ; if ( spadlen < 0 ) spadlen = 0 ; if ( flags & DP_F_ZERO ) { zpadlen = OSSL_MAX ( zpadlen , spadlen ) ; spadlen = 0 ; } if ( flags & DP_F_MINUS ) spadlen = - spadlen ; while ( spadlen > 0 ) { doapr_outch ( sbuffer , buffer , currlen , maxlen , ' ' ) ; -- spadlen ; } if ( signvalue ) doapr_outch ( sbuffer , buffer , currlen , maxlen , signvalue ) ; while ( * prefix ) { doapr_outch ( sbuffer , buffer , currlen , maxlen , * prefix ) ; prefix ++ ; } if ( zpadlen > 0 ) { while ( zpadlen > 0 ) { doapr_outch ( sbuffer , buffer , currlen , maxlen , '0' ) ; -- zpadlen ; } } while ( place > 0 ) doapr_outch ( sbuffer , buffer , currlen , maxlen , convert [ -- place ] ) ; while ( spadlen < 0 ) { doapr_outch ( sbuffer , buffer , currlen , maxlen , ' ' ) ; ++ spadlen ; } return ; }
1
247,973
Node::InsertionNotificationRequest HTMLInputElement::InsertedInto( ContainerNode* insertion_point) { TextControlElement::InsertedInto(insertion_point); if (insertion_point->isConnected() && !Form()) AddToRadioButtonGroup(); ResetListAttributeTargetObserver(); LogAddElementIfIsolatedWorldAndInDocument("input", typeAttr, formactionAttr); return kInsertionShouldCallDidNotifySubtreeInsertions; }
0
75,512
qemuProcessHandleAgentEOF(qemuAgentPtr agent, virDomainObjPtr vm) { qemuDomainObjPrivatePtr priv; VIR_DEBUG("Received EOF from agent on %p '%s'", vm, vm->def->name); virObjectLock(vm); priv = vm->privateData; if (!priv->agent) { VIR_DEBUG("Agent freed already"); goto unlock; } if (priv->beingDestroyed) { VIR_DEBUG("Domain is being destroyed, agent EOF is expected"); goto unlock; } qemuAgentClose(agent); priv->agent = NULL; priv->agentError = false; virObjectUnlock(vm); return; unlock: virObjectUnlock(vm); return; }
0
165,709
void WebContentsImpl::OnDidRunInsecureContent( const std::string& security_origin, const GURL& target_url) { LOG(WARNING) << security_origin << " ran insecure content from " << target_url.possibly_invalid_spec(); RecordAction(base::UserMetricsAction("SSL.RanInsecureContent")); if (EndsWith(security_origin, kDotGoogleDotCom, false)) RecordAction(base::UserMetricsAction("SSL.RanInsecureContentGoogle")); controller_.ssl_manager()->DidRunInsecureContent(security_origin); displayed_insecure_content_ = true; SSLManager::NotifySSLInternalStateChanged( GetController().GetBrowserContext()); }
0
215,664
ssh_packet_read_seqnr(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p) { struct session_state *state = ssh->state; int len, r, ms_remain; fd_set *setp; char buf[8192]; struct timeval timeout, start, *timeoutp = NULL; DBG(debug("packet_read()")); setp = calloc(howmany(state->connection_in + 1, NFDBITS), sizeof(fd_mask)); if (setp == NULL) return SSH_ERR_ALLOC_FAIL; /* * Since we are blocking, ensure that all written packets have * been sent. */ if ((r = ssh_packet_write_wait(ssh)) != 0) goto out; /* Stay in the loop until we have received a complete packet. */ for (;;) { /* Try to read a packet from the buffer. */ r = ssh_packet_read_poll_seqnr(ssh, typep, seqnr_p); if (r != 0) break; if (!compat20 && ( *typep == SSH_SMSG_SUCCESS || *typep == SSH_SMSG_FAILURE || *typep == SSH_CMSG_EOF || *typep == SSH_CMSG_EXIT_CONFIRMATION)) if ((r = sshpkt_get_end(ssh)) != 0) break; /* If we got a packet, return it. */ if (*typep != SSH_MSG_NONE) break; /* * Otherwise, wait for some data to arrive, add it to the * buffer, and try again. */ memset(setp, 0, howmany(state->connection_in + 1, NFDBITS) * sizeof(fd_mask)); FD_SET(state->connection_in, setp); if (state->packet_timeout_ms > 0) { ms_remain = state->packet_timeout_ms; timeoutp = &timeout; } /* Wait for some data to arrive. */ for (;;) { if (state->packet_timeout_ms != -1) { ms_to_timeval(&timeout, ms_remain); gettimeofday(&start, NULL); } if ((r = select(state->connection_in + 1, setp, NULL, NULL, timeoutp)) >= 0) break; if (errno != EAGAIN && errno != EINTR && errno != EWOULDBLOCK) break; if (state->packet_timeout_ms == -1) continue; ms_subtract_diff(&start, &ms_remain); if (ms_remain <= 0) { r = 0; break; } } if (r == 0) return SSH_ERR_CONN_TIMEOUT; /* Read data from the socket. */ len = read(state->connection_in, buf, sizeof(buf)); if (len == 0) { r = SSH_ERR_CONN_CLOSED; goto out; } if (len < 0) { r = SSH_ERR_SYSTEM_ERROR; goto out; } /* Append it to the buffer. */ if ((r = ssh_packet_process_incoming(ssh, buf, len)) != 0) goto out; } out: free(setp); return r; }
0
370,306
xsltInitDocKeyTable(xsltTransformContextPtr ctxt, const xmlChar *name, const xmlChar *nameURI) { xsltStylesheetPtr style; xsltKeyDefPtr keyd = NULL; int found = 0; #ifdef KEY_INIT_DEBUG fprintf(stderr, "xsltInitDocKeyTable %s\n", name); #endif style = ctxt->style; while (style != NULL) { keyd = (xsltKeyDefPtr) style->keys; while (keyd != NULL) { if (((keyd->nameURI != NULL) == (nameURI != NULL)) && xmlStrEqual(keyd->name, name) && xmlStrEqual(keyd->nameURI, nameURI)) { xsltInitCtxtKey(ctxt, ctxt->document, keyd); if (ctxt->document->nbKeysComputed == ctxt->nbKeys) return(0); found = 1; } keyd = keyd->next; } style = xsltNextImport(style); } if (found == 0) { #ifdef WITH_XSLT_DEBUG_KEYS XSLT_TRACE(ctxt,XSLT_TRACE_KEYS,xsltGenericDebug(xsltGenericDebugContext, "xsltInitDocKeyTable: did not found %s\n", name)); #endif xsltTransformError(ctxt, NULL, keyd? keyd->inst : NULL, "Failed to find key definition for %s\n", name); ctxt->state = XSLT_STATE_STOPPED; return(-1); } #ifdef KEY_INIT_DEBUG fprintf(stderr, "xsltInitDocKeyTable %s done\n", name); #endif return(0); }
0
15,031
static int idr_start ( struct archive_write * a , struct idr * idr , int cnt , int ffmax , int num_size , int null_size , const struct archive_rb_tree_ops * rbt_ops ) { int r ; ( void ) ffmax ; r = idr_ensure_poolsize ( a , idr , cnt ) ; if ( r != ARCHIVE_OK ) return ( r ) ; __archive_rb_tree_init ( & ( idr -> rbtree ) , rbt_ops ) ; idr -> wait_list . first = NULL ; idr -> wait_list . last = & ( idr -> wait_list . first ) ; idr -> pool_idx = 0 ; idr -> num_size = num_size ; idr -> null_size = null_size ; return ( ARCHIVE_OK ) ; }
0
187,751
void FrameLoader::detachFromParent() { RefPtr<Frame> protect(m_frame); closeURL(); stopAllLoaders(); history()->saveScrollPositionAndViewStateToItem(history()->currentItem()); detachChildren(); #if ENABLE(INSPECTOR) if (Page* page = m_frame->page()) page->inspectorController()->frameDetachedFromParent(m_frame); #endif detachViewsAndDocumentLoader(); if (Frame* parent = m_frame->tree()->parent()) { parent->loader()->closeAndRemoveChild(m_frame); parent->loader()->scheduleCheckCompleted(); } else { m_frame->setView(0); m_frame->pageDestroyed(); } }
0
454,514
TEST_F(DateExpressionTest, AcceptsObjectIds) { auto expCtx = getExpCtx(); for (auto&& expName : dateExpressions) { BSONObj spec = BSON(expName << "$oid"); auto dateExp = Expression::parseExpression(expCtx, spec, expCtx->variablesParseState); auto contextDoc = Document{{"oid", OID::gen()}}; dateExp->evaluate(contextDoc); // Should not throw. } }
0
158,429
test_custom_timeout (Test *test, gconstpointer data) { cockpit_expect_message ("*session timed out*"); test_custom_fail (test, data); }
0
446,168
virDomainVcpuPinDefParseXML(virDomainDefPtr def, xmlNodePtr node) { virDomainVcpuDefPtr vcpu; unsigned int vcpuid; g_autofree char *tmp = NULL; if (!(tmp = virXMLPropString(node, "vcpu"))) { virReportError(VIR_ERR_XML_ERROR, "%s", _("missing vcpu id in vcpupin")); return -1; } if (virStrToLong_uip(tmp, NULL, 10, &vcpuid) < 0) { virReportError(VIR_ERR_XML_ERROR, _("invalid setting for vcpu '%s'"), tmp); return -1; } VIR_FREE(tmp); if (!(vcpu = virDomainDefGetVcpu(def, vcpuid))) { VIR_WARN("Ignoring vcpupin for missing vcpus"); return 0; } if (!(tmp = virXMLPropString(node, "cpuset"))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing cpuset for vcpupin")); return -1; } if (vcpu->cpumask) { virReportError(VIR_ERR_INTERNAL_ERROR, _("duplicate vcpupin for vcpu '%d'"), vcpuid); return -1; } if (virBitmapParse(tmp, &vcpu->cpumask, VIR_DOMAIN_CPUMASK_LEN) < 0) return -1; if (virBitmapIsAllClear(vcpu->cpumask)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Invalid value of 'cpuset': %s"), tmp); return -1; } return 0; }
0
384,749
static char* get_executable(pid_t pid, int *fd_p) { char buf[sizeof("/proc/%lu/exe") + sizeof(long)*3]; sprintf(buf, "/proc/%lu/exe", (long)pid); if (fd_p) *fd_p = open(buf, O_RDONLY); /* might fail and return -1, it's ok */ char *executable = malloc_readlink(buf); if (!executable) return NULL; /* find and cut off " (deleted)" from the path */ char *deleted = executable + strlen(executable) - strlen(" (deleted)"); if (deleted > executable && strcmp(deleted, " (deleted)") == 0) { *deleted = '\0'; log("File '%s' seems to be deleted", executable); } /* find and cut off prelink suffixes from the path */ char *prelink = executable + strlen(executable) - strlen(".#prelink#.XXXXXX"); if (prelink > executable && strncmp(prelink, ".#prelink#.", strlen(".#prelink#.")) == 0) { log("File '%s' seems to be a prelink temporary file", executable); *prelink = '\0'; } return executable; }
0
443,950
test_connection_missing_server_identity (TestConnection *test, gconstpointer data) { GIOStream *connection; GError *error = NULL; test->database = g_tls_file_database_new (tls_test_file_path ("ca-roots.pem"), &error); g_assert_no_error (error); g_assert_nonnull (test->database); /* We pass NULL instead of test->identity when creating the client * connection. This means verification must fail with * G_TLS_CERTIFICATE_BAD_IDENTITY. */ connection = start_async_server_and_connect_to_it (test, G_TLS_AUTHENTICATION_NONE); test->client_connection = g_tls_client_connection_new (connection, NULL, &error); g_assert_no_error (error); g_assert_nonnull (test->client_connection); g_object_unref (connection); g_tls_connection_set_database (G_TLS_CONNECTION (test->client_connection), test->database); /* All validation in this test */ g_tls_client_connection_set_validation_flags (G_TLS_CLIENT_CONNECTION (test->client_connection), G_TLS_CERTIFICATE_VALIDATE_ALL); read_test_data_async (test); g_main_loop_run (test->loop); wait_until_server_finished (test); g_assert_error (test->read_error, G_TLS_ERROR, G_TLS_ERROR_BAD_CERTIFICATE); #ifdef BACKEND_IS_GNUTLS g_assert_error (test->server_error, G_TLS_ERROR, G_TLS_ERROR_NOT_TLS); #elif defined(BACKEND_IS_OPENSSL) /* FIXME: This is not OK. There should be a NOT_TLS errors. But some times * we either get no error or BROKEN_PIPE */ #endif g_clear_error (&test->read_error); g_clear_error (&test->server_error); g_clear_object (&test->client_connection); g_clear_object (&test->server_connection); /* Now do the same thing again, this time ignoring bad identity. */ connection = start_async_server_and_connect_to_it (test, G_TLS_AUTHENTICATION_NONE); test->client_connection = g_tls_client_connection_new (connection, NULL, &error); g_assert_no_error (error); g_assert_nonnull (test->client_connection); g_object_unref (connection); g_tls_connection_set_database (G_TLS_CONNECTION (test->client_connection), test->database); g_tls_client_connection_set_validation_flags (G_TLS_CLIENT_CONNECTION (test->client_connection), G_TLS_CERTIFICATE_VALIDATE_ALL & ~G_TLS_CERTIFICATE_BAD_IDENTITY); read_test_data_async (test); g_main_loop_run (test->loop); wait_until_server_finished (test); g_assert_no_error (test->read_error); g_assert_no_error (test->server_error); }
0
364,059
uschar *dkim_exim_expand_query(int what) { if (!dkim_verify_ctx || dkim_disable_verify || !dkim_cur_sig) return dkim_exim_expand_defaults(what); switch(what) { case DKIM_ALGO: switch(dkim_cur_sig->algo) { case PDKIM_ALGO_RSA_SHA1: return US"rsa-sha1"; case PDKIM_ALGO_RSA_SHA256: default: return US"rsa-sha256"; } case DKIM_BODYLENGTH: return (dkim_cur_sig->bodylength >= 0)? (uschar *)string_sprintf(OFF_T_FMT,(LONGLONG_T)dkim_cur_sig->bodylength) :dkim_exim_expand_defaults(what); case DKIM_CANON_BODY: switch(dkim_cur_sig->canon_body) { case PDKIM_CANON_RELAXED: return US"relaxed"; case PDKIM_CANON_SIMPLE: default: return US"simple"; } case DKIM_CANON_HEADERS: switch(dkim_cur_sig->canon_headers) { case PDKIM_CANON_RELAXED: return US"relaxed"; case PDKIM_CANON_SIMPLE: default: return US"simple"; } case DKIM_COPIEDHEADERS: return dkim_cur_sig->copiedheaders? (uschar *)(dkim_cur_sig->copiedheaders) :dkim_exim_expand_defaults(what); case DKIM_CREATED: return (dkim_cur_sig->created > 0)? (uschar *)string_sprintf("%llu",dkim_cur_sig->created) :dkim_exim_expand_defaults(what); case DKIM_EXPIRES: return (dkim_cur_sig->expires > 0)? (uschar *)string_sprintf("%llu",dkim_cur_sig->expires) :dkim_exim_expand_defaults(what); case DKIM_HEADERNAMES: return dkim_cur_sig->headernames? (uschar *)(dkim_cur_sig->headernames) :dkim_exim_expand_defaults(what); case DKIM_IDENTITY: return dkim_cur_sig->identity? (uschar *)(dkim_cur_sig->identity) :dkim_exim_expand_defaults(what); case DKIM_KEY_GRANULARITY: return dkim_cur_sig->pubkey? (dkim_cur_sig->pubkey->granularity? (uschar *)(dkim_cur_sig->pubkey->granularity) :dkim_exim_expand_defaults(what) ) :dkim_exim_expand_defaults(what); case DKIM_KEY_SRVTYPE: return dkim_cur_sig->pubkey? (dkim_cur_sig->pubkey->srvtype? (uschar *)(dkim_cur_sig->pubkey->srvtype) :dkim_exim_expand_defaults(what) ) :dkim_exim_expand_defaults(what); case DKIM_KEY_NOTES: return dkim_cur_sig->pubkey? (dkim_cur_sig->pubkey->notes? (uschar *)(dkim_cur_sig->pubkey->notes) :dkim_exim_expand_defaults(what) ) :dkim_exim_expand_defaults(what); case DKIM_KEY_TESTING: return dkim_cur_sig->pubkey? (dkim_cur_sig->pubkey->testing? US"1" :dkim_exim_expand_defaults(what) ) :dkim_exim_expand_defaults(what); case DKIM_NOSUBDOMAINS: return dkim_cur_sig->pubkey? (dkim_cur_sig->pubkey->no_subdomaining? US"1" :dkim_exim_expand_defaults(what) ) :dkim_exim_expand_defaults(what); case DKIM_VERIFY_STATUS: switch(dkim_cur_sig->verify_status) { case PDKIM_VERIFY_INVALID: return US"invalid"; case PDKIM_VERIFY_FAIL: return US"fail"; case PDKIM_VERIFY_PASS: return US"pass"; case PDKIM_VERIFY_NONE: default: return US"none"; } case DKIM_VERIFY_REASON: switch (dkim_cur_sig->verify_ext_status) { case PDKIM_VERIFY_INVALID_PUBKEY_UNAVAILABLE: return US"pubkey_unavailable"; case PDKIM_VERIFY_INVALID_PUBKEY_PARSING: return US"pubkey_syntax"; case PDKIM_VERIFY_FAIL_BODY: return US"bodyhash_mismatch"; case PDKIM_VERIFY_FAIL_MESSAGE: return US"signature_incorrect"; } default: return US""; } }
0
204,701
static void activityLoggedAttrGetter2AttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) { TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); TestObjectV8Internal::activityLoggedAttrGetter2AttributeSetter(jsValue, info); TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); }
0
118,979
void purple_transfer_request(struct im_connection *ic, file_transfer_t *ft, char *handle) { struct prpl_xfer_data *px = g_new0(struct prpl_xfer_data, 1); struct purple_data *pd; char *dir, *basename; ft->data = px; px->ft = ft; px->ft->free = prpl_xfer_free; dir = g_strdup("/tmp/bitlbee-purple-ft.XXXXXX"); if (!mkdtemp(dir)) { imcb_error(ic, "Could not create temporary file for file transfer"); g_free(px); g_free(dir); return; } if ((basename = strrchr(ft->file_name, '/'))) { basename++; } else { basename = ft->file_name; } px->fn = g_strdup_printf("%s/%s", dir, basename); px->fd = open(px->fn, O_WRONLY | O_CREAT, 0600); g_free(dir); if (px->fd < 0) { imcb_error(ic, "Could not create temporary file for file transfer"); g_free(px); g_free(px->fn); return; } px->ic = ic; px->handle = g_strdup(handle); pd = px->ic->proto_data; pd->filetransfers = g_slist_prepend(pd->filetransfers, px); imcb_log(ic, "Due to libpurple limitations, the file has to be cached locally before proceeding with the actual file transfer. Please wait..."); px->timeout = b_timeout_add(0, purple_transfer_request_cb, ft); }
0
180,297
void get_checksum2(char *buf, int32 len, char *sum) { md_context m; switch (xfersum_type) { case CSUM_MD5: { uchar seedbuf[4]; md5_begin(&m); if (proper_seed_order) { if (checksum_seed) { SIVALu(seedbuf, 0, checksum_seed); md5_update(&m, seedbuf, 4); } md5_update(&m, (uchar *)buf, len); } else { md5_update(&m, (uchar *)buf, len); if (checksum_seed) { SIVALu(seedbuf, 0, checksum_seed); md5_update(&m, seedbuf, 4); } } md5_result(&m, (uchar *)sum); break; } case CSUM_MD4: case CSUM_MD4_OLD: case CSUM_MD4_BUSTED: case CSUM_MD4_ARCHAIC: { int32 i; static char *buf1; static int32 len1; mdfour_begin(&m); if (len > len1) { if (buf1) free(buf1); buf1 = new_array(char, len+4); len1 = len; if (!buf1) out_of_memory("get_checksum2"); } memcpy(buf1, buf, len); if (checksum_seed) { SIVAL(buf1,len,checksum_seed); len += 4; } for (i = 0; i + CSUM_CHUNK <= len; i += CSUM_CHUNK) mdfour_update(&m, (uchar *)(buf1+i), CSUM_CHUNK); /* * Prior to version 27 an incorrect MD4 checksum was computed * by failing to call mdfour_tail() for block sizes that * are multiples of 64. This is fixed by calling mdfour_update() * are multiples of 64. This is fixed by calling mdfour_update() * even when there are no more bytes. */ if (len - i > 0 || xfersum_type > CSUM_MD4_BUSTED) mdfour_update(&m, (uchar *)(buf1+i), len-i); mdfour_result(&m, (uchar *)sum); } } }
0
371,656
context_offers_target (GdkDragContext *context, GdkAtom target) { return (g_list_find (gdk_drag_context_list_targets (context), target) != NULL); }
0
209,353
UsbCloseDeviceFunction::UsbCloseDeviceFunction() { }
0
143,670
bool kvm_rdpmc(struct kvm_vcpu *vcpu) { u32 ecx = kvm_register_read(vcpu, VCPU_REGS_RCX); u64 data; int err; err = kvm_pmu_rdpmc(vcpu, ecx, &data); if (err) return err; kvm_register_write(vcpu, VCPU_REGS_RAX, (u32)data); kvm_register_write(vcpu, VCPU_REGS_RDX, data >> 32); return err; }
0
306,080
command_key_event (FepClient *client, FepControlMessage *request, FepControlMessage *response) { FepEventKey event; int retval; uint32_t intval; retval = _fep_control_message_read_uint32_arg (request, 0, &intval); if (retval < 0) { fep_log (FEP_LOG_LEVEL_WARNING, "can't read keyval"); goto out; } event.keyval = intval; retval = _fep_control_message_read_uint32_arg (request, 1, &intval); if (retval < 0) { fep_log (FEP_LOG_LEVEL_WARNING, "can't read modifiers"); goto out; } event.modifiers = intval; out: response->command = FEP_CONTROL_RESPONSE; _fep_control_message_alloc_args (response, 2); _fep_control_message_write_uint8_arg (response, 0, FEP_CONTROL_KEY_EVENT); intval = retval; if (retval == 0 && client->filter) { event.event.type = FEP_KEY_PRESS; event.source = request->args[2].str; event.source_length = request->args[2].len; intval = client->filter ((FepEvent *) &event, client->filter_data); _fep_control_message_write_uint32_arg (response, 1, intval); } /* If key is not handled, send back the original input to the server. */ if (intval == 0) fep_client_send_data (client, request->args[2].str, request->args[2].len); }
0
181,076
void SyncManager::SyncInternal::OnSyncEngineEvent( const SyncEngineEvent& event) { DCHECK(thread_checker_.CalledOnValidThread()); if (event.what_happened == SyncEngineEvent::SYNC_CYCLE_ENDED) { ModelSafeRoutingInfo enabled_types; registrar_->GetModelSafeRoutingInfo(&enabled_types); { sync_api::ReadTransaction trans(FROM_HERE, GetUserShare()); Cryptographer* cryptographer = trans.GetCryptographer(); if (cryptographer->has_pending_keys()) { DVLOG(1) << "OnPassPhraseRequired Sent"; sync_pb::EncryptedData pending_keys = cryptographer->GetPendingKeys(); FOR_EACH_OBSERVER(SyncManager::Observer, observers_, OnPassphraseRequired(sync_api::REASON_DECRYPTION, pending_keys)); } else if (!cryptographer->is_ready() && event.snapshot->initial_sync_ended.Has(syncable::NIGORI)) { DVLOG(1) << "OnPassphraseRequired sent because cryptographer is not " << "ready"; FOR_EACH_OBSERVER(SyncManager::Observer, observers_, OnPassphraseRequired(sync_api::REASON_ENCRYPTION, sync_pb::EncryptedData())); } allstatus_.SetCryptographerReady(cryptographer->is_ready()); allstatus_.SetCryptoHasPendingKeys(cryptographer->has_pending_keys()); allstatus_.SetEncryptedTypes(cryptographer->GetEncryptedTypes()); } if (!initialized_) { LOG(INFO) << "OnSyncCycleCompleted not sent because sync api is not " << "initialized"; return; } if (!event.snapshot->has_more_to_sync) { DVLOG(1) << "Sending OnSyncCycleCompleted"; FOR_EACH_OBSERVER(SyncManager::Observer, observers_, OnSyncCycleCompleted(event.snapshot)); } bool is_notifiable_commit = (event.snapshot->syncer_status.num_successful_commits > 0); if (is_notifiable_commit) { if (sync_notifier_.get()) { const ModelTypeSet changed_types = syncable::ModelTypePayloadMapToEnumSet( event.snapshot->source.types); sync_notifier_->SendNotification(changed_types); } else { DVLOG(1) << "Not sending notification: sync_notifier_ is NULL"; } } } if (event.what_happened == SyncEngineEvent::STOP_SYNCING_PERMANENTLY) { FOR_EACH_OBSERVER(SyncManager::Observer, observers_, OnStopSyncingPermanently()); return; } if (event.what_happened == SyncEngineEvent::CLEAR_SERVER_DATA_SUCCEEDED) { FOR_EACH_OBSERVER(SyncManager::Observer, observers_, OnClearServerDataSucceeded()); return; } if (event.what_happened == SyncEngineEvent::CLEAR_SERVER_DATA_FAILED) { FOR_EACH_OBSERVER(SyncManager::Observer, observers_, OnClearServerDataFailed()); return; } if (event.what_happened == SyncEngineEvent::UPDATED_TOKEN) { FOR_EACH_OBSERVER(SyncManager::Observer, observers_, OnUpdatedToken(event.updated_token)); return; } if (event.what_happened == SyncEngineEvent::ACTIONABLE_ERROR) { FOR_EACH_OBSERVER(SyncManager::Observer, observers_, OnActionableError( event.snapshot->errors.sync_protocol_error)); return; } }
0
206,783
bool verifyJavaStringFormat(const StringPiece16& str) { const char16_t* c = str.begin(); const char16_t* const end = str.end(); size_t argCount = 0; bool nonpositional = false; while (c != end) { if (*c == u'%' && c + 1 < end) { c++; if (*c == u'%') { c++; continue; } argCount++; size_t numDigits = consumeDigits(c, end); if (numDigits > 0) { c += numDigits; if (c != end && *c != u'$') { nonpositional = true; } } else if (*c == u'<') { nonpositional = true; c++; if (c != end && *c == u'$') { c++; } } else { nonpositional = true; } while (c != end && (*c == u'-' || *c == u'#' || *c == u'+' || *c == u' ' || *c == u',' || *c == u'(' || (*c >= u'0' && *c <= '9'))) { c++; } /* * This is a shortcut to detect strings that are going to Time.format() * instead of String.format() * * Comparison of String.format() and Time.format() args: * * String: ABC E GH ST X abcdefgh nost x * Time: DEFGHKMS W Za d hkm s w yz * * Therefore we know it's definitely Time if we have: * DFKMWZkmwyz */ if (c != end) { switch (*c) { case 'D': case 'F': case 'K': case 'M': case 'W': case 'Z': case 'k': case 'm': case 'w': case 'y': case 'z': return true; } } } if (c != end) { c++; } } if (argCount > 1 && nonpositional) { return false; } return true; }
0
353,661
rsvg_state_finalize (RsvgState * state) { g_free (state->font_family); g_free (state->lang); rsvg_paint_server_unref (state->fill); rsvg_paint_server_unref (state->stroke); if (state->dash.n_dash != 0) g_free (state->dash.dash); if (state->styles) { g_hash_table_unref (state->styles); state->styles = NULL; } }
1
58,816
Perl_croak_no_modify(void) { Perl_croak_nocontext( "%s", PL_no_modify); }
0
213,503
Capturer* ScreenRecorder::capturer() { DCHECK_EQ(capture_loop_, MessageLoop::current()); DCHECK(capturer_); return capturer_; }
0
501,788
transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_clause) { AttrNumber parent_attno; Relation relation; TupleDesc tupleDesc; TupleConstr *constr; AclResult aclresult; char *comment; ParseCallbackState pcbstate; setup_parser_errposition_callback(&pcbstate, cxt->pstate, table_like_clause->relation->location); /* we could support LIKE in many cases, but worry about it another day */ if (cxt->isforeign) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("LIKE is not supported for creating foreign tables"))); /* Open the relation referenced by the LIKE clause */ relation = relation_openrv(table_like_clause->relation, AccessShareLock); if (relation->rd_rel->relkind != RELKIND_RELATION && relation->rd_rel->relkind != RELKIND_VIEW && relation->rd_rel->relkind != RELKIND_MATVIEW && relation->rd_rel->relkind != RELKIND_COMPOSITE_TYPE && relation->rd_rel->relkind != RELKIND_FOREIGN_TABLE && relation->rd_rel->relkind != RELKIND_PARTITIONED_TABLE) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("\"%s\" is not a table, view, materialized view, composite type, or foreign table", RelationGetRelationName(relation)))); cancel_parser_errposition_callback(&pcbstate); /* * Check for privileges */ if (relation->rd_rel->relkind == RELKIND_COMPOSITE_TYPE) { aclresult = pg_type_aclcheck(relation->rd_rel->reltype, GetUserId(), ACL_USAGE); if (aclresult != ACLCHECK_OK) aclcheck_error(aclresult, ACL_KIND_TYPE, RelationGetRelationName(relation)); } else { aclresult = pg_class_aclcheck(RelationGetRelid(relation), GetUserId(), ACL_SELECT); if (aclresult != ACLCHECK_OK) aclcheck_error(aclresult, ACL_KIND_CLASS, RelationGetRelationName(relation)); } tupleDesc = RelationGetDescr(relation); constr = tupleDesc->constr; /* * Insert the copied attributes into the cxt for the new table definition. * We must do this now so that they appear in the table in the relative * position where the LIKE clause is, as required by SQL99. */ for (parent_attno = 1; parent_attno <= tupleDesc->natts; parent_attno++) { Form_pg_attribute attribute = tupleDesc->attrs[parent_attno - 1]; char *attributeName = NameStr(attribute->attname); ColumnDef *def; /* * Ignore dropped columns in the parent. */ if (attribute->attisdropped) continue; /* * Create a new column, which is marked as NOT inherited. * * For constraints, ONLY the NOT NULL constraint is inherited by the * new column definition per SQL99. */ def = makeNode(ColumnDef); def->colname = pstrdup(attributeName); def->typeName = makeTypeNameFromOid(attribute->atttypid, attribute->atttypmod); def->inhcount = 0; def->is_local = true; def->is_not_null = attribute->attnotnull; def->is_from_type = false; def->storage = 0; def->raw_default = NULL; def->cooked_default = NULL; def->collClause = NULL; def->collOid = attribute->attcollation; def->constraints = NIL; def->location = -1; /* * Add to column list */ cxt->columns = lappend(cxt->columns, def); /* * Copy default, if present and the default has been requested */ if (attribute->atthasdef && (table_like_clause->options & CREATE_TABLE_LIKE_DEFAULTS)) { Node *this_default = NULL; AttrDefault *attrdef; int i; /* Find default in constraint structure */ Assert(constr != NULL); attrdef = constr->defval; for (i = 0; i < constr->num_defval; i++) { if (attrdef[i].adnum == parent_attno) { this_default = stringToNode(attrdef[i].adbin); break; } } Assert(this_default != NULL); /* * If default expr could contain any vars, we'd need to fix 'em, * but it can't; so default is ready to apply to child. */ def->cooked_default = this_default; } /* * Copy identity if requested */ if (attribute->attidentity && (table_like_clause->options & CREATE_TABLE_LIKE_IDENTITY)) { Oid seq_relid; List *seq_options; /* * find sequence owned by old column; extract sequence parameters; * build new create sequence command */ seq_relid = getOwnedSequence(RelationGetRelid(relation), attribute->attnum); seq_options = sequence_options(seq_relid); generateSerialExtraStmts(cxt, def, InvalidOid, seq_options, true, NULL, NULL); def->identity = attribute->attidentity; } /* Likewise, copy storage if requested */ if (table_like_clause->options & CREATE_TABLE_LIKE_STORAGE) def->storage = attribute->attstorage; else def->storage = 0; /* Likewise, copy comment if requested */ if ((table_like_clause->options & CREATE_TABLE_LIKE_COMMENTS) && (comment = GetComment(attribute->attrelid, RelationRelationId, attribute->attnum)) != NULL) { CommentStmt *stmt = makeNode(CommentStmt); stmt->objtype = OBJECT_COLUMN; stmt->object = (Node *) list_make3(makeString(cxt->relation->schemaname), makeString(cxt->relation->relname), makeString(def->colname)); stmt->comment = comment; cxt->alist = lappend(cxt->alist, stmt); } } /* We use oids if at least one LIKE'ed table has oids. */ cxt->hasoids |= relation->rd_rel->relhasoids; /* * We cannot yet deal with CHECK constraints or indexes, since we don't * yet know what column numbers the copied columns will have in the * finished table. If any of those options are specified, add the LIKE * clause to cxt->likeclauses so that expandTableLikeClause will be called * after we do know that. Also, remember the relation OID so that * expandTableLikeClause is certain to open the same table. */ if (table_like_clause->options & (CREATE_TABLE_LIKE_CONSTRAINTS | CREATE_TABLE_LIKE_INDEXES)) { table_like_clause->relationOid = RelationGetRelid(relation); cxt->likeclauses = lappend(cxt->likeclauses, table_like_clause); } /* * We may copy extended statistics if requested, since the representation * of CreateStatsStmt doesn't depend on column numbers. */ if (table_like_clause->options & CREATE_TABLE_LIKE_STATISTICS) { List *parent_extstats; ListCell *l; parent_extstats = RelationGetStatExtList(relation); foreach(l, parent_extstats) { Oid parent_stat_oid = lfirst_oid(l); CreateStatsStmt *stats_stmt; stats_stmt = generateClonedExtStatsStmt(cxt->relation, RelationGetRelid(relation), parent_stat_oid); cxt->extstats = lappend(cxt->extstats, stats_stmt); /* * We'd like to clone the comments too, but we lack the support * code to do it. */ } list_free(parent_extstats); } /* * Close the parent rel, but keep our AccessShareLock on it until xact * commit. That will prevent someone else from deleting or ALTERing the * parent before we can run expandTableLikeClause. */ heap_close(relation, NoLock); }
0
143,884
void *napi_alloc_frag(unsigned int fragsz) { return __napi_alloc_frag(fragsz, GFP_ATOMIC | __GFP_COLD); }
0
270,324
explicit BoostedTreesQuantileStreamResourceFlushOp( OpKernelConstruction* const context) : OpKernel(context) { OP_REQUIRES_OK(context, context->GetAttr(kGenerateQuantiles, &generate_quantiles_)); }
0
41,348
static bool exec_command_on_flag(RFlagItem *flg, void *u) { struct exec_command_t *user = (struct exec_command_t *)u; r_core_block_size (user->core, flg->size); r_core_seek (user->core, flg->offset, 1); r_core_cmd0 (user->core, user->cmd); return true; }
0
197,276
static int uhid_write(int fd, const struct uhid_event *ev) { ssize_t ret = TEMP_FAILURE_RETRY(write(fd, ev, sizeof(*ev))); if (ret < 0){ int rtn = -errno; APPL_TRACE_ERROR("%s: Cannot write to uhid:%s", __FUNCTION__, strerror(errno)); return rtn; } else if (ret != (ssize_t)sizeof(*ev)) { APPL_TRACE_ERROR("%s: Wrong size written to uhid: %zd != %zu", __FUNCTION__, ret, sizeof(*ev)); return -EFAULT; } return 0; }
0
427,839
static int wcd9335_codec_enable_ear_pa(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kc, int event) { struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm); int ret = 0; switch (event) { case SND_SOC_DAPM_POST_PMU: /* 5ms sleep is required after PA is enabled as per * HW requirement */ usleep_range(5000, 5500); snd_soc_component_update_bits(comp, WCD9335_CDC_RX0_RX_PATH_CTL, WCD9335_CDC_RX_PGA_MUTE_EN_MASK, WCD9335_CDC_RX_PGA_MUTE_DISABLE); /* Remove mix path mute if it is enabled */ if ((snd_soc_component_read32(comp, WCD9335_CDC_RX0_RX_PATH_MIX_CTL)) & WCD9335_CDC_RX_PGA_MUTE_EN_MASK) snd_soc_component_update_bits(comp, WCD9335_CDC_RX0_RX_PATH_MIX_CTL, WCD9335_CDC_RX_PGA_MUTE_EN_MASK, WCD9335_CDC_RX_PGA_MUTE_DISABLE); break; case SND_SOC_DAPM_POST_PMD: /* 5ms sleep is required after PA is disabled as per * HW requirement */ usleep_range(5000, 5500); break; }; return ret; }
0
439,680
void SplashOutputDev::clearPatternOpacity(GfxState *state) { splash->clearPatternAlpha(); }
0
108,798
static void test_bug10214() { int len; char out[8]; myheader("test_bug10214"); DIE_UNLESS(!(mysql->server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES)); len= mysql_real_escape_string(mysql, out, "a'b\\c", 5); DIE_UNLESS(memcmp(out, "a\\'b\\\\c", len) == 0); mysql_query(mysql, "set sql_mode='NO_BACKSLASH_ESCAPES'"); DIE_UNLESS(mysql->server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES); len= mysql_real_escape_string(mysql, out, "a'b\\c", 5); DIE_UNLESS(memcmp(out, "a''b\\c", len) == 0); mysql_query(mysql, "set sql_mode=''"); }
0
23,466
int jpc_pi_addpchg ( jpc_pi_t * pi , jpc_pocpchg_t * pchg ) { return jpc_pchglist_insert ( pi -> pchglist , - 1 , pchg ) ; }
0
237,817
bool Document::ChildTypeAllowed(NodeType type) const { switch (type) { case kAttributeNode: case kCdataSectionNode: case kDocumentFragmentNode: case kDocumentNode: case kTextNode: return false; case kCommentNode: case kProcessingInstructionNode: return true; case kDocumentTypeNode: case kElementNode: for (Node& c : NodeTraversal::ChildrenOf(*this)) { if (c.getNodeType() == type) return false; } return true; } return false; }
0
98,934
_tiffSizeProc(thandle_t fd) { ULARGE_INTEGER m; m.LowPart=GetFileSize(fd,&m.HighPart); return(m.QuadPart); }
0
109,574
static u32 tcm_loop_sess_get_index(struct se_session *se_sess) { return 1; }
0
461,584
static int copyTdEntry(const indexEntry entry, rpmtd td, headerGetFlags flags) { rpm_count_t count = entry->info.count; int rc = 1; /* XXX 1 on success. */ /* ALLOC overrides MINMEM */ int allocMem = flags & HEADERGET_ALLOC; int minMem = allocMem ? 0 : flags & HEADERGET_MINMEM; int argvArray = (flags & HEADERGET_ARGV) ? 1 : 0; assert(td != NULL); td->flags = RPMTD_IMMUTABLE; switch (entry->info.type) { case RPM_BIN_TYPE: /* * XXX This only works for * XXX "sealed" HEADER_IMMUTABLE/HEADER_SIGNATURES/HEADER_IMAGE. * XXX This will *not* work for unsealed legacy HEADER_IMAGE (i.e. * XXX a legacy header freshly read, but not yet unloaded to the rpmdb). */ if (ENTRY_IS_REGION(entry)) { int32_t * ei = ((int32_t *)entry->data) - 2; entryInfo pe = (entryInfo) (ei + 2); unsigned char * dataStart = (unsigned char *) (pe + ntohl(ei[0])); int32_t rdl = -entry->info.offset; /* negative offset */ int32_t ril = rdl/sizeof(*pe); rdl = entry->rdlen; count = 2 * sizeof(*ei) + (ril * sizeof(*pe)) + rdl; if (entry->info.tag == RPMTAG_HEADERIMAGE) { ril -= 1; pe += 1; } else { count += REGION_TAG_COUNT; rdl += REGION_TAG_COUNT; } td->data = xmalloc(count); ei = (int32_t *) td->data; ei[0] = htonl(ril); ei[1] = htonl(rdl); pe = (entryInfo) memcpy(ei + 2, pe, (ril * sizeof(*pe))); dataStart = (unsigned char *) memcpy(pe + ril, dataStart, rdl); rc = regionSwab(NULL, ril, 0, pe, dataStart, dataStart + rdl, 0, 0); /* don't return data on failure */ if (rc < 0) { td->data = _free(td->data); } /* XXX 1 on success. */ rc = (rc < 0) ? 0 : 1; } else { td->data = (!minMem ? memcpy(xmalloc(count), entry->data, count) : entry->data); } break; case RPM_STRING_TYPE: /* simple string, but fallthrough if its actually an array */ if (count == 1 && !argvArray) { td->data = allocMem ? xstrdup(entry->data) : entry->data; break; } case RPM_STRING_ARRAY_TYPE: case RPM_I18NSTRING_TYPE: { const char ** ptrEntry; int tableSize = (count + argvArray) * sizeof(char *); char * t; int i; if (minMem) { td->data = xmalloc(tableSize); ptrEntry = (const char **) td->data; t = entry->data; } else { t = xmalloc(tableSize + entry->length); td->data = (void *)t; ptrEntry = (const char **) td->data; t += tableSize; memcpy(t, entry->data, entry->length); } for (i = 0; i < count; i++) { *ptrEntry++ = t; t = strchr(t, 0); t++; } if (argvArray) { *ptrEntry = NULL; td->flags |= RPMTD_ARGV; } } break; case RPM_CHAR_TYPE: case RPM_INT8_TYPE: case RPM_INT16_TYPE: case RPM_INT32_TYPE: case RPM_INT64_TYPE: if (allocMem) { td->data = xmalloc(entry->length); memcpy(td->data, entry->data, entry->length); } else { td->data = entry->data; } break; default: /* WTH? Don't mess with unknown data types... */ rc = 0; td->data = NULL; break; } td->type = entry->info.type; td->count = count; td->size = entry->length; if (td->data && entry->data != td->data) { td->flags |= RPMTD_ALLOCED; } return rc; }
0
188,019
SelectFileDialog* SelectFileDialog::Create(Listener* listener) { return new SelectFileDialogImpl(listener); }
0
17,419
static void http_connection_test ( int persistent ) { short port = - 1 ; struct evhttp_connection * evcon = NULL ; struct evhttp_request * req = NULL ; test_ok = 0 ; fprintf ( stdout , "Testing Request Connection Pipeline %s: " , persistent ? "(persistent)" : "" ) ; http = http_setup ( & port , NULL ) ; evcon = evhttp_connection_new ( "127.0.0.1" , port ) ; if ( evcon == NULL ) { fprintf ( stdout , "FAILED\n" ) ; exit ( 1 ) ; } req = evhttp_request_new ( http_request_done , NULL ) ; evhttp_add_header ( req -> output_headers , "Host" , "somehost" ) ; if ( evhttp_make_request ( evcon , req , EVHTTP_REQ_GET , "/test" ) == - 1 ) { fprintf ( stdout , "FAILED\n" ) ; exit ( 1 ) ; } event_dispatch ( ) ; if ( test_ok != 1 ) { fprintf ( stdout , "FAILED\n" ) ; exit ( 1 ) ; } test_ok = 0 ; req = evhttp_request_new ( http_request_done , NULL ) ; evhttp_add_header ( req -> output_headers , "Host" , "somehost" ) ; if ( ! persistent ) evhttp_add_header ( req -> output_headers , "Connection" , "close" ) ; if ( evhttp_make_request ( evcon , req , EVHTTP_REQ_GET , "/test" ) == - 1 ) { fprintf ( stdout , "FAILED\n" ) ; exit ( 1 ) ; } event_dispatch ( ) ; test_ok = 0 ; req = evhttp_request_new ( http_request_empty_done , NULL ) ; evhttp_add_header ( req -> output_headers , "Empty" , "itis" ) ; if ( evhttp_make_request ( evcon , req , EVHTTP_REQ_GET , "/test" ) == - 1 ) { fprintf ( stdout , "FAILED\n" ) ; exit ( 1 ) ; } event_dispatch ( ) ; if ( test_ok != 1 ) { fprintf ( stdout , "FAILED\n" ) ; exit ( 1 ) ; } evhttp_connection_free ( evcon ) ; evhttp_free ( http ) ; fprintf ( stdout , "OK\n" ) ; }
0
101,721
PHP_FUNCTION(exif_tagname) { long tag; char *szTemp; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &tag) == FAILURE) { return; } szTemp = exif_get_tagname(tag, NULL, 0, tag_table_IFD TSRMLS_CC); if (tag < 0 || !szTemp || !szTemp[0]) { RETURN_FALSE; } RETURN_STRING(szTemp, 1) }
0
451,352
void clear() override { HeaderMapImpl::clear(); }
0
236,779
void PDFiumEngine::Form_EmailTo(FPDF_FORMFILLINFO* param, FPDF_FILEHANDLER* file_handler, FPDF_WIDESTRING to, FPDF_WIDESTRING subject, FPDF_WIDESTRING cc, FPDF_WIDESTRING bcc, FPDF_WIDESTRING message) { std::string to_str = WideStringToString(to); std::string subject_str = WideStringToString(subject); std::string cc_str = WideStringToString(cc); std::string bcc_str = WideStringToString(bcc); std::string message_str = WideStringToString(message); PDFiumEngine* engine = static_cast<PDFiumEngine*>(param); engine->client_->Email(to_str, cc_str, bcc_str, subject_str, message_str); }
0
64,164
void CreateDataAndRunAveragePool(bool padding_same) { const int batch = UniformRandomInt(1, 2); const int input_depth = UniformRandomInt(1, 700); const int output_depth = input_depth; const int input_width_offset = UniformRandomInt(1, 30); const int input_height_offset = UniformRandomInt(1, 30); const int stride_width = UniformRandomInt(1, 10); const int stride_height = UniformRandomInt(1, 10); const int filter_width = UniformRandomInt(1, 10); const int filter_height = UniformRandomInt(1, 10); const int input_width = input_width_offset + filter_width; const int input_height = input_height_offset + filter_height; const int output_width = padding_same ? (input_width + stride_width - 1) / stride_width : (input_width - filter_width + stride_width) / stride_width; const int output_height = padding_same ? (input_height + stride_height - 1) / stride_height : (input_height - filter_height + stride_height) / stride_height; auto input_shape = RuntimeShape({batch, input_height, input_width, input_depth}); auto output_shape = RuntimeShape({batch, output_height, output_width, output_depth}); const int buffer_size = input_shape.FlatSize(); std::vector<int8> input_data(buffer_size); FillRandom(&input_data); PoolParams params; params.stride_height = stride_height; params.stride_width = stride_width; params.filter_height = filter_height; params.filter_width = filter_width; params.quantized_activation_min = static_cast<int8_t>(std::numeric_limits<int8_t>::lowest()); params.quantized_activation_max = static_cast<int8_t>(std::numeric_limits<int8_t>::max()); auto compute_padding = [](int stride, int in_size, int filter_size, int out_size) { int padding = ((out_size - 1) * stride + filter_size - in_size) / 2; return padding > 0 ? padding : 0; }; params.padding_values.width = compute_padding(stride_width, input_width, filter_width, output_width); params.padding_values.height = compute_padding(stride_height, input_height, filter_height, output_height); RunOneAveragePoolTest(params, input_shape, input_data.data(), output_shape); }
0
112,700
uint Jsi_TreeSize(Jsi_Tree *treePtr) { return treePtr->numEntries; }
0
234,818
gfloat webkit_web_view_get_zoom_level(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 1.0f); Frame* frame = core(webView)->mainFrame(); if (!frame) return 1.0f; WebKitWebViewPrivate* priv = webView->priv; return priv->zoomFullContent ? frame->pageZoomFactor() : frame->textZoomFactor(); }
0
520,029
my_var_sp(const LEX_STRING& j, uint o, enum_field_types t, sp_head *s) : my_var(j, LOCAL_VAR), offset(o), type(t), sp(s) { }
0
152,977
TRIO_PUBLIC_STRING int trio_equal_max TRIO_ARGS3((first, max, second), TRIO_CONST char* first, size_t max, TRIO_CONST char* second) { assert(first); assert(second); if ((first != NULL) && (second != NULL)) { #if defined(USE_STRNCASECMP) return (0 == strncasecmp(first, second, max)); #else /* Not adequately tested yet */ size_t cnt = 0; while ((*first != NIL) && (*second != NIL) && (cnt <= max)) { if (internal_to_upper(*first) != internal_to_upper(*second)) { break; } first++; second++; cnt++; } return ((cnt == max) || ((*first == NIL) && (*second == NIL))); #endif } return FALSE; }
0
169,799
int WebContentsImpl::SendToAllFrames(IPC::Message* message) { int number_of_messages = 0; for (RenderFrameHost* rfh : GetAllFrames()) { if (!rfh->IsRenderFrameLive()) continue; ++number_of_messages; IPC::Message* message_copy = new IPC::Message(*message); message_copy->set_routing_id(rfh->GetRoutingID()); rfh->Send(message_copy); } delete message; return number_of_messages; }
0
294,290
header_put_byte (SF_PRIVATE *psf, char x) { psf->header.ptr [psf->header.indx++] = x ; } /* header_put_byte */
0
328,317
static int do_sigframe_return_v2(CPUARMState *env, target_ulong frame_addr, struct target_ucontext_v2 *uc) { sigset_t host_set; abi_ulong *regspace; target_to_host_sigset(&host_set, &uc->tuc_sigmask); sigprocmask(SIG_SETMASK, &host_set, NULL); if (restore_sigcontext(env, &uc->tuc_mcontext)) return 1; /* Restore coprocessor signal frame */ regspace = uc->tuc_regspace; if (arm_feature(env, ARM_FEATURE_VFP)) { regspace = restore_sigframe_v2_vfp(env, regspace); if (!regspace) { return 1; } } if (arm_feature(env, ARM_FEATURE_IWMMXT)) { regspace = restore_sigframe_v2_iwmmxt(env, regspace); if (!regspace) { return 1; } } if (do_sigaltstack(frame_addr + offsetof(struct target_ucontext_v2, tuc_stack), 0, get_sp_from_cpustate(env)) == -EFAULT) return 1; #if 0 /* Send SIGTRAP if we're single-stepping */ if (ptrace_cancel_bpt(current)) send_sig(SIGTRAP, current, 1); #endif return 0; }
0
254,702
int HAL_load(void) { int err = 0; hw_module_t* module; hw_device_t* device; bdt_log("Loading HAL lib + extensions"); err = hw_get_module(BT_HARDWARE_MODULE_ID, (hw_module_t const**)&module); if (err == 0) { err = module->methods->open(module, BT_HARDWARE_MODULE_ID, &device); if (err == 0) { bt_device = (bluetooth_device_t *)device; sBtInterface = bt_device->get_bluetooth_interface(); } } bdt_log("HAL library loaded (%s)", strerror(err)); return err; }
0
40,725
evutil_open_closeonexec_(const char *pathname, int flags, unsigned mode) { int fd; #ifdef O_CLOEXEC fd = open(pathname, flags|O_CLOEXEC, (mode_t)mode); if (fd >= 0 || errno == EINVAL) return fd; /* If we got an EINVAL, fall through and try without O_CLOEXEC */ #endif fd = open(pathname, flags, (mode_t)mode); if (fd < 0) return -1; #if defined(FD_CLOEXEC) if (fcntl(fd, F_SETFD, FD_CLOEXEC) < 0) { close(fd); return -1; } #endif return fd; }
0
455,214
TEST(ExprMatchTest, OptimizingExprAbsorbsAndOfAnd) { BSONObj exprBson = fromjson("{$expr: {$and: [{$eq: ['$a', 1]}, {$eq: ['$b', 2]}]}}"); boost::intrusive_ptr<ExpressionContextForTest> expCtx(new ExpressionContextForTest()); auto matchExpr = std::make_unique<ExprMatchExpression>(exprBson.firstElement(), std::move(expCtx)); auto optimized = MatchExpression::optimize(std::move(matchExpr)); // The optimized match expression should not have and AND children of AND nodes. This should be // collapsed during optimization. BSONObj serialized; { BSONObjBuilder builder; optimized->serialize(&builder); serialized = builder.obj(); } BSONObj expectedSerialization = fromjson( "{$and: [{$expr: {$and: [{$eq: ['$a', {$const: 1}]}, {$eq: ['$b', {$const: 2}]}]}}," "{a: {$_internalExprEq: 1}}, {b: {$_internalExprEq: 2}}]}"); ASSERT_BSONOBJ_EQ(serialized, expectedSerialization); }
0
346,033
PyImaging_LibTiffEncoderNew(PyObject* self, PyObject* args) { ImagingEncoderObject* encoder; char* mode; char* rawmode; char* compname; char* filename; int compression; int fp; PyObject *dir; PyObject *key, *value; Py_ssize_t pos = 0; int status; Py_ssize_t d_size; PyObject *keys, *values; if (! PyArg_ParseTuple(args, "sssisO", &mode, &rawmode, &compname, &fp, &filename, &dir)) { return NULL; } if (!PyDict_Check(dir)) { PyErr_SetString(PyExc_ValueError, "Invalid Dictionary"); return NULL; } else { d_size = PyDict_Size(dir); TRACE(("dict size: %d\n", (int)d_size)); keys = PyDict_Keys(dir); values = PyDict_Values(dir); for (pos=0;pos<d_size;pos++){ TRACE((" key: %d\n", (int)PyInt_AsLong(PyList_GetItem(keys,pos)))); } pos = 0; } TRACE(("new tiff encoder %s fp: %d, filename: %s \n", compname, fp, filename)); /* UNDONE -- we can probably do almost any arbitrary compression here, * so long as we're doing row/stripe based actions and not tiles. */ if (strcasecmp(compname, "tiff_ccitt") == 0) { compression = COMPRESSION_CCITTRLE; } else if (strcasecmp(compname, "group3") == 0) { compression = COMPRESSION_CCITTFAX3; } else if (strcasecmp(compname, "group4") == 0) { compression = COMPRESSION_CCITTFAX4; } else if (strcasecmp(compname, "tiff_raw_16") == 0) { compression = COMPRESSION_CCITTRLEW; } else { PyErr_SetString(PyExc_ValueError, "unknown compession"); return NULL; } TRACE(("Found compression: %d\n", compression)); encoder = PyImaging_EncoderNew(sizeof(TIFFSTATE)); if (encoder == NULL) return NULL; if (get_packer(encoder, mode, rawmode) < 0) return NULL; if (! ImagingLibTiffEncodeInit(&encoder->state, filename, fp)) { Py_DECREF(encoder); PyErr_SetString(PyExc_RuntimeError, "tiff codec initialization failed"); return NULL; } // While failes on 64 bit machines, complains that pos is an int instead of a Py_ssize_t // while (PyDict_Next(dir, &pos, &key, &value)) { for (pos=0;pos<d_size;pos++){ key = PyList_GetItem(keys,pos); value = PyList_GetItem(values,pos); status = 0; TRACE(("Attempting to set key: %d\n", (int)PyInt_AsLong(key))); if (PyInt_Check(value)) { TRACE(("Setting from Int: %d %ld \n", (int)PyInt_AsLong(key),PyInt_AsLong(value))); status = ImagingLibTiffSetField(&encoder->state, (ttag_t) PyInt_AsLong(key), PyInt_AsLong(value)); } else if(PyBytes_Check(value)) { TRACE(("Setting from String: %d, %s \n", (int)PyInt_AsLong(key),PyBytes_AsString(value))); status = ImagingLibTiffSetField(&encoder->state, (ttag_t) PyInt_AsLong(key), PyBytes_AsString(value)); } else if(PyList_Check(value)) { int len,i; float *floatav; TRACE(("Setting from List: %d \n", (int)PyInt_AsLong(key))); len = (int)PyList_Size(value); TRACE((" %d elements, setting as floats \n", len)); floatav = malloc(sizeof(float)*len); if (floatav) { for (i=0;i<len;i++) { floatav[i] = (float)PyFloat_AsDouble(PyList_GetItem(value,i)); } status = ImagingLibTiffSetField(&encoder->state, (ttag_t) PyInt_AsLong(key), floatav); free(floatav); } } else if (PyFloat_Check(value)) { TRACE(("Setting from String: %d, %f \n", (int)PyInt_AsLong(key),PyFloat_AsDouble(value))); status = ImagingLibTiffSetField(&encoder->state, (ttag_t) PyInt_AsLong(key), (float)PyFloat_AsDouble(value)); } else { TRACE(("Unhandled type for key %d : %s ", (int)PyInt_AsLong(key), PyBytes_AsString(PyObject_Str(value)))); } if (!status) { TRACE(("Error setting Field\n")); Py_DECREF(encoder); PyErr_SetString(PyExc_RuntimeError, "Error setting from dictionary"); return NULL; } } encoder->encode = ImagingLibTiffEncode; return (PyObject*) encoder; }
1
83,798
static void chroma_mc_bi(HEVCContext *s, uint8_t *dst0, ptrdiff_t dststride, AVFrame *ref0, AVFrame *ref1, int x_off, int y_off, int block_w, int block_h, struct MvField *current_mv, int cidx) { HEVCLocalContext *lc = s->HEVClc; uint8_t *src1 = ref0->data[cidx+1]; uint8_t *src2 = ref1->data[cidx+1]; ptrdiff_t src1stride = ref0->linesize[cidx+1]; ptrdiff_t src2stride = ref1->linesize[cidx+1]; int weight_flag = (s->sh.slice_type == HEVC_SLICE_P && s->ps.pps->weighted_pred_flag) || (s->sh.slice_type == HEVC_SLICE_B && s->ps.pps->weighted_bipred_flag); int pic_width = s->ps.sps->width >> s->ps.sps->hshift[1]; int pic_height = s->ps.sps->height >> s->ps.sps->vshift[1]; Mv *mv0 = &current_mv->mv[0]; Mv *mv1 = &current_mv->mv[1]; int hshift = s->ps.sps->hshift[1]; int vshift = s->ps.sps->vshift[1]; intptr_t mx0 = av_mod_uintp2(mv0->x, 2 + hshift); intptr_t my0 = av_mod_uintp2(mv0->y, 2 + vshift); intptr_t mx1 = av_mod_uintp2(mv1->x, 2 + hshift); intptr_t my1 = av_mod_uintp2(mv1->y, 2 + vshift); intptr_t _mx0 = mx0 << (1 - hshift); intptr_t _my0 = my0 << (1 - vshift); intptr_t _mx1 = mx1 << (1 - hshift); intptr_t _my1 = my1 << (1 - vshift); int x_off0 = x_off + (mv0->x >> (2 + hshift)); int y_off0 = y_off + (mv0->y >> (2 + vshift)); int x_off1 = x_off + (mv1->x >> (2 + hshift)); int y_off1 = y_off + (mv1->y >> (2 + vshift)); int idx = ff_hevc_pel_weight[block_w]; src1 += y_off0 * src1stride + (int)((unsigned)x_off0 << s->ps.sps->pixel_shift); src2 += y_off1 * src2stride + (int)((unsigned)x_off1 << s->ps.sps->pixel_shift); if (x_off0 < EPEL_EXTRA_BEFORE || y_off0 < EPEL_EXTRA_AFTER || x_off0 >= pic_width - block_w - EPEL_EXTRA_AFTER || y_off0 >= pic_height - block_h - EPEL_EXTRA_AFTER) { const int edge_emu_stride = EDGE_EMU_BUFFER_STRIDE << s->ps.sps->pixel_shift; int offset1 = EPEL_EXTRA_BEFORE * (src1stride + (1 << s->ps.sps->pixel_shift)); int buf_offset1 = EPEL_EXTRA_BEFORE * (edge_emu_stride + (1 << s->ps.sps->pixel_shift)); s->vdsp.emulated_edge_mc(lc->edge_emu_buffer, src1 - offset1, edge_emu_stride, src1stride, block_w + EPEL_EXTRA, block_h + EPEL_EXTRA, x_off0 - EPEL_EXTRA_BEFORE, y_off0 - EPEL_EXTRA_BEFORE, pic_width, pic_height); src1 = lc->edge_emu_buffer + buf_offset1; src1stride = edge_emu_stride; } if (x_off1 < EPEL_EXTRA_BEFORE || y_off1 < EPEL_EXTRA_AFTER || x_off1 >= pic_width - block_w - EPEL_EXTRA_AFTER || y_off1 >= pic_height - block_h - EPEL_EXTRA_AFTER) { const int edge_emu_stride = EDGE_EMU_BUFFER_STRIDE << s->ps.sps->pixel_shift; int offset1 = EPEL_EXTRA_BEFORE * (src2stride + (1 << s->ps.sps->pixel_shift)); int buf_offset1 = EPEL_EXTRA_BEFORE * (edge_emu_stride + (1 << s->ps.sps->pixel_shift)); s->vdsp.emulated_edge_mc(lc->edge_emu_buffer2, src2 - offset1, edge_emu_stride, src2stride, block_w + EPEL_EXTRA, block_h + EPEL_EXTRA, x_off1 - EPEL_EXTRA_BEFORE, y_off1 - EPEL_EXTRA_BEFORE, pic_width, pic_height); src2 = lc->edge_emu_buffer2 + buf_offset1; src2stride = edge_emu_stride; } s->hevcdsp.put_hevc_epel[idx][!!my0][!!mx0](lc->tmp, src1, src1stride, block_h, _mx0, _my0, block_w); if (!weight_flag) s->hevcdsp.put_hevc_epel_bi[idx][!!my1][!!mx1](dst0, s->frame->linesize[cidx+1], src2, src2stride, lc->tmp, block_h, _mx1, _my1, block_w); else s->hevcdsp.put_hevc_epel_bi_w[idx][!!my1][!!mx1](dst0, s->frame->linesize[cidx+1], src2, src2stride, lc->tmp, block_h, s->sh.chroma_log2_weight_denom, s->sh.chroma_weight_l0[current_mv->ref_idx[0]][cidx], s->sh.chroma_weight_l1[current_mv->ref_idx[1]][cidx], s->sh.chroma_offset_l0[current_mv->ref_idx[0]][cidx], s->sh.chroma_offset_l1[current_mv->ref_idx[1]][cidx], _mx1, _my1, block_w); }
0
241,461
NotificationView(const DialogNotification& data, AutofillDialogViewDelegate* delegate) : data_(data), delegate_(delegate), checkbox_(NULL) { scoped_ptr<views::View> label_view; if (data.HasCheckbox()) { scoped_ptr<views::Checkbox> checkbox( new views::Checkbox(base::string16())); checkbox->SetText(data.display_text()); checkbox->SetTextMultiLine(true); checkbox->SetHorizontalAlignment(gfx::ALIGN_LEFT); checkbox->SetTextColor(views::Button::STATE_NORMAL, data.GetTextColor()); checkbox->SetTextColor(views::Button::STATE_HOVERED, data.GetTextColor()); checkbox->SetChecked(data.checked()); checkbox->set_listener(this); checkbox_ = checkbox.get(); label_view.reset(checkbox.release()); } else { scoped_ptr<views::StyledLabel> label(new views::StyledLabel( data.display_text(), this)); label->set_auto_color_readability_enabled(false); views::StyledLabel::RangeStyleInfo text_style; text_style.color = data.GetTextColor(); if (data.link_range().is_empty()) { label->AddStyleRange(gfx::Range(0, data.display_text().size()), text_style); } else { gfx::Range prefix_range(0, data.link_range().start()); if (!prefix_range.is_empty()) label->AddStyleRange(prefix_range, text_style); label->AddStyleRange( data.link_range(), views::StyledLabel::RangeStyleInfo::CreateForLink()); gfx::Range suffix_range(data.link_range().end(), data.display_text().size()); if (!suffix_range.is_empty()) label->AddStyleRange(suffix_range, text_style); } label_view.reset(label.release()); } AddChildView(label_view.release()); if (!data.tooltip_text().empty()) AddChildView(new TooltipIcon(data.tooltip_text())); set_background( views::Background::CreateSolidBackground(data.GetBackgroundColor())); SetBorder(views::Border::CreateSolidSidedBorder( 1, 0, 1, 0, data.GetBorderColor())); }
0
200,085
const CustomButton* CustomButton::AsCustomButton(const views::View* view) { return AsCustomButton(const_cast<views::View*>(view)); }
0
516,098
int llhttp__on_message_complete(llhttp_t* s, const char* p, const char* endp) { int err; CALLBACK_MAYBE(s, on_message_complete); return err; }
0
246,728
z2copy(i_ctx_t *i_ctx_p) { os_ptr op = osp; int code = zcopy(i_ctx_p); if (code >= 0) return code; if (!r_has_type(op, t_astruct)) return code; return z2copy_gstate(i_ctx_p); }
0
41,199
_pause_for_job_completion (uint32_t job_id, char *nodes, int max_time) { int sec = 0; int pause = 1; bool rc = false; while ((sec < max_time) || (max_time == 0)) { rc = _job_still_running (job_id); if (!rc) break; if ((max_time == 0) && (sec > 1)) { _terminate_all_steps(job_id, true); } if (sec > 10) { /* Reduce logging frequency about unkillable tasks */ if (max_time) pause = MIN((max_time - sec), 10); else pause = 10; } sleep(pause); sec += pause; } /* * Return true if job is NOT running */ return (!rc); }
0
482,554
static int init_wvx_bitstream (WavpackStream *wps, WavpackMetadata *wpmd) { unsigned char *cp = (unsigned char *)wpmd->data; if (wpmd->byte_length <= 4 || (wpmd->byte_length & 1)) return FALSE; wps->crc_wvx = *cp++; wps->crc_wvx |= (uint32_t) *cp++ << 8; wps->crc_wvx |= (uint32_t) *cp++ << 16; wps->crc_wvx |= (uint32_t) *cp++ << 24; bs_open_read (&wps->wvxbits, cp, (unsigned char *) wpmd->data + wpmd->byte_length); return TRUE; }
0
82,895
bool kvm_vcpu_yield_to(struct kvm_vcpu *target) { struct pid *pid; struct task_struct *task = NULL; rcu_read_lock(); pid = rcu_dereference(target->pid); if (pid) task = get_pid_task(target->pid, PIDTYPE_PID); rcu_read_unlock(); if (!task) return false; if (task->flags & PF_VCPU) { put_task_struct(task); return false; } if (yield_to(task, 1)) { put_task_struct(task); return true; } put_task_struct(task); return false; }
0
459,538
dissect_kafka_find_coordinator_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, kafka_api_version_t api_version) { if (api_version >= 1) { offset = dissect_kafka_throttle_time(tvb, pinfo, tree, offset); } /* error_code */ offset = dissect_kafka_error(tvb, pinfo, tree, offset); if (api_version >= 1) { offset = dissect_kafka_string(tree, hf_kafka_error_message, tvb, pinfo, offset, api_version >= 3, NULL, NULL); } /* coordinator */ offset = dissect_kafka_find_coordinator_response_coordinator(tvb, pinfo, tree, offset, api_version); if (api_version >= 3) { offset = dissect_kafka_tagged_fields(tvb, pinfo, tree, offset, 0); } return offset; }
0
409,879
static inline unsigned char *skb_inner_network_header(const struct sk_buff *skb) { return skb->head + skb->inner_network_header;
0
129,271
void hrtick_start(struct rq *rq, u64 delay) { __hrtimer_start_range_ns(&rq->hrtick_timer, ns_to_ktime(delay), 0, HRTIMER_MODE_REL_PINNED, 0); }
0
523,069
find_thread_callback_arg(longlong id_arg, bool query_id_arg): thd(0), id(id_arg), query_id(query_id_arg) {}
0
445,281
TimeSource& ListenerFactoryContextBaseImpl::timeSource() { return api().timeSource(); }
0
197,559
WebContents* WebContents::CreateWithSessionStorage( const WebContents::CreateParams& params, const SessionStorageNamespaceMap& session_storage_namespace_map) { WebContentsImpl* new_contents = new WebContentsImpl(params.browser_context); new_contents->SetOpenerForNewContents(FindOpener(params), params.opener_suppressed); for (SessionStorageNamespaceMap::const_iterator it = session_storage_namespace_map.begin(); it != session_storage_namespace_map.end(); ++it) { new_contents->GetController() .SetSessionStorageNamespace(it->first, it->second.get()); } new_contents->Init(params); return new_contents; }
0
379,809
PHP_FUNCTION(sqlite_exec) { zval *zdb; struct php_sqlite_db *db; char *sql; int sql_len; char *errtext = NULL; zval *errmsg = NULL; zval *object = getThis(); if (object) { if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z/", &sql, &sql_len, &errmsg)) { return; } DB_FROM_OBJECT(db, object); } else { if(FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "sr", &sql, &sql_len, &zdb) && FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|z/", &zdb, &sql, &sql_len, &errmsg)) { return; } DB_FROM_ZVAL(db, &zdb); } if (errmsg) { zval_dtor(errmsg); ZVAL_NULL(errmsg); } PHP_SQLITE_EMPTY_QUERY; db->last_err_code = sqlite_exec(db->db, sql, NULL, NULL, &errtext); if (db->last_err_code != SQLITE_OK) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", errtext); if (errmsg) { ZVAL_STRING(errmsg, errtext, 1); } sqlite_freemem(errtext); RETURN_FALSE; } RETURN_TRUE; }
0
516,500
bool Locked_tables_list::restore_lock(THD *thd, TABLE_LIST *dst_table_list, TABLE *table, MYSQL_LOCK *lock) { MYSQL_LOCK *merged_lock; DBUG_ENTER("restore_lock"); DBUG_ASSERT(!strcmp(dst_table_list->table_name, table->s->table_name.str)); /* Ensure we have the memory to add the table back */ if (!(merged_lock= mysql_lock_merge(thd->lock, lock))) DBUG_RETURN(1); thd->lock= merged_lock; /* Link to the new table */ dst_table_list->table= table; /* The lock type may have changed (normally it should not as create table will lock the table in write mode */ dst_table_list->lock_type= table->reginfo.lock_type; table->pos_in_locked_tables= dst_table_list; add_back_last_deleted_lock(dst_table_list); table->mdl_ticket->downgrade_lock(table->reginfo.lock_type >= TL_WRITE_ALLOW_WRITE ? MDL_SHARED_NO_READ_WRITE : MDL_SHARED_READ); DBUG_RETURN(0); }
0
266,166
EbmlElement * EbmlElement::FindNextID(IOCallback & DataStream, const EbmlCallbacks & ClassInfos, uint64 MaxDataSize) { binary PossibleId[4]; int PossibleID_Length = 0; binary PossibleSize[8]; // we don't support size stored in more than 64 bits uint32 PossibleSizeLength = 0; uint64 SizeUnknown; uint64 SizeFound; bool bElementFound = false; binary BitMask; uint64 aElementPosition, aSizePosition; while (!bElementFound) { // read ID aElementPosition = DataStream.getFilePointer(); uint32 ReadSize = 0; BitMask = 1 << 7; while (1) { ReadSize += DataStream.read(&PossibleId[PossibleID_Length], 1); if (ReadSize == uint32(PossibleID_Length)) { return NULL; // no more data ? } if (++PossibleID_Length > 4) { return NULL; // we don't support element IDs over class D } if (PossibleId[0] & BitMask) { // this is the last octet of the ID // check wether that's the one we're looking for /* if (PossibleID == EBML_INFO_ID(ClassInfos)) { break; } else { /// \todo This element should be skipped (use a context ?) }*/ bElementFound = true; /// \todo not exactly the one we're looking for break; } BitMask >>= 1; } // read the data size aSizePosition = DataStream.getFilePointer(); uint32 _SizeLength; do { if (PossibleSizeLength >= 8) // Size is larger than 8 bytes return NULL; ReadSize += DataStream.read(&PossibleSize[PossibleSizeLength++], 1); _SizeLength = PossibleSizeLength; SizeFound = ReadCodedSizeValue(&PossibleSize[0], _SizeLength, SizeUnknown); } while (_SizeLength == 0); } EbmlElement *Result = NULL; EbmlId PossibleID(PossibleId, PossibleID_Length); if (PossibleID == EBML_INFO_ID(ClassInfos)) { // the element is the one expected Result = &EBML_INFO_CREATE(ClassInfos); } else { /// \todo find the element in the context Result = new (std::nothrow) EbmlDummy(PossibleID); if(Result == NULL) return NULL; } Result->SetSizeLength(PossibleSizeLength); Result->Size = SizeFound; if (!Result->ValidateSize() || (SizeFound != SizeUnknown && MaxDataSize < Result->Size)) { delete Result; return NULL; } // check if the size is not all 1s if (SizeFound == SizeUnknown) { // Size of this element is unknown // only possible for Master elements if (!Result->SetSizeInfinite()) { /// \todo the element is not allowed to be infinite delete Result; return NULL; } } else Result->SetSizeInfinite(false); Result->ElementPosition = aElementPosition; Result->SizePosition = aSizePosition; return Result; }
0
330,096
int event_notifier_init(EventNotifier *e, int active) { #ifdef CONFIG_EVENTFD int fd = eventfd(!!active, EFD_NONBLOCK | EFD_CLOEXEC); if (fd < 0) return -errno; e->fd = fd; return 0; #else return -ENOSYS; #endif }
0
140,424
static int ffm_write_write_index(int fd, int64_t pos) { uint8_t buf[8]; int i; for(i=0;i<8;i++) buf[i] = (pos >> (56 - i * 8)) & 0xff; if (lseek(fd, 8, SEEK_SET) < 0) goto bail_eio; if (write(fd, buf, 8) != 8) goto bail_eio; return 8; bail_eio: return AVERROR(EIO); }
0
13,717
void GDataDirectoryService::InitializeRootEntry(const std::string& root_id) { root_.reset(new GDataDirectory(NULL, this)); root_->set_title(kGDataRootDirectory); root_->SetBaseNameFromTitle(); root_->set_resource_id(root_id); AddEntryToResourceMap(root_.get()); }
1
231,258
isoent_clone_tree(struct archive_write *a, struct isoent **nroot, struct isoent *root) { struct isoent *np, *xroot, *newent; np = root; xroot = NULL; do { newent = isoent_clone(np); if (newent == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate memory"); return (ARCHIVE_FATAL); } if (xroot == NULL) { *nroot = xroot = newent; newent->parent = xroot; } else isoent_add_child_tail(xroot, newent); if (np->dir && np->children.first != NULL) { /* Enter to sub directories. */ np = np->children.first; xroot = newent; continue; } while (np != np->parent) { if (np->chnext == NULL) { /* Return to the parent directory. */ np = np->parent; xroot = xroot->parent; } else { np = np->chnext; break; } } } while (np != np->parent); return (ARCHIVE_OK); }
0
436,904
static int fts3TermSelectFinishMerge(Fts3Table *p, TermSelect *pTS){ char *aOut = 0; int nOut = 0; int i; /* Loop through the doclists in the aaOutput[] array. Merge them all ** into a single doclist. */ for(i=0; i<SizeofArray(pTS->aaOutput); i++){ if( pTS->aaOutput[i] ){ if( !aOut ){ aOut = pTS->aaOutput[i]; nOut = pTS->anOutput[i]; pTS->aaOutput[i] = 0; }else{ int nNew; char *aNew; int rc = fts3DoclistOrMerge(p->bDescIdx, pTS->aaOutput[i], pTS->anOutput[i], aOut, nOut, &aNew, &nNew ); if( rc!=SQLITE_OK ){ sqlite3_free(aOut); return rc; } sqlite3_free(pTS->aaOutput[i]); sqlite3_free(aOut); pTS->aaOutput[i] = 0; aOut = aNew; nOut = nNew; } } } pTS->aaOutput[0] = aOut; pTS->anOutput[0] = nOut; return SQLITE_OK; }
0