idx
int64
func
string
target
int64
327,170
int qcow2_update_header(BlockDriverState *bs) BDRVQcowState *s = bs->opaque; QCowHeader *header; char *buf; size_t buflen = s->cluster_size; int ret; uint64_t total_size; uint32_t refcount_table_clusters; size_t header_length; Qcow2UnknownHeaderExtension *uext; buf = qemu_blockalign(bs, buflen); /* Header structure */ header = (QCowHeader*) buf; if (buflen < sizeof(*header)) { ret = -ENOSPC; goto fail; } header_length = sizeof(*header) + s->unknown_header_fields_size; total_size = bs->total_sectors * BDRV_SECTOR_SIZE; refcount_table_clusters = s->refcount_table_size >> (s->cluster_bits - 3); *header = (QCowHeader) { /* Version 2 fields */ .magic = cpu_to_be32(QCOW_MAGIC), .version = cpu_to_be32(s->qcow_version), .backing_file_offset = 0, .backing_file_size = 0, .cluster_bits = cpu_to_be32(s->cluster_bits), .size = cpu_to_be64(total_size), .crypt_method = cpu_to_be32(s->crypt_method_header), .l1_size = cpu_to_be32(s->l1_size), .l1_table_offset = cpu_to_be64(s->l1_table_offset), .refcount_table_offset = cpu_to_be64(s->refcount_table_offset), .refcount_table_clusters = cpu_to_be32(refcount_table_clusters), .nb_snapshots = cpu_to_be32(s->nb_snapshots), .snapshots_offset = cpu_to_be64(s->snapshots_offset), /* Version 3 fields */ .incompatible_features = cpu_to_be64(s->incompatible_features), .compatible_features = cpu_to_be64(s->compatible_features), .autoclear_features = cpu_to_be64(s->autoclear_features), .refcount_order = cpu_to_be32(3 + REFCOUNT_SHIFT), .header_length = cpu_to_be32(header_length), }; /* For older versions, write a shorter header */ switch (s->qcow_version) { case 2: ret = offsetof(QCowHeader, incompatible_features); break; case 3: ret = sizeof(*header); break; default: ret = -EINVAL; goto fail; } buf += ret; buflen -= ret; memset(buf, 0, buflen); /* Preserve any unknown field in the header */ if (s->unknown_header_fields_size) { if (buflen < s->unknown_header_fields_size) { ret = -ENOSPC; goto fail; } memcpy(buf, s->unknown_header_fields, s->unknown_header_fields_size); buf += s->unknown_header_fields_size; buflen -= s->unknown_header_fields_size; } /* Backing file format header extension */ if (*bs->backing_format) { ret = header_ext_add(buf, QCOW2_EXT_MAGIC_BACKING_FORMAT, bs->backing_format, strlen(bs->backing_format), buflen); if (ret < 0) { goto fail; } buf += ret; buflen -= ret; } /* Feature table */ Qcow2Feature features[] = { .bit = QCOW2_INCOMPAT_DIRTY_BITNR, .name = "dirty bit", .type = QCOW2_FEAT_TYPE_COMPATIBLE, .bit = QCOW2_COMPAT_LAZY_REFCOUNTS_BITNR, .name = "lazy refcounts", }; ret = header_ext_add(buf, QCOW2_EXT_MAGIC_FEATURE_TABLE, features, sizeof(features), buflen); if (ret < 0) { goto fail; } buf += ret; buflen -= ret; /* Keep unknown header extensions */ QLIST_FOREACH(uext, &s->unknown_header_ext, next) { ret = header_ext_add(buf, uext->magic, uext->data, uext->len, buflen); if (ret < 0) { goto fail; } buf += ret; buflen -= ret; } /* End of header extensions */ ret = header_ext_add(buf, QCOW2_EXT_MAGIC_END, NULL, 0, buflen); if (ret < 0) { goto fail; } buf += ret; buflen -= ret; /* Backing file name */ if (*bs->backing_file) { size_t backing_file_len = strlen(bs->backing_file); if (buflen < backing_file_len) { ret = -ENOSPC; goto fail; } /* Using strncpy is ok here, since buf is not NUL-terminated. */ strncpy(buf, bs->backing_file, buflen); header->backing_file_offset = cpu_to_be64(buf - ((char*) header)); header->backing_file_size = cpu_to_be32(backing_file_len); } /* Write the new header */ ret = bdrv_pwrite(bs->file, 0, header, s->cluster_size); if (ret < 0) { goto fail; } ret = 0; fail: qemu_vfree(header); return ret; }
1
175,692
bool InputHandler::setSpannableTextAndRelativeCursor(spannable_string_t* spannableString, int relativeCursorPosition, bool markTextAsComposing) { InputLog(LogLevelInfo, "InputHandler::setSpannableTextAndRelativeCursor(%d, %d, %d)", spannableString->length, relativeCursorPosition, markTextAsComposing); int insertionPoint = compositionActive() ? m_composingTextStart : selectionStart(); ProcessingChangeGuard guard(this); if (!setText(spannableString)) return false; if (!setTextAttributes(insertionPoint, spannableString)) return false; if (!setRelativeCursorPosition(insertionPoint, relativeCursorPosition)) return false; if (markTextAsComposing) { m_composingTextStart = insertionPoint; m_composingTextEnd = insertionPoint + spannableString->length; } return true; }
0
12,062
int test_sqr(BIO *bp, BN_CTX *ctx) { BIGNUM a,c,d,e; int i; BN_init(&a); BN_init(&c); BN_init(&d); BN_init(&e); for (i=0; i<num0; i++) { BN_bntest_rand(&a,40+i*10,0,0); a.neg=rand_neg(); BN_sqr(&c,&a,ctx); if (bp != NULL) { if (!results) { BN_print(bp,&a); BIO_puts(bp," * "); BN_print(bp,&a); BIO_puts(bp," - "); } BN_print(bp,&c); BIO_puts(bp,"\n"); } BN_div(&d,&e,&c,&a,ctx); BN_sub(&d,&d,&a); if(!BN_is_zero(&d) || !BN_is_zero(&e)) { fprintf(stderr,"Square test failed!\n"); return 0; } } BN_free(&a); BN_free(&c); BN_free(&d); BN_free(&e); return(1); }
1
299,925
static string getRubberWhaleFrame2() { return getDataDir() + "optflow/RubberWhale2.png"; }
0
192,848
IV_API_CALL_STATUS_T impeg2d_api_function (iv_obj_t *ps_dechdl, void *pv_api_ip,void *pv_api_op) { WORD32 i4_cmd; IV_API_CALL_STATUS_T u4_error_code; UWORD32 *pu4_api_ip; u4_error_code = impeg2d_api_check_struct_sanity(ps_dechdl,pv_api_ip,pv_api_op); if(IV_SUCCESS != u4_error_code) { return u4_error_code; } pu4_api_ip = (UWORD32 *)pv_api_ip; i4_cmd = *(pu4_api_ip + 1); switch(i4_cmd) { case IV_CMD_GET_NUM_MEM_REC: u4_error_code = impeg2d_api_num_mem_rec((void *)pv_api_ip,(void *)pv_api_op); break; case IV_CMD_FILL_NUM_MEM_REC: u4_error_code = impeg2d_api_fill_mem_rec((void *)pv_api_ip,(void *)pv_api_op); break; case IV_CMD_INIT: u4_error_code = impeg2d_api_init(ps_dechdl,(void *)pv_api_ip,(void *)pv_api_op); break; case IVD_CMD_SET_DISPLAY_FRAME: u4_error_code = impeg2d_api_set_display_frame(ps_dechdl,(void *)pv_api_ip,(void *)pv_api_op); break; case IVD_CMD_REL_DISPLAY_FRAME: u4_error_code = impeg2d_api_rel_display_frame(ps_dechdl,(void *)pv_api_ip,(void *)pv_api_op); break; case IVD_CMD_VIDEO_DECODE: u4_error_code = impeg2d_api_entity(ps_dechdl, (void *)pv_api_ip,(void *)pv_api_op); break; case IV_CMD_RETRIEVE_MEMREC: u4_error_code = impeg2d_api_retrieve_mem_rec(ps_dechdl,(void *)pv_api_ip,(void *)pv_api_op); break; case IVD_CMD_VIDEO_CTL: u4_error_code = impeg2d_api_ctl(ps_dechdl,(void *)pv_api_ip,(void *)pv_api_op); break; default: break; } return(u4_error_code); }
0
308,818
static XHCIEPContext *xhci_alloc_epctx(XHCIState *xhci, unsigned int slotid, unsigned int epid) { XHCIEPContext *epctx; int i; epctx = g_new0(XHCIEPContext, 1); epctx->xhci = xhci; epctx->slotid = slotid; epctx->epid = epid; for (i = 0; i < ARRAY_SIZE(epctx->transfers); i++) { epctx->transfers[i].xhci = xhci; epctx->transfers[i].slotid = slotid; epctx->transfers[i].epid = epid; usb_packet_init(&epctx->transfers[i].packet); } epctx->kick_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, xhci_ep_kick_timer, epctx); return epctx; }
0
159,576
STATIC void S_ssc_finalize(pTHX_ RExC_state_t *pRExC_state, regnode_ssc *ssc) { /* The inversion list in the SSC is marked mortal; now we need a more * permanent copy, which is stored the same way that is done in a regular * ANYOF node, with the first NUM_ANYOF_CODE_POINTS code points in a bit * map */ SV* invlist = invlist_clone(ssc->invlist, NULL); PERL_ARGS_ASSERT_SSC_FINALIZE; assert(is_ANYOF_SYNTHETIC(ssc)); /* The code in this file assumes that all but these flags aren't relevant * to the SSC, except SSC_MATCHES_EMPTY_STRING, which should be cleared * by the time we reach here */ assert(! (ANYOF_FLAGS(ssc) & ~( ANYOF_COMMON_FLAGS |ANYOF_SHARED_d_MATCHES_ALL_NON_UTF8_NON_ASCII_non_d_WARN_SUPER |ANYOF_SHARED_d_UPPER_LATIN1_UTF8_STRING_MATCHES_non_d_RUNTIME_USER_PROP))); populate_ANYOF_from_invlist( (regnode *) ssc, &invlist); set_ANYOF_arg(pRExC_state, (regnode *) ssc, invlist, NULL, NULL); /* Make sure is clone-safe */ ssc->invlist = NULL; if (ANYOF_POSIXL_SSC_TEST_ANY_SET(ssc)) { ANYOF_FLAGS(ssc) |= ANYOF_MATCHES_POSIXL; OP(ssc) = ANYOFPOSIXL; } else if (RExC_contains_locale) { OP(ssc) = ANYOFL; } assert(! (ANYOF_FLAGS(ssc) & ANYOF_LOCALE_FLAGS) || RExC_contains_locale);
0
26,349
X509_CRL * d2i_X509_CRL_bio ( BIO * bp , X509_CRL * * crl ) { return ASN1_item_d2i_bio ( ASN1_ITEM_rptr ( X509_CRL ) , bp , crl ) ; }
0
189,065
bool PasswordAutofillAgent::DidClearAutofillSelection( const WebFormControlElement& control_element) { const WebInputElement* element = ToWebInputElement(&control_element); if (!element) return false; WebInputElement username_element; WebInputElement password_element; PasswordInfo* password_info; if (!FindPasswordInfoForElement(*element, &username_element, &password_element, &password_info)) { return false; } ClearPreview(&username_element, &password_element); return true; }
0
401,311
cr_input_set_line_num (CRInput * a_this, glong a_line_num) { g_return_val_if_fail (a_this && PRIVATE (a_this), CR_BAD_PARAM_ERROR); PRIVATE (a_this)->line = a_line_num; return CR_OK; }
0
509,880
com_status(String *buffer __attribute__((unused)), char *line __attribute__((unused))) { const char *status_str; char buff[40]; ulonglong id; MYSQL_RES *result; LINT_INIT(result); if (mysql_real_query_for_lazy( C_STRING_WITH_LEN("select DATABASE(), USER() limit 1"))) return 0; tee_puts("--------------", stdout); usage(1); /* Print version */ tee_fprintf(stdout, "\nConnection id:\t\t%lu\n",mysql_thread_id(&mysql)); /* Don't remove "limit 1", it is protection againts SQL_SELECT_LIMIT=0 */ if (!mysql_store_result_for_lazy(&result)) { MYSQL_ROW cur=mysql_fetch_row(result); if (cur) { tee_fprintf(stdout, "Current database:\t%s\n", cur[0] ? cur[0] : ""); tee_fprintf(stdout, "Current user:\t\t%s\n", cur[1]); } mysql_free_result(result); } #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) if ((status_str= mysql_get_ssl_cipher(&mysql))) tee_fprintf(stdout, "SSL:\t\t\tCipher in use is %s\n", status_str); else #endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */ tee_puts("SSL:\t\t\tNot in use", stdout); if (skip_updates) { my_vidattr(A_BOLD); tee_fprintf(stdout, "\nAll updates ignored to this database\n"); my_vidattr(A_NORMAL); } #ifdef USE_POPEN tee_fprintf(stdout, "Current pager:\t\t%s\n", pager); tee_fprintf(stdout, "Using outfile:\t\t'%s'\n", opt_outfile ? outfile : ""); #endif tee_fprintf(stdout, "Using delimiter:\t%s\n", delimiter); tee_fprintf(stdout, "Server:\t\t\t%s\n", mysql_get_server_name(&mysql)); tee_fprintf(stdout, "Server version:\t\t%s\n", server_version_string(&mysql)); tee_fprintf(stdout, "Protocol version:\t%d\n", mysql_get_proto_info(&mysql)); tee_fprintf(stdout, "Connection:\t\t%s\n", mysql_get_host_info(&mysql)); if ((id= mysql_insert_id(&mysql))) tee_fprintf(stdout, "Insert id:\t\t%s\n", llstr(id, buff)); /* "limit 1" is protection against SQL_SELECT_LIMIT=0 */ if (mysql_real_query_for_lazy(C_STRING_WITH_LEN( "select @@character_set_client, @@character_set_connection, " "@@character_set_server, @@character_set_database limit 1"))) { if (mysql_errno(&mysql) == CR_SERVER_GONE_ERROR) return 0; } if (!mysql_store_result_for_lazy(&result)) { MYSQL_ROW cur=mysql_fetch_row(result); if (cur) { tee_fprintf(stdout, "Server characterset:\t%s\n", cur[2] ? cur[2] : ""); tee_fprintf(stdout, "Db characterset:\t%s\n", cur[3] ? cur[3] : ""); tee_fprintf(stdout, "Client characterset:\t%s\n", cur[0] ? cur[0] : ""); tee_fprintf(stdout, "Conn. characterset:\t%s\n", cur[1] ? cur[1] : ""); } mysql_free_result(result); } else { /* Probably pre-4.1 server */ tee_fprintf(stdout, "Client characterset:\t%s\n", charset_info->csname); tee_fprintf(stdout, "Server characterset:\t%s\n", mysql.charset->csname); } #ifndef EMBEDDED_LIBRARY if (strstr(mysql_get_host_info(&mysql),"TCP/IP") || ! mysql.unix_socket) tee_fprintf(stdout, "TCP port:\t\t%d\n", mysql.port); else tee_fprintf(stdout, "UNIX socket:\t\t%s\n", mysql.unix_socket); if (mysql.net.compress) tee_fprintf(stdout, "Protocol:\t\tCompressed\n"); #endif if ((status_str= mysql_stat(&mysql)) && !mysql_error(&mysql)[0]) { ulong sec; const char *pos= strchr(status_str,' '); /* print label */ tee_fprintf(stdout, "%.*s\t\t\t", (int) (pos-status_str), status_str); if ((status_str= str2int(pos,10,0,LONG_MAX,(long*) &sec))) { nice_time((double) sec,buff,0); tee_puts(buff, stdout); /* print nice time */ while (*status_str == ' ') status_str++; /* to next info */ tee_putc('\n', stdout); tee_puts(status_str, stdout); } } if (safe_updates) { my_vidattr(A_BOLD); tee_fprintf(stdout, "\nNote that you are running in safe_update_mode:\n"); my_vidattr(A_NORMAL); tee_fprintf(stdout, "\ UPDATEs and DELETEs that don't use a key in the WHERE clause are not allowed.\n\ (One can force an UPDATE/DELETE by adding LIMIT # at the end of the command.)\n\ SELECT has an automatic 'LIMIT %lu' if LIMIT is not used.\n\ Max number of examined row combination in a join is set to: %lu\n\n", select_limit, max_join_size); } tee_puts("--------------\n", stdout); return 0; }
0
141,925
static void srpt_get_svc_entries(u64 ioc_guid, u16 slot, u8 hi, u8 lo, struct ib_dm_mad *mad) { struct ib_dm_svc_entries *svc_entries; WARN_ON(!ioc_guid); if (!slot || slot > 16) { mad->mad_hdr.status = cpu_to_be16(DM_MAD_STATUS_INVALID_FIELD); return; } if (slot > 2 || lo > hi || hi > 1) { mad->mad_hdr.status = cpu_to_be16(DM_MAD_STATUS_NO_IOC); return; } svc_entries = (struct ib_dm_svc_entries *)mad->data; memset(svc_entries, 0, sizeof *svc_entries); svc_entries->service_entries[0].id = cpu_to_be64(ioc_guid); snprintf(svc_entries->service_entries[0].name, sizeof(svc_entries->service_entries[0].name), "%s%016llx", SRP_SERVICE_NAME_PREFIX, ioc_guid); mad->mad_hdr.status = 0; }
0
319,781
static inline int get_ue_code(GetBitContext *gb, int order) { if (order) { int ret = get_ue_golomb(gb) << order; return ret + get_bits(gb, order); } return get_ue_golomb(gb); }
1
508,522
BIO *SSL_get_wbio(const SSL *s) { return (s->wbio); }
0
252,220
static int DecodeIPV6FragTest01 (void) { uint8_t raw_frag1[] = { 0x60, 0x0f, 0x1a, 0xcf, 0x05, 0xa8, 0x2c, 0x36, 0x20, 0x01, 0x04, 0x70, 0x00, 0x01, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x01, 0x09, 0x80, 0x32, 0xb2, 0x00, 0x01, 0x2e, 0x41, 0x38, 0xff, 0xfe, 0xa7, 0xea, 0xeb, 0x06, 0x00, 0x00, 0x01, 0xdf, 0xf8, 0x11, 0xd7, 0x00, 0x50, 0xa6, 0x5c, 0xcc, 0xd7, 0x28, 0x9f, 0xc3, 0x34, 0xc6, 0x58, 0x80, 0x10, 0x20, 0x13, 0x18, 0x1f, 0x00, 0x00, 0x01, 0x01, 0x08, 0x0a, 0xcd, 0xf9, 0x3a, 0x41, 0x00, 0x1a, 0x91, 0x8a, 0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x31, 0x20, 0x32, 0x30, 0x30, 0x20, 0x4f, 0x4b, 0x0d, 0x0a, 0x44, 0x61, 0x74, 0x65, 0x3a, 0x20, 0x46, 0x72, 0x69, 0x2c, 0x20, 0x30, 0x32, 0x20, 0x44, 0x65, 0x63, 0x20, 0x32, 0x30, 0x31, 0x31, 0x20, 0x30, 0x38, 0x3a, 0x33, 0x32, 0x3a, 0x35, 0x37, 0x20, 0x47, 0x4d, 0x54, 0x0d, 0x0a, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x3a, 0x20, 0x41, 0x70, 0x61, 0x63, 0x68, 0x65, 0x0d, 0x0a, 0x43, 0x61, 0x63, 0x68, 0x65, 0x2d, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x3a, 0x20, 0x6e, 0x6f, 0x2d, 0x63, 0x61, 0x63, 0x68, 0x65, 0x0d, 0x0a, 0x50, 0x72, 0x61, 0x67, 0x6d, 0x61, 0x3a, 0x20, 0x6e, 0x6f, 0x2d, 0x63, 0x61, 0x63, 0x68, 0x65, 0x0d, 0x0a, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x3a, 0x20, 0x54, 0x68, 0x75, 0x2c, 0x20, 0x30, 0x31, 0x20, 0x4a, 0x61, 0x6e, 0x20, 0x31, 0x39, 0x37, 0x31, 0x20, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x3a, 0x30, 0x30, 0x20, 0x47, 0x4d, 0x54, 0x0d, 0x0a, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x3a, 0x20, 0x31, 0x35, 0x39, 0x39, 0x0d, 0x0a, 0x4b, 0x65, 0x65, 0x70, 0x2d, 0x41, 0x6c, 0x69, 0x76, 0x65, 0x3a, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x3d, 0x35, 0x2c, 0x20, 0x6d, 0x61, 0x78, 0x3d, 0x39, 0x39, 0x0d, 0x0a, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x4b, 0x65, 0x65, 0x70, 0x2d, 0x41, 0x6c, 0x69, 0x76, 0x65, 0x0d, 0x0a, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x61, 0x76, 0x61, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x3b, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, 0x74, 0x3d, 0x61, 0x73, 0x63, 0x69, 0x69, 0x0d, 0x0a, 0x0d, 0x0a, 0x5f, 0x6a, 0x71, 0x6a, 0x73, 0x70, 0x28, 0x7b, 0x22, 0x69, 0x70, 0x22, 0x3a, 0x22, 0x32, 0x30, 0x30, 0x31, 0x3a, 0x39, 0x38, 0x30, 0x3a, 0x33, 0x32, 0x62, 0x32, 0x3a, 0x31, 0x3a, 0x32, 0x65, 0x34, 0x31, 0x3a, 0x33, 0x38, 0x66, 0x66, 0x3a, 0x66, 0x65, 0x61, 0x37, 0x3a, 0x65, 0x61, 0x65, 0x62, 0x22, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x69, 0x70, 0x76, 0x36, 0x22, 0x2c, 0x22, 0x73, 0x75, 0x62, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x22, 0x2c, 0x22, 0x76, 0x69, 0x61, 0x22, 0x3a, 0x22, 0x22, 0x2c, 0x22, 0x70, 0x61, 0x64, 0x64, 0x69, 0x6e, 0x67, 0x22, 0x3a, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, }; uint8_t raw_frag2[] = { 0x60, 0x0f, 0x1a, 0xcf, 0x00, 0x1c, 0x2c, 0x36, 0x20, 0x01, 0x04, 0x70, 0x00, 0x01, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x01, 0x09, 0x80, 0x32, 0xb2, 0x00, 0x01, 0x2e, 0x41, 0x38, 0xff, 0xfe, 0xa7, 0xea, 0xeb, 0x06, 0x00, 0x05, 0xa0, 0xdf, 0xf8, 0x11, 0xd7, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, }; Packet *pkt; Packet *p1 = PacketGetFromAlloc(); if (unlikely(p1 == NULL)) return 0; Packet *p2 = PacketGetFromAlloc(); if (unlikely(p2 == NULL)) { SCFree(p1); return 0; } ThreadVars tv; DecodeThreadVars dtv; int result = 0; PacketQueue pq; FlowInitConfig(FLOW_QUIET); DefragInit(); memset(&pq, 0, sizeof(PacketQueue)); memset(&tv, 0, sizeof(ThreadVars)); memset(&dtv, 0, sizeof(DecodeThreadVars)); PacketCopyData(p1, raw_frag1, sizeof(raw_frag1)); PacketCopyData(p2, raw_frag2, sizeof(raw_frag2)); DecodeIPV6(&tv, &dtv, p1, GET_PKT_DATA(p1), GET_PKT_LEN(p1), &pq); if (!(IPV6_EXTHDR_ISSET_FH(p1))) { printf("ipv6 frag header not detected: "); goto end; } DecodeIPV6(&tv, &dtv, p2, GET_PKT_DATA(p2), GET_PKT_LEN(p2), &pq); if (!(IPV6_EXTHDR_ISSET_FH(p2))) { printf("ipv6 frag header not detected: "); goto end; } if (pq.len != 1) { printf("no reassembled packet: "); goto end; } result = 1; end: PACKET_RECYCLE(p1); PACKET_RECYCLE(p2); SCFree(p1); SCFree(p2); pkt = PacketDequeue(&pq); while (pkt != NULL) { PACKET_RECYCLE(pkt); SCFree(pkt); pkt = PacketDequeue(&pq); } DefragDestroy(); FlowShutdown(); return result; }
0
226,139
void DisplayItemList::commitNewDisplayItems(GraphicsLayer* graphicsLayer) { TRACE_EVENT2("blink,benchmark", "DisplayItemList::commitNewDisplayItems", "current_display_list_size", (int)m_currentDisplayItems.size(), "num_non_cached_new_items", (int)m_newDisplayItems.size() - m_numCachedItems); if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()) { for (const auto& invalidation : m_invalidations) graphicsLayer->setNeedsDisplayInRect(invalidation.rect, invalidation.invalidationReason); m_invalidations.clear(); } ASSERT(m_scopeStack.isEmpty()); m_scopeStack.clear(); m_nextScope = 1; ASSERT(!skippingCache()); #if ENABLE(ASSERT) m_newDisplayItemIndicesByClient.clear(); #endif if (m_currentDisplayItems.isEmpty()) { #if ENABLE(ASSERT) for (const auto& item : m_newDisplayItems) ASSERT(!item.isCached()); #endif m_currentDisplayItems.swap(m_newDisplayItems); m_currentPaintChunks = m_newPaintChunks.releasePaintChunks(); m_validlyCachedClientsDirty = true; m_numCachedItems = 0; return; } updateValidlyCachedClientsIfNeeded(); OutOfOrderIndexContext outOfOrderIndexContext(m_currentDisplayItems.begin()); DisplayItems updatedList(std::max(m_currentDisplayItems.usedCapacityInBytes(), m_newDisplayItems.usedCapacityInBytes())); Vector<PaintChunk> updatedPaintChunks; DisplayItems::iterator currentIt = m_currentDisplayItems.begin(); DisplayItems::iterator currentEnd = m_currentDisplayItems.end(); for (DisplayItems::iterator newIt = m_newDisplayItems.begin(); newIt != m_newDisplayItems.end(); ++newIt) { const DisplayItem& newDisplayItem = *newIt; const DisplayItem::Id newDisplayItemId = newDisplayItem.nonCachedId(); bool newDisplayItemHasCachedType = newDisplayItem.type() != newDisplayItemId.type; bool isSynchronized = currentIt != currentEnd && newDisplayItemId.matches(*currentIt); if (newDisplayItemHasCachedType) { ASSERT(newDisplayItem.isCached()); ASSERT(clientCacheIsValid(newDisplayItem.client()) || (RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && !paintOffsetWasInvalidated(newDisplayItem.client()))); if (!isSynchronized) { currentIt = findOutOfOrderCachedItem(newDisplayItemId, outOfOrderIndexContext); if (currentIt == currentEnd) { #ifndef NDEBUG showDebugData(); WTFLogAlways("%s not found in m_currentDisplayItems\n", newDisplayItem.asDebugString().utf8().data()); #endif ASSERT_NOT_REACHED(); continue; } } #if ENABLE(ASSERT) if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled()) { DisplayItems::iterator temp = currentIt; checkUnderInvalidation(newIt, temp); } #endif if (newDisplayItem.isCachedDrawing()) { updatedList.appendByMoving(*currentIt); ++currentIt; } else { ASSERT(newDisplayItem.isCachedSubsequence()); copyCachedSubsequence(currentIt, updatedList); ASSERT(updatedList.last().isEndSubsequence()); } } else { ASSERT(!newDisplayItem.isDrawing() || newDisplayItem.skippedCache() || !clientCacheIsValid(newDisplayItem.client()) || (RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && paintOffsetWasInvalidated(newDisplayItem.client()))); updatedList.appendByMoving(*newIt); if (isSynchronized) ++currentIt; } if (currentIt - outOfOrderIndexContext.nextItemToIndex > 0) outOfOrderIndexContext.nextItemToIndex = currentIt; } #if ENABLE(ASSERT) if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled()) checkNoRemainingCachedDisplayItems(); #endif // ENABLE(ASSERT) // TODO(jbroman): When subsequence caching applies to SPv2, we'll need to // merge the paint chunks as well. m_currentPaintChunks = m_newPaintChunks.releasePaintChunks(); m_newDisplayItems.clear(); m_validlyCachedClientsDirty = true; m_currentDisplayItems.swap(updatedList); m_numCachedItems = 0; #if ENABLE(ASSERT) m_clientsWithPaintOffsetInvalidations.clear(); #endif }
0
432,890
backend_can_flush (struct backend *b, struct connection *conn) { struct b_conn_handle *h = &conn->handles[b->i]; debug ("%s: can_flush", b->name); if (h->can_flush == -1) h->can_flush = b->can_flush (b, conn); return h->can_flush; }
0
270,452
OpGradFactory* GetOpGradFactory() { static OpGradFactory* factory = new OpGradFactory; return factory; }
0
87,704
megasas_check_reset_ppc(struct megasas_instance *instance, struct megasas_register_set __iomem *regs) { if (atomic_read(&instance->adprecovery) != MEGASAS_HBA_OPERATIONAL) return 1; return 0; }
0
383,244
dbg_search_packet (IOBUF inp, PACKET * pkt, off_t * retpos, int with_uid, const char *dbg_f, int dbg_l) { int skip, rc; do { rc = parse (inp, pkt, with_uid ? 2 : 1, retpos, &skip, NULL, 0, "search", dbg_f, dbg_l); } while (skip); return rc; }
0
241,549
void ObserveKeychainEvents() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); net::CertDatabase::GetInstance()->SetMessageLoopForKeychainEvents(); }
0
137,646
void ipv6FlushDnsServerList(NetInterface *interface) { //Clear the list of DNS servers osMemset(interface->ipv6Context.dnsServerList, 0, sizeof(interface->ipv6Context.dnsServerList)); }
0
150,618
static void ext4_map_blocks_es_recheck(handle_t *handle, struct inode *inode, struct ext4_map_blocks *es_map, struct ext4_map_blocks *map, int flags) { int retval; map->m_flags = 0; /* * There is a race window that the result is not the same. * e.g. xfstests #223 when dioread_nolock enables. The reason * is that we lookup a block mapping in extent status tree with * out taking i_data_sem. So at the time the unwritten extent * could be converted. */ if (!(flags & EXT4_GET_BLOCKS_NO_LOCK)) down_read(&EXT4_I(inode)->i_data_sem); if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) { retval = ext4_ext_map_blocks(handle, inode, map, flags & EXT4_GET_BLOCKS_KEEP_SIZE); } else { retval = ext4_ind_map_blocks(handle, inode, map, flags & EXT4_GET_BLOCKS_KEEP_SIZE); } if (!(flags & EXT4_GET_BLOCKS_NO_LOCK)) up_read((&EXT4_I(inode)->i_data_sem)); /* * We don't check m_len because extent will be collpased in status * tree. So the m_len might not equal. */ if (es_map->m_lblk != map->m_lblk || es_map->m_flags != map->m_flags || es_map->m_pblk != map->m_pblk) { printk("ES cache assertion failed for inode: %lu " "es_cached ex [%d/%d/%llu/%x] != " "found ex [%d/%d/%llu/%x] retval %d flags %x\n", inode->i_ino, es_map->m_lblk, es_map->m_len, es_map->m_pblk, es_map->m_flags, map->m_lblk, map->m_len, map->m_pblk, map->m_flags, retval, flags); } }
0
30,249
void * TSHttpTxnArgGet ( TSHttpTxn txnp , int arg_idx ) { sdk_assert ( sdk_sanity_check_txn ( txnp ) == TS_SUCCESS ) ; sdk_assert ( arg_idx >= 0 && arg_idx < HTTP_SSN_TXN_MAX_USER_ARG ) ; HttpSM * sm = ( HttpSM * ) txnp ; return sm -> t_state . user_args [ arg_idx ] ; }
0
28,043
static void super_block_uvrd ( const VP9_COMP * cpi , MACROBLOCK * x , int * rate , int64_t * distortion , int * skippable , int64_t * sse , BLOCK_SIZE bsize , int64_t ref_best_rd ) { MACROBLOCKD * const xd = & x -> e_mbd ; MB_MODE_INFO * const mbmi = & xd -> mi [ 0 ] . src_mi -> mbmi ; const TX_SIZE uv_tx_size = get_uv_tx_size ( mbmi , & xd -> plane [ 1 ] ) ; int plane ; int pnrate = 0 , pnskip = 1 ; int64_t pndist = 0 , pnsse = 0 ; if ( ref_best_rd < 0 ) goto term ; if ( is_inter_block ( mbmi ) ) { int plane ; for ( plane = 1 ; plane < MAX_MB_PLANE ; ++ plane ) vp9_subtract_plane ( x , bsize , plane ) ; } * rate = 0 ; * distortion = 0 ; * sse = 0 ; * skippable = 1 ; for ( plane = 1 ; plane < MAX_MB_PLANE ; ++ plane ) { txfm_rd_in_plane ( x , & pnrate , & pndist , & pnskip , & pnsse , ref_best_rd , plane , bsize , uv_tx_size , cpi -> sf . use_fast_coef_costing ) ; if ( pnrate == INT_MAX ) goto term ; * rate += pnrate ; * distortion += pndist ; * sse += pnsse ; * skippable &= pnskip ; } return ; term : * rate = INT_MAX ; * distortion = INT64_MAX ; * sse = INT64_MAX ; * skippable = 0 ; return ; }
0
412,572
pk_transaction_repo_enable (PkTransaction *transaction, GVariant *params, GDBusMethodInvocation *context) { gboolean ret; const gchar *repo_id; gboolean enabled; g_autoptr(GError) error = NULL; g_return_if_fail (PK_IS_TRANSACTION (transaction)); g_return_if_fail (transaction->priv->tid != NULL); g_variant_get (params, "(&sb)", &repo_id, &enabled); g_debug ("RepoEnable method called: %s, %i", repo_id, enabled); /* not implemented yet */ if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_REPO_ENABLE)) { g_set_error (&error, PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED, "RepoEnable not supported by backend"); pk_transaction_set_state (transaction, PK_TRANSACTION_STATE_ERROR); goto out; } /* check for sanity */ ret = pk_transaction_strvalidate (repo_id, &error); if (!ret) { pk_transaction_set_state (transaction, PK_TRANSACTION_STATE_ERROR); goto out; } /* save so we can run later */ transaction->priv->cached_repo_id = g_strdup (repo_id); transaction->priv->cached_enabled = enabled; pk_transaction_set_role (transaction, PK_ROLE_ENUM_REPO_ENABLE); /* try to get authorization */ ret = pk_transaction_obtain_authorization (transaction, PK_ROLE_ENUM_REPO_ENABLE, &error); if (!ret) { pk_transaction_set_state (transaction, PK_TRANSACTION_STATE_ERROR); goto out; } out: pk_transaction_dbus_return (context, error); }
0
516,518
bool Alter_table_prelocking_strategy:: handle_table(THD *thd, Query_tables_list *prelocking_ctx, TABLE_LIST *table_list, bool *need_prelocking) { return FALSE; }
0
208,948
bool VerifyMAC(const std::string& key, const std::string& mac, const char* data, int data_length) { std::string key_copy = key; DecodeWebSafe(&key_copy); std::string decoded_key; base::Base64Decode(key_copy, &decoded_key); std::string mac_copy = mac; DecodeWebSafe(&mac_copy); std::string decoded_mac; base::Base64Decode(mac_copy, &decoded_mac); base::HMAC hmac(base::HMAC::SHA1); if (!hmac.Init(decoded_key)) return false; const std::string data_str(data, data_length); unsigned char digest[kSafeBrowsingMacDigestSize]; if (!hmac.Sign(data_str, digest, kSafeBrowsingMacDigestSize)) return false; return !memcmp(digest, decoded_mac.data(), kSafeBrowsingMacDigestSize); }
0
13,309
int main(int argc, char **argv) { u8 *byteStrmStart; u8 *byteStrm; u32 strmLen; u32 picSize; H264SwDecInst decInst; H264SwDecRet ret; H264SwDecInput decInput; H264SwDecOutput decOutput; H264SwDecPicture decPicture; H264SwDecInfo decInfo; u32 picNumber; FILE *finput; FILE *foutput; /* Check that enough command line arguments given, if not -> print usage * information out */ if (argc < 2) { printf( "Usage: %s file.h264\n", argv[0]); return -1; } /* open output file for writing, output file named out.yuv. If file open * fails -> exit */ foutput = fopen("out.yuv", "wb"); if (foutput == NULL) { printf("UNABLE TO OPEN OUTPUT FILE\n"); return -1; } /* open input file for reading, file name given by user. If file open * fails -> exit */ finput = fopen(argv[argc-1], "rb"); if (finput == NULL) { printf("UNABLE TO OPEN INPUT FILE\n"); return -1; } /* check size of the input file -> length of the stream in bytes */ fseek(finput, 0L, SEEK_END); strmLen = (u32)ftell(finput); rewind(finput); /* allocate memory for stream buffer, exit if unsuccessful */ byteStrm = byteStrmStart = (u8 *)H264SwDecMalloc(sizeof(u8)*strmLen); if (byteStrm == NULL) { printf("UNABLE TO ALLOCATE MEMORY\n"); return -1; } /* read input stream from file to buffer and close input file */ fread(byteStrm, sizeof(u8), strmLen, finput); fclose(finput); /* initialize decoder. If unsuccessful -> exit */ ret = H264SwDecInit(&decInst, 0); if (ret != H264SWDEC_OK) { printf("DECODER INITIALIZATION FAILED\n"); return -1; } /* initialize H264SwDecDecode() input structure */ decInput.pStream = byteStrmStart; decInput.dataLen = strmLen; decInput.intraConcealmentMethod = 0; picNumber = 0; /* For performance measurements, read the start time (in seconds) here. * The decoding time should be measured over several frames and after * that average fps (frames/second) can be calculated. * * startTime = GetTime(); * * To prevent calculating file I/O latensies as a decoding time, * comment out WriteOutput function call. Also prints to stdout might * consume considerable amount of cycles during measurement */ /* main decoding loop */ do { /* call API function to perform decoding */ ret = H264SwDecDecode(decInst, &decInput, &decOutput); switch(ret) { case H264SWDEC_HDRS_RDY_BUFF_NOT_EMPTY: /* picture dimensions are available for query now */ ret = H264SwDecGetInfo(decInst, &decInfo); if (ret != H264SWDEC_OK) return -1; /* picture size in pixels */ picSize = decInfo.picWidth * decInfo.picHeight; /* memory needed for YCbCr 4:2:0 picture in bytes */ picSize = (3 * picSize)/2; /* memory needed for 16-bit RGB picture in bytes * picSize = (decInfo.picWidth * decInfo.picHeight) * 2; */ printf("Width %d Height %d\n", decInfo.picWidth, decInfo.picHeight); /* update H264SwDecDecode() input structure, number of bytes * "consumed" is computed as difference between the new stream * pointer and old stream pointer */ decInput.dataLen -= (u32)(decOutput.pStrmCurrPos - decInput.pStream); decInput.pStream = decOutput.pStrmCurrPos; break; case H264SWDEC_PIC_RDY_BUFF_NOT_EMPTY: case H264SWDEC_PIC_RDY: /* update H264SwDecDecode() input structure, number of bytes * "consumed" is computed as difference between the new stream * pointer and old stream pointer */ decInput.dataLen -= (u32)(decOutput.pStrmCurrPos - decInput.pStream); decInput.pStream = decOutput.pStrmCurrPos; /* use function H264SwDecNextPicture() to obtain next picture * in display order. Function is called until no more images * are ready for display */ while (H264SwDecNextPicture(decInst, &decPicture, 0) == H264SWDEC_PIC_RDY) { picNumber++; printf("PIC %d, type %s, concealed %d\n", picNumber, decPicture.isIdrPicture ? "IDR" : "NON-IDR", decPicture.nbrOfErrMBs); fflush(stdout); /* Do color conversion if needed to get display image * in RGB-format * * YuvToRgb( decPicture.pOutputPicture, pRgbPicture ); */ /* write next display image to output file */ WriteOutput(foutput, (u8*)decPicture.pOutputPicture, picSize); } break; case H264SWDEC_EVALUATION_LIMIT_EXCEEDED: /* evaluation version of the decoder has limited decoding * capabilities */ printf("EVALUATION LIMIT REACHED\n"); goto end; default: printf("UNRECOVERABLE ERROR\n"); return -1; } /* keep decoding until all data from input stream buffer consumed */ } while (decInput.dataLen > 0); end: /* if output in display order is preferred, the decoder shall be forced * to output pictures remaining in decoded picture buffer. Use function * H264SwDecNextPicture() to obtain next picture in display order. Function * is called until no more images are ready for display. Second parameter * for the function is set to '1' to indicate that this is end of the * stream and all pictures shall be output */ while (H264SwDecNextPicture(decInst, &decPicture, 1) == H264SWDEC_PIC_RDY) { picNumber++; printf("PIC %d, type %s, concealed %d\n", picNumber, decPicture.isIdrPicture ? "IDR" : "NON-IDR", decPicture.nbrOfErrMBs); fflush(stdout); /* Do color conversion if needed to get display image * in RGB-format * * YuvToRgb( decPicture.pOutputPicture, pRgbPicture ); */ /* write next display image to output file */ WriteOutput(foutput, (u8*)decPicture.pOutputPicture, picSize); } /* For performance measurements, read the end time (in seconds) here. * * endTime = GetTime(); * * Now the performance can be calculated as frames per second: * fps = picNumber / (endTime - startTime); */ /* release decoder instance */ H264SwDecRelease(decInst); /* close output file */ fclose(foutput); /* free byte stream buffer */ free(byteStrmStart); return 0; }
1
274,799
void WebContents::Print(gin_helper::Arguments* args) { gin_helper::Dictionary options = gin::Dictionary::CreateEmpty(args->isolate()); base::Value settings(base::Value::Type::DICTIONARY); if (args->Length() >= 1 && !args->GetNext(&options)) { args->ThrowError("webContents.print(): Invalid print settings specified."); return; } printing::CompletionCallback callback; if (args->Length() == 2 && !args->GetNext(&callback)) { args->ThrowError( "webContents.print(): Invalid optional callback provided."); return; } // Set optional silent printing bool silent = false; options.Get("silent", &silent); bool print_background = false; options.Get("printBackground", &print_background); settings.SetBoolKey(printing::kSettingShouldPrintBackgrounds, print_background); // Set custom margin settings gin_helper::Dictionary margins = gin::Dictionary::CreateEmpty(args->isolate()); if (options.Get("margins", &margins)) { printing::MarginType margin_type = printing::DEFAULT_MARGINS; margins.Get("marginType", &margin_type); settings.SetIntKey(printing::kSettingMarginsType, margin_type); if (margin_type == printing::CUSTOM_MARGINS) { base::Value custom_margins(base::Value::Type::DICTIONARY); int top = 0; margins.Get("top", &top); custom_margins.SetIntKey(printing::kSettingMarginTop, top); int bottom = 0; margins.Get("bottom", &bottom); custom_margins.SetIntKey(printing::kSettingMarginBottom, bottom); int left = 0; margins.Get("left", &left); custom_margins.SetIntKey(printing::kSettingMarginLeft, left); int right = 0; margins.Get("right", &right); custom_margins.SetIntKey(printing::kSettingMarginRight, right); settings.SetPath(printing::kSettingMarginsCustom, std::move(custom_margins)); } } else { settings.SetIntKey(printing::kSettingMarginsType, printing::DEFAULT_MARGINS); } // Set whether to print color or greyscale bool print_color = true; options.Get("color", &print_color); int color_setting = print_color ? printing::COLOR : printing::GRAY; settings.SetIntKey(printing::kSettingColor, color_setting); // Is the orientation landscape or portrait. bool landscape = false; options.Get("landscape", &landscape); settings.SetBoolKey(printing::kSettingLandscape, landscape); // We set the default to the system's default printer and only update // if at the Chromium level if the user overrides. // Printer device name as opened by the OS. base::string16 device_name; options.Get("deviceName", &device_name); if (!device_name.empty() && !IsDeviceNameValid(device_name)) { args->ThrowError("webContents.print(): Invalid deviceName provided."); return; } int scale_factor = 100; options.Get("scaleFactor", &scale_factor); settings.SetIntKey(printing::kSettingScaleFactor, scale_factor); int pages_per_sheet = 1; options.Get("pagesPerSheet", &pages_per_sheet); settings.SetIntKey(printing::kSettingPagesPerSheet, pages_per_sheet); // True if the user wants to print with collate. bool collate = true; options.Get("collate", &collate); settings.SetBoolKey(printing::kSettingCollate, collate); // The number of individual copies to print int copies = 1; options.Get("copies", &copies); settings.SetIntKey(printing::kSettingCopies, copies); // Strings to be printed as headers and footers if requested by the user. std::string header; options.Get("header", &header); std::string footer; options.Get("footer", &footer); if (!(header.empty() && footer.empty())) { settings.SetBoolKey(printing::kSettingHeaderFooterEnabled, true); settings.SetStringKey(printing::kSettingHeaderFooterTitle, header); settings.SetStringKey(printing::kSettingHeaderFooterURL, footer); } else { settings.SetBoolKey(printing::kSettingHeaderFooterEnabled, false); } // We don't want to allow the user to enable these settings // but we need to set them or a CHECK is hit. settings.SetIntKey(printing::kSettingPrinterType, static_cast<int>(printing::PrinterType::kLocal)); settings.SetBoolKey(printing::kSettingShouldPrintSelectionOnly, false); settings.SetBoolKey(printing::kSettingRasterizePdf, false); // Set custom page ranges to print std::vector<gin_helper::Dictionary> page_ranges; if (options.Get("pageRanges", &page_ranges)) { base::Value page_range_list(base::Value::Type::LIST); for (auto& range : page_ranges) { int from, to; if (range.Get("from", &from) && range.Get("to", &to)) { base::Value range(base::Value::Type::DICTIONARY); range.SetIntKey(printing::kSettingPageRangeFrom, from); range.SetIntKey(printing::kSettingPageRangeTo, to); page_range_list.Append(std::move(range)); } else { continue; } } if (page_range_list.GetList().size() > 0) settings.SetPath(printing::kSettingPageRange, std::move(page_range_list)); } // Duplex type user wants to use. printing::mojom::DuplexMode duplex_mode = printing::mojom::DuplexMode::kSimplex; options.Get("duplexMode", &duplex_mode); settings.SetIntKey(printing::kSettingDuplexMode, static_cast<int>(duplex_mode)); // We've already done necessary parameter sanitization at the // JS level, so we can simply pass this through. base::Value media_size(base::Value::Type::DICTIONARY); if (options.Get("mediaSize", &media_size)) settings.SetKey(printing::kSettingMediaSize, std::move(media_size)); // Set custom dots per inch (dpi) gin_helper::Dictionary dpi_settings; int dpi = 72; if (options.Get("dpi", &dpi_settings)) { int horizontal = 72; dpi_settings.Get("horizontal", &horizontal); settings.SetIntKey(printing::kSettingDpiHorizontal, horizontal); int vertical = 72; dpi_settings.Get("vertical", &vertical); settings.SetIntKey(printing::kSettingDpiVertical, vertical); } else { settings.SetIntKey(printing::kSettingDpiHorizontal, dpi); settings.SetIntKey(printing::kSettingDpiVertical, dpi); } base::ThreadPool::PostTaskAndReplyWithResult( FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_BLOCKING}, base::BindOnce(&GetDefaultPrinterAsync), base::BindOnce(&WebContents::OnGetDefaultPrinter, weak_factory_.GetWeakPtr(), std::move(settings), std::move(callback), device_name, silent)); }
0
128,587
void FVMarkHintsOutOfDate(SplineChar *sc) { int i, j; int pos; FontView *fv; if ( sc->parent->onlybitmaps || sc->parent->multilayer || sc->parent->strokedfont ) return; for ( fv = (FontView *) (sc->parent->fv); fv!=NULL; fv=(FontView *) (fv->b.nextsame) ) { if ( fv->b.sf!=sc->parent ) /* Can happen in CID fonts if char's parent is not currently active */ continue; if ( sc->layers[fv->b.active_layer].order2 ) continue; if ( fv->v==NULL || fv->colcnt==0 ) /* Can happen in scripts */ continue; for ( pos=0; pos<fv->b.map->enccount; ++pos ) if ( fv->b.map->map[pos]==sc->orig_pos ) { i = pos / fv->colcnt; j = pos - i*fv->colcnt; i -= fv->rowoff; /* Normally we should be checking against fv->rowcnt (rather than <=rowcnt) */ /* but every now and then the WM forces us to use a window size which doesn't */ /* fit our expectations (maximized view) and we must be prepared for half */ /* lines */ if ( i>=0 && i<=fv->rowcnt ) { GRect r; r.x = j*fv->cbw+1; r.width = fv->cbw-1; r.y = i*fv->cbh+1; r.height = fv->lab_height-1; GDrawDrawLine(fv->v,r.x,r.y,r.x,r.y+r.height-1,fvhintingneededcol); GDrawDrawLine(fv->v,r.x+1,r.y,r.x+1,r.y+r.height-1,fvhintingneededcol); GDrawDrawLine(fv->v,r.x+r.width-1,r.y,r.x+r.width-1,r.y+r.height-1,fvhintingneededcol); GDrawDrawLine(fv->v,r.x+r.width-2,r.y,r.x+r.width-2,r.y+r.height-1,fvhintingneededcol); } } } }
0
262,438
void conn_free(conn *c) { if (c) { assert(c != NULL); assert(c->sfd >= 0 && c->sfd < max_fds); MEMCACHED_CONN_DESTROY(c); conns[c->sfd] = NULL; if (c->hdrbuf) free(c->hdrbuf); if (c->msglist) free(c->msglist); if (c->rbuf) free(c->rbuf); if (c->wbuf) free(c->wbuf); if (c->ilist) free(c->ilist); if (c->suffixlist) free(c->suffixlist); if (c->iov) free(c->iov); #ifdef TLS if (c->ssl_wbuf) c->ssl_wbuf = NULL; #endif free(c); } }
0
26,765
static int dissect_h245_RedundancyEncodingDTMode ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h245_RedundancyEncodingDTMode , RedundancyEncodingDTMode_sequence ) ; return offset ; }
0
237,457
gs_main_finit(gs_main_instance * minst, int exit_status, int code) { i_ctx_t *i_ctx_p = minst->i_ctx_p; gs_dual_memory_t dmem = {0}; int exit_code; ref error_object; char *tempnames; /* NB: need to free gs_name_table */ /* * Previous versions of this code closed the devices in the * device list here. Since these devices are now prototypes, * they cannot be opened, so they do not need to be closed; * alloc_restore_all will close dynamically allocated devices. */ tempnames = gs_main_tempnames(minst); /* by the time we get here, we *must* avoid any random redefinitions of * operators etc, so we push systemdict onto the top of the dict stack. * We do this in C to avoid running into any other re-defininitions in the * Postscript world. */ gs_finit_push_systemdict(i_ctx_p); /* We have to disable BGPrint before we call interp_reclaim() to prevent the * parent rendering thread initialising for the next page, whilst we are * removing objects it may want to access - for example, the I/O device table. * We also have to mess with the BeginPage/EndPage procs so that we don't * trigger a spurious extra page to be emitted. */ if (minst->init_done >= 2) { gs_main_run_string(minst, "/BGPrint /GetDeviceParam .special_op \ {{ <</BeginPage {pop} /EndPage {pop pop //false } \ /BGPrint false /NumRenderingThreads 0>> setpagedevice} if} if \ serverdict /.jobsavelevel get 0 eq {/quit} {/stop} ifelse \ .systemvar exec", 0 , &exit_code, &error_object); } /* * Close the "main" device, because it may need to write out * data before destruction. pdfwrite needs so. */ if (minst->init_done >= 2) { int code = 0; if (idmemory->reclaim != 0) { code = interp_reclaim(&minst->i_ctx_p, avm_global); if (code < 0) { ref error_name; if (tempnames) free(tempnames); if (gs_errorname(i_ctx_p, code, &error_name) >= 0) { char err_str[32] = {0}; name_string_ref(imemory, &error_name, &error_name); memcpy(err_str, error_name.value.const_bytes, r_size(&error_name)); emprintf2(imemory, "ERROR: %s (%d) reclaiming the memory while the interpreter finalization.\n", err_str, code); } else { emprintf1(imemory, "UNKNOWN ERROR %d reclaiming the memory while the interpreter finalization.\n", code); } #ifdef MEMENTO_SQUEEZE_BUILD if (code != gs_error_VMerror ) return gs_error_Fatal; #else return gs_error_Fatal; #endif } i_ctx_p = minst->i_ctx_p; /* interp_reclaim could change it. */ } if (i_ctx_p->pgs != NULL && i_ctx_p->pgs->device != NULL && gx_device_is_null(i_ctx_p->pgs->device)) { /* if the job replaced the device with the nulldevice, we we need to grestore away that device, so the block below can properly dispense with the default device. */ int code = gs_grestoreall(i_ctx_p->pgs); if (code < 0) return_error(gs_error_Fatal); } if (i_ctx_p->pgs != NULL && i_ctx_p->pgs->device != NULL) { gx_device *pdev = i_ctx_p->pgs->device; const char * dname = pdev->dname; if (code < 0) { ref error_name; if (gs_errorname(i_ctx_p, code, &error_name) >= 0) { char err_str[32] = {0}; name_string_ref(imemory, &error_name, &error_name); memcpy(err_str, error_name.value.const_bytes, r_size(&error_name)); emprintf3(imemory, "ERROR: %s (%d) on closing %s device.\n", err_str, code, dname); } else { emprintf2(imemory, "UNKNOWN ERROR %d closing %s device.\n", code, dname); } } rc_decrement(pdev, "gs_main_finit"); /* device might be freed */ if (exit_status == 0 || exit_status == gs_error_Quit) exit_status = code; } /* Flush stdout and stderr */ gs_main_run_string(minst, "(%stdout) (w) file closefile (%stderr) (w) file closefile \ serverdict /.jobsavelevel get 0 eq {/quit} {/stop} ifelse .systemexec \ systemdict /savedinitialgstate .forceundef", 0 , &exit_code, &error_object); } gp_readline_finit(minst->readline_data); i_ctx_p = minst->i_ctx_p; /* get current interp context */ if (gs_debug_c(':')) { print_resource_usage(minst, &gs_imemory, "Final"); dmprintf1(minst->heap, "%% Exiting instance 0x%p\n", minst); } /* Do the equivalent of a restore "past the bottom". */ /* This will release all memory, close all open files, etc. */ if (minst->init_done >= 1) { gs_memory_t *mem_raw = i_ctx_p->memory.current->non_gc_memory; i_plugin_holder *h = i_ctx_p->plugin_list; dmem = *idmemory; code = alloc_restore_all(i_ctx_p); if (code < 0) emprintf1(mem_raw, "ERROR %d while the final restore. See gs/psi/ierrors.h for code explanation.\n", code); i_iodev_finit(&dmem); i_plugin_finit(mem_raw, h); } /* clean up redirected stdout */ if (minst->heap->gs_lib_ctx->fstdout2 && (minst->heap->gs_lib_ctx->fstdout2 != minst->heap->gs_lib_ctx->fstdout) && (minst->heap->gs_lib_ctx->fstdout2 != minst->heap->gs_lib_ctx->fstderr)) { fclose(minst->heap->gs_lib_ctx->fstdout2); minst->heap->gs_lib_ctx->fstdout2 = (FILE *)NULL; } minst->heap->gs_lib_ctx->stdout_is_redirected = 0; minst->heap->gs_lib_ctx->stdout_to_stderr = 0; /* remove any temporary files, after ghostscript has closed files */ if (tempnames) { char *p = tempnames; while (*p) { unlink(p); p += strlen(p) + 1; } free(tempnames); } gs_lib_finit(exit_status, code, minst->heap); gs_free_object(minst->heap, minst->lib_path.container.value.refs, "lib_path array"); ialloc_finit(&dmem); return exit_status; }
0
445,566
void addDrainTracker(std::function<void()> drain_tracker) override { // Not implemented well. ASSERT(false); drain_tracker(); }
0
140,675
psf_binheader_readf (SF_PRIVATE *psf, char const *format, ...) { va_list argptr ; sf_count_t *countptr, countdata ; unsigned char *ucptr, sixteen_bytes [16] ; unsigned int *intptr, intdata ; unsigned short *shortptr ; char *charptr ; float *floatptr ; double *doubleptr ; char c ; int byte_count = 0, count = 0 ; if (! format) return psf_ftell (psf) ; va_start (argptr, format) ; while ((c = *format++)) { if (psf->header.indx + 16 >= psf->header.len && psf_bump_header_allocation (psf, 16)) return count ; switch (c) { case 'e' : /* All conversions are now from LE to host. */ psf->rwf_endian = SF_ENDIAN_LITTLE ; break ; case 'E' : /* All conversions are now from BE to host. */ psf->rwf_endian = SF_ENDIAN_BIG ; break ; case 'm' : /* 4 byte marker value eg 'RIFF' */ intptr = va_arg (argptr, unsigned int*) ; *intptr = 0 ; ucptr = (unsigned char*) intptr ; byte_count += header_read (psf, ucptr, sizeof (int)) ; *intptr = GET_MARKER (ucptr) ; break ; case 'h' : intptr = va_arg (argptr, unsigned int*) ; *intptr = 0 ; ucptr = (unsigned char*) intptr ; byte_count += header_read (psf, sixteen_bytes, sizeof (sixteen_bytes)) ; { int k ; intdata = 0 ; for (k = 0 ; k < 16 ; k++) intdata ^= sixteen_bytes [k] << k ; } *intptr = intdata ; break ; case '1' : charptr = va_arg (argptr, char*) ; *charptr = 0 ; byte_count += header_read (psf, charptr, sizeof (char)) ; break ; case '2' : /* 2 byte value with the current endian-ness */ shortptr = va_arg (argptr, unsigned short*) ; *shortptr = 0 ; ucptr = (unsigned char*) shortptr ; byte_count += header_read (psf, ucptr, sizeof (short)) ; if (psf->rwf_endian == SF_ENDIAN_BIG) *shortptr = GET_BE_SHORT (ucptr) ; else *shortptr = GET_LE_SHORT (ucptr) ; break ; case '3' : /* 3 byte value with the current endian-ness */ intptr = va_arg (argptr, unsigned int*) ; *intptr = 0 ; byte_count += header_read (psf, sixteen_bytes, 3) ; if (psf->rwf_endian == SF_ENDIAN_BIG) *intptr = GET_BE_3BYTE (sixteen_bytes) ; else *intptr = GET_LE_3BYTE (sixteen_bytes) ; break ; case '4' : /* 4 byte value with the current endian-ness */ intptr = va_arg (argptr, unsigned int*) ; *intptr = 0 ; ucptr = (unsigned char*) intptr ; byte_count += header_read (psf, ucptr, sizeof (int)) ; if (psf->rwf_endian == SF_ENDIAN_BIG) *intptr = psf_get_be32 (ucptr, 0) ; else *intptr = psf_get_le32 (ucptr, 0) ; break ; case '8' : /* 8 byte value with the current endian-ness */ countptr = va_arg (argptr, sf_count_t *) ; *countptr = 0 ; byte_count += header_read (psf, sixteen_bytes, 8) ; if (psf->rwf_endian == SF_ENDIAN_BIG) countdata = psf_get_be64 (sixteen_bytes, 0) ; else countdata = psf_get_le64 (sixteen_bytes, 0) ; *countptr = countdata ; break ; case 'f' : /* Float conversion */ floatptr = va_arg (argptr, float *) ; *floatptr = 0.0 ; byte_count += header_read (psf, floatptr, sizeof (float)) ; if (psf->rwf_endian == SF_ENDIAN_BIG) *floatptr = float32_be_read ((unsigned char*) floatptr) ; else *floatptr = float32_le_read ((unsigned char*) floatptr) ; break ; case 'd' : /* double conversion */ doubleptr = va_arg (argptr, double *) ; *doubleptr = 0.0 ; byte_count += header_read (psf, doubleptr, sizeof (double)) ; if (psf->rwf_endian == SF_ENDIAN_BIG) *doubleptr = double64_be_read ((unsigned char*) doubleptr) ; else *doubleptr = double64_le_read ((unsigned char*) doubleptr) ; break ; case 's' : psf_log_printf (psf, "Format conversion 's' not implemented yet.\n") ; /* strptr = va_arg (argptr, char *) ; size = strlen (strptr) + 1 ; size += (size & 1) ; longdata = H2LE_32 (size) ; get_int (psf, longdata) ; memcpy (&(psf->header.ptr [psf->header.indx]), strptr, size) ; psf->header.indx += size ; */ break ; case 'b' : /* Raw bytes */ charptr = va_arg (argptr, char*) ; count = va_arg (argptr, size_t) ; memset (charptr, 0, count) ; byte_count += header_read (psf, charptr, count) ; break ; case 'G' : charptr = va_arg (argptr, char*) ; count = va_arg (argptr, size_t) ; memset (charptr, 0, count) ; if (psf->header.indx + count >= psf->header.len && psf_bump_header_allocation (psf, count)) return 0 ; byte_count += header_gets (psf, charptr, count) ; break ; case 'z' : psf_log_printf (psf, "Format conversion 'z' not implemented yet.\n") ; /* size = va_arg (argptr, size_t) ; while (size) { psf->header.ptr [psf->header.indx] = 0 ; psf->header.indx ++ ; size -- ; } ; */ break ; case 'p' : /* Seek to position from start. */ count = va_arg (argptr, size_t) ; header_seek (psf, count, SEEK_SET) ; byte_count = count ; break ; case 'j' : /* Seek to position from current position. */ count = va_arg (argptr, size_t) ; header_seek (psf, count, SEEK_CUR) ; byte_count += count ; break ; default : psf_log_printf (psf, "*** Invalid format specifier `%c'\n", c) ; psf->error = SFE_INTERNAL ; break ; } ; } ; va_end (argptr) ; return byte_count ; } /* psf_binheader_readf */
0
370,683
static void process_bin_flush(conn *c) { time_t exptime = 0; protocol_binary_request_flush* req = binary_get_request(c); if (c->binary_header.request.extlen == sizeof(req->message.body)) { exptime = ntohl(req->message.body.expiration); } if (exptime > 0) { settings.oldest_live = realtime(exptime) - 1; } else { settings.oldest_live = current_time - 1; } item_flush_expired(); pthread_mutex_lock(&c->thread->stats.mutex); c->thread->stats.flush_cmds++; pthread_mutex_unlock(&c->thread->stats.mutex); write_bin_response(c, NULL, 0, 0, 0); }
0
389,744
ram_addr_t qemu_ram_alloc_internal(ram_addr_t size, ram_addr_t max_size, void (*resized)(const char*, uint64_t length, void *host), void *host, bool resizeable, MemoryRegion *mr, Error **errp) { RAMBlock *new_block; ram_addr_t addr; Error *local_err = NULL; size = TARGET_PAGE_ALIGN(size); max_size = TARGET_PAGE_ALIGN(max_size); new_block = g_malloc0(sizeof(*new_block)); new_block->mr = mr; new_block->resized = resized; new_block->used_length = size; new_block->max_length = max_size; assert(max_size >= size); new_block->fd = -1; new_block->host = host; if (host) { new_block->flags |= RAM_PREALLOC; } if (resizeable) { new_block->flags |= RAM_RESIZEABLE; } addr = ram_block_add(new_block, &local_err); if (local_err) { g_free(new_block); error_propagate(errp, local_err); return -1; } return addr; }
0
308,218
bool CSPSource::matches(const KURL& url, ContentSecurityPolicy::RedirectStatus redirectStatus) const { if (!schemeMatches(url)) return false; if (isSchemeOnly()) return true; bool pathsMatch = (redirectStatus == ContentSecurityPolicy::DidRedirect) || pathMatches(url); return hostMatches(url) && portMatches(url) && pathsMatch; }
0
458,689
parse_vlan(const void **datap, size_t *sizep, union flow_vlan_hdr *vlan_hdrs) { const ovs_be16 *eth_type; memset(vlan_hdrs, 0, sizeof(union flow_vlan_hdr) * FLOW_MAX_VLAN_HEADERS); data_pull(datap, sizep, ETH_ADDR_LEN * 2); eth_type = *datap; size_t n; for (n = 0; eth_type_vlan(*eth_type) && n < flow_vlan_limit; n++) { if (OVS_UNLIKELY(*sizep < sizeof(ovs_be32) + sizeof(ovs_be16))) { break; } const ovs_16aligned_be32 *qp = data_pull(datap, sizep, sizeof *qp); vlan_hdrs[n].qtag = get_16aligned_be32(qp); vlan_hdrs[n].tci |= htons(VLAN_CFI); eth_type = *datap; } return n; }
0
111,813
static bool __head check_la57_support(unsigned long physaddr) { /* * 5-level paging is detected and enabled at kernel decompression * stage. Only check if it has been enabled there. */ if (!(native_read_cr4() & X86_CR4_LA57)) return false; *fixup_int(&__pgtable_l5_enabled, physaddr) = 1; *fixup_int(&pgdir_shift, physaddr) = 48; *fixup_int(&ptrs_per_p4d, physaddr) = 512; *fixup_long(&page_offset_base, physaddr) = __PAGE_OFFSET_BASE_L5; *fixup_long(&vmalloc_base, physaddr) = __VMALLOC_BASE_L5; *fixup_long(&vmemmap_base, physaddr) = __VMEMMAP_BASE_L5; return true; }
0
250,247
PPB_URLLoader_API* PPB_URLLoader_Impl::AsPPB_URLLoader_API() { return this; }
0
445,822
*to_usb_os_desc_ext_prop(struct config_item *item) { return container_of(item, struct usb_os_desc_ext_prop, item); }
0
229,060
void UsageTracker::GetHostUsage( const std::string& host, HostUsageCallback* callback) { if (client_tracker_map_.size() == 0) { callback->Run(host, type_, 0); delete callback; return; } if (host_usage_callbacks_.Add(host, callback)) { DCHECK(outstanding_host_usage_.find(host) == outstanding_host_usage_.end()); outstanding_host_usage_[host].pending_clients = client_tracker_map_.size(); for (ClientTrackerMap::iterator iter = client_tracker_map_.begin(); iter != client_tracker_map_.end(); ++iter) { iter->second->GetHostUsage(host, callback_factory_.NewCallback( &UsageTracker::DidGetClientHostUsage)); } } }
0
492,983
static int ssl_compress_buf( mbedtls_ssl_context *ssl ) { int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; unsigned char *msg_post = ssl->out_msg; ptrdiff_t bytes_written = ssl->out_msg - ssl->out_buf; size_t len_pre = ssl->out_msglen; unsigned char *msg_pre = ssl->compress_buf; #if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH) size_t out_buf_len = ssl->out_buf_len; #else size_t out_buf_len = MBEDTLS_SSL_OUT_BUFFER_LEN; #endif MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> compress buf" ) ); if( len_pre == 0 ) return( 0 ); memcpy( msg_pre, ssl->out_msg, len_pre ); MBEDTLS_SSL_DEBUG_MSG( 3, ( "before compression: msglen = %" MBEDTLS_PRINTF_SIZET ", ", ssl->out_msglen ) ); MBEDTLS_SSL_DEBUG_BUF( 4, "before compression: output payload", ssl->out_msg, ssl->out_msglen ); ssl->transform_out->ctx_deflate.next_in = msg_pre; ssl->transform_out->ctx_deflate.avail_in = len_pre; ssl->transform_out->ctx_deflate.next_out = msg_post; ssl->transform_out->ctx_deflate.avail_out = out_buf_len - bytes_written; ret = deflate( &ssl->transform_out->ctx_deflate, Z_SYNC_FLUSH ); if( ret != Z_OK ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( "failed to perform compression (%d)", ret ) ); return( MBEDTLS_ERR_SSL_COMPRESSION_FAILED ); } ssl->out_msglen = out_buf_len - ssl->transform_out->ctx_deflate.avail_out - bytes_written; MBEDTLS_SSL_DEBUG_MSG( 3, ( "after compression: msglen = %" MBEDTLS_PRINTF_SIZET ", ", ssl->out_msglen ) ); MBEDTLS_SSL_DEBUG_BUF( 4, "after compression: output payload", ssl->out_msg, ssl->out_msglen ); MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= compress buf" ) ); return( 0 ); }
0
153,009
MapNto1(SDL_PixelFormat * src, SDL_PixelFormat * dst, int *identical) { /* Generate a 256 color dither palette */ SDL_Palette dithered; SDL_Color colors[256]; SDL_Palette *pal = dst->palette; dithered.ncolors = 256; SDL_DitherColors(colors, 8); dithered.colors = colors; return (Map1to1(&dithered, pal, identical)); }
0
247,031
bool Document::IsDelayingLoadEvent() { if (ThreadState::Current()->SweepForbidden()) { if (!load_event_delay_count_) CheckLoadEventSoon(); return true; } return load_event_delay_count_; }
0
102,110
static ssize_t lbs_threshold_write(uint16_t tlv_type, uint16_t event_mask, struct file *file, const char __user *userbuf, size_t count, loff_t *ppos) { struct cmd_ds_802_11_subscribe_event *events; struct mrvl_ie_thresholds *tlv; struct lbs_private *priv = file->private_data; ssize_t buf_size; int value, freq, new_mask; uint16_t curr_mask; char *buf; int ret; buf = (char *)get_zeroed_page(GFP_KERNEL); if (!buf) return -ENOMEM; buf_size = min(count, len - 1); if (copy_from_user(buf, userbuf, buf_size)) { ret = -EFAULT; goto out_page; } ret = sscanf(buf, "%d %d %d", &value, &freq, &new_mask); if (ret != 3) { ret = -EINVAL; goto out_page; } events = kzalloc(sizeof(*events), GFP_KERNEL); if (!events) { ret = -ENOMEM; goto out_page; } events->hdr.size = cpu_to_le16(sizeof(*events)); events->action = cpu_to_le16(CMD_ACT_GET); ret = lbs_cmd_with_response(priv, CMD_802_11_SUBSCRIBE_EVENT, events); if (ret) goto out_events; curr_mask = le16_to_cpu(events->events); if (new_mask) new_mask = curr_mask | event_mask; else new_mask = curr_mask & ~event_mask; /* Now everything is set and we can send stuff down to the firmware */ tlv = (void *)events->tlv; events->action = cpu_to_le16(CMD_ACT_SET); events->events = cpu_to_le16(new_mask); tlv->header.type = cpu_to_le16(tlv_type); tlv->header.len = cpu_to_le16(sizeof(*tlv) - sizeof(tlv->header)); tlv->value = value; if (tlv_type != TLV_TYPE_BCNMISS) tlv->freq = freq; /* The command header, the action, the event mask, and one TLV */ events->hdr.size = cpu_to_le16(sizeof(events->hdr) + 4 + sizeof(*tlv)); ret = lbs_cmd_with_response(priv, CMD_802_11_SUBSCRIBE_EVENT, events); if (!ret) ret = count; out_events: kfree(events); out_page: free_page((unsigned long)buf); return ret; }
0
349,976
int hugetlb_overcommit_handler(struct ctl_table *table, int write, void *buffer, size_t *length, loff_t *ppos) { struct hstate *h = &default_hstate; unsigned long tmp; int ret; if (!hugepages_supported()) return -EOPNOTSUPP; tmp = h->nr_overcommit_huge_pages; if (write && hstate_is_gigantic(h)) return -EINVAL; table->data = &tmp; table->maxlen = sizeof(unsigned long); ret = proc_doulongvec_minmax(table, write, buffer, length, ppos); if (ret) goto out; if (write) { spin_lock(&hugetlb_lock); h->nr_overcommit_huge_pages = tmp; spin_unlock(&hugetlb_lock); } out: return ret; }
1
14,790
status_t OMXNodeInstance::emptyBuffer( OMX::buffer_id buffer, OMX_U32 rangeOffset, OMX_U32 rangeLength, OMX_U32 flags, OMX_TICKS timestamp, int fenceFd) { Mutex::Autolock autoLock(mLock); OMX_BUFFERHEADERTYPE *header = findBufferHeader(buffer, kPortIndexInput); if (header == NULL) { ALOGE("b/25884056"); return BAD_VALUE; } BufferMeta *buffer_meta = static_cast<BufferMeta *>(header->pAppPrivate); sp<ABuffer> backup = buffer_meta->getBuffer(header, true /* backup */, false /* limit */); sp<ABuffer> codec = buffer_meta->getBuffer(header, false /* backup */, false /* limit */); if (mMetadataType[kPortIndexInput] == kMetadataBufferTypeGrallocSource && backup->capacity() >= sizeof(VideoNativeMetadata) && codec->capacity() >= sizeof(VideoGrallocMetadata) && ((VideoNativeMetadata *)backup->base())->eType == kMetadataBufferTypeANWBuffer) { VideoNativeMetadata &backupMeta = *(VideoNativeMetadata *)backup->base(); VideoGrallocMetadata &codecMeta = *(VideoGrallocMetadata *)codec->base(); CLOG_BUFFER(emptyBuffer, "converting ANWB %p to handle %p", backupMeta.pBuffer, backupMeta.pBuffer->handle); codecMeta.pHandle = backupMeta.pBuffer != NULL ? backupMeta.pBuffer->handle : NULL; codecMeta.eType = kMetadataBufferTypeGrallocSource; header->nFilledLen = rangeLength ? sizeof(codecMeta) : 0; header->nOffset = 0; } else { if (rangeOffset > header->nAllocLen || rangeLength > header->nAllocLen - rangeOffset) { CLOG_ERROR(emptyBuffer, OMX_ErrorBadParameter, FULL_BUFFER(NULL, header, fenceFd)); if (fenceFd >= 0) { ::close(fenceFd); } return BAD_VALUE; } header->nFilledLen = rangeLength; header->nOffset = rangeOffset; buffer_meta->CopyToOMX(header); } return emptyBuffer_l(header, flags, timestamp, (intptr_t)buffer, fenceFd); }
1
45,885
/* Called with irq disabled */ static inline void ____napi_schedule(struct softnet_data *sd, struct napi_struct *napi) { list_add_tail(&napi->poll_list, &sd->poll_list); __raise_softirq_irqoff(NET_RX_SOFTIRQ);
0
52,770
static void process_bin_stat(conn *c) { char *subcommand = binary_get_key(c); size_t nkey = c->binary_header.request.keylen; if (settings.verbose > 1) { int ii; fprintf(stderr, "<%d STATS ", c->sfd); for (ii = 0; ii < nkey; ++ii) { fprintf(stderr, "%c", subcommand[ii]); } fprintf(stderr, "\n"); } if (nkey == 0) { /* request all statistics */ server_stats(&append_stats, c); (void)get_stats(NULL, 0, &append_stats, c); } else if (strncmp(subcommand, "reset", 5) == 0) { stats_reset(); } else if (strncmp(subcommand, "settings", 8) == 0) { process_stat_settings(&append_stats, c); } else if (strncmp(subcommand, "detail", 6) == 0) { char *subcmd_pos = subcommand + 6; if (strncmp(subcmd_pos, " dump", 5) == 0) { int len; char *dump_buf = stats_prefix_dump(&len); if (dump_buf == NULL || len <= 0) { write_bin_error(c, PROTOCOL_BINARY_RESPONSE_ENOMEM, 0); return ; } else { append_stats("detailed", strlen("detailed"), dump_buf, len, c); free(dump_buf); } } else if (strncmp(subcmd_pos, " on", 3) == 0) { settings.detail_enabled = 1; } else if (strncmp(subcmd_pos, " off", 4) == 0) { settings.detail_enabled = 0; } else { write_bin_error(c, PROTOCOL_BINARY_RESPONSE_KEY_ENOENT, 0); return; } } else { if (get_stats(subcommand, nkey, &append_stats, c)) { if (c->stats.buffer == NULL) { write_bin_error(c, PROTOCOL_BINARY_RESPONSE_ENOMEM, 0); } else { write_and_free(c, c->stats.buffer, c->stats.offset); c->stats.buffer = NULL; } } else { write_bin_error(c, PROTOCOL_BINARY_RESPONSE_KEY_ENOENT, 0); } return; } /* Append termination package and start the transfer */ append_stats(NULL, 0, NULL, 0, c); if (c->stats.buffer == NULL) { write_bin_error(c, PROTOCOL_BINARY_RESPONSE_ENOMEM, 0); } else { write_and_free(c, c->stats.buffer, c->stats.offset); c->stats.buffer = NULL; } }
0
249,004
virtual void performInternal(WebPagePrivate* webPagePrivate) { webPagePrivate->setPageVisibilityState(); }
0
156,685
tune_quant(Node* node, regex_t* reg, int state, ScanEnv* env) { int r; QuantNode* qn = QUANT_(node); Node* body = NODE_BODY(node); if ((state & IN_REAL_REPEAT) != 0) { NODE_STATUS_ADD(node, IN_REAL_REPEAT); } if ((state & IN_MULTI_ENTRY) != 0) { NODE_STATUS_ADD(node, IN_MULTI_ENTRY); } if (IS_INFINITE_REPEAT(qn->upper) || qn->upper >= 1) { OnigLen d = node_min_byte_len(body, env); if (d == 0) { #ifdef USE_STUBBORN_CHECK_CAPTURES_IN_EMPTY_REPEAT qn->emptiness = quantifiers_memory_node_info(body); #else qn->emptiness = BODY_MAY_BE_EMPTY; #endif } } if (IS_INFINITE_REPEAT(qn->upper) || qn->upper >= 2) state |= IN_REAL_REPEAT; if (qn->lower != qn->upper) state |= IN_VAR_REPEAT; r = tune_tree(body, reg, state, env); if (r != 0) return r; /* expand string */ #define EXPAND_STRING_MAX_LENGTH 100 if (NODE_TYPE(body) == NODE_STRING) { if (!IS_INFINITE_REPEAT(qn->lower) && qn->lower == qn->upper && qn->lower > 1 && qn->lower <= EXPAND_STRING_MAX_LENGTH) { int len = NODE_STRING_LEN(body); if (len * qn->lower <= EXPAND_STRING_MAX_LENGTH) { int i, n = qn->lower; node_conv_to_str_node(node, body); for (i = 0; i < n; i++) { r = node_str_node_cat(node, body); if (r != 0) return r; } onig_node_free(body); return r; } } } if (qn->greedy && (qn->emptiness == BODY_IS_NOT_EMPTY)) { if (NODE_TYPE(body) == NODE_QUANT) { QuantNode* tqn = QUANT_(body); if (IS_NOT_NULL(tqn->head_exact)) { qn->head_exact = tqn->head_exact; tqn->head_exact = NULL; } } else { qn->head_exact = get_tree_head_literal(NODE_BODY(node), 1, reg); } } return r; }
0
206,289
String DOMWindow::CrossDomainAccessErrorMessage( const LocalDOMWindow* calling_window) const { if (!calling_window || !calling_window->document() || !GetFrame()) return String(); const KURL& calling_window_url = calling_window->document()->Url(); if (calling_window_url.IsNull()) return String(); const SecurityOrigin* active_origin = calling_window->document()->GetSecurityOrigin(); const SecurityOrigin* target_origin = GetFrame()->GetSecurityContext()->GetSecurityOrigin(); DCHECK(GetFrame()->IsRemoteFrame() || !active_origin->CanAccess(target_origin)); String message = "Blocked a frame with origin \"" + active_origin->ToString() + "\" from accessing a frame with origin \"" + target_origin->ToString() + "\". "; KURL active_url = calling_window->document()->Url(); KURL target_url = IsLocalDOMWindow() ? blink::ToLocalDOMWindow(this)->document()->Url() : KURL(NullURL(), target_origin->ToString()); if (GetFrame()->GetSecurityContext()->IsSandboxed(kSandboxOrigin) || calling_window->document()->IsSandboxed(kSandboxOrigin)) { message = "Blocked a frame at \"" + SecurityOrigin::Create(active_url)->ToString() + "\" from accessing a frame at \"" + SecurityOrigin::Create(target_url)->ToString() + "\". "; if (GetFrame()->GetSecurityContext()->IsSandboxed(kSandboxOrigin) && calling_window->document()->IsSandboxed(kSandboxOrigin)) return "Sandbox access violation: " + message + " Both frames are sandboxed and lack the \"allow-same-origin\" " "flag."; if (GetFrame()->GetSecurityContext()->IsSandboxed(kSandboxOrigin)) return "Sandbox access violation: " + message + " The frame being accessed is sandboxed and lacks the " "\"allow-same-origin\" flag."; return "Sandbox access violation: " + message + " The frame requesting access is sandboxed and lacks the " "\"allow-same-origin\" flag."; } if (target_origin->Protocol() != active_origin->Protocol()) return message + " The frame requesting access has a protocol of \"" + active_url.Protocol() + "\", the frame being accessed has a protocol of \"" + target_url.Protocol() + "\". Protocols must match.\n"; if (target_origin->DomainWasSetInDOM() && active_origin->DomainWasSetInDOM()) return message + "The frame requesting access set \"document.domain\" to \"" + active_origin->Domain() + "\", the frame being accessed set it to \"" + target_origin->Domain() + "\". Both must set \"document.domain\" to the same value to allow " "access."; if (active_origin->DomainWasSetInDOM()) return message + "The frame requesting access set \"document.domain\" to \"" + active_origin->Domain() + "\", but the frame being accessed did not. Both must set " "\"document.domain\" to the same value to allow access."; if (target_origin->DomainWasSetInDOM()) return message + "The frame being accessed set \"document.domain\" to \"" + target_origin->Domain() + "\", but the frame requesting access did not. Both must set " "\"document.domain\" to the same value to allow access."; return message + "Protocols, domains, and ports must match."; }
0
437,749
static char *sieve_srs_forward(char *return_path) { const char *srs_domain = config_getstring(IMAPOPT_SRS_DOMAIN); char *srs_return_path = NULL; int srs_status; if (!srs_engine) { /* SRS not enabled */ return NULL; } srs_status = srs_forward_alloc(srs_engine, &srs_return_path, return_path, srs_domain); if (srs_status != SRS_SUCCESS) { syslog(LOG_ERR, "sieve SRS forward failed (%s, %s): %s", return_path, srs_domain, srs_strerror(srs_status)); if (srs_return_path) { free(srs_return_path); srs_return_path = NULL; } } return srs_return_path; }
0
344,368
goa_http_client_check (GoaHttpClient *client, const gchar *uri, const gchar *username, const gchar *password, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { CheckData *data; CheckAuthData *auth; SoupLogger *logger; g_return_if_fail (GOA_IS_HTTP_CLIENT (client)); g_return_if_fail (uri != NULL || uri[0] != '\0'); g_return_if_fail (username != NULL || username[0] != '\0'); g_return_if_fail (password != NULL || password[0] != '\0'); g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); data = g_slice_new0 (CheckData); data->res = g_simple_async_result_new (G_OBJECT (client), callback, user_data, goa_http_client_check); data->session = soup_session_async_new_with_options (SOUP_SESSION_USE_THREAD_CONTEXT, TRUE, NULL); logger = soup_logger_new (SOUP_LOGGER_LOG_BODY, -1); soup_logger_set_printer (logger, http_client_log_printer, NULL, NULL); soup_session_add_feature (data->session, SOUP_SESSION_FEATURE (logger)); g_object_unref (logger); data->msg = soup_message_new (SOUP_METHOD_GET, uri); soup_message_headers_append (data->msg->request_headers, "Connection", "close"); if (cancellable != NULL) { data->cancellable = g_object_ref (cancellable); data->cancellable_id = g_cancellable_connect (data->cancellable, G_CALLBACK (http_client_check_cancelled_cb), data, NULL); g_simple_async_result_set_check_cancellable (data->res, data->cancellable); } auth = g_slice_new0 (CheckAuthData); auth->username = g_strdup (username); auth->password = g_strdup (password); g_signal_connect_data (data->session, "authenticate", G_CALLBACK (http_client_authenticate), auth, http_client_check_auth_data_free, 0); soup_session_queue_message (data->session, data->msg, http_client_check_response_cb, data); }
1
358,350
static int handle_triple_fault(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) { kvm_run->exit_reason = KVM_EXIT_SHUTDOWN; return 0; }
0
186,121
void RenderWidgetHostViewAura::BeginFrameSubscription( scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) { frame_subscriber_ = subscriber.Pass(); }
0
71,467
builtin_bin(PyObject *module, PyObject *number) /*[clinic end generated code: output=b6fc4ad5e649f4f7 input=53f8a0264bacaf90]*/ { return PyNumber_ToBase(number, 2); }
0
442,474
static long task_close_fd(struct binder_proc *proc, unsigned int fd) { int retval; mutex_lock(&proc->files_lock); if (proc->files == NULL) { retval = -ESRCH; goto err; } retval = __close_fd(proc->files, fd); /* can't restart close syscall because file table entry was cleared */ if (unlikely(retval == -ERESTARTSYS || retval == -ERESTARTNOINTR || retval == -ERESTARTNOHAND || retval == -ERESTART_RESTARTBLOCK)) retval = -EINTR; err: mutex_unlock(&proc->files_lock); return retval; }
0
175,712
void CustomButton::OnEnabledChanged() { if (enabled() ? (state_ != STATE_DISABLED) : (state_ == STATE_DISABLED)) return; if (enabled()) SetState(ShouldEnterHoveredState() ? STATE_HOVERED : STATE_NORMAL); else SetState(STATE_DISABLED); }
0
34,829
static u64 btrfs_dev_stats_value(const struct extent_buffer *eb, const struct btrfs_dev_stats_item *ptr, int index) { u64 val; read_extent_buffer(eb, &val, offsetof(struct btrfs_dev_stats_item, values) + ((unsigned long)ptr) + (index * sizeof(u64)), sizeof(val)); return val; }
0
107,211
static void __free_resource(void *resource) { r_ne_resource *res = (r_ne_resource *)resource; free (res->name); r_list_free (res->entry); free (res); }
0
72,496
flatpak_dir_get_remote_default_branch (FlatpakDir *self, const char *remote_name) { GKeyFile *config = flatpak_dir_get_repo_config (self); g_autofree char *group = get_group (remote_name); if (config) return g_key_file_get_string (config, group, "xa.default-branch", NULL); return NULL; }
0
258,080
static void initial_reordering ( const hb_ot_shape_plan_t * plan , hb_font_t * font , hb_buffer_t * buffer ) { update_consonant_positions ( plan , font , buffer ) ; insert_dotted_circles ( plan , font , buffer ) ; foreach_syllable ( buffer , start , end ) initial_reordering_syllable ( plan , font -> face , buffer , start , end ) ; }
0
62,749
l_noret luaG_callerror (lua_State *L, const TValue *o) { CallInfo *ci = L->ci; const char *name = NULL; /* to avoid warnings */ const char *kind = funcnamefromcall(L, ci, &name); const char *extra = kind ? formatvarinfo(L, kind, name) : varinfo(L, o); typeerror(L, o, "call", extra); }
0
324,094
static void decode_clnpass(Jpeg2000DecoderContext *s, Jpeg2000T1Context *t1, int width, int height, int bpno, int bandno, int seg_symbols, int vert_causal_ctx_csty_symbol) { int mask = 3 << (bpno - 1), y0, x, y, runlen, dec; for (y0 = 0; y0 < height; y0 += 4) { for (x = 0; x < width; x++) { int flags_mask = -1; if (vert_causal_ctx_csty_symbol) flags_mask &= ~(JPEG2000_T1_SIG_S | JPEG2000_T1_SIG_SW | JPEG2000_T1_SIG_SE | JPEG2000_T1_SGN_S); if (y0 + 3 < height && !((t1->flags[y0 + 1][x + 1] & (JPEG2000_T1_SIG_NB | JPEG2000_T1_VIS | JPEG2000_T1_SIG)) || (t1->flags[y0 + 2][x + 1] & (JPEG2000_T1_SIG_NB | JPEG2000_T1_VIS | JPEG2000_T1_SIG)) || (t1->flags[y0 + 3][x + 1] & (JPEG2000_T1_SIG_NB | JPEG2000_T1_VIS | JPEG2000_T1_SIG)) || (t1->flags[y0 + 4][x + 1] & (JPEG2000_T1_SIG_NB | JPEG2000_T1_VIS | JPEG2000_T1_SIG) & flags_mask))) { if (!ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_RL)) continue; runlen = ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI); runlen = (runlen << 1) | ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI); dec = 1; } else { runlen = 0; dec = 0; } for (y = y0 + runlen; y < y0 + 4 && y < height; y++) { int flags_mask = -1; if (vert_causal_ctx_csty_symbol && y == y0 + 3) flags_mask &= ~(JPEG2000_T1_SIG_S | JPEG2000_T1_SIG_SW | JPEG2000_T1_SIG_SE | JPEG2000_T1_SGN_S); if (!dec) { if (!(t1->flags[y+1][x+1] & (JPEG2000_T1_SIG | JPEG2000_T1_VIS))) { dec = ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ff_jpeg2000_getsigctxno(t1->flags[y+1][x+1] & flags_mask, bandno)); } } if (dec) { int xorbit; int ctxno = ff_jpeg2000_getsgnctxno(t1->flags[y + 1][x + 1] & flags_mask, &xorbit); t1->data[y][x] = (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ^ xorbit) ? -mask : mask; ff_jpeg2000_set_significance(t1, x, y, t1->data[y][x] < 0); } dec = 0; t1->flags[y + 1][x + 1] &= ~JPEG2000_T1_VIS; } } } if (seg_symbols) { int val; val = ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI); val = (val << 1) + ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI); val = (val << 1) + ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI); val = (val << 1) + ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI); if (val != 0xa) av_log(s->avctx, AV_LOG_ERROR, "Segmentation symbol value incorrect\n"); } }
0
51,598
EIGEN_STRONG_INLINE QInt32 operator-(const QInt32 a, const QUInt8 b) { return QInt32(a.value - static_cast<int32_t>(b.value)); }
0
258,587
static int rtp_event_packet ( void * ptr _U_ , packet_info * pinfo , epan_dissect_t * edt _U_ , const void * rtp_event_info ) { const struct _rtp_event_info * pi = ( const struct _rtp_event_info * ) rtp_event_info ; if ( pi -> info_setup_frame_num == 0 ) { return 0 ; } rtp_evt_frame_num = pinfo -> fd -> num ; rtp_evt = pi -> info_rtp_evt ; rtp_evt_end = pi -> info_end ; return 0 ; }
0
282,423
void DownloadManagerImpl::GetNextId(const DownloadIdCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); if (delegate_) { delegate_->GetNextId(callback); return; } static uint32_t next_id = content::DownloadItem::kInvalidId + 1; callback.Run(next_id++); }
0
350,371
static void rtps_util_detect_coherent_set_end_empty_data_case( coherent_set_entity_info *coherent_set_entity_info_object) { coherent_set_entity_info *coherent_set_entry = NULL; coherent_set_entry = (coherent_set_entity_info*) wmem_map_lookup(coherent_set_tracking.entities_using_map, &coherent_set_entity_info_object->guid); if (coherent_set_entry) { coherent_set_info *coherent_set_info_entry; coherent_set_key key; key.guid = coherent_set_entity_info_object->guid; key.coherent_set_seq_number = coherent_set_entry->coherent_set_seq_number; coherent_set_info_entry = (coherent_set_info*)wmem_map_lookup(coherent_set_tracking.coherent_set_registry_map, &key); if (coherent_set_info_entry) { if (coherent_set_entry->expected_coherent_set_end_writers_seq_number == coherent_set_entity_info_object->writer_seq_number) { coherent_set_info_entry->is_set = TRUE; coherent_set_info_entry->writer_seq_number = coherent_set_entry->expected_coherent_set_end_writers_seq_number - 1; } } } }
1
496,862
ReturnCode_t DataWriterImpl::check_qos( const DataWriterQos& qos) { if (qos.durability().kind == PERSISTENT_DURABILITY_QOS) { logError(RTPS_QOS_CHECK, "PERSISTENT Durability not supported"); return ReturnCode_t::RETCODE_UNSUPPORTED; } if (qos.destination_order().kind == BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS) { logError(RTPS_QOS_CHECK, "BY SOURCE TIMESTAMP DestinationOrder not supported"); return ReturnCode_t::RETCODE_UNSUPPORTED; } if (qos.reliability().kind == BEST_EFFORT_RELIABILITY_QOS && qos.ownership().kind == EXCLUSIVE_OWNERSHIP_QOS) { logError(RTPS_QOS_CHECK, "BEST_EFFORT incompatible with EXCLUSIVE ownership"); return ReturnCode_t::RETCODE_INCONSISTENT_POLICY; } if (qos.liveliness().kind == AUTOMATIC_LIVELINESS_QOS || qos.liveliness().kind == MANUAL_BY_PARTICIPANT_LIVELINESS_QOS) { if (qos.liveliness().lease_duration < eprosima::fastrtps::c_TimeInfinite && qos.liveliness().lease_duration <= qos.liveliness().announcement_period) { logError(RTPS_QOS_CHECK, "WRITERQOS: LeaseDuration <= announcement period."); return ReturnCode_t::RETCODE_INCONSISTENT_POLICY; } } return ReturnCode_t::RETCODE_OK; }
0
489,902
static int asepcos_build_pin_apdu(sc_card_t *card, sc_apdu_t *apdu, struct sc_pin_cmd_data *data, u8 *buf, size_t buf_len, unsigned int cmd, int is_puk) { int r, fileid; u8 *p = buf; sc_cardctl_asepcos_akn2fileid_t st; switch (cmd) { case SC_PIN_CMD_VERIFY: st.akn = data->pin_reference; r = asepcos_akn_to_fileid(card, &st); if (r != SC_SUCCESS) return r; fileid = st.fileid; /* the fileid of the puk is the fileid of the pin + 1 */ if (is_puk != 0) fileid++; sc_format_apdu(card, apdu, SC_APDU_CASE_3_SHORT, 0x20, 0x02, 0x80); *p++ = (fileid >> 24) & 0xff; *p++ = (fileid >> 16) & 0xff; *p++ = (fileid >> 8 ) & 0xff; *p++ = fileid & 0xff; memcpy(p, data->pin1.data, data->pin1.len); p += data->pin1.len; apdu->lc = p - buf; apdu->datalen = p - buf; apdu->data = buf; break; case SC_PIN_CMD_CHANGE: /* build the CHANGE KEY apdu. Note: the PIN file is implicitly * selected by its SFID */ *p++ = 0x81; *p++ = data->pin2.len & 0xff; memcpy(p, data->pin2.data, data->pin2.len); p += data->pin2.len; st.akn = data->pin_reference; r = asepcos_akn_to_fileid(card, &st); if (r != SC_SUCCESS) return r; fileid = 0x80 | (st.fileid & 0x1f); sc_format_apdu(card, apdu, SC_APDU_CASE_3_SHORT, 0x24, 0x01, fileid); apdu->lc = p - buf; apdu->datalen = p - buf; apdu->data = buf; break; case SC_PIN_CMD_UNBLOCK: /* build the UNBLOCK KEY apdu. The PIN file is implicitly * selected by its SFID. The new PIN is provided in the * data field of the UNBLOCK KEY command. */ *p++ = 0x81; *p++ = data->pin2.len & 0xff; memcpy(p, data->pin2.data, data->pin2.len); p += data->pin2.len; st.akn = data->pin_reference; r = asepcos_akn_to_fileid(card, &st); if (r != SC_SUCCESS) return r; fileid = 0x80 | (st.fileid & 0x1f); sc_format_apdu(card, apdu, SC_APDU_CASE_3_SHORT, 0x2C, 0x02, fileid); apdu->lc = p - buf; apdu->datalen = p - buf; apdu->data = buf; break; default: return SC_ERROR_NOT_SUPPORTED; } return SC_SUCCESS; }
0
441,659
static void __init __map_memblock(pgd_t *pgdp, phys_addr_t start, phys_addr_t end, pgprot_t prot, int flags) { __create_pgd_mapping(pgdp, start, __phys_to_virt(start), end - start, prot, early_pgtable_alloc, flags); }
0
409,843
void sock_zerocopy_callback(struct ubuf_info *uarg, bool success) { struct sk_buff *tail, *skb = skb_from_uarg(uarg); struct sock_exterr_skb *serr; struct sock *sk = skb->sk; struct sk_buff_head *q; unsigned long flags; u32 lo, hi; u16 len; mm_unaccount_pinned_pages(&uarg->mmp); /* if !len, there was only 1 call, and it was aborted * so do not queue a completion notification */ if (!uarg->len || sock_flag(sk, SOCK_DEAD)) goto release; len = uarg->len; lo = uarg->id; hi = uarg->id + len - 1; serr = SKB_EXT_ERR(skb); memset(serr, 0, sizeof(*serr)); serr->ee.ee_errno = 0; serr->ee.ee_origin = SO_EE_ORIGIN_ZEROCOPY; serr->ee.ee_data = hi; serr->ee.ee_info = lo; if (!success) serr->ee.ee_code |= SO_EE_CODE_ZEROCOPY_COPIED; q = &sk->sk_error_queue; spin_lock_irqsave(&q->lock, flags); tail = skb_peek_tail(q); if (!tail || SKB_EXT_ERR(tail)->ee.ee_origin != SO_EE_ORIGIN_ZEROCOPY || !skb_zerocopy_notify_extend(tail, lo, len)) { __skb_queue_tail(q, skb); skb = NULL; } spin_unlock_irqrestore(&q->lock, flags); sk->sk_error_report(sk); release: consume_skb(skb); sock_put(sk);
0
248,613
DefaultWebClientState IsDefaultProtocolClient(const std::string& protocol) { return GetDefaultWebClientStateFromShellUtilDefaultState( ShellUtil::GetChromeDefaultProtocolClientState( base::UTF8ToUTF16(protocol))); }
0
137,848
hybiReadHeader(ws_ctx_t *wsctx, int *sockRet, int *nPayload) { int ret; char *headerDst = wsctx->codeBufDecode + wsctx->header.nRead; int n = ((uint64_t)WSHLENMAX) - wsctx->header.nRead; ws_dbg("header_read to %p with len=%d\n", headerDst, n); ret = wsctx->ctxInfo.readFunc(wsctx->ctxInfo.ctxPtr, headerDst, n); ws_dbg("read %d bytes from socket\n", ret); if (ret <= 0) { if (-1 == ret) { /* save errno because rfbErr() will tamper it */ int olderrno = errno; rfbErr("%s: read; %s\n", __func__, strerror(errno)); errno = olderrno; goto err_cleanup_state; } else { *sockRet = 0; goto err_cleanup_state_sock_closed; } } wsctx->header.nRead += ret; if (wsctx->header.nRead < 2) { /* cannot decode header with less than two bytes */ goto ret_header_pending; } /* first two header bytes received; interpret header data and get rest */ wsctx->header.data = (ws_header_t *)wsctx->codeBufDecode; wsctx->header.opcode = wsctx->header.data->b0 & 0x0f; wsctx->header.fin = (wsctx->header.data->b0 & 0x80) >> 7; if (isControlFrame(wsctx)) { ws_dbg("is control frame\n"); /* is a control frame, leave remembered continuation opcode unchanged; * just check if there is a wrong fragmentation */ if (wsctx->header.fin == 0) { /* we only accept text/binary continuation frames; RFC6455: * Control frames (see Section 5.5) MAY be injected in the middle of * a fragmented message. Control frames themselves MUST NOT be * fragmented. */ rfbErr("control frame with FIN bit cleared received, aborting\n"); errno = EPROTO; goto err_cleanup_state; } } else { ws_dbg("not a control frame\n"); /* not a control frame, check for continuation opcode */ if (wsctx->header.opcode == WS_OPCODE_CONTINUATION) { ws_dbg("cont_frame\n"); /* do we have state (i.e., opcode) for continuation frame? */ if (wsctx->continuation_opcode == WS_OPCODE_INVALID) { rfbErr("no continuation state\n"); errno = EPROTO; goto err_cleanup_state; } /* otherwise, set opcode = continuation_opcode */ wsctx->header.opcode = wsctx->continuation_opcode; ws_dbg("set opcode to continuation_opcode: %d\n", wsctx->header.opcode); } else { if (wsctx->header.fin == 0) { wsctx->continuation_opcode = wsctx->header.opcode; } else { wsctx->continuation_opcode = WS_OPCODE_INVALID; } ws_dbg("set continuation_opcode to %d\n", wsctx->continuation_opcode); } } wsctx->header.payloadLen = (uint64_t)(wsctx->header.data->b1 & 0x7f); ws_dbg("first header bytes received; opcode=%d lenbyte=%d fin=%d\n", wsctx->header.opcode, wsctx->header.payloadLen, wsctx->header.fin); /* * 4.3. Client-to-Server Masking * * The client MUST mask all frames sent to the server. A server MUST * close the connection upon receiving a frame with the MASK bit set to 0. **/ if (!(wsctx->header.data->b1 & 0x80)) { rfbErr("%s: got frame without mask; ret=%d\n", __func__, ret); errno = EPROTO; goto err_cleanup_state; } if (wsctx->header.payloadLen < 126 && wsctx->header.nRead >= 6) { wsctx->header.headerLen = WS_HYBI_HEADER_LEN_SHORT; wsctx->header.mask = wsctx->header.data->u.m; } else if (wsctx->header.payloadLen == 126 && 8 <= wsctx->header.nRead) { wsctx->header.headerLen = WS_HYBI_HEADER_LEN_EXTENDED; wsctx->header.payloadLen = WS_NTOH16(wsctx->header.data->u.s16.l16); wsctx->header.mask = wsctx->header.data->u.s16.m16; } else if (wsctx->header.payloadLen == 127 && 14 <= wsctx->header.nRead) { wsctx->header.headerLen = WS_HYBI_HEADER_LEN_LONG; wsctx->header.payloadLen = WS_NTOH64(wsctx->header.data->u.s64.l64); wsctx->header.mask = wsctx->header.data->u.s64.m64; } else { /* Incomplete frame header, try again */ rfbErr("%s: incomplete frame header; ret=%d\n", __func__, ret); goto ret_header_pending; } char *h = wsctx->codeBufDecode; int i; ws_dbg("Header:\n"); for (i=0; i <10; i++) { ws_dbg("0x%02X\n", (unsigned char)h[i]); } ws_dbg("\n"); /* while RFC 6455 mandates that lengths MUST be encoded with the minimum * number of bytes, it does not specify for the server how to react on * 'wrongly' encoded frames --- this implementation rejects them*/ if ((wsctx->header.headerLen > WS_HYBI_HEADER_LEN_SHORT && wsctx->header.payloadLen < (uint64_t)126) || (wsctx->header.headerLen > WS_HYBI_HEADER_LEN_EXTENDED && wsctx->header.payloadLen < (uint64_t)65536)) { rfbErr("%s: invalid length field; headerLen=%d payloadLen=%llu\n", __func__, wsctx->header.headerLen, wsctx->header.payloadLen); errno = EPROTO; goto err_cleanup_state; } /* update write position for next bytes */ wsctx->writePos = wsctx->codeBufDecode + wsctx->header.nRead; /* set payload pointer just after header */ wsctx->readPos = (unsigned char *)(wsctx->codeBufDecode + wsctx->header.headerLen); *nPayload = wsctx->header.nRead - wsctx->header.headerLen; wsctx->nReadPayload = *nPayload; ws_dbg("header complete: state=%d headerlen=%d payloadlen=%llu writeTo=%p nPayload=%d\n", wsctx->hybiDecodeState, wsctx->header.headerLen, wsctx->header.payloadLen, wsctx->writePos, *nPayload); return WS_HYBI_STATE_DATA_NEEDED; ret_header_pending: errno = EAGAIN; *sockRet = -1; return WS_HYBI_STATE_HEADER_PENDING; err_cleanup_state: *sockRet = -1; err_cleanup_state_sock_closed: hybiDecodeCleanupComplete(wsctx); return WS_HYBI_STATE_ERR; }
0
506,525
long ssl3_ctx_callback_ctrl(SSL_CTX *ctx, int cmd, void (*fp)(void)) { CERT *cert; cert=ctx->cert; switch (cmd) { #ifndef OPENSSL_NO_RSA case SSL_CTRL_SET_TMP_RSA_CB: { cert->rsa_tmp_cb = (RSA *(*)(SSL *, int, int))fp; } break; #endif #ifndef OPENSSL_NO_DH case SSL_CTRL_SET_TMP_DH_CB: { cert->dh_tmp_cb = (DH *(*)(SSL *, int, int))fp; } break; #endif #ifndef OPENSSL_NO_ECDH case SSL_CTRL_SET_TMP_ECDH_CB: { cert->ecdh_tmp_cb = (EC_KEY *(*)(SSL *, int, int))fp; } break; #endif #ifndef OPENSSL_NO_TLSEXT case SSL_CTRL_SET_TLSEXT_SERVERNAME_CB: ctx->tlsext_servername_callback=(int (*)(SSL *,int *,void *))fp; break; #ifdef TLSEXT_TYPE_opaque_prf_input case SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB: ctx->tlsext_opaque_prf_input_callback = (int (*)(SSL *,void *, size_t, void *))fp; break; #endif case SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB: ctx->tlsext_status_cb=(int (*)(SSL *,void *))fp; break; case SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB: ctx->tlsext_ticket_key_cb=(int (*)(SSL *,unsigned char *, unsigned char *, EVP_CIPHER_CTX *, HMAC_CTX *, int))fp; break; #ifndef OPENSSL_NO_SRP case SSL_CTRL_SET_SRP_VERIFY_PARAM_CB: ctx->srp_ctx.srp_Mask|=SSL_kSRP; ctx->srp_ctx.SRP_verify_param_callback=(int (*)(SSL *,void *))fp; break; case SSL_CTRL_SET_TLS_EXT_SRP_USERNAME_CB: ctx->srp_ctx.srp_Mask|=SSL_kSRP; ctx->srp_ctx.TLS_ext_srp_username_callback=(int (*)(SSL *,int *,void *))fp; break; case SSL_CTRL_SET_SRP_GIVE_CLIENT_PWD_CB: ctx->srp_ctx.srp_Mask|=SSL_kSRP; ctx->srp_ctx.SRP_give_srp_client_pwd_callback=(char *(*)(SSL *,void *))fp; break; case SSL_CTRL_SET_TLS_EXT_SRP_MISSING_CLIENT_USERNAME_CB: ctx->srp_ctx.srp_Mask|=SSL_kSRP; ctx->srp_ctx.SRP_TLS_ext_missing_srp_client_username_callback=(char *(*)(SSL *,void *))fp; break; #endif #endif case SSL_CTRL_SET_NOT_RESUMABLE_SESS_CB: { ctx->not_resumable_session_cb = (int (*)(SSL *, int))fp; } break; default: return(0); } return(1); }
0
436,464
static int hidpp_ff_upload_effect(struct input_dev *dev, struct ff_effect *effect, struct ff_effect *old) { struct hidpp_ff_private_data *data = dev->ff->private; u8 params[20]; u8 size; int force; /* set common parameters */ params[2] = effect->replay.length >> 8; params[3] = effect->replay.length & 255; params[4] = effect->replay.delay >> 8; params[5] = effect->replay.delay & 255; switch (effect->type) { case FF_CONSTANT: force = (effect->u.constant.level * fixp_sin16((effect->direction * 360) >> 16)) >> 15; params[1] = HIDPP_FF_EFFECT_CONSTANT; params[6] = force >> 8; params[7] = force & 255; params[8] = effect->u.constant.envelope.attack_level >> 7; params[9] = effect->u.constant.envelope.attack_length >> 8; params[10] = effect->u.constant.envelope.attack_length & 255; params[11] = effect->u.constant.envelope.fade_level >> 7; params[12] = effect->u.constant.envelope.fade_length >> 8; params[13] = effect->u.constant.envelope.fade_length & 255; size = 14; dbg_hid("Uploading constant force level=%d in dir %d = %d\n", effect->u.constant.level, effect->direction, force); dbg_hid(" envelope attack=(%d, %d ms) fade=(%d, %d ms)\n", effect->u.constant.envelope.attack_level, effect->u.constant.envelope.attack_length, effect->u.constant.envelope.fade_level, effect->u.constant.envelope.fade_length); break; case FF_PERIODIC: { switch (effect->u.periodic.waveform) { case FF_SINE: params[1] = HIDPP_FF_EFFECT_PERIODIC_SINE; break; case FF_SQUARE: params[1] = HIDPP_FF_EFFECT_PERIODIC_SQUARE; break; case FF_SAW_UP: params[1] = HIDPP_FF_EFFECT_PERIODIC_SAWTOOTHUP; break; case FF_SAW_DOWN: params[1] = HIDPP_FF_EFFECT_PERIODIC_SAWTOOTHDOWN; break; case FF_TRIANGLE: params[1] = HIDPP_FF_EFFECT_PERIODIC_TRIANGLE; break; default: hid_err(data->hidpp->hid_dev, "Unexpected periodic waveform type %i!\n", effect->u.periodic.waveform); return -EINVAL; } force = (effect->u.periodic.magnitude * fixp_sin16((effect->direction * 360) >> 16)) >> 15; params[6] = effect->u.periodic.magnitude >> 8; params[7] = effect->u.periodic.magnitude & 255; params[8] = effect->u.periodic.offset >> 8; params[9] = effect->u.periodic.offset & 255; params[10] = effect->u.periodic.period >> 8; params[11] = effect->u.periodic.period & 255; params[12] = effect->u.periodic.phase >> 8; params[13] = effect->u.periodic.phase & 255; params[14] = effect->u.periodic.envelope.attack_level >> 7; params[15] = effect->u.periodic.envelope.attack_length >> 8; params[16] = effect->u.periodic.envelope.attack_length & 255; params[17] = effect->u.periodic.envelope.fade_level >> 7; params[18] = effect->u.periodic.envelope.fade_length >> 8; params[19] = effect->u.periodic.envelope.fade_length & 255; size = 20; dbg_hid("Uploading periodic force mag=%d/dir=%d, offset=%d, period=%d ms, phase=%d\n", effect->u.periodic.magnitude, effect->direction, effect->u.periodic.offset, effect->u.periodic.period, effect->u.periodic.phase); dbg_hid(" envelope attack=(%d, %d ms) fade=(%d, %d ms)\n", effect->u.periodic.envelope.attack_level, effect->u.periodic.envelope.attack_length, effect->u.periodic.envelope.fade_level, effect->u.periodic.envelope.fade_length); break; } case FF_RAMP: params[1] = HIDPP_FF_EFFECT_RAMP; force = (effect->u.ramp.start_level * fixp_sin16((effect->direction * 360) >> 16)) >> 15; params[6] = force >> 8; params[7] = force & 255; force = (effect->u.ramp.end_level * fixp_sin16((effect->direction * 360) >> 16)) >> 15; params[8] = force >> 8; params[9] = force & 255; params[10] = effect->u.ramp.envelope.attack_level >> 7; params[11] = effect->u.ramp.envelope.attack_length >> 8; params[12] = effect->u.ramp.envelope.attack_length & 255; params[13] = effect->u.ramp.envelope.fade_level >> 7; params[14] = effect->u.ramp.envelope.fade_length >> 8; params[15] = effect->u.ramp.envelope.fade_length & 255; size = 16; dbg_hid("Uploading ramp force level=%d -> %d in dir %d = %d\n", effect->u.ramp.start_level, effect->u.ramp.end_level, effect->direction, force); dbg_hid(" envelope attack=(%d, %d ms) fade=(%d, %d ms)\n", effect->u.ramp.envelope.attack_level, effect->u.ramp.envelope.attack_length, effect->u.ramp.envelope.fade_level, effect->u.ramp.envelope.fade_length); break; case FF_FRICTION: case FF_INERTIA: case FF_SPRING: case FF_DAMPER: params[1] = HIDPP_FF_CONDITION_CMDS[effect->type - FF_SPRING]; params[6] = effect->u.condition[0].left_saturation >> 9; params[7] = (effect->u.condition[0].left_saturation >> 1) & 255; params[8] = effect->u.condition[0].left_coeff >> 8; params[9] = effect->u.condition[0].left_coeff & 255; params[10] = effect->u.condition[0].deadband >> 9; params[11] = (effect->u.condition[0].deadband >> 1) & 255; params[12] = effect->u.condition[0].center >> 8; params[13] = effect->u.condition[0].center & 255; params[14] = effect->u.condition[0].right_coeff >> 8; params[15] = effect->u.condition[0].right_coeff & 255; params[16] = effect->u.condition[0].right_saturation >> 9; params[17] = (effect->u.condition[0].right_saturation >> 1) & 255; size = 18; dbg_hid("Uploading %s force left coeff=%d, left sat=%d, right coeff=%d, right sat=%d\n", HIDPP_FF_CONDITION_NAMES[effect->type - FF_SPRING], effect->u.condition[0].left_coeff, effect->u.condition[0].left_saturation, effect->u.condition[0].right_coeff, effect->u.condition[0].right_saturation); dbg_hid(" deadband=%d, center=%d\n", effect->u.condition[0].deadband, effect->u.condition[0].center); break; default: hid_err(data->hidpp->hid_dev, "Unexpected force type %i!\n", effect->type); return -EINVAL; } return hidpp_ff_queue_work(data, effect->id, HIDPP_FF_DOWNLOAD_EFFECT, params, size); }
0
170,625
bool destroyed() const { return destroyed_; }
0
129,061
static void gf_isom_check_sample_desc(GF_TrackBox *trak) { GF_BitStream *bs; GF_UnknownBox *a; u32 i; if (!trak->Media || !trak->Media->information) { GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, ("[iso file] Track with no media box !\n" )); return; } if (!trak->Media->information->sampleTable) { GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, ("[iso file] Track with no sample table !\n" )); trak->Media->information->sampleTable = (GF_SampleTableBox *) gf_isom_box_new(GF_ISOM_BOX_TYPE_STBL); } if (!trak->Media->information->sampleTable->SampleDescription) { GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, ("[iso file] Track with no sample description box !\n" )); trak->Media->information->sampleTable->SampleDescription = (GF_SampleDescriptionBox *) gf_isom_box_new(GF_ISOM_BOX_TYPE_STSD); return; } i=0; while ((a = (GF_UnknownBox*)gf_list_enum(trak->Media->information->sampleTable->SampleDescription->other_boxes, &i))) { switch (a->type) { case GF_ISOM_BOX_TYPE_MP4S: case GF_ISOM_BOX_TYPE_ENCS: case GF_ISOM_BOX_TYPE_MP4A: case GF_ISOM_BOX_TYPE_ENCA: case GF_ISOM_BOX_TYPE_MP4V: case GF_ISOM_BOX_TYPE_ENCV: case GF_ISOM_BOX_TYPE_RESV: case GF_ISOM_SUBTYPE_3GP_AMR: case GF_ISOM_SUBTYPE_3GP_AMR_WB: case GF_ISOM_SUBTYPE_3GP_EVRC: case GF_ISOM_SUBTYPE_3GP_QCELP: case GF_ISOM_SUBTYPE_3GP_SMV: case GF_ISOM_SUBTYPE_3GP_H263: case GF_ISOM_BOX_TYPE_GHNT: case GF_ISOM_BOX_TYPE_RTP_STSD: case GF_ISOM_BOX_TYPE_SRTP_STSD: case GF_ISOM_BOX_TYPE_FDP_STSD: case GF_ISOM_BOX_TYPE_RRTP_STSD: case GF_ISOM_BOX_TYPE_RTCP_STSD: case GF_ISOM_BOX_TYPE_METX: case GF_ISOM_BOX_TYPE_METT: case GF_ISOM_BOX_TYPE_STXT: case GF_ISOM_BOX_TYPE_AVC1: case GF_ISOM_BOX_TYPE_AVC2: case GF_ISOM_BOX_TYPE_AVC3: case GF_ISOM_BOX_TYPE_AVC4: case GF_ISOM_BOX_TYPE_SVC1: case GF_ISOM_BOX_TYPE_MVC1: case GF_ISOM_BOX_TYPE_HVC1: case GF_ISOM_BOX_TYPE_HEV1: case GF_ISOM_BOX_TYPE_HVC2: case GF_ISOM_BOX_TYPE_HEV2: case GF_ISOM_BOX_TYPE_HVT1: case GF_ISOM_BOX_TYPE_LHV1: case GF_ISOM_BOX_TYPE_LHE1: case GF_ISOM_BOX_TYPE_AV01: case GF_ISOM_BOX_TYPE_VP08: case GF_ISOM_BOX_TYPE_VP09: case GF_ISOM_BOX_TYPE_AV1C: case GF_ISOM_BOX_TYPE_TX3G: case GF_ISOM_BOX_TYPE_TEXT: case GF_ISOM_BOX_TYPE_ENCT: case GF_ISOM_BOX_TYPE_DIMS: case GF_ISOM_BOX_TYPE_AC3: case GF_ISOM_BOX_TYPE_EC3: case GF_ISOM_BOX_TYPE_LSR1: case GF_ISOM_BOX_TYPE_WVTT: case GF_ISOM_BOX_TYPE_STPP: case GF_ISOM_BOX_TYPE_SBTT: case GF_ISOM_BOX_TYPE_MP3: case GF_ISOM_BOX_TYPE_JPEG: case GF_ISOM_BOX_TYPE_PNG: case GF_ISOM_BOX_TYPE_JP2K: case GF_ISOM_BOX_TYPE_MHA1: case GF_ISOM_BOX_TYPE_MHA2: case GF_ISOM_BOX_TYPE_MHM1: case GF_ISOM_BOX_TYPE_MHM2: case GF_QT_BOX_TYPE_AUDIO_RAW: case GF_QT_BOX_TYPE_AUDIO_TWOS: case GF_QT_BOX_TYPE_AUDIO_SOWT: case GF_QT_BOX_TYPE_AUDIO_FL32: case GF_QT_BOX_TYPE_AUDIO_FL64: case GF_QT_BOX_TYPE_AUDIO_IN24: case GF_QT_BOX_TYPE_AUDIO_IN32: case GF_QT_BOX_TYPE_AUDIO_ULAW: case GF_QT_BOX_TYPE_AUDIO_ALAW: case GF_QT_BOX_TYPE_AUDIO_ADPCM: case GF_QT_BOX_TYPE_AUDIO_IMA_ADPCM: case GF_QT_BOX_TYPE_AUDIO_DVCA: case GF_QT_BOX_TYPE_AUDIO_QDMC: case GF_QT_BOX_TYPE_AUDIO_QDMC2: case GF_QT_BOX_TYPE_AUDIO_QCELP: case GF_QT_BOX_TYPE_AUDIO_kMP3: continue; case GF_ISOM_BOX_TYPE_UNKNOWN: break; default: if (gf_box_valid_in_parent((GF_Box *) a, "stsd")) { continue; } GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, ("[iso file] Unexpected box %s in stsd!\n", gf_4cc_to_str(a->type))); continue; } //we are sure to have an unknown box here assert(a->type==GF_ISOM_BOX_TYPE_UNKNOWN); if (!a->data || (a->dataSize<8) ) { GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, ("[iso file] Sample description %s does not have at least 8 bytes!\n", gf_4cc_to_str(a->original_4cc) )); continue; } else if (a->dataSize > a->size) { GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[iso file] Sample description %s has wrong data size %d!\n", gf_4cc_to_str(a->original_4cc), a->dataSize)); continue; } #define STSD_SWITCH_BOX(_box) \ if (gf_bs_available(bs)) { \ u64 pos = gf_bs_get_position(bs); \ u32 count_subb = 0; \ GF_Err e;\ gf_bs_set_cookie(bs, 1);\ e = gf_isom_box_array_read((GF_Box *) _box, bs, gf_isom_box_add_default); \ count_subb = _box->other_boxes ? gf_list_count(_box->other_boxes) : 0; \ if (!count_subb || e) { \ gf_bs_seek(bs, pos); \ _box->data_size = (u32) gf_bs_available(bs); \ if (_box->data_size) { \ _box->data = a->data; \ a->data = NULL; \ memmove(_box->data, _box->data + pos, _box->data_size); \ } \ } else { \ _box->data_size = 0; \ } \ } \ gf_bs_del(bs); \ if (!_box->data_size && _box->data) { \ gf_free(_box->data); \ _box->data = NULL; \ } \ _box->size = 0; \ _box->EntryType = a->original_4cc; \ gf_list_rem(trak->Media->information->sampleTable->SampleDescription->other_boxes, i-1); \ gf_isom_box_del((GF_Box *)a); \ gf_list_insert(trak->Media->information->sampleTable->SampleDescription->other_boxes, _box, i-1); \ /*only process visual or audio*/ switch (trak->Media->handler->handlerType) { case GF_ISOM_MEDIA_VISUAL: case GF_ISOM_MEDIA_AUXV: case GF_ISOM_MEDIA_PICT: { GF_GenericVisualSampleEntryBox *genv = (GF_GenericVisualSampleEntryBox *) gf_isom_box_new(GF_ISOM_BOX_TYPE_GNRV); bs = gf_bs_new(a->data, a->dataSize, GF_BITSTREAM_READ); genv->size = a->size-8; gf_isom_video_sample_entry_read((GF_VisualSampleEntryBox *) genv, bs); STSD_SWITCH_BOX(genv) } break; case GF_ISOM_MEDIA_AUDIO: { GF_GenericAudioSampleEntryBox *gena = (GF_GenericAudioSampleEntryBox *) gf_isom_box_new(GF_ISOM_BOX_TYPE_GNRA); gena->size = a->size-8; bs = gf_bs_new(a->data, a->dataSize, GF_BITSTREAM_READ); gf_isom_audio_sample_entry_read((GF_AudioSampleEntryBox *) gena, bs); STSD_SWITCH_BOX(gena) } break; default: { GF_Err e; GF_GenericSampleEntryBox *genm = (GF_GenericSampleEntryBox *) gf_isom_box_new(GF_ISOM_BOX_TYPE_GNRM); genm->size = a->size-8; bs = gf_bs_new(a->data, a->dataSize, GF_BITSTREAM_READ); e = gf_isom_base_sample_entry_read((GF_SampleEntryBox *)genm, bs); if (e) return; STSD_SWITCH_BOX(genm) } break; } }
0
223,742
int GetChangedMouseButtonFlagsFromNative( const base::NativeEvent& native_event) { switch (GetNativeMouseKey(native_event)) { case MK_LBUTTON: return EF_LEFT_MOUSE_BUTTON; case MK_MBUTTON: return EF_MIDDLE_MOUSE_BUTTON; case MK_RBUTTON: return EF_RIGHT_MOUSE_BUTTON; default: break; } return 0; }
0
68,830
static void ff_jref_idct1_put(uint8_t *dest, ptrdiff_t line_size, int16_t *block) { dest[0] = av_clip_uint8((block[0] + 4)>>3); }
0
276,572
float GetTouchForce(const base::NativeEvent& native_event) { NOTIMPLEMENTED(); return 0.0; }
0
252,019
bool initial_sync_ended_for_type(syncable::ModelType type) { return directory()->initial_sync_ended_for_type(type); }
0
184,917
bool jsvIsArray(const JsVar *v) { return v && (v->flags&JSV_VARTYPEMASK)==JSV_ARRAY; }
0
258,280
static void virtio_net_reset ( VirtIODevice * vdev ) { VirtIONet * n = to_virtio_net ( vdev ) ; n -> promisc = 1 ; n -> allmulti = 0 ; n -> alluni = 0 ; n -> nomulti = 0 ; n -> nouni = 0 ; n -> nobcast = 0 ; n -> mac_table . in_use = 0 ; n -> mac_table . first_multi = 0 ; n -> mac_table . multi_overflow = 0 ; n -> mac_table . uni_overflow = 0 ; memset ( n -> mac_table . macs , 0 , MAC_TABLE_ENTRIES * ETH_ALEN ) ; memset ( n -> vlans , 0 , MAX_VLAN >> 3 ) ; }
0
109,570
static int create_uaxx_quirk(struct snd_usb_audio *chip, struct usb_interface *iface, struct usb_driver *driver, const struct snd_usb_audio_quirk *quirk) { static const struct audioformat ua_format = { .formats = SNDRV_PCM_FMTBIT_S24_3LE, .channels = 2, .fmt_type = UAC_FORMAT_TYPE_I, .altsetting = 1, .altset_idx = 1, .rates = SNDRV_PCM_RATE_CONTINUOUS, }; struct usb_host_interface *alts; struct usb_interface_descriptor *altsd; struct audioformat *fp; int stream, err; /* both PCM and MIDI interfaces have 2 or more altsettings */ if (iface->num_altsetting < 2) return -ENXIO; alts = &iface->altsetting[1]; altsd = get_iface_desc(alts); if (altsd->bNumEndpoints == 2) { static const struct snd_usb_midi_endpoint_info ua700_ep = { .out_cables = 0x0003, .in_cables = 0x0003 }; static const struct snd_usb_audio_quirk ua700_quirk = { .type = QUIRK_MIDI_FIXED_ENDPOINT, .data = &ua700_ep }; static const struct snd_usb_midi_endpoint_info uaxx_ep = { .out_cables = 0x0001, .in_cables = 0x0001 }; static const struct snd_usb_audio_quirk uaxx_quirk = { .type = QUIRK_MIDI_FIXED_ENDPOINT, .data = &uaxx_ep }; const struct snd_usb_audio_quirk *quirk = chip->usb_id == USB_ID(0x0582, 0x002b) ? &ua700_quirk : &uaxx_quirk; return __snd_usbmidi_create(chip->card, iface, &chip->midi_list, quirk, chip->usb_id); } if (altsd->bNumEndpoints != 1) return -ENXIO; fp = kmemdup(&ua_format, sizeof(*fp), GFP_KERNEL); if (!fp) return -ENOMEM; fp->iface = altsd->bInterfaceNumber; fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress; fp->ep_attr = get_endpoint(alts, 0)->bmAttributes; fp->datainterval = 0; fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize); switch (fp->maxpacksize) { case 0x120: fp->rate_max = fp->rate_min = 44100; break; case 0x138: case 0x140: fp->rate_max = fp->rate_min = 48000; break; case 0x258: case 0x260: fp->rate_max = fp->rate_min = 96000; break; default: usb_audio_err(chip, "unknown sample rate\n"); kfree(fp); return -ENXIO; } stream = (fp->endpoint & USB_DIR_IN) ? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK; err = snd_usb_add_audio_stream(chip, stream, fp); if (err < 0) { kfree(fp); return err; } usb_set_interface(chip->dev, fp->iface, 0); return 0; }
0
513,322
CallRewrite(y, xs, xe, doit) int y, xs, xe, doit; { struct canvas *cv, *cvlist, *cvlnext; struct viewport *vp; struct layer *oldflayer; int cost; debug3("CallRewrite %d %d %d\n", y, xs, xe); ASSERT(display); ASSERT(xe >= xs); vp = 0; for (cv = D_cvlist; cv; cv = cv->c_next) { if (y < cv->c_ys || y > cv->c_ye || xe < cv->c_xs || xs > cv->c_xe) continue; for (vp = cv->c_vplist; vp; vp = vp->v_next) if (y >= vp->v_ys && y <= vp->v_ye && xe >= vp->v_xs && xs <= vp->v_xe) break; if (vp) break; } if (doit) { oldflayer = flayer; flayer = cv->c_layer; cvlist = flayer->l_cvlist; cvlnext = cv->c_lnext; flayer->l_cvlist = cv; cv->c_lnext = 0; LayRewrite(y - vp->v_yoff, xs - vp->v_xoff, xe - vp->v_xoff, &D_rend, 1); flayer->l_cvlist = cvlist; cv->c_lnext = cvlnext; flayer = oldflayer; return 0; } if (cv == 0 || cv->c_layer == 0) return EXPENSIVE; /* not found or nothing on it */ if (xs < vp->v_xs || xe > vp->v_xe) return EXPENSIVE; /* crosses viewport boundaries */ if (y - vp->v_yoff < 0 || y - vp->v_yoff >= cv->c_layer->l_height) return EXPENSIVE; /* line not on layer */ if (xs - vp->v_xoff < 0 || xe - vp->v_xoff >= cv->c_layer->l_width) return EXPENSIVE; /* line not on layer */ #ifdef UTF8 if (D_encoding == UTF8) D_rend.font = 0; #endif oldflayer = flayer; flayer = cv->c_layer; debug3("Calling Rewrite %d %d %d\n", y - vp->v_yoff, xs - vp->v_xoff, xe - vp->v_xoff); cost = LayRewrite(y - vp->v_yoff, xs - vp->v_xoff, xe - vp->v_xoff, &D_rend, 0); flayer = oldflayer; if (D_insert) cost += D_EIcost + D_IMcost; return cost; }
0
176,380
WebGLUniformLocation* WebGLRenderingContextBase::getUniformLocation( WebGLProgram* program, const String& name) { if (!ValidateWebGLProgramOrShader("getUniformLocation", program)) return nullptr; if (!ValidateLocationLength("getUniformLocation", name)) return nullptr; if (!ValidateString("getUniformLocation", name)) return nullptr; if (IsPrefixReserved(name)) return nullptr; if (!program->LinkStatus(this)) { SynthesizeGLError(GL_INVALID_OPERATION, "getUniformLocation", "program not linked"); return nullptr; } GLint uniform_location = ContextGL()->GetUniformLocation( ObjectOrZero(program), name.Utf8().data()); if (uniform_location == -1) return nullptr; return WebGLUniformLocation::Create(program, uniform_location); }
0
268,318
int phar_copy_entry_fp(phar_entry_info *source, phar_entry_info *dest, char **error) /* {{{ */ { phar_entry_info *link; if (FAILURE == phar_open_entry_fp(source, error, 1)) { return FAILURE; } if (dest->link) { efree(dest->link); dest->link = NULL; dest->tar_type = (dest->is_tar ? TAR_FILE : '\0'); } dest->fp_type = PHAR_MOD; dest->offset = 0; dest->is_modified = 1; dest->fp = php_stream_fopen_tmpfile(); if (dest->fp == NULL) { spprintf(error, 0, "phar error: unable to create temporary file"); return EOF; } phar_seek_efp(source, 0, SEEK_SET, 0, 1); link = phar_get_link_source(source); if (!link) { link = source; } if (SUCCESS != php_stream_copy_to_stream_ex(phar_get_efp(link, 0), dest->fp, link->uncompressed_filesize, NULL)) { php_stream_close(dest->fp); dest->fp_type = PHAR_FP; if (error) { spprintf(error, 4096, "phar error: unable to copy contents of file \"%s\" to \"%s\" in phar archive \"%s\"", source->filename, dest->filename, source->phar->fname); } return FAILURE; } return SUCCESS; }
0
511,040
int BN_num_bits(const BIGNUM *a) { int i = a->top - 1; bn_check_top(a); if (BN_is_zero(a)) return 0; return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); }
0
491,194
TPMS_KDF_SCHEME_KDF1_SP800_56A_Unmarshal(TPMS_KDF_SCHEME_KDF1_SP800_56A *target, BYTE **buffer, INT32 *size) { TPM_RC rc = TPM_RC_SUCCESS; if (rc == TPM_RC_SUCCESS) { rc = TPMS_SCHEME_HASH_Unmarshal(target, buffer, size); } return rc; }
0
116,348
findtags_in_help_init(findtags_state_T *st) { int i; char_u *s; // Keep 'en' as the language if the file extension is '.txt' if (st->is_txt) STRCPY(st->help_lang, "en"); else { // Prefer help tags according to 'helplang'. Put the two-letter // language name in help_lang[]. i = (int)STRLEN(st->tag_fname); if (i > 3 && st->tag_fname[i - 3] == '-') vim_strncpy(st->help_lang, st->tag_fname + i - 2, 2); else STRCPY(st->help_lang, "en"); } // When searching for a specific language skip tags files for other // languages. if (st->help_lang_find != NULL && STRICMP(st->help_lang, st->help_lang_find) != 0) return FALSE; // For CTRL-] in a help file prefer a match with the same language. if ((st->flags & TAG_KEEP_LANG) && st->help_lang_find == NULL && curbuf->b_fname != NULL && (i = (int)STRLEN(curbuf->b_fname)) > 4 && curbuf->b_fname[i - 1] == 'x' && curbuf->b_fname[i - 4] == '.' && STRNICMP(curbuf->b_fname + i - 3, st->help_lang, 2) == 0) st->help_pri = 0; else { // search for the language in 'helplang' st->help_pri = 1; for (s = p_hlg; *s != NUL; ++s) { if (STRNICMP(s, st->help_lang, 2) == 0) break; ++st->help_pri; if ((s = vim_strchr(s, ',')) == NULL) break; } if (s == NULL || *s == NUL) { // Language not in 'helplang': use last, prefer English, unless // found already. ++st->help_pri; if (STRICMP(st->help_lang, "en") != 0) ++st->help_pri; } } return TRUE; }
0
278,541
virtual ~FakeRegistrationManager() {}
0
128,328
TEST_F(SecretManagerImplTest, ConfigDumpHandlerStaticValidationContext) { Server::MockInstance server; auto secret_manager = std::make_unique<SecretManagerImpl>(config_tracker_); time_system_.setSystemTime(std::chrono::milliseconds(1234567891234)); NiceMock<Server::Configuration::MockTransportSocketFactoryContext> secret_context; envoy::config::core::v3::ConfigSource config_source; NiceMock<LocalInfo::MockLocalInfo> local_info; NiceMock<Event::MockDispatcher> dispatcher; NiceMock<Random::MockRandomGenerator> random; Stats::IsolatedStoreImpl stats; NiceMock<Init::MockManager> init_manager; NiceMock<Init::ExpectableWatcherImpl> init_watcher; Init::TargetHandlePtr init_target_handle; EXPECT_CALL(init_manager, add(_)) .WillRepeatedly(Invoke([&init_target_handle](const Init::Target& target) { init_target_handle = target.createHandle("test"); })); EXPECT_CALL(secret_context, stats()).WillRepeatedly(ReturnRef(stats)); EXPECT_CALL(secret_context, initManager()).WillRepeatedly(ReturnRef(init_manager)); EXPECT_CALL(secret_context, mainThreadDispatcher()).WillRepeatedly(ReturnRef(dispatcher)); EXPECT_CALL(secret_context, localInfo()).WillRepeatedly(ReturnRef(local_info)); const std::string validation_context = R"EOF( name: "abc.com.validation" validation_context: trusted_ca: inline_string: "DUMMY_INLINE_STRING_TRUSTED_CA" )EOF"; envoy::extensions::transport_sockets::tls::v3::Secret validation_secret; TestUtility::loadFromYaml(TestEnvironment::substitute(validation_context), validation_secret); secret_manager->addStaticSecret(validation_secret); const std::string expected_config_dump = R"EOF( static_secrets: - name: "abc.com.validation" secret: "@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.Secret name: "abc.com.validation" validation_context: trusted_ca: inline_string: "DUMMY_INLINE_STRING_TRUSTED_CA" )EOF"; checkConfigDump(expected_config_dump); StrictMock<MockStringMatcher> mock_matcher; EXPECT_CALL(mock_matcher, match("abc.com.validation")).WillOnce(Return(false)); checkConfigDump("{}", mock_matcher); }
0
345,148
PHP_FUNCTION(chmod) { char *filename; int filename_len; long mode; int ret; mode_t imode; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &filename, &filename_len, &mode) == FAILURE) { return; } if (PG(safe_mode) &&(!php_checkuid(filename, NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS))) { RETURN_FALSE; } /* Check the basedir */ if (php_check_open_basedir(filename TSRMLS_CC)) { RETURN_FALSE; } imode = (mode_t) mode; /* In safe mode, do not allow to setuid files. * Setuiding files could allow users to gain privileges * that safe mode doesn't give them. */ if (PG(safe_mode)) { php_stream_statbuf ssb; if (php_stream_stat_path_ex(filename, 0, &ssb, NULL)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "stat failed for %s", filename); RETURN_FALSE; } if ((imode & 04000) != 0 && (ssb.sb.st_mode & 04000) == 0) { imode ^= 04000; } if ((imode & 02000) != 0 && (ssb.sb.st_mode & 02000) == 0) { imode ^= 02000; } if ((imode & 01000) != 0 && (ssb.sb.st_mode & 01000) == 0) { imode ^= 01000; } } ret = VCWD_CHMOD(filename, imode); if (ret == -1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); RETURN_FALSE; } RETURN_TRUE; }
1
234,669
event_clear_no_set_filter_flag(struct trace_event_file *file) { file->flags &= ~EVENT_FILE_FL_NO_SET_FILTER; }
0
504,701
kssl_krb5_cc_get_principal (krb5_context context, krb5_ccache cache, krb5_principal *principal) { if ( p_krb5_cc_get_principal ) return(p_krb5_cc_get_principal(context,cache,principal)); else return(krb5_x ((cache)->ops->get_princ,(context, cache, principal))); }
0