idx
int64
func
string
target
int64
94,959
static void get_fs_root_rcu(struct fs_struct *fs, struct path *root) { unsigned seq; do { seq = read_seqcount_begin(&fs->seq); *root = fs->root; } while (read_seqcount_retry(&fs->seq, seq)); }
0
434,177
int vrend_renderer_execute(void *execute_args, uint32_t execute_size) { struct virgl_renderer_hdr *hdr = execute_args; if (hdr->stype_version != 0) return -EINVAL; switch (hdr->stype) { case VIRGL_RENDERER_STRUCTURE_TYPE_SUPPORTED_STRUCTURES: return vrend_renderer_supported_structures(execute_args, execute_size); case VIRGL_RENDERER_STRUCTURE_TYPE_EXPORT_QUERY: return vrend_renderer_export_query(execute_args, execute_size); default: return -EINVAL; } }
0
43,921
void CLASS derror() { if (!data_error) { dcraw_message (DCRAW_WARNING, "%s: ", ifname_display); if (feof(ifp)) dcraw_message (DCRAW_WARNING,_("Unexpected end of file\n")); else #ifdef HAVE_FSEEKO dcraw_message (DCRAW_WARNING,_("Corrupt data near 0x%llx\n"), (INT64) ftello(ifp)); #else dcraw_message (DCRAW_WARNING,_("Corrupt data near 0x%lx\n"), ftell(ifp)); #endif } data_error++; }
0
167,625
SYSCALL_DEFINE2(sethostname, char __user *, name, int, len) { int errno; char tmp[__NEW_UTS_LEN]; if (!ns_capable(current->nsproxy->uts_ns->user_ns, CAP_SYS_ADMIN)) return -EPERM; if (len < 0 || len > __NEW_UTS_LEN) return -EINVAL; down_write(&uts_sem); errno = -EFAULT; if (!copy_from_user(tmp, name, len)) { struct new_utsname *u = utsname(); memcpy(u->nodename, tmp, len); memset(u->nodename + len, 0, sizeof(u->nodename) - len); errno = 0; } uts_proc_notify(UTS_PROC_HOSTNAME); up_write(&uts_sem); return errno; }
0
361,152
NTSTATUS smb_set_file_time(connection_struct *conn, files_struct *fsp, const struct smb_filename *smb_fname, struct smb_file_time *ft, bool setting_write_time) { struct smb_filename smb_fname_base; uint32 action = FILE_NOTIFY_CHANGE_LAST_ACCESS |FILE_NOTIFY_CHANGE_LAST_WRITE |FILE_NOTIFY_CHANGE_CREATION; if (!VALID_STAT(smb_fname->st)) { return NT_STATUS_OBJECT_NAME_NOT_FOUND; } /* get some defaults (no modifications) if any info is zero or -1. */ if (null_timespec(ft->create_time)) { action &= ~FILE_NOTIFY_CHANGE_CREATION; } if (null_timespec(ft->atime)) { action &= ~FILE_NOTIFY_CHANGE_LAST_ACCESS; } if (null_timespec(ft->mtime)) { action &= ~FILE_NOTIFY_CHANGE_LAST_WRITE; } if (!setting_write_time) { /* ft->mtime comes from change time, not write time. */ action &= ~FILE_NOTIFY_CHANGE_LAST_WRITE; } /* Ensure the resolution is the correct for * what we can store on this filesystem. */ round_timespec(conn->ts_res, &ft->create_time); round_timespec(conn->ts_res, &ft->ctime); round_timespec(conn->ts_res, &ft->atime); round_timespec(conn->ts_res, &ft->mtime); DEBUG(5,("smb_set_filetime: actime: %s\n ", time_to_asc(convert_timespec_to_time_t(ft->atime)))); DEBUG(5,("smb_set_filetime: modtime: %s\n ", time_to_asc(convert_timespec_to_time_t(ft->mtime)))); DEBUG(5,("smb_set_filetime: ctime: %s\n ", time_to_asc(convert_timespec_to_time_t(ft->ctime)))); DEBUG(5,("smb_set_file_time: createtime: %s\n ", time_to_asc(convert_timespec_to_time_t(ft->create_time)))); if (setting_write_time) { /* * This was a Windows setfileinfo on an open file. * NT does this a lot. We also need to * set the time here, as it can be read by * FindFirst/FindNext and with the patch for bug #2045 * in smbd/fileio.c it ensures that this timestamp is * kept sticky even after a write. We save the request * away and will set it on file close and after a write. JRA. */ DEBUG(10,("smb_set_file_time: setting pending modtime to %s\n", time_to_asc(convert_timespec_to_time_t(ft->mtime)))); if (fsp != NULL) { if (fsp->base_fsp) { set_sticky_write_time_fsp(fsp->base_fsp, ft->mtime); } else { set_sticky_write_time_fsp(fsp, ft->mtime); } } else { set_sticky_write_time_path( vfs_file_id_from_sbuf(conn, &smb_fname->st), ft->mtime); } } DEBUG(10,("smb_set_file_time: setting utimes to modified values.\n")); /* Always call ntimes on the base, even if a stream was passed in. */ smb_fname_base = *smb_fname; smb_fname_base.stream_name = NULL; if(file_ntimes(conn, &smb_fname_base, ft)!=0) { return map_nt_error_from_unix(errno); } notify_fname(conn, NOTIFY_ACTION_MODIFIED, action, smb_fname->base_name); return NT_STATUS_OK; }
0
50,229
fptr_finalize(mrb_state *mrb, struct mrb_io *fptr, int quiet) { int saved_errno = 0; if (fptr == NULL) { return; } if (fptr->fd > 2) { #ifdef _WIN32 if (fptr->is_socket) { if (closesocket(fptr->fd) != 0) { saved_errno = WSAGetLastError(); } fptr->fd = -1; } #endif if (fptr->fd != -1) { if (close(fptr->fd) == -1) { saved_errno = errno; } } fptr->fd = -1; } if (fptr->fd2 > 2) { if (close(fptr->fd2) == -1) { if (saved_errno == 0) { saved_errno = errno; } } fptr->fd2 = -1; } if (fptr->pid != 0) { #if !defined(_WIN32) && !defined(_WIN64) pid_t pid; int status; do { pid = waitpid(fptr->pid, &status, 0); } while (pid == -1 && errno == EINTR); if (!quiet && pid == fptr->pid) { io_set_process_status(mrb, pid, status); } #else HANDLE h = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, fptr->pid); DWORD status; if (WaitForSingleObject(h, INFINITE) && GetExitCodeProcess(h, &status)) if (!quiet) io_set_process_status(mrb, fptr->pid, (int)status); CloseHandle(h); #endif fptr->pid = 0; /* Note: we don't raise an exception when waitpid(3) fails */ } if (!quiet && saved_errno != 0) { errno = saved_errno; mrb_sys_fail(mrb, "fptr_finalize failed."); } }
0
136,344
short CLASS guess_byte_order(int words) { uchar test[4][2]; int t = 2, msb; double diff, sum[2] = {0, 0}; fread(test[0], 2, 2, ifp); for (words -= 2; words--;) { fread(test[t], 2, 1, ifp); for (msb = 0; msb < 2; msb++) { diff = (test[t ^ 2][msb] << 8 | test[t ^ 2][!msb]) - (test[t][msb] << 8 | test[t][!msb]); sum[msb] += diff * diff; } t = (t + 1) & 3; } return sum[0] < sum[1] ? 0x4d4d : 0x4949; }
0
46,071
TEST_P(DownstreamProtocolIntegrationTest, LargeRequestUrlAccepted) { // Send one 95 kB URL with limit 96 kB headers. testLargeRequestUrl(95, 96); }
0
199,560
coolkey_logout(sc_card_t *card) { /* when we add multi pin support here, how do we know which pin to logout? */ coolkey_private_data_t * priv = COOLKEY_DATA(card); u8 pin_ref = 0; (void) coolkey_apdu_io(card, COOLKEY_CLASS, COOLKEY_INS_LOGOUT, pin_ref, 0, NULL, 0, NULL, NULL, priv->nonce, sizeof(priv->nonce)); /* even if logout failed on the card, flush the nonce and clear the nonce_valid and we are effectively * logged out... needing to login again to get a nonce back */ memset(priv->nonce, 0, sizeof(priv->nonce)); priv->nonce_valid = 0; return SC_SUCCESS; }
0
477,435
FNAME(prefetch_gpte)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp, u64 *spte, pt_element_t gpte, bool no_dirty_log) { struct kvm_memory_slot *slot; unsigned pte_access; gfn_t gfn; kvm_pfn_t pfn; if (FNAME(prefetch_invalid_gpte)(vcpu, sp, spte, gpte)) return false; pgprintk("%s: gpte %llx spte %p\n", __func__, (u64)gpte, spte); gfn = gpte_to_gfn(gpte); pte_access = sp->role.access & FNAME(gpte_access)(gpte); FNAME(protect_clean_gpte)(vcpu->arch.mmu, &pte_access, gpte); slot = gfn_to_memslot_dirty_bitmap(vcpu, gfn, no_dirty_log && (pte_access & ACC_WRITE_MASK)); if (!slot) return false; pfn = gfn_to_pfn_memslot_atomic(slot, gfn); if (is_error_pfn(pfn)) return false; mmu_set_spte(vcpu, slot, spte, pte_access, gfn, pfn, NULL); kvm_release_pfn_clean(pfn); return true; }
0
481,868
static void extract_umask(ProcessHandle sandbox) { int fd = process_rootfs_open(sandbox, RUN_UMASK_FILE); if (fd < 0) { fprintf(stderr, "Error: cannot open umask file\n"); exit(1); } FILE *fp = fdopen(fd, "r"); if (!fp) errExit("fdopen"); if (fscanf(fp, "%3o", &orig_umask) != 1) { fprintf(stderr, "Error: cannot read umask\n"); exit(1); } fclose(fp); }
0
267,704
struct inode *ilookup5_nowait(struct super_block *sb, unsigned long hashval, int (*test)(struct inode *, void *), void *data) { struct hlist_head *head = inode_hashtable + hash(sb, hashval); struct inode *inode; spin_lock(&inode_hash_lock); inode = find_inode(sb, head, test, data); spin_unlock(&inode_hash_lock); return inode; }
0
88,303
static int vfat_hashi(const struct dentry *dentry, const struct inode *inode, struct qstr *qstr) { struct nls_table *t = MSDOS_SB(dentry->d_sb)->nls_io; const unsigned char *name; unsigned int len; unsigned long hash; name = qstr->name; len = vfat_striptail_len(qstr); hash = init_name_hash(); while (len--) hash = partial_name_hash(nls_tolower(t, *name++), hash); qstr->hash = end_name_hash(hash); return 0; }
0
231,187
spnego_gss_wrap( OM_uint32 *minor_status, gss_ctx_id_t context_handle, int conf_req_flag, gss_qop_t qop_req, gss_buffer_t input_message_buffer, int *conf_state, gss_buffer_t output_message_buffer) { OM_uint32 ret; ret = gss_wrap(minor_status, context_handle, conf_req_flag, qop_req, input_message_buffer, conf_state, output_message_buffer); return (ret); }
0
277,771
void CairoOutputDev::clearSoftMask(GfxState * /*state*/) { if (mask) cairo_pattern_destroy(mask); mask = NULL; }
0
323,612
OP(zerof64) { set_opf64(PARAM1, 0); FORCE_RET(); }
0
278,158
SAPI_API char *sapi_getenv(char *name, size_t name_len TSRMLS_DC) { if (sapi_module.getenv) { char *value, *tmp = sapi_module.getenv(name, name_len TSRMLS_CC); if (tmp) { value = estrdup(tmp); } else { return NULL; } if (sapi_module.input_filter) { sapi_module.input_filter(PARSE_STRING, name, &value, strlen(value), NULL TSRMLS_CC); } return value; } return NULL; }
0
427,276
remove_thumbnailer (GnomeDesktopThumbnailFactory *factory, const gchar *path) { GnomeDesktopThumbnailFactoryPrivate *priv = factory->priv; GList *l; Thumbnailer *thumb; g_mutex_lock (&priv->lock); for (l = priv->thumbnailers; l; l = g_list_next (l)) { thumb = (Thumbnailer *)l->data; if (strcmp (thumb->path, path) == 0) { priv->thumbnailers = g_list_delete_link (priv->thumbnailers, l); g_hash_table_foreach_remove (priv->mime_types_map, (GHRFunc)remove_thumbnailer_from_mime_type_map, (gpointer)path); thumbnailer_unref (thumb); break; } } g_mutex_unlock (&priv->lock); }
0
355,527
pick_next(struct cfs_rq *cfs_rq, struct sched_entity *se) { if (!cfs_rq->next) return se; if (wakeup_preempt_entity(cfs_rq->next, se) != 0) return se; return cfs_rq->next; }
0
142,418
TIFFCvtNativeToIEEEDouble(TIFF* tif, u_int n, double* f) { double_t* fp = (double_t*) f; while (n-- > 0) { NATIVE2IEEEDOUBLE(fp); fp++; } }
0
310,112
void ResourceDispatcherHostImpl::MarkAsTransferredNavigation( const GlobalRequestID& id) { GetLoader(id)->MarkAsTransferring(); }
0
507,664
static int rsa_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) { X509_ALGOR *alg = NULL; switch (op) { case ASN1_PKEY_CTRL_PKCS7_SIGN: if (arg1 == 0) PKCS7_SIGNER_INFO_get0_algs(arg2, NULL, NULL, &alg); break; case ASN1_PKEY_CTRL_PKCS7_ENCRYPT: if (arg1 == 0) PKCS7_RECIP_INFO_get0_alg(arg2, &alg); break; #ifndef OPENSSL_NO_CMS case ASN1_PKEY_CTRL_CMS_SIGN: if (arg1 == 0) return rsa_cms_sign(arg2); else if (arg1 == 1) return rsa_cms_verify(arg2); break; case ASN1_PKEY_CTRL_CMS_ENVELOPE: if (arg1 == 0) return rsa_cms_encrypt(arg2); else if (arg1 == 1) return rsa_cms_decrypt(arg2); break; case ASN1_PKEY_CTRL_CMS_RI_TYPE: *(int *)arg2 = CMS_RECIPINFO_TRANS; return 1; #endif case ASN1_PKEY_CTRL_DEFAULT_MD_NID: *(int *)arg2 = NID_sha256; return 1; default: return -2; } if (alg) X509_ALGOR_set0(alg, OBJ_nid2obj(NID_rsaEncryption), V_ASN1_NULL, 0); return 1; }
0
296,293
nv_down(cmdarg_T *cap) { if (mod_mask & MOD_MASK_SHIFT) { // <S-Down> is page down cap->arg = FORWARD; nv_page(cap); } #if defined(FEAT_QUICKFIX) // Quickfix window only: view the result under the cursor. else if (bt_quickfix(curbuf) && cap->cmdchar == CAR) qf_view_result(FALSE); #endif else { #ifdef FEAT_CMDWIN // In the cmdline window a <CR> executes the command. if (cmdwin_type != 0 && cap->cmdchar == CAR) cmdwin_result = CAR; else #endif #ifdef FEAT_JOB_CHANNEL // In a prompt buffer a <CR> in the last line invokes the callback. if (bt_prompt(curbuf) && cap->cmdchar == CAR && curwin->w_cursor.lnum == curbuf->b_ml.ml_line_count) { invoke_prompt_callback(); if (restart_edit == 0) restart_edit = 'a'; } else #endif { cap->oap->motion_type = MLINE; if (cursor_down(cap->count1, cap->oap->op_type == OP_NOP) == FAIL) clearopbeep(cap->oap); else if (cap->arg) beginline(BL_WHITE | BL_FIX); } } }
0
114,783
static inline int hpel_motion_lowres(MpegEncContext *s, uint8_t *dest, uint8_t *src, int field_based, int field_select, int src_x, int src_y, int width, int height, ptrdiff_t stride, int h_edge_pos, int v_edge_pos, int w, int h, h264_chroma_mc_func *pix_op, int motion_x, int motion_y) { const int lowres = s->avctx->lowres; const int op_index = FFMIN(lowres, 3); const int s_mask = (2 << lowres) - 1; int emu = 0; int sx, sy; if (s->quarter_sample) { motion_x /= 2; motion_y /= 2; } sx = motion_x & s_mask; sy = motion_y & s_mask; src_x += motion_x >> lowres + 1; src_y += motion_y >> lowres + 1; src += src_y * stride + src_x; if ((unsigned)src_x > FFMAX( h_edge_pos - (!!sx) - w, 0) || (unsigned)src_y > FFMAX((v_edge_pos >> field_based) - (!!sy) - h, 0)) { s->vdsp.emulated_edge_mc(s->sc.edge_emu_buffer, src, s->linesize, s->linesize, w + 1, (h + 1) << field_based, src_x, src_y << field_based, h_edge_pos, v_edge_pos); src = s->sc.edge_emu_buffer; emu = 1; } sx = (sx << 2) >> lowres; sy = (sy << 2) >> lowres; if (field_select) src += s->linesize; pix_op[op_index](dest, src, stride, h, sx, sy); return emu; }
0
122,376
void ByteCodeGenerator::EndStatement(ParseNode* node) { m_writer.EndStatement(node); }
0
404,617
ModuleExport void UnregisterSFWImage(void) { (void) UnregisterMagickInfo("SFW"); }
0
59,397
ngx_http_lua_process_vars_option(ngx_http_request_t *r, lua_State *L, int table, ngx_array_t **varsp) { ngx_array_t *vars; ngx_keyval_t *var; if (table < 0) { table = lua_gettop(L) + table + 1; } vars = *varsp; if (vars == NULL) { vars = ngx_array_create(r->pool, 4, sizeof(ngx_keyval_t)); if (vars == NULL) { dd("here"); luaL_error(L, "no memory"); return; } *varsp = vars; } lua_pushnil(L); while (lua_next(L, table) != 0) { if (lua_type(L, -2) != LUA_TSTRING) { luaL_error(L, "attempt to use a non-string key in the " "\"vars\" option table"); return; } if (!lua_isstring(L, -1)) { luaL_error(L, "attempt to use bad variable value type %s", luaL_typename(L, -1)); return; } var = ngx_array_push(vars); if (var == NULL) { dd("here"); luaL_error(L, "no memory"); return; } var->key.data = (u_char *) lua_tolstring(L, -2, &var->key.len); var->value.data = (u_char *) lua_tolstring(L, -1, &var->value.len); lua_pop(L, 1); } }
0
449,813
static Token *set_text(struct Token *t, const char *text, size_t len) { char *textp; if (t->len > INLINE_TEXT) nasm_free(t->text.p.ptr); nasm_zero(t->text); t->len = len = tok_check_len(len); textp = (len > INLINE_TEXT) ? (t->text.p.ptr = nasm_malloc(len+1)) : t->text.a; memcpy(textp, text, len); textp[len] = '\0'; return t; }
0
411,871
__zzip_parse_root_directory(int fd, struct _disk_trailer *trailer, struct zzip_dir_hdr **hdr_return, zzip_plugin_io_t io) { auto struct zzip_disk_entry dirent; struct zzip_dir_hdr *hdr; struct zzip_dir_hdr *hdr0; uint16_t *p_reclen = 0; zzip_off64_t entries; zzip_off64_t zz_offset; /* offset from start of root directory */ char *fd_map = 0; zzip_off64_t zz_fd_gap = 0; zzip_off64_t zz_entries = _disk_trailer_localentries(trailer); zzip_off64_t zz_rootsize = _disk_trailer_rootsize(trailer); zzip_off64_t zz_rootseek = _disk_trailer_rootseek(trailer); __correct_rootseek(zz_rootseek, zz_rootsize, trailer); if (zz_entries < 0 || zz_rootseek < 0 || zz_rootsize < 0) return ZZIP_CORRUPTED; hdr0 = (struct zzip_dir_hdr *) malloc(zz_rootsize); if (! hdr0) return ZZIP_DIRSIZE; hdr = hdr0; __debug_dir_hdr(hdr); if (USE_MMAP && io->fd.sys) { zz_fd_gap = zz_rootseek & (_zzip_getpagesize(io->fd.sys) - 1); HINT4(" fd_gap=%ld, mapseek=0x%lx, maplen=%ld", (long) (zz_fd_gap), (long) (zz_rootseek - zz_fd_gap), (long) (zz_rootsize + zz_fd_gap)); fd_map = _zzip_mmap(io->fd.sys, fd, zz_rootseek - zz_fd_gap, zz_rootsize + zz_fd_gap); /* if mmap failed we will fallback to seek/read mode */ if (fd_map == MAP_FAILED) { NOTE2("map failed: %s", strerror(errno)); fd_map = 0; } else { HINT3("mapped *%p len=%li", fd_map, (long) (zz_rootsize + zz_fd_gap)); } } for (entries=0, zz_offset=0; ; entries++) { register struct zzip_disk_entry *d; uint16_t u_extras, u_comment, u_namlen; # ifndef ZZIP_ALLOW_MODULO_ENTRIES if (entries >= zz_entries) { if (zz_offset + 256 < zz_rootsize) { FAIL4("%li's entry is long before the end of directory - enable modulo_entries? (O:%li R:%li)", (long) entries, (long) (zz_offset), (long) zz_rootsize); } break; } # endif if (fd_map) { d = (void*)(fd_map+zz_fd_gap+zz_offset); /* fd_map+fd_gap==u_rootseek */ } else { if (io->fd.seeks(fd, zz_rootseek + zz_offset, SEEK_SET) < 0) return ZZIP_DIR_SEEK; if (io->fd.read(fd, &dirent, sizeof(dirent)) < __sizeof(dirent)) return ZZIP_DIR_READ; d = &dirent; } if ((zzip_off64_t) (zz_offset + sizeof(*d)) > zz_rootsize || (zzip_off64_t) (zz_offset + sizeof(*d)) < 0) { FAIL4("%li's entry stretches beyond root directory (O:%li R:%li)", (long) entries, (long) (zz_offset), (long) zz_rootsize); break; } if (! zzip_disk_entry_check_magic(d)) { # ifndef ZZIP_ALLOW_MODULO_ENTRIES FAIL4("%li's entry has no disk_entry magic indicator (O:%li R:%li)", (long) entries, (long) (zz_offset), (long) zz_rootsize); # endif break; } # if 0 && defined DEBUG zzip_debug_xbuf((unsigned char *) d, sizeof(*d) + 8); # endif u_extras = zzip_disk_entry_get_extras(d); u_comment = zzip_disk_entry_get_comment(d); u_namlen = zzip_disk_entry_get_namlen(d); HINT5("offset=0x%lx, size %ld, dirent *%p, hdr %p\n", (long) (zz_offset + zz_rootseek), (long) zz_rootsize, d, hdr); /* writes over the read buffer, Since the structure where data is copied is smaller than the data in buffer this can be done. It is important that the order of setting the fields is considered when filling the structure, so that some data is not trashed in first structure read. at the end the whole copied list of structures is copied into newly allocated buffer */ hdr->d_crc32 = zzip_disk_entry_get_crc32(d); hdr->d_csize = zzip_disk_entry_get_csize(d); hdr->d_usize = zzip_disk_entry_get_usize(d); hdr->d_off = zzip_disk_entry_get_offset(d); hdr->d_compr = zzip_disk_entry_get_compr(d); if (hdr->d_compr > _255) hdr->d_compr = 255; if ((zzip_off64_t) (zz_offset + sizeof(*d) + u_namlen) > zz_rootsize || (zzip_off64_t) (zz_offset + sizeof(*d) + u_namlen) < 0) { FAIL4("%li's name stretches beyond root directory (O:%li N:%li)", (long) entries, (long) (zz_offset), (long) (u_namlen)); break; } if (fd_map) { memcpy(hdr->d_name, fd_map+zz_fd_gap + zz_offset+sizeof(*d), u_namlen); } else { io->fd.read(fd, hdr->d_name, u_namlen); } hdr->d_name[u_namlen] = '\0'; hdr->d_namlen = u_namlen; /* update offset by the total length of this entry -> next entry */ zz_offset += sizeof(*d) + u_namlen + u_extras + u_comment; if (zz_offset > zz_rootsize) { FAIL3("%li's entry stretches beyond root directory (O:%li)", (long) entries, (long) (zz_offset)); entries ++; break; } HINT5("file %ld { compr=%d crc32=$%x offset=%d", (long) entries, hdr->d_compr, hdr->d_crc32, hdr->d_off); HINT5("csize=%d usize=%d namlen=%d extras=%d", hdr->d_csize, hdr->d_usize, u_namlen, u_extras); HINT5("comment=%d name='%s' %s <sizeof %d> } ", u_comment, hdr->d_name, "", (int) sizeof(*d)); p_reclen = &hdr->d_reclen; { register char *p = (char *) hdr; register char *q = aligned4(p + sizeof(*hdr) + u_namlen + 1); *p_reclen = (uint16_t) (q - p); hdr = (struct zzip_dir_hdr *) q; } } /*for */ if (USE_MMAP && fd_map) { HINT3("unmap *%p len=%li", fd_map, (long) (zz_rootsize + zz_fd_gap)); _zzip_munmap(io->fd.sys, fd_map, zz_rootsize + zz_fd_gap); } if (p_reclen) { *p_reclen = 0; /* mark end of list */ if (hdr_return) *hdr_return = hdr0; } /* else zero (sane) entries */ # ifndef ZZIP_ALLOW_MODULO_ENTRIES return (entries != zz_entries ? ZZIP_CORRUPTED : 0); # else return ((entries & (unsigned)0xFFFF) != zz_entries ? ZZIP_CORRUPTED : 0); # endif }
0
148,046
xmlValidCtxtPtr xmlNewValidCtxt(void) { xmlValidCtxtPtr ret; if ((ret = xmlMalloc(sizeof (xmlValidCtxt))) == NULL) { xmlVErrMemory(NULL, "malloc failed"); return (NULL); } (void) memset(ret, 0, sizeof (xmlValidCtxt)); return (ret); }
0
39,426
template<typename T> CImgDisplay& display(const CImg<T>& img) { return assign(img);
0
294,577
static MagickBooleanType WritePTIFImage(const ImageInfo *image_info, Image *image,ExceptionInfo *exception) { Image *images, *next, *pyramid_image; ImageInfo *write_info; MagickBooleanType status; PointInfo resolution; size_t columns, rows; /* Create pyramid-encoded TIFF image. */ images=NewImageList(); for (next=image; next != (Image *) NULL; next=GetNextImageInList(next)) { Image *clone_image; clone_image=CloneImage(next,0,0,MagickFalse,exception); if (clone_image == (Image *) NULL) break; clone_image->previous=NewImageList(); clone_image->next=NewImageList(); (void) SetImageProperty(clone_image,"tiff:subfiletype","none",exception); AppendImageToList(&images,clone_image); columns=next->columns; rows=next->rows; resolution=next->resolution; while ((columns > 64) && (rows > 64)) { columns/=2; rows/=2; resolution.x/=2; resolution.y/=2; pyramid_image=ResizeImage(next,columns,rows,image->filter,exception); if (pyramid_image == (Image *) NULL) break; pyramid_image->resolution=resolution; (void) SetImageProperty(pyramid_image,"tiff:subfiletype","REDUCEDIMAGE", exception); AppendImageToList(&images,pyramid_image); } } images=GetFirstImageInList(images); /* Write pyramid-encoded TIFF image. */ write_info=CloneImageInfo(image_info); write_info->adjoin=MagickTrue; (void) CopyMagickString(write_info->magick,"TIFF",MagickPathExtent); (void) CopyMagickString(images->magick,"TIFF",MagickPathExtent); status=WriteTIFFImage(write_info,images,exception); images=DestroyImageList(images); write_info=DestroyImageInfo(write_info); return(status); }
0
224,592
void HttpProxyClientSocket::Disconnect() { if (transport_.get()) transport_->socket()->Disconnect(); next_state_ = STATE_NONE; user_callback_.Reset(); }
0
221,225
void CancelUnlockOperation() { cancel_unlock_ = true; }
0
138,024
inline String& String::operator=(const StaticString& v) { m_str = req::ptr<StringData>::attach(v.m_str.get()); return *this; }
0
149,347
static int check_map_prog_compatibility(struct bpf_verifier_env *env, struct bpf_map *map, struct bpf_prog *prog) { /* * Validate that trace type programs use preallocated hash maps. * * For programs attached to PERF events this is mandatory as the * perf NMI can hit any arbitrary code sequence. * * All other trace types using preallocated hash maps are unsafe as * well because tracepoint or kprobes can be inside locked regions * of the memory allocator or at a place where a recursion into the * memory allocator would see inconsistent state. * * On RT enabled kernels run-time allocation of all trace type * programs is strictly prohibited due to lock type constraints. On * !RT kernels it is allowed for backwards compatibility reasons for * now, but warnings are emitted so developers are made aware of * the unsafety and can fix their programs before this is enforced. */ if (is_tracing_prog_type(prog->type) && !is_preallocated_map(map)) { if (prog->type == BPF_PROG_TYPE_PERF_EVENT) { verbose(env, "perf_event programs can only use preallocated hash map\n"); return -EINVAL; } if (IS_ENABLED(CONFIG_PREEMPT_RT)) { verbose(env, "trace type programs can only use preallocated hash map\n"); return -EINVAL; } WARN_ONCE(1, "trace type BPF program uses run-time allocation\n"); verbose(env, "trace type programs with run-time allocated hash maps are unsafe. Switch to preallocated hash maps.\n"); } if ((is_tracing_prog_type(prog->type) || prog->type == BPF_PROG_TYPE_SOCKET_FILTER) && map_value_has_spin_lock(map)) { verbose(env, "tracing progs cannot use bpf_spin_lock yet\n"); return -EINVAL; } if ((bpf_prog_is_dev_bound(prog->aux) || bpf_map_is_dev_bound(map)) && !bpf_offload_prog_map_match(prog, map)) { verbose(env, "offload device mismatch between prog and map\n"); return -EINVAL; } if (map->map_type == BPF_MAP_TYPE_STRUCT_OPS) { verbose(env, "bpf_struct_ops map cannot be used in prog\n"); return -EINVAL; } return 0; }
0
123,015
static void add_timer_randomness(struct timer_rand_state *state, unsigned num) { struct entropy_store *r; struct { long jiffies; unsigned cycles; unsigned num; } sample; long delta, delta2, delta3; sample.jiffies = jiffies; sample.cycles = random_get_entropy(); sample.num = num; r = &input_pool; mix_pool_bytes(r, &sample, sizeof(sample)); /* * Calculate number of bits of randomness we probably added. * We take into account the first, second and third-order deltas * in order to make our estimate. */ delta = sample.jiffies - READ_ONCE(state->last_time); WRITE_ONCE(state->last_time, sample.jiffies); delta2 = delta - READ_ONCE(state->last_delta); WRITE_ONCE(state->last_delta, delta); delta3 = delta2 - READ_ONCE(state->last_delta2); WRITE_ONCE(state->last_delta2, delta2); if (delta < 0) delta = -delta; if (delta2 < 0) delta2 = -delta2; if (delta3 < 0) delta3 = -delta3; if (delta > delta2) delta = delta2; if (delta > delta3) delta = delta3; /* * delta is now minimum absolute delta. * Round down by 1 bit on general principles, * and limit entropy estimate to 12 bits. */ credit_entropy_bits(r, min_t(int, fls(delta>>1), 11)); }
0
84,952
static int pcd_reset(struct pcd_unit *cd) { int i, k, flg; int expect[5] = { 1, 1, 1, 0x14, 0xeb }; pi_connect(cd->pi); write_reg(cd, 6, 0xa0 + 0x10 * cd->drive); write_reg(cd, 7, 8); pcd_sleep(20 * HZ / 1000); /* delay a bit */ k = 0; while ((k++ < PCD_RESET_TMO) && (status_reg(cd) & IDE_BUSY)) pcd_sleep(HZ / 10); flg = 1; for (i = 0; i < 5; i++) flg &= (read_reg(cd, i + 1) == expect[i]); if (verbose) { printk("%s: Reset (%d) signature = ", cd->name, k); for (i = 0; i < 5; i++) printk("%3x", read_reg(cd, i + 1)); if (!flg) printk(" (incorrect)"); printk("\n"); } pi_disconnect(cd->pi); return flg - 1; }
0
10,364
const AXObject* AXObject::ariaHiddenRoot() const { for (const AXObject* object = this; object; object = object->parentObject()) { if (equalIgnoringCase(object->getAttribute(aria_hiddenAttr), "true")) return object; } return 0; }
1
121,123
void QSvgHandler::pushColorCopy() { if (m_colorTagCount.count()) ++m_colorTagCount.top(); else pushColor(Qt::black); }
0
252,170
void RenderWidgetHostImpl::IncrementInFlightEventCount() { ++in_flight_event_count_; if (!is_hidden_) StartHangMonitorTimeout(hung_renderer_delay_); }
0
265,676
win_setminwidth(void) { int room; int needed; int first = TRUE; // loop until there is a 'winminheight' that is possible while (p_wmw > 0) { room = Columns; needed = frame_minwidth(topframe, NULL); if (room >= needed) break; --p_wmw; if (first) { emsg(_(e_not_enough_room)); first = FALSE; } } }
0
483,691
int driver_probe_device(struct device_driver *drv, struct device *dev) { int ret = 0; if (!device_is_registered(dev)) return -ENODEV; pr_debug("bus: '%s': %s: matched device %s with driver %s\n", drv->bus->name, __func__, dev_name(dev), drv->name); pm_runtime_get_suppliers(dev); if (dev->parent) pm_runtime_get_sync(dev->parent); pm_runtime_barrier(dev); if (initcall_debug) ret = really_probe_debug(dev, drv); else ret = really_probe(dev, drv); pm_request_idle(dev); if (dev->parent) pm_runtime_put(dev->parent); pm_runtime_put_suppliers(dev); return ret; }
0
228,040
AffineTransform& AffineTransform::multiply(const AffineTransform& other) { if (other.isIdentityOrTranslation()) { if (other.m_transform[4] || other.m_transform[5]) translate(other.m_transform[4], other.m_transform[5]); return *this; } AffineTransform trans; doMultiply(*this, other, &trans); setMatrix(trans.m_transform); return *this; }
0
509,735
static uint get_table_structure(char *table, char *db, char *table_type, char *ignore_flag) { my_bool init=0, delayed, write_data, complete_insert; my_ulonglong num_fields; char *result_table, *opt_quoted_table; const char *insert_option; char name_buff[NAME_LEN+3],table_buff[NAME_LEN*2+3]; char table_buff2[NAME_LEN*2+3], query_buff[QUERY_LENGTH]; const char *show_fields_stmt= "SELECT `COLUMN_NAME` AS `Field`, " "`COLUMN_TYPE` AS `Type`, " "`IS_NULLABLE` AS `Null`, " "`COLUMN_KEY` AS `Key`, " "`COLUMN_DEFAULT` AS `Default`, " "`EXTRA` AS `Extra`, " "`COLUMN_COMMENT` AS `Comment` " "FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE " "TABLE_SCHEMA = '%s' AND TABLE_NAME = '%s'"; FILE *sql_file= md_result_file; int len; my_bool is_log_table; MYSQL_RES *result; MYSQL_ROW row; DBUG_ENTER("get_table_structure"); DBUG_PRINT("enter", ("db: %s table: %s", db, table)); *ignore_flag= check_if_ignore_table(table, table_type); delayed= opt_delayed; if (delayed && (*ignore_flag & IGNORE_INSERT_DELAYED)) { delayed= 0; verbose_msg("-- Warning: Unable to use delayed inserts for table '%s' " "because it's of type %s\n", table, table_type); } complete_insert= 0; if ((write_data= !(*ignore_flag & IGNORE_DATA))) { complete_insert= opt_complete_insert; if (!insert_pat_inited) { insert_pat_inited= 1; init_dynamic_string_checked(&insert_pat, "", 1024, 1024); } else dynstr_set_checked(&insert_pat, ""); } insert_option= ((delayed && opt_ignore) ? " DELAYED IGNORE " : delayed ? " DELAYED " : opt_ignore ? " IGNORE " : ""); verbose_msg("-- Retrieving table structure for table %s...\n", table); len= my_snprintf(query_buff, sizeof(query_buff), "SET SQL_QUOTE_SHOW_CREATE=%d", (opt_quoted || opt_keywords)); if (!create_options) strmov(query_buff+len, "/*!40102 ,SQL_MODE=concat(@@sql_mode, _utf8 ',NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS') */"); result_table= quote_name(table, table_buff, 1); opt_quoted_table= quote_name(table, table_buff2, 0); if (opt_order_by_primary) order_by= primary_key_fields(result_table); if (!opt_xml && !mysql_query_with_error_report(mysql, 0, query_buff)) { /* using SHOW CREATE statement */ if (!opt_no_create_info) { /* Make an sql-file, if path was given iow. option -T was given */ char buff[20+FN_REFLEN]; MYSQL_FIELD *field; my_snprintf(buff, sizeof(buff), "show create table %s", result_table); if (switch_character_set_results(mysql, "binary") || mysql_query_with_error_report(mysql, &result, buff) || switch_character_set_results(mysql, default_charset)) DBUG_RETURN(0); if (path) { if (!(sql_file= open_sql_file_for_table(table, O_WRONLY))) DBUG_RETURN(0); write_header(sql_file, db); } if (strcmp (table_type, "VIEW") == 0) /* view */ print_comment(sql_file, 0, "\n--\n-- Temporary table structure for view %s\n--\n\n", fix_for_comment(result_table)); else print_comment(sql_file, 0, "\n--\n-- Table structure for table %s\n--\n\n", fix_for_comment(result_table)); if (opt_drop) { /* Even if the "table" is a view, we do a DROP TABLE here. The view-specific code below fills in the DROP VIEW. We will skip the DROP TABLE for general_log and slow_log, since those stmts will fail, in case we apply dump by enabling logging. */ if (!general_log_or_slow_log_tables(db, table)) fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n", opt_quoted_table); check_io(sql_file); } field= mysql_fetch_field_direct(result, 0); if (strcmp(field->name, "View") == 0) { char *scv_buff= NULL; my_ulonglong n_cols; verbose_msg("-- It's a view, create dummy table for view\n"); /* save "show create" statement for later */ if ((row= mysql_fetch_row(result)) && (scv_buff=row[1])) scv_buff= my_strdup(scv_buff, MYF(0)); mysql_free_result(result); /* Create a table with the same name as the view and with columns of the same name in order to satisfy views that depend on this view. The table will be removed when the actual view is created. The properties of each column, are not preserved in this temporary table, because they are not necessary. This will not be necessary once we can determine dependencies between views and can simply dump them in the appropriate order. */ my_snprintf(query_buff, sizeof(query_buff), "SHOW FIELDS FROM %s", result_table); if (switch_character_set_results(mysql, "binary") || mysql_query_with_error_report(mysql, &result, query_buff) || switch_character_set_results(mysql, default_charset)) { /* View references invalid or privileged table/col/fun (err 1356), so we cannot create a stand-in table. Be defensive and dump a comment with the view's 'show create' statement. (Bug #17371) */ if (mysql_errno(mysql) == ER_VIEW_INVALID) fprintf(sql_file, "\n-- failed on view %s: %s\n\n", result_table, scv_buff ? scv_buff : ""); my_free(scv_buff); DBUG_RETURN(0); } else my_free(scv_buff); n_cols= mysql_num_rows(result); if (0 != n_cols) { /* The actual formula is based on the column names and how the .FRM files are stored and is too volatile to be repeated here. Thus we simply warn the user if the columns exceed a limit we know works most of the time. */ if (n_cols >= 1000) fprintf(stderr, "-- Warning: Creating a stand-in table for view %s may" " fail when replaying the dump file produced because " "of the number of columns exceeding 1000. Exercise " "caution when replaying the produced dump file.\n", table); if (opt_drop) { /* We have already dropped any table of the same name above, so here we just drop the view. */ fprintf(sql_file, "/*!50001 DROP VIEW IF EXISTS %s*/;\n", opt_quoted_table); check_io(sql_file); } fprintf(sql_file, "SET @saved_cs_client = @@character_set_client;\n" "SET character_set_client = utf8;\n" "/*!50001 CREATE TABLE %s (\n", result_table); /* Get first row, following loop will prepend comma - keeps from having to know if the row being printed is last to determine if there should be a _trailing_ comma. */ row= mysql_fetch_row(result); /* The actual column type doesn't matter anyway, since the table will be dropped at run time. We do tinyint to avoid hitting the row size limit. */ fprintf(sql_file, " %s tinyint NOT NULL", quote_name(row[0], name_buff, 0)); while((row= mysql_fetch_row(result))) { /* col name, col type */ fprintf(sql_file, ",\n %s tinyint NOT NULL", quote_name(row[0], name_buff, 0)); } /* Stand-in tables are always MyISAM tables as the default engine might have a column-limit that's lower than the number of columns in the view, and MyISAM support is guaranteed to be in the server anyway. */ fprintf(sql_file, "\n) ENGINE=MyISAM */;\n" "SET character_set_client = @saved_cs_client;\n"); check_io(sql_file); } mysql_free_result(result); if (path) my_fclose(sql_file, MYF(MY_WME)); seen_views= 1; DBUG_RETURN(0); } row= mysql_fetch_row(result); is_log_table= general_log_or_slow_log_tables(db, table); if (is_log_table) row[1]+= 13; /* strlen("CREATE TABLE ")= 13 */ if (opt_compatible_mode & 3) { fprintf(sql_file, is_log_table ? "CREATE TABLE IF NOT EXISTS %s;\n" : "%s;\n", row[1]); } else { fprintf(sql_file, "/*!40101 SET @saved_cs_client = @@character_set_client */;\n" "/*!40101 SET character_set_client = utf8 */;\n" "%s%s;\n" "/*!40101 SET character_set_client = @saved_cs_client */;\n", is_log_table ? "CREATE TABLE IF NOT EXISTS " : "", row[1]); } check_io(sql_file); mysql_free_result(result); } my_snprintf(query_buff, sizeof(query_buff), "show fields from %s", result_table); if (mysql_query_with_error_report(mysql, &result, query_buff)) { if (path) my_fclose(sql_file, MYF(MY_WME)); DBUG_RETURN(0); } /* If write_data is true, then we build up insert statements for the table's data. Note: in subsequent lines of code, this test will have to be performed each time we are appending to insert_pat. */ if (write_data) { if (opt_replace_into) dynstr_append_checked(&insert_pat, "REPLACE "); else dynstr_append_checked(&insert_pat, "INSERT "); dynstr_append_checked(&insert_pat, insert_option); dynstr_append_checked(&insert_pat, "INTO "); dynstr_append_checked(&insert_pat, opt_quoted_table); if (complete_insert) { dynstr_append_checked(&insert_pat, " ("); } else { dynstr_append_checked(&insert_pat, " VALUES "); if (!extended_insert) dynstr_append_checked(&insert_pat, "("); } } while ((row= mysql_fetch_row(result))) { if (complete_insert) { if (init) { dynstr_append_checked(&insert_pat, ", "); } init=1; dynstr_append_checked(&insert_pat, quote_name(row[SHOW_FIELDNAME], name_buff, 0)); } } num_fields= mysql_num_rows(result); mysql_free_result(result); } else { verbose_msg("%s: Warning: Can't set SQL_QUOTE_SHOW_CREATE option (%s)\n", my_progname_short, mysql_error(mysql)); my_snprintf(query_buff, sizeof(query_buff), show_fields_stmt, db, table); if (mysql_query_with_error_report(mysql, &result, query_buff)) DBUG_RETURN(0); /* Make an sql-file, if path was given iow. option -T was given */ if (!opt_no_create_info) { if (path) { if (!(sql_file= open_sql_file_for_table(table, O_WRONLY))) DBUG_RETURN(0); write_header(sql_file, db); } print_comment(sql_file, 0, "\n--\n-- Table structure for table %s\n--\n\n", fix_for_comment(result_table)); if (opt_drop) fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n", result_table); if (!opt_xml) fprintf(sql_file, "CREATE TABLE %s (\n", result_table); else print_xml_tag(sql_file, "\t", "\n", "table_structure", "name=", table, NullS); check_io(sql_file); } if (write_data) { if (opt_replace_into) dynstr_append_checked(&insert_pat, "REPLACE "); else dynstr_append_checked(&insert_pat, "INSERT "); dynstr_append_checked(&insert_pat, insert_option); dynstr_append_checked(&insert_pat, "INTO "); dynstr_append_checked(&insert_pat, result_table); if (complete_insert) dynstr_append_checked(&insert_pat, " ("); else { dynstr_append_checked(&insert_pat, " VALUES "); if (!extended_insert) dynstr_append_checked(&insert_pat, "("); } } while ((row= mysql_fetch_row(result))) { ulong *lengths= mysql_fetch_lengths(result); if (init) { if (!opt_xml && !opt_no_create_info) { fputs(",\n",sql_file); check_io(sql_file); } if (complete_insert) dynstr_append_checked(&insert_pat, ", "); } init=1; if (complete_insert) dynstr_append_checked(&insert_pat, quote_name(row[SHOW_FIELDNAME], name_buff, 0)); if (!opt_no_create_info) { if (opt_xml) { print_xml_row(sql_file, "field", result, &row, NullS); continue; } if (opt_keywords) fprintf(sql_file, " %s.%s %s", result_table, quote_name(row[SHOW_FIELDNAME],name_buff, 0), row[SHOW_TYPE]); else fprintf(sql_file, " %s %s", quote_name(row[SHOW_FIELDNAME], name_buff, 0), row[SHOW_TYPE]); if (row[SHOW_DEFAULT]) { fputs(" DEFAULT ", sql_file); unescape(sql_file, row[SHOW_DEFAULT], lengths[SHOW_DEFAULT]); } if (!row[SHOW_NULL][0]) fputs(" NOT NULL", sql_file); if (row[SHOW_EXTRA][0]) fprintf(sql_file, " %s",row[SHOW_EXTRA]); check_io(sql_file); } } num_fields= mysql_num_rows(result); mysql_free_result(result); if (!opt_no_create_info) { /* Make an sql-file, if path was given iow. option -T was given */ char buff[20+FN_REFLEN]; uint keynr,primary_key; my_snprintf(buff, sizeof(buff), "show keys from %s", result_table); if (mysql_query_with_error_report(mysql, &result, buff)) { if (mysql_errno(mysql) == ER_WRONG_OBJECT) { /* it is VIEW */ fputs("\t\t<options Comment=\"view\" />\n", sql_file); goto continue_xml; } fprintf(stderr, "%s: Can't get keys for table %s (%s)\n", my_progname_short, result_table, mysql_error(mysql)); if (path) my_fclose(sql_file, MYF(MY_WME)); DBUG_RETURN(0); } /* Find first which key is primary key */ keynr=0; primary_key=INT_MAX; while ((row= mysql_fetch_row(result))) { if (atoi(row[3]) == 1) { keynr++; #ifdef FORCE_PRIMARY_KEY if (atoi(row[1]) == 0 && primary_key == INT_MAX) primary_key=keynr; #endif if (!strcmp(row[2],"PRIMARY")) { primary_key=keynr; break; } } } mysql_data_seek(result,0); keynr=0; while ((row= mysql_fetch_row(result))) { if (opt_xml) { print_xml_row(sql_file, "key", result, &row, NullS); continue; } if (atoi(row[3]) == 1) { if (keynr++) putc(')', sql_file); if (atoi(row[1])) /* Test if duplicate key */ /* Duplicate allowed */ fprintf(sql_file, ",\n KEY %s (",quote_name(row[2],name_buff,0)); else if (keynr == primary_key) fputs(",\n PRIMARY KEY (",sql_file); /* First UNIQUE is primary */ else fprintf(sql_file, ",\n UNIQUE %s (",quote_name(row[2],name_buff, 0)); } else putc(',', sql_file); fputs(quote_name(row[4], name_buff, 0), sql_file); if (row[7]) fprintf(sql_file, " (%s)",row[7]); /* Sub key */ check_io(sql_file); } mysql_free_result(result); if (!opt_xml) { if (keynr) putc(')', sql_file); fputs("\n)",sql_file); check_io(sql_file); } /* Get MySQL specific create options */ if (create_options) { char show_name_buff[NAME_LEN*2+2+24]; /* Check memory for quote_for_like() */ my_snprintf(buff, sizeof(buff), "show table status like %s", quote_for_like(table, show_name_buff)); if (mysql_query_with_error_report(mysql, &result, buff)) { if (mysql_errno(mysql) != ER_PARSE_ERROR) { /* If old MySQL version */ verbose_msg("-- Warning: Couldn't get status information for " \ "table %s (%s)\n", result_table,mysql_error(mysql)); } } else if (!(row= mysql_fetch_row(result))) { fprintf(stderr, "Error: Couldn't read status information for table %s (%s)\n", result_table,mysql_error(mysql)); } else { if (opt_xml) print_xml_row(sql_file, "options", result, &row, NullS); else { fputs("/*!",sql_file); print_value(sql_file,result,row,"engine=","Engine",0); print_value(sql_file,result,row,"","Create_options",0); print_value(sql_file,result,row,"comment=","Comment",1); fputs(" */",sql_file); check_io(sql_file); } } mysql_free_result(result); /* Is always safe to free */ } continue_xml: if (!opt_xml) fputs(";\n", sql_file); else fputs("\t</table_structure>\n", sql_file); check_io(sql_file); } } if (complete_insert) { dynstr_append_checked(&insert_pat, ") VALUES "); if (!extended_insert) dynstr_append_checked(&insert_pat, "("); } if (sql_file != md_result_file) { fputs("\n", sql_file); write_footer(sql_file); my_fclose(sql_file, MYF(MY_WME)); } DBUG_RETURN((uint) num_fields); } /* get_table_structure */
0
267,557
static int follow_automount(struct path *path, struct nameidata *nd, bool *need_mntput) { struct vfsmount *mnt; int err; if (!path->dentry->d_op || !path->dentry->d_op->d_automount) return -EREMOTE; /* We don't want to mount if someone's just doing a stat - * unless they're stat'ing a directory and appended a '/' to * the name. * * We do, however, want to mount if someone wants to open or * create a file of any type under the mountpoint, wants to * traverse through the mountpoint or wants to open the * mounted directory. Also, autofs may mark negative dentries * as being automount points. These will need the attentions * of the daemon to instantiate them before they can be used. */ if (!(nd->flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY | LOOKUP_OPEN | LOOKUP_CREATE | LOOKUP_AUTOMOUNT)) && path->dentry->d_inode) return -EISDIR; nd->total_link_count++; if (nd->total_link_count >= 40) return -ELOOP; mnt = path->dentry->d_op->d_automount(path); if (IS_ERR(mnt)) { /* * The filesystem is allowed to return -EISDIR here to indicate * it doesn't want to automount. For instance, autofs would do * this so that its userspace daemon can mount on this dentry. * * However, we can only permit this if it's a terminal point in * the path being looked up; if it wasn't then the remainder of * the path is inaccessible and we should say so. */ if (PTR_ERR(mnt) == -EISDIR && (nd->flags & LOOKUP_PARENT)) return -EREMOTE; return PTR_ERR(mnt); } if (!mnt) /* mount collision */ return 0; if (!*need_mntput) { /* lock_mount() may release path->mnt on error */ mntget(path->mnt); *need_mntput = true; } err = finish_automount(mnt, path); switch (err) { case -EBUSY: /* Someone else made a mount here whilst we were busy */ return 0; case 0: path_put(path); path->mnt = mnt; path->dentry = dget(mnt->mnt_root); return 0; default: return err; } }
0
258,036
const char * keyring_get_resource_name ( KEYRING_HANDLE hd ) { if ( ! hd || ! hd -> resource ) return NULL ; return hd -> resource -> fname ; }
0
224,503
static void activityLoggedInIsolatedWorldMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext()); if (contextData && contextData->activityLogger()) { Vector<v8::Handle<v8::Value> > loggerArgs = toNativeArguments<v8::Handle<v8::Value> >(info, 0); contextData->activityLogger()->log("TestObject.activityLoggedInIsolatedWorldMethod", info.Length(), loggerArgs.data(), "Method"); } TestObjectV8Internal::activityLoggedInIsolatedWorldMethodMethod(info); TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); }
0
484,741
static int read_tlv_buf(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id, unsigned int __user *buf, unsigned int size) { struct snd_kcontrol_volatile *vd = &kctl->vd[snd_ctl_get_ioff(kctl, id)]; unsigned int len; if (!(vd->access & SNDRV_CTL_ELEM_ACCESS_TLV_READ)) return -ENXIO; if (kctl->tlv.p == NULL) return -ENXIO; len = sizeof(unsigned int) * 2 + kctl->tlv.p[1]; if (size < len) return -ENOMEM; if (copy_to_user(buf, kctl->tlv.p, len)) return -EFAULT; return 0; }
0
285,214
void FFmpegVideoDecodeEngine::DecodeFrame(scoped_refptr<Buffer> buffer) { scoped_refptr<VideoFrame> video_frame; AVPacket packet; av_init_packet(&packet); packet.data = const_cast<uint8*>(buffer->GetData()); packet.size = buffer->GetDataSize(); PipelineStatistics statistics; statistics.video_bytes_decoded = buffer->GetDataSize(); codec_context_->reordered_opaque = buffer->GetTimestamp().InMicroseconds(); av_frame_->reordered_opaque = codec_context_->reordered_opaque; int frame_decoded = 0; int result = avcodec_decode_video2(codec_context_, av_frame_.get(), &frame_decoded, &packet); if (result < 0) { LOG(ERROR) << "Error decoding a video frame with timestamp: " << buffer->GetTimestamp().InMicroseconds() << " us, duration: " << buffer->GetDuration().InMicroseconds() << " us, packet size: " << buffer->GetDataSize() << " bytes"; event_handler_->OnError(); return; } if (frame_decoded == 0) { if (buffer->IsEndOfStream()) { // We had started flushing. event_handler_->ConsumeVideoFrame(video_frame, statistics); output_eos_reached_ = true; } else { ReadInput(); } return; } if (!av_frame_->data[VideoFrame::kYPlane] || !av_frame_->data[VideoFrame::kUPlane] || !av_frame_->data[VideoFrame::kVPlane]) { event_handler_->OnError(); return; } DCHECK_LE(av_frame_->repeat_pict, 2); // Sanity check. AVRational doubled_time_base; doubled_time_base.num = frame_rate_denominator_; doubled_time_base.den = frame_rate_numerator_ * 2; base::TimeDelta timestamp = base::TimeDelta::FromMicroseconds(av_frame_->reordered_opaque); base::TimeDelta duration = ConvertFromTimeBase(doubled_time_base, 2 + av_frame_->repeat_pict); DCHECK(frame_queue_available_.size()); video_frame = frame_queue_available_.front(); frame_queue_available_.pop_front(); size_t height = codec_context_->height; CopyPlane(VideoFrame::kYPlane, video_frame.get(), av_frame_.get(), height); CopyPlane(VideoFrame::kUPlane, video_frame.get(), av_frame_.get(), height); CopyPlane(VideoFrame::kVPlane, video_frame.get(), av_frame_.get(), height); video_frame->SetTimestamp(timestamp); video_frame->SetDuration(duration); pending_output_buffers_--; event_handler_->ConsumeVideoFrame(video_frame, statistics); }
0
319,791
static void monitor_data_destroy(Monitor *mon) { QDECREF(mon->outbuf); qemu_mutex_destroy(&mon->out_lock);
1
288,325
int32_t PepperFlashRendererHost::OnNavigate( ppapi::host::HostMessageContext* host_context, const ppapi::URLRequestInfoData& data, const std::string& target, bool from_user_action) { content::PepperPluginInstance* plugin_instance = host_->GetPluginInstance(pp_instance()); if (!plugin_instance) return PP_ERROR_FAILED; ppapi::proxy::HostDispatcher* host_dispatcher = ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); host_dispatcher->set_allow_plugin_reentrancy(); base::WeakPtr<PepperFlashRendererHost> weak_ptr = weak_factory_.GetWeakPtr(); navigate_replies_.push_back(host_context->MakeReplyMessageContext()); plugin_instance->Navigate(data, target.c_str(), from_user_action); if (weak_ptr.get()) { SendReply(navigate_replies_.back(), IPC::Message()); navigate_replies_.pop_back(); } return PP_OK_COMPLETIONPENDING; }
1
91,535
extern "C" void slave_io_thread_detach_vio() { THD *thd= current_thd; if (thd && thd->slave_thread) thd->clear_active_vio(); }
0
157,001
static const char *dd_check(struct dump_dir *dd) { dd->dd_time = parse_time_file_at(dd->dd_fd, FILENAME_TIME); if (dd->dd_time < 0) { log_warning("Missing file: "FILENAME_TIME); return FILENAME_TIME; } dd->dd_type = load_text_file_at(dd->dd_fd, FILENAME_TYPE, DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE); if (!dd->dd_type || (strlen(dd->dd_type) == 0)) { log_warning("Missing or empty file: "FILENAME_TYPE); return FILENAME_TYPE; } return NULL; }
0
337,931
static int svq1_decode_frame_header(GetBitContext *bitbuf, MpegEncContext *s) { int frame_size_code; skip_bits(bitbuf, 8); /* temporal_reference */ /* frame type */ s->pict_type = get_bits(bitbuf, 2) + 1; if (s->pict_type == 4) return AVERROR_INVALIDDATA; if (s->pict_type == AV_PICTURE_TYPE_I) { /* unknown fields */ if (s->f_code == 0x50 || s->f_code == 0x60) { int csum = get_bits(bitbuf, 16); csum = ff_svq1_packet_checksum(bitbuf->buffer, bitbuf->size_in_bits >> 3, csum); av_dlog(s->avctx, "%s checksum (%02x) for packet data\n", (csum == 0) ? "correct" : "incorrect", csum); } if ((s->f_code ^ 0x10) >= 0x50) { uint8_t msg[256]; svq1_parse_string(bitbuf, msg); av_log(s->avctx, AV_LOG_ERROR, "embedded message: \"%s\"\n", (char *)msg); } skip_bits(bitbuf, 2); skip_bits(bitbuf, 2); skip_bits1(bitbuf); /* load frame size */ frame_size_code = get_bits(bitbuf, 3); if (frame_size_code == 7) { /* load width, height (12 bits each) */ s->width = get_bits(bitbuf, 12); s->height = get_bits(bitbuf, 12); if (!s->width || !s->height) return AVERROR_INVALIDDATA; } else { /* get width, height from table */ s->width = ff_svq1_frame_size_table[frame_size_code].width; s->height = ff_svq1_frame_size_table[frame_size_code].height; } } /* unknown fields */ if (get_bits1(bitbuf) == 1) { skip_bits1(bitbuf); /* use packet checksum if (1) */ skip_bits1(bitbuf); /* component checksums after image data if (1) */ if (get_bits(bitbuf, 2) != 0) return AVERROR_INVALIDDATA; } if (get_bits1(bitbuf) == 1) { skip_bits1(bitbuf); skip_bits(bitbuf, 4); skip_bits1(bitbuf); skip_bits(bitbuf, 2); while (get_bits1(bitbuf) == 1) skip_bits(bitbuf, 8); } return 0; }
0
121,463
void sc_mem_clear(void *ptr, size_t len) { if (len > 0) { #ifdef ENABLE_OPENSSL OPENSSL_cleanse(ptr, len); #else memset(ptr, 0, len); #endif } }
0
394,537
static int mb86a20s_reset_counters(struct dvb_frontend *fe) { struct mb86a20s_state *state = fe->demodulator_priv; struct dtv_frontend_properties *c = &fe->dtv_property_cache; int rc, val; dev_dbg(&state->i2c->dev, "%s called.\n", __func__); /* Reset the counters, if the channel changed */ if (state->last_frequency != c->frequency) { memset(&c->cnr, 0, sizeof(c->cnr)); memset(&c->pre_bit_error, 0, sizeof(c->pre_bit_error)); memset(&c->pre_bit_count, 0, sizeof(c->pre_bit_count)); memset(&c->post_bit_error, 0, sizeof(c->post_bit_error)); memset(&c->post_bit_count, 0, sizeof(c->post_bit_count)); memset(&c->block_error, 0, sizeof(c->block_error)); memset(&c->block_count, 0, sizeof(c->block_count)); state->last_frequency = c->frequency; } /* Clear status for most stats */ /* BER/PER counter reset */ rc = mb86a20s_writeregdata(state, mb86a20s_per_ber_reset); if (rc < 0) goto err; /* CNR counter reset */ rc = mb86a20s_readreg(state, 0x45); if (rc < 0) goto err; val = rc; rc = mb86a20s_writereg(state, 0x45, val | 0x10); if (rc < 0) goto err; rc = mb86a20s_writereg(state, 0x45, val & 0x6f); if (rc < 0) goto err; /* MER counter reset */ rc = mb86a20s_writereg(state, 0x50, 0x50); if (rc < 0) goto err; rc = mb86a20s_readreg(state, 0x51); if (rc < 0) goto err; val = rc; rc = mb86a20s_writereg(state, 0x51, val | 0x01); if (rc < 0) goto err; rc = mb86a20s_writereg(state, 0x51, val & 0x06); if (rc < 0) goto err; goto ok; err: dev_err(&state->i2c->dev, "%s: Can't reset FE statistics (error %d).\n", __func__, rc); ok: return rc; }
0
194,987
void RenderWidgetHostViewAndroid::SetCachedBackgroundColor(SkColor color) { cached_background_color_ = color; }
0
34,974
void CModule::OnNick(const CNick& Nick, const CString& sNewNick, const vector<CChan*>& vChans) {}
0
72,521
load_binpersid(UnpicklerObject *self) { PyObject *pid, *obj; if (self->pers_func) { PDATA_POP(self->stack, pid); if (pid == NULL) return -1; obj = call_method(self->pers_func, self->pers_func_self, pid); Py_DECREF(pid); if (obj == NULL) return -1; PDATA_PUSH(self->stack, obj, -1); return 0; } else { PickleState *st = _Pickle_GetGlobalState(); PyErr_SetString(st->UnpicklingError, "A load persistent id instruction was encountered,\n" "but no persistent_load function was specified."); return -1; } }
0
331,103
static void spapr_nvram_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); VIOsPAPRDeviceClass *k = VIO_SPAPR_DEVICE_CLASS(klass); k->realize = spapr_nvram_realize; k->devnode = spapr_nvram_devnode; k->dt_name = "nvram"; k->dt_type = "nvram"; k->dt_compatible = "qemu,spapr-nvram"; set_bit(DEVICE_CATEGORY_MISC, dc->categories); dc->props = spapr_nvram_properties; dc->vmsd = &vmstate_spapr_nvram; }
1
470,910
void outflush(const gs_memory_t *mem) { gs_lib_ctx_core_t *core = mem->gs_lib_ctx->core; if (core->stdout_is_redirected) { if (core->stdout_to_stderr) { if (!core->stderr_fn) fflush(core->fstderr); } else gp_fflush(core->fstdout2); } else if (!core->stdout_fn) fflush(core->fstdout); }
0
445,262
LogRecordingSink::LogRecordingSink(Logger::DelegatingLogSinkSharedPtr log_sink) : Logger::SinkDelegate(log_sink) {}
0
54,199
flatpak_dir_get_config_strv (FlatpakDir *self, char *key) { GKeyFile *config = flatpak_dir_get_repo_config (self); g_auto(GStrv) lang = NULL; if (config) { if (g_key_file_has_key (config, "core", key, NULL)) { lang = g_key_file_get_string_list (config, "core", key, NULL, NULL); return g_steal_pointer (&lang); } } return NULL; }
0
55,241
static inline int apic_test_vector(int vec, void *bitmap) { return test_bit(VEC_POS(vec), (bitmap) + REG_POS(vec)); }
0
221,904
void RenderBox::willBeDestroyed() { clearOverrideSize(); if (style() && (style()->logicalHeight().isPercent() || style()->logicalMinHeight().isPercent() || style()->logicalMaxHeight().isPercent())) RenderBlock::removePercentHeightDescendant(this); ASSERT(!RenderBlock::hasPercentHeightDescendant(this)); RenderBoxModelObject::willBeDestroyed(); }
0
19,421
int xmlHashRemoveEntry ( xmlHashTablePtr table , const xmlChar * name , xmlHashDeallocator f ) { return ( xmlHashRemoveEntry3 ( table , name , NULL , NULL , f ) ) ; }
0
225,289
unsigned HTMLInputElement::width() const { return m_inputType->width(); }
0
51,872
static int MP4_ReadBox_dac3( stream_t *p_stream, MP4_Box_t *p_box ) { MP4_Box_data_dac3_t *p_dac3; MP4_READBOX_ENTER( MP4_Box_data_dac3_t ); p_dac3 = p_box->data.p_dac3; unsigned i_header; MP4_GET3BYTES( i_header ); p_dac3->i_fscod = ( i_header >> 22 ) & 0x03; p_dac3->i_bsid = ( i_header >> 17 ) & 0x01f; p_dac3->i_bsmod = ( i_header >> 14 ) & 0x07; p_dac3->i_acmod = ( i_header >> 11 ) & 0x07; p_dac3->i_lfeon = ( i_header >> 10 ) & 0x01; p_dac3->i_bitrate_code = ( i_header >> 5) & 0x1f; #ifdef MP4_VERBOSE msg_Dbg( p_stream, "read box: \"dac3\" fscod=0x%x bsid=0x%x bsmod=0x%x acmod=0x%x lfeon=0x%x bitrate_code=0x%x", p_dac3->i_fscod, p_dac3->i_bsid, p_dac3->i_bsmod, p_dac3->i_acmod, p_dac3->i_lfeon, p_dac3->i_bitrate_code ); #endif MP4_READBOX_EXIT( 1 ); }
0
414,133
work_address_populate (EContact *card, gchar **values) { address_populate (card, values, E_CONTACT_ADDRESS_LABEL_WORK, E_CONTACT_ADDRESS_WORK); }
0
62,139
static void default_print_str(WriterContext *wctx, const char *key, const char *value) { DefaultContext *def = wctx->priv; if (!def->nokey) printf("%s%s=", wctx->section_pbuf[wctx->level].str, key); printf("%s\n", value); }
0
144,328
virtual void clean() { dirty = false; }
0
200,092
OMX_ERRORTYPE SoftMPEG4Encoder::releaseEncoder() { if (mEncParams) { delete mEncParams; mEncParams = NULL; } if (mHandle) { delete mHandle; mHandle = NULL; } return OMX_ErrorNone; }
0
377,873
static int audit_set_enabled(u32 state) { int rc; if (state < AUDIT_OFF || state > AUDIT_LOCKED) return -EINVAL; rc = audit_do_config_change("audit_enabled", &audit_enabled, state); if (!rc) audit_ever_enabled |= !!state; return rc; }
0
184,863
bool RenderLayerCompositor::allocateOrClearCompositedLayerMapping(RenderLayer* layer) { bool compositedLayerMappingChanged = false; bool nonCompositedReasonChanged = updateLayerIfViewportConstrained(layer); CompositingStateTransitionType compositedLayerUpdate = computeCompositedLayerUpdate(layer); switch (compositedLayerUpdate) { case AllocateOwnCompositedLayerMapping: ASSERT(!layer->hasCompositedLayerMapping()); enableCompositingMode(); repaintOnCompositingChange(layer); layer->ensureCompositedLayerMapping(); compositedLayerMappingChanged = true; if (layer->isRootLayer() && isMainFrame()) { if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator()) scrollingCoordinator->frameViewRootLayerDidChange(m_renderView->frameView()); } layer->setGroupedMapping(0); if (layer->parent()) layer->repainter().computeRepaintRectsIncludingDescendants(); break; case RemoveOwnCompositedLayerMapping: case AddToSquashingLayer: if (layer->hasCompositedLayerMapping()) { if (layer->isReflection()) { RenderLayer* sourceLayer = toRenderLayerModelObject(layer->renderer()->parent())->layer(); if (sourceLayer->hasCompositedLayerMapping()) { ASSERT(sourceLayer->compositedLayerMapping()->mainGraphicsLayer()->replicaLayer() == layer->compositedLayerMapping()->mainGraphicsLayer()); sourceLayer->compositedLayerMapping()->mainGraphicsLayer()->setReplicatedByLayer(0); } } removeViewportConstrainedLayer(layer); layer->clearCompositedLayerMapping(); compositedLayerMappingChanged = true; layer->repainter().computeRepaintRectsIncludingDescendants(); repaintOnCompositingChange(layer); } break; case RemoveFromSquashingLayer: case NoCompositingStateChange: break; } if (layer->hasCompositedLayerMapping() && layer->compositedLayerMapping()->updateRequiresOwnBackingStoreForIntrinsicReasons()) compositedLayerMappingChanged = true; if (compositedLayerMappingChanged && layer->renderer()->isRenderPart()) { RenderLayerCompositor* innerCompositor = frameContentsCompositor(toRenderPart(layer->renderer())); if (innerCompositor && innerCompositor->inCompositingMode()) innerCompositor->updateRootLayerAttachment(); } if (compositedLayerMappingChanged) layer->clipper().clearClipRectsIncludingDescendants(PaintingClipRects); if (compositedLayerMappingChanged || nonCompositedReasonChanged) { if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator()) scrollingCoordinator->frameViewFixedObjectsDidChange(m_renderView->frameView()); } return compositedLayerMappingChanged || nonCompositedReasonChanged; }
0
365,738
g_delete_wait_obj_from_socket(tbus wait_obj) { #ifdef _WIN32 if (wait_obj == 0) { return; } WSACloseEvent((HANDLE)wait_obj); #else #endif }
0
229,775
RenderFrameImpl::CreatePortal(mojo::ScopedInterfaceEndpointHandle pipe) { int proxy_routing_id = MSG_ROUTING_NONE; base::UnguessableToken portal_token; GetFrameHost()->CreatePortal( blink::mojom::PortalAssociatedRequest(std::move(pipe)), &proxy_routing_id, &portal_token); RenderFrameProxy* proxy = RenderFrameProxy::CreateProxyForPortal(this, proxy_routing_id); return std::make_pair(proxy->web_frame(), portal_token); }
0
361,145
static void call_trans2findnotifyfirst(connection_struct *conn, struct smb_request *req, char **pparams, int total_params, char **ppdata, int total_data, unsigned int max_data_bytes) { char *params = *pparams; uint16 info_level; if (total_params < 6) { reply_nterror(req, NT_STATUS_INVALID_PARAMETER); return; } info_level = SVAL(params,4); DEBUG(3,("call_trans2findnotifyfirst - info_level %d\n", info_level)); switch (info_level) { case 1: case 2: break; default: reply_nterror(req, NT_STATUS_INVALID_LEVEL); return; } /* Realloc the parameter and data sizes */ *pparams = (char *)SMB_REALLOC(*pparams,6); if (*pparams == NULL) { reply_nterror(req, NT_STATUS_NO_MEMORY); return; } params = *pparams; SSVAL(params,0,fnf_handle); SSVAL(params,2,0); /* No changes */ SSVAL(params,4,0); /* No EA errors */ fnf_handle++; if(fnf_handle == 0) fnf_handle = 257; send_trans2_replies(conn, req, params, 6, *ppdata, 0, max_data_bytes); return; }
0
459,419
static int uvc_resume(struct usb_interface *intf) { return __uvc_resume(intf, 0); }
0
258,842
PackOpenBSDElf32x86::generateElfHdr( OutputFile *fo, void const *proto, unsigned const brka ) { cprElfHdr3 *const h3 = (cprElfHdr3 *)(void *)&elfout; memcpy(h3, proto, sizeof(*h3)); // reads beyond, but OK h3->ehdr.e_ident[Elf32_Ehdr::EI_OSABI] = ei_osabi; assert(2==get_te16(&h3->ehdr.e_phnum)); set_te16(&h3->ehdr.e_phnum, 3); assert(get_te32(&h3->ehdr.e_phoff) == sizeof(Elf32_Ehdr)); h3->ehdr.e_shoff = 0; assert(get_te16(&h3->ehdr.e_ehsize) == sizeof(Elf32_Ehdr)); assert(get_te16(&h3->ehdr.e_phentsize) == sizeof(Elf32_Phdr)); set_te16(&h3->ehdr.e_shentsize, sizeof(Elf32_Shdr)); h3->ehdr.e_shnum = 0; h3->ehdr.e_shstrndx = 0; struct { Elf32_Nhdr nhdr; char name[8]; unsigned body; } elfnote; unsigned const note_offset = sizeof(*h3) - sizeof(linfo); sz_elf_hdrs = sizeof(elfnote) + note_offset; set_te32(&h3->phdr[C_NOTE].p_type, PT_NOTE32); set_te32(&h3->phdr[C_NOTE].p_offset, note_offset); set_te32(&h3->phdr[C_NOTE].p_vaddr, note_offset); set_te32(&h3->phdr[C_NOTE].p_paddr, note_offset); set_te32(&h3->phdr[C_NOTE].p_filesz, sizeof(elfnote)); set_te32(&h3->phdr[C_NOTE].p_memsz, sizeof(elfnote)); set_te32(&h3->phdr[C_NOTE].p_flags, Elf32_Phdr::PF_R); set_te32(&h3->phdr[C_NOTE].p_align, 4); // Q: Same as this->note_body[0 .. this->note_size-1] ? set_te32(&elfnote.nhdr.namesz, 8); set_te32(&elfnote.nhdr.descsz, OPENBSD_DESCSZ); set_te32(&elfnote.nhdr.type, NHDR_OPENBSD_TAG); memcpy(elfnote.name, "OpenBSD", sizeof(elfnote.name)); elfnote.body = 0; set_te32(&h3->phdr[C_TEXT].p_filesz, sz_elf_hdrs); h3->phdr[C_TEXT].p_memsz = h3->phdr[C_TEXT].p_filesz; unsigned const brkb = brka | ((0==(~page_mask & brka)) ? 0x20 : 0); set_te32(&h3->phdr[C_BASE].p_type, PT_LOAD32); // be sure set_te32(&h3->phdr[C_BASE].p_offset, ~page_mask & brkb); set_te32(&h3->phdr[C_BASE].p_vaddr, brkb); set_te32(&h3->phdr[C_BASE].p_paddr, brkb); h3->phdr[C_BASE].p_filesz = 0; // Too many kernels have bugs when 0==.p_memsz set_te32(&h3->phdr[C_BASE].p_memsz, 1); set_te32(&h3->phdr[C_BASE].p_flags, Elf32_Phdr::PF_R | Elf32_Phdr::PF_W); if (ph.format==getFormat()) { memset(&h3->linfo, 0, sizeof(h3->linfo)); fo->write(h3, sizeof(*h3) - sizeof(h3->linfo)); fo->write(&elfnote, sizeof(elfnote)); fo->write(&h3->linfo, sizeof(h3->linfo)); } else { assert(false); // unknown ph.format, PackLinuxElf32 } }
0
403,691
static void xfrm_policy_fini(struct net *net) { unsigned int sz; int dir; flush_work(&net->xfrm.policy_hash_work); #ifdef CONFIG_XFRM_SUB_POLICY xfrm_policy_flush(net, XFRM_POLICY_TYPE_SUB, false); #endif xfrm_policy_flush(net, XFRM_POLICY_TYPE_MAIN, false); WARN_ON(!list_empty(&net->xfrm.policy_all)); for (dir = 0; dir < XFRM_POLICY_MAX; dir++) { struct xfrm_policy_hash *htab; WARN_ON(!hlist_empty(&net->xfrm.policy_inexact[dir])); htab = &net->xfrm.policy_bydst[dir]; sz = (htab->hmask + 1) * sizeof(struct hlist_head); WARN_ON(!hlist_empty(htab->table)); xfrm_hash_free(htab->table, sz); } sz = (net->xfrm.policy_idx_hmask + 1) * sizeof(struct hlist_head); WARN_ON(!hlist_empty(net->xfrm.policy_byidx)); xfrm_hash_free(net->xfrm.policy_byidx, sz); }
0
372,693
void CLASS lin_interpolate() { int code[16][16][32], size=16, *ip, sum[4]; int f, c, x, y, row, col, shift, color; #ifdef DCRAW_VERBOSE if (verbose) fprintf (stderr,_("Bilinear interpolation...\n")); #endif #ifdef LIBRAW_LIBRARY_BUILD RUN_CALLBACK(LIBRAW_PROGRESS_INTERPOLATE,0,3); #endif if (filters == 9) size = 6; border_interpolate(1); for (row=0; row < size; row++) for (col=0; col < size; col++) { ip = code[row][col]+1; f = fcol(row,col); memset (sum, 0, sizeof sum); for (y=-1; y <= 1; y++) for (x=-1; x <= 1; x++) { shift = (y==0) + (x==0); color = fcol(row+y,col+x); if (color == f) continue; *ip++ = (width*y + x)*4 + color; *ip++ = shift; *ip++ = color; sum[color] += 1 << shift; } code[row][col][0] = (ip - code[row][col]) / 3; FORCC if (c != f) { *ip++ = c; *ip++ = 256 / sum[c]; } } #ifdef LIBRAW_LIBRARY_BUILD RUN_CALLBACK(LIBRAW_PROGRESS_INTERPOLATE,1,3); #endif lin_interpolate_loop(code,size); #ifdef LIBRAW_LIBRARY_BUILD RUN_CALLBACK(LIBRAW_PROGRESS_INTERPOLATE,2,3); #endif }
0
122,402
int ethereum_message_verify(const EthereumVerifyMessage *msg) { if (msg->signature.size != 65 || msg->address.size != 20) { fsm_sendFailure(FailureType_Failure_SyntaxError, _("Malformed data")); return 1; } uint8_t pubkey[65]; uint8_t hash[32]; ethereum_message_hash(msg->message.bytes, msg->message.size, hash); /* v should be 27, 28 but some implementations use 0,1. We are * compatible with both. */ uint8_t v = msg->signature.bytes[64]; if (v >= 27) { v -= 27; } if (v >= 2 || ecdsa_recover_pub_from_sig( &secp256k1, pubkey, msg->signature.bytes, hash, v) != 0) { return 2; } struct SHA3_CTX ctx; sha3_256_Init(&ctx); sha3_Update(&ctx, pubkey + 1, 64); keccak_Final(&ctx, hash); /* result are the least significant 160 bits */ if (memcmp(msg->address.bytes, hash + 12, 20) != 0) { return 2; } return 0; }
0
120,973
INST_HANDLER (add) { // ADD Rd, Rr // LSL Rd int d = ((buf[0] >> 4) & 0xf) | ((buf[1] & 1) << 4); int r = (buf[0] & 0xf) | ((buf[1] & 2) << 3); ESIL_A ("r%d,r%d,+,", r, d); // Rd + Rr __generic_add_update_flags_rr(op, d, r); // FLAGS ESIL_A ("r%d,=,", d); // Rd = result }
0
326,428
static int get_cluster_duration(MOVTrack *track, int cluster_idx) { int64_t next_dts; if (cluster_idx >= track->entry) return 0; if (cluster_idx + 1 == track->entry) next_dts = track->track_duration + track->start_dts; else next_dts = track->cluster[cluster_idx + 1].dts; return next_dts - track->cluster[cluster_idx].dts; }
0
271,391
TEST_P(ConnectTerminationIntegrationTest, UpstreamClose) { initialize(); setUpConnection(); sendBidirectionalData(); // Tear down by closing the upstream connection. ASSERT_TRUE(fake_raw_upstream_connection_->close()); if (downstream_protocol_ == Http::CodecType::HTTP3) { // In HTTP/3 end stream will be sent when the upstream connection is closed, and // STOP_SENDING frame sent instead of reset. ASSERT_TRUE(response_->waitForEndStream()); } else { ASSERT_TRUE(response_->waitForReset()); } }
0
277,382
SandboxPolicyFuchsia::~SandboxPolicyFuchsia() { if (service_directory_) { service_directory_task_runner_->DeleteSoon(FROM_HERE, std::move(service_directory_)); } }
0
504,919
rsvg_filter_set_args (RsvgNode * self, RsvgHandle * ctx, RsvgPropertyBag * atts) { const char *value; RsvgFilter *filter; filter = (RsvgFilter *) self; if (rsvg_property_bag_size (atts)) { if ((value = rsvg_property_bag_lookup (atts, "filterUnits"))) { if (!strcmp (value, "userSpaceOnUse")) filter->filterunits = userSpaceOnUse; else filter->filterunits = objectBoundingBox; } if ((value = rsvg_property_bag_lookup (atts, "primitiveUnits"))) { if (!strcmp (value, "objectBoundingBox")) filter->primitiveunits = objectBoundingBox; else filter->primitiveunits = userSpaceOnUse; } if ((value = rsvg_property_bag_lookup (atts, "x"))) filter->x = _rsvg_css_parse_length (value); if ((value = rsvg_property_bag_lookup (atts, "y"))) filter->y = _rsvg_css_parse_length (value); if ((value = rsvg_property_bag_lookup (atts, "width"))) filter->width = _rsvg_css_parse_length (value); if ((value = rsvg_property_bag_lookup (atts, "height"))) filter->height = _rsvg_css_parse_length (value); if ((value = rsvg_property_bag_lookup (atts, "id"))) rsvg_defs_register_name (ctx->priv->defs, value, &filter->super); } }
0
241,863
void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped( const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped"); base::ScopedClosureRunner scoped_completion_runner( base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted, host_id_, params.route_id, params.surface_id, params.surface_handle, true, base::TimeTicks(), base::TimeDelta())); gfx::PluginWindowHandle handle = GpuSurfaceTracker::Get()->GetSurfaceWindowHandle(params.surface_id); if (!handle) { TRACE_EVENT1("gpu", "SurfaceIDNotFound_RoutingToUI", "surface_id", params.surface_id); #if defined(USE_AURA) scoped_completion_runner.Release(); RouteOnUIThread(GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params)); #endif return; } scoped_refptr<AcceleratedPresenter> presenter( AcceleratedPresenter::GetForWindow(handle)); if (!presenter) { TRACE_EVENT1("gpu", "EarlyOut_NativeWindowNotFound", "handle", handle); return; } scoped_completion_runner.Release(); presenter->AsyncPresentAndAcknowledge( params.size, params.surface_handle, base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted, host_id_, params.route_id, params.surface_id, params.surface_handle)); }
0
328,237
void qdev_prop_set_drive(DeviceState *dev, const char *name, BlockBackend *value, Error **errp) { object_property_set_str(OBJECT(dev), value ? blk_name(value) : "", name, errp); }
1
394,459
static void cli_connect_sock_done(struct tevent_req *subreq) { struct tevent_req *req = tevent_req_callback_data( subreq, struct tevent_req); struct cli_connect_sock_state *state = tevent_req_data( req, struct cli_connect_sock_state); NTSTATUS status; status = smbsock_any_connect_recv(subreq, &state->fd, NULL, &state->port); TALLOC_FREE(subreq); if (tevent_req_nterror(req, status)) { return; } set_socket_options(state->fd, lp_socket_options()); tevent_req_done(req); }
0
123,682
int btrfs_remove_chunk(struct btrfs_trans_handle *trans, u64 chunk_offset) { struct btrfs_fs_info *fs_info = trans->fs_info; struct extent_map *em; struct map_lookup *map; u64 dev_extent_len = 0; int i, ret = 0; struct btrfs_fs_devices *fs_devices = fs_info->fs_devices; em = btrfs_get_chunk_map(fs_info, chunk_offset, 1); if (IS_ERR(em)) { /* * This is a logic error, but we don't want to just rely on the * user having built with ASSERT enabled, so if ASSERT doesn't * do anything we still error out. */ ASSERT(0); return PTR_ERR(em); } map = em->map_lookup; /* * First delete the device extent items from the devices btree. * We take the device_list_mutex to avoid racing with the finishing phase * of a device replace operation. See the comment below before acquiring * fs_info->chunk_mutex. Note that here we do not acquire the chunk_mutex * because that can result in a deadlock when deleting the device extent * items from the devices btree - COWing an extent buffer from the btree * may result in allocating a new metadata chunk, which would attempt to * lock again fs_info->chunk_mutex. */ mutex_lock(&fs_devices->device_list_mutex); for (i = 0; i < map->num_stripes; i++) { struct btrfs_device *device = map->stripes[i].dev; ret = btrfs_free_dev_extent(trans, device, map->stripes[i].physical, &dev_extent_len); if (ret) { mutex_unlock(&fs_devices->device_list_mutex); btrfs_abort_transaction(trans, ret); goto out; } if (device->bytes_used > 0) { mutex_lock(&fs_info->chunk_mutex); btrfs_device_set_bytes_used(device, device->bytes_used - dev_extent_len); atomic64_add(dev_extent_len, &fs_info->free_chunk_space); btrfs_clear_space_info_full(fs_info); mutex_unlock(&fs_info->chunk_mutex); } } mutex_unlock(&fs_devices->device_list_mutex); /* * We acquire fs_info->chunk_mutex for 2 reasons: * * 1) Just like with the first phase of the chunk allocation, we must * reserve system space, do all chunk btree updates and deletions, and * update the system chunk array in the superblock while holding this * mutex. This is for similar reasons as explained on the comment at * the top of btrfs_chunk_alloc(); * * 2) Prevent races with the final phase of a device replace operation * that replaces the device object associated with the map's stripes, * because the device object's id can change at any time during that * final phase of the device replace operation * (dev-replace.c:btrfs_dev_replace_finishing()), so we could grab the * replaced device and then see it with an ID of * BTRFS_DEV_REPLACE_DEVID, which would cause a failure when updating * the device item, which does not exists on the chunk btree. * The finishing phase of device replace acquires both the * device_list_mutex and the chunk_mutex, in that order, so we are * safe by just acquiring the chunk_mutex. */ trans->removing_chunk = true; mutex_lock(&fs_info->chunk_mutex); check_system_chunk(trans, map->type); ret = remove_chunk_item(trans, map, chunk_offset); /* * Normally we should not get -ENOSPC since we reserved space before * through the call to check_system_chunk(). * * Despite our system space_info having enough free space, we may not * be able to allocate extents from its block groups, because all have * an incompatible profile, which will force us to allocate a new system * block group with the right profile, or right after we called * check_system_space() above, a scrub turned the only system block group * with enough free space into RO mode. * This is explained with more detail at do_chunk_alloc(). * * So if we get -ENOSPC, allocate a new system chunk and retry once. */ if (ret == -ENOSPC) { const u64 sys_flags = btrfs_system_alloc_profile(fs_info); struct btrfs_block_group *sys_bg; sys_bg = btrfs_alloc_chunk(trans, sys_flags); if (IS_ERR(sys_bg)) { ret = PTR_ERR(sys_bg); btrfs_abort_transaction(trans, ret); goto out; } ret = btrfs_chunk_alloc_add_chunk_item(trans, sys_bg); if (ret) { btrfs_abort_transaction(trans, ret); goto out; } ret = remove_chunk_item(trans, map, chunk_offset); if (ret) { btrfs_abort_transaction(trans, ret); goto out; } } else if (ret) { btrfs_abort_transaction(trans, ret); goto out; } trace_btrfs_chunk_free(fs_info, map, chunk_offset, em->len); if (map->type & BTRFS_BLOCK_GROUP_SYSTEM) { ret = btrfs_del_sys_chunk(fs_info, chunk_offset); if (ret) { btrfs_abort_transaction(trans, ret); goto out; } } mutex_unlock(&fs_info->chunk_mutex); trans->removing_chunk = false; /* * We are done with chunk btree updates and deletions, so release the * system space we previously reserved (with check_system_chunk()). */ btrfs_trans_release_chunk_metadata(trans); ret = btrfs_remove_block_group(trans, chunk_offset, em); if (ret) { btrfs_abort_transaction(trans, ret); goto out; } out: if (trans->removing_chunk) { mutex_unlock(&fs_info->chunk_mutex); trans->removing_chunk = false; } /* once for us */ free_extent_map(em); return ret; }
0
261,410
static void l2cap_sock_destruct(struct sock *sk) { BT_DBG("sk %p", sk); l2cap_chan_put(l2cap_pi(sk)->chan); if (l2cap_pi(sk)->rx_busy_skb) { kfree_skb(l2cap_pi(sk)->rx_busy_skb); l2cap_pi(sk)->rx_busy_skb = NULL; } skb_queue_purge(&sk->sk_receive_queue); skb_queue_purge(&sk->sk_write_queue); }
0
20,095
IN_PROC_BROWSER_TEST_F ( PageLoadMetricsBrowserTest , PayloadSizeChildFrame ) { ASSERT_TRUE ( embedded_test_server ( ) -> Start ( ) ) ; auto waiter = CreatePageLoadMetricsWaiter ( ) ; waiter -> AddPageExpectation ( TimingField : : LOAD_EVENT ) ; ui_test_utils : : NavigateToURL ( browser ( ) , embedded_test_server ( ) -> GetURL ( "/page_load_metrics/large_iframe.html" ) ) ; waiter -> Wait ( ) ; NavigateToUntrackedUrl ( ) ; histogram_tester_ . ExpectTotalCount ( internal : : kHistogramPageLoadTotalBytes , 1 ) ; histogram_tester_ . ExpectBucketCount ( internal : : kHistogramPageLoadTotalBytes , 10 , 1 ) ; }
0
357,746
unsigned long sock_i_ino(struct sock *sk) { unsigned long ino; read_lock(&sk->sk_callback_lock); ino = sk->sk_socket ? SOCK_INODE(sk->sk_socket)->i_ino : 0; read_unlock(&sk->sk_callback_lock); return ino; }
0
236,277
void Browser::OpenBookmarkManagerWindow(Profile* profile) { Browser* browser = Browser::Create(profile); browser->ShowBookmarkManagerTab(); browser->window()->Show(); }
0
43,313
load_dummy_buffer( char_u *fname, char_u *dirname_start, // in: old directory char_u *resulting_dir) // out: new directory { buf_T *newbuf; bufref_T newbufref; bufref_T newbuf_to_wipe; int failed = TRUE; aco_save_T aco; int readfile_result; // Allocate a buffer without putting it in the buffer list. newbuf = buflist_new(NULL, NULL, (linenr_T)1, BLN_DUMMY); if (newbuf == NULL) return NULL; set_bufref(&newbufref, newbuf); // Init the options. buf_copy_options(newbuf, BCO_ENTER | BCO_NOHELP); // need to open the memfile before putting the buffer in a window if (ml_open(newbuf) == OK) { // Make sure this buffer isn't wiped out by autocommands. ++newbuf->b_locked; // set curwin/curbuf to buf and save a few things aucmd_prepbuf(&aco, newbuf); // Need to set the filename for autocommands. (void)setfname(curbuf, fname, NULL, FALSE); // Create swap file now to avoid the ATTENTION message. check_need_swap(TRUE); // Remove the "dummy" flag, otherwise autocommands may not // work. curbuf->b_flags &= ~BF_DUMMY; newbuf_to_wipe.br_buf = NULL; readfile_result = readfile(fname, NULL, (linenr_T)0, (linenr_T)0, (linenr_T)MAXLNUM, NULL, READ_NEW | READ_DUMMY); --newbuf->b_locked; if (readfile_result == OK && !got_int && !(curbuf->b_flags & BF_NEW)) { failed = FALSE; if (curbuf != newbuf) { // Bloody autocommands changed the buffer! Can happen when // using netrw and editing a remote file. Use the current // buffer instead, delete the dummy one after restoring the // window stuff. set_bufref(&newbuf_to_wipe, newbuf); newbuf = curbuf; } } // restore curwin/curbuf and a few other things aucmd_restbuf(&aco); if (newbuf_to_wipe.br_buf != NULL && bufref_valid(&newbuf_to_wipe)) wipe_buffer(newbuf_to_wipe.br_buf, FALSE); // Add back the "dummy" flag, otherwise buflist_findname_stat() won't // skip it. newbuf->b_flags |= BF_DUMMY; } // When autocommands/'autochdir' option changed directory: go back. // Let the caller know what the resulting dir was first, in case it is // important. mch_dirname(resulting_dir, MAXPATHL); restore_start_dir(dirname_start); if (!bufref_valid(&newbufref)) return NULL; if (failed) { wipe_dummy_buffer(newbuf, dirname_start); return NULL; } return newbuf; }
0
285,456
static js_Ast *funexp(js_State *J) { js_Ast *a, *b, *c; a = identifieropt(J); jsP_expect(J, '('); b = parameters(J); jsP_expect(J, ')'); c = funbody(J); return EXP3(FUN, a, b, c); }
0
230,345
NavigatorServiceWorker* NavigatorServiceWorker::from(Document& document) { if (!document.frame() || !document.frame()->domWindow()) return nullptr; Navigator& navigator = *document.frame()->domWindow()->navigator(); return &from(navigator); }
0
315,506
void AudioOutputController::Close(Task* closed_task) { DCHECK(closed_task); DCHECK(message_loop_); message_loop_->PostTask( FROM_HERE, NewRunnableMethod(this, &AudioOutputController::DoClose, closed_task)); }
0