idx
int64
func
string
target
int64
389,921
ServerKeyExchange::~ServerKeyExchange() { ysDelete(server_key_); }
0
464,734
static int v4l_g_crop(const struct v4l2_ioctl_ops *ops, struct file *file, void *fh, void *arg) { struct video_device *vfd = video_devdata(file); struct v4l2_crop *p = arg; struct v4l2_selection s = { .type = p->type, }; int ret; /* simulate capture crop using selection api */ /* crop means compose for output devices */ if (V4L2_TYPE_IS_OUTPUT(p->type)) s.target = V4L2_SEL_TGT_COMPOSE; else s.target = V4L2_SEL_TGT_CROP; if (test_bit(V4L2_FL_QUIRK_INVERTED_CROP, &vfd->flags)) s.target = s.target == V4L2_SEL_TGT_COMPOSE ? V4L2_SEL_TGT_CROP : V4L2_SEL_TGT_COMPOSE; ret = v4l_g_selection(ops, file, fh, &s); /* copying results to old structure on success */ if (!ret) p->c = s.r; return ret; }
0
438,628
static u32 *gen8_emit_fini_breadcrumb(struct i915_request *request, u32 *cs) { cs = gen8_emit_ggtt_write(cs, request->fence.seqno, i915_request_active_timeline(request)->hwsp_offset, 0); return gen8_emit_fini_breadcrumb_footer(request, cs); }
0
337,697
static int rm_assemble_video_frame(AVFormatContext *s, ByteIOContext *pb, RMDemuxContext *rm, RMStream *vst, AVPacket *pkt, int len, int *pseq) { int hdr, seq, pic_num, len2, pos; int type; hdr = get_byte(pb); len--; type = hdr >> 6; if(type != 3){ // not frame as a part of packet seq = get_byte(pb); len--; } if(type != 1){ // not whole frame len2 = get_num(pb, &len); pos = get_num(pb, &len); pic_num = get_byte(pb); len--; } if(len<0) return -1; rm->remaining_len = len; if(type&1){ // frame, not slice if(type == 3) // frame as a part of packet len= len2; if(rm->remaining_len < len) return -1; rm->remaining_len -= len; if(av_new_packet(pkt, len + 9) < 0) return AVERROR(EIO); pkt->data[0] = 0; AV_WL32(pkt->data + 1, 1); AV_WL32(pkt->data + 5, 0); get_buffer(pb, pkt->data + 9, len); return 0; } //now we have to deal with single slice *pseq = seq; if((seq & 0x7F) == 1 || vst->curpic_num != pic_num){ vst->slices = ((hdr & 0x3F) << 1) + 1; vst->videobufsize = len2 + 8*vst->slices + 1; av_free_packet(&vst->pkt); //FIXME this should be output. if(av_new_packet(&vst->pkt, vst->videobufsize) < 0) return AVERROR(ENOMEM); vst->videobufpos = 8*vst->slices + 1; vst->cur_slice = 0; vst->curpic_num = pic_num; vst->pktpos = url_ftell(pb); } if(type == 2) len = FFMIN(len, pos); if(++vst->cur_slice > vst->slices) return 1; AV_WL32(vst->pkt.data - 7 + 8*vst->cur_slice, 1); AV_WL32(vst->pkt.data - 3 + 8*vst->cur_slice, vst->videobufpos - 8*vst->slices - 1); if(vst->videobufpos + len > vst->videobufsize) return 1; if (get_buffer(pb, vst->pkt.data + vst->videobufpos, len) != len) return AVERROR(EIO); vst->videobufpos += len; rm->remaining_len-= len; if(type == 2 || (vst->videobufpos) == vst->videobufsize){ vst->pkt.data[0] = vst->cur_slice-1; *pkt= vst->pkt; vst->pkt.data= NULL; vst->pkt.size= 0; if(vst->slices != vst->cur_slice) //FIXME find out how to set slices correct from the begin memmove(pkt->data + 1 + 8*vst->cur_slice, pkt->data + 1 + 8*vst->slices, vst->videobufpos - 1 - 8*vst->slices); pkt->size = vst->videobufpos + 8*(vst->cur_slice - vst->slices); pkt->pts = AV_NOPTS_VALUE; pkt->pos = vst->pktpos; return 0; } return 1; }
1
339,831
static void loop_filter(H264Context *h){ MpegEncContext * const s = &h->s; uint8_t *dest_y, *dest_cb, *dest_cr; int linesize, uvlinesize, mb_x, mb_y; const int end_mb_y= s->mb_y + FRAME_MBAFF; const int old_slice_type= h->slice_type; if(h->deblocking_filter) { for(mb_x= 0; mb_x<s->mb_width; mb_x++){ for(mb_y=end_mb_y - FRAME_MBAFF; mb_y<= end_mb_y; mb_y++){ int list, mb_xy, mb_type; mb_xy = h->mb_xy = mb_x + mb_y*s->mb_stride; h->slice_num= h->slice_table[mb_xy]; mb_type= s->current_picture.mb_type[mb_xy]; h->list_count= h->list_counts[mb_xy]; if(FRAME_MBAFF) h->mb_mbaff = h->mb_field_decoding_flag = !!IS_INTERLACED(mb_type); s->mb_x= mb_x; s->mb_y= mb_y; dest_y = s->current_picture.data[0] + (mb_x + mb_y * s->linesize ) * 16; dest_cb = s->current_picture.data[1] + (mb_x + mb_y * s->uvlinesize) * 8; dest_cr = s->current_picture.data[2] + (mb_x + mb_y * s->uvlinesize) * 8; //FIXME simplify above if (MB_FIELD) { linesize = h->mb_linesize = s->linesize * 2; uvlinesize = h->mb_uvlinesize = s->uvlinesize * 2; if(mb_y&1){ //FIXME move out of this function? dest_y -= s->linesize*15; dest_cb-= s->uvlinesize*7; dest_cr-= s->uvlinesize*7; } } else { linesize = h->mb_linesize = s->linesize; uvlinesize = h->mb_uvlinesize = s->uvlinesize; } backup_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 0); if(fill_filter_caches(h, mb_type) < 0) continue; h->chroma_qp[0] = get_chroma_qp(h, 0, s->current_picture.qscale_table[mb_xy]); h->chroma_qp[1] = get_chroma_qp(h, 1, s->current_picture.qscale_table[mb_xy]); if (FRAME_MBAFF) { ff_h264_filter_mb (h, mb_x, mb_y, dest_y, dest_cb, dest_cr, linesize, uvlinesize); } else { ff_h264_filter_mb_fast(h, mb_x, mb_y, dest_y, dest_cb, dest_cr, linesize, uvlinesize); } } } } h->slice_type= old_slice_type; s->mb_x= 0; s->mb_y= end_mb_y - FRAME_MBAFF; }
0
355,095
ProcShmDispatch (client) register ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_ShmQueryVersion: return ProcShmQueryVersion(client); case X_ShmAttach: return ProcShmAttach(client); case X_ShmDetach: return ProcShmDetach(client); case X_ShmPutImage: #ifdef PANORAMIX if ( !noPanoramiXExtension ) return ProcPanoramiXShmPutImage(client); #endif return ProcShmPutImage(client); case X_ShmGetImage: #ifdef PANORAMIX if ( !noPanoramiXExtension ) return ProcPanoramiXShmGetImage(client); #endif return ProcShmGetImage(client); case X_ShmCreatePixmap: #ifdef PANORAMIX if ( !noPanoramiXExtension ) return ProcPanoramiXShmCreatePixmap(client); #endif return ProcShmCreatePixmap(client); default: return BadRequest; } }
0
140,023
nvme_fc_parse_traddr(struct nvmet_fc_traddr *traddr, char *buf, size_t blen) { char name[2 + NVME_FC_TRADDR_HEXNAMELEN + 1]; substring_t wwn = { name, &name[sizeof(name)-1] }; int nnoffset, pnoffset; /* validate it string one of the 2 allowed formats */ if (strnlen(buf, blen) == NVME_FC_TRADDR_MAXLENGTH && !strncmp(buf, "nn-0x", NVME_FC_TRADDR_OXNNLEN) && !strncmp(&buf[NVME_FC_TRADDR_MAX_PN_OFFSET], "pn-0x", NVME_FC_TRADDR_OXNNLEN)) { nnoffset = NVME_FC_TRADDR_OXNNLEN; pnoffset = NVME_FC_TRADDR_MAX_PN_OFFSET + NVME_FC_TRADDR_OXNNLEN; } else if ((strnlen(buf, blen) == NVME_FC_TRADDR_MINLENGTH && !strncmp(buf, "nn-", NVME_FC_TRADDR_NNLEN) && !strncmp(&buf[NVME_FC_TRADDR_MIN_PN_OFFSET], "pn-", NVME_FC_TRADDR_NNLEN))) { nnoffset = NVME_FC_TRADDR_NNLEN; pnoffset = NVME_FC_TRADDR_MIN_PN_OFFSET + NVME_FC_TRADDR_NNLEN; } else goto out_einval; name[0] = '0'; name[1] = 'x'; name[2 + NVME_FC_TRADDR_HEXNAMELEN] = 0; memcpy(&name[2], &buf[nnoffset], NVME_FC_TRADDR_HEXNAMELEN); if (__nvme_fc_parse_u64(&wwn, &traddr->nn)) goto out_einval; memcpy(&name[2], &buf[pnoffset], NVME_FC_TRADDR_HEXNAMELEN); if (__nvme_fc_parse_u64(&wwn, &traddr->pn)) goto out_einval; return 0; out_einval: pr_warn("%s: bad traddr string\n", __func__); return -EINVAL; }
0
55,083
static int proc_close( struct inode *inode, struct file *file ) { struct proc_data *data = file->private_data; if (data->on_close != NULL) data->on_close(inode, file); kfree(data->rbuffer); kfree(data->wbuffer); kfree(data); return 0; }
0
101,156
static void *alloc_event_data(int cpu) { int size; cpumask_t *mask; struct etm_event_data *event_data; /* First get memory for the session's data */ event_data = kzalloc(sizeof(struct etm_event_data), GFP_KERNEL); if (!event_data) return NULL; /* Make sure nothing disappears under us */ get_online_cpus(); size = num_online_cpus(); mask = &event_data->mask; if (cpu != -1) cpumask_set_cpu(cpu, mask); else cpumask_copy(mask, cpu_online_mask); put_online_cpus(); /* * Each CPU has a single path between source and destination. As such * allocate an array using CPU numbers as indexes. That way a path * for any CPU can easily be accessed at any given time. We proceed * the same way for sessions involving a single CPU. The cost of * unused memory when dealing with single CPU trace scenarios is small * compared to the cost of searching through an optimized array. */ event_data->path = kcalloc(size, sizeof(struct list_head *), GFP_KERNEL); if (!event_data->path) { kfree(event_data); return NULL; } return event_data; }
0
421,293
int bus_socket_connect(sd_bus *b) { bool inotify_done = false; int r; assert(b); for (;;) { assert(b->input_fd < 0); assert(b->output_fd < 0); assert(b->sockaddr.sa.sa_family != AF_UNSPEC); b->input_fd = socket(b->sockaddr.sa.sa_family, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0); if (b->input_fd < 0) return -errno; b->input_fd = fd_move_above_stdio(b->input_fd); b->output_fd = b->input_fd; bus_socket_setup(b); if (connect(b->input_fd, &b->sockaddr.sa, b->sockaddr_size) < 0) { if (errno == EINPROGRESS) { /* If we have any inotify watches open, close them now, we don't need them anymore, as * we have successfully initiated a connection */ bus_close_inotify_fd(b); /* Note that very likely we are already in BUS_OPENING state here, as we enter it when * we start parsing the address string. The only reason we set the state explicitly * here, is to undo BUS_WATCH_BIND, in case we did the inotify magic. */ bus_set_state(b, BUS_OPENING); return 1; } if (IN_SET(errno, ENOENT, ECONNREFUSED) && /* ENOENT → unix socket doesn't exist at all; ECONNREFUSED → unix socket stale */ b->watch_bind && b->sockaddr.sa.sa_family == AF_UNIX && b->sockaddr.un.sun_path[0] != 0) { /* This connection attempt failed, let's release the socket for now, and start with a * fresh one when reconnecting. */ bus_close_io_fds(b); if (inotify_done) { /* inotify set up already, don't do it again, just return now, and remember * that we are waiting for inotify events now. */ bus_set_state(b, BUS_WATCH_BIND); return 1; } /* This is a file system socket, and the inotify logic is enabled. Let's create the necessary inotify fd. */ r = bus_socket_inotify_setup(b); if (r < 0) return r; /* Let's now try to connect a second time, because in theory there's otherwise a race * here: the socket might have been created in the time between our first connect() and * the time we set up the inotify logic. But let's remember that we set up inotify now, * so that we don't do the connect() more than twice. */ inotify_done = true; } else return -errno; } else break; } /* Yay, established, we don't need no inotify anymore! */ bus_close_inotify_fd(b); return bus_socket_start_auth(b); }
0
509,266
static int manager_dispatch_time_change_fd(sd_event_source *source, int fd, uint32_t revents, void *userdata) { Manager *m = userdata; Iterator i; Unit *u; assert(m); assert(m->time_change_fd == fd); log_struct(LOG_INFO, MESSAGE_ID(SD_MESSAGE_TIME_CHANGE), "MESSAGE=Time has been changed", NULL); /* Restart the watch */ m->time_change_event_source = sd_event_source_unref(m->time_change_event_source); close_nointr_nofail(m->time_change_fd); m->time_change_fd = -1; manager_setup_time_change(m); HASHMAP_FOREACH(u, m->units, i) if (UNIT_VTABLE(u)->time_change) UNIT_VTABLE(u)->time_change(u); return 0; }
0
505,799
static int FIPS_sha512_test() { unsigned char digest[SHA512_DIGEST_LENGTH] = {0x99, 0xc9, 0xe9, 0x5b, 0x88, 0xd4, 0x78, 0x88, 0xdf, 0x88, 0x5f, 0x94, 0x71, 0x64, 0x28, 0xca, 0x16, 0x1f, 0x3d, 0xf4, 0x1f, 0xf3, 0x0f, 0xc5, 0x03, 0x99, 0xb2, 0xd0, 0xe7, 0x0b, 0x94, 0x4a, 0x45, 0xd2, 0x6c, 0x4f, 0x20, 0x06, 0xef, 0x71, 0xa9, 0x25, 0x7f, 0x24, 0xb1, 0xd9, 0x40, 0x22, 0x49, 0x54, 0x10, 0xc2, 0x22, 0x9d, 0x27, 0xfe, 0xbd, 0xd6, 0xd6, 0xeb, 0x2d, 0x42, 0x1d, 0xa3}; unsigned char str[] = "etaonrishd"; unsigned char md[SHA512_DIGEST_LENGTH]; ERR_clear_error(); if (!FIPS_digest(str,sizeof(str) - 1,md, NULL, EVP_sha512())) return 0; if (memcmp(md,digest,sizeof(md))) return 0; return 1; }
0
308,590
tar_sparse_dump_region (struct tar_sparse_file *file, size_t i) { if (file->optab->dump_region) return file->optab->dump_region (file, i); return false; }
0
503,120
static void connection_handle_shutdown(connection *con) { plugins_call_handle_connection_shut_wr(con); connection_reset(con); ++con->srv->con_closed; /* close the connection */ if (con->fd >= 0 && (con->is_ssl_sock || 0 == shutdown(con->fd, SHUT_WR))) { con->close_timeout_ts = log_epoch_secs; request_st * const r = &con->request; connection_set_state(r, CON_STATE_CLOSE); if (r->conf.log_state_handling) { log_error(r->conf.errh, __FILE__, __LINE__, "shutdown for fd %d", con->fd); } } else { connection_close(con); } }
0
447,754
imapx_untagged_list (CamelIMAPXServer *is, GInputStream *input_stream, GCancellable *cancellable, GError **error) { CamelIMAPXListResponse *response; const gchar *mailbox_name; gchar separator; g_return_val_if_fail (CAMEL_IS_IMAPX_SERVER (is), FALSE); response = camel_imapx_list_response_new ( CAMEL_IMAPX_INPUT_STREAM (input_stream), cancellable, error); if (response == NULL) return FALSE; mailbox_name = camel_imapx_list_response_get_mailbox_name (response); separator = camel_imapx_list_response_get_separator (response); /* Record the INBOX separator character once we know it. */ if (camel_imapx_mailbox_is_inbox (mailbox_name)) is->priv->inbox_separator = separator; if (is->priv->list_responses_hash) { is->priv->list_responses = g_slist_prepend (is->priv->list_responses, response); g_hash_table_insert (is->priv->list_responses_hash, (gpointer) camel_imapx_list_response_get_mailbox_name (response), response); } else { CamelIMAPXStore *imapx_store; imapx_store = camel_imapx_server_ref_store (is); camel_imapx_store_handle_list_response (imapx_store, is, response); g_clear_object (&imapx_store); g_clear_object (&response); } return TRUE; }
0
361,657
_gnutls_mac_is_ok (gnutls_mac_algorithm_t algorithm) { ssize_t ret = -1; GNUTLS_HASH_ALG_LOOP (ret = p->id); if (ret >= 0) ret = 0; else ret = 1; return ret; }
0
374,567
RangeVarCallbackOwnsTable(const RangeVar *relation, Oid relId, Oid oldRelId, void *arg) { char relkind; /* Nothing to do if the relation was not found. */ if (!OidIsValid(relId)) return; /* * If the relation does exist, check whether it's an index. But note that * the relation might have been dropped between the time we did the name * lookup and now. In that case, there's nothing to do. */ relkind = get_rel_relkind(relId); if (!relkind) return; if (relkind != RELKIND_RELATION && relkind != RELKIND_TOASTVALUE && relkind != RELKIND_MATVIEW) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("\"%s\" is not a table or materialized view", relation->relname))); /* Check permissions */ if (!pg_class_ownercheck(relId, GetUserId())) aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_CLASS, relation->relname); }
0
471,350
void addReplyHumanLongDouble(client *c, long double d) { if (c->resp == 2) { robj *o = createStringObjectFromLongDouble(d,1); addReplyBulk(c,o); decrRefCount(o); } else { char buf[MAX_LONG_DOUBLE_CHARS]; int len = ld2string(buf,sizeof(buf),d,LD_STR_HUMAN); addReplyProto(c,",",1); addReplyProto(c,buf,len); addReplyProto(c,"\r\n",2); } }
0
105,093
ff_rm_parse_packet (AVFormatContext *s, AVIOContext *pb, AVStream *st, RMStream *ast, int len, AVPacket *pkt, int *seq, int flags, int64_t timestamp) { RMDemuxContext *rm = s->priv_data; int ret; if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { rm->current_stream= st->id; ret = rm_assemble_video_frame(s, pb, rm, ast, pkt, len, seq, &timestamp); if(ret) return ret < 0 ? ret : -1; //got partial frame or error } else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) { if ((ast->deint_id == DEINT_ID_GENR) || (ast->deint_id == DEINT_ID_INT4) || (ast->deint_id == DEINT_ID_SIPR)) { int x; int sps = ast->sub_packet_size; int cfs = ast->coded_framesize; int h = ast->sub_packet_h; int y = ast->sub_packet_cnt; int w = ast->audio_framesize; if (flags & 2) y = ast->sub_packet_cnt = 0; if (!y) ast->audiotimestamp = timestamp; switch (ast->deint_id) { case DEINT_ID_INT4: for (x = 0; x < h/2; x++) readfull(s, pb, ast->pkt.data+x*2*w+y*cfs, cfs); break; case DEINT_ID_GENR: for (x = 0; x < w/sps; x++) readfull(s, pb, ast->pkt.data+sps*(h*x+((h+1)/2)*(y&1)+(y>>1)), sps); break; case DEINT_ID_SIPR: readfull(s, pb, ast->pkt.data + y * w, w); break; } if (++(ast->sub_packet_cnt) < h) return -1; if (ast->deint_id == DEINT_ID_SIPR) ff_rm_reorder_sipr_data(ast->pkt.data, h, w); ast->sub_packet_cnt = 0; rm->audio_stream_num = st->index; if (st->codecpar->block_align <= 0) { av_log(s, AV_LOG_ERROR, "Invalid block alignment %d\n", st->codecpar->block_align); return AVERROR_INVALIDDATA; } rm->audio_pkt_cnt = h * w / st->codecpar->block_align; } else if ((ast->deint_id == DEINT_ID_VBRF) || (ast->deint_id == DEINT_ID_VBRS)) { int x; rm->audio_stream_num = st->index; ast->sub_packet_cnt = (avio_rb16(pb) & 0xf0) >> 4; if (ast->sub_packet_cnt) { for (x = 0; x < ast->sub_packet_cnt; x++) ast->sub_packet_lengths[x] = avio_rb16(pb); rm->audio_pkt_cnt = ast->sub_packet_cnt; ast->audiotimestamp = timestamp; } else return -1; } else { ret = av_get_packet(pb, pkt, len); if (ret < 0) return ret; rm_ac3_swap_bytes(st, pkt); } } else { ret = av_get_packet(pb, pkt, len); if (ret < 0) return ret; } pkt->stream_index = st->index; pkt->pts = timestamp; if (flags & 2) pkt->flags |= AV_PKT_FLAG_KEY; return st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO ? rm->audio_pkt_cnt : 0; }
0
83,651
int pit_has_pending_timer(struct kvm_vcpu *vcpu) { struct kvm_pit *pit = vcpu->kvm->arch.vpit; if (pit && kvm_vcpu_is_bsp(vcpu) && pit->pit_state.irq_ack) return atomic_read(&pit->pit_state.pit_timer.pending); return 0; }
0
375,248
_copyAlterTSDictionaryStmt(const AlterTSDictionaryStmt *from) { AlterTSDictionaryStmt *newnode = makeNode(AlterTSDictionaryStmt); COPY_NODE_FIELD(dictname); COPY_NODE_FIELD(options); return newnode; }
0
422,127
e_ews_connection_get_server_version (EEwsConnection *cnc) { g_return_val_if_fail (cnc != NULL, E_EWS_EXCHANGE_UNKNOWN); g_return_val_if_fail (cnc->priv != NULL, E_EWS_EXCHANGE_UNKNOWN); return cnc->priv->version; }
0
239,593
void RenderBox::addShadowOverflow() { int shadowLeft; int shadowRight; int shadowTop; int shadowBottom; style()->getBoxShadowExtent(shadowTop, shadowRight, shadowBottom, shadowLeft); IntRect borderBox = borderBoxRect(); int overflowLeft = borderBox.x() + shadowLeft; int overflowRight = borderBox.maxX() + shadowRight; int overflowTop = borderBox.y() + shadowTop; int overflowBottom = borderBox.maxY() + shadowBottom; addVisualOverflow(IntRect(overflowLeft, overflowTop, overflowRight - overflowLeft, overflowBottom - overflowTop)); }
0
101,725
static int kvm_get_msr_with_filter(struct kvm_vcpu *vcpu, u32 index, u64 *data) { if (!kvm_msr_allowed(vcpu, index, KVM_MSR_FILTER_READ)) return KVM_MSR_RET_FILTERED; return kvm_get_msr_ignored_check(vcpu, index, data, false); }
0
388,696
int smb_vfs_call_closedir(struct vfs_handle_struct *handle, DIR *dir) { VFS_FIND(closedir); return handle->fns->closedir_fn(handle, dir); }
0
69,908
bracketed_paste(paste_mode_T mode, int drop, garray_T *gap) { int c; char_u buf[NUMBUFLEN + MB_MAXBYTES]; int idx = 0; char_u *end = find_termcode((char_u *)"PE"); int ret_char = -1; int save_allow_keys = allow_keys; int save_paste = p_paste; // If the end code is too long we can't detect it, read everything. if (end != NULL && STRLEN(end) >= NUMBUFLEN) end = NULL; ++no_mapping; allow_keys = 0; if (!p_paste) // Also have the side effects of setting 'paste' to make it work much // faster. set_option_value((char_u *)"paste", TRUE, NULL, 0); for (;;) { // When the end is not defined read everything there is. if (end == NULL && vpeekc() == NUL) break; do c = vgetc(); while (c == K_IGNORE || c == K_VER_SCROLLBAR || c == K_HOR_SCROLLBAR); if (c == NUL || got_int || (ex_normal_busy > 0 && c == Ctrl_C)) // When CTRL-C was encountered the typeahead will be flushed and we // won't get the end sequence. Except when using ":normal". break; if (has_mbyte) idx += (*mb_char2bytes)(c, buf + idx); else buf[idx++] = c; buf[idx] = NUL; if (end != NULL && STRNCMP(buf, end, idx) == 0) { if (end[idx] == NUL) break; // Found the end of paste code. continue; } if (!drop) { switch (mode) { case PASTE_CMDLINE: put_on_cmdline(buf, idx, TRUE); break; case PASTE_EX: // add one for the NUL that is going to be appended if (gap != NULL && ga_grow(gap, idx + 1) == OK) { mch_memmove((char *)gap->ga_data + gap->ga_len, buf, (size_t)idx); gap->ga_len += idx; } break; case PASTE_INSERT: if (stop_arrow() == OK) { c = buf[0]; if (idx == 1 && (c == CAR || c == K_KENTER || c == NL)) ins_eol(c); else { ins_char_bytes(buf, idx); AppendToRedobuffLit(buf, idx); } } break; case PASTE_ONE_CHAR: if (ret_char == -1) { if (has_mbyte) ret_char = (*mb_ptr2char)(buf); else ret_char = buf[0]; } break; } } idx = 0; } --no_mapping; allow_keys = save_allow_keys; if (!save_paste) set_option_value((char_u *)"paste", FALSE, NULL, 0); return ret_char; }
0
194,187
void UsbDevice::OpenInterface(int interface_id, const OpenCallback& callback) {
0
182,756
void lbl_destroy() { pthread_mutex_destroy(&(device.lbllock)); }
0
322,344
static void cirrus_invalidate_region(CirrusVGAState * s, int off_begin, int off_pitch, int bytesperline, int lines) { int y; int off_cur; int off_cur_end; for (y = 0; y < lines; y++) { off_cur = off_begin; off_cur_end = off_cur + bytesperline; off_cur &= TARGET_PAGE_MASK; while (off_cur < off_cur_end) { cpu_physical_memory_set_dirty(s->vram_offset + off_cur); off_cur += TARGET_PAGE_SIZE; } off_begin += off_pitch; } }
1
308,487
CreateDownloadURLLoaderFactoryGetterFromURLLoaderFactory( std::unique_ptr<network::mojom::URLLoaderFactory> factory) { network::mojom::URLLoaderFactoryPtr factory_ptr; mojo::MakeStrongBinding(std::move(factory), mojo::MakeRequest(&factory_ptr)); network::mojom::URLLoaderFactoryPtrInfo factory_ptr_info = factory_ptr.PassInterface(); auto wrapper_factory = std::make_unique<network::WrapperSharedURLLoaderFactoryInfo>( std::move(factory_ptr_info)); return base::MakeRefCounted<download::DownloadURLLoaderFactoryGetterImpl>( std::move(wrapper_factory)); }
0
433,039
static int v9fs_set_super(struct super_block *s, void *data) { s->s_fs_info = data; return set_anon_super(s, data); }
0
199,172
FPDF_PAGE PDFiumEngine::Form_GetCurrentPage(FPDF_FORMFILLINFO* param, FPDF_DOCUMENT document) { PDFiumEngine* engine = static_cast<PDFiumEngine*>(param); int index = engine->last_page_mouse_down_; if (index == -1) { index = engine->GetMostVisiblePage(); if (index == -1) { NOTREACHED(); return nullptr; } } return engine->pages_[index]->GetPage(); }
0
140,688
static inline void hwsim_check_sta_magic(struct ieee80211_sta *sta) { struct hwsim_sta_priv *sp = (void *)sta->drv_priv; WARN_ON(sp->magic != HWSIM_STA_MAGIC); }
0
115,735
find_match_paren(int ind_maxparen) // XXX { return find_match_char('(', ind_maxparen); }
0
442,139
void setInputFrameBuffer(FrameBuffer& frameBuffer, int pixelType, Array2D<unsigned int>& uData, Array2D<float>& fData, Array2D<half>& hData, int width, int height) { switch (pixelType) { case 0: uData.resizeErase(height, width); frameBuffer.insert ("UINT", Slice (IMF::UINT, (char *) (&uData[0][0]), sizeof (uData[0][0]) * 1, sizeof (uData[0][0]) * width, 1, 1, 0)); break; case 1: fData.resizeErase(height, width); frameBuffer.insert ("FLOAT", Slice (IMF::FLOAT, (char *) (&fData[0][0]), sizeof (fData[0][0]) * 1, sizeof (fData[0][0]) * width, 1, 1, 0)); break; case 2: hData.resizeErase(height, width); frameBuffer.insert ("HALF", Slice (IMF::HALF, (char *) (&hData[0][0]), sizeof (hData[0][0]) * 1, sizeof (hData[0][0]) * width, 1, 1, 0)); break; } }
0
173,132
void HTMLMediaElement::AudioClientImpl::Trace(blink::Visitor* visitor) { visitor->Trace(client_); }
0
43,729
int CL_ScaledMilliseconds( void ) { return Sys_Milliseconds() * com_timescale->value; }
0
175,570
int test_gf2m_mod_div(BIO *bp,BN_CTX *ctx) { BIGNUM *a,*b[2],*c,*d,*e,*f; int i, j, ret = 0; int p0[] = {163,7,6,3,0,-1}; int p1[] = {193,15,0,-1}; a=BN_new(); b[0]=BN_new(); b[1]=BN_new(); c=BN_new(); d=BN_new(); e=BN_new(); f=BN_new(); BN_GF2m_arr2poly(p0, b[0]); BN_GF2m_arr2poly(p1, b[1]); for (i=0; i<num0; i++) { BN_bntest_rand(a, 512, 0, 0); BN_bntest_rand(c, 512, 0, 0); for (j=0; j < 2; j++) { BN_GF2m_mod_div(d, a, c, b[j], ctx); BN_GF2m_mod_mul(e, d, c, b[j], ctx); BN_GF2m_mod_div(f, a, e, b[j], ctx); #if 0 /* make test uses ouput in bc but bc can't handle GF(2^m) arithmetic */ if (bp != NULL) { if (!results) { BN_print(bp,a); BIO_puts(bp, " = "); BN_print(bp,c); BIO_puts(bp," * "); BN_print(bp,d); BIO_puts(bp, " % "); BN_print(bp,b[j]); BIO_puts(bp,"\n"); } } #endif /* Test that ((a/c)*c)/a = 1. */ if(!BN_is_one(f)) { fprintf(stderr,"GF(2^m) modular division test failed!\n"); goto err; } } } ret = 1; err: BN_free(a); BN_free(b[0]); BN_free(b[1]); BN_free(c); BN_free(d); BN_free(e); BN_free(f); return ret; }
0
347,409
static js_Ast *equality(js_State *J, int notin) { js_Ast *a = relational(J, notin); loop: if (jsP_accept(J, TK_EQ)) { a = EXP2(EQ, a, relational(J, notin)); goto loop; } if (jsP_accept(J, TK_NE)) { a = EXP2(NE, a, relational(J, notin)); goto loop; } if (jsP_accept(J, TK_STRICTEQ)) { a = EXP2(STRICTEQ, a, relational(J, notin)); goto loop; } if (jsP_accept(J, TK_STRICTNE)) { a = EXP2(STRICTNE, a, relational(J, notin)); goto loop; } return a; }
1
411,190
**/ CImg<T>& acos() { if (is_empty()) return *this; cimg_pragma_openmp(parallel for cimg_openmp_if(size()>=8192)) cimg_rof(*this,ptrd,T) *ptrd = (T)std::acos((double)*ptrd); return *this;
0
419,354
window_pane_choose_best(struct window_pane **list, u_int size) { struct window_pane *next, *best; u_int i; if (size == 0) return (NULL); best = list[0]; for (i = 1; i < size; i++) { next = list[i]; if (next->active_point > best->active_point) best = next; } return (best); }
0
73,900
do_cast (VerifyContext *ctx, int token, const char *opcode) { ILStackDesc *value; MonoType *type; gboolean is_boxed; gboolean do_box; if (!check_underflow (ctx, 1)) return; if (!(type = get_boxable_mono_type (ctx, token, opcode))) return; if (type->byref) { ADD_VERIFY_ERROR (ctx, g_strdup_printf ("Invalid %s type at 0x%04x", opcode, ctx->ip_offset)); return; } value = stack_pop (ctx); is_boxed = stack_slot_is_boxed_value (value); if (stack_slot_is_managed_pointer (value)) CODE_NOT_VERIFIABLE (ctx, g_strdup_printf ("Invalid value for %s at 0x%04x", opcode, ctx->ip_offset)); else if (!MONO_TYPE_IS_REFERENCE (value->type) && !is_boxed) { char *name = stack_slot_full_name (value); CODE_NOT_VERIFIABLE (ctx, g_strdup_printf ("Expected a reference type on stack for %s but found %s at 0x%04x", opcode, name, ctx->ip_offset)); g_free (name); } switch (value->type->type) { case MONO_TYPE_FNPTR: case MONO_TYPE_PTR: case MONO_TYPE_TYPEDBYREF: CODE_NOT_VERIFIABLE (ctx, g_strdup_printf ("Invalid value for %s at 0x%04x", opcode, ctx->ip_offset)); } do_box = is_boxed || mono_type_is_generic_argument(type) || mono_class_from_mono_type (type)->valuetype; stack_push_val (ctx, TYPE_COMPLEX | (do_box ? BOXED_MASK : 0), type); }
0
138,649
usbtest_ioctl(struct usb_interface *intf, unsigned int code, void *buf) { struct usbtest_dev *dev = usb_get_intfdata(intf); struct usbtest_param_64 *param_64 = buf; struct usbtest_param_32 temp; struct usbtest_param_32 *param_32 = buf; struct timespec64 start; struct timespec64 end; struct timespec64 duration; int retval = -EOPNOTSUPP; /* FIXME USBDEVFS_CONNECTINFO doesn't say how fast the device is. */ pattern = mod_pattern; if (mutex_lock_interruptible(&dev->lock)) return -ERESTARTSYS; /* FIXME: What if a system sleep starts while a test is running? */ /* some devices, like ez-usb default devices, need a non-default * altsetting to have any active endpoints. some tests change * altsettings; force a default so most tests don't need to check. */ if (dev->info->alt >= 0) { if (intf->altsetting->desc.bInterfaceNumber) { retval = -ENODEV; goto free_mutex; } retval = set_altsetting(dev, dev->info->alt); if (retval) { dev_err(&intf->dev, "set altsetting to %d failed, %d\n", dev->info->alt, retval); goto free_mutex; } } switch (code) { case USBTEST_REQUEST_64: temp.test_num = param_64->test_num; temp.iterations = param_64->iterations; temp.length = param_64->length; temp.sglen = param_64->sglen; temp.vary = param_64->vary; param_32 = &temp; break; case USBTEST_REQUEST_32: break; default: retval = -EOPNOTSUPP; goto free_mutex; } ktime_get_ts64(&start); retval = usbtest_do_ioctl(intf, param_32); if (retval < 0) goto free_mutex; ktime_get_ts64(&end); duration = timespec64_sub(end, start); temp.duration_sec = duration.tv_sec; temp.duration_usec = duration.tv_nsec/NSEC_PER_USEC; switch (code) { case USBTEST_REQUEST_32: param_32->duration_sec = temp.duration_sec; param_32->duration_usec = temp.duration_usec; break; case USBTEST_REQUEST_64: param_64->duration_sec = temp.duration_sec; param_64->duration_usec = temp.duration_usec; break; } free_mutex: mutex_unlock(&dev->lock); return retval; }
0
305,646
LPCOLESTR Parser::ConstructFinalHintNode(IdentPtr pClassName, IdentPtr pMemberName, IdentPtr pGetSet, bool isStatic, uint32* nameLength, uint32* pShortNameOffset, bool isComputedName, LPCOLESTR pMemberNameHint) { if ((pMemberName == nullptr && !isComputedName) || (pMemberNameHint == nullptr && isComputedName) || !CONFIG_FLAG(UseFullName)) { return nullptr; } LPCOLESTR pFinalName = isComputedName? pMemberNameHint : pMemberName->Psz(); uint32 fullNameHintLength = 0; uint32 shortNameOffset = 0; if (!isStatic) { // Add prototype. pFinalName = AppendNameHints(wellKnownPropertyPids.prototype, pFinalName, &fullNameHintLength, &shortNameOffset); } if (pClassName) { uint32 classNameOffset = 0; pFinalName = AppendNameHints(pClassName, pFinalName, &fullNameHintLength, &classNameOffset); shortNameOffset += classNameOffset; } if (pGetSet) { if (m_scriptContext->GetConfig()->IsES6FunctionNameEnabled()) { // displays as get/set prototype.funcname uint32 getSetOffset = 0; pFinalName = AppendNameHints(pGetSet, pFinalName, &fullNameHintLength, &getSetOffset, true); shortNameOffset += getSetOffset; } else { pFinalName = AppendNameHints(pFinalName, pGetSet, &fullNameHintLength, &shortNameOffset); } } if (fullNameHintLength > *nameLength) { *nameLength = fullNameHintLength; } if (shortNameOffset > *pShortNameOffset) { *pShortNameOffset = shortNameOffset; } return pFinalName; }
0
324,716
int bdrv_flush(BlockDriverState *bs) { Coroutine *co; FlushCo flush_co = { .bs = bs, .ret = NOT_DONE, }; if (qemu_in_coroutine()) { /* Fast-path if already in coroutine context */ bdrv_flush_co_entry(&flush_co); } else { co = qemu_coroutine_create(bdrv_flush_co_entry, &flush_co); qemu_coroutine_enter(co); BDRV_POLL_WHILE(bs, flush_co.ret == NOT_DONE); } return flush_co.ret; }
1
369,277
transfer_secret_keys (ctrl_t ctrl, struct stats_s *stats, kbnode_t sec_keyblock) { gpg_error_t err = 0; void *kek = NULL; size_t keklen; kbnode_t ctx = NULL; kbnode_t node; PKT_public_key *main_pk, *pk; struct seckey_info *ski; int nskey; membuf_t mbuf; int i, j; unsigned int n; void *format_args_buf_ptr[PUBKEY_MAX_NSKEY]; int format_args_buf_int[PUBKEY_MAX_NSKEY]; void *format_args[2*PUBKEY_MAX_NSKEY]; gcry_sexp_t skey, prot, tmpsexp; unsigned char *transferkey = NULL; size_t transferkeylen; gcry_cipher_hd_t cipherhd = NULL; unsigned char *wrappedkey = NULL; size_t wrappedkeylen; char *cache_nonce = NULL; gcry_mpi_t ecc_params[5] = {NULL, NULL, NULL, NULL, NULL}; /* Get the current KEK. */ err = agent_keywrap_key (ctrl, 0, &kek, &keklen); if (err) { log_error ("error getting the KEK: %s\n", gpg_strerror (err)); goto leave; } /* Prepare a cipher context. */ err = gcry_cipher_open (&cipherhd, GCRY_CIPHER_AES128, GCRY_CIPHER_MODE_AESWRAP, 0); if (!err) err = gcry_cipher_setkey (cipherhd, kek, keklen); if (err) goto leave; xfree (kek); kek = NULL; main_pk = NULL; while ((node = walk_kbnode (sec_keyblock, &ctx, 0))) { if (node->pkt->pkttype != PKT_SECRET_KEY && node->pkt->pkttype != PKT_SECRET_SUBKEY) continue; pk = node->pkt->pkt.public_key; if (!main_pk) main_pk = pk; /* Make sure the keyids are available. */ keyid_from_pk (pk, NULL); if (node->pkt->pkttype == PKT_SECRET_KEY) { pk->main_keyid[0] = pk->keyid[0]; pk->main_keyid[1] = pk->keyid[1]; } else { pk->main_keyid[0] = main_pk->keyid[0]; pk->main_keyid[1] = main_pk->keyid[1]; } ski = pk->seckey_info; if (!ski) BUG (); stats->count++; stats->secret_read++; /* We ignore stub keys. The way we handle them in other parts of the code is by asking the agent whether any secret key is available for a given keyblock and then concluding that we have a secret key; all secret (sub)keys of the keyblock the agent does not know of are then stub keys. This works also for card stub keys. The learn command or the card-status command may be used to check with the agent whether a card has been inserted and a stub key is in turn generated by the agent. */ if (ski->s2k.mode == 1001 || ski->s2k.mode == 1002) continue; /* Convert our internal secret key object into an S-expression. */ nskey = pubkey_get_nskey (pk->pubkey_algo); if (!nskey || nskey > PUBKEY_MAX_NSKEY) { err = gpg_error (GPG_ERR_BAD_SECKEY); log_error ("internal error: %s\n", gpg_strerror (err)); goto leave; } init_membuf (&mbuf, 50); put_membuf_str (&mbuf, "(skey"); if (pk->pubkey_algo == PUBKEY_ALGO_ECDSA || pk->pubkey_algo == PUBKEY_ALGO_ECDH) { /* We need special treatment for ECC algorithms. OpenPGP stores only the curve name but the agent expects a full key. This is so that we can keep all curve name validation code out of gpg-agent. */ #if PUBKEY_MAX_NSKEY < 7 #error PUBKEY_MAX_NSKEY too low for ECC #endif char *curve = openpgp_oid_to_str (pk->pkey[0]); if (!curve) err = gpg_error_from_syserror (); else { gcry_sexp_t cparam = gcry_pk_get_param (GCRY_PK_ECDSA, curve); xfree (curve); if (!cparam) err = gpg_error (GPG_ERR_UNKNOWN_CURVE); else { const char *s; /* Append the curve parameters P, A, B, G and N. */ for (i=j=0; !err && *(s = "pabgn"+i); i++) { ecc_params[i] = one_mpi_from_pkey (cparam, s, 1); if (!ecc_params[i]) err = gpg_error (GPG_ERR_INV_CURVE); else { put_membuf_str (&mbuf, " _ %m"); format_args[j++] = ecc_params+i; } } gcry_sexp_release (cparam); if (!err) { /* Append the public key element Q. */ put_membuf_str (&mbuf, " _ %m"); format_args[j++] = pk->pkey + 1; /* Append the secret key element D. Note that for ECDH we need to skip PKEY[2] because this holds the KEK which is not needed. */ i = pk->pubkey_algo == PUBKEY_ALGO_ECDH? 3 : 2; if (gcry_mpi_get_flag (pk->pkey[i], GCRYMPI_FLAG_OPAQUE)) { put_membuf_str (&mbuf, " e %b"); format_args_buf_ptr[i] = gcry_mpi_get_opaque (pk->pkey[i],&n); format_args_buf_int[i] = (n+7)/8; format_args[j++] = format_args_buf_int + i; format_args[j++] = format_args_buf_ptr + i; } else { put_membuf_str (&mbuf, " _ %m"); format_args[j++] = pk->pkey + i; } } } } } else { /* Standard case for the old (non-ECC) algorithms. */ for (i=j=0; i < nskey; i++) { if (!pk->pkey[i]) ; /* Protected keys only have NPKEY+1 elements. */ else if (gcry_mpi_get_flag (pk->pkey[i], GCRYMPI_FLAG_OPAQUE)) { put_membuf_str (&mbuf, " e %b"); format_args_buf_ptr[i] = gcry_mpi_get_opaque (pk->pkey[i],&n); format_args_buf_int[i] = (n+7)/8; format_args[j++] = format_args_buf_int + i; format_args[j++] = format_args_buf_ptr + i; } else { put_membuf_str (&mbuf, " _ %m"); format_args[j++] = pk->pkey + i; } } } put_membuf_str (&mbuf, ")\n"); put_membuf (&mbuf, "", 1); if (err) xfree (get_membuf (&mbuf, NULL)); else { char *format = get_membuf (&mbuf, NULL); if (!format) err = gpg_error_from_syserror (); else err = gcry_sexp_build_array (&skey, NULL, format, format_args); xfree (format); } if (err) { log_error ("error building skey array: %s\n", gpg_strerror (err)); goto leave; } if (ski->is_protected) { char countbuf[35]; /* Note that the IVLEN may be zero if we are working on a dummy key. We can't express that in an S-expression and thus we send dummy data for the IV. */ snprintf (countbuf, sizeof countbuf, "%lu", (unsigned long)ski->s2k.count); err = gcry_sexp_build (&prot, NULL, " (protection %s %s %b %d %s %b %s)\n", ski->sha1chk? "sha1":"sum", openpgp_cipher_algo_name (ski->algo), ski->ivlen? (int)ski->ivlen:1, ski->ivlen? ski->iv: (const unsigned char*)"X", ski->s2k.mode, openpgp_md_algo_name (ski->s2k.hash_algo), (int)sizeof (ski->s2k.salt), ski->s2k.salt, countbuf); } else err = gcry_sexp_build (&prot, NULL, " (protection none)\n"); tmpsexp = NULL; xfree (transferkey); transferkey = NULL; if (!err) err = gcry_sexp_build (&tmpsexp, NULL, "(openpgp-private-key\n" " (version %d)\n" " (algo %s)\n" " %S\n" " (csum %d)\n" " %S)\n", pk->version, openpgp_pk_algo_name (pk->pubkey_algo), skey, (int)(unsigned long)ski->csum, prot); gcry_sexp_release (skey); gcry_sexp_release (prot); if (!err) err = make_canon_sexp_pad (tmpsexp, 1, &transferkey, &transferkeylen); gcry_sexp_release (tmpsexp); if (err) { log_error ("error building transfer key: %s\n", gpg_strerror (err)); goto leave; } /* Wrap the key. */ wrappedkeylen = transferkeylen + 8; xfree (wrappedkey); wrappedkey = xtrymalloc (wrappedkeylen); if (!wrappedkey) err = gpg_error_from_syserror (); else err = gcry_cipher_encrypt (cipherhd, wrappedkey, wrappedkeylen, transferkey, transferkeylen); if (err) goto leave; xfree (transferkey); transferkey = NULL; /* Send the wrapped key to the agent. */ { char *desc = gpg_format_keydesc (pk, 1, 1); err = agent_import_key (ctrl, desc, &cache_nonce, wrappedkey, wrappedkeylen); xfree (desc); } if (!err) { if (opt.verbose) log_info (_("key %s: secret key imported\n"), keystr_from_pk_with_sub (main_pk, pk)); stats->secret_imported++; } else if ( gpg_err_code (err) == GPG_ERR_EEXIST ) { if (opt.verbose) log_info (_("key %s: secret key already exists\n"), keystr_from_pk_with_sub (main_pk, pk)); err = 0; stats->secret_dups++; } else { log_error (_("key %s: error sending to agent: %s\n"), keystr_from_pk_with_sub (main_pk, pk), gpg_strerror (err)); if (gpg_err_code (err) == GPG_ERR_CANCELED || gpg_err_code (err) == GPG_ERR_FULLY_CANCELED) break; /* Don't try the other subkeys. */ } } leave: for (i=0; i < DIM (ecc_params); i++) gcry_mpi_release (ecc_params[i]); xfree (cache_nonce); xfree (wrappedkey); xfree (transferkey); gcry_cipher_close (cipherhd); xfree (kek); return err; }
0
135,999
get_func_line( int c UNUSED, void *cookie, int indent UNUSED, getline_opt_T options UNUSED) { funccall_T *fcp = (funccall_T *)cookie; ufunc_T *fp = fcp->func; char_u *retval; garray_T *gap; // growarray with function lines // If breakpoints have been added/deleted need to check for it. if (fcp->dbg_tick != debug_tick) { fcp->breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, SOURCING_LNUM); fcp->dbg_tick = debug_tick; } #ifdef FEAT_PROFILE if (do_profiling == PROF_YES) func_line_end(cookie); #endif gap = &fp->uf_lines; if (((fp->uf_flags & FC_ABORT) && did_emsg && !aborted_in_try()) || fcp->returned) retval = NULL; else { // Skip NULL lines (continuation lines). while (fcp->linenr < gap->ga_len && ((char_u **)(gap->ga_data))[fcp->linenr] == NULL) ++fcp->linenr; if (fcp->linenr >= gap->ga_len) retval = NULL; else { retval = vim_strsave(((char_u **)(gap->ga_data))[fcp->linenr++]); SOURCING_LNUM = fcp->linenr; #ifdef FEAT_PROFILE if (do_profiling == PROF_YES) func_line_start(cookie, SOURCING_LNUM); #endif } } // Did we encounter a breakpoint? if (fcp->breakpoint != 0 && fcp->breakpoint <= SOURCING_LNUM) { dbg_breakpoint(fp->uf_name, SOURCING_LNUM); // Find next breakpoint. fcp->breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, SOURCING_LNUM); fcp->dbg_tick = debug_tick; } return retval; }
0
357,583
AvahiServer *avahi_server_new(const AvahiPoll *poll_api, const AvahiServerConfig *sc, AvahiServerCallback callback, void* userdata, int *error) { AvahiServer *s; int e; if (sc && (e = valid_server_config(sc)) < 0) { if (error) *error = e; return NULL; } if (!(s = avahi_new(AvahiServer, 1))) { if (error) *error = AVAHI_ERR_NO_MEMORY; return NULL; } s->poll_api = poll_api; if (sc) avahi_server_config_copy(&s->config, sc); else avahi_server_config_init(&s->config); if ((e = setup_sockets(s)) < 0) { if (error) *error = e; avahi_server_config_free(&s->config); avahi_free(s); return NULL; } s->n_host_rr_pending = 0; s->need_entry_cleanup = 0; s->need_group_cleanup = 0; s->need_browser_cleanup = 0; s->hinfo_entry_group = NULL; s->browse_domain_entry_group = NULL; s->error = AVAHI_OK; s->state = AVAHI_SERVER_INVALID; s->callback = callback; s->userdata = userdata; s->time_event_queue = avahi_time_event_queue_new(poll_api); s->entries_by_key = avahi_hashmap_new((AvahiHashFunc) avahi_key_hash, (AvahiEqualFunc) avahi_key_equal, NULL, NULL); AVAHI_LLIST_HEAD_INIT(AvahiEntry, s->entries); AVAHI_LLIST_HEAD_INIT(AvahiGroup, s->groups); s->record_browser_hashmap = avahi_hashmap_new((AvahiHashFunc) avahi_key_hash, (AvahiEqualFunc) avahi_key_equal, NULL, NULL); AVAHI_LLIST_HEAD_INIT(AvahiSRecordBrowser, s->record_browsers); AVAHI_LLIST_HEAD_INIT(AvahiSHostNameResolver, s->host_name_resolvers); AVAHI_LLIST_HEAD_INIT(AvahiSAddressResolver, s->address_resolvers); AVAHI_LLIST_HEAD_INIT(AvahiSDomainBrowser, s->domain_browsers); AVAHI_LLIST_HEAD_INIT(AvahiSServiceTypeBrowser, s->service_type_browsers); AVAHI_LLIST_HEAD_INIT(AvahiSServiceBrowser, s->service_browsers); AVAHI_LLIST_HEAD_INIT(AvahiSServiceResolver, s->service_resolvers); AVAHI_LLIST_HEAD_INIT(AvahiSDNSServerBrowser, s->dns_server_browsers); s->legacy_unicast_reflect_slots = NULL; s->legacy_unicast_reflect_id = 0; s->record_list = avahi_record_list_new(); /* Get host name */ s->host_name = s->config.host_name ? avahi_normalize_name_strdup(s->config.host_name) : avahi_get_host_name_strdup(); s->host_name[strcspn(s->host_name, ".")] = 0; s->domain_name = s->config.domain_name ? avahi_normalize_name_strdup(s->config.domain_name) : avahi_strdup("local"); s->host_name_fqdn = NULL; update_fqdn(s); do { s->local_service_cookie = (uint32_t) rand() * (uint32_t) rand(); } while (s->local_service_cookie == AVAHI_SERVICE_COOKIE_INVALID); if (s->config.enable_wide_area) { s->wide_area_lookup_engine = avahi_wide_area_engine_new(s); avahi_wide_area_set_servers(s->wide_area_lookup_engine, s->config.wide_area_servers, s->config.n_wide_area_servers); } else s->wide_area_lookup_engine = NULL; s->multicast_lookup_engine = avahi_multicast_lookup_engine_new(s); s->monitor = avahi_interface_monitor_new(s); avahi_interface_monitor_sync(s->monitor); register_localhost(s); register_stuff(s); return s; }
0
158,347
void CServer::RegisterCommands() { m_pConsole = Kernel()->RequestInterface<IConsole>(); m_pGameServer = Kernel()->RequestInterface<IGameServer>(); m_pMap = Kernel()->RequestInterface<IEngineMap>(); m_pStorage = Kernel()->RequestInterface<IStorage>(); // register console commands Console()->Register("kick", "i?r", CFGFLAG_SERVER, ConKick, this, "Kick player with specified id for any reason"); Console()->Register("status", "", CFGFLAG_SERVER, ConStatus, this, "List players"); Console()->Register("shutdown", "", CFGFLAG_SERVER, ConShutdown, this, "Shut down"); Console()->Register("logout", "", CFGFLAG_SERVER, ConLogout, this, "Logout of rcon"); Console()->Register("record", "?s", CFGFLAG_SERVER|CFGFLAG_STORE, ConRecord, this, "Record to a file"); Console()->Register("stoprecord", "", CFGFLAG_SERVER, ConStopRecord, this, "Stop recording"); Console()->Register("reload", "", CFGFLAG_SERVER, ConMapReload, this, "Reload the map"); Console()->Chain("sv_name", ConchainSpecialInfoupdate, this); Console()->Chain("password", ConchainSpecialInfoupdate, this); Console()->Chain("sv_max_clients_per_ip", ConchainMaxclientsperipUpdate, this); Console()->Chain("mod_command", ConchainModCommandUpdate, this); Console()->Chain("console_output_level", ConchainConsoleOutputLevelUpdate, this); // register console commands in sub parts m_ServerBan.InitServerBan(Console(), Storage(), this); m_pGameServer->OnConsoleInit(); }
0
105,304
const std::string getRepl() const { return repl; }
0
503,611
void edge_filtering_chroma_internal(de265_image* img, bool vertical, int yStart,int yEnd, int xStart,int xEnd) { //printf("chroma %d-%d %d-%d\n",xStart,xEnd,yStart,yEnd); const seq_parameter_set& sps = img->get_sps(); const int SubWidthC = sps.SubWidthC; const int SubHeightC = sps.SubHeightC; int xIncr = vertical ? 2 : 1; int yIncr = vertical ? 1 : 2; xIncr *= SubWidthC; yIncr *= SubHeightC; const int stride = img->get_image_stride(1); xEnd = libde265_min(xEnd,img->get_deblk_width()); yEnd = libde265_min(yEnd,img->get_deblk_height()); int bitDepth_C = sps.BitDepth_C; for (int y=yStart;y<yEnd;y+=yIncr) for (int x=xStart;x<xEnd;x+=xIncr) { int xDi = x << (3-SubWidthC); int yDi = y << (3-SubHeightC); //printf("x,y:%d,%d xDi,yDi:%d,%d\n",x,y,xDi,yDi); int bS = img->get_deblk_bS(xDi*SubWidthC,yDi*SubHeightC); if (bS>1) { // 8.7.2.4.5 for (int cplane=0;cplane<2;cplane++) { int cQpPicOffset = (cplane==0 ? img->get_pps().pic_cb_qp_offset : img->get_pps().pic_cr_qp_offset); pixel_t* ptr = img->get_image_plane_at_pos_NEW<pixel_t>(cplane+1, xDi,yDi); pixel_t p[2][4]; pixel_t q[2][4]; logtrace(LogDeblock,"-%s- %d %d\n",cplane==0 ? "Cb" : "Cr",xDi,yDi); for (int i=0;i<2;i++) for (int k=0;k<4;k++) { if (vertical) { q[i][k] = ptr[ i +k*stride]; p[i][k] = ptr[-i-1+k*stride]; } else { q[i][k] = ptr[k + i *stride]; p[i][k] = ptr[k -(i+1)*stride]; } } #if 0 for (int k=0;k<4;k++) { for (int i=0;i<2;i++) { printf("%02x ", p[1-i][k]); } printf("| "); for (int i=0;i<2;i++) { printf("%02x ", q[i][k]); } printf("\n"); } #endif int QP_Q = img->get_QPY(SubWidthC*xDi,SubHeightC*yDi); int QP_P = (vertical ? img->get_QPY(SubWidthC*xDi-1,SubHeightC*yDi) : img->get_QPY(SubWidthC*xDi,SubHeightC*yDi-1)); int qP_i = ((QP_Q+QP_P+1)>>1) + cQpPicOffset; int QP_C; if (sps.ChromaArrayType == CHROMA_420) { QP_C = table8_22(qP_i); } else { QP_C = libde265_min(qP_i, 51); } //printf("POC=%d\n",ctx->img->PicOrderCntVal); logtrace(LogDeblock,"%d %d: ((%d+%d+1)>>1) + %d = qP_i=%d (QP_C=%d)\n", SubWidthC*xDi,SubHeightC*yDi, QP_Q,QP_P,cQpPicOffset,qP_i,QP_C); int sliceIndexQ00 = img->get_SliceHeaderIndex(SubWidthC*xDi,SubHeightC*yDi); int tc_offset = img->slices[sliceIndexQ00]->slice_tc_offset; int Q = Clip3(0,53, QP_C + 2*(bS-1) + tc_offset); int tcPrime = table_8_23_tc[Q]; int tc = tcPrime * (1<<(sps.BitDepth_C - 8)); logtrace(LogDeblock,"tc_offset=%d Q=%d tc'=%d tc=%d\n",tc_offset,Q,tcPrime,tc); if (vertical) { bool filterP = true; if (sps.pcm_loop_filter_disable_flag && img->get_pcm_flag(SubWidthC*xDi-1,SubHeightC*yDi)) filterP=false; if (img->get_cu_transquant_bypass(SubWidthC*xDi-1,SubHeightC*yDi)) filterP=false; bool filterQ = true; if (sps.pcm_loop_filter_disable_flag && img->get_pcm_flag(SubWidthC*xDi,SubHeightC*yDi)) filterQ=false; if (img->get_cu_transquant_bypass(SubWidthC*xDi,SubHeightC*yDi)) filterQ=false; for (int k=0;k<4;k++) { int delta = Clip3(-tc,tc, ((((q[0][k]-p[0][k])*4)+p[1][k]-q[1][k]+4)>>3)); // standard says <<2 in eq. (8-356), but the value can also be negative logtrace(LogDeblock,"delta=%d\n",delta); if (filterP) { ptr[-1+k*stride] = Clip_BitDepth(p[0][k]+delta, bitDepth_C); } if (filterQ) { ptr[ 0+k*stride] = Clip_BitDepth(q[0][k]-delta, bitDepth_C); } } } else { bool filterP = true; if (sps.pcm_loop_filter_disable_flag && img->get_pcm_flag(SubWidthC*xDi,SubHeightC*yDi-1)) filterP=false; if (img->get_cu_transquant_bypass(SubWidthC*xDi,SubHeightC*yDi-1)) filterP=false; bool filterQ = true; if (sps.pcm_loop_filter_disable_flag && img->get_pcm_flag(SubWidthC*xDi,SubHeightC*yDi)) filterQ=false; if (img->get_cu_transquant_bypass(SubWidthC*xDi,SubHeightC*yDi)) filterQ=false; for (int k=0;k<4;k++) { int delta = Clip3(-tc,tc, ((((q[0][k]-p[0][k])*4)+p[1][k]-q[1][k]+4)>>3)); // standard says <<2, but the value can also be negative if (filterP) { ptr[ k-1*stride] = Clip_BitDepth(p[0][k]+delta, bitDepth_C); } if (filterQ) { ptr[ k+0*stride] = Clip_BitDepth(q[0][k]-delta, bitDepth_C); } } } } } } }
0
95,796
DEFUN(gorURL, GOTO_RELATIVE, "Go to relative address") { goURL0("Goto relative URL: ", TRUE); }
0
266,142
bool CanOptimize(const NodeDef& node) const { DataType dtype = GetDataTypeFromAttr(node, "T"); if (!IsSupported(node.op(), dtype)) { return false; } if (IsInPreserveSet(node)) { return false; } if (!NodeIsOnCpu(node)) { return false; } if (NodeIsAlreadyFused(node)) { return false; } return !(IsDrivenByControlDependency(node) || DrivesControlDependency(node)); }
0
428,201
int tcp_mss_to_mtu(struct sock *sk, int mss) { const struct tcp_sock *tp = tcp_sk(sk); const struct inet_connection_sock *icsk = inet_csk(sk); int mtu; mtu = mss + tp->tcp_header_len + icsk->icsk_ext_hdr_len + icsk->icsk_af_ops->net_header_len; /* IPv6 adds a frag_hdr in case RTAX_FEATURE_ALLFRAG is set */ if (icsk->icsk_af_ops->net_frag_header_len) { const struct dst_entry *dst = __sk_dst_get(sk); if (dst && dst_allfrag(dst)) mtu += icsk->icsk_af_ops->net_frag_header_len; } return mtu; }
0
399,516
static void rebind_workers(struct worker_pool *pool) { struct worker *worker; lockdep_assert_held(&pool->attach_mutex); /* * Restore CPU affinity of all workers. As all idle workers should * be on the run-queue of the associated CPU before any local * wake-ups for concurrency management happen, restore CPU affinity * of all workers first and then clear UNBOUND. As we're called * from CPU_ONLINE, the following shouldn't fail. */ for_each_pool_worker(worker, pool) WARN_ON_ONCE(set_cpus_allowed_ptr(worker->task, pool->attrs->cpumask) < 0); spin_lock_irq(&pool->lock); /* * XXX: CPU hotplug notifiers are weird and can call DOWN_FAILED * w/o preceding DOWN_PREPARE. Work around it. CPU hotplug is * being reworked and this can go away in time. */ if (!(pool->flags & POOL_DISASSOCIATED)) { spin_unlock_irq(&pool->lock); return; } pool->flags &= ~POOL_DISASSOCIATED; for_each_pool_worker(worker, pool) { unsigned int worker_flags = worker->flags; /* * A bound idle worker should actually be on the runqueue * of the associated CPU for local wake-ups targeting it to * work. Kick all idle workers so that they migrate to the * associated CPU. Doing this in the same loop as * replacing UNBOUND with REBOUND is safe as no worker will * be bound before @pool->lock is released. */ if (worker_flags & WORKER_IDLE) wake_up_process(worker->task); /* * We want to clear UNBOUND but can't directly call * worker_clr_flags() or adjust nr_running. Atomically * replace UNBOUND with another NOT_RUNNING flag REBOUND. * @worker will clear REBOUND using worker_clr_flags() when * it initiates the next execution cycle thus restoring * concurrency management. Note that when or whether * @worker clears REBOUND doesn't affect correctness. * * ACCESS_ONCE() is necessary because @worker->flags may be * tested without holding any lock in * wq_worker_waking_up(). Without it, NOT_RUNNING test may * fail incorrectly leading to premature concurrency * management operations. */ WARN_ON_ONCE(!(worker_flags & WORKER_UNBOUND)); worker_flags |= WORKER_REBOUND; worker_flags &= ~WORKER_UNBOUND; ACCESS_ONCE(worker->flags) = worker_flags; } spin_unlock_irq(&pool->lock); }
0
142,063
unsigned long long task_sched_runtime(struct task_struct *p) { unsigned long flags; struct rq *rq; u64 ns = 0; rq = task_rq_lock(p, &flags); ns = p->se.sum_exec_runtime + do_task_delta_exec(p, rq); task_rq_unlock(rq, &flags); return ns; }
0
114,159
tsqueryout(PG_FUNCTION_ARGS) { TSQuery query = PG_GETARG_TSQUERY(0); INFIX nrm; if (query->size == 0) { char *b = palloc(1); *b = '\0'; PG_RETURN_POINTER(b); } nrm.curpol = GETQUERY(query); nrm.buflen = 32; nrm.cur = nrm.buf = (char *) palloc(sizeof(char) * nrm.buflen); *(nrm.cur) = '\0'; nrm.op = GETOPERAND(query); infix(&nrm, true); PG_FREE_IF_COPY(query, 0); PG_RETURN_CSTRING(nrm.buf); }
0
118,206
static int ext4_ext_create_new_leaf(handle_t *handle, struct inode *inode, struct ext4_ext_path *path, struct ext4_extent *newext) { struct ext4_ext_path *curp; int depth, i, err = 0; repeat: i = depth = ext_depth(inode); /* walk up to the tree and look for free index entry */ curp = path + depth; while (i > 0 && !EXT_HAS_FREE_INDEX(curp)) { i--; curp--; } /* we use already allocated block for index block, * so subsequent data blocks should be contiguous */ if (EXT_HAS_FREE_INDEX(curp)) { /* if we found index with free entry, then use that * entry: create all needed subtree and add new leaf */ err = ext4_ext_split(handle, inode, path, newext, i); if (err) goto out; /* refill path */ ext4_ext_drop_refs(path); path = ext4_ext_find_extent(inode, (ext4_lblk_t)le32_to_cpu(newext->ee_block), path); if (IS_ERR(path)) err = PTR_ERR(path); } else { /* tree is full, time to grow in depth */ err = ext4_ext_grow_indepth(handle, inode, path, newext); if (err) goto out; /* refill path */ ext4_ext_drop_refs(path); path = ext4_ext_find_extent(inode, (ext4_lblk_t)le32_to_cpu(newext->ee_block), path); if (IS_ERR(path)) { err = PTR_ERR(path); goto out; } /* * only first (depth 0 -> 1) produces free space; * in all other cases we have to split the grown tree */ depth = ext_depth(inode); if (path[depth].p_hdr->eh_entries == path[depth].p_hdr->eh_max) { /* now we need to split */ goto repeat; } } out: return err; }
0
213,141
void ScreenRecorder::EncodedDataAvailableCallback(VideoPacket* packet) { DCHECK_EQ(encode_loop_, MessageLoop::current()); if (encoder_stopped_) return; bool last = (packet->flags() & VideoPacket::LAST_PACKET) != 0; if (last) { base::TimeDelta encode_time = base::Time::Now() - encode_start_time_; int encode_time_ms = static_cast<int>(encode_time.InMilliseconds()); packet->set_encode_time_ms(encode_time_ms); scheduler_.RecordEncodeTime(encode_time); } network_loop_->PostTask( FROM_HERE, base::Bind(&ScreenRecorder::DoSendVideoPacket, this, packet)); }
0
189,522
WtsSessionProcessDelegate::~WtsSessionProcessDelegate() { core_->Stop(); }
0
438,653
intel_virtual_engine_get_sibling(struct intel_engine_cs *engine, unsigned int sibling) { struct virtual_engine *ve = to_virtual_engine(engine); if (sibling >= ve->num_siblings) return NULL; return ve->siblings[sibling]; }
0
116,951
dnslabel_table_add(struct dnslabel_table *table, const char *label, off_t pos) { char *v; int p; if (table->n_labels == MAX_LABELS) return (-1); v = mm_strdup(label); if (v == NULL) return (-1); p = table->n_labels++; table->labels[p].v = v; table->labels[p].pos = pos; return (0); }
0
64,454
nv_home(cmdarg_T *cap) { // CTRL-HOME is like "gg" if (mod_mask & MOD_MASK_CTRL) nv_goto(cap); else { cap->count0 = 1; nv_pipe(cap); } ins_at_eol = FALSE; // Don't move cursor past eol (only necessary in a // one-character line). }
0
299,776
static __net_init int proto_init_net(struct net *net) { if (!proc_net_fops_create(net, "protocols", S_IRUGO, &proto_seq_fops)) return -ENOMEM; return 0; }
0
318,980
static int adx_read_header(AVFormatContext *s) { ADXDemuxerContext *c = s->priv_data; AVCodecParameters *par; AVStream *st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); par = s->streams[0]->codecpar; if (avio_rb16(s->pb) != 0x8000) return AVERROR_INVALIDDATA; c->header_size = avio_rb16(s->pb) + 4; avio_seek(s->pb, -4, SEEK_CUR); if (ff_get_extradata(s, par, s->pb, c->header_size) < 0) return AVERROR(ENOMEM); if (par->extradata_size < 12) { av_log(s, AV_LOG_ERROR, "Invalid extradata size.\n"); return AVERROR_INVALIDDATA; } par->channels = AV_RB8 (par->extradata + 7); par->sample_rate = AV_RB32(par->extradata + 8); if (par->channels <= 0) { av_log(s, AV_LOG_ERROR, "invalid number of channels %d\n", par->channels); return AVERROR_INVALIDDATA; } if (par->sample_rate <= 0) { av_log(s, AV_LOG_ERROR, "Invalid sample rate %d\n", par->sample_rate); return AVERROR_INVALIDDATA; } par->codec_type = AVMEDIA_TYPE_AUDIO; par->codec_id = s->iformat->raw_codec_id; par->bit_rate = par->sample_rate * par->channels * BLOCK_SIZE * 8LL / BLOCK_SAMPLES; avpriv_set_pts_info(st, 64, BLOCK_SAMPLES, par->sample_rate); return 0; }
1
176,339
OJPEGWriteStreamDri(TIFF* tif, void** mem, uint32* len) { OJPEGState* sp=(OJPEGState*)tif->tif_data; assert(OJPEG_BUFFER>=6); if (sp->restart_interval!=0) { sp->out_buffer[0]=255; sp->out_buffer[1]=JPEG_MARKER_DRI; sp->out_buffer[2]=0; sp->out_buffer[3]=4; sp->out_buffer[4]=(sp->restart_interval>>8); sp->out_buffer[5]=(sp->restart_interval&255); *len=6; *mem=(void*)sp->out_buffer; } sp->out_state++; }
0
415,373
set_policy_defaults(cupsd_policy_t *pol)/* I - Policy */ { cupsd_location_t *op; /* Policy operation */ /* * Verify that we have an explicit policy for Validate-Job, Cancel-Jobs, * Cancel-My-Jobs, Close-Job, and CUPS-Get-Document, which ensures that * upgrades do not introduce new security issues... * * CUPS STR #4659: Allow a lone <Limit All> policy. */ if (cupsArrayCount(pol->ops) > 1) { if ((op = cupsdFindPolicyOp(pol, IPP_VALIDATE_JOB)) == NULL || op->op == IPP_ANY_OPERATION) { if ((op = cupsdFindPolicyOp(pol, IPP_PRINT_JOB)) != NULL && op->op != IPP_ANY_OPERATION) { /* * Add a new limit for Validate-Job using the Print-Job limit as a * template... */ cupsdLogMessage(CUPSD_LOG_WARN, "No limit for Validate-Job defined in policy %s - using Print-Job's policy.", pol->name); cupsdAddPolicyOp(pol, op, IPP_VALIDATE_JOB); } else cupsdLogMessage(CUPSD_LOG_WARN, "No limit for Validate-Job defined in policy %s and no suitable template found.", pol->name); } if ((op = cupsdFindPolicyOp(pol, IPP_CANCEL_JOBS)) == NULL || op->op == IPP_ANY_OPERATION) { if ((op = cupsdFindPolicyOp(pol, IPP_PAUSE_PRINTER)) != NULL && op->op != IPP_ANY_OPERATION) { /* * Add a new limit for Cancel-Jobs using the Pause-Printer limit as a * template... */ cupsdLogMessage(CUPSD_LOG_WARN, "No limit for Cancel-Jobs defined in policy %s - using Pause-Printer's policy.", pol->name); cupsdAddPolicyOp(pol, op, IPP_CANCEL_JOBS); } else cupsdLogMessage(CUPSD_LOG_WARN, "No limit for Cancel-Jobs defined in policy %s and no suitable template found.", pol->name); } if ((op = cupsdFindPolicyOp(pol, IPP_CANCEL_MY_JOBS)) == NULL || op->op == IPP_ANY_OPERATION) { if ((op = cupsdFindPolicyOp(pol, IPP_SEND_DOCUMENT)) != NULL && op->op != IPP_ANY_OPERATION) { /* * Add a new limit for Cancel-My-Jobs using the Send-Document limit as * a template... */ cupsdLogMessage(CUPSD_LOG_WARN, "No limit for Cancel-My-Jobs defined in policy %s - using Send-Document's policy.", pol->name); cupsdAddPolicyOp(pol, op, IPP_CANCEL_MY_JOBS); } else cupsdLogMessage(CUPSD_LOG_WARN, "No limit for Cancel-My-Jobs defined in policy %s and no suitable template found.", pol->name); } if ((op = cupsdFindPolicyOp(pol, IPP_CLOSE_JOB)) == NULL || op->op == IPP_ANY_OPERATION) { if ((op = cupsdFindPolicyOp(pol, IPP_SEND_DOCUMENT)) != NULL && op->op != IPP_ANY_OPERATION) { /* * Add a new limit for Close-Job using the Send-Document limit as a * template... */ cupsdLogMessage(CUPSD_LOG_WARN, "No limit for Close-Job defined in policy %s - using Send-Document's policy.", pol->name); cupsdAddPolicyOp(pol, op, IPP_CLOSE_JOB); } else cupsdLogMessage(CUPSD_LOG_WARN, "No limit for Close-Job defined in policy %s and no suitable template found.", pol->name); } if ((op = cupsdFindPolicyOp(pol, CUPS_GET_DOCUMENT)) == NULL || op->op == IPP_ANY_OPERATION) { if ((op = cupsdFindPolicyOp(pol, IPP_SEND_DOCUMENT)) != NULL && op->op != IPP_ANY_OPERATION) { /* * Add a new limit for CUPS-Get-Document using the Send-Document * limit as a template... */ cupsdLogMessage(CUPSD_LOG_WARN, "No limit for CUPS-Get-Document defined in policy %s - using Send-Document's policy.", pol->name); cupsdAddPolicyOp(pol, op, CUPS_GET_DOCUMENT); } else cupsdLogMessage(CUPSD_LOG_WARN, "No limit for CUPS-Get-Document defined in policy %s and no suitable template found.", pol->name); } } /* * Verify we have JobPrivateAccess, JobPrivateValues, * SubscriptionPrivateAccess, and SubscriptionPrivateValues in the policy. */ if (!pol->job_access) { cupsdLogMessage(CUPSD_LOG_WARN, "No JobPrivateAccess defined in policy %s - using defaults.", pol->name); cupsdAddString(&(pol->job_access), "@OWNER"); cupsdAddString(&(pol->job_access), "@SYSTEM"); } if (!pol->job_attrs) { cupsdLogMessage(CUPSD_LOG_WARN, "No JobPrivateValues defined in policy %s - using defaults.", pol->name); cupsdAddString(&(pol->job_attrs), "job-name"); cupsdAddString(&(pol->job_attrs), "job-originating-host-name"); cupsdAddString(&(pol->job_attrs), "job-originating-user-name"); cupsdAddString(&(pol->job_attrs), "phone"); } if (!pol->sub_access) { cupsdLogMessage(CUPSD_LOG_WARN, "No SubscriptionPrivateAccess defined in policy %s - using defaults.", pol->name); cupsdAddString(&(pol->sub_access), "@OWNER"); cupsdAddString(&(pol->sub_access), "@SYSTEM"); } if (!pol->sub_attrs) { cupsdLogMessage(CUPSD_LOG_WARN, "No SubscriptionPrivateValues defined in policy %s - using defaults.", pol->name); cupsdAddString(&(pol->sub_attrs), "notify-events"); cupsdAddString(&(pol->sub_attrs), "notify-pull-method"); cupsdAddString(&(pol->sub_attrs), "notify-recipient-uri"); cupsdAddString(&(pol->sub_attrs), "notify-subscriber-user-name"); cupsdAddString(&(pol->sub_attrs), "notify-user-data"); } }
0
268,254
int xdr_decode_array2(const struct xdr_buf *buf, unsigned int base, struct xdr_array2_desc *desc) { if (base >= buf->len) return -EINVAL; return xdr_xcode_array2(buf, base, desc, 0); }
0
192,128
void ShelfLayoutManager::OnLockStateEvent(LockStateObserver::EventType event) { if (event == EVENT_LOCK_ANIMATION_STARTED) { state_.pre_lock_screen_animation_active = true; UpdateShelfVisibilityAfterLoginUIChange(); } else { state_.pre_lock_screen_animation_active = false; } MaybeUpdateShelfBackground(AnimationChangeType::ANIMATE); }
0
236,563
void ExtensionInstallPrompt::SetIcon(const SkBitmap* image) { if (image) icon_ = *image; else icon_ = SkBitmap(); if (icon_.empty()) { icon_ = GetDefaultIconBitmapForMaxScaleFactor( extension_ ? extension_->is_app() : false); } }
0
29,769
static void append_user ( String * str , LEX_USER * user ) { if ( str -> length ( ) ) str -> append ( ',' ) ; str -> append ( '\'' ) ; str -> append ( user -> user . str ) ; str -> append ( STRING_WITH_LEN ( "'@'" ) ) ; str -> append ( user -> host . str ) ; str -> append ( '\'' ) ; }
0
34,500
ReadFromRFBServer(rfbClient* client, char *out, unsigned int n) { #undef DEBUG_READ_EXACT #ifdef DEBUG_READ_EXACT char* oout=out; int nn=n; rfbClientLog("ReadFromRFBServer %d bytes\n",n); #endif /* Handle attempts to write to NULL out buffer that might occur when an outside malloc() fails. For instance, memcpy() to NULL results in undefined behaviour and probably memory corruption.*/ if(!out) return FALSE; if (client->serverPort==-1) { /* vncrec playing */ rfbVNCRec* rec = client->vncRec; struct timeval tv; if (rec->readTimestamp) { rec->readTimestamp = FALSE; if (!fread(&tv,sizeof(struct timeval),1,rec->file)) return FALSE; tv.tv_sec = rfbClientSwap32IfLE (tv.tv_sec); tv.tv_usec = rfbClientSwap32IfLE (tv.tv_usec); if (rec->tv.tv_sec!=0 && !rec->doNotSleep) { struct timeval diff; diff.tv_sec = tv.tv_sec - rec->tv.tv_sec; diff.tv_usec = tv.tv_usec - rec->tv.tv_usec; if(diff.tv_usec<0) { diff.tv_sec--; diff.tv_usec+=1000000; } #ifndef WIN32 sleep (diff.tv_sec); usleep (diff.tv_usec); #else Sleep (diff.tv_sec * 1000 + diff.tv_usec/1000); #endif } rec->tv=tv; } return (fread(out,1,n,rec->file) != n ? FALSE : TRUE); } if (n <= client->buffered) { memcpy(out, client->bufoutptr, n); client->bufoutptr += n; client->buffered -= n; #ifdef DEBUG_READ_EXACT goto hexdump; #endif return TRUE; } memcpy(out, client->bufoutptr, client->buffered); out += client->buffered; n -= client->buffered; client->bufoutptr = client->buf; client->buffered = 0; if (n <= RFB_BUF_SIZE) { while (client->buffered < n) { int i; if (client->tlsSession) i = ReadFromTLS(client, client->buf + client->buffered, RFB_BUF_SIZE - client->buffered); else #ifdef LIBVNCSERVER_HAVE_SASL if (client->saslconn) i = ReadFromSASL(client, client->buf + client->buffered, RFB_BUF_SIZE - client->buffered); else { #endif /* LIBVNCSERVER_HAVE_SASL */ i = read(client->sock, client->buf + client->buffered, RFB_BUF_SIZE - client->buffered); #ifdef WIN32 if (i < 0) errno=WSAGetLastError(); #endif #ifdef LIBVNCSERVER_HAVE_SASL } #endif if (i <= 0) { if (i < 0) { if (errno == EWOULDBLOCK || errno == EAGAIN) { /* TODO: ProcessXtEvents(); */ WaitForMessage(client, 100000); i = 0; } else { rfbClientErr("read (%d: %s)\n",errno,strerror(errno)); return FALSE; } } else { if (errorMessageOnReadFailure) { rfbClientLog("VNC server closed connection\n"); } return FALSE; } } client->buffered += i; } memcpy(out, client->bufoutptr, n); client->bufoutptr += n; client->buffered -= n; } else { while (n > 0) { int i; if (client->tlsSession) i = ReadFromTLS(client, out, n); else #ifdef LIBVNCSERVER_HAVE_SASL if (client->saslconn) i = ReadFromSASL(client, out, n); else #endif i = read(client->sock, out, n); if (i <= 0) { if (i < 0) { #ifdef WIN32 errno=WSAGetLastError(); #endif if (errno == EWOULDBLOCK || errno == EAGAIN) { /* TODO: ProcessXtEvents(); */ WaitForMessage(client, 100000); i = 0; } else { rfbClientErr("read (%s)\n",strerror(errno)); return FALSE; } } else { if (errorMessageOnReadFailure) { rfbClientLog("VNC server closed connection\n"); } return FALSE; } } out += i; n -= i; } } #ifdef DEBUG_READ_EXACT hexdump: { int ii; for(ii=0;ii<nn;ii++) fprintf(stderr,"%02x ",(unsigned char)oout[ii]); fprintf(stderr,"\n"); } #endif return TRUE; }
0
416,414
void PngChunk::parseChunkContent( Image* pImage, const byte* key, long keySize, const DataBuf arr) { // We look if an ImageMagick EXIF raw profile exist. if ( keySize >= 21 && ( memcmp("Raw profile type exif", key, 21) == 0 || memcmp("Raw profile type APP1", key, 21) == 0) && pImage->exifData().empty()) { DataBuf exifData = readRawProfile(arr,false); long length = exifData.size_; if (length > 0) { // Find the position of Exif header in bytes array. const byte exifHeader[] = { 0x45, 0x78, 0x69, 0x66, 0x00, 0x00 }; long pos = -1; for (long i=0 ; i < length-(long)sizeof(exifHeader) ; i++) { if (memcmp(exifHeader, &exifData.pData_[i], sizeof(exifHeader)) == 0) { pos = i; break; } } // If found it, store only these data at from this place. if (pos !=-1) { #ifdef DEBUG std::cout << "Exiv2::PngChunk::parseChunkContent: Exif header found at position " << pos << "\n"; #endif pos = pos + sizeof(exifHeader); ByteOrder bo = TiffParser::decode(pImage->exifData(), pImage->iptcData(), pImage->xmpData(), exifData.pData_ + pos, length - pos); pImage->setByteOrder(bo); } else { #ifndef SUPPRESS_WARNINGS EXV_WARNING << "Failed to decode Exif metadata.\n"; #endif pImage->exifData().clear(); } } } // We look if an ImageMagick IPTC raw profile exist. if ( keySize >= 21 && memcmp("Raw profile type iptc", key, 21) == 0 && pImage->iptcData().empty()) { DataBuf psData = readRawProfile(arr,false); if (psData.size_ > 0) { Blob iptcBlob; const byte *record = 0; uint32_t sizeIptc = 0; uint32_t sizeHdr = 0; const byte* pEnd = psData.pData_ + psData.size_; const byte* pCur = psData.pData_; while ( pCur < pEnd && 0 == Photoshop::locateIptcIrb(pCur, static_cast<long>(pEnd - pCur), &record, &sizeHdr, &sizeIptc)) { if (sizeIptc) { #ifdef DEBUG std::cerr << "Found IPTC IRB, size = " << sizeIptc << "\n"; #endif append(iptcBlob, record + sizeHdr, sizeIptc); } pCur = record + sizeHdr + sizeIptc; pCur += (sizeIptc & 1); } if ( iptcBlob.size() > 0 && IptcParser::decode(pImage->iptcData(), &iptcBlob[0], static_cast<uint32_t>(iptcBlob.size()))) { #ifndef SUPPRESS_WARNINGS EXV_WARNING << "Failed to decode IPTC metadata.\n"; #endif pImage->clearIptcData(); } // If there is no IRB, try to decode the complete chunk data if ( iptcBlob.empty() && IptcParser::decode(pImage->iptcData(), psData.pData_, psData.size_)) { #ifndef SUPPRESS_WARNINGS EXV_WARNING << "Failed to decode IPTC metadata.\n"; #endif pImage->clearIptcData(); } } // if (psData.size_ > 0) } // We look if an ImageMagick XMP raw profile exist. if ( keySize >= 20 && memcmp("Raw profile type xmp", key, 20) == 0 && pImage->xmpData().empty()) { DataBuf xmpBuf = readRawProfile(arr,false); long length = xmpBuf.size_; if (length > 0) { std::string& xmpPacket = pImage->xmpPacket(); xmpPacket.assign(reinterpret_cast<char*>(xmpBuf.pData_), length); std::string::size_type idx = xmpPacket.find_first_of('<'); if (idx != std::string::npos && idx > 0) { #ifndef SUPPRESS_WARNINGS EXV_WARNING << "Removing " << idx << " characters from the beginning of the XMP packet\n"; #endif xmpPacket = xmpPacket.substr(idx); } if (XmpParser::decode(pImage->xmpData(), xmpPacket)) { #ifndef SUPPRESS_WARNINGS EXV_WARNING << "Failed to decode XMP metadata.\n"; #endif } } } // We look if an Adobe XMP string exist. if ( keySize >= 17 && memcmp("XML:com.adobe.xmp", key, 17) == 0 && pImage->xmpData().empty()) { if (arr.size_ > 0) { std::string& xmpPacket = pImage->xmpPacket(); xmpPacket.assign(reinterpret_cast<char*>(arr.pData_), arr.size_); std::string::size_type idx = xmpPacket.find_first_of('<'); if (idx != std::string::npos && idx > 0) { #ifndef SUPPRESS_WARNINGS EXV_WARNING << "Removing " << idx << " characters " << "from the beginning of the XMP packet\n"; #endif xmpPacket = xmpPacket.substr(idx); } if (XmpParser::decode(pImage->xmpData(), xmpPacket)) { #ifndef SUPPRESS_WARNINGS EXV_WARNING << "Failed to decode XMP metadata.\n"; #endif } } } // We look if a comments string exist. Note than we use only 'Description' keyword which // is dedicaced to store long comments. 'Comment' keyword is ignored. if ( keySize >= 11 && memcmp("Description", key, 11) == 0 && pImage->comment().empty()) { pImage->setComment(std::string(reinterpret_cast<char*>(arr.pData_), arr.size_)); } } // PngChunk::parseChunkContent
0
296,159
TEST_P(ProtocolIntegrationTest, TestDownstreamResetIdleTimeout) { useAccessLog("%RESPONSE_FLAGS% %RESPONSE_CODE_DETAILS%"); config_helper_.setDownstreamHttpIdleTimeout(std::chrono::milliseconds(100)); initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); auto encoder_decoder = codec_client_->startRequest(default_request_headers_); EXPECT_TRUE(fake_upstreams_[0]->waitForHttpConnection(*dispatcher_, fake_upstream_connection_)); EXPECT_TRUE(fake_upstream_connection_->waitForNewStream(*dispatcher_, upstream_request_)); if (downstreamProtocol() == Http::CodecType::HTTP1) { codec_client_->close(); } else { codec_client_->sendReset(encoder_decoder.first); } if (upstreamProtocol() == Http::CodecType::HTTP1) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); } else { ASSERT_TRUE(upstream_request_->waitForReset()); ASSERT_TRUE(fake_upstream_connection_->close()); ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); } ASSERT_TRUE(codec_client_->waitForDisconnect()); EXPECT_THAT(waitForAccessLog(access_log_name_), Not(HasSubstr("DPE"))); }
0
61,867
static void __perf_event_exit_context(void *__info) { struct remove_event re = { .detach_group = true }; struct perf_event_context *ctx = __info; perf_pmu_rotate_stop(ctx->pmu); rcu_read_lock(); list_for_each_entry_rcu(re.event, &ctx->event_list, event_entry) __perf_remove_from_context(&re); rcu_read_unlock(); }
0
378,939
int LZ4IO_setStreamChecksumMode(int xxhash) { streamChecksum = (xxhash != 0); return streamChecksum; }
0
129,617
int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, u64 end, struct btrfs_scrub_progress *progress, int readonly, int is_dev_replace) { struct scrub_ctx *sctx; int ret; struct btrfs_device *dev; unsigned int nofs_flag; if (btrfs_fs_closing(fs_info)) return -EINVAL; if (fs_info->nodesize > BTRFS_STRIPE_LEN) { /* * in this case scrub is unable to calculate the checksum * the way scrub is implemented. Do not handle this * situation at all because it won't ever happen. */ btrfs_err(fs_info, "scrub: size assumption nodesize <= BTRFS_STRIPE_LEN (%d <= %d) fails", fs_info->nodesize, BTRFS_STRIPE_LEN); return -EINVAL; } if (fs_info->sectorsize != PAGE_SIZE) { /* not supported for data w/o checksums */ btrfs_err_rl(fs_info, "scrub: size assumption sectorsize != PAGE_SIZE (%d != %lu) fails", fs_info->sectorsize, PAGE_SIZE); return -EINVAL; } if (fs_info->nodesize > PAGE_SIZE * SCRUB_MAX_PAGES_PER_BLOCK || fs_info->sectorsize > PAGE_SIZE * SCRUB_MAX_PAGES_PER_BLOCK) { /* * would exhaust the array bounds of pagev member in * struct scrub_block */ btrfs_err(fs_info, "scrub: size assumption nodesize and sectorsize <= SCRUB_MAX_PAGES_PER_BLOCK (%d <= %d && %d <= %d) fails", fs_info->nodesize, SCRUB_MAX_PAGES_PER_BLOCK, fs_info->sectorsize, SCRUB_MAX_PAGES_PER_BLOCK); return -EINVAL; } /* Allocate outside of device_list_mutex */ sctx = scrub_setup_ctx(fs_info, is_dev_replace); if (IS_ERR(sctx)) return PTR_ERR(sctx); mutex_lock(&fs_info->fs_devices->device_list_mutex); dev = btrfs_find_device(fs_info->fs_devices, devid, NULL, NULL, true); if (!dev || (test_bit(BTRFS_DEV_STATE_MISSING, &dev->dev_state) && !is_dev_replace)) { mutex_unlock(&fs_info->fs_devices->device_list_mutex); ret = -ENODEV; goto out_free_ctx; } if (!is_dev_replace && !readonly && !test_bit(BTRFS_DEV_STATE_WRITEABLE, &dev->dev_state)) { mutex_unlock(&fs_info->fs_devices->device_list_mutex); btrfs_err_in_rcu(fs_info, "scrub: device %s is not writable", rcu_str_deref(dev->name)); ret = -EROFS; goto out_free_ctx; } mutex_lock(&fs_info->scrub_lock); if (!test_bit(BTRFS_DEV_STATE_IN_FS_METADATA, &dev->dev_state) || test_bit(BTRFS_DEV_STATE_REPLACE_TGT, &dev->dev_state)) { mutex_unlock(&fs_info->scrub_lock); mutex_unlock(&fs_info->fs_devices->device_list_mutex); ret = -EIO; goto out_free_ctx; } down_read(&fs_info->dev_replace.rwsem); if (dev->scrub_ctx || (!is_dev_replace && btrfs_dev_replace_is_ongoing(&fs_info->dev_replace))) { up_read(&fs_info->dev_replace.rwsem); mutex_unlock(&fs_info->scrub_lock); mutex_unlock(&fs_info->fs_devices->device_list_mutex); ret = -EINPROGRESS; goto out_free_ctx; } up_read(&fs_info->dev_replace.rwsem); ret = scrub_workers_get(fs_info, is_dev_replace); if (ret) { mutex_unlock(&fs_info->scrub_lock); mutex_unlock(&fs_info->fs_devices->device_list_mutex); goto out_free_ctx; } sctx->readonly = readonly; dev->scrub_ctx = sctx; mutex_unlock(&fs_info->fs_devices->device_list_mutex); /* * checking @scrub_pause_req here, we can avoid * race between committing transaction and scrubbing. */ __scrub_blocked_if_needed(fs_info); atomic_inc(&fs_info->scrubs_running); mutex_unlock(&fs_info->scrub_lock); /* * In order to avoid deadlock with reclaim when there is a transaction * trying to pause scrub, make sure we use GFP_NOFS for all the * allocations done at btrfs_scrub_pages() and scrub_pages_for_parity() * invoked by our callees. The pausing request is done when the * transaction commit starts, and it blocks the transaction until scrub * is paused (done at specific points at scrub_stripe() or right above * before incrementing fs_info->scrubs_running). */ nofs_flag = memalloc_nofs_save(); if (!is_dev_replace) { /* * by holding device list mutex, we can * kick off writing super in log tree sync. */ mutex_lock(&fs_info->fs_devices->device_list_mutex); ret = scrub_supers(sctx, dev); mutex_unlock(&fs_info->fs_devices->device_list_mutex); } if (!ret) ret = scrub_enumerate_chunks(sctx, dev, start, end); memalloc_nofs_restore(nofs_flag); wait_event(sctx->list_wait, atomic_read(&sctx->bios_in_flight) == 0); atomic_dec(&fs_info->scrubs_running); wake_up(&fs_info->scrub_pause_wait); wait_event(sctx->list_wait, atomic_read(&sctx->workers_pending) == 0); if (progress) memcpy(progress, &sctx->stat, sizeof(*progress)); mutex_lock(&fs_info->scrub_lock); dev->scrub_ctx = NULL; scrub_workers_put(fs_info); mutex_unlock(&fs_info->scrub_lock); scrub_put_ctx(sctx); return ret; out_free_ctx: scrub_free_ctx(sctx); return ret; }
0
221,576
void mem_cgroup_split_huge_fixup(struct page *head) { struct page_cgroup *head_pc = lookup_page_cgroup(head); struct page_cgroup *pc; int i; if (mem_cgroup_disabled()) return; for (i = 1; i < HPAGE_PMD_NR; i++) { pc = head_pc + i; pc->mem_cgroup = head_pc->mem_cgroup; smp_wmb();/* see __commit_charge() */ pc->flags = head_pc->flags & ~PCGF_NOCOPY_AT_SPLIT; } }
0
280,767
bool FrameSelection::ShouldShowBlockCursor() const { return frame_caret_->ShouldShowBlockCursor(); }
0
245,270
void RegisterClient(MockStorageClient* client) { quota_manager_->proxy()->RegisterClient(client); }
0
329,717
static void matroska_fix_ass_packet(MatroskaDemuxContext *matroska, AVPacket *pkt, uint64_t display_duration) { char *line, *layer, *ptr = pkt->data, *end = ptr+pkt->size; for (; *ptr!=',' && ptr<end-1; ptr++); if (*ptr == ',') layer = ++ptr; for (; *ptr!=',' && ptr<end-1; ptr++); if (*ptr == ',') { int64_t end_pts = pkt->pts + display_duration; int sc = matroska->time_scale * pkt->pts / 10000000; int ec = matroska->time_scale * end_pts / 10000000; int sh, sm, ss, eh, em, es, len; sh = sc/360000; sc -= 360000*sh; sm = sc/ 6000; sc -= 6000*sm; ss = sc/ 100; sc -= 100*ss; eh = ec/360000; ec -= 360000*eh; em = ec/ 6000; ec -= 6000*em; es = ec/ 100; ec -= 100*es; *ptr++ = '\0'; len = 50 + end-ptr + FF_INPUT_BUFFER_PADDING_SIZE; if (!(line = av_malloc(len))) return; snprintf(line,len,"Dialogue: %s,%d:%02d:%02d.%02d,%d:%02d:%02d.%02d,%s", layer, sh, sm, ss, sc, eh, em, es, ec, ptr); av_free(pkt->data); pkt->data = line; pkt->size = strlen(line); } }
1
397,875
static void event_privmsg(IRC_SERVER_REC *server, const char *data, const char *nick, const char *address) { char *params, *target, *msg; g_return_if_fail(data != NULL); if (nick == NULL) return; params = event_get_params(data, 2 | PARAM_FLAG_GETREST, &target, &msg); check_query_changes(server, nick, address, target); g_free(params); }
0
523,801
static int make_addressRange(IPAddressOrRange **result, unsigned char *min, unsigned char *max, const int length) { IPAddressOrRange *aor; int i, prefixlen; if ((prefixlen = range_should_be_prefix(min, max, length)) >= 0) return make_addressPrefix(result, min, prefixlen); if ((aor = IPAddressOrRange_new()) == NULL) return 0; aor->type = IPAddressOrRange_addressRange; OPENSSL_assert(aor->u.addressRange == NULL); if ((aor->u.addressRange = IPAddressRange_new()) == NULL) goto err; if (aor->u.addressRange->min == NULL && (aor->u.addressRange->min = ASN1_BIT_STRING_new()) == NULL) goto err; if (aor->u.addressRange->max == NULL && (aor->u.addressRange->max = ASN1_BIT_STRING_new()) == NULL) goto err; for (i = length; i > 0 && min[i - 1] == 0x00; --i) ; if (!ASN1_BIT_STRING_set(aor->u.addressRange->min, min, i)) goto err; aor->u.addressRange->min->flags &= ~7; aor->u.addressRange->min->flags |= ASN1_STRING_FLAG_BITS_LEFT; if (i > 0) { unsigned char b = min[i - 1]; int j = 1; while ((b & (0xFFU >> j)) != 0) ++j; aor->u.addressRange->min->flags |= 8 - j; } for (i = length; i > 0 && max[i - 1] == 0xFF; --i) ; if (!ASN1_BIT_STRING_set(aor->u.addressRange->max, max, i)) goto err; aor->u.addressRange->max->flags &= ~7; aor->u.addressRange->max->flags |= ASN1_STRING_FLAG_BITS_LEFT; if (i > 0) { unsigned char b = max[i - 1]; int j = 1; while ((b & (0xFFU >> j)) != (0xFFU >> j)) ++j; aor->u.addressRange->max->flags |= 8 - j; } *result = aor; return 1; err: IPAddressOrRange_free(aor); return 0; }
0
248,749
sysfs_get_string (const char *dir, const char *attribute) { char *result; char *filename; result = NULL; filename = g_build_filename (dir, attribute, NULL); if (!g_file_get_contents (filename, &result, NULL, NULL)) { result = g_strdup (""); } g_free (filename); return result; }
0
417,611
LogClose(enum ExitCode error) { if (logFile) { int msgtype = (error == EXIT_NO_ERROR) ? X_INFO : X_ERROR; LogMessageVerbSigSafe(msgtype, -1, "Server terminated %s (%d). Closing log file.\n", (error == EXIT_NO_ERROR) ? "successfully" : "with error", error); fclose(logFile); logFile = NULL; logFileFd = -1; } }
0
31,870
int x86_set_memory_region(struct kvm *kvm, int id, gpa_t gpa, u32 size) { int r; mutex_lock(&kvm->slots_lock); r = __x86_set_memory_region(kvm, id, gpa, size); mutex_unlock(&kvm->slots_lock); return r; }
0
255,477
static long mem_seek(jas_stream_obj_t *obj, long offset, int origin) { jas_stream_memobj_t *m = (jas_stream_memobj_t *)obj; long newpos; JAS_DBGLOG(100, ("mem_seek(%p, %ld, %d)\n", obj, offset, origin)); switch (origin) { case SEEK_SET: newpos = offset; break; case SEEK_END: newpos = m->len_ - offset; break; case SEEK_CUR: newpos = m->pos_ + offset; break; default: abort(); break; } if (newpos < 0) { return -1; } m->pos_ = newpos; return m->pos_; }
1
5,974
int fpm_unix_resolve_socket_premissions(struct fpm_worker_pool_s *wp) /* {{{ */ { struct fpm_worker_pool_config_s *c = wp->config; /* uninitialized */ wp->socket_uid = -1; wp->socket_gid = -1; wp->socket_mode = 0666; if (!c) { return 0; } if (c->listen_owner && *c->listen_owner) { struct passwd *pwd; pwd = getpwnam(c->listen_owner); if (!pwd) { zlog(ZLOG_SYSERROR, "[pool %s] cannot get uid for user '%s'", wp->config->name, c->listen_owner); return -1; } wp->socket_uid = pwd->pw_uid; wp->socket_gid = pwd->pw_gid; } if (c->listen_group && *c->listen_group) { struct group *grp; grp = getgrnam(c->listen_group); if (!grp) { zlog(ZLOG_SYSERROR, "[pool %s] cannot get gid for group '%s'", wp->config->name, c->listen_group); return -1; } wp->socket_gid = grp->gr_gid; } if (c->listen_mode && *c->listen_mode) { wp->socket_mode = strtoul(c->listen_mode, 0, 8); } return 0; }
1
506,591
int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm) { SSL_COMP *comp; if (cm == NULL || cm->type == NID_undef) return 1; /* According to draft-ietf-tls-compression-04.txt, the compression number ranges should be the following: 0 to 63: methods defined by the IETF 64 to 192: external party methods assigned by IANA 193 to 255: reserved for private use */ if (id < 193 || id > 255) { SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD,SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE); return 0; } MemCheck_off(); comp=(SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP)); comp->id=id; comp->method=cm; load_builtin_compressions(); if (ssl_comp_methods && sk_SSL_COMP_find(ssl_comp_methods,comp) >= 0) { OPENSSL_free(comp); MemCheck_on(); SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD,SSL_R_DUPLICATE_COMPRESSION_ID); return(1); } else if ((ssl_comp_methods == NULL) || !sk_SSL_COMP_push(ssl_comp_methods,comp)) { OPENSSL_free(comp); MemCheck_on(); SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD,ERR_R_MALLOC_FAILURE); return(1); } else { MemCheck_on(); return(0); } }
0
244,078
void Layer::RemoveScrollChild(Layer* child) { scroll_children_->erase(child); if (scroll_children_->empty()) scroll_children_.reset(); SetNeedsCommit(); }
0
501,287
ZSTD_CStream* ZSTD_createCStream(void) { DEBUGLOG(3, "ZSTD_createCStream"); return ZSTD_createCStream_advanced(ZSTD_defaultCMem); }
0
241,464
bool AutocompleteEditModel::CreatedKeywordSearchByInsertingSpaceInMiddle( const string16& old_text, const string16& new_text, size_t caret_position) const { DCHECK_GE(new_text.length(), caret_position); if ((paste_state_ != NONE) || (caret_position < 2) || (old_text.length() < caret_position) || (new_text.length() == caret_position)) return false; size_t space_position = caret_position - 1; if (!IsSpaceCharForAcceptingKeyword(new_text[space_position]) || IsWhitespace(new_text[space_position - 1]) || new_text.compare(0, space_position, old_text, 0, space_position) || !new_text.compare(space_position, new_text.length() - space_position, old_text, space_position, old_text.length() - space_position)) { return false; } string16 keyword; TrimWhitespace(new_text.substr(0, space_position), TRIM_LEADING, &keyword); return !keyword.empty() && !autocomplete_controller_->keyword_provider()-> GetKeywordForText(keyword).empty(); }
0
154,656
fast_save_enter(PicklerObject *self, PyObject *obj) { /* if fast_nesting < 0, we're doing an error exit. */ if (++self->fast_nesting >= FAST_NESTING_LIMIT) { PyObject *key = NULL; if (self->fast_memo == NULL) { self->fast_memo = PyDict_New(); if (self->fast_memo == NULL) { self->fast_nesting = -1; return 0; } } key = PyLong_FromVoidPtr(obj); if (key == NULL) { self->fast_nesting = -1; return 0; } if (PyDict_GetItemWithError(self->fast_memo, key)) { Py_DECREF(key); PyErr_Format(PyExc_ValueError, "fast mode: can't pickle cyclic objects " "including object type %.200s at %p", obj->ob_type->tp_name, obj); self->fast_nesting = -1; return 0; } if (PyErr_Occurred()) { Py_DECREF(key); self->fast_nesting = -1; return 0; } if (PyDict_SetItem(self->fast_memo, key, Py_None) < 0) { Py_DECREF(key); self->fast_nesting = -1; return 0; } Py_DECREF(key); } return 1; }
0
448,455
dns_message_movename(dns_message_t *msg, dns_name_t *name, dns_section_t fromsection, dns_section_t tosection) { REQUIRE(msg != NULL); REQUIRE(msg->from_to_wire == DNS_MESSAGE_INTENTRENDER); REQUIRE(name != NULL); REQUIRE(VALID_NAMED_SECTION(fromsection)); REQUIRE(VALID_NAMED_SECTION(tosection)); /* * Unlink the name from the old section */ ISC_LIST_UNLINK(msg->sections[fromsection], name, link); ISC_LIST_APPEND(msg->sections[tosection], name, link); }
0
277,305
void CustomButton::AnimationProgressed(const gfx::Animation* animation) { SchedulePaint(); }
0
107,361
static int klv_read_packet(KLVPacket *klv, AVIOContext *pb) { int64_t length, pos; if (!mxf_read_sync(pb, mxf_klv_key, 4)) return AVERROR_INVALIDDATA; klv->offset = avio_tell(pb) - 4; memcpy(klv->key, mxf_klv_key, 4); avio_read(pb, klv->key + 4, 12); length = klv_decode_ber_length(pb); if (length < 0) return length; klv->length = length; pos = avio_tell(pb); if (pos > INT64_MAX - length) return AVERROR_INVALIDDATA; klv->next_klv = pos + length; return 0; }
0
210,320
bool DecodeCharset(const std::string& input, std::string* decoded_charset, std::string* value) { StringTokenizer t(input, "'"); t.set_options(StringTokenizer::RETURN_DELIMS); std::string temp_charset; std::string temp_value; int numDelimsSeen = 0; while (t.GetNext()) { if (t.token_is_delim()) { ++numDelimsSeen; continue; } else { switch (numDelimsSeen) { case 0: temp_charset = t.token(); break; case 1: break; case 2: temp_value = t.token(); break; default: return false; } } } if (numDelimsSeen != 2) return false; if (temp_charset.empty() || temp_value.empty()) return false; decoded_charset->swap(temp_charset); value->swap(temp_value); return true; }
0
258,214
void proto_register_t38 ( void ) { static hf_register_info hf [ ] = { # line 1 "../../asn1/t38/packet-t38-hfarr.c" { & hf_t38_IFPPacket_PDU , { "IFPPacket" , "t38.IFPPacket_element" , FT_NONE , BASE_NONE , NULL , 0 , NULL , HFILL } } , { & hf_t38_UDPTLPacket_PDU , { "UDPTLPacket" , "t38.UDPTLPacket_element" , FT_NONE , BASE_NONE , NULL , 0 , NULL , HFILL } } , { & hf_t38_type_of_msg , { "type-of-msg" , "t38.type_of_msg" , FT_UINT32 , BASE_DEC , VALS ( t38_Type_of_msg_vals ) , 0 , NULL , HFILL } } , { & hf_t38_data_field , { "data-field" , "t38.data_field" , FT_UINT32 , BASE_DEC , NULL , 0 , NULL , HFILL } } , { & hf_t38_t30_indicator , { "t30-indicator" , "t38.t30_indicator" , FT_UINT32 , BASE_DEC , VALS ( t38_T30_indicator_vals ) , 0 , NULL , HFILL } } , { & hf_t38_t30_data , { "t30-data" , "t38.t30_data" , FT_UINT32 , BASE_DEC , VALS ( t38_T30_data_vals ) , 0 , NULL , HFILL } } , { & hf_t38_Data_Field_item , { "Data-Field item" , "t38.Data_Field_item_element" , FT_NONE , BASE_NONE , NULL , 0 , NULL , HFILL } } , { & hf_t38_field_type , { "field-type" , "t38.field_type" , FT_UINT32 , BASE_DEC , VALS ( t38_T_field_type_vals ) , 0 , NULL , HFILL } } , { & hf_t38_field_data , { "field-data" , "t38.field_data" , FT_BYTES , BASE_NONE , NULL , 0 , NULL , HFILL } } , { & hf_t38_seq_number , { "seq-number" , "t38.seq_number" , FT_UINT32 , BASE_DEC , NULL , 0 , NULL , HFILL } } , { & hf_t38_primary_ifp_packet , { "primary-ifp-packet" , "t38.primary_ifp_packet_element" , FT_NONE , BASE_NONE , NULL , 0 , NULL , HFILL } } , { & hf_t38_error_recovery , { "error-recovery" , "t38.error_recovery" , FT_UINT32 , BASE_DEC , VALS ( t38_T_error_recovery_vals ) , 0 , NULL , HFILL } } , { & hf_t38_secondary_ifp_packets , { "secondary-ifp-packets" , "t38.secondary_ifp_packets" , FT_UINT32 , BASE_DEC , NULL , 0 , NULL , HFILL } } , { & hf_t38_secondary_ifp_packets_item , { "secondary-ifp-packets item" , "t38.secondary_ifp_packets_item_element" , FT_NONE , BASE_NONE , NULL , 0 , "OpenType_IFPPacket" , HFILL } } , { & hf_t38_fec_info , { "fec-info" , "t38.fec_info_element" , FT_NONE , BASE_NONE , NULL , 0 , NULL , HFILL } } , { & hf_t38_fec_npackets , { "fec-npackets" , "t38.fec_npackets" , FT_INT32 , BASE_DEC , NULL , 0 , "INTEGER" , HFILL } } , { & hf_t38_fec_data , { "fec-data" , "t38.fec_data" , FT_UINT32 , BASE_DEC , NULL , 0 , NULL , HFILL } } , { & hf_t38_fec_data_item , { "fec-data item" , "t38.fec_data_item" , FT_BYTES , BASE_NONE , NULL , 0 , "OCTET_STRING" , HFILL } } , # line 659 "../../asn1/t38/packet-t38-template.c" { & hf_t38_setup , { "Stream setup" , "t38.setup" , FT_STRING , BASE_NONE , NULL , 0x0 , "Stream setup, method and frame number" , HFILL } } , { & hf_t38_setup_frame , { "Stream frame" , "t38.setup-frame" , FT_FRAMENUM , BASE_NONE , NULL , 0x0 , "Frame that set up this stream" , HFILL } } , { & hf_t38_setup_method , { "Stream Method" , "t38.setup-method" , FT_STRING , BASE_NONE , NULL , 0x0 , "Method used to set up this stream" , HFILL } } , { & hf_t38_fragments , { "Message fragments" , "t38.fragments" , FT_NONE , BASE_NONE , NULL , 0x00 , NULL , HFILL } } , { & hf_t38_fragment , { "Message fragment" , "t38.fragment" , FT_FRAMENUM , BASE_NONE , NULL , 0x00 , NULL , HFILL } } , { & hf_t38_fragment_overlap , { "Message fragment overlap" , "t38.fragment.overlap" , FT_BOOLEAN , BASE_NONE , NULL , 0x0 , NULL , HFILL } } , { & hf_t38_fragment_overlap_conflicts , { "Message fragment overlapping with conflicting data" , "t38.fragment.overlap.conflicts" , FT_BOOLEAN , BASE_NONE , NULL , 0x0 , NULL , HFILL } } , { & hf_t38_fragment_multiple_tails , { "Message has multiple tail fragments" , "t38.fragment.multiple_tails" , FT_BOOLEAN , BASE_NONE , NULL , 0x0 , NULL , HFILL } } , { & hf_t38_fragment_too_long_fragment , { "Message fragment too long" , "t38.fragment.too_long_fragment" , FT_BOOLEAN , BASE_NONE , NULL , 0x0 , NULL , HFILL } } , { & hf_t38_fragment_error , { "Message defragmentation error" , "t38.fragment.error" , FT_FRAMENUM , BASE_NONE , NULL , 0x00 , NULL , HFILL } } , { & hf_t38_fragment_count , { "Message fragment count" , "t38.fragment.count" , FT_UINT32 , BASE_DEC , NULL , 0x00 , NULL , HFILL } } , { & hf_t38_reassembled_in , { "Reassembled in" , "t38.reassembled.in" , FT_FRAMENUM , BASE_NONE , NULL , 0x00 , NULL , HFILL } } , { & hf_t38_reassembled_length , { "Reassembled T38 length" , "t38.reassembled.length" , FT_UINT32 , BASE_DEC , NULL , 0x00 , NULL , HFILL } } , } ; static gint * ett [ ] = { & ett_t38 , # line 1 "../../asn1/t38/packet-t38-ettarr.c" & ett_t38_IFPPacket , & ett_t38_Type_of_msg , & ett_t38_Data_Field , & ett_t38_Data_Field_item , & ett_t38_UDPTLPacket , & ett_t38_T_error_recovery , & ett_t38_T_secondary_ifp_packets , & ett_t38_T_fec_info , & ett_t38_T_fec_data , # line 706 "../../asn1/t38/packet-t38-template.c" & ett_t38_setup , & ett_data_fragment , & ett_data_fragments } ; static ei_register_info ei [ ] = { { & ei_t38_malformed , { "t38.malformed" , PI_MALFORMED , PI_ERROR , "Malformed packet" , EXPFILL } } , } ; module_t * t38_module ; expert_module_t * expert_t38 ; proto_t38 = proto_register_protocol ( "T.38" , "T.38" , "t38" ) ; proto_register_field_array ( proto_t38 , hf , array_length ( hf ) ) ; proto_register_subtree_array ( ett , array_length ( ett ) ) ; expert_t38 = expert_register_protocol ( proto_t38 ) ; expert_register_field_array ( expert_t38 , ei , array_length ( ei ) ) ; register_dissector ( "t38_udp" , dissect_t38_udp , proto_t38 ) ; register_init_routine ( t38_defragment_init ) ; register_cleanup_routine ( t38_defragment_cleanup ) ; t38_tap = register_tap ( "t38" ) ; t38_module = prefs_register_protocol ( proto_t38 , proto_reg_handoff_t38 ) ; prefs_register_bool_preference ( t38_module , "use_pre_corrigendum_asn1_specification" , "Use the Pre-Corrigendum ASN.1 specification" , "Whether the T.38 dissector should decode using the Pre-Corrigendum T.38 " "ASN.1 specification (1998)." , & use_pre_corrigendum_asn1_specification ) ; prefs_register_bool_preference ( t38_module , "dissect_possible_rtpv2_packets_as_rtp" , "Dissect possible RTP version 2 packets with RTP dissector" , "Whether a UDP packet that looks like RTP version 2 packet will " "be dissected as RTP packet or T.38 packet. If enabled there is a risk that T.38 UDPTL " "packets with sequence number higher than 32767 may be dissected as RTP." , & dissect_possible_rtpv2_packets_as_rtp ) ; prefs_register_uint_preference ( t38_module , "tcp.port" , "T.38 TCP Port" , "Set the TCP port for T.38 messages" , 10 , & global_t38_tcp_port ) ; prefs_register_uint_preference ( t38_module , "udp.port" , "T.38 UDP Port" , "Set the UDP port for T.38 messages" , 10 , & global_t38_udp_port ) ; prefs_register_bool_preference ( t38_module , "reassembly" , "Reassemble T.38 PDUs over TPKT over TCP" , "Whether the dissector should reassemble T.38 PDUs spanning multiple TCP segments " "when TPKT is used over TCP. " "To use this option, you must also enable \"Allow subdissectors to reassemble " "TCP streams\" in the TCP protocol settings." , & t38_tpkt_reassembly ) ; prefs_register_enum_preference ( t38_module , "tpkt_usage" , "TPKT used over TCP" , "Whether T.38 is used with TPKT for TCP" , ( gint * ) & t38_tpkt_usage , t38_tpkt_options , FALSE ) ; prefs_register_bool_preference ( t38_module , "show_setup_info" , "Show stream setup information" , "Where available, show which protocol and frame caused " "this T.38 stream to be created" , & global_t38_show_setup_info ) ; }
0
459,358
cb_syslog_badpri(const union sudo_defs_val *sd_un) { debug_decl(cb_syslog_badpri, SUDOERS_DEBUG_PLUGIN); eventlog_set_syslog_rejectpri(sd_un->ival); eventlog_set_syslog_alertpri(sd_un->ival); debug_return_bool(true); }
0
108,088
static Jsi_OpCodes *code_pop(int n) { JSI_NEW_CODES(0,OP_POP, n); }
0