idx
int64
func
string
target
int64
489,212
static int hfsplus_fill_cat_thread(struct super_block *sb, hfsplus_cat_entry *entry, int type, u32 parentid, struct qstr *str) { entry->type = cpu_to_be16(type); entry->thread.reserved = 0; entry->thread.parentID = cpu_to_be32(parentid); hfsplus_asc2uni(sb, &entry->thread.nodeName, str->name, str->len); return 10 + be16_to_cpu(entry->thread.nodeName.length) * 2; }
0
270,382
static int ok_inflater_decode_length(ok_inflater *inflater, int value) { if (value < 8) { return value + 3; } else { int len = OK_INFLATER_LENGTH_TABLE[value]; unsigned int extra_bits = (unsigned int)((value >> 2) - 1); if (extra_bits <= 5) { if (!ok_inflater_load_bits(inflater, extra_bits)) { return -1; } len += ok_inflater_read_bits(inflater, extra_bits); } return len; } }
0
445,934
archive_add_ready_for_conversion_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { ConvertData *cdata = user_data; FrWindow *window = cdata->window; GError *error = NULL; fr_archive_operation_finish (FR_ARCHIVE (source_object), result, &error); _fr_window_stop_activity_mode (window); close_progress_dialog (window, FALSE); if (error != NULL) { _handle_archive_operation_error (window, cdata->new_archive, FR_ACTION_ADDING_FILES, error, NULL, NULL); fr_window_stop_batch (window); g_error_free (error); return; } open_progress_dialog_with_open_archive (window); fr_window_exec_next_batch_action (window); }
0
224,224
R_API void r_io_bank_drain(RIO *io, const ut32 bankid) { r_return_if_fail (io); RIOBank *bank = r_io_bank_get (io, bankid); if (!bank) { return; } bank->last_used = NULL; RRBNode *node = r_crbtree_first_node (bank->submaps); RRBNode *next = NULL; while (node) { next = r_rbnode_next (node); if (next) { RIOSubMap *bd = (RIOSubMap *)node->data; RIOSubMap *sm = (RIOSubMap *)next->data; if (!memcmp (&bd->mapref, &sm->mapref, sizeof (RIOMapRef))) { r_io_submap_set_to (bd, r_io_submap_to (sm)); r_crbtree_delete (bank->submaps, sm, _find_sm_by_from_vaddr_cb, NULL); continue; } } node = next; } }
0
225,662
GF_Box *ctts_box_new() { ISOM_DECL_BOX_ALLOC(GF_CompositionOffsetBox, GF_ISOM_BOX_TYPE_CTTS); return (GF_Box *) tmp; }
0
463,135
static void annotation_get_pop3showafter(annotate_state_t *state, struct annotate_entry_list *entry) { struct mailbox *mailbox = state->mailbox; char valuebuf[RFC3501_DATETIME_MAX+1]; struct buf value = BUF_INITIALIZER; assert(mailbox); if (mailbox->i.pop3_show_after) { time_to_rfc3501(mailbox->i.pop3_show_after, valuebuf, sizeof(valuebuf)); buf_appendcstr(&value, valuebuf); } output_entryatt(state, entry->name, "", &value); buf_free(&value); }
0
512,950
bool is_string() const { return m_type == DYN_COL_STRING; }
0
230,615
void derive_temporal_luma_vector_prediction(base_context* ctx, de265_image* img, const slice_segment_header* shdr, int xP,int yP, int nPbW,int nPbH, int refIdxL, int X, // which MV (L0/L1) to get MotionVector* out_mvLXCol, uint8_t* out_availableFlagLXCol) { // --- no temporal MVP -> exit --- if (shdr->slice_temporal_mvp_enabled_flag == 0) { out_mvLXCol->x = 0; out_mvLXCol->y = 0; *out_availableFlagLXCol = 0; return; } // --- find collocated reference image --- int Log2CtbSizeY = img->get_sps().Log2CtbSizeY; int colPic; // TODO: this is the same for the whole slice. We can precompute it. if (shdr->slice_type == SLICE_TYPE_B && shdr->collocated_from_l0_flag == 0) { logtrace(LogMotion,"collocated L1 ref_idx=%d\n",shdr->collocated_ref_idx); colPic = shdr->RefPicList[1][ shdr->collocated_ref_idx ]; } else { logtrace(LogMotion,"collocated L0 ref_idx=%d\n",shdr->collocated_ref_idx); colPic = shdr->RefPicList[0][ shdr->collocated_ref_idx ]; } // check whether collocated reference picture exists if (!ctx->has_image(colPic)) { out_mvLXCol->x = 0; out_mvLXCol->y = 0; *out_availableFlagLXCol = 0; ctx->add_warning(DE265_WARNING_NONEXISTING_REFERENCE_PICTURE_ACCESSED, false); return; } // --- get collocated MV either at bottom-right corner or from center of PB --- int xColPb,yColPb; int yColBr = yP + nPbH; // bottom right collocated motion vector position int xColBr = xP + nPbW; /* If neighboring pixel at bottom-right corner is in the same CTB-row and inside the image, use this (reduced down to 16 pixels resolution) as collocated MV position. Note: see 2014, Sze, Sect. 5.2.1.2 why candidate C0 is excluded when on another CTB-row. This is to reduce the memory bandwidth requirements. */ if ((yP>>Log2CtbSizeY) == (yColBr>>Log2CtbSizeY) && xColBr < img->get_sps().pic_width_in_luma_samples && yColBr < img->get_sps().pic_height_in_luma_samples) { xColPb = xColBr & ~0x0F; // reduce resolution of collocated motion-vectors to 16 pixels grid yColPb = yColBr & ~0x0F; derive_collocated_motion_vectors(ctx,img,shdr, xP,yP, colPic, xColPb,yColPb, refIdxL, X, out_mvLXCol, out_availableFlagLXCol); } else { out_mvLXCol->x = 0; out_mvLXCol->y = 0; *out_availableFlagLXCol = 0; } if (*out_availableFlagLXCol==0) { int xColCtr = xP+(nPbW>>1); int yColCtr = yP+(nPbH>>1); xColPb = xColCtr & ~0x0F; // reduce resolution of collocated motion-vectors to 16 pixels grid yColPb = yColCtr & ~0x0F; derive_collocated_motion_vectors(ctx,img,shdr, xP,yP, colPic, xColPb,yColPb, refIdxL, X, out_mvLXCol, out_availableFlagLXCol); } }
0
227,036
IRC_PROTOCOL_CALLBACK(728) { struct t_irc_channel *ptr_channel; struct t_gui_buffer *ptr_buffer; struct t_irc_modelist *ptr_modelist; time_t datetime; const char *nick_address; char str_number[64]; IRC_PROTOCOL_MIN_ARGS(6); ptr_channel = irc_channel_search (server, argv[3]); ptr_buffer = (ptr_channel && ptr_channel->nicks) ? ptr_channel->buffer : server->buffer; ptr_modelist = irc_modelist_search (ptr_channel, argv[4][0]); if (ptr_modelist) { /* start receiving new list */ if (ptr_modelist->state != IRC_MODELIST_STATE_RECEIVING) { irc_modelist_item_free_all (ptr_modelist); ptr_modelist->state = IRC_MODELIST_STATE_RECEIVING; } snprintf (str_number, sizeof (str_number), "%s[%s%d%s] ", IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, ((ptr_modelist->last_item) ? ptr_modelist->last_item->number + 1 : 0) + 1, IRC_COLOR_CHAT_DELIMITERS); } else str_number[0] = '\0'; if (argc >= 7) { nick_address = irc_protocol_nick_address ( server, 1, NULL, irc_message_get_nick_from_host (argv[6]), irc_message_get_address_from_host (argv[6])); if (argc >= 8) { datetime = (time_t)(atol ((argv[7][0] == ':') ? argv[7] + 1 : argv[7])); if (ptr_modelist) irc_modelist_item_new (ptr_modelist, argv[5], argv[6], datetime); weechat_printf_date_tags ( irc_msgbuffer_get_target_buffer ( server, NULL, command, "quietlist", ptr_buffer), date, irc_protocol_tags (command, "irc_numeric", NULL, NULL), /* TRANSLATORS: "%s" after "on" is a date */ _("%s%s[%s%s%s] %s%s%s%s quieted by %s on %s"), weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_CHANNEL, argv[3], IRC_COLOR_CHAT_DELIMITERS, str_number, IRC_COLOR_CHAT_HOST, argv[5], IRC_COLOR_RESET, (nick_address[0]) ? nick_address : "?", weechat_util_get_time_string (&datetime)); } else { if (ptr_modelist) irc_modelist_item_new (ptr_modelist, argv[5], argv[6], 0); weechat_printf_date_tags ( irc_msgbuffer_get_target_buffer ( server, NULL, command, "quietlist", ptr_buffer), date, irc_protocol_tags (command, "irc_numeric", NULL, NULL), _("%s%s[%s%s%s] %s%s%s%s quieted by %s"), weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_CHANNEL, argv[3], IRC_COLOR_CHAT_DELIMITERS, str_number, IRC_COLOR_CHAT_HOST, argv[5], IRC_COLOR_RESET, (nick_address[0]) ? nick_address : "?"); } } else { if (ptr_modelist) irc_modelist_item_new (ptr_modelist, argv[5], NULL, 0); weechat_printf_date_tags ( irc_msgbuffer_get_target_buffer ( server, NULL, command, "quietlist", ptr_buffer), date, irc_protocol_tags (command, "irc_numeric", NULL, NULL), _("%s%s[%s%s%s] %s%s%s%s quieted"), weechat_prefix ("network"), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT_CHANNEL, argv[3], IRC_COLOR_CHAT_DELIMITERS, str_number, IRC_COLOR_CHAT_HOST, argv[5], IRC_COLOR_RESET); } return WEECHAT_RC_OK; }
0
448,559
static int bgp_collision_detect(struct peer *new, struct in_addr remote_id) { struct peer *peer; /* * Upon receipt of an OPEN message, the local system must examine * all of its connections that are in the OpenConfirm state. A BGP * speaker may also examine connections in an OpenSent state if it * knows the BGP Identifier of the peer by means outside of the * protocol. If among these connections there is a connection to a * remote BGP speaker whose BGP Identifier equals the one in the * OPEN message, then the local system performs the following * collision resolution procedure: */ peer = new->doppelganger; if (peer == NULL) return 0; /* * Do not accept the new connection in Established or Clearing * states. Note that a peer GR is handled by closing the existing * connection upon receipt of new one. */ if (peer_established(peer) || peer->status == Clearing) { bgp_notify_send(new, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_COLLISION_RESOLUTION); return -1; } if ((peer->status != OpenConfirm) && (peer->status != OpenSent)) return 0; /* * 1. The BGP Identifier of the local system is * compared to the BGP Identifier of the remote * system (as specified in the OPEN message). * * If the BGP Identifiers of the peers * involved in the connection collision * are identical, then the connection * initiated by the BGP speaker with the * larger AS number is preserved. */ if (ntohl(peer->local_id.s_addr) < ntohl(remote_id.s_addr) || (ntohl(peer->local_id.s_addr) == ntohl(remote_id.s_addr) && peer->local_as < peer->as)) if (!CHECK_FLAG(peer->sflags, PEER_STATUS_ACCEPT_PEER)) { /* * 2. If the value of the local BGP * Identifier is less than the remote one, * the local system closes BGP connection * that already exists (the one that is * already in the OpenConfirm state), * and accepts BGP connection initiated by * the remote system. */ bgp_notify_send(peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_COLLISION_RESOLUTION); return 1; } else { bgp_notify_send(new, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_COLLISION_RESOLUTION); return -1; } else { if (ntohl(peer->local_id.s_addr) == ntohl(remote_id.s_addr) && peer->local_as == peer->as) flog_err(EC_BGP_ROUTER_ID_SAME, "Peer's router-id %pI4 is the same as ours", &remote_id); /* * 3. Otherwise, the local system closes newly * created BGP connection (the one associated with the * newly received OPEN message), and continues to use * the existing one (the one that is already in the * OpenConfirm state). */ if (CHECK_FLAG(peer->sflags, PEER_STATUS_ACCEPT_PEER)) { bgp_notify_send(peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_COLLISION_RESOLUTION); return 1; } else { bgp_notify_send(new, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_COLLISION_RESOLUTION); return -1; } } }
0
317,063
static int smack_ipc_permission(struct kern_ipc_perm *ipp, short flag) { struct smack_known **blob = smack_ipc(ipp); struct smack_known *iskp = *blob; int may = smack_flags_to_may(flag); struct smk_audit_info ad; int rc; #ifdef CONFIG_AUDIT smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_IPC); ad.a.u.ipc_id = ipp->id; #endif rc = smk_curacc(iskp, may, &ad); rc = smk_bu_current("svipc", iskp, may, rc); return rc; }
0
430,420
static int validate_vlan_from_nlattrs(const struct sw_flow_match *match, u64 key_attrs, bool inner, const struct nlattr **a, bool log) { __be16 tci = 0; if (!((key_attrs & (1 << OVS_KEY_ATTR_ETHERNET)) && (key_attrs & (1 << OVS_KEY_ATTR_ETHERTYPE)) && eth_type_vlan(nla_get_be16(a[OVS_KEY_ATTR_ETHERTYPE])))) { /* Not a VLAN. */ return 0; } if (!((key_attrs & (1 << OVS_KEY_ATTR_VLAN)) && (key_attrs & (1 << OVS_KEY_ATTR_ENCAP)))) { OVS_NLERR(log, "Invalid %s frame", (inner) ? "C-VLAN" : "VLAN"); return -EINVAL; } if (a[OVS_KEY_ATTR_VLAN]) tci = nla_get_be16(a[OVS_KEY_ATTR_VLAN]); if (!(tci & htons(VLAN_CFI_MASK))) { if (tci) { OVS_NLERR(log, "%s TCI does not have VLAN_CFI_MASK bit set.", (inner) ? "C-VLAN" : "VLAN"); return -EINVAL; } else if (nla_len(a[OVS_KEY_ATTR_ENCAP])) { /* Corner case for truncated VLAN header. */ OVS_NLERR(log, "Truncated %s header has non-zero encap attribute.", (inner) ? "C-VLAN" : "VLAN"); return -EINVAL; } } return 1; }
0
442,794
static void GetStr(char **string, char *value) { if(*string) free(*string); if(value) *string = strdup(value); else *string = NULL; }
0
437,007
static int mcba_usb_start(struct mcba_priv *priv) { struct net_device *netdev = priv->netdev; int err, i; mcba_init_ctx(priv); for (i = 0; i < MCBA_MAX_RX_URBS; i++) { struct urb *urb = NULL; u8 *buf; dma_addr_t buf_dma; /* create a URB, and a buffer for it */ urb = usb_alloc_urb(0, GFP_KERNEL); if (!urb) { err = -ENOMEM; break; } buf = usb_alloc_coherent(priv->udev, MCBA_USB_RX_BUFF_SIZE, GFP_KERNEL, &buf_dma); if (!buf) { netdev_err(netdev, "No memory left for USB buffer\n"); usb_free_urb(urb); err = -ENOMEM; break; } urb->transfer_dma = buf_dma; usb_fill_bulk_urb(urb, priv->udev, usb_rcvbulkpipe(priv->udev, MCBA_USB_EP_IN), buf, MCBA_USB_RX_BUFF_SIZE, mcba_usb_read_bulk_callback, priv); urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; usb_anchor_urb(urb, &priv->rx_submitted); err = usb_submit_urb(urb, GFP_KERNEL); if (err) { usb_unanchor_urb(urb); usb_free_coherent(priv->udev, MCBA_USB_RX_BUFF_SIZE, buf, buf_dma); usb_free_urb(urb); break; } priv->rxbuf[i] = buf; priv->rxbuf_dma[i] = buf_dma; /* Drop reference, USB core will take care of freeing it */ usb_free_urb(urb); } /* Did we submit any URBs */ if (i == 0) { netdev_warn(netdev, "couldn't setup read URBs\n"); return err; } /* Warn if we've couldn't transmit all the URBs */ if (i < MCBA_MAX_RX_URBS) netdev_warn(netdev, "rx performance may be slow\n"); mcba_usb_xmit_read_fw_ver(priv, MCBA_VER_REQ_USB); mcba_usb_xmit_read_fw_ver(priv, MCBA_VER_REQ_CAN); return err; }
0
255,761
add_if_prefix_matches(lookup_state_t *state, const sorted_pattern_t *prefix, const svn_stringbuf_t *segment) { node_t *node = prefix->node; if ( node->segment.len <= segment->len && !memcmp(node->segment.data, segment->data, node->segment.len)) add_next_node(state, node); }
0
238,482
struct btf *bpf_get_btf_vmlinux(void) { if (!btf_vmlinux && IS_ENABLED(CONFIG_DEBUG_INFO_BTF)) { mutex_lock(&bpf_verifier_lock); if (!btf_vmlinux) btf_vmlinux = btf_parse_vmlinux(); mutex_unlock(&bpf_verifier_lock); } return btf_vmlinux; }
0
343,283
static int _dlmap_read(DLHandler * const dlhandler) { ssize_t readnb; if (dlhandler->dlmap_size > dlhandler->sizeof_map) { abort(); } if (dlhandler->dlmap_size <= (size_t) 0U) { return 0; } if (dlhandler->dlmap_pos != dlhandler->dlmap_fdpos) { do { if (lseek(dlhandler->f, dlhandler->dlmap_pos, SEEK_SET) == (off_t) -1) { dlhandler->dlmap_fdpos = (off_t) -1; return -1; } dlhandler->dlmap_fdpos = dlhandler->dlmap_pos; readnb = read(dlhandler->f, dlhandler->map, dlhandler->dlmap_size); } while (readnb == (ssize_t) -1 && errno == EINTR); } else { do { readnb = read(dlhandler->f, dlhandler->map, dlhandler->dlmap_size); } while (readnb == (ssize_t) -1 && errno == EINTR); } if (readnb <= (ssize_t) 0) { dlhandler->dlmap_fdpos = (off_t) -1; return -1; } if (readnb != (ssize_t) dlhandler->dlmap_size) { dlhandler->dlmap_fdpos = (off_t) -1; } else { dlhandler->dlmap_fdpos += (off_t) readnb; } return 0; }
0
339,718
static Bigint *lshift(Bigint *b, int k) { int i, k1, n, n1; Bigint *b1; ULong *x, *x1, *xe, z; #ifdef Pack_32 n = k >> 5; #else n = k >> 4; #endif k1 = b->k; n1 = n + b->wds + 1; for(i = b->maxwds; n1 > i; i <<= 1) { k1++; } b1 = Balloc(k1); x1 = b1->x; for(i = 0; i < n; i++) { *x1++ = 0; } x = b->x; xe = x + b->wds; #ifdef Pack_32 if (k &= 0x1f) { k1 = 32 - k; z = 0; do { *x1++ = *x << k | z; z = *x++ >> k1; } while(x < xe); if ((*x1 = z)) { ++n1; } } #else if (k &= 0xf) { k1 = 16 - k; z = 0; do { *x1++ = *x << k & 0xffff | z; z = *x++ >> k1; } while(x < xe); if (*x1 = z) { ++n1; } } #endif else do *x1++ = *x++; while(x < xe); b1->wds = n1 - 1; Bfree(b); return b1; }
0
225,801
GF_Err mvex_box_write(GF_Box *s, GF_BitStream *bs) { return gf_isom_box_write_header(s, bs); }
0
512,614
With_sum_func_cache(const Item *a) :m_with_sum_func(a->with_sum_func()) { }
0
509,534
void _ma_check_print_info(HA_CHECK *param, const char *fmt, ...) { va_list args; DBUG_ENTER("_ma_check_print_info"); va_start(args, fmt); _ma_check_print_msg(param, MA_CHECK_INFO, fmt, args); va_end(args); DBUG_VOID_RETURN; }
0
273,915
static void handle_RMD(ctrl_t *ctrl, char *arg) { handle_DELE(ctrl, arg); }
0
310,113
legal_tab_list(const char *tab_list) { bool result = TRUE; if (tab_list != 0 && *tab_list != '\0') { if (comma_is_needed(tab_list)) { int n, ch; for (n = 0; tab_list[n] != '\0'; ++n) { ch = UChar(tab_list[n]); if (!(isdigit(ch) || ch == ',' || ch == '+')) { fprintf(stderr, "%s: unexpected character found '%c'\n", _nc_progname, ch); result = FALSE; break; } } } else { fprintf(stderr, "%s: trailing comma found '%s'\n", _nc_progname, tab_list); result = FALSE; } } else { fprintf(stderr, "%s: no tab-list given\n", _nc_progname); result = FALSE; } return result; }
0
281,144
static void xfrm_audit_common_policyinfo(struct xfrm_policy *xp, struct audit_buffer *audit_buf) { struct xfrm_sec_ctx *ctx = xp->security; struct xfrm_selector *sel = &xp->selector; if (ctx) audit_log_format(audit_buf, " sec_alg=%u sec_doi=%u sec_obj=%s", ctx->ctx_alg, ctx->ctx_doi, ctx->ctx_str); switch (sel->family) { case AF_INET: audit_log_format(audit_buf, " src=%pI4", &sel->saddr.a4); if (sel->prefixlen_s != 32) audit_log_format(audit_buf, " src_prefixlen=%d", sel->prefixlen_s); audit_log_format(audit_buf, " dst=%pI4", &sel->daddr.a4); if (sel->prefixlen_d != 32) audit_log_format(audit_buf, " dst_prefixlen=%d", sel->prefixlen_d); break; case AF_INET6: audit_log_format(audit_buf, " src=%pI6", sel->saddr.a6); if (sel->prefixlen_s != 128) audit_log_format(audit_buf, " src_prefixlen=%d", sel->prefixlen_s); audit_log_format(audit_buf, " dst=%pI6", sel->daddr.a6); if (sel->prefixlen_d != 128) audit_log_format(audit_buf, " dst_prefixlen=%d", sel->prefixlen_d); break; } }
0
366,196
bool __is_local_mountpoint(struct dentry *dentry) { struct mnt_namespace *ns = current->nsproxy->mnt_ns; struct mount *mnt; bool is_covered = false; down_read(&namespace_sem); lock_ns_list(ns); list_for_each_entry(mnt, &ns->list, mnt_list) { if (mnt_is_cursor(mnt)) continue; is_covered = (mnt->mnt_mountpoint == dentry); if (is_covered) break; } unlock_ns_list(ns); up_read(&namespace_sem); return is_covered; }
0
244,215
GF_Box *bloc_box_new() { ISOM_DECL_BOX_ALLOC(GF_BaseLocationBox, GF_ISOM_BOX_TYPE_BLOC); return (GF_Box *)tmp; }
0
486,794
static void gem_update_int_status(CadenceGEMState *s) { int i; qemu_set_irq(s->irq[0], !!s->regs[GEM_ISR]); for (i = 1; i < s->num_priority_queues; ++i) { qemu_set_irq(s->irq[i], !!s->regs[GEM_INT_Q1_STATUS + i - 1]); } }
0
230,279
njs_array_handler_index_of(njs_vm_t *vm, njs_iterator_args_t *args, njs_value_t *entry, int64_t n) { if (njs_values_strict_equal(args->argument, entry)) { njs_set_number(&vm->retval, n); return NJS_DONE; } return NJS_OK; }
0
326,921
static u32 vidtv_s302m_write_frame(struct vidtv_encoder *e, u16 sample) { struct vidtv_s302m_ctx *ctx = e->ctx; struct vidtv_s302m_frame_16 f = {}; u32 nbytes = 0; /* from ffmpeg: see s302enc.c */ u8 vucf = ctx->frame_index == 0 ? 0x10 : 0; f.data[0] = sample & 0xFF; f.data[1] = (sample & 0xFF00) >> 8; f.data[2] = ((sample & 0x0F) << 4) | vucf; f.data[3] = (sample & 0x0FF0) >> 4; f.data[4] = (sample & 0xF000) >> 12; f.data[0] = reverse[f.data[0]]; f.data[1] = reverse[f.data[1]]; f.data[2] = reverse[f.data[2]]; f.data[3] = reverse[f.data[3]]; f.data[4] = reverse[f.data[4]]; nbytes += vidtv_memcpy(e->encoder_buf, e->encoder_buf_offset, VIDTV_S302M_BUF_SZ, &f, sizeof(f)); e->encoder_buf_offset += nbytes; ctx->frame_index++; if (ctx->frame_index >= S302M_BLOCK_SZ) ctx->frame_index = 0; return nbytes; }
0
502,659
BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert) { int i, j; BIO *out = NULL, *btmp = NULL, *etmp = NULL, *bio = NULL; unsigned char *tmp = NULL; X509_ALGOR *xa; ASN1_OCTET_STRING *data_body = NULL; const EVP_MD *evp_md; const EVP_CIPHER *evp_cipher = NULL; EVP_CIPHER_CTX *evp_ctx = NULL; X509_ALGOR *enc_alg = NULL; STACK_OF(X509_ALGOR) *md_sk = NULL; STACK_OF(PKCS7_RECIP_INFO) *rsk = NULL; PKCS7_RECIP_INFO *ri = NULL; if (p7 == NULL) { PKCS7err(PKCS7_F_PKCS7_DATADECODE, PKCS7_R_INVALID_NULL_POINTER); return NULL; } if (p7->d.ptr == NULL) { PKCS7err(PKCS7_F_PKCS7_DATADECODE, PKCS7_R_NO_CONTENT); return NULL; } i = OBJ_obj2nid(p7->type); p7->state = PKCS7_S_HEADER; switch (i) { case NID_pkcs7_signed: /* * p7->d.sign->contents is a PKCS7 structure consisting of a contentType * field and optional content. * data_body is NULL if that structure has no (=detached) content * or if the contentType is wrong (i.e., not "data"). */ data_body = PKCS7_get_octet_string(p7->d.sign->contents); md_sk = p7->d.sign->md_algs; break; case NID_pkcs7_signedAndEnveloped: rsk = p7->d.signed_and_enveloped->recipientinfo; md_sk = p7->d.signed_and_enveloped->md_algs; /* data_body is NULL if the optional EncryptedContent is missing. */ data_body = p7->d.signed_and_enveloped->enc_data->enc_data; enc_alg = p7->d.signed_and_enveloped->enc_data->algorithm; evp_cipher = EVP_get_cipherbyobj(enc_alg->algorithm); if (evp_cipher == NULL) { PKCS7err(PKCS7_F_PKCS7_DATADECODE, PKCS7_R_UNSUPPORTED_CIPHER_TYPE); goto err; } break; case NID_pkcs7_enveloped: rsk = p7->d.enveloped->recipientinfo; enc_alg = p7->d.enveloped->enc_data->algorithm; /* data_body is NULL if the optional EncryptedContent is missing. */ data_body = p7->d.enveloped->enc_data->enc_data; evp_cipher = EVP_get_cipherbyobj(enc_alg->algorithm); if (evp_cipher == NULL) { PKCS7err(PKCS7_F_PKCS7_DATADECODE, PKCS7_R_UNSUPPORTED_CIPHER_TYPE); goto err; } break; default: PKCS7err(PKCS7_F_PKCS7_DATADECODE, PKCS7_R_UNSUPPORTED_CONTENT_TYPE); goto err; } /* Detached content must be supplied via in_bio instead. */ if (data_body == NULL && in_bio == NULL) { PKCS7err(PKCS7_F_PKCS7_DATADECODE, PKCS7_R_NO_CONTENT); goto err; } /* We will be checking the signature */ if (md_sk != NULL) { for (i = 0; i < sk_X509_ALGOR_num(md_sk); i++) { xa = sk_X509_ALGOR_value(md_sk, i); if ((btmp = BIO_new(BIO_f_md())) == NULL) { PKCS7err(PKCS7_F_PKCS7_DATADECODE, ERR_R_BIO_LIB); goto err; } j = OBJ_obj2nid(xa->algorithm); evp_md = EVP_get_digestbynid(j); if (evp_md == NULL) { PKCS7err(PKCS7_F_PKCS7_DATADECODE, PKCS7_R_UNKNOWN_DIGEST_TYPE); goto err; } BIO_set_md(btmp, evp_md); if (out == NULL) out = btmp; else BIO_push(out, btmp); btmp = NULL; } } if (evp_cipher != NULL) { #if 0 unsigned char key[EVP_MAX_KEY_LENGTH]; unsigned char iv[EVP_MAX_IV_LENGTH]; unsigned char *p; int keylen, ivlen; int max; X509_OBJECT ret; #endif unsigned char *tkey = NULL; int tkeylen; int jj; if ((etmp = BIO_new(BIO_f_cipher())) == NULL) { PKCS7err(PKCS7_F_PKCS7_DATADECODE, ERR_R_BIO_LIB); goto err; } /* * It was encrypted, we need to decrypt the secret key with the * private key */ /* * Find the recipientInfo which matches the passed certificate (if * any) */ if (pcert) { for (i = 0; i < sk_PKCS7_RECIP_INFO_num(rsk); i++) { ri = sk_PKCS7_RECIP_INFO_value(rsk, i); if (!pkcs7_cmp_ri(ri, pcert)) break; ri = NULL; } if (ri == NULL) { PKCS7err(PKCS7_F_PKCS7_DATADECODE, PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE); goto err; } } jj = EVP_PKEY_size(pkey); tmp = (unsigned char *)OPENSSL_malloc(jj + 10); if (tmp == NULL) { PKCS7err(PKCS7_F_PKCS7_DATADECODE, ERR_R_MALLOC_FAILURE); goto err; } /* If we haven't got a certificate try each ri in turn */ if (pcert == NULL) { /* * Temporary storage in case EVP_PKEY_decrypt overwrites output * buffer on error. */ unsigned char *tmp2; tmp2 = OPENSSL_malloc(jj); if (!tmp2) goto err; jj = -1; /* * Always attempt to decrypt all cases to avoid leaking timing * information about a successful decrypt. */ for (i = 0; i < sk_PKCS7_RECIP_INFO_num(rsk); i++) { int tret; ri = sk_PKCS7_RECIP_INFO_value(rsk, i); tret = EVP_PKEY_decrypt(tmp2, M_ASN1_STRING_data(ri->enc_key), M_ASN1_STRING_length(ri->enc_key), pkey); if (tret > 0) { memcpy(tmp, tmp2, tret); OPENSSL_cleanse(tmp2, tret); jj = tret; } ERR_clear_error(); } OPENSSL_free(tmp2); } else { jj = EVP_PKEY_decrypt(tmp, M_ASN1_STRING_data(ri->enc_key), M_ASN1_STRING_length(ri->enc_key), pkey); ERR_clear_error(); } evp_ctx = NULL; BIO_get_cipher_ctx(etmp, &evp_ctx); if (EVP_CipherInit_ex(evp_ctx, evp_cipher, NULL, NULL, NULL, 0) <= 0) goto err; if (EVP_CIPHER_asn1_to_param(evp_ctx, enc_alg->parameter) < 0) goto err; /* Generate random key to counter MMA */ tkeylen = EVP_CIPHER_CTX_key_length(evp_ctx); tkey = OPENSSL_malloc(tkeylen); if (!tkey) goto err; if (EVP_CIPHER_CTX_rand_key(evp_ctx, tkey) <= 0) goto err; /* If we have no key use random key */ if (jj <= 0) { OPENSSL_free(tmp); jj = tkeylen; tmp = tkey; tkey = NULL; } if (jj != tkeylen) { /* * Some S/MIME clients don't use the same key and effective key * length. The key length is determined by the size of the * decrypted RSA key. */ if (!EVP_CIPHER_CTX_set_key_length(evp_ctx, jj)) { /* As MMA defence use random key instead */ OPENSSL_cleanse(tmp, jj); OPENSSL_free(tmp); jj = tkeylen; tmp = tkey; tkey = NULL; } } ERR_clear_error(); if (EVP_CipherInit_ex(evp_ctx, NULL, NULL, tmp, NULL, 0) <= 0) goto err; OPENSSL_cleanse(tmp, jj); if (tkey) { OPENSSL_cleanse(tkey, tkeylen); OPENSSL_free(tkey); } if (out == NULL) out = etmp; else BIO_push(out, etmp); etmp = NULL; } #if 1 if (in_bio != NULL) { bio = in_bio; } else { # if 0 bio = BIO_new(BIO_s_mem()); /* * We need to set this so that when we have read all the data, the * encrypt BIO, if present, will read EOF and encode the last few * bytes */ BIO_set_mem_eof_return(bio, 0); if (data_body->length > 0) BIO_write(bio, (char *)data_body->data, data_body->length); # else if (data_body->length > 0) bio = BIO_new_mem_buf(data_body->data, data_body->length); else { bio = BIO_new(BIO_s_mem()); BIO_set_mem_eof_return(bio, 0); } if (bio == NULL) goto err; # endif } BIO_push(out, bio); bio = NULL; #endif if (0) { err: if (out != NULL) BIO_free_all(out); if (btmp != NULL) BIO_free_all(btmp); if (etmp != NULL) BIO_free_all(etmp); if (bio != NULL) BIO_free_all(bio); out = NULL; } if (tmp != NULL) OPENSSL_free(tmp); return (out); }
0
430,422
static int __ovs_nla_copy_actions(struct net *net, const struct nlattr *attr, const struct sw_flow_key *key, struct sw_flow_actions **sfa, __be16 eth_type, __be16 vlan_tci, u32 mpls_label_count, bool log) { u8 mac_proto = ovs_key_mac_proto(key); const struct nlattr *a; int rem, err; nla_for_each_nested(a, attr, rem) { /* Expected argument lengths, (u32)-1 for variable length. */ static const u32 action_lens[OVS_ACTION_ATTR_MAX + 1] = { [OVS_ACTION_ATTR_OUTPUT] = sizeof(u32), [OVS_ACTION_ATTR_RECIRC] = sizeof(u32), [OVS_ACTION_ATTR_USERSPACE] = (u32)-1, [OVS_ACTION_ATTR_PUSH_MPLS] = sizeof(struct ovs_action_push_mpls), [OVS_ACTION_ATTR_POP_MPLS] = sizeof(__be16), [OVS_ACTION_ATTR_PUSH_VLAN] = sizeof(struct ovs_action_push_vlan), [OVS_ACTION_ATTR_POP_VLAN] = 0, [OVS_ACTION_ATTR_SET] = (u32)-1, [OVS_ACTION_ATTR_SET_MASKED] = (u32)-1, [OVS_ACTION_ATTR_SAMPLE] = (u32)-1, [OVS_ACTION_ATTR_HASH] = sizeof(struct ovs_action_hash), [OVS_ACTION_ATTR_CT] = (u32)-1, [OVS_ACTION_ATTR_CT_CLEAR] = 0, [OVS_ACTION_ATTR_TRUNC] = sizeof(struct ovs_action_trunc), [OVS_ACTION_ATTR_PUSH_ETH] = sizeof(struct ovs_action_push_eth), [OVS_ACTION_ATTR_POP_ETH] = 0, [OVS_ACTION_ATTR_PUSH_NSH] = (u32)-1, [OVS_ACTION_ATTR_POP_NSH] = 0, [OVS_ACTION_ATTR_METER] = sizeof(u32), [OVS_ACTION_ATTR_CLONE] = (u32)-1, [OVS_ACTION_ATTR_CHECK_PKT_LEN] = (u32)-1, [OVS_ACTION_ATTR_ADD_MPLS] = sizeof(struct ovs_action_add_mpls), [OVS_ACTION_ATTR_DEC_TTL] = (u32)-1, }; const struct ovs_action_push_vlan *vlan; int type = nla_type(a); bool skip_copy; if (type > OVS_ACTION_ATTR_MAX || (action_lens[type] != nla_len(a) && action_lens[type] != (u32)-1)) return -EINVAL; skip_copy = false; switch (type) { case OVS_ACTION_ATTR_UNSPEC: return -EINVAL; case OVS_ACTION_ATTR_USERSPACE: err = validate_userspace(a); if (err) return err; break; case OVS_ACTION_ATTR_OUTPUT: if (nla_get_u32(a) >= DP_MAX_PORTS) return -EINVAL; break; case OVS_ACTION_ATTR_TRUNC: { const struct ovs_action_trunc *trunc = nla_data(a); if (trunc->max_len < ETH_HLEN) return -EINVAL; break; } case OVS_ACTION_ATTR_HASH: { const struct ovs_action_hash *act_hash = nla_data(a); switch (act_hash->hash_alg) { case OVS_HASH_ALG_L4: break; default: return -EINVAL; } break; } case OVS_ACTION_ATTR_POP_VLAN: if (mac_proto != MAC_PROTO_ETHERNET) return -EINVAL; vlan_tci = htons(0); break; case OVS_ACTION_ATTR_PUSH_VLAN: if (mac_proto != MAC_PROTO_ETHERNET) return -EINVAL; vlan = nla_data(a); if (!eth_type_vlan(vlan->vlan_tpid)) return -EINVAL; if (!(vlan->vlan_tci & htons(VLAN_CFI_MASK))) return -EINVAL; vlan_tci = vlan->vlan_tci; break; case OVS_ACTION_ATTR_RECIRC: break; case OVS_ACTION_ATTR_ADD_MPLS: { const struct ovs_action_add_mpls *mpls = nla_data(a); if (!eth_p_mpls(mpls->mpls_ethertype)) return -EINVAL; if (mpls->tun_flags & OVS_MPLS_L3_TUNNEL_FLAG_MASK) { if (vlan_tci & htons(VLAN_CFI_MASK) || (eth_type != htons(ETH_P_IP) && eth_type != htons(ETH_P_IPV6) && eth_type != htons(ETH_P_ARP) && eth_type != htons(ETH_P_RARP) && !eth_p_mpls(eth_type))) return -EINVAL; mpls_label_count++; } else { if (mac_proto == MAC_PROTO_ETHERNET) { mpls_label_count = 1; mac_proto = MAC_PROTO_NONE; } else { mpls_label_count++; } } eth_type = mpls->mpls_ethertype; break; } case OVS_ACTION_ATTR_PUSH_MPLS: { const struct ovs_action_push_mpls *mpls = nla_data(a); if (!eth_p_mpls(mpls->mpls_ethertype)) return -EINVAL; /* Prohibit push MPLS other than to a white list * for packets that have a known tag order. */ if (vlan_tci & htons(VLAN_CFI_MASK) || (eth_type != htons(ETH_P_IP) && eth_type != htons(ETH_P_IPV6) && eth_type != htons(ETH_P_ARP) && eth_type != htons(ETH_P_RARP) && !eth_p_mpls(eth_type))) return -EINVAL; eth_type = mpls->mpls_ethertype; mpls_label_count++; break; } case OVS_ACTION_ATTR_POP_MPLS: { __be16 proto; if (vlan_tci & htons(VLAN_CFI_MASK) || !eth_p_mpls(eth_type)) return -EINVAL; /* Disallow subsequent L2.5+ set actions and mpls_pop * actions once the last MPLS label in the packet is * is popped as there is no check here to ensure that * the new eth type is valid and thus set actions could * write off the end of the packet or otherwise corrupt * it. * * Support for these actions is planned using packet * recirculation. */ proto = nla_get_be16(a); if (proto == htons(ETH_P_TEB) && mac_proto != MAC_PROTO_NONE) return -EINVAL; mpls_label_count--; if (!eth_p_mpls(proto) || !mpls_label_count) eth_type = htons(0); else eth_type = proto; break; } case OVS_ACTION_ATTR_SET: err = validate_set(a, key, sfa, &skip_copy, mac_proto, eth_type, false, log); if (err) return err; break; case OVS_ACTION_ATTR_SET_MASKED: err = validate_set(a, key, sfa, &skip_copy, mac_proto, eth_type, true, log); if (err) return err; break; case OVS_ACTION_ATTR_SAMPLE: { bool last = nla_is_last(a, rem); err = validate_and_copy_sample(net, a, key, sfa, eth_type, vlan_tci, mpls_label_count, log, last); if (err) return err; skip_copy = true; break; } case OVS_ACTION_ATTR_CT: err = ovs_ct_copy_action(net, a, key, sfa, log); if (err) return err; skip_copy = true; break; case OVS_ACTION_ATTR_CT_CLEAR: break; case OVS_ACTION_ATTR_PUSH_ETH: /* Disallow pushing an Ethernet header if one * is already present */ if (mac_proto != MAC_PROTO_NONE) return -EINVAL; mac_proto = MAC_PROTO_ETHERNET; break; case OVS_ACTION_ATTR_POP_ETH: if (mac_proto != MAC_PROTO_ETHERNET) return -EINVAL; if (vlan_tci & htons(VLAN_CFI_MASK)) return -EINVAL; mac_proto = MAC_PROTO_NONE; break; case OVS_ACTION_ATTR_PUSH_NSH: if (mac_proto != MAC_PROTO_ETHERNET) { u8 next_proto; next_proto = tun_p_from_eth_p(eth_type); if (!next_proto) return -EINVAL; } mac_proto = MAC_PROTO_NONE; if (!validate_nsh(nla_data(a), false, true, true)) return -EINVAL; break; case OVS_ACTION_ATTR_POP_NSH: { __be16 inner_proto; if (eth_type != htons(ETH_P_NSH)) return -EINVAL; inner_proto = tun_p_to_eth_p(key->nsh.base.np); if (!inner_proto) return -EINVAL; if (key->nsh.base.np == TUN_P_ETHERNET) mac_proto = MAC_PROTO_ETHERNET; else mac_proto = MAC_PROTO_NONE; break; } case OVS_ACTION_ATTR_METER: /* Non-existent meters are simply ignored. */ break; case OVS_ACTION_ATTR_CLONE: { bool last = nla_is_last(a, rem); err = validate_and_copy_clone(net, a, key, sfa, eth_type, vlan_tci, mpls_label_count, log, last); if (err) return err; skip_copy = true; break; } case OVS_ACTION_ATTR_CHECK_PKT_LEN: { bool last = nla_is_last(a, rem); err = validate_and_copy_check_pkt_len(net, a, key, sfa, eth_type, vlan_tci, mpls_label_count, log, last); if (err) return err; skip_copy = true; break; } case OVS_ACTION_ATTR_DEC_TTL: err = validate_and_copy_dec_ttl(net, a, key, sfa, eth_type, vlan_tci, mpls_label_count, log); if (err) return err; skip_copy = true; break; default: OVS_NLERR(log, "Unknown Action type %d", type); return -EINVAL; } if (!skip_copy) { err = copy_action(a, sfa, log); if (err) return err; } } if (rem > 0) return -EINVAL; return 0; }
0
253,532
static int smb3_fiemap(struct cifs_tcon *tcon, struct cifsFileInfo *cfile, struct fiemap_extent_info *fei, u64 start, u64 len) { unsigned int xid; struct file_allocated_range_buffer in_data, *out_data; u32 out_data_len; int i, num, rc, flags, last_blob; u64 next; rc = fiemap_prep(d_inode(cfile->dentry), fei, start, &len, 0); if (rc) return rc; xid = get_xid(); again: in_data.file_offset = cpu_to_le64(start); in_data.length = cpu_to_le64(len); rc = SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid, cfile->fid.volatile_fid, FSCTL_QUERY_ALLOCATED_RANGES, true, (char *)&in_data, sizeof(in_data), 1024 * sizeof(struct file_allocated_range_buffer), (char **)&out_data, &out_data_len); if (rc == -E2BIG) { last_blob = 0; rc = 0; } else last_blob = 1; if (rc) goto out; if (out_data_len && out_data_len < sizeof(struct file_allocated_range_buffer)) { rc = -EINVAL; goto out; } if (out_data_len % sizeof(struct file_allocated_range_buffer)) { rc = -EINVAL; goto out; } num = out_data_len / sizeof(struct file_allocated_range_buffer); for (i = 0; i < num; i++) { flags = 0; if (i == num - 1 && last_blob) flags |= FIEMAP_EXTENT_LAST; rc = fiemap_fill_next_extent(fei, le64_to_cpu(out_data[i].file_offset), le64_to_cpu(out_data[i].file_offset), le64_to_cpu(out_data[i].length), flags); if (rc < 0) goto out; if (rc == 1) { rc = 0; goto out; } } if (!last_blob) { next = le64_to_cpu(out_data[num - 1].file_offset) + le64_to_cpu(out_data[num - 1].length); len = len - (next - start); start = next; goto again; } out: free_xid(xid); kfree(out_data); return rc; }
0
139,233
bool OverlayWindowViews::IsVisible() const { return views::Widget::IsVisible(); }
0
225,114
string DefaultAttrStr(const OpDef::AttrDef& attr) { if (!attr.has_default_value()) return "no default"; return SummarizeAttrValue(attr.default_value()); }
0
436,119
static void __io_complete_rw(struct io_kiocb *req, long res, long res2, unsigned int issue_flags) { int cflags = 0; if (req->rw.kiocb.ki_flags & IOCB_WRITE) kiocb_end_write(req); if (res != req->result) { if ((res == -EAGAIN || res == -EOPNOTSUPP) && io_rw_should_reissue(req)) { req->flags |= REQ_F_REISSUE; return; } req_set_fail(req); } if (req->flags & REQ_F_BUFFER_SELECTED) cflags = io_put_rw_kbuf(req); __io_req_complete(req, issue_flags, res, cflags); }
0
248,755
static void remove_expired(struct CookieInfo *cookies) { struct Cookie *co, *nx; curl_off_t now = (curl_off_t)time(NULL); unsigned int i; /* * If the earliest expiration timestamp in the jar is in the future we can * skip scanning the whole jar and instead exit early as there won't be any * cookies to evict. If we need to evict however, reset the next_expiration * counter in order to track the next one. In case the recorded first * expiration is the max offset, then perform the safe fallback of checking * all cookies. */ if(now < cookies->next_expiration && cookies->next_expiration != CURL_OFF_T_MAX) return; else cookies->next_expiration = CURL_OFF_T_MAX; for(i = 0; i < COOKIE_HASH_SIZE; i++) { struct Cookie *pv = NULL; co = cookies->cookies[i]; while(co) { nx = co->next; if(co->expires && co->expires < now) { if(!pv) { cookies->cookies[i] = co->next; } else { pv->next = co->next; } cookies->numcookies--; freecookie(co); } else { /* * If this cookie has an expiration timestamp earlier than what we've * seen so far then record it for the next round of expirations. */ if(co->expires && co->expires < cookies->next_expiration) cookies->next_expiration = co->expires; pv = co; } co = nx; } } }
0
343,179
static void *esp_alloc_tmp(struct crypto_aead *aead, int nfrags, int seqihlen) { unsigned int len; len = seqihlen; len += crypto_aead_ivsize(aead); if (len) { len += crypto_aead_alignmask(aead) & ~(crypto_tfm_ctx_alignment() - 1); len = ALIGN(len, crypto_tfm_ctx_alignment()); } len += sizeof(struct aead_request) + crypto_aead_reqsize(aead); len = ALIGN(len, __alignof__(struct scatterlist)); len += sizeof(struct scatterlist) * nfrags; return kmalloc(len, GFP_ATOMIC); }
0
274,720
callbacks_display_object_properties_clicked (GtkButton *button, gpointer user_data) { gint index = callbacks_get_selected_row_index (); guint i; if (index < 0 || selection_length (&screen.selectionInfo) == 0) { interface_show_alert_dialog(_("No object is currently selected"), _("Objects must be selected using the pointer tool " "before you can view the object properties."), FALSE, NULL); return; } for (i = 0; i < selection_length (&screen.selectionInfo); i++){ gerbv_selection_item_t sItem = selection_get_item_by_index (&screen.selectionInfo, i); gerbv_net_t *net = sItem.net; gerbv_image_t *image = sItem.image; if (net->interpolation == GERBV_INTERPOLATION_PAREA_START) { /* Spacing for a pretty display */ if (i != 0) g_message (" "); g_message (_("Object type: Polygon")); parea_report (net, image, mainProject); net_layer_file_report (net, image, mainProject); } else { switch (net->aperture_state) { case GERBV_APERTURE_STATE_ON: case GERBV_APERTURE_STATE_FLASH: /* Spacing for a pretty display */ if (i != 0) g_message (" "); break; default: break; } aperture_state_report (net, image, mainProject); } } /* Use separator for different report requests */ g_message ("---------------------------------------"); }
0
336,141
static void ip6gre_dellink(struct net_device *dev, struct list_head *head) { struct net *net = dev_net(dev); struct ip6gre_net *ign = net_generic(net, ip6gre_net_id); if (dev != ign->fb_tunnel_dev) unregister_netdevice_queue(dev, head); }
0
247,540
void configureServerAndExpiredClientCertificate( envoy::config::listener::v3::Listener& listener, envoy::extensions::transport_sockets::tls::v3::UpstreamTlsContext& client, const OptionalServerConfig& server_config) { envoy::config::listener::v3::FilterChain* filter_chain = listener.add_filter_chains(); envoy::extensions::transport_sockets::tls::v3::DownstreamTlsContext tls_context; envoy::extensions::transport_sockets::tls::v3::TlsCertificate* server_cert = tls_context.mutable_common_tls_context()->add_tls_certificates(); server_cert->mutable_certificate_chain()->set_filename(TestEnvironment::substitute( "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/unittest_cert.pem")); server_cert->mutable_private_key()->set_filename(TestEnvironment::substitute( "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/unittest_key.pem")); envoy::extensions::transport_sockets::tls::v3::CertificateValidationContext* server_validation_ctx = tls_context.mutable_common_tls_context()->mutable_validation_context(); if (server_config.trusted_ca.has_value()) { server_validation_ctx->mutable_trusted_ca()->set_filename( TestEnvironment::substitute(server_config.trusted_ca.value())); } else { server_validation_ctx->mutable_trusted_ca()->set_filename(TestEnvironment::substitute( "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/ca_cert.pem")); } if (server_config.allow_expired_cert.has_value()) { server_validation_ctx->set_allow_expired_certificate(server_config.allow_expired_cert.value()); } if (server_config.cert_hash.has_value()) { server_validation_ctx->add_verify_certificate_hash(server_config.cert_hash.value()); } updateFilterChain(tls_context, *filter_chain); envoy::extensions::transport_sockets::tls::v3::TlsCertificate* client_cert = client.mutable_common_tls_context()->add_tls_certificates(); client_cert->mutable_certificate_chain()->set_filename(TestEnvironment::substitute( "{{ test_rundir " "}}/test/extensions/transport_sockets/tls/test_data/expired_san_uri_cert.pem")); client_cert->mutable_private_key()->set_filename(TestEnvironment::substitute( "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/expired_san_uri_key.pem")); }
0
269,317
static av_always_inline void snow_interleave_line_footer(int * i, IDWTELEM * low, IDWTELEM * high){ for (; (*i)>=0; (*i)-=2){ low[(*i)+1] = high[(*i)>>1]; low[*i] = low[(*i)>>1]; } }
0
230,624
void derive_combined_bipredictive_merging_candidates(const base_context* ctx, const slice_segment_header* shdr, PBMotion* inout_mergeCandList, int* inout_numMergeCand, int maxCandidates) { if (*inout_numMergeCand>1 && *inout_numMergeCand < maxCandidates) { int numOrigMergeCand = *inout_numMergeCand; int numInputMergeCand = *inout_numMergeCand; int combIdx = 0; uint8_t combStop = false; while (!combStop) { int l0CandIdx = table_8_19[0][combIdx]; int l1CandIdx = table_8_19[1][combIdx]; if (l0CandIdx >= numInputMergeCand || l1CandIdx >= numInputMergeCand) { assert(false); // bitstream error -> TODO: conceal error } PBMotion& l0Cand = inout_mergeCandList[l0CandIdx]; PBMotion& l1Cand = inout_mergeCandList[l1CandIdx]; logtrace(LogMotion,"add bipredictive merging candidate (combIdx:%d)\n",combIdx); logtrace(LogMotion,"l0Cand:\n"); logmvcand(l0Cand); logtrace(LogMotion,"l1Cand:\n"); logmvcand(l1Cand); const de265_image* img0 = l0Cand.predFlag[0] ? ctx->get_image(shdr->RefPicList[0][l0Cand.refIdx[0]]) : NULL; const de265_image* img1 = l1Cand.predFlag[1] ? ctx->get_image(shdr->RefPicList[1][l1Cand.refIdx[1]]) : NULL; if (l0Cand.predFlag[0] && !img0) { return; // TODO error } if (l1Cand.predFlag[1] && !img1) { return; // TODO error } if (l0Cand.predFlag[0] && l1Cand.predFlag[1] && (img0->PicOrderCntVal != img1->PicOrderCntVal || l0Cand.mv[0].x != l1Cand.mv[1].x || l0Cand.mv[0].y != l1Cand.mv[1].y)) { PBMotion& p = inout_mergeCandList[ *inout_numMergeCand ]; p.refIdx[0] = l0Cand.refIdx[0]; p.refIdx[1] = l1Cand.refIdx[1]; p.predFlag[0] = l0Cand.predFlag[0]; p.predFlag[1] = l1Cand.predFlag[1]; p.mv[0] = l0Cand.mv[0]; p.mv[1] = l1Cand.mv[1]; (*inout_numMergeCand)++; logtrace(LogMotion,"result:\n"); logmvcand(p); } combIdx++; if (combIdx == numOrigMergeCand*(numOrigMergeCand-1) || *inout_numMergeCand == maxCandidates) { combStop = true; } } } }
0
247,144
u32 gf_fs_get_filters_count(GF_FilterSession *session) { return session ? gf_list_count(session->filters) : 0; }
0
512,692
longlong Item_func_between::val_int_cmp_time() { THD *thd= current_thd; longlong value= args[0]->val_time_packed(thd), a, b; if ((null_value= args[0]->null_value)) return 0; a= args[1]->val_time_packed(thd); b= args[2]->val_time_packed(thd); return val_int_cmp_int_finalize(value, a, b); }
0
228,442
static String HHVM_FUNCTION(wddx_packet_end, const Resource& packet_id) { return cast<WddxPacket>(packet_id)->packet_end(); }
0
359,247
DEFUN (ip_community_list_name_expanded, ip_community_list_name_expanded_cmd, "ip community-list expanded WORD (deny|permit) .LINE", IP_STR COMMUNITY_LIST_STR "Add an expanded community-list entry\n" "Community list name\n" "Specify community to reject\n" "Specify community to accept\n" "An ordered list as a regular-expression\n") { return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); }
0
234,728
bool btrfs_pinned_by_swapfile(struct btrfs_fs_info *fs_info, void *ptr) { struct btrfs_swapfile_pin *sp; struct rb_node *node; spin_lock(&fs_info->swapfile_pins_lock); node = fs_info->swapfile_pins.rb_node; while (node) { sp = rb_entry(node, struct btrfs_swapfile_pin, node); if (ptr < sp->ptr) node = node->rb_left; else if (ptr > sp->ptr) node = node->rb_right; else break; } spin_unlock(&fs_info->swapfile_pins_lock); return node != NULL; }
0
376,682
void ZRLE_DECODE (const Rect& r, rdr::InStream* is, rdr::ZlibInStream* zis, const PixelFormat& pf, ModifiablePixelBuffer* pb) { int length = is->readU32(); zis->setUnderlying(is, length); Rect t; PIXEL_T buf[64 * 64]; for (t.tl.y = r.tl.y; t.tl.y < r.br.y; t.tl.y += 64) { t.br.y = __rfbmin(r.br.y, t.tl.y + 64); for (t.tl.x = r.tl.x; t.tl.x < r.br.x; t.tl.x += 64) { t.br.x = __rfbmin(r.br.x, t.tl.x + 64); int mode = zis->readU8(); bool rle = mode & 128; int palSize = mode & 127; PIXEL_T palette[128]; for (int i = 0; i < palSize; i++) { palette[i] = READ_PIXEL(zis); } if (palSize == 1) { PIXEL_T pix = palette[0]; pb->fillRect(pf, t, &pix); continue; } if (!rle) { if (palSize == 0) { // raw #ifdef CPIXEL for (PIXEL_T* ptr = buf; ptr < buf+t.area(); ptr++) { *ptr = READ_PIXEL(zis); } #else zis->readBytes(buf, t.area() * (BPP / 8)); #endif } else { // packed pixels int bppp = ((palSize > 16) ? 8 : ((palSize > 4) ? 4 : ((palSize > 2) ? 2 : 1))); PIXEL_T* ptr = buf; for (int i = 0; i < t.height(); i++) { PIXEL_T* eol = ptr + t.width(); rdr::U8 byte = 0; rdr::U8 nbits = 0; while (ptr < eol) { if (nbits == 0) { byte = zis->readU8(); nbits = 8; } nbits -= bppp; rdr::U8 index = (byte >> nbits) & ((1 << bppp) - 1) & 127; *ptr++ = palette[index]; } } } } else { if (palSize == 0) { // plain RLE PIXEL_T* ptr = buf; PIXEL_T* end = ptr + t.area(); while (ptr < end) { PIXEL_T pix = READ_PIXEL(zis); int len = 1; int b; do { b = zis->readU8(); len += b; } while (b == 255); if (end - ptr < len) { throw Exception ("ZRLE decode error"); } while (len-- > 0) *ptr++ = pix; } } else { // palette RLE PIXEL_T* ptr = buf; PIXEL_T* end = ptr + t.area(); while (ptr < end) { int index = zis->readU8(); int len = 1; if (index & 128) { int b; do { b = zis->readU8(); len += b; } while (b == 255); if (end - ptr < len) { throw Exception ("ZRLE decode error"); } } index &= 127; PIXEL_T pix = palette[index]; while (len-- > 0) *ptr++ = pix; } } } pb->imageRect(pf, t, buf); } } zis->flushUnderlying(); zis->setUnderlying(NULL, 0); }
0
336,144
static inline bool ip6gre_tnl_addr_conflict(const struct ip6_tnl *t, const struct ipv6hdr *hdr) { return ipv6_addr_equal(&t->parms.raddr, &hdr->saddr); }
0
463,136
EXPORTED void freestrlist(struct strlist *l) { struct strlist *n; while (l) { n = l->next; free(l->s); if (l->p) charset_freepat(l->p); free((char *)l); l = n; } }
0
223,417
static PCRE2_SPTR compile_simple_assertion_matchingpath(compiler_common *common, PCRE2_UCHAR type, PCRE2_SPTR cc, jump_list **backtracks) { DEFINE_COMPILER; int length; struct sljit_jump *jump[4]; #ifdef SUPPORT_UNICODE struct sljit_label *label; #endif /* SUPPORT_UNICODE */ switch(type) { case OP_SOD: if (HAS_VIRTUAL_REGISTERS) { OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin)); } else OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, begin)); add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, STR_PTR, 0, TMP1, 0)); return cc; case OP_SOM: if (HAS_VIRTUAL_REGISTERS) { OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, str)); } else OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, str)); add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, STR_PTR, 0, TMP1, 0)); return cc; case OP_NOT_WORD_BOUNDARY: case OP_WORD_BOUNDARY: add_jump(compiler, &common->wordboundary, JUMP(SLJIT_FAST_CALL)); #ifdef SUPPORT_UNICODE if (common->invalid_utf) { add_jump(compiler, backtracks, CMP((type == OP_NOT_WORD_BOUNDARY) ? SLJIT_NOT_EQUAL : SLJIT_SIG_LESS_EQUAL, TMP2, 0, SLJIT_IMM, 0)); return cc; } #endif /* SUPPORT_UNICODE */ sljit_set_current_flags(compiler, SLJIT_SET_Z); add_jump(compiler, backtracks, JUMP(type == OP_NOT_WORD_BOUNDARY ? SLJIT_NOT_ZERO : SLJIT_ZERO)); return cc; case OP_EODN: /* Requires rather complex checks. */ jump[0] = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0); if (common->nltype == NLTYPE_FIXED && common->newline > 255) { OP2(SLJIT_ADD, TMP2, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(2)); OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0)); if (common->mode == PCRE2_JIT_COMPLETE) add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP2, 0, STR_END, 0)); else { jump[1] = CMP(SLJIT_EQUAL, TMP2, 0, STR_END, 0); OP2U(SLJIT_SUB | SLJIT_SET_LESS, TMP2, 0, STR_END, 0); OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_LESS); OP2U(SLJIT_SUB | SLJIT_SET_Z, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff); OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_NOT_EQUAL); add_jump(compiler, backtracks, JUMP(SLJIT_NOT_EQUAL)); check_partial(common, TRUE); add_jump(compiler, backtracks, JUMP(SLJIT_JUMP)); JUMPHERE(jump[1]); } OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1)); add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff)); add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff)); } else if (common->nltype == NLTYPE_FIXED) { OP2(SLJIT_ADD, TMP2, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0)); add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP2, 0, STR_END, 0)); add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, common->newline)); } else { OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0)); jump[1] = CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_CR); OP2(SLJIT_ADD, TMP2, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(2)); OP2U(SLJIT_SUB | SLJIT_SET_Z | SLJIT_SET_GREATER, TMP2, 0, STR_END, 0); jump[2] = JUMP(SLJIT_GREATER); add_jump(compiler, backtracks, JUMP(SLJIT_NOT_EQUAL) /* LESS */); /* Equal. */ OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1)); jump[3] = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_NL); add_jump(compiler, backtracks, JUMP(SLJIT_JUMP)); JUMPHERE(jump[1]); if (common->nltype == NLTYPE_ANYCRLF) { OP2(SLJIT_ADD, TMP2, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); add_jump(compiler, backtracks, CMP(SLJIT_LESS, TMP2, 0, STR_END, 0)); add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_NL)); } else { OP1(SLJIT_MOV, TMP3, 0, STR_PTR, 0); read_char(common, common->nlmin, common->nlmax, backtracks, READ_CHAR_UPDATE_STR_PTR); add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, STR_PTR, 0, STR_END, 0)); add_jump(compiler, &common->anynewline, JUMP(SLJIT_FAST_CALL)); sljit_set_current_flags(compiler, SLJIT_SET_Z); add_jump(compiler, backtracks, JUMP(SLJIT_ZERO)); OP1(SLJIT_MOV, STR_PTR, 0, TMP3, 0); } JUMPHERE(jump[2]); JUMPHERE(jump[3]); } JUMPHERE(jump[0]); if (common->mode != PCRE2_JIT_COMPLETE) check_partial(common, TRUE); return cc; case OP_EOD: add_jump(compiler, backtracks, CMP(SLJIT_LESS, STR_PTR, 0, STR_END, 0)); if (common->mode != PCRE2_JIT_COMPLETE) check_partial(common, TRUE); return cc; case OP_DOLL: if (HAS_VIRTUAL_REGISTERS) { OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0); OP2U(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTEOL); } else OP2U(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTEOL); add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO)); if (!common->endonly) compile_simple_assertion_matchingpath(common, OP_EODN, cc, backtracks); else { add_jump(compiler, backtracks, CMP(SLJIT_LESS, STR_PTR, 0, STR_END, 0)); check_partial(common, FALSE); } return cc; case OP_DOLLM: jump[1] = CMP(SLJIT_LESS, STR_PTR, 0, STR_END, 0); if (HAS_VIRTUAL_REGISTERS) { OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0); OP2U(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTEOL); } else OP2U(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTEOL); add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO)); check_partial(common, FALSE); jump[0] = JUMP(SLJIT_JUMP); JUMPHERE(jump[1]); if (common->nltype == NLTYPE_FIXED && common->newline > 255) { OP2(SLJIT_ADD, TMP2, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(2)); OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0)); if (common->mode == PCRE2_JIT_COMPLETE) add_jump(compiler, backtracks, CMP(SLJIT_GREATER, TMP2, 0, STR_END, 0)); else { jump[1] = CMP(SLJIT_LESS_EQUAL, TMP2, 0, STR_END, 0); /* STR_PTR = STR_END - IN_UCHARS(1) */ add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff)); check_partial(common, TRUE); add_jump(compiler, backtracks, JUMP(SLJIT_JUMP)); JUMPHERE(jump[1]); } OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1)); add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff)); add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff)); } else { peek_char(common, common->nlmax, TMP3, 0, NULL); check_newlinechar(common, common->nltype, backtracks, FALSE); } JUMPHERE(jump[0]); return cc; case OP_CIRC: if (HAS_VIRTUAL_REGISTERS) { OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0); OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, begin)); add_jump(compiler, backtracks, CMP(SLJIT_GREATER, STR_PTR, 0, TMP1, 0)); OP2U(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTBOL); add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO)); } else { OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, begin)); add_jump(compiler, backtracks, CMP(SLJIT_GREATER, STR_PTR, 0, TMP1, 0)); OP2U(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTBOL); add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO)); } return cc; case OP_CIRCM: /* TMP2 might be used by peek_char_back. */ if (HAS_VIRTUAL_REGISTERS) { OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin)); jump[1] = CMP(SLJIT_GREATER, STR_PTR, 0, TMP2, 0); OP2U(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTBOL); } else { OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, begin)); jump[1] = CMP(SLJIT_GREATER, STR_PTR, 0, TMP2, 0); OP2U(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTBOL); } add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO)); jump[0] = JUMP(SLJIT_JUMP); JUMPHERE(jump[1]); if (!common->alt_circumflex) add_jump(compiler, backtracks, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0)); if (common->nltype == NLTYPE_FIXED && common->newline > 255) { OP2(SLJIT_SUB, TMP1, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(2)); add_jump(compiler, backtracks, CMP(SLJIT_LESS, TMP1, 0, TMP2, 0)); OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-2)); OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-1)); add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff)); add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff)); } else { peek_char_back(common, common->nlmax, backtracks); check_newlinechar(common, common->nltype, backtracks, FALSE); } JUMPHERE(jump[0]); return cc; case OP_REVERSE: length = GET(cc, 0); if (length == 0) return cc + LINK_SIZE; if (HAS_VIRTUAL_REGISTERS) { OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin)); } else OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, begin)); #ifdef SUPPORT_UNICODE if (common->utf) { OP1(SLJIT_MOV, TMP3, 0, SLJIT_IMM, length); label = LABEL(); add_jump(compiler, backtracks, CMP(SLJIT_LESS_EQUAL, STR_PTR, 0, TMP2, 0)); move_back(common, backtracks, FALSE); OP2(SLJIT_SUB | SLJIT_SET_Z, TMP3, 0, TMP3, 0, SLJIT_IMM, 1); JUMPTO(SLJIT_NOT_ZERO, label); } else #endif { OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(length)); add_jump(compiler, backtracks, CMP(SLJIT_LESS, STR_PTR, 0, TMP2, 0)); } check_start_used_ptr(common); return cc + LINK_SIZE; } SLJIT_UNREACHABLE(); return cc; }
0
513,148
static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref rc, uint state_mask= PLUGIN_IS_READY | PLUGIN_IS_UNINITIALIZED | PLUGIN_IS_DELETED) { st_plugin_int *pi= plugin_ref_to_int(rc); DBUG_ENTER("intern_plugin_lock"); mysql_mutex_assert_owner(&LOCK_plugin); if (pi->state & state_mask) { plugin_ref plugin; #ifdef DBUG_OFF /* In optimized builds we don't do reference counting for built-in (plugin->plugin_dl == 0) plugins. */ if (!pi->plugin_dl) DBUG_RETURN(pi); plugin= pi; #else /* For debugging, we do an additional malloc which allows the memory manager and/or valgrind to track locked references and double unlocks to aid resolving reference counting problems. */ if (!(plugin= (plugin_ref) my_malloc(sizeof(pi), MYF(MY_WME)))) DBUG_RETURN(NULL); *plugin= pi; #endif pi->ref_count++; DBUG_PRINT("lock",("thd: %p plugin: \"%s\" LOCK ref_count: %d", current_thd, pi->name.str, pi->ref_count)); if (lex) insert_dynamic(&lex->plugins, (uchar*)&plugin); DBUG_RETURN(plugin); } DBUG_RETURN(NULL); }
0
409,443
invoke_tgetent(char_u *tbuf, char_u *term) { int i; // Note: Valgrind may report a leak here, because the library keeps one // buffer around that we can't ever free. i = TGETENT(tbuf, term); if (i < 0 // -1 is always an error # ifdef TGETENT_ZERO_ERR || i == 0 // sometimes zero is also an error # endif ) { // On FreeBSD tputs() gets a SEGV after a tgetent() which fails. Call // tgetent() with the always existing "dumb" entry to avoid a crash or // hang. (void)TGETENT(tbuf, "dumb"); if (i < 0) # ifdef TGETENT_ZERO_ERR return _(e_cannot_open_termcap_file); if (i == 0) # endif #ifdef TERMINFO return _(e_terminal_entry_not_found_in_terminfo); #else return _(e_terminal_entry_not_found_in_termcap); #endif } return NULL; }
0
253,638
smb2_cached_lease_break(struct work_struct *work) { struct cached_fid *cfid = container_of(work, struct cached_fid, lease_break); close_cached_dir_lease(cfid); }
0
232,331
GF_EdtsEntry *CreateEditEntry(u64 EditDuration, u64 MediaTime, u32 MediaRate, u8 EditMode) { GF_EdtsEntry *ent; ent = (GF_EdtsEntry*)gf_malloc(sizeof(GF_EdtsEntry)); if (!ent) return NULL; switch (EditMode) { case GF_ISOM_EDIT_EMPTY: ent->mediaRate = 0x10000; ent->mediaTime = -1; break; case GF_ISOM_EDIT_DWELL: ent->mediaRate = 0; ent->mediaTime = MediaTime; break; default: ent->mediaRate = MediaRate; ent->mediaTime = MediaTime; break; } ent->segmentDuration = EditDuration; return ent; }
0
210,303
static Image *ReadWMFImage(const ImageInfo *image_info,ExceptionInfo *exception) { double bounding_height, bounding_width, image_height, image_height_inch, image_width, image_width_inch, resolution_y, resolution_x, units_per_inch; float wmf_width, wmf_height; Image *image; MagickBooleanType status; unsigned long wmf_options_flags = 0; wmf_error_t wmf_error; wmf_magick_t *ddata = 0; wmfAPI *API = 0; wmfAPI_Options wmf_api_options; wmfD_Rect bbox; image=AcquireImage(image_info,exception); if (OpenBlob(image_info,image,ReadBinaryBlobMode,exception) == MagickFalse) { if (image->debug != MagickFalse) { (void) LogMagickEvent(CoderEvent,GetMagickModule(), " OpenBlob failed"); (void) LogMagickEvent(CoderEvent,GetMagickModule(), "leave ReadWMFImage()"); } image=DestroyImageList(image); return((Image *) NULL); } /* * Create WMF API * */ /* Register callbacks */ wmf_options_flags |= WMF_OPT_FUNCTION; (void) ResetMagickMemory(&wmf_api_options, 0, sizeof(wmf_api_options)); wmf_api_options.function = ipa_functions; /* Ignore non-fatal errors */ wmf_options_flags |= WMF_OPT_IGNORE_NONFATAL; wmf_error = wmf_api_create(&API, wmf_options_flags, &wmf_api_options); if (wmf_error != wmf_E_None) { if (API) wmf_api_destroy(API); if (image->debug != MagickFalse) { (void) LogMagickEvent(CoderEvent,GetMagickModule(), " wmf_api_create failed"); (void) LogMagickEvent(CoderEvent,GetMagickModule(), "leave ReadWMFImage()"); } ThrowReaderException(DelegateError,"UnableToInitializeWMFLibrary"); } /* Register progress monitor */ wmf_status_function(API,image,magick_progress_callback); ddata=WMF_MAGICK_GetData(API); ddata->image=image; ddata->image_info=image_info; ddata->draw_info=CloneDrawInfo(image_info,(const DrawInfo *) NULL); ddata->exception=exception; ddata->draw_info->font=(char *) RelinquishMagickMemory(ddata->draw_info->font); ddata->draw_info->text=(char *) RelinquishMagickMemory(ddata->draw_info->text); #if defined(MAGICKCORE_WMF_DELEGATE) /* Must initialize font subystem for WMFlite interface */ lite_font_init (API,&wmf_api_options); /* similar to wmf_ipa_font_init in src/font.c */ /* wmf_arg_fontdirs (API,options); */ /* similar to wmf_arg_fontdirs in src/wmf.c */ #endif /* * Open BLOB input via libwmf API * */ wmf_error = wmf_bbuf_input(API,ipa_blob_read,ipa_blob_seek, ipa_blob_tell,(void*)image); if (wmf_error != wmf_E_None) { wmf_api_destroy(API); if (image->debug != MagickFalse) { (void) LogMagickEvent(CoderEvent,GetMagickModule(), " wmf_bbuf_input failed"); (void) LogMagickEvent(CoderEvent,GetMagickModule(), "leave ReadWMFImage()"); } ThrowFileException(exception,FileOpenError,"UnableToOpenFile", image->filename); image=DestroyImageList(image); return((Image *) NULL); } /* * Scan WMF file * */ if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Scanning WMF to obtain bounding box"); wmf_error=wmf_scan(API, 0, &bbox); if (wmf_error != wmf_E_None) { wmf_api_destroy(API); if (image->debug != MagickFalse) { (void) LogMagickEvent(CoderEvent,GetMagickModule(), " wmf_scan failed with wmf_error %d", wmf_error); (void) LogMagickEvent(CoderEvent,GetMagickModule(), "leave ReadWMFImage()"); } ThrowReaderException(DelegateError,"FailedToScanFile"); } /* * Compute dimensions and scale factors * */ ddata->bbox=bbox; /* User specified resolution */ resolution_y=DefaultResolution; if (image->resolution.y != 0.0) { resolution_y = image->resolution.y; if (image->units == PixelsPerCentimeterResolution) resolution_y *= CENTIMETERS_PER_INCH; } resolution_x=DefaultResolution; if (image->resolution.x != 0.0) { resolution_x = image->resolution.x; if (image->units == PixelsPerCentimeterResolution) resolution_x *= CENTIMETERS_PER_INCH; } /* Obtain output size expressed in metafile units */ wmf_error=wmf_size(API,&wmf_width,&wmf_height); if (wmf_error != wmf_E_None) { wmf_api_destroy(API); if (image->debug != MagickFalse) { (void) LogMagickEvent(CoderEvent,GetMagickModule(), " wmf_size failed with wmf_error %d", wmf_error); (void) LogMagickEvent(CoderEvent,GetMagickModule(), "leave ReadWMFImage()"); } ThrowReaderException(DelegateError,"FailedToComputeOutputSize"); } /* Obtain (or guess) metafile units */ if ((API)->File->placeable) units_per_inch=(API)->File->pmh->Inch; else if ( (wmf_width*wmf_height) < 1024*1024) units_per_inch=POINTS_PER_INCH; /* MM_TEXT */ else units_per_inch=TWIPS_PER_INCH; /* MM_TWIPS */ /* Calculate image width and height based on specified DPI resolution */ image_width_inch = (double) wmf_width / units_per_inch; image_height_inch = (double) wmf_height / units_per_inch; image_width = image_width_inch * resolution_x; image_height = image_height_inch * resolution_y; /* Compute bounding box scale factors and origin translations * * This all just a hack since libwmf does not currently seem to * provide the mapping between LOGICAL coordinates and DEVICE * coordinates. This mapping is necessary in order to know * where to place the logical bounding box within the image. * */ bounding_width = bbox.BR.x - bbox.TL.x; bounding_height = bbox.BR.y - bbox.TL.y; ddata->scale_x = image_width/bounding_width; ddata->translate_x = 0-bbox.TL.x; ddata->rotate = 0; /* Heuristic: guess that if the vertical coordinates mostly span negative values, then the image must be inverted. */ if ( fabs(bbox.BR.y) > fabs(bbox.TL.y) ) { /* Normal (Origin at top left of image) */ ddata->scale_y = (image_height/bounding_height); ddata->translate_y = 0-bbox.TL.y; } else { /* Inverted (Origin at bottom left of image) */ ddata->scale_y = (-image_height/bounding_height); ddata->translate_y = 0-bbox.BR.y; } if (image->debug != MagickFalse) { (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Placeable metafile: %s", (API)->File->placeable ? "Yes" : "No"); (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Size in metafile units: %gx%g",wmf_width,wmf_height); (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Metafile units/inch: %g",units_per_inch); (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Size in inches: %gx%g", image_width_inch,image_height_inch); (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Bounding Box: %g,%g %g,%g", bbox.TL.x, bbox.TL.y, bbox.BR.x, bbox.BR.y); (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Bounding width x height: %gx%g",bounding_width, bounding_height); (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Output resolution: %gx%g",resolution_x,resolution_y); (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Image size: %gx%g",image_width,image_height); (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Bounding box scale factor: %g,%g",ddata->scale_x, ddata->scale_y); (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Translation: %g,%g", ddata->translate_x, ddata->translate_y); } #if 0 #if 0 { typedef struct _wmfPlayer_t wmfPlayer_t; struct _wmfPlayer_t { wmfPen default_pen; wmfBrush default_brush; wmfFont default_font; wmfDC* dc; /* current dc */ }; wmfDC *dc; #define WMF_ELICIT_DC(API) (((wmfPlayer_t*)((API)->player_data))->dc) dc = WMF_ELICIT_DC(API); printf("dc->Window.Ox = %d\n", dc->Window.Ox); printf("dc->Window.Oy = %d\n", dc->Window.Oy); printf("dc->Window.width = %d\n", dc->Window.width); printf("dc->Window.height = %d\n", dc->Window.height); printf("dc->pixel_width = %g\n", dc->pixel_width); printf("dc->pixel_height = %g\n", dc->pixel_height); #if defined(MAGICKCORE_WMF_DELEGATE) /* Only in libwmf 0.3 */ printf("dc->Ox = %.d\n", dc->Ox); printf("dc->Oy = %.d\n", dc->Oy); printf("dc->width = %.d\n", dc->width); printf("dc->height = %.d\n", dc->height); #endif } #endif #endif /* * Create canvas image * */ image->rows=(unsigned long) ceil(image_height); image->columns=(unsigned long) ceil(image_width); if (image_info->ping != MagickFalse) { wmf_api_destroy(API); (void) CloseBlob(image); if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "leave ReadWMFImage()"); return(GetFirstImageInList(image)); } status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) return(DestroyImageList(image)); if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Creating canvas image with size %lux%lu",(unsigned long) image->rows, (unsigned long) image->columns); /* * Set solid background color */ { image->background_color = image_info->background_color; if (image->background_color.alpha != OpaqueAlpha) image->alpha_trait=BlendPixelTrait; (void) SetImageBackgroundColor(image,exception); } /* * Play file to generate Vector drawing commands * */ if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Playing WMF to prepare vectors"); wmf_error = wmf_play(API, 0, &bbox); if (wmf_error != wmf_E_None) { wmf_api_destroy(API); if (image->debug != MagickFalse) { (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Playing WMF failed with wmf_error %d", wmf_error); (void) LogMagickEvent(CoderEvent,GetMagickModule(), "leave ReadWMFImage()"); } ThrowReaderException(DelegateError,"FailedToRenderFile"); } /* * Scribble on canvas image * */ if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Rendering WMF vectors"); DrawRender(ddata->draw_wand); if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(),"leave ReadWMFImage()"); /* Cleanup allocated data */ wmf_api_destroy(API); (void) CloseBlob(image); /* Return image */ return image; }
1
395,086
redraw_win_later( win_T *wp, int type) { if (!exiting && wp->w_redr_type < type) { wp->w_redr_type = type; if (type >= NOT_VALID) wp->w_lines_valid = 0; if (must_redraw < type) // must_redraw is the maximum of all windows must_redraw = type; } }
0
224,993
PQsetErrorContextVisibility(PGconn *conn, PGContextVisibility show_context) { PGContextVisibility old; if (!conn) return PQSHOW_CONTEXT_ERRORS; old = conn->show_context; conn->show_context = show_context; return old; }
0
359,514
peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, safi_t safi) { int ret; struct peer *peer; peer = peer_and_group_lookup_vty (vty, ip_str); if (! peer) return CMD_WARNING; ret = peer_unsuppress_map_unset (peer, afi, safi); return bgp_vty_return (vty, ret); }
0
455,423
xfs_iflag_for_tag( int tag) { switch (tag) { case XFS_ICI_EOFBLOCKS_TAG: return XFS_IEOFBLOCKS; case XFS_ICI_COWBLOCKS_TAG: return XFS_ICOWBLOCKS; default: ASSERT(0); return 0; } }
0
196,276
lsquic_qeh_settings (struct qpack_enc_hdl *qeh, unsigned max_table_size, unsigned dyn_table_size, unsigned max_risked_streams, int server) { enum lsqpack_enc_opts enc_opts; assert(qeh->qeh_flags & QEH_INITIALIZED); if (qeh->qeh_flags & QEH_HAVE_SETTINGS) { LSQ_WARN("settings already set"); return -1; } enc_opts = LSQPACK_ENC_OPT_STAGE_2 | (server ? LSQPACK_ENC_OPT_SERVER : 0); qeh->qeh_tsu_sz = sizeof(qeh->qeh_tsu_buf); if (0 != lsqpack_enc_init(&qeh->qeh_encoder, (void *) qeh->qeh_conn, max_table_size, dyn_table_size, max_risked_streams, enc_opts, qeh->qeh_tsu_buf, &qeh->qeh_tsu_sz)) { LSQ_INFO("could not initialize QPACK encoder"); return -1; } LSQ_DEBUG("%zu-byte post-init TSU", qeh->qeh_tsu_sz); qeh->qeh_flags |= QEH_HAVE_SETTINGS; qeh->qeh_max_prefix_size = lsqpack_enc_header_block_prefix_size(&qeh->qeh_encoder); LSQ_DEBUG("have settings: max table size=%u; dyn table size=%u; max risked " "streams=%u", max_table_size, dyn_table_size, max_risked_streams); if (qeh->qeh_enc_sm_out) qeh_begin_out(qeh); return 0; }
1
90,761
void DidGetHostUsage(const std::string& host, StorageType type, int64 usage) { DCHECK_EQ(host_, host); DCHECK_EQ(type_, type); host_usage_ = usage; CheckCompleted(); }
0
262,006
int Curl_conncache_init(struct conncache *connc, int size) { /* allocate a new easy handle to use when closing cached connections */ connc->closure_handle = curl_easy_init(); if(!connc->closure_handle) return 1; /* bad */ Curl_hash_init(&connc->hash, size, Curl_hash_str, Curl_str_key_compare, free_bundle_hash_entry); connc->closure_handle->state.conn_cache = connc; return 0; /* good */ }
0
274,764
static s64 ntfs_attr_pread_i(ntfs_attr *na, const s64 pos, s64 count, void *b) { s64 br, to_read, ofs, total, total2, max_read, max_init; ntfs_volume *vol; runlist_element *rl; u16 efs_padding_length; /* Sanity checking arguments is done in ntfs_attr_pread(). */ if ((na->data_flags & ATTR_COMPRESSION_MASK) && NAttrNonResident(na)) { if ((na->data_flags & ATTR_COMPRESSION_MASK) == ATTR_IS_COMPRESSED) return ntfs_compressed_attr_pread(na, pos, count, b); else { /* compression mode not supported */ errno = EOPNOTSUPP; return -1; } } /* * Encrypted non-resident attributes are not supported. We return * access denied, which is what Windows NT4 does, too. * However, allow if mounted with efs_raw option */ vol = na->ni->vol; if (!vol->efs_raw && NAttrEncrypted(na) && NAttrNonResident(na)) { errno = EACCES; return -1; } if (!count) return 0; /* * Truncate reads beyond end of attribute, * but round to next 512 byte boundary for encrypted * attributes with efs_raw mount option */ max_read = na->data_size; max_init = na->initialized_size; if (na->ni->vol->efs_raw && (na->data_flags & ATTR_IS_ENCRYPTED) && NAttrNonResident(na)) { if (na->data_size != na->initialized_size) { ntfs_log_error("uninitialized encrypted file not supported\n"); errno = EINVAL; return -1; } max_init = max_read = ((na->data_size + 511) & ~511) + 2; } if (pos + count > max_read) { if (pos >= max_read) return 0; count = max_read - pos; } /* If it is a resident attribute, get the value from the mft record. */ if (!NAttrNonResident(na)) { ntfs_attr_search_ctx *ctx; char *val; ctx = ntfs_attr_get_search_ctx(na->ni, NULL); if (!ctx) return -1; if (ntfs_attr_lookup(na->type, na->name, na->name_len, 0, 0, NULL, 0, ctx)) { res_err_out: ntfs_attr_put_search_ctx(ctx); return -1; } val = (char*)ctx->attr + le16_to_cpu(ctx->attr->value_offset); if (val < (char*)ctx->attr || val + le32_to_cpu(ctx->attr->value_length) > (char*)ctx->mrec + vol->mft_record_size) { errno = EIO; ntfs_log_perror("%s: Sanity check failed", __FUNCTION__); goto res_err_out; } memcpy(b, val + pos, count); ntfs_attr_put_search_ctx(ctx); return count; } total = total2 = 0; /* Zero out reads beyond initialized size. */ if (pos + count > max_init) { if (pos >= max_init) { memset(b, 0, count); return count; } total2 = pos + count - max_init; count -= total2; memset((u8*)b + count, 0, total2); } /* * for encrypted non-resident attributes with efs_raw set * the last two bytes aren't read from disk but contain * the number of padding bytes so original size can be * restored */ if (na->ni->vol->efs_raw && (na->data_flags & ATTR_IS_ENCRYPTED) && ((pos + count) > max_init-2)) { efs_padding_length = 511 - ((na->data_size - 1) & 511); if (pos+count == max_init) { if (count == 1) { *((u8*)b+count-1) = (u8)(efs_padding_length >> 8); count--; total2++; } else { *(le16*)((u8*)b+count-2) = cpu_to_le16(efs_padding_length); count -= 2; total2 +=2; } } else { *((u8*)b+count-1) = (u8)(efs_padding_length & 0xff); count--; total2++; } } /* Find the runlist element containing the vcn. */ rl = ntfs_attr_find_vcn(na, pos >> vol->cluster_size_bits); if (!rl) { /* * If the vcn is not present it is an out of bounds read. * However, we already truncated the read to the data_size, * so getting this here is an error. */ if (errno == ENOENT) { errno = EIO; ntfs_log_perror("%s: Failed to find VCN #1", __FUNCTION__); } return -1; } /* * Gather the requested data into the linear destination buffer. Note, * a partial final vcn is taken care of by the @count capping of read * length. */ ofs = pos - (rl->vcn << vol->cluster_size_bits); for (; count; rl++, ofs = 0) { if (rl->lcn == LCN_RL_NOT_MAPPED) { rl = ntfs_attr_find_vcn(na, rl->vcn); if (!rl) { if (errno == ENOENT) { errno = EIO; ntfs_log_perror("%s: Failed to find VCN #2", __FUNCTION__); } goto rl_err_out; } /* Needed for case when runs merged. */ ofs = pos + total - (rl->vcn << vol->cluster_size_bits); } if (!rl->length) { errno = EIO; ntfs_log_perror("%s: Zero run length", __FUNCTION__); goto rl_err_out; } if (rl->lcn < (LCN)0) { if (rl->lcn != (LCN)LCN_HOLE) { ntfs_log_perror("%s: Bad run (%lld)", __FUNCTION__, (long long)rl->lcn); goto rl_err_out; } /* It is a hole, just zero the matching @b range. */ to_read = min(count, (rl->length << vol->cluster_size_bits) - ofs); memset(b, 0, to_read); /* Update progress counters. */ total += to_read; count -= to_read; b = (u8*)b + to_read; continue; } /* It is a real lcn, read it into @dst. */ to_read = min(count, (rl->length << vol->cluster_size_bits) - ofs); retry: ntfs_log_trace("Reading %lld bytes from vcn %lld, lcn %lld, ofs" " %lld.\n", (long long)to_read, (long long)rl->vcn, (long long )rl->lcn, (long long)ofs); br = ntfs_pread(vol->dev, (rl->lcn << vol->cluster_size_bits) + ofs, to_read, b); /* If everything ok, update progress counters and continue. */ if (br > 0) { total += br; count -= br; b = (u8*)b + br; } if (br == to_read) continue; /* If the syscall was interrupted, try again. */ if (br == (s64)-1 && errno == EINTR) goto retry; if (total) return total; if (!br) errno = EIO; ntfs_log_perror("%s: ntfs_pread failed", __FUNCTION__); return -1; } /* Finally, return the number of bytes read. */ return total + total2; rl_err_out: if (total) return total; errno = EIO; return -1; }
0
90,870
void SetUp() { ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); mock_special_storage_policy_ = new MockSpecialStoragePolicy; quota_manager_ = new QuotaManager( false /* is_incognito */, data_dir_.path(), MessageLoopProxy::current(), MessageLoopProxy::current(), mock_special_storage_policy_); quota_manager_->eviction_disabled_ = true; additional_callback_count_ = 0; }
0
222,921
bool operator()(const Handle& h1, const Handle& h2) const { return h1.SameHandle(h2); }
0
331,784
static void qpaintengineex_moveTo(qreal x, qreal y, void *data) { ((StrokeHandler *) data)->pts.add(x); ((StrokeHandler *) data)->pts.add(y); ((StrokeHandler *) data)->types.add(QPainterPath::MoveToElement); }
0
270,394
ok_png ok_png_read(FILE *file, ok_png_decode_flags decode_flags) { return ok_png_read_with_allocator(file, decode_flags, OK_PNG_DEFAULT_ALLOCATOR, NULL); }
0
247,724
TEST_P(SslSocketTest, ClientSessionResumptionEnabledTls12) { const std::string server_ctx_yaml = R"EOF( common_tls_context: tls_params: tls_minimum_protocol_version: TLSv1_0 tls_maximum_protocol_version: TLSv1_2 tls_certificates: certificate_chain: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/unittest_cert.pem" private_key: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/unittest_key.pem" )EOF"; const std::string client_ctx_yaml = R"EOF( common_tls_context: tls_params: tls_minimum_protocol_version: TLSv1_0 tls_maximum_protocol_version: TLSv1_2 max_session_keys: 2 )EOF"; testClientSessionResumption(server_ctx_yaml, client_ctx_yaml, true, GetParam()); }
0
246,698
u32 parse_cryp(char *arg_val, u32 opt) { open_edit = GF_TRUE; if (!opt) { crypt = 1; drm_file = arg_val; open_edit = GF_TRUE; return 0; } crypt = 2; if (arg_val && get_file_type_by_ext(arg_val) != 1) { drm_file = arg_val; return 0; } return 3; }
0
313,801
nv_ctrlo(cmdarg_T *cap) { if (VIsual_active && VIsual_select) { VIsual_select = FALSE; may_trigger_modechanged(); showmode(); restart_VIsual_select = 2; // restart Select mode later } else { cap->count1 = -cap->count1; nv_pcmark(cap); } }
0
299,891
readconf_find_option(void *p) { int i; router_instance *r; transport_instance *t; for (i = 0; i < optionlist_config_size; i++) if (p == optionlist_config[i].value) return US optionlist_config[i].name; for (r = routers; r != NULL; r = r->next) { router_info *ri = r->info; for (i = 0; i < ri->options_count[0]; i++) { if ((ri->options[i].type & opt_mask) != opt_stringptr) continue; if (p == (char *)(r->options_block) + (long int)(ri->options[i].value)) return US ri->options[i].name; } } for (t = transports; t != NULL; t = t->next) { transport_info *ti = t->info; for (i = 0; i < ti->options_count[0]; i++) { if ((ti->options[i].type & opt_mask) != opt_stringptr) continue; if (p == (char *)(t->options_block) + (long int)(ti->options[i].value)) return US ti->options[i].name; } } return US""; }
0
225,017
PQconninfo(PGconn *conn) { PQExpBufferData errorBuf; PQconninfoOption *connOptions; if (conn == NULL) return NULL; /* * We don't actually report any errors here, but callees want a buffer, * and we prefer not to trash the conn's errorMessage. */ initPQExpBuffer(&errorBuf); if (PQExpBufferDataBroken(errorBuf)) return NULL; /* out of memory already :-( */ connOptions = conninfo_init(&errorBuf); if (connOptions != NULL) { const internalPQconninfoOption *option; for (option = PQconninfoOptions; option->keyword; option++) { char **connmember; if (option->connofs < 0) continue; connmember = (char **) ((char *) conn + option->connofs); if (*connmember) conninfo_storeval(connOptions, option->keyword, *connmember, &errorBuf, true, false); } } termPQExpBuffer(&errorBuf); return connOptions; }
0
275,985
uECC_VLI_API uECC_word_t uECC_vli_sub(uECC_word_t *result, const uECC_word_t *left, const uECC_word_t *right, wordcount_t num_words) { uECC_word_t borrow = 0; wordcount_t i; for (i = 0; i < num_words; ++i) { uECC_word_t diff = left[i] - right[i] - borrow; if (diff != left[i]) { borrow = (diff > left[i]); } result[i] = diff; } return borrow; }
0
249,982
GF_Err gf_isom_write_compressed_box(GF_ISOFile *mov, GF_Box *root_box, u32 repl_type, GF_BitStream *bs, u32 *box_csize) { #ifdef GPAC_DISABLE_ZLIB return GF_NOT_SUPPORTED; #else GF_Err e; GF_BitStream *comp_bs = gf_bs_new(NULL, 0, GF_BITSTREAM_WRITE); e = gf_isom_box_write(root_box, comp_bs); if (!e) { u8 *box_data; u32 box_size, comp_size; if (box_csize) *box_csize = (u32) root_box->size; gf_bs_get_content(comp_bs, &box_data, &box_size); gf_gz_compress_payload_ex(&box_data, box_size, &comp_size, 8, GF_TRUE, NULL); if (mov->force_compress || (comp_size + COMP_BOX_COST_BYTES < box_size)) { if (bs) { gf_bs_write_u32(bs, comp_size+8); gf_bs_write_u32(bs, repl_type); gf_bs_write_data(bs, box_data, comp_size); } if (box_csize) *box_csize = comp_size + COMP_BOX_COST_BYTES; } else if (bs) { gf_bs_write_data(bs, box_data, box_size); } gf_free(box_data); } gf_bs_del(comp_bs); return e; #endif /*GPAC_DISABLE_ZLIB*/ }
0
270,767
static int check_passwd(unsigned char *passwd, size_t length) { struct digest *d = NULL; unsigned char *passwd1_sum; unsigned char *passwd2_sum; int ret = 0; int hash_len; if (IS_ENABLED(CONFIG_PASSWD_CRYPTO_PBKDF2)) { hash_len = PBKDF2_LENGTH; } else { d = digest_alloc(PASSWD_SUM); if (!d) { pr_err("No such digest: %s\n", PASSWD_SUM ? PASSWD_SUM : "NULL"); return -ENOENT; } hash_len = digest_length(d); } passwd1_sum = calloc(hash_len * 2, sizeof(unsigned char)); if (!passwd1_sum) return -ENOMEM; passwd2_sum = passwd1_sum + hash_len; if (is_passwd_env_enable()) ret = read_env_passwd(passwd2_sum, hash_len); else if (is_passwd_default_enable()) ret = read_default_passwd(passwd2_sum, hash_len); else ret = -EINVAL; if (ret < 0) goto err; if (IS_ENABLED(CONFIG_PASSWD_CRYPTO_PBKDF2)) { char *key = passwd2_sum + PBKDF2_SALT_LEN; char *salt = passwd2_sum; int keylen = PBKDF2_LENGTH - PBKDF2_SALT_LEN; ret = pkcs5_pbkdf2_hmac_sha1(passwd, length, salt, PBKDF2_SALT_LEN, PBKDF2_COUNT, keylen, passwd1_sum); if (ret) goto err; if (!crypto_memneq(passwd1_sum, key, keylen)) ret = 1; } else { ret = digest_digest(d, passwd, length, passwd1_sum); if (ret) goto err; if (!crypto_memneq(passwd1_sum, passwd2_sum, hash_len)) ret = 1; } err: free(passwd1_sum); digest_free(d); return ret; }
0
222,923
std::string StringifyShapeHandle(ShapeHandle s) { auto* ic = inference_context.get(); if (ic->RankKnown(s)) { std::vector<std::string> vals; for (int i = 0; i < ic->Rank(s); i++) { DimensionHandle d = ic->Dim(s, i); if (ic->ValueKnown(d) && ic->Value(d) == kUnknownDimFromConst) { vals.push_back("?(Const)"); } else { vals.push_back(ic->DebugString(d)); } } return strings::StrCat("[", absl::StrJoin(vals, ","), "]"); } else { return "?"; } }
0
265,420
static std::string getDescription(const std::string &fulltext, int line) { if (line < 1) return ""; unsigned int start = 0; for (; start<fulltext.length() ; ++start) { if (line <= 1) break; if (fulltext[start] == '\n') line--; } // not a valid description if (fulltext.compare(start, 2, "//") != 0) return ""; // Jump over the two forward slashes start = start+2; //Jump over all the spaces while (fulltext[start] == ' ' || fulltext[start] == '\t') start++; std::string retString = ""; // go till the end of the line while (fulltext[start] != '\n') { // replace // with space if (fulltext.compare(start, 2, "//") == 0) { retString += " "; start++; } else { retString += fulltext[start]; } start++; } return retString; }
0
459,112
static int tc_setup_offload_act(struct tc_action *act, struct flow_action_entry *entry, u32 *index_inc) { #ifdef CONFIG_NET_CLS_ACT if (act->ops->offload_act_setup) return act->ops->offload_act_setup(act, entry, index_inc, true); else return -EOPNOTSUPP; #else return 0; #endif }
0
351,180
static double area2d_polygon (int n, const double *x, const double *y) { double area = 0; for (int i = 1; i < n; i++) { area += (x[i-1] + x[i]) * (y[i] - y[i-1]); } return area / 2.0; }
0
265,432
TfLiteStatus Gather(TfLiteContext* context, const TfLiteGatherParams& params, const TfLiteTensor* input, const TfLiteTensor* positions, TfLiteTensor* output) { const PositionsT* indexes = GetTensorData<PositionsT>(positions); bool indices_has_only_positive_elements = true; const size_t num_indices = positions->bytes / sizeof(PositionsT); for (size_t i = 0; i < num_indices; i++) { if (indexes[i] < 0) { indices_has_only_positive_elements = false; break; } } TF_LITE_ENSURE(context, indices_has_only_positive_elements); tflite::GatherParams op_params; op_params.axis = params.axis; op_params.batch_dims = params.batch_dims; optimized_ops::Gather(op_params, GetTensorShape(input), GetTensorData<InputT>(input), GetTensorShape(positions), GetTensorData<PositionsT>(positions), GetTensorShape(output), GetTensorData<InputT>(output)); return kTfLiteOk; }
0
223,387
static SLJIT_INLINE void match_script_run_common(compiler_common *common, int private_data_ptr, backtrack_common *parent) { DEFINE_COMPILER; SLJIT_ASSERT(TMP1 == SLJIT_R0 && STR_PTR == SLJIT_R1); OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr); #ifdef SUPPORT_UNICODE sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_ARGS2(W, W, W), SLJIT_IMM, common->utf ? SLJIT_FUNC_ADDR(do_script_run_utf) : SLJIT_FUNC_ADDR(do_script_run)); #else sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_ARGS2(W, W, W), SLJIT_IMM, SLJIT_FUNC_ADDR(do_script_run)); #endif OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_RETURN_REG, 0); add_jump(compiler, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks, CMP(SLJIT_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0)); }
0
241,073
static void client_dead(int ci) { struct client *c = clients + ci; if (c->fd != -1) { log_debug("removing client %d", c->fd); close(c->fd); } c->fd = -1; c->workfn = NULL; if (c->msg) { free(c->msg); c->msg = NULL; c->offset = 0; } pollfds[ci].fd = -1; }
0
326,614
archive_write_disk_set_acls(struct archive *a, int fd, const char *name, struct archive_acl *abstract_acl, __LA_MODE_T mode) { (void)a; /* UNUSED */ (void)fd; /* UNUSED */ (void)name; /* UNUSED */ (void)abstract_acl; /* UNUSED */ (void)mode; /* UNUSED */ return (ARCHIVE_OK); }
0
462,409
processDataRcvd(ptcpsess_t *const __restrict__ pThis, char **buff, const int buffLen, struct syslogTime *stTime, const time_t ttGenTime, multi_submit_t *pMultiSub, unsigned *const __restrict__ pnMsgs) { DEFiRet; char c = **buff; int octatesToCopy, octatesToDiscard; if(pThis->inputState == eAtStrtFram) { if(pThis->bSuppOctetFram && isdigit((int) c)) { pThis->inputState = eInOctetCnt; pThis->iOctetsRemain = 0; pThis->eFraming = TCP_FRAMING_OCTET_COUNTING; } else if(pThis->bSPFramingFix && c == ' ') { /* Cisco very occasionally sends a SP after a LF, which * thrashes framing if not taken special care of. Here, * we permit space *in front of the next frame* and * ignore it. */ FINALIZE; } else { pThis->inputState = eInMsg; pThis->eFraming = TCP_FRAMING_OCTET_STUFFING; } } if(pThis->inputState == eInOctetCnt) { if(isdigit(c)) { if(pThis->iOctetsRemain <= 200000000) { pThis->iOctetsRemain = pThis->iOctetsRemain * 10 + c - '0'; } else { errmsg.LogError(0, NO_ERRCODE, "Framing Error in received TCP message: " "frame too large (at least %d%c), change to octet stuffing", pThis->iOctetsRemain, c); pThis->eFraming = TCP_FRAMING_OCTET_STUFFING; pThis->inputState = eInMsg; } *(pThis->pMsg + pThis->iMsg++) = c; } else { /* done with the octet count, so this must be the SP terminator */ DBGPRINTF("TCP Message with octet-counter, size %d.\n", pThis->iOctetsRemain); if(c != ' ') { errmsg.LogError(0, NO_ERRCODE, "Framing Error in received TCP message: " "delimiter is not SP but has ASCII value %d.", c); } if(pThis->iOctetsRemain < 1) { /* TODO: handle the case where the octet count is 0! */ errmsg.LogError(0, NO_ERRCODE, "Framing Error in received TCP message: " "invalid octet count %d.", pThis->iOctetsRemain); pThis->eFraming = TCP_FRAMING_OCTET_STUFFING; } else if(pThis->iOctetsRemain > iMaxLine) { /* while we can not do anything against it, we can at least log an indication * that something went wrong) -- rgerhards, 2008-03-14 */ DBGPRINTF("truncating message with %d octets - max msg size is %d\n", pThis->iOctetsRemain, iMaxLine); errmsg.LogError(0, NO_ERRCODE, "received oversize message: size is %d bytes, " "max msg size is %d, truncating...", pThis->iOctetsRemain, iMaxLine); } pThis->inputState = eInMsg; pThis->iMsg = 0; } } else { assert(pThis->inputState == eInMsg); if (pThis->eFraming == TCP_FRAMING_OCTET_STUFFING) { if(pThis->iMsg >= iMaxLine) { /* emergency, we now need to flush, no matter if we are at end of message or not... */ int i = 1; char currBuffChar; while(i < buffLen && ((currBuffChar = (*buff)[i]) != '\n' && (pThis->pLstn->pSrv->iAddtlFrameDelim == TCPSRV_NO_ADDTL_DELIMITER || currBuffChar != pThis->pLstn->pSrv->iAddtlFrameDelim))) { i++; } LogError(0, NO_ERRCODE, "error: message received is at least %d byte larger than max msg" " size; message will be split starting at: \"%.*s\"\n", i, (i < 32) ? i : 32, *buff); doSubmitMsg(pThis, stTime, ttGenTime, pMultiSub); ++(*pnMsgs); /* we might think if it is better to ignore the rest of the * message than to treat it as a new one. Maybe this is a good * candidate for a configuration parameter... * rgerhards, 2006-12-04 */ } if ((c == '\n') || ((pThis->pLstn->pSrv->iAddtlFrameDelim != TCPSRV_NO_ADDTL_DELIMITER) && (c == pThis->pLstn->pSrv->iAddtlFrameDelim)) ) { /* record delimiter? */ doSubmitMsg(pThis, stTime, ttGenTime, pMultiSub); ++(*pnMsgs); pThis->inputState = eAtStrtFram; } else { /* IMPORTANT: here we copy the actual frame content to the message - for BOTH framing modes! * If we have a message that is larger than the max msg size, we truncate it. This is the best * we can do in light of what the engine supports. -- rgerhards, 2008-03-14 */ if(pThis->iMsg < iMaxLine) { *(pThis->pMsg + pThis->iMsg++) = c; } } } else { assert(pThis->eFraming == TCP_FRAMING_OCTET_COUNTING); octatesToCopy = pThis->iOctetsRemain; octatesToDiscard = 0; if (buffLen < octatesToCopy) { octatesToCopy = buffLen; } if (octatesToCopy + pThis->iMsg > iMaxLine) { octatesToDiscard = octatesToCopy - (iMaxLine - pThis->iMsg); octatesToCopy = iMaxLine - pThis->iMsg; } memcpy(pThis->pMsg + pThis->iMsg, *buff, octatesToCopy); pThis->iMsg += octatesToCopy; pThis->iOctetsRemain -= (octatesToCopy + octatesToDiscard); *buff += (octatesToCopy + octatesToDiscard - 1); if (pThis->iOctetsRemain == 0) { /* we have end of frame! */ doSubmitMsg(pThis, stTime, ttGenTime, pMultiSub); ++(*pnMsgs); pThis->inputState = eAtStrtFram; } } } finalize_it: RETiRet; }
0
443,160
int jfs_write_inode(struct inode *inode, struct writeback_control *wbc) { int wait = wbc->sync_mode == WB_SYNC_ALL; if (inode->i_nlink == 0) return 0; /* * If COMMIT_DIRTY is not set, the inode isn't really dirty. * It has been committed since the last change, but was still * on the dirty inode list. */ if (!test_cflag(COMMIT_Dirty, inode)) { /* Make sure committed changes hit the disk */ jfs_flush_journal(JFS_SBI(inode->i_sb)->log, wait); return 0; } if (jfs_commit_inode(inode, wait)) { jfs_err("jfs_write_inode: jfs_commit_inode failed!"); return -EIO; } else return 0; }
0
195,063
GF_Err mpgviddmx_process(GF_Filter *filter) { GF_MPGVidDmxCtx *ctx = gf_filter_get_udta(filter); GF_FilterPacket *pck, *dst_pck; u64 byte_offset; s64 vosh_start = -1; s64 vosh_end = -1; GF_Err e; char *data; u8 *start; u32 pck_size; s32 remain; //always reparse duration if (!ctx->duration.num) mpgviddmx_check_dur(filter, ctx); pck = gf_filter_pid_get_packet(ctx->ipid); if (!pck) { if (gf_filter_pid_is_eos(ctx->ipid)) { mpgviddmx_enqueue_or_dispatch(ctx, NULL, GF_TRUE, GF_TRUE); if (ctx->opid) gf_filter_pid_set_eos(ctx->opid); if (ctx->src_pck) gf_filter_pck_unref(ctx->src_pck); ctx->src_pck = NULL; return GF_EOS; } return GF_OK; } data = (char *) gf_filter_pck_get_data(pck, &pck_size); byte_offset = gf_filter_pck_get_byte_offset(pck); start = data; remain = pck_size; //input pid sets some timescale - we flushed pending data , update cts if (!ctx->resume_from && ctx->timescale) { u64 ts = gf_filter_pck_get_cts(pck); if (ts != GF_FILTER_NO_TS) { if (!ctx->cts || !ctx->recompute_cts) ctx->cts = ts; } ts = gf_filter_pck_get_dts(pck); if (ts != GF_FILTER_NO_TS) { if (!ctx->dts || !ctx->recompute_cts) ctx->dts = ts; if (!ctx->prev_dts) ctx->prev_dts = ts; else if (ctx->prev_dts != ts) { u64 diff = ts; diff -= ctx->prev_dts; if (!ctx->cur_fps.den) ctx->cur_fps.den = (u32) diff; else if (ctx->cur_fps.den > diff) ctx->cur_fps.den = (u32) diff; } } gf_filter_pck_get_framing(pck, &ctx->input_is_au_start, &ctx->input_is_au_end); //this will force CTS recomput of each frame if (ctx->recompute_cts) ctx->input_is_au_start = GF_FALSE; if (ctx->src_pck) gf_filter_pck_unref(ctx->src_pck); ctx->src_pck = pck; gf_filter_pck_ref_props(&ctx->src_pck); } //we stored some data to find the complete vosh, aggregate this packet with current one if (!ctx->resume_from && ctx->hdr_store_size) { if (ctx->hdr_store_alloc < ctx->hdr_store_size + pck_size) { ctx->hdr_store_alloc = ctx->hdr_store_size + pck_size; ctx->hdr_store = gf_realloc(ctx->hdr_store, sizeof(char)*ctx->hdr_store_alloc); } memcpy(ctx->hdr_store + ctx->hdr_store_size, data, sizeof(char)*pck_size); if (byte_offset != GF_FILTER_NO_BO) { if (byte_offset >= ctx->hdr_store_size) byte_offset -= ctx->hdr_store_size; else byte_offset = GF_FILTER_NO_BO; } ctx->hdr_store_size += pck_size; start = data = ctx->hdr_store; remain = pck_size = ctx->hdr_store_size; } if (ctx->resume_from) { if (gf_filter_pid_would_block(ctx->opid)) return GF_OK; //resume from data copied internally if (ctx->hdr_store_size) { assert(ctx->resume_from <= ctx->hdr_store_size); start = data = ctx->hdr_store + ctx->resume_from; remain = pck_size = ctx->hdr_store_size - ctx->resume_from; } else { assert(remain >= (s32) ctx->resume_from); start += ctx->resume_from; remain -= ctx->resume_from; } ctx->resume_from = 0; } if (!ctx->bs) { ctx->bs = gf_bs_new(start, remain, GF_BITSTREAM_READ); } else { gf_bs_reassign_buffer(ctx->bs, start, remain); } if (!ctx->vparser) { ctx->vparser = gf_m4v_parser_bs_new(ctx->bs, ctx->is_mpg12); } while (remain) { Bool full_frame; u8 *pck_data; s32 current; u8 sc_type, forced_sc_type=0; Bool sc_type_forced = GF_FALSE; Bool skip_pck = GF_FALSE; u8 ftype; u32 tinc; u64 size=0; u64 fstart; Bool is_coded; u32 bytes_from_store = 0; u32 hdr_offset = 0; Bool copy_last_bytes = GF_FALSE; //not enough bytes to parse start code if (remain<5) { memcpy(ctx->hdr_store, start, remain); ctx->bytes_in_header = remain; break; } current = -1; //we have some potential bytes of a start code in the store, copy some more bytes and check if valid start code. //if not, dispatch these bytes as continuation of the data if (ctx->bytes_in_header) { memcpy(ctx->hdr_store + ctx->bytes_in_header, start, 8 - ctx->bytes_in_header); current = mpgviddmx_next_start_code(ctx->hdr_store, 8); //no start code in stored buffer if ((current<0) || (current >= (s32) ctx->bytes_in_header) ) { if (ctx->opid) { dst_pck = gf_filter_pck_new_alloc(ctx->opid, ctx->bytes_in_header, &pck_data); if (!dst_pck) return GF_OUT_OF_MEM; if (ctx->src_pck) gf_filter_pck_merge_properties(ctx->src_pck, dst_pck); gf_filter_pck_set_cts(dst_pck, GF_FILTER_NO_TS); gf_filter_pck_set_dts(dst_pck, GF_FILTER_NO_TS); memcpy(pck_data, ctx->hdr_store, ctx->bytes_in_header); gf_filter_pck_set_framing(dst_pck, GF_FALSE, GF_FALSE); if (byte_offset != GF_FILTER_NO_BO) { gf_filter_pck_set_byte_offset(dst_pck, byte_offset - ctx->bytes_in_header); } mpgviddmx_enqueue_or_dispatch(ctx, dst_pck, GF_FALSE, GF_FALSE); } if (current<0) current = -1; else current -= ctx->bytes_in_header; ctx->bytes_in_header = 0; } else { //we have a valid start code, check which byte in our store or in the packet payload is the start code type //and remember its location to reinit the parser from there hdr_offset = 4 - ctx->bytes_in_header + current; //bytes still to dispatch bytes_from_store = ctx->bytes_in_header; ctx->bytes_in_header = 0; if (!hdr_offset) { forced_sc_type = ctx->hdr_store[current+3]; } else { forced_sc_type = start[hdr_offset-1]; } sc_type_forced = GF_TRUE; } } //no starcode in store, look for startcode in packet if (current == -1) { //locate next start code current = mpgviddmx_next_start_code(start, remain); //no start code, dispatch the block if (current<0) { u8 b3, b2, b1; if (! ctx->frame_started) { GF_LOG(GF_LOG_DEBUG, GF_LOG_MEDIA, ("[MPGVid] no start code in block and no frame started, discarding data\n" )); break; } size = remain; b3 = start[remain-3]; b2 = start[remain-2]; b1 = start[remain-1]; //we may have a startcode at the end of the packet, store it and don't dispatch the last 3 bytes ! if (!b1 || !b2 || !b3) { copy_last_bytes = GF_TRUE; assert(size >= 3); size -= 3; ctx->bytes_in_header = 3; } dst_pck = gf_filter_pck_new_alloc(ctx->opid, (u32) size, &pck_data); if (!dst_pck) return GF_OUT_OF_MEM; if (ctx->src_pck) gf_filter_pck_merge_properties(ctx->src_pck, dst_pck); memcpy(pck_data, start, (size_t) size); gf_filter_pck_set_framing(dst_pck, GF_FALSE, GF_FALSE); gf_filter_pck_set_cts(dst_pck, GF_FILTER_NO_TS); gf_filter_pck_set_dts(dst_pck, GF_FILTER_NO_TS); if (byte_offset != GF_FILTER_NO_BO) { gf_filter_pck_set_byte_offset(dst_pck, byte_offset); } mpgviddmx_enqueue_or_dispatch(ctx, dst_pck, GF_FALSE, GF_FALSE); if (copy_last_bytes) { memcpy(ctx->hdr_store, start+remain-3, 3); } break; } } assert(current>=0); //if we are in the middle of parsing the vosh, skip over bytes remaining from previous obj not parsed if ((vosh_start>=0) && current) { assert(remain>=current); start += current; remain -= current; current = 0; } //also skip if no output pid if (!ctx->opid && current) { assert(remain>=current); start += current; remain -= current; current = 0; } //dispatch remaining bytes if (current>0) { //flush remaining dst_pck = gf_filter_pck_new_alloc(ctx->opid, current, &pck_data); if (!dst_pck) return GF_OUT_OF_MEM; if (ctx->src_pck) gf_filter_pck_merge_properties(ctx->src_pck, dst_pck); gf_filter_pck_set_cts(dst_pck, GF_FILTER_NO_TS); gf_filter_pck_set_dts(dst_pck, GF_FILTER_NO_TS); gf_filter_pck_set_framing(dst_pck, GF_FALSE, GF_TRUE); //bytes were partly in store, partly in packet if (bytes_from_store) { if (byte_offset != GF_FILTER_NO_BO) { gf_filter_pck_set_byte_offset(dst_pck, byte_offset - bytes_from_store); } assert(bytes_from_store>=(u32) current); bytes_from_store -= current; memcpy(pck_data, ctx->hdr_store, current); } else { //bytes were only in packet if (byte_offset != GF_FILTER_NO_BO) { gf_filter_pck_set_byte_offset(dst_pck, byte_offset); } memcpy(pck_data, start, current); assert(remain>=current); start += current; remain -= current; current = 0; } gf_filter_pck_set_carousel_version(dst_pck, 1); mpgviddmx_enqueue_or_dispatch(ctx, dst_pck, GF_FALSE, GF_FALSE); } //parse headers //we have a start code loaded, eg the data packet does not have a full start code at the beginning if (sc_type_forced) { gf_bs_reassign_buffer(ctx->bs, start + hdr_offset, remain - hdr_offset); sc_type = forced_sc_type; } else { gf_bs_reassign_buffer(ctx->bs, start, remain); gf_bs_read_int(ctx->bs, 24); sc_type = gf_bs_read_int(ctx->bs, 8); } if (ctx->is_mpg12) { switch (sc_type) { case M2V_SEQ_START_CODE: case M2V_EXT_START_CODE: gf_bs_reassign_buffer(ctx->bs, start, remain); e = gf_m4v_parse_config(ctx->vparser, &ctx->dsi); //not enough data, accumulate until we can parse the full header if (e==GF_EOS) { if (vosh_start<0) vosh_start = 0; if (data == ctx->hdr_store) { memmove(ctx->hdr_store, start, remain); ctx->hdr_store_size = remain; } else { if (ctx->hdr_store_alloc < ctx->hdr_store_size + pck_size - vosh_start) { ctx->hdr_store_alloc = (u32) (ctx->hdr_store_size + pck_size - vosh_start); ctx->hdr_store = gf_realloc(ctx->hdr_store, sizeof(char)*ctx->hdr_store_alloc); } memcpy(ctx->hdr_store + ctx->hdr_store_size, data + vosh_start, (size_t) (pck_size - vosh_start) ); ctx->hdr_store_size += pck_size - (u32) vosh_start; } gf_filter_pid_drop_packet(ctx->ipid); return GF_OK; } else if (e != GF_OK) { GF_LOG(GF_LOG_ERROR, GF_LOG_MEDIA, ("[MPGVid] Failed to parse VOS header: %s\n", gf_error_to_string(e) )); } else { mpgviddmx_check_pid(filter, ctx, 0, NULL); } break; case M2V_PIC_START_CODE: break; default: break; } } else { u8 PL; switch (sc_type) { case M4V_VOS_START_CODE: ctx->dsi.VideoPL = (u8) gf_bs_read_u8(ctx->bs); vosh_start = start - (u8 *)data; skip_pck = GF_TRUE; assert(remain>=5); start += 5; remain -= 5; break; case M4V_VOL_START_CODE: gf_bs_reassign_buffer(ctx->bs, start, remain); PL = ctx->dsi.VideoPL; e = gf_m4v_parse_config(ctx->vparser, &ctx->dsi); ctx->dsi.VideoPL = PL; //not enough data, accumulate until we can parse the full header if (e==GF_EOS) { if (vosh_start<0) vosh_start = 0; if (data == ctx->hdr_store) { memmove(ctx->hdr_store, start, remain); ctx->hdr_store_size = remain; } else { if (ctx->hdr_store_alloc < ctx->hdr_store_size + pck_size - vosh_start) { ctx->hdr_store_alloc = (u32) (ctx->hdr_store_size + pck_size - (u32) vosh_start); ctx->hdr_store = gf_realloc(ctx->hdr_store, sizeof(char)*ctx->hdr_store_alloc); } memcpy(ctx->hdr_store + ctx->hdr_store_size, data + vosh_start, (size_t) (pck_size - vosh_start) ); ctx->hdr_store_size += pck_size - (u32) vosh_start; } gf_filter_pid_drop_packet(ctx->ipid); return GF_OK; } else if (e != GF_OK) { GF_LOG(GF_LOG_ERROR, GF_LOG_MEDIA, ("[MPGVid] Failed to parse VOS header: %s\n", gf_error_to_string(e) )); } else { u32 obj_size = (u32) gf_m4v_get_object_start(ctx->vparser); if (vosh_start<0) vosh_start = 0; vosh_end = start - (u8 *)data + obj_size; vosh_end -= vosh_start; mpgviddmx_check_pid(filter, ctx,(u32) vosh_end, data+vosh_start); skip_pck = GF_TRUE; assert(remain>=(s32) obj_size); start += obj_size; remain -= obj_size; } break; case M4V_VOP_START_CODE: case M4V_GOV_START_CODE: break; case M4V_VO_START_CODE: case M4V_VISOBJ_START_CODE: default: if (vosh_start>=0) { skip_pck = GF_TRUE; assert(remain>=4); start += 4; remain -= 4; } break; } } if (skip_pck) { continue; } if (!ctx->opid) { assert(remain>=4); start += 4; remain -= 4; continue; } if (!ctx->is_playing) { ctx->resume_from = (u32) ((char *)start - (char *)data); return GF_OK; } //at this point, we no longer reaggregate packets ctx->hdr_store_size = 0; if (ctx->in_seek) { u64 nb_frames_at_seek = (u64) (ctx->start_range * ctx->cur_fps.num); if (ctx->cts + ctx->cur_fps.den >= nb_frames_at_seek) { //u32 samples_to_discard = (ctx->cts + ctx->dts_inc) - nb_samples_at_seek; ctx->in_seek = GF_FALSE; } } //may happen that after all our checks, only 4 bytes are left, continue to store these 4 bytes if (remain<5) continue; //good to go gf_m4v_parser_reset(ctx->vparser, sc_type_forced ? forced_sc_type + 1 : 0); size = 0; e = gf_m4v_parse_frame(ctx->vparser, &ctx->dsi, &ftype, &tinc, &size, &fstart, &is_coded); //true if we strip VO and VISOBJ assert(!fstart); //we skipped bytes already in store + end of start code present in packet, so the size of the first object //needs adjustement if (bytes_from_store) { size += bytes_from_store + hdr_offset; } if ((e == GF_EOS) && !ctx->input_is_au_end) { u8 b3 = start[remain-3]; u8 b2 = start[remain-2]; u8 b1 = start[remain-1]; //we may have a startcode at the end of the packet, store it and don't dispatch the last 3 bytes ! if (!b1 || !b2 || !b3) { copy_last_bytes = GF_TRUE; assert(size >= 3); size -= 3; ctx->bytes_in_header = 3; } full_frame = GF_FALSE; } else { full_frame = GF_TRUE; } if (!is_coded) { /*if prev is B and we're parsing a packed bitstream discard n-vop*/ if (ctx->forced_packed && ctx->b_frames) { ctx->is_packed = GF_TRUE; assert(remain>=size); start += size; remain -= (s32) size; continue; } /*policy is to import at variable frame rate, skip*/ if (ctx->vfr) { ctx->is_vfr = GF_TRUE; mpgviddmx_update_time(ctx); assert(remain>=size); start += size; remain -= (s32) size; continue; } /*policy is to keep non coded frame (constant frame rate), add*/ } if (ftype==2) { //count number of B-frames since last ref ctx->b_frames++; ctx->nb_b++; } else { //flush all pending packets mpgviddmx_enqueue_or_dispatch(ctx, NULL, GF_TRUE, GF_FALSE); //remeber the CTS of the last ref ctx->last_ref_cts = ctx->cts; if (ctx->max_b < ctx->b_frames) ctx->max_b = ctx->b_frames; ctx->b_frames = 0; if (ftype) ctx->nb_p++; else ctx->nb_i++; } ctx->nb_frames++; dst_pck = gf_filter_pck_new_alloc(ctx->opid, (u32) size, &pck_data); if (!dst_pck) return GF_OUT_OF_MEM; if (ctx->src_pck) gf_filter_pck_merge_properties(ctx->src_pck, dst_pck); //bytes come from both our store and the data packet if (bytes_from_store) { memcpy(pck_data, ctx->hdr_store+current, bytes_from_store); assert(size >= bytes_from_store); size -= bytes_from_store; if (byte_offset != GF_FILTER_NO_BO) { gf_filter_pck_set_byte_offset(dst_pck, byte_offset - bytes_from_store); } memcpy(pck_data + bytes_from_store, start, (size_t) size); } else { //bytes only come the data packet memcpy(pck_data, start, (size_t) size); if (byte_offset != GF_FILTER_NO_BO) { gf_filter_pck_set_byte_offset(dst_pck, byte_offset + start - (u8 *) data); } } assert(pck_data[0] == 0); assert(pck_data[1] == 0); assert(pck_data[2] == 0x01); gf_filter_pck_set_framing(dst_pck, GF_TRUE, (full_frame || ctx->input_is_au_end) ? GF_TRUE : GF_FALSE); gf_filter_pck_set_cts(dst_pck, ctx->cts); gf_filter_pck_set_dts(dst_pck, ctx->dts); if (ctx->input_is_au_start) { ctx->input_is_au_start = GF_FALSE; } else { //we use the carousel flag temporarly to indicate the cts must be recomputed gf_filter_pck_set_carousel_version(dst_pck, 1); } gf_filter_pck_set_sap(dst_pck, ftype ? GF_FILTER_SAP_NONE : GF_FILTER_SAP_1); gf_filter_pck_set_duration(dst_pck, ctx->cur_fps.den); if (ctx->in_seek) gf_filter_pck_set_seek_flag(dst_pck, GF_TRUE); ctx->frame_started = GF_TRUE; mpgviddmx_enqueue_or_dispatch(ctx, dst_pck, GF_FALSE, GF_FALSE); mpgviddmx_update_time(ctx); if (!full_frame) { if (copy_last_bytes) { memcpy(ctx->hdr_store, start+remain-3, 3); } break; } assert(remain>=size); start += size; remain -= (s32) size; } gf_filter_pid_drop_packet(ctx->ipid); return GF_OK; }
1
442,815
static void warnf(struct Configurable *config, const char *fmt, ...) { if(!(config->conf & CONF_MUTE)) { va_list ap; int len; char *ptr; char print_buffer[256]; va_start(ap, fmt); va_start(ap, fmt); len = vsnprintf(print_buffer, sizeof(print_buffer), fmt, ap); va_end(ap); ptr = print_buffer; while(len > 0) { fputs(WARN_PREFIX, config->errors); if(len > (int)WARN_TEXTWIDTH) { int cut = WARN_TEXTWIDTH-1; while(!ISSPACE(ptr[cut]) && cut) { cut--; } if(0 == cut) /* not a single cutting position was found, just cut it at the max text width then! */ cut = WARN_TEXTWIDTH-1; fwrite(ptr, cut + 1, 1, config->errors); fputs("\n", config->errors); ptr += cut+1; /* skip the space too */ len -= cut; } else { fputs(ptr, config->errors); len = 0; } } } }
0
236,204
GF_Err href_box_read(GF_Box *s, GF_BitStream *bs) { u32 len; GF_TextHyperTextBox*ptr = (GF_TextHyperTextBox*)s; ISOM_DECREASE_SIZE(ptr, 6) //including 2 length fields ptr->startcharoffset = gf_bs_read_u16(bs); ptr->endcharoffset = gf_bs_read_u16(bs); len = gf_bs_read_u8(bs); if (len) { ISOM_DECREASE_SIZE(ptr, len) ptr->URL = (char *) gf_malloc(sizeof(char) * (len+1)); if (!ptr->URL) return GF_OUT_OF_MEM; gf_bs_read_data(bs, ptr->URL, len); ptr->URL[len] = 0; } len = gf_bs_read_u8(bs); if (len) { ISOM_DECREASE_SIZE(ptr, len) ptr->URL_hint = (char *) gf_malloc(sizeof(char) * (len+1)); if (!ptr->URL_hint) return GF_OUT_OF_MEM; gf_bs_read_data(bs, ptr->URL_hint, len); ptr->URL_hint[len]= 0; } return GF_OK; }
0
373,541
ipf_is_first_v6_frag(ovs_be16 ip6f_offlg) { if (!(ip6f_offlg & IP6F_OFF_MASK) && ip6f_offlg & IP6F_MORE_FRAG) { return true; } return false; }
0
90,232
virtual const WifiNetworkVector& wifi_networks() const { return wifi_networks_; }
0
252,436
inline void outputBits(int nBits, long long bits, long long &c, int &lc, char *&out) { c <<= nBits; lc += nBits; c |= bits; while (lc >= 8) *out++ = static_cast<char>((c >> (lc -= 8))); }
0
233,938
void validateUnionWithCollectionlessPipeline( const boost::optional<std::vector<mongo::BSONObj>>& pipeline) { uassert(ErrorCodes::FailedToParse, "$unionWith stage without explicit collection must have a pipeline with $documents as " "first stage", pipeline && pipeline->size() > 0 && !(*pipeline)[0].getField(DocumentSourceDocuments::kStageName).eoo()); }
0
328,827
R_API RBinJavaElementValue *r_bin_java_element_value_new(ut8 *buffer, ut64 sz, ut64 buf_offset) { ut32 i = 0; ut64 offset = 0; if (sz < 8) { return NULL; } RBinJavaElementValue *element_value = R_NEW0 (RBinJavaElementValue); if (!element_value) { return NULL; } RBinJavaElementValuePair *evps = NULL; element_value->metas = R_NEW0 (RBinJavaMetaInfo); if (!element_value->metas) { R_FREE (element_value); return NULL; } element_value->file_offset = buf_offset; element_value->tag = buffer[offset]; element_value->size += 1; offset += 1; element_value->metas->type_info = (void *) r_bin_java_get_ev_meta_from_tag (element_value->tag); switch (element_value->tag) { case R_BIN_JAVA_EV_TAG_BYTE: case R_BIN_JAVA_EV_TAG_CHAR: case R_BIN_JAVA_EV_TAG_DOUBLE: case R_BIN_JAVA_EV_TAG_FLOAT: case R_BIN_JAVA_EV_TAG_INT: case R_BIN_JAVA_EV_TAG_LONG: case R_BIN_JAVA_EV_TAG_SHORT: case R_BIN_JAVA_EV_TAG_BOOLEAN: case R_BIN_JAVA_EV_TAG_STRING: // look up value in bin->cp_list // (ut16) read and set const_value.const_value_idx element_value->value.const_value.const_value_idx = R_BIN_JAVA_USHORT (buffer, offset); element_value->size += 2; // look-up, deep copy, and set const_value.const_value_cp_obj element_value->value.const_value.const_value_cp_obj = r_bin_java_clone_cp_idx (R_BIN_JAVA_GLOBAL_BIN, element_value->value.const_value.const_value_idx); break; case R_BIN_JAVA_EV_TAG_ENUM: // (ut16) read and set enum_const_value.type_name_idx element_value->value.enum_const_value.type_name_idx = R_BIN_JAVA_USHORT (buffer, offset); element_value->size += 2; offset += 2; // (ut16) read and set enum_const_value.const_name_idx element_value->value.enum_const_value.const_name_idx = R_BIN_JAVA_USHORT (buffer, offset); element_value->size += 2; offset += 2; // look up type_name_index in bin->cp_list // look-up, deep copy, and set enum_const_value.const_name_cp_obj element_value->value.enum_const_value.const_name_cp_obj = r_bin_java_clone_cp_idx (R_BIN_JAVA_GLOBAL_BIN, element_value->value.enum_const_value.const_name_idx); // look-up, deep copy, and set enum_const_value.type_name_cp_obj element_value->value.enum_const_value.type_name_cp_obj = r_bin_java_clone_cp_idx (R_BIN_JAVA_GLOBAL_BIN, element_value->value.enum_const_value.type_name_idx); break; case R_BIN_JAVA_EV_TAG_CLASS: // (ut16) read and set class_value.class_info_idx element_value->value.class_value.class_info_idx = R_BIN_JAVA_USHORT (buffer, offset); element_value->size += 2; offset += 2; // look up type_name_index in bin->cp_list // look-up, deep copy, and set class_value.class_info_cp_obj element_value->value.class_value.class_info_cp_obj = r_bin_java_clone_cp_idx (R_BIN_JAVA_GLOBAL_BIN, element_value->value.class_value.class_info_idx); break; case R_BIN_JAVA_EV_TAG_ARRAY: // (ut16) read and set array_value.num_values element_value->value.array_value.num_values = R_BIN_JAVA_USHORT (buffer, offset); element_value->size += 2; offset += 2; element_value->value.array_value.values = r_list_new (); for (i = 0; i < element_value->value.array_value.num_values; i++) { if (offset >= sz) { break; } RBinJavaElementValue *ev_element = r_bin_java_element_value_new (buffer + offset, sz - offset, buf_offset + offset); if (ev_element) { element_value->size += ev_element->size; offset += ev_element->size; // read array_value.num_values, and append to array_value.values r_list_append (element_value->value.array_value.values, (void *) ev_element); } } break; case R_BIN_JAVA_EV_TAG_ANNOTATION: // annotation new is not used here. // (ut16) read and set annotation_value.type_idx; if (offset + 8 < sz) { element_value->value.annotation_value.type_idx = R_BIN_JAVA_USHORT (buffer, offset); element_value->size += 2; offset += 2; // (ut16) read and set annotation_value.num_element_value_pairs; element_value->value.annotation_value.num_element_value_pairs = R_BIN_JAVA_USHORT (buffer, offset); element_value->size += 2; offset += 2; } element_value->value.annotation_value.element_value_pairs = r_list_newf (r_bin_java_element_pair_free); // read annotation_value.num_element_value_pairs, and append to annotation_value.element_value_pairs for (i = 0; i < element_value->value.annotation_value.num_element_value_pairs; i++) { if (offset > sz) { break; } evps = r_bin_java_element_pair_new (buffer + offset, sz - offset, buf_offset + offset); if (evps) { element_value->size += evps->size; offset += evps->size; } if (evps == NULL) { // TODO: eprintf error when reading element pair } r_list_append (element_value->value.annotation_value.element_value_pairs, (void *) evps); } break; default: // eprintf unable to handle tag break; } return element_value; }
0
274,660
static void aperture_state_report (gerbv_net_t *net, gerbv_image_t *img, gerbv_project_t *prj) { gerbv_layertype_t layer_type = img->layertype; gboolean show_length = FALSE; gboolean aperture_is_valid = FALSE; double x, y, len = 0; if (net->aperture > 0) aperture_is_valid = TRUE; switch (net->aperture_state) { case GERBV_APERTURE_STATE_OFF: break; case GERBV_APERTURE_STATE_ON: switch (net->interpolation) { case GERBV_INTERPOLATION_LINEARx1: case GERBV_INTERPOLATION_LINEARx10: case GERBV_INTERPOLATION_LINEARx01: case GERBV_INTERPOLATION_LINEARx001: if (layer_type != GERBV_LAYERTYPE_DRILL) g_message (_("Object type: Line")); else g_message (_("Object type: Slot (drilled)")); len = line_length(net->start_x, net->start_y, net->stop_x, net->stop_y); show_length = 1; break; case GERBV_INTERPOLATION_CW_CIRCULAR: case GERBV_INTERPOLATION_CCW_CIRCULAR: g_message (_("Object type: Arc")); len = arc_length(net->cirseg->width, fabs(net->cirseg->angle1 - net->cirseg->angle2)); show_length = 1; break; default: g_message (_("Object type: Unknown")); break; } if (layer_type != GERBV_LAYERTYPE_DRILL) g_message (_(" Exposure: On")); if (aperture_is_valid) { if (layer_type != GERBV_LAYERTYPE_DRILL) aperture_report(img->aperture, net->aperture, net->start_x, net->start_y, img, prj); else drill_report(img->aperture, net->aperture); } x = net->start_x; y = net->start_y; gerbv_transform_coord_for_image(&x, &y, img, prj); g_message (_(" Start: (%g, %g) %s"), screen_units(x), screen_units(y), screen_units_str()); x = net->stop_x; y = net->stop_y; gerbv_transform_coord_for_image(&x, &y, img, prj); g_message (_(" Stop: (%g, %g) %s"), screen_units(x), screen_units(y), screen_units_str()); switch (net->interpolation) { case GERBV_INTERPOLATION_CW_CIRCULAR: case GERBV_INTERPOLATION_CCW_CIRCULAR: x = net->cirseg->cp_x; y = net->cirseg->cp_y; gerbv_transform_coord_for_image(&x, &y, img, prj); g_message (_(" Center: (%g, %g) %s"), screen_units(x), screen_units(y), screen_units_str()); x = net->cirseg->width/2; y = x; gerbv_transform_coord_for_image(&x, &y, img, prj); g_message (_(" Radius: %g %s"), screen_units(x), screen_units_str()); g_message (_(" Angle: %g deg"), fabs(net->cirseg->angle1 - net->cirseg->angle2)); g_message (_(" Angles: (%g, %g) deg"), net->cirseg->angle1, net->cirseg->angle2); g_message (_(" Direction: %s"), (net->interpolation == GERBV_INTERPOLATION_CW_CIRCULAR)? _("CW"): _("CCW")); break; default: break; } if (show_length) { gerbv_aperture_t *aper = img->aperture[net->aperture]; if (layer_type == GERBV_LAYERTYPE_DRILL && aperture_is_valid && aper->type == GERBV_APTYPE_CIRCLE) { double dia = aper->parameter[0]; g_message (_(" Slot length: %g %s"), screen_units(len + dia), screen_units_str()); } screen.length_sum += len; g_message (_(" Length: %g (sum: %g) %s"), screen_units(len), screen_units(screen.length_sum), screen_units_str()); } net_layer_file_report (net, img, prj); break; case GERBV_APERTURE_STATE_FLASH: if (layer_type != GERBV_LAYERTYPE_DRILL) g_message (_("Object type: Flashed aperture")); else g_message (_("Object type: Drill")); if (aperture_is_valid) { if (layer_type != GERBV_LAYERTYPE_DRILL) aperture_report(img->aperture, net->aperture, net->stop_x, net->stop_y, img, prj); else drill_report(img->aperture, net->aperture); } x = net->stop_x; y = net->stop_y; gerbv_transform_coord_for_image(&x, &y, img, prj); g_message (_(" Location: (%g, %g) %s"), screen_units(x), screen_units(y), screen_units_str()); net_layer_file_report (net, img, prj); break; } }
0
366,310
void mark_mounts_for_expiry(struct list_head *mounts) { struct mount *mnt, *next; LIST_HEAD(graveyard); if (list_empty(mounts)) return; namespace_lock(); lock_mount_hash(); /* extract from the expiration list every vfsmount that matches the * following criteria: * - only referenced by its parent vfsmount * - still marked for expiry (marked on the last call here; marks are * cleared by mntput()) */ list_for_each_entry_safe(mnt, next, mounts, mnt_expire) { if (!xchg(&mnt->mnt_expiry_mark, 1) || propagate_mount_busy(mnt, 1)) continue; list_move(&mnt->mnt_expire, &graveyard); } while (!list_empty(&graveyard)) { mnt = list_first_entry(&graveyard, struct mount, mnt_expire); touch_mnt_namespace(mnt->mnt_ns); umount_tree(mnt, UMOUNT_PROPAGATE|UMOUNT_SYNC); } unlock_mount_hash(); namespace_unlock(); }
0
508,802
Lex_input_stream::unescape(CHARSET_INFO *cs, char *to, const char *str, const char *end, int sep) { return my_unescape(cs, to, str, end, sep, m_thd->backslash_escapes()); }
0
512,919
my_decimal *val_decimal(my_decimal *to) { return update_null() ? 0 : cached_time.to_decimal(to); }
0
489,160
sctp_disposition_t sctp_sf_do_asconf_ack(const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands) { struct sctp_chunk *asconf_ack = arg; struct sctp_chunk *last_asconf = asoc->addip_last_asconf; struct sctp_chunk *abort; struct sctp_paramhdr *err_param = NULL; sctp_addiphdr_t *addip_hdr; __u32 sent_serial, rcvd_serial; if (!sctp_vtag_verify(asconf_ack, asoc)) { sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_BAD_TAG, SCTP_NULL()); return sctp_sf_pdiscard(ep, asoc, type, arg, commands); } /* ADD-IP, Section 4.1.2: * This chunk MUST be sent in an authenticated way by using * the mechanism defined in [I-D.ietf-tsvwg-sctp-auth]. If this chunk * is received unauthenticated it MUST be silently discarded as * described in [I-D.ietf-tsvwg-sctp-auth]. */ if (!sctp_addip_noauth && !asconf_ack->auth) return sctp_sf_discard_chunk(ep, asoc, type, arg, commands); /* Make sure that the ADDIP chunk has a valid length. */ if (!sctp_chunk_length_valid(asconf_ack, sizeof(sctp_addip_chunk_t))) return sctp_sf_violation_chunklen(ep, asoc, type, arg, commands); addip_hdr = (sctp_addiphdr_t *)asconf_ack->skb->data; rcvd_serial = ntohl(addip_hdr->serial); /* Verify the ASCONF-ACK chunk before processing it. */ if (!sctp_verify_asconf(asoc, (sctp_paramhdr_t *)addip_hdr->params, (void *)asconf_ack->chunk_end, &err_param)) return sctp_sf_violation_paramlen(ep, asoc, type, arg, (void *)err_param, commands); if (last_asconf) { addip_hdr = (sctp_addiphdr_t *)last_asconf->subh.addip_hdr; sent_serial = ntohl(addip_hdr->serial); } else { sent_serial = asoc->addip_serial - 1; } /* D0) If an endpoint receives an ASCONF-ACK that is greater than or * equal to the next serial number to be used but no ASCONF chunk is * outstanding the endpoint MUST ABORT the association. Note that a * sequence number is greater than if it is no more than 2^^31-1 * larger than the current sequence number (using serial arithmetic). */ if (ADDIP_SERIAL_gte(rcvd_serial, sent_serial + 1) && !(asoc->addip_last_asconf)) { abort = sctp_make_abort(asoc, asconf_ack, sizeof(sctp_errhdr_t)); if (abort) { sctp_init_cause(abort, SCTP_ERROR_ASCONF_ACK, 0); sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort)); } /* We are going to ABORT, so we might as well stop * processing the rest of the chunks in the packet. */ sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP, SCTP_TO(SCTP_EVENT_TIMEOUT_T4_RTO)); sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET,SCTP_NULL()); sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, SCTP_ERROR(ECONNABORTED)); sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, SCTP_PERR(SCTP_ERROR_ASCONF_ACK)); SCTP_INC_STATS(SCTP_MIB_ABORTEDS); SCTP_DEC_STATS(SCTP_MIB_CURRESTAB); return SCTP_DISPOSITION_ABORT; } if ((rcvd_serial == sent_serial) && asoc->addip_last_asconf) { sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP, SCTP_TO(SCTP_EVENT_TIMEOUT_T4_RTO)); if (!sctp_process_asconf_ack((struct sctp_association *)asoc, asconf_ack)) return SCTP_DISPOSITION_CONSUME; abort = sctp_make_abort(asoc, asconf_ack, sizeof(sctp_errhdr_t)); if (abort) { sctp_init_cause(abort, SCTP_ERROR_RSRC_LOW, 0); sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort)); } /* We are going to ABORT, so we might as well stop * processing the rest of the chunks in the packet. */ sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET,SCTP_NULL()); sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, SCTP_ERROR(ECONNABORTED)); sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, SCTP_PERR(SCTP_ERROR_ASCONF_ACK)); SCTP_INC_STATS(SCTP_MIB_ABORTEDS); SCTP_DEC_STATS(SCTP_MIB_CURRESTAB); return SCTP_DISPOSITION_ABORT; } return SCTP_DISPOSITION_DISCARD; }
0
238,823
cmdline_search_stat( int dirc, pos_T *pos, pos_T *cursor_pos, int show_top_bot_msg, char_u *msgbuf, int recompute, int maxcount, long timeout) { searchstat_T stat; update_search_stat(dirc, pos, cursor_pos, &stat, recompute, maxcount, timeout); if (stat.cur > 0) { char t[SEARCH_STAT_BUF_LEN]; size_t len; #ifdef FEAT_RIGHTLEFT if (curwin->w_p_rl && *curwin->w_p_rlc == 's') { if (stat.incomplete == 1) vim_snprintf(t, SEARCH_STAT_BUF_LEN, "[?/??]"); else if (stat.cnt > maxcount && stat.cur > maxcount) vim_snprintf(t, SEARCH_STAT_BUF_LEN, "[>%d/>%d]", maxcount, maxcount); else if (stat.cnt > maxcount) vim_snprintf(t, SEARCH_STAT_BUF_LEN, "[>%d/%d]", maxcount, stat.cur); else vim_snprintf(t, SEARCH_STAT_BUF_LEN, "[%d/%d]", stat.cnt, stat.cur); } else #endif { if (stat.incomplete == 1) vim_snprintf(t, SEARCH_STAT_BUF_LEN, "[?/??]"); else if (stat.cnt > maxcount && stat.cur > maxcount) vim_snprintf(t, SEARCH_STAT_BUF_LEN, "[>%d/>%d]", maxcount, maxcount); else if (stat.cnt > maxcount) vim_snprintf(t, SEARCH_STAT_BUF_LEN, "[%d/>%d]", stat.cur, maxcount); else vim_snprintf(t, SEARCH_STAT_BUF_LEN, "[%d/%d]", stat.cur, stat.cnt); } len = STRLEN(t); if (show_top_bot_msg && len + 2 < SEARCH_STAT_BUF_LEN) { mch_memmove(t + 2, t, len); t[0] = 'W'; t[1] = ' '; len += 2; } mch_memmove(msgbuf + STRLEN(msgbuf) - len, t, len); if (dirc == '?' && stat.cur == maxcount + 1) stat.cur = -1; // keep the message even after redraw, but don't put in history msg_hist_off = TRUE; give_warning(msgbuf, FALSE); msg_hist_off = FALSE; } }
0