target
int64
0
1
func
stringlengths
0
484k
idx
int64
1
378k
1
ModHandle CModules::OpenModule(const CString& sModule, const CString& sModPath, CModInfo& Info, CString& sRetMsg) { // Some sane defaults in case anything errors out below sRetMsg.clear(); for (unsigned int a = 0; a < sModule.length(); a++) { if (((sModule[a] < '0') || (sModule[a] > '9')) && ((sModule[a] < 'a') || (sModule[a] > 'z')) && ((sModule[a] < 'A') || (sModule[a] > 'Z')) && (sModule[a] != '_')) { sRetMsg = t_f("Module names can only contain letters, numbers and " "underscores, [{1}] is invalid")(sModule); return nullptr; } } // The second argument to dlopen() has a long history. It seems clear // that (despite what the man page says) we must include either of // RTLD_NOW and RTLD_LAZY and either of RTLD_GLOBAL and RTLD_LOCAL. // // RTLD_NOW vs. RTLD_LAZY: We use RTLD_NOW to avoid ZNC dying due to // failed symbol lookups later on. Doesn't really seem to have much of a // performance impact. // // RTLD_GLOBAL vs. RTLD_LOCAL: If perl is loaded with RTLD_LOCAL and later // on loads own modules (which it apparently does with RTLD_LAZY), we will // die in a name lookup since one of perl's symbols isn't found. That's // worse than any theoretical issue with RTLD_GLOBAL. ModHandle p = dlopen((sModPath).c_str(), RTLD_NOW | RTLD_GLOBAL); if (!p) { // dlerror() returns pointer to static buffer, which may be overwritten // very soon with another dl call also it may just return null. const char* cDlError = dlerror(); CString sDlError = cDlError ? cDlError : t_s("Unknown error"); sRetMsg = t_f("Unable to open module {1}: {2}")(sModule, sDlError); return nullptr; } const CModuleEntry* (*fpZNCModuleEntry)() = nullptr; // man dlsym(3) explains this *reinterpret_cast<void**>(&fpZNCModuleEntry) = dlsym(p, "ZNCModuleEntry"); if (!fpZNCModuleEntry) { dlclose(p); sRetMsg = t_f("Could not find ZNCModuleEntry in module {1}")(sModule); return nullptr; } const CModuleEntry* pModuleEntry = fpZNCModuleEntry(); if (std::strcmp(pModuleEntry->pcVersion, VERSION_STR) || std::strcmp(pModuleEntry->pcVersionExtra, VERSION_EXTRA)) { sRetMsg = t_f( "Version mismatch for module {1}: core is {2}, module is built for " "{3}. Recompile this module.")( sModule, VERSION_STR VERSION_EXTRA, CString(pModuleEntry->pcVersion) + pModuleEntry->pcVersionExtra); dlclose(p); return nullptr; } if (std::strcmp(pModuleEntry->pcCompileOptions, ZNC_COMPILE_OPTIONS_STRING)) { sRetMsg = t_f( "Module {1} is built incompatibly: core is '{2}', module is '{3}'. " "Recompile this module.")(sModule, ZNC_COMPILE_OPTIONS_STRING, pModuleEntry->pcCompileOptions); dlclose(p); return nullptr; } CTranslationDomainRefHolder translation("znc-" + sModule); pModuleEntry->fpFillModInfo(Info); sRetMsg = ""; return p; }
618
0
static void handle_new_lock_ctx ( struct xml_ctx * ctx , int tag_closed ) { struct remote_lock * lock = ( struct remote_lock * ) ctx -> userData ; git_SHA_CTX sha_ctx ; unsigned char lock_token_sha1 [ 20 ] ; if ( tag_closed && ctx -> cdata ) { if ( ! strcmp ( ctx -> name , DAV_ACTIVELOCK_OWNER ) ) { lock -> owner = xstrdup ( ctx -> cdata ) ; } else if ( ! strcmp ( ctx -> name , DAV_ACTIVELOCK_TIMEOUT ) ) { const char * arg ; if ( skip_prefix ( ctx -> cdata , "Second-" , & arg ) ) lock -> timeout = strtol ( arg , NULL , 10 ) ; } else if ( ! strcmp ( ctx -> name , DAV_ACTIVELOCK_TOKEN ) ) { lock -> token = xstrdup ( ctx -> cdata ) ; git_SHA1_Init ( & sha_ctx ) ; git_SHA1_Update ( & sha_ctx , lock -> token , strlen ( lock -> token ) ) ; git_SHA1_Final ( lock_token_sha1 , & sha_ctx ) ; lock -> tmpfile_suffix [ 0 ] = '_' ; memcpy ( lock -> tmpfile_suffix + 1 , sha1_to_hex ( lock_token_sha1 ) , 40 ) ; } } }
619
0
static int ppc_fixup_cpu(PowerPCCPU *cpu) { CPUPPCState *env = &cpu->env; /* TCG doesn't (yet) emulate some groups of instructions that * are implemented on some otherwise supported CPUs (e.g. VSX * and decimal floating point instructions on POWER7). We * remove unsupported instruction groups from the cpu state's * instruction masks and hope the guest can cope. For at * least the pseries machine, the unavailability of these * instructions can be advertised to the guest via the device * tree. */ if ((env->insns_flags & ~PPC_TCG_INSNS) || (env->insns_flags2 & ~PPC_TCG_INSNS2)) { fprintf(stderr, "Warning: Disabling some instructions which are not " "emulated by TCG (0x%" PRIx64 ", 0x%" PRIx64 ")\n", env->insns_flags & ~PPC_TCG_INSNS, env->insns_flags2 & ~PPC_TCG_INSNS2); } env->insns_flags &= PPC_TCG_INSNS; env->insns_flags2 &= PPC_TCG_INSNS2; return 0; }
620
1
init_state(struct posix_acl_state *state, int cnt) { int alloc; memset(state, 0, sizeof(struct posix_acl_state)); state->empty = 1; /* * In the worst case, each individual acl could be for a distinct * named user or group, but we don't no which, so we allocate * enough space for either: */ alloc = sizeof(struct posix_ace_state_array) + cnt*sizeof(struct posix_ace_state); state->users = kzalloc(alloc, GFP_KERNEL); if (!state->users) return -ENOMEM; state->groups = kzalloc(alloc, GFP_KERNEL); if (!state->groups) { kfree(state->users); return -ENOMEM; } return 0; }
621
0
void main_loop_wait(int timeout) { IOHandlerRecord *ioh; fd_set rfds, wfds, xfds; int ret, nfds; struct timeval tv; qemu_bh_update_timeout(&timeout); host_main_loop_wait(&timeout); /* poll any events */ /* XXX: separate device handlers from system ones */ nfds = -1; FD_ZERO(&rfds); FD_ZERO(&wfds); FD_ZERO(&xfds); for(ioh = first_io_handler; ioh != NULL; ioh = ioh->next) { if (ioh->deleted) continue; if (ioh->fd_read && (!ioh->fd_read_poll || ioh->fd_read_poll(ioh->opaque) != 0)) { FD_SET(ioh->fd, &rfds); if (ioh->fd > nfds) nfds = ioh->fd; } if (ioh->fd_write) { FD_SET(ioh->fd, &wfds); if (ioh->fd > nfds) nfds = ioh->fd; } } tv.tv_sec = timeout / 1000; tv.tv_usec = (timeout % 1000) * 1000; slirp_select_fill(&nfds, &rfds, &wfds, &xfds); qemu_mutex_unlock_iothread(); ret = select(nfds + 1, &rfds, &wfds, &xfds, &tv); qemu_mutex_lock_iothread(); if (ret > 0) { IOHandlerRecord **pioh; for(ioh = first_io_handler; ioh != NULL; ioh = ioh->next) { if (!ioh->deleted && ioh->fd_read && FD_ISSET(ioh->fd, &rfds)) { ioh->fd_read(ioh->opaque); } if (!ioh->deleted && ioh->fd_write && FD_ISSET(ioh->fd, &wfds)) { ioh->fd_write(ioh->opaque); } } /* remove deleted IO handlers */ pioh = &first_io_handler; while (*pioh) { ioh = *pioh; if (ioh->deleted) { *pioh = ioh->next; qemu_free(ioh); } else pioh = &ioh->next; } } slirp_select_poll(&rfds, &wfds, &xfds, (ret < 0)); /* rearm timer, if not periodic */ if (alarm_timer->flags & ALARM_FLAG_EXPIRED) { alarm_timer->flags &= ~ALARM_FLAG_EXPIRED; qemu_rearm_alarm_timer(alarm_timer); } /* vm time timers */ if (vm_running) { if (!cur_cpu || likely(!(cur_cpu->singlestep_enabled & SSTEP_NOTIMER))) qemu_run_timers(&active_timers[QEMU_TIMER_VIRTUAL], qemu_get_clock(vm_clock)); } /* real time timers */ qemu_run_timers(&active_timers[QEMU_TIMER_REALTIME], qemu_get_clock(rt_clock)); /* Check bottom-halves last in case any of the earlier events triggered them. */ qemu_bh_poll(); }
623
1
static int jas_icctxtdesc_input(jas_iccattrval_t *attrval, jas_stream_t *in, int cnt) { int n; int c; jas_icctxtdesc_t *txtdesc = &attrval->data.txtdesc; txtdesc->ascdata = 0; txtdesc->ucdata = 0; if (jas_iccgetuint32(in, &txtdesc->asclen)) goto error; if (!(txtdesc->ascdata = jas_malloc(txtdesc->asclen))) goto error; if (jas_stream_read(in, txtdesc->ascdata, txtdesc->asclen) != JAS_CAST(int, txtdesc->asclen)) goto error; txtdesc->ascdata[txtdesc->asclen - 1] = '\0'; if (jas_iccgetuint32(in, &txtdesc->uclangcode) || jas_iccgetuint32(in, &txtdesc->uclen)) goto error; if (!(txtdesc->ucdata = jas_malloc(txtdesc->uclen * 2))) goto error; if (jas_stream_read(in, txtdesc->ucdata, txtdesc->uclen * 2) != JAS_CAST(int, txtdesc->uclen * 2)) goto error; if (jas_iccgetuint16(in, &txtdesc->sccode)) goto error; if ((c = jas_stream_getc(in)) == EOF) goto error; txtdesc->maclen = c; if (jas_stream_read(in, txtdesc->macdata, 67) != 67) goto error; txtdesc->asclen = strlen(txtdesc->ascdata) + 1; #define WORKAROUND_BAD_PROFILES #ifdef WORKAROUND_BAD_PROFILES n = txtdesc->asclen + txtdesc->uclen * 2 + 15 + 67; if (n > cnt) { return -1; } if (n < cnt) { if (jas_stream_gobble(in, cnt - n) != cnt - n) goto error; } #else if (txtdesc->asclen + txtdesc->uclen * 2 + 15 + 67 != cnt) return -1; #endif return 0; error: jas_icctxtdesc_destroy(attrval); return -1; }
624
1
void jpc_qmfb_split_row(jpc_fix_t *a, int numcols, int parity) { int bufsize = JPC_CEILDIVPOW2(numcols, 1); jpc_fix_t splitbuf[QMFB_SPLITBUFSIZE]; jpc_fix_t *buf = splitbuf; register jpc_fix_t *srcptr; register jpc_fix_t *dstptr; register int n; register int m; int hstartcol; /* Get a buffer. */ if (bufsize > QMFB_SPLITBUFSIZE) { if (!(buf = jas_malloc(bufsize * sizeof(jpc_fix_t)))) { /* We have no choice but to commit suicide in this case. */ abort(); } } if (numcols >= 2) { hstartcol = (numcols + 1 - parity) >> 1; m = (parity) ? hstartcol : (numcols - hstartcol); /* Save the samples destined for the highpass channel. */ n = m; dstptr = buf; srcptr = &a[1 - parity]; while (n-- > 0) { *dstptr = *srcptr; ++dstptr; srcptr += 2; } /* Copy the appropriate samples into the lowpass channel. */ dstptr = &a[1 - parity]; srcptr = &a[2 - parity]; n = numcols - m - (!parity); while (n-- > 0) { *dstptr = *srcptr; ++dstptr; srcptr += 2; } /* Copy the saved samples into the highpass channel. */ dstptr = &a[hstartcol]; srcptr = buf; n = m; while (n-- > 0) { *dstptr = *srcptr; ++dstptr; ++srcptr; } } /* If the split buffer was allocated on the heap, free this memory. */ if (buf != splitbuf) { jas_free(buf); } }
625
0
av_cold int ff_rate_control_init(MpegEncContext *s) { RateControlContext *rcc = &s->rc_context; int i, res; static const char * const const_names[] = { "PI", "E", "iTex", "pTex", "tex", "mv", "fCode", "iCount", "mcVar", "var", "isI", "isP", "isB", "avgQP", "qComp", #if 0 "lastIQP", "lastPQP", "lastBQP", "nextNonBQP", #endif "avgIITex", "avgPITex", "avgPPTex", "avgBPTex", "avgTex", NULL }; static double (* const func1[])(void *, double) = { (void *)bits2qp, (void *)qp2bits, NULL }; static const char * const func1_names[] = { "bits2qp", "qp2bits", NULL }; emms_c(); res = av_expr_parse(&rcc->rc_eq_eval, s->rc_eq ? s->rc_eq : "tex^qComp", const_names, func1_names, func1, NULL, NULL, 0, s->avctx); if (res < 0) { av_log(s->avctx, AV_LOG_ERROR, "Error parsing rc_eq \"%s\"\n", s->rc_eq); return res; } for (i = 0; i < 5; i++) { rcc->pred[i].coeff = FF_QP2LAMBDA * 7.0; rcc->pred[i].count = 1.0; rcc->pred[i].decay = 0.4; rcc->i_cplx_sum [i] = rcc->p_cplx_sum [i] = rcc->mv_bits_sum[i] = rcc->qscale_sum [i] = rcc->frame_count[i] = 1; // 1 is better because of 1/0 and such rcc->last_qscale_for[i] = FF_QP2LAMBDA * 5; } rcc->buffer_index = s->avctx->rc_initial_buffer_occupancy; if (s->avctx->flags & CODEC_FLAG_PASS2) { int i; char *p; /* find number of pics */ p = s->avctx->stats_in; for (i = -1; p; i++) p = strchr(p + 1, ';'); i += s->max_b_frames; if (i <= 0 || i >= INT_MAX / sizeof(RateControlEntry)) return -1; rcc->entry = av_mallocz(i * sizeof(RateControlEntry)); rcc->num_entries = i; /* init all to skipped p frames * (with b frames we might have a not encoded frame at the end FIXME) */ for (i = 0; i < rcc->num_entries; i++) { RateControlEntry *rce = &rcc->entry[i]; rce->pict_type = rce->new_pict_type = AV_PICTURE_TYPE_P; rce->qscale = rce->new_qscale = FF_QP2LAMBDA * 2; rce->misc_bits = s->mb_num + 10; rce->mb_var_sum = s->mb_num * 100; } /* read stats */ p = s->avctx->stats_in; for (i = 0; i < rcc->num_entries - s->max_b_frames; i++) { RateControlEntry *rce; int picture_number; int e; char *next; next = strchr(p, ';'); if (next) { (*next) = 0; // sscanf in unbelievably slow on looong strings // FIXME copy / do not write next++; } e = sscanf(p, " in:%d ", &picture_number); assert(picture_number >= 0); assert(picture_number < rcc->num_entries); rce = &rcc->entry[picture_number]; e += sscanf(p, " in:%*d out:%*d type:%d q:%f itex:%d ptex:%d mv:%d misc:%d fcode:%d bcode:%d mc-var:%d var:%d icount:%d skipcount:%d hbits:%d", &rce->pict_type, &rce->qscale, &rce->i_tex_bits, &rce->p_tex_bits, &rce->mv_bits, &rce->misc_bits, &rce->f_code, &rce->b_code, &rce->mc_mb_var_sum, &rce->mb_var_sum, &rce->i_count, &rce->skip_count, &rce->header_bits); if (e != 14) { av_log(s->avctx, AV_LOG_ERROR, "statistics are damaged at line %d, parser out=%d\n", i, e); return -1; } p = next; } if (init_pass2(s) < 0) return -1; // FIXME maybe move to end if ((s->avctx->flags & CODEC_FLAG_PASS2) && s->avctx->rc_strategy == FF_RC_STRATEGY_XVID) { #if CONFIG_LIBXVID return ff_xvid_rate_control_init(s); #else av_log(s->avctx, AV_LOG_ERROR, "Xvid ratecontrol requires libavcodec compiled with Xvid support.\n"); return -1; #endif } } if (!(s->avctx->flags & CODEC_FLAG_PASS2)) { rcc->short_term_qsum = 0.001; rcc->short_term_qcount = 0.001; rcc->pass1_rc_eq_output_sum = 0.001; rcc->pass1_wanted_bits = 0.001; if (s->avctx->qblur > 1.0) { av_log(s->avctx, AV_LOG_ERROR, "qblur too large\n"); return -1; } /* init stuff with the user specified complexity */ if (s->rc_initial_cplx) { for (i = 0; i < 60 * 30; i++) { double bits = s->rc_initial_cplx * (i / 10000.0 + 1.0) * s->mb_num; RateControlEntry rce; if (i % ((s->gop_size + 3) / 4) == 0) rce.pict_type = AV_PICTURE_TYPE_I; else if (i % (s->max_b_frames + 1)) rce.pict_type = AV_PICTURE_TYPE_B; else rce.pict_type = AV_PICTURE_TYPE_P; rce.new_pict_type = rce.pict_type; rce.mc_mb_var_sum = bits * s->mb_num / 100000; rce.mb_var_sum = s->mb_num; rce.qscale = FF_QP2LAMBDA * 2; rce.f_code = 2; rce.b_code = 1; rce.misc_bits = 1; if (s->pict_type == AV_PICTURE_TYPE_I) { rce.i_count = s->mb_num; rce.i_tex_bits = bits; rce.p_tex_bits = 0; rce.mv_bits = 0; } else { rce.i_count = 0; // FIXME we do know this approx rce.i_tex_bits = 0; rce.p_tex_bits = bits * 0.9; rce.mv_bits = bits * 0.1; } rcc->i_cplx_sum[rce.pict_type] += rce.i_tex_bits * rce.qscale; rcc->p_cplx_sum[rce.pict_type] += rce.p_tex_bits * rce.qscale; rcc->mv_bits_sum[rce.pict_type] += rce.mv_bits; rcc->frame_count[rce.pict_type]++; get_qscale(s, &rce, rcc->pass1_wanted_bits / rcc->pass1_rc_eq_output_sum, i); // FIXME misbehaves a little for variable fps rcc->pass1_wanted_bits += s->bit_rate / (1 / av_q2d(s->avctx->time_base)); } } } return 0; }
627
1
static int jas_image_growcmpts(jas_image_t *image, int maxcmpts) { jas_image_cmpt_t **newcmpts; int cmptno; newcmpts = (!image->cmpts_) ? jas_malloc(maxcmpts * sizeof(jas_image_cmpt_t *)) : jas_realloc(image->cmpts_, maxcmpts * sizeof(jas_image_cmpt_t *)); if (!newcmpts) { return -1; } image->cmpts_ = newcmpts; image->maxcmpts_ = maxcmpts; for (cmptno = image->numcmpts_; cmptno < image->maxcmpts_; ++cmptno) { image->cmpts_[cmptno] = 0; } return 0; }
628
0
av_cold void ff_sws_init_swscale_x86(SwsContext *c) { int cpu_flags = av_get_cpu_flags(); #if HAVE_MMX_INLINE if (INLINE_MMX(cpu_flags)) sws_init_swscale_mmx(c); #endif #if HAVE_MMXEXT_INLINE if (INLINE_MMXEXT(cpu_flags)) sws_init_swscale_mmxext(c); #endif #define ASSIGN_SCALE_FUNC2(hscalefn, filtersize, opt1, opt2) do { \ if (c->srcBpc == 8) { \ hscalefn = c->dstBpc <= 10 ? ff_hscale8to15_ ## filtersize ## _ ## opt2 : \ ff_hscale8to19_ ## filtersize ## _ ## opt1; \ } else if (c->srcBpc == 9) { \ hscalefn = c->dstBpc <= 10 ? ff_hscale9to15_ ## filtersize ## _ ## opt2 : \ ff_hscale9to19_ ## filtersize ## _ ## opt1; \ } else if (c->srcBpc == 10) { \ hscalefn = c->dstBpc <= 10 ? ff_hscale10to15_ ## filtersize ## _ ## opt2 : \ ff_hscale10to19_ ## filtersize ## _ ## opt1; \ } else /* c->srcBpc == 16 */ { \ hscalefn = c->dstBpc <= 10 ? ff_hscale16to15_ ## filtersize ## _ ## opt2 : \ ff_hscale16to19_ ## filtersize ## _ ## opt1; \ } \ } while (0) #define ASSIGN_MMX_SCALE_FUNC(hscalefn, filtersize, opt1, opt2) \ switch (filtersize) { \ case 4: ASSIGN_SCALE_FUNC2(hscalefn, 4, opt1, opt2); break; \ case 8: ASSIGN_SCALE_FUNC2(hscalefn, 8, opt1, opt2); break; \ default: ASSIGN_SCALE_FUNC2(hscalefn, X, opt1, opt2); break; \ } #define ASSIGN_VSCALEX_FUNC(vscalefn, opt, do_16_case, condition_8bit) \ switch(c->dstBpc){ \ case 16: do_16_case; break; \ case 10: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2planeX_10_ ## opt; break; \ case 9: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2planeX_9_ ## opt; break; \ default: if (condition_8bit) vscalefn = ff_yuv2planeX_8_ ## opt; break; \ } #define ASSIGN_VSCALE_FUNC(vscalefn, opt1, opt2, opt2chk) \ switch(c->dstBpc){ \ case 16: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2plane1_16_ ## opt1; break; \ case 10: if (!isBE(c->dstFormat) && opt2chk) vscalefn = ff_yuv2plane1_10_ ## opt2; break; \ case 9: if (!isBE(c->dstFormat) && opt2chk) vscalefn = ff_yuv2plane1_9_ ## opt2; break; \ default: vscalefn = ff_yuv2plane1_8_ ## opt1; break; \ } #define case_rgb(x, X, opt) \ case AV_PIX_FMT_ ## X: \ c->lumToYV12 = ff_ ## x ## ToY_ ## opt; \ if (!c->chrSrcHSubSample) \ c->chrToYV12 = ff_ ## x ## ToUV_ ## opt; \ break #if ARCH_X86_32 if (EXTERNAL_MMX(cpu_flags)) { ASSIGN_MMX_SCALE_FUNC(c->hyScale, c->hLumFilterSize, mmx, mmx); ASSIGN_MMX_SCALE_FUNC(c->hcScale, c->hChrFilterSize, mmx, mmx); ASSIGN_VSCALE_FUNC(c->yuv2plane1, mmx, mmxext, cpu_flags & AV_CPU_FLAG_MMXEXT); switch (c->srcFormat) { case AV_PIX_FMT_YA8: c->lumToYV12 = ff_yuyvToY_mmx; if (c->alpPixBuf) c->alpToYV12 = ff_uyvyToY_mmx; break; case AV_PIX_FMT_YUYV422: c->lumToYV12 = ff_yuyvToY_mmx; c->chrToYV12 = ff_yuyvToUV_mmx; break; case AV_PIX_FMT_UYVY422: c->lumToYV12 = ff_uyvyToY_mmx; c->chrToYV12 = ff_uyvyToUV_mmx; break; case AV_PIX_FMT_NV12: c->chrToYV12 = ff_nv12ToUV_mmx; break; case AV_PIX_FMT_NV21: c->chrToYV12 = ff_nv21ToUV_mmx; break; case_rgb(rgb24, RGB24, mmx); case_rgb(bgr24, BGR24, mmx); case_rgb(bgra, BGRA, mmx); case_rgb(rgba, RGBA, mmx); case_rgb(abgr, ABGR, mmx); case_rgb(argb, ARGB, mmx); default: break; } } if (EXTERNAL_MMXEXT(cpu_flags)) { ASSIGN_VSCALEX_FUNC(c->yuv2planeX, mmxext, , 1); } #endif /* ARCH_X86_32 */ #define ASSIGN_SSE_SCALE_FUNC(hscalefn, filtersize, opt1, opt2) \ switch (filtersize) { \ case 4: ASSIGN_SCALE_FUNC2(hscalefn, 4, opt1, opt2); break; \ case 8: ASSIGN_SCALE_FUNC2(hscalefn, 8, opt1, opt2); break; \ default: if (filtersize & 4) ASSIGN_SCALE_FUNC2(hscalefn, X4, opt1, opt2); \ else ASSIGN_SCALE_FUNC2(hscalefn, X8, opt1, opt2); \ break; \ } if (EXTERNAL_SSE2(cpu_flags)) { ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, sse2, sse2); ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse2, sse2); ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse2, , HAVE_ALIGNED_STACK || ARCH_X86_64); ASSIGN_VSCALE_FUNC(c->yuv2plane1, sse2, sse2, 1); switch (c->srcFormat) { case AV_PIX_FMT_YA8: c->lumToYV12 = ff_yuyvToY_sse2; if (c->alpPixBuf) c->alpToYV12 = ff_uyvyToY_sse2; break; case AV_PIX_FMT_YUYV422: c->lumToYV12 = ff_yuyvToY_sse2; c->chrToYV12 = ff_yuyvToUV_sse2; break; case AV_PIX_FMT_UYVY422: c->lumToYV12 = ff_uyvyToY_sse2; c->chrToYV12 = ff_uyvyToUV_sse2; break; case AV_PIX_FMT_NV12: c->chrToYV12 = ff_nv12ToUV_sse2; break; case AV_PIX_FMT_NV21: c->chrToYV12 = ff_nv21ToUV_sse2; break; case_rgb(rgb24, RGB24, sse2); case_rgb(bgr24, BGR24, sse2); case_rgb(bgra, BGRA, sse2); case_rgb(rgba, RGBA, sse2); case_rgb(abgr, ABGR, sse2); case_rgb(argb, ARGB, sse2); default: break; } } if (EXTERNAL_SSSE3(cpu_flags)) { ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, ssse3, ssse3); ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, ssse3, ssse3); switch (c->srcFormat) { case_rgb(rgb24, RGB24, ssse3); case_rgb(bgr24, BGR24, ssse3); default: break; } } if (EXTERNAL_SSE4(cpu_flags)) { /* Xto15 don't need special sse4 functions */ ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, sse4, ssse3); ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse4, ssse3); ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse4, if (!isBE(c->dstFormat)) c->yuv2planeX = ff_yuv2planeX_16_sse4, HAVE_ALIGNED_STACK || ARCH_X86_64); if (c->dstBpc == 16 && !isBE(c->dstFormat)) c->yuv2plane1 = ff_yuv2plane1_16_sse4; } if (EXTERNAL_AVX(cpu_flags)) { ASSIGN_VSCALEX_FUNC(c->yuv2planeX, avx, , HAVE_ALIGNED_STACK || ARCH_X86_64); ASSIGN_VSCALE_FUNC(c->yuv2plane1, avx, avx, 1); switch (c->srcFormat) { case AV_PIX_FMT_YUYV422: c->chrToYV12 = ff_yuyvToUV_avx; break; case AV_PIX_FMT_UYVY422: c->chrToYV12 = ff_uyvyToUV_avx; break; case AV_PIX_FMT_NV12: c->chrToYV12 = ff_nv12ToUV_avx; break; case AV_PIX_FMT_NV21: c->chrToYV12 = ff_nv21ToUV_avx; break; case_rgb(rgb24, RGB24, avx); case_rgb(bgr24, BGR24, avx); case_rgb(bgra, BGRA, avx); case_rgb(rgba, RGBA, avx); case_rgb(abgr, ABGR, avx); case_rgb(argb, ARGB, avx); default: break; } } }
629
0
xsltDocumentPtr xsltLoadDocument ( xsltTransformContextPtr ctxt , const xmlChar * URI ) { xsltDocumentPtr ret ; xmlDocPtr doc ; if ( ( ctxt == NULL ) || ( URI == NULL ) ) return ( NULL ) ; if ( ctxt -> sec != NULL ) { int res ; res = xsltCheckRead ( ctxt -> sec , ctxt , URI ) ; if ( res == 0 ) { xsltTransformError ( ctxt , NULL , NULL , "xsltLoadDocument: read rights for %s denied\n" , URI ) ; return ( NULL ) ; } } ret = ctxt -> docList ; while ( ret != NULL ) { if ( ( ret -> doc != NULL ) && ( ret -> doc -> URL != NULL ) && ( xmlStrEqual ( ret -> doc -> URL , URI ) ) ) return ( ret ) ; ret = ret -> next ; } doc = xsltDocDefaultLoader ( URI , ctxt -> dict , ctxt -> parserOptions , ( void * ) ctxt , XSLT_LOAD_DOCUMENT ) ; if ( doc == NULL ) return ( NULL ) ; if ( ctxt -> xinclude != 0 ) { # ifdef LIBXML_XINCLUDE_ENABLED # if LIBXML_VERSION >= 20603 xmlXIncludeProcessFlags ( doc , ctxt -> parserOptions ) ; # else xmlXIncludeProcess ( doc ) ; # endif # else xsltTransformError ( ctxt , NULL , NULL , "xsltLoadDocument(%s) : XInclude processing not compiled in\n" , URI ) ; # endif } if ( xsltNeedElemSpaceHandling ( ctxt ) ) xsltApplyStripSpaces ( ctxt , xmlDocGetRootElement ( doc ) ) ; if ( ctxt -> debugStatus == XSLT_DEBUG_NONE ) xmlXPathOrderDocElems ( doc ) ; ret = xsltNewDocument ( ctxt , doc ) ; return ( ret ) ; }
630
1
TEST_F(ZNCTest, AwayNotify) { auto znc = Run(); auto ircd = ConnectIRCd(); auto client = ConnectClient(); client.Write("CAP LS"); client.Write("PASS :hunter2"); client.Write("NICK nick"); client.Write("USER user/test x x :x"); QByteArray cap_ls; client.ReadUntilAndGet(" LS :", cap_ls); ASSERT_THAT(cap_ls.toStdString(), AllOf(HasSubstr("cap-notify"), Not(HasSubstr("away-notify")))); client.Write("CAP REQ :cap-notify"); client.ReadUntil("ACK :cap-notify"); client.Write("CAP END"); client.ReadUntil(" 001 "); ircd.ReadUntil("USER"); ircd.Write("CAP user LS :away-notify"); ircd.ReadUntil("CAP REQ :away-notify"); ircd.Write("CAP user ACK :away-notify"); ircd.ReadUntil("CAP END"); ircd.Write(":server 001 user :welcome"); client.ReadUntil("CAP user NEW :away-notify"); client.Write("CAP REQ :away-notify"); client.ReadUntil("ACK :away-notify"); ircd.Write(":x!y@z AWAY :reason"); client.ReadUntil(":x!y@z AWAY :reason"); ircd.Close(); client.ReadUntil("DEL :away-notify"); }
632
1
static void initial_reordering_non_myanmar_cluster ( const hb_ot_shape_plan_t * plan HB_UNUSED , hb_face_t * face HB_UNUSED , hb_buffer_t * buffer HB_UNUSED , unsigned int start HB_UNUSED , unsigned int end HB_UNUSED ) { }
633
1
static int jas_iccprof_gettagtab(jas_stream_t *in, jas_icctagtab_t *tagtab) { int i; jas_icctagtabent_t *tagtabent; if (tagtab->ents) { jas_free(tagtab->ents); tagtab->ents = 0; } if (jas_iccgetuint32(in, &tagtab->numents)) goto error; if (!(tagtab->ents = jas_malloc(tagtab->numents * sizeof(jas_icctagtabent_t)))) goto error; tagtabent = tagtab->ents; for (i = 0; i < JAS_CAST(long, tagtab->numents); ++i) { if (jas_iccgetuint32(in, &tagtabent->tag) || jas_iccgetuint32(in, &tagtabent->off) || jas_iccgetuint32(in, &tagtabent->len)) goto error; ++tagtabent; } return 0; error: if (tagtab->ents) { jas_free(tagtab->ents); tagtab->ents = 0; } return -1; }
634
0
TEST_F(ZNCTest, StatusEchoMessage) { auto znc = Run(); auto ircd = ConnectIRCd(); auto client = LoginClient(); client.Write("CAP REQ :echo-message"); client.Write("PRIVMSG *status :blah"); client.ReadUntil(":nick!user@irc.znc.in PRIVMSG *status :blah"); client.ReadUntil(":*status!znc@znc.in PRIVMSG nick :Unknown command"); }
635
0
TEST_F ( ProtocolHandlerRegistryTest , TestDisablePreventsHandling ) { ProtocolHandler ph1 = CreateProtocolHandler ( "test" , "test1" ) ; registry ( ) -> OnAcceptRegisterProtocolHandler ( ph1 ) ; ASSERT_TRUE ( registry ( ) -> IsHandledProtocol ( "test" ) ) ; registry ( ) -> Disable ( ) ; ASSERT_FALSE ( registry ( ) -> IsHandledProtocol ( "test" ) ) ; }
637
0
static int mov_write_tmcd_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = avio_tell(pb); #if 1 int frame_duration = av_rescale(track->timescale, track->enc->time_base.num, track->enc->time_base.den); int nb_frames = ROUNDED_DIV(track->enc->time_base.den, track->enc->time_base.num); AVDictionaryEntry *t = NULL; if (nb_frames > 255) { av_log(NULL, AV_LOG_ERROR, "fps %d is too large\n", nb_frames); return AVERROR(EINVAL); } avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "tmcd"); /* Data format */ avio_wb32(pb, 0); /* Reserved */ avio_wb32(pb, 1); /* Data reference index */ avio_wb32(pb, 0); /* Flags */ avio_wb32(pb, track->timecode_flags); /* Flags (timecode) */ avio_wb32(pb, track->timescale); /* Timescale */ avio_wb32(pb, frame_duration); /* Frame duration */ avio_w8(pb, nb_frames); /* Number of frames */ avio_w8(pb, 0); /* Reserved */ if (track->st) t = av_dict_get(track->st->metadata, "reel_name", NULL, 0); if (t && utf8len(t->value)) mov_write_source_reference_tag(pb, track, t->value); else avio_wb16(pb, 0); /* zero size */ #else avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "tmcd"); /* Data format */ avio_wb32(pb, 0); /* Reserved */ avio_wb32(pb, 1); /* Data reference index */ if (track->enc->extradata_size) avio_write(pb, track->enc->extradata, track->enc->extradata_size); #endif return update_size(pb, pos); }
638
0
static void dv_decode_ac(DVVideoDecodeContext *s, BlockInfo *mb, DCTELEM *block, int last_index) { int last_re_index; int shift_offset = mb->shift_offset; const UINT8 *scan_table = mb->scan_table; const UINT8 *shift_table = mb->shift_table; int pos = mb->pos; int level, pos1, sign, run; int partial_bit_count; OPEN_READER(re, &s->gb); #ifdef VLC_DEBUG printf("start\n"); #endif /* if we must parse a partial vlc, we do it here */ partial_bit_count = mb->partial_bit_count; if (partial_bit_count > 0) { UINT8 buf[4]; UINT32 v; int l, l1; GetBitContext gb1; /* build the dummy bit buffer */ l = 16 - partial_bit_count; UPDATE_CACHE(re, &s->gb); #ifdef VLC_DEBUG printf("show=%04x\n", SHOW_UBITS(re, &s->gb, 16)); #endif v = (mb->partial_bit_buffer << l) | SHOW_UBITS(re, &s->gb, l); buf[0] = v >> 8; buf[1] = v; #ifdef VLC_DEBUG printf("v=%04x cnt=%d %04x\n", v, partial_bit_count, (mb->partial_bit_buffer << l)); #endif /* try to read the codeword */ init_get_bits(&gb1, buf, 4); { OPEN_READER(re1, &gb1); UPDATE_CACHE(re1, &gb1); GET_RL_VLC(level, run, re1, &gb1, dv_rl_vlc[0], TEX_VLC_BITS, 2); l = re1_index; CLOSE_READER(re1, &gb1); } #ifdef VLC_DEBUG printf("****run=%d level=%d size=%d\n", run, level, l); #endif /* compute codeword length */ l1 = (level != 256 && level != 0); /* if too long, we cannot parse */ l -= partial_bit_count; if ((re_index + l + l1) > last_index) return; /* skip read bits */ last_re_index = 0; /* avoid warning */ re_index += l; /* by definition, if we can read the vlc, all partial bits will be read (otherwise we could have read the vlc before) */ mb->partial_bit_count = 0; UPDATE_CACHE(re, &s->gb); goto handle_vlc; } /* get the AC coefficients until last_index is reached */ for(;;) { UPDATE_CACHE(re, &s->gb); #ifdef VLC_DEBUG printf("%2d: bits=%04x index=%d\n", pos, SHOW_UBITS(re, &s->gb, 16), re_index); #endif last_re_index = re_index; GET_RL_VLC(level, run, re, &s->gb, dv_rl_vlc[0], TEX_VLC_BITS, 2); handle_vlc: #ifdef VLC_DEBUG printf("run=%d level=%d\n", run, level); #endif if (level == 256) { if (re_index > last_index) { cannot_read: /* put position before read code */ re_index = last_re_index; mb->eob_reached = 0; break; } /* EOB */ mb->eob_reached = 1; break; } else if (level != 0) { if ((re_index + 1) > last_index) goto cannot_read; sign = SHOW_SBITS(re, &s->gb, 1); level = (level ^ sign) - sign; LAST_SKIP_BITS(re, &s->gb, 1); pos += run; /* error */ if (pos >= 64) { goto read_error; } pos1 = scan_table[pos]; level = level << (shift_table[pos1] + shift_offset); block[pos1] = level; // printf("run=%d level=%d shift=%d\n", run, level, shift_table[pos1]); } else { if (re_index > last_index) goto cannot_read; /* level is zero: means run without coding. No sign is coded */ pos += run; /* error */ if (pos >= 64) { read_error: #if defined(VLC_DEBUG) || 1 printf("error pos=%d\n", pos); #endif /* for errors, we consider the eob is reached */ mb->eob_reached = 1; break; } } } CLOSE_READER(re, &s->gb); mb->pos = pos; }
639
1
jpc_mqdec_t *jpc_mqdec_create(int maxctxs, jas_stream_t *in) { jpc_mqdec_t *mqdec; /* There must be at least one context. */ assert(maxctxs > 0); /* Allocate memory for the MQ decoder. */ if (!(mqdec = jas_malloc(sizeof(jpc_mqdec_t)))) { goto error; } mqdec->in = in; mqdec->maxctxs = maxctxs; /* Allocate memory for the per-context state information. */ if (!(mqdec->ctxs = jas_malloc(mqdec->maxctxs * sizeof(jpc_mqstate_t *)))) { goto error; } /* Set the current context to the first context. */ mqdec->curctx = mqdec->ctxs; /* If an input stream has been associated with the MQ decoder, initialize the decoder state from the stream. */ if (mqdec->in) { jpc_mqdec_init(mqdec); } /* Initialize the per-context state information. */ jpc_mqdec_setctxs(mqdec, 0, 0); return mqdec; error: /* Oops... Something has gone wrong. */ if (mqdec) { jpc_mqdec_destroy(mqdec); } return 0; }
640
0
static gcry_err_code_t pkcs1_encode_for_encryption ( gcry_mpi_t * r_result , unsigned int nbits , const unsigned char * value , size_t valuelen , const unsigned char * random_override , size_t random_override_len ) { gcry_err_code_t rc = 0 ; gcry_error_t err ; unsigned char * frame = NULL ; size_t nframe = ( nbits + 7 ) / 8 ; int i ; size_t n ; unsigned char * p ; if ( valuelen + 7 > nframe || ! nframe ) { return GPG_ERR_TOO_SHORT ; } if ( ! ( frame = gcry_malloc_secure ( nframe ) ) ) return gpg_err_code_from_syserror ( ) ; n = 0 ; frame [ n ++ ] = 0 ; frame [ n ++ ] = 2 ; i = nframe - 3 - valuelen ; gcry_assert ( i > 0 ) ; if ( random_override ) { int j ; if ( random_override_len != i ) { gcry_free ( frame ) ; return GPG_ERR_INV_ARG ; } for ( j = 0 ; j < random_override_len ; j ++ ) if ( ! random_override [ j ] ) { gcry_free ( frame ) ; return GPG_ERR_INV_ARG ; } memcpy ( frame + n , random_override , random_override_len ) ; n += random_override_len ; } else { p = gcry_random_bytes_secure ( i , GCRY_STRONG_RANDOM ) ; for ( ; ; ) { int j , k ; unsigned char * pp ; for ( j = k = 0 ; j < i ; j ++ ) { if ( ! p [ j ] ) k ++ ; } if ( ! k ) break ; k += k / 128 + 3 ; pp = gcry_random_bytes_secure ( k , GCRY_STRONG_RANDOM ) ; for ( j = 0 ; j < i && k ; ) { if ( ! p [ j ] ) p [ j ] = pp [ -- k ] ; if ( p [ j ] ) j ++ ; } gcry_free ( pp ) ; } memcpy ( frame + n , p , i ) ; n += i ; gcry_free ( p ) ; } frame [ n ++ ] = 0 ; memcpy ( frame + n , value , valuelen ) ; n += valuelen ; gcry_assert ( n == nframe ) ; err = gcry_mpi_scan ( r_result , GCRYMPI_FMT_USG , frame , n , & nframe ) ; if ( err ) rc = gcry_err_code ( err ) ; else if ( DBG_CIPHER ) log_mpidump ( "PKCS#1 block type 2 encoded data" , * r_result ) ; gcry_free ( frame ) ; return rc ; }
641
1
static bmp_info_t *bmp_getinfo(jas_stream_t *in) { bmp_info_t *info; int i; bmp_palent_t *palent; if (!(info = bmp_info_create())) { return 0; } if (bmp_getint32(in, &info->len) || info->len != 40 || bmp_getint32(in, &info->width) || bmp_getint32(in, &info->height) || bmp_getint16(in, &info->numplanes) || bmp_getint16(in, &info->depth) || bmp_getint32(in, &info->enctype) || bmp_getint32(in, &info->siz) || bmp_getint32(in, &info->hres) || bmp_getint32(in, &info->vres) || bmp_getint32(in, &info->numcolors) || bmp_getint32(in, &info->mincolors)) { bmp_info_destroy(info); return 0; } if (info->height < 0) { info->topdown = 1; info->height = -info->height; } else { info->topdown = 0; } if (info->width <= 0 || info->height <= 0 || info->numplanes <= 0 || info->depth <= 0 || info->numcolors < 0 || info->mincolors < 0) { bmp_info_destroy(info); return 0; } if (info->enctype != BMP_ENC_RGB) { jas_eprintf("unsupported BMP encoding\n"); bmp_info_destroy(info); return 0; } if (info->numcolors > 0) { if (!(info->palents = jas_malloc(info->numcolors * sizeof(bmp_palent_t)))) { bmp_info_destroy(info); return 0; } } else { info->palents = 0; } for (i = 0; i < info->numcolors; ++i) { palent = &info->palents[i]; if ((palent->blu = jas_stream_getc(in)) == EOF || (palent->grn = jas_stream_getc(in)) == EOF || (palent->red = jas_stream_getc(in)) == EOF || (palent->res = jas_stream_getc(in)) == EOF) { bmp_info_destroy(info); return 0; } } return info; }
644
0
static int expand_rle_row16(SgiState *s, uint16_t *out_buf, int len, int pixelstride) { unsigned short pixel; unsigned char count; unsigned short *orig = out_buf; uint16_t *out_end = out_buf + len; while (out_buf < out_end) { if (bytestream2_get_bytes_left(&s->g) < 2) return AVERROR_INVALIDDATA; pixel = bytestream2_get_be16u(&s->g); if (!(count = (pixel & 0x7f))) break; /* Check for buffer overflow. */ if (pixelstride * (count - 1) >= len) { av_log(s->avctx, AV_LOG_ERROR, "Invalid pixel count.\n"); return AVERROR_INVALIDDATA; } if (pixel & 0x80) { while (count--) { pixel = bytestream2_get_ne16(&s->g); AV_WN16A(out_buf, pixel); out_buf += pixelstride; } } else { pixel = bytestream2_get_ne16(&s->g); while (count--) { AV_WN16A(out_buf, pixel); out_buf += pixelstride; } } } return (out_buf - orig) / pixelstride; }
645
0
struct archive_string * archive_strncat ( struct archive_string * as , const void * _p , size_t n ) { size_t s ; const char * p , * pp ; p = ( const char * ) _p ; s = 0 ; pp = p ; while ( s < n && * pp ) { pp ++ ; s ++ ; } if ( ( as = archive_string_append ( as , p , s ) ) == NULL ) __archive_errx ( 1 , "Out of memory" ) ; return ( as ) ; }
646
1
void *jas_realloc(void *ptr, size_t size) { return realloc(ptr, size); }
647
0
void OverlaySettings::save(QSettings* settings_ptr) { OverlaySettings def; settings_ptr->setValue(QLatin1String("version"), QLatin1String(MUMTEXT(MUMBLE_VERSION_STRING))); settings_ptr->sync(); #if defined(Q_OS_WIN) || defined(Q_OS_MAC) if (settings_ptr->format() == QSettings::IniFormat) #endif { QFile f(settings_ptr->fileName()); f.setPermissions(f.permissions() & ~(QFile::ReadGroup | QFile::WriteGroup | QFile::ExeGroup | QFile::ReadOther | QFile::WriteOther | QFile::ExeOther)); } SAVELOAD(bEnable, "enable"); SAVELOAD(osShow, "show"); SAVELOAD(bAlwaysSelf, "alwaysself"); SAVELOAD(uiActiveTime, "activetime"); SAVELOAD(osSort, "sort"); SAVELOAD(fX, "x"); SAVELOAD(fY, "y"); SAVELOAD(fZoom, "zoom"); SAVELOAD(uiColumns, "columns"); settings_ptr->beginReadArray(QLatin1String("states")); for (int i=0; i<4; ++i) { settings_ptr->setArrayIndex(i); SAVELOAD(qcUserName[i], "color"); SAVELOAD(fUser[i], "opacity"); } settings_ptr->endArray(); SAVELOAD(qfUserName, "userfont"); SAVELOAD(qfChannel, "channelfont"); SAVELOAD(qcChannel, "channelcolor"); SAVELOAD(qfFps, "fpsfont"); SAVELOAD(qcFps, "fpscolor"); SAVELOAD(fBoxPad, "padding"); SAVELOAD(fBoxPenWidth, "penwidth"); SAVELOAD(qcBoxPen, "pencolor"); SAVELOAD(qcBoxFill, "fillcolor"); SAVELOAD(bUserName, "usershow"); SAVELOAD(bChannel, "channelshow"); SAVELOAD(bMutedDeafened, "mutedshow"); SAVELOAD(bAvatar, "avatarshow"); SAVELOAD(bBox, "boxshow"); SAVELOAD(bFps, "fpsshow"); SAVELOAD(fUserName, "useropacity"); SAVELOAD(fChannel, "channelopacity"); SAVELOAD(fMutedDeafened, "mutedopacity"); SAVELOAD(fAvatar, "avataropacity"); SAVELOAD(fFps, "fpsopacity"); SAVELOAD(qrfUserName, "userrect"); SAVELOAD(qrfChannel, "channelrect"); SAVELOAD(qrfMutedDeafened, "mutedrect"); SAVELOAD(qrfAvatar, "avatarrect"); SAVELOAD(qrfFps, "fpsrect"); SAVEFLAG(qaUserName, "useralign"); SAVEFLAG(qaChannel, "channelalign"); SAVEFLAG(qaMutedDeafened, "mutedalign"); SAVEFLAG(qaAvatar, "avataralign"); settings_ptr->setValue(QLatin1String("usewhitelist"), bUseWhitelist); settings_ptr->setValue(QLatin1String("blacklist"), qslBlacklist); settings_ptr->setValue(QLatin1String("whitelist"), qslWhitelist); }
651
1
static int webvtt_read_header(AVFormatContext *s) { WebVTTContext *webvtt = s->priv_data; AVBPrint header, cue; int res = 0; AVStream *st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); avpriv_set_pts_info(st, 64, 1, 1000); st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; st->codec->codec_id = AV_CODEC_ID_WEBVTT; st->disposition |= webvtt->kind; av_bprint_init(&header, 0, AV_BPRINT_SIZE_UNLIMITED); av_bprint_init(&cue, 0, AV_BPRINT_SIZE_UNLIMITED); for (;;) { int i; int64_t pos; AVPacket *sub; const char *p, *identifier, *settings; int identifier_len, settings_len; int64_t ts_start, ts_end; ff_subtitles_read_chunk(s->pb, &cue); if (!cue.len) break; p = identifier = cue.str; pos = avio_tell(s->pb); /* ignore header chunk */ if (!strncmp(p, "\xEF\xBB\xBFWEBVTT", 9) || !strncmp(p, "WEBVTT", 6)) continue; /* optional cue identifier (can be a number like in SRT or some kind of * chaptering id) */ for (i = 0; p[i] && p[i] != '\n' && p[i] != '\r'; i++) { if (!strncmp(p + i, "-->", 3)) { identifier = NULL; break; } } if (!identifier) identifier_len = 0; else { identifier_len = strcspn(p, "\r\n"); p += identifier_len; if (*p == '\r') p++; if (*p == '\n') p++; } /* cue timestamps */ if ((ts_start = read_ts(p)) == AV_NOPTS_VALUE) break; if (!(p = strstr(p, "-->"))) break; p += 3; do p++; while (*p == ' ' || *p == '\t'); if ((ts_end = read_ts(p)) == AV_NOPTS_VALUE) break; /* optional cue settings */ p += strcspn(p, "\n\t "); while (*p == '\t' || *p == ' ') p++; settings = p; settings_len = strcspn(p, "\r\n"); p += settings_len; if (*p == '\r') p++; if (*p == '\n') p++; /* create packet */ sub = ff_subtitles_queue_insert(&webvtt->q, p, strlen(p), 0); if (!sub) { res = AVERROR(ENOMEM); goto end; } sub->pos = pos; sub->pts = ts_start; sub->duration = ts_end - ts_start; #define SET_SIDE_DATA(name, type) do { \ if (name##_len) { \ uint8_t *buf = av_packet_new_side_data(sub, type, name##_len); \ if (!buf) { \ res = AVERROR(ENOMEM); \ goto end; \ } \ memcpy(buf, name, name##_len); \ } \ } while (0) SET_SIDE_DATA(identifier, AV_PKT_DATA_WEBVTT_IDENTIFIER); SET_SIDE_DATA(settings, AV_PKT_DATA_WEBVTT_SETTINGS); } ff_subtitles_queue_finalize(&webvtt->q); end: av_bprint_finalize(&cue, NULL); av_bprint_finalize(&header, NULL); return res; }
653
0
static UBool _isPrivateuseVariantSubtag ( const char * s , int32_t len ) { if ( len < 0 ) { len = ( int32_t ) uprv_strlen ( s ) ; } if ( len >= 1 && len <= 8 && _isAlphaNumericString ( s , len ) ) { return TRUE ; } return FALSE ; }
654
1
static int jpc_enc_encodemainhdr(jpc_enc_t *enc) { jpc_siz_t *siz; jpc_cod_t *cod; jpc_qcd_t *qcd; int i; long startoff; long mainhdrlen; jpc_enc_cp_t *cp; jpc_qcc_t *qcc; jpc_enc_tccp_t *tccp; uint_fast16_t cmptno; jpc_tsfb_band_t bandinfos[JPC_MAXBANDS]; jpc_fix_t mctsynweight; jpc_enc_tcp_t *tcp; jpc_tsfb_t *tsfb; jpc_tsfb_band_t *bandinfo; uint_fast16_t numbands; uint_fast16_t bandno; uint_fast16_t rlvlno; uint_fast16_t analgain; jpc_fix_t absstepsize; char buf[1024]; jpc_com_t *com; cp = enc->cp; startoff = jas_stream_getrwcount(enc->out); /* Write SOC marker segment. */ if (!(enc->mrk = jpc_ms_create(JPC_MS_SOC))) { return -1; } if (jpc_putms(enc->out, enc->cstate, enc->mrk)) { jas_eprintf("cannot write SOC marker\n"); return -1; } jpc_ms_destroy(enc->mrk); enc->mrk = 0; /* Write SIZ marker segment. */ if (!(enc->mrk = jpc_ms_create(JPC_MS_SIZ))) { return -1; } siz = &enc->mrk->parms.siz; siz->caps = 0; siz->xoff = cp->imgareatlx; siz->yoff = cp->imgareatly; siz->width = cp->refgrdwidth; siz->height = cp->refgrdheight; siz->tilexoff = cp->tilegrdoffx; siz->tileyoff = cp->tilegrdoffy; siz->tilewidth = cp->tilewidth; siz->tileheight = cp->tileheight; siz->numcomps = cp->numcmpts; siz->comps = jas_malloc(siz->numcomps * sizeof(jpc_sizcomp_t)); assert(siz->comps); for (i = 0; i < JAS_CAST(int, cp->numcmpts); ++i) { siz->comps[i].prec = cp->ccps[i].prec; siz->comps[i].sgnd = cp->ccps[i].sgnd; siz->comps[i].hsamp = cp->ccps[i].sampgrdstepx; siz->comps[i].vsamp = cp->ccps[i].sampgrdstepy; } if (jpc_putms(enc->out, enc->cstate, enc->mrk)) { jas_eprintf("cannot write SIZ marker\n"); return -1; } jpc_ms_destroy(enc->mrk); enc->mrk = 0; if (!(enc->mrk = jpc_ms_create(JPC_MS_COM))) { return -1; } sprintf(buf, "Creator: JasPer Version %s", jas_getversion()); com = &enc->mrk->parms.com; com->len = strlen(buf); com->regid = JPC_COM_LATIN; if (!(com->data = JAS_CAST(uchar *, jas_strdup(buf)))) { abort(); } if (jpc_putms(enc->out, enc->cstate, enc->mrk)) { jas_eprintf("cannot write COM marker\n"); return -1; } jpc_ms_destroy(enc->mrk); enc->mrk = 0; #if 0 if (!(enc->mrk = jpc_ms_create(JPC_MS_CRG))) { return -1; } crg = &enc->mrk->parms.crg; crg->comps = jas_malloc(crg->numcomps * sizeof(jpc_crgcomp_t)); if (jpc_putms(enc->out, enc->cstate, enc->mrk)) { jas_eprintf("cannot write CRG marker\n"); return -1; } jpc_ms_destroy(enc->mrk); enc->mrk = 0; #endif tcp = &cp->tcp; tccp = &cp->tccp; for (cmptno = 0; cmptno < cp->numcmpts; ++cmptno) { tsfb = jpc_cod_gettsfb(tccp->qmfbid, tccp->maxrlvls - 1); jpc_tsfb_getbands(tsfb, 0, 0, 1 << tccp->maxrlvls, 1 << tccp->maxrlvls, bandinfos); jpc_tsfb_destroy(tsfb); mctsynweight = jpc_mct_getsynweight(tcp->mctid, cmptno); numbands = 3 * tccp->maxrlvls - 2; for (bandno = 0, bandinfo = bandinfos; bandno < numbands; ++bandno, ++bandinfo) { rlvlno = (bandno) ? ((bandno - 1) / 3 + 1) : 0; analgain = JPC_NOMINALGAIN(tccp->qmfbid, tccp->maxrlvls, rlvlno, bandinfo->orient); if (!tcp->intmode) { absstepsize = jpc_fix_div(jpc_inttofix(1 << (analgain + 1)), bandinfo->synenergywt); } else { absstepsize = jpc_inttofix(1); } cp->ccps[cmptno].stepsizes[bandno] = jpc_abstorelstepsize(absstepsize, cp->ccps[cmptno].prec + analgain); } cp->ccps[cmptno].numstepsizes = numbands; } if (!(enc->mrk = jpc_ms_create(JPC_MS_COD))) { return -1; } cod = &enc->mrk->parms.cod; cod->csty = cp->tccp.csty | cp->tcp.csty; cod->compparms.csty = cp->tccp.csty | cp->tcp.csty; cod->compparms.numdlvls = cp->tccp.maxrlvls - 1; cod->compparms.numrlvls = cp->tccp.maxrlvls; cod->prg = cp->tcp.prg; cod->numlyrs = cp->tcp.numlyrs; cod->compparms.cblkwidthval = JPC_COX_CBLKSIZEEXPN(cp->tccp.cblkwidthexpn); cod->compparms.cblkheightval = JPC_COX_CBLKSIZEEXPN(cp->tccp.cblkheightexpn); cod->compparms.cblksty = cp->tccp.cblksty; cod->compparms.qmfbid = cp->tccp.qmfbid; cod->mctrans = (cp->tcp.mctid != JPC_MCT_NONE); if (tccp->csty & JPC_COX_PRT) { for (rlvlno = 0; rlvlno < tccp->maxrlvls; ++rlvlno) { cod->compparms.rlvls[rlvlno].parwidthval = tccp->prcwidthexpns[rlvlno]; cod->compparms.rlvls[rlvlno].parheightval = tccp->prcheightexpns[rlvlno]; } } if (jpc_putms(enc->out, enc->cstate, enc->mrk)) { jas_eprintf("cannot write COD marker\n"); return -1; } jpc_ms_destroy(enc->mrk); enc->mrk = 0; if (!(enc->mrk = jpc_ms_create(JPC_MS_QCD))) { return -1; } qcd = &enc->mrk->parms.qcd; qcd->compparms.qntsty = (tccp->qmfbid == JPC_COX_INS) ? JPC_QCX_SEQNT : JPC_QCX_NOQNT; qcd->compparms.numstepsizes = cp->ccps[0].numstepsizes; qcd->compparms.numguard = cp->tccp.numgbits; qcd->compparms.stepsizes = cp->ccps[0].stepsizes; if (jpc_putms(enc->out, enc->cstate, enc->mrk)) { return -1; } /* We do not want the step size array to be freed! */ qcd->compparms.stepsizes = 0; jpc_ms_destroy(enc->mrk); enc->mrk = 0; tccp = &cp->tccp; for (cmptno = 1; cmptno < cp->numcmpts; ++cmptno) { if (!(enc->mrk = jpc_ms_create(JPC_MS_QCC))) { return -1; } qcc = &enc->mrk->parms.qcc; qcc->compno = cmptno; qcc->compparms.qntsty = (tccp->qmfbid == JPC_COX_INS) ? JPC_QCX_SEQNT : JPC_QCX_NOQNT; qcc->compparms.numstepsizes = cp->ccps[cmptno].numstepsizes; qcc->compparms.numguard = cp->tccp.numgbits; qcc->compparms.stepsizes = cp->ccps[cmptno].stepsizes; if (jpc_putms(enc->out, enc->cstate, enc->mrk)) { return -1; } /* We do not want the step size array to be freed! */ qcc->compparms.stepsizes = 0; jpc_ms_destroy(enc->mrk); enc->mrk = 0; } #define MAINTLRLEN 2 mainhdrlen = jas_stream_getrwcount(enc->out) - startoff; enc->len += mainhdrlen; if (enc->cp->totalsize != UINT_FAST32_MAX) { uint_fast32_t overhead; overhead = mainhdrlen + MAINTLRLEN; enc->mainbodysize = (enc->cp->totalsize >= overhead) ? (enc->cp->totalsize - overhead) : 0; } else { enc->mainbodysize = UINT_FAST32_MAX; } return 0; }
656
1
static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg){ AVFrame *pic=NULL; int i; const int encoding_delay= s->max_b_frames; int direct=1; if(pic_arg){ if(encoding_delay && !(s->flags&CODEC_FLAG_INPUT_PRESERVED)) direct=0; if(pic_arg->linesize[0] != s->linesize) direct=0; if(pic_arg->linesize[1] != s->uvlinesize) direct=0; if(pic_arg->linesize[2] != s->uvlinesize) direct=0; // printf("%d %d %d %d\n",pic_arg->linesize[0], pic_arg->linesize[1], s->linesize, s->uvlinesize); if(direct){ i= find_unused_picture(s, 1); pic= (AVFrame*)&s->picture[i]; pic->reference= 3; for(i=0; i<4; i++){ pic->data[i]= pic_arg->data[i]; pic->linesize[i]= pic_arg->linesize[i]; } alloc_picture(s, (Picture*)pic, 1); }else{ i= find_unused_picture(s, 0); pic= (AVFrame*)&s->picture[i]; pic->reference= 3; alloc_picture(s, (Picture*)pic, 0); for(i=0; i<4; i++){ /* the input will be 16 pixels to the right relative to the actual buffer start * and the current_pic, so the buffer can be reused, yes its not beatifull */ pic->data[i]+= 16; } if( pic->data[0] == pic_arg->data[0] && pic->data[1] == pic_arg->data[1] && pic->data[2] == pic_arg->data[2]){ // empty }else{ int h_chroma_shift, v_chroma_shift; avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &h_chroma_shift, &v_chroma_shift); for(i=0; i<3; i++){ int src_stride= pic_arg->linesize[i]; int dst_stride= i ? s->uvlinesize : s->linesize; int h_shift= i ? h_chroma_shift : 0; int v_shift= i ? v_chroma_shift : 0; int w= s->width >>h_shift; int h= s->height>>v_shift; uint8_t *src= pic_arg->data[i]; uint8_t *dst= pic->data[i]; if(src_stride==dst_stride) memcpy(dst, src, src_stride*h); else{ while(h--){ memcpy(dst, src, w); dst += dst_stride; src += src_stride; } } } } } pic->quality= pic_arg->quality; pic->pict_type= pic_arg->pict_type; pic->pts = pic_arg->pts; if(s->input_picture[encoding_delay]) pic->display_picture_number= s->input_picture[encoding_delay]->display_picture_number + 1; } /* shift buffer entries */ for(i=1; i<MAX_PICTURE_COUNT /*s->encoding_delay+1*/; i++) s->input_picture[i-1]= s->input_picture[i]; s->input_picture[encoding_delay]= (Picture*)pic; return 0; }
658
1
void APE::Properties::analyzeCurrent() { // Read the descriptor d->file->seek(2, File::Current); ByteVector descriptor = d->file->readBlock(44); uint descriptorBytes = descriptor.mid(0,4).toUInt(false); if ((descriptorBytes - 52) > 0) d->file->seek(descriptorBytes - 52, File::Current); // Read the header ByteVector header = d->file->readBlock(24); // Get the APE info d->channels = header.mid(18, 2).toShort(false); d->sampleRate = header.mid(20, 4).toUInt(false); d->bitsPerSample = header.mid(16, 2).toShort(false); //d->compressionLevel = uint totalFrames = header.mid(12, 4).toUInt(false); uint blocksPerFrame = header.mid(4, 4).toUInt(false); uint finalFrameBlocks = header.mid(8, 4).toUInt(false); uint totalBlocks = totalFrames > 0 ? (totalFrames - 1) * blocksPerFrame + finalFrameBlocks : 0; d->length = totalBlocks / d->sampleRate; d->bitrate = d->length > 0 ? ((d->streamLength * 8L) / d->length) / 1000 : 0; }
659
1
int jas_iccprof_save(jas_iccprof_t *prof, jas_stream_t *out) { long curoff; long reloff; long newoff; int i; int j; jas_icctagtabent_t *tagtabent; jas_icctagtabent_t *sharedtagtabent; jas_icctagtabent_t *tmptagtabent; jas_iccuint32_t attrname; jas_iccattrval_t *attrval; jas_icctagtab_t *tagtab; tagtab = &prof->tagtab; if (!(tagtab->ents = jas_malloc(prof->attrtab->numattrs * sizeof(jas_icctagtabent_t)))) goto error; tagtab->numents = prof->attrtab->numattrs; curoff = JAS_ICC_HDRLEN + 4 + 12 * tagtab->numents; for (i = 0; i < JAS_CAST(int, tagtab->numents); ++i) { tagtabent = &tagtab->ents[i]; if (jas_iccattrtab_get(prof->attrtab, i, &attrname, &attrval)) goto error; assert(attrval->ops->output); tagtabent->tag = attrname; tagtabent->data = &attrval->data; sharedtagtabent = 0; for (j = 0; j < i; ++j) { tmptagtabent = &tagtab->ents[j]; if (tagtabent->data == tmptagtabent->data) { sharedtagtabent = tmptagtabent; break; } } if (sharedtagtabent) { tagtabent->off = sharedtagtabent->off; tagtabent->len = sharedtagtabent->len; tagtabent->first = sharedtagtabent; } else { tagtabent->off = curoff; tagtabent->len = (*attrval->ops->getsize)(attrval) + 8; tagtabent->first = 0; if (i < JAS_CAST(int, tagtab->numents - 1)) { curoff = jas_iccpadtomult(curoff + tagtabent->len, 4); } else { curoff += tagtabent->len; } } jas_iccattrval_destroy(attrval); } prof->hdr.size = curoff; if (jas_iccprof_writehdr(out, &prof->hdr)) goto error; if (jas_iccprof_puttagtab(out, &prof->tagtab)) goto error; curoff = JAS_ICC_HDRLEN + 4 + 12 * tagtab->numents; for (i = 0; i < JAS_CAST(int, tagtab->numents);) { tagtabent = &tagtab->ents[i]; assert(curoff == JAS_CAST(long, tagtabent->off)); if (jas_iccattrtab_get(prof->attrtab, i, &attrname, &attrval)) goto error; if (jas_iccputuint32(out, attrval->type) || jas_stream_pad(out, 4, 0) != 4) goto error; if ((*attrval->ops->output)(attrval, out)) goto error; jas_iccattrval_destroy(attrval); curoff += tagtabent->len; ++i; while (i < JAS_CAST(int, tagtab->numents) && tagtab->ents[i].first) ++i; newoff = (i < JAS_CAST(int, tagtab->numents)) ? tagtab->ents[i].off : prof->hdr.size; reloff = newoff - curoff; assert(reloff >= 0); if (reloff > 0) { if (jas_stream_pad(out, reloff, 0) != reloff) goto error; curoff += reloff; } } return 0; error: /* XXX - need to free some resources here */ return -1; }
660
1
void jpc_qmfb_split_colgrp(jpc_fix_t *a, int numrows, int stride, int parity) { int bufsize = JPC_CEILDIVPOW2(numrows, 1); jpc_fix_t splitbuf[QMFB_SPLITBUFSIZE * JPC_QMFB_COLGRPSIZE]; jpc_fix_t *buf = splitbuf; jpc_fix_t *srcptr; jpc_fix_t *dstptr; register jpc_fix_t *srcptr2; register jpc_fix_t *dstptr2; register int n; register int i; int m; int hstartcol; /* Get a buffer. */ if (bufsize > QMFB_SPLITBUFSIZE) { if (!(buf = jas_malloc(bufsize * sizeof(jpc_fix_t)))) { /* We have no choice but to commit suicide in this case. */ abort(); } } if (numrows >= 2) { hstartcol = (numrows + 1 - parity) >> 1; m = (parity) ? hstartcol : (numrows - hstartcol); /* Save the samples destined for the highpass channel. */ n = m; dstptr = buf; srcptr = &a[(1 - parity) * stride]; while (n-- > 0) { dstptr2 = dstptr; srcptr2 = srcptr; for (i = 0; i < JPC_QMFB_COLGRPSIZE; ++i) { *dstptr2 = *srcptr2; ++dstptr2; ++srcptr2; } dstptr += JPC_QMFB_COLGRPSIZE; srcptr += stride << 1; } /* Copy the appropriate samples into the lowpass channel. */ dstptr = &a[(1 - parity) * stride]; srcptr = &a[(2 - parity) * stride]; n = numrows - m - (!parity); while (n-- > 0) { dstptr2 = dstptr; srcptr2 = srcptr; for (i = 0; i < JPC_QMFB_COLGRPSIZE; ++i) { *dstptr2 = *srcptr2; ++dstptr2; ++srcptr2; } dstptr += stride; srcptr += stride << 1; } /* Copy the saved samples into the highpass channel. */ dstptr = &a[hstartcol * stride]; srcptr = buf; n = m; while (n-- > 0) { dstptr2 = dstptr; srcptr2 = srcptr; for (i = 0; i < JPC_QMFB_COLGRPSIZE; ++i) { *dstptr2 = *srcptr2; ++dstptr2; ++srcptr2; } dstptr += stride; srcptr += JPC_QMFB_COLGRPSIZE; } } /* If the split buffer was allocated on the heap, free this memory. */ if (buf != splitbuf) { jas_free(buf); } }
661
1
int av_buffersink_get_frame(AVFilterContext *ctx, AVFrame *frame) { BufferSinkContext *s = ctx->priv; AVFilterLink *link = ctx->inputs[0]; int ret; if ((ret = ff_request_frame(link)) < 0) return ret; if (!s->cur_frame) return AVERROR(EINVAL); av_frame_move_ref(frame, s->cur_frame); av_frame_free(&s->cur_frame); return 0; }
662
1
ByteVector ByteVector::mid(uint index, uint length) const { ByteVector v; if(index > size()) return v; ConstIterator endIt; if(length < 0xffffffff && length + index < size()) endIt = d->data.begin() + index + length; else endIt = d->data.end(); v.d->data.insert(v.d->data.begin(), ConstIterator(d->data.begin() + index), endIt); v.d->size = v.d->data.size(); return v; }
663
0
unsigned int vp9_sad ## m ## x ## n ## _avg_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , const uint8_t * second_pred ) { uint8_t comp_pred [ m * n ] ; vp9_comp_avg_pred ( comp_pred , second_pred , m , n , ref , ref_stride ) ; return sad ( src , src_stride , comp_pred , m , m , n ) ; \ } # define sadMxNxK ( m , n , k ) void vp9_sad ## m ## x ## n ## x ## k ## _c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sads ) { int i ; for ( i = 0 ; i < k ; ++ i ) sads [ i ] = vp9_sad ## m ## x ## n ## _c ( src , src_stride , & ref [ i ] , ref_stride ) ; \ } # define sadMxNx4D ( m , n ) void vp9_sad ## m ## x ## n ## x4d_c ( const uint8_t * src , int src_stride , const uint8_t * const refs [ ] , int ref_stride , unsigned int * sads ) { int i ; for ( i = 0 ; i < 4 ; ++ i ) sads [ i ] = vp9_sad ## m ## x ## n ## _c ( src , src_stride , refs [ i ] , ref_stride ) ; \ } sadMxN ( 64 , 64 ) sadMxNxK ( 64 , 64 , 3 ) sadMxNxK ( 64 , 64 , 8 ) sadMxNx4D ( 64 , 64 ) sadMxN ( 64 , 32 ) sadMxNx4D ( 64 , 32 ) sadMxN ( 32 , 64 ) sadMxNx4D ( 32 , 64 ) sadMxN ( 32 , 32 ) sadMxNxK ( 32 , 32 , 3 ) sadMxNxK ( 32 , 32 , 8 ) sadMxNx4D ( 32 , 32 ) sadMxN ( 32 , 16 ) sadMxNx4D ( 32 , 16 ) sadMxN ( 16 , 32 ) sadMxNx4D ( 16 , 32 ) sadMxN ( 16 , 16 ) sadMxNxK ( 16 , 16 , 3 ) sadMxNxK ( 16 , 16 , 8 ) sadMxNx4D ( 16 , 16 ) sadMxN ( 16 , 8 ) sadMxNxK ( 16 , 8 , 3 ) sadMxNxK ( 16 , 8 , 8 ) sadMxNx4D ( 16 , 8 ) sadMxN ( 8 , 16 ) sadMxNxK ( 8 , 16 , 3 ) sadMxNxK ( 8 , 16 , 8 ) sadMxNx4D ( 8 , 16 ) sadMxN ( 8 , 8 )
664
1
bool_t xdr_nullstring(XDR *xdrs, char **objp) { u_int size; if (xdrs->x_op == XDR_ENCODE) { if (*objp == NULL) size = 0; else size = strlen(*objp) + 1; } if (! xdr_u_int(xdrs, &size)) { return FALSE; } switch (xdrs->x_op) { case XDR_DECODE: if (size == 0) { *objp = NULL; return TRUE; } else if (*objp == NULL) { *objp = (char *) mem_alloc(size); if (*objp == NULL) { errno = ENOMEM; return FALSE; } } return (xdr_opaque(xdrs, *objp, size)); case XDR_ENCODE: if (size != 0) return (xdr_opaque(xdrs, *objp, size)); return TRUE; case XDR_FREE: if (*objp != NULL) mem_free(*objp, size); *objp = NULL; return TRUE; } return FALSE; }
665
0
ByteVector ByteVector::mid(uint index, uint length) const { ByteVector v; if(index > size()) return v; ConstIterator endIt; if(length < size() - index) endIt = d->data.begin() + index + length; else endIt = d->data.end(); v.d->data.insert(v.d->data.begin(), ConstIterator(d->data.begin() + index), endIt); v.d->size = v.d->data.size(); return v; }
666
1
static int jas_cmshapmatlut_set(jas_cmshapmatlut_t *lut, jas_icccurv_t *curv) { jas_cmreal_t gamma; int i; gamma = 0; jas_cmshapmatlut_cleanup(lut); if (curv->numents == 0) { lut->size = 2; if (!(lut->data = jas_malloc(lut->size * sizeof(jas_cmreal_t)))) goto error; lut->data[0] = 0.0; lut->data[1] = 1.0; } else if (curv->numents == 1) { lut->size = 256; if (!(lut->data = jas_malloc(lut->size * sizeof(jas_cmreal_t)))) goto error; gamma = curv->ents[0] / 256.0; for (i = 0; i < lut->size; ++i) { lut->data[i] = gammafn(i / (double) (lut->size - 1), gamma); } } else { lut->size = curv->numents; if (!(lut->data = jas_malloc(lut->size * sizeof(jas_cmreal_t)))) goto error; for (i = 0; i < lut->size; ++i) { lut->data[i] = curv->ents[i] / 65535.0; } } return 0; error: return -1; }
667
1
static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value, MemTxAttrs attrs) { ARMCPU *cpu = s->cpu; switch (offset) { case 0x380 ... 0x3bf: /* NVIC_ITNS<n> */ { int startvec = 32 * (offset - 0x380) + NVIC_FIRST_IRQ; int i; if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (!attrs.secure) { break; } for (i = 0; i < 32 && startvec + i < s->num_irq; i++) { s->itns[startvec + i] = (value >> i) & 1; } nvic_irq_update(s); break; } case 0xd04: /* Interrupt Control State (ICSR) */ if (cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK) { if (value & (1 << 31)) { armv7m_nvic_set_pending(s, ARMV7M_EXCP_NMI, false); } else if (value & (1 << 30) && arm_feature(&cpu->env, ARM_FEATURE_V8)) { /* PENDNMICLR didn't exist in v7M */ armv7m_nvic_clear_pending(s, ARMV7M_EXCP_NMI, false); } } if (value & (1 << 28)) { armv7m_nvic_set_pending(s, ARMV7M_EXCP_PENDSV, attrs.secure); } else if (value & (1 << 27)) { armv7m_nvic_clear_pending(s, ARMV7M_EXCP_PENDSV, attrs.secure); } if (value & (1 << 26)) { armv7m_nvic_set_pending(s, ARMV7M_EXCP_SYSTICK, attrs.secure); } else if (value & (1 << 25)) { armv7m_nvic_clear_pending(s, ARMV7M_EXCP_SYSTICK, attrs.secure); } break; case 0xd08: /* Vector Table Offset. */ cpu->env.v7m.vecbase[attrs.secure] = value & 0xffffff80; break; case 0xd0c: /* Application Interrupt/Reset Control (AIRCR) */ if ((value >> R_V7M_AIRCR_VECTKEY_SHIFT) == 0x05fa) { if (value & R_V7M_AIRCR_SYSRESETREQ_MASK) { if (attrs.secure || !(cpu->env.v7m.aircr & R_V7M_AIRCR_SYSRESETREQS_MASK)) { qemu_irq_pulse(s->sysresetreq); } } if (value & R_V7M_AIRCR_VECTCLRACTIVE_MASK) { qemu_log_mask(LOG_GUEST_ERROR, "Setting VECTCLRACTIVE when not in DEBUG mode " "is UNPREDICTABLE\n"); } if (value & R_V7M_AIRCR_VECTRESET_MASK) { /* NB: this bit is RES0 in v8M */ qemu_log_mask(LOG_GUEST_ERROR, "Setting VECTRESET when not in DEBUG mode " "is UNPREDICTABLE\n"); } s->prigroup[attrs.secure] = extract32(value, R_V7M_AIRCR_PRIGROUP_SHIFT, R_V7M_AIRCR_PRIGROUP_LENGTH); if (attrs.secure) { /* These bits are only writable by secure */ cpu->env.v7m.aircr = value & (R_V7M_AIRCR_SYSRESETREQS_MASK | R_V7M_AIRCR_BFHFNMINS_MASK | R_V7M_AIRCR_PRIS_MASK); /* BFHFNMINS changes the priority of Secure HardFault, and * allows a pending Non-secure HardFault to preempt (which * we implement by marking it enabled). */ if (cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK) { s->sec_vectors[ARMV7M_EXCP_HARD].prio = -3; s->vectors[ARMV7M_EXCP_HARD].enabled = 1; } else { s->sec_vectors[ARMV7M_EXCP_HARD].prio = -1; s->vectors[ARMV7M_EXCP_HARD].enabled = 0; } } nvic_irq_update(s); } break; case 0xd10: /* System Control. */ /* TODO: Implement control registers. */ qemu_log_mask(LOG_UNIMP, "NVIC: SCR unimplemented\n"); break; case 0xd14: /* Configuration Control. */ /* Enforce RAZ/WI on reserved and must-RAZ/WI bits */ value &= (R_V7M_CCR_STKALIGN_MASK | R_V7M_CCR_BFHFNMIGN_MASK | R_V7M_CCR_DIV_0_TRP_MASK | R_V7M_CCR_UNALIGN_TRP_MASK | R_V7M_CCR_USERSETMPEND_MASK | R_V7M_CCR_NONBASETHRDENA_MASK); if (arm_feature(&cpu->env, ARM_FEATURE_V8)) { /* v8M makes NONBASETHRDENA and STKALIGN be RES1 */ value |= R_V7M_CCR_NONBASETHRDENA_MASK | R_V7M_CCR_STKALIGN_MASK; } if (attrs.secure) { /* the BFHFNMIGN bit is not banked; keep that in the NS copy */ cpu->env.v7m.ccr[M_REG_NS] = (cpu->env.v7m.ccr[M_REG_NS] & ~R_V7M_CCR_BFHFNMIGN_MASK) | (value & R_V7M_CCR_BFHFNMIGN_MASK); value &= ~R_V7M_CCR_BFHFNMIGN_MASK; } cpu->env.v7m.ccr[attrs.secure] = value; break; case 0xd24: /* System Handler Control and State (SHCSR) */ if (attrs.secure) { s->sec_vectors[ARMV7M_EXCP_MEM].active = (value & (1 << 0)) != 0; /* Secure HardFault active bit cannot be written */ s->sec_vectors[ARMV7M_EXCP_USAGE].active = (value & (1 << 3)) != 0; s->sec_vectors[ARMV7M_EXCP_SVC].active = (value & (1 << 7)) != 0; s->sec_vectors[ARMV7M_EXCP_PENDSV].active = (value & (1 << 10)) != 0; s->sec_vectors[ARMV7M_EXCP_SYSTICK].active = (value & (1 << 11)) != 0; s->sec_vectors[ARMV7M_EXCP_USAGE].pending = (value & (1 << 12)) != 0; s->sec_vectors[ARMV7M_EXCP_MEM].pending = (value & (1 << 13)) != 0; s->sec_vectors[ARMV7M_EXCP_SVC].pending = (value & (1 << 15)) != 0; s->sec_vectors[ARMV7M_EXCP_MEM].enabled = (value & (1 << 16)) != 0; s->sec_vectors[ARMV7M_EXCP_BUS].enabled = (value & (1 << 17)) != 0; s->sec_vectors[ARMV7M_EXCP_USAGE].enabled = (value & (1 << 18)) != 0; s->sec_vectors[ARMV7M_EXCP_HARD].pending = (value & (1 << 21)) != 0; /* SecureFault not banked, but RAZ/WI to NS */ s->vectors[ARMV7M_EXCP_SECURE].active = (value & (1 << 4)) != 0; s->vectors[ARMV7M_EXCP_SECURE].enabled = (value & (1 << 19)) != 0; s->vectors[ARMV7M_EXCP_SECURE].pending = (value & (1 << 20)) != 0; } else { s->vectors[ARMV7M_EXCP_MEM].active = (value & (1 << 0)) != 0; if (arm_feature(&cpu->env, ARM_FEATURE_V8)) { /* HARDFAULTPENDED is not present in v7M */ s->vectors[ARMV7M_EXCP_HARD].pending = (value & (1 << 21)) != 0; } s->vectors[ARMV7M_EXCP_USAGE].active = (value & (1 << 3)) != 0; s->vectors[ARMV7M_EXCP_SVC].active = (value & (1 << 7)) != 0; s->vectors[ARMV7M_EXCP_PENDSV].active = (value & (1 << 10)) != 0; s->vectors[ARMV7M_EXCP_SYSTICK].active = (value & (1 << 11)) != 0; s->vectors[ARMV7M_EXCP_USAGE].pending = (value & (1 << 12)) != 0; s->vectors[ARMV7M_EXCP_MEM].pending = (value & (1 << 13)) != 0; s->vectors[ARMV7M_EXCP_SVC].pending = (value & (1 << 15)) != 0; s->vectors[ARMV7M_EXCP_MEM].enabled = (value & (1 << 16)) != 0; s->vectors[ARMV7M_EXCP_USAGE].enabled = (value & (1 << 18)) != 0; } if (attrs.secure || (cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK)) { s->vectors[ARMV7M_EXCP_BUS].active = (value & (1 << 1)) != 0; s->vectors[ARMV7M_EXCP_BUS].pending = (value & (1 << 14)) != 0; s->vectors[ARMV7M_EXCP_BUS].enabled = (value & (1 << 17)) != 0; } /* NMIACT can only be written if the write is of a zero, with * BFHFNMINS 1, and by the CPU in secure state via the NS alias. */ if (!attrs.secure && cpu->env.v7m.secure && (cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK) && (value & (1 << 5)) == 0) { s->vectors[ARMV7M_EXCP_NMI].active = 0; } /* HARDFAULTACT can only be written if the write is of a zero * to the non-secure HardFault state by the CPU in secure state. * The only case where we can be targeting the non-secure HF state * when in secure state is if this is a write via the NS alias * and BFHFNMINS is 1. */ if (!attrs.secure && cpu->env.v7m.secure && (cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK) && (value & (1 << 2)) == 0) { s->vectors[ARMV7M_EXCP_HARD].active = 0; } /* TODO: this is RAZ/WI from NS if DEMCR.SDME is set */ s->vectors[ARMV7M_EXCP_DEBUG].active = (value & (1 << 8)) != 0; nvic_irq_update(s); break; case 0xd28: /* Configurable Fault Status. */ cpu->env.v7m.cfsr[attrs.secure] &= ~value; /* W1C */ if (attrs.secure) { /* The BFSR bits [15:8] are shared between security states * and we store them in the NS copy. */ cpu->env.v7m.cfsr[M_REG_NS] &= ~(value & R_V7M_CFSR_BFSR_MASK); } break; case 0xd2c: /* Hard Fault Status. */ cpu->env.v7m.hfsr &= ~value; /* W1C */ break; case 0xd30: /* Debug Fault Status. */ cpu->env.v7m.dfsr &= ~value; /* W1C */ break; case 0xd34: /* Mem Manage Address. */ cpu->env.v7m.mmfar[attrs.secure] = value; return; case 0xd38: /* Bus Fault Address. */ cpu->env.v7m.bfar = value; return; case 0xd3c: /* Aux Fault Status. */ qemu_log_mask(LOG_UNIMP, "NVIC: Aux fault status registers unimplemented\n"); break; case 0xd90: /* MPU_TYPE */ return; /* RO */ case 0xd94: /* MPU_CTRL */ if ((value & (R_V7M_MPU_CTRL_HFNMIENA_MASK | R_V7M_MPU_CTRL_ENABLE_MASK)) == R_V7M_MPU_CTRL_HFNMIENA_MASK) { qemu_log_mask(LOG_GUEST_ERROR, "MPU_CTRL: HFNMIENA and !ENABLE is " "UNPREDICTABLE\n"); } cpu->env.v7m.mpu_ctrl[attrs.secure] = value & (R_V7M_MPU_CTRL_ENABLE_MASK | R_V7M_MPU_CTRL_HFNMIENA_MASK | R_V7M_MPU_CTRL_PRIVDEFENA_MASK); tlb_flush(CPU(cpu)); break; case 0xd98: /* MPU_RNR */ if (value >= cpu->pmsav7_dregion) { qemu_log_mask(LOG_GUEST_ERROR, "MPU region out of range %" PRIu32 "/%" PRIu32 "\n", value, cpu->pmsav7_dregion); } else { cpu->env.pmsav7.rnr[attrs.secure] = value; } break; case 0xd9c: /* MPU_RBAR */ case 0xda4: /* MPU_RBAR_A1 */ case 0xdac: /* MPU_RBAR_A2 */ case 0xdb4: /* MPU_RBAR_A3 */ { int region; if (arm_feature(&cpu->env, ARM_FEATURE_V8)) { /* PMSAv8M handling of the aliases is different from v7M: * aliases A1, A2, A3 override the low two bits of the region * number in MPU_RNR, and there is no 'region' field in the * RBAR register. */ int aliasno = (offset - 0xd9c) / 8; /* 0..3 */ region = cpu->env.pmsav7.rnr[attrs.secure]; if (aliasno) { region = deposit32(region, 0, 2, aliasno); } if (region >= cpu->pmsav7_dregion) { return; } cpu->env.pmsav8.rbar[attrs.secure][region] = value; tlb_flush(CPU(cpu)); return; } if (value & (1 << 4)) { /* VALID bit means use the region number specified in this * value and also update MPU_RNR.REGION with that value. */ region = extract32(value, 0, 4); if (region >= cpu->pmsav7_dregion) { qemu_log_mask(LOG_GUEST_ERROR, "MPU region out of range %u/%" PRIu32 "\n", region, cpu->pmsav7_dregion); return; } cpu->env.pmsav7.rnr[attrs.secure] = region; } else { region = cpu->env.pmsav7.rnr[attrs.secure]; } if (region >= cpu->pmsav7_dregion) { return; } cpu->env.pmsav7.drbar[region] = value & ~0x1f; tlb_flush(CPU(cpu)); break; } case 0xda0: /* MPU_RASR (v7M), MPU_RLAR (v8M) */ case 0xda8: /* MPU_RASR_A1 (v7M), MPU_RLAR_A1 (v8M) */ case 0xdb0: /* MPU_RASR_A2 (v7M), MPU_RLAR_A2 (v8M) */ case 0xdb8: /* MPU_RASR_A3 (v7M), MPU_RLAR_A3 (v8M) */ { int region = cpu->env.pmsav7.rnr[attrs.secure]; if (arm_feature(&cpu->env, ARM_FEATURE_V8)) { /* PMSAv8M handling of the aliases is different from v7M: * aliases A1, A2, A3 override the low two bits of the region * number in MPU_RNR. */ int aliasno = (offset - 0xd9c) / 8; /* 0..3 */ region = cpu->env.pmsav7.rnr[attrs.secure]; if (aliasno) { region = deposit32(region, 0, 2, aliasno); } if (region >= cpu->pmsav7_dregion) { return; } cpu->env.pmsav8.rlar[attrs.secure][region] = value; tlb_flush(CPU(cpu)); return; } if (region >= cpu->pmsav7_dregion) { return; } cpu->env.pmsav7.drsr[region] = value & 0xff3f; cpu->env.pmsav7.dracr[region] = (value >> 16) & 0x173f; tlb_flush(CPU(cpu)); break; } case 0xdc0: /* MPU_MAIR0 */ if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (cpu->pmsav7_dregion) { /* Register is RES0 if no MPU regions are implemented */ cpu->env.pmsav8.mair0[attrs.secure] = value; } /* We don't need to do anything else because memory attributes * only affect cacheability, and we don't implement caching. */ break; case 0xdc4: /* MPU_MAIR1 */ if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (cpu->pmsav7_dregion) { /* Register is RES0 if no MPU regions are implemented */ cpu->env.pmsav8.mair1[attrs.secure] = value; } /* We don't need to do anything else because memory attributes * only affect cacheability, and we don't implement caching. */ break; case 0xdd0: /* SAU_CTRL */ if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (!attrs.secure) { return; } cpu->env.sau.ctrl = value & 3; break; case 0xdd4: /* SAU_TYPE */ if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } break; case 0xdd8: /* SAU_RNR */ if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (!attrs.secure) { return; } if (value >= cpu->sau_sregion) { qemu_log_mask(LOG_GUEST_ERROR, "SAU region out of range %" PRIu32 "/%" PRIu32 "\n", value, cpu->sau_sregion); } else { cpu->env.sau.rnr = value; } break; case 0xddc: /* SAU_RBAR */ { int region = cpu->env.sau.rnr; if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (!attrs.secure) { return; } if (region >= cpu->sau_sregion) { return; } cpu->env.sau.rbar[region] = value & ~0x1f; tlb_flush(CPU(cpu)); break; } case 0xde0: /* SAU_RLAR */ { int region = cpu->env.sau.rnr; if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (!attrs.secure) { return; } if (region >= cpu->sau_sregion) { return; } cpu->env.sau.rlar[region] = value & ~0x1c; tlb_flush(CPU(cpu)); break; } case 0xde4: /* SFSR */ if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (!attrs.secure) { return; } cpu->env.v7m.sfsr &= ~value; /* W1C */ break; case 0xde8: /* SFAR */ if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) { goto bad_offset; } if (!attrs.secure) { return; } cpu->env.v7m.sfsr = value; break; case 0xf00: /* Software Triggered Interrupt Register */ { int excnum = (value & 0x1ff) + NVIC_FIRST_IRQ; if (excnum < s->num_irq) { armv7m_nvic_set_pending(s, excnum, false); } break; } default: bad_offset: qemu_log_mask(LOG_GUEST_ERROR, "NVIC: Bad write offset 0x%x\n", offset); } }
668
0
void _zip_dirent_torrent_normalize ( struct zip_dirent * de ) { static struct tm torrenttime ; static time_t last_mod = 0 ; if ( last_mod == 0 ) { # ifdef HAVE_STRUCT_TM_TM_ZONE time_t now ; struct tm * l ; # endif torrenttime . tm_sec = 0 ; torrenttime . tm_min = 32 ; torrenttime . tm_hour = 23 ; torrenttime . tm_mday = 24 ; torrenttime . tm_mon = 11 ; torrenttime . tm_year = 96 ; torrenttime . tm_wday = 0 ; torrenttime . tm_yday = 0 ; torrenttime . tm_isdst = 0 ; # ifdef HAVE_STRUCT_TM_TM_ZONE time ( & now ) ; l = localtime ( & now ) ; torrenttime . tm_gmtoff = l -> tm_gmtoff ; torrenttime . tm_zone = l -> tm_zone ; # endif last_mod = mktime ( & torrenttime ) ; } de -> version_madeby = 0 ; de -> version_needed = 20 ; de -> bitflags = 2 ; de -> comp_method = ZIP_CM_DEFLATE ; de -> last_mod = last_mod ; de -> disk_number = 0 ; de -> int_attrib = 0 ; de -> ext_attrib = 0 ; de -> offset = 0 ; free ( de -> extrafield ) ; de -> extrafield = NULL ; de -> extrafield_len = 0 ; free ( de -> comment ) ; de -> comment = NULL ; de -> comment_len = 0 ; }
669
0
static void directory_load_cancel ( NautilusDirectory * directory ) { NautilusFile * file ; DirectoryLoadState * state ; state = directory -> details -> directory_load_in_progress ; if ( state != NULL ) { file = state -> load_directory_file ; file -> details -> loading_directory = FALSE ; if ( file -> details -> directory != directory ) { nautilus_directory_async_state_changed ( file -> details -> directory ) ; } g_cancellable_cancel ( state -> cancellable ) ; state -> directory = NULL ; directory -> details -> directory_load_in_progress = NULL ; async_job_end ( directory , "file list" ) ; } }
670
1
static target_ulong put_tce_emu(sPAPRTCETable *tcet, target_ulong ioba, target_ulong tce) { sPAPRTCE *tcep; if (ioba >= tcet->window_size) { hcall_dprintf("spapr_vio_put_tce on out-of-boards IOBA 0x" TARGET_FMT_lx "\n", ioba); return H_PARAMETER; } tcep = tcet->table + (ioba >> SPAPR_TCE_PAGE_SHIFT); tcep->tce = tce; return H_SUCCESS; }
671
1
static int mem_resize(jas_stream_memobj_t *m, int bufsize) { unsigned char *buf; assert(m->buf_); if (!(buf = jas_realloc(m->buf_, bufsize * sizeof(unsigned char)))) { return -1; } m->buf_ = buf; m->bufsize_ = bufsize; return 0; }
672
1
void Ogg::XiphComment::parse(const ByteVector &data) { // The first thing in the comment data is the vendor ID length, followed by a // UTF8 string with the vendor ID. int pos = 0; int vendorLength = data.mid(0, 4).toUInt(false); pos += 4; d->vendorID = String(data.mid(pos, vendorLength), String::UTF8); pos += vendorLength; // Next the number of fields in the comment vector. int commentFields = data.mid(pos, 4).toUInt(false); pos += 4; for(int i = 0; i < commentFields; i++) { // Each comment field is in the format "KEY=value" in a UTF8 string and has // 4 bytes before the text starts that gives the length. int commentLength = data.mid(pos, 4).toUInt(false); pos += 4; String comment = String(data.mid(pos, commentLength), String::UTF8); pos += commentLength; int commentSeparatorPosition = comment.find("="); String key = comment.substr(0, commentSeparatorPosition); String value = comment.substr(commentSeparatorPosition + 1); addField(key, value, false); } }
673
1
kadm5_create_principal_3(void *server_handle, kadm5_principal_ent_t entry, long mask, int n_ks_tuple, krb5_key_salt_tuple *ks_tuple, char *password) { krb5_db_entry *kdb; osa_princ_ent_rec adb; kadm5_policy_ent_rec polent; krb5_boolean have_polent = FALSE; krb5_int32 now; krb5_tl_data *tl_data_tail; unsigned int ret; kadm5_server_handle_t handle = server_handle; krb5_keyblock *act_mkey; krb5_kvno act_kvno; int new_n_ks_tuple = 0; krb5_key_salt_tuple *new_ks_tuple = NULL; CHECK_HANDLE(server_handle); krb5_clear_error_message(handle->context); check_1_6_dummy(entry, mask, n_ks_tuple, ks_tuple, &password); /* * Argument sanity checking, and opening up the DB */ if(!(mask & KADM5_PRINCIPAL) || (mask & KADM5_MOD_NAME) || (mask & KADM5_MOD_TIME) || (mask & KADM5_LAST_PWD_CHANGE) || (mask & KADM5_MKVNO) || (mask & KADM5_AUX_ATTRIBUTES) || (mask & KADM5_LAST_SUCCESS) || (mask & KADM5_LAST_FAILED) || (mask & KADM5_FAIL_AUTH_COUNT)) return KADM5_BAD_MASK; if ((mask & KADM5_KEY_DATA) && entry->n_key_data != 0) return KADM5_BAD_MASK; if((mask & KADM5_POLICY) && (mask & KADM5_POLICY_CLR)) return KADM5_BAD_MASK; if((mask & ~ALL_PRINC_MASK)) return KADM5_BAD_MASK; if (entry == NULL) return EINVAL; /* * Check to see if the principal exists */ ret = kdb_get_entry(handle, entry->principal, &kdb, &adb); switch(ret) { case KADM5_UNK_PRINC: break; case 0: kdb_free_entry(handle, kdb, &adb); return KADM5_DUP; default: return ret; } kdb = krb5_db_alloc(handle->context, NULL, sizeof(*kdb)); if (kdb == NULL) return ENOMEM; memset(kdb, 0, sizeof(*kdb)); memset(&adb, 0, sizeof(osa_princ_ent_rec)); /* * If a policy was specified, load it. * If we can not find the one specified return an error */ if ((mask & KADM5_POLICY)) { ret = get_policy(handle, entry->policy, &polent, &have_polent); if (ret) goto cleanup; } if (password) { ret = passwd_check(handle, password, have_polent ? &polent : NULL, entry->principal); if (ret) goto cleanup; } /* * Start populating the various DB fields, using the * "defaults" for fields that were not specified by the * mask. */ if ((ret = krb5_timeofday(handle->context, &now))) goto cleanup; kdb->magic = KRB5_KDB_MAGIC_NUMBER; kdb->len = KRB5_KDB_V1_BASE_LENGTH; /* gag me with a chainsaw */ if ((mask & KADM5_ATTRIBUTES)) kdb->attributes = entry->attributes; else kdb->attributes = handle->params.flags; if ((mask & KADM5_MAX_LIFE)) kdb->max_life = entry->max_life; else kdb->max_life = handle->params.max_life; if (mask & KADM5_MAX_RLIFE) kdb->max_renewable_life = entry->max_renewable_life; else kdb->max_renewable_life = handle->params.max_rlife; if ((mask & KADM5_PRINC_EXPIRE_TIME)) kdb->expiration = entry->princ_expire_time; else kdb->expiration = handle->params.expiration; kdb->pw_expiration = 0; if (have_polent) { if(polent.pw_max_life) kdb->pw_expiration = now + polent.pw_max_life; else kdb->pw_expiration = 0; } if ((mask & KADM5_PW_EXPIRATION)) kdb->pw_expiration = entry->pw_expiration; kdb->last_success = 0; kdb->last_failed = 0; kdb->fail_auth_count = 0; /* this is kind of gross, but in order to free the tl data, I need to free the entire kdb entry, and that will try to free the principal. */ if ((ret = kadm5_copy_principal(handle->context, entry->principal, &(kdb->princ)))) goto cleanup; if ((ret = krb5_dbe_update_last_pwd_change(handle->context, kdb, now))) goto cleanup; if (mask & KADM5_TL_DATA) { /* splice entry->tl_data onto the front of kdb->tl_data */ for (tl_data_tail = entry->tl_data; tl_data_tail; tl_data_tail = tl_data_tail->tl_data_next) { ret = krb5_dbe_update_tl_data(handle->context, kdb, tl_data_tail); if( ret ) goto cleanup; } } /* * We need to have setup the TL data, so we have strings, so we can * check enctype policy, which is why we check/initialize ks_tuple * this late. */ ret = apply_keysalt_policy(handle, entry->policy, n_ks_tuple, ks_tuple, &new_n_ks_tuple, &new_ks_tuple); if (ret) goto cleanup; /* initialize the keys */ ret = kdb_get_active_mkey(handle, &act_kvno, &act_mkey); if (ret) goto cleanup; if (mask & KADM5_KEY_DATA) { /* The client requested no keys for this principal. */ assert(entry->n_key_data == 0); } else if (password) { ret = krb5_dbe_cpw(handle->context, act_mkey, new_ks_tuple, new_n_ks_tuple, password, (mask & KADM5_KVNO)?entry->kvno:1, FALSE, kdb); } else { /* Null password means create with random key (new in 1.8). */ ret = krb5_dbe_crk(handle->context, &master_keyblock, new_ks_tuple, new_n_ks_tuple, FALSE, kdb); } if (ret) goto cleanup; /* Record the master key VNO used to encrypt this entry's keys */ ret = krb5_dbe_update_mkvno(handle->context, kdb, act_kvno); if (ret) goto cleanup; ret = k5_kadm5_hook_create(handle->context, handle->hook_handles, KADM5_HOOK_STAGE_PRECOMMIT, entry, mask, new_n_ks_tuple, new_ks_tuple, password); if (ret) goto cleanup; /* populate the admin-server-specific fields. In the OV server, this used to be in a separate database. Since there's already marshalling code for the admin fields, to keep things simple, I'm going to keep it, and make all the admin stuff occupy a single tl_data record, */ adb.admin_history_kvno = INITIAL_HIST_KVNO; if (mask & KADM5_POLICY) { adb.aux_attributes = KADM5_POLICY; /* this does *not* need to be strdup'ed, because adb is xdr */ /* encoded in osa_adb_create_princ, and not ever freed */ adb.policy = entry->policy; } /* In all cases key and the principal data is set, let the database provider know */ kdb->mask = mask | KADM5_KEY_DATA | KADM5_PRINCIPAL ; /* store the new db entry */ ret = kdb_put_entry(handle, kdb, &adb); (void) k5_kadm5_hook_create(handle->context, handle->hook_handles, KADM5_HOOK_STAGE_POSTCOMMIT, entry, mask, new_n_ks_tuple, new_ks_tuple, password); cleanup: free(new_ks_tuple); krb5_db_free_principal(handle->context, kdb); if (have_polent) (void) kadm5_free_policy_ent(handle->lhandle, &polent); return ret; }
674
0
void Ogg::XiphComment::parse(const ByteVector &data) { // The first thing in the comment data is the vendor ID length, followed by a // UTF8 string with the vendor ID. int pos = 0; int vendorLength = data.mid(0, 4).toUInt(false); pos += 4; d->vendorID = String(data.mid(pos, vendorLength), String::UTF8); pos += vendorLength; // Next the number of fields in the comment vector. uint commentFields = data.mid(pos, 4).toUInt(false); pos += 4; if(commentFields > (data.size() - 8) / 4) { return; } for(uint i = 0; i < commentFields; i++) { // Each comment field is in the format "KEY=value" in a UTF8 string and has // 4 bytes before the text starts that gives the length. uint commentLength = data.mid(pos, 4).toUInt(false); pos += 4; String comment = String(data.mid(pos, commentLength), String::UTF8); pos += commentLength; if(pos > data.size()) { break; } int commentSeparatorPosition = comment.find("="); if(commentSeparatorPosition == -1) { break; } String key = comment.substr(0, commentSeparatorPosition); String value = comment.substr(commentSeparatorPosition + 1); addField(key, value, false); } }
676
0
size_t Curl_FormReader ( char * buffer , size_t size , size_t nitems , FILE * mydata ) { struct Form * form ; size_t wantedsize ; size_t gotsize = 0 ; form = ( struct Form * ) mydata ; wantedsize = size * nitems ; if ( ! form -> data ) return 0 ; if ( ( form -> data -> type == FORM_FILE ) || ( form -> data -> type == FORM_CALLBACK ) ) { gotsize = readfromfile ( form , buffer , wantedsize ) ; if ( gotsize ) return gotsize ; } do { if ( ( form -> data -> length - form -> sent ) > wantedsize - gotsize ) { memcpy ( buffer + gotsize , form -> data -> line + form -> sent , wantedsize - gotsize ) ; form -> sent += wantedsize - gotsize ; return wantedsize ; } memcpy ( buffer + gotsize , form -> data -> line + form -> sent , ( form -> data -> length - form -> sent ) ) ; gotsize += form -> data -> length - form -> sent ; form -> sent = 0 ; form -> data = form -> data -> next ; } while ( form -> data && ( form -> data -> type < FORM_CALLBACK ) ) ; return gotsize ; }
677
1
static void gen_lq(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); #else int ra, rd; TCGv EA; /* Restore CPU state */ if (unlikely(ctx->mem_idx == 0)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); return; } ra = rA(ctx->opcode); rd = rD(ctx->opcode); if (unlikely((rd & 1) || rd == ra)) { gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL); return; } if (unlikely(ctx->le_mode)) { /* Little-endian mode is not handled */ gen_exception_err(ctx, POWERPC_EXCP_ALIGN, POWERPC_EXCP_ALIGN_LE); return; } gen_set_access_type(ctx, ACCESS_INT); EA = tcg_temp_new(); gen_addr_imm_index(ctx, EA, 0x0F); gen_qemu_ld64(ctx, cpu_gpr[rd], EA); gen_addr_add(ctx, EA, EA, 8); gen_qemu_ld64(ctx, cpu_gpr[rd+1], EA); tcg_temp_free(EA); #endif }
678
0
static int32_t U_CALLCONV lenient8IteratorGetIndex ( UCharIterator * iter , UCharIteratorOrigin origin ) { switch ( origin ) { case UITER_ZERO : case UITER_START : return 0 ; case UITER_CURRENT : if ( iter -> index < 0 ) { const uint8_t * s ; UChar32 c ; int32_t i , limit , index ; s = ( const uint8_t * ) iter -> context ; i = index = 0 ; limit = iter -> start ; while ( i < limit ) { L8_NEXT ( s , i , limit , c ) ; if ( c <= 0xffff ) { ++ index ; } else { index += 2 ; } } iter -> start = i ; if ( i == iter -> limit ) { iter -> length = index ; } if ( iter -> reservedField != 0 ) { -- index ; } iter -> index = index ; } return iter -> index ; case UITER_LIMIT : case UITER_LENGTH : if ( iter -> length < 0 ) { const uint8_t * s ; UChar32 c ; int32_t i , limit , length ; s = ( const uint8_t * ) iter -> context ; if ( iter -> index < 0 ) { i = length = 0 ; limit = iter -> start ; while ( i < limit ) { L8_NEXT ( s , i , limit , c ) ; if ( c <= 0xffff ) { ++ length ; } else { length += 2 ; } } iter -> start = i ; iter -> index = iter -> reservedField != 0 ? length - 1 : length ; } else { i = iter -> start ; length = iter -> index ; if ( iter -> reservedField != 0 ) { ++ length ; } } limit = iter -> limit ; while ( i < limit ) { L8_NEXT ( s , i , limit , c ) ; if ( c <= 0xffff ) { ++ length ; } else { length += 2 ; } } iter -> length = length ; } return iter -> length ; default : return - 1 ; } }
680
1
static uint32_t esp_mem_readb(void *opaque, target_phys_addr_t addr) { ESPState *s = opaque; uint32_t saddr; saddr = (addr >> s->it_shift) & (ESP_REGS - 1); DPRINTF("read reg[%d]: 0x%2.2x\n", saddr, s->rregs[saddr]); switch (saddr) { case ESP_FIFO: if (s->ti_size > 0) { s->ti_size--; if ((s->rregs[ESP_RSTAT] & STAT_PIO_MASK) == 0) { /* Data in/out. */ fprintf(stderr, "esp: PIO data read not implemented\n"); s->rregs[ESP_FIFO] = 0; } else { s->rregs[ESP_FIFO] = s->ti_buf[s->ti_rptr++]; } esp_raise_irq(s); } if (s->ti_size == 0) { s->ti_rptr = 0; s->ti_wptr = 0; } break; case ESP_RINTR: // Clear interrupt/error status bits s->rregs[ESP_RSTAT] &= ~(STAT_GE | STAT_PE); esp_lower_irq(s); break; default: break; } return s->rregs[saddr]; }
681
1
jpc_mqenc_t *jpc_mqenc_create(int maxctxs, jas_stream_t *out) { jpc_mqenc_t *mqenc; /* Allocate memory for the MQ encoder. */ if (!(mqenc = jas_malloc(sizeof(jpc_mqenc_t)))) { goto error; } mqenc->out = out; mqenc->maxctxs = maxctxs; /* Allocate memory for the per-context state information. */ if (!(mqenc->ctxs = jas_malloc(mqenc->maxctxs * sizeof(jpc_mqstate_t *)))) { goto error; } /* Set the current context to the first one. */ mqenc->curctx = mqenc->ctxs; jpc_mqenc_init(mqenc); /* Initialize the per-context state information to something sane. */ jpc_mqenc_setctxs(mqenc, 0, 0); return mqenc; error: if (mqenc) { jpc_mqenc_destroy(mqenc); } return 0; }
682
1
static jpc_enc_rlvl_t *rlvl_create(jpc_enc_rlvl_t *rlvl, jpc_enc_cp_t *cp, jpc_enc_tcmpt_t *tcmpt, jpc_tsfb_band_t *bandinfos) { uint_fast16_t rlvlno; uint_fast32_t tlprctlx; uint_fast32_t tlprctly; uint_fast32_t brprcbrx; uint_fast32_t brprcbry; uint_fast16_t bandno; jpc_enc_band_t *band; /* Deduce the resolution level. */ rlvlno = rlvl - tcmpt->rlvls; /* Initialize members required for error recovery. */ rlvl->bands = 0; rlvl->tcmpt = tcmpt; /* Compute the coordinates of the top-left and bottom-right corners of the tile-component at this resolution. */ rlvl->tlx = JPC_CEILDIVPOW2(jas_seq2d_xstart(tcmpt->data), tcmpt->numrlvls - 1 - rlvlno); rlvl->tly = JPC_CEILDIVPOW2(jas_seq2d_ystart(tcmpt->data), tcmpt->numrlvls - 1 - rlvlno); rlvl->brx = JPC_CEILDIVPOW2(jas_seq2d_xend(tcmpt->data), tcmpt->numrlvls - 1 - rlvlno); rlvl->bry = JPC_CEILDIVPOW2(jas_seq2d_yend(tcmpt->data), tcmpt->numrlvls - 1 - rlvlno); if (rlvl->tlx >= rlvl->brx || rlvl->tly >= rlvl->bry) { rlvl->numhprcs = 0; rlvl->numvprcs = 0; rlvl->numprcs = 0; return rlvl; } rlvl->numbands = (!rlvlno) ? 1 : 3; rlvl->prcwidthexpn = cp->tccp.prcwidthexpns[rlvlno]; rlvl->prcheightexpn = cp->tccp.prcheightexpns[rlvlno]; if (!rlvlno) { rlvl->cbgwidthexpn = rlvl->prcwidthexpn; rlvl->cbgheightexpn = rlvl->prcheightexpn; } else { rlvl->cbgwidthexpn = rlvl->prcwidthexpn - 1; rlvl->cbgheightexpn = rlvl->prcheightexpn - 1; } rlvl->cblkwidthexpn = JAS_MIN(cp->tccp.cblkwidthexpn, rlvl->cbgwidthexpn); rlvl->cblkheightexpn = JAS_MIN(cp->tccp.cblkheightexpn, rlvl->cbgheightexpn); /* Compute the number of precincts. */ tlprctlx = JPC_FLOORTOMULTPOW2(rlvl->tlx, rlvl->prcwidthexpn); tlprctly = JPC_FLOORTOMULTPOW2(rlvl->tly, rlvl->prcheightexpn); brprcbrx = JPC_CEILTOMULTPOW2(rlvl->brx, rlvl->prcwidthexpn); brprcbry = JPC_CEILTOMULTPOW2(rlvl->bry, rlvl->prcheightexpn); rlvl->numhprcs = JPC_FLOORDIVPOW2(brprcbrx - tlprctlx, rlvl->prcwidthexpn); rlvl->numvprcs = JPC_FLOORDIVPOW2(brprcbry - tlprctly, rlvl->prcheightexpn); rlvl->numprcs = rlvl->numhprcs * rlvl->numvprcs; if (!(rlvl->bands = jas_malloc(rlvl->numbands * sizeof(jpc_enc_band_t)))) { goto error; } for (bandno = 0, band = rlvl->bands; bandno < rlvl->numbands; ++bandno, ++band) { band->prcs = 0; band->data = 0; band->rlvl = rlvl; } for (bandno = 0, band = rlvl->bands; bandno < rlvl->numbands; ++bandno, ++band) { if (!band_create(band, cp, rlvl, bandinfos)) { goto error; } } return rlvl; error: rlvl_destroy(rlvl); return 0; }
683
0
TSReturnCode TSHttpTxnServerPacketMarkSet ( TSHttpTxn txnp , int mark ) { sdk_assert ( sdk_sanity_check_txn ( txnp ) == TS_SUCCESS ) ; HttpSM * sm = ( HttpSM * ) txnp ; if ( nullptr != sm -> ua_session ) { HttpServerSession * ssn = sm -> ua_session -> get_server_session ( ) ; if ( nullptr != ssn ) { NetVConnection * vc = ssn -> get_netvc ( ) ; if ( vc != nullptr ) { vc -> options . packet_mark = ( uint32_t ) mark ; vc -> apply_options ( ) ; } } } TSHttpTxnConfigIntSet ( txnp , TS_CONFIG_NET_SOCK_PACKET_MARK_OUT , mark ) ; return TS_SUCCESS ; }
684
1
void FrameFactory::rebuildAggregateFrames(ID3v2::Tag *tag) const { if(tag->header()->majorVersion() < 4 && tag->frameList("TDRC").size() == 1 && tag->frameList("TDAT").size() == 1) { TextIdentificationFrame *tdrc = static_cast<TextIdentificationFrame *>(tag->frameList("TDRC").front()); UnknownFrame *tdat = static_cast<UnknownFrame *>(tag->frameList("TDAT").front()); if(tdrc->fieldList().size() == 1 && tdrc->fieldList().front().size() == 4 && tdat->data().size() >= 5) { String date(tdat->data().mid(1), String::Type(tdat->data()[0])); if(date.length() == 4) { tdrc->setText(tdrc->toString() + '-' + date.substr(2, 2) + '-' + date.substr(0, 2)); if(tag->frameList("TIME").size() == 1) { UnknownFrame *timeframe = static_cast<UnknownFrame *>(tag->frameList("TIME").front()); if(timeframe->data().size() >= 5) { String time(timeframe->data().mid(1), String::Type(timeframe->data()[0])); if(time.length() == 4) { tdrc->setText(tdrc->toString() + 'T' + time.substr(0, 2) + ':' + time.substr(2, 2)); } } } } } } }
685
1
int av_vsrc_buffer_add_frame2(AVFilterContext *buffer_filter, AVFrame *frame, int64_t pts, AVRational pixel_aspect, int width, int height, enum PixelFormat pix_fmt, const char *sws_param) { BufferSourceContext *c = buffer_filter->priv; int ret; if (c->has_frame) { av_log(buffer_filter, AV_LOG_ERROR, "Buffering several frames is not supported. " "Please consume all available frames before adding a new one.\n" ); //return -1; } if(width != c->w || height != c->h || pix_fmt != c->pix_fmt){ AVFilterContext *scale= buffer_filter->outputs[0]->dst; AVFilterLink *link; av_log(buffer_filter, AV_LOG_INFO, "Changing filter graph input to accept %dx%d %d (%d %d)\n", width,height,pix_fmt, c->pix_fmt, scale->outputs[0]->format); if(!scale || strcmp(scale->filter->name,"scale")){ AVFilter *f= avfilter_get_by_name("scale"); av_log(buffer_filter, AV_LOG_INFO, "Inserting scaler filter\n"); if(avfilter_open(&scale, f, "Input equalizer") < 0) return -1; if((ret=avfilter_init_filter(scale, sws_param, NULL))<0){ avfilter_free(scale); return ret; } if((ret=avfilter_insert_filter(buffer_filter->outputs[0], scale, 0, 0))<0){ avfilter_free(scale); return ret; } scale->outputs[0]->format= c->pix_fmt; } c->pix_fmt= scale->inputs[0]->format= pix_fmt; c->w= scale->inputs[0]->w= width; c->h= scale->inputs[0]->h= height; link= scale->outputs[0]; if ((ret = link->srcpad->config_props(link)) < 0) return ret; } memcpy(c->frame.data , frame->data , sizeof(frame->data)); memcpy(c->frame.linesize, frame->linesize, sizeof(frame->linesize)); c->frame.interlaced_frame= frame->interlaced_frame; c->frame.top_field_first = frame->top_field_first; c->frame.key_frame = frame->key_frame; c->frame.pict_type = frame->pict_type; c->pts = pts; c->pixel_aspect = pixel_aspect; c->has_frame = 1; return 0; }
686
1
chpass_principal3_2_svc(chpass3_arg *arg, struct svc_req *rqstp) { static generic_ret ret; char *prime_arg; gss_buffer_desc client_name, service_name; OM_uint32 minor_stat; kadm5_server_handle_t handle; const char *errmsg = NULL; xdr_free(xdr_generic_ret, &ret); if ((ret.code = new_server_handle(arg->api_version, rqstp, &handle))) goto exit_func; if ((ret.code = check_handle((void *)handle))) goto exit_func; ret.api_version = handle->api_version; if (setup_gss_names(rqstp, &client_name, &service_name) < 0) { ret.code = KADM5_FAILURE; goto exit_func; } if (krb5_unparse_name(handle->context, arg->princ, &prime_arg)) { ret.code = KADM5_BAD_PRINCIPAL; goto exit_func; } if (cmp_gss_krb5_name(handle, rqst2name(rqstp), arg->princ)) { ret.code = chpass_principal_wrapper_3((void *)handle, arg->princ, arg->keepold, arg->n_ks_tuple, arg->ks_tuple, arg->pass); } else if (!(CHANGEPW_SERVICE(rqstp)) && kadm5int_acl_check(handle->context, rqst2name(rqstp), ACL_CHANGEPW, arg->princ, NULL)) { ret.code = kadm5_chpass_principal_3((void *)handle, arg->princ, arg->keepold, arg->n_ks_tuple, arg->ks_tuple, arg->pass); } else { log_unauth("kadm5_chpass_principal", prime_arg, &client_name, &service_name, rqstp); ret.code = KADM5_AUTH_CHANGEPW; } if(ret.code != KADM5_AUTH_CHANGEPW) { if( ret.code != 0 ) errmsg = krb5_get_error_message(handle->context, ret.code); log_done("kadm5_chpass_principal", prime_arg, errmsg, &client_name, &service_name, rqstp); if (errmsg != NULL) krb5_free_error_message(handle->context, errmsg); } free(prime_arg); gss_release_buffer(&minor_stat, &client_name); gss_release_buffer(&minor_stat, &service_name); exit_func: free_server_handle(handle); return &ret; }
688
1
void *jas_malloc(size_t size) { #if defined(MEMALLOC_ALIGN2) void *ptr; abort(); if (posix_memalign(&ptr, MEMALLOC_ALIGNMENT, size)) { return 0; } return ptr; #endif return malloc(size); }
689
0
static void copy_partitioning ( VP9_COMMON * cm , MODE_INFO * mi_8x8 , MODE_INFO * prev_mi_8x8 ) { const int mis = cm -> mi_stride ; int block_row , block_col ; for ( block_row = 0 ; block_row < 8 ; ++ block_row ) { for ( block_col = 0 ; block_col < 8 ; ++ block_col ) { MODE_INFO * const prev_mi = prev_mi_8x8 [ block_row * mis + block_col ] . src_mi ; const BLOCK_SIZE sb_type = prev_mi ? prev_mi -> mbmi . sb_type : 0 ; if ( prev_mi ) { const ptrdiff_t offset = prev_mi - cm -> prev_mi ; mi_8x8 [ block_row * mis + block_col ] . src_mi = cm -> mi + offset ; mi_8x8 [ block_row * mis + block_col ] . src_mi -> mbmi . sb_type = sb_type ; } } } }
690
1
jpc_pi_t *jpc_enc_pi_create(jpc_enc_cp_t *cp, jpc_enc_tile_t *tile) { jpc_pi_t *pi; int compno; jpc_picomp_t *picomp; jpc_pirlvl_t *pirlvl; jpc_enc_tcmpt_t *tcomp; int rlvlno; jpc_enc_rlvl_t *rlvl; int prcno; int *prclyrno; if (!(pi = jpc_pi_create0())) { return 0; } pi->pktno = -1; pi->numcomps = cp->numcmpts; if (!(pi->picomps = jas_malloc(pi->numcomps * sizeof(jpc_picomp_t)))) { jpc_pi_destroy(pi); return 0; } for (compno = 0, picomp = pi->picomps; compno < pi->numcomps; ++compno, ++picomp) { picomp->pirlvls = 0; } for (compno = 0, tcomp = tile->tcmpts, picomp = pi->picomps; compno < pi->numcomps; ++compno, ++tcomp, ++picomp) { picomp->numrlvls = tcomp->numrlvls; if (!(picomp->pirlvls = jas_malloc(picomp->numrlvls * sizeof(jpc_pirlvl_t)))) { jpc_pi_destroy(pi); return 0; } for (rlvlno = 0, pirlvl = picomp->pirlvls; rlvlno < picomp->numrlvls; ++rlvlno, ++pirlvl) { pirlvl->prclyrnos = 0; } for (rlvlno = 0, pirlvl = picomp->pirlvls, rlvl = tcomp->rlvls; rlvlno < picomp->numrlvls; ++rlvlno, ++pirlvl, ++rlvl) { /* XXX sizeof(long) should be sizeof different type */ pirlvl->numprcs = rlvl->numprcs; if (rlvl->numprcs) { if (!(pirlvl->prclyrnos = jas_malloc(pirlvl->numprcs * sizeof(long)))) { jpc_pi_destroy(pi); return 0; } } else { pirlvl->prclyrnos = 0; } } } pi->maxrlvls = 0; for (compno = 0, tcomp = tile->tcmpts, picomp = pi->picomps; compno < pi->numcomps; ++compno, ++tcomp, ++picomp) { picomp->hsamp = cp->ccps[compno].sampgrdstepx; picomp->vsamp = cp->ccps[compno].sampgrdstepy; for (rlvlno = 0, pirlvl = picomp->pirlvls, rlvl = tcomp->rlvls; rlvlno < picomp->numrlvls; ++rlvlno, ++pirlvl, ++rlvl) { pirlvl->prcwidthexpn = rlvl->prcwidthexpn; pirlvl->prcheightexpn = rlvl->prcheightexpn; for (prcno = 0, prclyrno = pirlvl->prclyrnos; prcno < pirlvl->numprcs; ++prcno, ++prclyrno) { *prclyrno = 0; } pirlvl->numhprcs = rlvl->numhprcs; } if (pi->maxrlvls < tcomp->numrlvls) { pi->maxrlvls = tcomp->numrlvls; } } pi->numlyrs = tile->numlyrs; pi->xstart = tile->tlx; pi->ystart = tile->tly; pi->xend = tile->brx; pi->yend = tile->bry; pi->picomp = 0; pi->pirlvl = 0; pi->x = 0; pi->y = 0; pi->compno = 0; pi->rlvlno = 0; pi->prcno = 0; pi->lyrno = 0; pi->xstep = 0; pi->ystep = 0; pi->pchgno = -1; pi->defaultpchg.prgord = tile->prg; pi->defaultpchg.compnostart = 0; pi->defaultpchg.compnoend = pi->numcomps; pi->defaultpchg.rlvlnostart = 0; pi->defaultpchg.rlvlnoend = pi->maxrlvls; pi->defaultpchg.lyrnoend = pi->numlyrs; pi->pchg = 0; pi->valid = 0; return pi; }
691
1
void qmp_getfd(const char *fdname, Error **errp) { mon_fd_t *monfd; int fd; fd = qemu_chr_fe_get_msgfd(cur_mon->chr); if (fd == -1) { error_set(errp, QERR_FD_NOT_SUPPLIED); return; } if (qemu_isdigit(fdname[0])) { error_set(errp, QERR_INVALID_PARAMETER_VALUE, "fdname", "a name not starting with a digit"); return; } QLIST_FOREACH(monfd, &cur_mon->fds, next) { if (strcmp(monfd->name, fdname) != 0) { continue; } close(monfd->fd); monfd->fd = fd; return; } monfd = g_malloc0(sizeof(mon_fd_t)); monfd->name = g_strdup(fdname); monfd->fd = fd; QLIST_INSERT_HEAD(&cur_mon->fds, monfd, next); }
692
0
static int ir2_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) { Ir2Context * const s = avctx -> priv_data ; const uint8_t * buf = avpkt -> data ; int buf_size = avpkt -> size ; AVFrame * picture = data ; AVFrame * const p = & s -> picture ; int start , ret ; if ( ( ret = ff_reget_buffer ( avctx , p ) ) < 0 ) { av_log ( s -> avctx , AV_LOG_ERROR , "reget_buffer() failed\n" ) ; return ret ; } start = 48 ; if ( start >= buf_size ) { av_log ( s -> avctx , AV_LOG_ERROR , "input buffer size too small (%d)\n" , buf_size ) ; return AVERROR_INVALIDDATA ; } s -> decode_delta = buf [ 18 ] ; # ifndef BITSTREAM_READER_LE for ( i = 0 ; i < buf_size ; i ++ ) buf [ i ] = ff_reverse [ buf [ i ] ] ; # endif init_get_bits ( & s -> gb , buf + start , ( buf_size - start ) * 8 ) ; if ( s -> decode_delta ) { if ( ( ret = ir2_decode_plane ( s , avctx -> width , avctx -> height , s -> picture . data [ 0 ] , s -> picture . linesize [ 0 ] , ir2_luma_table ) ) < 0 ) return ret ; if ( ( ret = ir2_decode_plane ( s , avctx -> width >> 2 , avctx -> height >> 2 , s -> picture . data [ 2 ] , s -> picture . linesize [ 2 ] , ir2_luma_table ) ) < 0 ) return ret ; if ( ( ret = ir2_decode_plane ( s , avctx -> width >> 2 , avctx -> height >> 2 , s -> picture . data [ 1 ] , s -> picture . linesize [ 1 ] , ir2_luma_table ) ) < 0 ) return ret ; } else { if ( ( ret = ir2_decode_plane_inter ( s , avctx -> width , avctx -> height , s -> picture . data [ 0 ] , s -> picture . linesize [ 0 ] , ir2_luma_table ) ) < 0 ) return ret ; if ( ( ret = ir2_decode_plane_inter ( s , avctx -> width >> 2 , avctx -> height >> 2 , s -> picture . data [ 2 ] , s -> picture . linesize [ 2 ] , ir2_luma_table ) ) < 0 ) return ret ; if ( ( ret = ir2_decode_plane_inter ( s , avctx -> width >> 2 , avctx -> height >> 2 , s -> picture . data [ 1 ] , s -> picture . linesize [ 1 ] , ir2_luma_table ) ) < 0 ) return ret ; } if ( ( ret = av_frame_ref ( picture , & s -> picture ) ) < 0 ) return ret ; * got_frame = 1 ; return buf_size ; }
693
1
static void qmp_deserialize(void **native_out, void *datap, VisitorFunc visit, Error **errp) { QmpSerializeData *d = datap; QString *output_json = qobject_to_json(qmp_output_get_qobject(d->qov)); QObject *obj = qobject_from_json(qstring_get_str(output_json)); QDECREF(output_json); d->qiv = qmp_input_visitor_new(obj); qobject_decref(obj); visit(qmp_input_get_visitor(d->qiv), native_out, errp); }
696
0
gs_ref_memory_t * ialloc_alloc_state ( gs_memory_t * parent , uint clump_size ) { clump_t * cp ; gs_ref_memory_t * iimem = ialloc_solo ( parent , & st_ref_memory , & cp ) ; if ( iimem == 0 ) return 0 ; iimem -> stable_memory = ( gs_memory_t * ) iimem ; iimem -> procs = gs_ref_memory_procs ; iimem -> gs_lib_ctx = parent -> gs_lib_ctx ; iimem -> non_gc_memory = parent ; iimem -> thread_safe_memory = parent -> thread_safe_memory ; iimem -> clump_size = clump_size ; # ifdef MEMENTO iimem -> large_size = 1 ; # else iimem -> large_size = ( ( clump_size / 4 ) & - obj_align_mod ) + 1 ; # endif iimem -> is_controlled = false ; iimem -> gc_status . vm_threshold = clump_size * 3L ; iimem -> gc_status . max_vm = max_long ; iimem -> gc_status . signal_value = 0 ; iimem -> gc_status . enabled = false ; iimem -> gc_status . requested = 0 ; iimem -> gc_allocated = 0 ; iimem -> previous_status . allocated = 0 ; iimem -> previous_status . used = 0 ; ialloc_reset ( iimem ) ; iimem -> root = cp ; ialloc_set_limit ( iimem ) ; iimem -> cc = NULL ; iimem -> save_level = 0 ; iimem -> new_mask = 0 ; iimem -> test_mask = ~ 0 ; iimem -> streams = 0 ; iimem -> names_array = 0 ; iimem -> roots = 0 ; iimem -> num_contexts = 0 ; iimem -> saved = 0 ; return iimem ; }
697
1
void jpc_qmfb_join_colres(jpc_fix_t *a, int numrows, int numcols, int stride, int parity) { int bufsize = JPC_CEILDIVPOW2(numrows, 1); jpc_fix_t joinbuf[QMFB_JOINBUFSIZE * JPC_QMFB_COLGRPSIZE]; jpc_fix_t *buf = joinbuf; jpc_fix_t *srcptr; jpc_fix_t *dstptr; register jpc_fix_t *srcptr2; register jpc_fix_t *dstptr2; register int n; register int i; int hstartcol; /* Allocate memory for the join buffer from the heap. */ if (bufsize > QMFB_JOINBUFSIZE) { if (!(buf = jas_malloc(bufsize * numcols * sizeof(jpc_fix_t)))) { /* We have no choice but to commit suicide. */ abort(); } } hstartcol = (numrows + 1 - parity) >> 1; /* Save the samples from the lowpass channel. */ n = hstartcol; srcptr = &a[0]; dstptr = buf; while (n-- > 0) { dstptr2 = dstptr; srcptr2 = srcptr; for (i = 0; i < numcols; ++i) { *dstptr2 = *srcptr2; ++dstptr2; ++srcptr2; } srcptr += stride; dstptr += numcols; } /* Copy the samples from the highpass channel into place. */ srcptr = &a[hstartcol * stride]; dstptr = &a[(1 - parity) * stride]; n = numrows - hstartcol; while (n-- > 0) { dstptr2 = dstptr; srcptr2 = srcptr; for (i = 0; i < numcols; ++i) { *dstptr2 = *srcptr2; ++dstptr2; ++srcptr2; } dstptr += 2 * stride; srcptr += stride; } /* Copy the samples from the lowpass channel into place. */ srcptr = buf; dstptr = &a[parity * stride]; n = hstartcol; while (n-- > 0) { dstptr2 = dstptr; srcptr2 = srcptr; for (i = 0; i < numcols; ++i) { *dstptr2 = *srcptr2; ++dstptr2; ++srcptr2; } dstptr += 2 * stride; srcptr += numcols; } /* If the join buffer was allocated on the heap, free this memory. */ if (buf != joinbuf) { jas_free(buf); } }
698
1
static bool coroutine_fn yield_and_check(BackupBlockJob *job) { if (block_job_is_cancelled(&job->common)) { return true; } /* we need to yield so that bdrv_drain_all() returns. * (without, VM does not reboot) */ if (job->common.speed) { uint64_t delay_ns = ratelimit_calculate_delay(&job->limit, job->sectors_read); job->sectors_read = 0; block_job_sleep_ns(&job->common, QEMU_CLOCK_REALTIME, delay_ns); } else { block_job_sleep_ns(&job->common, QEMU_CLOCK_REALTIME, 0); } if (block_job_is_cancelled(&job->common)) { return true; } return false; }
699
0
ParseResult validate_hdr_host ( HTTPHdrImpl * hh ) { ParseResult ret = PARSE_RESULT_DONE ; MIMEField * host_field = mime_hdr_field_find ( hh -> m_fields_impl , MIME_FIELD_HOST , MIME_LEN_HOST ) ; if ( host_field ) { if ( host_field -> has_dups ( ) ) { ret = PARSE_RESULT_ERROR ; } else { int host_len = 0 ; const char * host_val = host_field -> value_get ( & host_len ) ; ts : : ConstBuffer addr , port , rest , host ( host_val , host_len ) ; if ( 0 == ats_ip_parse ( host , & addr , & port , & rest ) ) { if ( port ) { if ( port . size ( ) > 5 ) { return PARSE_RESULT_ERROR ; } int port_i = ink_atoi ( port . data ( ) , port . size ( ) ) ; if ( port_i >= 65536 || port_i <= 0 ) { return PARSE_RESULT_ERROR ; } } if ( ! validate_host_name ( addr ) ) { return PARSE_RESULT_ERROR ; } while ( rest && PARSE_RESULT_DONE == ret ) { if ( ! ParseRules : : is_ws ( * rest ) ) { return PARSE_RESULT_ERROR ; } ++ rest ; } } else { ret = PARSE_RESULT_ERROR ; } } } return ret ; }
700
1
static int virtio_scsi_do_tmf(VirtIOSCSI *s, VirtIOSCSIReq *req) { SCSIDevice *d = virtio_scsi_device_find(s, req->req.tmf.lun); SCSIRequest *r, *next; BusChild *kid; int target; int ret = 0; if (s->dataplane_started) { assert(blk_get_aio_context(d->conf.blk) == s->ctx); } /* Here VIRTIO_SCSI_S_OK means "FUNCTION COMPLETE". */ req->resp.tmf.response = VIRTIO_SCSI_S_OK; virtio_tswap32s(VIRTIO_DEVICE(s), &req->req.tmf.subtype); switch (req->req.tmf.subtype) { case VIRTIO_SCSI_T_TMF_ABORT_TASK: case VIRTIO_SCSI_T_TMF_QUERY_TASK: if (!d) { goto fail; } if (d->lun != virtio_scsi_get_lun(req->req.tmf.lun)) { goto incorrect_lun; } QTAILQ_FOREACH_SAFE(r, &d->requests, next, next) { VirtIOSCSIReq *cmd_req = r->hba_private; if (cmd_req && cmd_req->req.cmd.tag == req->req.tmf.tag) { break; } } if (r) { /* * Assert that the request has not been completed yet, we * check for it in the loop above. */ assert(r->hba_private); if (req->req.tmf.subtype == VIRTIO_SCSI_T_TMF_QUERY_TASK) { /* "If the specified command is present in the task set, then * return a service response set to FUNCTION SUCCEEDED". */ req->resp.tmf.response = VIRTIO_SCSI_S_FUNCTION_SUCCEEDED; } else { VirtIOSCSICancelNotifier *notifier; req->remaining = 1; notifier = g_new(VirtIOSCSICancelNotifier, 1); notifier->tmf_req = req; notifier->notifier.notify = virtio_scsi_cancel_notify; scsi_req_cancel_async(r, &notifier->notifier); ret = -EINPROGRESS; } } break; case VIRTIO_SCSI_T_TMF_LOGICAL_UNIT_RESET: if (!d) { goto fail; } if (d->lun != virtio_scsi_get_lun(req->req.tmf.lun)) { goto incorrect_lun; } s->resetting++; qdev_reset_all(&d->qdev); s->resetting--; break; case VIRTIO_SCSI_T_TMF_ABORT_TASK_SET: case VIRTIO_SCSI_T_TMF_CLEAR_TASK_SET: case VIRTIO_SCSI_T_TMF_QUERY_TASK_SET: if (!d) { goto fail; } if (d->lun != virtio_scsi_get_lun(req->req.tmf.lun)) { goto incorrect_lun; } /* Add 1 to "remaining" until virtio_scsi_do_tmf returns. * This way, if the bus starts calling back to the notifiers * even before we finish the loop, virtio_scsi_cancel_notify * will not complete the TMF too early. */ req->remaining = 1; QTAILQ_FOREACH_SAFE(r, &d->requests, next, next) { if (r->hba_private) { if (req->req.tmf.subtype == VIRTIO_SCSI_T_TMF_QUERY_TASK_SET) { /* "If there is any command present in the task set, then * return a service response set to FUNCTION SUCCEEDED". */ req->resp.tmf.response = VIRTIO_SCSI_S_FUNCTION_SUCCEEDED; break; } else { VirtIOSCSICancelNotifier *notifier; req->remaining++; notifier = g_new(VirtIOSCSICancelNotifier, 1); notifier->notifier.notify = virtio_scsi_cancel_notify; notifier->tmf_req = req; scsi_req_cancel_async(r, &notifier->notifier); } } } if (--req->remaining > 0) { ret = -EINPROGRESS; } break; case VIRTIO_SCSI_T_TMF_I_T_NEXUS_RESET: target = req->req.tmf.lun[1]; s->resetting++; QTAILQ_FOREACH(kid, &s->bus.qbus.children, sibling) { d = DO_UPCAST(SCSIDevice, qdev, kid->child); if (d->channel == 0 && d->id == target) { qdev_reset_all(&d->qdev); } } s->resetting--; break; case VIRTIO_SCSI_T_TMF_CLEAR_ACA: default: req->resp.tmf.response = VIRTIO_SCSI_S_FUNCTION_REJECTED; break; } return ret; incorrect_lun: req->resp.tmf.response = VIRTIO_SCSI_S_INCORRECT_LUN; return ret; fail: req->resp.tmf.response = VIRTIO_SCSI_S_BAD_TARGET; return ret; }
701
1
chrand_principal3_2_svc(chrand3_arg *arg, struct svc_req *rqstp) { static chrand_ret ret; krb5_keyblock *k; int nkeys; char *prime_arg, *funcname; gss_buffer_desc client_name, service_name; OM_uint32 minor_stat; kadm5_server_handle_t handle; const char *errmsg = NULL; xdr_free(xdr_chrand_ret, &ret); if ((ret.code = new_server_handle(arg->api_version, rqstp, &handle))) goto exit_func; if ((ret.code = check_handle((void *)handle))) goto exit_func; ret.api_version = handle->api_version; funcname = "kadm5_randkey_principal"; if (setup_gss_names(rqstp, &client_name, &service_name) < 0) { ret.code = KADM5_FAILURE; goto exit_func; } if (krb5_unparse_name(handle->context, arg->princ, &prime_arg)) { ret.code = KADM5_BAD_PRINCIPAL; goto exit_func; } if (cmp_gss_krb5_name(handle, rqst2name(rqstp), arg->princ)) { ret.code = randkey_principal_wrapper_3((void *)handle, arg->princ, arg->keepold, arg->n_ks_tuple, arg->ks_tuple, &k, &nkeys); } else if (!(CHANGEPW_SERVICE(rqstp)) && kadm5int_acl_check(handle->context, rqst2name(rqstp), ACL_CHANGEPW, arg->princ, NULL)) { ret.code = kadm5_randkey_principal_3((void *)handle, arg->princ, arg->keepold, arg->n_ks_tuple, arg->ks_tuple, &k, &nkeys); } else { log_unauth(funcname, prime_arg, &client_name, &service_name, rqstp); ret.code = KADM5_AUTH_CHANGEPW; } if(ret.code == KADM5_OK) { ret.keys = k; ret.n_keys = nkeys; } if(ret.code != KADM5_AUTH_CHANGEPW) { if( ret.code != 0 ) errmsg = krb5_get_error_message(handle->context, ret.code); log_done(funcname, prime_arg, errmsg, &client_name, &service_name, rqstp); if (errmsg != NULL) krb5_free_error_message(handle->context, errmsg); } free(prime_arg); gss_release_buffer(&minor_stat, &client_name); gss_release_buffer(&minor_stat, &service_name); exit_func: free_server_handle(handle); return &ret; }
702
1
void xps_parse_path ( xps_document * doc , const fz_matrix * ctm , char * base_uri , xps_resource * dict , fz_xml * root ) { fz_xml * node ; char * fill_uri ; char * stroke_uri ; char * opacity_mask_uri ; char * transform_att ; char * clip_att ; char * data_att ; char * fill_att ; char * stroke_att ; char * opacity_att ; char * opacity_mask_att ; fz_xml * transform_tag = NULL ; fz_xml * clip_tag = NULL ; fz_xml * data_tag = NULL ; fz_xml * fill_tag = NULL ; fz_xml * stroke_tag = NULL ; fz_xml * opacity_mask_tag = NULL ; char * fill_opacity_att = NULL ; char * stroke_opacity_att = NULL ; char * stroke_dash_array_att ; char * stroke_dash_cap_att ; char * stroke_dash_offset_att ; char * stroke_end_line_cap_att ; char * stroke_start_line_cap_att ; char * stroke_line_join_att ; char * stroke_miter_limit_att ; char * stroke_thickness_att ; char * navigate_uri_att ; fz_stroke_state * stroke = NULL ; fz_matrix transform ; float samples [ 32 ] ; fz_colorspace * colorspace ; fz_path * path = NULL ; fz_path * stroke_path = NULL ; fz_rect area ; int fill_rule ; int dash_len = 0 ; fz_matrix local_ctm ; transform_att = fz_xml_att ( root , "RenderTransform" ) ; clip_att = fz_xml_att ( root , "Clip" ) ; data_att = fz_xml_att ( root , "Data" ) ; fill_att = fz_xml_att ( root , "Fill" ) ; stroke_att = fz_xml_att ( root , "Stroke" ) ; opacity_att = fz_xml_att ( root , "Opacity" ) ; opacity_mask_att = fz_xml_att ( root , "OpacityMask" ) ; stroke_dash_array_att = fz_xml_att ( root , "StrokeDashArray" ) ; stroke_dash_cap_att = fz_xml_att ( root , "StrokeDashCap" ) ; stroke_dash_offset_att = fz_xml_att ( root , "StrokeDashOffset" ) ; stroke_end_line_cap_att = fz_xml_att ( root , "StrokeEndLineCap" ) ; stroke_start_line_cap_att = fz_xml_att ( root , "StrokeStartLineCap" ) ; stroke_line_join_att = fz_xml_att ( root , "StrokeLineJoin" ) ; stroke_miter_limit_att = fz_xml_att ( root , "StrokeMiterLimit" ) ; stroke_thickness_att = fz_xml_att ( root , "StrokeThickness" ) ; navigate_uri_att = fz_xml_att ( root , "FixedPage.NavigateUri" ) ; for ( node = fz_xml_down ( root ) ; node ; node = fz_xml_next ( node ) ) { if ( ! strcmp ( fz_xml_tag ( node ) , "Path.RenderTransform" ) ) transform_tag = fz_xml_down ( node ) ; if ( ! strcmp ( fz_xml_tag ( node ) , "Path.OpacityMask" ) ) opacity_mask_tag = fz_xml_down ( node ) ; if ( ! strcmp ( fz_xml_tag ( node ) , "Path.Clip" ) ) clip_tag = fz_xml_down ( node ) ; if ( ! strcmp ( fz_xml_tag ( node ) , "Path.Fill" ) ) fill_tag = fz_xml_down ( node ) ; if ( ! strcmp ( fz_xml_tag ( node ) , "Path.Stroke" ) ) stroke_tag = fz_xml_down ( node ) ; if ( ! strcmp ( fz_xml_tag ( node ) , "Path.Data" ) ) data_tag = fz_xml_down ( node ) ; } fill_uri = base_uri ; stroke_uri = base_uri ; opacity_mask_uri = base_uri ; xps_resolve_resource_reference ( doc , dict , & data_att , & data_tag , NULL ) ; xps_resolve_resource_reference ( doc , dict , & clip_att , & clip_tag , NULL ) ; xps_resolve_resource_reference ( doc , dict , & transform_att , & transform_tag , NULL ) ; xps_resolve_resource_reference ( doc , dict , & fill_att , & fill_tag , & fill_uri ) ; xps_resolve_resource_reference ( doc , dict , & stroke_att , & stroke_tag , & stroke_uri ) ; xps_resolve_resource_reference ( doc , dict , & opacity_mask_att , & opacity_mask_tag , & opacity_mask_uri ) ; if ( ! data_att && ! data_tag ) return ; if ( fill_tag && ! strcmp ( fz_xml_tag ( fill_tag ) , "SolidColorBrush" ) ) { fill_opacity_att = fz_xml_att ( fill_tag , "Opacity" ) ; fill_att = fz_xml_att ( fill_tag , "Color" ) ; fill_tag = NULL ; } if ( stroke_tag && ! strcmp ( fz_xml_tag ( stroke_tag ) , "SolidColorBrush" ) ) { stroke_opacity_att = fz_xml_att ( stroke_tag , "Opacity" ) ; stroke_att = fz_xml_att ( stroke_tag , "Color" ) ; stroke_tag = NULL ; } if ( stroke_att || stroke_tag ) { if ( stroke_dash_array_att ) { char * s = stroke_dash_array_att ; while ( * s ) { while ( * s == ' ' ) s ++ ; if ( * s ) dash_len ++ ; while ( * s && * s != ' ' ) s ++ ; } } stroke = fz_new_stroke_state_with_dash_len ( doc -> ctx , dash_len ) ; stroke -> start_cap = xps_parse_line_cap ( stroke_start_line_cap_att ) ; stroke -> dash_cap = xps_parse_line_cap ( stroke_dash_cap_att ) ; stroke -> end_cap = xps_parse_line_cap ( stroke_end_line_cap_att ) ; stroke -> linejoin = FZ_LINEJOIN_MITER_XPS ; if ( stroke_line_join_att ) { if ( ! strcmp ( stroke_line_join_att , "Miter" ) ) stroke -> linejoin = FZ_LINEJOIN_MITER_XPS ; if ( ! strcmp ( stroke_line_join_att , "Round" ) ) stroke -> linejoin = FZ_LINEJOIN_ROUND ; if ( ! strcmp ( stroke_line_join_att , "Bevel" ) ) stroke -> linejoin = FZ_LINEJOIN_BEVEL ; } stroke -> miterlimit = 10 ; if ( stroke_miter_limit_att ) stroke -> miterlimit = fz_atof ( stroke_miter_limit_att ) ; stroke -> linewidth = 1 ; if ( stroke_thickness_att ) stroke -> linewidth = fz_atof ( stroke_thickness_att ) ; stroke -> dash_phase = 0 ; stroke -> dash_len = 0 ; if ( stroke_dash_array_att ) { char * s = stroke_dash_array_att ; if ( stroke_dash_offset_att ) stroke -> dash_phase = fz_atof ( stroke_dash_offset_att ) * stroke -> linewidth ; while ( * s ) { while ( * s == ' ' ) s ++ ; if ( * s ) stroke -> dash_list [ stroke -> dash_len ++ ] = fz_atof ( s ) * stroke -> linewidth ; while ( * s && * s != ' ' ) s ++ ; } stroke -> dash_len = dash_len ; } } transform = fz_identity ; if ( transform_att ) xps_parse_render_transform ( doc , transform_att , & transform ) ; if ( transform_tag ) xps_parse_matrix_transform ( doc , transform_tag , & transform ) ; fz_concat ( & local_ctm , & transform , ctm ) ; if ( clip_att || clip_tag ) xps_clip ( doc , & local_ctm , dict , clip_att , clip_tag ) ; fill_rule = 0 ; if ( data_att ) path = xps_parse_abbreviated_geometry ( doc , data_att , & fill_rule ) ; else if ( data_tag ) { path = xps_parse_path_geometry ( doc , dict , data_tag , 0 , & fill_rule ) ; if ( stroke_att || stroke_tag ) stroke_path = xps_parse_path_geometry ( doc , dict , data_tag , 1 , & fill_rule ) ; } if ( ! stroke_path ) stroke_path = path ; if ( stroke_att || stroke_tag ) { fz_bound_path ( doc -> ctx , stroke_path , stroke , & local_ctm , & area ) ; if ( stroke_path != path && ( fill_att || fill_tag ) ) { fz_rect bounds ; fz_bound_path ( doc -> ctx , path , NULL , & local_ctm , & bounds ) ; fz_union_rect ( & area , & bounds ) ; } } else fz_bound_path ( doc -> ctx , path , NULL , & local_ctm , & area ) ; if ( navigate_uri_att ) xps_add_link ( doc , & area , base_uri , navigate_uri_att ) ; xps_begin_opacity ( doc , & local_ctm , & area , opacity_mask_uri , dict , opacity_att , opacity_mask_tag ) ; if ( fill_att ) { xps_parse_color ( doc , base_uri , fill_att , & colorspace , samples ) ; if ( fill_opacity_att ) samples [ 0 ] *= fz_atof ( fill_opacity_att ) ; xps_set_color ( doc , colorspace , samples ) ; fz_fill_path ( doc -> dev , path , fill_rule == 0 , & local_ctm , doc -> colorspace , doc -> color , doc -> alpha ) ; } if ( fill_tag ) { fz_clip_path ( doc -> dev , path , & area , fill_rule == 0 , & local_ctm ) ; xps_parse_brush ( doc , & local_ctm , & area , fill_uri , dict , fill_tag ) ; fz_pop_clip ( doc -> dev ) ; } if ( stroke_att ) { xps_parse_color ( doc , base_uri , stroke_att , & colorspace , samples ) ; if ( stroke_opacity_att ) samples [ 0 ] *= fz_atof ( stroke_opacity_att ) ; xps_set_color ( doc , colorspace , samples ) ; fz_stroke_path ( doc -> dev , stroke_path , stroke , & local_ctm , doc -> colorspace , doc -> color , doc -> alpha ) ; } if ( stroke_tag ) { fz_clip_stroke_path ( doc -> dev , stroke_path , & area , stroke , & local_ctm ) ; xps_parse_brush ( doc , & local_ctm , & area , stroke_uri , dict , stroke_tag ) ; fz_pop_clip ( doc -> dev ) ; } xps_end_opacity ( doc , opacity_mask_uri , dict , opacity_att , opacity_mask_tag ) ; if ( stroke_path != path ) fz_free_path ( doc -> ctx , stroke_path ) ; fz_free_path ( doc -> ctx , path ) ; path = NULL ; fz_drop_stroke_state ( doc -> ctx , stroke ) ; if ( clip_att || clip_tag ) fz_pop_clip ( doc -> dev ) ; }
703
1
static int mif_hdr_growcmpts(mif_hdr_t *hdr, int maxcmpts) { int cmptno; mif_cmpt_t **newcmpts; assert(maxcmpts >= hdr->numcmpts); newcmpts = (!hdr->cmpts) ? jas_malloc(maxcmpts * sizeof(mif_cmpt_t *)) : jas_realloc(hdr->cmpts, maxcmpts * sizeof(mif_cmpt_t *)); if (!newcmpts) { return -1; } hdr->maxcmpts = maxcmpts; hdr->cmpts = newcmpts; for (cmptno = hdr->numcmpts; cmptno < hdr->maxcmpts; ++cmptno) { hdr->cmpts[cmptno] = 0; } return 0; }
704
1
static int jpc_dec_tileinit(jpc_dec_t *dec, jpc_dec_tile_t *tile) { jpc_dec_tcomp_t *tcomp; int compno; int rlvlno; jpc_dec_rlvl_t *rlvl; jpc_dec_band_t *band; jpc_dec_prc_t *prc; int bndno; jpc_tsfb_band_t *bnd; int bandno; jpc_dec_ccp_t *ccp; int prccnt; jpc_dec_cblk_t *cblk; int cblkcnt; uint_fast32_t tlprcxstart; uint_fast32_t tlprcystart; uint_fast32_t brprcxend; uint_fast32_t brprcyend; uint_fast32_t tlcbgxstart; uint_fast32_t tlcbgystart; uint_fast32_t brcbgxend; uint_fast32_t brcbgyend; uint_fast32_t cbgxstart; uint_fast32_t cbgystart; uint_fast32_t cbgxend; uint_fast32_t cbgyend; uint_fast32_t tlcblkxstart; uint_fast32_t tlcblkystart; uint_fast32_t brcblkxend; uint_fast32_t brcblkyend; uint_fast32_t cblkxstart; uint_fast32_t cblkystart; uint_fast32_t cblkxend; uint_fast32_t cblkyend; uint_fast32_t tmpxstart; uint_fast32_t tmpystart; uint_fast32_t tmpxend; uint_fast32_t tmpyend; jpc_dec_cp_t *cp; jpc_tsfb_band_t bnds[64]; jpc_pchg_t *pchg; int pchgno; jpc_dec_cmpt_t *cmpt; cp = tile->cp; tile->realmode = 0; if (cp->mctid == JPC_MCT_ICT) { tile->realmode = 1; } for (compno = 0, tcomp = tile->tcomps, cmpt = dec->cmpts; compno < dec->numcomps; ++compno, ++tcomp, ++cmpt) { ccp = &tile->cp->ccps[compno]; if (ccp->qmfbid == JPC_COX_INS) { tile->realmode = 1; } tcomp->numrlvls = ccp->numrlvls; if (!(tcomp->rlvls = jas_malloc(tcomp->numrlvls * sizeof(jpc_dec_rlvl_t)))) { return -1; } if (!(tcomp->data = jas_seq2d_create(JPC_CEILDIV(tile->xstart, cmpt->hstep), JPC_CEILDIV(tile->ystart, cmpt->vstep), JPC_CEILDIV(tile->xend, cmpt->hstep), JPC_CEILDIV(tile->yend, cmpt->vstep)))) { return -1; } if (!(tcomp->tsfb = jpc_cod_gettsfb(ccp->qmfbid, tcomp->numrlvls - 1))) { return -1; } { jpc_tsfb_getbands(tcomp->tsfb, jas_seq2d_xstart(tcomp->data), jas_seq2d_ystart(tcomp->data), jas_seq2d_xend(tcomp->data), jas_seq2d_yend(tcomp->data), bnds); } for (rlvlno = 0, rlvl = tcomp->rlvls; rlvlno < tcomp->numrlvls; ++rlvlno, ++rlvl) { rlvl->bands = 0; rlvl->xstart = JPC_CEILDIVPOW2(tcomp->xstart, tcomp->numrlvls - 1 - rlvlno); rlvl->ystart = JPC_CEILDIVPOW2(tcomp->ystart, tcomp->numrlvls - 1 - rlvlno); rlvl->xend = JPC_CEILDIVPOW2(tcomp->xend, tcomp->numrlvls - 1 - rlvlno); rlvl->yend = JPC_CEILDIVPOW2(tcomp->yend, tcomp->numrlvls - 1 - rlvlno); rlvl->prcwidthexpn = ccp->prcwidthexpns[rlvlno]; rlvl->prcheightexpn = ccp->prcheightexpns[rlvlno]; tlprcxstart = JPC_FLOORDIVPOW2(rlvl->xstart, rlvl->prcwidthexpn) << rlvl->prcwidthexpn; tlprcystart = JPC_FLOORDIVPOW2(rlvl->ystart, rlvl->prcheightexpn) << rlvl->prcheightexpn; brprcxend = JPC_CEILDIVPOW2(rlvl->xend, rlvl->prcwidthexpn) << rlvl->prcwidthexpn; brprcyend = JPC_CEILDIVPOW2(rlvl->yend, rlvl->prcheightexpn) << rlvl->prcheightexpn; rlvl->numhprcs = (brprcxend - tlprcxstart) >> rlvl->prcwidthexpn; rlvl->numvprcs = (brprcyend - tlprcystart) >> rlvl->prcheightexpn; rlvl->numprcs = rlvl->numhprcs * rlvl->numvprcs; if (rlvl->xstart >= rlvl->xend || rlvl->ystart >= rlvl->yend) { rlvl->bands = 0; rlvl->numprcs = 0; rlvl->numhprcs = 0; rlvl->numvprcs = 0; continue; } if (!rlvlno) { tlcbgxstart = tlprcxstart; tlcbgystart = tlprcystart; brcbgxend = brprcxend; brcbgyend = brprcyend; rlvl->cbgwidthexpn = rlvl->prcwidthexpn; rlvl->cbgheightexpn = rlvl->prcheightexpn; } else { tlcbgxstart = JPC_CEILDIVPOW2(tlprcxstart, 1); tlcbgystart = JPC_CEILDIVPOW2(tlprcystart, 1); brcbgxend = JPC_CEILDIVPOW2(brprcxend, 1); brcbgyend = JPC_CEILDIVPOW2(brprcyend, 1); rlvl->cbgwidthexpn = rlvl->prcwidthexpn - 1; rlvl->cbgheightexpn = rlvl->prcheightexpn - 1; } rlvl->cblkwidthexpn = JAS_MIN(ccp->cblkwidthexpn, rlvl->cbgwidthexpn); rlvl->cblkheightexpn = JAS_MIN(ccp->cblkheightexpn, rlvl->cbgheightexpn); rlvl->numbands = (!rlvlno) ? 1 : 3; if (!(rlvl->bands = jas_malloc(rlvl->numbands * sizeof(jpc_dec_band_t)))) { return -1; } for (bandno = 0, band = rlvl->bands; bandno < rlvl->numbands; ++bandno, ++band) { bndno = (!rlvlno) ? 0 : (3 * (rlvlno - 1) + bandno + 1); bnd = &bnds[bndno]; band->orient = bnd->orient; band->stepsize = ccp->stepsizes[bndno]; band->analgain = JPC_NOMINALGAIN(ccp->qmfbid, tcomp->numrlvls - 1, rlvlno, band->orient); band->absstepsize = jpc_calcabsstepsize(band->stepsize, cmpt->prec + band->analgain); band->numbps = ccp->numguardbits + JPC_QCX_GETEXPN(band->stepsize) - 1; band->roishift = (ccp->roishift + band->numbps >= JPC_PREC) ? (JPC_PREC - 1 - band->numbps) : ccp->roishift; band->data = 0; band->prcs = 0; if (bnd->xstart == bnd->xend || bnd->ystart == bnd->yend) { continue; } if (!(band->data = jas_seq2d_create(0, 0, 0, 0))) { return -1; } jas_seq2d_bindsub(band->data, tcomp->data, bnd->locxstart, bnd->locystart, bnd->locxend, bnd->locyend); jas_seq2d_setshift(band->data, bnd->xstart, bnd->ystart); assert(rlvl->numprcs); if (!(band->prcs = jas_malloc(rlvl->numprcs * sizeof(jpc_dec_prc_t)))) { return -1; } /************************************************/ cbgxstart = tlcbgxstart; cbgystart = tlcbgystart; for (prccnt = rlvl->numprcs, prc = band->prcs; prccnt > 0; --prccnt, ++prc) { cbgxend = cbgxstart + (1 << rlvl->cbgwidthexpn); cbgyend = cbgystart + (1 << rlvl->cbgheightexpn); prc->xstart = JAS_MAX(cbgxstart, JAS_CAST(uint_fast32_t, jas_seq2d_xstart(band->data))); prc->ystart = JAS_MAX(cbgystart, JAS_CAST(uint_fast32_t, jas_seq2d_ystart(band->data))); prc->xend = JAS_MIN(cbgxend, JAS_CAST(uint_fast32_t, jas_seq2d_xend(band->data))); prc->yend = JAS_MIN(cbgyend, JAS_CAST(uint_fast32_t, jas_seq2d_yend(band->data))); if (prc->xend > prc->xstart && prc->yend > prc->ystart) { tlcblkxstart = JPC_FLOORDIVPOW2(prc->xstart, rlvl->cblkwidthexpn) << rlvl->cblkwidthexpn; tlcblkystart = JPC_FLOORDIVPOW2(prc->ystart, rlvl->cblkheightexpn) << rlvl->cblkheightexpn; brcblkxend = JPC_CEILDIVPOW2(prc->xend, rlvl->cblkwidthexpn) << rlvl->cblkwidthexpn; brcblkyend = JPC_CEILDIVPOW2(prc->yend, rlvl->cblkheightexpn) << rlvl->cblkheightexpn; prc->numhcblks = (brcblkxend - tlcblkxstart) >> rlvl->cblkwidthexpn; prc->numvcblks = (brcblkyend - tlcblkystart) >> rlvl->cblkheightexpn; prc->numcblks = prc->numhcblks * prc->numvcblks; assert(prc->numcblks > 0); if (!(prc->incltagtree = jpc_tagtree_create(prc->numhcblks, prc->numvcblks))) { return -1; } if (!(prc->numimsbstagtree = jpc_tagtree_create(prc->numhcblks, prc->numvcblks))) { return -1; } if (!(prc->cblks = jas_malloc(prc->numcblks * sizeof(jpc_dec_cblk_t)))) { return -1; } cblkxstart = cbgxstart; cblkystart = cbgystart; for (cblkcnt = prc->numcblks, cblk = prc->cblks; cblkcnt > 0;) { cblkxend = cblkxstart + (1 << rlvl->cblkwidthexpn); cblkyend = cblkystart + (1 << rlvl->cblkheightexpn); tmpxstart = JAS_MAX(cblkxstart, prc->xstart); tmpystart = JAS_MAX(cblkystart, prc->ystart); tmpxend = JAS_MIN(cblkxend, prc->xend); tmpyend = JAS_MIN(cblkyend, prc->yend); if (tmpxend > tmpxstart && tmpyend > tmpystart) { cblk->firstpassno = -1; cblk->mqdec = 0; cblk->nulldec = 0; cblk->flags = 0; cblk->numpasses = 0; cblk->segs.head = 0; cblk->segs.tail = 0; cblk->curseg = 0; cblk->numimsbs = 0; cblk->numlenbits = 3; cblk->flags = 0; if (!(cblk->data = jas_seq2d_create(0, 0, 0, 0))) { return -1; } jas_seq2d_bindsub(cblk->data, band->data, tmpxstart, tmpystart, tmpxend, tmpyend); ++cblk; --cblkcnt; } cblkxstart += 1 << rlvl->cblkwidthexpn; if (cblkxstart >= cbgxend) { cblkxstart = cbgxstart; cblkystart += 1 << rlvl->cblkheightexpn; } } } else { prc->cblks = 0; prc->incltagtree = 0; prc->numimsbstagtree = 0; } cbgxstart += 1 << rlvl->cbgwidthexpn; if (cbgxstart >= brcbgxend) { cbgxstart = tlcbgxstart; cbgystart += 1 << rlvl->cbgheightexpn; } } /********************************************/ } } } if (!(tile->pi = jpc_dec_pi_create(dec, tile))) { return -1; } for (pchgno = 0; pchgno < jpc_pchglist_numpchgs(tile->cp->pchglist); ++pchgno) { pchg = jpc_pchg_copy(jpc_pchglist_get(tile->cp->pchglist, pchgno)); assert(pchg); jpc_pi_addpchg(tile->pi, pchg); } jpc_pi_init(tile->pi); return 0; }
708
0
static Asn1Generic * DecodeAsn1DerNull ( const unsigned char * buffer , uint32_t size , uint8_t depth , uint32_t * errcode ) { const unsigned char * d_ptr = buffer ; uint8_t numbytes ; uint32_t value ; Asn1Generic * a ; numbytes = d_ptr [ 1 ] ; d_ptr += 2 ; if ( DecodeAsn1BuildValue ( & d_ptr , & value , numbytes , errcode ) == - 1 ) { return NULL ; } a = Asn1GenericNew ( ) ; if ( a == NULL ) return NULL ; a -> type = ASN1_NULL ; a -> length = ( d_ptr - buffer ) ; a -> value = 0 ; return a ; }
709
1
chrand_principal_2_svc(chrand_arg *arg, struct svc_req *rqstp) { static chrand_ret ret; krb5_keyblock *k; int nkeys; char *prime_arg, *funcname; gss_buffer_desc client_name, service_name; OM_uint32 minor_stat; kadm5_server_handle_t handle; const char *errmsg = NULL; xdr_free(xdr_chrand_ret, &ret); if ((ret.code = new_server_handle(arg->api_version, rqstp, &handle))) goto exit_func; if ((ret.code = check_handle((void *)handle))) goto exit_func; ret.api_version = handle->api_version; funcname = "kadm5_randkey_principal"; if (setup_gss_names(rqstp, &client_name, &service_name) < 0) { ret.code = KADM5_FAILURE; goto exit_func; } if (krb5_unparse_name(handle->context, arg->princ, &prime_arg)) { ret.code = KADM5_BAD_PRINCIPAL; goto exit_func; } if (cmp_gss_krb5_name(handle, rqst2name(rqstp), arg->princ)) { ret.code = randkey_principal_wrapper_3((void *)handle, arg->princ, FALSE, 0, NULL, &k, &nkeys); } else if (!(CHANGEPW_SERVICE(rqstp)) && kadm5int_acl_check(handle->context, rqst2name(rqstp), ACL_CHANGEPW, arg->princ, NULL)) { ret.code = kadm5_randkey_principal((void *)handle, arg->princ, &k, &nkeys); } else { log_unauth(funcname, prime_arg, &client_name, &service_name, rqstp); ret.code = KADM5_AUTH_CHANGEPW; } if(ret.code == KADM5_OK) { ret.keys = k; ret.n_keys = nkeys; } if(ret.code != KADM5_AUTH_CHANGEPW) { if( ret.code != 0 ) errmsg = krb5_get_error_message(handle->context, ret.code); log_done(funcname, prime_arg, errmsg, &client_name, &service_name, rqstp); if (errmsg != NULL) krb5_free_error_message(handle->context, errmsg); } free(prime_arg); gss_release_buffer(&minor_stat, &client_name); gss_release_buffer(&minor_stat, &service_name); exit_func: free_server_handle(handle); return &ret; }
710
0
void qemu_del_timer(QEMUTimer *ts) { }
711
1
static int jpc_qcx_getcompparms(jpc_qcxcp_t *compparms, jpc_cstate_t *cstate, jas_stream_t *in, uint_fast16_t len) { uint_fast8_t tmp; int n; int i; /* Eliminate compiler warning about unused variables. */ cstate = 0; n = 0; if (jpc_getuint8(in, &tmp)) { return -1; } ++n; compparms->qntsty = tmp & 0x1f; compparms->numguard = (tmp >> 5) & 7; switch (compparms->qntsty) { case JPC_QCX_SIQNT: compparms->numstepsizes = 1; break; case JPC_QCX_NOQNT: compparms->numstepsizes = (len - n); break; case JPC_QCX_SEQNT: /* XXX - this is a hack */ compparms->numstepsizes = (len - n) / 2; break; } if (compparms->numstepsizes > 0) { compparms->stepsizes = jas_malloc(compparms->numstepsizes * sizeof(uint_fast16_t)); assert(compparms->stepsizes); for (i = 0; i < compparms->numstepsizes; ++i) { if (compparms->qntsty == JPC_QCX_NOQNT) { if (jpc_getuint8(in, &tmp)) { return -1; } compparms->stepsizes[i] = JPC_QCX_EXPN(tmp >> 3); } else { if (jpc_getuint16(in, &compparms->stepsizes[i])) { return -1; } } } } else { compparms->stepsizes = 0; } if (jas_stream_error(in) || jas_stream_eof(in)) { jpc_qcx_destroycompparms(compparms); return -1; } return 0; }
712
0
IN_PROC_BROWSER_TEST_F ( ExtensionPreferenceApiTest , SessionOnlyIncognito ) { PrefService * prefs = profile_ -> GetPrefs ( ) ; prefs -> SetBoolean ( prefs : : kBlockThirdPartyCookies , false ) ; EXPECT_TRUE ( RunExtensionTestIncognito ( "preference/session_only_incognito" ) ) << message_ ; EXPECT_TRUE ( profile_ -> HasOffTheRecordProfile ( ) ) ; PrefService * otr_prefs = profile_ -> GetOffTheRecordProfile ( ) -> GetPrefs ( ) ; const PrefService : : Preference * pref = otr_prefs -> FindPreference ( prefs : : kBlockThirdPartyCookies ) ; ASSERT_TRUE ( pref ) ; EXPECT_TRUE ( pref -> IsExtensionControlled ( ) ) ; EXPECT_FALSE ( otr_prefs -> GetBoolean ( prefs : : kBlockThirdPartyCookies ) ) ; pref = prefs -> FindPreference ( prefs : : kBlockThirdPartyCookies ) ; ASSERT_TRUE ( pref ) ; EXPECT_FALSE ( pref -> IsExtensionControlled ( ) ) ; EXPECT_FALSE ( prefs -> GetBoolean ( prefs : : kBlockThirdPartyCookies ) ) ; }
713
1
create_policy_2_svc(cpol_arg *arg, struct svc_req *rqstp) { static generic_ret ret; char *prime_arg; gss_buffer_desc client_name, service_name; OM_uint32 minor_stat; kadm5_server_handle_t handle; const char *errmsg = NULL; xdr_free(xdr_generic_ret, &ret); if ((ret.code = new_server_handle(arg->api_version, rqstp, &handle))) goto exit_func; if ((ret.code = check_handle((void *)handle))) goto exit_func; ret.api_version = handle->api_version; if (setup_gss_names(rqstp, &client_name, &service_name) < 0) { ret.code = KADM5_FAILURE; goto exit_func; } prime_arg = arg->rec.policy; if (CHANGEPW_SERVICE(rqstp) || !kadm5int_acl_check(handle->context, rqst2name(rqstp), ACL_ADD, NULL, NULL)) { ret.code = KADM5_AUTH_ADD; log_unauth("kadm5_create_policy", prime_arg, &client_name, &service_name, rqstp); } else { ret.code = kadm5_create_policy((void *)handle, &arg->rec, arg->mask); if( ret.code != 0 ) errmsg = krb5_get_error_message(handle->context, ret.code); log_done("kadm5_create_policy", ((prime_arg == NULL) ? "(null)" : prime_arg), errmsg, &client_name, &service_name, rqstp); if (errmsg != NULL) krb5_free_error_message(handle->context, errmsg); } gss_release_buffer(&minor_stat, &client_name); gss_release_buffer(&minor_stat, &service_name); exit_func: free_server_handle(handle); return &ret; }
714
0
static void restore_native_fp_frstor(CPUState *env) { int fptag, i, j; struct fpstate fp1, *fp = &fp1; fp->fpuc = env->fpuc; fp->fpus = (env->fpus & ~0x3800) | (env->fpstt & 0x7) << 11; fptag = 0; for (i=7; i>=0; i--) { fptag <<= 2; if (env->fptags[i]) { fptag |= 3; } else { /* the FPU automatically computes it */ } } fp->fptag = fptag; j = env->fpstt; for(i = 0;i < 8; i++) { memcpy(&fp->fpregs1[i * 10], &env->fpregs[j].d, 10); j = (j + 1) & 7; } asm volatile ("frstor %0" : "=m" (*fp)); }
715
0
TEST_F ( BudgetManagerTest , TestInsecureOrigin ) { const blink : : mojom : : BudgetOperationType type = blink : : mojom : : BudgetOperationType : : SILENT_PUSH ; SetOrigin ( url : : Origin ( GURL ( "http://example.com" ) ) ) ; SetSiteEngagementScore ( kTestSES ) ; ASSERT_FALSE ( ReserveBudget ( type ) ) ; ASSERT_EQ ( blink : : mojom : : BudgetServiceErrorType : : NOT_SUPPORTED , error_ ) ; ASSERT_FALSE ( ConsumeBudget ( type ) ) ; }
716
1
void jpc_qmfb_split_col(jpc_fix_t *a, int numrows, int stride, int parity) { int bufsize = JPC_CEILDIVPOW2(numrows, 1); jpc_fix_t splitbuf[QMFB_SPLITBUFSIZE]; jpc_fix_t *buf = splitbuf; register jpc_fix_t *srcptr; register jpc_fix_t *dstptr; register int n; register int m; int hstartcol; /* Get a buffer. */ if (bufsize > QMFB_SPLITBUFSIZE) { if (!(buf = jas_malloc(bufsize * sizeof(jpc_fix_t)))) { /* We have no choice but to commit suicide in this case. */ abort(); } } if (numrows >= 2) { hstartcol = (numrows + 1 - parity) >> 1; m = (parity) ? hstartcol : (numrows - hstartcol); /* Save the samples destined for the highpass channel. */ n = m; dstptr = buf; srcptr = &a[(1 - parity) * stride]; while (n-- > 0) { *dstptr = *srcptr; ++dstptr; srcptr += stride << 1; } /* Copy the appropriate samples into the lowpass channel. */ dstptr = &a[(1 - parity) * stride]; srcptr = &a[(2 - parity) * stride]; n = numrows - m - (!parity); while (n-- > 0) { *dstptr = *srcptr; dstptr += stride; srcptr += stride << 1; } /* Copy the saved samples into the highpass channel. */ dstptr = &a[hstartcol * stride]; srcptr = buf; n = m; while (n-- > 0) { *dstptr = *srcptr; dstptr += stride; ++srcptr; } } /* If the split buffer was allocated on the heap, free this memory. */ if (buf != splitbuf) { jas_free(buf); } }
717
0
static void passphrase_free ( char * ppbuff ) { if ( ppbuff != NULL ) { memset ( ppbuff , 0 , PPBUFF_SIZE ) ; free ( ppbuff ) ; } }
718
1
void jas_matrix_bindsub(jas_matrix_t *mat0, jas_matrix_t *mat1, int r0, int c0, int r1, int c1) { int i; if (mat0->data_) { if (!(mat0->flags_ & JAS_MATRIX_REF)) { jas_free(mat0->data_); } mat0->data_ = 0; mat0->datasize_ = 0; } if (mat0->rows_) { jas_free(mat0->rows_); mat0->rows_ = 0; } mat0->flags_ |= JAS_MATRIX_REF; mat0->numrows_ = r1 - r0 + 1; mat0->numcols_ = c1 - c0 + 1; mat0->maxrows_ = mat0->numrows_; mat0->rows_ = jas_malloc(mat0->maxrows_ * sizeof(jas_seqent_t *)); for (i = 0; i < mat0->numrows_; ++i) { mat0->rows_[i] = mat1->rows_[r0 + i] + c0; } mat0->xstart_ = mat1->xstart_ + c0; mat0->ystart_ = mat1->ystart_ + r0; mat0->xend_ = mat0->xstart_ + mat0->numcols_; mat0->yend_ = mat0->ystart_ + mat0->numrows_; }
719
0
static void cpu_exec_nocache(int max_cycles, TranslationBlock *orig_tb) { unsigned long next_tb; TranslationBlock *tb; /* Should never happen. We only end up here when an existing TB is too long. */ if (max_cycles > CF_COUNT_MASK) max_cycles = CF_COUNT_MASK; tb = tb_gen_code(env, orig_tb->pc, orig_tb->cs_base, orig_tb->flags, max_cycles); env->current_tb = tb; /* execute the generated code */ next_tb = tcg_qemu_tb_exec(tb->tc_ptr); env->current_tb = NULL; if ((next_tb & 3) == 2) { /* Restore PC. This may happen if async event occurs before the TB starts executing. */ cpu_pc_from_tb(env, tb); } tb_phys_invalidate(tb, -1); tb_free(tb); }
720
1
static int jas_cmpxformseq_resize(jas_cmpxformseq_t *pxformseq, int n) { jas_cmpxform_t **p; assert(n >= pxformseq->numpxforms); p = (!pxformseq->pxforms) ? jas_malloc(n * sizeof(jas_cmpxform_t *)) : jas_realloc(pxformseq->pxforms, n * sizeof(jas_cmpxform_t *)); if (!p) { return -1; } pxformseq->pxforms = p; pxformseq->maxpxforms = n; return 0; }
721
0
static char *regname(uint32_t addr) { static char buf[16]; if (addr < PCI_IO_SIZE) { const char *r = reg[addr / 4]; if (r != 0) { sprintf(buf, "%s+%u", r, addr % 4); } else { sprintf(buf, "0x%02x", addr); } } else { sprintf(buf, "??? 0x%08x", addr); } return buf; }
724
1
static int jpc_ppt_getparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *in) { jpc_ppt_t *ppt = &ms->parms.ppt; /* Eliminate compiler warning about unused variables. */ cstate = 0; ppt->data = 0; if (ms->len < 1) { goto error; } if (jpc_getuint8(in, &ppt->ind)) { goto error; } ppt->len = ms->len - 1; if (ppt->len > 0) { if (!(ppt->data = jas_malloc(ppt->len * sizeof(unsigned char)))) { goto error; } if (jas_stream_read(in, (char *) ppt->data, ppt->len) != JAS_CAST(int, ppt->len)) { goto error; } } else { ppt->data = 0; } return 0; error: jpc_ppt_destroyparms(ms); return -1; }
725
0
static void handle_2misc_fcmp_zero(DisasContext *s, int opcode, bool is_scalar, bool is_u, bool is_q, int size, int rn, int rd) { bool is_double = (size == 3); TCGv_ptr fpst = get_fpstatus_ptr(); if (is_double) { TCGv_i64 tcg_op = tcg_temp_new_i64(); TCGv_i64 tcg_zero = tcg_const_i64(0); TCGv_i64 tcg_res = tcg_temp_new_i64(); NeonGenTwoDoubleOPFn *genfn; bool swap = false; int pass; switch (opcode) { case 0x2e: /* FCMLT (zero) */ swap = true; /* fallthrough */ case 0x2c: /* FCMGT (zero) */ genfn = gen_helper_neon_cgt_f64; break; case 0x2d: /* FCMEQ (zero) */ genfn = gen_helper_neon_ceq_f64; break; case 0x6d: /* FCMLE (zero) */ swap = true; /* fall through */ case 0x6c: /* FCMGE (zero) */ genfn = gen_helper_neon_cge_f64; break; default: g_assert_not_reached(); } for (pass = 0; pass < (is_scalar ? 1 : 2); pass++) { read_vec_element(s, tcg_op, rn, pass, MO_64); if (swap) { genfn(tcg_res, tcg_zero, tcg_op, fpst); } else { genfn(tcg_res, tcg_op, tcg_zero, fpst); } write_vec_element(s, tcg_res, rd, pass, MO_64); } if (is_scalar) { clear_vec_high(s, rd); } tcg_temp_free_i64(tcg_res); tcg_temp_free_i64(tcg_zero); tcg_temp_free_i64(tcg_op); } else { TCGv_i32 tcg_op = tcg_temp_new_i32(); TCGv_i32 tcg_zero = tcg_const_i32(0); TCGv_i32 tcg_res = tcg_temp_new_i32(); NeonGenTwoSingleOPFn *genfn; bool swap = false; int pass, maxpasses; switch (opcode) { case 0x2e: /* FCMLT (zero) */ swap = true; /* fall through */ case 0x2c: /* FCMGT (zero) */ genfn = gen_helper_neon_cgt_f32; break; case 0x2d: /* FCMEQ (zero) */ genfn = gen_helper_neon_ceq_f32; break; case 0x6d: /* FCMLE (zero) */ swap = true; /* fall through */ case 0x6c: /* FCMGE (zero) */ genfn = gen_helper_neon_cge_f32; break; default: g_assert_not_reached(); } if (is_scalar) { maxpasses = 1; } else { maxpasses = is_q ? 4 : 2; } for (pass = 0; pass < maxpasses; pass++) { read_vec_element_i32(s, tcg_op, rn, pass, MO_32); if (swap) { genfn(tcg_res, tcg_zero, tcg_op, fpst); } else { genfn(tcg_res, tcg_op, tcg_zero, fpst); } if (is_scalar) { write_fp_sreg(s, rd, tcg_res); } else { write_vec_element_i32(s, tcg_res, rd, pass, MO_32); } } tcg_temp_free_i32(tcg_res); tcg_temp_free_i32(tcg_zero); tcg_temp_free_i32(tcg_op); if (!is_q && !is_scalar) { clear_vec_high(s, rd); } } tcg_temp_free_ptr(fpst); }
726
0
static int on2avc_decode_band_scales(On2AVCContext *c, GetBitContext *gb) { int w, w2, b, scale, first = 1; int band_off = 0; for (w = 0; w < c->num_windows; w++) { if (!c->grouping[w]) { memcpy(c->band_scales + band_off, c->band_scales + band_off - c->num_bands, c->num_bands * sizeof(*c->band_scales)); band_off += c->num_bands; continue; } for (b = 0; b < c->num_bands; b++) { if (!c->band_type[band_off]) { int all_zero = 1; for (w2 = w + 1; w2 < c->num_windows; w2++) { if (c->grouping[w2]) break; if (c->band_type[w2 * c->num_bands + b]) { all_zero = 0; break; } } if (all_zero) { c->band_scales[band_off++] = 0; continue; } } if (first) { scale = get_bits(gb, 7); first = 0; } else { scale += get_vlc2(gb, c->scale_diff.table, 9, 3) - 60; } if (scale < 0 || scale > 128) { av_log(c->avctx, AV_LOG_ERROR, "Invalid scale value %d\n", scale); return AVERROR_INVALIDDATA; } c->band_scales[band_off++] = c->scale_tab[scale]; } } return 0; }
728
0
int ssl_choose_client_version ( SSL * s , int version ) { const version_info * vent ; const version_info * table ; switch ( s -> method -> version ) { default : if ( version != s -> version ) return SSL_R_WRONG_SSL_VERSION ; return 0 ; case TLS_ANY_VERSION : table = tls_version_table ; break ; case DTLS_ANY_VERSION : table = dtls_version_table ; break ; } for ( vent = table ; vent -> version != 0 ; ++ vent ) { const SSL_METHOD * method ; int err ; if ( version != vent -> version ) continue ; if ( vent -> cmeth == NULL ) break ; method = vent -> cmeth ( ) ; err = ssl_method_error ( s , method ) ; if ( err != 0 ) return err ; s -> method = method ; s -> version = version ; return 0 ; } return SSL_R_UNSUPPORTED_PROTOCOL ; }
729
1
create_principal_2_svc(cprinc_arg *arg, struct svc_req *rqstp) { static generic_ret ret; char *prime_arg; gss_buffer_desc client_name, service_name; OM_uint32 minor_stat; kadm5_server_handle_t handle; restriction_t *rp; const char *errmsg = NULL; xdr_free(xdr_generic_ret, &ret); if ((ret.code = new_server_handle(arg->api_version, rqstp, &handle))) goto exit_func; if ((ret.code = check_handle((void *)handle))) goto exit_func; ret.api_version = handle->api_version; if (setup_gss_names(rqstp, &client_name, &service_name) < 0) { ret.code = KADM5_FAILURE; goto exit_func; } if (krb5_unparse_name(handle->context, arg->rec.principal, &prime_arg)) { ret.code = KADM5_BAD_PRINCIPAL; goto exit_func; } if (CHANGEPW_SERVICE(rqstp) || !kadm5int_acl_check(handle->context, rqst2name(rqstp), ACL_ADD, arg->rec.principal, &rp) || kadm5int_acl_impose_restrictions(handle->context, &arg->rec, &arg->mask, rp)) { ret.code = KADM5_AUTH_ADD; log_unauth("kadm5_create_principal", prime_arg, &client_name, &service_name, rqstp); } else { ret.code = kadm5_create_principal((void *)handle, &arg->rec, arg->mask, arg->passwd); if( ret.code != 0 ) errmsg = krb5_get_error_message(handle->context, ret.code); log_done("kadm5_create_principal", prime_arg, errmsg, &client_name, &service_name, rqstp); if (errmsg != NULL) krb5_free_error_message(handle->context, errmsg); } free(prime_arg); gss_release_buffer(&minor_stat, &client_name); gss_release_buffer(&minor_stat, &service_name); exit_func: free_server_handle(handle); return &ret; }
730
1
jas_image_t *jas_image_create(int numcmpts, jas_image_cmptparm_t *cmptparms, int clrspc) { jas_image_t *image; uint_fast32_t rawsize; uint_fast32_t inmem; int cmptno; jas_image_cmptparm_t *cmptparm; if (!(image = jas_image_create0())) { return 0; } image->clrspc_ = clrspc; image->maxcmpts_ = numcmpts; image->inmem_ = true; /* Allocate memory for the per-component information. */ if (!(image->cmpts_ = jas_malloc(image->maxcmpts_ * sizeof(jas_image_cmpt_t *)))) { jas_image_destroy(image); return 0; } /* Initialize in case of failure. */ for (cmptno = 0; cmptno < image->maxcmpts_; ++cmptno) { image->cmpts_[cmptno] = 0; } /* Compute the approximate raw size of the image. */ rawsize = 0; for (cmptno = 0, cmptparm = cmptparms; cmptno < numcmpts; ++cmptno, ++cmptparm) { rawsize += cmptparm->width * cmptparm->height * (cmptparm->prec + 7) / 8; } /* Decide whether to buffer the image data in memory, based on the raw size of the image. */ inmem = (rawsize < JAS_IMAGE_INMEMTHRESH); /* Create the individual image components. */ for (cmptno = 0, cmptparm = cmptparms; cmptno < numcmpts; ++cmptno, ++cmptparm) { if (!(image->cmpts_[cmptno] = jas_image_cmpt_create(cmptparm->tlx, cmptparm->tly, cmptparm->hstep, cmptparm->vstep, cmptparm->width, cmptparm->height, cmptparm->prec, cmptparm->sgnd, inmem))) { jas_image_destroy(image); return 0; } ++image->numcmpts_; } /* Determine the bounding box for all of the components on the reference grid (i.e., the image area) */ jas_image_setbbox(image); return image; }
731
0
static void start_or_stop_io ( NautilusDirectory * directory ) { NautilusFile * file ; gboolean doing_io ; file_list_start_or_stop ( directory ) ; file_info_stop ( directory ) ; directory_count_stop ( directory ) ; deep_count_stop ( directory ) ; mime_list_stop ( directory ) ; link_info_stop ( directory ) ; extension_info_stop ( directory ) ; mount_stop ( directory ) ; thumbnail_stop ( directory ) ; filesystem_info_stop ( directory ) ; doing_io = FALSE ; while ( ! nautilus_file_queue_is_empty ( directory -> details -> high_priority_queue ) ) { file = nautilus_file_queue_head ( directory -> details -> high_priority_queue ) ; file_info_start ( directory , file , & doing_io ) ; link_info_start ( directory , file , & doing_io ) ; if ( doing_io ) { return ; } move_file_to_low_priority_queue ( directory , file ) ; } while ( ! nautilus_file_queue_is_empty ( directory -> details -> low_priority_queue ) ) { file = nautilus_file_queue_head ( directory -> details -> low_priority_queue ) ; mount_start ( directory , file , & doing_io ) ; directory_count_start ( directory , file , & doing_io ) ; deep_count_start ( directory , file , & doing_io ) ; mime_list_start ( directory , file , & doing_io ) ; thumbnail_start ( directory , file , & doing_io ) ; filesystem_info_start ( directory , file , & doing_io ) ; if ( doing_io ) { return ; } move_file_to_extension_queue ( directory , file ) ; } while ( ! nautilus_file_queue_is_empty ( directory -> details -> extension_queue ) ) { file = nautilus_file_queue_head ( directory -> details -> extension_queue ) ; extension_info_start ( directory , file , & doing_io ) ; if ( doing_io ) { return ; } nautilus_directory_remove_file_from_work_queue ( directory , file ) ; } }
733
1
static int jpc_ppm_getparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *in) { jpc_ppm_t *ppm = &ms->parms.ppm; /* Eliminate compiler warning about unused variables. */ cstate = 0; ppm->data = 0; if (ms->len < 1) { goto error; } if (jpc_getuint8(in, &ppm->ind)) { goto error; } ppm->len = ms->len - 1; if (ppm->len > 0) { if (!(ppm->data = jas_malloc(ppm->len * sizeof(unsigned char)))) { goto error; } if (JAS_CAST(uint, jas_stream_read(in, ppm->data, ppm->len)) != ppm->len) { goto error; } } else { ppm->data = 0; } return 0; error: jpc_ppm_destroyparms(ms); return -1; }
734
1
delete_policy_2_svc(dpol_arg *arg, struct svc_req *rqstp) { static generic_ret ret; char *prime_arg; gss_buffer_desc client_name, service_name; OM_uint32 minor_stat; kadm5_server_handle_t handle; const char *errmsg = NULL; xdr_free(xdr_generic_ret, &ret); if ((ret.code = new_server_handle(arg->api_version, rqstp, &handle))) goto exit_func; if ((ret.code = check_handle((void *)handle))) goto exit_func; ret.api_version = handle->api_version; if (setup_gss_names(rqstp, &client_name, &service_name) < 0) { ret.code = KADM5_FAILURE; goto exit_func; } prime_arg = arg->name; if (CHANGEPW_SERVICE(rqstp) || !kadm5int_acl_check(handle->context, rqst2name(rqstp), ACL_DELETE, NULL, NULL)) { log_unauth("kadm5_delete_policy", prime_arg, &client_name, &service_name, rqstp); ret.code = KADM5_AUTH_DELETE; } else { ret.code = kadm5_delete_policy((void *)handle, arg->name); if( ret.code != 0 ) errmsg = krb5_get_error_message(handle->context, ret.code); log_done("kadm5_delete_policy", ((prime_arg == NULL) ? "(null)" : prime_arg), errmsg, &client_name, &service_name, rqstp); if (errmsg != NULL) krb5_free_error_message(handle->context, errmsg); } gss_release_buffer(&minor_stat, &client_name); gss_release_buffer(&minor_stat, &service_name); exit_func: free_server_handle(handle); return &ret; }
735
0
int cpu_watchpoint_insert(CPUState *env, target_ulong addr, target_ulong len, int flags, CPUWatchpoint **watchpoint) { target_ulong len_mask = ~(len - 1); CPUWatchpoint *wp; /* sanity checks: allow power-of-2 lengths, deny unaligned watchpoints */ if ((len != 1 && len != 2 && len != 4 && len != 8) || (addr & ~len_mask)) { fprintf(stderr, "qemu: tried to set invalid watchpoint at " TARGET_FMT_lx ", len=" TARGET_FMT_lu "\n", addr, len); return -EINVAL; } wp = qemu_malloc(sizeof(*wp)); wp->vaddr = addr; wp->len_mask = len_mask; wp->flags = flags; /* keep all GDB-injected watchpoints in front */ if (flags & BP_GDB) TAILQ_INSERT_HEAD(&env->watchpoints, wp, entry); else TAILQ_INSERT_TAIL(&env->watchpoints, wp, entry); tlb_flush_page(env, addr); if (watchpoint) *watchpoint = wp; return 0; }
736
1
static int jpc_poc_getparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *in) { jpc_poc_t *poc = &ms->parms.poc; jpc_pocpchg_t *pchg; int pchgno; uint_fast8_t tmp; poc->numpchgs = (cstate->numcomps > 256) ? (ms->len / 9) : (ms->len / 7); if (!(poc->pchgs = jas_malloc(poc->numpchgs * sizeof(jpc_pocpchg_t)))) { goto error; } for (pchgno = 0, pchg = poc->pchgs; pchgno < poc->numpchgs; ++pchgno, ++pchg) { if (jpc_getuint8(in, &pchg->rlvlnostart)) { goto error; } if (cstate->numcomps > 256) { if (jpc_getuint16(in, &pchg->compnostart)) { goto error; } } else { if (jpc_getuint8(in, &tmp)) { goto error; }; pchg->compnostart = tmp; } if (jpc_getuint16(in, &pchg->lyrnoend) || jpc_getuint8(in, &pchg->rlvlnoend)) { goto error; } if (cstate->numcomps > 256) { if (jpc_getuint16(in, &pchg->compnoend)) { goto error; } } else { if (jpc_getuint8(in, &tmp)) { goto error; } pchg->compnoend = tmp; } if (jpc_getuint8(in, &pchg->prgord)) { goto error; } if (pchg->rlvlnostart > pchg->rlvlnoend || pchg->compnostart > pchg->compnoend) { goto error; } } return 0; error: jpc_poc_destroyparms(ms); return -1; }
737
0
static void predict_and_reconstruct_intra_block ( int plane , int block , BLOCK_SIZE plane_bsize , TX_SIZE tx_size , void * arg ) { struct intra_args * const args = ( struct intra_args * ) arg ; VP9_COMMON * const cm = args -> cm ; MACROBLOCKD * const xd = args -> xd ; struct macroblockd_plane * const pd = & xd -> plane [ plane ] ; MODE_INFO * const mi = xd -> mi [ 0 ] . src_mi ; const PREDICTION_MODE mode = ( plane == 0 ) ? get_y_mode ( mi , block ) : mi -> mbmi . uv_mode ; int x , y ; uint8_t * dst ; txfrm_block_to_raster_xy ( plane_bsize , tx_size , block , & x , & y ) ; dst = & pd -> dst . buf [ 4 * y * pd -> dst . stride + 4 * x ] ; vp9_predict_intra_block ( xd , block >> ( tx_size << 1 ) , b_width_log2 ( plane_bsize ) , tx_size , mode , dst , pd -> dst . stride , dst , pd -> dst . stride , x , y , plane ) ; if ( ! mi -> mbmi . skip ) { const int eob = vp9_decode_block_tokens ( cm , xd , plane , block , plane_bsize , x , y , tx_size , args -> r ) ; inverse_transform_block ( xd , plane , block , tx_size , dst , pd -> dst . stride , eob ) ; } }
738
1
TSReturnCode TSHttpTxnConfigFind ( const char * name , int length , TSOverridableConfigKey * conf , TSRecordDataType * type ) { sdk_assert ( sdk_sanity_check_null_ptr ( ( void * ) name ) == TS_SUCCESS ) ; sdk_assert ( sdk_sanity_check_null_ptr ( ( void * ) conf ) == TS_SUCCESS ) ; TSOverridableConfigKey cnf = TS_CONFIG_NULL ; TSRecordDataType typ = TS_RECORDDATATYPE_INT ; if ( length == - 1 ) { length = strlen ( name ) ; } switch ( length ) { case 24 : if ( ! strncmp ( name , "proxy.config.srv_enabled" , length ) ) { cnf = TS_CONFIG_SRV_ENABLED ; } break ; case 28 : if ( ! strncmp ( name , "proxy.config.http.cache.http" , length ) ) { cnf = TS_CONFIG_HTTP_CACHE_HTTP ; } break ; case 29 : if ( ! strncmp ( name , "proxy.config.ssl.hsts_max_age" , length ) ) { cnf = TS_CONFIG_SSL_HSTS_MAX_AGE ; } break ; case 31 : if ( ! strncmp ( name , "proxy.config.http.chunking.size" , length ) ) { cnf = TS_CONFIG_HTTP_CHUNKING_SIZE ; } break ; case 33 : if ( ! strncmp ( name , "proxy.config.http.cache.fuzz.time" , length ) ) { cnf = TS_CONFIG_HTTP_CACHE_FUZZ_TIME ; } else if ( ! strncmp ( name , "proxy.config.ssl.client.cert.path" , length ) ) { cnf = TS_CONFIG_SSL_CERT_FILEPATH ; typ = TS_RECORDDATATYPE_STRING ; } break ; case 34 : if ( ! strncmp ( name , "proxy.config.http.chunking_enabled" , length ) ) { cnf = TS_CONFIG_HTTP_CHUNKING_ENABLED ; } else if ( ! strncmp ( name , "proxy.config.http.cache.generation" , length ) ) { cnf = TS_CONFIG_HTTP_CACHE_GENERATION ; } else if ( ! strncmp ( name , "proxy.config.http.insert_client_ip" , length ) ) { cnf = TS_CONFIG_HTTP_ANONYMIZE_INSERT_CLIENT_IP ; } break ; case 35 : switch ( name [ length - 1 ] ) { case 'e' : if ( ! strncmp ( name , "proxy.config.http.cache.range.write" , length ) ) { cnf = TS_CONFIG_HTTP_CACHE_RANGE_WRITE ; } break ; case 'p' : if ( ! strncmp ( name , "proxy.config.http.normalize_ae_gzip" , length ) ) { cnf = TS_CONFIG_HTTP_NORMALIZE_AE_GZIP ; } break ; } break ; case 36 : switch ( name [ length - 1 ] ) { case 'p' : if ( ! strncmp ( name , "proxy.config.http.cache.range.lookup" , length ) ) { cnf = TS_CONFIG_HTTP_CACHE_RANGE_LOOKUP ; } break ; case 't' : if ( ! strncmp ( name , "proxy.config.net.sock_packet_tos_out" , length ) ) { cnf = TS_CONFIG_NET_SOCK_PACKET_TOS_OUT ; } break ; case 'd' : if ( ! strncmp ( name , "proxy.config.http.slow.log.threshold" , length ) ) { cnf = TS_CONFIG_HTTP_SLOW_LOG_THRESHOLD ; } break ; } break ; case 37 : switch ( name [ length - 1 ] ) { case 'd' : if ( ! strncmp ( name , "proxy.config.http.redirection_enabled" , length ) ) { cnf = TS_CONFIG_HTTP_ENABLE_REDIRECTION ; } break ; case 'e' : if ( ! strncmp ( name , "proxy.config.http.cache.max_stale_age" , length ) ) { cnf = TS_CONFIG_HTTP_CACHE_MAX_STALE_AGE ; } else if ( ! strncmp ( name , "proxy.config.http.cache.fuzz.min_time" , length ) ) { cnf = TS_CONFIG_HTTP_CACHE_FUZZ_MIN_TIME ; } else if ( ! strncmp ( name , "proxy.config.http.default_buffer_size" , length ) ) { cnf = TS_CONFIG_HTTP_DEFAULT_BUFFER_SIZE ; } else if ( ! strncmp ( name , "proxy.config.ssl.client.cert.filename" , length ) ) { cnf = TS_CONFIG_SSL_CERT_FILENAME ; typ = TS_RECORDDATATYPE_STRING ; } break ; case 'r' : if ( ! strncmp ( name , "proxy.config.http.response_server_str" , length ) ) { cnf = TS_CONFIG_HTTP_RESPONSE_SERVER_STR ; typ = TS_RECORDDATATYPE_STRING ; } else if ( ! strncmp ( name , "proxy.config.ssl.client.verify.server" , length ) ) { cnf = TS_CONFIG_SSL_CLIENT_VERIFY_SERVER ; } break ; case 't' : if ( ! strncmp ( name , "proxy.config.http.keep_alive_post_out" , length ) ) { cnf = TS_CONFIG_HTTP_KEEP_ALIVE_POST_OUT ; } else if ( ! strncmp ( name , "proxy.config.net.sock_option_flag_out" , length ) ) { cnf = TS_CONFIG_NET_SOCK_OPTION_FLAG_OUT ; } else if ( ! strncmp ( name , "proxy.config.net.sock_packet_mark_out" , length ) ) { cnf = TS_CONFIG_NET_SOCK_PACKET_MARK_OUT ; } else if ( ! strncmp ( name , "proxy.config.websocket.active_timeout" , length ) ) { cnf = TS_CONFIG_WEBSOCKET_ACTIVE_TIMEOUT ; } break ; } break ; case 38 : switch ( name [ length - 1 ] ) { case 'd' : if ( ! strncmp ( name , "proxy.config.http.server_tcp_init_cwnd" , length ) ) { cnf = TS_CONFIG_HTTP_SERVER_TCP_INIT_CWND ; } else if ( ! strncmp ( name , "proxy.config.http.flow_control.enabled" , length ) ) { cnf = TS_CONFIG_HTTP_FLOW_CONTROL_ENABLED ; } break ; break ; case 's' : if ( ! strncmp ( name , "proxy.config.http.send_http11_requests" , length ) ) { cnf = TS_CONFIG_HTTP_SEND_HTTP11_REQUESTS ; } break ; } break ; case 39 : switch ( name [ length - 1 ] ) { case 'e' : if ( ! strncmp ( name , "proxy.config.body_factory.template_base" , length ) ) { cnf = TS_CONFIG_BODY_FACTORY_TEMPLATE_BASE ; typ = TS_RECORDDATATYPE_STRING ; } break ; case 'm' : if ( ! strncmp ( name , "proxy.config.http.anonymize_remove_from" , length ) ) { cnf = TS_CONFIG_HTTP_ANONYMIZE_REMOVE_FROM ; } break ; case 'n' : if ( ! strncmp ( name , "proxy.config.http.keep_alive_enabled_in" , length ) ) { cnf = TS_CONFIG_HTTP_KEEP_ALIVE_ENABLED_IN ; } break ; case 's' : if ( ! strncmp ( name , "proxy.config.http.doc_in_cache_skip_dns" , length ) ) { cnf = TS_CONFIG_HTTP_DOC_IN_CACHE_SKIP_DNS ; } break ; } break ; case 40 : switch ( name [ length - 1 ] ) { case 'd' : if ( ! strncmp ( name , "proxy.config.http.forward_connect_method" , length ) ) { cnf = TS_CONFIG_HTTP_FORWARD_CONNECT_METHOD ; } break ; case 'e' : if ( ! strncmp ( name , "proxy.config.http.down_server.cache_time" , length ) ) { cnf = TS_CONFIG_HTTP_DOWN_SERVER_CACHE_TIME ; } else if ( ! strncmp ( name , "proxy.config.http.insert_age_in_response" , length ) ) { cnf = TS_CONFIG_HTTP_INSERT_AGE_IN_RESPONSE ; } break ; case 'r' : if ( ! strncmp ( name , "proxy.config.url_remap.pristine_host_hdr" , length ) ) { cnf = TS_CONFIG_URL_REMAP_PRISTINE_HOST_HDR ; } else if ( ! strncmp ( name , "proxy.config.http.insert_request_via_str" , length ) ) { cnf = TS_CONFIG_HTTP_INSERT_REQUEST_VIA_STR ; } else if ( ! strncmp ( name , "proxy.config.http.flow_control.low_water" , length ) ) { cnf = TS_CONFIG_HTTP_FLOW_CONTROL_LOW_WATER_MARK ; } break ; case 's' : if ( ! strncmp ( name , "proxy.config.http.origin_max_connections" , length ) ) { cnf = TS_CONFIG_HTTP_ORIGIN_MAX_CONNECTIONS ; } else if ( ! strncmp ( name , "proxy.config.http.cache.required_headers" , length ) ) { cnf = TS_CONFIG_HTTP_CACHE_REQUIRED_HEADERS ; } else if ( ! strncmp ( name , "proxy.config.ssl.hsts_include_subdomains" , length ) ) { cnf = TS_CONFIG_SSL_HSTS_INCLUDE_SUBDOMAINS ; } else if ( ! strncmp ( name , "proxy.config.http.number_of_redirections" , length ) ) { cnf = TS_CONFIG_HTTP_NUMBER_OF_REDIRECTIONS ; } break ; case 't' : if ( ! strncmp ( name , "proxy.config.http.keep_alive_enabled_out" , length ) ) { cnf = TS_CONFIG_HTTP_KEEP_ALIVE_ENABLED_OUT ; } break ; case 'y' : if ( ! strncmp ( name , "proxy.config.http.cache.fuzz.probability" , length ) ) { typ = TS_RECORDDATATYPE_FLOAT ; cnf = TS_CONFIG_HTTP_CACHE_FUZZ_PROBABILITY ; } break ; } break ; case 41 : switch ( name [ length - 1 ] ) { case 'd' : if ( ! strncmp ( name , "proxy.config.http.response_server_enabled" , length ) ) { cnf = TS_CONFIG_HTTP_RESPONSE_SERVER_ENABLED ; } break ; case 'e' : if ( ! strncmp ( name , "proxy.config.http.anonymize_remove_cookie" , length ) ) { cnf = TS_CONFIG_HTTP_ANONYMIZE_REMOVE_COOKIE ; } else if ( ! strncmp ( name , "proxy.config.http.request_header_max_size" , length ) ) { cnf = TS_CONFIG_HTTP_REQUEST_HEADER_MAX_SIZE ; } else if ( ! strncmp ( name , "proxy.config.http.safe_requests_retryable" , length ) ) { cnf = TS_CONFIG_HTTP_SAFE_REQUESTS_RETRYABLE ; } else if ( ! strncmp ( name , "proxy.config.http.parent_proxy.retry_time" , length ) ) { cnf = TS_CONFIG_HTTP_PARENT_PROXY_RETRY_TIME ; } break ; case 'r' : if ( ! strncmp ( name , "proxy.config.http.insert_response_via_str" , length ) ) { cnf = TS_CONFIG_HTTP_INSERT_RESPONSE_VIA_STR ; } else if ( ! strncmp ( name , "proxy.config.http.flow_control.high_water" , length ) ) { cnf = TS_CONFIG_HTTP_FLOW_CONTROL_HIGH_WATER_MARK ; } break ; } break ; case 42 : switch ( name [ length - 1 ] ) { case 'd' : if ( ! strncmp ( name , "proxy.config.http.negative_caching_enabled" , length ) ) { cnf = TS_CONFIG_HTTP_NEGATIVE_CACHING_ENABLED ; } break ; case 'e' : if ( ! strncmp ( name , "proxy.config.http.cache.when_to_revalidate" , length ) ) { cnf = TS_CONFIG_HTTP_CACHE_WHEN_TO_REVALIDATE ; } else if ( ! strncmp ( name , "proxy.config.http.response_header_max_size" , length ) ) { cnf = TS_CONFIG_HTTP_RESPONSE_HEADER_MAX_SIZE ; } break ; case 'r' : if ( ! strncmp ( name , "proxy.config.http.anonymize_remove_referer" , length ) ) { cnf = TS_CONFIG_HTTP_ANONYMIZE_REMOVE_REFERER ; } else if ( ! strncmp ( name , "proxy.config.http.global_user_agent_header" , length ) ) { cnf = TS_CONFIG_HTTP_GLOBAL_USER_AGENT_HEADER ; typ = TS_RECORDDATATYPE_STRING ; } break ; case 't' : if ( ! strncmp ( name , "proxy.config.net.sock_recv_buffer_size_out" , length ) ) { cnf = TS_CONFIG_NET_SOCK_RECV_BUFFER_SIZE_OUT ; } else if ( ! strncmp ( name , "proxy.config.net.sock_send_buffer_size_out" , length ) ) { cnf = TS_CONFIG_NET_SOCK_SEND_BUFFER_SIZE_OUT ; } else if ( ! strncmp ( name , "proxy.config.http.connect_attempts_timeout" , length ) ) { cnf = TS_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT ; } else if ( ! strncmp ( name , "proxy.config.websocket.no_activity_timeout" , length ) ) { cnf = TS_CONFIG_WEBSOCKET_NO_ACTIVITY_TIMEOUT ; } break ; } break ; case 43 : switch ( name [ length - 1 ] ) { case 'e' : if ( ! strncmp ( name , "proxy.config.http.negative_caching_lifetime" , length ) ) { cnf = TS_CONFIG_HTTP_NEGATIVE_CACHING_LIFETIME ; } break ; case 'k' : if ( ! strncmp ( name , "proxy.config.http.default_buffer_water_mark" , length ) ) { cnf = TS_CONFIG_HTTP_DEFAULT_BUFFER_WATER_MARK ; } break ; case 'l' : if ( ! strncmp ( name , "proxy.config.http.cache.cluster_cache_local" , length ) ) { cnf = TS_CONFIG_HTTP_CACHE_CLUSTER_CACHE_LOCAL ; } break ; case 'r' : if ( ! strncmp ( name , "proxy.config.http.cache.heuristic_lm_factor" , length ) ) { typ = TS_RECORDDATATYPE_FLOAT ; cnf = TS_CONFIG_HTTP_CACHE_HEURISTIC_LM_FACTOR ; } break ; } break ; case 44 : switch ( name [ length - 1 ] ) { case 'p' : if ( ! strncmp ( name , "proxy.config.http.anonymize_remove_client_ip" , length ) ) { cnf = TS_CONFIG_HTTP_ANONYMIZE_REMOVE_CLIENT_IP ; } break ; case 'e' : if ( ! strncmp ( name , "proxy.config.http.cache.open_read_retry_time" , length ) ) { cnf = TS_CONFIG_HTTP_CACHE_OPEN_READ_RETRY_TIME ; } break ; } break ; case 45 : switch ( name [ length - 1 ] ) { case 'd' : if ( ! strncmp ( name , "proxy.config.http.down_server.abort_threshold" , length ) ) { cnf = TS_CONFIG_HTTP_DOWN_SERVER_ABORT_THRESHOLD ; } else if ( ! strncmp ( name , "proxy.config.http.parent_proxy.fail_threshold" , length ) ) { cnf = TS_CONFIG_HTTP_PARENT_PROXY_FAIL_THRESHOLD ; } break ; case 'n' : if ( ! strncmp ( name , "proxy.config.http.cache.ignore_authentication" , length ) ) { cnf = TS_CONFIG_HTTP_CACHE_IGNORE_AUTHENTICATION ; } break ; case 't' : if ( ! strncmp ( name , "proxy.config.http.anonymize_remove_user_agent" , length ) ) { cnf = TS_CONFIG_HTTP_ANONYMIZE_REMOVE_USER_AGENT ; } break ; case 's' : if ( ! strncmp ( name , "proxy.config.http.connect_attempts_rr_retries" , length ) ) { cnf = TS_CONFIG_HTTP_CONNECT_ATTEMPTS_RR_RETRIES ; } else if ( ! strncmp ( name , "proxy.config.http.cache.max_open_read_retries" , length ) ) { cnf = TS_CONFIG_HTTP_CACHE_MAX_OPEN_READ_RETRIES ; } break ; case 'e' : if ( 0 == strncmp ( name , "proxy.config.http.auth_server_session_private" , length ) ) { cnf = TS_CONFIG_HTTP_AUTH_SERVER_SESSION_PRIVATE ; } break ; case 'y' : if ( ! strncmp ( name , "proxy.config.http.redirect_use_orig_cache_key" , length ) ) { cnf = TS_CONFIG_HTTP_REDIRECT_USE_ORIG_CACHE_KEY ; } break ; } break ; case 46 : switch ( name [ length - 1 ] ) { case 'e' : if ( ! strncmp ( name , "proxy.config.http.cache.ignore_client_no_cache" , length ) ) { cnf = TS_CONFIG_HTTP_CACHE_IGNORE_CLIENT_NO_CACHE ; } else if ( ! strncmp ( name , "proxy.config.http.cache.ims_on_client_no_cache" , length ) ) { cnf = TS_CONFIG_HTTP_CACHE_IMS_ON_CLIENT_NO_CACHE ; } else if ( ! strncmp ( name , "proxy.config.http.cache.ignore_server_no_cache" , length ) ) { cnf = TS_CONFIG_HTTP_CACHE_IGNORE_SERVER_NO_CACHE ; } else if ( ! strncmp ( name , "proxy.config.http.cache.heuristic_min_lifetime" , length ) ) { cnf = TS_CONFIG_HTTP_CACHE_HEURISTIC_MIN_LIFETIME ; } else if ( ! strncmp ( name , "proxy.config.http.cache.heuristic_max_lifetime" , length ) ) { cnf = TS_CONFIG_HTTP_CACHE_HEURISTIC_MAX_LIFETIME ; } else if ( ! strncmp ( name , "proxy.config.http.origin_max_connections_queue" , length ) ) { cnf = TS_CONFIG_HTTP_ORIGIN_MAX_CONNECTIONS_QUEUE ; } break ; case 'r' : if ( ! strncmp ( name , "proxy.config.http.insert_squid_x_forwarded_for" , length ) ) { cnf = TS_CONFIG_HTTP_INSERT_SQUID_X_FORWARDED_FOR ; } break ; case 's' : if ( ! strncmp ( name , "proxy.config.http.connect_attempts_max_retries" , length ) ) { cnf = TS_CONFIG_HTTP_CONNECT_ATTEMPTS_MAX_RETRIES ; } else if ( ! strncmp ( name , "proxy.config.http.cache.max_open_write_retries" , length ) ) { cnf = TS_CONFIG_HTTP_CACHE_MAX_OPEN_WRITE_RETRIES ; } break ; case 't' : if ( ! strncmp ( name , "proxy.config.http.forward.proxy_auth_to_parent" , length ) ) { cnf = TS_CONFIG_HTTP_FORWARD_PROXY_AUTH_TO_PARENT ; } break ; case 'h' : if ( 0 == strncmp ( name , "proxy.config.http.server_session_sharing.match" , length ) ) { cnf = TS_CONFIG_HTTP_SERVER_SESSION_SHARING_MATCH ; } break ; case 'n' : if ( ! strncmp ( name , "proxy.config.http.cache.open_write_fail_action" , length ) ) { cnf = TS_CONFIG_HTTP_CACHE_OPEN_WRITE_FAIL_ACTION ; } break ; } break ; case 47 : switch ( name [ length - 1 ] ) { case 'b' : if ( ! strncmp ( name , "proxy.config.http.parent_proxy.mark_down_hostdb" , length ) ) { cnf = TS_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB ; } break ; case 'd' : if ( ! strncmp ( name , "proxy.config.http.negative_revalidating_enabled" , length ) ) { cnf = TS_CONFIG_HTTP_NEGATIVE_REVALIDATING_ENABLED ; } break ; case 'e' : if ( ! strncmp ( name , "proxy.config.http.cache.guaranteed_min_lifetime" , length ) ) { cnf = TS_CONFIG_HTTP_CACHE_GUARANTEED_MIN_LIFETIME ; } else if ( ! strncmp ( name , "proxy.config.http.cache.guaranteed_max_lifetime" , length ) ) { cnf = TS_CONFIG_HTTP_CACHE_GUARANTEED_MAX_LIFETIME ; } break ; case 'n' : if ( ! strncmp ( name , "proxy.config.http.transaction_active_timeout_in" , length ) ) { cnf = TS_CONFIG_HTTP_TRANSACTION_ACTIVE_TIMEOUT_IN ; } break ; case 't' : if ( ! strncmp ( name , "proxy.config.http.post_connect_attempts_timeout" , length ) ) { cnf = TS_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT ; } break ; } break ; case 48 : switch ( name [ length - 1 ] ) { case 'e' : if ( ! strncmp ( name , "proxy.config.http.cache.ignore_client_cc_max_age" , length ) ) { cnf = TS_CONFIG_HTTP_CACHE_IGNORE_CLIENT_CC_MAX_AGE ; } else if ( ! strncmp ( name , "proxy.config.http.negative_revalidating_lifetime" , length ) ) { cnf = TS_CONFIG_HTTP_NEGATIVE_REVALIDATING_LIFETIME ; } break ; case 't' : switch ( name [ length - 4 ] ) { case '_' : if ( ! strncmp ( name , "proxy.config.http.transaction_active_timeout_out" , length ) ) { cnf = TS_CONFIG_HTTP_TRANSACTION_ACTIVE_TIMEOUT_OUT ; } break ; case 'e' : if ( ! strncmp ( name , "proxy.config.http.background_fill_active_timeout" , length ) ) { cnf = TS_CONFIG_HTTP_BACKGROUND_FILL_ACTIVE_TIMEOUT ; } break ; } break ; } break ; case 49 : if ( ! strncmp ( name , "proxy.config.http.attach_server_session_to_client" , length ) ) { cnf = TS_CONFIG_HTTP_ATTACH_SERVER_SESSION_TO_CLIENT ; } break ; case 50 : if ( ! strncmp ( name , "proxy.config.http.cache.cache_responses_to_cookies" , length ) ) { cnf = TS_CONFIG_HTTP_CACHE_CACHE_RESPONSES_TO_COOKIES ; } break ; case 51 : switch ( name [ length - 1 ] ) { case 'n' : if ( ! strncmp ( name , "proxy.config.http.keep_alive_no_activity_timeout_in" , length ) ) { cnf = TS_CONFIG_HTTP_KEEP_ALIVE_NO_ACTIVITY_TIMEOUT_IN ; } break ; case 'd' : if ( ! strncmp ( name , "proxy.config.http.post.check.content_length.enabled" , length ) ) { cnf = TS_CONFIG_HTTP_POST_CHECK_CONTENT_LENGTH_ENABLED ; } break ; } break ; case 52 : switch ( name [ length - 1 ] ) { case 'c' : if ( ! strncmp ( name , "proxy.config.http.cache.cache_urls_that_look_dynamic" , length ) ) { cnf = TS_CONFIG_HTTP_CACHE_CACHE_URLS_THAT_LOOK_DYNAMIC ; } break ; case 'n' : if ( ! strncmp ( name , "proxy.config.http.transaction_no_activity_timeout_in" , length ) ) { cnf = TS_CONFIG_HTTP_TRANSACTION_NO_ACTIVITY_TIMEOUT_IN ; } break ; case 't' : if ( ! strncmp ( name , "proxy.config.http.keep_alive_no_activity_timeout_out" , length ) ) { cnf = TS_CONFIG_HTTP_KEEP_ALIVE_NO_ACTIVITY_TIMEOUT_OUT ; } else if ( ! strncmp ( name , "proxy.config.http.uncacheable_requests_bypass_parent" , length ) ) { cnf = TS_CONFIG_HTTP_UNCACHEABLE_REQUESTS_BYPASS_PARENT ; } break ; } break ; case 53 : switch ( name [ length - 1 ] ) { case 't' : if ( ! strncmp ( name , "proxy.config.http.transaction_no_activity_timeout_out" , length ) ) { cnf = TS_CONFIG_HTTP_TRANSACTION_NO_ACTIVITY_TIMEOUT_OUT ; } break ; case 'd' : if ( ! strncmp ( name , "proxy.config.http.background_fill_completed_threshold" , length ) ) { typ = TS_RECORDDATATYPE_FLOAT ; cnf = TS_CONFIG_HTTP_BACKGROUND_FILL_COMPLETED_THRESHOLD ; } break ; case 's' : if ( ! strncmp ( name , "proxy.config.http.parent_proxy.total_connect_attempts" , length ) ) { cnf = TS_CONFIG_HTTP_PARENT_PROXY_TOTAL_CONNECT_ATTEMPTS ; } break ; } break ; case 55 : if ( ! strncmp ( name , "proxy.config.http.parent_proxy.connect_attempts_timeout" , length ) ) { cnf = TS_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT ; } break ; case 58 : if ( ! strncmp ( name , "proxy.config.http.connect_attempts_max_retries_dead_server" , length ) ) { cnf = TS_CONFIG_HTTP_CONNECT_ATTEMPTS_MAX_RETRIES_DEAD_SERVER ; } else if ( ! strncmp ( name , "proxy.config.http.parent_proxy.per_parent_connect_attempts" , length ) ) { cnf = TS_CONFIG_HTTP_PER_PARENT_CONNECT_ATTEMPTS ; } break ; } * conf = cnf ; if ( type ) { * type = typ ; } return ( ( cnf != TS_CONFIG_NULL ) ? TS_SUCCESS : TS_ERROR ) ; }
740
1
delete_principal_2_svc(dprinc_arg *arg, struct svc_req *rqstp) { static generic_ret ret; char *prime_arg; gss_buffer_desc client_name, service_name; OM_uint32 minor_stat; kadm5_server_handle_t handle; const char *errmsg = NULL; xdr_free(xdr_generic_ret, &ret); if ((ret.code = new_server_handle(arg->api_version, rqstp, &handle))) goto exit_func; if ((ret.code = check_handle((void *)handle))) goto exit_func; ret.api_version = handle->api_version; if (setup_gss_names(rqstp, &client_name, &service_name) < 0) { ret.code = KADM5_FAILURE; goto exit_func; } if (krb5_unparse_name(handle->context, arg->princ, &prime_arg)) { ret.code = KADM5_BAD_PRINCIPAL; goto exit_func; } if (CHANGEPW_SERVICE(rqstp) || !kadm5int_acl_check(handle->context, rqst2name(rqstp), ACL_DELETE, arg->princ, NULL)) { ret.code = KADM5_AUTH_DELETE; log_unauth("kadm5_delete_principal", prime_arg, &client_name, &service_name, rqstp); } else { ret.code = kadm5_delete_principal((void *)handle, arg->princ); if( ret.code != 0 ) errmsg = krb5_get_error_message(handle->context, ret.code); log_done("kadm5_delete_principal", prime_arg, errmsg, &client_name, &service_name, rqstp); if (errmsg != NULL) krb5_free_error_message(handle->context, errmsg); } free(prime_arg); gss_release_buffer(&minor_stat, &client_name); gss_release_buffer(&minor_stat, &service_name); exit_func: free_server_handle(handle); return &ret; }
742
0
void pc_machine_done(Notifier *notifier, void *data) { PCMachineState *pcms = container_of(notifier, PCMachineState, machine_done); PCIBus *bus = pcms->bus; /* set the number of CPUs */ rtc_set_cpus_count(pcms->rtc, pcms->boot_cpus); if (bus) { int extra_hosts = 0; QLIST_FOREACH(bus, &bus->child, sibling) { /* look for expander root buses */ if (pci_bus_is_root(bus)) { extra_hosts++; } } if (extra_hosts && pcms->fw_cfg) { uint64_t *val = g_malloc(sizeof(*val)); *val = cpu_to_le64(extra_hosts); fw_cfg_add_file(pcms->fw_cfg, "etc/extra-pci-roots", val, sizeof(*val)); } } acpi_setup(); if (pcms->fw_cfg) { pc_build_smbios(pcms); pc_build_feature_control_file(pcms); /* update FW_CFG_NB_CPUS to account for -device added CPUs */ fw_cfg_modify_i16(pcms->fw_cfg, FW_CFG_NB_CPUS, pcms->boot_cpus); } if (pcms->apic_id_limit > 255) { IntelIOMMUState *iommu = INTEL_IOMMU_DEVICE(x86_iommu_get_default()); if (!iommu || !iommu->x86_iommu.intr_supported || iommu->intr_eim != ON_OFF_AUTO_ON) { error_report("current -smp configuration requires " "Extended Interrupt Mode enabled. " "You can add an IOMMU using: " "-device intel-iommu,intremap=on,eim=on"); exit(EXIT_FAILURE); } } }
743