idx
int64
func
string
target
int64
211,090
add_mtab(char *devname, char *mountpoint, unsigned long flags, const char *fstype) { int rc = 0; uid_t uid; char *mount_user = NULL; struct mntent mountent; FILE *pmntfile; sigset_t mask, oldmask; uid = getuid(); if (uid != 0) mount_user = getusername(uid); /* * Set the real uid to the effective uid. This prevents unprivileged * users from sending signals to this process, though ^c on controlling * terminal should still work. */ rc = setreuid(geteuid(), -1); if (rc != 0) { fprintf(stderr, "Unable to set real uid to effective uid: %s\n", strerror(errno)); return EX_FILEIO; } rc = sigfillset(&mask); if (rc) { fprintf(stderr, "Unable to set filled signal mask\n"); return EX_FILEIO; } rc = sigprocmask(SIG_SETMASK, &mask, &oldmask); if (rc) { fprintf(stderr, "Unable to make process ignore signals\n"); return EX_FILEIO; } rc = toggle_dac_capability(1, 1); if (rc) return EX_FILEIO; atexit(unlock_mtab); rc = lock_mtab(); if (rc) { fprintf(stderr, "cannot lock mtab"); rc = EX_FILEIO; goto add_mtab_exit; } pmntfile = setmntent(MOUNTED, "a+"); if (!pmntfile) { fprintf(stderr, "could not update mount table\n"); unlock_mtab(); rc = EX_FILEIO; goto add_mtab_exit; } mountent.mnt_fsname = devname; mountent.mnt_dir = mountpoint; mountent.mnt_type = (char *)(void *)fstype; mountent.mnt_opts = (char *)calloc(MTAB_OPTIONS_LEN, 1); if (mountent.mnt_opts) { if (flags & MS_RDONLY) strlcat(mountent.mnt_opts, "ro", MTAB_OPTIONS_LEN); else strlcat(mountent.mnt_opts, "rw", MTAB_OPTIONS_LEN); if (flags & MS_MANDLOCK) strlcat(mountent.mnt_opts, ",mand", MTAB_OPTIONS_LEN); if (flags & MS_NOEXEC) strlcat(mountent.mnt_opts, ",noexec", MTAB_OPTIONS_LEN); if (flags & MS_NOSUID) strlcat(mountent.mnt_opts, ",nosuid", MTAB_OPTIONS_LEN); if (flags & MS_NODEV) strlcat(mountent.mnt_opts, ",nodev", MTAB_OPTIONS_LEN); if (flags & MS_SYNCHRONOUS) strlcat(mountent.mnt_opts, ",sync", MTAB_OPTIONS_LEN); if (mount_user) { strlcat(mountent.mnt_opts, ",user=", MTAB_OPTIONS_LEN); strlcat(mountent.mnt_opts, mount_user, MTAB_OPTIONS_LEN); } } mountent.mnt_freq = 0; mountent.mnt_passno = 0; rc = addmntent(pmntfile, &mountent); if (rc) { fprintf(stderr, "unable to add mount entry to mtab\n"); rc = EX_FILEIO; } endmntent(pmntfile); unlock_mtab(); SAFE_FREE(mountent.mnt_opts); add_mtab_exit: toggle_dac_capability(1, 0); sigprocmask(SIG_SETMASK, &oldmask, NULL); return rc; }
1
210,284
vhost_user_get_inflight_fd(struct virtio_net **pdev, struct vhu_msg_context *ctx, int main_fd __rte_unused) { struct rte_vhost_inflight_info_packed *inflight_packed; uint64_t pervq_inflight_size, mmap_size; uint16_t num_queues, queue_size; struct virtio_net *dev = *pdev; int fd, i, j; int numa_node = SOCKET_ID_ANY; void *addr; if (ctx->msg.size != sizeof(ctx->msg.payload.inflight)) { VHOST_LOG_CONFIG(ERR, "(%s) invalid get_inflight_fd message size is %d\n", dev->ifname, ctx->msg.size); return RTE_VHOST_MSG_RESULT_ERR; } /* * If VQ 0 has already been allocated, try to allocate on the same * NUMA node. It can be reallocated later in numa_realloc(). */ if (dev->nr_vring > 0) numa_node = dev->virtqueue[0]->numa_node; if (dev->inflight_info == NULL) { dev->inflight_info = rte_zmalloc_socket("inflight_info", sizeof(struct inflight_mem_info), 0, numa_node); if (!dev->inflight_info) { VHOST_LOG_CONFIG(ERR, "(%s) failed to alloc dev inflight area\n", dev->ifname); return RTE_VHOST_MSG_RESULT_ERR; } dev->inflight_info->fd = -1; } num_queues = ctx->msg.payload.inflight.num_queues; queue_size = ctx->msg.payload.inflight.queue_size; VHOST_LOG_CONFIG(INFO, "(%s) get_inflight_fd num_queues: %u\n", dev->ifname, ctx->msg.payload.inflight.num_queues); VHOST_LOG_CONFIG(INFO, "(%s) get_inflight_fd queue_size: %u\n", dev->ifname, ctx->msg.payload.inflight.queue_size); if (vq_is_packed(dev)) pervq_inflight_size = get_pervq_shm_size_packed(queue_size); else pervq_inflight_size = get_pervq_shm_size_split(queue_size); mmap_size = num_queues * pervq_inflight_size; addr = inflight_mem_alloc(dev, "vhost-inflight", mmap_size, &fd); if (!addr) { VHOST_LOG_CONFIG(ERR, "(%s) failed to alloc vhost inflight area\n", dev->ifname); ctx->msg.payload.inflight.mmap_size = 0; return RTE_VHOST_MSG_RESULT_ERR; } memset(addr, 0, mmap_size); if (dev->inflight_info->addr) { munmap(dev->inflight_info->addr, dev->inflight_info->size); dev->inflight_info->addr = NULL; } if (dev->inflight_info->fd >= 0) { close(dev->inflight_info->fd); dev->inflight_info->fd = -1; } dev->inflight_info->addr = addr; dev->inflight_info->size = ctx->msg.payload.inflight.mmap_size = mmap_size; dev->inflight_info->fd = ctx->fds[0] = fd; ctx->msg.payload.inflight.mmap_offset = 0; ctx->fd_num = 1; if (vq_is_packed(dev)) { for (i = 0; i < num_queues; i++) { inflight_packed = (struct rte_vhost_inflight_info_packed *)addr; inflight_packed->used_wrap_counter = 1; inflight_packed->old_used_wrap_counter = 1; for (j = 0; j < queue_size; j++) inflight_packed->desc[j].next = j + 1; addr = (void *)((char *)addr + pervq_inflight_size); } } VHOST_LOG_CONFIG(INFO, "(%s) send inflight mmap_size: %"PRIu64"\n", dev->ifname, ctx->msg.payload.inflight.mmap_size); VHOST_LOG_CONFIG(INFO, "(%s) send inflight mmap_offset: %"PRIu64"\n", dev->ifname, ctx->msg.payload.inflight.mmap_offset); VHOST_LOG_CONFIG(INFO, "(%s) send inflight fd: %d\n", dev->ifname, ctx->fds[0]); return RTE_VHOST_MSG_RESULT_REPLY; }
1
307,832
ciInstance* ciEnv::the_min_jint_string() { if (_the_min_jint_string == NULL) { VM_ENTRY_MARK; _the_min_jint_string = get_object(Universe::the_min_jint_string())->as_instance(); } return _the_min_jint_string; }
0
195,055
void Compute(OpKernelContext* context) override { const Tensor& indices = context->input(0); const Tensor& values = context->input(1); const Tensor& shape = context->input(2); const Tensor& weights = context->input(3); bool use_weights = weights.NumElements() > 0; OP_REQUIRES(context, TensorShapeUtils::IsMatrix(indices.shape()), errors::InvalidArgument( "Input indices must be a 2-dimensional tensor. Got: ", indices.shape().DebugString())); if (use_weights) { OP_REQUIRES( context, weights.shape() == values.shape(), errors::InvalidArgument( "Weights and values must have the same shape. Weight shape: ", weights.shape().DebugString(), "; values shape: ", values.shape().DebugString())); } OP_REQUIRES(context, shape.NumElements() != 0, errors::InvalidArgument( "The shape argument requires at least one element.")); bool is_1d = shape.NumElements() == 1; auto shape_vector = shape.flat<int64_t>(); int num_batches = is_1d ? 1 : shape_vector(0); int num_values = values.NumElements(); for (int b = 0; b < shape_vector.size(); b++) { OP_REQUIRES(context, shape_vector(b) >= 0, errors::InvalidArgument( "Elements in dense_shape must be >= 0. Instead got:", shape.DebugString())); } OP_REQUIRES(context, num_values == indices.shape().dim_size(0), errors::InvalidArgument( "Number of values must match first dimension of indices.", "Got ", num_values, " values, indices shape: ", indices.shape().DebugString())); const auto indices_values = indices.matrix<int64_t>(); const auto values_values = values.flat<T>(); const auto weight_values = weights.flat<W>(); auto per_batch_counts = BatchedMap<W>(num_batches); T max_value = 0; OP_REQUIRES(context, num_values <= indices.shape().dim_size(0), errors::InvalidArgument( "The first dimension of indices must be equal to or " "greather than number of values. ( ", indices.shape().dim_size(0), " vs. ", num_values, " )")); OP_REQUIRES(context, indices.shape().dim_size(1) > 0, errors::InvalidArgument("The second dimension of indices must " "be greater than 0. Received: ", indices.shape().dim_size(1))); for (int idx = 0; idx < num_values; ++idx) { int batch = is_1d ? 0 : indices_values(idx, 0); if (batch >= num_batches) { OP_REQUIRES(context, batch < num_batches, errors::InvalidArgument( "Indices value along the first dimension must be ", "lower than the first index of the shape.", "Got ", batch, " as batch and ", num_batches, " as the first dimension of the shape.")); } const auto& value = values_values(idx); if (value >= 0 && (maxlength_ <= 0 || value < maxlength_)) { if (binary_output_) { per_batch_counts[batch][value] = 1; } else if (use_weights) { per_batch_counts[batch][value] += weight_values(idx); } else { per_batch_counts[batch][value]++; } if (value > max_value) { max_value = value; } } } int num_output_values = GetOutputSize(max_value, maxlength_, minlength_); OP_REQUIRES_OK(context, OutputSparse<W>(per_batch_counts, num_output_values, is_1d, context)); }
1
253,982
static int vidioc_querybuf(struct file *file, void *fh, struct v4l2_buffer *b) { enum v4l2_buf_type type; int index; struct v4l2_loopback_device *dev; struct v4l2_loopback_opener *opener; MARK(); type = b->type; index = b->index; dev = v4l2loopback_getdevice(file); opener = file->private_data; if ((b->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) && (b->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)) { return -EINVAL; } if (b->index > max_buffers) return -EINVAL; if (opener->timeout_image_io) *b = dev->timeout_image_buffer.buffer; else *b = dev->buffers[b->index % dev->used_buffers].buffer; b->type = type; b->index = index; dprintkrw("buffer type: %d (of %d with size=%ld)\n", b->memory, dev->buffers_number, dev->buffer_size); /* Hopefully fix 'DQBUF return bad index if queue bigger then 2 for capture' https://github.com/umlaeute/v4l2loopback/issues/60 */ b->flags &= ~V4L2_BUF_FLAG_DONE; b->flags |= V4L2_BUF_FLAG_QUEUED; return 0; }
0
318,972
f_test_void(typval_T *argvars UNUSED, typval_T *rettv) { rettv->v_type = VAR_VOID; }
0
269,500
static tmsize_t TIFFWritePixels(TIFF *tiff,TIFFInfo *tiff_info,ssize_t row, tsample_t sample,Image *image) { ssize_t i; tmsize_t status; size_t number_tiles, tile_width; ssize_t bytes_per_pixel, j, k, l; unsigned char *p, *q; if (TIFFIsTiled(tiff) == 0) return(TIFFWriteScanline(tiff,tiff_info->scanline,(uint32) row,sample)); /* Fill scanlines to tile height. */ i=(ssize_t) (row % tiff_info->tile_geometry.height)*TIFFScanlineSize(tiff); (void) memcpy(tiff_info->scanlines+i,(char *) tiff_info->scanline, (size_t) TIFFScanlineSize(tiff)); if (((size_t) (row % tiff_info->tile_geometry.height) != (tiff_info->tile_geometry.height-1)) && (row != (ssize_t) (image->rows-1))) return(0); /* Write tile to TIFF image. */ status=0; bytes_per_pixel=TIFFTileSize(tiff)/(ssize_t) ( tiff_info->tile_geometry.height*tiff_info->tile_geometry.width); number_tiles=(image->columns+tiff_info->tile_geometry.width)/ tiff_info->tile_geometry.width; for (i=0; i < (ssize_t) number_tiles; i++) { tile_width=(i == (ssize_t) (number_tiles-1)) ? image->columns-(i* tiff_info->tile_geometry.width) : tiff_info->tile_geometry.width; for (j=0; j < (ssize_t) ((row % tiff_info->tile_geometry.height)+1); j++) for (k=0; k < (ssize_t) tile_width; k++) { if (bytes_per_pixel == 0) { p=tiff_info->scanlines+(j*TIFFScanlineSize(tiff)+(i* tiff_info->tile_geometry.width+k)/8); q=tiff_info->pixels+(j*TIFFTileRowSize(tiff)+k/8); *q++=(*p++); continue; } p=tiff_info->scanlines+(j*TIFFScanlineSize(tiff)+(i* tiff_info->tile_geometry.width+k)*bytes_per_pixel); q=tiff_info->pixels+(j*TIFFTileRowSize(tiff)+k*bytes_per_pixel); for (l=0; l < bytes_per_pixel; l++) *q++=(*p++); } if ((i*tiff_info->tile_geometry.width) != image->columns) status=TIFFWriteTile(tiff,tiff_info->pixels,(uint32) (i* tiff_info->tile_geometry.width),(uint32) ((row/ tiff_info->tile_geometry.height)*tiff_info->tile_geometry.height),0, sample); if (status < 0) break; } return(status); }
0
413,855
Method* LinkResolver::resolve_static_call_or_null(const LinkInfo& link_info) { EXCEPTION_MARK; CallInfo info; resolve_static_call(info, link_info, /*initialize_class*/false, THREAD); if (HAS_PENDING_EXCEPTION) { CLEAR_PENDING_EXCEPTION; return NULL; } return info.selected_method(); }
0
401,538
static void numa_crng_init(void) {}
0
226,288
GF_Err drep_box_write(GF_Box *s, GF_BitStream *bs) { GF_Err e; GF_DREPBox *ptr = (GF_DREPBox *)s; if (ptr == NULL) return GF_BAD_PARAM; e = gf_isom_box_write_header(s, bs); if (e) return e; gf_bs_write_u64(bs, ptr->nbBytes); return GF_OK; }
0
482,647
static inline const char *xt_inname(const struct xt_action_param *par) { return par->state->in->name; }
0
359,563
zlog_set_file (struct zlog *zl, const char *filename, int log_level) { FILE *fp; mode_t oldumask; /* There is opend file. */ zlog_reset_file (zl); /* Set default zl. */ if (zl == NULL) zl = zlog_default; /* Open file. */ oldumask = umask (0777 & ~LOGFILE_MASK); fp = fopen (filename, "a"); umask(oldumask); if (fp == NULL) return 0; /* Set flags. */ zl->filename = strdup (filename); zl->maxlvl[ZLOG_DEST_FILE] = log_level; zl->fp = fp; logfile_fd = fileno(fp); return 1; }
0
233,888
*/ PS_SERIALIZER_DECODE_FUNC(wddx) { zval retval; zval *ent; zend_string *key; zend_ulong idx; int ret; if (vallen == 0) { return SUCCESS; } ZVAL_UNDEF(&retval); if ((ret = php_wddx_deserialize_ex(val, vallen, &retval)) == SUCCESS) { if (Z_TYPE(retval) != IS_ARRAY) { zval_dtor(&retval); return FAILURE; } ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL(retval), idx, key, ent) { if (key == NULL) { key = zend_long_to_str(idx); } else { zend_string_addref(key); } if (php_set_session_var(key, ent, NULL)) { if (Z_REFCOUNTED_P(ent)) Z_ADDREF_P(ent); } PS_ADD_VAR(key); zend_string_release(key); } ZEND_HASH_FOREACH_END(); } zval_ptr_dtor(&retval); return ret;
0
427,722
cdf_namecmp(const char *d, const uint16_t *s, size_t l) { for (; l--; d++, s++) if (*d != CDF_TOLE2(*s)) return CAST(unsigned char, *d) - CDF_TOLE2(*s); return 0; }
0
513,036
virtual longlong val_int_signed_typecast() { return cast_to_int_type_handler()->Item_val_int_signed_typecast(this); }
0
218,742
static HENHMETAFILE ReadEnhMetaFile(const char *path,ssize_t *width, ssize_t *height) { #pragma pack( push, 2 ) typedef struct { DWORD dwKey; WORD hmf; SMALL_RECT bbox; WORD wInch; DWORD dwReserved; WORD wCheckSum; } APMHEADER, *PAPMHEADER; #pragma pack( pop ) DWORD dwSize; ENHMETAHEADER emfh; HANDLE hFile; HDC hDC; HENHMETAFILE hTemp; LPBYTE pBits; METAFILEPICT mp; HMETAFILE hOld; *width=512; *height=512; hTemp=GetEnhMetaFile(path); #if defined(MAGICKCORE_HAVE__WFOPEN) if (hTemp == (HENHMETAFILE) NULL) { wchar_t *unicode_path; unicode_path=ConvertUTF8ToUTF16((const unsigned char *) path); if (unicode_path != (wchar_t *) NULL) { hTemp=GetEnhMetaFileW(unicode_path); unicode_path=(wchar_t *) RelinquishMagickMemory(unicode_path); } } #endif if (hTemp != (HENHMETAFILE) NULL) { /* Enhanced metafile. */ GetEnhMetaFileHeader(hTemp,sizeof(ENHMETAHEADER),&emfh); *width=emfh.rclFrame.right-emfh.rclFrame.left; *height=emfh.rclFrame.bottom-emfh.rclFrame.top; return(hTemp); } hOld=GetMetaFile(path); if (hOld != (HMETAFILE) NULL) { /* 16bit windows metafile. */ dwSize=GetMetaFileBitsEx(hOld,0,NULL); if (dwSize == 0) { DeleteMetaFile(hOld); return((HENHMETAFILE) NULL); } pBits=(LPBYTE) AcquireQuantumMemory(dwSize,sizeof(*pBits)); if (pBits == (LPBYTE) NULL) { DeleteMetaFile(hOld); return((HENHMETAFILE) NULL); } if (GetMetaFileBitsEx(hOld,dwSize,pBits) == 0) { pBits=(BYTE *) DestroyString((char *) pBits); DeleteMetaFile(hOld); return((HENHMETAFILE) NULL); } /* Make an enhanced metafile from the windows metafile. */ mp.mm=MM_ANISOTROPIC; mp.xExt=1000; mp.yExt=1000; mp.hMF=NULL; hDC=GetDC(NULL); hTemp=SetWinMetaFileBits(dwSize,pBits,hDC,&mp); ReleaseDC(NULL,hDC); DeleteMetaFile(hOld); pBits=(BYTE *) DestroyString((char *) pBits); GetEnhMetaFileHeader(hTemp,sizeof(ENHMETAHEADER),&emfh); *width=emfh.rclFrame.right-emfh.rclFrame.left; *height=emfh.rclFrame.bottom-emfh.rclFrame.top; return(hTemp); } /* Aldus Placeable metafile. */ hFile=CreateFile(path,GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) return(NULL); dwSize=GetFileSize(hFile,NULL); pBits=(LPBYTE) AcquireQuantumMemory(dwSize,sizeof(*pBits)); if (pBits == (LPBYTE) NULL) { CloseHandle(hFile); return((HENHMETAFILE) NULL); } ReadFile(hFile,pBits,dwSize,&dwSize,NULL); CloseHandle(hFile); if (((PAPMHEADER) pBits)->dwKey != 0x9ac6cdd7l || (((PAPMHEADER) pBits)->wInch == 0)) { pBits=(BYTE *) DestroyString((char *) pBits); return((HENHMETAFILE) NULL); } /* Make an enhanced metafile from the placable metafile. */ mp.mm=MM_ANISOTROPIC; mp.xExt=((PAPMHEADER) pBits)->bbox.Right-((PAPMHEADER) pBits)->bbox.Left; *width=mp.xExt; mp.xExt=(mp.xExt*2540l)/(DWORD) (((PAPMHEADER) pBits)->wInch); mp.yExt=((PAPMHEADER)pBits)->bbox.Bottom-((PAPMHEADER) pBits)->bbox.Top; *height=mp.yExt; mp.yExt=(mp.yExt*2540l)/(DWORD) (((PAPMHEADER) pBits)->wInch); mp.hMF=NULL; hDC=GetDC(NULL); hTemp=SetWinMetaFileBits(dwSize,&(pBits[sizeof(APMHEADER)]),hDC,&mp); ReleaseDC(NULL,hDC); pBits=(BYTE *) DestroyString((char *) pBits); return(hTemp); }
0
387,830
bool InstanceKlass::link_class_or_fail(TRAPS) { assert(is_loaded(), "must be loaded"); if (!is_linked()) { link_class_impl(false, CHECK_false); } return is_linked(); }
0
90,163
static void NetworkStatusChangedHandler(void* object, const char* path, const char* key, const Value* value) { NetworkLibraryImpl* networklib = static_cast<NetworkLibraryImpl*>(object); DCHECK(networklib); networklib->UpdateNetworkStatus(path, key, value); }
0
379,663
R_API RAnalVarAccess *r_anal_var_get_access_at(RAnalVar *var, ut64 addr) { r_return_val_if_fail (var, NULL); st64 offset = addr - var->fcn->addr; size_t index; r_vector_lower_bound (&var->accesses, offset, index, ACCESS_CMP); if (index >= var->accesses.len) { return NULL; } RAnalVarAccess *acc = r_vector_index_ptr (&var->accesses, index); if (acc->offset == offset) { return acc; } return NULL; }
0
462,235
static void* clone_msgint_attr(pj_pool_t *pool, const void *src) { pj_stun_msgint_attr *dst = PJ_POOL_ALLOC_T(pool, pj_stun_msgint_attr); pj_memcpy(dst, src, sizeof(pj_stun_msgint_attr)); return (void*) dst; }
0
474,443
ObjectCreateHashSequence( TPMI_ALG_HASH hashAlg, // IN: hash algorithm TPM2B_AUTH *auth, // IN: authValue TPMI_DH_OBJECT *newHandle // OUT: sequence object handle ) { HASH_OBJECT *hashObject = AllocateSequenceSlot(newHandle, auth); // See if slot allocated if(hashObject == NULL) return TPM_RC_OBJECT_MEMORY; // Set hash sequence bit hashObject->attributes.hashSeq = SET; // Start hash for hash sequence CryptHashStart(&hashObject->state.hashState[0], hashAlg); return TPM_RC_SUCCESS; }
0
232,840
void Compute(OpKernelContext* context) override { core::RefCountPtr<QuantileStreamResource> streams_resource; // Create a reference to the underlying resource using the handle. OP_REQUIRES_OK(context, LookupResource(context, HandleFromInput(context, 0), &streams_resource)); // Remove the reference at the end of this scope. mutex_lock l(*streams_resource->mutex()); OpInputList bucket_boundaries_list; OP_REQUIRES_OK(context, context->input_list(kBucketBoundariesName, &bucket_boundaries_list)); auto do_quantile_deserialize = [&](const int64_t begin, const int64_t end) { // Iterating over all streams. for (int64_t stream_idx = begin; stream_idx < end; stream_idx++) { const Tensor& bucket_boundaries_t = bucket_boundaries_list[stream_idx]; const auto& bucket_boundaries = bucket_boundaries_t.vec<float>(); std::vector<float> result; result.reserve(bucket_boundaries.size()); for (size_t i = 0; i < bucket_boundaries.size(); ++i) { result.push_back(bucket_boundaries(i)); } streams_resource->set_boundaries(result, stream_idx); } }; // TODO(tanzheny): comment on the magic number. const int64_t kCostPerUnit = 500 * num_features_; const DeviceBase::CpuWorkerThreads& worker_threads = *context->device()->tensorflow_cpu_worker_threads(); Shard(worker_threads.num_threads, worker_threads.workers, num_features_, kCostPerUnit, do_quantile_deserialize); }
0
225,766
GF_Err xtra_box_read(GF_Box *s, GF_BitStream *bs) { GF_XtraBox *ptr = (GF_XtraBox *)s; while (ptr->size) { GF_XtraTag *tag; u32 prop_type = 0; char *data=NULL, *data2=NULL; ISOM_DECREASE_SIZE_NO_ERR(ptr, 8) s32 tag_size = gf_bs_read_u32(bs); u32 name_size = gf_bs_read_u32(bs); if (tag_size < 8) return GF_ISOM_INVALID_FILE; tag_size -= 8; if ((tag_size>ptr->size) || (name_size>ptr->size)) { return GF_ISOM_INVALID_FILE; } ISOM_DECREASE_SIZE_NO_ERR(ptr, 10) ISOM_DECREASE_SIZE_NO_ERR(ptr, name_size) data = gf_malloc(sizeof(char) * (name_size+1)); gf_bs_read_data(bs, data, name_size); data[name_size] = 0; tag_size-=name_size; u32 flags = gf_bs_read_u32(bs); u32 prop_size = gf_bs_read_u32(bs); tag_size-=8; if (prop_size>4) { tag_size-=2; prop_type = gf_bs_read_u16(bs); prop_size -= 6; ISOM_DECREASE_SIZE_NO_ERR(ptr, prop_size) data2 = gf_malloc(sizeof(char) * (prop_size)); gf_bs_read_data(bs, data2, prop_size); tag_size-=prop_size; } else { prop_size = 0; } GF_SAFEALLOC(tag, GF_XtraTag) tag->flags = flags; tag->name = data; tag->prop_size = prop_size; tag->prop_value = data2; tag->prop_type = prop_type; gf_list_add(ptr->tags, tag); if (tag_size) { GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, ("[isom] invalid tag size in Xtra !\n")); } } return GF_OK;
0
279,939
do_bang( int addr_count, exarg_T *eap, int forceit, int do_in, int do_out) { char_u *arg = eap->arg; // command linenr_T line1 = eap->line1; // start of range linenr_T line2 = eap->line2; // end of range char_u *newcmd = NULL; // the new command int free_newcmd = FALSE; // need to free() newcmd int ins_prevcmd; char_u *t; char_u *p; char_u *trailarg; int len; int scroll_save = msg_scroll; /* * Disallow shell commands for "rvim". * Disallow shell commands from .exrc and .vimrc in current directory for * security reasons. */ if (check_restricted() || check_secure()) return; if (addr_count == 0) // :! { msg_scroll = FALSE; // don't scroll here autowrite_all(); msg_scroll = scroll_save; } /* * Try to find an embedded bang, like in :!<cmd> ! [args] * (:!! is indicated by the 'forceit' variable) */ ins_prevcmd = forceit; trailarg = arg; do { len = (int)STRLEN(trailarg) + 1; if (newcmd != NULL) len += (int)STRLEN(newcmd); if (ins_prevcmd) { if (prevcmd == NULL) { emsg(_(e_no_previous_command)); vim_free(newcmd); return; } len += (int)STRLEN(prevcmd); } if ((t = alloc(len)) == NULL) { vim_free(newcmd); return; } *t = NUL; if (newcmd != NULL) STRCAT(t, newcmd); if (ins_prevcmd) STRCAT(t, prevcmd); p = t + STRLEN(t); STRCAT(t, trailarg); vim_free(newcmd); newcmd = t; /* * Scan the rest of the argument for '!', which is replaced by the * previous command. "\!" is replaced by "!" (this is vi compatible). */ trailarg = NULL; while (*p) { if (*p == '!') { if (p > newcmd && p[-1] == '\\') STRMOVE(p - 1, p); else { trailarg = p; *trailarg++ = NUL; ins_prevcmd = TRUE; break; } } ++p; } } while (trailarg != NULL); vim_free(prevcmd); prevcmd = newcmd; if (bangredo) // put cmd in redo buffer for ! command { // If % or # appears in the command, it must have been escaped. // Reescape them, so that redoing them does not substitute them by the // buffername. char_u *cmd = vim_strsave_escaped(prevcmd, (char_u *)"%#"); if (cmd != NULL) { AppendToRedobuffLit(cmd, -1); vim_free(cmd); } else AppendToRedobuffLit(prevcmd, -1); AppendToRedobuff((char_u *)"\n"); bangredo = FALSE; } /* * Add quotes around the command, for shells that need them. */ if (*p_shq != NUL) { newcmd = alloc(STRLEN(prevcmd) + 2 * STRLEN(p_shq) + 1); if (newcmd == NULL) return; STRCPY(newcmd, p_shq); STRCAT(newcmd, prevcmd); STRCAT(newcmd, p_shq); free_newcmd = TRUE; } if (addr_count == 0) // :! { // echo the command msg_start(); msg_putchar(':'); msg_putchar('!'); msg_outtrans(newcmd); msg_clr_eos(); windgoto(msg_row, msg_col); do_shell(newcmd, 0); } else // :range! { // Careful: This may recursively call do_bang() again! (because of // autocommands) do_filter(line1, line2, eap, newcmd, do_in, do_out); apply_autocmds(EVENT_SHELLFILTERPOST, NULL, NULL, FALSE, curbuf); } if (free_newcmd) vim_free(newcmd); }
0
369,234
static bool need_read_all(struct io_kiocb *req) { return req->flags & REQ_F_ISREG || S_ISBLK(file_inode(req->file)->i_mode); }
0
503,880
SCM_DEFINE (scm_close, "close", 1, 0, 0, (SCM fd_or_port), "Similar to close-port (@pxref{Closing, close-port}),\n" "but also works on file descriptors. A side\n" "effect of closing a file descriptor is that any ports using that file\n" "descriptor are moved to a different file descriptor and have\n" "their revealed counts set to zero.") #define FUNC_NAME s_scm_close { int rv; int fd; fd_or_port = SCM_COERCE_OUTPORT (fd_or_port); if (SCM_PORTP (fd_or_port)) return scm_close_port (fd_or_port); fd = scm_to_int (fd_or_port); scm_evict_ports (fd); /* see scsh manual. */ SCM_SYSCALL (rv = close (fd)); /* following scsh, closing an already closed file descriptor is not an error. */ if (rv < 0 && errno != EBADF) SCM_SYSERROR; return scm_from_bool (rv >= 0); }
0
462,577
void controller::enqueue_items(std::shared_ptr<rss_feed> feed) { if (!cfg.get_configvalue_as_bool("podcast-auto-enqueue")) return; std::lock_guard<std::mutex> lock(feed->item_mutex); for (auto item : feed->items()) { if (!item->enqueued() && item->enclosure_url().length() > 0) { LOG(level::DEBUG, "controller::enqueue_items: enclosure_url = `%s' enclosure_type = `%s'", item->enclosure_url(), item->enclosure_type()); if (is_valid_podcast_type(item->enclosure_type()) && utils::is_http_url(item->enclosure_url())) { LOG(level::INFO, "controller::enqueue_items: enqueuing `%s'", item->enclosure_url()); enqueue_url(item->enclosure_url(), feed); item->set_enqueued(true); rsscache->update_rssitem_unread_and_enqueued(item, feed->rssurl()); } } } }
0
359,199
BPF_CALL_2(bpf_ringbuf_query, struct bpf_map *, map, u64, flags) { struct bpf_ringbuf *rb; rb = container_of(map, struct bpf_ringbuf_map, map)->rb; switch (flags) { case BPF_RB_AVAIL_DATA: return ringbuf_avail_data_sz(rb); case BPF_RB_RING_SIZE: return rb->mask + 1; case BPF_RB_CONS_POS: return smp_load_acquire(&rb->consumer_pos); case BPF_RB_PROD_POS: return smp_load_acquire(&rb->producer_pos); default: return 0; } }
0
234,801
static struct btrfs_super_block *btrfs_read_disk_super(struct block_device *bdev, u64 bytenr, u64 bytenr_orig) { struct btrfs_super_block *disk_super; struct page *page; void *p; pgoff_t index; /* make sure our super fits in the device */ if (bytenr + PAGE_SIZE >= i_size_read(bdev->bd_inode)) return ERR_PTR(-EINVAL); /* make sure our super fits in the page */ if (sizeof(*disk_super) > PAGE_SIZE) return ERR_PTR(-EINVAL); /* make sure our super doesn't straddle pages on disk */ index = bytenr >> PAGE_SHIFT; if ((bytenr + sizeof(*disk_super) - 1) >> PAGE_SHIFT != index) return ERR_PTR(-EINVAL); /* pull in the page with our super */ page = read_cache_page_gfp(bdev->bd_inode->i_mapping, index, GFP_KERNEL); if (IS_ERR(page)) return ERR_CAST(page); p = page_address(page); /* align our pointer to the offset of the super block */ disk_super = p + offset_in_page(bytenr); if (btrfs_super_bytenr(disk_super) != bytenr_orig || btrfs_super_magic(disk_super) != BTRFS_MAGIC) { btrfs_release_disk_super(p); return ERR_PTR(-EINVAL); } if (disk_super->label[0] && disk_super->label[BTRFS_LABEL_SIZE - 1]) disk_super->label[BTRFS_LABEL_SIZE - 1] = 0; return disk_super; }
0
402,601
find_named_certificate(cms_context *cms, char *name, CERTCertificate **cert) { if (!name) { cms->log(cms, LOG_ERR, "no certificate name specified"); return -1; } PK11_SetPasswordFunc(cms->func ? cms->func : SECU_GetModulePassword); PK11SlotList *slots = NULL; slots = PK11_GetAllTokens(CKM_RSA_PKCS, PR_FALSE, PR_TRUE, cms); if (!slots) cmsreterr(-1, cms, "could not get pk11 token list"); PK11SlotListElement *psle = NULL; psle = PK11_GetFirstSafe(slots); if (!psle) { save_port_err() { PK11_FreeSlotList(slots); } cmsreterr(-1, cms, "could not get pk11 safe"); } while (psle) { if (!strcmp(cms->tokenname, PK11_GetTokenName(psle->slot))) break; psle = PK11_GetNextSafe(slots, psle, PR_FALSE); } if (!psle) { save_port_err() { PK11_FreeSlotList(slots); cms->log(cms, LOG_ERR, "could not find token \"%s\"", cms->tokenname); } return -1; } SECStatus status; if (PK11_NeedLogin(psle->slot) && !PK11_IsLoggedIn(psle->slot, cms)) { status = PK11_Authenticate(psle->slot, PR_TRUE, cms); if (status != SECSuccess) { save_port_err() { PK11_DestroySlotListElement(slots, &psle); PK11_FreeSlotList(slots); cms->log(cms, LOG_ERR, "authentication failed for token \"%s\"", cms->tokenname); } return -1; } } CERTCertList *certlist = NULL; certlist = PK11_ListCertsInSlot(psle->slot); if (!certlist) { save_port_err() { PK11_DestroySlotListElement(slots, &psle); PK11_FreeSlotList(slots); } cmsreterr(-1, cms, "could not get certificate list"); } CERTCertListNode *node = NULL; for_each_cert(certlist, tmpnode) { if (!strcmp(tmpnode->cert->subjectName, name)) { node = tmpnode; break; } } /* If we're looking up the issuer of some cert, and the issuer isn't * in the database, we'll get back what is essentially a template * that's in NSS's cache waiting to be filled out. We can't use that, * it'll just cause CERT_DupCertificate() to segfault. */ if (!node || !node->cert || !node->cert->derCert.data || !node->cert->derCert.len || !node->cert->derIssuer.data || !node->cert->derIssuer.len) { PK11_DestroySlotListElement(slots, &psle); PK11_FreeSlotList(slots); CERT_DestroyCertList(certlist); return -1; } *cert = CERT_DupCertificate(node->cert); PK11_DestroySlotListElement(slots, &psle); PK11_FreeSlotList(slots); CERT_DestroyCertList(certlist); return 0; }
0
246,459
static size_t consume_s7_r(RBuffer *b, ut64 bound, st8 *out) { size_t n = 0; ut32 tmp = consume_r (b, bound, &n, (ConsumeFcn)read_i32_leb128); if (out) { *out = (st8) (((tmp & 0x10000000) << 7) | (tmp & 0x7f)); } return n; }
0
395,088
status_redraw_curbuf(void) { win_T *wp; FOR_ALL_WINDOWS(wp) if (wp->w_status_height != 0 && wp->w_buffer == curbuf) { wp->w_redr_status = TRUE; redraw_later(VALID); } }
0
395,083
updateWindow(win_T *wp) { // return if already busy updating if (updating_screen) return; update_prepare(); #ifdef FEAT_CLIPBOARD // When Visual area changed, may have to update selection. if (clip_star.available && clip_isautosel_star()) clip_update_selection(&clip_star); if (clip_plus.available && clip_isautosel_plus()) clip_update_selection(&clip_plus); #endif win_update(wp); // When the screen was cleared redraw the tab pages line. if (redraw_tabline) draw_tabline(); if (wp->w_redr_status # ifdef FEAT_CMDL_INFO || p_ru # endif # ifdef FEAT_STL_OPT || *p_stl != NUL || *wp->w_p_stl != NUL # endif ) win_redr_status(wp, FALSE); #ifdef FEAT_PROP_POPUP // Display popup windows on top of everything. update_popups(win_update); #endif update_finish(); }
0
246,724
GF_Err HintFile(GF_ISOFile *file, u32 MTUSize, u32 max_ptime, u32 rtp_rate, u32 base_flags, Bool copy_data, Bool interleave, Bool regular_iod, Bool single_group, Bool hint_no_offset) { GF_ESD *esd; GF_InitialObjectDescriptor *iod; u32 i, val, res, streamType; u32 sl_mode, prev_ocr, single_ocr, nb_done, tot_bw, bw, flags, spec_type; GF_Err e; char szPayload[30]; GF_RTPHinter *hinter; Bool copy, has_iod, single_av; u8 init_payt = BASE_PAYT; u32 mtype; GF_SDP_IODProfile iod_mode = GF_SDP_IOD_NONE; u32 media_group = 0; u8 media_prio = 0; tot_bw = 0; prev_ocr = 0; single_ocr = 1; has_iod = 1; iod = (GF_InitialObjectDescriptor *) gf_isom_get_root_od(file); if (!iod) has_iod = 0; else { if (!gf_list_count(iod->ESDescriptors)) has_iod = 0; gf_odf_desc_del((GF_Descriptor *) iod); } spec_type = gf_isom_guess_specification(file); single_av = single_group ? 1 : gf_isom_is_single_av(file); /*first make sure we use a systems track as base OCR*/ for (i=0; i<gf_isom_get_track_count(file); i++) { res = gf_isom_get_media_type(file, i+1); if ((res==GF_ISOM_MEDIA_SCENE) || (res==GF_ISOM_MEDIA_OD)) { if (gf_isom_is_track_in_root_od(file, i+1)) { gf_isom_set_default_sync_track(file, i+1); break; } } } nb_done = 0; for (i=0; i<gf_isom_get_track_count(file); i++) { sl_mode = base_flags; copy = copy_data; /*skip emty tracks (mainly MPEG-4 interaction streams...*/ if (!gf_isom_get_sample_count(file, i+1)) continue; if (!gf_isom_is_track_enabled(file, i+1)) { M4_LOG(GF_LOG_INFO, ("Track ID %d disabled - skipping hint\n", gf_isom_get_track_id(file, i+1) )); continue; } mtype = gf_isom_get_media_type(file, i+1); switch (mtype) { case GF_ISOM_MEDIA_VISUAL: if (single_av) { media_group = 2; media_prio = 2; } break; case GF_ISOM_MEDIA_AUXV: if (single_av) { media_group = 2; media_prio = 3; } break; case GF_ISOM_MEDIA_PICT: if (single_av) { media_group = 2; media_prio = 4; } break; case GF_ISOM_MEDIA_AUDIO: if (single_av) { media_group = 2; media_prio = 1; } break; case GF_ISOM_MEDIA_HINT: continue; default: /*no hinting of systems track on isma*/ if (spec_type==GF_ISOM_BRAND_ISMA) continue; } mtype = gf_isom_get_media_subtype(file, i+1, 1); if ((mtype==GF_ISOM_SUBTYPE_MPEG4) || (mtype==GF_ISOM_SUBTYPE_MPEG4_CRYP) ) mtype = gf_isom_get_mpeg4_subtype(file, i+1, 1); if (!single_av) { /*one media per group only (we should prompt user for group selection)*/ media_group ++; media_prio = 1; } streamType = 0; esd = gf_isom_get_esd(file, i+1, 1); if (esd && esd->decoderConfig) { streamType = esd->decoderConfig->streamType; if (!prev_ocr) { prev_ocr = esd->OCRESID; if (!esd->OCRESID) prev_ocr = esd->ESID; } else if (esd->OCRESID && prev_ocr != esd->OCRESID) { single_ocr = 0; } /*OD MUST BE WITHOUT REFERENCES*/ if (streamType==1) copy = 1; } gf_odf_desc_del((GF_Descriptor *) esd); if (!regular_iod && gf_isom_is_track_in_root_od(file, i+1)) { /*single AU - check if base64 would fit in ESD (consider 33% overhead of base64), otherwise stream*/ if (gf_isom_get_sample_count(file, i+1)==1) { GF_ISOSample *samp = gf_isom_get_sample(file, i+1, 1, &val); if (streamType && samp) { res = gf_hinter_can_embbed_data(samp->data, samp->dataLength, streamType); } else { /*not a system track, we shall hint it*/ res = 0; } if (samp) gf_isom_sample_del(&samp); if (res) continue; } } if (interleave) sl_mode |= GP_RTP_PCK_USE_INTERLEAVING; hinter = gf_hinter_track_new(file, i+1, MTUSize, max_ptime, rtp_rate, sl_mode, init_payt, copy, media_group, media_prio, &e); if (!hinter) { if (e) { M4_LOG(nb_done ? GF_LOG_WARNING : GF_LOG_ERROR, ("Cannot create hinter (%s)\n", gf_error_to_string(e) )); if (!nb_done) return e; } continue; } if (hint_no_offset) gf_hinter_track_force_no_offsets(hinter); bw = gf_hinter_track_get_bandwidth(hinter); tot_bw += bw; flags = gf_hinter_track_get_flags(hinter); //set extraction mode for AVC/SVC gf_isom_set_nalu_extract_mode(file, i+1, GF_ISOM_NALU_EXTRACT_LAYER_ONLY); gf_hinter_track_get_payload_name(hinter, szPayload); M4_LOG(GF_LOG_INFO, ("Hinting track ID %d - Type \"%s:%s\" (%s) - BW %d kbps\n", gf_isom_get_track_id(file, i+1), gf_4cc_to_str(mtype), gf_4cc_to_str(mtype), szPayload, bw)); if (flags & GP_RTP_PCK_SYSTEMS_CAROUSEL) M4_LOG(GF_LOG_INFO, ("\tMPEG-4 Systems stream carousel enabled\n")); e = gf_hinter_track_process(hinter); if (!e) e = gf_hinter_track_finalize(hinter, has_iod); gf_hinter_track_del(hinter); if (e) { M4_LOG(GF_LOG_ERROR, ("Error while hinting (%s)\n", gf_error_to_string(e))); if (!nb_done) return e; } init_payt++; nb_done ++; } if (has_iod) { iod_mode = GF_SDP_IOD_ISMA; if (regular_iod) iod_mode = GF_SDP_IOD_REGULAR; } else { iod_mode = GF_SDP_IOD_NONE; } gf_hinter_finalize(file, iod_mode, tot_bw); if (!single_ocr) M4_LOG(GF_LOG_WARNING, ("Warning: at least 2 timelines found in the file\nThis may not be supported by servers/players\n\n")); return GF_OK; }
0
289,284
static int snd_pcm_oss_get_formats(struct snd_pcm_oss_file *pcm_oss_file) { struct snd_pcm_substream *substream; int err; int direct; struct snd_pcm_hw_params *params; unsigned int formats = 0; const struct snd_mask *format_mask; int fmt; err = snd_pcm_oss_get_active_substream(pcm_oss_file, &substream); if (err < 0) return err; if (atomic_read(&substream->mmap_count)) direct = 1; else direct = substream->oss.setup.direct; if (!direct) return AFMT_MU_LAW | AFMT_U8 | AFMT_S16_LE | AFMT_S16_BE | AFMT_S8 | AFMT_U16_LE | AFMT_U16_BE | AFMT_S32_LE | AFMT_S32_BE | AFMT_S24_LE | AFMT_S24_BE | AFMT_S24_PACKED; params = kmalloc(sizeof(*params), GFP_KERNEL); if (!params) return -ENOMEM; _snd_pcm_hw_params_any(params); err = snd_pcm_hw_refine(substream, params); if (err < 0) goto error; format_mask = hw_param_mask_c(params, SNDRV_PCM_HW_PARAM_FORMAT); for (fmt = 0; fmt < 32; ++fmt) { if (snd_mask_test(format_mask, fmt)) { int f = snd_pcm_oss_format_to((__force snd_pcm_format_t)fmt); if (f >= 0) formats |= f; } } error: kfree(params); return err < 0 ? err : formats; }
0
212,414
static int tc_new_tfilter(struct sk_buff *skb, struct nlmsghdr *n, struct netlink_ext_ack *extack) { struct net *net = sock_net(skb->sk); struct nlattr *tca[TCA_MAX + 1]; char name[IFNAMSIZ]; struct tcmsg *t; u32 protocol; u32 prio; bool prio_allocate; u32 parent; u32 chain_index; struct Qdisc *q = NULL; struct tcf_chain_info chain_info; struct tcf_chain *chain = NULL; struct tcf_block *block; struct tcf_proto *tp; unsigned long cl; void *fh; int err; int tp_created; bool rtnl_held = false; u32 flags; if (!netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) return -EPERM; replay: tp_created = 0; err = nlmsg_parse_deprecated(n, sizeof(*t), tca, TCA_MAX, rtm_tca_policy, extack); if (err < 0) return err; t = nlmsg_data(n); protocol = TC_H_MIN(t->tcm_info); prio = TC_H_MAJ(t->tcm_info); prio_allocate = false; parent = t->tcm_parent; tp = NULL; cl = 0; block = NULL; flags = 0; if (prio == 0) { /* If no priority is provided by the user, * we allocate one. */ if (n->nlmsg_flags & NLM_F_CREATE) { prio = TC_H_MAKE(0x80000000U, 0U); prio_allocate = true; } else { NL_SET_ERR_MSG(extack, "Invalid filter command with priority of zero"); return -ENOENT; } } /* Find head of filter chain. */ err = __tcf_qdisc_find(net, &q, &parent, t->tcm_ifindex, false, extack); if (err) return err; if (tcf_proto_check_kind(tca[TCA_KIND], name)) { NL_SET_ERR_MSG(extack, "Specified TC filter name too long"); err = -EINVAL; goto errout; } /* Take rtnl mutex if rtnl_held was set to true on previous iteration, * block is shared (no qdisc found), qdisc is not unlocked, classifier * type is not specified, classifier is not unlocked. */ if (rtnl_held || (q && !(q->ops->cl_ops->flags & QDISC_CLASS_OPS_DOIT_UNLOCKED)) || !tcf_proto_is_unlocked(name)) { rtnl_held = true; rtnl_lock(); } err = __tcf_qdisc_cl_find(q, parent, &cl, t->tcm_ifindex, extack); if (err) goto errout; block = __tcf_block_find(net, q, cl, t->tcm_ifindex, t->tcm_block_index, extack); if (IS_ERR(block)) { err = PTR_ERR(block); goto errout; } block->classid = parent; chain_index = tca[TCA_CHAIN] ? nla_get_u32(tca[TCA_CHAIN]) : 0; if (chain_index > TC_ACT_EXT_VAL_MASK) { NL_SET_ERR_MSG(extack, "Specified chain index exceeds upper limit"); err = -EINVAL; goto errout; } chain = tcf_chain_get(block, chain_index, true); if (!chain) { NL_SET_ERR_MSG(extack, "Cannot create specified filter chain"); err = -ENOMEM; goto errout; } mutex_lock(&chain->filter_chain_lock); tp = tcf_chain_tp_find(chain, &chain_info, protocol, prio, prio_allocate); if (IS_ERR(tp)) { NL_SET_ERR_MSG(extack, "Filter with specified priority/protocol not found"); err = PTR_ERR(tp); goto errout_locked; } if (tp == NULL) { struct tcf_proto *tp_new = NULL; if (chain->flushing) { err = -EAGAIN; goto errout_locked; } /* Proto-tcf does not exist, create new one */ if (tca[TCA_KIND] == NULL || !protocol) { NL_SET_ERR_MSG(extack, "Filter kind and protocol must be specified"); err = -EINVAL; goto errout_locked; } if (!(n->nlmsg_flags & NLM_F_CREATE)) { NL_SET_ERR_MSG(extack, "Need both RTM_NEWTFILTER and NLM_F_CREATE to create a new filter"); err = -ENOENT; goto errout_locked; } if (prio_allocate) prio = tcf_auto_prio(tcf_chain_tp_prev(chain, &chain_info)); mutex_unlock(&chain->filter_chain_lock); tp_new = tcf_proto_create(name, protocol, prio, chain, rtnl_held, extack); if (IS_ERR(tp_new)) { err = PTR_ERR(tp_new); goto errout_tp; } tp_created = 1; tp = tcf_chain_tp_insert_unique(chain, tp_new, protocol, prio, rtnl_held); if (IS_ERR(tp)) { err = PTR_ERR(tp); goto errout_tp; } } else { mutex_unlock(&chain->filter_chain_lock); } if (tca[TCA_KIND] && nla_strcmp(tca[TCA_KIND], tp->ops->kind)) { NL_SET_ERR_MSG(extack, "Specified filter kind does not match existing one"); err = -EINVAL; goto errout; } fh = tp->ops->get(tp, t->tcm_handle); if (!fh) { if (!(n->nlmsg_flags & NLM_F_CREATE)) { NL_SET_ERR_MSG(extack, "Need both RTM_NEWTFILTER and NLM_F_CREATE to create a new filter"); err = -ENOENT; goto errout; } } else if (n->nlmsg_flags & NLM_F_EXCL) { tfilter_put(tp, fh); NL_SET_ERR_MSG(extack, "Filter already exists"); err = -EEXIST; goto errout; } if (chain->tmplt_ops && chain->tmplt_ops != tp->ops) { NL_SET_ERR_MSG(extack, "Chain template is set to a different filter kind"); err = -EINVAL; goto errout; } if (!(n->nlmsg_flags & NLM_F_CREATE)) flags |= TCA_ACT_FLAGS_REPLACE; if (!rtnl_held) flags |= TCA_ACT_FLAGS_NO_RTNL; err = tp->ops->change(net, skb, tp, cl, t->tcm_handle, tca, &fh, flags, extack); if (err == 0) { tfilter_notify(net, skb, n, tp, block, q, parent, fh, RTM_NEWTFILTER, false, rtnl_held); tfilter_put(tp, fh); /* q pointer is NULL for shared blocks */ if (q) q->flags &= ~TCQ_F_CAN_BYPASS; } errout: if (err && tp_created) tcf_chain_tp_delete_empty(chain, tp, rtnl_held, NULL); errout_tp: if (chain) { if (tp && !IS_ERR(tp)) tcf_proto_put(tp, rtnl_held, NULL); if (!tp_created) tcf_chain_put(chain); } tcf_block_release(q, block, rtnl_held); if (rtnl_held) rtnl_unlock(); if (err == -EAGAIN) { /* Take rtnl lock in case EAGAIN is caused by concurrent flush * of target chain. */ rtnl_held = true; /* Replay the request. */ goto replay; } return err; errout_locked: mutex_unlock(&chain->filter_chain_lock); goto errout; }
1
197,898
void Compute(OpKernelContext* ctx) override { const Tensor& gradient = ctx->input(0); const Tensor& input = ctx->input(1); Tensor* input_backprop = nullptr; OP_REQUIRES_OK(ctx, ctx->allocate_output(0, input.shape(), &input_backprop)); OP_REQUIRES( ctx, input.IsSameSize(gradient), errors::InvalidArgument("gradient and input must be the same size")); const int depth = (axis_ == -1) ? 1 : input.dim_size(axis_); const Tensor& input_min_tensor = ctx->input(2); OP_REQUIRES(ctx, input_min_tensor.dims() == 0 || input_min_tensor.dims() == 1, errors::InvalidArgument( "Input min tensor must have dimension 1. Recieved ", input_min_tensor.dims(), ".")); const Tensor& input_max_tensor = ctx->input(3); OP_REQUIRES(ctx, input_max_tensor.dims() == 0 || input_max_tensor.dims() == 1, errors::InvalidArgument( "Input max tensor must have dimension 1. Recieved ", input_max_tensor.dims(), ".")); if (axis_ != -1) { OP_REQUIRES( ctx, input_min_tensor.dim_size(0) == depth, errors::InvalidArgument("min has incorrect size, expected ", depth, " was ", input_min_tensor.dim_size(0))); OP_REQUIRES( ctx, input_max_tensor.dim_size(0) == depth, errors::InvalidArgument("max has incorrect size, expected ", depth, " was ", input_max_tensor.dim_size(0))); } TensorShape min_max_shape(input_min_tensor.shape()); Tensor* input_min_backprop; OP_REQUIRES_OK(ctx, ctx->allocate_output(1, min_max_shape, &input_min_backprop)); Tensor* input_max_backprop; OP_REQUIRES_OK(ctx, ctx->allocate_output(2, min_max_shape, &input_max_backprop)); if (axis_ == -1) { functor::QuantizeAndDequantizeOneScaleGradientFunctor<Device, T> f; f(ctx->eigen_device<Device>(), gradient.template flat<T>(), input.template flat<T>(), input_min_tensor.scalar<T>(), input_max_tensor.scalar<T>(), input_backprop->template flat<T>(), input_min_backprop->template scalar<T>(), input_max_backprop->template scalar<T>()); } else { functor::QuantizeAndDequantizePerChannelGradientFunctor<Device, T> f; f(ctx->eigen_device<Device>(), gradient.template flat_inner_outer_dims<T, 3>(axis_ - 1), input.template flat_inner_outer_dims<T, 3>(axis_ - 1), &input_min_tensor, &input_max_tensor, input_backprop->template flat_inner_outer_dims<T, 3>(axis_ - 1), input_min_backprop->template flat<T>(), input_max_backprop->template flat<T>()); } }
1
445,936
archive_extraction_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { ExtractData *edata = user_data; FrWindow *window = edata->window; gboolean ask_to_open_destination; gboolean batch_mode; GError *error = NULL; ask_to_open_destination = edata->ask_to_open_destination; batch_mode = window->priv->batch_mode; _g_clear_object (&window->priv->last_extraction_destination); window->priv->last_extraction_destination = _g_object_ref (fr_archive_get_last_extraction_destination (window->archive)); fr_archive_operation_finish (FR_ARCHIVE (source_object), result, &error); _archive_operation_completed (window, FR_ACTION_EXTRACTING_FILES, error); if ((error == NULL) && ask_to_open_destination) { window->priv->quit_with_progress_dialog = window->priv->batch_mode; open_progress_dialog_with_open_destination (window); } else if ((error == NULL) && ! batch_mode && ! gtk_window_has_toplevel_focus (GTK_WINDOW (window->priv->progress_dialog))) gtk_window_present (GTK_WINDOW (window)); _g_error_free (error); }
0
398,548
static inline ut64 get_max_offset(size_t addr_size) { switch (addr_size) { case 2: return UT16_MAX; case 4: return UT32_MAX; case 8: return UT64_MAX; } return 0; }
0
352,964
integerIndexer( slap_mask_t use, slap_mask_t flags, Syntax *syntax, MatchingRule *mr, struct berval *prefix, BerVarray values, BerVarray *keysp, void *ctx ) { char ibuf[64]; struct berval itmp; BerVarray keys; ber_len_t vlen; int i, rc; unsigned maxstrlen = index_intlen_strlen + INDEX_INTLEN_CHOP-1; /* count the values and find max needed length */ vlen = 0; for( i = 0; !BER_BVISNULL( &values[i] ); i++ ) { if ( vlen < values[i].bv_len ) vlen = values[i].bv_len; } if ( vlen > maxstrlen ) vlen = maxstrlen; /* we should have at least one value at this point */ assert( i > 0 ); keys = slap_sl_malloc( sizeof( struct berval ) * (i+1), ctx ); for ( i = 0; !BER_BVISNULL( &values[i] ); i++ ) { keys[i].bv_len = index_intlen; keys[i].bv_val = slap_sl_malloc( index_intlen, ctx ); } keys[i].bv_len = 0; keys[i].bv_val = NULL; if ( vlen > sizeof(ibuf) ) { itmp.bv_val = slap_sl_malloc( vlen, ctx ); } else { itmp.bv_val = ibuf; } itmp.bv_len = sizeof(ibuf); for ( i=0; !BER_BVISNULL( &values[i] ); i++ ) { if ( itmp.bv_val != ibuf ) { itmp.bv_len = values[i].bv_len; if ( itmp.bv_len <= sizeof(ibuf) ) itmp.bv_len = sizeof(ibuf); else if ( itmp.bv_len > maxstrlen ) itmp.bv_len = maxstrlen; } rc = integerVal2Key( &values[i], &keys[i], &itmp, ctx ); if ( rc ) { slap_sl_free( keys, ctx ); goto func_leave; } } *keysp = keys; func_leave: if ( itmp.bv_val != ibuf ) { slap_sl_free( itmp.bv_val, ctx ); } return rc; }
0
459,156
static int __init tc_filter_init(void) { int err; tc_filter_wq = alloc_ordered_workqueue("tc_filter_workqueue", 0); if (!tc_filter_wq) return -ENOMEM; err = register_pernet_subsys(&tcf_net_ops); if (err) goto err_register_pernet_subsys; rtnl_register(PF_UNSPEC, RTM_NEWTFILTER, tc_new_tfilter, NULL, RTNL_FLAG_DOIT_UNLOCKED); rtnl_register(PF_UNSPEC, RTM_DELTFILTER, tc_del_tfilter, NULL, RTNL_FLAG_DOIT_UNLOCKED); rtnl_register(PF_UNSPEC, RTM_GETTFILTER, tc_get_tfilter, tc_dump_tfilter, RTNL_FLAG_DOIT_UNLOCKED); rtnl_register(PF_UNSPEC, RTM_NEWCHAIN, tc_ctl_chain, NULL, 0); rtnl_register(PF_UNSPEC, RTM_DELCHAIN, tc_ctl_chain, NULL, 0); rtnl_register(PF_UNSPEC, RTM_GETCHAIN, tc_ctl_chain, tc_dump_chain, 0); return 0; err_register_pernet_subsys: destroy_workqueue(tc_filter_wq); return err; }
0
359,661
DEFUN (neighbor_maximum_prefix_threshold_restart, neighbor_maximum_prefix_threshold_restart_cmd, NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Maximum number of prefix accept from this peer\n" "maximum no. of prefix limit\n" "Threshold value (%) at which to generate a warning msg\n" "Restart bgp connection after limit is exceeded\n" "Restart interval in minutes") { return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]); }
0
224,539
Status BiasAddShape(shape_inference::InferenceContext* c) { ShapeHandle input_shape; // Fetch the data_format attribute, which may not exist. string data_format; Status s = c->GetAttr("data_format", &data_format); if (s.ok() && data_format == "NCHW") { TF_RETURN_IF_ERROR(c->WithRankAtLeast(c->input(0), 3, &input_shape)); } else { TF_RETURN_IF_ERROR(c->WithRankAtLeast(c->input(0), 2, &input_shape)); } ShapeHandle bias_shape; TF_RETURN_IF_ERROR(c->WithRank(c->input(1), 1, &bias_shape)); DimensionHandle bias_dim = c->Dim(bias_shape, 0); // If rank unknown, return unknown shape. if (!c->RankKnown(input_shape)) { c->set_output(0, c->UnknownShape()); return Status::OK(); } // Output has the same shape as the input, and matches the length of // the bias in its bias dimension. ShapeHandle output_shape; if (s.ok() && data_format == "NCHW") { // Merge the length of bias_shape into the third to last dimension ShapeHandle first; TF_RETURN_IF_ERROR(c->Subshape(input_shape, 0, 1, &first)); ShapeHandle last; TF_RETURN_IF_ERROR(c->Subshape(input_shape, 2, &last)); DimensionHandle input_bias_dim = c->Dim(input_shape, 1); DimensionHandle merged_bias_dim; TF_RETURN_IF_ERROR(c->Merge(input_bias_dim, bias_dim, &merged_bias_dim)); ShapeHandle merged_bias = c->Vector(merged_bias_dim); ShapeHandle temp; TF_RETURN_IF_ERROR(c->Concatenate(first, merged_bias, &temp)); TF_RETURN_IF_ERROR(c->Concatenate(temp, last, &output_shape)); } else { ShapeHandle all_but_bias; TF_RETURN_IF_ERROR(c->Subshape(input_shape, 0, -1, &all_but_bias)); DimensionHandle input_bias_dim = c->Dim(input_shape, -1); DimensionHandle merged_bias_dim; TF_RETURN_IF_ERROR(c->Merge(input_bias_dim, bias_dim, &merged_bias_dim)); ShapeHandle merged_bias = c->Vector(merged_bias_dim); TF_RETURN_IF_ERROR( c->Concatenate(all_but_bias, merged_bias, &output_shape)); } c->set_output(0, output_shape); return Status::OK(); }
0
339,724
static char * rv_alloc(int i) { int j, k, *r; j = sizeof(ULong); for(k = 0; sizeof(Bigint) - sizeof(ULong) - sizeof(int) + j <= i; j <<= 1) { k++; } r = (int*)Balloc(k); *r = k; return (char *)(r+1); }
0
201,925
*vidtv_s302m_encoder_init(struct vidtv_s302m_encoder_init_args args) { u32 priv_sz = sizeof(struct vidtv_s302m_ctx); struct vidtv_s302m_ctx *ctx; struct vidtv_encoder *e; e = kzalloc(sizeof(*e), GFP_KERNEL); if (!e) return NULL; e->id = S302M; if (args.name) e->name = kstrdup(args.name, GFP_KERNEL); e->encoder_buf = vzalloc(VIDTV_S302M_BUF_SZ); e->encoder_buf_sz = VIDTV_S302M_BUF_SZ; e->encoder_buf_offset = 0; e->sample_count = 0; e->src_buf = (args.src_buf) ? args.src_buf : NULL; e->src_buf_sz = (args.src_buf) ? args.src_buf_sz : 0; e->src_buf_offset = 0; e->is_video_encoder = false; ctx = kzalloc(priv_sz, GFP_KERNEL); if (!ctx) { kfree(e); return NULL; } e->ctx = ctx; ctx->last_duration = 0; e->encode = vidtv_s302m_encode; e->clear = vidtv_s302m_clear; e->es_pid = cpu_to_be16(args.es_pid); e->stream_id = cpu_to_be16(PES_PRIVATE_STREAM_1); e->sync = args.sync; e->sampling_rate_hz = S302M_SAMPLING_RATE_HZ; e->last_sample_cb = args.last_sample_cb; e->destroy = vidtv_s302m_encoder_destroy; if (args.head) { while (args.head->next) args.head = args.head->next; args.head->next = e; } e->next = NULL; return e; }
1
437,713
static int cx23888_ir_tx_s_parameters(struct v4l2_subdev *sd, struct v4l2_subdev_ir_parameters *p) { struct cx23888_ir_state *state = to_state(sd); struct cx23885_dev *dev = state->dev; struct v4l2_subdev_ir_parameters *o = &state->tx_params; u16 txclk_divider; if (p->shutdown) return cx23888_ir_tx_shutdown(sd); if (p->mode != V4L2_SUBDEV_IR_MODE_PULSE_WIDTH) return -ENOSYS; mutex_lock(&state->tx_params_lock); o->shutdown = p->shutdown; o->mode = p->mode = V4L2_SUBDEV_IR_MODE_PULSE_WIDTH; o->bytes_per_data_element = p->bytes_per_data_element = sizeof(union cx23888_ir_fifo_rec); /* Before we tweak the hardware, we have to disable the transmitter */ irqenable_tx(dev, 0); control_tx_enable(dev, false); control_tx_modulation_enable(dev, p->modulation); o->modulation = p->modulation; if (p->modulation) { p->carrier_freq = txclk_tx_s_carrier(dev, p->carrier_freq, &txclk_divider); o->carrier_freq = p->carrier_freq; p->duty_cycle = cduty_tx_s_duty_cycle(dev, p->duty_cycle); o->duty_cycle = p->duty_cycle; p->max_pulse_width = (u32) pulse_width_count_to_ns(FIFO_RXTX, txclk_divider); } else { p->max_pulse_width = txclk_tx_s_max_pulse_width(dev, p->max_pulse_width, &txclk_divider); } o->max_pulse_width = p->max_pulse_width; atomic_set(&state->txclk_divider, txclk_divider); p->resolution = clock_divider_to_resolution(txclk_divider); o->resolution = p->resolution; /* FIXME - make this dependent on resolution for better performance */ control_tx_irq_watermark(dev, TX_FIFO_HALF_EMPTY); control_tx_polarity_invert(dev, p->invert_carrier_sense); o->invert_carrier_sense = p->invert_carrier_sense; control_tx_level_invert(dev, p->invert_level); o->invert_level = p->invert_level; o->interrupt_enable = p->interrupt_enable; o->enable = p->enable; if (p->enable) { if (p->interrupt_enable) irqenable_tx(dev, IRQEN_TSE); control_tx_enable(dev, p->enable); } mutex_unlock(&state->tx_params_lock); return 0; }
0
473,852
compile_length_string_node(Node* node, regex_t* reg) { int rlen, r, len, prev_len, slen, ambig; OnigEncoding enc = reg->enc; UChar *p, *prev; StrNode* sn; sn = NSTR(node); if (sn->end <= sn->s) return 0; ambig = NSTRING_IS_AMBIG(node); p = prev = sn->s; prev_len = enclen(enc, p, sn->end); p += prev_len; slen = 1; rlen = 0; for (; p < sn->end; ) { len = enclen(enc, p, sn->end); if (len == prev_len) { slen++; } else { r = add_compile_string_length(prev, prev_len, slen, reg, ambig); rlen += r; prev = p; slen = 1; prev_len = len; } p += len; } r = add_compile_string_length(prev, prev_len, slen, reg, ambig); rlen += r; return rlen; }
0
289,252
snd_pcm_sframes_t snd_pcm_oss_write3(struct snd_pcm_substream *substream, const char *ptr, snd_pcm_uframes_t frames, int in_kernel) { struct snd_pcm_runtime *runtime = substream->runtime; int ret; while (1) { if (runtime->status->state == SNDRV_PCM_STATE_XRUN || runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { #ifdef OSS_DEBUG pcm_dbg(substream->pcm, "pcm_oss: write: recovering from %s\n", runtime->status->state == SNDRV_PCM_STATE_XRUN ? "XRUN" : "SUSPEND"); #endif ret = snd_pcm_oss_prepare(substream); if (ret < 0) break; } mutex_unlock(&runtime->oss.params_lock); ret = __snd_pcm_lib_xfer(substream, (void *)ptr, true, frames, in_kernel); mutex_lock(&runtime->oss.params_lock); if (ret != -EPIPE && ret != -ESTRPIPE) break; /* test, if we can't store new data, because the stream */ /* has not been started */ if (runtime->status->state == SNDRV_PCM_STATE_PREPARED) return -EAGAIN; } return ret; }
0
233,811
void fmtutil_handle_iptc(deark *c, dbuf *f, i64 pos, i64 len, unsigned int flags) { int should_decode; int should_extract; int user_opt; int extract_fmt = 1; // 0=raw, 1=TIFF-wrapped if(len<1) return; user_opt = de_get_ext_option_bool(c, "extractiptc", -1); if(user_opt==1 || (c->extract_level>=2 && user_opt!=0)) { should_decode = 0; should_extract = 1; if(flags&0x2) { // Avoid "extracting" in a way that would just recreate the exact same file. extract_fmt = 0; } } else { should_decode = 1; should_extract = 0; } if(should_decode) { de_run_module_by_id_on_slice(c, "iptc", NULL, f, pos, len); } if(should_extract && extract_fmt==0) { dbuf_create_file_from_slice(f, pos, len, "iptc", NULL, DE_CREATEFLAG_IS_AUX); } else if(should_extract && extract_fmt==1) { wrap_in_tiff(c, f, pos, len, "Deark extracted IPTC", 33723, "iptctiff", DE_CREATEFLAG_IS_AUX); } }
0
508,835
Yacc_state::~Yacc_state() { if (yacc_yyss) { my_free(yacc_yyss); my_free(yacc_yyvs); } }
0
333,079
copy_sub(regsub_T *to, regsub_T *from) { to->in_use = from->in_use; if (from->in_use > 0) { // Copy the match start and end positions. if (REG_MULTI) mch_memmove(&to->list.multi[0], &from->list.multi[0], sizeof(struct multipos) * from->in_use); else mch_memmove(&to->list.line[0], &from->list.line[0], sizeof(struct linepos) * from->in_use); } }
0
226,033
GF_Err co64_box_read(GF_Box *s,GF_BitStream *bs) { u32 entries; GF_ChunkLargeOffsetBox *ptr = (GF_ChunkLargeOffsetBox *) s; ptr->nb_entries = gf_bs_read_u32(bs); ISOM_DECREASE_SIZE(ptr, 4) if ((u64)ptr->nb_entries > ptr->size / 8 || (u64)ptr->nb_entries > (u64)SIZE_MAX/sizeof(u64)) { GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[iso file] Invalid number of entries %d in co64\n", ptr->nb_entries)); return GF_ISOM_INVALID_FILE; } ptr->offsets = (u64 *) gf_malloc(ptr->nb_entries * sizeof(u64) ); if (ptr->offsets == NULL) return GF_OUT_OF_MEM; ptr->alloc_size = ptr->nb_entries; for (entries = 0; entries < ptr->nb_entries; entries++) { ptr->offsets[entries] = gf_bs_read_u64(bs); } return GF_OK; }
0
405,705
static int xemaclite_close(struct net_device *dev) { struct net_local *lp = netdev_priv(dev); netif_stop_queue(dev); xemaclite_disable_interrupts(lp); free_irq(dev->irq, dev); if (lp->phy_dev) phy_disconnect(lp->phy_dev); lp->phy_dev = NULL; return 0; }
0
223,728
bool ConstantFolding::MulConvPushDown(GraphDef* optimized_graph, NodeDef* node, const GraphProperties& properties) { // Push down multiplication on ConvND. // * ConvND // / \ / \ // ConvND C2 -- > X * // / \ / \ // X C1 C1 C2 // // where C1 and C2 are constants and X is non-constant. // // TODO(rmlarsen): Use PrepareConstantPushDown() to simplify this code. if (!IsAnyMul(*node) || NumNonControlInputs(*node) != 2) return false; NodeDef* mul_left_child = node_map_->GetNode(node->input(0)); NodeDef* mul_right_child = node_map_->GetNode(node->input(1)); if (mul_left_child == nullptr || mul_right_child == nullptr) { return false; } // One child must be constant, and the second must be Conv op. const bool left_child_is_constant = IsReallyConstant(*mul_left_child); const bool right_child_is_constant = IsReallyConstant(*mul_right_child); if (!left_child_is_constant && !right_child_is_constant) { return false; } NodeDef* conv_node = left_child_is_constant ? mul_right_child : mul_left_child; if (!IsConv2D(*conv_node) && !IsConv3D(*conv_node)) { return false; } if (node->device() != mul_left_child->device() || node->device() != mul_right_child->device()) { return false; } // Make sure that it is safe to change the value of the convolution // output. if (conv_node->input_size() < 2 || NumNonControlOutputs(*conv_node, *node_map_) > 1 || nodes_to_preserve_.find(conv_node->name()) != nodes_to_preserve_.end()) { return false; } // Identify the nodes to swap. NodeDef* conv_left_child = node_map_->GetNode(conv_node->input(0)); NodeDef* conv_right_child = node_map_->GetNode(conv_node->input(1)); const bool conv_left_is_constant = IsReallyConstant(*conv_left_child); const bool conv_right_is_constant = IsReallyConstant(*conv_right_child); if (!conv_left_is_constant && !conv_right_is_constant) { // At least one of the convolution inputs should be constant. return false; } if (conv_left_is_constant && conv_right_is_constant) { // Leverage regular constant folding to handle this. return false; } const auto& mul_props = properties.GetOutputProperties(node->name()); const auto& conv_props = properties.GetOutputProperties(conv_node->name()); if (mul_props.empty() || conv_props.empty()) { return false; } const auto& mul_shape = mul_props[0].shape(); const auto& conv_shape = conv_props[0].shape(); if (!ShapesSymbolicallyEqual(mul_shape, conv_shape)) { return false; } const auto& input_props = properties.GetInputProperties(conv_node->name()); if (input_props.size() < 2) { return false; } const auto& filter_shape = input_props[1].shape(); NodeDef* const_node = left_child_is_constant ? mul_left_child : mul_right_child; const auto& const_props = properties.GetOutputProperties(const_node->name()); if (const_props.empty()) { return false; } const auto& const_shape = const_props[0].shape(); if (!IsValidConstShapeForMulConvPushDown( conv_node->attr().at("data_format").s(), filter_shape, const_shape)) { return false; } string mul_new_name = AddPrefixToNodeName("merged_input", conv_node->name()); if (node_map_->NodeExists(mul_new_name)) { return false; } // Make sure we don't introduce loops in the graph by removing control // dependencies from the conv2d node to c2. string conv_const_input = conv_left_is_constant ? conv_node->input(0) : conv_node->input(1); if (MaybeRemoveControlInput(conv_node->name(), const_node, optimized_graph, node_map_.get())) { // Add a control dep from c1 to c2 to ensure c2 is in the right frame MaybeAddControlInput(conv_const_input, const_node, optimized_graph, node_map_.get()); } conv_node->set_name(node->name()); node->set_name(mul_new_name); if (conv_left_is_constant) { node_map_->UpdateInput(conv_node->name(), node->input(0), mul_new_name); conv_node->set_input(0, mul_new_name); } else { node_map_->UpdateInput(conv_node->name(), node->input(1), mul_new_name); conv_node->set_input(1, mul_new_name); } NodeDef* conv_const_node = conv_left_is_constant ? conv_left_child : conv_right_child; if (left_child_is_constant) { node->set_input(1, conv_const_node->name()); } else { node->set_input(0, conv_const_node->name()); } node_map_->AddNode(mul_new_name, node); return true; }
0
243,991
GF_Err saiz_box_write(GF_Box *s, GF_BitStream *bs) { GF_Err e; GF_SampleAuxiliaryInfoSizeBox*ptr = (GF_SampleAuxiliaryInfoSizeBox*) s; if (!s) return GF_BAD_PARAM; e = gf_isom_full_box_write(s, bs); if (e) return e; if (ptr->flags & 1) { gf_bs_write_u32(bs, ptr->aux_info_type); gf_bs_write_u32(bs, ptr->aux_info_type_parameter); } gf_bs_write_u8(bs, ptr->default_sample_info_size); gf_bs_write_u32(bs, ptr->sample_count); if (!ptr->default_sample_info_size) { if (!ptr->sample_info_size) gf_bs_write_u8(bs, 0); else gf_bs_write_data(bs, (char *) ptr->sample_info_size, ptr->sample_count); } return GF_OK; }
0
338,108
void WasmBinaryBuilder::visitLoop(Loop* curr) { BYN_TRACE("zz node: Loop\n"); startControlFlow(curr); curr->type = getType(); curr->name = getNextLabel(); breakStack.push_back({curr->name, Type::none}); // find the expressions in the block, and create the body // a loop may have a list of instructions in wasm, much like // a block, but it only has a label at the top of the loop, // so even if we need a block (if there is more than 1 // expression) we never need a label on the block. auto start = expressionStack.size(); processExpressions(); size_t end = expressionStack.size(); if (start > end) { throwError("block cannot pop from outside"); } if (end - start == 1) { curr->body = popExpression(); } else { auto* block = allocator.alloc<Block>(); pushBlockElements(block, curr->type, start); block->finalize(curr->type); curr->body = block; } breakStack.pop_back(); breakTargetNames.erase(curr->name); curr->finalize(curr->type); }
0
445,992
fr_window_file_list_drag_data_get (FrWindow *window, GdkDragContext *context, GtkSelectionData *selection_data, GList *path_list) { char *uri; GFile *destination; GFile *destination_folder; debug (DEBUG_INFO, "::DragDataGet -->\n"); if (window->priv->path_clicked != NULL) { gtk_tree_path_free (window->priv->path_clicked); window->priv->path_clicked = NULL; } if (window->priv->activity_ref > 0) return FALSE; if (gtk_selection_data_get_target (selection_data) == XFR_ATOM) { FrClipboardData *tmp; char *data; tmp = fr_clipboard_data_new (); tmp->files = fr_window_get_file_list_selection (window, TRUE, NULL); tmp->op = FR_CLIPBOARD_OP_COPY; tmp->base_dir = g_strdup (fr_window_get_current_location (window)); data = get_selection_data_from_clipboard_data (window, tmp); gtk_selection_data_set (selection_data, XFR_ATOM, 8, (guchar *) data, strlen (data)); fr_clipboard_data_unref (tmp); g_free (data); return TRUE; } if (! nautilus_xds_dnd_is_valid_xds_context (context)) return FALSE; uri = get_xds_atom_value (context); g_return_val_if_fail (uri != NULL, FALSE); destination = g_file_new_for_uri (uri); destination_folder = g_file_get_parent (destination); g_object_unref (destination); /* check whether the extraction can be performed in the destination * folder */ g_clear_error (&window->priv->drag_error); if (! _g_file_check_permissions (destination_folder, R_OK | W_OK)) { char *display_name; display_name = _g_file_get_display_basename (destination_folder); window->priv->drag_error = g_error_new (FR_ERROR, 0, _("You don't have the right permissions to extract archives in the folder \"%s\""), display_name); g_free (display_name); } if (window->priv->drag_error == NULL) { _g_object_unref (window->priv->drag_destination_folder); g_free (window->priv->drag_base_dir); _g_string_list_free (window->priv->drag_file_list); window->priv->drag_destination_folder = g_object_ref (destination_folder); window->priv->drag_base_dir = g_strdup (fr_window_get_current_location (window)); window->priv->drag_file_list = fr_window_get_file_list_from_path_list (window, path_list, NULL); } g_object_unref (destination_folder); /* sends back the response */ gtk_selection_data_set (selection_data, gtk_selection_data_get_target (selection_data), 8, (guchar *) ((window->priv->drag_error == NULL) ? "S" : "E"), 1); debug (DEBUG_INFO, "::DragDataGet <--\n"); return TRUE; }
0
391,659
static bool has_delete_on_close(struct share_mode_lock *lck, uint32_t name_hash) { struct share_mode_data *d = lck->data; uint32_t i; if (d->num_share_modes == 0) { return false; } if (!is_delete_on_close_set(lck, name_hash)) { return false; } for (i=0; i<d->num_share_modes; i++) { if (!share_mode_stale_pid(d, i)) { return true; } } return false; }
0
254,070
query_string(const query_string& qs): url_(qs.url_) { for (auto p : qs.key_value_pairs_) { key_value_pairs_.push_back((char*)(p - qs.url_.c_str() + url_.c_str())); } }
0
230,127
json_t * user_auth_scheme_module_register(struct config_module * config, const struct _u_request * http_request, const char * username, json_t * j_scheme_data, void * cls) { UNUSED(config); UNUSED(http_request); json_t * j_return, * j_result, * j_credential, * j_user_id, * j_assertion; int res; if (0 == o_strcmp(json_string_value(json_object_get(j_scheme_data, "register")), "new-credential")) { j_user_id = get_user_id_from_username(config, (json_t *)cls, username, 1); if (check_result_value(j_user_id, G_OK)) { j_credential = generate_new_credential(config, (json_t *)cls, username); if (check_result_value(j_credential, G_OK)) { j_return = json_pack("{sis{sOsOsOsss{sOss}sO}}", "result", G_OK, "response", "session", json_object_get(json_object_get(j_credential, "credential"), "session"), "challenge", json_object_get(json_object_get(j_credential, "credential"), "challenge"), "pubKey-cred-params", json_object_get((json_t *)cls, "pubKey-cred-params"), "attestation-required", json_object_get((json_t *)cls, "force-fmt-none")==json_true()?"none":"direct", "user", "id", json_object_get(j_user_id, "user_id"), "name", username, "rpId", json_object_get((json_t *)cls, "rp-origin") ); } else { y_log_message(Y_LOG_LEVEL_ERROR, "user_auth_scheme_module_register webauthn - Error generate_new_credential"); j_return = json_pack("{si}", "result", G_ERROR); } json_decref(j_credential); } else { y_log_message(Y_LOG_LEVEL_ERROR, "user_auth_scheme_module_register webauthn - Error get_user_id_from_username"); j_return = json_pack("{si}", "result", G_ERROR); } json_decref(j_user_id); } else if (0 == o_strcmp(json_string_value(json_object_get(j_scheme_data, "register")), "register-credential")) { j_credential = get_credential_from_session(config, (json_t *)cls, username, json_string_value(json_object_get(j_scheme_data, "session"))); if (check_result_value(j_credential, G_OK)) { j_result = register_new_attestation(config, (json_t *)cls, j_scheme_data, json_object_get(j_credential, "credential")); if (check_result_value(j_result, G_OK)) { j_return = json_pack("{si}", "result", G_OK); } else if (check_result_value(j_result, G_ERROR_UNAUTHORIZED)) { j_return = json_pack("{sisO}", "result", G_ERROR_UNAUTHORIZED, "response", json_object_get(j_result, "error")); } else if (check_result_value(j_result, G_ERROR_PARAM)) { j_return = json_pack("{sisO}", "result", G_ERROR_PARAM, "response", json_object_get(j_result, "error")); } else { y_log_message(Y_LOG_LEVEL_ERROR, "user_auth_scheme_module_register webauthn - Error register_new_attestation"); j_return = json_pack("{si}", "result", G_ERROR); } json_decref(j_result); } else if (check_result_value(j_credential, G_ERROR_NOT_FOUND)) { j_return = json_pack("{si}", "result", G_ERROR_NOT_FOUND); } else if (check_result_value(j_credential, G_ERROR_PARAM)) { j_return = json_pack("{si}", "result", G_ERROR_PARAM); } else { y_log_message(Y_LOG_LEVEL_ERROR, "user_auth_scheme_module_register webauthn - Error get_credential_from_session"); j_return = json_pack("{si}", "result", G_ERROR); } json_decref(j_credential); } else if (0 == o_strcmp(json_string_value(json_object_get(j_scheme_data, "register")), "remove-credential") && json_string_length(json_object_get(j_scheme_data, "credential_id"))) { j_credential = get_credential(config, (json_t *)cls, username, json_string_value(json_object_get(j_scheme_data, "credential_id"))); if (check_result_value(j_credential, G_OK)) { if ((res = update_credential(config, (json_t *)cls, username, json_string_value(json_object_get(j_scheme_data, "credential_id")), 4)) == G_OK) { j_return = json_pack("{si}", "result", G_OK); } else if (res == G_ERROR_PARAM) { j_return = json_pack("{si}", "result", G_ERROR_PARAM); } else { y_log_message(Y_LOG_LEVEL_ERROR, "user_auth_scheme_module_register webauthn - Error update_credential"); j_return = json_pack("{si}", "result", G_ERROR); } } else if (check_result_value(j_credential, G_ERROR_NOT_FOUND)) { j_return = json_pack("{si}", "result", G_ERROR_NOT_FOUND); } else { y_log_message(Y_LOG_LEVEL_ERROR, "user_auth_scheme_module_register webauthn - Error get_credential"); j_return = json_pack("{si}", "result", G_ERROR); } json_decref(j_credential); } else if (0 == o_strcmp(json_string_value(json_object_get(j_scheme_data, "register")), "disable-credential") && json_string_length(json_object_get(j_scheme_data, "credential_id"))) { j_credential = get_credential(config, (json_t *)cls, username, json_string_value(json_object_get(j_scheme_data, "credential_id"))); if (check_result_value(j_credential, G_OK)) { if ((res = update_credential(config, (json_t *)cls, username, json_string_value(json_object_get(j_scheme_data, "credential_id")), 3)) == G_OK) { j_return = json_pack("{si}", "result", G_OK); } else if (res == G_ERROR_PARAM) { j_return = json_pack("{si}", "result", G_ERROR_PARAM); } else { y_log_message(Y_LOG_LEVEL_ERROR, "user_auth_scheme_module_register webauthn - Error update_credential"); j_return = json_pack("{si}", "result", G_ERROR); } } else if (check_result_value(j_credential, G_ERROR_NOT_FOUND)) { j_return = json_pack("{si}", "result", G_ERROR_NOT_FOUND); } else { y_log_message(Y_LOG_LEVEL_ERROR, "user_auth_scheme_module_register webauthn - Error get_credential"); j_return = json_pack("{si}", "result", G_ERROR); } json_decref(j_credential); } else if (0 == o_strcmp(json_string_value(json_object_get(j_scheme_data, "register")), "enable-credential") && json_string_length(json_object_get(j_scheme_data, "credential_id"))) { j_credential = get_credential(config, (json_t *)cls, username, json_string_value(json_object_get(j_scheme_data, "credential_id"))); if (check_result_value(j_credential, G_OK)) { if ((res = update_credential(config, (json_t *)cls, username, json_string_value(json_object_get(j_scheme_data, "credential_id")), 1)) == G_OK) { j_return = json_pack("{si}", "result", G_OK); } else if (res == G_ERROR_PARAM) { j_return = json_pack("{si}", "result", G_ERROR_PARAM); } else { y_log_message(Y_LOG_LEVEL_ERROR, "user_auth_scheme_module_register webauthn - Error update_credential"); j_return = json_pack("{si}", "result", G_ERROR); } } else if (check_result_value(j_credential, G_ERROR_NOT_FOUND)) { j_return = json_pack("{si}", "result", G_ERROR_NOT_FOUND); } else { y_log_message(Y_LOG_LEVEL_ERROR, "user_auth_scheme_module_register webauthn - Error get_credential"); j_return = json_pack("{si}", "result", G_ERROR); } json_decref(j_credential); } else if (0 == o_strcmp(json_string_value(json_object_get(j_scheme_data, "register")), "edit-credential") && json_string_length(json_object_get(j_scheme_data, "credential_id")) && json_string_length(json_object_get(j_scheme_data, "name"))) { j_credential = get_credential(config, (json_t *)cls, username, json_string_value(json_object_get(j_scheme_data, "credential_id"))); if (check_result_value(j_credential, G_OK)) { if ((res = update_credential_name(config, (json_t *)cls, username, json_string_value(json_object_get(j_scheme_data, "credential_id")), json_string_value(json_object_get(j_scheme_data, "name")))) == G_OK) { j_return = json_pack("{si}", "result", G_OK); } else if (res == G_ERROR_PARAM) { j_return = json_pack("{si}", "result", G_ERROR_PARAM); } else { y_log_message(Y_LOG_LEVEL_ERROR, "user_auth_scheme_module_register webauthn - Error update_credential_name"); j_return = json_pack("{si}", "result", G_ERROR); } } else if (check_result_value(j_credential, G_ERROR_NOT_FOUND)) { j_return = json_pack("{si}", "result", G_ERROR_NOT_FOUND); } else { y_log_message(Y_LOG_LEVEL_ERROR, "user_auth_scheme_module_register webauthn - Error get_credential"); j_return = json_pack("{si}", "result", G_ERROR); } json_decref(j_credential); } else if (0 == o_strcmp(json_string_value(json_object_get(j_scheme_data, "register")), "trigger-assertion")) { j_user_id = get_user_id_from_username(config, (json_t *)cls, username, 0); if (check_result_value(j_user_id, G_OK)) { j_credential = get_credential_list(config, (json_t *)cls, username, 1); if (check_result_value(j_credential, G_OK)) { j_assertion = generate_new_assertion(config, (json_t *)cls, username, 1); if (check_result_value(j_assertion, G_OK)) { j_return = json_pack("{sis{sOsOsOs{sOss}sO}}", "result", G_OK, "response", "allowCredentials", json_object_get(j_credential, "credential"), "session", json_object_get(json_object_get(j_assertion, "assertion"), "session"), "challenge", json_object_get(json_object_get(j_assertion, "assertion"), "challenge"), "user", "id", json_object_get(j_user_id, "user_id"), "name", username, "rpId", json_object_get((json_t *)cls, "rp-origin") ); } else if (check_result_value(j_assertion, G_ERROR_UNAUTHORIZED)) { j_return = json_pack("{si}", "result", G_ERROR_UNAUTHORIZED); } else { y_log_message(Y_LOG_LEVEL_ERROR, "user_auth_scheme_module_trigger webauthn - Error register_new_assertion"); j_return = json_pack("{si}", "result", G_ERROR); } json_decref(j_assertion); } else if (check_result_value(j_credential, G_ERROR_NOT_FOUND)) { j_return = json_pack("{si}", "result", G_ERROR_UNAUTHORIZED); } else { y_log_message(Y_LOG_LEVEL_ERROR, "user_auth_scheme_module_trigger webauthn - Error get_credential_list"); j_return = json_pack("{si}", "result", G_ERROR); } json_decref(j_credential); } else if (check_result_value(j_user_id, G_ERROR_NOT_FOUND)) { j_return = json_pack("{si}", "result", G_ERROR_UNAUTHORIZED); } else { y_log_message(Y_LOG_LEVEL_ERROR, "user_auth_scheme_module_register webauthn - Error get_user_id_from_username"); j_return = json_pack("{si}", "result", G_ERROR); } json_decref(j_user_id); } else if (0 == o_strcmp(json_string_value(json_object_get(j_scheme_data, "register")), "validate-assertion")) { j_user_id = get_user_id_from_username(config, (json_t *)cls, username, 0); if (check_result_value(j_user_id, G_OK)) { j_assertion = get_assertion_from_session(config, (json_t *)cls, username, json_string_value(json_object_get(j_scheme_data, "session")), 1); if (check_result_value(j_assertion, G_OK)) { if ((res = check_assertion(config, (json_t *)cls, username, j_scheme_data, json_object_get(j_assertion, "assertion"))) == G_OK) { j_return = json_pack("{si}", "result", G_OK); } else if (res == G_ERROR_UNAUTHORIZED || res == G_ERROR_PARAM) { j_return = json_pack("{si}", "result", res); } else { y_log_message(Y_LOG_LEVEL_ERROR, "user_auth_scheme_module_register webauthn - Error check_assertion"); j_return = json_pack("{si}", "result", G_ERROR); } } else if (check_result_value(j_assertion, G_ERROR_NOT_FOUND)) { j_return = json_pack("{si}", "result", G_ERROR_UNAUTHORIZED); } else { y_log_message(Y_LOG_LEVEL_ERROR, "user_auth_scheme_module_register webauthn - Error get_credential"); j_return = json_pack("{si}", "result", G_ERROR); } json_decref(j_assertion); } else if (check_result_value(j_user_id, G_ERROR_NOT_FOUND)) { j_return = json_pack("{si}", "result", G_ERROR_UNAUTHORIZED); } else { y_log_message(Y_LOG_LEVEL_ERROR, "user_auth_scheme_module_validate webauthn - Error get_user_id_from_username"); j_return = json_pack("{si}", "result", G_ERROR); } json_decref(j_user_id); } else { j_return = json_pack("{si}", "result", G_ERROR_PARAM); } return j_return; }
0
220,843
inline int32x4x4_t MultiplyByQuantizedMultiplier4Rows( int32x4x4_t input_val, int32_t quantized_multiplier, int shift) { TFLITE_DCHECK(quantized_multiplier >= 0); const int right_shift = std::min(-1, shift); const int left_shift = shift - right_shift; const int32x4_t multiplier_dup = vdupq_n_s32(quantized_multiplier); const int32x4_t left_shift_dup = vdupq_n_s32(left_shift); const int32x4_t right_shift_dup = vdupq_n_s32(right_shift); int32x4x4_t result; result.val[0] = vrshlq_s32( vqdmulhq_s32(vshlq_s32(input_val.val[0], left_shift_dup), multiplier_dup), right_shift_dup); result.val[1] = vrshlq_s32( vqdmulhq_s32(vshlq_s32(input_val.val[1], left_shift_dup), multiplier_dup), right_shift_dup); result.val[2] = vrshlq_s32( vqdmulhq_s32(vshlq_s32(input_val.val[2], left_shift_dup), multiplier_dup), right_shift_dup); result.val[3] = vrshlq_s32( vqdmulhq_s32(vshlq_s32(input_val.val[3], left_shift_dup), multiplier_dup), right_shift_dup); return result; }
0
445,998
get_dir_list_from_file_data (FrWindow *window, FileData *fdata) { char *dirname; GList *list; dirname = g_strconcat (fr_window_get_current_location (window), fdata->list_name, NULL); list = get_dir_list_from_path (window, dirname); g_free (dirname); return list; }
0
139,252
void OverlayWindowViews::UpdateLayerBoundsWithLetterboxing( gfx::Size window_size) { if (window_bounds_.size().IsEmpty() || natural_size_.IsEmpty()) return; gfx::Rect letterbox_region = media::ComputeLetterboxRegion( gfx::Rect(gfx::Point(0, 0), window_size), natural_size_); if (letterbox_region.IsEmpty()) return; gfx::Size letterbox_size = letterbox_region.size(); gfx::Point origin = gfx::Point((window_size.width() - letterbox_size.width()) / 2, (window_size.height() - letterbox_size.height()) / 2); video_bounds_.set_origin(origin); video_bounds_.set_size(letterbox_region.size()); UpdateControlsBounds(); controller_->UpdateLayerBounds(); }
0
217,559
MagickExport MagickBooleanType FormatImageProperty(Image *image, const char *property,const char *format,...) { char value[MaxTextExtent]; ssize_t n; va_list operands; va_start(operands,format); n=FormatLocaleStringList(value,MaxTextExtent,format,operands); (void) n; va_end(operands); return(SetImageProperty(image,property,value)); }
0
245,186
free_mysql_variables(mysql_variable *vars) { mysql_variable *var; for (var = vars; var->name; var++) { free(*(var->value)); *var->value = NULL; } }
0
337,851
void sctp_chunk_assign_ssn(struct sctp_chunk *chunk) { struct sctp_stream *stream; struct sctp_chunk *lchunk; struct sctp_datamsg *msg; __u16 ssn, sid; if (chunk->has_ssn) return; /* All fragments will be on the same stream */ sid = ntohs(chunk->subh.data_hdr->stream); stream = &chunk->asoc->stream; /* Now assign the sequence number to the entire message. * All fragments must have the same stream sequence number. */ msg = chunk->msg; list_for_each_entry(lchunk, &msg->chunks, frag_list) { if (lchunk->chunk_hdr->flags & SCTP_DATA_UNORDERED) { ssn = 0; } else { if (lchunk->chunk_hdr->flags & SCTP_DATA_LAST_FRAG) ssn = sctp_ssn_next(stream, out, sid); else ssn = sctp_ssn_peek(stream, out, sid); } lchunk->subh.data_hdr->ssn = htons(ssn); lchunk->has_ssn = 1; } }
0
247,637
TEST_P(SslSocketTest, ClientCertificateHashVerification) { const std::string client_ctx_yaml = R"EOF( common_tls_context: tls_certificates: certificate_chain: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_uri_cert.pem" private_key: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_uri_key.pem" )EOF"; const std::string server_ctx_yaml = absl::StrCat(R"EOF( common_tls_context: tls_certificates: certificate_chain: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/unittest_cert.pem" private_key: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/unittest_key.pem" validation_context: trusted_ca: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/ca_cert.pem" verify_certificate_hash: ")EOF", TEST_SAN_URI_CERT_256_HASH, "\""); TestUtilOptions test_options(client_ctx_yaml, server_ctx_yaml, true, GetParam()); testUtil(test_options.setExpectedClientCertUri("spiffe://lyft.com/test-team") .setExpectedSerialNumber(TEST_SAN_URI_CERT_SERIAL)); }
0
243,986
GF_Err udta_on_child_box(GF_Box *s, GF_Box *a, Bool is_rem) { GF_Err e; u32 box_type; GF_UserDataMap *map; GF_UserDataBox *ptr = (GF_UserDataBox *)s; if (!ptr) return GF_BAD_PARAM; if (!a) return GF_OK; //detach from parent list if any gf_list_del_item(ptr->child_boxes, a); /* for unknown udta boxes, we reference them by their original box type */ box_type = a->type; if (box_type == GF_ISOM_BOX_TYPE_UNKNOWN) { GF_UnknownBox* unkn = (GF_UnknownBox *)a; box_type = unkn->original_4cc; } map = udta_getEntry(ptr, box_type, (a->type==GF_ISOM_BOX_TYPE_UUID) ? & ((GF_UUIDBox *)a)->uuid : NULL); if (map == NULL) { if (is_rem) return GF_OK; map = (GF_UserDataMap *) gf_malloc(sizeof(GF_UserDataMap)); if (map == NULL) return GF_OUT_OF_MEM; memset(map, 0, sizeof(GF_UserDataMap)); map->boxType = box_type; if (a->type == GF_ISOM_BOX_TYPE_UUID) memcpy(map->uuid, ((GF_UUIDBox *)a)->uuid, 16); map->boxes = gf_list_new(); if (!map->boxes) { gf_free(map); return GF_OUT_OF_MEM; } e = gf_list_add(ptr->recordList, map); if (e) return e; } if (is_rem) { gf_list_del_item(map->boxes, a); return GF_OK; } return gf_list_add(map->boxes, a); }
0
220,834
void optimized_ops_preload_l1_stream(const T* ptr) { #ifdef __GNUC__ // builtin offered by GCC-compatible compilers including clang __builtin_prefetch(ptr, /* 0 means read */ 0, /* 0 means no locality */ 0); #else (void)ptr; #endif }
0
521,461
int ZipFile::getIndexOfFileName (const String& fileName, bool ignoreCase) const noexcept { for (int i = 0; i < entries.size(); ++i) { auto& entryFilename = entries.getUnchecked (i)->entry.filename; if (ignoreCase ? entryFilename.equalsIgnoreCase (fileName) : entryFilename == fileName) return i; } return -1; }
0
349,876
int hw_atl_write_fwsettings_dwords(struct aq_hw_s *self, u32 offset, u32 *p, u32 cnt) { return hw_atl_utils_fw_upload_dwords(self, self->settings_addr + offset, p, cnt, MCP_AREA_SETTINGS); }
0
326,621
create_parent_dir(struct archive_write_disk *a, char *path) { char *slash; int r; /* Remove tail element to obtain parent name. */ slash = strrchr(path, '/'); if (slash == NULL) return (ARCHIVE_OK); *slash = '\0'; r = create_dir(a, path); *slash = '/'; return (r); }
0
338,240
void WasmBinaryBuilder::visitTableSet(TableSet* curr) { BYN_TRACE("zz node: TableSet\n"); Index tableIdx = getU32LEB(); if (tableIdx >= tables.size()) { throwError("bad table index"); } curr->value = popNonVoidExpression(); curr->index = popNonVoidExpression(); curr->finalize(); // Defer setting the table name for later, when we know it. tableRefs[tableIdx].push_back(curr); }
0
254,717
njs_typed_array_prop_set(njs_vm_t *vm, njs_typed_array_t *array, uint32_t index, double v) { int8_t i8; int16_t i16; int32_t i32; njs_array_buffer_t *buffer; buffer = array->buffer; index += array->offset; njs_assert(!buffer->object.shared); switch (array->type) { case NJS_OBJ_TYPE_UINT8_CLAMPED_ARRAY: if (isnan(v) || v < 0) { v = 0; } else if (v > 255) { v = 255; } buffer->u.u8[index] = lrint(v); break; case NJS_OBJ_TYPE_UINT8_ARRAY: case NJS_OBJ_TYPE_INT8_ARRAY: i8 = njs_number_to_int32(v); buffer->u.u8[index] = i8; break; case NJS_OBJ_TYPE_UINT16_ARRAY: case NJS_OBJ_TYPE_INT16_ARRAY: i16 = njs_number_to_int32(v); buffer->u.u16[index] = i16; break; case NJS_OBJ_TYPE_UINT32_ARRAY: case NJS_OBJ_TYPE_INT32_ARRAY: i32 = njs_number_to_int32(v); buffer->u.u32[index] = i32; break; case NJS_OBJ_TYPE_FLOAT32_ARRAY: buffer->u.f32[index] = v; break; default: /* NJS_OBJ_TYPE_FLOAT64_ARRAY. */ buffer->u.f64[index] = v; } }
0
508,406
static void update_field_dependencies(THD *thd, Field *field, TABLE *table) { DBUG_ENTER("update_field_dependencies"); if (thd->mark_used_columns != MARK_COLUMNS_NONE) { MY_BITMAP *bitmap; /* We always want to register the used keys, as the column bitmap may have been set for all fields (for example for view). */ table->covering_keys.intersect(field->part_of_key); if (field->vcol_info) table->mark_virtual_col(field); if (thd->mark_used_columns == MARK_COLUMNS_READ) bitmap= table->read_set; else bitmap= table->write_set; /* The test-and-set mechanism in the bitmap is not reliable during multi-UPDATE statements under MARK_COLUMNS_READ mode (thd->mark_used_columns == MARK_COLUMNS_READ), as this bitmap contains only those columns that are used in the SET clause. I.e they are being set here. See multi_update::prepare() */ if (bitmap_fast_test_and_set(bitmap, field->field_index)) { if (thd->mark_used_columns == MARK_COLUMNS_WRITE) { DBUG_PRINT("warning", ("Found duplicated field")); thd->dup_field= field; } else { DBUG_PRINT("note", ("Field found before")); } DBUG_VOID_RETURN; } if (table->get_fields_in_item_tree) field->flags|= GET_FIXED_FIELDS_FLAG; table->used_fields++; } else if (table->get_fields_in_item_tree) field->flags|= GET_FIXED_FIELDS_FLAG; DBUG_VOID_RETURN; }
0
446,062
LZWCleanup(TIFF* tif) { (void)TIFFPredictorCleanup(tif); assert(tif->tif_data != 0); if (DecoderState(tif)->dec_codetab) _TIFFfree(DecoderState(tif)->dec_codetab); if (EncoderState(tif)->enc_hashtab) _TIFFfree(EncoderState(tif)->enc_hashtab); _TIFFfree(tif->tif_data); tif->tif_data = NULL; _TIFFSetDefaultCompressionState(tif); }
0
226,441
Status RestoreInternal(IteratorContext* ctx, IteratorStateReader* reader) override { mutex_lock l(mu_); TF_RETURN_IF_ERROR(reader->ReadScalar(Iterator::full_name("i"), &i_)); int64_t iter_loc; TF_RETURN_IF_ERROR( reader->ReadScalar(Iterator::full_name("iter_loc"), &iter_loc)); iter_ = group_iterable_.at(iter_loc); TF_RETURN_IF_ERROR(reader->ReadScalar( Iterator::full_name("next_non_empty_i_"), &next_non_empty_i_)); if (i_ <= next_non_empty_i_) { TF_RETURN_IF_ERROR(reader->ReadTensor( Iterator::full_name("next_indices_"), &next_indices_)); TF_RETURN_IF_ERROR(reader->ReadTensor( Iterator::full_name("next_values_"), &next_values_)); } return Status::OK(); }
0
234,237
free_all_abbrevs (void) { abbrev_list * list; for (list = abbrev_lists; list != NULL;) { abbrev_list * next = list->next; abbrev_entry * abbrv; for (abbrv = list->first_abbrev; abbrv != NULL;) { abbrev_entry * next_abbrev = abbrv->next; abbrev_attr * attr; for (attr = abbrv->first_attr; attr;) { abbrev_attr *next_attr = attr->next; free (attr); attr = next_attr; } free (abbrv); abbrv = next_abbrev; } free (list); list = next; } abbrev_lists = NULL; }
0
256,445
JANET_CORE_FN(cfun_array_insert, "(array/insert arr at & xs)", "Insert all `xs` into array `arr` at index `at`. `at` should be an integer between " "0 and the length of the array. A negative value for `at` will index backwards from " "the end of the array, such that inserting at -1 appends to the array. " "Returns the array.") { size_t chunksize, restsize; janet_arity(argc, 2, -1); JanetArray *array = janet_getarray(argv, 0); int32_t at = janet_getinteger(argv, 1); if (at < 0) { at = array->count + at + 1; } if (at < 0 || at > array->count) janet_panicf("insertion index %d out of range [0,%d]", at, array->count); chunksize = (argc - 2) * sizeof(Janet); restsize = (array->count - at) * sizeof(Janet); if (INT32_MAX - (argc - 2) < array->count) { janet_panic("array overflow"); } janet_array_ensure(array, array->count + argc - 2, 2); if (restsize) { memmove(array->data + at + argc - 2, array->data + at, restsize); } safe_memcpy(array->data + at, argv + 2, chunksize); array->count += (argc - 2); return argv[0]; }
0
241,050
static int query_get_string_answer(cmd_request_t cmd) { struct booth_site *site; struct boothc_hdr_msg reply; struct boothc_header *header; char *data; int data_len; int rv; struct booth_transport const *tpt; int (*test_reply_f) (cmd_result_t reply_code, cmd_request_t cmd); size_t msg_size; void *request; if (cl.type == GEOSTORE) { test_reply_f = test_attr_reply; msg_size = sizeof(cl.attr_msg); request = &cl.attr_msg; } else { test_reply_f = test_reply; msg_size = sizeof(cl.msg); request = &cl.msg; } header = (struct boothc_header *)request; data = NULL; init_header(header, cmd, 0, cl.options, 0, 0, msg_size); if (!*cl.site) site = local; else if (!find_site_by_name(cl.site, &site, 1)) { log_error("cannot find site \"%s\"", cl.site); rv = ENOENT; goto out; } tpt = booth_transport + TCP; rv = tpt->open(site); if (rv < 0) goto out_close; rv = tpt->send(site, request, msg_size); if (rv < 0) goto out_close; rv = tpt->recv_auth(site, &reply, sizeof(reply)); if (rv < 0) goto out_close; data_len = ntohl(reply.header.length) - rv; /* no attribute, or no ticket found */ if (!data_len) { goto out_test_reply; } data = malloc(data_len+1); if (!data) { rv = -ENOMEM; goto out_close; } rv = tpt->recv(site, data, data_len); if (rv < 0) goto out_close; *(data+data_len) = '\0'; *(data + data_len) = '\0'; (void)fputs(data, stdout); fflush(stdout); rv = 0; out_test_reply: rv = test_reply_f(ntohl(reply.header.result), cmd); out_close: tpt->close(site); out: if (data) free(data); return rv; }
0
231,700
virtual void setupConnection() { EXPECT_EQ(server->getConn().readCodec, nullptr); EXPECT_EQ(server->getConn().statsCallback, transportInfoCb_.get()); setupClientReadCodec(); recvClientHello(); IOBufEqualTo eq; EXPECT_TRUE(eq(getCryptoStreamData(), IOBuf::copyBuffer("SHLO"))); serverWrites.clear(); EXPECT_NE(server->getConn().readCodec, nullptr); EXPECT_NE(server->getConn().initialWriteCipher, nullptr); EXPECT_NE(server->getConn().initialHeaderCipher, nullptr); EXPECT_NE(server->getConn().handshakeWriteCipher, nullptr); EXPECT_NE(server->getConn().handshakeWriteHeaderCipher, nullptr); EXPECT_NE(server->getConn().readCodec->getHandshakeHeaderCipher(), nullptr); EXPECT_FALSE(server->getConn().localConnectionError.has_value()); EXPECT_EQ(server->getConn().version, QuicVersion::MVFST); EXPECT_EQ(server->getConn().serverConnIdParams->processId, 0); EXPECT_EQ(server->getConn().serverConnIdParams->workerId, 1); EXPECT_TRUE(server->getConn().serverConnectionId.has_value()); EXPECT_EQ(server->getConn().selfConnectionIds.size(), 1); serverConnectionId = *server->getConn().serverConnectionId; EXPECT_EQ( server->getConn().selfConnectionIds[0].connId, serverConnectionId); // the crypto data should have been written in the previous loop, verify // that the write loop callback is not scheduled any more since we don't // have keys to write acks. This assumes that we will schedule crypto data // as soon as we can. EXPECT_FALSE(server->writeLooper()->isLoopCallbackScheduled()); EXPECT_FALSE(server->readLooper()->isLoopCallbackScheduled()); expectWriteNewSessionTicket(); // Once oneRtt keys are available, ServerTransport must call the // onConnectionIdBound on its 'routingCallback' EXPECT_CALL(routingCallback, onConnectionIdBound(_)) .WillOnce(Invoke([&, clientAddr = clientAddr](auto transport) { EXPECT_EQ(clientAddr, transport->getOriginalPeerAddress()); })); EXPECT_TRUE(server->getConn().pendingEvents.frames.empty()); EXPECT_EQ(server->getConn().nextSelfConnectionIdSequence, 1); recvClientFinished(); // We need an extra pump here for some reason. loopForWrites(); // Issue (kMinNumAvailableConnIds - 1) more connection ids on handshake // complete auto numNewConnIdFrames = 0; for (const auto& packet : server->getConn().outstandings.packets) { for (const auto& frame : packet.packet.frames) { switch (frame.type()) { case QuicWriteFrame::Type::QuicSimpleFrame: { const auto writeFrame = frame.asQuicSimpleFrame(); if (writeFrame->type() == QuicSimpleFrame::Type::NewConnectionIdFrame) { ++numNewConnIdFrames; } break; } default: break; } } } uint64_t connIdsToIssue = std::min( server->getConn().peerActiveConnectionIdLimit, kDefaultActiveConnectionIdLimit) - 1; if (server->getConn().transportSettings.disableMigration || (connIdsToIssue == 0)) { EXPECT_EQ(numNewConnIdFrames, 0); EXPECT_EQ(server->getConn().nextSelfConnectionIdSequence, 1); } else { EXPECT_EQ(numNewConnIdFrames, connIdsToIssue); EXPECT_EQ( server->getConn().nextSelfConnectionIdSequence, connIdsToIssue + 1); } EXPECT_NE(server->getConn().readCodec, nullptr); EXPECT_NE(server->getConn().oneRttWriteCipher, nullptr); EXPECT_NE(server->getConn().oneRttWriteHeaderCipher, nullptr); EXPECT_NE(server->getConn().readCodec->getOneRttHeaderCipher(), nullptr); EXPECT_TRUE(getCryptoStream( *server->getConn().cryptoState, EncryptionLevel::Initial) ->readBuffer.empty()); EXPECT_FALSE(server->getConn().localConnectionError.has_value()); verifyTransportParameters(kDefaultIdleTimeout); serverWrites.clear(); auto& cryptoState = server->getConn().cryptoState; EXPECT_EQ(cryptoState->handshakeStream.retransmissionBuffer.size(), 0); EXPECT_EQ(cryptoState->oneRttStream.retransmissionBuffer.size(), 0); }
0
512,271
Item_literal(THD *thd): Item_basic_constant(thd) { }
0
224,994
PQrequestCancel(PGconn *conn) { int r; /* Check we have an open connection */ if (!conn) return false; if (conn->sock == PGINVALID_SOCKET) { strlcpy(conn->errorMessage.data, "PQrequestCancel() -- connection is not open\n", conn->errorMessage.maxlen); conn->errorMessage.len = strlen(conn->errorMessage.data); return false; } r = internal_cancel(&conn->raddr, conn->be_pid, conn->be_key, conn->errorMessage.data, conn->errorMessage.maxlen); if (!r) conn->errorMessage.len = strlen(conn->errorMessage.data); return r; }
0
247,358
static int pgpPrtKey(pgpTag tag, const uint8_t *h, size_t hlen, pgpDigParams _digp) { uint8_t version = 0; const uint8_t * p = NULL; int rc = 1; if (pgpVersion(h, hlen, &version)) return rc; /* We only permit V4 keys, V3 keys are long long since deprecated */ switch (version) { case 4: { pgpPktKeyV4 v = (pgpPktKeyV4)h; if (hlen > sizeof(*v)) { pgpPrtVal("V4 ", pgpTagTbl, tag); pgpPrtVal(" ", pgpPubkeyTbl, v->pubkey_algo); pgpPrtTime(" ", v->time, sizeof(v->time)); pgpPrtNL(); /* If _digp->hash is not NULL then signature is already loaded */ if (_digp->hash == NULL) { _digp->version = v->version; _digp->time = pgpGrab(v->time, sizeof(v->time)); _digp->pubkey_algo = v->pubkey_algo; } p = ((uint8_t *)v) + sizeof(*v); rc = pgpPrtPubkeyParams(v->pubkey_algo, p, h, hlen, _digp); } } break; default: rpmlog(RPMLOG_WARNING, _("Unsupported version of key: V%d\n"), h[0]); } return rc; }
0
337,810
void sctp_init_addrs(struct sctp_chunk *chunk, union sctp_addr *src, union sctp_addr *dest) { memcpy(&chunk->source, src, sizeof(union sctp_addr)); memcpy(&chunk->dest, dest, sizeof(union sctp_addr)); }
0
453,008
static struct nft_flow_rule *nft_flow_rule_alloc(int num_actions) { struct nft_flow_rule *flow; flow = kzalloc(sizeof(struct nft_flow_rule), GFP_KERNEL); if (!flow) return NULL; flow->rule = flow_rule_alloc(num_actions); if (!flow->rule) { kfree(flow); return NULL; } flow->rule->match.dissector = &flow->match.dissector; flow->rule->match.mask = &flow->match.mask; flow->rule->match.key = &flow->match.key; return flow; }
0
242,615
explicit StageClearOp(OpKernelConstruction* ctx) : OpKernel(ctx) {}
0
404,727
static struct fdtable *close_files(struct files_struct * files) { /* * It is safe to dereference the fd table without RCU or * ->file_lock because this is the last reference to the * files structure. */ struct fdtable *fdt = rcu_dereference_raw(files->fdt); unsigned int i, j = 0; for (;;) { unsigned long set; i = j * BITS_PER_LONG; if (i >= fdt->max_fds) break; set = fdt->open_fds[j++]; while (set) { if (set & 1) { struct file * file = xchg(&fdt->fd[i], NULL); if (file) { filp_close(file, files); cond_resched(); } } i++; set >>= 1; } } return fdt; }
0
462,569
void controller::dump_config(const std::string& filename) { std::vector<std::string> configlines; cfg.dump_config(configlines); if (v) { v->get_keys()->dump_config(configlines); } ign.dump_config(configlines); filters.dump_config(configlines); colorman.dump_config(configlines); rxman.dump_config(configlines); std::fstream f; f.open(filename.c_str(), std::fstream::out); if (f.is_open()) { for (auto line : configlines) { f << line << std::endl; } } }
0
226,951
IRC_PROTOCOL_CALLBACK(005) { char *pos, *pos2, *pos_start, *error, *isupport2; int length_isupport, length, casemapping; long value; IRC_PROTOCOL_MIN_ARGS(4); irc_protocol_cb_numeric (server, date, nick, address, host, command, ignored, argc, argv, argv_eol); /* save prefix */ pos = strstr (argv_eol[3], "PREFIX="); if (pos) { pos += 7; pos2 = strchr (pos, ' '); if (pos2) pos2[0] = '\0'; irc_server_set_prefix_modes_chars (server, pos); if (pos2) pos2[0] = ' '; } /* save max nick length */ pos = strstr (argv_eol[3], "NICKLEN="); if (pos) { pos += 8; pos2 = strchr (pos, ' '); if (pos2) pos2[0] = '\0'; error = NULL; value = strtol (pos, &error, 10); if (error && !error[0] && (value > 0)) server->nick_max_length = (int)value; if (pos2) pos2[0] = ' '; } /* save max user length */ pos = strstr (argv_eol[3], "USERLEN="); if (pos) { pos += 8; pos2 = strchr (pos, ' '); if (pos2) pos2[0] = '\0'; error = NULL; value = strtol (pos, &error, 10); if (error && !error[0] && (value > 0)) server->user_max_length = (int)value; if (pos2) pos2[0] = ' '; } /* save max host length */ pos = strstr (argv_eol[3], "HOSTLEN="); if (pos) { pos += 8; pos2 = strchr (pos, ' '); if (pos2) pos2[0] = '\0'; error = NULL; value = strtol (pos, &error, 10); if (error && !error[0] && (value > 0)) server->host_max_length = (int)value; if (pos2) pos2[0] = ' '; } /* save casemapping */ pos = strstr (argv_eol[3], "CASEMAPPING="); if (pos) { pos += 12; pos2 = strchr (pos, ' '); if (pos2) pos2[0] = '\0'; casemapping = irc_server_search_casemapping (pos); if (casemapping >= 0) server->casemapping = casemapping; if (pos2) pos2[0] = ' '; } /* save chantypes */ pos = strstr (argv_eol[3], "CHANTYPES="); if (pos) { pos += 10; pos2 = strchr (pos, ' '); if (pos2) pos2[0] = '\0'; if (server->chantypes) free (server->chantypes); server->chantypes = strdup (pos); if (pos2) pos2[0] = ' '; } /* save chanmodes */ pos = strstr (argv_eol[3], "CHANMODES="); if (pos) { pos += 10; pos2 = strchr (pos, ' '); if (pos2) pos2[0] = '\0'; if (server->chanmodes) free (server->chanmodes); server->chanmodes = strdup (pos); if (pos2) pos2[0] = ' '; } /* save monitor (limit) */ pos = strstr (argv_eol[3], "MONITOR="); if (pos) { pos += 8; pos2 = strchr (pos, ' '); if (pos2) pos2[0] = '\0'; error = NULL; value = strtol (pos, &error, 10); if (error && !error[0] && (value > 0)) server->monitor = (int)value; if (pos2) pos2[0] = ' '; } /* save whole message (concatenate to existing isupport, if any) */ pos_start = NULL; pos = strstr (argv_eol[3], " :"); length = (pos) ? pos - argv_eol[3] : (int)strlen (argv_eol[3]); if (server->isupport) { length_isupport = strlen (server->isupport); isupport2 = realloc (server->isupport, length_isupport + /* existing */ 1 + length + 1); /* new */ if (isupport2) { server->isupport = isupport2; pos_start = server->isupport + length_isupport; } } else { server->isupport = malloc (1 + length + 1); if (server->isupport) pos_start = server->isupport; } if (pos_start) { pos_start[0] = ' '; memcpy (pos_start + 1, argv_eol[3], length); pos_start[length + 1] = '\0'; } return WEECHAT_RC_OK; }
0
244,225
GF_Err vwid_box_read(GF_Box *s,GF_BitStream *bs) { u32 i; GF_ViewIdentifierBox *ptr = (GF_ViewIdentifierBox *) s; ISOM_DECREASE_SIZE(s, 3) gf_bs_read_int(bs, 2); ptr->min_temporal_id = gf_bs_read_int(bs, 3); ptr->max_temporal_id = gf_bs_read_int(bs, 3); ptr->num_views = gf_bs_read_u16(bs); if (ptr->num_views > ptr->size / 6) return GF_ISOM_INVALID_FILE; ptr->views = gf_malloc(sizeof(ViewIDEntry)*ptr->num_views); memset(ptr->views, 0, sizeof(ViewIDEntry)*ptr->num_views); for (i=0; i<ptr->num_views; i++) { u32 j; ISOM_DECREASE_SIZE(s, 6) gf_bs_read_int(bs, 6); ptr->views[i].view_id = gf_bs_read_int(bs, 10); gf_bs_read_int(bs, 6); ptr->views[i].view_order_index = gf_bs_read_int(bs, 10); ptr->views[i].texture_in_stream = gf_bs_read_int(bs, 1); ptr->views[i].texture_in_track = gf_bs_read_int(bs, 1); ptr->views[i].depth_in_stream = gf_bs_read_int(bs, 1); ptr->views[i].depth_in_track = gf_bs_read_int(bs, 1); ptr->views[i].base_view_type = gf_bs_read_int(bs, 2); ptr->views[i].num_ref_views = gf_bs_read_int(bs, 10); if (ptr->views[i].num_ref_views > ptr->size / 2) return GF_ISOM_INVALID_FILE; ptr->views[i].view_refs = gf_malloc(sizeof(ViewIDRefViewEntry)*ptr->views[i].num_ref_views); for (j=0; j<ptr->views[i].num_ref_views; j++) { ISOM_DECREASE_SIZE(s, 2) gf_bs_read_int(bs, 4); ptr->views[i].view_refs[j].dep_comp_idc = gf_bs_read_int(bs, 2); ptr->views[i].view_refs[j].ref_view_id = gf_bs_read_int(bs, 10); } } return GF_OK; }
0
309,930
NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_DCLx int old_pair, int pair, int reverse, NCURSES_SP_OUTC outc) { #ifdef USE_TERM_DRIVER CallDriver_4(SP_PARM, td_docolor, old_pair, pair, reverse, outc); #else int fg = COLOR_DEFAULT; int bg = COLOR_DEFAULT; int old_fg = -1; int old_bg = -1; if (!ValidPair(SP_PARM, pair)) { return; } else if (pair != 0) { if (set_color_pair) { TPUTS_TRACE("set_color_pair"); NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx TIPARM_1(set_color_pair, pair), 1, outc); return; } else if (SP_PARM != 0) { if (_nc_pair_content(SP_PARM, pair, &fg, &bg) == ERR) return; } } if (old_pair >= 0 && SP_PARM != 0 && _nc_pair_content(SP_PARM, old_pair, &old_fg, &old_bg) != ERR) { if ((isDefaultColor(fg) && !isDefaultColor(old_fg)) || (isDefaultColor(bg) && !isDefaultColor(old_bg))) { #if NCURSES_EXT_FUNCS /* * A minor optimization - but extension. If "AX" is specified in * the terminal description, treat it as screen's indicator of ECMA * SGR 39 and SGR 49, and assume the two sequences are independent. */ if (SP_PARM->_has_sgr_39_49 && isDefaultColor(old_bg) && !isDefaultColor(old_fg)) { NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx "\033[39m", 1, outc); } else if (SP_PARM->_has_sgr_39_49 && isDefaultColor(old_fg) && !isDefaultColor(old_bg)) { NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx "\033[49m", 1, outc); } else #endif reset_color_pair(NCURSES_SP_ARG); } } else { reset_color_pair(NCURSES_SP_ARG); if (old_pair < 0 && pair <= 0) return; } #if NCURSES_EXT_FUNCS if (isDefaultColor(fg)) fg = default_fg(NCURSES_SP_ARG); if (isDefaultColor(bg)) bg = default_bg(NCURSES_SP_ARG); #endif if (reverse) { int xx = fg; fg = bg; bg = xx; } TR(TRACE_ATTRS, ("setting colors: pair = %d, fg = %d, bg = %d", pair, fg, bg)); if (!isDefaultColor(fg)) { set_foreground_color(NCURSES_SP_ARGx fg, outc); } if (!isDefaultColor(bg)) { set_background_color(NCURSES_SP_ARGx bg, outc); } #endif }
0
90,828
void set_db_disabled(bool db_disabled) { db_disabled_ = db_disabled; }
0
300,800
static int tipc_getsockopt(struct socket *sock, int lvl, int opt, char __user *ov, int __user *ol) { struct sock *sk = sock->sk; struct tipc_sock *tsk = tipc_sk(sk); struct tipc_service_range seq; int len, scope; u32 value; int res; if ((lvl == IPPROTO_TCP) && (sock->type == SOCK_STREAM)) return put_user(0, ol); if (lvl != SOL_TIPC) return -ENOPROTOOPT; res = get_user(len, ol); if (res) return res; lock_sock(sk); switch (opt) { case TIPC_IMPORTANCE: value = tsk_importance(tsk); break; case TIPC_SRC_DROPPABLE: value = tsk_unreliable(tsk); break; case TIPC_DEST_DROPPABLE: value = tsk_unreturnable(tsk); break; case TIPC_CONN_TIMEOUT: value = tsk->conn_timeout; /* no need to set "res", since already 0 at this point */ break; case TIPC_NODE_RECVQ_DEPTH: value = 0; /* was tipc_queue_size, now obsolete */ break; case TIPC_SOCK_RECVQ_DEPTH: value = skb_queue_len(&sk->sk_receive_queue); break; case TIPC_SOCK_RECVQ_USED: value = sk_rmem_alloc_get(sk); break; case TIPC_GROUP_JOIN: seq.type = 0; if (tsk->group) tipc_group_self(tsk->group, &seq, &scope); value = seq.type; break; default: res = -EINVAL; } release_sock(sk); if (res) return res; /* "get" failed */ if (len < sizeof(value)) return -EINVAL; if (copy_to_user(ov, &value, sizeof(value))) return -EFAULT; return put_user(sizeof(value), ol); }
0
459,116
static int tc_get_tfilter(struct sk_buff *skb, struct nlmsghdr *n, struct netlink_ext_ack *extack) { struct net *net = sock_net(skb->sk); struct nlattr *tca[TCA_MAX + 1]; char name[IFNAMSIZ]; struct tcmsg *t; u32 protocol; u32 prio; u32 parent; u32 chain_index; struct Qdisc *q = NULL; struct tcf_chain_info chain_info; struct tcf_chain *chain = NULL; struct tcf_block *block = NULL; struct tcf_proto *tp = NULL; unsigned long cl = 0; void *fh = NULL; int err; bool rtnl_held = false; err = nlmsg_parse_deprecated(n, sizeof(*t), tca, TCA_MAX, rtm_tca_policy, extack); if (err < 0) return err; t = nlmsg_data(n); protocol = TC_H_MIN(t->tcm_info); prio = TC_H_MAJ(t->tcm_info); parent = t->tcm_parent; if (prio == 0) { NL_SET_ERR_MSG(extack, "Invalid filter command with priority of zero"); return -ENOENT; } /* Find head of filter chain. */ err = __tcf_qdisc_find(net, &q, &parent, t->tcm_ifindex, false, extack); if (err) return err; if (tcf_proto_check_kind(tca[TCA_KIND], name)) { NL_SET_ERR_MSG(extack, "Specified TC filter name too long"); err = -EINVAL; goto errout; } /* Take rtnl mutex if block is shared (no qdisc found), qdisc is not * unlocked, classifier type is not specified, classifier is not * unlocked. */ if ((q && !(q->ops->cl_ops->flags & QDISC_CLASS_OPS_DOIT_UNLOCKED)) || !tcf_proto_is_unlocked(name)) { rtnl_held = true; rtnl_lock(); } err = __tcf_qdisc_cl_find(q, parent, &cl, t->tcm_ifindex, extack); if (err) goto errout; block = __tcf_block_find(net, q, cl, t->tcm_ifindex, t->tcm_block_index, extack); if (IS_ERR(block)) { err = PTR_ERR(block); goto errout; } chain_index = tca[TCA_CHAIN] ? nla_get_u32(tca[TCA_CHAIN]) : 0; if (chain_index > TC_ACT_EXT_VAL_MASK) { NL_SET_ERR_MSG(extack, "Specified chain index exceeds upper limit"); err = -EINVAL; goto errout; } chain = tcf_chain_get(block, chain_index, false); if (!chain) { NL_SET_ERR_MSG(extack, "Cannot find specified filter chain"); err = -EINVAL; goto errout; } mutex_lock(&chain->filter_chain_lock); tp = tcf_chain_tp_find(chain, &chain_info, protocol, prio, false); mutex_unlock(&chain->filter_chain_lock); if (!tp || IS_ERR(tp)) { NL_SET_ERR_MSG(extack, "Filter with specified priority/protocol not found"); err = tp ? PTR_ERR(tp) : -ENOENT; goto errout; } else if (tca[TCA_KIND] && nla_strcmp(tca[TCA_KIND], tp->ops->kind)) { NL_SET_ERR_MSG(extack, "Specified filter kind does not match existing one"); err = -EINVAL; goto errout; } fh = tp->ops->get(tp, t->tcm_handle); if (!fh) { NL_SET_ERR_MSG(extack, "Specified filter handle not found"); err = -ENOENT; } else { err = tfilter_notify(net, skb, n, tp, block, q, parent, fh, RTM_NEWTFILTER, true, rtnl_held); if (err < 0) NL_SET_ERR_MSG(extack, "Failed to send filter notify message"); } tfilter_put(tp, fh); errout: if (chain) { if (tp && !IS_ERR(tp)) tcf_proto_put(tp, rtnl_held, NULL); tcf_chain_put(chain); } tcf_block_release(q, block, rtnl_held); if (rtnl_held) rtnl_unlock(); return err; }
0
253,520
smb2_flush_file(const unsigned int xid, struct cifs_tcon *tcon, struct cifs_fid *fid) { return SMB2_flush(xid, tcon, fid->persistent_fid, fid->volatile_fid); }
0
417,093
PlayerGeneric::~PlayerGeneric() { if (player) { if (mixer && mixer->isActive() && !mixer->isDeviceRemoved(player)) mixer->removeDevice(player); delete player; } if (mixer) delete mixer; delete[] audioDriverName; delete listener; }
0
412,142
respip_inform_print(struct respip_addr_info* respip_addr, uint8_t* qname, uint16_t qtype, uint16_t qclass, struct local_rrset* local_alias, struct comm_reply* repinfo) { char srcip[128], respip[128], txt[512]; unsigned port; if(local_alias) qname = local_alias->rrset->rk.dname; port = (unsigned)((repinfo->addr.ss_family == AF_INET) ? ntohs(((struct sockaddr_in*)&repinfo->addr)->sin_port) : ntohs(((struct sockaddr_in6*)&repinfo->addr)->sin6_port)); addr_to_str(&repinfo->addr, repinfo->addrlen, srcip, sizeof(srcip)); addr_to_str(&respip_addr->addr, respip_addr->addrlen, respip, sizeof(respip)); snprintf(txt, sizeof(txt), "%s/%d inform %s@%u", respip, respip_addr->net, srcip, port); log_nametypeclass(0, txt, qname, qtype, qclass); }
0
301,442
static ssize_t vfswrap_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *tofsp, off_t offset, size_t n) { ssize_t result; START_PROFILE_BYTES(syscall_recvfile, n); result = sys_recvfile(fromfd, tofsp->fh->fd, offset, n); END_PROFILE(syscall_recvfile); return result; }
0
387,772
void InstanceKlass::clean_weak_instanceklass_links() { clean_implementors_list(); clean_method_data(); // Since GC iterates InstanceKlasses sequentially, it is safe to remove stale entries here. DependencyContext dep_context(&_dep_context); dep_context.expunge_stale_entries(); }
0