id
int32
0
27.3k
func
stringlengths
26
142k
target
bool
2 classes
project
stringclasses
2 values
commit_id
stringlengths
40
40
func_clean
stringlengths
26
131k
vul_lines
dict
normalized_func
stringlengths
24
132k
lines
listlengths
1
2.8k
label
listlengths
1
2.8k
line_no
listlengths
1
2.8k
8,352
void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp) { int ret; int status; pid_t pid; Error *local_err = NULL; struct timeval tv; /* If user has passed a time, validate and set it. */ if (has_time) { /* year-2038 will overflow in case time_t is 32bit */ if (time_ns / 1000000000 != (time_t)(time_ns / 1000000000)) { error_setg(errp, "Time %" PRId64 " is too large", time_ns); return; } tv.tv_sec = time_ns / 1000000000; tv.tv_usec = (time_ns % 1000000000) / 1000; g_date_set_time_t(&date, tv.tv_sec); if (date.year < 1970 || date.year >= 2070) { error_setg_errno(errp, errno, "Invalid time"); return; } ret = settimeofday(&tv, NULL); if (ret < 0) { error_setg_errno(errp, errno, "Failed to set time to guest"); return; } } /* Now, if user has passed a time to set and the system time is set, we * just need to synchronize the hardware clock. However, if no time was * passed, user is requesting the opposite: set the system time from the * hardware clock (RTC). */ pid = fork(); if (pid == 0) { setsid(); reopen_fd_to_null(0); reopen_fd_to_null(1); reopen_fd_to_null(2); /* Use '/sbin/hwclock -w' to set RTC from the system time, * or '/sbin/hwclock -s' to set the system time from RTC. */ execle("/sbin/hwclock", "hwclock", has_time ? "-w" : "-s", NULL, environ); _exit(EXIT_FAILURE); } else if (pid < 0) { error_setg_errno(errp, errno, "failed to create child process"); return; } ga_wait_child(pid, &status, &local_err); if (local_err) { error_propagate(errp, local_err); return; } if (!WIFEXITED(status)) { error_setg(errp, "child process has terminated abnormally"); return; } if (WEXITSTATUS(status)) { error_setg(errp, "hwclock failed to set hardware clock to system time"); return; } }
true
qemu
00d2f3707a63881a0cec8d00cbd467f9b2d8af41
void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp) { int ret; int status; pid_t pid; Error *local_err = NULL; struct timeval tv; if (has_time) { if (time_ns / 1000000000 != (time_t)(time_ns / 1000000000)) { error_setg(errp, "Time %" PRId64 " is too large", time_ns); return; } tv.tv_sec = time_ns / 1000000000; tv.tv_usec = (time_ns % 1000000000) / 1000; g_date_set_time_t(&date, tv.tv_sec); if (date.year < 1970 || date.year >= 2070) { error_setg_errno(errp, errno, "Invalid time"); return; } ret = settimeofday(&tv, NULL); if (ret < 0) { error_setg_errno(errp, errno, "Failed to set time to guest"); return; } } pid = fork(); if (pid == 0) { setsid(); reopen_fd_to_null(0); reopen_fd_to_null(1); reopen_fd_to_null(2); execle("/sbin/hwclock", "hwclock", has_time ? "-w" : "-s", NULL, environ); _exit(EXIT_FAILURE); } else if (pid < 0) { error_setg_errno(errp, errno, "failed to create child process"); return; } ga_wait_child(pid, &status, &local_err); if (local_err) { error_propagate(errp, local_err); return; } if (!WIFEXITED(status)) { error_setg(errp, "child process has terminated abnormally"); return; } if (WEXITSTATUS(status)) { error_setg(errp, "hwclock failed to set hardware clock to system time"); return; } }
{ "code": [], "line_no": [] }
void FUNC_0(bool VAR_0, int64_t VAR_1, Error **VAR_2) { int VAR_3; int VAR_4; pid_t pid; Error *local_err = NULL; struct timeval VAR_5; if (VAR_0) { if (VAR_1 / 1000000000 != (time_t)(VAR_1 / 1000000000)) { error_setg(VAR_2, "Time %" PRId64 " is too large", VAR_1); return; } VAR_5.tv_sec = VAR_1 / 1000000000; VAR_5.tv_usec = (VAR_1 % 1000000000) / 1000; g_date_set_time_t(&date, VAR_5.tv_sec); if (date.year < 1970 || date.year >= 2070) { error_setg_errno(VAR_2, errno, "Invalid time"); return; } VAR_3 = settimeofday(&VAR_5, NULL); if (VAR_3 < 0) { error_setg_errno(VAR_2, errno, "Failed to set time to guest"); return; } } pid = fork(); if (pid == 0) { setsid(); reopen_fd_to_null(0); reopen_fd_to_null(1); reopen_fd_to_null(2); execle("/sbin/hwclock", "hwclock", VAR_0 ? "-w" : "-s", NULL, environ); _exit(EXIT_FAILURE); } else if (pid < 0) { error_setg_errno(VAR_2, errno, "failed to create child process"); return; } ga_wait_child(pid, &VAR_4, &local_err); if (local_err) { error_propagate(VAR_2, local_err); return; } if (!WIFEXITED(VAR_4)) { error_setg(VAR_2, "child process has terminated abnormally"); return; } if (WEXITSTATUS(VAR_4)) { error_setg(VAR_2, "hwclock failed to set hardware clock to system time"); return; } }
[ "void FUNC_0(bool VAR_0, int64_t VAR_1, Error **VAR_2)\n{", "int VAR_3;", "int VAR_4;", "pid_t pid;", "Error *local_err = NULL;", "struct timeval VAR_5;", "if (VAR_0) {", "if (VAR_1 / 1000000000 != (time_t)(VAR_1 / 1000000000)) {", "error_setg(VAR_2, \"Time %\" PRId64 \" is too large\", VAR_1);", "return;", "}", "VAR_5.tv_sec = VAR_1 / 1000000000;", "VAR_5.tv_usec = (VAR_1 % 1000000000) / 1000;", "g_date_set_time_t(&date, VAR_5.tv_sec);", "if (date.year < 1970 || date.year >= 2070) {", "error_setg_errno(VAR_2, errno, \"Invalid time\");", "return;", "}", "VAR_3 = settimeofday(&VAR_5, NULL);", "if (VAR_3 < 0) {", "error_setg_errno(VAR_2, errno, \"Failed to set time to guest\");", "return;", "}", "}", "pid = fork();", "if (pid == 0) {", "setsid();", "reopen_fd_to_null(0);", "reopen_fd_to_null(1);", "reopen_fd_to_null(2);", "execle(\"/sbin/hwclock\", \"hwclock\", VAR_0 ? \"-w\" : \"-s\",\nNULL, environ);", "_exit(EXIT_FAILURE);", "} else if (pid < 0) {", "error_setg_errno(VAR_2, errno, \"failed to create child process\");", "return;", "}", "ga_wait_child(pid, &VAR_4, &local_err);", "if (local_err) {", "error_propagate(VAR_2, local_err);", "return;", "}", "if (!WIFEXITED(VAR_4)) {", "error_setg(VAR_2, \"child process has terminated abnormally\");", "return;", "}", "if (WEXITSTATUS(VAR_4)) {", "error_setg(VAR_2, \"hwclock failed to set hardware clock to system time\");", "return;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 9 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17 ], [ 18 ], [ 19 ], [ 20 ], [ 21 ], [ 22 ], [ 23 ], [ 24 ], [ 25 ], [ 26 ], [ 27 ], [ 32 ], [ 33 ], [ 34 ], [ 35 ], [ 36 ], [ 37 ], [ 40, 41 ], [ 42 ], [ 43 ], [ 44 ], [ 45 ], [ 46 ], [ 47 ], [ 48 ], [ 49 ], [ 50 ], [ 51 ], [ 52 ], [ 53 ], [ 54 ], [ 55 ], [ 56 ], [ 57 ], [ 58 ], [ 59 ], [ 60 ] ]
8,353
static int posix_aio_init(void) { sigset_t mask; PosixAioState *s; if (posix_aio_state) return 0; s = qemu_malloc(sizeof(PosixAioState)); if (s == NULL) return -ENOMEM; /* Make sure to block AIO signal */ sigemptyset(&mask); sigaddset(&mask, SIGUSR2); sigprocmask(SIG_BLOCK, &mask, NULL); s->first_aio = NULL; s->fd = qemu_signalfd(&mask); if (s->fd == -1) { fprintf(stderr, "failed to create signalfd\n"); return -errno; } fcntl(s->fd, F_SETFL, O_NONBLOCK); qemu_aio_set_fd_handler(s->fd, posix_aio_read, NULL, posix_aio_flush, s); #if defined(__linux__) { struct aioinit ai; memset(&ai, 0, sizeof(ai)); #if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 4) ai.aio_threads = 64; ai.aio_num = 64; #else /* XXX: aio thread exit seems to hang on RedHat 9 and this init seems to fix the problem. */ ai.aio_threads = 1; ai.aio_num = 1; ai.aio_idle_time = 365 * 100000; #endif aio_init(&ai); } #endif posix_aio_state = s; return 0; }
true
qemu
9e472e101f37233f4e32d181d2fee29014c1cf2f
static int posix_aio_init(void) { sigset_t mask; PosixAioState *s; if (posix_aio_state) return 0; s = qemu_malloc(sizeof(PosixAioState)); if (s == NULL) return -ENOMEM; sigemptyset(&mask); sigaddset(&mask, SIGUSR2); sigprocmask(SIG_BLOCK, &mask, NULL); s->first_aio = NULL; s->fd = qemu_signalfd(&mask); if (s->fd == -1) { fprintf(stderr, "failed to create signalfd\n"); return -errno; } fcntl(s->fd, F_SETFL, O_NONBLOCK); qemu_aio_set_fd_handler(s->fd, posix_aio_read, NULL, posix_aio_flush, s); #if defined(__linux__) { struct aioinit ai; memset(&ai, 0, sizeof(ai)); #if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 4) ai.aio_threads = 64; ai.aio_num = 64; #else ai.aio_threads = 1; ai.aio_num = 1; ai.aio_idle_time = 365 * 100000; #endif aio_init(&ai); } #endif posix_aio_state = s; return 0; }
{ "code": [ " sigset_t mask;", " sigemptyset(&mask);", " sigaddset(&mask, SIGUSR2);", " sigprocmask(SIG_BLOCK, &mask, NULL);", " s->fd = qemu_signalfd(&mask);", " if (s->fd == -1) {", " fprintf(stderr, \"failed to create signalfd\\n\");", " fcntl(s->fd, F_SETFL, O_NONBLOCK);", " qemu_aio_set_fd_handler(s->fd, posix_aio_read, NULL, posix_aio_flush, s);", " sigset_t mask;", "#endif", " return 0;", "#endif", "#endif" ], "line_no": [ 5, 27, 29, 31, 37, 39, 41, 49, 53, 5, 85, 13, 85, 85 ] }
static int FUNC_0(void) { sigset_t mask; PosixAioState *s; if (posix_aio_state) return 0; s = qemu_malloc(sizeof(PosixAioState)); if (s == NULL) return -ENOMEM; sigemptyset(&mask); sigaddset(&mask, SIGUSR2); sigprocmask(SIG_BLOCK, &mask, NULL); s->first_aio = NULL; s->fd = qemu_signalfd(&mask); if (s->fd == -1) { fprintf(stderr, "failed to create signalfd\n"); return -errno; } fcntl(s->fd, F_SETFL, O_NONBLOCK); qemu_aio_set_fd_handler(s->fd, posix_aio_read, NULL, posix_aio_flush, s); #if defined(__linux__) { struct aioinit ai; memset(&ai, 0, sizeof(ai)); #if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 4) ai.aio_threads = 64; ai.aio_num = 64; #else ai.aio_threads = 1; ai.aio_num = 1; ai.aio_idle_time = 365 * 100000; #endif aio_init(&ai); } #endif posix_aio_state = s; return 0; }
[ "static int FUNC_0(void)\n{", "sigset_t mask;", "PosixAioState *s;", "if (posix_aio_state)\nreturn 0;", "s = qemu_malloc(sizeof(PosixAioState));", "if (s == NULL)\nreturn -ENOMEM;", "sigemptyset(&mask);", "sigaddset(&mask, SIGUSR2);", "sigprocmask(SIG_BLOCK, &mask, NULL);", "s->first_aio = NULL;", "s->fd = qemu_signalfd(&mask);", "if (s->fd == -1) {", "fprintf(stderr, \"failed to create signalfd\\n\");", "return -errno;", "}", "fcntl(s->fd, F_SETFL, O_NONBLOCK);", "qemu_aio_set_fd_handler(s->fd, posix_aio_read, NULL, posix_aio_flush, s);", "#if defined(__linux__)\n{", "struct aioinit ai;", "memset(&ai, 0, sizeof(ai));", "#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 4)\nai.aio_threads = 64;", "ai.aio_num = 64;", "#else\nai.aio_threads = 1;", "ai.aio_num = 1;", "ai.aio_idle_time = 365 * 100000;", "#endif\naio_init(&ai);", "}", "#endif\nposix_aio_state = s;", "return 0;", "}" ]
[ 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 17 ], [ 19, 21 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 53 ], [ 57, 59 ], [ 61 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73, 79 ], [ 81 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 91, 93 ], [ 97 ], [ 99 ] ]
8,354
static void vp8_idct_dc_add4y_c(uint8_t *dst, int16_t block[4][16], ptrdiff_t stride) { vp8_idct_dc_add_c(dst + 0, block[0], stride); vp8_idct_dc_add_c(dst + 4, block[1], stride); vp8_idct_dc_add_c(dst + 8, block[2], stride); vp8_idct_dc_add_c(dst + 12, block[3], stride); }
true
FFmpeg
ac4b32df71bd932838043a4838b86d11e169707f
static void vp8_idct_dc_add4y_c(uint8_t *dst, int16_t block[4][16], ptrdiff_t stride) { vp8_idct_dc_add_c(dst + 0, block[0], stride); vp8_idct_dc_add_c(dst + 4, block[1], stride); vp8_idct_dc_add_c(dst + 8, block[2], stride); vp8_idct_dc_add_c(dst + 12, block[3], stride); }
{ "code": [ "static void vp8_idct_dc_add4y_c(uint8_t *dst, int16_t block[4][16],", " ptrdiff_t stride)", " vp8_idct_dc_add_c(dst + 0, block[0], stride);", " vp8_idct_dc_add_c(dst + 4, block[1], stride);", " vp8_idct_dc_add_c(dst + 8, block[2], stride);", " vp8_idct_dc_add_c(dst + 12, block[3], stride);" ], "line_no": [ 1, 3, 7, 9, 11, 13 ] }
static void FUNC_0(uint8_t *VAR_0, int16_t VAR_1[4][16], ptrdiff_t VAR_2) { vp8_idct_dc_add_c(VAR_0 + 0, VAR_1[0], VAR_2); vp8_idct_dc_add_c(VAR_0 + 4, VAR_1[1], VAR_2); vp8_idct_dc_add_c(VAR_0 + 8, VAR_1[2], VAR_2); vp8_idct_dc_add_c(VAR_0 + 12, VAR_1[3], VAR_2); }
[ "static void FUNC_0(uint8_t *VAR_0, int16_t VAR_1[4][16],\nptrdiff_t VAR_2)\n{", "vp8_idct_dc_add_c(VAR_0 + 0, VAR_1[0], VAR_2);", "vp8_idct_dc_add_c(VAR_0 + 4, VAR_1[1], VAR_2);", "vp8_idct_dc_add_c(VAR_0 + 8, VAR_1[2], VAR_2);", "vp8_idct_dc_add_c(VAR_0 + 12, VAR_1[3], VAR_2);", "}" ]
[ 1, 1, 1, 1, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
8,355
void ff_frame_thread_encoder_free(AVCodecContext *avctx){ int i; ThreadContext *c= avctx->internal->frame_thread_encoder; pthread_mutex_lock(&c->task_fifo_mutex); c->exit = 1; pthread_cond_broadcast(&c->task_fifo_cond); pthread_mutex_unlock(&c->task_fifo_mutex); for (i=0; i<avctx->thread_count; i++) { pthread_join(c->worker[i], NULL); } pthread_mutex_destroy(&c->task_fifo_mutex); pthread_mutex_destroy(&c->finished_task_mutex); pthread_mutex_destroy(&c->buffer_mutex); pthread_cond_destroy(&c->task_fifo_cond); pthread_cond_destroy(&c->finished_task_cond); av_fifo_freep(&c->task_fifo); av_freep(&avctx->internal->frame_thread_encoder); }
true
FFmpeg
183216b21870f21c86c904a7530d53682d7db46d
void ff_frame_thread_encoder_free(AVCodecContext *avctx){ int i; ThreadContext *c= avctx->internal->frame_thread_encoder; pthread_mutex_lock(&c->task_fifo_mutex); c->exit = 1; pthread_cond_broadcast(&c->task_fifo_cond); pthread_mutex_unlock(&c->task_fifo_mutex); for (i=0; i<avctx->thread_count; i++) { pthread_join(c->worker[i], NULL); } pthread_mutex_destroy(&c->task_fifo_mutex); pthread_mutex_destroy(&c->finished_task_mutex); pthread_mutex_destroy(&c->buffer_mutex); pthread_cond_destroy(&c->task_fifo_cond); pthread_cond_destroy(&c->finished_task_cond); av_fifo_freep(&c->task_fifo); av_freep(&avctx->internal->frame_thread_encoder); }
{ "code": [ " c->exit = 1;" ], "line_no": [ 11 ] }
void FUNC_0(AVCodecContext *VAR_0){ int VAR_1; ThreadContext *c= VAR_0->internal->frame_thread_encoder; pthread_mutex_lock(&c->task_fifo_mutex); c->exit = 1; pthread_cond_broadcast(&c->task_fifo_cond); pthread_mutex_unlock(&c->task_fifo_mutex); for (VAR_1=0; VAR_1<VAR_0->thread_count; VAR_1++) { pthread_join(c->worker[VAR_1], NULL); } pthread_mutex_destroy(&c->task_fifo_mutex); pthread_mutex_destroy(&c->finished_task_mutex); pthread_mutex_destroy(&c->buffer_mutex); pthread_cond_destroy(&c->task_fifo_cond); pthread_cond_destroy(&c->finished_task_cond); av_fifo_freep(&c->task_fifo); av_freep(&VAR_0->internal->frame_thread_encoder); }
[ "void FUNC_0(AVCodecContext *VAR_0){", "int VAR_1;", "ThreadContext *c= VAR_0->internal->frame_thread_encoder;", "pthread_mutex_lock(&c->task_fifo_mutex);", "c->exit = 1;", "pthread_cond_broadcast(&c->task_fifo_cond);", "pthread_mutex_unlock(&c->task_fifo_mutex);", "for (VAR_1=0; VAR_1<VAR_0->thread_count; VAR_1++) {", "pthread_join(c->worker[VAR_1], NULL);", "}", "pthread_mutex_destroy(&c->task_fifo_mutex);", "pthread_mutex_destroy(&c->finished_task_mutex);", "pthread_mutex_destroy(&c->buffer_mutex);", "pthread_cond_destroy(&c->task_fifo_cond);", "pthread_cond_destroy(&c->finished_task_cond);", "av_fifo_freep(&c->task_fifo);", "av_freep(&VAR_0->internal->frame_thread_encoder);", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ] ]
8,356
static void build_fs_mount_list_from_mtab(FsMountList *mounts, Error **errp) { struct mntent *ment; FsMount *mount; char const *mtab = "/proc/self/mounts"; FILE *fp; unsigned int devmajor, devminor; fp = setmntent(mtab, "r"); if (!fp) { error_setg(errp, "failed to open mtab file: '%s'", mtab); return; } while ((ment = getmntent(fp))) { /* * An entry which device name doesn't start with a '/' is * either a dummy file system or a network file system. * Add special handling for smbfs and cifs as is done by * coreutils as well. */ if ((ment->mnt_fsname[0] != '/') || (strcmp(ment->mnt_type, "smbfs") == 0) || (strcmp(ment->mnt_type, "cifs") == 0)) { continue; } if (dev_major_minor(ment->mnt_fsname, &devmajor, &devminor) == -2) { /* Skip bind mounts */ continue; } mount = g_malloc0(sizeof(FsMount)); mount->dirname = g_strdup(ment->mnt_dir); mount->devtype = g_strdup(ment->mnt_type); mount->devmajor = devmajor; mount->devminor = devminor; QTAILQ_INSERT_TAIL(mounts, mount, next); } endmntent(fp); }
true
qemu
f3a06403b82c7f036564e4caf18b52ce6885fcfb
static void build_fs_mount_list_from_mtab(FsMountList *mounts, Error **errp) { struct mntent *ment; FsMount *mount; char const *mtab = "/proc/self/mounts"; FILE *fp; unsigned int devmajor, devminor; fp = setmntent(mtab, "r"); if (!fp) { error_setg(errp, "failed to open mtab file: '%s'", mtab); return; } while ((ment = getmntent(fp))) { if ((ment->mnt_fsname[0] != '/') || (strcmp(ment->mnt_type, "smbfs") == 0) || (strcmp(ment->mnt_type, "cifs") == 0)) { continue; } if (dev_major_minor(ment->mnt_fsname, &devmajor, &devminor) == -2) { continue; } mount = g_malloc0(sizeof(FsMount)); mount->dirname = g_strdup(ment->mnt_dir); mount->devtype = g_strdup(ment->mnt_type); mount->devmajor = devmajor; mount->devminor = devminor; QTAILQ_INSERT_TAIL(mounts, mount, next); } endmntent(fp); }
{ "code": [ " mount = g_malloc0(sizeof(FsMount));", " mount = g_malloc0(sizeof(FsMount));" ], "line_no": [ 63, 63 ] }
static void FUNC_0(FsMountList *VAR_0, Error **VAR_1) { struct mntent *VAR_2; FsMount *mount; char const *VAR_3 = "/proc/self/VAR_0"; FILE *fp; unsigned int VAR_4, VAR_5; fp = setmntent(VAR_3, "r"); if (!fp) { error_setg(VAR_1, "failed to open VAR_3 file: '%s'", VAR_3); return; } while ((VAR_2 = getmntent(fp))) { if ((VAR_2->mnt_fsname[0] != '/') || (strcmp(VAR_2->mnt_type, "smbfs") == 0) || (strcmp(VAR_2->mnt_type, "cifs") == 0)) { continue; } if (dev_major_minor(VAR_2->mnt_fsname, &VAR_4, &VAR_5) == -2) { continue; } mount = g_malloc0(sizeof(FsMount)); mount->dirname = g_strdup(VAR_2->mnt_dir); mount->devtype = g_strdup(VAR_2->mnt_type); mount->VAR_4 = VAR_4; mount->VAR_5 = VAR_5; QTAILQ_INSERT_TAIL(VAR_0, mount, next); } endmntent(fp); }
[ "static void FUNC_0(FsMountList *VAR_0, Error **VAR_1)\n{", "struct mntent *VAR_2;", "FsMount *mount;", "char const *VAR_3 = \"/proc/self/VAR_0\";", "FILE *fp;", "unsigned int VAR_4, VAR_5;", "fp = setmntent(VAR_3, \"r\");", "if (!fp) {", "error_setg(VAR_1, \"failed to open VAR_3 file: '%s'\", VAR_3);", "return;", "}", "while ((VAR_2 = getmntent(fp))) {", "if ((VAR_2->mnt_fsname[0] != '/') ||\n(strcmp(VAR_2->mnt_type, \"smbfs\") == 0) ||\n(strcmp(VAR_2->mnt_type, \"cifs\") == 0)) {", "continue;", "}", "if (dev_major_minor(VAR_2->mnt_fsname, &VAR_4, &VAR_5) == -2) {", "continue;", "}", "mount = g_malloc0(sizeof(FsMount));", "mount->dirname = g_strdup(VAR_2->mnt_dir);", "mount->devtype = g_strdup(VAR_2->mnt_type);", "mount->VAR_4 = VAR_4;", "mount->VAR_5 = VAR_5;", "QTAILQ_INSERT_TAIL(VAR_0, mount, next);", "}", "endmntent(fp);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 43, 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ] ]
8,358
static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; int version; char language[4] = {0}; unsigned lang; int64_t creation_time; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; if (sc->time_scale) { av_log(c->fc, AV_LOG_ERROR, "Multiple mdhd?\n"); return AVERROR_INVALIDDATA; } version = avio_r8(pb); if (version > 1) { avpriv_request_sample(c->fc, "Version %d", version); return AVERROR_PATCHWELCOME; } avio_rb24(pb); /* flags */ if (version == 1) { creation_time = avio_rb64(pb); avio_rb64(pb); } else { creation_time = avio_rb32(pb); avio_rb32(pb); /* modification time */ } mov_metadata_creation_time(&st->metadata, creation_time); sc->time_scale = avio_rb32(pb); if (sc->time_scale <= 0) { av_log(c->fc, AV_LOG_ERROR, "Invalid mdhd time scale %d\n", sc->time_scale); return AVERROR_INVALIDDATA; } st->duration = (version == 1) ? avio_rb64(pb) : avio_rb32(pb); /* duration */ lang = avio_rb16(pb); /* language */ if (ff_mov_lang_to_iso639(lang, language)) av_dict_set(&st->metadata, "language", language, 0); avio_rb16(pb); /* quality */ return 0; }
false
FFmpeg
ab61b79b1c707a9ea0512238d837ea3e8b8395ed
static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; int version; char language[4] = {0}; unsigned lang; int64_t creation_time; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; if (sc->time_scale) { av_log(c->fc, AV_LOG_ERROR, "Multiple mdhd?\n"); return AVERROR_INVALIDDATA; } version = avio_r8(pb); if (version > 1) { avpriv_request_sample(c->fc, "Version %d", version); return AVERROR_PATCHWELCOME; } avio_rb24(pb); if (version == 1) { creation_time = avio_rb64(pb); avio_rb64(pb); } else { creation_time = avio_rb32(pb); avio_rb32(pb); } mov_metadata_creation_time(&st->metadata, creation_time); sc->time_scale = avio_rb32(pb); if (sc->time_scale <= 0) { av_log(c->fc, AV_LOG_ERROR, "Invalid mdhd time scale %d\n", sc->time_scale); return AVERROR_INVALIDDATA; } st->duration = (version == 1) ? avio_rb64(pb) : avio_rb32(pb); lang = avio_rb16(pb); if (ff_mov_lang_to_iso639(lang, language)) av_dict_set(&st->metadata, "language", language, 0); avio_rb16(pb); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2) { AVStream *st; MOVStreamContext *sc; int VAR_3; char VAR_4[4] = {0}; unsigned VAR_5; int64_t creation_time; if (VAR_0->fc->nb_streams < 1) return 0; st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1]; sc = st->priv_data; if (sc->time_scale) { av_log(VAR_0->fc, AV_LOG_ERROR, "Multiple mdhd?\n"); return AVERROR_INVALIDDATA; } VAR_3 = avio_r8(VAR_1); if (VAR_3 > 1) { avpriv_request_sample(VAR_0->fc, "Version %d", VAR_3); return AVERROR_PATCHWELCOME; } avio_rb24(VAR_1); if (VAR_3 == 1) { creation_time = avio_rb64(VAR_1); avio_rb64(VAR_1); } else { creation_time = avio_rb32(VAR_1); avio_rb32(VAR_1); } mov_metadata_creation_time(&st->metadata, creation_time); sc->time_scale = avio_rb32(VAR_1); if (sc->time_scale <= 0) { av_log(VAR_0->fc, AV_LOG_ERROR, "Invalid mdhd time scale %d\n", sc->time_scale); return AVERROR_INVALIDDATA; } st->duration = (VAR_3 == 1) ? avio_rb64(VAR_1) : avio_rb32(VAR_1); VAR_5 = avio_rb16(VAR_1); if (ff_mov_lang_to_iso639(VAR_5, VAR_4)) av_dict_set(&st->metadata, "VAR_4", VAR_4, 0); avio_rb16(VAR_1); return 0; }
[ "static int FUNC_0(MOVContext *VAR_0, AVIOContext *VAR_1, MOVAtom VAR_2)\n{", "AVStream *st;", "MOVStreamContext *sc;", "int VAR_3;", "char VAR_4[4] = {0};", "unsigned VAR_5;", "int64_t creation_time;", "if (VAR_0->fc->nb_streams < 1)\nreturn 0;", "st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1];", "sc = st->priv_data;", "if (sc->time_scale) {", "av_log(VAR_0->fc, AV_LOG_ERROR, \"Multiple mdhd?\\n\");", "return AVERROR_INVALIDDATA;", "}", "VAR_3 = avio_r8(VAR_1);", "if (VAR_3 > 1) {", "avpriv_request_sample(VAR_0->fc, \"Version %d\", VAR_3);", "return AVERROR_PATCHWELCOME;", "}", "avio_rb24(VAR_1);", "if (VAR_3 == 1) {", "creation_time = avio_rb64(VAR_1);", "avio_rb64(VAR_1);", "} else {", "creation_time = avio_rb32(VAR_1);", "avio_rb32(VAR_1);", "}", "mov_metadata_creation_time(&st->metadata, creation_time);", "sc->time_scale = avio_rb32(VAR_1);", "if (sc->time_scale <= 0) {", "av_log(VAR_0->fc, AV_LOG_ERROR, \"Invalid mdhd time scale %d\\n\", sc->time_scale);", "return AVERROR_INVALIDDATA;", "}", "st->duration = (VAR_3 == 1) ? avio_rb64(VAR_1) : avio_rb32(VAR_1);", "VAR_5 = avio_rb16(VAR_1);", "if (ff_mov_lang_to_iso639(VAR_5, VAR_4))\nav_dict_set(&st->metadata, \"VAR_4\", VAR_4, 0);", "avio_rb16(VAR_1);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 93 ], [ 95 ] ]
8,359
void visit_type_enum(Visitor *v, const char *name, int *obj, const char *const strings[], Error **errp) { assert(obj && strings); if (v->type == VISITOR_INPUT) { input_type_enum(v, name, obj, strings, errp); } else if (v->type == VISITOR_OUTPUT) { output_type_enum(v, name, obj, strings, errp); } }
true
qemu
a15fcc3cf69ee3d408f60d6cc316488d2b0249b4
void visit_type_enum(Visitor *v, const char *name, int *obj, const char *const strings[], Error **errp) { assert(obj && strings); if (v->type == VISITOR_INPUT) { input_type_enum(v, name, obj, strings, errp); } else if (v->type == VISITOR_OUTPUT) { output_type_enum(v, name, obj, strings, errp); } }
{ "code": [ " if (v->type == VISITOR_INPUT) {", " if (v->type == VISITOR_INPUT) {", " if (v->type == VISITOR_INPUT) {", " } else if (v->type == VISITOR_OUTPUT) {" ], "line_no": [ 9, 9, 9, 13 ] }
void FUNC_0(Visitor *VAR_0, const char *VAR_1, int *VAR_2, const char *const VAR_3[], Error **VAR_4) { assert(VAR_2 && VAR_3); if (VAR_0->type == VISITOR_INPUT) { input_type_enum(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4); } else if (VAR_0->type == VISITOR_OUTPUT) { output_type_enum(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4); } }
[ "void FUNC_0(Visitor *VAR_0, const char *VAR_1, int *VAR_2,\nconst char *const VAR_3[], Error **VAR_4)\n{", "assert(VAR_2 && VAR_3);", "if (VAR_0->type == VISITOR_INPUT) {", "input_type_enum(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4);", "} else if (VAR_0->type == VISITOR_OUTPUT) {", "output_type_enum(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4);", "}", "}" ]
[ 0, 0, 1, 0, 1, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
8,360
av_cold int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans) { int n = 1 << nbits; int i; const double theta = (trans == RDFT || trans == IRIDFT ? -1 : 1)*2*M_PI/n; s->nbits = nbits; s->inverse = trans == IRDFT || trans == IRIDFT; s->sign_convention = trans == RIDFT || trans == IRIDFT ? 1 : -1; if (nbits < 4 || nbits > 16) return -1; if (ff_fft_init(&s->fft, nbits-1, trans == IRDFT || trans == RIDFT) < 0) return -1; s->tcos = ff_cos_tabs[nbits-4]; s->tsin = ff_sin_tabs[nbits-4]+(trans == RDFT || trans == IRIDFT)*(n>>2); for (i = 0; i < (n>>2); i++) { s->tcos[i] = cos(i*theta); s->tsin[i] = sin(i*theta); } return 0; }
true
FFmpeg
aafd659518356d1ae3624830a36816f154d94d83
av_cold int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans) { int n = 1 << nbits; int i; const double theta = (trans == RDFT || trans == IRIDFT ? -1 : 1)*2*M_PI/n; s->nbits = nbits; s->inverse = trans == IRDFT || trans == IRIDFT; s->sign_convention = trans == RIDFT || trans == IRIDFT ? 1 : -1; if (nbits < 4 || nbits > 16) return -1; if (ff_fft_init(&s->fft, nbits-1, trans == IRDFT || trans == RIDFT) < 0) return -1; s->tcos = ff_cos_tabs[nbits-4]; s->tsin = ff_sin_tabs[nbits-4]+(trans == RDFT || trans == IRIDFT)*(n>>2); for (i = 0; i < (n>>2); i++) { s->tcos[i] = cos(i*theta); s->tsin[i] = sin(i*theta); } return 0; }
{ "code": [ " s->tcos[i] = cos(i*theta);" ], "line_no": [ 39 ] }
av_cold int FUNC_0(RDFTContext *s, int nbits, enum RDFTransformType trans) { int VAR_0 = 1 << nbits; int VAR_1; const double VAR_2 = (trans == RDFT || trans == IRIDFT ? -1 : 1)*2*M_PI/VAR_0; s->nbits = nbits; s->inverse = trans == IRDFT || trans == IRIDFT; s->sign_convention = trans == RIDFT || trans == IRIDFT ? 1 : -1; if (nbits < 4 || nbits > 16) return -1; if (ff_fft_init(&s->fft, nbits-1, trans == IRDFT || trans == RIDFT) < 0) return -1; s->tcos = ff_cos_tabs[nbits-4]; s->tsin = ff_sin_tabs[nbits-4]+(trans == RDFT || trans == IRIDFT)*(VAR_0>>2); for (VAR_1 = 0; VAR_1 < (VAR_0>>2); VAR_1++) { s->tcos[VAR_1] = cos(VAR_1*VAR_2); s->tsin[VAR_1] = sin(VAR_1*VAR_2); } return 0; }
[ "av_cold int FUNC_0(RDFTContext *s, int nbits, enum RDFTransformType trans)\n{", "int VAR_0 = 1 << nbits;", "int VAR_1;", "const double VAR_2 = (trans == RDFT || trans == IRIDFT ? -1 : 1)*2*M_PI/VAR_0;", "s->nbits = nbits;", "s->inverse = trans == IRDFT || trans == IRIDFT;", "s->sign_convention = trans == RIDFT || trans == IRIDFT ? 1 : -1;", "if (nbits < 4 || nbits > 16)\nreturn -1;", "if (ff_fft_init(&s->fft, nbits-1, trans == IRDFT || trans == RIDFT) < 0)\nreturn -1;", "s->tcos = ff_cos_tabs[nbits-4];", "s->tsin = ff_sin_tabs[nbits-4]+(trans == RDFT || trans == IRIDFT)*(VAR_0>>2);", "for (VAR_1 = 0; VAR_1 < (VAR_0>>2); VAR_1++) {", "s->tcos[VAR_1] = cos(VAR_1*VAR_2);", "s->tsin[VAR_1] = sin(VAR_1*VAR_2);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 27, 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ] ]
8,361
static int qio_channel_buffer_close(QIOChannel *ioc, Error **errp) { QIOChannelBuffer *bioc = QIO_CHANNEL_BUFFER(ioc); g_free(bioc->data); bioc->capacity = bioc->usage = bioc->offset = 0; return 0; }
true
qemu
d656ec5ea823bcdb59b6512cb73b3f2f97a8308f
static int qio_channel_buffer_close(QIOChannel *ioc, Error **errp) { QIOChannelBuffer *bioc = QIO_CHANNEL_BUFFER(ioc); g_free(bioc->data); bioc->capacity = bioc->usage = bioc->offset = 0; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(QIOChannel *VAR_0, Error **VAR_1) { QIOChannelBuffer *bioc = QIO_CHANNEL_BUFFER(VAR_0); g_free(bioc->data); bioc->capacity = bioc->usage = bioc->offset = 0; return 0; }
[ "static int FUNC_0(QIOChannel *VAR_0,\nError **VAR_1)\n{", "QIOChannelBuffer *bioc = QIO_CHANNEL_BUFFER(VAR_0);", "g_free(bioc->data);", "bioc->capacity = bioc->usage = bioc->offset = 0;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 14 ], [ 18 ], [ 20 ] ]
8,362
static void cpu_4xx_wdt_cb (void *opaque) { PowerPCCPU *cpu; CPUPPCState *env; ppc_tb_t *tb_env; ppc40x_timer_t *ppc40x_timer; uint64_t now, next; env = opaque; cpu = ppc_env_get_cpu(env); tb_env = env->tb_env; ppc40x_timer = tb_env->opaque; now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); switch ((env->spr[SPR_40x_TCR] >> 30) & 0x3) { case 0: next = 1 << 17; break; case 1: next = 1 << 21; break; case 2: next = 1 << 25; break; case 3: next = 1 << 29; break; default: /* Cannot occur, but makes gcc happy */ return; } next = now + muldiv64(next, get_ticks_per_sec(), tb_env->decr_freq); if (next == now) next++; LOG_TB("%s: TCR " TARGET_FMT_lx " TSR " TARGET_FMT_lx "\n", __func__, env->spr[SPR_40x_TCR], env->spr[SPR_40x_TSR]); switch ((env->spr[SPR_40x_TSR] >> 30) & 0x3) { case 0x0: case 0x1: timer_mod(ppc40x_timer->wdt_timer, next); ppc40x_timer->wdt_next = next; env->spr[SPR_40x_TSR] |= 1 << 31; break; case 0x2: timer_mod(ppc40x_timer->wdt_timer, next); ppc40x_timer->wdt_next = next; env->spr[SPR_40x_TSR] |= 1 << 30; if ((env->spr[SPR_40x_TCR] >> 27) & 0x1) { ppc_set_irq(cpu, PPC_INTERRUPT_WDT, 1); } break; case 0x3: env->spr[SPR_40x_TSR] &= ~0x30000000; env->spr[SPR_40x_TSR] |= env->spr[SPR_40x_TCR] & 0x30000000; switch ((env->spr[SPR_40x_TCR] >> 28) & 0x3) { case 0x0: /* No reset */ break; case 0x1: /* Core reset */ ppc40x_core_reset(cpu); break; case 0x2: /* Chip reset */ ppc40x_chip_reset(cpu); break; case 0x3: /* System reset */ ppc40x_system_reset(cpu); break; } } }
true
qemu
a1f7f97b950a46393b0e55a9a0082e70f540cbbd
static void cpu_4xx_wdt_cb (void *opaque) { PowerPCCPU *cpu; CPUPPCState *env; ppc_tb_t *tb_env; ppc40x_timer_t *ppc40x_timer; uint64_t now, next; env = opaque; cpu = ppc_env_get_cpu(env); tb_env = env->tb_env; ppc40x_timer = tb_env->opaque; now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); switch ((env->spr[SPR_40x_TCR] >> 30) & 0x3) { case 0: next = 1 << 17; break; case 1: next = 1 << 21; break; case 2: next = 1 << 25; break; case 3: next = 1 << 29; break; default: return; } next = now + muldiv64(next, get_ticks_per_sec(), tb_env->decr_freq); if (next == now) next++; LOG_TB("%s: TCR " TARGET_FMT_lx " TSR " TARGET_FMT_lx "\n", __func__, env->spr[SPR_40x_TCR], env->spr[SPR_40x_TSR]); switch ((env->spr[SPR_40x_TSR] >> 30) & 0x3) { case 0x0: case 0x1: timer_mod(ppc40x_timer->wdt_timer, next); ppc40x_timer->wdt_next = next; env->spr[SPR_40x_TSR] |= 1 << 31; break; case 0x2: timer_mod(ppc40x_timer->wdt_timer, next); ppc40x_timer->wdt_next = next; env->spr[SPR_40x_TSR] |= 1 << 30; if ((env->spr[SPR_40x_TCR] >> 27) & 0x1) { ppc_set_irq(cpu, PPC_INTERRUPT_WDT, 1); } break; case 0x3: env->spr[SPR_40x_TSR] &= ~0x30000000; env->spr[SPR_40x_TSR] |= env->spr[SPR_40x_TCR] & 0x30000000; switch ((env->spr[SPR_40x_TCR] >> 28) & 0x3) { case 0x0: break; case 0x1: ppc40x_core_reset(cpu); break; case 0x2: ppc40x_chip_reset(cpu); break; case 0x3: ppc40x_system_reset(cpu); break; } } }
{ "code": [ " env->spr[SPR_40x_TSR] |= 1 << 31;" ], "line_no": [ 81 ] }
static void FUNC_0 (void *VAR_0) { PowerPCCPU *cpu; CPUPPCState *env; ppc_tb_t *tb_env; ppc40x_timer_t *ppc40x_timer; uint64_t now, next; env = VAR_0; cpu = ppc_env_get_cpu(env); tb_env = env->tb_env; ppc40x_timer = tb_env->VAR_0; now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); switch ((env->spr[SPR_40x_TCR] >> 30) & 0x3) { case 0: next = 1 << 17; break; case 1: next = 1 << 21; break; case 2: next = 1 << 25; break; case 3: next = 1 << 29; break; default: return; } next = now + muldiv64(next, get_ticks_per_sec(), tb_env->decr_freq); if (next == now) next++; LOG_TB("%s: TCR " TARGET_FMT_lx " TSR " TARGET_FMT_lx "\n", __func__, env->spr[SPR_40x_TCR], env->spr[SPR_40x_TSR]); switch ((env->spr[SPR_40x_TSR] >> 30) & 0x3) { case 0x0: case 0x1: timer_mod(ppc40x_timer->wdt_timer, next); ppc40x_timer->wdt_next = next; env->spr[SPR_40x_TSR] |= 1 << 31; break; case 0x2: timer_mod(ppc40x_timer->wdt_timer, next); ppc40x_timer->wdt_next = next; env->spr[SPR_40x_TSR] |= 1 << 30; if ((env->spr[SPR_40x_TCR] >> 27) & 0x1) { ppc_set_irq(cpu, PPC_INTERRUPT_WDT, 1); } break; case 0x3: env->spr[SPR_40x_TSR] &= ~0x30000000; env->spr[SPR_40x_TSR] |= env->spr[SPR_40x_TCR] & 0x30000000; switch ((env->spr[SPR_40x_TCR] >> 28) & 0x3) { case 0x0: break; case 0x1: ppc40x_core_reset(cpu); break; case 0x2: ppc40x_chip_reset(cpu); break; case 0x3: ppc40x_system_reset(cpu); break; } } }
[ "static void FUNC_0 (void *VAR_0)\n{", "PowerPCCPU *cpu;", "CPUPPCState *env;", "ppc_tb_t *tb_env;", "ppc40x_timer_t *ppc40x_timer;", "uint64_t now, next;", "env = VAR_0;", "cpu = ppc_env_get_cpu(env);", "tb_env = env->tb_env;", "ppc40x_timer = tb_env->VAR_0;", "now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);", "switch ((env->spr[SPR_40x_TCR] >> 30) & 0x3) {", "case 0:\nnext = 1 << 17;", "break;", "case 1:\nnext = 1 << 21;", "break;", "case 2:\nnext = 1 << 25;", "break;", "case 3:\nnext = 1 << 29;", "break;", "default:\nreturn;", "}", "next = now + muldiv64(next, get_ticks_per_sec(), tb_env->decr_freq);", "if (next == now)\nnext++;", "LOG_TB(\"%s: TCR \" TARGET_FMT_lx \" TSR \" TARGET_FMT_lx \"\\n\", __func__,\nenv->spr[SPR_40x_TCR], env->spr[SPR_40x_TSR]);", "switch ((env->spr[SPR_40x_TSR] >> 30) & 0x3) {", "case 0x0:\ncase 0x1:\ntimer_mod(ppc40x_timer->wdt_timer, next);", "ppc40x_timer->wdt_next = next;", "env->spr[SPR_40x_TSR] |= 1 << 31;", "break;", "case 0x2:\ntimer_mod(ppc40x_timer->wdt_timer, next);", "ppc40x_timer->wdt_next = next;", "env->spr[SPR_40x_TSR] |= 1 << 30;", "if ((env->spr[SPR_40x_TCR] >> 27) & 0x1) {", "ppc_set_irq(cpu, PPC_INTERRUPT_WDT, 1);", "}", "break;", "case 0x3:\nenv->spr[SPR_40x_TSR] &= ~0x30000000;", "env->spr[SPR_40x_TSR] |= env->spr[SPR_40x_TCR] & 0x30000000;", "switch ((env->spr[SPR_40x_TCR] >> 28) & 0x3) {", "case 0x0:\nbreak;", "case 0x1:\nppc40x_core_reset(cpu);", "break;", "case 0x2:\nppc40x_chip_reset(cpu);", "break;", "case 0x3:\nppc40x_system_reset(cpu);", "break;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53, 57 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67, 69 ], [ 71 ], [ 73, 75, 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 109, 113 ], [ 115, 117 ], [ 119 ], [ 121, 123 ], [ 125 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ] ]
8,363
int unix_connect_opts(QemuOpts *opts) { struct sockaddr_un un; const char *path = qemu_opt_get(opts, "path"); int sock; if (NULL == path) { fprintf(stderr, "unix connect: no path specified\n"); return -1; } sock = qemu_socket(PF_UNIX, SOCK_STREAM, 0); if (sock < 0) { perror("socket(unix)"); return -1; } memset(&un, 0, sizeof(un)); un.sun_family = AF_UNIX; snprintf(un.sun_path, sizeof(un.sun_path), "%s", path); if (connect(sock, (struct sockaddr*) &un, sizeof(un)) < 0) { fprintf(stderr, "connect(unix:%s): %s\n", path, strerror(errno)); return -1; } if (sockets_debug) fprintf(stderr, "connect(unix:%s): OK\n", path); return sock; }
true
qemu
9d9474726274d0e1c420f055849a0e3058cad0e4
int unix_connect_opts(QemuOpts *opts) { struct sockaddr_un un; const char *path = qemu_opt_get(opts, "path"); int sock; if (NULL == path) { fprintf(stderr, "unix connect: no path specified\n"); return -1; } sock = qemu_socket(PF_UNIX, SOCK_STREAM, 0); if (sock < 0) { perror("socket(unix)"); return -1; } memset(&un, 0, sizeof(un)); un.sun_family = AF_UNIX; snprintf(un.sun_path, sizeof(un.sun_path), "%s", path); if (connect(sock, (struct sockaddr*) &un, sizeof(un)) < 0) { fprintf(stderr, "connect(unix:%s): %s\n", path, strerror(errno)); return -1; } if (sockets_debug) fprintf(stderr, "connect(unix:%s): OK\n", path); return sock; }
{ "code": [], "line_no": [] }
int FUNC_0(QemuOpts *VAR_0) { struct sockaddr_un VAR_1; const char *VAR_2 = qemu_opt_get(VAR_0, "VAR_2"); int VAR_3; if (NULL == VAR_2) { fprintf(stderr, "unix connect: no VAR_2 specified\n"); return -1; } VAR_3 = qemu_socket(PF_UNIX, SOCK_STREAM, 0); if (VAR_3 < 0) { perror("socket(unix)"); return -1; } memset(&VAR_1, 0, sizeof(VAR_1)); VAR_1.sun_family = AF_UNIX; snprintf(VAR_1.sun_path, sizeof(VAR_1.sun_path), "%s", VAR_2); if (connect(VAR_3, (struct sockaddr*) &VAR_1, sizeof(VAR_1)) < 0) { fprintf(stderr, "connect(unix:%s): %s\n", VAR_2, strerror(errno)); return -1; } if (sockets_debug) fprintf(stderr, "connect(unix:%s): OK\n", VAR_2); return VAR_3; }
[ "int FUNC_0(QemuOpts *VAR_0)\n{", "struct sockaddr_un VAR_1;", "const char *VAR_2 = qemu_opt_get(VAR_0, \"VAR_2\");", "int VAR_3;", "if (NULL == VAR_2) {", "fprintf(stderr, \"unix connect: no VAR_2 specified\\n\");", "return -1;", "}", "VAR_3 = qemu_socket(PF_UNIX, SOCK_STREAM, 0);", "if (VAR_3 < 0) {", "perror(\"socket(unix)\");", "return -1;", "}", "memset(&VAR_1, 0, sizeof(VAR_1));", "VAR_1.sun_family = AF_UNIX;", "snprintf(VAR_1.sun_path, sizeof(VAR_1.sun_path), \"%s\", VAR_2);", "if (connect(VAR_3, (struct sockaddr*) &VAR_1, sizeof(VAR_1)) < 0) {", "fprintf(stderr, \"connect(unix:%s): %s\\n\", VAR_2, strerror(errno));", "return -1;", "}", "if (sockets_debug)\nfprintf(stderr, \"connect(unix:%s): OK\\n\", VAR_2);", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 46 ], [ 48 ], [ 52, 54 ], [ 56 ], [ 58 ] ]
8,364
static int vhost_net_start_one(struct vhost_net *net, VirtIODevice *dev) { struct vhost_vring_file file = { }; int r; net->dev.nvqs = 2; net->dev.vqs = net->vqs; r = vhost_dev_enable_notifiers(&net->dev, dev); if (r < 0) { goto fail_notifiers; } r = vhost_dev_start(&net->dev, dev); if (r < 0) { goto fail_start; } if (net->nc->info->poll) { net->nc->info->poll(net->nc, false); } if (net->nc->info->type == NET_CLIENT_DRIVER_TAP) { qemu_set_fd_handler(net->backend, NULL, NULL, NULL); file.fd = net->backend; for (file.index = 0; file.index < net->dev.nvqs; ++file.index) { const VhostOps *vhost_ops = net->dev.vhost_ops; r = vhost_ops->vhost_net_set_backend(&net->dev, &file); if (r < 0) { r = -errno; goto fail; } } } return 0; fail: file.fd = -1; if (net->nc->info->type == NET_CLIENT_DRIVER_TAP) { while (file.index-- > 0) { const VhostOps *vhost_ops = net->dev.vhost_ops; int r = vhost_ops->vhost_net_set_backend(&net->dev, &file); assert(r >= 0); } } if (net->nc->info->poll) { net->nc->info->poll(net->nc, true); } vhost_dev_stop(&net->dev, dev); fail_start: vhost_dev_disable_notifiers(&net->dev, dev); fail_notifiers: return r; }
true
qemu
950d94ba0671e7f154a9e87a277f8efbddcee28f
static int vhost_net_start_one(struct vhost_net *net, VirtIODevice *dev) { struct vhost_vring_file file = { }; int r; net->dev.nvqs = 2; net->dev.vqs = net->vqs; r = vhost_dev_enable_notifiers(&net->dev, dev); if (r < 0) { goto fail_notifiers; } r = vhost_dev_start(&net->dev, dev); if (r < 0) { goto fail_start; } if (net->nc->info->poll) { net->nc->info->poll(net->nc, false); } if (net->nc->info->type == NET_CLIENT_DRIVER_TAP) { qemu_set_fd_handler(net->backend, NULL, NULL, NULL); file.fd = net->backend; for (file.index = 0; file.index < net->dev.nvqs; ++file.index) { const VhostOps *vhost_ops = net->dev.vhost_ops; r = vhost_ops->vhost_net_set_backend(&net->dev, &file); if (r < 0) { r = -errno; goto fail; } } } return 0; fail: file.fd = -1; if (net->nc->info->type == NET_CLIENT_DRIVER_TAP) { while (file.index-- > 0) { const VhostOps *vhost_ops = net->dev.vhost_ops; int r = vhost_ops->vhost_net_set_backend(&net->dev, &file); assert(r >= 0); } } if (net->nc->info->poll) { net->nc->info->poll(net->nc, true); } vhost_dev_stop(&net->dev, dev); fail_start: vhost_dev_disable_notifiers(&net->dev, dev); fail_notifiers: return r; }
{ "code": [ " const VhostOps *vhost_ops = net->dev.vhost_ops;", " r = vhost_ops->vhost_net_set_backend(&net->dev, &file);", " const VhostOps *vhost_ops = net->dev.vhost_ops;", " int r = vhost_ops->vhost_net_set_backend(&net->dev, &file);", " const VhostOps *vhost_ops = net->dev.vhost_ops;", " int r = vhost_ops->vhost_net_set_backend(&net->dev, &file);" ], "line_no": [ 55, 57, 55, 83, 55, 83 ] }
static int FUNC_0(struct vhost_net *VAR_0, VirtIODevice *VAR_1) { struct vhost_vring_file VAR_2 = { }; int VAR_5; VAR_0->VAR_1.nvqs = 2; VAR_0->VAR_1.vqs = VAR_0->vqs; VAR_5 = vhost_dev_enable_notifiers(&VAR_0->VAR_1, VAR_1); if (VAR_5 < 0) { goto fail_notifiers; } VAR_5 = vhost_dev_start(&VAR_0->VAR_1, VAR_1); if (VAR_5 < 0) { goto fail_start; } if (VAR_0->nc->info->poll) { VAR_0->nc->info->poll(VAR_0->nc, false); } if (VAR_0->nc->info->type == NET_CLIENT_DRIVER_TAP) { qemu_set_fd_handler(VAR_0->backend, NULL, NULL, NULL); VAR_2.fd = VAR_0->backend; for (VAR_2.index = 0; VAR_2.index < VAR_0->VAR_1.nvqs; ++VAR_2.index) { const VhostOps *VAR_4 = VAR_0->VAR_1.VAR_4; VAR_5 = VAR_4->vhost_net_set_backend(&VAR_0->VAR_1, &VAR_2); if (VAR_5 < 0) { VAR_5 = -errno; goto fail; } } } return 0; fail: VAR_2.fd = -1; if (VAR_0->nc->info->type == NET_CLIENT_DRIVER_TAP) { while (VAR_2.index-- > 0) { const VhostOps *VAR_4 = VAR_0->VAR_1.VAR_4; int VAR_5 = VAR_4->vhost_net_set_backend(&VAR_0->VAR_1, &VAR_2); assert(VAR_5 >= 0); } } if (VAR_0->nc->info->poll) { VAR_0->nc->info->poll(VAR_0->nc, true); } vhost_dev_stop(&VAR_0->VAR_1, VAR_1); fail_start: vhost_dev_disable_notifiers(&VAR_0->VAR_1, VAR_1); fail_notifiers: return VAR_5; }
[ "static int FUNC_0(struct vhost_net *VAR_0,\nVirtIODevice *VAR_1)\n{", "struct vhost_vring_file VAR_2 = { };", "int VAR_5;", "VAR_0->VAR_1.nvqs = 2;", "VAR_0->VAR_1.vqs = VAR_0->vqs;", "VAR_5 = vhost_dev_enable_notifiers(&VAR_0->VAR_1, VAR_1);", "if (VAR_5 < 0) {", "goto fail_notifiers;", "}", "VAR_5 = vhost_dev_start(&VAR_0->VAR_1, VAR_1);", "if (VAR_5 < 0) {", "goto fail_start;", "}", "if (VAR_0->nc->info->poll) {", "VAR_0->nc->info->poll(VAR_0->nc, false);", "}", "if (VAR_0->nc->info->type == NET_CLIENT_DRIVER_TAP) {", "qemu_set_fd_handler(VAR_0->backend, NULL, NULL, NULL);", "VAR_2.fd = VAR_0->backend;", "for (VAR_2.index = 0; VAR_2.index < VAR_0->VAR_1.nvqs; ++VAR_2.index) {", "const VhostOps *VAR_4 = VAR_0->VAR_1.VAR_4;", "VAR_5 = VAR_4->vhost_net_set_backend(&VAR_0->VAR_1, &VAR_2);", "if (VAR_5 < 0) {", "VAR_5 = -errno;", "goto fail;", "}", "}", "}", "return 0;", "fail:\nVAR_2.fd = -1;", "if (VAR_0->nc->info->type == NET_CLIENT_DRIVER_TAP) {", "while (VAR_2.index-- > 0) {", "const VhostOps *VAR_4 = VAR_0->VAR_1.VAR_4;", "int VAR_5 = VAR_4->vhost_net_set_backend(&VAR_0->VAR_1, &VAR_2);", "assert(VAR_5 >= 0);", "}", "}", "if (VAR_0->nc->info->poll) {", "VAR_0->nc->info->poll(VAR_0->nc, true);", "}", "vhost_dev_stop(&VAR_0->VAR_1, VAR_1);", "fail_start:\nvhost_dev_disable_notifiers(&VAR_0->VAR_1, VAR_1);", "fail_notifiers:\nreturn VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 103, 105 ], [ 107 ] ]
8,365
int qcow2_pre_write_overlap_check(BlockDriverState *bs, int chk, int64_t offset, int64_t size) { int ret = qcow2_check_metadata_overlap(bs, chk, offset, size); if (ret < 0) { return ret; } else if (ret > 0) { int metadata_ol_bitnr = ffs(ret) - 1; char *message; QObject *data; assert(metadata_ol_bitnr < QCOW2_OL_MAX_BITNR); fprintf(stderr, "qcow2: Preventing invalid write on metadata (overlaps " "with %s); image marked as corrupt.\n", metadata_ol_names[metadata_ol_bitnr]); message = g_strdup_printf("Prevented %s overwrite", metadata_ol_names[metadata_ol_bitnr]); data = qobject_from_jsonf("{ 'device': %s, 'msg': %s, 'offset': %" PRId64 ", 'size': %" PRId64 " }", bs->device_name, message, offset, size); monitor_protocol_event(QEVENT_BLOCK_IMAGE_CORRUPTED, data); g_free(message); qobject_decref(data); qcow2_mark_corrupt(bs); bs->drv = NULL; /* make BDS unusable */ return -EIO; } return 0; }
true
qemu
231bb267644ee3a9ebfd9c7f42d5d41610194b45
int qcow2_pre_write_overlap_check(BlockDriverState *bs, int chk, int64_t offset, int64_t size) { int ret = qcow2_check_metadata_overlap(bs, chk, offset, size); if (ret < 0) { return ret; } else if (ret > 0) { int metadata_ol_bitnr = ffs(ret) - 1; char *message; QObject *data; assert(metadata_ol_bitnr < QCOW2_OL_MAX_BITNR); fprintf(stderr, "qcow2: Preventing invalid write on metadata (overlaps " "with %s); image marked as corrupt.\n", metadata_ol_names[metadata_ol_bitnr]); message = g_strdup_printf("Prevented %s overwrite", metadata_ol_names[metadata_ol_bitnr]); data = qobject_from_jsonf("{ 'device': %s, 'msg': %s, 'offset': %" PRId64 ", 'size': %" PRId64 " }", bs->device_name, message, offset, size); monitor_protocol_event(QEVENT_BLOCK_IMAGE_CORRUPTED, data); g_free(message); qobject_decref(data); qcow2_mark_corrupt(bs); bs->drv = NULL; return -EIO; } return 0; }
{ "code": [ "int qcow2_pre_write_overlap_check(BlockDriverState *bs, int chk, int64_t offset,", " int ret = qcow2_check_metadata_overlap(bs, chk, offset, size);", "int qcow2_pre_write_overlap_check(BlockDriverState *bs, int chk, int64_t offset," ], "line_no": [ 1, 7, 1 ] }
int FUNC_0(BlockDriverState *VAR_0, int VAR_1, int64_t VAR_2, int64_t VAR_3) { int VAR_4 = qcow2_check_metadata_overlap(VAR_0, VAR_1, VAR_2, VAR_3); if (VAR_4 < 0) { return VAR_4; } else if (VAR_4 > 0) { int VAR_5 = ffs(VAR_4) - 1; char *VAR_6; QObject *data; assert(VAR_5 < QCOW2_OL_MAX_BITNR); fprintf(stderr, "qcow2: Preventing invalid write on metadata (overlaps " "with %s); image marked as corrupt.\n", metadata_ol_names[VAR_5]); VAR_6 = g_strdup_printf("Prevented %s overwrite", metadata_ol_names[VAR_5]); data = qobject_from_jsonf("{ 'device': %s, 'msg': %s, 'VAR_2': %" PRId64 ", 'VAR_3': %" PRId64 " }", VAR_0->device_name, VAR_6, VAR_2, VAR_3); monitor_protocol_event(QEVENT_BLOCK_IMAGE_CORRUPTED, data); g_free(VAR_6); qobject_decref(data); qcow2_mark_corrupt(VAR_0); VAR_0->drv = NULL; return -EIO; } return 0; }
[ "int FUNC_0(BlockDriverState *VAR_0, int VAR_1, int64_t VAR_2,\nint64_t VAR_3)\n{", "int VAR_4 = qcow2_check_metadata_overlap(VAR_0, VAR_1, VAR_2, VAR_3);", "if (VAR_4 < 0) {", "return VAR_4;", "} else if (VAR_4 > 0) {", "int VAR_5 = ffs(VAR_4) - 1;", "char *VAR_6;", "QObject *data;", "assert(VAR_5 < QCOW2_OL_MAX_BITNR);", "fprintf(stderr, \"qcow2: Preventing invalid write on metadata (overlaps \"\n\"with %s); image marked as corrupt.\\n\",", "metadata_ol_names[VAR_5]);", "VAR_6 = g_strdup_printf(\"Prevented %s overwrite\",\nmetadata_ol_names[VAR_5]);", "data = qobject_from_jsonf(\"{ 'device': %s, 'msg': %s, 'VAR_2': %\"", "PRId64 \", 'VAR_3': %\" PRId64 \" }\", VAR_0->device_name, VAR_6,", "VAR_2, VAR_3);", "monitor_protocol_event(QEVENT_BLOCK_IMAGE_CORRUPTED, data);", "g_free(VAR_6);", "qobject_decref(data);", "qcow2_mark_corrupt(VAR_0);", "VAR_0->drv = NULL;", "return -EIO;", "}", "return 0;", "}" ]
[ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 29, 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ] ]
8,367
static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, int source_index) { int n; AVStream *st; OutputStream *ost; AVCodecContext *audio_enc; ost = new_output_stream(o, oc, AVMEDIA_TYPE_AUDIO, source_index); st = ost->st; audio_enc = st->codec; audio_enc->codec_type = AVMEDIA_TYPE_AUDIO; MATCH_PER_STREAM_OPT(filter_scripts, str, ost->filters_script, oc, st); MATCH_PER_STREAM_OPT(filters, str, ost->filters, oc, st); if (!ost->stream_copy) { char *sample_fmt = NULL; MATCH_PER_STREAM_OPT(audio_channels, i, audio_enc->channels, oc, st); MATCH_PER_STREAM_OPT(sample_fmts, str, sample_fmt, oc, st); if (sample_fmt && (audio_enc->sample_fmt = av_get_sample_fmt(sample_fmt)) == AV_SAMPLE_FMT_NONE) { av_log(NULL, AV_LOG_FATAL, "Invalid sample format '%s'\n", sample_fmt); exit_program(1); } MATCH_PER_STREAM_OPT(audio_sample_rate, i, audio_enc->sample_rate, oc, st); MATCH_PER_STREAM_OPT(apad, str, ost->apad, oc, st); ost->apad = av_strdup(ost->apad); ost->avfilter = get_ost_filters(o, oc, ost); if (!ost->avfilter) exit_program(1); /* check for channel mapping for this audio stream */ for (n = 0; n < o->nb_audio_channel_maps; n++) { AudioChannelMap *map = &o->audio_channel_maps[n]; InputStream *ist = input_streams[ost->source_index]; if ((map->channel_idx == -1 || (ist->file_index == map->file_idx && ist->st->index == map->stream_idx)) && (map->ofile_idx == -1 || ost->file_index == map->ofile_idx) && (map->ostream_idx == -1 || ost->st->index == map->ostream_idx)) { if (ost->audio_channels_mapped < FF_ARRAY_ELEMS(ost->audio_channels_map)) ost->audio_channels_map[ost->audio_channels_mapped++] = map->channel_idx; else av_log(NULL, AV_LOG_FATAL, "Max channel mapping for output %d.%d reached\n", ost->file_index, ost->st->index); } } } if (ost->stream_copy) check_streamcopy_filters(o, oc, ost, AVMEDIA_TYPE_AUDIO); return ost; }
false
FFmpeg
8803b970ef98ea51278dece401d23dc870c5aa01
static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, int source_index) { int n; AVStream *st; OutputStream *ost; AVCodecContext *audio_enc; ost = new_output_stream(o, oc, AVMEDIA_TYPE_AUDIO, source_index); st = ost->st; audio_enc = st->codec; audio_enc->codec_type = AVMEDIA_TYPE_AUDIO; MATCH_PER_STREAM_OPT(filter_scripts, str, ost->filters_script, oc, st); MATCH_PER_STREAM_OPT(filters, str, ost->filters, oc, st); if (!ost->stream_copy) { char *sample_fmt = NULL; MATCH_PER_STREAM_OPT(audio_channels, i, audio_enc->channels, oc, st); MATCH_PER_STREAM_OPT(sample_fmts, str, sample_fmt, oc, st); if (sample_fmt && (audio_enc->sample_fmt = av_get_sample_fmt(sample_fmt)) == AV_SAMPLE_FMT_NONE) { av_log(NULL, AV_LOG_FATAL, "Invalid sample format '%s'\n", sample_fmt); exit_program(1); } MATCH_PER_STREAM_OPT(audio_sample_rate, i, audio_enc->sample_rate, oc, st); MATCH_PER_STREAM_OPT(apad, str, ost->apad, oc, st); ost->apad = av_strdup(ost->apad); ost->avfilter = get_ost_filters(o, oc, ost); if (!ost->avfilter) exit_program(1); for (n = 0; n < o->nb_audio_channel_maps; n++) { AudioChannelMap *map = &o->audio_channel_maps[n]; InputStream *ist = input_streams[ost->source_index]; if ((map->channel_idx == -1 || (ist->file_index == map->file_idx && ist->st->index == map->stream_idx)) && (map->ofile_idx == -1 || ost->file_index == map->ofile_idx) && (map->ostream_idx == -1 || ost->st->index == map->ostream_idx)) { if (ost->audio_channels_mapped < FF_ARRAY_ELEMS(ost->audio_channels_map)) ost->audio_channels_map[ost->audio_channels_mapped++] = map->channel_idx; else av_log(NULL, AV_LOG_FATAL, "Max channel mapping for output %d.%d reached\n", ost->file_index, ost->st->index); } } } if (ost->stream_copy) check_streamcopy_filters(o, oc, ost, AVMEDIA_TYPE_AUDIO); return ost; }
{ "code": [], "line_no": [] }
static OutputStream *FUNC_0(OptionsContext *o, AVFormatContext *oc, int source_index) { int VAR_0; AVStream *st; OutputStream *ost; AVCodecContext *audio_enc; ost = new_output_stream(o, oc, AVMEDIA_TYPE_AUDIO, source_index); st = ost->st; audio_enc = st->codec; audio_enc->codec_type = AVMEDIA_TYPE_AUDIO; MATCH_PER_STREAM_OPT(filter_scripts, str, ost->filters_script, oc, st); MATCH_PER_STREAM_OPT(filters, str, ost->filters, oc, st); if (!ost->stream_copy) { char *VAR_1 = NULL; MATCH_PER_STREAM_OPT(audio_channels, i, audio_enc->channels, oc, st); MATCH_PER_STREAM_OPT(sample_fmts, str, VAR_1, oc, st); if (VAR_1 && (audio_enc->VAR_1 = av_get_sample_fmt(VAR_1)) == AV_SAMPLE_FMT_NONE) { av_log(NULL, AV_LOG_FATAL, "Invalid sample format '%s'\VAR_0", VAR_1); exit_program(1); } MATCH_PER_STREAM_OPT(audio_sample_rate, i, audio_enc->sample_rate, oc, st); MATCH_PER_STREAM_OPT(apad, str, ost->apad, oc, st); ost->apad = av_strdup(ost->apad); ost->avfilter = get_ost_filters(o, oc, ost); if (!ost->avfilter) exit_program(1); for (VAR_0 = 0; VAR_0 < o->nb_audio_channel_maps; VAR_0++) { AudioChannelMap *map = &o->audio_channel_maps[VAR_0]; InputStream *ist = input_streams[ost->source_index]; if ((map->channel_idx == -1 || (ist->file_index == map->file_idx && ist->st->index == map->stream_idx)) && (map->ofile_idx == -1 || ost->file_index == map->ofile_idx) && (map->ostream_idx == -1 || ost->st->index == map->ostream_idx)) { if (ost->audio_channels_mapped < FF_ARRAY_ELEMS(ost->audio_channels_map)) ost->audio_channels_map[ost->audio_channels_mapped++] = map->channel_idx; else av_log(NULL, AV_LOG_FATAL, "Max channel mapping for output %d.%d reached\VAR_0", ost->file_index, ost->st->index); } } } if (ost->stream_copy) check_streamcopy_filters(o, oc, ost, AVMEDIA_TYPE_AUDIO); return ost; }
[ "static OutputStream *FUNC_0(OptionsContext *o, AVFormatContext *oc, int source_index)\n{", "int VAR_0;", "AVStream *st;", "OutputStream *ost;", "AVCodecContext *audio_enc;", "ost = new_output_stream(o, oc, AVMEDIA_TYPE_AUDIO, source_index);", "st = ost->st;", "audio_enc = st->codec;", "audio_enc->codec_type = AVMEDIA_TYPE_AUDIO;", "MATCH_PER_STREAM_OPT(filter_scripts, str, ost->filters_script, oc, st);", "MATCH_PER_STREAM_OPT(filters, str, ost->filters, oc, st);", "if (!ost->stream_copy) {", "char *VAR_1 = NULL;", "MATCH_PER_STREAM_OPT(audio_channels, i, audio_enc->channels, oc, st);", "MATCH_PER_STREAM_OPT(sample_fmts, str, VAR_1, oc, st);", "if (VAR_1 &&\n(audio_enc->VAR_1 = av_get_sample_fmt(VAR_1)) == AV_SAMPLE_FMT_NONE) {", "av_log(NULL, AV_LOG_FATAL, \"Invalid sample format '%s'\\VAR_0\", VAR_1);", "exit_program(1);", "}", "MATCH_PER_STREAM_OPT(audio_sample_rate, i, audio_enc->sample_rate, oc, st);", "MATCH_PER_STREAM_OPT(apad, str, ost->apad, oc, st);", "ost->apad = av_strdup(ost->apad);", "ost->avfilter = get_ost_filters(o, oc, ost);", "if (!ost->avfilter)\nexit_program(1);", "for (VAR_0 = 0; VAR_0 < o->nb_audio_channel_maps; VAR_0++) {", "AudioChannelMap *map = &o->audio_channel_maps[VAR_0];", "InputStream *ist = input_streams[ost->source_index];", "if ((map->channel_idx == -1 || (ist->file_index == map->file_idx && ist->st->index == map->stream_idx)) &&\n(map->ofile_idx == -1 || ost->file_index == map->ofile_idx) &&\n(map->ostream_idx == -1 || ost->st->index == map->ostream_idx)) {", "if (ost->audio_channels_mapped < FF_ARRAY_ELEMS(ost->audio_channels_map))\nost->audio_channels_map[ost->audio_channels_mapped++] = map->channel_idx;", "else\nav_log(NULL, AV_LOG_FATAL, \"Max channel mapping for output %d.%d reached\\VAR_0\",\nost->file_index, ost->st->index);", "}", "}", "}", "if (ost->stream_copy)\ncheck_streamcopy_filters(o, oc, ost, AVMEDIA_TYPE_AUDIO);", "return ost;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 39 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 61 ], [ 63 ], [ 67 ], [ 69, 71 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85, 87 ], [ 89, 91 ], [ 93, 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 107, 109 ], [ 113 ], [ 115 ] ]
8,368
static void end_frame(AVFilterLink *link) { DeshakeContext *deshake = link->dst->priv; AVFilterBufferRef *in = link->cur_buf; AVFilterBufferRef *out = link->dst->outputs[0]->out_buf; Transform t; float matrix[9]; float alpha = 2.0 / deshake->refcount; char tmp[256]; Transform orig; if (deshake->cx < 0 || deshake->cy < 0 || deshake->cw < 0 || deshake->ch < 0) { // Find the most likely global motion for the current frame find_motion(deshake, (deshake->ref == NULL) ? in->data[0] : deshake->ref->data[0], in->data[0], link->w, link->h, in->linesize[0], &t); } else { uint8_t *src1 = (deshake->ref == NULL) ? in->data[0] : deshake->ref->data[0]; uint8_t *src2 = in->data[0]; deshake->cx = FFMIN(deshake->cx, link->w); deshake->cy = FFMIN(deshake->cy, link->h); if ((unsigned)deshake->cx + (unsigned)deshake->cw > link->w) deshake->cw = link->w - deshake->cx; if ((unsigned)deshake->cy + (unsigned)deshake->ch > link->h) deshake->ch = link->h - deshake->cy; // Quadword align right margin deshake->cw &= ~15; src1 += deshake->cy * in->linesize[0] + deshake->cx; src2 += deshake->cy * in->linesize[0] + deshake->cx; find_motion(deshake, src1, src2, deshake->cw, deshake->ch, in->linesize[0], &t); } // Copy transform so we can output it later to compare to the smoothed value orig.vector.x = t.vector.x; orig.vector.y = t.vector.y; orig.angle = t.angle; orig.zoom = t.zoom; // Generate a one-sided moving exponential average deshake->avg.vector.x = alpha * t.vector.x + (1.0 - alpha) * deshake->avg.vector.x; deshake->avg.vector.y = alpha * t.vector.y + (1.0 - alpha) * deshake->avg.vector.y; deshake->avg.angle = alpha * t.angle + (1.0 - alpha) * deshake->avg.angle; deshake->avg.zoom = alpha * t.zoom + (1.0 - alpha) * deshake->avg.zoom; // Remove the average from the current motion to detect the motion that // is not on purpose, just as jitter from bumping the camera t.vector.x -= deshake->avg.vector.x; t.vector.y -= deshake->avg.vector.y; t.angle -= deshake->avg.angle; t.zoom -= deshake->avg.zoom; // Invert the motion to undo it t.vector.x *= -1; t.vector.y *= -1; t.angle *= -1; // Write statistics to file if (deshake->fp) { snprintf(tmp, 256, "%f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f\n", orig.vector.x, deshake->avg.vector.x, t.vector.x, orig.vector.y, deshake->avg.vector.y, t.vector.y, orig.angle, deshake->avg.angle, t.angle, orig.zoom, deshake->avg.zoom, t.zoom); fwrite(tmp, sizeof(char), strlen(tmp), deshake->fp); } // Turn relative current frame motion into absolute by adding it to the // last absolute motion t.vector.x += deshake->last.vector.x; t.vector.y += deshake->last.vector.y; t.angle += deshake->last.angle; t.zoom += deshake->last.zoom; // Shrink motion by 10% to keep things centered in the camera frame t.vector.x *= 0.9; t.vector.y *= 0.9; t.angle *= 0.9; // Store the last absolute motion information deshake->last.vector.x = t.vector.x; deshake->last.vector.y = t.vector.y; deshake->last.angle = t.angle; deshake->last.zoom = t.zoom; // Generate a luma transformation matrix avfilter_get_matrix(t.vector.x, t.vector.y, t.angle, 1.0 + t.zoom / 100.0, matrix); // Transform the luma plane avfilter_transform(in->data[0], out->data[0], in->linesize[0], out->linesize[0], link->w, link->h, matrix, INTERPOLATE_BILINEAR, deshake->edge); // Generate a chroma transformation matrix avfilter_get_matrix(t.vector.x / (link->w / CHROMA_WIDTH(link)), t.vector.y / (link->h / CHROMA_HEIGHT(link)), t.angle, 1.0 + t.zoom / 100.0, matrix); // Transform the chroma planes avfilter_transform(in->data[1], out->data[1], in->linesize[1], out->linesize[1], CHROMA_WIDTH(link), CHROMA_HEIGHT(link), matrix, INTERPOLATE_BILINEAR, deshake->edge); avfilter_transform(in->data[2], out->data[2], in->linesize[2], out->linesize[2], CHROMA_WIDTH(link), CHROMA_HEIGHT(link), matrix, INTERPOLATE_BILINEAR, deshake->edge); // Store the current frame as the reference frame for calculating the // motion of the next frame if (deshake->ref != NULL) avfilter_unref_buffer(deshake->ref); // Cleanup the old reference frame deshake->ref = in; // Draw the transformed frame information avfilter_draw_slice(link->dst->outputs[0], 0, link->h, 1); avfilter_end_frame(link->dst->outputs[0]); avfilter_unref_buffer(out); }
false
FFmpeg
7f6004fc7466c2ce975894446f4b13ca6c3779a0
static void end_frame(AVFilterLink *link) { DeshakeContext *deshake = link->dst->priv; AVFilterBufferRef *in = link->cur_buf; AVFilterBufferRef *out = link->dst->outputs[0]->out_buf; Transform t; float matrix[9]; float alpha = 2.0 / deshake->refcount; char tmp[256]; Transform orig; if (deshake->cx < 0 || deshake->cy < 0 || deshake->cw < 0 || deshake->ch < 0) { find_motion(deshake, (deshake->ref == NULL) ? in->data[0] : deshake->ref->data[0], in->data[0], link->w, link->h, in->linesize[0], &t); } else { uint8_t *src1 = (deshake->ref == NULL) ? in->data[0] : deshake->ref->data[0]; uint8_t *src2 = in->data[0]; deshake->cx = FFMIN(deshake->cx, link->w); deshake->cy = FFMIN(deshake->cy, link->h); if ((unsigned)deshake->cx + (unsigned)deshake->cw > link->w) deshake->cw = link->w - deshake->cx; if ((unsigned)deshake->cy + (unsigned)deshake->ch > link->h) deshake->ch = link->h - deshake->cy; deshake->cw &= ~15; src1 += deshake->cy * in->linesize[0] + deshake->cx; src2 += deshake->cy * in->linesize[0] + deshake->cx; find_motion(deshake, src1, src2, deshake->cw, deshake->ch, in->linesize[0], &t); } orig.vector.x = t.vector.x; orig.vector.y = t.vector.y; orig.angle = t.angle; orig.zoom = t.zoom; deshake->avg.vector.x = alpha * t.vector.x + (1.0 - alpha) * deshake->avg.vector.x; deshake->avg.vector.y = alpha * t.vector.y + (1.0 - alpha) * deshake->avg.vector.y; deshake->avg.angle = alpha * t.angle + (1.0 - alpha) * deshake->avg.angle; deshake->avg.zoom = alpha * t.zoom + (1.0 - alpha) * deshake->avg.zoom; t.vector.x -= deshake->avg.vector.x; t.vector.y -= deshake->avg.vector.y; t.angle -= deshake->avg.angle; t.zoom -= deshake->avg.zoom; t.vector.x *= -1; t.vector.y *= -1; t.angle *= -1; if (deshake->fp) { snprintf(tmp, 256, "%f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f\n", orig.vector.x, deshake->avg.vector.x, t.vector.x, orig.vector.y, deshake->avg.vector.y, t.vector.y, orig.angle, deshake->avg.angle, t.angle, orig.zoom, deshake->avg.zoom, t.zoom); fwrite(tmp, sizeof(char), strlen(tmp), deshake->fp); } t.vector.x += deshake->last.vector.x; t.vector.y += deshake->last.vector.y; t.angle += deshake->last.angle; t.zoom += deshake->last.zoom; t.vector.x *= 0.9; t.vector.y *= 0.9; t.angle *= 0.9; deshake->last.vector.x = t.vector.x; deshake->last.vector.y = t.vector.y; deshake->last.angle = t.angle; deshake->last.zoom = t.zoom; avfilter_get_matrix(t.vector.x, t.vector.y, t.angle, 1.0 + t.zoom / 100.0, matrix); avfilter_transform(in->data[0], out->data[0], in->linesize[0], out->linesize[0], link->w, link->h, matrix, INTERPOLATE_BILINEAR, deshake->edge); avfilter_get_matrix(t.vector.x / (link->w / CHROMA_WIDTH(link)), t.vector.y / (link->h / CHROMA_HEIGHT(link)), t.angle, 1.0 + t.zoom / 100.0, matrix); avfilter_transform(in->data[1], out->data[1], in->linesize[1], out->linesize[1], CHROMA_WIDTH(link), CHROMA_HEIGHT(link), matrix, INTERPOLATE_BILINEAR, deshake->edge); avfilter_transform(in->data[2], out->data[2], in->linesize[2], out->linesize[2], CHROMA_WIDTH(link), CHROMA_HEIGHT(link), matrix, INTERPOLATE_BILINEAR, deshake->edge); if (deshake->ref != NULL) avfilter_unref_buffer(deshake->ref); deshake->ref = in; avfilter_draw_slice(link->dst->outputs[0], 0, link->h, 1); avfilter_end_frame(link->dst->outputs[0]); avfilter_unref_buffer(out); }
{ "code": [], "line_no": [] }
static void FUNC_0(AVFilterLink *VAR_0) { DeshakeContext *deshake = VAR_0->dst->priv; AVFilterBufferRef *in = VAR_0->cur_buf; AVFilterBufferRef *out = VAR_0->dst->outputs[0]->out_buf; Transform t; float VAR_1[9]; float VAR_2 = 2.0 / deshake->refcount; char VAR_3[256]; Transform orig; if (deshake->cx < 0 || deshake->cy < 0 || deshake->cw < 0 || deshake->ch < 0) { find_motion(deshake, (deshake->ref == NULL) ? in->data[0] : deshake->ref->data[0], in->data[0], VAR_0->w, VAR_0->h, in->linesize[0], &t); } else { uint8_t *src1 = (deshake->ref == NULL) ? in->data[0] : deshake->ref->data[0]; uint8_t *src2 = in->data[0]; deshake->cx = FFMIN(deshake->cx, VAR_0->w); deshake->cy = FFMIN(deshake->cy, VAR_0->h); if ((unsigned)deshake->cx + (unsigned)deshake->cw > VAR_0->w) deshake->cw = VAR_0->w - deshake->cx; if ((unsigned)deshake->cy + (unsigned)deshake->ch > VAR_0->h) deshake->ch = VAR_0->h - deshake->cy; deshake->cw &= ~15; src1 += deshake->cy * in->linesize[0] + deshake->cx; src2 += deshake->cy * in->linesize[0] + deshake->cx; find_motion(deshake, src1, src2, deshake->cw, deshake->ch, in->linesize[0], &t); } orig.vector.x = t.vector.x; orig.vector.y = t.vector.y; orig.angle = t.angle; orig.zoom = t.zoom; deshake->avg.vector.x = VAR_2 * t.vector.x + (1.0 - VAR_2) * deshake->avg.vector.x; deshake->avg.vector.y = VAR_2 * t.vector.y + (1.0 - VAR_2) * deshake->avg.vector.y; deshake->avg.angle = VAR_2 * t.angle + (1.0 - VAR_2) * deshake->avg.angle; deshake->avg.zoom = VAR_2 * t.zoom + (1.0 - VAR_2) * deshake->avg.zoom; t.vector.x -= deshake->avg.vector.x; t.vector.y -= deshake->avg.vector.y; t.angle -= deshake->avg.angle; t.zoom -= deshake->avg.zoom; t.vector.x *= -1; t.vector.y *= -1; t.angle *= -1; if (deshake->fp) { snprintf(VAR_3, 256, "%f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f\n", orig.vector.x, deshake->avg.vector.x, t.vector.x, orig.vector.y, deshake->avg.vector.y, t.vector.y, orig.angle, deshake->avg.angle, t.angle, orig.zoom, deshake->avg.zoom, t.zoom); fwrite(VAR_3, sizeof(char), strlen(VAR_3), deshake->fp); } t.vector.x += deshake->last.vector.x; t.vector.y += deshake->last.vector.y; t.angle += deshake->last.angle; t.zoom += deshake->last.zoom; t.vector.x *= 0.9; t.vector.y *= 0.9; t.angle *= 0.9; deshake->last.vector.x = t.vector.x; deshake->last.vector.y = t.vector.y; deshake->last.angle = t.angle; deshake->last.zoom = t.zoom; avfilter_get_matrix(t.vector.x, t.vector.y, t.angle, 1.0 + t.zoom / 100.0, VAR_1); avfilter_transform(in->data[0], out->data[0], in->linesize[0], out->linesize[0], VAR_0->w, VAR_0->h, VAR_1, INTERPOLATE_BILINEAR, deshake->edge); avfilter_get_matrix(t.vector.x / (VAR_0->w / CHROMA_WIDTH(VAR_0)), t.vector.y / (VAR_0->h / CHROMA_HEIGHT(VAR_0)), t.angle, 1.0 + t.zoom / 100.0, VAR_1); avfilter_transform(in->data[1], out->data[1], in->linesize[1], out->linesize[1], CHROMA_WIDTH(VAR_0), CHROMA_HEIGHT(VAR_0), VAR_1, INTERPOLATE_BILINEAR, deshake->edge); avfilter_transform(in->data[2], out->data[2], in->linesize[2], out->linesize[2], CHROMA_WIDTH(VAR_0), CHROMA_HEIGHT(VAR_0), VAR_1, INTERPOLATE_BILINEAR, deshake->edge); if (deshake->ref != NULL) avfilter_unref_buffer(deshake->ref); deshake->ref = in; avfilter_draw_slice(VAR_0->dst->outputs[0], 0, VAR_0->h, 1); avfilter_end_frame(VAR_0->dst->outputs[0]); avfilter_unref_buffer(out); }
[ "static void FUNC_0(AVFilterLink *VAR_0)\n{", "DeshakeContext *deshake = VAR_0->dst->priv;", "AVFilterBufferRef *in = VAR_0->cur_buf;", "AVFilterBufferRef *out = VAR_0->dst->outputs[0]->out_buf;", "Transform t;", "float VAR_1[9];", "float VAR_2 = 2.0 / deshake->refcount;", "char VAR_3[256];", "Transform orig;", "if (deshake->cx < 0 || deshake->cy < 0 || deshake->cw < 0 || deshake->ch < 0) {", "find_motion(deshake, (deshake->ref == NULL) ? in->data[0] : deshake->ref->data[0], in->data[0], VAR_0->w, VAR_0->h, in->linesize[0], &t);", "} else {", "uint8_t *src1 = (deshake->ref == NULL) ? in->data[0] : deshake->ref->data[0];", "uint8_t *src2 = in->data[0];", "deshake->cx = FFMIN(deshake->cx, VAR_0->w);", "deshake->cy = FFMIN(deshake->cy, VAR_0->h);", "if ((unsigned)deshake->cx + (unsigned)deshake->cw > VAR_0->w) deshake->cw = VAR_0->w - deshake->cx;", "if ((unsigned)deshake->cy + (unsigned)deshake->ch > VAR_0->h) deshake->ch = VAR_0->h - deshake->cy;", "deshake->cw &= ~15;", "src1 += deshake->cy * in->linesize[0] + deshake->cx;", "src2 += deshake->cy * in->linesize[0] + deshake->cx;", "find_motion(deshake, src1, src2, deshake->cw, deshake->ch, in->linesize[0], &t);", "}", "orig.vector.x = t.vector.x;", "orig.vector.y = t.vector.y;", "orig.angle = t.angle;", "orig.zoom = t.zoom;", "deshake->avg.vector.x = VAR_2 * t.vector.x + (1.0 - VAR_2) * deshake->avg.vector.x;", "deshake->avg.vector.y = VAR_2 * t.vector.y + (1.0 - VAR_2) * deshake->avg.vector.y;", "deshake->avg.angle = VAR_2 * t.angle + (1.0 - VAR_2) * deshake->avg.angle;", "deshake->avg.zoom = VAR_2 * t.zoom + (1.0 - VAR_2) * deshake->avg.zoom;", "t.vector.x -= deshake->avg.vector.x;", "t.vector.y -= deshake->avg.vector.y;", "t.angle -= deshake->avg.angle;", "t.zoom -= deshake->avg.zoom;", "t.vector.x *= -1;", "t.vector.y *= -1;", "t.angle *= -1;", "if (deshake->fp) {", "snprintf(VAR_3, 256, \"%f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f\\n\", orig.vector.x, deshake->avg.vector.x, t.vector.x, orig.vector.y, deshake->avg.vector.y, t.vector.y, orig.angle, deshake->avg.angle, t.angle, orig.zoom, deshake->avg.zoom, t.zoom);", "fwrite(VAR_3, sizeof(char), strlen(VAR_3), deshake->fp);", "}", "t.vector.x += deshake->last.vector.x;", "t.vector.y += deshake->last.vector.y;", "t.angle += deshake->last.angle;", "t.zoom += deshake->last.zoom;", "t.vector.x *= 0.9;", "t.vector.y *= 0.9;", "t.angle *= 0.9;", "deshake->last.vector.x = t.vector.x;", "deshake->last.vector.y = t.vector.y;", "deshake->last.angle = t.angle;", "deshake->last.zoom = t.zoom;", "avfilter_get_matrix(t.vector.x, t.vector.y, t.angle, 1.0 + t.zoom / 100.0, VAR_1);", "avfilter_transform(in->data[0], out->data[0], in->linesize[0], out->linesize[0], VAR_0->w, VAR_0->h, VAR_1, INTERPOLATE_BILINEAR, deshake->edge);", "avfilter_get_matrix(t.vector.x / (VAR_0->w / CHROMA_WIDTH(VAR_0)), t.vector.y / (VAR_0->h / CHROMA_HEIGHT(VAR_0)), t.angle, 1.0 + t.zoom / 100.0, VAR_1);", "avfilter_transform(in->data[1], out->data[1], in->linesize[1], out->linesize[1], CHROMA_WIDTH(VAR_0), CHROMA_HEIGHT(VAR_0), VAR_1, INTERPOLATE_BILINEAR, deshake->edge);", "avfilter_transform(in->data[2], out->data[2], in->linesize[2], out->linesize[2], CHROMA_WIDTH(VAR_0), CHROMA_HEIGHT(VAR_0), VAR_1, INTERPOLATE_BILINEAR, deshake->edge);", "if (deshake->ref != NULL)\navfilter_unref_buffer(deshake->ref);", "deshake->ref = in;", "avfilter_draw_slice(VAR_0->dst->outputs[0], 0, VAR_0->h, 1);", "avfilter_end_frame(VAR_0->dst->outputs[0]);", "avfilter_unref_buffer(out);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 51 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 109 ], [ 111 ], [ 113 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 145 ], [ 147 ], [ 149 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 167 ], [ 173 ], [ 179 ], [ 185 ], [ 187 ], [ 195, 197 ], [ 203 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ] ]
8,369
static av_cold int dsp_init(AVCodecContext *avctx, AACEncContext *s) { int ret = 0; s->fdsp = avpriv_float_dsp_alloc(avctx->flags & CODEC_FLAG_BITEXACT); if (!s->fdsp) return AVERROR(ENOMEM); // window init ff_kbd_window_init(ff_aac_kbd_long_1024, 4.0, 1024); ff_kbd_window_init(ff_aac_kbd_short_128, 6.0, 128); ff_init_ff_sine_windows(10); ff_init_ff_sine_windows(7); if (ret = ff_mdct_init(&s->mdct1024, 11, 0, 32768.0)) return ret; if (ret = ff_mdct_init(&s->mdct128, 8, 0, 32768.0)) return ret; return 0; }
false
FFmpeg
3fb726c6b4772594365271046d11c87ae8417bde
static av_cold int dsp_init(AVCodecContext *avctx, AACEncContext *s) { int ret = 0; s->fdsp = avpriv_float_dsp_alloc(avctx->flags & CODEC_FLAG_BITEXACT); if (!s->fdsp) return AVERROR(ENOMEM); ff_kbd_window_init(ff_aac_kbd_long_1024, 4.0, 1024); ff_kbd_window_init(ff_aac_kbd_short_128, 6.0, 128); ff_init_ff_sine_windows(10); ff_init_ff_sine_windows(7); if (ret = ff_mdct_init(&s->mdct1024, 11, 0, 32768.0)) return ret; if (ret = ff_mdct_init(&s->mdct128, 8, 0, 32768.0)) return ret; return 0; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx, AACEncContext *s) { int VAR_0 = 0; s->fdsp = avpriv_float_dsp_alloc(avctx->flags & CODEC_FLAG_BITEXACT); if (!s->fdsp) return AVERROR(ENOMEM); ff_kbd_window_init(ff_aac_kbd_long_1024, 4.0, 1024); ff_kbd_window_init(ff_aac_kbd_short_128, 6.0, 128); ff_init_ff_sine_windows(10); ff_init_ff_sine_windows(7); if (VAR_0 = ff_mdct_init(&s->mdct1024, 11, 0, 32768.0)) return VAR_0; if (VAR_0 = ff_mdct_init(&s->mdct128, 8, 0, 32768.0)) return VAR_0; return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx, AACEncContext *s)\n{", "int VAR_0 = 0;", "s->fdsp = avpriv_float_dsp_alloc(avctx->flags & CODEC_FLAG_BITEXACT);", "if (!s->fdsp)\nreturn AVERROR(ENOMEM);", "ff_kbd_window_init(ff_aac_kbd_long_1024, 4.0, 1024);", "ff_kbd_window_init(ff_aac_kbd_short_128, 6.0, 128);", "ff_init_ff_sine_windows(10);", "ff_init_ff_sine_windows(7);", "if (VAR_0 = ff_mdct_init(&s->mdct1024, 11, 0, 32768.0))\nreturn VAR_0;", "if (VAR_0 = ff_mdct_init(&s->mdct128, 8, 0, 32768.0))\nreturn VAR_0;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29, 31 ], [ 33, 35 ], [ 39 ], [ 41 ] ]
8,371
static void sbr_dequant(SpectralBandReplication *sbr, int id_aac) { int k, e; int ch; if (id_aac == TYPE_CPE && sbr->bs_coupling) { int alpha = sbr->data[0].bs_amp_res ? 2 : 1; int pan_offset = sbr->data[0].bs_amp_res ? 12 : 24; for (e = 1; e <= sbr->data[0].bs_num_env; e++) { for (k = 0; k < sbr->n[sbr->data[0].bs_freq_res[e]]; k++) { SoftFloat temp1, temp2, fac; temp1.exp = sbr->data[0].env_facs[e][k].mant * alpha + 14; if (temp1.exp & 1) temp1.mant = 759250125; else temp1.mant = 0x20000000; temp1.exp = (temp1.exp >> 1) + 1; if (temp1.exp > 66) { // temp1 > 1E20 av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n"); temp1 = FLOAT_1; } temp2.exp = (pan_offset - sbr->data[1].env_facs[e][k].mant) * alpha; if (temp2.exp & 1) temp2.mant = 759250125; else temp2.mant = 0x20000000; temp2.exp = (temp2.exp >> 1) + 1; fac = av_div_sf(temp1, av_add_sf(FLOAT_1, temp2)); sbr->data[0].env_facs[e][k] = fac; sbr->data[1].env_facs[e][k] = av_mul_sf(fac, temp2); } } for (e = 1; e <= sbr->data[0].bs_num_noise; e++) { for (k = 0; k < sbr->n_q; k++) { SoftFloat temp1, temp2, fac; temp1.exp = NOISE_FLOOR_OFFSET - \ sbr->data[0].noise_facs[e][k].mant + 2; temp1.mant = 0x20000000; if (temp1.exp > 66) { // temp1 > 1E20 av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n"); temp1 = FLOAT_1; } temp2.exp = 12 - sbr->data[1].noise_facs[e][k].mant + 1; temp2.mant = 0x20000000; fac = av_div_sf(temp1, av_add_sf(FLOAT_1, temp2)); sbr->data[0].noise_facs[e][k] = fac; sbr->data[1].noise_facs[e][k] = av_mul_sf(fac, temp2); } } } else { // SCE or one non-coupled CPE for (ch = 0; ch < (id_aac == TYPE_CPE) + 1; ch++) { int alpha = sbr->data[ch].bs_amp_res ? 2 : 1; for (e = 1; e <= sbr->data[ch].bs_num_env; e++) for (k = 0; k < sbr->n[sbr->data[ch].bs_freq_res[e]]; k++){ SoftFloat temp1; temp1.exp = alpha * sbr->data[ch].env_facs[e][k].mant + 12; if (temp1.exp & 1) temp1.mant = 759250125; else temp1.mant = 0x20000000; temp1.exp = (temp1.exp >> 1) + 1; if (temp1.exp > 66) { // temp1 > 1E20 av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n"); temp1 = FLOAT_1; } sbr->data[ch].env_facs[e][k] = temp1; } for (e = 1; e <= sbr->data[ch].bs_num_noise; e++) for (k = 0; k < sbr->n_q; k++){ sbr->data[ch].noise_facs[e][k].exp = NOISE_FLOOR_OFFSET - \ sbr->data[ch].noise_facs[e][k].mant + 1; sbr->data[ch].noise_facs[e][k].mant = 0x20000000; } } } }
false
FFmpeg
bfd0e02dd64e912a6b67c25d9f86b3b0b849ad10
static void sbr_dequant(SpectralBandReplication *sbr, int id_aac) { int k, e; int ch; if (id_aac == TYPE_CPE && sbr->bs_coupling) { int alpha = sbr->data[0].bs_amp_res ? 2 : 1; int pan_offset = sbr->data[0].bs_amp_res ? 12 : 24; for (e = 1; e <= sbr->data[0].bs_num_env; e++) { for (k = 0; k < sbr->n[sbr->data[0].bs_freq_res[e]]; k++) { SoftFloat temp1, temp2, fac; temp1.exp = sbr->data[0].env_facs[e][k].mant * alpha + 14; if (temp1.exp & 1) temp1.mant = 759250125; else temp1.mant = 0x20000000; temp1.exp = (temp1.exp >> 1) + 1; if (temp1.exp > 66) { av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n"); temp1 = FLOAT_1; } temp2.exp = (pan_offset - sbr->data[1].env_facs[e][k].mant) * alpha; if (temp2.exp & 1) temp2.mant = 759250125; else temp2.mant = 0x20000000; temp2.exp = (temp2.exp >> 1) + 1; fac = av_div_sf(temp1, av_add_sf(FLOAT_1, temp2)); sbr->data[0].env_facs[e][k] = fac; sbr->data[1].env_facs[e][k] = av_mul_sf(fac, temp2); } } for (e = 1; e <= sbr->data[0].bs_num_noise; e++) { for (k = 0; k < sbr->n_q; k++) { SoftFloat temp1, temp2, fac; temp1.exp = NOISE_FLOOR_OFFSET - \ sbr->data[0].noise_facs[e][k].mant + 2; temp1.mant = 0x20000000; if (temp1.exp > 66) { av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n"); temp1 = FLOAT_1; } temp2.exp = 12 - sbr->data[1].noise_facs[e][k].mant + 1; temp2.mant = 0x20000000; fac = av_div_sf(temp1, av_add_sf(FLOAT_1, temp2)); sbr->data[0].noise_facs[e][k] = fac; sbr->data[1].noise_facs[e][k] = av_mul_sf(fac, temp2); } } } else { for (ch = 0; ch < (id_aac == TYPE_CPE) + 1; ch++) { int alpha = sbr->data[ch].bs_amp_res ? 2 : 1; for (e = 1; e <= sbr->data[ch].bs_num_env; e++) for (k = 0; k < sbr->n[sbr->data[ch].bs_freq_res[e]]; k++){ SoftFloat temp1; temp1.exp = alpha * sbr->data[ch].env_facs[e][k].mant + 12; if (temp1.exp & 1) temp1.mant = 759250125; else temp1.mant = 0x20000000; temp1.exp = (temp1.exp >> 1) + 1; if (temp1.exp > 66) { av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n"); temp1 = FLOAT_1; } sbr->data[ch].env_facs[e][k] = temp1; } for (e = 1; e <= sbr->data[ch].bs_num_noise; e++) for (k = 0; k < sbr->n_q; k++){ sbr->data[ch].noise_facs[e][k].exp = NOISE_FLOOR_OFFSET - \ sbr->data[ch].noise_facs[e][k].mant + 1; sbr->data[ch].noise_facs[e][k].mant = 0x20000000; } } } }
{ "code": [], "line_no": [] }
static void FUNC_0(SpectralBandReplication *VAR_0, int VAR_1) { int VAR_2, VAR_3; int VAR_4; if (VAR_1 == TYPE_CPE && VAR_0->bs_coupling) { int VAR_5 = VAR_0->data[0].bs_amp_res ? 2 : 1; int VAR_6 = VAR_0->data[0].bs_amp_res ? 12 : 24; for (VAR_3 = 1; VAR_3 <= VAR_0->data[0].bs_num_env; VAR_3++) { for (VAR_2 = 0; VAR_2 < VAR_0->n[VAR_0->data[0].bs_freq_res[VAR_3]]; VAR_2++) { SoftFloat temp1, temp2, fac; temp1.exp = VAR_0->data[0].env_facs[VAR_3][VAR_2].mant * VAR_5 + 14; if (temp1.exp & 1) temp1.mant = 759250125; else temp1.mant = 0x20000000; temp1.exp = (temp1.exp >> 1) + 1; if (temp1.exp > 66) { av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n"); temp1 = FLOAT_1; } temp2.exp = (VAR_6 - VAR_0->data[1].env_facs[VAR_3][VAR_2].mant) * VAR_5; if (temp2.exp & 1) temp2.mant = 759250125; else temp2.mant = 0x20000000; temp2.exp = (temp2.exp >> 1) + 1; fac = av_div_sf(temp1, av_add_sf(FLOAT_1, temp2)); VAR_0->data[0].env_facs[VAR_3][VAR_2] = fac; VAR_0->data[1].env_facs[VAR_3][VAR_2] = av_mul_sf(fac, temp2); } } for (VAR_3 = 1; VAR_3 <= VAR_0->data[0].bs_num_noise; VAR_3++) { for (VAR_2 = 0; VAR_2 < VAR_0->n_q; VAR_2++) { SoftFloat temp1, temp2, fac; temp1.exp = NOISE_FLOOR_OFFSET - \ VAR_0->data[0].noise_facs[VAR_3][VAR_2].mant + 2; temp1.mant = 0x20000000; if (temp1.exp > 66) { av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n"); temp1 = FLOAT_1; } temp2.exp = 12 - VAR_0->data[1].noise_facs[VAR_3][VAR_2].mant + 1; temp2.mant = 0x20000000; fac = av_div_sf(temp1, av_add_sf(FLOAT_1, temp2)); VAR_0->data[0].noise_facs[VAR_3][VAR_2] = fac; VAR_0->data[1].noise_facs[VAR_3][VAR_2] = av_mul_sf(fac, temp2); } } } else { for (VAR_4 = 0; VAR_4 < (VAR_1 == TYPE_CPE) + 1; VAR_4++) { int VAR_5 = VAR_0->data[VAR_4].bs_amp_res ? 2 : 1; for (VAR_3 = 1; VAR_3 <= VAR_0->data[VAR_4].bs_num_env; VAR_3++) for (VAR_2 = 0; VAR_2 < VAR_0->n[VAR_0->data[VAR_4].bs_freq_res[VAR_3]]; VAR_2++){ SoftFloat temp1; temp1.exp = VAR_5 * VAR_0->data[VAR_4].env_facs[VAR_3][VAR_2].mant + 12; if (temp1.exp & 1) temp1.mant = 759250125; else temp1.mant = 0x20000000; temp1.exp = (temp1.exp >> 1) + 1; if (temp1.exp > 66) { av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n"); temp1 = FLOAT_1; } VAR_0->data[VAR_4].env_facs[VAR_3][VAR_2] = temp1; } for (VAR_3 = 1; VAR_3 <= VAR_0->data[VAR_4].bs_num_noise; VAR_3++) for (VAR_2 = 0; VAR_2 < VAR_0->n_q; VAR_2++){ VAR_0->data[VAR_4].noise_facs[VAR_3][VAR_2].exp = NOISE_FLOOR_OFFSET - \ VAR_0->data[VAR_4].noise_facs[VAR_3][VAR_2].mant + 1; VAR_0->data[VAR_4].noise_facs[VAR_3][VAR_2].mant = 0x20000000; } } } }
[ "static void FUNC_0(SpectralBandReplication *VAR_0, int VAR_1)\n{", "int VAR_2, VAR_3;", "int VAR_4;", "if (VAR_1 == TYPE_CPE && VAR_0->bs_coupling) {", "int VAR_5 = VAR_0->data[0].bs_amp_res ? 2 : 1;", "int VAR_6 = VAR_0->data[0].bs_amp_res ? 12 : 24;", "for (VAR_3 = 1; VAR_3 <= VAR_0->data[0].bs_num_env; VAR_3++) {", "for (VAR_2 = 0; VAR_2 < VAR_0->n[VAR_0->data[0].bs_freq_res[VAR_3]]; VAR_2++) {", "SoftFloat temp1, temp2, fac;", "temp1.exp = VAR_0->data[0].env_facs[VAR_3][VAR_2].mant * VAR_5 + 14;", "if (temp1.exp & 1)\ntemp1.mant = 759250125;", "else\ntemp1.mant = 0x20000000;", "temp1.exp = (temp1.exp >> 1) + 1;", "if (temp1.exp > 66) {", "av_log(NULL, AV_LOG_ERROR, \"envelope scalefactor overflow in dequant\\n\");", "temp1 = FLOAT_1;", "}", "temp2.exp = (VAR_6 - VAR_0->data[1].env_facs[VAR_3][VAR_2].mant) * VAR_5;", "if (temp2.exp & 1)\ntemp2.mant = 759250125;", "else\ntemp2.mant = 0x20000000;", "temp2.exp = (temp2.exp >> 1) + 1;", "fac = av_div_sf(temp1, av_add_sf(FLOAT_1, temp2));", "VAR_0->data[0].env_facs[VAR_3][VAR_2] = fac;", "VAR_0->data[1].env_facs[VAR_3][VAR_2] = av_mul_sf(fac, temp2);", "}", "}", "for (VAR_3 = 1; VAR_3 <= VAR_0->data[0].bs_num_noise; VAR_3++) {", "for (VAR_2 = 0; VAR_2 < VAR_0->n_q; VAR_2++) {", "SoftFloat temp1, temp2, fac;", "temp1.exp = NOISE_FLOOR_OFFSET - \\\nVAR_0->data[0].noise_facs[VAR_3][VAR_2].mant + 2;", "temp1.mant = 0x20000000;", "if (temp1.exp > 66) {", "av_log(NULL, AV_LOG_ERROR, \"envelope scalefactor overflow in dequant\\n\");", "temp1 = FLOAT_1;", "}", "temp2.exp = 12 - VAR_0->data[1].noise_facs[VAR_3][VAR_2].mant + 1;", "temp2.mant = 0x20000000;", "fac = av_div_sf(temp1, av_add_sf(FLOAT_1, temp2));", "VAR_0->data[0].noise_facs[VAR_3][VAR_2] = fac;", "VAR_0->data[1].noise_facs[VAR_3][VAR_2] = av_mul_sf(fac, temp2);", "}", "}", "} else {", "for (VAR_4 = 0; VAR_4 < (VAR_1 == TYPE_CPE) + 1; VAR_4++) {", "int VAR_5 = VAR_0->data[VAR_4].bs_amp_res ? 2 : 1;", "for (VAR_3 = 1; VAR_3 <= VAR_0->data[VAR_4].bs_num_env; VAR_3++)", "for (VAR_2 = 0; VAR_2 < VAR_0->n[VAR_0->data[VAR_4].bs_freq_res[VAR_3]]; VAR_2++){", "SoftFloat temp1;", "temp1.exp = VAR_5 * VAR_0->data[VAR_4].env_facs[VAR_3][VAR_2].mant + 12;", "if (temp1.exp & 1)\ntemp1.mant = 759250125;", "else\ntemp1.mant = 0x20000000;", "temp1.exp = (temp1.exp >> 1) + 1;", "if (temp1.exp > 66) {", "av_log(NULL, AV_LOG_ERROR, \"envelope scalefactor overflow in dequant\\n\");", "temp1 = FLOAT_1;", "}", "VAR_0->data[VAR_4].env_facs[VAR_3][VAR_2] = temp1;", "}", "for (VAR_3 = 1; VAR_3 <= VAR_0->data[VAR_4].bs_num_noise; VAR_3++)", "for (VAR_2 = 0; VAR_2 < VAR_0->n_q; VAR_2++){", "VAR_0->data[VAR_4].noise_facs[VAR_3][VAR_2].exp = NOISE_FLOOR_OFFSET - \\\nVAR_0->data[VAR_4].noise_facs[VAR_3][VAR_2].mant + 1;", "VAR_0->data[VAR_4].noise_facs[VAR_3][VAR_2].mant = 0x20000000;", "}", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27, 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49, 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 121, 123 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147, 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ] ]
8,372
static int decode_value(SCPRContext *s, unsigned *cnt, unsigned maxc, unsigned step, unsigned *rval) { GetByteContext *gb = &s->gb; RangeCoder *rc = &s->rc; unsigned totfr = cnt[maxc]; unsigned value; unsigned c = 0, cumfr = 0, cnt_c = 0; int i, ret; if ((ret = s->get_freq(rc, totfr, &value)) < 0) return ret; while (c < maxc) { cnt_c = cnt[c]; if (value >= cumfr + cnt_c) cumfr += cnt_c; else break; c++; } s->decode(gb, rc, cumfr, cnt_c, totfr); cnt[c] = cnt_c + step; totfr += step; if (totfr > BOT) { totfr = 0; for (i = 0; i < maxc; i++) { unsigned nc = (cnt[i] >> 1) + 1; cnt[i] = nc; totfr += nc; } } cnt[maxc] = totfr; *rval = c; return 0; }
false
FFmpeg
86ab6b6e08e2982fb5785e0691c0a7e289339ffb
static int decode_value(SCPRContext *s, unsigned *cnt, unsigned maxc, unsigned step, unsigned *rval) { GetByteContext *gb = &s->gb; RangeCoder *rc = &s->rc; unsigned totfr = cnt[maxc]; unsigned value; unsigned c = 0, cumfr = 0, cnt_c = 0; int i, ret; if ((ret = s->get_freq(rc, totfr, &value)) < 0) return ret; while (c < maxc) { cnt_c = cnt[c]; if (value >= cumfr + cnt_c) cumfr += cnt_c; else break; c++; } s->decode(gb, rc, cumfr, cnt_c, totfr); cnt[c] = cnt_c + step; totfr += step; if (totfr > BOT) { totfr = 0; for (i = 0; i < maxc; i++) { unsigned nc = (cnt[i] >> 1) + 1; cnt[i] = nc; totfr += nc; } } cnt[maxc] = totfr; *rval = c; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(SCPRContext *VAR_0, unsigned *VAR_1, unsigned VAR_2, unsigned VAR_3, unsigned *VAR_4) { GetByteContext *gb = &VAR_0->gb; RangeCoder *rc = &VAR_0->rc; unsigned VAR_5 = VAR_1[VAR_2]; unsigned VAR_6; unsigned VAR_7 = 0, VAR_8 = 0, VAR_9 = 0; int VAR_10, VAR_11; if ((VAR_11 = VAR_0->get_freq(rc, VAR_5, &VAR_6)) < 0) return VAR_11; while (VAR_7 < VAR_2) { VAR_9 = VAR_1[VAR_7]; if (VAR_6 >= VAR_8 + VAR_9) VAR_8 += VAR_9; else break; VAR_7++; } VAR_0->decode(gb, rc, VAR_8, VAR_9, VAR_5); VAR_1[VAR_7] = VAR_9 + VAR_3; VAR_5 += VAR_3; if (VAR_5 > BOT) { VAR_5 = 0; for (VAR_10 = 0; VAR_10 < VAR_2; VAR_10++) { unsigned VAR_12 = (VAR_1[VAR_10] >> 1) + 1; VAR_1[VAR_10] = VAR_12; VAR_5 += VAR_12; } } VAR_1[VAR_2] = VAR_5; *VAR_4 = VAR_7; return 0; }
[ "static int FUNC_0(SCPRContext *VAR_0, unsigned *VAR_1, unsigned VAR_2, unsigned VAR_3, unsigned *VAR_4)\n{", "GetByteContext *gb = &VAR_0->gb;", "RangeCoder *rc = &VAR_0->rc;", "unsigned VAR_5 = VAR_1[VAR_2];", "unsigned VAR_6;", "unsigned VAR_7 = 0, VAR_8 = 0, VAR_9 = 0;", "int VAR_10, VAR_11;", "if ((VAR_11 = VAR_0->get_freq(rc, VAR_5, &VAR_6)) < 0)\nreturn VAR_11;", "while (VAR_7 < VAR_2) {", "VAR_9 = VAR_1[VAR_7];", "if (VAR_6 >= VAR_8 + VAR_9)\nVAR_8 += VAR_9;", "else\nbreak;", "VAR_7++;", "}", "VAR_0->decode(gb, rc, VAR_8, VAR_9, VAR_5);", "VAR_1[VAR_7] = VAR_9 + VAR_3;", "VAR_5 += VAR_3;", "if (VAR_5 > BOT) {", "VAR_5 = 0;", "for (VAR_10 = 0; VAR_10 < VAR_2; VAR_10++) {", "unsigned VAR_12 = (VAR_1[VAR_10] >> 1) + 1;", "VAR_1[VAR_10] = VAR_12;", "VAR_5 += VAR_12;", "}", "}", "VAR_1[VAR_2] = VAR_5;", "*VAR_4 = VAR_7;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ] ]
8,373
char *socket_address_to_string(struct SocketAddressLegacy *addr, Error **errp) { char *buf; InetSocketAddress *inet; switch (addr->type) { case SOCKET_ADDRESS_LEGACY_KIND_INET: inet = addr->u.inet.data; if (strchr(inet->host, ':') == NULL) { buf = g_strdup_printf("%s:%s", inet->host, inet->port); } else { buf = g_strdup_printf("[%s]:%s", inet->host, inet->port); } break; case SOCKET_ADDRESS_LEGACY_KIND_UNIX: buf = g_strdup(addr->u.q_unix.data->path); break; case SOCKET_ADDRESS_LEGACY_KIND_FD: buf = g_strdup(addr->u.fd.data->str); break; case SOCKET_ADDRESS_LEGACY_KIND_VSOCK: buf = g_strdup_printf("%s:%s", addr->u.vsock.data->cid, addr->u.vsock.data->port); break; default: abort(); } return buf; }
false
qemu
bd269ebc82fbaa5fe7ce5bc7c1770ac8acecd884
char *socket_address_to_string(struct SocketAddressLegacy *addr, Error **errp) { char *buf; InetSocketAddress *inet; switch (addr->type) { case SOCKET_ADDRESS_LEGACY_KIND_INET: inet = addr->u.inet.data; if (strchr(inet->host, ':') == NULL) { buf = g_strdup_printf("%s:%s", inet->host, inet->port); } else { buf = g_strdup_printf("[%s]:%s", inet->host, inet->port); } break; case SOCKET_ADDRESS_LEGACY_KIND_UNIX: buf = g_strdup(addr->u.q_unix.data->path); break; case SOCKET_ADDRESS_LEGACY_KIND_FD: buf = g_strdup(addr->u.fd.data->str); break; case SOCKET_ADDRESS_LEGACY_KIND_VSOCK: buf = g_strdup_printf("%s:%s", addr->u.vsock.data->cid, addr->u.vsock.data->port); break; default: abort(); } return buf; }
{ "code": [], "line_no": [] }
char *FUNC_0(struct SocketAddressLegacy *VAR_0, Error **VAR_1) { char *VAR_2; InetSocketAddress *inet; switch (VAR_0->type) { case SOCKET_ADDRESS_LEGACY_KIND_INET: inet = VAR_0->u.inet.data; if (strchr(inet->host, ':') == NULL) { VAR_2 = g_strdup_printf("%s:%s", inet->host, inet->port); } else { VAR_2 = g_strdup_printf("[%s]:%s", inet->host, inet->port); } break; case SOCKET_ADDRESS_LEGACY_KIND_UNIX: VAR_2 = g_strdup(VAR_0->u.q_unix.data->path); break; case SOCKET_ADDRESS_LEGACY_KIND_FD: VAR_2 = g_strdup(VAR_0->u.fd.data->str); break; case SOCKET_ADDRESS_LEGACY_KIND_VSOCK: VAR_2 = g_strdup_printf("%s:%s", VAR_0->u.vsock.data->cid, VAR_0->u.vsock.data->port); break; default: abort(); } return VAR_2; }
[ "char *FUNC_0(struct SocketAddressLegacy *VAR_0, Error **VAR_1)\n{", "char *VAR_2;", "InetSocketAddress *inet;", "switch (VAR_0->type) {", "case SOCKET_ADDRESS_LEGACY_KIND_INET:\ninet = VAR_0->u.inet.data;", "if (strchr(inet->host, ':') == NULL) {", "VAR_2 = g_strdup_printf(\"%s:%s\", inet->host, inet->port);", "} else {", "VAR_2 = g_strdup_printf(\"[%s]:%s\", inet->host, inet->port);", "}", "break;", "case SOCKET_ADDRESS_LEGACY_KIND_UNIX:\nVAR_2 = g_strdup(VAR_0->u.q_unix.data->path);", "break;", "case SOCKET_ADDRESS_LEGACY_KIND_FD:\nVAR_2 = g_strdup(VAR_0->u.fd.data->str);", "break;", "case SOCKET_ADDRESS_LEGACY_KIND_VSOCK:\nVAR_2 = g_strdup_printf(\"%s:%s\",\nVAR_0->u.vsock.data->cid,\nVAR_0->u.vsock.data->port);", "break;", "default:\nabort();", "}", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31, 33 ], [ 35 ], [ 39, 41 ], [ 43 ], [ 47, 49, 51, 53 ], [ 55 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ] ]
8,375
START_TEST(unterminated_escape) { QObject *obj = qobject_from_json("\"abc\\\""); fail_unless(obj == NULL); }
false
qemu
ef76dc59fa5203d146a2acf85a0ad5a5971a4824
START_TEST(unterminated_escape) { QObject *obj = qobject_from_json("\"abc\\\""); fail_unless(obj == NULL); }
{ "code": [], "line_no": [] }
FUNC_0(VAR_0) { QObject *obj = qobject_from_json("\"abc\\\""); fail_unless(obj == NULL); }
[ "FUNC_0(VAR_0)\n{", "QObject *obj = qobject_from_json(\"\\\"abc\\\\\\\"\");", "fail_unless(obj == NULL);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
8,376
BlockBackend *blk_new(uint64_t perm, uint64_t shared_perm) { BlockBackend *blk; blk = g_new0(BlockBackend, 1); blk->refcnt = 1; blk->perm = perm; blk->shared_perm = shared_perm; blk_set_enable_write_cache(blk, true); qemu_co_mutex_init(&blk->public.throttle_group_member.throttled_reqs_lock); qemu_co_queue_init(&blk->public.throttle_group_member.throttled_reqs[0]); qemu_co_queue_init(&blk->public.throttle_group_member.throttled_reqs[1]); block_acct_init(&blk->stats); notifier_list_init(&blk->remove_bs_notifiers); notifier_list_init(&blk->insert_bs_notifiers); QTAILQ_INSERT_TAIL(&block_backends, blk, link); return blk; }
false
qemu
f738cfc843055238ad969782db69156929873832
BlockBackend *blk_new(uint64_t perm, uint64_t shared_perm) { BlockBackend *blk; blk = g_new0(BlockBackend, 1); blk->refcnt = 1; blk->perm = perm; blk->shared_perm = shared_perm; blk_set_enable_write_cache(blk, true); qemu_co_mutex_init(&blk->public.throttle_group_member.throttled_reqs_lock); qemu_co_queue_init(&blk->public.throttle_group_member.throttled_reqs[0]); qemu_co_queue_init(&blk->public.throttle_group_member.throttled_reqs[1]); block_acct_init(&blk->stats); notifier_list_init(&blk->remove_bs_notifiers); notifier_list_init(&blk->insert_bs_notifiers); QTAILQ_INSERT_TAIL(&block_backends, blk, link); return blk; }
{ "code": [], "line_no": [] }
BlockBackend *FUNC_0(uint64_t perm, uint64_t shared_perm) { BlockBackend *blk; blk = g_new0(BlockBackend, 1); blk->refcnt = 1; blk->perm = perm; blk->shared_perm = shared_perm; blk_set_enable_write_cache(blk, true); qemu_co_mutex_init(&blk->public.throttle_group_member.throttled_reqs_lock); qemu_co_queue_init(&blk->public.throttle_group_member.throttled_reqs[0]); qemu_co_queue_init(&blk->public.throttle_group_member.throttled_reqs[1]); block_acct_init(&blk->stats); notifier_list_init(&blk->remove_bs_notifiers); notifier_list_init(&blk->insert_bs_notifiers); QTAILQ_INSERT_TAIL(&block_backends, blk, link); return blk; }
[ "BlockBackend *FUNC_0(uint64_t perm, uint64_t shared_perm)\n{", "BlockBackend *blk;", "blk = g_new0(BlockBackend, 1);", "blk->refcnt = 1;", "blk->perm = perm;", "blk->shared_perm = shared_perm;", "blk_set_enable_write_cache(blk, true);", "qemu_co_mutex_init(&blk->public.throttle_group_member.throttled_reqs_lock);", "qemu_co_queue_init(&blk->public.throttle_group_member.throttled_reqs[0]);", "qemu_co_queue_init(&blk->public.throttle_group_member.throttled_reqs[1]);", "block_acct_init(&blk->stats);", "notifier_list_init(&blk->remove_bs_notifiers);", "notifier_list_init(&blk->insert_bs_notifiers);", "QTAILQ_INSERT_TAIL(&block_backends, blk, link);", "return blk;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ] ]
8,377
static inline int put_dwords(uint32_t addr, uint32_t *buf, int num) { int i; for(i = 0; i < num; i++, buf++, addr += sizeof(*buf)) { uint32_t tmp = cpu_to_le32(*buf); cpu_physical_memory_rw(addr,(uint8_t *)&tmp, sizeof(tmp), 1); } return 1; }
false
qemu
68d553587c0aa271c3eb2902921b503740d775b6
static inline int put_dwords(uint32_t addr, uint32_t *buf, int num) { int i; for(i = 0; i < num; i++, buf++, addr += sizeof(*buf)) { uint32_t tmp = cpu_to_le32(*buf); cpu_physical_memory_rw(addr,(uint8_t *)&tmp, sizeof(tmp), 1); } return 1; }
{ "code": [], "line_no": [] }
static inline int FUNC_0(uint32_t VAR_0, uint32_t *VAR_1, int VAR_2) { int VAR_3; for(VAR_3 = 0; VAR_3 < VAR_2; VAR_3++, VAR_1++, VAR_0 += sizeof(*VAR_1)) { uint32_t tmp = cpu_to_le32(*VAR_1); cpu_physical_memory_rw(VAR_0,(uint8_t *)&tmp, sizeof(tmp), 1); } return 1; }
[ "static inline int FUNC_0(uint32_t VAR_0, uint32_t *VAR_1, int VAR_2)\n{", "int VAR_3;", "for(VAR_3 = 0; VAR_3 < VAR_2; VAR_3++, VAR_1++, VAR_0 += sizeof(*VAR_1)) {", "uint32_t tmp = cpu_to_le32(*VAR_1);", "cpu_physical_memory_rw(VAR_0,(uint8_t *)&tmp, sizeof(tmp), 1);", "}", "return 1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ] ]
8,378
static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquant, int ttmb, int first_block, uint8_t *dst, int linesize, int skip_block) { MpegEncContext *s = &v->s; GetBitContext *gb = &s->gb; int i, j; int subblkpat = 0; int scale, off, idx, last, skip, value; int ttblk = ttmb & 7; if(ttmb == -1) { ttblk = ff_vc1_ttblk_to_tt[v->tt_index][get_vlc2(gb, ff_vc1_ttblk_vlc[v->tt_index].table, VC1_TTBLK_VLC_BITS, 1)]; } if(ttblk == TT_4X4) { subblkpat = ~(get_vlc2(gb, ff_vc1_subblkpat_vlc[v->tt_index].table, VC1_SUBBLKPAT_VLC_BITS, 1) + 1); } if((ttblk != TT_8X8 && ttblk != TT_4X4) && (v->ttmbf || (ttmb != -1 && (ttmb & 8) && !first_block))) { subblkpat = decode012(gb); if(subblkpat) subblkpat ^= 3; //swap decoded pattern bits if(ttblk == TT_8X4_TOP || ttblk == TT_8X4_BOTTOM) ttblk = TT_8X4; if(ttblk == TT_4X8_RIGHT || ttblk == TT_4X8_LEFT) ttblk = TT_4X8; } scale = 2 * mquant + ((v->pq == mquant) ? v->halfpq : 0); // convert transforms like 8X4_TOP to generic TT and SUBBLKPAT if(ttblk == TT_8X4_TOP || ttblk == TT_8X4_BOTTOM) { subblkpat = 2 - (ttblk == TT_8X4_TOP); ttblk = TT_8X4; } if(ttblk == TT_4X8_RIGHT || ttblk == TT_4X8_LEFT) { subblkpat = 2 - (ttblk == TT_4X8_LEFT); ttblk = TT_4X8; } switch(ttblk) { case TT_8X8: i = 0; last = 0; while (!last) { vc1_decode_ac_coeff(v, &last, &skip, &value, v->codingset2); i += skip; if(i > 63) break; idx = wmv1_scantable[0][i++]; block[idx] = value * scale; if(!v->pquantizer) block[idx] += (block[idx] < 0) ? -mquant : mquant; } if(!skip_block){ s->dsp.vc1_inv_trans_8x8(block); s->dsp.add_pixels_clamped(block, dst, linesize); } break; case TT_4X4: for(j = 0; j < 4; j++) { last = subblkpat & (1 << (3 - j)); i = 0; off = (j & 1) * 4 + (j & 2) * 16; while (!last) { vc1_decode_ac_coeff(v, &last, &skip, &value, v->codingset2); i += skip; if(i > 15) break; idx = ff_vc1_simple_progressive_4x4_zz[i++]; block[idx + off] = value * scale; if(!v->pquantizer) block[idx + off] += (block[idx + off] < 0) ? -mquant : mquant; } if(!(subblkpat & (1 << (3 - j))) && !skip_block) s->dsp.vc1_inv_trans_4x4(dst + (j&1)*4 + (j&2)*2*linesize, linesize, block + off); } break; case TT_8X4: for(j = 0; j < 2; j++) { last = subblkpat & (1 << (1 - j)); i = 0; off = j * 32; while (!last) { vc1_decode_ac_coeff(v, &last, &skip, &value, v->codingset2); i += skip; if(i > 31) break; idx = v->zz_8x4[i++]+off; block[idx] = value * scale; if(!v->pquantizer) block[idx] += (block[idx] < 0) ? -mquant : mquant; } if(!(subblkpat & (1 << (1 - j))) && !skip_block) s->dsp.vc1_inv_trans_8x4(dst + j*4*linesize, linesize, block + off); } break; case TT_4X8: for(j = 0; j < 2; j++) { last = subblkpat & (1 << (1 - j)); i = 0; off = j * 4; while (!last) { vc1_decode_ac_coeff(v, &last, &skip, &value, v->codingset2); i += skip; if(i > 31) break; idx = v->zz_4x8[i++]+off; block[idx] = value * scale; if(!v->pquantizer) block[idx] += (block[idx] < 0) ? -mquant : mquant; } if(!(subblkpat & (1 << (1 - j))) && !skip_block) s->dsp.vc1_inv_trans_4x8(dst + j*4, linesize, block + off); } break; } return 0; }
false
FFmpeg
00a750009ffe232960ab0f729fdcbd454b233e26
static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquant, int ttmb, int first_block, uint8_t *dst, int linesize, int skip_block) { MpegEncContext *s = &v->s; GetBitContext *gb = &s->gb; int i, j; int subblkpat = 0; int scale, off, idx, last, skip, value; int ttblk = ttmb & 7; if(ttmb == -1) { ttblk = ff_vc1_ttblk_to_tt[v->tt_index][get_vlc2(gb, ff_vc1_ttblk_vlc[v->tt_index].table, VC1_TTBLK_VLC_BITS, 1)]; } if(ttblk == TT_4X4) { subblkpat = ~(get_vlc2(gb, ff_vc1_subblkpat_vlc[v->tt_index].table, VC1_SUBBLKPAT_VLC_BITS, 1) + 1); } if((ttblk != TT_8X8 && ttblk != TT_4X4) && (v->ttmbf || (ttmb != -1 && (ttmb & 8) && !first_block))) { subblkpat = decode012(gb); if(subblkpat) subblkpat ^= 3; if(ttblk == TT_8X4_TOP || ttblk == TT_8X4_BOTTOM) ttblk = TT_8X4; if(ttblk == TT_4X8_RIGHT || ttblk == TT_4X8_LEFT) ttblk = TT_4X8; } scale = 2 * mquant + ((v->pq == mquant) ? v->halfpq : 0); if(ttblk == TT_8X4_TOP || ttblk == TT_8X4_BOTTOM) { subblkpat = 2 - (ttblk == TT_8X4_TOP); ttblk = TT_8X4; } if(ttblk == TT_4X8_RIGHT || ttblk == TT_4X8_LEFT) { subblkpat = 2 - (ttblk == TT_4X8_LEFT); ttblk = TT_4X8; } switch(ttblk) { case TT_8X8: i = 0; last = 0; while (!last) { vc1_decode_ac_coeff(v, &last, &skip, &value, v->codingset2); i += skip; if(i > 63) break; idx = wmv1_scantable[0][i++]; block[idx] = value * scale; if(!v->pquantizer) block[idx] += (block[idx] < 0) ? -mquant : mquant; } if(!skip_block){ s->dsp.vc1_inv_trans_8x8(block); s->dsp.add_pixels_clamped(block, dst, linesize); } break; case TT_4X4: for(j = 0; j < 4; j++) { last = subblkpat & (1 << (3 - j)); i = 0; off = (j & 1) * 4 + (j & 2) * 16; while (!last) { vc1_decode_ac_coeff(v, &last, &skip, &value, v->codingset2); i += skip; if(i > 15) break; idx = ff_vc1_simple_progressive_4x4_zz[i++]; block[idx + off] = value * scale; if(!v->pquantizer) block[idx + off] += (block[idx + off] < 0) ? -mquant : mquant; } if(!(subblkpat & (1 << (3 - j))) && !skip_block) s->dsp.vc1_inv_trans_4x4(dst + (j&1)*4 + (j&2)*2*linesize, linesize, block + off); } break; case TT_8X4: for(j = 0; j < 2; j++) { last = subblkpat & (1 << (1 - j)); i = 0; off = j * 32; while (!last) { vc1_decode_ac_coeff(v, &last, &skip, &value, v->codingset2); i += skip; if(i > 31) break; idx = v->zz_8x4[i++]+off; block[idx] = value * scale; if(!v->pquantizer) block[idx] += (block[idx] < 0) ? -mquant : mquant; } if(!(subblkpat & (1 << (1 - j))) && !skip_block) s->dsp.vc1_inv_trans_8x4(dst + j*4*linesize, linesize, block + off); } break; case TT_4X8: for(j = 0; j < 2; j++) { last = subblkpat & (1 << (1 - j)); i = 0; off = j * 4; while (!last) { vc1_decode_ac_coeff(v, &last, &skip, &value, v->codingset2); i += skip; if(i > 31) break; idx = v->zz_4x8[i++]+off; block[idx] = value * scale; if(!v->pquantizer) block[idx] += (block[idx] < 0) ? -mquant : mquant; } if(!(subblkpat & (1 << (1 - j))) && !skip_block) s->dsp.vc1_inv_trans_4x8(dst + j*4, linesize, block + off); } break; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(VC1Context *VAR_0, DCTELEM VAR_1[64], int VAR_2, int VAR_3, int VAR_4, int VAR_5, uint8_t *VAR_6, int VAR_7, int VAR_8) { MpegEncContext *s = &VAR_0->s; GetBitContext *gb = &s->gb; int VAR_9, VAR_10; int VAR_11 = 0; int VAR_12, VAR_13, VAR_14, VAR_15, VAR_16, VAR_17; int VAR_18 = VAR_4 & 7; if(VAR_4 == -1) { VAR_18 = ff_vc1_ttblk_to_tt[VAR_0->tt_index][get_vlc2(gb, ff_vc1_ttblk_vlc[VAR_0->tt_index].table, VC1_TTBLK_VLC_BITS, 1)]; } if(VAR_18 == TT_4X4) { VAR_11 = ~(get_vlc2(gb, ff_vc1_subblkpat_vlc[VAR_0->tt_index].table, VC1_SUBBLKPAT_VLC_BITS, 1) + 1); } if((VAR_18 != TT_8X8 && VAR_18 != TT_4X4) && (VAR_0->ttmbf || (VAR_4 != -1 && (VAR_4 & 8) && !VAR_5))) { VAR_11 = decode012(gb); if(VAR_11) VAR_11 ^= 3; if(VAR_18 == TT_8X4_TOP || VAR_18 == TT_8X4_BOTTOM) VAR_18 = TT_8X4; if(VAR_18 == TT_4X8_RIGHT || VAR_18 == TT_4X8_LEFT) VAR_18 = TT_4X8; } VAR_12 = 2 * VAR_3 + ((VAR_0->pq == VAR_3) ? VAR_0->halfpq : 0); if(VAR_18 == TT_8X4_TOP || VAR_18 == TT_8X4_BOTTOM) { VAR_11 = 2 - (VAR_18 == TT_8X4_TOP); VAR_18 = TT_8X4; } if(VAR_18 == TT_4X8_RIGHT || VAR_18 == TT_4X8_LEFT) { VAR_11 = 2 - (VAR_18 == TT_4X8_LEFT); VAR_18 = TT_4X8; } switch(VAR_18) { case TT_8X8: VAR_9 = 0; VAR_15 = 0; while (!VAR_15) { vc1_decode_ac_coeff(VAR_0, &VAR_15, &VAR_16, &VAR_17, VAR_0->codingset2); VAR_9 += VAR_16; if(VAR_9 > 63) break; VAR_14 = wmv1_scantable[0][VAR_9++]; VAR_1[VAR_14] = VAR_17 * VAR_12; if(!VAR_0->pquantizer) VAR_1[VAR_14] += (VAR_1[VAR_14] < 0) ? -VAR_3 : VAR_3; } if(!VAR_8){ s->dsp.vc1_inv_trans_8x8(VAR_1); s->dsp.add_pixels_clamped(VAR_1, VAR_6, VAR_7); } break; case TT_4X4: for(VAR_10 = 0; VAR_10 < 4; VAR_10++) { VAR_15 = VAR_11 & (1 << (3 - VAR_10)); VAR_9 = 0; VAR_13 = (VAR_10 & 1) * 4 + (VAR_10 & 2) * 16; while (!VAR_15) { vc1_decode_ac_coeff(VAR_0, &VAR_15, &VAR_16, &VAR_17, VAR_0->codingset2); VAR_9 += VAR_16; if(VAR_9 > 15) break; VAR_14 = ff_vc1_simple_progressive_4x4_zz[VAR_9++]; VAR_1[VAR_14 + VAR_13] = VAR_17 * VAR_12; if(!VAR_0->pquantizer) VAR_1[VAR_14 + VAR_13] += (VAR_1[VAR_14 + VAR_13] < 0) ? -VAR_3 : VAR_3; } if(!(VAR_11 & (1 << (3 - VAR_10))) && !VAR_8) s->dsp.vc1_inv_trans_4x4(VAR_6 + (VAR_10&1)*4 + (VAR_10&2)*2*VAR_7, VAR_7, VAR_1 + VAR_13); } break; case TT_8X4: for(VAR_10 = 0; VAR_10 < 2; VAR_10++) { VAR_15 = VAR_11 & (1 << (1 - VAR_10)); VAR_9 = 0; VAR_13 = VAR_10 * 32; while (!VAR_15) { vc1_decode_ac_coeff(VAR_0, &VAR_15, &VAR_16, &VAR_17, VAR_0->codingset2); VAR_9 += VAR_16; if(VAR_9 > 31) break; VAR_14 = VAR_0->zz_8x4[VAR_9++]+VAR_13; VAR_1[VAR_14] = VAR_17 * VAR_12; if(!VAR_0->pquantizer) VAR_1[VAR_14] += (VAR_1[VAR_14] < 0) ? -VAR_3 : VAR_3; } if(!(VAR_11 & (1 << (1 - VAR_10))) && !VAR_8) s->dsp.vc1_inv_trans_8x4(VAR_6 + VAR_10*4*VAR_7, VAR_7, VAR_1 + VAR_13); } break; case TT_4X8: for(VAR_10 = 0; VAR_10 < 2; VAR_10++) { VAR_15 = VAR_11 & (1 << (1 - VAR_10)); VAR_9 = 0; VAR_13 = VAR_10 * 4; while (!VAR_15) { vc1_decode_ac_coeff(VAR_0, &VAR_15, &VAR_16, &VAR_17, VAR_0->codingset2); VAR_9 += VAR_16; if(VAR_9 > 31) break; VAR_14 = VAR_0->zz_4x8[VAR_9++]+VAR_13; VAR_1[VAR_14] = VAR_17 * VAR_12; if(!VAR_0->pquantizer) VAR_1[VAR_14] += (VAR_1[VAR_14] < 0) ? -VAR_3 : VAR_3; } if(!(VAR_11 & (1 << (1 - VAR_10))) && !VAR_8) s->dsp.vc1_inv_trans_4x8(VAR_6 + VAR_10*4, VAR_7, VAR_1 + VAR_13); } break; } return 0; }
[ "static int FUNC_0(VC1Context *VAR_0, DCTELEM VAR_1[64], int VAR_2, int VAR_3, int VAR_4, int VAR_5,\nuint8_t *VAR_6, int VAR_7, int VAR_8)\n{", "MpegEncContext *s = &VAR_0->s;", "GetBitContext *gb = &s->gb;", "int VAR_9, VAR_10;", "int VAR_11 = 0;", "int VAR_12, VAR_13, VAR_14, VAR_15, VAR_16, VAR_17;", "int VAR_18 = VAR_4 & 7;", "if(VAR_4 == -1) {", "VAR_18 = ff_vc1_ttblk_to_tt[VAR_0->tt_index][get_vlc2(gb, ff_vc1_ttblk_vlc[VAR_0->tt_index].table, VC1_TTBLK_VLC_BITS, 1)];", "}", "if(VAR_18 == TT_4X4) {", "VAR_11 = ~(get_vlc2(gb, ff_vc1_subblkpat_vlc[VAR_0->tt_index].table, VC1_SUBBLKPAT_VLC_BITS, 1) + 1);", "}", "if((VAR_18 != TT_8X8 && VAR_18 != TT_4X4) && (VAR_0->ttmbf || (VAR_4 != -1 && (VAR_4 & 8) && !VAR_5))) {", "VAR_11 = decode012(gb);", "if(VAR_11) VAR_11 ^= 3;", "if(VAR_18 == TT_8X4_TOP || VAR_18 == TT_8X4_BOTTOM) VAR_18 = TT_8X4;", "if(VAR_18 == TT_4X8_RIGHT || VAR_18 == TT_4X8_LEFT) VAR_18 = TT_4X8;", "}", "VAR_12 = 2 * VAR_3 + ((VAR_0->pq == VAR_3) ? VAR_0->halfpq : 0);", "if(VAR_18 == TT_8X4_TOP || VAR_18 == TT_8X4_BOTTOM) {", "VAR_11 = 2 - (VAR_18 == TT_8X4_TOP);", "VAR_18 = TT_8X4;", "}", "if(VAR_18 == TT_4X8_RIGHT || VAR_18 == TT_4X8_LEFT) {", "VAR_11 = 2 - (VAR_18 == TT_4X8_LEFT);", "VAR_18 = TT_4X8;", "}", "switch(VAR_18) {", "case TT_8X8:\nVAR_9 = 0;", "VAR_15 = 0;", "while (!VAR_15) {", "vc1_decode_ac_coeff(VAR_0, &VAR_15, &VAR_16, &VAR_17, VAR_0->codingset2);", "VAR_9 += VAR_16;", "if(VAR_9 > 63)\nbreak;", "VAR_14 = wmv1_scantable[0][VAR_9++];", "VAR_1[VAR_14] = VAR_17 * VAR_12;", "if(!VAR_0->pquantizer)\nVAR_1[VAR_14] += (VAR_1[VAR_14] < 0) ? -VAR_3 : VAR_3;", "}", "if(!VAR_8){", "s->dsp.vc1_inv_trans_8x8(VAR_1);", "s->dsp.add_pixels_clamped(VAR_1, VAR_6, VAR_7);", "}", "break;", "case TT_4X4:\nfor(VAR_10 = 0; VAR_10 < 4; VAR_10++) {", "VAR_15 = VAR_11 & (1 << (3 - VAR_10));", "VAR_9 = 0;", "VAR_13 = (VAR_10 & 1) * 4 + (VAR_10 & 2) * 16;", "while (!VAR_15) {", "vc1_decode_ac_coeff(VAR_0, &VAR_15, &VAR_16, &VAR_17, VAR_0->codingset2);", "VAR_9 += VAR_16;", "if(VAR_9 > 15)\nbreak;", "VAR_14 = ff_vc1_simple_progressive_4x4_zz[VAR_9++];", "VAR_1[VAR_14 + VAR_13] = VAR_17 * VAR_12;", "if(!VAR_0->pquantizer)\nVAR_1[VAR_14 + VAR_13] += (VAR_1[VAR_14 + VAR_13] < 0) ? -VAR_3 : VAR_3;", "}", "if(!(VAR_11 & (1 << (3 - VAR_10))) && !VAR_8)\ns->dsp.vc1_inv_trans_4x4(VAR_6 + (VAR_10&1)*4 + (VAR_10&2)*2*VAR_7, VAR_7, VAR_1 + VAR_13);", "}", "break;", "case TT_8X4:\nfor(VAR_10 = 0; VAR_10 < 2; VAR_10++) {", "VAR_15 = VAR_11 & (1 << (1 - VAR_10));", "VAR_9 = 0;", "VAR_13 = VAR_10 * 32;", "while (!VAR_15) {", "vc1_decode_ac_coeff(VAR_0, &VAR_15, &VAR_16, &VAR_17, VAR_0->codingset2);", "VAR_9 += VAR_16;", "if(VAR_9 > 31)\nbreak;", "VAR_14 = VAR_0->zz_8x4[VAR_9++]+VAR_13;", "VAR_1[VAR_14] = VAR_17 * VAR_12;", "if(!VAR_0->pquantizer)\nVAR_1[VAR_14] += (VAR_1[VAR_14] < 0) ? -VAR_3 : VAR_3;", "}", "if(!(VAR_11 & (1 << (1 - VAR_10))) && !VAR_8)\ns->dsp.vc1_inv_trans_8x4(VAR_6 + VAR_10*4*VAR_7, VAR_7, VAR_1 + VAR_13);", "}", "break;", "case TT_4X8:\nfor(VAR_10 = 0; VAR_10 < 2; VAR_10++) {", "VAR_15 = VAR_11 & (1 << (1 - VAR_10));", "VAR_9 = 0;", "VAR_13 = VAR_10 * 4;", "while (!VAR_15) {", "vc1_decode_ac_coeff(VAR_0, &VAR_15, &VAR_16, &VAR_17, VAR_0->codingset2);", "VAR_9 += VAR_16;", "if(VAR_9 > 31)\nbreak;", "VAR_14 = VAR_0->zz_4x8[VAR_9++]+VAR_13;", "VAR_1[VAR_14] = VAR_17 * VAR_12;", "if(!VAR_0->pquantizer)\nVAR_1[VAR_14] += (VAR_1[VAR_14] < 0) ? -VAR_3 : VAR_3;", "}", "if(!(VAR_11 & (1 << (1 - VAR_10))) && !VAR_8)\ns->dsp.vc1_inv_trans_4x8(VAR_6 + VAR_10*4, VAR_7, VAR_1 + VAR_13);", "}", "break;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105, 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121, 123 ], [ 125 ], [ 127 ], [ 129, 131 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 143, 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159, 161 ], [ 163 ], [ 165 ], [ 167, 169 ], [ 171 ], [ 173, 175 ], [ 177 ], [ 179 ], [ 181, 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197, 199 ], [ 201 ], [ 203 ], [ 205, 207 ], [ 209 ], [ 211, 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ] ]
8,379
static void dma_bdrv_unmap(DMAAIOCB *dbs) { int i; for (i = 0; i < dbs->iov.niov; ++i) { dma_memory_unmap(dbs->sg->as, dbs->iov.iov[i].iov_base, dbs->iov.iov[i].iov_len, dbs->dir, dbs->iov.iov[i].iov_len); } qemu_iovec_reset(&dbs->iov); }
false
qemu
4be746345f13e99e468c60acbd3a355e8183e3ce
static void dma_bdrv_unmap(DMAAIOCB *dbs) { int i; for (i = 0; i < dbs->iov.niov; ++i) { dma_memory_unmap(dbs->sg->as, dbs->iov.iov[i].iov_base, dbs->iov.iov[i].iov_len, dbs->dir, dbs->iov.iov[i].iov_len); } qemu_iovec_reset(&dbs->iov); }
{ "code": [], "line_no": [] }
static void FUNC_0(DMAAIOCB *VAR_0) { int VAR_1; for (VAR_1 = 0; VAR_1 < VAR_0->iov.niov; ++VAR_1) { dma_memory_unmap(VAR_0->sg->as, VAR_0->iov.iov[VAR_1].iov_base, VAR_0->iov.iov[VAR_1].iov_len, VAR_0->dir, VAR_0->iov.iov[VAR_1].iov_len); } qemu_iovec_reset(&VAR_0->iov); }
[ "static void FUNC_0(DMAAIOCB *VAR_0)\n{", "int VAR_1;", "for (VAR_1 = 0; VAR_1 < VAR_0->iov.niov; ++VAR_1) {", "dma_memory_unmap(VAR_0->sg->as, VAR_0->iov.iov[VAR_1].iov_base,\nVAR_0->iov.iov[VAR_1].iov_len, VAR_0->dir,\nVAR_0->iov.iov[VAR_1].iov_len);", "}", "qemu_iovec_reset(&VAR_0->iov);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13, 15 ], [ 17 ], [ 19 ], [ 21 ] ]
8,381
static inline abi_long do_msgsnd(int msqid, abi_long msgp, unsigned int msgsz, int msgflg) { struct target_msgbuf *target_mb; struct msgbuf *host_mb; abi_long ret = 0; if (!lock_user_struct(VERIFY_READ, target_mb, msgp, 0)) return -TARGET_EFAULT; host_mb = malloc(msgsz+sizeof(long)); host_mb->mtype = (abi_long) tswapal(target_mb->mtype); memcpy(host_mb->mtext, target_mb->mtext, msgsz); ret = get_errno(msgsnd(msqid, host_mb, msgsz, msgflg)); free(host_mb); unlock_user_struct(target_mb, msgp, 0); return ret; }
false
qemu
edcc5f9dc39309d32f4b3737e6b750ae967f5bbd
static inline abi_long do_msgsnd(int msqid, abi_long msgp, unsigned int msgsz, int msgflg) { struct target_msgbuf *target_mb; struct msgbuf *host_mb; abi_long ret = 0; if (!lock_user_struct(VERIFY_READ, target_mb, msgp, 0)) return -TARGET_EFAULT; host_mb = malloc(msgsz+sizeof(long)); host_mb->mtype = (abi_long) tswapal(target_mb->mtype); memcpy(host_mb->mtext, target_mb->mtext, msgsz); ret = get_errno(msgsnd(msqid, host_mb, msgsz, msgflg)); free(host_mb); unlock_user_struct(target_mb, msgp, 0); return ret; }
{ "code": [], "line_no": [] }
static inline abi_long FUNC_0(int msqid, abi_long msgp, unsigned int msgsz, int msgflg) { struct target_msgbuf *VAR_0; struct msgbuf *VAR_1; abi_long ret = 0; if (!lock_user_struct(VERIFY_READ, VAR_0, msgp, 0)) return -TARGET_EFAULT; VAR_1 = malloc(msgsz+sizeof(long)); VAR_1->mtype = (abi_long) tswapal(VAR_0->mtype); memcpy(VAR_1->mtext, VAR_0->mtext, msgsz); ret = get_errno(msgsnd(msqid, VAR_1, msgsz, msgflg)); free(VAR_1); unlock_user_struct(VAR_0, msgp, 0); return ret; }
[ "static inline abi_long FUNC_0(int msqid, abi_long msgp,\nunsigned int msgsz, int msgflg)\n{", "struct target_msgbuf *VAR_0;", "struct msgbuf *VAR_1;", "abi_long ret = 0;", "if (!lock_user_struct(VERIFY_READ, VAR_0, msgp, 0))\nreturn -TARGET_EFAULT;", "VAR_1 = malloc(msgsz+sizeof(long));", "VAR_1->mtype = (abi_long) tswapal(VAR_0->mtype);", "memcpy(VAR_1->mtext, VAR_0->mtext, msgsz);", "ret = get_errno(msgsnd(msqid, VAR_1, msgsz, msgflg));", "free(VAR_1);", "unlock_user_struct(VAR_0, msgp, 0);", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ] ]
8,382
void qemu_service_io(void) { qemu_notify_event(); }
false
qemu
ad96090a01d848df67d70c5259ed8aa321fa8716
void qemu_service_io(void) { qemu_notify_event(); }
{ "code": [], "line_no": [] }
void FUNC_0(void) { qemu_notify_event(); }
[ "void FUNC_0(void)\n{", "qemu_notify_event();", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
8,383
static int v9fs_synth_chown(FsContext *fs_ctx, V9fsPath *path, FsCred *credp) { errno = EPERM; return -1; }
false
qemu
364031f17932814484657e5551ba12957d993d7e
static int v9fs_synth_chown(FsContext *fs_ctx, V9fsPath *path, FsCred *credp) { errno = EPERM; return -1; }
{ "code": [], "line_no": [] }
static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1, FsCred *VAR_2) { errno = EPERM; return -1; }
[ "static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1, FsCred *VAR_2)\n{", "errno = EPERM;", "return -1;", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
8,384
static void invalidate_tlb (int idx, int use_extra) { tlb_t *tlb; target_ulong addr; uint8_t ASID; ASID = env->CP0_EntryHi & 0xFF; tlb = &env->tlb[idx]; /* The qemu TLB is flushed then the ASID changes, so no need to flush these entries again. */ if (tlb->G == 0 && tlb->ASID != ASID) { return; } if (use_extra && env->tlb_in_use < MIPS_TLB_MAX) { /* For tlbwr, we can shadow the discarded entry into a new (fake) TLB entry, as long as the guest can not tell that it's there. */ env->tlb[env->tlb_in_use] = *tlb; env->tlb_in_use++; return; } if (tlb->V0) { tb_invalidate_page_range(tlb->PFN[0], tlb->end - tlb->VPN); addr = tlb->VPN; while (addr < tlb->end) { tlb_flush_page (env, addr); addr += TARGET_PAGE_SIZE; } } if (tlb->V1) { tb_invalidate_page_range(tlb->PFN[1], tlb->end2 - tlb->end); addr = tlb->end; while (addr < tlb->end2) { tlb_flush_page (env, addr); addr += TARGET_PAGE_SIZE; } } }
false
qemu
2ee4aed86ff2ba38a0e1846de18a9aec38d73015
static void invalidate_tlb (int idx, int use_extra) { tlb_t *tlb; target_ulong addr; uint8_t ASID; ASID = env->CP0_EntryHi & 0xFF; tlb = &env->tlb[idx]; if (tlb->G == 0 && tlb->ASID != ASID) { return; } if (use_extra && env->tlb_in_use < MIPS_TLB_MAX) { env->tlb[env->tlb_in_use] = *tlb; env->tlb_in_use++; return; } if (tlb->V0) { tb_invalidate_page_range(tlb->PFN[0], tlb->end - tlb->VPN); addr = tlb->VPN; while (addr < tlb->end) { tlb_flush_page (env, addr); addr += TARGET_PAGE_SIZE; } } if (tlb->V1) { tb_invalidate_page_range(tlb->PFN[1], tlb->end2 - tlb->end); addr = tlb->end; while (addr < tlb->end2) { tlb_flush_page (env, addr); addr += TARGET_PAGE_SIZE; } } }
{ "code": [], "line_no": [] }
static void FUNC_0 (int VAR_0, int VAR_1) { tlb_t *tlb; target_ulong addr; uint8_t ASID; ASID = env->CP0_EntryHi & 0xFF; tlb = &env->tlb[VAR_0]; if (tlb->G == 0 && tlb->ASID != ASID) { return; } if (VAR_1 && env->tlb_in_use < MIPS_TLB_MAX) { env->tlb[env->tlb_in_use] = *tlb; env->tlb_in_use++; return; } if (tlb->V0) { tb_invalidate_page_range(tlb->PFN[0], tlb->end - tlb->VPN); addr = tlb->VPN; while (addr < tlb->end) { tlb_flush_page (env, addr); addr += TARGET_PAGE_SIZE; } } if (tlb->V1) { tb_invalidate_page_range(tlb->PFN[1], tlb->end2 - tlb->end); addr = tlb->end; while (addr < tlb->end2) { tlb_flush_page (env, addr); addr += TARGET_PAGE_SIZE; } } }
[ "static void FUNC_0 (int VAR_0, int VAR_1)\n{", "tlb_t *tlb;", "target_ulong addr;", "uint8_t ASID;", "ASID = env->CP0_EntryHi & 0xFF;", "tlb = &env->tlb[VAR_0];", "if (tlb->G == 0 && tlb->ASID != ASID) {", "return;", "}", "if (VAR_1 && env->tlb_in_use < MIPS_TLB_MAX) {", "env->tlb[env->tlb_in_use] = *tlb;", "env->tlb_in_use++;", "return;", "}", "if (tlb->V0) {", "tb_invalidate_page_range(tlb->PFN[0], tlb->end - tlb->VPN);", "addr = tlb->VPN;", "while (addr < tlb->end) {", "tlb_flush_page (env, addr);", "addr += TARGET_PAGE_SIZE;", "}", "}", "if (tlb->V1) {", "tb_invalidate_page_range(tlb->PFN[1], tlb->end2 - tlb->end);", "addr = tlb->end;", "while (addr < tlb->end2) {", "tlb_flush_page (env, addr);", "addr += TARGET_PAGE_SIZE;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ] ]
8,385
static int parse_uri(const char *filename, QDict *options, Error **errp) { URI *uri = NULL; QueryParams *qp = NULL; int i; uri = uri_parse(filename); if (!uri) { return -EINVAL; } if (strcmp(uri->scheme, "ssh") != 0) { error_setg(errp, "URI scheme must be 'ssh'"); goto err; } if (!uri->server || strcmp(uri->server, "") == 0) { error_setg(errp, "missing hostname in URI"); goto err; } if (!uri->path || strcmp(uri->path, "") == 0) { error_setg(errp, "missing remote path in URI"); goto err; } qp = query_params_parse(uri->query); if (!qp) { error_setg(errp, "could not parse query parameters"); goto err; } if(uri->user && strcmp(uri->user, "") != 0) { qdict_put(options, "user", qstring_from_str(uri->user)); } qdict_put(options, "host", qstring_from_str(uri->server)); if (uri->port) { qdict_put(options, "port", qint_from_int(uri->port)); } qdict_put(options, "path", qstring_from_str(uri->path)); /* Pick out any query parameters that we understand, and ignore * the rest. */ for (i = 0; i < qp->n; ++i) { if (strcmp(qp->p[i].name, "host_key_check") == 0) { qdict_put(options, "host_key_check", qstring_from_str(qp->p[i].value)); } } query_params_free(qp); uri_free(uri); return 0; err: if (qp) { query_params_free(qp); } if (uri) { uri_free(uri); } return -EINVAL; }
false
qemu
eab2ac9d3c1675a58989000c2647aa33e440906a
static int parse_uri(const char *filename, QDict *options, Error **errp) { URI *uri = NULL; QueryParams *qp = NULL; int i; uri = uri_parse(filename); if (!uri) { return -EINVAL; } if (strcmp(uri->scheme, "ssh") != 0) { error_setg(errp, "URI scheme must be 'ssh'"); goto err; } if (!uri->server || strcmp(uri->server, "") == 0) { error_setg(errp, "missing hostname in URI"); goto err; } if (!uri->path || strcmp(uri->path, "") == 0) { error_setg(errp, "missing remote path in URI"); goto err; } qp = query_params_parse(uri->query); if (!qp) { error_setg(errp, "could not parse query parameters"); goto err; } if(uri->user && strcmp(uri->user, "") != 0) { qdict_put(options, "user", qstring_from_str(uri->user)); } qdict_put(options, "host", qstring_from_str(uri->server)); if (uri->port) { qdict_put(options, "port", qint_from_int(uri->port)); } qdict_put(options, "path", qstring_from_str(uri->path)); for (i = 0; i < qp->n; ++i) { if (strcmp(qp->p[i].name, "host_key_check") == 0) { qdict_put(options, "host_key_check", qstring_from_str(qp->p[i].value)); } } query_params_free(qp); uri_free(uri); return 0; err: if (qp) { query_params_free(qp); } if (uri) { uri_free(uri); } return -EINVAL; }
{ "code": [], "line_no": [] }
static int FUNC_0(const char *VAR_0, QDict *VAR_1, Error **VAR_2) { URI *uri = NULL; QueryParams *qp = NULL; int VAR_3; uri = uri_parse(VAR_0); if (!uri) { return -EINVAL; } if (strcmp(uri->scheme, "ssh") != 0) { error_setg(VAR_2, "URI scheme must be 'ssh'"); goto err; } if (!uri->server || strcmp(uri->server, "") == 0) { error_setg(VAR_2, "missing hostname in URI"); goto err; } if (!uri->path || strcmp(uri->path, "") == 0) { error_setg(VAR_2, "missing remote path in URI"); goto err; } qp = query_params_parse(uri->query); if (!qp) { error_setg(VAR_2, "could not parse query parameters"); goto err; } if(uri->user && strcmp(uri->user, "") != 0) { qdict_put(VAR_1, "user", qstring_from_str(uri->user)); } qdict_put(VAR_1, "host", qstring_from_str(uri->server)); if (uri->port) { qdict_put(VAR_1, "port", qint_from_int(uri->port)); } qdict_put(VAR_1, "path", qstring_from_str(uri->path)); for (VAR_3 = 0; VAR_3 < qp->n; ++VAR_3) { if (strcmp(qp->p[VAR_3].name, "host_key_check") == 0) { qdict_put(VAR_1, "host_key_check", qstring_from_str(qp->p[VAR_3].value)); } } query_params_free(qp); uri_free(uri); return 0; err: if (qp) { query_params_free(qp); } if (uri) { uri_free(uri); } return -EINVAL; }
[ "static int FUNC_0(const char *VAR_0, QDict *VAR_1, Error **VAR_2)\n{", "URI *uri = NULL;", "QueryParams *qp = NULL;", "int VAR_3;", "uri = uri_parse(VAR_0);", "if (!uri) {", "return -EINVAL;", "}", "if (strcmp(uri->scheme, \"ssh\") != 0) {", "error_setg(VAR_2, \"URI scheme must be 'ssh'\");", "goto err;", "}", "if (!uri->server || strcmp(uri->server, \"\") == 0) {", "error_setg(VAR_2, \"missing hostname in URI\");", "goto err;", "}", "if (!uri->path || strcmp(uri->path, \"\") == 0) {", "error_setg(VAR_2, \"missing remote path in URI\");", "goto err;", "}", "qp = query_params_parse(uri->query);", "if (!qp) {", "error_setg(VAR_2, \"could not parse query parameters\");", "goto err;", "}", "if(uri->user && strcmp(uri->user, \"\") != 0) {", "qdict_put(VAR_1, \"user\", qstring_from_str(uri->user));", "}", "qdict_put(VAR_1, \"host\", qstring_from_str(uri->server));", "if (uri->port) {", "qdict_put(VAR_1, \"port\", qint_from_int(uri->port));", "}", "qdict_put(VAR_1, \"path\", qstring_from_str(uri->path));", "for (VAR_3 = 0; VAR_3 < qp->n; ++VAR_3) {", "if (strcmp(qp->p[VAR_3].name, \"host_key_check\") == 0) {", "qdict_put(VAR_1, \"host_key_check\",\nqstring_from_str(qp->p[VAR_3].value));", "}", "}", "query_params_free(qp);", "uri_free(uri);", "return 0;", "err:\nif (qp) {", "query_params_free(qp);", "}", "if (uri) {", "uri_free(uri);", "}", "return -EINVAL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ] ]
8,386
static void qmp_chardev_open_udp(Chardev *chr, ChardevBackend *backend, bool *be_opened, Error **errp) { ChardevUdp *udp = backend->u.udp.data; QIOChannelSocket *sioc = qio_channel_socket_new(); char *name; UdpChardev *s = UDP_CHARDEV(chr); if (qio_channel_socket_dgram_sync(sioc, udp->local, udp->remote, errp) < 0) { object_unref(OBJECT(sioc)); return; } name = g_strdup_printf("chardev-udp-%s", chr->label); qio_channel_set_name(QIO_CHANNEL(sioc), name); g_free(name); s->ioc = QIO_CHANNEL(sioc); /* be isn't opened until we get a connection */ *be_opened = false; }
false
qemu
bd269ebc82fbaa5fe7ce5bc7c1770ac8acecd884
static void qmp_chardev_open_udp(Chardev *chr, ChardevBackend *backend, bool *be_opened, Error **errp) { ChardevUdp *udp = backend->u.udp.data; QIOChannelSocket *sioc = qio_channel_socket_new(); char *name; UdpChardev *s = UDP_CHARDEV(chr); if (qio_channel_socket_dgram_sync(sioc, udp->local, udp->remote, errp) < 0) { object_unref(OBJECT(sioc)); return; } name = g_strdup_printf("chardev-udp-%s", chr->label); qio_channel_set_name(QIO_CHANNEL(sioc), name); g_free(name); s->ioc = QIO_CHANNEL(sioc); *be_opened = false; }
{ "code": [], "line_no": [] }
static void FUNC_0(Chardev *VAR_0, ChardevBackend *VAR_1, bool *VAR_2, Error **VAR_3) { ChardevUdp *udp = VAR_1->u.udp.data; QIOChannelSocket *sioc = qio_channel_socket_new(); char *VAR_4; UdpChardev *s = UDP_CHARDEV(VAR_0); if (qio_channel_socket_dgram_sync(sioc, udp->local, udp->remote, VAR_3) < 0) { object_unref(OBJECT(sioc)); return; } VAR_4 = g_strdup_printf("chardev-udp-%s", VAR_0->label); qio_channel_set_name(QIO_CHANNEL(sioc), VAR_4); g_free(VAR_4); s->ioc = QIO_CHANNEL(sioc); *VAR_2 = false; }
[ "static void FUNC_0(Chardev *VAR_0,\nChardevBackend *VAR_1,\nbool *VAR_2,\nError **VAR_3)\n{", "ChardevUdp *udp = VAR_1->u.udp.data;", "QIOChannelSocket *sioc = qio_channel_socket_new();", "char *VAR_4;", "UdpChardev *s = UDP_CHARDEV(VAR_0);", "if (qio_channel_socket_dgram_sync(sioc,\nudp->local, udp->remote,\nVAR_3) < 0) {", "object_unref(OBJECT(sioc));", "return;", "}", "VAR_4 = g_strdup_printf(\"chardev-udp-%s\", VAR_0->label);", "qio_channel_set_name(QIO_CHANNEL(sioc), VAR_4);", "g_free(VAR_4);", "s->ioc = QIO_CHANNEL(sioc);", "*VAR_2 = false;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 47 ], [ 49 ] ]
8,387
void qbus_create_inplace(BusState *bus, const char *typename, DeviceState *parent, const char *name) { object_initialize(bus, typename); qbus_realize(bus, parent, name); }
false
qemu
39355c3826f5d9a2eb1ce3dc9b4cdd68893769d6
void qbus_create_inplace(BusState *bus, const char *typename, DeviceState *parent, const char *name) { object_initialize(bus, typename); qbus_realize(bus, parent, name); }
{ "code": [], "line_no": [] }
void FUNC_0(BusState *VAR_0, const char *VAR_1, DeviceState *VAR_2, const char *VAR_3) { object_initialize(VAR_0, VAR_1); qbus_realize(VAR_0, VAR_2, VAR_3); }
[ "void FUNC_0(BusState *VAR_0, const char *VAR_1,\nDeviceState *VAR_2, const char *VAR_3)\n{", "object_initialize(VAR_0, VAR_1);", "qbus_realize(VAR_0, VAR_2, VAR_3);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ] ]
8,388
static int qemu_rdma_drain_cq(QEMUFile *f, RDMAContext *rdma) { int ret; if (qemu_rdma_write_flush(f, rdma) < 0) { return -EIO; } while (rdma->nb_sent) { ret = qemu_rdma_block_for_wrid(rdma, RDMA_WRID_RDMA_WRITE); if (ret < 0) { fprintf(stderr, "rdma migration: complete polling error!\n"); return -EIO; } } qemu_rdma_unregister_waiting(rdma); return 0; }
false
qemu
88571882516a7cb4291a329c537eb79fd126e1f2
static int qemu_rdma_drain_cq(QEMUFile *f, RDMAContext *rdma) { int ret; if (qemu_rdma_write_flush(f, rdma) < 0) { return -EIO; } while (rdma->nb_sent) { ret = qemu_rdma_block_for_wrid(rdma, RDMA_WRID_RDMA_WRITE); if (ret < 0) { fprintf(stderr, "rdma migration: complete polling error!\n"); return -EIO; } } qemu_rdma_unregister_waiting(rdma); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(QEMUFile *VAR_0, RDMAContext *VAR_1) { int VAR_2; if (qemu_rdma_write_flush(VAR_0, VAR_1) < 0) { return -EIO; } while (VAR_1->nb_sent) { VAR_2 = qemu_rdma_block_for_wrid(VAR_1, RDMA_WRID_RDMA_WRITE); if (VAR_2 < 0) { fprintf(stderr, "VAR_1 migration: complete polling error!\n"); return -EIO; } } qemu_rdma_unregister_waiting(VAR_1); return 0; }
[ "static int FUNC_0(QEMUFile *VAR_0, RDMAContext *VAR_1)\n{", "int VAR_2;", "if (qemu_rdma_write_flush(VAR_0, VAR_1) < 0) {", "return -EIO;", "}", "while (VAR_1->nb_sent) {", "VAR_2 = qemu_rdma_block_for_wrid(VAR_1, RDMA_WRID_RDMA_WRITE);", "if (VAR_2 < 0) {", "fprintf(stderr, \"VAR_1 migration: complete polling error!\\n\");", "return -EIO;", "}", "}", "qemu_rdma_unregister_waiting(VAR_1);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 37 ], [ 39 ] ]
8,389
SwsVector *sws_cloneVec(SwsVector *a) { int i; SwsVector *vec = sws_allocVec(a->length); if (!vec) return NULL; for (i = 0; i < a->length; i++) vec->coeff[i] = a->coeff[i]; return vec; }
false
FFmpeg
c914c99d4b8159d6be7c53c21f63d84f24d5ffeb
SwsVector *sws_cloneVec(SwsVector *a) { int i; SwsVector *vec = sws_allocVec(a->length); if (!vec) return NULL; for (i = 0; i < a->length; i++) vec->coeff[i] = a->coeff[i]; return vec; }
{ "code": [], "line_no": [] }
SwsVector *FUNC_0(SwsVector *a) { int VAR_0; SwsVector *vec = sws_allocVec(a->length); if (!vec) return NULL; for (VAR_0 = 0; VAR_0 < a->length; VAR_0++) vec->coeff[VAR_0] = a->coeff[VAR_0]; return vec; }
[ "SwsVector *FUNC_0(SwsVector *a)\n{", "int VAR_0;", "SwsVector *vec = sws_allocVec(a->length);", "if (!vec)\nreturn NULL;", "for (VAR_0 = 0; VAR_0 < a->length; VAR_0++)", "vec->coeff[VAR_0] = a->coeff[VAR_0];", "return vec;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ] ]
8,390
static void expr_error(const char *fmt) { term_printf(fmt); term_printf("\n"); longjmp(expr_env, 1); }
false
qemu
60cbfb95522b33c3ec1dd4fa32da261c6c3d6a9d
static void expr_error(const char *fmt) { term_printf(fmt); term_printf("\n"); longjmp(expr_env, 1); }
{ "code": [], "line_no": [] }
static void FUNC_0(const char *VAR_0) { term_printf(VAR_0); term_printf("\n"); longjmp(expr_env, 1); }
[ "static void FUNC_0(const char *VAR_0)\n{", "term_printf(VAR_0);", "term_printf(\"\\n\");", "longjmp(expr_env, 1);", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
8,391
static void dec_wcsr(DisasContext *dc) { int no; LOG_DIS("wcsr r%d, %d\n", dc->r1, dc->csr); switch (dc->csr) { case CSR_IE: tcg_gen_mov_tl(cpu_ie, cpu_R[dc->r1]); tcg_gen_movi_tl(cpu_pc, dc->pc + 4); dc->is_jmp = DISAS_UPDATE; break; case CSR_IM: /* mark as an io operation because it could cause an interrupt */ if (use_icount) { gen_io_start(); } gen_helper_wcsr_im(cpu_env, cpu_R[dc->r1]); tcg_gen_movi_tl(cpu_pc, dc->pc + 4); if (use_icount) { gen_io_end(); } dc->is_jmp = DISAS_UPDATE; break; case CSR_IP: /* mark as an io operation because it could cause an interrupt */ if (use_icount) { gen_io_start(); } gen_helper_wcsr_ip(cpu_env, cpu_R[dc->r1]); tcg_gen_movi_tl(cpu_pc, dc->pc + 4); if (use_icount) { gen_io_end(); } dc->is_jmp = DISAS_UPDATE; break; case CSR_ICC: /* TODO */ break; case CSR_DCC: /* TODO */ break; case CSR_EBA: tcg_gen_mov_tl(cpu_eba, cpu_R[dc->r1]); break; case CSR_DEBA: tcg_gen_mov_tl(cpu_deba, cpu_R[dc->r1]); break; case CSR_JTX: gen_helper_wcsr_jtx(cpu_env, cpu_R[dc->r1]); break; case CSR_JRX: gen_helper_wcsr_jrx(cpu_env, cpu_R[dc->r1]); break; case CSR_DC: gen_helper_wcsr_dc(cpu_env, cpu_R[dc->r1]); break; case CSR_BP0: case CSR_BP1: case CSR_BP2: case CSR_BP3: no = dc->csr - CSR_BP0; if (dc->num_breakpoints <= no) { qemu_log_mask(LOG_GUEST_ERROR, "breakpoint #%i is not available\n", no); t_gen_illegal_insn(dc); break; } gen_helper_wcsr_bp(cpu_env, cpu_R[dc->r1], tcg_const_i32(no)); break; case CSR_WP0: case CSR_WP1: case CSR_WP2: case CSR_WP3: no = dc->csr - CSR_WP0; if (dc->num_watchpoints <= no) { qemu_log_mask(LOG_GUEST_ERROR, "watchpoint #%i is not available\n", no); t_gen_illegal_insn(dc); break; } gen_helper_wcsr_wp(cpu_env, cpu_R[dc->r1], tcg_const_i32(no)); break; case CSR_CC: case CSR_CFG: qemu_log_mask(LOG_GUEST_ERROR, "invalid write access csr=%x\n", dc->csr); break; default: qemu_log_mask(LOG_GUEST_ERROR, "write_csr: unknown csr=%x\n", dc->csr); break; } }
false
qemu
bd79255d2571a3c68820117caf94ea9afe1d527e
static void dec_wcsr(DisasContext *dc) { int no; LOG_DIS("wcsr r%d, %d\n", dc->r1, dc->csr); switch (dc->csr) { case CSR_IE: tcg_gen_mov_tl(cpu_ie, cpu_R[dc->r1]); tcg_gen_movi_tl(cpu_pc, dc->pc + 4); dc->is_jmp = DISAS_UPDATE; break; case CSR_IM: if (use_icount) { gen_io_start(); } gen_helper_wcsr_im(cpu_env, cpu_R[dc->r1]); tcg_gen_movi_tl(cpu_pc, dc->pc + 4); if (use_icount) { gen_io_end(); } dc->is_jmp = DISAS_UPDATE; break; case CSR_IP: if (use_icount) { gen_io_start(); } gen_helper_wcsr_ip(cpu_env, cpu_R[dc->r1]); tcg_gen_movi_tl(cpu_pc, dc->pc + 4); if (use_icount) { gen_io_end(); } dc->is_jmp = DISAS_UPDATE; break; case CSR_ICC: break; case CSR_DCC: break; case CSR_EBA: tcg_gen_mov_tl(cpu_eba, cpu_R[dc->r1]); break; case CSR_DEBA: tcg_gen_mov_tl(cpu_deba, cpu_R[dc->r1]); break; case CSR_JTX: gen_helper_wcsr_jtx(cpu_env, cpu_R[dc->r1]); break; case CSR_JRX: gen_helper_wcsr_jrx(cpu_env, cpu_R[dc->r1]); break; case CSR_DC: gen_helper_wcsr_dc(cpu_env, cpu_R[dc->r1]); break; case CSR_BP0: case CSR_BP1: case CSR_BP2: case CSR_BP3: no = dc->csr - CSR_BP0; if (dc->num_breakpoints <= no) { qemu_log_mask(LOG_GUEST_ERROR, "breakpoint #%i is not available\n", no); t_gen_illegal_insn(dc); break; } gen_helper_wcsr_bp(cpu_env, cpu_R[dc->r1], tcg_const_i32(no)); break; case CSR_WP0: case CSR_WP1: case CSR_WP2: case CSR_WP3: no = dc->csr - CSR_WP0; if (dc->num_watchpoints <= no) { qemu_log_mask(LOG_GUEST_ERROR, "watchpoint #%i is not available\n", no); t_gen_illegal_insn(dc); break; } gen_helper_wcsr_wp(cpu_env, cpu_R[dc->r1], tcg_const_i32(no)); break; case CSR_CC: case CSR_CFG: qemu_log_mask(LOG_GUEST_ERROR, "invalid write access csr=%x\n", dc->csr); break; default: qemu_log_mask(LOG_GUEST_ERROR, "write_csr: unknown csr=%x\n", dc->csr); break; } }
{ "code": [], "line_no": [] }
static void FUNC_0(DisasContext *VAR_0) { int VAR_1; LOG_DIS("wcsr r%d, %d\n", VAR_0->r1, VAR_0->csr); switch (VAR_0->csr) { case CSR_IE: tcg_gen_mov_tl(cpu_ie, cpu_R[VAR_0->r1]); tcg_gen_movi_tl(cpu_pc, VAR_0->pc + 4); VAR_0->is_jmp = DISAS_UPDATE; break; case CSR_IM: if (use_icount) { gen_io_start(); } gen_helper_wcsr_im(cpu_env, cpu_R[VAR_0->r1]); tcg_gen_movi_tl(cpu_pc, VAR_0->pc + 4); if (use_icount) { gen_io_end(); } VAR_0->is_jmp = DISAS_UPDATE; break; case CSR_IP: if (use_icount) { gen_io_start(); } gen_helper_wcsr_ip(cpu_env, cpu_R[VAR_0->r1]); tcg_gen_movi_tl(cpu_pc, VAR_0->pc + 4); if (use_icount) { gen_io_end(); } VAR_0->is_jmp = DISAS_UPDATE; break; case CSR_ICC: break; case CSR_DCC: break; case CSR_EBA: tcg_gen_mov_tl(cpu_eba, cpu_R[VAR_0->r1]); break; case CSR_DEBA: tcg_gen_mov_tl(cpu_deba, cpu_R[VAR_0->r1]); break; case CSR_JTX: gen_helper_wcsr_jtx(cpu_env, cpu_R[VAR_0->r1]); break; case CSR_JRX: gen_helper_wcsr_jrx(cpu_env, cpu_R[VAR_0->r1]); break; case CSR_DC: gen_helper_wcsr_dc(cpu_env, cpu_R[VAR_0->r1]); break; case CSR_BP0: case CSR_BP1: case CSR_BP2: case CSR_BP3: VAR_1 = VAR_0->csr - CSR_BP0; if (VAR_0->num_breakpoints <= VAR_1) { qemu_log_mask(LOG_GUEST_ERROR, "breakpoint #%i is not available\n", VAR_1); t_gen_illegal_insn(VAR_0); break; } gen_helper_wcsr_bp(cpu_env, cpu_R[VAR_0->r1], tcg_const_i32(VAR_1)); break; case CSR_WP0: case CSR_WP1: case CSR_WP2: case CSR_WP3: VAR_1 = VAR_0->csr - CSR_WP0; if (VAR_0->num_watchpoints <= VAR_1) { qemu_log_mask(LOG_GUEST_ERROR, "watchpoint #%i is not available\n", VAR_1); t_gen_illegal_insn(VAR_0); break; } gen_helper_wcsr_wp(cpu_env, cpu_R[VAR_0->r1], tcg_const_i32(VAR_1)); break; case CSR_CC: case CSR_CFG: qemu_log_mask(LOG_GUEST_ERROR, "invalid write access csr=%x\n", VAR_0->csr); break; default: qemu_log_mask(LOG_GUEST_ERROR, "write_csr: unknown csr=%x\n", VAR_0->csr); break; } }
[ "static void FUNC_0(DisasContext *VAR_0)\n{", "int VAR_1;", "LOG_DIS(\"wcsr r%d, %d\\n\", VAR_0->r1, VAR_0->csr);", "switch (VAR_0->csr) {", "case CSR_IE:\ntcg_gen_mov_tl(cpu_ie, cpu_R[VAR_0->r1]);", "tcg_gen_movi_tl(cpu_pc, VAR_0->pc + 4);", "VAR_0->is_jmp = DISAS_UPDATE;", "break;", "case CSR_IM:\nif (use_icount) {", "gen_io_start();", "}", "gen_helper_wcsr_im(cpu_env, cpu_R[VAR_0->r1]);", "tcg_gen_movi_tl(cpu_pc, VAR_0->pc + 4);", "if (use_icount) {", "gen_io_end();", "}", "VAR_0->is_jmp = DISAS_UPDATE;", "break;", "case CSR_IP:\nif (use_icount) {", "gen_io_start();", "}", "gen_helper_wcsr_ip(cpu_env, cpu_R[VAR_0->r1]);", "tcg_gen_movi_tl(cpu_pc, VAR_0->pc + 4);", "if (use_icount) {", "gen_io_end();", "}", "VAR_0->is_jmp = DISAS_UPDATE;", "break;", "case CSR_ICC:\nbreak;", "case CSR_DCC:\nbreak;", "case CSR_EBA:\ntcg_gen_mov_tl(cpu_eba, cpu_R[VAR_0->r1]);", "break;", "case CSR_DEBA:\ntcg_gen_mov_tl(cpu_deba, cpu_R[VAR_0->r1]);", "break;", "case CSR_JTX:\ngen_helper_wcsr_jtx(cpu_env, cpu_R[VAR_0->r1]);", "break;", "case CSR_JRX:\ngen_helper_wcsr_jrx(cpu_env, cpu_R[VAR_0->r1]);", "break;", "case CSR_DC:\ngen_helper_wcsr_dc(cpu_env, cpu_R[VAR_0->r1]);", "break;", "case CSR_BP0:\ncase CSR_BP1:\ncase CSR_BP2:\ncase CSR_BP3:\nVAR_1 = VAR_0->csr - CSR_BP0;", "if (VAR_0->num_breakpoints <= VAR_1) {", "qemu_log_mask(LOG_GUEST_ERROR,\n\"breakpoint #%i is not available\\n\", VAR_1);", "t_gen_illegal_insn(VAR_0);", "break;", "}", "gen_helper_wcsr_bp(cpu_env, cpu_R[VAR_0->r1], tcg_const_i32(VAR_1));", "break;", "case CSR_WP0:\ncase CSR_WP1:\ncase CSR_WP2:\ncase CSR_WP3:\nVAR_1 = VAR_0->csr - CSR_WP0;", "if (VAR_0->num_watchpoints <= VAR_1) {", "qemu_log_mask(LOG_GUEST_ERROR,\n\"watchpoint #%i is not available\\n\", VAR_1);", "t_gen_illegal_insn(VAR_0);", "break;", "}", "gen_helper_wcsr_wp(cpu_env, cpu_R[VAR_0->r1], tcg_const_i32(VAR_1));", "break;", "case CSR_CC:\ncase CSR_CFG:\nqemu_log_mask(LOG_GUEST_ERROR, \"invalid write access csr=%x\\n\",\nVAR_0->csr);", "break;", "default:\nqemu_log_mask(LOG_GUEST_ERROR, \"write_csr: unknown csr=%x\\n\",\nVAR_0->csr);", "break;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 77 ], [ 79, 83 ], [ 85, 87 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 97, 99 ], [ 101 ], [ 103, 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115, 117, 119, 121, 123 ], [ 125 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141, 143, 145, 147, 149 ], [ 151 ], [ 153, 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167, 169, 171, 173 ], [ 175 ], [ 177, 179, 181 ], [ 183 ], [ 185 ], [ 187 ] ]
8,392
static void coroutine_enter_cb(void *opaque, int ret) { Coroutine *co = opaque; qemu_coroutine_enter(co, NULL); }
false
qemu
fe52840c8760122257be7b7e4893dd951480a71f
static void coroutine_enter_cb(void *opaque, int ret) { Coroutine *co = opaque; qemu_coroutine_enter(co, NULL); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, int VAR_1) { Coroutine *co = VAR_0; qemu_coroutine_enter(co, NULL); }
[ "static void FUNC_0(void *VAR_0, int VAR_1)\n{", "Coroutine *co = VAR_0;", "qemu_coroutine_enter(co, NULL);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
8,393
int cpu_ppc_handle_mmu_fault (CPUState *env, target_ulong address, int rw, int mmu_idx, int is_softmmu) { mmu_ctx_t ctx; int access_type; int ret = 0; if (rw == 2) { /* code access */ rw = 0; access_type = ACCESS_CODE; } else { /* data access */ access_type = env->access_type; } ret = get_physical_address(env, &ctx, address, rw, access_type); if (ret == 0) { ret = tlb_set_page_exec(env, address & TARGET_PAGE_MASK, ctx.raddr & TARGET_PAGE_MASK, ctx.prot, mmu_idx, is_softmmu); } else if (ret < 0) { LOG_MMU_STATE(env); if (access_type == ACCESS_CODE) { switch (ret) { case -1: /* No matches in page tables or TLB */ switch (env->mmu_model) { case POWERPC_MMU_SOFT_6xx: env->exception_index = POWERPC_EXCP_IFTLB; env->error_code = 1 << 18; env->spr[SPR_IMISS] = address; env->spr[SPR_ICMP] = 0x80000000 | ctx.ptem; goto tlb_miss; case POWERPC_MMU_SOFT_74xx: env->exception_index = POWERPC_EXCP_IFTLB; goto tlb_miss_74xx; case POWERPC_MMU_SOFT_4xx: case POWERPC_MMU_SOFT_4xx_Z: env->exception_index = POWERPC_EXCP_ITLB; env->error_code = 0; env->spr[SPR_40x_DEAR] = address; env->spr[SPR_40x_ESR] = 0x00000000; break; case POWERPC_MMU_32B: case POWERPC_MMU_601: #if defined(TARGET_PPC64) case POWERPC_MMU_620: case POWERPC_MMU_64B: #endif env->exception_index = POWERPC_EXCP_ISI; env->error_code = 0x40000000; break; case POWERPC_MMU_BOOKE: /* XXX: TODO */ cpu_abort(env, "BookE MMU model is not implemented\n"); return -1; case POWERPC_MMU_BOOKE_FSL: /* XXX: TODO */ cpu_abort(env, "BookE FSL MMU model is not implemented\n"); return -1; case POWERPC_MMU_MPC8xx: /* XXX: TODO */ cpu_abort(env, "MPC8xx MMU model is not implemented\n"); break; case POWERPC_MMU_REAL: cpu_abort(env, "PowerPC in real mode should never raise " "any MMU exceptions\n"); return -1; default: cpu_abort(env, "Unknown or invalid MMU model\n"); return -1; } break; case -2: /* Access rights violation */ env->exception_index = POWERPC_EXCP_ISI; env->error_code = 0x08000000; break; case -3: /* No execute protection violation */ env->exception_index = POWERPC_EXCP_ISI; env->error_code = 0x10000000; break; case -4: /* Direct store exception */ /* No code fetch is allowed in direct-store areas */ env->exception_index = POWERPC_EXCP_ISI; env->error_code = 0x10000000; break; #if defined(TARGET_PPC64) case -5: /* No match in segment table */ if (env->mmu_model == POWERPC_MMU_620) { env->exception_index = POWERPC_EXCP_ISI; /* XXX: this might be incorrect */ env->error_code = 0x40000000; } else { env->exception_index = POWERPC_EXCP_ISEG; env->error_code = 0; } break; #endif } } else { switch (ret) { case -1: /* No matches in page tables or TLB */ switch (env->mmu_model) { case POWERPC_MMU_SOFT_6xx: if (rw == 1) { env->exception_index = POWERPC_EXCP_DSTLB; env->error_code = 1 << 16; } else { env->exception_index = POWERPC_EXCP_DLTLB; env->error_code = 0; } env->spr[SPR_DMISS] = address; env->spr[SPR_DCMP] = 0x80000000 | ctx.ptem; tlb_miss: env->error_code |= ctx.key << 19; env->spr[SPR_HASH1] = ctx.pg_addr[0]; env->spr[SPR_HASH2] = ctx.pg_addr[1]; break; case POWERPC_MMU_SOFT_74xx: if (rw == 1) { env->exception_index = POWERPC_EXCP_DSTLB; } else { env->exception_index = POWERPC_EXCP_DLTLB; } tlb_miss_74xx: /* Implement LRU algorithm */ env->error_code = ctx.key << 19; env->spr[SPR_TLBMISS] = (address & ~((target_ulong)0x3)) | ((env->last_way + 1) & (env->nb_ways - 1)); env->spr[SPR_PTEHI] = 0x80000000 | ctx.ptem; break; case POWERPC_MMU_SOFT_4xx: case POWERPC_MMU_SOFT_4xx_Z: env->exception_index = POWERPC_EXCP_DTLB; env->error_code = 0; env->spr[SPR_40x_DEAR] = address; if (rw) env->spr[SPR_40x_ESR] = 0x00800000; else env->spr[SPR_40x_ESR] = 0x00000000; break; case POWERPC_MMU_32B: case POWERPC_MMU_601: #if defined(TARGET_PPC64) case POWERPC_MMU_620: case POWERPC_MMU_64B: #endif env->exception_index = POWERPC_EXCP_DSI; env->error_code = 0; env->spr[SPR_DAR] = address; if (rw == 1) env->spr[SPR_DSISR] = 0x42000000; else env->spr[SPR_DSISR] = 0x40000000; break; case POWERPC_MMU_MPC8xx: /* XXX: TODO */ cpu_abort(env, "MPC8xx MMU model is not implemented\n"); break; case POWERPC_MMU_BOOKE: /* XXX: TODO */ cpu_abort(env, "BookE MMU model is not implemented\n"); return -1; case POWERPC_MMU_BOOKE_FSL: /* XXX: TODO */ cpu_abort(env, "BookE FSL MMU model is not implemented\n"); return -1; case POWERPC_MMU_REAL: cpu_abort(env, "PowerPC in real mode should never raise " "any MMU exceptions\n"); return -1; default: cpu_abort(env, "Unknown or invalid MMU model\n"); return -1; } break; case -2: /* Access rights violation */ env->exception_index = POWERPC_EXCP_DSI; env->error_code = 0; env->spr[SPR_DAR] = address; if (rw == 1) env->spr[SPR_DSISR] = 0x0A000000; else env->spr[SPR_DSISR] = 0x08000000; break; case -4: /* Direct store exception */ switch (access_type) { case ACCESS_FLOAT: /* Floating point load/store */ env->exception_index = POWERPC_EXCP_ALIGN; env->error_code = POWERPC_EXCP_ALIGN_FP; env->spr[SPR_DAR] = address; break; case ACCESS_RES: /* lwarx, ldarx or stwcx. */ env->exception_index = POWERPC_EXCP_DSI; env->error_code = 0; env->spr[SPR_DAR] = address; if (rw == 1) env->spr[SPR_DSISR] = 0x06000000; else env->spr[SPR_DSISR] = 0x04000000; break; case ACCESS_EXT: /* eciwx or ecowx */ env->exception_index = POWERPC_EXCP_DSI; env->error_code = 0; env->spr[SPR_DAR] = address; if (rw == 1) env->spr[SPR_DSISR] = 0x06100000; else env->spr[SPR_DSISR] = 0x04100000; break; default: printf("DSI: invalid exception (%d)\n", ret); env->exception_index = POWERPC_EXCP_PROGRAM; env->error_code = POWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_INVAL; env->spr[SPR_DAR] = address; break; } break; #if defined(TARGET_PPC64) case -5: /* No match in segment table */ if (env->mmu_model == POWERPC_MMU_620) { env->exception_index = POWERPC_EXCP_DSI; env->error_code = 0; env->spr[SPR_DAR] = address; /* XXX: this might be incorrect */ if (rw == 1) env->spr[SPR_DSISR] = 0x42000000; else env->spr[SPR_DSISR] = 0x40000000; } else { env->exception_index = POWERPC_EXCP_DSEG; env->error_code = 0; env->spr[SPR_DAR] = address; } break; #endif } } #if 0 printf("%s: set exception to %d %02x\n", __func__, env->exception, env->error_code); #endif ret = 1; } return ret; }
false
qemu
dcbc9a70af47fdd49d053f6a544a86de8dca398a
int cpu_ppc_handle_mmu_fault (CPUState *env, target_ulong address, int rw, int mmu_idx, int is_softmmu) { mmu_ctx_t ctx; int access_type; int ret = 0; if (rw == 2) { rw = 0; access_type = ACCESS_CODE; } else { access_type = env->access_type; } ret = get_physical_address(env, &ctx, address, rw, access_type); if (ret == 0) { ret = tlb_set_page_exec(env, address & TARGET_PAGE_MASK, ctx.raddr & TARGET_PAGE_MASK, ctx.prot, mmu_idx, is_softmmu); } else if (ret < 0) { LOG_MMU_STATE(env); if (access_type == ACCESS_CODE) { switch (ret) { case -1: switch (env->mmu_model) { case POWERPC_MMU_SOFT_6xx: env->exception_index = POWERPC_EXCP_IFTLB; env->error_code = 1 << 18; env->spr[SPR_IMISS] = address; env->spr[SPR_ICMP] = 0x80000000 | ctx.ptem; goto tlb_miss; case POWERPC_MMU_SOFT_74xx: env->exception_index = POWERPC_EXCP_IFTLB; goto tlb_miss_74xx; case POWERPC_MMU_SOFT_4xx: case POWERPC_MMU_SOFT_4xx_Z: env->exception_index = POWERPC_EXCP_ITLB; env->error_code = 0; env->spr[SPR_40x_DEAR] = address; env->spr[SPR_40x_ESR] = 0x00000000; break; case POWERPC_MMU_32B: case POWERPC_MMU_601: #if defined(TARGET_PPC64) case POWERPC_MMU_620: case POWERPC_MMU_64B: #endif env->exception_index = POWERPC_EXCP_ISI; env->error_code = 0x40000000; break; case POWERPC_MMU_BOOKE: cpu_abort(env, "BookE MMU model is not implemented\n"); return -1; case POWERPC_MMU_BOOKE_FSL: cpu_abort(env, "BookE FSL MMU model is not implemented\n"); return -1; case POWERPC_MMU_MPC8xx: cpu_abort(env, "MPC8xx MMU model is not implemented\n"); break; case POWERPC_MMU_REAL: cpu_abort(env, "PowerPC in real mode should never raise " "any MMU exceptions\n"); return -1; default: cpu_abort(env, "Unknown or invalid MMU model\n"); return -1; } break; case -2: env->exception_index = POWERPC_EXCP_ISI; env->error_code = 0x08000000; break; case -3: env->exception_index = POWERPC_EXCP_ISI; env->error_code = 0x10000000; break; case -4: env->exception_index = POWERPC_EXCP_ISI; env->error_code = 0x10000000; break; #if defined(TARGET_PPC64) case -5: if (env->mmu_model == POWERPC_MMU_620) { env->exception_index = POWERPC_EXCP_ISI; env->error_code = 0x40000000; } else { env->exception_index = POWERPC_EXCP_ISEG; env->error_code = 0; } break; #endif } } else { switch (ret) { case -1: switch (env->mmu_model) { case POWERPC_MMU_SOFT_6xx: if (rw == 1) { env->exception_index = POWERPC_EXCP_DSTLB; env->error_code = 1 << 16; } else { env->exception_index = POWERPC_EXCP_DLTLB; env->error_code = 0; } env->spr[SPR_DMISS] = address; env->spr[SPR_DCMP] = 0x80000000 | ctx.ptem; tlb_miss: env->error_code |= ctx.key << 19; env->spr[SPR_HASH1] = ctx.pg_addr[0]; env->spr[SPR_HASH2] = ctx.pg_addr[1]; break; case POWERPC_MMU_SOFT_74xx: if (rw == 1) { env->exception_index = POWERPC_EXCP_DSTLB; } else { env->exception_index = POWERPC_EXCP_DLTLB; } tlb_miss_74xx: env->error_code = ctx.key << 19; env->spr[SPR_TLBMISS] = (address & ~((target_ulong)0x3)) | ((env->last_way + 1) & (env->nb_ways - 1)); env->spr[SPR_PTEHI] = 0x80000000 | ctx.ptem; break; case POWERPC_MMU_SOFT_4xx: case POWERPC_MMU_SOFT_4xx_Z: env->exception_index = POWERPC_EXCP_DTLB; env->error_code = 0; env->spr[SPR_40x_DEAR] = address; if (rw) env->spr[SPR_40x_ESR] = 0x00800000; else env->spr[SPR_40x_ESR] = 0x00000000; break; case POWERPC_MMU_32B: case POWERPC_MMU_601: #if defined(TARGET_PPC64) case POWERPC_MMU_620: case POWERPC_MMU_64B: #endif env->exception_index = POWERPC_EXCP_DSI; env->error_code = 0; env->spr[SPR_DAR] = address; if (rw == 1) env->spr[SPR_DSISR] = 0x42000000; else env->spr[SPR_DSISR] = 0x40000000; break; case POWERPC_MMU_MPC8xx: cpu_abort(env, "MPC8xx MMU model is not implemented\n"); break; case POWERPC_MMU_BOOKE: cpu_abort(env, "BookE MMU model is not implemented\n"); return -1; case POWERPC_MMU_BOOKE_FSL: cpu_abort(env, "BookE FSL MMU model is not implemented\n"); return -1; case POWERPC_MMU_REAL: cpu_abort(env, "PowerPC in real mode should never raise " "any MMU exceptions\n"); return -1; default: cpu_abort(env, "Unknown or invalid MMU model\n"); return -1; } break; case -2: env->exception_index = POWERPC_EXCP_DSI; env->error_code = 0; env->spr[SPR_DAR] = address; if (rw == 1) env->spr[SPR_DSISR] = 0x0A000000; else env->spr[SPR_DSISR] = 0x08000000; break; case -4: switch (access_type) { case ACCESS_FLOAT: env->exception_index = POWERPC_EXCP_ALIGN; env->error_code = POWERPC_EXCP_ALIGN_FP; env->spr[SPR_DAR] = address; break; case ACCESS_RES: env->exception_index = POWERPC_EXCP_DSI; env->error_code = 0; env->spr[SPR_DAR] = address; if (rw == 1) env->spr[SPR_DSISR] = 0x06000000; else env->spr[SPR_DSISR] = 0x04000000; break; case ACCESS_EXT: env->exception_index = POWERPC_EXCP_DSI; env->error_code = 0; env->spr[SPR_DAR] = address; if (rw == 1) env->spr[SPR_DSISR] = 0x06100000; else env->spr[SPR_DSISR] = 0x04100000; break; default: printf("DSI: invalid exception (%d)\n", ret); env->exception_index = POWERPC_EXCP_PROGRAM; env->error_code = POWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_INVAL; env->spr[SPR_DAR] = address; break; } break; #if defined(TARGET_PPC64) case -5: if (env->mmu_model == POWERPC_MMU_620) { env->exception_index = POWERPC_EXCP_DSI; env->error_code = 0; env->spr[SPR_DAR] = address; if (rw == 1) env->spr[SPR_DSISR] = 0x42000000; else env->spr[SPR_DSISR] = 0x40000000; } else { env->exception_index = POWERPC_EXCP_DSEG; env->error_code = 0; env->spr[SPR_DAR] = address; } break; #endif } } #if 0 printf("%s: set exception to %d %02x\n", __func__, env->exception, env->error_code); #endif ret = 1; } return ret; }
{ "code": [], "line_no": [] }
int FUNC_0 (CPUState *VAR_0, target_ulong VAR_1, int VAR_2, int VAR_3, int VAR_4) { mmu_ctx_t ctx; int VAR_5; int VAR_6 = 0; if (VAR_2 == 2) { VAR_2 = 0; VAR_5 = ACCESS_CODE; } else { VAR_5 = VAR_0->VAR_5; } VAR_6 = get_physical_address(VAR_0, &ctx, VAR_1, VAR_2, VAR_5); if (VAR_6 == 0) { VAR_6 = tlb_set_page_exec(VAR_0, VAR_1 & TARGET_PAGE_MASK, ctx.raddr & TARGET_PAGE_MASK, ctx.prot, VAR_3, VAR_4); } else if (VAR_6 < 0) { LOG_MMU_STATE(VAR_0); if (VAR_5 == ACCESS_CODE) { switch (VAR_6) { case -1: switch (VAR_0->mmu_model) { case POWERPC_MMU_SOFT_6xx: VAR_0->exception_index = POWERPC_EXCP_IFTLB; VAR_0->error_code = 1 << 18; VAR_0->spr[SPR_IMISS] = VAR_1; VAR_0->spr[SPR_ICMP] = 0x80000000 | ctx.ptem; goto tlb_miss; case POWERPC_MMU_SOFT_74xx: VAR_0->exception_index = POWERPC_EXCP_IFTLB; goto tlb_miss_74xx; case POWERPC_MMU_SOFT_4xx: case POWERPC_MMU_SOFT_4xx_Z: VAR_0->exception_index = POWERPC_EXCP_ITLB; VAR_0->error_code = 0; VAR_0->spr[SPR_40x_DEAR] = VAR_1; VAR_0->spr[SPR_40x_ESR] = 0x00000000; break; case POWERPC_MMU_32B: case POWERPC_MMU_601: #if defined(TARGET_PPC64) case POWERPC_MMU_620: case POWERPC_MMU_64B: #endif VAR_0->exception_index = POWERPC_EXCP_ISI; VAR_0->error_code = 0x40000000; break; case POWERPC_MMU_BOOKE: cpu_abort(VAR_0, "BookE MMU model is not implemented\n"); return -1; case POWERPC_MMU_BOOKE_FSL: cpu_abort(VAR_0, "BookE FSL MMU model is not implemented\n"); return -1; case POWERPC_MMU_MPC8xx: cpu_abort(VAR_0, "MPC8xx MMU model is not implemented\n"); break; case POWERPC_MMU_REAL: cpu_abort(VAR_0, "PowerPC in real mode should never raise " "any MMU exceptions\n"); return -1; default: cpu_abort(VAR_0, "Unknown or invalid MMU model\n"); return -1; } break; case -2: VAR_0->exception_index = POWERPC_EXCP_ISI; VAR_0->error_code = 0x08000000; break; case -3: VAR_0->exception_index = POWERPC_EXCP_ISI; VAR_0->error_code = 0x10000000; break; case -4: VAR_0->exception_index = POWERPC_EXCP_ISI; VAR_0->error_code = 0x10000000; break; #if defined(TARGET_PPC64) case -5: if (VAR_0->mmu_model == POWERPC_MMU_620) { VAR_0->exception_index = POWERPC_EXCP_ISI; VAR_0->error_code = 0x40000000; } else { VAR_0->exception_index = POWERPC_EXCP_ISEG; VAR_0->error_code = 0; } break; #endif } } else { switch (VAR_6) { case -1: switch (VAR_0->mmu_model) { case POWERPC_MMU_SOFT_6xx: if (VAR_2 == 1) { VAR_0->exception_index = POWERPC_EXCP_DSTLB; VAR_0->error_code = 1 << 16; } else { VAR_0->exception_index = POWERPC_EXCP_DLTLB; VAR_0->error_code = 0; } VAR_0->spr[SPR_DMISS] = VAR_1; VAR_0->spr[SPR_DCMP] = 0x80000000 | ctx.ptem; tlb_miss: VAR_0->error_code |= ctx.key << 19; VAR_0->spr[SPR_HASH1] = ctx.pg_addr[0]; VAR_0->spr[SPR_HASH2] = ctx.pg_addr[1]; break; case POWERPC_MMU_SOFT_74xx: if (VAR_2 == 1) { VAR_0->exception_index = POWERPC_EXCP_DSTLB; } else { VAR_0->exception_index = POWERPC_EXCP_DLTLB; } tlb_miss_74xx: VAR_0->error_code = ctx.key << 19; VAR_0->spr[SPR_TLBMISS] = (VAR_1 & ~((target_ulong)0x3)) | ((VAR_0->last_way + 1) & (VAR_0->nb_ways - 1)); VAR_0->spr[SPR_PTEHI] = 0x80000000 | ctx.ptem; break; case POWERPC_MMU_SOFT_4xx: case POWERPC_MMU_SOFT_4xx_Z: VAR_0->exception_index = POWERPC_EXCP_DTLB; VAR_0->error_code = 0; VAR_0->spr[SPR_40x_DEAR] = VAR_1; if (VAR_2) VAR_0->spr[SPR_40x_ESR] = 0x00800000; else VAR_0->spr[SPR_40x_ESR] = 0x00000000; break; case POWERPC_MMU_32B: case POWERPC_MMU_601: #if defined(TARGET_PPC64) case POWERPC_MMU_620: case POWERPC_MMU_64B: #endif VAR_0->exception_index = POWERPC_EXCP_DSI; VAR_0->error_code = 0; VAR_0->spr[SPR_DAR] = VAR_1; if (VAR_2 == 1) VAR_0->spr[SPR_DSISR] = 0x42000000; else VAR_0->spr[SPR_DSISR] = 0x40000000; break; case POWERPC_MMU_MPC8xx: cpu_abort(VAR_0, "MPC8xx MMU model is not implemented\n"); break; case POWERPC_MMU_BOOKE: cpu_abort(VAR_0, "BookE MMU model is not implemented\n"); return -1; case POWERPC_MMU_BOOKE_FSL: cpu_abort(VAR_0, "BookE FSL MMU model is not implemented\n"); return -1; case POWERPC_MMU_REAL: cpu_abort(VAR_0, "PowerPC in real mode should never raise " "any MMU exceptions\n"); return -1; default: cpu_abort(VAR_0, "Unknown or invalid MMU model\n"); return -1; } break; case -2: VAR_0->exception_index = POWERPC_EXCP_DSI; VAR_0->error_code = 0; VAR_0->spr[SPR_DAR] = VAR_1; if (VAR_2 == 1) VAR_0->spr[SPR_DSISR] = 0x0A000000; else VAR_0->spr[SPR_DSISR] = 0x08000000; break; case -4: switch (VAR_5) { case ACCESS_FLOAT: VAR_0->exception_index = POWERPC_EXCP_ALIGN; VAR_0->error_code = POWERPC_EXCP_ALIGN_FP; VAR_0->spr[SPR_DAR] = VAR_1; break; case ACCESS_RES: VAR_0->exception_index = POWERPC_EXCP_DSI; VAR_0->error_code = 0; VAR_0->spr[SPR_DAR] = VAR_1; if (VAR_2 == 1) VAR_0->spr[SPR_DSISR] = 0x06000000; else VAR_0->spr[SPR_DSISR] = 0x04000000; break; case ACCESS_EXT: VAR_0->exception_index = POWERPC_EXCP_DSI; VAR_0->error_code = 0; VAR_0->spr[SPR_DAR] = VAR_1; if (VAR_2 == 1) VAR_0->spr[SPR_DSISR] = 0x06100000; else VAR_0->spr[SPR_DSISR] = 0x04100000; break; default: printf("DSI: invalid exception (%d)\n", VAR_6); VAR_0->exception_index = POWERPC_EXCP_PROGRAM; VAR_0->error_code = POWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_INVAL; VAR_0->spr[SPR_DAR] = VAR_1; break; } break; #if defined(TARGET_PPC64) case -5: if (VAR_0->mmu_model == POWERPC_MMU_620) { VAR_0->exception_index = POWERPC_EXCP_DSI; VAR_0->error_code = 0; VAR_0->spr[SPR_DAR] = VAR_1; if (VAR_2 == 1) VAR_0->spr[SPR_DSISR] = 0x42000000; else VAR_0->spr[SPR_DSISR] = 0x40000000; } else { VAR_0->exception_index = POWERPC_EXCP_DSEG; VAR_0->error_code = 0; VAR_0->spr[SPR_DAR] = VAR_1; } break; #endif } } #if 0 printf("%s: set exception to %d %02x\n", __func__, VAR_0->exception, VAR_0->error_code); #endif VAR_6 = 1; } return VAR_6; }
[ "int FUNC_0 (CPUState *VAR_0, target_ulong VAR_1, int VAR_2,\nint VAR_3, int VAR_4)\n{", "mmu_ctx_t ctx;", "int VAR_5;", "int VAR_6 = 0;", "if (VAR_2 == 2) {", "VAR_2 = 0;", "VAR_5 = ACCESS_CODE;", "} else {", "VAR_5 = VAR_0->VAR_5;", "}", "VAR_6 = get_physical_address(VAR_0, &ctx, VAR_1, VAR_2, VAR_5);", "if (VAR_6 == 0) {", "VAR_6 = tlb_set_page_exec(VAR_0, VAR_1 & TARGET_PAGE_MASK,\nctx.raddr & TARGET_PAGE_MASK, ctx.prot,\nVAR_3, VAR_4);", "} else if (VAR_6 < 0) {", "LOG_MMU_STATE(VAR_0);", "if (VAR_5 == ACCESS_CODE) {", "switch (VAR_6) {", "case -1:\nswitch (VAR_0->mmu_model) {", "case POWERPC_MMU_SOFT_6xx:\nVAR_0->exception_index = POWERPC_EXCP_IFTLB;", "VAR_0->error_code = 1 << 18;", "VAR_0->spr[SPR_IMISS] = VAR_1;", "VAR_0->spr[SPR_ICMP] = 0x80000000 | ctx.ptem;", "goto tlb_miss;", "case POWERPC_MMU_SOFT_74xx:\nVAR_0->exception_index = POWERPC_EXCP_IFTLB;", "goto tlb_miss_74xx;", "case POWERPC_MMU_SOFT_4xx:\ncase POWERPC_MMU_SOFT_4xx_Z:\nVAR_0->exception_index = POWERPC_EXCP_ITLB;", "VAR_0->error_code = 0;", "VAR_0->spr[SPR_40x_DEAR] = VAR_1;", "VAR_0->spr[SPR_40x_ESR] = 0x00000000;", "break;", "case POWERPC_MMU_32B:\ncase POWERPC_MMU_601:\n#if defined(TARGET_PPC64)\ncase POWERPC_MMU_620:\ncase POWERPC_MMU_64B:\n#endif\nVAR_0->exception_index = POWERPC_EXCP_ISI;", "VAR_0->error_code = 0x40000000;", "break;", "case POWERPC_MMU_BOOKE:\ncpu_abort(VAR_0, \"BookE MMU model is not implemented\\n\");", "return -1;", "case POWERPC_MMU_BOOKE_FSL:\ncpu_abort(VAR_0, \"BookE FSL MMU model is not implemented\\n\");", "return -1;", "case POWERPC_MMU_MPC8xx:\ncpu_abort(VAR_0, \"MPC8xx MMU model is not implemented\\n\");", "break;", "case POWERPC_MMU_REAL:\ncpu_abort(VAR_0, \"PowerPC in real mode should never raise \"\n\"any MMU exceptions\\n\");", "return -1;", "default:\ncpu_abort(VAR_0, \"Unknown or invalid MMU model\\n\");", "return -1;", "}", "break;", "case -2:\nVAR_0->exception_index = POWERPC_EXCP_ISI;", "VAR_0->error_code = 0x08000000;", "break;", "case -3:\nVAR_0->exception_index = POWERPC_EXCP_ISI;", "VAR_0->error_code = 0x10000000;", "break;", "case -4:\nVAR_0->exception_index = POWERPC_EXCP_ISI;", "VAR_0->error_code = 0x10000000;", "break;", "#if defined(TARGET_PPC64)\ncase -5:\nif (VAR_0->mmu_model == POWERPC_MMU_620) {", "VAR_0->exception_index = POWERPC_EXCP_ISI;", "VAR_0->error_code = 0x40000000;", "} else {", "VAR_0->exception_index = POWERPC_EXCP_ISEG;", "VAR_0->error_code = 0;", "}", "break;", "#endif\n}", "} else {", "switch (VAR_6) {", "case -1:\nswitch (VAR_0->mmu_model) {", "case POWERPC_MMU_SOFT_6xx:\nif (VAR_2 == 1) {", "VAR_0->exception_index = POWERPC_EXCP_DSTLB;", "VAR_0->error_code = 1 << 16;", "} else {", "VAR_0->exception_index = POWERPC_EXCP_DLTLB;", "VAR_0->error_code = 0;", "}", "VAR_0->spr[SPR_DMISS] = VAR_1;", "VAR_0->spr[SPR_DCMP] = 0x80000000 | ctx.ptem;", "tlb_miss:\nVAR_0->error_code |= ctx.key << 19;", "VAR_0->spr[SPR_HASH1] = ctx.pg_addr[0];", "VAR_0->spr[SPR_HASH2] = ctx.pg_addr[1];", "break;", "case POWERPC_MMU_SOFT_74xx:\nif (VAR_2 == 1) {", "VAR_0->exception_index = POWERPC_EXCP_DSTLB;", "} else {", "VAR_0->exception_index = POWERPC_EXCP_DLTLB;", "}", "tlb_miss_74xx:\nVAR_0->error_code = ctx.key << 19;", "VAR_0->spr[SPR_TLBMISS] = (VAR_1 & ~((target_ulong)0x3)) |\n((VAR_0->last_way + 1) & (VAR_0->nb_ways - 1));", "VAR_0->spr[SPR_PTEHI] = 0x80000000 | ctx.ptem;", "break;", "case POWERPC_MMU_SOFT_4xx:\ncase POWERPC_MMU_SOFT_4xx_Z:\nVAR_0->exception_index = POWERPC_EXCP_DTLB;", "VAR_0->error_code = 0;", "VAR_0->spr[SPR_40x_DEAR] = VAR_1;", "if (VAR_2)\nVAR_0->spr[SPR_40x_ESR] = 0x00800000;", "else\nVAR_0->spr[SPR_40x_ESR] = 0x00000000;", "break;", "case POWERPC_MMU_32B:\ncase POWERPC_MMU_601:\n#if defined(TARGET_PPC64)\ncase POWERPC_MMU_620:\ncase POWERPC_MMU_64B:\n#endif\nVAR_0->exception_index = POWERPC_EXCP_DSI;", "VAR_0->error_code = 0;", "VAR_0->spr[SPR_DAR] = VAR_1;", "if (VAR_2 == 1)\nVAR_0->spr[SPR_DSISR] = 0x42000000;", "else\nVAR_0->spr[SPR_DSISR] = 0x40000000;", "break;", "case POWERPC_MMU_MPC8xx:\ncpu_abort(VAR_0, \"MPC8xx MMU model is not implemented\\n\");", "break;", "case POWERPC_MMU_BOOKE:\ncpu_abort(VAR_0, \"BookE MMU model is not implemented\\n\");", "return -1;", "case POWERPC_MMU_BOOKE_FSL:\ncpu_abort(VAR_0, \"BookE FSL MMU model is not implemented\\n\");", "return -1;", "case POWERPC_MMU_REAL:\ncpu_abort(VAR_0, \"PowerPC in real mode should never raise \"\n\"any MMU exceptions\\n\");", "return -1;", "default:\ncpu_abort(VAR_0, \"Unknown or invalid MMU model\\n\");", "return -1;", "}", "break;", "case -2:\nVAR_0->exception_index = POWERPC_EXCP_DSI;", "VAR_0->error_code = 0;", "VAR_0->spr[SPR_DAR] = VAR_1;", "if (VAR_2 == 1)\nVAR_0->spr[SPR_DSISR] = 0x0A000000;", "else\nVAR_0->spr[SPR_DSISR] = 0x08000000;", "break;", "case -4:\nswitch (VAR_5) {", "case ACCESS_FLOAT:\nVAR_0->exception_index = POWERPC_EXCP_ALIGN;", "VAR_0->error_code = POWERPC_EXCP_ALIGN_FP;", "VAR_0->spr[SPR_DAR] = VAR_1;", "break;", "case ACCESS_RES:\nVAR_0->exception_index = POWERPC_EXCP_DSI;", "VAR_0->error_code = 0;", "VAR_0->spr[SPR_DAR] = VAR_1;", "if (VAR_2 == 1)\nVAR_0->spr[SPR_DSISR] = 0x06000000;", "else\nVAR_0->spr[SPR_DSISR] = 0x04000000;", "break;", "case ACCESS_EXT:\nVAR_0->exception_index = POWERPC_EXCP_DSI;", "VAR_0->error_code = 0;", "VAR_0->spr[SPR_DAR] = VAR_1;", "if (VAR_2 == 1)\nVAR_0->spr[SPR_DSISR] = 0x06100000;", "else\nVAR_0->spr[SPR_DSISR] = 0x04100000;", "break;", "default:\nprintf(\"DSI: invalid exception (%d)\\n\", VAR_6);", "VAR_0->exception_index = POWERPC_EXCP_PROGRAM;", "VAR_0->error_code =\nPOWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_INVAL;", "VAR_0->spr[SPR_DAR] = VAR_1;", "break;", "}", "break;", "#if defined(TARGET_PPC64)\ncase -5:\nif (VAR_0->mmu_model == POWERPC_MMU_620) {", "VAR_0->exception_index = POWERPC_EXCP_DSI;", "VAR_0->error_code = 0;", "VAR_0->spr[SPR_DAR] = VAR_1;", "if (VAR_2 == 1)\nVAR_0->spr[SPR_DSISR] = 0x42000000;", "else\nVAR_0->spr[SPR_DSISR] = 0x40000000;", "} else {", "VAR_0->exception_index = POWERPC_EXCP_DSEG;", "VAR_0->error_code = 0;", "VAR_0->spr[SPR_DAR] = VAR_1;", "}", "break;", "#endif\n}", "}", "#if 0\nprintf(\"%s: set exception to %d %02x\\n\", __func__,\nVAR_0->exception, VAR_0->error_code);", "#endif\nVAR_6 = 1;", "}", "return VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73, 75, 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87, 89, 91, 93, 95, 97, 99 ], [ 101 ], [ 103 ], [ 105, 109 ], [ 111 ], [ 113, 117 ], [ 119 ], [ 121, 125 ], [ 127 ], [ 129, 131, 133 ], [ 135 ], [ 137, 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147, 151 ], [ 153 ], [ 155 ], [ 157, 161 ], [ 163 ], [ 165 ], [ 167, 173 ], [ 175 ], [ 177 ], [ 179, 181, 185 ], [ 187 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203, 205 ], [ 207 ], [ 209 ], [ 211, 215 ], [ 217, 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237, 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247, 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259, 263 ], [ 265, 267 ], [ 269 ], [ 271 ], [ 273, 275, 277 ], [ 279 ], [ 281 ], [ 283, 285 ], [ 287, 289 ], [ 291 ], [ 293, 295, 297, 299, 301, 303, 305 ], [ 307 ], [ 309 ], [ 311, 313 ], [ 315, 317 ], [ 319 ], [ 321, 325 ], [ 327 ], [ 329, 333 ], [ 335 ], [ 337, 341 ], [ 343 ], [ 345, 347, 349 ], [ 351 ], [ 353, 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363, 367 ], [ 369 ], [ 371 ], [ 373, 375 ], [ 377, 379 ], [ 381 ], [ 383, 387 ], [ 389, 393 ], [ 395 ], [ 397 ], [ 399 ], [ 401, 405 ], [ 407 ], [ 409 ], [ 411, 413 ], [ 415, 417 ], [ 419 ], [ 421, 425 ], [ 427 ], [ 429 ], [ 431, 433 ], [ 435, 437 ], [ 439 ], [ 441, 443 ], [ 445 ], [ 447, 449 ], [ 451 ], [ 453 ], [ 455 ], [ 457 ], [ 459, 461, 465 ], [ 467 ], [ 469 ], [ 471 ], [ 475, 477 ], [ 479, 481 ], [ 483 ], [ 485 ], [ 487 ], [ 489 ], [ 491 ], [ 493 ], [ 495, 497 ], [ 499 ], [ 501, 503, 505 ], [ 507, 509 ], [ 511 ], [ 515 ], [ 517 ] ]
8,394
static int sd_create(const char *filename, QEMUOptionParameter *options, Error **errp) { int ret = 0; uint32_t vid = 0; char *backing_file = NULL; BDRVSheepdogState *s; char tag[SD_MAX_VDI_TAG_LEN]; uint32_t snapid; bool prealloc = false; Error *local_err = NULL; s = g_malloc0(sizeof(BDRVSheepdogState)); memset(tag, 0, sizeof(tag)); if (strstr(filename, "://")) { ret = sd_parse_uri(s, filename, s->name, &snapid, tag); } else { ret = parse_vdiname(s, filename, s->name, &snapid, tag); } if (ret < 0) { goto out; } while (options && options->name) { if (!strcmp(options->name, BLOCK_OPT_SIZE)) { s->inode.vdi_size = options->value.n; } else if (!strcmp(options->name, BLOCK_OPT_BACKING_FILE)) { backing_file = options->value.s; } else if (!strcmp(options->name, BLOCK_OPT_PREALLOC)) { if (!options->value.s || !strcmp(options->value.s, "off")) { prealloc = false; } else if (!strcmp(options->value.s, "full")) { prealloc = true; } else { error_report("Invalid preallocation mode: '%s'", options->value.s); ret = -EINVAL; goto out; } } else if (!strcmp(options->name, BLOCK_OPT_REDUNDANCY)) { ret = parse_redundancy(s, options->value.s); if (ret < 0) { goto out; } } options++; } if (s->inode.vdi_size > SD_MAX_VDI_SIZE) { error_report("too big image size"); ret = -EINVAL; goto out; } if (backing_file) { BlockDriverState *bs; BDRVSheepdogState *s; BlockDriver *drv; /* Currently, only Sheepdog backing image is supported. */ drv = bdrv_find_protocol(backing_file, true); if (!drv || strcmp(drv->protocol_name, "sheepdog") != 0) { error_report("backing_file must be a sheepdog image"); ret = -EINVAL; goto out; } ret = bdrv_file_open(&bs, backing_file, NULL, 0, &local_err); if (ret < 0) { qerror_report_err(local_err); error_free(local_err); goto out; } s = bs->opaque; if (!is_snapshot(&s->inode)) { error_report("cannot clone from a non snapshot vdi"); bdrv_unref(bs); ret = -EINVAL; goto out; } bdrv_unref(bs); } ret = do_sd_create(s, &vid, 0); if (!prealloc || ret) { goto out; } ret = sd_prealloc(filename); out: g_free(s); return ret; }
false
qemu
a3120deee5fc1d702ba5da98fd9c845ad1c8f301
static int sd_create(const char *filename, QEMUOptionParameter *options, Error **errp) { int ret = 0; uint32_t vid = 0; char *backing_file = NULL; BDRVSheepdogState *s; char tag[SD_MAX_VDI_TAG_LEN]; uint32_t snapid; bool prealloc = false; Error *local_err = NULL; s = g_malloc0(sizeof(BDRVSheepdogState)); memset(tag, 0, sizeof(tag)); if (strstr(filename, ": ret = sd_parse_uri(s, filename, s->name, &snapid, tag); } else { ret = parse_vdiname(s, filename, s->name, &snapid, tag); } if (ret < 0) { goto out; } while (options && options->name) { if (!strcmp(options->name, BLOCK_OPT_SIZE)) { s->inode.vdi_size = options->value.n; } else if (!strcmp(options->name, BLOCK_OPT_BACKING_FILE)) { backing_file = options->value.s; } else if (!strcmp(options->name, BLOCK_OPT_PREALLOC)) { if (!options->value.s || !strcmp(options->value.s, "off")) { prealloc = false; } else if (!strcmp(options->value.s, "full")) { prealloc = true; } else { error_report("Invalid preallocation mode: '%s'", options->value.s); ret = -EINVAL; goto out; } } else if (!strcmp(options->name, BLOCK_OPT_REDUNDANCY)) { ret = parse_redundancy(s, options->value.s); if (ret < 0) { goto out; } } options++; } if (s->inode.vdi_size > SD_MAX_VDI_SIZE) { error_report("too big image size"); ret = -EINVAL; goto out; } if (backing_file) { BlockDriverState *bs; BDRVSheepdogState *s; BlockDriver *drv; drv = bdrv_find_protocol(backing_file, true); if (!drv || strcmp(drv->protocol_name, "sheepdog") != 0) { error_report("backing_file must be a sheepdog image"); ret = -EINVAL; goto out; } ret = bdrv_file_open(&bs, backing_file, NULL, 0, &local_err); if (ret < 0) { qerror_report_err(local_err); error_free(local_err); goto out; } s = bs->opaque; if (!is_snapshot(&s->inode)) { error_report("cannot clone from a non snapshot vdi"); bdrv_unref(bs); ret = -EINVAL; goto out; } bdrv_unref(bs); } ret = do_sd_create(s, &vid, 0); if (!prealloc || ret) { goto out; } ret = sd_prealloc(filename); out: g_free(s); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(const char *VAR_0, QEMUOptionParameter *VAR_1, Error **VAR_2) { int VAR_3 = 0; uint32_t vid = 0; char *VAR_4 = NULL; BDRVSheepdogState *s; char VAR_5[SD_MAX_VDI_TAG_LEN]; uint32_t snapid; bool prealloc = false; Error *local_err = NULL; s = g_malloc0(sizeof(BDRVSheepdogState)); memset(VAR_5, 0, sizeof(VAR_5)); if (strstr(VAR_0, ": VAR_3 = sd_parse_uri(s, VAR_0, s->name, &snapid, VAR_5); } else { VAR_3 = parse_vdiname(s, VAR_0, s->name, &snapid, VAR_5); } if (VAR_3 < 0) { goto out; } while (VAR_1 && VAR_1->name) { if (!strcmp(VAR_1->name, BLOCK_OPT_SIZE)) { s->inode.vdi_size = VAR_1->value.n; } else if (!strcmp(VAR_1->name, BLOCK_OPT_BACKING_FILE)) { VAR_4 = VAR_1->value.s; } else if (!strcmp(VAR_1->name, BLOCK_OPT_PREALLOC)) { if (!VAR_1->value.s || !strcmp(VAR_1->value.s, "off")) { prealloc = false; } else if (!strcmp(VAR_1->value.s, "full")) { prealloc = true; } else { error_report("Invalid preallocation mode: '%s'", VAR_1->value.s); VAR_3 = -EINVAL; goto out; } } else if (!strcmp(VAR_1->name, BLOCK_OPT_REDUNDANCY)) { VAR_3 = parse_redundancy(s, VAR_1->value.s); if (VAR_3 < 0) { goto out; } } VAR_1++; } if (s->inode.vdi_size > SD_MAX_VDI_SIZE) { error_report("too big image size"); VAR_3 = -EINVAL; goto out; } if (VAR_4) { BlockDriverState *bs; BDRVSheepdogState *s; BlockDriver *drv; drv = bdrv_find_protocol(VAR_4, true); if (!drv || strcmp(drv->protocol_name, "sheepdog") != 0) { error_report("VAR_4 must be a sheepdog image"); VAR_3 = -EINVAL; goto out; } VAR_3 = bdrv_file_open(&bs, VAR_4, NULL, 0, &local_err); if (VAR_3 < 0) { qerror_report_err(local_err); error_free(local_err); goto out; } s = bs->opaque; if (!is_snapshot(&s->inode)) { error_report("cannot clone from a non snapshot vdi"); bdrv_unref(bs); VAR_3 = -EINVAL; goto out; } bdrv_unref(bs); } VAR_3 = do_sd_create(s, &vid, 0); if (!prealloc || VAR_3) { goto out; } VAR_3 = sd_prealloc(VAR_0); out: g_free(s); return VAR_3; }
[ "static int FUNC_0(const char *VAR_0, QEMUOptionParameter *VAR_1,\nError **VAR_2)\n{", "int VAR_3 = 0;", "uint32_t vid = 0;", "char *VAR_4 = NULL;", "BDRVSheepdogState *s;", "char VAR_5[SD_MAX_VDI_TAG_LEN];", "uint32_t snapid;", "bool prealloc = false;", "Error *local_err = NULL;", "s = g_malloc0(sizeof(BDRVSheepdogState));", "memset(VAR_5, 0, sizeof(VAR_5));", "if (strstr(VAR_0, \":\nVAR_3 = sd_parse_uri(s, VAR_0, s->name, &snapid, VAR_5);", "} else {", "VAR_3 = parse_vdiname(s, VAR_0, s->name, &snapid, VAR_5);", "}", "if (VAR_3 < 0) {", "goto out;", "}", "while (VAR_1 && VAR_1->name) {", "if (!strcmp(VAR_1->name, BLOCK_OPT_SIZE)) {", "s->inode.vdi_size = VAR_1->value.n;", "} else if (!strcmp(VAR_1->name, BLOCK_OPT_BACKING_FILE)) {", "VAR_4 = VAR_1->value.s;", "} else if (!strcmp(VAR_1->name, BLOCK_OPT_PREALLOC)) {", "if (!VAR_1->value.s || !strcmp(VAR_1->value.s, \"off\")) {", "prealloc = false;", "} else if (!strcmp(VAR_1->value.s, \"full\")) {", "prealloc = true;", "} else {", "error_report(\"Invalid preallocation mode: '%s'\",\nVAR_1->value.s);", "VAR_3 = -EINVAL;", "goto out;", "}", "} else if (!strcmp(VAR_1->name, BLOCK_OPT_REDUNDANCY)) {", "VAR_3 = parse_redundancy(s, VAR_1->value.s);", "if (VAR_3 < 0) {", "goto out;", "}", "}", "VAR_1++;", "}", "if (s->inode.vdi_size > SD_MAX_VDI_SIZE) {", "error_report(\"too big image size\");", "VAR_3 = -EINVAL;", "goto out;", "}", "if (VAR_4) {", "BlockDriverState *bs;", "BDRVSheepdogState *s;", "BlockDriver *drv;", "drv = bdrv_find_protocol(VAR_4, true);", "if (!drv || strcmp(drv->protocol_name, \"sheepdog\") != 0) {", "error_report(\"VAR_4 must be a sheepdog image\");", "VAR_3 = -EINVAL;", "goto out;", "}", "VAR_3 = bdrv_file_open(&bs, VAR_4, NULL, 0, &local_err);", "if (VAR_3 < 0) {", "qerror_report_err(local_err);", "error_free(local_err);", "goto out;", "}", "s = bs->opaque;", "if (!is_snapshot(&s->inode)) {", "error_report(\"cannot clone from a non snapshot vdi\");", "bdrv_unref(bs);", "VAR_3 = -EINVAL;", "goto out;", "}", "bdrv_unref(bs);", "}", "VAR_3 = do_sd_create(s, &vid, 0);", "if (!prealloc || VAR_3) {", "goto out;", "}", "VAR_3 = sd_prealloc(VAR_0);", "out:\ng_free(s);", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 169 ], [ 171 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 185 ], [ 187, 189 ], [ 191 ], [ 193 ] ]
8,395
opts_type_uint64(Visitor *v, uint64_t *obj, const char *name, Error **errp) { OptsVisitor *ov = DO_UPCAST(OptsVisitor, visitor, v); const QemuOpt *opt; const char *str; unsigned long long val; char *endptr; if (ov->list_mode == LM_UNSIGNED_INTERVAL) { *obj = ov->range_next.u; return; } opt = lookup_scalar(ov, name, errp); if (!opt) { return; } str = opt->str; /* we've gotten past lookup_scalar() */ assert(ov->list_mode == LM_NONE || ov->list_mode == LM_IN_PROGRESS); if (parse_uint(str, &val, &endptr, 0) == 0 && val <= UINT64_MAX) { if (*endptr == '\0') { *obj = val; processed(ov, name); return; } if (*endptr == '-' && ov->list_mode == LM_IN_PROGRESS) { unsigned long long val2; str = endptr + 1; if (parse_uint_full(str, &val2, 0) == 0 && val2 <= UINT64_MAX && val <= val2) { ov->range_next.u = val; ov->range_limit.u = val2; ov->list_mode = LM_UNSIGNED_INTERVAL; /* as if entering on the top */ *obj = ov->range_next.u; return; } } } error_set(errp, QERR_INVALID_PARAMETER_VALUE, opt->name, (ov->list_mode == LM_NONE) ? "a uint64 value" : "a uint64 value or range"); }
false
qemu
15a849be100b54776bcf63193c3fea598666030f
opts_type_uint64(Visitor *v, uint64_t *obj, const char *name, Error **errp) { OptsVisitor *ov = DO_UPCAST(OptsVisitor, visitor, v); const QemuOpt *opt; const char *str; unsigned long long val; char *endptr; if (ov->list_mode == LM_UNSIGNED_INTERVAL) { *obj = ov->range_next.u; return; } opt = lookup_scalar(ov, name, errp); if (!opt) { return; } str = opt->str; assert(ov->list_mode == LM_NONE || ov->list_mode == LM_IN_PROGRESS); if (parse_uint(str, &val, &endptr, 0) == 0 && val <= UINT64_MAX) { if (*endptr == '\0') { *obj = val; processed(ov, name); return; } if (*endptr == '-' && ov->list_mode == LM_IN_PROGRESS) { unsigned long long val2; str = endptr + 1; if (parse_uint_full(str, &val2, 0) == 0 && val2 <= UINT64_MAX && val <= val2) { ov->range_next.u = val; ov->range_limit.u = val2; ov->list_mode = LM_UNSIGNED_INTERVAL; *obj = ov->range_next.u; return; } } } error_set(errp, QERR_INVALID_PARAMETER_VALUE, opt->name, (ov->list_mode == LM_NONE) ? "a uint64 value" : "a uint64 value or range"); }
{ "code": [], "line_no": [] }
FUNC_0(Visitor *VAR_0, uint64_t *VAR_1, const char *VAR_2, Error **VAR_3) { OptsVisitor *ov = DO_UPCAST(OptsVisitor, visitor, VAR_0); const QemuOpt *VAR_4; const char *VAR_5; unsigned long long VAR_6; char *VAR_7; if (ov->list_mode == LM_UNSIGNED_INTERVAL) { *VAR_1 = ov->range_next.u; return; } VAR_4 = lookup_scalar(ov, VAR_2, VAR_3); if (!VAR_4) { return; } VAR_5 = VAR_4->VAR_5; assert(ov->list_mode == LM_NONE || ov->list_mode == LM_IN_PROGRESS); if (parse_uint(VAR_5, &VAR_6, &VAR_7, 0) == 0 && VAR_6 <= UINT64_MAX) { if (*VAR_7 == '\0') { *VAR_1 = VAR_6; processed(ov, VAR_2); return; } if (*VAR_7 == '-' && ov->list_mode == LM_IN_PROGRESS) { unsigned long long VAR_8; VAR_5 = VAR_7 + 1; if (parse_uint_full(VAR_5, &VAR_8, 0) == 0 && VAR_8 <= UINT64_MAX && VAR_6 <= VAR_8) { ov->range_next.u = VAR_6; ov->range_limit.u = VAR_8; ov->list_mode = LM_UNSIGNED_INTERVAL; *VAR_1 = ov->range_next.u; return; } } } error_set(VAR_3, QERR_INVALID_PARAMETER_VALUE, VAR_4->VAR_2, (ov->list_mode == LM_NONE) ? "a uint64 value" : "a uint64 value or range"); }
[ "FUNC_0(Visitor *VAR_0, uint64_t *VAR_1, const char *VAR_2, Error **VAR_3)\n{", "OptsVisitor *ov = DO_UPCAST(OptsVisitor, visitor, VAR_0);", "const QemuOpt *VAR_4;", "const char *VAR_5;", "unsigned long long VAR_6;", "char *VAR_7;", "if (ov->list_mode == LM_UNSIGNED_INTERVAL) {", "*VAR_1 = ov->range_next.u;", "return;", "}", "VAR_4 = lookup_scalar(ov, VAR_2, VAR_3);", "if (!VAR_4) {", "return;", "}", "VAR_5 = VAR_4->VAR_5;", "assert(ov->list_mode == LM_NONE || ov->list_mode == LM_IN_PROGRESS);", "if (parse_uint(VAR_5, &VAR_6, &VAR_7, 0) == 0 && VAR_6 <= UINT64_MAX) {", "if (*VAR_7 == '\\0') {", "*VAR_1 = VAR_6;", "processed(ov, VAR_2);", "return;", "}", "if (*VAR_7 == '-' && ov->list_mode == LM_IN_PROGRESS) {", "unsigned long long VAR_8;", "VAR_5 = VAR_7 + 1;", "if (parse_uint_full(VAR_5, &VAR_8, 0) == 0 &&\nVAR_8 <= UINT64_MAX && VAR_6 <= VAR_8) {", "ov->range_next.u = VAR_6;", "ov->range_limit.u = VAR_8;", "ov->list_mode = LM_UNSIGNED_INTERVAL;", "*VAR_1 = ov->range_next.u;", "return;", "}", "}", "}", "error_set(VAR_3, QERR_INVALID_PARAMETER_VALUE, VAR_4->VAR_2,\n(ov->list_mode == LM_NONE) ? \"a uint64 value\" :\n\"a uint64 value or range\");", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89, 91, 93 ], [ 95 ] ]
8,396
static void pci_basic_config(void) { QVirtIO9P *v9p; void *addr; size_t tag_len; char *tag; int i; qvirtio_9p_start(); v9p = qvirtio_9p_pci_init(); addr = ((QVirtioPCIDevice *) v9p->dev)->addr + VIRTIO_PCI_CONFIG_OFF(false); tag_len = qvirtio_config_readw(v9p->dev, (uint64_t)(uintptr_t)addr); g_assert_cmpint(tag_len, ==, strlen(mount_tag)); addr += sizeof(uint16_t); tag = g_malloc(tag_len); for (i = 0; i < tag_len; i++) { tag[i] = qvirtio_config_readb(v9p->dev, (uint64_t)(uintptr_t)addr + i); } g_assert_cmpmem(tag, tag_len, mount_tag, tag_len); g_free(tag); qvirtio_9p_pci_free(v9p); qvirtio_9p_stop(); }
false
qemu
a980f7f2c2f4d7e9a1eba4f804cd66dbd458b6d4
static void pci_basic_config(void) { QVirtIO9P *v9p; void *addr; size_t tag_len; char *tag; int i; qvirtio_9p_start(); v9p = qvirtio_9p_pci_init(); addr = ((QVirtioPCIDevice *) v9p->dev)->addr + VIRTIO_PCI_CONFIG_OFF(false); tag_len = qvirtio_config_readw(v9p->dev, (uint64_t)(uintptr_t)addr); g_assert_cmpint(tag_len, ==, strlen(mount_tag)); addr += sizeof(uint16_t); tag = g_malloc(tag_len); for (i = 0; i < tag_len; i++) { tag[i] = qvirtio_config_readb(v9p->dev, (uint64_t)(uintptr_t)addr + i); } g_assert_cmpmem(tag, tag_len, mount_tag, tag_len); g_free(tag); qvirtio_9p_pci_free(v9p); qvirtio_9p_stop(); }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { QVirtIO9P *v9p; void *VAR_0; size_t tag_len; char *VAR_1; int VAR_2; qvirtio_9p_start(); v9p = qvirtio_9p_pci_init(); VAR_0 = ((QVirtioPCIDevice *) v9p->dev)->VAR_0 + VIRTIO_PCI_CONFIG_OFF(false); tag_len = qvirtio_config_readw(v9p->dev, (uint64_t)(uintptr_t)VAR_0); g_assert_cmpint(tag_len, ==, strlen(mount_tag)); VAR_0 += sizeof(uint16_t); VAR_1 = g_malloc(tag_len); for (VAR_2 = 0; VAR_2 < tag_len; VAR_2++) { VAR_1[VAR_2] = qvirtio_config_readb(v9p->dev, (uint64_t)(uintptr_t)VAR_0 + VAR_2); } g_assert_cmpmem(VAR_1, tag_len, mount_tag, tag_len); g_free(VAR_1); qvirtio_9p_pci_free(v9p); qvirtio_9p_stop(); }
[ "static void FUNC_0(void)\n{", "QVirtIO9P *v9p;", "void *VAR_0;", "size_t tag_len;", "char *VAR_1;", "int VAR_2;", "qvirtio_9p_start();", "v9p = qvirtio_9p_pci_init();", "VAR_0 = ((QVirtioPCIDevice *) v9p->dev)->VAR_0 + VIRTIO_PCI_CONFIG_OFF(false);", "tag_len = qvirtio_config_readw(v9p->dev,\n(uint64_t)(uintptr_t)VAR_0);", "g_assert_cmpint(tag_len, ==, strlen(mount_tag));", "VAR_0 += sizeof(uint16_t);", "VAR_1 = g_malloc(tag_len);", "for (VAR_2 = 0; VAR_2 < tag_len; VAR_2++) {", "VAR_1[VAR_2] = qvirtio_config_readb(v9p->dev, (uint64_t)(uintptr_t)VAR_0 + VAR_2);", "}", "g_assert_cmpmem(VAR_1, tag_len, mount_tag, tag_len);", "g_free(VAR_1);", "qvirtio_9p_pci_free(v9p);", "qvirtio_9p_stop();", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ] ]
8,397
static ssize_t qio_channel_websock_readv(QIOChannel *ioc, const struct iovec *iov, size_t niov, int **fds, size_t *nfds, Error **errp) { QIOChannelWebsock *wioc = QIO_CHANNEL_WEBSOCK(ioc); size_t i; ssize_t got = 0; ssize_t ret; if (wioc->io_err) { *errp = error_copy(wioc->io_err); return -1; } if (!wioc->rawinput.offset) { ret = qio_channel_websock_read_wire(QIO_CHANNEL_WEBSOCK(ioc), errp); if (ret < 0) { return ret; } } for (i = 0 ; i < niov ; i++) { size_t want = iov[i].iov_len; if (want > (wioc->rawinput.offset - got)) { want = (wioc->rawinput.offset - got); } memcpy(iov[i].iov_base, wioc->rawinput.buffer + got, want); got += want; if (want < iov[i].iov_len) { break; } } buffer_advance(&wioc->rawinput, got); qio_channel_websock_set_watch(wioc); return got; }
false
qemu
e79ea67a9785a5da4d1889b6e2bb71d03e916add
static ssize_t qio_channel_websock_readv(QIOChannel *ioc, const struct iovec *iov, size_t niov, int **fds, size_t *nfds, Error **errp) { QIOChannelWebsock *wioc = QIO_CHANNEL_WEBSOCK(ioc); size_t i; ssize_t got = 0; ssize_t ret; if (wioc->io_err) { *errp = error_copy(wioc->io_err); return -1; } if (!wioc->rawinput.offset) { ret = qio_channel_websock_read_wire(QIO_CHANNEL_WEBSOCK(ioc), errp); if (ret < 0) { return ret; } } for (i = 0 ; i < niov ; i++) { size_t want = iov[i].iov_len; if (want > (wioc->rawinput.offset - got)) { want = (wioc->rawinput.offset - got); } memcpy(iov[i].iov_base, wioc->rawinput.buffer + got, want); got += want; if (want < iov[i].iov_len) { break; } } buffer_advance(&wioc->rawinput, got); qio_channel_websock_set_watch(wioc); return got; }
{ "code": [], "line_no": [] }
static ssize_t FUNC_0(QIOChannel *ioc, const struct iovec *iov, size_t niov, int **fds, size_t *nfds, Error **errp) { QIOChannelWebsock *wioc = QIO_CHANNEL_WEBSOCK(ioc); size_t i; ssize_t got = 0; ssize_t ret; if (wioc->io_err) { *errp = error_copy(wioc->io_err); return -1; } if (!wioc->rawinput.offset) { ret = qio_channel_websock_read_wire(QIO_CHANNEL_WEBSOCK(ioc), errp); if (ret < 0) { return ret; } } for (i = 0 ; i < niov ; i++) { size_t want = iov[i].iov_len; if (want > (wioc->rawinput.offset - got)) { want = (wioc->rawinput.offset - got); } memcpy(iov[i].iov_base, wioc->rawinput.buffer + got, want); got += want; if (want < iov[i].iov_len) { break; } } buffer_advance(&wioc->rawinput, got); qio_channel_websock_set_watch(wioc); return got; }
[ "static ssize_t FUNC_0(QIOChannel *ioc,\nconst struct iovec *iov,\nsize_t niov,\nint **fds,\nsize_t *nfds,\nError **errp)\n{", "QIOChannelWebsock *wioc = QIO_CHANNEL_WEBSOCK(ioc);", "size_t i;", "ssize_t got = 0;", "ssize_t ret;", "if (wioc->io_err) {", "*errp = error_copy(wioc->io_err);", "return -1;", "}", "if (!wioc->rawinput.offset) {", "ret = qio_channel_websock_read_wire(QIO_CHANNEL_WEBSOCK(ioc), errp);", "if (ret < 0) {", "return ret;", "}", "}", "for (i = 0 ; i < niov ; i++) {", "size_t want = iov[i].iov_len;", "if (want > (wioc->rawinput.offset - got)) {", "want = (wioc->rawinput.offset - got);", "}", "memcpy(iov[i].iov_base,\nwioc->rawinput.buffer + got,\nwant);", "got += want;", "if (want < iov[i].iov_len) {", "break;", "}", "}", "buffer_advance(&wioc->rawinput, got);", "qio_channel_websock_set_watch(wioc);", "return got;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61, 63, 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ] ]
8,398
static void ppc_core99_init(MachineState *machine) { ram_addr_t ram_size = machine->ram_size; const char *cpu_model = machine->cpu_model; const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; const char *initrd_filename = machine->initrd_filename; const char *boot_device = machine->boot_order; PowerPCCPU *cpu = NULL; CPUPPCState *env = NULL; char *filename; qemu_irq *pic, **openpic_irqs; MemoryRegion *isa = g_new(MemoryRegion, 1); MemoryRegion *unin_memory = g_new(MemoryRegion, 1); MemoryRegion *unin2_memory = g_new(MemoryRegion, 1); int linux_boot, i, j, k; MemoryRegion *ram = g_new(MemoryRegion, 1), *bios = g_new(MemoryRegion, 1); hwaddr kernel_base, initrd_base, cmdline_base = 0; long kernel_size, initrd_size; PCIBus *pci_bus; PCIDevice *macio; MACIOIDEState *macio_ide; BusState *adb_bus; MacIONVRAMState *nvr; int bios_size; MemoryRegion *pic_mem, *escc_mem; MemoryRegion *escc_bar = g_new(MemoryRegion, 1); int ppc_boot_device; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; void *fw_cfg; int machine_arch; SysBusDevice *s; DeviceState *dev; int *token = g_new(int, 1); hwaddr nvram_addr = 0xFFF04000; uint64_t tbfreq; linux_boot = (kernel_filename != NULL); /* init CPUs */ if (cpu_model == NULL) #ifdef TARGET_PPC64 cpu_model = "970fx"; #else cpu_model = "G4"; #endif for (i = 0; i < smp_cpus; i++) { cpu = cpu_ppc_init(cpu_model); if (cpu == NULL) { fprintf(stderr, "Unable to find PowerPC CPU definition\n"); exit(1); } env = &cpu->env; /* Set time-base frequency to 100 Mhz */ cpu_ppc_tb_init(env, TBFREQ); qemu_register_reset(ppc_core99_reset, cpu); } /* allocate RAM */ memory_region_allocate_system_memory(ram, NULL, "ppc_core99.ram", ram_size); memory_region_add_subregion(get_system_memory(), 0, ram); /* allocate and load BIOS */ memory_region_init_ram(bios, NULL, "ppc_core99.bios", BIOS_SIZE, &error_abort); vmstate_register_ram_global(bios); if (bios_name == NULL) bios_name = PROM_FILENAME; filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); memory_region_set_readonly(bios, true); memory_region_add_subregion(get_system_memory(), PROM_ADDR, bios); /* Load OpenBIOS (ELF) */ if (filename) { bios_size = load_elf(filename, NULL, NULL, NULL, NULL, NULL, 1, ELF_MACHINE, 0); g_free(filename); } else { bios_size = -1; } if (bios_size < 0 || bios_size > BIOS_SIZE) { hw_error("qemu: could not load PowerPC bios '%s'\n", bios_name); exit(1); } if (linux_boot) { uint64_t lowaddr = 0; int bswap_needed; #ifdef BSWAP_NEEDED bswap_needed = 1; #else bswap_needed = 0; #endif kernel_base = KERNEL_LOAD_ADDR; kernel_size = load_elf(kernel_filename, translate_kernel_address, NULL, NULL, &lowaddr, NULL, 1, ELF_MACHINE, 0); if (kernel_size < 0) kernel_size = load_aout(kernel_filename, kernel_base, ram_size - kernel_base, bswap_needed, TARGET_PAGE_SIZE); if (kernel_size < 0) kernel_size = load_image_targphys(kernel_filename, kernel_base, ram_size - kernel_base); if (kernel_size < 0) { hw_error("qemu: could not load kernel '%s'\n", kernel_filename); exit(1); } /* load initrd */ if (initrd_filename) { initrd_base = round_page(kernel_base + kernel_size + KERNEL_GAP); initrd_size = load_image_targphys(initrd_filename, initrd_base, ram_size - initrd_base); if (initrd_size < 0) { hw_error("qemu: could not load initial ram disk '%s'\n", initrd_filename); exit(1); } cmdline_base = round_page(initrd_base + initrd_size); } else { initrd_base = 0; initrd_size = 0; cmdline_base = round_page(kernel_base + kernel_size + KERNEL_GAP); } ppc_boot_device = 'm'; } else { kernel_base = 0; kernel_size = 0; initrd_base = 0; initrd_size = 0; ppc_boot_device = '\0'; /* We consider that NewWorld PowerMac never have any floppy drive * For now, OHW cannot boot from the network. */ for (i = 0; boot_device[i] != '\0'; i++) { if (boot_device[i] >= 'c' && boot_device[i] <= 'f') { ppc_boot_device = boot_device[i]; break; } } if (ppc_boot_device == '\0') { fprintf(stderr, "No valid boot device for Mac99 machine\n"); exit(1); } } /* Register 8 MB of ISA IO space */ memory_region_init_alias(isa, NULL, "isa_mmio", get_system_io(), 0, 0x00800000); memory_region_add_subregion(get_system_memory(), 0xf2000000, isa); /* UniN init: XXX should be a real device */ memory_region_init_io(unin_memory, NULL, &unin_ops, token, "unin", 0x1000); memory_region_add_subregion(get_system_memory(), 0xf8000000, unin_memory); memory_region_init_io(unin2_memory, NULL, &unin_ops, token, "unin", 0x1000); memory_region_add_subregion(get_system_memory(), 0xf3000000, unin2_memory); openpic_irqs = g_malloc0(smp_cpus * sizeof(qemu_irq *)); openpic_irqs[0] = g_malloc0(smp_cpus * sizeof(qemu_irq) * OPENPIC_OUTPUT_NB); for (i = 0; i < smp_cpus; i++) { /* Mac99 IRQ connection between OpenPIC outputs pins * and PowerPC input pins */ switch (PPC_INPUT(env)) { case PPC_FLAGS_INPUT_6xx: openpic_irqs[i] = openpic_irqs[0] + (i * OPENPIC_OUTPUT_NB); openpic_irqs[i][OPENPIC_OUTPUT_INT] = ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_INT]; openpic_irqs[i][OPENPIC_OUTPUT_CINT] = ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_INT]; openpic_irqs[i][OPENPIC_OUTPUT_MCK] = ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_MCP]; /* Not connected ? */ openpic_irqs[i][OPENPIC_OUTPUT_DEBUG] = NULL; /* Check this */ openpic_irqs[i][OPENPIC_OUTPUT_RESET] = ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_HRESET]; break; #if defined(TARGET_PPC64) case PPC_FLAGS_INPUT_970: openpic_irqs[i] = openpic_irqs[0] + (i * OPENPIC_OUTPUT_NB); openpic_irqs[i][OPENPIC_OUTPUT_INT] = ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_INT]; openpic_irqs[i][OPENPIC_OUTPUT_CINT] = ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_INT]; openpic_irqs[i][OPENPIC_OUTPUT_MCK] = ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_MCP]; /* Not connected ? */ openpic_irqs[i][OPENPIC_OUTPUT_DEBUG] = NULL; /* Check this */ openpic_irqs[i][OPENPIC_OUTPUT_RESET] = ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_HRESET]; break; #endif /* defined(TARGET_PPC64) */ default: hw_error("Bus model not supported on mac99 machine\n"); exit(1); } } pic = g_new0(qemu_irq, 64); dev = qdev_create(NULL, TYPE_OPENPIC); qdev_prop_set_uint32(dev, "model", OPENPIC_MODEL_RAVEN); qdev_init_nofail(dev); s = SYS_BUS_DEVICE(dev); pic_mem = s->mmio[0].memory; k = 0; for (i = 0; i < smp_cpus; i++) { for (j = 0; j < OPENPIC_OUTPUT_NB; j++) { sysbus_connect_irq(s, k++, openpic_irqs[i][j]); } } for (i = 0; i < 64; i++) { pic[i] = qdev_get_gpio_in(dev, i); } if (PPC_INPUT(env) == PPC_FLAGS_INPUT_970) { /* 970 gets a U3 bus */ pci_bus = pci_pmac_u3_init(pic, get_system_memory(), get_system_io()); machine_arch = ARCH_MAC99_U3; machine->usb |= defaults_enabled(); } else { pci_bus = pci_pmac_init(pic, get_system_memory(), get_system_io()); machine_arch = ARCH_MAC99; } /* Timebase Frequency */ if (kvm_enabled()) { tbfreq = kvmppc_get_tbfreq(); } else { tbfreq = TBFREQ; } /* init basic PC hardware */ escc_mem = escc_init(0, pic[0x25], pic[0x24], serial_hds[0], serial_hds[1], ESCC_CLOCK, 4); memory_region_init_alias(escc_bar, NULL, "escc-bar", escc_mem, 0, memory_region_size(escc_mem)); macio = pci_create(pci_bus, -1, TYPE_NEWWORLD_MACIO); dev = DEVICE(macio); qdev_connect_gpio_out(dev, 0, pic[0x19]); /* CUDA */ qdev_connect_gpio_out(dev, 1, pic[0x0d]); /* IDE */ qdev_connect_gpio_out(dev, 2, pic[0x02]); /* IDE DMA */ qdev_connect_gpio_out(dev, 3, pic[0x0e]); /* IDE */ qdev_connect_gpio_out(dev, 4, pic[0x03]); /* IDE DMA */ qdev_prop_set_uint64(dev, "frequency", tbfreq); macio_init(macio, pic_mem, escc_bar); /* We only emulate 2 out of 3 IDE controllers for now */ ide_drive_get(hd, ARRAY_SIZE(hd)); macio_ide = MACIO_IDE(object_resolve_path_component(OBJECT(macio), "ide[0]")); macio_ide_init_drives(macio_ide, hd); macio_ide = MACIO_IDE(object_resolve_path_component(OBJECT(macio), "ide[1]")); macio_ide_init_drives(macio_ide, &hd[MAX_IDE_DEVS]); dev = DEVICE(object_resolve_path_component(OBJECT(macio), "cuda")); adb_bus = qdev_get_child_bus(dev, "adb.0"); dev = qdev_create(adb_bus, TYPE_ADB_KEYBOARD); qdev_init_nofail(dev); dev = qdev_create(adb_bus, TYPE_ADB_MOUSE); qdev_init_nofail(dev); if (machine->usb) { pci_create_simple(pci_bus, -1, "pci-ohci"); /* U3 needs to use USB for input because Linux doesn't support via-cuda on PPC64 */ if (machine_arch == ARCH_MAC99_U3) { USBBus *usb_bus = usb_bus_find(-1); usb_create_simple(usb_bus, "usb-kbd"); usb_create_simple(usb_bus, "usb-mouse"); } } pci_vga_init(pci_bus); if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8) { graphic_depth = 15; } for (i = 0; i < nb_nics; i++) { pci_nic_init_nofail(&nd_table[i], pci_bus, "ne2k_pci", NULL); } /* The NewWorld NVRAM is not located in the MacIO device */ #ifdef CONFIG_KVM if (kvm_enabled() && getpagesize() > 4096) { /* We can't combine read-write and read-only in a single page, so move the NVRAM out of ROM again for KVM */ nvram_addr = 0xFFE00000; } #endif dev = qdev_create(NULL, TYPE_MACIO_NVRAM); qdev_prop_set_uint32(dev, "size", 0x2000); qdev_prop_set_uint32(dev, "it_shift", 1); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, nvram_addr); nvr = MACIO_NVRAM(dev); pmac_format_nvram_partition(nvr, 0x2000); /* No PCI init: the BIOS will do it */ fw_cfg = fw_cfg_init_mem(CFG_ADDR, CFG_ADDR + 2); fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)max_cpus); fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1); fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, machine_arch); fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, kernel_base); fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_SIZE, kernel_size); if (kernel_cmdline) { fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, cmdline_base); pstrcpy_targphys("cmdline", cmdline_base, TARGET_PAGE_SIZE, kernel_cmdline); } else { fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, 0); } fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_ADDR, initrd_base); fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size); fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, ppc_boot_device); fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, graphic_width); fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height); fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth); fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_IS_KVM, kvm_enabled()); if (kvm_enabled()) { #ifdef CONFIG_KVM uint8_t *hypercall; hypercall = g_malloc(16); kvmppc_get_hypercall(env, hypercall, 16); fw_cfg_add_bytes(fw_cfg, FW_CFG_PPC_KVM_HC, hypercall, 16); fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_KVM_PID, getpid()); #endif } fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_TBFREQ, tbfreq); /* Mac OS X requires a "known good" clock-frequency value; pass it one. */ fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_CLOCKFREQ, CLOCKFREQ); fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_BUSFREQ, BUSFREQ); fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_NVRAM_ADDR, nvram_addr); qemu_register_boot_set(fw_cfg_boot_set, fw_cfg); }
false
qemu
3a5c76baf312d83cb77c8faa72c5f7a477effed0
static void ppc_core99_init(MachineState *machine) { ram_addr_t ram_size = machine->ram_size; const char *cpu_model = machine->cpu_model; const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; const char *initrd_filename = machine->initrd_filename; const char *boot_device = machine->boot_order; PowerPCCPU *cpu = NULL; CPUPPCState *env = NULL; char *filename; qemu_irq *pic, **openpic_irqs; MemoryRegion *isa = g_new(MemoryRegion, 1); MemoryRegion *unin_memory = g_new(MemoryRegion, 1); MemoryRegion *unin2_memory = g_new(MemoryRegion, 1); int linux_boot, i, j, k; MemoryRegion *ram = g_new(MemoryRegion, 1), *bios = g_new(MemoryRegion, 1); hwaddr kernel_base, initrd_base, cmdline_base = 0; long kernel_size, initrd_size; PCIBus *pci_bus; PCIDevice *macio; MACIOIDEState *macio_ide; BusState *adb_bus; MacIONVRAMState *nvr; int bios_size; MemoryRegion *pic_mem, *escc_mem; MemoryRegion *escc_bar = g_new(MemoryRegion, 1); int ppc_boot_device; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; void *fw_cfg; int machine_arch; SysBusDevice *s; DeviceState *dev; int *token = g_new(int, 1); hwaddr nvram_addr = 0xFFF04000; uint64_t tbfreq; linux_boot = (kernel_filename != NULL); if (cpu_model == NULL) #ifdef TARGET_PPC64 cpu_model = "970fx"; #else cpu_model = "G4"; #endif for (i = 0; i < smp_cpus; i++) { cpu = cpu_ppc_init(cpu_model); if (cpu == NULL) { fprintf(stderr, "Unable to find PowerPC CPU definition\n"); exit(1); } env = &cpu->env; cpu_ppc_tb_init(env, TBFREQ); qemu_register_reset(ppc_core99_reset, cpu); } memory_region_allocate_system_memory(ram, NULL, "ppc_core99.ram", ram_size); memory_region_add_subregion(get_system_memory(), 0, ram); memory_region_init_ram(bios, NULL, "ppc_core99.bios", BIOS_SIZE, &error_abort); vmstate_register_ram_global(bios); if (bios_name == NULL) bios_name = PROM_FILENAME; filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); memory_region_set_readonly(bios, true); memory_region_add_subregion(get_system_memory(), PROM_ADDR, bios); if (filename) { bios_size = load_elf(filename, NULL, NULL, NULL, NULL, NULL, 1, ELF_MACHINE, 0); g_free(filename); } else { bios_size = -1; } if (bios_size < 0 || bios_size > BIOS_SIZE) { hw_error("qemu: could not load PowerPC bios '%s'\n", bios_name); exit(1); } if (linux_boot) { uint64_t lowaddr = 0; int bswap_needed; #ifdef BSWAP_NEEDED bswap_needed = 1; #else bswap_needed = 0; #endif kernel_base = KERNEL_LOAD_ADDR; kernel_size = load_elf(kernel_filename, translate_kernel_address, NULL, NULL, &lowaddr, NULL, 1, ELF_MACHINE, 0); if (kernel_size < 0) kernel_size = load_aout(kernel_filename, kernel_base, ram_size - kernel_base, bswap_needed, TARGET_PAGE_SIZE); if (kernel_size < 0) kernel_size = load_image_targphys(kernel_filename, kernel_base, ram_size - kernel_base); if (kernel_size < 0) { hw_error("qemu: could not load kernel '%s'\n", kernel_filename); exit(1); } if (initrd_filename) { initrd_base = round_page(kernel_base + kernel_size + KERNEL_GAP); initrd_size = load_image_targphys(initrd_filename, initrd_base, ram_size - initrd_base); if (initrd_size < 0) { hw_error("qemu: could not load initial ram disk '%s'\n", initrd_filename); exit(1); } cmdline_base = round_page(initrd_base + initrd_size); } else { initrd_base = 0; initrd_size = 0; cmdline_base = round_page(kernel_base + kernel_size + KERNEL_GAP); } ppc_boot_device = 'm'; } else { kernel_base = 0; kernel_size = 0; initrd_base = 0; initrd_size = 0; ppc_boot_device = '\0'; for (i = 0; boot_device[i] != '\0'; i++) { if (boot_device[i] >= 'c' && boot_device[i] <= 'f') { ppc_boot_device = boot_device[i]; break; } } if (ppc_boot_device == '\0') { fprintf(stderr, "No valid boot device for Mac99 machine\n"); exit(1); } } memory_region_init_alias(isa, NULL, "isa_mmio", get_system_io(), 0, 0x00800000); memory_region_add_subregion(get_system_memory(), 0xf2000000, isa); memory_region_init_io(unin_memory, NULL, &unin_ops, token, "unin", 0x1000); memory_region_add_subregion(get_system_memory(), 0xf8000000, unin_memory); memory_region_init_io(unin2_memory, NULL, &unin_ops, token, "unin", 0x1000); memory_region_add_subregion(get_system_memory(), 0xf3000000, unin2_memory); openpic_irqs = g_malloc0(smp_cpus * sizeof(qemu_irq *)); openpic_irqs[0] = g_malloc0(smp_cpus * sizeof(qemu_irq) * OPENPIC_OUTPUT_NB); for (i = 0; i < smp_cpus; i++) { switch (PPC_INPUT(env)) { case PPC_FLAGS_INPUT_6xx: openpic_irqs[i] = openpic_irqs[0] + (i * OPENPIC_OUTPUT_NB); openpic_irqs[i][OPENPIC_OUTPUT_INT] = ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_INT]; openpic_irqs[i][OPENPIC_OUTPUT_CINT] = ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_INT]; openpic_irqs[i][OPENPIC_OUTPUT_MCK] = ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_MCP]; openpic_irqs[i][OPENPIC_OUTPUT_DEBUG] = NULL; openpic_irqs[i][OPENPIC_OUTPUT_RESET] = ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_HRESET]; break; #if defined(TARGET_PPC64) case PPC_FLAGS_INPUT_970: openpic_irqs[i] = openpic_irqs[0] + (i * OPENPIC_OUTPUT_NB); openpic_irqs[i][OPENPIC_OUTPUT_INT] = ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_INT]; openpic_irqs[i][OPENPIC_OUTPUT_CINT] = ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_INT]; openpic_irqs[i][OPENPIC_OUTPUT_MCK] = ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_MCP]; openpic_irqs[i][OPENPIC_OUTPUT_DEBUG] = NULL; openpic_irqs[i][OPENPIC_OUTPUT_RESET] = ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_HRESET]; break; #endif default: hw_error("Bus model not supported on mac99 machine\n"); exit(1); } } pic = g_new0(qemu_irq, 64); dev = qdev_create(NULL, TYPE_OPENPIC); qdev_prop_set_uint32(dev, "model", OPENPIC_MODEL_RAVEN); qdev_init_nofail(dev); s = SYS_BUS_DEVICE(dev); pic_mem = s->mmio[0].memory; k = 0; for (i = 0; i < smp_cpus; i++) { for (j = 0; j < OPENPIC_OUTPUT_NB; j++) { sysbus_connect_irq(s, k++, openpic_irqs[i][j]); } } for (i = 0; i < 64; i++) { pic[i] = qdev_get_gpio_in(dev, i); } if (PPC_INPUT(env) == PPC_FLAGS_INPUT_970) { pci_bus = pci_pmac_u3_init(pic, get_system_memory(), get_system_io()); machine_arch = ARCH_MAC99_U3; machine->usb |= defaults_enabled(); } else { pci_bus = pci_pmac_init(pic, get_system_memory(), get_system_io()); machine_arch = ARCH_MAC99; } if (kvm_enabled()) { tbfreq = kvmppc_get_tbfreq(); } else { tbfreq = TBFREQ; } escc_mem = escc_init(0, pic[0x25], pic[0x24], serial_hds[0], serial_hds[1], ESCC_CLOCK, 4); memory_region_init_alias(escc_bar, NULL, "escc-bar", escc_mem, 0, memory_region_size(escc_mem)); macio = pci_create(pci_bus, -1, TYPE_NEWWORLD_MACIO); dev = DEVICE(macio); qdev_connect_gpio_out(dev, 0, pic[0x19]); qdev_connect_gpio_out(dev, 1, pic[0x0d]); qdev_connect_gpio_out(dev, 2, pic[0x02]); qdev_connect_gpio_out(dev, 3, pic[0x0e]); qdev_connect_gpio_out(dev, 4, pic[0x03]); qdev_prop_set_uint64(dev, "frequency", tbfreq); macio_init(macio, pic_mem, escc_bar); ide_drive_get(hd, ARRAY_SIZE(hd)); macio_ide = MACIO_IDE(object_resolve_path_component(OBJECT(macio), "ide[0]")); macio_ide_init_drives(macio_ide, hd); macio_ide = MACIO_IDE(object_resolve_path_component(OBJECT(macio), "ide[1]")); macio_ide_init_drives(macio_ide, &hd[MAX_IDE_DEVS]); dev = DEVICE(object_resolve_path_component(OBJECT(macio), "cuda")); adb_bus = qdev_get_child_bus(dev, "adb.0"); dev = qdev_create(adb_bus, TYPE_ADB_KEYBOARD); qdev_init_nofail(dev); dev = qdev_create(adb_bus, TYPE_ADB_MOUSE); qdev_init_nofail(dev); if (machine->usb) { pci_create_simple(pci_bus, -1, "pci-ohci"); if (machine_arch == ARCH_MAC99_U3) { USBBus *usb_bus = usb_bus_find(-1); usb_create_simple(usb_bus, "usb-kbd"); usb_create_simple(usb_bus, "usb-mouse"); } } pci_vga_init(pci_bus); if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8) { graphic_depth = 15; } for (i = 0; i < nb_nics; i++) { pci_nic_init_nofail(&nd_table[i], pci_bus, "ne2k_pci", NULL); } #ifdef CONFIG_KVM if (kvm_enabled() && getpagesize() > 4096) { nvram_addr = 0xFFE00000; } #endif dev = qdev_create(NULL, TYPE_MACIO_NVRAM); qdev_prop_set_uint32(dev, "size", 0x2000); qdev_prop_set_uint32(dev, "it_shift", 1); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, nvram_addr); nvr = MACIO_NVRAM(dev); pmac_format_nvram_partition(nvr, 0x2000); fw_cfg = fw_cfg_init_mem(CFG_ADDR, CFG_ADDR + 2); fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)max_cpus); fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1); fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, machine_arch); fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, kernel_base); fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_SIZE, kernel_size); if (kernel_cmdline) { fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, cmdline_base); pstrcpy_targphys("cmdline", cmdline_base, TARGET_PAGE_SIZE, kernel_cmdline); } else { fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, 0); } fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_ADDR, initrd_base); fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size); fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, ppc_boot_device); fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, graphic_width); fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height); fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth); fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_IS_KVM, kvm_enabled()); if (kvm_enabled()) { #ifdef CONFIG_KVM uint8_t *hypercall; hypercall = g_malloc(16); kvmppc_get_hypercall(env, hypercall, 16); fw_cfg_add_bytes(fw_cfg, FW_CFG_PPC_KVM_HC, hypercall, 16); fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_KVM_PID, getpid()); #endif } fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_TBFREQ, tbfreq); fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_CLOCKFREQ, CLOCKFREQ); fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_BUSFREQ, BUSFREQ); fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_NVRAM_ADDR, nvram_addr); qemu_register_boot_set(fw_cfg_boot_set, fw_cfg); }
{ "code": [], "line_no": [] }
static void FUNC_0(MachineState *VAR_0) { ram_addr_t ram_size = VAR_0->ram_size; const char *VAR_1 = VAR_0->VAR_1; const char *VAR_2 = VAR_0->VAR_2; const char *VAR_3 = VAR_0->VAR_3; const char *VAR_4 = VAR_0->VAR_4; const char *VAR_5 = VAR_0->boot_order; PowerPCCPU *cpu = NULL; CPUPPCState *env = NULL; char *VAR_6; qemu_irq *pic, **openpic_irqs; MemoryRegion *isa = g_new(MemoryRegion, 1); MemoryRegion *unin_memory = g_new(MemoryRegion, 1); MemoryRegion *unin2_memory = g_new(MemoryRegion, 1); int VAR_7, VAR_8, VAR_9, VAR_10; MemoryRegion *ram = g_new(MemoryRegion, 1), *bios = g_new(MemoryRegion, 1); hwaddr kernel_base, initrd_base, cmdline_base = 0; long VAR_11, VAR_12; PCIBus *pci_bus; PCIDevice *macio; MACIOIDEState *macio_ide; BusState *adb_bus; MacIONVRAMState *nvr; int VAR_13; MemoryRegion *pic_mem, *escc_mem; MemoryRegion *escc_bar = g_new(MemoryRegion, 1); int VAR_14; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; void *VAR_15; int VAR_16; SysBusDevice *s; DeviceState *dev; int *VAR_17 = g_new(int, 1); hwaddr nvram_addr = 0xFFF04000; uint64_t tbfreq; VAR_7 = (VAR_2 != NULL); if (VAR_1 == NULL) #ifdef TARGET_PPC64 VAR_1 = "970fx"; #else VAR_1 = "G4"; #endif for (VAR_8 = 0; VAR_8 < smp_cpus; VAR_8++) { cpu = cpu_ppc_init(VAR_1); if (cpu == NULL) { fprintf(stderr, "Unable to find PowerPC CPU definition\n"); exit(1); } env = &cpu->env; cpu_ppc_tb_init(env, TBFREQ); qemu_register_reset(ppc_core99_reset, cpu); } memory_region_allocate_system_memory(ram, NULL, "ppc_core99.ram", ram_size); memory_region_add_subregion(get_system_memory(), 0, ram); memory_region_init_ram(bios, NULL, "ppc_core99.bios", BIOS_SIZE, &error_abort); vmstate_register_ram_global(bios); if (bios_name == NULL) bios_name = PROM_FILENAME; VAR_6 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); memory_region_set_readonly(bios, true); memory_region_add_subregion(get_system_memory(), PROM_ADDR, bios); if (VAR_6) { VAR_13 = load_elf(VAR_6, NULL, NULL, NULL, NULL, NULL, 1, ELF_MACHINE, 0); g_free(VAR_6); } else { VAR_13 = -1; } if (VAR_13 < 0 || VAR_13 > BIOS_SIZE) { hw_error("qemu: could not load PowerPC bios '%s'\n", bios_name); exit(1); } if (VAR_7) { uint64_t lowaddr = 0; int VAR_18; #ifdef BSWAP_NEEDED VAR_18 = 1; #else VAR_18 = 0; #endif kernel_base = KERNEL_LOAD_ADDR; VAR_11 = load_elf(VAR_2, translate_kernel_address, NULL, NULL, &lowaddr, NULL, 1, ELF_MACHINE, 0); if (VAR_11 < 0) VAR_11 = load_aout(VAR_2, kernel_base, ram_size - kernel_base, VAR_18, TARGET_PAGE_SIZE); if (VAR_11 < 0) VAR_11 = load_image_targphys(VAR_2, kernel_base, ram_size - kernel_base); if (VAR_11 < 0) { hw_error("qemu: could not load kernel '%s'\n", VAR_2); exit(1); } if (VAR_4) { initrd_base = round_page(kernel_base + VAR_11 + KERNEL_GAP); VAR_12 = load_image_targphys(VAR_4, initrd_base, ram_size - initrd_base); if (VAR_12 < 0) { hw_error("qemu: could not load initial ram disk '%s'\n", VAR_4); exit(1); } cmdline_base = round_page(initrd_base + VAR_12); } else { initrd_base = 0; VAR_12 = 0; cmdline_base = round_page(kernel_base + VAR_11 + KERNEL_GAP); } VAR_14 = 'm'; } else { kernel_base = 0; VAR_11 = 0; initrd_base = 0; VAR_12 = 0; VAR_14 = '\0'; for (VAR_8 = 0; VAR_5[VAR_8] != '\0'; VAR_8++) { if (VAR_5[VAR_8] >= 'c' && VAR_5[VAR_8] <= 'f') { VAR_14 = VAR_5[VAR_8]; break; } } if (VAR_14 == '\0') { fprintf(stderr, "No valid boot device for Mac99 VAR_0\n"); exit(1); } } memory_region_init_alias(isa, NULL, "isa_mmio", get_system_io(), 0, 0x00800000); memory_region_add_subregion(get_system_memory(), 0xf2000000, isa); memory_region_init_io(unin_memory, NULL, &unin_ops, VAR_17, "unin", 0x1000); memory_region_add_subregion(get_system_memory(), 0xf8000000, unin_memory); memory_region_init_io(unin2_memory, NULL, &unin_ops, VAR_17, "unin", 0x1000); memory_region_add_subregion(get_system_memory(), 0xf3000000, unin2_memory); openpic_irqs = g_malloc0(smp_cpus * sizeof(qemu_irq *)); openpic_irqs[0] = g_malloc0(smp_cpus * sizeof(qemu_irq) * OPENPIC_OUTPUT_NB); for (VAR_8 = 0; VAR_8 < smp_cpus; VAR_8++) { switch (PPC_INPUT(env)) { case PPC_FLAGS_INPUT_6xx: openpic_irqs[VAR_8] = openpic_irqs[0] + (VAR_8 * OPENPIC_OUTPUT_NB); openpic_irqs[VAR_8][OPENPIC_OUTPUT_INT] = ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_INT]; openpic_irqs[VAR_8][OPENPIC_OUTPUT_CINT] = ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_INT]; openpic_irqs[VAR_8][OPENPIC_OUTPUT_MCK] = ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_MCP]; openpic_irqs[VAR_8][OPENPIC_OUTPUT_DEBUG] = NULL; openpic_irqs[VAR_8][OPENPIC_OUTPUT_RESET] = ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_HRESET]; break; #if defined(TARGET_PPC64) case PPC_FLAGS_INPUT_970: openpic_irqs[VAR_8] = openpic_irqs[0] + (VAR_8 * OPENPIC_OUTPUT_NB); openpic_irqs[VAR_8][OPENPIC_OUTPUT_INT] = ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_INT]; openpic_irqs[VAR_8][OPENPIC_OUTPUT_CINT] = ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_INT]; openpic_irqs[VAR_8][OPENPIC_OUTPUT_MCK] = ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_MCP]; openpic_irqs[VAR_8][OPENPIC_OUTPUT_DEBUG] = NULL; openpic_irqs[VAR_8][OPENPIC_OUTPUT_RESET] = ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_HRESET]; break; #endif default: hw_error("Bus model not supported on mac99 VAR_0\n"); exit(1); } } pic = g_new0(qemu_irq, 64); dev = qdev_create(NULL, TYPE_OPENPIC); qdev_prop_set_uint32(dev, "model", OPENPIC_MODEL_RAVEN); qdev_init_nofail(dev); s = SYS_BUS_DEVICE(dev); pic_mem = s->mmio[0].memory; VAR_10 = 0; for (VAR_8 = 0; VAR_8 < smp_cpus; VAR_8++) { for (VAR_9 = 0; VAR_9 < OPENPIC_OUTPUT_NB; VAR_9++) { sysbus_connect_irq(s, VAR_10++, openpic_irqs[VAR_8][VAR_9]); } } for (VAR_8 = 0; VAR_8 < 64; VAR_8++) { pic[VAR_8] = qdev_get_gpio_in(dev, VAR_8); } if (PPC_INPUT(env) == PPC_FLAGS_INPUT_970) { pci_bus = pci_pmac_u3_init(pic, get_system_memory(), get_system_io()); VAR_16 = ARCH_MAC99_U3; VAR_0->usb |= defaults_enabled(); } else { pci_bus = pci_pmac_init(pic, get_system_memory(), get_system_io()); VAR_16 = ARCH_MAC99; } if (kvm_enabled()) { tbfreq = kvmppc_get_tbfreq(); } else { tbfreq = TBFREQ; } escc_mem = escc_init(0, pic[0x25], pic[0x24], serial_hds[0], serial_hds[1], ESCC_CLOCK, 4); memory_region_init_alias(escc_bar, NULL, "escc-bar", escc_mem, 0, memory_region_size(escc_mem)); macio = pci_create(pci_bus, -1, TYPE_NEWWORLD_MACIO); dev = DEVICE(macio); qdev_connect_gpio_out(dev, 0, pic[0x19]); qdev_connect_gpio_out(dev, 1, pic[0x0d]); qdev_connect_gpio_out(dev, 2, pic[0x02]); qdev_connect_gpio_out(dev, 3, pic[0x0e]); qdev_connect_gpio_out(dev, 4, pic[0x03]); qdev_prop_set_uint64(dev, "frequency", tbfreq); macio_init(macio, pic_mem, escc_bar); ide_drive_get(hd, ARRAY_SIZE(hd)); macio_ide = MACIO_IDE(object_resolve_path_component(OBJECT(macio), "ide[0]")); macio_ide_init_drives(macio_ide, hd); macio_ide = MACIO_IDE(object_resolve_path_component(OBJECT(macio), "ide[1]")); macio_ide_init_drives(macio_ide, &hd[MAX_IDE_DEVS]); dev = DEVICE(object_resolve_path_component(OBJECT(macio), "cuda")); adb_bus = qdev_get_child_bus(dev, "adb.0"); dev = qdev_create(adb_bus, TYPE_ADB_KEYBOARD); qdev_init_nofail(dev); dev = qdev_create(adb_bus, TYPE_ADB_MOUSE); qdev_init_nofail(dev); if (VAR_0->usb) { pci_create_simple(pci_bus, -1, "pci-ohci"); if (VAR_16 == ARCH_MAC99_U3) { USBBus *usb_bus = usb_bus_find(-1); usb_create_simple(usb_bus, "usb-kbd"); usb_create_simple(usb_bus, "usb-mouse"); } } pci_vga_init(pci_bus); if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8) { graphic_depth = 15; } for (VAR_8 = 0; VAR_8 < nb_nics; VAR_8++) { pci_nic_init_nofail(&nd_table[VAR_8], pci_bus, "ne2k_pci", NULL); } #ifdef CONFIG_KVM if (kvm_enabled() && getpagesize() > 4096) { nvram_addr = 0xFFE00000; } #endif dev = qdev_create(NULL, TYPE_MACIO_NVRAM); qdev_prop_set_uint32(dev, "size", 0x2000); qdev_prop_set_uint32(dev, "it_shift", 1); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, nvram_addr); nvr = MACIO_NVRAM(dev); pmac_format_nvram_partition(nvr, 0x2000); VAR_15 = fw_cfg_init_mem(CFG_ADDR, CFG_ADDR + 2); fw_cfg_add_i16(VAR_15, FW_CFG_MAX_CPUS, (uint16_t)max_cpus); fw_cfg_add_i32(VAR_15, FW_CFG_ID, 1); fw_cfg_add_i64(VAR_15, FW_CFG_RAM_SIZE, (uint64_t)ram_size); fw_cfg_add_i16(VAR_15, FW_CFG_MACHINE_ID, VAR_16); fw_cfg_add_i32(VAR_15, FW_CFG_KERNEL_ADDR, kernel_base); fw_cfg_add_i32(VAR_15, FW_CFG_KERNEL_SIZE, VAR_11); if (VAR_3) { fw_cfg_add_i32(VAR_15, FW_CFG_KERNEL_CMDLINE, cmdline_base); pstrcpy_targphys("cmdline", cmdline_base, TARGET_PAGE_SIZE, VAR_3); } else { fw_cfg_add_i32(VAR_15, FW_CFG_KERNEL_CMDLINE, 0); } fw_cfg_add_i32(VAR_15, FW_CFG_INITRD_ADDR, initrd_base); fw_cfg_add_i32(VAR_15, FW_CFG_INITRD_SIZE, VAR_12); fw_cfg_add_i16(VAR_15, FW_CFG_BOOT_DEVICE, VAR_14); fw_cfg_add_i16(VAR_15, FW_CFG_PPC_WIDTH, graphic_width); fw_cfg_add_i16(VAR_15, FW_CFG_PPC_HEIGHT, graphic_height); fw_cfg_add_i16(VAR_15, FW_CFG_PPC_DEPTH, graphic_depth); fw_cfg_add_i32(VAR_15, FW_CFG_PPC_IS_KVM, kvm_enabled()); if (kvm_enabled()) { #ifdef CONFIG_KVM uint8_t *hypercall; hypercall = g_malloc(16); kvmppc_get_hypercall(env, hypercall, 16); fw_cfg_add_bytes(VAR_15, FW_CFG_PPC_KVM_HC, hypercall, 16); fw_cfg_add_i32(VAR_15, FW_CFG_PPC_KVM_PID, getpid()); #endif } fw_cfg_add_i32(VAR_15, FW_CFG_PPC_TBFREQ, tbfreq); fw_cfg_add_i32(VAR_15, FW_CFG_PPC_CLOCKFREQ, CLOCKFREQ); fw_cfg_add_i32(VAR_15, FW_CFG_PPC_BUSFREQ, BUSFREQ); fw_cfg_add_i32(VAR_15, FW_CFG_PPC_NVRAM_ADDR, nvram_addr); qemu_register_boot_set(fw_cfg_boot_set, VAR_15); }
[ "static void FUNC_0(MachineState *VAR_0)\n{", "ram_addr_t ram_size = VAR_0->ram_size;", "const char *VAR_1 = VAR_0->VAR_1;", "const char *VAR_2 = VAR_0->VAR_2;", "const char *VAR_3 = VAR_0->VAR_3;", "const char *VAR_4 = VAR_0->VAR_4;", "const char *VAR_5 = VAR_0->boot_order;", "PowerPCCPU *cpu = NULL;", "CPUPPCState *env = NULL;", "char *VAR_6;", "qemu_irq *pic, **openpic_irqs;", "MemoryRegion *isa = g_new(MemoryRegion, 1);", "MemoryRegion *unin_memory = g_new(MemoryRegion, 1);", "MemoryRegion *unin2_memory = g_new(MemoryRegion, 1);", "int VAR_7, VAR_8, VAR_9, VAR_10;", "MemoryRegion *ram = g_new(MemoryRegion, 1), *bios = g_new(MemoryRegion, 1);", "hwaddr kernel_base, initrd_base, cmdline_base = 0;", "long VAR_11, VAR_12;", "PCIBus *pci_bus;", "PCIDevice *macio;", "MACIOIDEState *macio_ide;", "BusState *adb_bus;", "MacIONVRAMState *nvr;", "int VAR_13;", "MemoryRegion *pic_mem, *escc_mem;", "MemoryRegion *escc_bar = g_new(MemoryRegion, 1);", "int VAR_14;", "DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];", "void *VAR_15;", "int VAR_16;", "SysBusDevice *s;", "DeviceState *dev;", "int *VAR_17 = g_new(int, 1);", "hwaddr nvram_addr = 0xFFF04000;", "uint64_t tbfreq;", "VAR_7 = (VAR_2 != NULL);", "if (VAR_1 == NULL)\n#ifdef TARGET_PPC64\nVAR_1 = \"970fx\";", "#else\nVAR_1 = \"G4\";", "#endif\nfor (VAR_8 = 0; VAR_8 < smp_cpus; VAR_8++) {", "cpu = cpu_ppc_init(VAR_1);", "if (cpu == NULL) {", "fprintf(stderr, \"Unable to find PowerPC CPU definition\\n\");", "exit(1);", "}", "env = &cpu->env;", "cpu_ppc_tb_init(env, TBFREQ);", "qemu_register_reset(ppc_core99_reset, cpu);", "}", "memory_region_allocate_system_memory(ram, NULL, \"ppc_core99.ram\", ram_size);", "memory_region_add_subregion(get_system_memory(), 0, ram);", "memory_region_init_ram(bios, NULL, \"ppc_core99.bios\", BIOS_SIZE,\n&error_abort);", "vmstate_register_ram_global(bios);", "if (bios_name == NULL)\nbios_name = PROM_FILENAME;", "VAR_6 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);", "memory_region_set_readonly(bios, true);", "memory_region_add_subregion(get_system_memory(), PROM_ADDR, bios);", "if (VAR_6) {", "VAR_13 = load_elf(VAR_6, NULL, NULL, NULL,\nNULL, NULL, 1, ELF_MACHINE, 0);", "g_free(VAR_6);", "} else {", "VAR_13 = -1;", "}", "if (VAR_13 < 0 || VAR_13 > BIOS_SIZE) {", "hw_error(\"qemu: could not load PowerPC bios '%s'\\n\", bios_name);", "exit(1);", "}", "if (VAR_7) {", "uint64_t lowaddr = 0;", "int VAR_18;", "#ifdef BSWAP_NEEDED\nVAR_18 = 1;", "#else\nVAR_18 = 0;", "#endif\nkernel_base = KERNEL_LOAD_ADDR;", "VAR_11 = load_elf(VAR_2, translate_kernel_address, NULL,\nNULL, &lowaddr, NULL, 1, ELF_MACHINE, 0);", "if (VAR_11 < 0)\nVAR_11 = load_aout(VAR_2, kernel_base,\nram_size - kernel_base, VAR_18,\nTARGET_PAGE_SIZE);", "if (VAR_11 < 0)\nVAR_11 = load_image_targphys(VAR_2,\nkernel_base,\nram_size - kernel_base);", "if (VAR_11 < 0) {", "hw_error(\"qemu: could not load kernel '%s'\\n\", VAR_2);", "exit(1);", "}", "if (VAR_4) {", "initrd_base = round_page(kernel_base + VAR_11 + KERNEL_GAP);", "VAR_12 = load_image_targphys(VAR_4, initrd_base,\nram_size - initrd_base);", "if (VAR_12 < 0) {", "hw_error(\"qemu: could not load initial ram disk '%s'\\n\",\nVAR_4);", "exit(1);", "}", "cmdline_base = round_page(initrd_base + VAR_12);", "} else {", "initrd_base = 0;", "VAR_12 = 0;", "cmdline_base = round_page(kernel_base + VAR_11 + KERNEL_GAP);", "}", "VAR_14 = 'm';", "} else {", "kernel_base = 0;", "VAR_11 = 0;", "initrd_base = 0;", "VAR_12 = 0;", "VAR_14 = '\\0';", "for (VAR_8 = 0; VAR_5[VAR_8] != '\\0'; VAR_8++) {", "if (VAR_5[VAR_8] >= 'c' && VAR_5[VAR_8] <= 'f') {", "VAR_14 = VAR_5[VAR_8];", "break;", "}", "}", "if (VAR_14 == '\\0') {", "fprintf(stderr, \"No valid boot device for Mac99 VAR_0\\n\");", "exit(1);", "}", "}", "memory_region_init_alias(isa, NULL, \"isa_mmio\",\nget_system_io(), 0, 0x00800000);", "memory_region_add_subregion(get_system_memory(), 0xf2000000, isa);", "memory_region_init_io(unin_memory, NULL, &unin_ops, VAR_17, \"unin\", 0x1000);", "memory_region_add_subregion(get_system_memory(), 0xf8000000, unin_memory);", "memory_region_init_io(unin2_memory, NULL, &unin_ops, VAR_17, \"unin\", 0x1000);", "memory_region_add_subregion(get_system_memory(), 0xf3000000, unin2_memory);", "openpic_irqs = g_malloc0(smp_cpus * sizeof(qemu_irq *));", "openpic_irqs[0] =\ng_malloc0(smp_cpus * sizeof(qemu_irq) * OPENPIC_OUTPUT_NB);", "for (VAR_8 = 0; VAR_8 < smp_cpus; VAR_8++) {", "switch (PPC_INPUT(env)) {", "case PPC_FLAGS_INPUT_6xx:\nopenpic_irqs[VAR_8] = openpic_irqs[0] + (VAR_8 * OPENPIC_OUTPUT_NB);", "openpic_irqs[VAR_8][OPENPIC_OUTPUT_INT] =\n((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_INT];", "openpic_irqs[VAR_8][OPENPIC_OUTPUT_CINT] =\n((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_INT];", "openpic_irqs[VAR_8][OPENPIC_OUTPUT_MCK] =\n((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_MCP];", "openpic_irqs[VAR_8][OPENPIC_OUTPUT_DEBUG] = NULL;", "openpic_irqs[VAR_8][OPENPIC_OUTPUT_RESET] =\n((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_HRESET];", "break;", "#if defined(TARGET_PPC64)\ncase PPC_FLAGS_INPUT_970:\nopenpic_irqs[VAR_8] = openpic_irqs[0] + (VAR_8 * OPENPIC_OUTPUT_NB);", "openpic_irqs[VAR_8][OPENPIC_OUTPUT_INT] =\n((qemu_irq *)env->irq_inputs)[PPC970_INPUT_INT];", "openpic_irqs[VAR_8][OPENPIC_OUTPUT_CINT] =\n((qemu_irq *)env->irq_inputs)[PPC970_INPUT_INT];", "openpic_irqs[VAR_8][OPENPIC_OUTPUT_MCK] =\n((qemu_irq *)env->irq_inputs)[PPC970_INPUT_MCP];", "openpic_irqs[VAR_8][OPENPIC_OUTPUT_DEBUG] = NULL;", "openpic_irqs[VAR_8][OPENPIC_OUTPUT_RESET] =\n((qemu_irq *)env->irq_inputs)[PPC970_INPUT_HRESET];", "break;", "#endif\ndefault:\nhw_error(\"Bus model not supported on mac99 VAR_0\\n\");", "exit(1);", "}", "}", "pic = g_new0(qemu_irq, 64);", "dev = qdev_create(NULL, TYPE_OPENPIC);", "qdev_prop_set_uint32(dev, \"model\", OPENPIC_MODEL_RAVEN);", "qdev_init_nofail(dev);", "s = SYS_BUS_DEVICE(dev);", "pic_mem = s->mmio[0].memory;", "VAR_10 = 0;", "for (VAR_8 = 0; VAR_8 < smp_cpus; VAR_8++) {", "for (VAR_9 = 0; VAR_9 < OPENPIC_OUTPUT_NB; VAR_9++) {", "sysbus_connect_irq(s, VAR_10++, openpic_irqs[VAR_8][VAR_9]);", "}", "}", "for (VAR_8 = 0; VAR_8 < 64; VAR_8++) {", "pic[VAR_8] = qdev_get_gpio_in(dev, VAR_8);", "}", "if (PPC_INPUT(env) == PPC_FLAGS_INPUT_970) {", "pci_bus = pci_pmac_u3_init(pic, get_system_memory(), get_system_io());", "VAR_16 = ARCH_MAC99_U3;", "VAR_0->usb |= defaults_enabled();", "} else {", "pci_bus = pci_pmac_init(pic, get_system_memory(), get_system_io());", "VAR_16 = ARCH_MAC99;", "}", "if (kvm_enabled()) {", "tbfreq = kvmppc_get_tbfreq();", "} else {", "tbfreq = TBFREQ;", "}", "escc_mem = escc_init(0, pic[0x25], pic[0x24],\nserial_hds[0], serial_hds[1], ESCC_CLOCK, 4);", "memory_region_init_alias(escc_bar, NULL, \"escc-bar\",\nescc_mem, 0, memory_region_size(escc_mem));", "macio = pci_create(pci_bus, -1, TYPE_NEWWORLD_MACIO);", "dev = DEVICE(macio);", "qdev_connect_gpio_out(dev, 0, pic[0x19]);", "qdev_connect_gpio_out(dev, 1, pic[0x0d]);", "qdev_connect_gpio_out(dev, 2, pic[0x02]);", "qdev_connect_gpio_out(dev, 3, pic[0x0e]);", "qdev_connect_gpio_out(dev, 4, pic[0x03]);", "qdev_prop_set_uint64(dev, \"frequency\", tbfreq);", "macio_init(macio, pic_mem, escc_bar);", "ide_drive_get(hd, ARRAY_SIZE(hd));", "macio_ide = MACIO_IDE(object_resolve_path_component(OBJECT(macio),\n\"ide[0]\"));", "macio_ide_init_drives(macio_ide, hd);", "macio_ide = MACIO_IDE(object_resolve_path_component(OBJECT(macio),\n\"ide[1]\"));", "macio_ide_init_drives(macio_ide, &hd[MAX_IDE_DEVS]);", "dev = DEVICE(object_resolve_path_component(OBJECT(macio), \"cuda\"));", "adb_bus = qdev_get_child_bus(dev, \"adb.0\");", "dev = qdev_create(adb_bus, TYPE_ADB_KEYBOARD);", "qdev_init_nofail(dev);", "dev = qdev_create(adb_bus, TYPE_ADB_MOUSE);", "qdev_init_nofail(dev);", "if (VAR_0->usb) {", "pci_create_simple(pci_bus, -1, \"pci-ohci\");", "if (VAR_16 == ARCH_MAC99_U3) {", "USBBus *usb_bus = usb_bus_find(-1);", "usb_create_simple(usb_bus, \"usb-kbd\");", "usb_create_simple(usb_bus, \"usb-mouse\");", "}", "}", "pci_vga_init(pci_bus);", "if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8) {", "graphic_depth = 15;", "}", "for (VAR_8 = 0; VAR_8 < nb_nics; VAR_8++) {", "pci_nic_init_nofail(&nd_table[VAR_8], pci_bus, \"ne2k_pci\", NULL);", "}", "#ifdef CONFIG_KVM\nif (kvm_enabled() && getpagesize() > 4096) {", "nvram_addr = 0xFFE00000;", "}", "#endif\ndev = qdev_create(NULL, TYPE_MACIO_NVRAM);", "qdev_prop_set_uint32(dev, \"size\", 0x2000);", "qdev_prop_set_uint32(dev, \"it_shift\", 1);", "qdev_init_nofail(dev);", "sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, nvram_addr);", "nvr = MACIO_NVRAM(dev);", "pmac_format_nvram_partition(nvr, 0x2000);", "VAR_15 = fw_cfg_init_mem(CFG_ADDR, CFG_ADDR + 2);", "fw_cfg_add_i16(VAR_15, FW_CFG_MAX_CPUS, (uint16_t)max_cpus);", "fw_cfg_add_i32(VAR_15, FW_CFG_ID, 1);", "fw_cfg_add_i64(VAR_15, FW_CFG_RAM_SIZE, (uint64_t)ram_size);", "fw_cfg_add_i16(VAR_15, FW_CFG_MACHINE_ID, VAR_16);", "fw_cfg_add_i32(VAR_15, FW_CFG_KERNEL_ADDR, kernel_base);", "fw_cfg_add_i32(VAR_15, FW_CFG_KERNEL_SIZE, VAR_11);", "if (VAR_3) {", "fw_cfg_add_i32(VAR_15, FW_CFG_KERNEL_CMDLINE, cmdline_base);", "pstrcpy_targphys(\"cmdline\", cmdline_base, TARGET_PAGE_SIZE, VAR_3);", "} else {", "fw_cfg_add_i32(VAR_15, FW_CFG_KERNEL_CMDLINE, 0);", "}", "fw_cfg_add_i32(VAR_15, FW_CFG_INITRD_ADDR, initrd_base);", "fw_cfg_add_i32(VAR_15, FW_CFG_INITRD_SIZE, VAR_12);", "fw_cfg_add_i16(VAR_15, FW_CFG_BOOT_DEVICE, VAR_14);", "fw_cfg_add_i16(VAR_15, FW_CFG_PPC_WIDTH, graphic_width);", "fw_cfg_add_i16(VAR_15, FW_CFG_PPC_HEIGHT, graphic_height);", "fw_cfg_add_i16(VAR_15, FW_CFG_PPC_DEPTH, graphic_depth);", "fw_cfg_add_i32(VAR_15, FW_CFG_PPC_IS_KVM, kvm_enabled());", "if (kvm_enabled()) {", "#ifdef CONFIG_KVM\nuint8_t *hypercall;", "hypercall = g_malloc(16);", "kvmppc_get_hypercall(env, hypercall, 16);", "fw_cfg_add_bytes(VAR_15, FW_CFG_PPC_KVM_HC, hypercall, 16);", "fw_cfg_add_i32(VAR_15, FW_CFG_PPC_KVM_PID, getpid());", "#endif\n}", "fw_cfg_add_i32(VAR_15, FW_CFG_PPC_TBFREQ, tbfreq);", "fw_cfg_add_i32(VAR_15, FW_CFG_PPC_CLOCKFREQ, CLOCKFREQ);", "fw_cfg_add_i32(VAR_15, FW_CFG_PPC_BUSFREQ, BUSFREQ);", "fw_cfg_add_i32(VAR_15, FW_CFG_PPC_NVRAM_ADDR, nvram_addr);", "qemu_register_boot_set(fw_cfg_boot_set, VAR_15);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 81, 83, 85 ], [ 87, 89 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 111 ], [ 113 ], [ 115 ], [ 121 ], [ 123 ], [ 129, 131 ], [ 133 ], [ 137, 139 ], [ 141 ], [ 143 ], [ 145 ], [ 151 ], [ 153, 155 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 177 ], [ 179 ], [ 181 ], [ 185, 187 ], [ 189, 191 ], [ 193, 195 ], [ 199, 201 ], [ 203, 205, 207, 209 ], [ 211, 213, 215, 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 229 ], [ 231 ], [ 233, 235 ], [ 237 ], [ 239, 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 305, 307 ], [ 309 ], [ 315 ], [ 317 ], [ 321 ], [ 323 ], [ 327 ], [ 329, 331 ], [ 333 ], [ 341 ], [ 343, 345 ], [ 347, 349 ], [ 351, 353 ], [ 355, 357 ], [ 361 ], [ 365, 367 ], [ 369 ], [ 371, 373, 375 ], [ 377, 379 ], [ 381, 383 ], [ 385, 387 ], [ 391 ], [ 395, 397 ], [ 399 ], [ 401, 403, 405 ], [ 407 ], [ 409 ], [ 411 ], [ 415 ], [ 419 ], [ 421 ], [ 423 ], [ 425 ], [ 427 ], [ 429 ], [ 431 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ], [ 443 ], [ 445 ], [ 447 ], [ 451 ], [ 455 ], [ 457 ], [ 459 ], [ 461 ], [ 463 ], [ 465 ], [ 467 ], [ 473 ], [ 475 ], [ 477 ], [ 479 ], [ 481 ], [ 487, 489 ], [ 491, 493 ], [ 497 ], [ 499 ], [ 501 ], [ 503 ], [ 505 ], [ 507 ], [ 509 ], [ 511 ], [ 513 ], [ 519 ], [ 523, 525 ], [ 527 ], [ 531, 533 ], [ 535 ], [ 539 ], [ 541 ], [ 543 ], [ 545 ], [ 547 ], [ 549 ], [ 553 ], [ 555 ], [ 563 ], [ 565 ], [ 569 ], [ 571 ], [ 573 ], [ 575 ], [ 579 ], [ 583 ], [ 585 ], [ 587 ], [ 591 ], [ 593 ], [ 595 ], [ 601, 603 ], [ 609 ], [ 611 ], [ 613, 615 ], [ 617 ], [ 619 ], [ 621 ], [ 623 ], [ 625 ], [ 627 ], [ 633 ], [ 635 ], [ 637 ], [ 639 ], [ 641 ], [ 643 ], [ 645 ], [ 647 ], [ 649 ], [ 651 ], [ 653 ], [ 655 ], [ 657 ], [ 659 ], [ 661 ], [ 663 ], [ 667 ], [ 669 ], [ 671 ], [ 675 ], [ 677 ], [ 679, 681 ], [ 685 ], [ 687 ], [ 689 ], [ 691 ], [ 693, 695 ], [ 697 ], [ 701 ], [ 703 ], [ 705 ], [ 709 ], [ 711 ] ]
8,399
static CoroutineThreadState *coroutine_get_thread_state(void) { CoroutineThreadState *s = pthread_getspecific(thread_state_key); if (!s) { s = g_malloc0(sizeof(*s)); s->current = &s->leader.base; QLIST_INIT(&s->pool); pthread_setspecific(thread_state_key, s); } return s; }
false
qemu
39a7a362e16bb27e98738d63f24d1ab5811e26a8
static CoroutineThreadState *coroutine_get_thread_state(void) { CoroutineThreadState *s = pthread_getspecific(thread_state_key); if (!s) { s = g_malloc0(sizeof(*s)); s->current = &s->leader.base; QLIST_INIT(&s->pool); pthread_setspecific(thread_state_key, s); } return s; }
{ "code": [], "line_no": [] }
static CoroutineThreadState *FUNC_0(void) { CoroutineThreadState *s = pthread_getspecific(thread_state_key); if (!s) { s = g_malloc0(sizeof(*s)); s->current = &s->leader.base; QLIST_INIT(&s->pool); pthread_setspecific(thread_state_key, s); } return s; }
[ "static CoroutineThreadState *FUNC_0(void)\n{", "CoroutineThreadState *s = pthread_getspecific(thread_state_key);", "if (!s) {", "s = g_malloc0(sizeof(*s));", "s->current = &s->leader.base;", "QLIST_INIT(&s->pool);", "pthread_setspecific(thread_state_key, s);", "}", "return s;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
8,400
void swri_resample_dsp_init(ResampleContext *c) { #define FNIDX(fmt) (AV_SAMPLE_FMT_##fmt - AV_SAMPLE_FMT_S16P) c->dsp.resample_one[FNIDX(S16P)] = (resample_one_fn) resample_one_int16; c->dsp.resample_one[FNIDX(S32P)] = (resample_one_fn) resample_one_int32; c->dsp.resample_one[FNIDX(FLTP)] = (resample_one_fn) resample_one_float; c->dsp.resample_one[FNIDX(DBLP)] = (resample_one_fn) resample_one_double; c->dsp.resample_common[FNIDX(S16P)] = (resample_fn) resample_common_int16; c->dsp.resample_common[FNIDX(S32P)] = (resample_fn) resample_common_int32; c->dsp.resample_common[FNIDX(FLTP)] = (resample_fn) resample_common_float; c->dsp.resample_common[FNIDX(DBLP)] = (resample_fn) resample_common_double; c->dsp.resample_linear[FNIDX(S16P)] = (resample_fn) resample_linear_int16; c->dsp.resample_linear[FNIDX(S32P)] = (resample_fn) resample_linear_int32; c->dsp.resample_linear[FNIDX(FLTP)] = (resample_fn) resample_linear_float; c->dsp.resample_linear[FNIDX(DBLP)] = (resample_fn) resample_linear_double; if (ARCH_X86) swri_resample_dsp_x86_init(c); }
false
FFmpeg
857cd1f33bcf86005529af2a77f861f884327be5
void swri_resample_dsp_init(ResampleContext *c) { #define FNIDX(fmt) (AV_SAMPLE_FMT_##fmt - AV_SAMPLE_FMT_S16P) c->dsp.resample_one[FNIDX(S16P)] = (resample_one_fn) resample_one_int16; c->dsp.resample_one[FNIDX(S32P)] = (resample_one_fn) resample_one_int32; c->dsp.resample_one[FNIDX(FLTP)] = (resample_one_fn) resample_one_float; c->dsp.resample_one[FNIDX(DBLP)] = (resample_one_fn) resample_one_double; c->dsp.resample_common[FNIDX(S16P)] = (resample_fn) resample_common_int16; c->dsp.resample_common[FNIDX(S32P)] = (resample_fn) resample_common_int32; c->dsp.resample_common[FNIDX(FLTP)] = (resample_fn) resample_common_float; c->dsp.resample_common[FNIDX(DBLP)] = (resample_fn) resample_common_double; c->dsp.resample_linear[FNIDX(S16P)] = (resample_fn) resample_linear_int16; c->dsp.resample_linear[FNIDX(S32P)] = (resample_fn) resample_linear_int32; c->dsp.resample_linear[FNIDX(FLTP)] = (resample_fn) resample_linear_float; c->dsp.resample_linear[FNIDX(DBLP)] = (resample_fn) resample_linear_double; if (ARCH_X86) swri_resample_dsp_x86_init(c); }
{ "code": [], "line_no": [] }
void FUNC_0(ResampleContext *VAR_0) { #define FNIDX(fmt) (AV_SAMPLE_FMT_##fmt - AV_SAMPLE_FMT_S16P) VAR_0->dsp.resample_one[FNIDX(S16P)] = (resample_one_fn) resample_one_int16; VAR_0->dsp.resample_one[FNIDX(S32P)] = (resample_one_fn) resample_one_int32; VAR_0->dsp.resample_one[FNIDX(FLTP)] = (resample_one_fn) resample_one_float; VAR_0->dsp.resample_one[FNIDX(DBLP)] = (resample_one_fn) resample_one_double; VAR_0->dsp.resample_common[FNIDX(S16P)] = (resample_fn) resample_common_int16; VAR_0->dsp.resample_common[FNIDX(S32P)] = (resample_fn) resample_common_int32; VAR_0->dsp.resample_common[FNIDX(FLTP)] = (resample_fn) resample_common_float; VAR_0->dsp.resample_common[FNIDX(DBLP)] = (resample_fn) resample_common_double; VAR_0->dsp.resample_linear[FNIDX(S16P)] = (resample_fn) resample_linear_int16; VAR_0->dsp.resample_linear[FNIDX(S32P)] = (resample_fn) resample_linear_int32; VAR_0->dsp.resample_linear[FNIDX(FLTP)] = (resample_fn) resample_linear_float; VAR_0->dsp.resample_linear[FNIDX(DBLP)] = (resample_fn) resample_linear_double; if (ARCH_X86) swri_resample_dsp_x86_init(VAR_0); }
[ "void FUNC_0(ResampleContext *VAR_0)\n{", "#define FNIDX(fmt) (AV_SAMPLE_FMT_##fmt - AV_SAMPLE_FMT_S16P)\nVAR_0->dsp.resample_one[FNIDX(S16P)] = (resample_one_fn) resample_one_int16;", "VAR_0->dsp.resample_one[FNIDX(S32P)] = (resample_one_fn) resample_one_int32;", "VAR_0->dsp.resample_one[FNIDX(FLTP)] = (resample_one_fn) resample_one_float;", "VAR_0->dsp.resample_one[FNIDX(DBLP)] = (resample_one_fn) resample_one_double;", "VAR_0->dsp.resample_common[FNIDX(S16P)] = (resample_fn) resample_common_int16;", "VAR_0->dsp.resample_common[FNIDX(S32P)] = (resample_fn) resample_common_int32;", "VAR_0->dsp.resample_common[FNIDX(FLTP)] = (resample_fn) resample_common_float;", "VAR_0->dsp.resample_common[FNIDX(DBLP)] = (resample_fn) resample_common_double;", "VAR_0->dsp.resample_linear[FNIDX(S16P)] = (resample_fn) resample_linear_int16;", "VAR_0->dsp.resample_linear[FNIDX(S32P)] = (resample_fn) resample_linear_int32;", "VAR_0->dsp.resample_linear[FNIDX(FLTP)] = (resample_fn) resample_linear_float;", "VAR_0->dsp.resample_linear[FNIDX(DBLP)] = (resample_fn) resample_linear_double;", "if (ARCH_X86) swri_resample_dsp_x86_init(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ] ]
8,401
static int qxl_init_primary(PCIDevice *dev) { PCIQXLDevice *qxl = DO_UPCAST(PCIQXLDevice, pci, dev); VGACommonState *vga = &qxl->vga; PortioList *qxl_vga_port_list = g_new(PortioList, 1); DisplayState *ds; int rc; qxl->id = 0; qxl_init_ramsize(qxl); vga->vram_size_mb = qxl->vga.vram_size >> 20; vga_common_init(vga); vga_init(vga, pci_address_space(dev), pci_address_space_io(dev), false); portio_list_init(qxl_vga_port_list, qxl_vga_portio_list, vga, "vga"); portio_list_add(qxl_vga_port_list, pci_address_space_io(dev), 0x3b0); vga->con = graphic_console_init(qxl_hw_update, qxl_hw_invalidate, qxl_hw_screen_dump, qxl_hw_text_update, qxl); qxl->ssd.con = vga->con, qemu_spice_display_init_common(&qxl->ssd); rc = qxl_init_common(qxl); if (rc != 0) { return rc; } qxl->ssd.dcl.ops = &display_listener_ops; ds = qemu_console_displaystate(vga->con); register_displaychangelistener(ds, &qxl->ssd.dcl); return rc; }
false
qemu
2c62f08ddbf3fa80dc7202eb9a2ea60ae44e2cc5
static int qxl_init_primary(PCIDevice *dev) { PCIQXLDevice *qxl = DO_UPCAST(PCIQXLDevice, pci, dev); VGACommonState *vga = &qxl->vga; PortioList *qxl_vga_port_list = g_new(PortioList, 1); DisplayState *ds; int rc; qxl->id = 0; qxl_init_ramsize(qxl); vga->vram_size_mb = qxl->vga.vram_size >> 20; vga_common_init(vga); vga_init(vga, pci_address_space(dev), pci_address_space_io(dev), false); portio_list_init(qxl_vga_port_list, qxl_vga_portio_list, vga, "vga"); portio_list_add(qxl_vga_port_list, pci_address_space_io(dev), 0x3b0); vga->con = graphic_console_init(qxl_hw_update, qxl_hw_invalidate, qxl_hw_screen_dump, qxl_hw_text_update, qxl); qxl->ssd.con = vga->con, qemu_spice_display_init_common(&qxl->ssd); rc = qxl_init_common(qxl); if (rc != 0) { return rc; } qxl->ssd.dcl.ops = &display_listener_ops; ds = qemu_console_displaystate(vga->con); register_displaychangelistener(ds, &qxl->ssd.dcl); return rc; }
{ "code": [], "line_no": [] }
static int FUNC_0(PCIDevice *VAR_0) { PCIQXLDevice *qxl = DO_UPCAST(PCIQXLDevice, pci, VAR_0); VGACommonState *vga = &qxl->vga; PortioList *qxl_vga_port_list = g_new(PortioList, 1); DisplayState *ds; int VAR_1; qxl->id = 0; qxl_init_ramsize(qxl); vga->vram_size_mb = qxl->vga.vram_size >> 20; vga_common_init(vga); vga_init(vga, pci_address_space(VAR_0), pci_address_space_io(VAR_0), false); portio_list_init(qxl_vga_port_list, qxl_vga_portio_list, vga, "vga"); portio_list_add(qxl_vga_port_list, pci_address_space_io(VAR_0), 0x3b0); vga->con = graphic_console_init(qxl_hw_update, qxl_hw_invalidate, qxl_hw_screen_dump, qxl_hw_text_update, qxl); qxl->ssd.con = vga->con, qemu_spice_display_init_common(&qxl->ssd); VAR_1 = qxl_init_common(qxl); if (VAR_1 != 0) { return VAR_1; } qxl->ssd.dcl.ops = &display_listener_ops; ds = qemu_console_displaystate(vga->con); register_displaychangelistener(ds, &qxl->ssd.dcl); return VAR_1; }
[ "static int FUNC_0(PCIDevice *VAR_0)\n{", "PCIQXLDevice *qxl = DO_UPCAST(PCIQXLDevice, pci, VAR_0);", "VGACommonState *vga = &qxl->vga;", "PortioList *qxl_vga_port_list = g_new(PortioList, 1);", "DisplayState *ds;", "int VAR_1;", "qxl->id = 0;", "qxl_init_ramsize(qxl);", "vga->vram_size_mb = qxl->vga.vram_size >> 20;", "vga_common_init(vga);", "vga_init(vga, pci_address_space(VAR_0), pci_address_space_io(VAR_0), false);", "portio_list_init(qxl_vga_port_list, qxl_vga_portio_list, vga, \"vga\");", "portio_list_add(qxl_vga_port_list, pci_address_space_io(VAR_0), 0x3b0);", "vga->con = graphic_console_init(qxl_hw_update, qxl_hw_invalidate,\nqxl_hw_screen_dump, qxl_hw_text_update,\nqxl);", "qxl->ssd.con = vga->con,\nqemu_spice_display_init_common(&qxl->ssd);", "VAR_1 = qxl_init_common(qxl);", "if (VAR_1 != 0) {", "return VAR_1;", "}", "qxl->ssd.dcl.ops = &display_listener_ops;", "ds = qemu_console_displaystate(vga->con);", "register_displaychangelistener(ds, &qxl->ssd.dcl);", "return VAR_1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33, 35, 37 ], [ 39, 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ] ]
8,402
int zipl_load(void) { struct mbr *mbr = (void*)sec; uint8_t *ns, *ns_end; int program_table_entries = 0; int pte_len = sizeof(struct scsi_blockptr); struct scsi_blockptr *prog_table_entry; const char *error = ""; /* Grab the MBR */ virtio_read(0, (void*)mbr); dputs("checking magic\n"); if (!zipl_magic(mbr->magic)) { error = "zipl_magic 1"; goto fail; } debug_print_int("program table", mbr->blockptr.blockno); /* Parse the program table */ if (virtio_read(mbr->blockptr.blockno, sec)) { error = "virtio_read"; goto fail; } if (!zipl_magic(sec)) { error = "zipl_magic 2"; goto fail; } ns_end = sec + SECTOR_SIZE; for (ns = (sec + pte_len); (ns + pte_len) < ns_end; ns++) { prog_table_entry = (struct scsi_blockptr *)ns; if (!prog_table_entry->blockno) { break; } program_table_entries++; } debug_print_int("program table entries", program_table_entries); if (!program_table_entries) { goto fail; } /* Run the default entry */ prog_table_entry = (struct scsi_blockptr *)(sec + pte_len); return zipl_run(prog_table_entry); fail: sclp_print("failed loading zipl: "); sclp_print(error); sclp_print("\n"); return -1; }
false
qemu
abd696e4f74a9d30801c6ae2693efe4e5979c2f2
int zipl_load(void) { struct mbr *mbr = (void*)sec; uint8_t *ns, *ns_end; int program_table_entries = 0; int pte_len = sizeof(struct scsi_blockptr); struct scsi_blockptr *prog_table_entry; const char *error = ""; virtio_read(0, (void*)mbr); dputs("checking magic\n"); if (!zipl_magic(mbr->magic)) { error = "zipl_magic 1"; goto fail; } debug_print_int("program table", mbr->blockptr.blockno); if (virtio_read(mbr->blockptr.blockno, sec)) { error = "virtio_read"; goto fail; } if (!zipl_magic(sec)) { error = "zipl_magic 2"; goto fail; } ns_end = sec + SECTOR_SIZE; for (ns = (sec + pte_len); (ns + pte_len) < ns_end; ns++) { prog_table_entry = (struct scsi_blockptr *)ns; if (!prog_table_entry->blockno) { break; } program_table_entries++; } debug_print_int("program table entries", program_table_entries); if (!program_table_entries) { goto fail; } prog_table_entry = (struct scsi_blockptr *)(sec + pte_len); return zipl_run(prog_table_entry); fail: sclp_print("failed loading zipl: "); sclp_print(error); sclp_print("\n"); return -1; }
{ "code": [], "line_no": [] }
int FUNC_0(void) { struct VAR_0 *VAR_0 = (void*)sec; uint8_t *ns, *ns_end; int VAR_1 = 0; int VAR_2 = sizeof(struct scsi_blockptr); struct scsi_blockptr *VAR_3; const char *VAR_4 = ""; virtio_read(0, (void*)VAR_0); dputs("checking magic\n"); if (!zipl_magic(VAR_0->magic)) { VAR_4 = "zipl_magic 1"; goto fail; } debug_print_int("program table", VAR_0->blockptr.blockno); if (virtio_read(VAR_0->blockptr.blockno, sec)) { VAR_4 = "virtio_read"; goto fail; } if (!zipl_magic(sec)) { VAR_4 = "zipl_magic 2"; goto fail; } ns_end = sec + SECTOR_SIZE; for (ns = (sec + VAR_2); (ns + VAR_2) < ns_end; ns++) { VAR_3 = (struct scsi_blockptr *)ns; if (!VAR_3->blockno) { break; } VAR_1++; } debug_print_int("program table entries", VAR_1); if (!VAR_1) { goto fail; } VAR_3 = (struct scsi_blockptr *)(sec + VAR_2); return zipl_run(VAR_3); fail: sclp_print("failed loading zipl: "); sclp_print(VAR_4); sclp_print("\n"); return -1; }
[ "int FUNC_0(void)\n{", "struct VAR_0 *VAR_0 = (void*)sec;", "uint8_t *ns, *ns_end;", "int VAR_1 = 0;", "int VAR_2 = sizeof(struct scsi_blockptr);", "struct scsi_blockptr *VAR_3;", "const char *VAR_4 = \"\";", "virtio_read(0, (void*)VAR_0);", "dputs(\"checking magic\\n\");", "if (!zipl_magic(VAR_0->magic)) {", "VAR_4 = \"zipl_magic 1\";", "goto fail;", "}", "debug_print_int(\"program table\", VAR_0->blockptr.blockno);", "if (virtio_read(VAR_0->blockptr.blockno, sec)) {", "VAR_4 = \"virtio_read\";", "goto fail;", "}", "if (!zipl_magic(sec)) {", "VAR_4 = \"zipl_magic 2\";", "goto fail;", "}", "ns_end = sec + SECTOR_SIZE;", "for (ns = (sec + VAR_2); (ns + VAR_2) < ns_end; ns++) {", "VAR_3 = (struct scsi_blockptr *)ns;", "if (!VAR_3->blockno) {", "break;", "}", "VAR_1++;", "}", "debug_print_int(\"program table entries\", VAR_1);", "if (!VAR_1) {", "goto fail;", "}", "VAR_3 = (struct scsi_blockptr *)(sec + VAR_2);", "return zipl_run(VAR_3);", "fail:\nsclp_print(\"failed loading zipl: \");", "sclp_print(VAR_4);", "sclp_print(\"\\n\");", "return -1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 21 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 101 ], [ 105 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ] ]
8,403
static void sdhci_data_transfer(void *opaque) { SDHCIState *s = (SDHCIState *)opaque; if (s->trnmod & SDHC_TRNS_DMA) { switch (SDHC_DMA_TYPE(s->hostctl)) { case SDHC_CTRL_SDMA: if ((s->trnmod & SDHC_TRNS_MULTI) && (!(s->trnmod & SDHC_TRNS_BLK_CNT_EN) || s->blkcnt == 0)) { break; } if ((s->blkcnt == 1) || !(s->trnmod & SDHC_TRNS_MULTI)) { sdhci_sdma_transfer_single_block(s); } else { sdhci_sdma_transfer_multi_blocks(s); } break; case SDHC_CTRL_ADMA1_32: if (!(s->capareg & SDHC_CAN_DO_ADMA1)) { ERRPRINT("ADMA1 not supported\n"); break; } sdhci_do_adma(s); break; case SDHC_CTRL_ADMA2_32: if (!(s->capareg & SDHC_CAN_DO_ADMA2)) { ERRPRINT("ADMA2 not supported\n"); break; } sdhci_do_adma(s); break; case SDHC_CTRL_ADMA2_64: if (!(s->capareg & SDHC_CAN_DO_ADMA2) || !(s->capareg & SDHC_64_BIT_BUS_SUPPORT)) { ERRPRINT("64 bit ADMA not supported\n"); break; } sdhci_do_adma(s); break; default: ERRPRINT("Unsupported DMA type\n"); break; } } else { if ((s->trnmod & SDHC_TRNS_READ) && sdbus_data_ready(&s->sdbus)) { s->prnsts |= SDHC_DOING_READ | SDHC_DATA_INHIBIT | SDHC_DAT_LINE_ACTIVE; sdhci_read_block_from_card(s); } else { s->prnsts |= SDHC_DOING_WRITE | SDHC_DAT_LINE_ACTIVE | SDHC_SPACE_AVAILABLE | SDHC_DATA_INHIBIT; sdhci_write_block_to_card(s); } } }
false
qemu
6e86d90352adf6cb08295255220295cf23c4286e
static void sdhci_data_transfer(void *opaque) { SDHCIState *s = (SDHCIState *)opaque; if (s->trnmod & SDHC_TRNS_DMA) { switch (SDHC_DMA_TYPE(s->hostctl)) { case SDHC_CTRL_SDMA: if ((s->trnmod & SDHC_TRNS_MULTI) && (!(s->trnmod & SDHC_TRNS_BLK_CNT_EN) || s->blkcnt == 0)) { break; } if ((s->blkcnt == 1) || !(s->trnmod & SDHC_TRNS_MULTI)) { sdhci_sdma_transfer_single_block(s); } else { sdhci_sdma_transfer_multi_blocks(s); } break; case SDHC_CTRL_ADMA1_32: if (!(s->capareg & SDHC_CAN_DO_ADMA1)) { ERRPRINT("ADMA1 not supported\n"); break; } sdhci_do_adma(s); break; case SDHC_CTRL_ADMA2_32: if (!(s->capareg & SDHC_CAN_DO_ADMA2)) { ERRPRINT("ADMA2 not supported\n"); break; } sdhci_do_adma(s); break; case SDHC_CTRL_ADMA2_64: if (!(s->capareg & SDHC_CAN_DO_ADMA2) || !(s->capareg & SDHC_64_BIT_BUS_SUPPORT)) { ERRPRINT("64 bit ADMA not supported\n"); break; } sdhci_do_adma(s); break; default: ERRPRINT("Unsupported DMA type\n"); break; } } else { if ((s->trnmod & SDHC_TRNS_READ) && sdbus_data_ready(&s->sdbus)) { s->prnsts |= SDHC_DOING_READ | SDHC_DATA_INHIBIT | SDHC_DAT_LINE_ACTIVE; sdhci_read_block_from_card(s); } else { s->prnsts |= SDHC_DOING_WRITE | SDHC_DAT_LINE_ACTIVE | SDHC_SPACE_AVAILABLE | SDHC_DATA_INHIBIT; sdhci_write_block_to_card(s); } } }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { SDHCIState *s = (SDHCIState *)VAR_0; if (s->trnmod & SDHC_TRNS_DMA) { switch (SDHC_DMA_TYPE(s->hostctl)) { case SDHC_CTRL_SDMA: if ((s->trnmod & SDHC_TRNS_MULTI) && (!(s->trnmod & SDHC_TRNS_BLK_CNT_EN) || s->blkcnt == 0)) { break; } if ((s->blkcnt == 1) || !(s->trnmod & SDHC_TRNS_MULTI)) { sdhci_sdma_transfer_single_block(s); } else { sdhci_sdma_transfer_multi_blocks(s); } break; case SDHC_CTRL_ADMA1_32: if (!(s->capareg & SDHC_CAN_DO_ADMA1)) { ERRPRINT("ADMA1 not supported\n"); break; } sdhci_do_adma(s); break; case SDHC_CTRL_ADMA2_32: if (!(s->capareg & SDHC_CAN_DO_ADMA2)) { ERRPRINT("ADMA2 not supported\n"); break; } sdhci_do_adma(s); break; case SDHC_CTRL_ADMA2_64: if (!(s->capareg & SDHC_CAN_DO_ADMA2) || !(s->capareg & SDHC_64_BIT_BUS_SUPPORT)) { ERRPRINT("64 bit ADMA not supported\n"); break; } sdhci_do_adma(s); break; default: ERRPRINT("Unsupported DMA type\n"); break; } } else { if ((s->trnmod & SDHC_TRNS_READ) && sdbus_data_ready(&s->sdbus)) { s->prnsts |= SDHC_DOING_READ | SDHC_DATA_INHIBIT | SDHC_DAT_LINE_ACTIVE; sdhci_read_block_from_card(s); } else { s->prnsts |= SDHC_DOING_WRITE | SDHC_DAT_LINE_ACTIVE | SDHC_SPACE_AVAILABLE | SDHC_DATA_INHIBIT; sdhci_write_block_to_card(s); } } }
[ "static void FUNC_0(void *VAR_0)\n{", "SDHCIState *s = (SDHCIState *)VAR_0;", "if (s->trnmod & SDHC_TRNS_DMA) {", "switch (SDHC_DMA_TYPE(s->hostctl)) {", "case SDHC_CTRL_SDMA:\nif ((s->trnmod & SDHC_TRNS_MULTI) &&\n(!(s->trnmod & SDHC_TRNS_BLK_CNT_EN) || s->blkcnt == 0)) {", "break;", "}", "if ((s->blkcnt == 1) || !(s->trnmod & SDHC_TRNS_MULTI)) {", "sdhci_sdma_transfer_single_block(s);", "} else {", "sdhci_sdma_transfer_multi_blocks(s);", "}", "break;", "case SDHC_CTRL_ADMA1_32:\nif (!(s->capareg & SDHC_CAN_DO_ADMA1)) {", "ERRPRINT(\"ADMA1 not supported\\n\");", "break;", "}", "sdhci_do_adma(s);", "break;", "case SDHC_CTRL_ADMA2_32:\nif (!(s->capareg & SDHC_CAN_DO_ADMA2)) {", "ERRPRINT(\"ADMA2 not supported\\n\");", "break;", "}", "sdhci_do_adma(s);", "break;", "case SDHC_CTRL_ADMA2_64:\nif (!(s->capareg & SDHC_CAN_DO_ADMA2) ||\n!(s->capareg & SDHC_64_BIT_BUS_SUPPORT)) {", "ERRPRINT(\"64 bit ADMA not supported\\n\");", "break;", "}", "sdhci_do_adma(s);", "break;", "default:\nERRPRINT(\"Unsupported DMA type\\n\");", "break;", "}", "} else {", "if ((s->trnmod & SDHC_TRNS_READ) && sdbus_data_ready(&s->sdbus)) {", "s->prnsts |= SDHC_DOING_READ | SDHC_DATA_INHIBIT |\nSDHC_DAT_LINE_ACTIVE;", "sdhci_read_block_from_card(s);", "} else {", "s->prnsts |= SDHC_DOING_WRITE | SDHC_DAT_LINE_ACTIVE |\nSDHC_SPACE_AVAILABLE | SDHC_DATA_INHIBIT;", "sdhci_write_block_to_card(s);", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13, 15, 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71, 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ] ]
8,404
static const char *keyval_parse_one(QDict *qdict, const char *params, const char *implied_key, Error **errp) { const char *key, *key_end, *s; size_t len; char key_in_cur[128]; QDict *cur; QObject *next; QString *val; key = params; len = strcspn(params, "=,"); if (implied_key && len && key[len] != '=') { /* Desugar implied key */ key = implied_key; len = strlen(implied_key); } key_end = key + len; /* * Loop over key fragments: @s points to current fragment, it * applies to @cur. @key_in_cur[] holds the previous fragment. */ cur = qdict; s = key; for (;;) { for (len = 0; s + len < key_end && s[len] != '.'; len++) { } if (!len) { assert(key != implied_key); error_setg(errp, "Invalid parameter '%.*s'", (int)(key_end - key), key); return NULL; } if (len >= sizeof(key_in_cur)) { assert(key != implied_key); error_setg(errp, "Parameter%s '%.*s' is too long", s != key || s + len != key_end ? " fragment" : "", (int)len, s); return NULL; } if (s != key) { next = keyval_parse_put(cur, key_in_cur, NULL, key, s - 1, errp); if (!next) { return NULL; } cur = qobject_to_qdict(next); assert(cur); } memcpy(key_in_cur, s, len); key_in_cur[len] = 0; s += len; if (*s != '.') { break; } s++; } if (key == implied_key) { assert(!*s); s = params; } else { if (*s != '=') { error_setg(errp, "Expected '=' after parameter '%.*s'", (int)(s - key), key); return NULL; } s++; } val = qstring_new(); for (;;) { if (!*s) { break; } else if (*s == ',') { s++; if (*s != ',') { break; } } qstring_append_chr(val, *s++); } if (!keyval_parse_put(cur, key_in_cur, val, key, key_end, errp)) { return NULL; } return s; }
false
qemu
f740048323398ebde9575a5730bf6d9f2a237f08
static const char *keyval_parse_one(QDict *qdict, const char *params, const char *implied_key, Error **errp) { const char *key, *key_end, *s; size_t len; char key_in_cur[128]; QDict *cur; QObject *next; QString *val; key = params; len = strcspn(params, "=,"); if (implied_key && len && key[len] != '=') { key = implied_key; len = strlen(implied_key); } key_end = key + len; cur = qdict; s = key; for (;;) { for (len = 0; s + len < key_end && s[len] != '.'; len++) { } if (!len) { assert(key != implied_key); error_setg(errp, "Invalid parameter '%.*s'", (int)(key_end - key), key); return NULL; } if (len >= sizeof(key_in_cur)) { assert(key != implied_key); error_setg(errp, "Parameter%s '%.*s' is too long", s != key || s + len != key_end ? " fragment" : "", (int)len, s); return NULL; } if (s != key) { next = keyval_parse_put(cur, key_in_cur, NULL, key, s - 1, errp); if (!next) { return NULL; } cur = qobject_to_qdict(next); assert(cur); } memcpy(key_in_cur, s, len); key_in_cur[len] = 0; s += len; if (*s != '.') { break; } s++; } if (key == implied_key) { assert(!*s); s = params; } else { if (*s != '=') { error_setg(errp, "Expected '=' after parameter '%.*s'", (int)(s - key), key); return NULL; } s++; } val = qstring_new(); for (;;) { if (!*s) { break; } else if (*s == ',') { s++; if (*s != ',') { break; } } qstring_append_chr(val, *s++); } if (!keyval_parse_put(cur, key_in_cur, val, key, key_end, errp)) { return NULL; } return s; }
{ "code": [], "line_no": [] }
static const char *FUNC_0(QDict *VAR_0, const char *VAR_1, const char *VAR_2, Error **VAR_3) { const char *VAR_4, *VAR_5, *VAR_6; size_t len; char VAR_7[128]; QDict *cur; QObject *next; QString *val; VAR_4 = VAR_1; len = strcspn(VAR_1, "=,"); if (VAR_2 && len && VAR_4[len] != '=') { VAR_4 = VAR_2; len = strlen(VAR_2); } VAR_5 = VAR_4 + len; cur = VAR_0; VAR_6 = VAR_4; for (;;) { for (len = 0; VAR_6 + len < VAR_5 && VAR_6[len] != '.'; len++) { } if (!len) { assert(VAR_4 != VAR_2); error_setg(VAR_3, "Invalid parameter '%.*VAR_6'", (int)(VAR_5 - VAR_4), VAR_4); return NULL; } if (len >= sizeof(VAR_7)) { assert(VAR_4 != VAR_2); error_setg(VAR_3, "Parameter%VAR_6 '%.*VAR_6' is too long", VAR_6 != VAR_4 || VAR_6 + len != VAR_5 ? " fragment" : "", (int)len, VAR_6); return NULL; } if (VAR_6 != VAR_4) { next = keyval_parse_put(cur, VAR_7, NULL, VAR_4, VAR_6 - 1, VAR_3); if (!next) { return NULL; } cur = qobject_to_qdict(next); assert(cur); } memcpy(VAR_7, VAR_6, len); VAR_7[len] = 0; VAR_6 += len; if (*VAR_6 != '.') { break; } VAR_6++; } if (VAR_4 == VAR_2) { assert(!*VAR_6); VAR_6 = VAR_1; } else { if (*VAR_6 != '=') { error_setg(VAR_3, "Expected '=' after parameter '%.*VAR_6'", (int)(VAR_6 - VAR_4), VAR_4); return NULL; } VAR_6++; } val = qstring_new(); for (;;) { if (!*VAR_6) { break; } else if (*VAR_6 == ',') { VAR_6++; if (*VAR_6 != ',') { break; } } qstring_append_chr(val, *VAR_6++); } if (!keyval_parse_put(cur, VAR_7, val, VAR_4, VAR_5, VAR_3)) { return NULL; } return VAR_6; }
[ "static const char *FUNC_0(QDict *VAR_0, const char *VAR_1,\nconst char *VAR_2,\nError **VAR_3)\n{", "const char *VAR_4, *VAR_5, *VAR_6;", "size_t len;", "char VAR_7[128];", "QDict *cur;", "QObject *next;", "QString *val;", "VAR_4 = VAR_1;", "len = strcspn(VAR_1, \"=,\");", "if (VAR_2 && len && VAR_4[len] != '=') {", "VAR_4 = VAR_2;", "len = strlen(VAR_2);", "}", "VAR_5 = VAR_4 + len;", "cur = VAR_0;", "VAR_6 = VAR_4;", "for (;;) {", "for (len = 0; VAR_6 + len < VAR_5 && VAR_6[len] != '.'; len++) {", "}", "if (!len) {", "assert(VAR_4 != VAR_2);", "error_setg(VAR_3, \"Invalid parameter '%.*VAR_6'\",\n(int)(VAR_5 - VAR_4), VAR_4);", "return NULL;", "}", "if (len >= sizeof(VAR_7)) {", "assert(VAR_4 != VAR_2);", "error_setg(VAR_3, \"Parameter%VAR_6 '%.*VAR_6' is too long\",\nVAR_6 != VAR_4 || VAR_6 + len != VAR_5 ? \" fragment\" : \"\",\n(int)len, VAR_6);", "return NULL;", "}", "if (VAR_6 != VAR_4) {", "next = keyval_parse_put(cur, VAR_7, NULL,\nVAR_4, VAR_6 - 1, VAR_3);", "if (!next) {", "return NULL;", "}", "cur = qobject_to_qdict(next);", "assert(cur);", "}", "memcpy(VAR_7, VAR_6, len);", "VAR_7[len] = 0;", "VAR_6 += len;", "if (*VAR_6 != '.') {", "break;", "}", "VAR_6++;", "}", "if (VAR_4 == VAR_2) {", "assert(!*VAR_6);", "VAR_6 = VAR_1;", "} else {", "if (*VAR_6 != '=') {", "error_setg(VAR_3, \"Expected '=' after parameter '%.*VAR_6'\",\n(int)(VAR_6 - VAR_4), VAR_4);", "return NULL;", "}", "VAR_6++;", "}", "val = qstring_new();", "for (;;) {", "if (!*VAR_6) {", "break;", "} else if (*VAR_6 == ',') {", "VAR_6++;", "if (*VAR_6 != ',') {", "break;", "}", "}", "qstring_append_chr(val, *VAR_6++);", "}", "if (!keyval_parse_put(cur, VAR_7, val, VAR_4, VAR_5, VAR_3)) {", "return NULL;", "}", "return VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75, 77, 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137, 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ] ]
8,405
void kvm_s390_cmma_reset(void) { int rc; struct kvm_device_attr attr = { .group = KVM_S390_VM_MEM_CTRL, .attr = KVM_S390_VM_MEM_CLR_CMMA, }; if (mem_path || !kvm_s390_cmma_available()) { return; } rc = kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &attr); trace_kvm_clear_cmma(rc); }
false
qemu
03f47ee49e1478b5ffffb3a9b6203c672903196c
void kvm_s390_cmma_reset(void) { int rc; struct kvm_device_attr attr = { .group = KVM_S390_VM_MEM_CTRL, .attr = KVM_S390_VM_MEM_CLR_CMMA, }; if (mem_path || !kvm_s390_cmma_available()) { return; } rc = kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &attr); trace_kvm_clear_cmma(rc); }
{ "code": [], "line_no": [] }
void FUNC_0(void) { int VAR_0; struct kvm_device_attr VAR_1 = { .group = KVM_S390_VM_MEM_CTRL, .VAR_1 = KVM_S390_VM_MEM_CLR_CMMA, }; if (mem_path || !kvm_s390_cmma_available()) { return; } VAR_0 = kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &VAR_1); trace_kvm_clear_cmma(VAR_0); }
[ "void FUNC_0(void)\n{", "int VAR_0;", "struct kvm_device_attr VAR_1 = {", ".group = KVM_S390_VM_MEM_CTRL,\n.VAR_1 = KVM_S390_VM_MEM_CLR_CMMA,\n};", "if (mem_path || !kvm_s390_cmma_available()) {", "return;", "}", "VAR_0 = kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &VAR_1);", "trace_kvm_clear_cmma(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11, 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ] ]
8,406
static void nested_struct_compare(UserDefTwo *udnp1, UserDefTwo *udnp2) { g_assert(udnp1); g_assert(udnp2); g_assert_cmpstr(udnp1->string0, ==, udnp2->string0); g_assert_cmpstr(udnp1->dict1->string1, ==, udnp2->dict1->string1); g_assert_cmpint(udnp1->dict1->dict2->userdef->base->integer, ==, udnp2->dict1->dict2->userdef->base->integer); g_assert_cmpstr(udnp1->dict1->dict2->userdef->string, ==, udnp2->dict1->dict2->userdef->string); g_assert_cmpstr(udnp1->dict1->dict2->string, ==, udnp2->dict1->dict2->string); g_assert(udnp1->dict1->has_dict3 == udnp2->dict1->has_dict3); g_assert_cmpint(udnp1->dict1->dict3->userdef->base->integer, ==, udnp2->dict1->dict3->userdef->base->integer); g_assert_cmpstr(udnp1->dict1->dict3->userdef->string, ==, udnp2->dict1->dict3->userdef->string); g_assert_cmpstr(udnp1->dict1->dict3->string, ==, udnp2->dict1->dict3->string); }
false
qemu
ddf21908961073199f3d186204da4810f2ea150b
static void nested_struct_compare(UserDefTwo *udnp1, UserDefTwo *udnp2) { g_assert(udnp1); g_assert(udnp2); g_assert_cmpstr(udnp1->string0, ==, udnp2->string0); g_assert_cmpstr(udnp1->dict1->string1, ==, udnp2->dict1->string1); g_assert_cmpint(udnp1->dict1->dict2->userdef->base->integer, ==, udnp2->dict1->dict2->userdef->base->integer); g_assert_cmpstr(udnp1->dict1->dict2->userdef->string, ==, udnp2->dict1->dict2->userdef->string); g_assert_cmpstr(udnp1->dict1->dict2->string, ==, udnp2->dict1->dict2->string); g_assert(udnp1->dict1->has_dict3 == udnp2->dict1->has_dict3); g_assert_cmpint(udnp1->dict1->dict3->userdef->base->integer, ==, udnp2->dict1->dict3->userdef->base->integer); g_assert_cmpstr(udnp1->dict1->dict3->userdef->string, ==, udnp2->dict1->dict3->userdef->string); g_assert_cmpstr(udnp1->dict1->dict3->string, ==, udnp2->dict1->dict3->string); }
{ "code": [], "line_no": [] }
static void FUNC_0(UserDefTwo *VAR_0, UserDefTwo *VAR_1) { g_assert(VAR_0); g_assert(VAR_1); g_assert_cmpstr(VAR_0->string0, ==, VAR_1->string0); g_assert_cmpstr(VAR_0->dict1->string1, ==, VAR_1->dict1->string1); g_assert_cmpint(VAR_0->dict1->dict2->userdef->base->integer, ==, VAR_1->dict1->dict2->userdef->base->integer); g_assert_cmpstr(VAR_0->dict1->dict2->userdef->string, ==, VAR_1->dict1->dict2->userdef->string); g_assert_cmpstr(VAR_0->dict1->dict2->string, ==, VAR_1->dict1->dict2->string); g_assert(VAR_0->dict1->has_dict3 == VAR_1->dict1->has_dict3); g_assert_cmpint(VAR_0->dict1->dict3->userdef->base->integer, ==, VAR_1->dict1->dict3->userdef->base->integer); g_assert_cmpstr(VAR_0->dict1->dict3->userdef->string, ==, VAR_1->dict1->dict3->userdef->string); g_assert_cmpstr(VAR_0->dict1->dict3->string, ==, VAR_1->dict1->dict3->string); }
[ "static void FUNC_0(UserDefTwo *VAR_0, UserDefTwo *VAR_1)\n{", "g_assert(VAR_0);", "g_assert(VAR_1);", "g_assert_cmpstr(VAR_0->string0, ==, VAR_1->string0);", "g_assert_cmpstr(VAR_0->dict1->string1, ==, VAR_1->dict1->string1);", "g_assert_cmpint(VAR_0->dict1->dict2->userdef->base->integer, ==,\nVAR_1->dict1->dict2->userdef->base->integer);", "g_assert_cmpstr(VAR_0->dict1->dict2->userdef->string, ==,\nVAR_1->dict1->dict2->userdef->string);", "g_assert_cmpstr(VAR_0->dict1->dict2->string, ==,\nVAR_1->dict1->dict2->string);", "g_assert(VAR_0->dict1->has_dict3 == VAR_1->dict1->has_dict3);", "g_assert_cmpint(VAR_0->dict1->dict3->userdef->base->integer, ==,\nVAR_1->dict1->dict3->userdef->base->integer);", "g_assert_cmpstr(VAR_0->dict1->dict3->userdef->string, ==,\nVAR_1->dict1->dict3->userdef->string);", "g_assert_cmpstr(VAR_0->dict1->dict3->string, ==,\nVAR_1->dict1->dict3->string);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13, 15 ], [ 17, 19 ], [ 21, 23 ], [ 25 ], [ 27, 29 ], [ 31, 33 ], [ 35, 37 ], [ 39 ] ]
8,407
static int scsi_generic_initfn(SCSIDevice *s) { int rc; int sg_version; struct sg_scsi_id scsiid; if (!s->conf.bs) { error_report("drive property not set"); return -1; } if (bdrv_get_on_error(s->conf.bs, 0) != BLOCKDEV_ON_ERROR_ENOSPC) { error_report("Device doesn't support drive option werror"); return -1; } if (bdrv_get_on_error(s->conf.bs, 1) != BLOCKDEV_ON_ERROR_REPORT) { error_report("Device doesn't support drive option rerror"); return -1; } /* check we are using a driver managing SG_IO (version 3 and after */ rc = bdrv_ioctl(s->conf.bs, SG_GET_VERSION_NUM, &sg_version); if (rc < 0) { error_report("cannot get SG_IO version number: %s. " "Is this a SCSI device?", strerror(-rc)); return -1; } if (sg_version < 30000) { error_report("scsi generic interface too old"); return -1; } /* get LUN of the /dev/sg? */ if (bdrv_ioctl(s->conf.bs, SG_GET_SCSI_ID, &scsiid)) { error_report("SG_GET_SCSI_ID ioctl failed"); return -1; } /* define device state */ s->type = scsiid.scsi_type; DPRINTF("device type %d\n", s->type); if (s->type == TYPE_DISK || s->type == TYPE_ROM) { add_boot_device_path(s->conf.bootindex, &s->qdev, NULL); } switch (s->type) { case TYPE_TAPE: s->blocksize = get_stream_blocksize(s->conf.bs); if (s->blocksize == -1) { s->blocksize = 0; } break; /* Make a guess for block devices, we'll fix it when the guest sends. * READ CAPACITY. If they don't, they likely would assume these sizes * anyway. (TODO: they could also send MODE SENSE). */ case TYPE_ROM: case TYPE_WORM: s->blocksize = 2048; break; default: s->blocksize = 512; break; } DPRINTF("block size %d\n", s->blocksize); return 0; }
false
qemu
a818a4b69d47ca3826dee36878074395aeac2083
static int scsi_generic_initfn(SCSIDevice *s) { int rc; int sg_version; struct sg_scsi_id scsiid; if (!s->conf.bs) { error_report("drive property not set"); return -1; } if (bdrv_get_on_error(s->conf.bs, 0) != BLOCKDEV_ON_ERROR_ENOSPC) { error_report("Device doesn't support drive option werror"); return -1; } if (bdrv_get_on_error(s->conf.bs, 1) != BLOCKDEV_ON_ERROR_REPORT) { error_report("Device doesn't support drive option rerror"); return -1; } rc = bdrv_ioctl(s->conf.bs, SG_GET_VERSION_NUM, &sg_version); if (rc < 0) { error_report("cannot get SG_IO version number: %s. " "Is this a SCSI device?", strerror(-rc)); return -1; } if (sg_version < 30000) { error_report("scsi generic interface too old"); return -1; } if (bdrv_ioctl(s->conf.bs, SG_GET_SCSI_ID, &scsiid)) { error_report("SG_GET_SCSI_ID ioctl failed"); return -1; } s->type = scsiid.scsi_type; DPRINTF("device type %d\n", s->type); if (s->type == TYPE_DISK || s->type == TYPE_ROM) { add_boot_device_path(s->conf.bootindex, &s->qdev, NULL); } switch (s->type) { case TYPE_TAPE: s->blocksize = get_stream_blocksize(s->conf.bs); if (s->blocksize == -1) { s->blocksize = 0; } break; case TYPE_ROM: case TYPE_WORM: s->blocksize = 2048; break; default: s->blocksize = 512; break; } DPRINTF("block size %d\n", s->blocksize); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(SCSIDevice *VAR_0) { int VAR_1; int VAR_2; struct sg_scsi_id VAR_3; if (!VAR_0->conf.bs) { error_report("drive property not set"); return -1; } if (bdrv_get_on_error(VAR_0->conf.bs, 0) != BLOCKDEV_ON_ERROR_ENOSPC) { error_report("Device doesn't support drive option werror"); return -1; } if (bdrv_get_on_error(VAR_0->conf.bs, 1) != BLOCKDEV_ON_ERROR_REPORT) { error_report("Device doesn't support drive option rerror"); return -1; } VAR_1 = bdrv_ioctl(VAR_0->conf.bs, SG_GET_VERSION_NUM, &VAR_2); if (VAR_1 < 0) { error_report("cannot get SG_IO version number: %VAR_0. " "Is this a SCSI device?", strerror(-VAR_1)); return -1; } if (VAR_2 < 30000) { error_report("scsi generic interface too old"); return -1; } if (bdrv_ioctl(VAR_0->conf.bs, SG_GET_SCSI_ID, &VAR_3)) { error_report("SG_GET_SCSI_ID ioctl failed"); return -1; } VAR_0->type = VAR_3.scsi_type; DPRINTF("device type %d\n", VAR_0->type); if (VAR_0->type == TYPE_DISK || VAR_0->type == TYPE_ROM) { add_boot_device_path(VAR_0->conf.bootindex, &VAR_0->qdev, NULL); } switch (VAR_0->type) { case TYPE_TAPE: VAR_0->blocksize = get_stream_blocksize(VAR_0->conf.bs); if (VAR_0->blocksize == -1) { VAR_0->blocksize = 0; } break; case TYPE_ROM: case TYPE_WORM: VAR_0->blocksize = 2048; break; default: VAR_0->blocksize = 512; break; } DPRINTF("block size %d\n", VAR_0->blocksize); return 0; }
[ "static int FUNC_0(SCSIDevice *VAR_0)\n{", "int VAR_1;", "int VAR_2;", "struct sg_scsi_id VAR_3;", "if (!VAR_0->conf.bs) {", "error_report(\"drive property not set\");", "return -1;", "}", "if (bdrv_get_on_error(VAR_0->conf.bs, 0) != BLOCKDEV_ON_ERROR_ENOSPC) {", "error_report(\"Device doesn't support drive option werror\");", "return -1;", "}", "if (bdrv_get_on_error(VAR_0->conf.bs, 1) != BLOCKDEV_ON_ERROR_REPORT) {", "error_report(\"Device doesn't support drive option rerror\");", "return -1;", "}", "VAR_1 = bdrv_ioctl(VAR_0->conf.bs, SG_GET_VERSION_NUM, &VAR_2);", "if (VAR_1 < 0) {", "error_report(\"cannot get SG_IO version number: %VAR_0. \"\n\"Is this a SCSI device?\",\nstrerror(-VAR_1));", "return -1;", "}", "if (VAR_2 < 30000) {", "error_report(\"scsi generic interface too old\");", "return -1;", "}", "if (bdrv_ioctl(VAR_0->conf.bs, SG_GET_SCSI_ID, &VAR_3)) {", "error_report(\"SG_GET_SCSI_ID ioctl failed\");", "return -1;", "}", "VAR_0->type = VAR_3.scsi_type;", "DPRINTF(\"device type %d\\n\", VAR_0->type);", "if (VAR_0->type == TYPE_DISK || VAR_0->type == TYPE_ROM) {", "add_boot_device_path(VAR_0->conf.bootindex, &VAR_0->qdev, NULL);", "}", "switch (VAR_0->type) {", "case TYPE_TAPE:\nVAR_0->blocksize = get_stream_blocksize(VAR_0->conf.bs);", "if (VAR_0->blocksize == -1) {", "VAR_0->blocksize = 0;", "}", "break;", "case TYPE_ROM:\ncase TYPE_WORM:\nVAR_0->blocksize = 2048;", "break;", "default:\nVAR_0->blocksize = 512;", "break;", "}", "DPRINTF(\"block size %d\\n\", VAR_0->blocksize);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 43 ], [ 45 ], [ 47, 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 117, 119, 121 ], [ 123 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 139 ] ]
8,408
VIOsPAPRDevice *spapr_vty_get_default(VIOsPAPRBus *bus) { VIOsPAPRDevice *sdev, *selected; DeviceState *iter; /* * To avoid the console bouncing around we want one VTY to be * the "default". We haven't really got anything to go on, so * arbitrarily choose the one with the lowest reg value. */ selected = NULL; QTAILQ_FOREACH(iter, &bus->bus.children, sibling) { /* Only look at VTY devices */ if (qdev_get_info(iter) != &spapr_vty_info.qdev) { continue; } sdev = DO_UPCAST(VIOsPAPRDevice, qdev, iter); /* First VTY we've found, so it is selected for now */ if (!selected) { selected = sdev; continue; } /* Choose VTY with lowest reg value */ if (sdev->reg < selected->reg) { selected = sdev; } } return selected; }
false
qemu
3954d33ab7f82f5a5fa0ced231849920265a5fec
VIOsPAPRDevice *spapr_vty_get_default(VIOsPAPRBus *bus) { VIOsPAPRDevice *sdev, *selected; DeviceState *iter; selected = NULL; QTAILQ_FOREACH(iter, &bus->bus.children, sibling) { if (qdev_get_info(iter) != &spapr_vty_info.qdev) { continue; } sdev = DO_UPCAST(VIOsPAPRDevice, qdev, iter); if (!selected) { selected = sdev; continue; } if (sdev->reg < selected->reg) { selected = sdev; } } return selected; }
{ "code": [], "line_no": [] }
VIOsPAPRDevice *FUNC_0(VIOsPAPRBus *bus) { VIOsPAPRDevice *sdev, *selected; DeviceState *iter; selected = NULL; QTAILQ_FOREACH(iter, &bus->bus.children, sibling) { if (qdev_get_info(iter) != &spapr_vty_info.qdev) { continue; } sdev = DO_UPCAST(VIOsPAPRDevice, qdev, iter); if (!selected) { selected = sdev; continue; } if (sdev->reg < selected->reg) { selected = sdev; } } return selected; }
[ "VIOsPAPRDevice *FUNC_0(VIOsPAPRBus *bus)\n{", "VIOsPAPRDevice *sdev, *selected;", "DeviceState *iter;", "selected = NULL;", "QTAILQ_FOREACH(iter, &bus->bus.children, sibling) {", "if (qdev_get_info(iter) != &spapr_vty_info.qdev) {", "continue;", "}", "sdev = DO_UPCAST(VIOsPAPRDevice, qdev, iter);", "if (!selected) {", "selected = sdev;", "continue;", "}", "if (sdev->reg < selected->reg) {", "selected = sdev;", "}", "}", "return selected;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ] ]
8,410
static int decode_ext_header(Wmv2Context *w){ MpegEncContext * const s= &w->s; GetBitContext gb; int fps; int code; if(s->avctx->extradata_size<4) return -1; init_get_bits(&gb, s->avctx->extradata, s->avctx->extradata_size*8); fps = get_bits(&gb, 5); s->bit_rate = get_bits(&gb, 11)*1024; w->mspel_bit = get_bits1(&gb); w->flag3 = get_bits1(&gb); w->abt_flag = get_bits1(&gb); w->j_type_bit = get_bits1(&gb); w->top_left_mv_flag= get_bits1(&gb); w->per_mb_rl_bit = get_bits1(&gb); code = get_bits(&gb, 3); if(code==0) return -1; s->slice_height = s->mb_height / code; if(s->avctx->debug&FF_DEBUG_PICT_INFO){ av_log(s->avctx, AV_LOG_DEBUG, "fps:%d, br:%d, qpbit:%d, abt_flag:%d, j_type_bit:%d, tl_mv_flag:%d, mbrl_bit:%d, code:%d, flag3:%d, slices:%d\n", fps, s->bit_rate, w->mspel_bit, w->abt_flag, w->j_type_bit, w->top_left_mv_flag, w->per_mb_rl_bit, code, w->flag3, code); } return 0; }
false
FFmpeg
a8ff69ce2bad1c4bb043e88ea35f5ab5691d4f3c
static int decode_ext_header(Wmv2Context *w){ MpegEncContext * const s= &w->s; GetBitContext gb; int fps; int code; if(s->avctx->extradata_size<4) return -1; init_get_bits(&gb, s->avctx->extradata, s->avctx->extradata_size*8); fps = get_bits(&gb, 5); s->bit_rate = get_bits(&gb, 11)*1024; w->mspel_bit = get_bits1(&gb); w->flag3 = get_bits1(&gb); w->abt_flag = get_bits1(&gb); w->j_type_bit = get_bits1(&gb); w->top_left_mv_flag= get_bits1(&gb); w->per_mb_rl_bit = get_bits1(&gb); code = get_bits(&gb, 3); if(code==0) return -1; s->slice_height = s->mb_height / code; if(s->avctx->debug&FF_DEBUG_PICT_INFO){ av_log(s->avctx, AV_LOG_DEBUG, "fps:%d, br:%d, qpbit:%d, abt_flag:%d, j_type_bit:%d, tl_mv_flag:%d, mbrl_bit:%d, code:%d, flag3:%d, slices:%d\n", fps, s->bit_rate, w->mspel_bit, w->abt_flag, w->j_type_bit, w->top_left_mv_flag, w->per_mb_rl_bit, code, w->flag3, code); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(Wmv2Context *VAR_0){ MpegEncContext * const s= &VAR_0->s; GetBitContext gb; int VAR_1; int VAR_2; if(s->avctx->extradata_size<4) return -1; init_get_bits(&gb, s->avctx->extradata, s->avctx->extradata_size*8); VAR_1 = get_bits(&gb, 5); s->bit_rate = get_bits(&gb, 11)*1024; VAR_0->mspel_bit = get_bits1(&gb); VAR_0->flag3 = get_bits1(&gb); VAR_0->abt_flag = get_bits1(&gb); VAR_0->j_type_bit = get_bits1(&gb); VAR_0->top_left_mv_flag= get_bits1(&gb); VAR_0->per_mb_rl_bit = get_bits1(&gb); VAR_2 = get_bits(&gb, 3); if(VAR_2==0) return -1; s->slice_height = s->mb_height / VAR_2; if(s->avctx->debug&FF_DEBUG_PICT_INFO){ av_log(s->avctx, AV_LOG_DEBUG, "VAR_1:%d, br:%d, qpbit:%d, abt_flag:%d, j_type_bit:%d, tl_mv_flag:%d, mbrl_bit:%d, VAR_2:%d, flag3:%d, slices:%d\n", VAR_1, s->bit_rate, VAR_0->mspel_bit, VAR_0->abt_flag, VAR_0->j_type_bit, VAR_0->top_left_mv_flag, VAR_0->per_mb_rl_bit, VAR_2, VAR_0->flag3, VAR_2); } return 0; }
[ "static int FUNC_0(Wmv2Context *VAR_0){", "MpegEncContext * const s= &VAR_0->s;", "GetBitContext gb;", "int VAR_1;", "int VAR_2;", "if(s->avctx->extradata_size<4) return -1;", "init_get_bits(&gb, s->avctx->extradata, s->avctx->extradata_size*8);", "VAR_1 = get_bits(&gb, 5);", "s->bit_rate = get_bits(&gb, 11)*1024;", "VAR_0->mspel_bit = get_bits1(&gb);", "VAR_0->flag3 = get_bits1(&gb);", "VAR_0->abt_flag = get_bits1(&gb);", "VAR_0->j_type_bit = get_bits1(&gb);", "VAR_0->top_left_mv_flag= get_bits1(&gb);", "VAR_0->per_mb_rl_bit = get_bits1(&gb);", "VAR_2 = get_bits(&gb, 3);", "if(VAR_2==0) return -1;", "s->slice_height = s->mb_height / VAR_2;", "if(s->avctx->debug&FF_DEBUG_PICT_INFO){", "av_log(s->avctx, AV_LOG_DEBUG, \"VAR_1:%d, br:%d, qpbit:%d, abt_flag:%d, j_type_bit:%d, tl_mv_flag:%d, mbrl_bit:%d, VAR_2:%d, flag3:%d, slices:%d\\n\",\nVAR_1, s->bit_rate, VAR_0->mspel_bit, VAR_0->abt_flag, VAR_0->j_type_bit, VAR_0->top_left_mv_flag, VAR_0->per_mb_rl_bit, VAR_2, VAR_0->flag3,\nVAR_2);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 45 ], [ 49 ], [ 51, 53, 55 ], [ 57 ], [ 59 ], [ 61 ] ]
8,411
void fw_cfg_add_file(FWCfgState *s, const char *filename, uint8_t *data, uint32_t len) { int i, index; if (!s->files) { int dsize = sizeof(uint32_t) + sizeof(FWCfgFile) * FW_CFG_FILE_SLOTS; s->files = g_malloc0(dsize); fw_cfg_add_bytes(s, FW_CFG_FILE_DIR, (uint8_t*)s->files, dsize); } index = be32_to_cpu(s->files->count); assert(index < FW_CFG_FILE_SLOTS); fw_cfg_add_bytes(s, FW_CFG_FILE_FIRST + index, data, len); pstrcpy(s->files->f[index].name, sizeof(s->files->f[index].name), filename); for (i = 0; i < index; i++) { if (strcmp(s->files->f[index].name, s->files->f[i].name) == 0) { trace_fw_cfg_add_file_dupe(s, s->files->f[index].name); return; } } s->files->f[index].size = cpu_to_be32(len); s->files->f[index].select = cpu_to_be16(FW_CFG_FILE_FIRST + index); trace_fw_cfg_add_file(s, index, s->files->f[index].name, len); s->files->count = cpu_to_be32(index+1); }
true
qemu
089da572b956ef0f8f5b8d5917358e07892a77c2
void fw_cfg_add_file(FWCfgState *s, const char *filename, uint8_t *data, uint32_t len) { int i, index; if (!s->files) { int dsize = sizeof(uint32_t) + sizeof(FWCfgFile) * FW_CFG_FILE_SLOTS; s->files = g_malloc0(dsize); fw_cfg_add_bytes(s, FW_CFG_FILE_DIR, (uint8_t*)s->files, dsize); } index = be32_to_cpu(s->files->count); assert(index < FW_CFG_FILE_SLOTS); fw_cfg_add_bytes(s, FW_CFG_FILE_FIRST + index, data, len); pstrcpy(s->files->f[index].name, sizeof(s->files->f[index].name), filename); for (i = 0; i < index; i++) { if (strcmp(s->files->f[index].name, s->files->f[i].name) == 0) { trace_fw_cfg_add_file_dupe(s, s->files->f[index].name); return; } } s->files->f[index].size = cpu_to_be32(len); s->files->f[index].select = cpu_to_be16(FW_CFG_FILE_FIRST + index); trace_fw_cfg_add_file(s, index, s->files->f[index].name, len); s->files->count = cpu_to_be32(index+1); }
{ "code": [ "void fw_cfg_add_file(FWCfgState *s, const char *filename, uint8_t *data,", " uint32_t len)", " int dsize = sizeof(uint32_t) + sizeof(FWCfgFile) * FW_CFG_FILE_SLOTS;", " fw_cfg_add_bytes(s, FW_CFG_FILE_DIR, (uint8_t*)s->files, dsize);" ], "line_no": [ 1, 3, 13, 17 ] }
void FUNC_0(FWCfgState *VAR_0, const char *VAR_1, uint8_t *VAR_2, uint32_t VAR_3) { int VAR_4, VAR_5; if (!VAR_0->files) { int VAR_6 = sizeof(uint32_t) + sizeof(FWCfgFile) * FW_CFG_FILE_SLOTS; VAR_0->files = g_malloc0(VAR_6); fw_cfg_add_bytes(VAR_0, FW_CFG_FILE_DIR, (uint8_t*)VAR_0->files, VAR_6); } VAR_5 = be32_to_cpu(VAR_0->files->count); assert(VAR_5 < FW_CFG_FILE_SLOTS); fw_cfg_add_bytes(VAR_0, FW_CFG_FILE_FIRST + VAR_5, VAR_2, VAR_3); pstrcpy(VAR_0->files->f[VAR_5].name, sizeof(VAR_0->files->f[VAR_5].name), VAR_1); for (VAR_4 = 0; VAR_4 < VAR_5; VAR_4++) { if (strcmp(VAR_0->files->f[VAR_5].name, VAR_0->files->f[VAR_4].name) == 0) { trace_fw_cfg_add_file_dupe(VAR_0, VAR_0->files->f[VAR_5].name); return; } } VAR_0->files->f[VAR_5].size = cpu_to_be32(VAR_3); VAR_0->files->f[VAR_5].select = cpu_to_be16(FW_CFG_FILE_FIRST + VAR_5); trace_fw_cfg_add_file(VAR_0, VAR_5, VAR_0->files->f[VAR_5].name, VAR_3); VAR_0->files->count = cpu_to_be32(VAR_5+1); }
[ "void FUNC_0(FWCfgState *VAR_0, const char *VAR_1, uint8_t *VAR_2,\nuint32_t VAR_3)\n{", "int VAR_4, VAR_5;", "if (!VAR_0->files) {", "int VAR_6 = sizeof(uint32_t) + sizeof(FWCfgFile) * FW_CFG_FILE_SLOTS;", "VAR_0->files = g_malloc0(VAR_6);", "fw_cfg_add_bytes(VAR_0, FW_CFG_FILE_DIR, (uint8_t*)VAR_0->files, VAR_6);", "}", "VAR_5 = be32_to_cpu(VAR_0->files->count);", "assert(VAR_5 < FW_CFG_FILE_SLOTS);", "fw_cfg_add_bytes(VAR_0, FW_CFG_FILE_FIRST + VAR_5, VAR_2, VAR_3);", "pstrcpy(VAR_0->files->f[VAR_5].name, sizeof(VAR_0->files->f[VAR_5].name),\nVAR_1);", "for (VAR_4 = 0; VAR_4 < VAR_5; VAR_4++) {", "if (strcmp(VAR_0->files->f[VAR_5].name, VAR_0->files->f[VAR_4].name) == 0) {", "trace_fw_cfg_add_file_dupe(VAR_0, VAR_0->files->f[VAR_5].name);", "return;", "}", "}", "VAR_0->files->f[VAR_5].size = cpu_to_be32(VAR_3);", "VAR_0->files->f[VAR_5].select = cpu_to_be16(FW_CFG_FILE_FIRST + VAR_5);", "trace_fw_cfg_add_file(VAR_0, VAR_5, VAR_0->files->f[VAR_5].name, VAR_3);", "VAR_0->files->count = cpu_to_be32(VAR_5+1);", "}" ]
[ 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ] ]
8,413
static int tls_open(URLContext *h, const char *uri, int flags) { TLSContext *c = h->priv_data; int ret; int port; char buf[200], host[200]; int numerichost = 0; struct addrinfo hints = { 0 }, *ai = NULL; const char *proxy_path; int use_proxy; ff_tls_init(); av_url_split(NULL, 0, NULL, 0, host, sizeof(host), &port, NULL, 0, uri); ff_url_join(buf, sizeof(buf), "tcp", NULL, host, port, NULL); hints.ai_flags = AI_NUMERICHOST; if (!getaddrinfo(host, NULL, &hints, &ai)) { numerichost = 1; freeaddrinfo(ai); } proxy_path = getenv("http_proxy"); use_proxy = !ff_http_match_no_proxy(getenv("no_proxy"), host) && proxy_path != NULL && av_strstart(proxy_path, "http://", NULL); if (use_proxy) { char proxy_host[200], proxy_auth[200], dest[200]; int proxy_port; av_url_split(NULL, 0, proxy_auth, sizeof(proxy_auth), proxy_host, sizeof(proxy_host), &proxy_port, NULL, 0, proxy_path); ff_url_join(dest, sizeof(dest), NULL, NULL, host, port, NULL); ff_url_join(buf, sizeof(buf), "httpproxy", proxy_auth, proxy_host, proxy_port, "/%s", dest); } ret = ffurl_open(&c->tcp, buf, AVIO_FLAG_READ_WRITE, &h->interrupt_callback, NULL); if (ret) goto fail; c->fd = ffurl_get_file_handle(c->tcp); #if CONFIG_GNUTLS gnutls_init(&c->session, GNUTLS_CLIENT); if (!numerichost) gnutls_server_name_set(c->session, GNUTLS_NAME_DNS, host, strlen(host)); gnutls_certificate_allocate_credentials(&c->cred); gnutls_certificate_set_verify_flags(c->cred, 0); gnutls_credentials_set(c->session, GNUTLS_CRD_CERTIFICATE, c->cred); gnutls_transport_set_ptr(c->session, (gnutls_transport_ptr_t) (intptr_t) c->fd); gnutls_priority_set_direct(c->session, "NORMAL", NULL); while (1) { ret = gnutls_handshake(c->session); if (ret == 0) break; if ((ret = do_tls_poll(h, ret)) < 0) goto fail; } #elif CONFIG_OPENSSL c->ctx = SSL_CTX_new(TLSv1_client_method()); if (!c->ctx) { av_log(h, AV_LOG_ERROR, "%s\n", ERR_error_string(ERR_get_error(), NULL)); ret = AVERROR(EIO); goto fail; } c->ssl = SSL_new(c->ctx); if (!c->ssl) { av_log(h, AV_LOG_ERROR, "%s\n", ERR_error_string(ERR_get_error(), NULL)); ret = AVERROR(EIO); goto fail; } SSL_set_fd(c->ssl, c->fd); if (!numerichost) SSL_set_tlsext_host_name(c->ssl, host); while (1) { ret = SSL_connect(c->ssl); if (ret > 0) break; if (ret == 0) { av_log(h, AV_LOG_ERROR, "Unable to negotiate TLS/SSL session\n"); ret = AVERROR(EIO); goto fail; } if ((ret = do_tls_poll(h, ret)) < 0) goto fail; } #endif return 0; fail: TLS_free(c); if (c->tcp) ffurl_close(c->tcp); ff_tls_deinit(); return ret; }
true
FFmpeg
8b09d917e7dc7d7f2ace31419f802d4ff518236c
static int tls_open(URLContext *h, const char *uri, int flags) { TLSContext *c = h->priv_data; int ret; int port; char buf[200], host[200]; int numerichost = 0; struct addrinfo hints = { 0 }, *ai = NULL; const char *proxy_path; int use_proxy; ff_tls_init(); av_url_split(NULL, 0, NULL, 0, host, sizeof(host), &port, NULL, 0, uri); ff_url_join(buf, sizeof(buf), "tcp", NULL, host, port, NULL); hints.ai_flags = AI_NUMERICHOST; if (!getaddrinfo(host, NULL, &hints, &ai)) { numerichost = 1; freeaddrinfo(ai); } proxy_path = getenv("http_proxy"); use_proxy = !ff_http_match_no_proxy(getenv("no_proxy"), host) && proxy_path != NULL && av_strstart(proxy_path, "http: if (use_proxy) { char proxy_host[200], proxy_auth[200], dest[200]; int proxy_port; av_url_split(NULL, 0, proxy_auth, sizeof(proxy_auth), proxy_host, sizeof(proxy_host), &proxy_port, NULL, 0, proxy_path); ff_url_join(dest, sizeof(dest), NULL, NULL, host, port, NULL); ff_url_join(buf, sizeof(buf), "httpproxy", proxy_auth, proxy_host, proxy_port, "/%s", dest); } ret = ffurl_open(&c->tcp, buf, AVIO_FLAG_READ_WRITE, &h->interrupt_callback, NULL); if (ret) goto fail; c->fd = ffurl_get_file_handle(c->tcp); #if CONFIG_GNUTLS gnutls_init(&c->session, GNUTLS_CLIENT); if (!numerichost) gnutls_server_name_set(c->session, GNUTLS_NAME_DNS, host, strlen(host)); gnutls_certificate_allocate_credentials(&c->cred); gnutls_certificate_set_verify_flags(c->cred, 0); gnutls_credentials_set(c->session, GNUTLS_CRD_CERTIFICATE, c->cred); gnutls_transport_set_ptr(c->session, (gnutls_transport_ptr_t) (intptr_t) c->fd); gnutls_priority_set_direct(c->session, "NORMAL", NULL); while (1) { ret = gnutls_handshake(c->session); if (ret == 0) break; if ((ret = do_tls_poll(h, ret)) < 0) goto fail; } #elif CONFIG_OPENSSL c->ctx = SSL_CTX_new(TLSv1_client_method()); if (!c->ctx) { av_log(h, AV_LOG_ERROR, "%s\n", ERR_error_string(ERR_get_error(), NULL)); ret = AVERROR(EIO); goto fail; } c->ssl = SSL_new(c->ctx); if (!c->ssl) { av_log(h, AV_LOG_ERROR, "%s\n", ERR_error_string(ERR_get_error(), NULL)); ret = AVERROR(EIO); goto fail; } SSL_set_fd(c->ssl, c->fd); if (!numerichost) SSL_set_tlsext_host_name(c->ssl, host); while (1) { ret = SSL_connect(c->ssl); if (ret > 0) break; if (ret == 0) { av_log(h, AV_LOG_ERROR, "Unable to negotiate TLS/SSL session\n"); ret = AVERROR(EIO); goto fail; } if ((ret = do_tls_poll(h, ret)) < 0) goto fail; } #endif return 0; fail: TLS_free(c); if (c->tcp) ffurl_close(c->tcp); ff_tls_deinit(); return ret; }
{ "code": [ " gnutls_certificate_set_verify_flags(c->cred, 0);" ], "line_no": [ 97 ] }
static int FUNC_0(URLContext *VAR_0, const char *VAR_1, int VAR_2) { TLSContext *c = VAR_0->priv_data; int VAR_3; int VAR_4; char VAR_5[200], VAR_6[200]; int VAR_7 = 0; struct addrinfo VAR_8 = { 0 }, *VAR_9 = NULL; const char *VAR_10; int VAR_11; ff_tls_init(); av_url_split(NULL, 0, NULL, 0, VAR_6, sizeof(VAR_6), &VAR_4, NULL, 0, VAR_1); ff_url_join(VAR_5, sizeof(VAR_5), "tcp", NULL, VAR_6, VAR_4, NULL); VAR_8.ai_flags = AI_NUMERICHOST; if (!getaddrinfo(VAR_6, NULL, &VAR_8, &VAR_9)) { VAR_7 = 1; freeaddrinfo(VAR_9); } VAR_10 = getenv("http_proxy"); VAR_11 = !ff_http_match_no_proxy(getenv("no_proxy"), VAR_6) && VAR_10 != NULL && av_strstart(VAR_10, "http: if (VAR_11) { char proxy_host[200], proxy_auth[200], dest[200]; int proxy_port; av_url_split(NULL, 0, proxy_auth, sizeof(proxy_auth), proxy_host, sizeof(proxy_host), &proxy_port, NULL, 0, VAR_10); ff_url_join(dest, sizeof(dest), NULL, NULL, VAR_6, VAR_4, NULL); ff_url_join(VAR_5, sizeof(VAR_5), "httpproxy", proxy_auth, proxy_host, proxy_port, "/%s", dest); } VAR_3 = ffurl_open(&c->tcp, VAR_5, AVIO_FLAG_READ_WRITE, &VAR_0->interrupt_callback, NULL); if (VAR_3) goto fail; c->fd = ffurl_get_file_handle(c->tcp); #if CONFIG_GNUTLS gnutls_init(&c->session, GNUTLS_CLIENT); if (!VAR_7) gnutls_server_name_set(c->session, GNUTLS_NAME_DNS, VAR_6, strlen(VAR_6)); gnutls_certificate_allocate_credentials(&c->cred); gnutls_certificate_set_verify_flags(c->cred, 0); gnutls_credentials_set(c->session, GNUTLS_CRD_CERTIFICATE, c->cred); gnutls_transport_set_ptr(c->session, (gnutls_transport_ptr_t) (intptr_t) c->fd); gnutls_priority_set_direct(c->session, "NORMAL", NULL); while (1) { VAR_3 = gnutls_handshake(c->session); if (VAR_3 == 0) break; if ((VAR_3 = do_tls_poll(VAR_0, VAR_3)) < 0) goto fail; } #elif CONFIG_OPENSSL c->ctx = SSL_CTX_new(TLSv1_client_method()); if (!c->ctx) { av_log(VAR_0, AV_LOG_ERROR, "%s\n", ERR_error_string(ERR_get_error(), NULL)); VAR_3 = AVERROR(EIO); goto fail; } c->ssl = SSL_new(c->ctx); if (!c->ssl) { av_log(VAR_0, AV_LOG_ERROR, "%s\n", ERR_error_string(ERR_get_error(), NULL)); VAR_3 = AVERROR(EIO); goto fail; } SSL_set_fd(c->ssl, c->fd); if (!VAR_7) SSL_set_tlsext_host_name(c->ssl, VAR_6); while (1) { VAR_3 = SSL_connect(c->ssl); if (VAR_3 > 0) break; if (VAR_3 == 0) { av_log(VAR_0, AV_LOG_ERROR, "Unable to negotiate TLS/SSL session\n"); VAR_3 = AVERROR(EIO); goto fail; } if ((VAR_3 = do_tls_poll(VAR_0, VAR_3)) < 0) goto fail; } #endif return 0; fail: TLS_free(c); if (c->tcp) ffurl_close(c->tcp); ff_tls_deinit(); return VAR_3; }
[ "static int FUNC_0(URLContext *VAR_0, const char *VAR_1, int VAR_2)\n{", "TLSContext *c = VAR_0->priv_data;", "int VAR_3;", "int VAR_4;", "char VAR_5[200], VAR_6[200];", "int VAR_7 = 0;", "struct addrinfo VAR_8 = { 0 }, *VAR_9 = NULL;", "const char *VAR_10;", "int VAR_11;", "ff_tls_init();", "av_url_split(NULL, 0, NULL, 0, VAR_6, sizeof(VAR_6), &VAR_4, NULL, 0, VAR_1);", "ff_url_join(VAR_5, sizeof(VAR_5), \"tcp\", NULL, VAR_6, VAR_4, NULL);", "VAR_8.ai_flags = AI_NUMERICHOST;", "if (!getaddrinfo(VAR_6, NULL, &VAR_8, &VAR_9)) {", "VAR_7 = 1;", "freeaddrinfo(VAR_9);", "}", "VAR_10 = getenv(\"http_proxy\");", "VAR_11 = !ff_http_match_no_proxy(getenv(\"no_proxy\"), VAR_6) &&\nVAR_10 != NULL && av_strstart(VAR_10, \"http:\nif (VAR_11) {", "char proxy_host[200], proxy_auth[200], dest[200];", "int proxy_port;", "av_url_split(NULL, 0, proxy_auth, sizeof(proxy_auth),\nproxy_host, sizeof(proxy_host), &proxy_port, NULL, 0,\nVAR_10);", "ff_url_join(dest, sizeof(dest), NULL, NULL, VAR_6, VAR_4, NULL);", "ff_url_join(VAR_5, sizeof(VAR_5), \"httpproxy\", proxy_auth, proxy_host,\nproxy_port, \"/%s\", dest);", "}", "VAR_3 = ffurl_open(&c->tcp, VAR_5, AVIO_FLAG_READ_WRITE,\n&VAR_0->interrupt_callback, NULL);", "if (VAR_3)\ngoto fail;", "c->fd = ffurl_get_file_handle(c->tcp);", "#if CONFIG_GNUTLS\ngnutls_init(&c->session, GNUTLS_CLIENT);", "if (!VAR_7)\ngnutls_server_name_set(c->session, GNUTLS_NAME_DNS, VAR_6, strlen(VAR_6));", "gnutls_certificate_allocate_credentials(&c->cred);", "gnutls_certificate_set_verify_flags(c->cred, 0);", "gnutls_credentials_set(c->session, GNUTLS_CRD_CERTIFICATE, c->cred);", "gnutls_transport_set_ptr(c->session, (gnutls_transport_ptr_t)\n(intptr_t) c->fd);", "gnutls_priority_set_direct(c->session, \"NORMAL\", NULL);", "while (1) {", "VAR_3 = gnutls_handshake(c->session);", "if (VAR_3 == 0)\nbreak;", "if ((VAR_3 = do_tls_poll(VAR_0, VAR_3)) < 0)\ngoto fail;", "}", "#elif CONFIG_OPENSSL\nc->ctx = SSL_CTX_new(TLSv1_client_method());", "if (!c->ctx) {", "av_log(VAR_0, AV_LOG_ERROR, \"%s\\n\", ERR_error_string(ERR_get_error(), NULL));", "VAR_3 = AVERROR(EIO);", "goto fail;", "}", "c->ssl = SSL_new(c->ctx);", "if (!c->ssl) {", "av_log(VAR_0, AV_LOG_ERROR, \"%s\\n\", ERR_error_string(ERR_get_error(), NULL));", "VAR_3 = AVERROR(EIO);", "goto fail;", "}", "SSL_set_fd(c->ssl, c->fd);", "if (!VAR_7)\nSSL_set_tlsext_host_name(c->ssl, VAR_6);", "while (1) {", "VAR_3 = SSL_connect(c->ssl);", "if (VAR_3 > 0)\nbreak;", "if (VAR_3 == 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"Unable to negotiate TLS/SSL session\\n\");", "VAR_3 = AVERROR(EIO);", "goto fail;", "}", "if ((VAR_3 = do_tls_poll(VAR_0, VAR_3)) < 0)\ngoto fail;", "}", "#endif\nreturn 0;", "fail:\nTLS_free(c);", "if (c->tcp)\nffurl_close(c->tcp);", "ff_tls_deinit();", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47, 49, 53 ], [ 55 ], [ 57 ], [ 59, 61, 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 75, 77 ], [ 79, 81 ], [ 83 ], [ 87, 89 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111, 113 ], [ 115, 117 ], [ 119 ], [ 121, 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149, 151 ], [ 153 ], [ 155 ], [ 157, 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171, 173 ], [ 175 ], [ 177, 179 ], [ 181, 183 ], [ 185, 187 ], [ 189 ], [ 191 ], [ 193 ] ]
8,414
void OPPROTO op_fdivr_STN_ST0(void) { CPU86_LDouble *p; p = &ST(PARAM1); *p = ST0 / *p; }
true
qemu
2ee73ac3a855fb0cfba3db91fdd1ecebdbc6f971
void OPPROTO op_fdivr_STN_ST0(void) { CPU86_LDouble *p; p = &ST(PARAM1); *p = ST0 / *p; }
{ "code": [ " *p = ST0 / *p;" ], "line_no": [ 9 ] }
void VAR_0 op_fdivr_STN_ST0(void) { CPU86_LDouble *p; p = &ST(PARAM1); *p = ST0 / *p; }
[ "void VAR_0 op_fdivr_STN_ST0(void)\n{", "CPU86_LDouble *p;", "p = &ST(PARAM1);", "*p = ST0 / *p;", "}" ]
[ 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
8,415
static int output_packet(AVFormatContext *ctx, int flush){ MpegMuxContext *s = ctx->priv_data; AVStream *st; StreamInfo *stream; int i, avail_space=0, es_size, trailer_size; int best_i= -1; int best_score= INT_MIN; int ignore_constraints=0; int64_t scr= s->last_scr; PacketDesc *timestamp_packet; const int64_t max_delay= av_rescale(ctx->max_delay, 90000, AV_TIME_BASE); retry: for(i=0; i<ctx->nb_streams; i++){ AVStream *st = ctx->streams[i]; StreamInfo *stream = st->priv_data; const int avail_data= av_fifo_size(stream->fifo); const int space= stream->max_buffer_size - stream->buffer_index; int rel_space= 1024LL*space / stream->max_buffer_size; PacketDesc *next_pkt= stream->premux_packet; /* for subtitle, a single PES packet must be generated, so we flush after every single subtitle packet */ if(s->packet_size > avail_data && !flush && st->codec->codec_type != AVMEDIA_TYPE_SUBTITLE) return 0; if(avail_data==0) continue; av_assert0(avail_data>0); if(space < s->packet_size && !ignore_constraints) continue; if(next_pkt && next_pkt->dts - scr > max_delay) continue; if(rel_space > best_score){ best_score= rel_space; best_i = i; avail_space= space; } } if(best_i < 0){ int64_t best_dts= INT64_MAX; for(i=0; i<ctx->nb_streams; i++){ AVStream *st = ctx->streams[i]; StreamInfo *stream = st->priv_data; PacketDesc *pkt_desc= stream->predecode_packet; if(pkt_desc && pkt_desc->dts < best_dts) best_dts= pkt_desc->dts; } av_dlog(ctx, "bumping scr, scr:%f, dts:%f\n", scr / 90000.0, best_dts / 90000.0); if(best_dts == INT64_MAX) return 0; if(scr >= best_dts+1 && !ignore_constraints){ av_log(ctx, AV_LOG_ERROR, "packet too large, ignoring buffer limits to mux it\n"); ignore_constraints= 1; } scr= FFMAX(best_dts+1, scr); if(remove_decoded_packets(ctx, scr) < 0) return -1; goto retry; } assert(best_i >= 0); st = ctx->streams[best_i]; stream = st->priv_data; assert(av_fifo_size(stream->fifo) > 0); assert(avail_space >= s->packet_size || ignore_constraints); timestamp_packet= stream->premux_packet; if(timestamp_packet->unwritten_size == timestamp_packet->size){ trailer_size= 0; }else{ trailer_size= timestamp_packet->unwritten_size; timestamp_packet= timestamp_packet->next; } if(timestamp_packet){ av_dlog(ctx, "dts:%f pts:%f scr:%f stream:%d\n", timestamp_packet->dts / 90000.0, timestamp_packet->pts / 90000.0, scr / 90000.0, best_i); es_size= flush_packet(ctx, best_i, timestamp_packet->pts, timestamp_packet->dts, scr, trailer_size); }else{ assert(av_fifo_size(stream->fifo) == trailer_size); es_size= flush_packet(ctx, best_i, AV_NOPTS_VALUE, AV_NOPTS_VALUE, scr, trailer_size); } if (s->is_vcd) { /* Write one or more padding sectors, if necessary, to reach the constant overall bitrate.*/ int vcd_pad_bytes; while((vcd_pad_bytes = get_vcd_padding_size(ctx,stream->premux_packet->pts) ) >= s->packet_size){ //FIXME pts cannot be correct here put_vcd_padding_sector(ctx); s->last_scr += s->packet_size*90000LL / (s->mux_rate*50LL); //FIXME rounding and first few bytes of each packet } } stream->buffer_index += es_size; s->last_scr += s->packet_size*90000LL / (s->mux_rate*50LL); //FIXME rounding and first few bytes of each packet while(stream->premux_packet && stream->premux_packet->unwritten_size <= es_size){ es_size -= stream->premux_packet->unwritten_size; stream->premux_packet= stream->premux_packet->next; } if(es_size) stream->premux_packet->unwritten_size -= es_size; if(remove_decoded_packets(ctx, s->last_scr) < 0) return -1; return 1; }
true
FFmpeg
32cde962969363bebc4ad49b770ffff39487d3f8
static int output_packet(AVFormatContext *ctx, int flush){ MpegMuxContext *s = ctx->priv_data; AVStream *st; StreamInfo *stream; int i, avail_space=0, es_size, trailer_size; int best_i= -1; int best_score= INT_MIN; int ignore_constraints=0; int64_t scr= s->last_scr; PacketDesc *timestamp_packet; const int64_t max_delay= av_rescale(ctx->max_delay, 90000, AV_TIME_BASE); retry: for(i=0; i<ctx->nb_streams; i++){ AVStream *st = ctx->streams[i]; StreamInfo *stream = st->priv_data; const int avail_data= av_fifo_size(stream->fifo); const int space= stream->max_buffer_size - stream->buffer_index; int rel_space= 1024LL*space / stream->max_buffer_size; PacketDesc *next_pkt= stream->premux_packet; if(s->packet_size > avail_data && !flush && st->codec->codec_type != AVMEDIA_TYPE_SUBTITLE) return 0; if(avail_data==0) continue; av_assert0(avail_data>0); if(space < s->packet_size && !ignore_constraints) continue; if(next_pkt && next_pkt->dts - scr > max_delay) continue; if(rel_space > best_score){ best_score= rel_space; best_i = i; avail_space= space; } } if(best_i < 0){ int64_t best_dts= INT64_MAX; for(i=0; i<ctx->nb_streams; i++){ AVStream *st = ctx->streams[i]; StreamInfo *stream = st->priv_data; PacketDesc *pkt_desc= stream->predecode_packet; if(pkt_desc && pkt_desc->dts < best_dts) best_dts= pkt_desc->dts; } av_dlog(ctx, "bumping scr, scr:%f, dts:%f\n", scr / 90000.0, best_dts / 90000.0); if(best_dts == INT64_MAX) return 0; if(scr >= best_dts+1 && !ignore_constraints){ av_log(ctx, AV_LOG_ERROR, "packet too large, ignoring buffer limits to mux it\n"); ignore_constraints= 1; } scr= FFMAX(best_dts+1, scr); if(remove_decoded_packets(ctx, scr) < 0) return -1; goto retry; } assert(best_i >= 0); st = ctx->streams[best_i]; stream = st->priv_data; assert(av_fifo_size(stream->fifo) > 0); assert(avail_space >= s->packet_size || ignore_constraints); timestamp_packet= stream->premux_packet; if(timestamp_packet->unwritten_size == timestamp_packet->size){ trailer_size= 0; }else{ trailer_size= timestamp_packet->unwritten_size; timestamp_packet= timestamp_packet->next; } if(timestamp_packet){ av_dlog(ctx, "dts:%f pts:%f scr:%f stream:%d\n", timestamp_packet->dts / 90000.0, timestamp_packet->pts / 90000.0, scr / 90000.0, best_i); es_size= flush_packet(ctx, best_i, timestamp_packet->pts, timestamp_packet->dts, scr, trailer_size); }else{ assert(av_fifo_size(stream->fifo) == trailer_size); es_size= flush_packet(ctx, best_i, AV_NOPTS_VALUE, AV_NOPTS_VALUE, scr, trailer_size); } if (s->is_vcd) { int vcd_pad_bytes; while((vcd_pad_bytes = get_vcd_padding_size(ctx,stream->premux_packet->pts) ) >= s->packet_size){ put_vcd_padding_sector(ctx); s->last_scr += s->packet_size*90000LL / (s->mux_rate*50LL); } } stream->buffer_index += es_size; s->last_scr += s->packet_size*90000LL / (s->mux_rate*50LL); while(stream->premux_packet && stream->premux_packet->unwritten_size <= es_size){ es_size -= stream->premux_packet->unwritten_size; stream->premux_packet= stream->premux_packet->next; } if(es_size) stream->premux_packet->unwritten_size -= es_size; if(remove_decoded_packets(ctx, s->last_scr) < 0) return -1; return 1; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, int VAR_1){ MpegMuxContext *s = VAR_0->priv_data; AVStream *st; StreamInfo *stream; int VAR_2, VAR_3=0, VAR_4, VAR_5; int VAR_6= -1; int VAR_7= INT_MIN; int VAR_8=0; int64_t scr= s->last_scr; PacketDesc *timestamp_packet; const int64_t VAR_9= av_rescale(VAR_0->VAR_9, 90000, AV_TIME_BASE); retry: for(VAR_2=0; VAR_2<VAR_0->nb_streams; VAR_2++){ AVStream *st = VAR_0->streams[VAR_2]; StreamInfo *stream = st->priv_data; const int avail_data= av_fifo_size(stream->fifo); const int space= stream->max_buffer_size - stream->buffer_index; int rel_space= 1024LL*space / stream->max_buffer_size; PacketDesc *next_pkt= stream->premux_packet; if(s->packet_size > avail_data && !VAR_1 && st->codec->codec_type != AVMEDIA_TYPE_SUBTITLE) return 0; if(avail_data==0) continue; av_assert0(avail_data>0); if(space < s->packet_size && !VAR_8) continue; if(next_pkt && next_pkt->dts - scr > VAR_9) continue; if(rel_space > VAR_7){ VAR_7= rel_space; VAR_6 = VAR_2; VAR_3= space; } } if(VAR_6 < 0){ int64_t best_dts= INT64_MAX; for(VAR_2=0; VAR_2<VAR_0->nb_streams; VAR_2++){ AVStream *st = VAR_0->streams[VAR_2]; StreamInfo *stream = st->priv_data; PacketDesc *pkt_desc= stream->predecode_packet; if(pkt_desc && pkt_desc->dts < best_dts) best_dts= pkt_desc->dts; } av_dlog(VAR_0, "bumping scr, scr:%f, dts:%f\n", scr / 90000.0, best_dts / 90000.0); if(best_dts == INT64_MAX) return 0; if(scr >= best_dts+1 && !VAR_8){ av_log(VAR_0, AV_LOG_ERROR, "packet too large, ignoring buffer limits to mux it\n"); VAR_8= 1; } scr= FFMAX(best_dts+1, scr); if(remove_decoded_packets(VAR_0, scr) < 0) return -1; goto retry; } assert(VAR_6 >= 0); st = VAR_0->streams[VAR_6]; stream = st->priv_data; assert(av_fifo_size(stream->fifo) > 0); assert(VAR_3 >= s->packet_size || VAR_8); timestamp_packet= stream->premux_packet; if(timestamp_packet->unwritten_size == timestamp_packet->size){ VAR_5= 0; }else{ VAR_5= timestamp_packet->unwritten_size; timestamp_packet= timestamp_packet->next; } if(timestamp_packet){ av_dlog(VAR_0, "dts:%f pts:%f scr:%f stream:%d\n", timestamp_packet->dts / 90000.0, timestamp_packet->pts / 90000.0, scr / 90000.0, VAR_6); VAR_4= flush_packet(VAR_0, VAR_6, timestamp_packet->pts, timestamp_packet->dts, scr, VAR_5); }else{ assert(av_fifo_size(stream->fifo) == VAR_5); VAR_4= flush_packet(VAR_0, VAR_6, AV_NOPTS_VALUE, AV_NOPTS_VALUE, scr, VAR_5); } if (s->is_vcd) { int VAR_10; while((VAR_10 = get_vcd_padding_size(VAR_0,stream->premux_packet->pts) ) >= s->packet_size){ put_vcd_padding_sector(VAR_0); s->last_scr += s->packet_size*90000LL / (s->mux_rate*50LL); } } stream->buffer_index += VAR_4; s->last_scr += s->packet_size*90000LL / (s->mux_rate*50LL); while(stream->premux_packet && stream->premux_packet->unwritten_size <= VAR_4){ VAR_4 -= stream->premux_packet->unwritten_size; stream->premux_packet= stream->premux_packet->next; } if(VAR_4) stream->premux_packet->unwritten_size -= VAR_4; if(remove_decoded_packets(VAR_0, s->last_scr) < 0) return -1; return 1; }
[ "static int FUNC_0(AVFormatContext *VAR_0, int VAR_1){", "MpegMuxContext *s = VAR_0->priv_data;", "AVStream *st;", "StreamInfo *stream;", "int VAR_2, VAR_3=0, VAR_4, VAR_5;", "int VAR_6= -1;", "int VAR_7= INT_MIN;", "int VAR_8=0;", "int64_t scr= s->last_scr;", "PacketDesc *timestamp_packet;", "const int64_t VAR_9= av_rescale(VAR_0->VAR_9, 90000, AV_TIME_BASE);", "retry:\nfor(VAR_2=0; VAR_2<VAR_0->nb_streams; VAR_2++){", "AVStream *st = VAR_0->streams[VAR_2];", "StreamInfo *stream = st->priv_data;", "const int avail_data= av_fifo_size(stream->fifo);", "const int space= stream->max_buffer_size - stream->buffer_index;", "int rel_space= 1024LL*space / stream->max_buffer_size;", "PacketDesc *next_pkt= stream->premux_packet;", "if(s->packet_size > avail_data && !VAR_1\n&& st->codec->codec_type != AVMEDIA_TYPE_SUBTITLE)\nreturn 0;", "if(avail_data==0)\ncontinue;", "av_assert0(avail_data>0);", "if(space < s->packet_size && !VAR_8)\ncontinue;", "if(next_pkt && next_pkt->dts - scr > VAR_9)\ncontinue;", "if(rel_space > VAR_7){", "VAR_7= rel_space;", "VAR_6 = VAR_2;", "VAR_3= space;", "}", "}", "if(VAR_6 < 0){", "int64_t best_dts= INT64_MAX;", "for(VAR_2=0; VAR_2<VAR_0->nb_streams; VAR_2++){", "AVStream *st = VAR_0->streams[VAR_2];", "StreamInfo *stream = st->priv_data;", "PacketDesc *pkt_desc= stream->predecode_packet;", "if(pkt_desc && pkt_desc->dts < best_dts)\nbest_dts= pkt_desc->dts;", "}", "av_dlog(VAR_0, \"bumping scr, scr:%f, dts:%f\\n\",\nscr / 90000.0, best_dts / 90000.0);", "if(best_dts == INT64_MAX)\nreturn 0;", "if(scr >= best_dts+1 && !VAR_8){", "av_log(VAR_0, AV_LOG_ERROR, \"packet too large, ignoring buffer limits to mux it\\n\");", "VAR_8= 1;", "}", "scr= FFMAX(best_dts+1, scr);", "if(remove_decoded_packets(VAR_0, scr) < 0)\nreturn -1;", "goto retry;", "}", "assert(VAR_6 >= 0);", "st = VAR_0->streams[VAR_6];", "stream = st->priv_data;", "assert(av_fifo_size(stream->fifo) > 0);", "assert(VAR_3 >= s->packet_size || VAR_8);", "timestamp_packet= stream->premux_packet;", "if(timestamp_packet->unwritten_size == timestamp_packet->size){", "VAR_5= 0;", "}else{", "VAR_5= timestamp_packet->unwritten_size;", "timestamp_packet= timestamp_packet->next;", "}", "if(timestamp_packet){", "av_dlog(VAR_0, \"dts:%f pts:%f scr:%f stream:%d\\n\",\ntimestamp_packet->dts / 90000.0,\ntimestamp_packet->pts / 90000.0,\nscr / 90000.0, VAR_6);", "VAR_4= flush_packet(VAR_0, VAR_6, timestamp_packet->pts, timestamp_packet->dts, scr, VAR_5);", "}else{", "assert(av_fifo_size(stream->fifo) == VAR_5);", "VAR_4= flush_packet(VAR_0, VAR_6, AV_NOPTS_VALUE, AV_NOPTS_VALUE, scr, VAR_5);", "}", "if (s->is_vcd) {", "int VAR_10;", "while((VAR_10 = get_vcd_padding_size(VAR_0,stream->premux_packet->pts) ) >= s->packet_size){", "put_vcd_padding_sector(VAR_0);", "s->last_scr += s->packet_size*90000LL / (s->mux_rate*50LL);", "}", "}", "stream->buffer_index += VAR_4;", "s->last_scr += s->packet_size*90000LL / (s->mux_rate*50LL);", "while(stream->premux_packet && stream->premux_packet->unwritten_size <= VAR_4){", "VAR_4 -= stream->premux_packet->unwritten_size;", "stream->premux_packet= stream->premux_packet->next;", "}", "if(VAR_4)\nstream->premux_packet->unwritten_size -= VAR_4;", "if(remove_decoded_packets(VAR_0, s->last_scr) < 0)\nreturn -1;", "return 1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 47, 49, 51 ], [ 53, 55 ], [ 57 ], [ 61, 63 ], [ 67, 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 109, 111 ], [ 113, 115 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129, 131 ], [ 133 ], [ 135 ], [ 139 ], [ 143 ], [ 145 ], [ 149 ], [ 153 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 173 ], [ 175, 177, 179, 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 195 ], [ 201 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 217 ], [ 219 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231, 233 ], [ 237, 239 ], [ 243 ], [ 245 ] ]
8,416
static void openpic_src_write(void *opaque, hwaddr addr, uint64_t val, unsigned len) { OpenPICState *opp = opaque; int idx; DPRINTF("%s: addr %08x <= %08x\n", __func__, addr, val); if (addr & 0xF) return; addr = addr & 0xFFF0; idx = addr >> 5; if (addr & 0x10) { /* EXDE / IFEDE / IEEDE */ write_IRQreg_ide(opp, idx, val); } else { /* EXVP / IFEVP / IEEVP */ write_IRQreg_ipvp(opp, idx, val); } }
true
qemu
af7e9e74c6a62a5bcd911726a9e88d28b61490e0
static void openpic_src_write(void *opaque, hwaddr addr, uint64_t val, unsigned len) { OpenPICState *opp = opaque; int idx; DPRINTF("%s: addr %08x <= %08x\n", __func__, addr, val); if (addr & 0xF) return; addr = addr & 0xFFF0; idx = addr >> 5; if (addr & 0x10) { write_IRQreg_ide(opp, idx, val); } else { write_IRQreg_ipvp(opp, idx, val); } }
{ "code": [ " if (addr & 0xF)", " if (addr & 0xF)", " if (addr & 0xF)", " if (addr & 0xF)", " if (addr & 0xF)", " if (addr & 0xF)", " if (addr & 0xF)" ], "line_no": [ 15, 15, 15, 15, 15, 15, 15 ] }
static void FUNC_0(void *VAR_0, hwaddr VAR_1, uint64_t VAR_2, unsigned VAR_3) { OpenPICState *opp = VAR_0; int VAR_4; DPRINTF("%s: VAR_1 %08x <= %08x\n", __func__, VAR_1, VAR_2); if (VAR_1 & 0xF) return; VAR_1 = VAR_1 & 0xFFF0; VAR_4 = VAR_1 >> 5; if (VAR_1 & 0x10) { write_IRQreg_ide(opp, VAR_4, VAR_2); } else { write_IRQreg_ipvp(opp, VAR_4, VAR_2); } }
[ "static void FUNC_0(void *VAR_0, hwaddr VAR_1, uint64_t VAR_2,\nunsigned VAR_3)\n{", "OpenPICState *opp = VAR_0;", "int VAR_4;", "DPRINTF(\"%s: VAR_1 %08x <= %08x\\n\", __func__, VAR_1, VAR_2);", "if (VAR_1 & 0xF)\nreturn;", "VAR_1 = VAR_1 & 0xFFF0;", "VAR_4 = VAR_1 >> 5;", "if (VAR_1 & 0x10) {", "write_IRQreg_ide(opp, VAR_4, VAR_2);", "} else {", "write_IRQreg_ipvp(opp, VAR_4, VAR_2);", "}", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ] ]
8,417
uint64_t helper_addlv(CPUAlphaState *env, uint64_t op1, uint64_t op2) { uint64_t tmp = op1; op1 = (uint32_t)(op1 + op2); if (unlikely((tmp ^ op2 ^ (-1UL)) & (tmp ^ op1) & (1UL << 31))) { arith_excp(env, GETPC(), EXC_M_IOV, 0); } return op1; }
true
qemu
4d1628e832dfc6ec02b0d196f6cc250aaa7bf3b3
uint64_t helper_addlv(CPUAlphaState *env, uint64_t op1, uint64_t op2) { uint64_t tmp = op1; op1 = (uint32_t)(op1 + op2); if (unlikely((tmp ^ op2 ^ (-1UL)) & (tmp ^ op1) & (1UL << 31))) { arith_excp(env, GETPC(), EXC_M_IOV, 0); } return op1; }
{ "code": [ " uint64_t tmp = op1;", " return op1;", "uint64_t helper_addlv(CPUAlphaState *env, uint64_t op1, uint64_t op2)", " uint64_t tmp = op1;", " op1 = (uint32_t)(op1 + op2);", " if (unlikely((tmp ^ op2 ^ (-1UL)) & (tmp ^ op1) & (1UL << 31))) {", " arith_excp(env, GETPC(), EXC_M_IOV, 0);", " return op1;", " arith_excp(env, GETPC(), EXC_M_IOV, 0);", " arith_excp(env, GETPC(), EXC_M_IOV, 0);", " arith_excp(env, GETPC(), EXC_M_IOV, 0);", " arith_excp(env, GETPC(), EXC_M_IOV, 0);" ], "line_no": [ 5, 15, 1, 5, 7, 9, 11, 15, 11, 11, 11, 11 ] }
uint64_t FUNC_0(CPUAlphaState *env, uint64_t op1, uint64_t op2) { uint64_t tmp = op1; op1 = (uint32_t)(op1 + op2); if (unlikely((tmp ^ op2 ^ (-1UL)) & (tmp ^ op1) & (1UL << 31))) { arith_excp(env, GETPC(), EXC_M_IOV, 0); } return op1; }
[ "uint64_t FUNC_0(CPUAlphaState *env, uint64_t op1, uint64_t op2)\n{", "uint64_t tmp = op1;", "op1 = (uint32_t)(op1 + op2);", "if (unlikely((tmp ^ op2 ^ (-1UL)) & (tmp ^ op1) & (1UL << 31))) {", "arith_excp(env, GETPC(), EXC_M_IOV, 0);", "}", "return op1;", "}" ]
[ 1, 1, 1, 1, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
8,418
static int ahci_dma_prepare_buf(IDEDMA *dma, int is_write) { AHCIDevice *ad = DO_UPCAST(AHCIDevice, dma, dma); IDEState *s = &ad->port.ifs[0]; ahci_populate_sglist(ad, &s->sg); s->io_buffer_size = s->sg.size; DPRINTF(ad->port_no, "len=%#x\n", s->io_buffer_size); return s->io_buffer_size != 0; }
true
qemu
61f52e06f0a21bab782f98ef3ea789aa6d0aa046
static int ahci_dma_prepare_buf(IDEDMA *dma, int is_write) { AHCIDevice *ad = DO_UPCAST(AHCIDevice, dma, dma); IDEState *s = &ad->port.ifs[0]; ahci_populate_sglist(ad, &s->sg); s->io_buffer_size = s->sg.size; DPRINTF(ad->port_no, "len=%#x\n", s->io_buffer_size); return s->io_buffer_size != 0; }
{ "code": [ " ahci_populate_sglist(ad, &s->sg);" ], "line_no": [ 11 ] }
static int FUNC_0(IDEDMA *VAR_0, int VAR_1) { AHCIDevice *ad = DO_UPCAST(AHCIDevice, VAR_0, VAR_0); IDEState *s = &ad->port.ifs[0]; ahci_populate_sglist(ad, &s->sg); s->io_buffer_size = s->sg.size; DPRINTF(ad->port_no, "len=%#x\n", s->io_buffer_size); return s->io_buffer_size != 0; }
[ "static int FUNC_0(IDEDMA *VAR_0, int VAR_1)\n{", "AHCIDevice *ad = DO_UPCAST(AHCIDevice, VAR_0, VAR_0);", "IDEState *s = &ad->port.ifs[0];", "ahci_populate_sglist(ad, &s->sg);", "s->io_buffer_size = s->sg.size;", "DPRINTF(ad->port_no, \"len=%#x\\n\", s->io_buffer_size);", "return s->io_buffer_size != 0;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ] ]
8,420
int av_vsrc_buffer_add_frame(AVFilterContext *buffer_src, const AVFrame *frame) { int ret; AVFilterBufferRef *picref = avfilter_get_video_buffer_ref_from_frame(frame, AV_PERM_WRITE); if (!picref) return AVERROR(ENOMEM); ret = av_vsrc_buffer_add_video_buffer_ref(buffer_src, picref); picref->buf->data[0] = NULL; avfilter_unref_buffer(picref); return ret; }
true
FFmpeg
27bcf55f459e038e81f09c17e72e6d44898b9015
int av_vsrc_buffer_add_frame(AVFilterContext *buffer_src, const AVFrame *frame) { int ret; AVFilterBufferRef *picref = avfilter_get_video_buffer_ref_from_frame(frame, AV_PERM_WRITE); if (!picref) return AVERROR(ENOMEM); ret = av_vsrc_buffer_add_video_buffer_ref(buffer_src, picref); picref->buf->data[0] = NULL; avfilter_unref_buffer(picref); return ret; }
{ "code": [ "int av_vsrc_buffer_add_frame(AVFilterContext *buffer_src, const AVFrame *frame)", " ret = av_vsrc_buffer_add_video_buffer_ref(buffer_src, picref);" ], "line_no": [ 1, 15 ] }
int FUNC_0(AVFilterContext *VAR_0, const AVFrame *VAR_1) { int VAR_2; AVFilterBufferRef *picref = avfilter_get_video_buffer_ref_from_frame(VAR_1, AV_PERM_WRITE); if (!picref) return AVERROR(ENOMEM); VAR_2 = av_vsrc_buffer_add_video_buffer_ref(VAR_0, picref); picref->buf->data[0] = NULL; avfilter_unref_buffer(picref); return VAR_2; }
[ "int FUNC_0(AVFilterContext *VAR_0, const AVFrame *VAR_1)\n{", "int VAR_2;", "AVFilterBufferRef *picref =\navfilter_get_video_buffer_ref_from_frame(VAR_1, AV_PERM_WRITE);", "if (!picref)\nreturn AVERROR(ENOMEM);", "VAR_2 = av_vsrc_buffer_add_video_buffer_ref(VAR_0, picref);", "picref->buf->data[0] = NULL;", "avfilter_unref_buffer(picref);", "return VAR_2;", "}" ]
[ 1, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ] ]
8,421
static ssize_t mp_user_getxattr(FsContext *ctx, const char *path, const char *name, void *value, size_t size) { char *buffer; ssize_t ret; if (strncmp(name, "user.virtfs.", 12) == 0) { /* * Don't allow fetch of user.virtfs namesapce * in case of mapped security */ errno = ENOATTR; return -1; } buffer = rpath(ctx, path); ret = lgetxattr(buffer, name, value, size); g_free(buffer); return ret; }
true
qemu
56ad3e54dad6cdcee8668d170df161d89581846f
static ssize_t mp_user_getxattr(FsContext *ctx, const char *path, const char *name, void *value, size_t size) { char *buffer; ssize_t ret; if (strncmp(name, "user.virtfs.", 12) == 0) { errno = ENOATTR; return -1; } buffer = rpath(ctx, path); ret = lgetxattr(buffer, name, value, size); g_free(buffer); return ret; }
{ "code": [ " char *buffer;", " ssize_t ret;", " buffer = rpath(ctx, path);", " g_free(buffer);", " return ret;", " char *buffer;", " ssize_t ret;", " buffer = rpath(ctx, path);", " g_free(buffer);", " return ret;", " char *buffer;", " ssize_t ret;", " buffer = rpath(ctx, path);", " ret = lgetxattr(buffer, name, value, size);", " g_free(buffer);", " return ret;", " char *buffer;", " ssize_t ret;", " buffer = rpath(ctx, path);", " ret = lgetxattr(buffer, name, value, size);", " g_free(buffer);" ], "line_no": [ 7, 9, 29, 33, 35, 7, 9, 29, 33, 35, 7, 9, 29, 31, 33, 35, 7, 9, 29, 31, 33 ] }
static ssize_t FUNC_0(FsContext *ctx, const char *path, const char *name, void *value, size_t size) { char *VAR_0; ssize_t ret; if (strncmp(name, "user.virtfs.", 12) == 0) { errno = ENOATTR; return -1; } VAR_0 = rpath(ctx, path); ret = lgetxattr(VAR_0, name, value, size); g_free(VAR_0); return ret; }
[ "static ssize_t FUNC_0(FsContext *ctx, const char *path,\nconst char *name, void *value, size_t size)\n{", "char *VAR_0;", "ssize_t ret;", "if (strncmp(name, \"user.virtfs.\", 12) == 0) {", "errno = ENOATTR;", "return -1;", "}", "VAR_0 = rpath(ctx, path);", "ret = lgetxattr(VAR_0, name, value, size);", "g_free(VAR_0);", "return ret;", "}" ]
[ 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ] ]
8,422
static int mpeg_decode_slice(AVCodecContext *avctx, AVFrame *pict, int start_code, UINT8 *buf, int buf_size) { Mpeg1Context *s1 = avctx->priv_data; MpegEncContext *s = &s1->mpeg_enc_ctx; int ret; start_code = (start_code - 1) & 0xff; if (start_code >= s->mb_height){ fprintf(stderr, "slice below image (%d >= %d)\n", start_code, s->mb_height); return DECODE_SLICE_ERROR; } s->last_dc[0] = 1 << (7 + s->intra_dc_precision); s->last_dc[1] = s->last_dc[0]; s->last_dc[2] = s->last_dc[0]; memset(s->last_mv, 0, sizeof(s->last_mv)); /* start frame decoding */ if (s->first_slice) { s->first_slice = 0; if(MPV_frame_start(s, avctx) < 0) return DECODE_SLICE_FATAL_ERROR; if(s->avctx->debug&FF_DEBUG_PICT_INFO){ printf("qp:%d fc:%2d%2d%2d%2d %s %s %s %s dc:%d pstruct:%d fdct:%d cmv:%d qtype:%d ivlc:%d rff:%d %s\n", s->qscale, s->mpeg_f_code[0][0],s->mpeg_f_code[0][1],s->mpeg_f_code[1][0],s->mpeg_f_code[1][1], s->pict_type == I_TYPE ? "I" : (s->pict_type == P_TYPE ? "P" : (s->pict_type == B_TYPE ? "B" : "S")), s->progressive_sequence ? "pro" :"", s->alternate_scan ? "alt" :"", s->top_field_first ? "top" :"", s->intra_dc_precision, s->picture_structure, s->frame_pred_frame_dct, s->concealment_motion_vectors, s->q_scale_type, s->intra_vlc_format, s->repeat_first_field, s->chroma_420_type ? "420" :""); } } init_get_bits(&s->gb, buf, buf_size); s->qscale = get_qscale(s); /* extra slice info */ while (get_bits1(&s->gb) != 0) { skip_bits(&s->gb, 8); } s->mb_x=0; for(;;) { int code = get_vlc2(&s->gb, mbincr_vlc.table, MBINCR_VLC_BITS, 2); if (code < 0) return -1; /* error = end of slice, but empty slice is bad or?*/ if (code >= 33) { if (code == 33) { s->mb_x += 33; } /* otherwise, stuffing, nothing to do */ } else { s->mb_x += code; break; } } s->mb_y = start_code; s->mb_incr= 1; for(;;) { s->dsp.clear_blocks(s->block[0]); ret = mpeg_decode_mb(s, s->block); dprintf("ret=%d\n", ret); if (ret < 0) return -1; MPV_decode_mb(s, s->block); if (++s->mb_x >= s->mb_width) { ff_draw_horiz_band(s); s->mb_x = 0; s->mb_y++; PRINT_QP("%s", "\n"); } PRINT_QP("%2d", s->qscale); /* skip mb handling */ if (s->mb_incr == 0) { /* read again increment */ s->mb_incr = 1; for(;;) { int code = get_vlc2(&s->gb, mbincr_vlc.table, MBINCR_VLC_BITS, 2); if (code < 0) goto eos; /* error = end of slice */ if (code >= 33) { if (code == 33) { s->mb_incr += 33; } /* otherwise, stuffing, nothing to do */ } else { s->mb_incr += code; break; } } } if(s->mb_y >= s->mb_height){ fprintf(stderr, "slice too long\n"); return DECODE_SLICE_ERROR; } } eos: //end of slice emms_c(); /* end of slice reached */ if (/*s->mb_x == 0 &&*/ s->mb_y == s->mb_height) { /* end of image */ if(s->mpeg2) s->qscale >>=1; MPV_frame_end(s); if (s->pict_type == B_TYPE || s->low_delay) { *pict= *(AVFrame*)&s->current_picture; } else { s->picture_number++; /* latency of 1 frame for I and P frames */ /* XXX: use another variable than picture_number */ if (s->last_picture.data[0] == NULL) { return DECODE_SLICE_OK; } else { *pict= *(AVFrame*)&s->last_picture; } } return DECODE_SLICE_EOP; } else { return DECODE_SLICE_OK; } }
false
FFmpeg
68f593b48433842f3407586679fe07f3e5199ab9
static int mpeg_decode_slice(AVCodecContext *avctx, AVFrame *pict, int start_code, UINT8 *buf, int buf_size) { Mpeg1Context *s1 = avctx->priv_data; MpegEncContext *s = &s1->mpeg_enc_ctx; int ret; start_code = (start_code - 1) & 0xff; if (start_code >= s->mb_height){ fprintf(stderr, "slice below image (%d >= %d)\n", start_code, s->mb_height); return DECODE_SLICE_ERROR; } s->last_dc[0] = 1 << (7 + s->intra_dc_precision); s->last_dc[1] = s->last_dc[0]; s->last_dc[2] = s->last_dc[0]; memset(s->last_mv, 0, sizeof(s->last_mv)); if (s->first_slice) { s->first_slice = 0; if(MPV_frame_start(s, avctx) < 0) return DECODE_SLICE_FATAL_ERROR; if(s->avctx->debug&FF_DEBUG_PICT_INFO){ printf("qp:%d fc:%2d%2d%2d%2d %s %s %s %s dc:%d pstruct:%d fdct:%d cmv:%d qtype:%d ivlc:%d rff:%d %s\n", s->qscale, s->mpeg_f_code[0][0],s->mpeg_f_code[0][1],s->mpeg_f_code[1][0],s->mpeg_f_code[1][1], s->pict_type == I_TYPE ? "I" : (s->pict_type == P_TYPE ? "P" : (s->pict_type == B_TYPE ? "B" : "S")), s->progressive_sequence ? "pro" :"", s->alternate_scan ? "alt" :"", s->top_field_first ? "top" :"", s->intra_dc_precision, s->picture_structure, s->frame_pred_frame_dct, s->concealment_motion_vectors, s->q_scale_type, s->intra_vlc_format, s->repeat_first_field, s->chroma_420_type ? "420" :""); } } init_get_bits(&s->gb, buf, buf_size); s->qscale = get_qscale(s); while (get_bits1(&s->gb) != 0) { skip_bits(&s->gb, 8); } s->mb_x=0; for(;;) { int code = get_vlc2(&s->gb, mbincr_vlc.table, MBINCR_VLC_BITS, 2); if (code < 0) return -1; if (code >= 33) { if (code == 33) { s->mb_x += 33; } } else { s->mb_x += code; break; } } s->mb_y = start_code; s->mb_incr= 1; for(;;) { s->dsp.clear_blocks(s->block[0]); ret = mpeg_decode_mb(s, s->block); dprintf("ret=%d\n", ret); if (ret < 0) return -1; MPV_decode_mb(s, s->block); if (++s->mb_x >= s->mb_width) { ff_draw_horiz_band(s); s->mb_x = 0; s->mb_y++; PRINT_QP("%s", "\n"); } PRINT_QP("%2d", s->qscale); if (s->mb_incr == 0) { s->mb_incr = 1; for(;;) { int code = get_vlc2(&s->gb, mbincr_vlc.table, MBINCR_VLC_BITS, 2); if (code < 0) goto eos; if (code >= 33) { if (code == 33) { s->mb_incr += 33; } } else { s->mb_incr += code; break; } } } if(s->mb_y >= s->mb_height){ fprintf(stderr, "slice too long\n"); return DECODE_SLICE_ERROR; } } eos: emms_c(); if ( s->mb_y == s->mb_height) { if(s->mpeg2) s->qscale >>=1; MPV_frame_end(s); if (s->pict_type == B_TYPE || s->low_delay) { *pict= *(AVFrame*)&s->current_picture; } else { s->picture_number++; if (s->last_picture.data[0] == NULL) { return DECODE_SLICE_OK; } else { *pict= *(AVFrame*)&s->last_picture; } } return DECODE_SLICE_EOP; } else { return DECODE_SLICE_OK; } }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1, int VAR_2, UINT8 *VAR_3, int VAR_4) { Mpeg1Context *s1 = VAR_0->priv_data; MpegEncContext *s = &s1->mpeg_enc_ctx; int VAR_5; VAR_2 = (VAR_2 - 1) & 0xff; if (VAR_2 >= s->mb_height){ fprintf(stderr, "slice below image (%d >= %d)\n", VAR_2, s->mb_height); return DECODE_SLICE_ERROR; } s->last_dc[0] = 1 << (7 + s->intra_dc_precision); s->last_dc[1] = s->last_dc[0]; s->last_dc[2] = s->last_dc[0]; memset(s->last_mv, 0, sizeof(s->last_mv)); if (s->first_slice) { s->first_slice = 0; if(MPV_frame_start(s, VAR_0) < 0) return DECODE_SLICE_FATAL_ERROR; if(s->VAR_0->debug&FF_DEBUG_PICT_INFO){ printf("qp:%d fc:%2d%2d%2d%2d %s %s %s %s dc:%d pstruct:%d fdct:%d cmv:%d qtype:%d ivlc:%d rff:%d %s\n", s->qscale, s->mpeg_f_code[0][0],s->mpeg_f_code[0][1],s->mpeg_f_code[1][0],s->mpeg_f_code[1][1], s->pict_type == I_TYPE ? "I" : (s->pict_type == P_TYPE ? "P" : (s->pict_type == B_TYPE ? "B" : "S")), s->progressive_sequence ? "pro" :"", s->alternate_scan ? "alt" :"", s->top_field_first ? "top" :"", s->intra_dc_precision, s->picture_structure, s->frame_pred_frame_dct, s->concealment_motion_vectors, s->q_scale_type, s->intra_vlc_format, s->repeat_first_field, s->chroma_420_type ? "420" :""); } } init_get_bits(&s->gb, VAR_3, VAR_4); s->qscale = get_qscale(s); while (get_bits1(&s->gb) != 0) { skip_bits(&s->gb, 8); } s->mb_x=0; for(;;) { int VAR_7 = get_vlc2(&s->gb, mbincr_vlc.table, MBINCR_VLC_BITS, 2); if (VAR_7 < 0) return -1; if (VAR_7 >= 33) { if (VAR_7 == 33) { s->mb_x += 33; } } else { s->mb_x += VAR_7; break; } } s->mb_y = VAR_2; s->mb_incr= 1; for(;;) { s->dsp.clear_blocks(s->block[0]); VAR_5 = mpeg_decode_mb(s, s->block); dprintf("VAR_5=%d\n", VAR_5); if (VAR_5 < 0) return -1; MPV_decode_mb(s, s->block); if (++s->mb_x >= s->mb_width) { ff_draw_horiz_band(s); s->mb_x = 0; s->mb_y++; PRINT_QP("%s", "\n"); } PRINT_QP("%2d", s->qscale); if (s->mb_incr == 0) { s->mb_incr = 1; for(;;) { int VAR_7 = get_vlc2(&s->gb, mbincr_vlc.table, MBINCR_VLC_BITS, 2); if (VAR_7 < 0) goto eos; if (VAR_7 >= 33) { if (VAR_7 == 33) { s->mb_incr += 33; } } else { s->mb_incr += VAR_7; break; } } } if(s->mb_y >= s->mb_height){ fprintf(stderr, "slice too long\n"); return DECODE_SLICE_ERROR; } } eos: emms_c(); if ( s->mb_y == s->mb_height) { if(s->mpeg2) s->qscale >>=1; MPV_frame_end(s); if (s->pict_type == B_TYPE || s->low_delay) { *VAR_1= *(AVFrame*)&s->current_picture; } else { s->picture_number++; if (s->last_picture.data[0] == NULL) { return DECODE_SLICE_OK; } else { *VAR_1= *(AVFrame*)&s->last_picture; } } return DECODE_SLICE_EOP; } else { return DECODE_SLICE_OK; } }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nAVFrame *VAR_1,\nint VAR_2,\nUINT8 *VAR_3, int VAR_4)\n{", "Mpeg1Context *s1 = VAR_0->priv_data;", "MpegEncContext *s = &s1->mpeg_enc_ctx;", "int VAR_5;", "VAR_2 = (VAR_2 - 1) & 0xff;", "if (VAR_2 >= s->mb_height){", "fprintf(stderr, \"slice below image (%d >= %d)\\n\", VAR_2, s->mb_height);", "return DECODE_SLICE_ERROR;", "}", "s->last_dc[0] = 1 << (7 + s->intra_dc_precision);", "s->last_dc[1] = s->last_dc[0];", "s->last_dc[2] = s->last_dc[0];", "memset(s->last_mv, 0, sizeof(s->last_mv));", "if (s->first_slice) {", "s->first_slice = 0;", "if(MPV_frame_start(s, VAR_0) < 0)\nreturn DECODE_SLICE_FATAL_ERROR;", "if(s->VAR_0->debug&FF_DEBUG_PICT_INFO){", "printf(\"qp:%d fc:%2d%2d%2d%2d %s %s %s %s dc:%d pstruct:%d fdct:%d cmv:%d qtype:%d ivlc:%d rff:%d %s\\n\",\ns->qscale, s->mpeg_f_code[0][0],s->mpeg_f_code[0][1],s->mpeg_f_code[1][0],s->mpeg_f_code[1][1],\ns->pict_type == I_TYPE ? \"I\" : (s->pict_type == P_TYPE ? \"P\" : (s->pict_type == B_TYPE ? \"B\" : \"S\")),\ns->progressive_sequence ? \"pro\" :\"\", s->alternate_scan ? \"alt\" :\"\", s->top_field_first ? \"top\" :\"\",\ns->intra_dc_precision, s->picture_structure, s->frame_pred_frame_dct, s->concealment_motion_vectors,\ns->q_scale_type, s->intra_vlc_format, s->repeat_first_field, s->chroma_420_type ? \"420\" :\"\");", "}", "}", "init_get_bits(&s->gb, VAR_3, VAR_4);", "s->qscale = get_qscale(s);", "while (get_bits1(&s->gb) != 0) {", "skip_bits(&s->gb, 8);", "}", "s->mb_x=0;", "for(;;) {", "int VAR_7 = get_vlc2(&s->gb, mbincr_vlc.table, MBINCR_VLC_BITS, 2);", "if (VAR_7 < 0)\nreturn -1;", "if (VAR_7 >= 33) {", "if (VAR_7 == 33) {", "s->mb_x += 33;", "}", "} else {", "s->mb_x += VAR_7;", "break;", "}", "}", "s->mb_y = VAR_2;", "s->mb_incr= 1;", "for(;;) {", "s->dsp.clear_blocks(s->block[0]);", "VAR_5 = mpeg_decode_mb(s, s->block);", "dprintf(\"VAR_5=%d\\n\", VAR_5);", "if (VAR_5 < 0)\nreturn -1;", "MPV_decode_mb(s, s->block);", "if (++s->mb_x >= s->mb_width) {", "ff_draw_horiz_band(s);", "s->mb_x = 0;", "s->mb_y++;", "PRINT_QP(\"%s\", \"\\n\");", "}", "PRINT_QP(\"%2d\", s->qscale);", "if (s->mb_incr == 0) {", "s->mb_incr = 1;", "for(;;) {", "int VAR_7 = get_vlc2(&s->gb, mbincr_vlc.table, MBINCR_VLC_BITS, 2);", "if (VAR_7 < 0)\ngoto eos;", "if (VAR_7 >= 33) {", "if (VAR_7 == 33) {", "s->mb_incr += 33;", "}", "} else {", "s->mb_incr += VAR_7;", "break;", "}", "}", "}", "if(s->mb_y >= s->mb_height){", "fprintf(stderr, \"slice too long\\n\");", "return DECODE_SLICE_ERROR;", "}", "}", "eos:\nemms_c();", "if (\ns->mb_y == s->mb_height) {", "if(s->mpeg2)\ns->qscale >>=1;", "MPV_frame_end(s);", "if (s->pict_type == B_TYPE || s->low_delay) {", "*VAR_1= *(AVFrame*)&s->current_picture;", "} else {", "s->picture_number++;", "if (s->last_picture.data[0] == NULL) {", "return DECODE_SLICE_OK;", "} else {", "*VAR_1= *(AVFrame*)&s->last_picture;", "}", "}", "return DECODE_SLICE_EOP;", "} else {", "return DECODE_SLICE_OK;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 49 ], [ 51, 53, 55, 57, 59, 61 ], [ 63 ], [ 65 ], [ 69 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 131, 133 ], [ 137 ], [ 141 ], [ 143 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 161 ], [ 165 ], [ 167 ], [ 169 ], [ 171, 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207, 211 ], [ 217, 219 ], [ 225, 227 ], [ 231 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ] ]
8,423
static void generate_codebook(RoqContext *enc, RoqTempdata *tempdata, int *points, int inputCount, roq_cell *results, int size, int cbsize) { int i, j, k; int c_size = size*size/4; int *buf; int *codebook = av_malloc(6*c_size*cbsize*sizeof(int)); int *closest_cb; if (size == 4) closest_cb = av_malloc(6*c_size*inputCount*sizeof(int)); else closest_cb = tempdata->closest_cb2; ff_init_elbg(points, 6*c_size, inputCount, codebook, cbsize, 1, closest_cb, &enc->randctx); ff_do_elbg(points, 6*c_size, inputCount, codebook, cbsize, 1, closest_cb, &enc->randctx); if (size == 4) av_free(closest_cb); buf = codebook; for (i=0; i<cbsize; i++) for (k=0; k<c_size; k++) { for(j=0; j<4; j++) results->y[j] = *buf++; results->u = (*buf++ + CHROMA_BIAS/2)/CHROMA_BIAS; results->v = (*buf++ + CHROMA_BIAS/2)/CHROMA_BIAS; results++; } av_free(codebook); }
false
FFmpeg
3beb9cbad35218ed1fb3473eeb3cfc97a931bff4
static void generate_codebook(RoqContext *enc, RoqTempdata *tempdata, int *points, int inputCount, roq_cell *results, int size, int cbsize) { int i, j, k; int c_size = size*size/4; int *buf; int *codebook = av_malloc(6*c_size*cbsize*sizeof(int)); int *closest_cb; if (size == 4) closest_cb = av_malloc(6*c_size*inputCount*sizeof(int)); else closest_cb = tempdata->closest_cb2; ff_init_elbg(points, 6*c_size, inputCount, codebook, cbsize, 1, closest_cb, &enc->randctx); ff_do_elbg(points, 6*c_size, inputCount, codebook, cbsize, 1, closest_cb, &enc->randctx); if (size == 4) av_free(closest_cb); buf = codebook; for (i=0; i<cbsize; i++) for (k=0; k<c_size; k++) { for(j=0; j<4; j++) results->y[j] = *buf++; results->u = (*buf++ + CHROMA_BIAS/2)/CHROMA_BIAS; results->v = (*buf++ + CHROMA_BIAS/2)/CHROMA_BIAS; results++; } av_free(codebook); }
{ "code": [], "line_no": [] }
static void FUNC_0(RoqContext *VAR_0, RoqTempdata *VAR_1, int *VAR_2, int VAR_3, roq_cell *VAR_4, int VAR_5, int VAR_6) { int VAR_7, VAR_8, VAR_9; int VAR_10 = VAR_5*VAR_5/4; int *VAR_11; int *VAR_12 = av_malloc(6*VAR_10*VAR_6*sizeof(int)); int *VAR_13; if (VAR_5 == 4) VAR_13 = av_malloc(6*VAR_10*VAR_3*sizeof(int)); else VAR_13 = VAR_1->closest_cb2; ff_init_elbg(VAR_2, 6*VAR_10, VAR_3, VAR_12, VAR_6, 1, VAR_13, &VAR_0->randctx); ff_do_elbg(VAR_2, 6*VAR_10, VAR_3, VAR_12, VAR_6, 1, VAR_13, &VAR_0->randctx); if (VAR_5 == 4) av_free(VAR_13); VAR_11 = VAR_12; for (VAR_7=0; VAR_7<VAR_6; VAR_7++) for (VAR_9=0; VAR_9<VAR_10; VAR_9++) { for(VAR_8=0; VAR_8<4; VAR_8++) VAR_4->y[VAR_8] = *VAR_11++; VAR_4->u = (*VAR_11++ + CHROMA_BIAS/2)/CHROMA_BIAS; VAR_4->v = (*VAR_11++ + CHROMA_BIAS/2)/CHROMA_BIAS; VAR_4++; } av_free(VAR_12); }
[ "static void FUNC_0(RoqContext *VAR_0, RoqTempdata *VAR_1,\nint *VAR_2, int VAR_3, roq_cell *VAR_4,\nint VAR_5, int VAR_6)\n{", "int VAR_7, VAR_8, VAR_9;", "int VAR_10 = VAR_5*VAR_5/4;", "int *VAR_11;", "int *VAR_12 = av_malloc(6*VAR_10*VAR_6*sizeof(int));", "int *VAR_13;", "if (VAR_5 == 4)\nVAR_13 = av_malloc(6*VAR_10*VAR_3*sizeof(int));", "else\nVAR_13 = VAR_1->closest_cb2;", "ff_init_elbg(VAR_2, 6*VAR_10, VAR_3, VAR_12, VAR_6, 1, VAR_13, &VAR_0->randctx);", "ff_do_elbg(VAR_2, 6*VAR_10, VAR_3, VAR_12, VAR_6, 1, VAR_13, &VAR_0->randctx);", "if (VAR_5 == 4)\nav_free(VAR_13);", "VAR_11 = VAR_12;", "for (VAR_7=0; VAR_7<VAR_6; VAR_7++)", "for (VAR_9=0; VAR_9<VAR_10; VAR_9++) {", "for(VAR_8=0; VAR_8<4; VAR_8++)", "VAR_4->y[VAR_8] = *VAR_11++;", "VAR_4->u = (*VAR_11++ + CHROMA_BIAS/2)/CHROMA_BIAS;", "VAR_4->v = (*VAR_11++ + CHROMA_BIAS/2)/CHROMA_BIAS;", "VAR_4++;", "}", "av_free(VAR_12);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 25, 27 ], [ 31 ], [ 33 ], [ 37, 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ] ]
8,426
static av_cold int xma_decode_init(AVCodecContext *avctx) { XMADecodeCtx *s = avctx->priv_data; int i, ret; for (i = 0; i < avctx->channels / 2; i++) { ret = decode_init(&s->xma[i], avctx); s->frames[i] = av_frame_alloc(); if (!s->frames[i]) return AVERROR(ENOMEM); s->frames[i]->nb_samples = 512; if ((ret = ff_get_buffer(avctx, s->frames[i], 0)) < 0) { return AVERROR(ENOMEM); } } return ret; }
false
FFmpeg
45f4bf94afb8b70d99fb7b5760fd65f5c3ad8b88
static av_cold int xma_decode_init(AVCodecContext *avctx) { XMADecodeCtx *s = avctx->priv_data; int i, ret; for (i = 0; i < avctx->channels / 2; i++) { ret = decode_init(&s->xma[i], avctx); s->frames[i] = av_frame_alloc(); if (!s->frames[i]) return AVERROR(ENOMEM); s->frames[i]->nb_samples = 512; if ((ret = ff_get_buffer(avctx, s->frames[i], 0)) < 0) { return AVERROR(ENOMEM); } } return ret; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx) { XMADecodeCtx *s = avctx->priv_data; int VAR_0, VAR_1; for (VAR_0 = 0; VAR_0 < avctx->channels / 2; VAR_0++) { VAR_1 = decode_init(&s->xma[VAR_0], avctx); s->frames[VAR_0] = av_frame_alloc(); if (!s->frames[VAR_0]) return AVERROR(ENOMEM); s->frames[VAR_0]->nb_samples = 512; if ((VAR_1 = ff_get_buffer(avctx, s->frames[VAR_0], 0)) < 0) { return AVERROR(ENOMEM); } } return VAR_1; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "XMADecodeCtx *s = avctx->priv_data;", "int VAR_0, VAR_1;", "for (VAR_0 = 0; VAR_0 < avctx->channels / 2; VAR_0++) {", "VAR_1 = decode_init(&s->xma[VAR_0], avctx);", "s->frames[VAR_0] = av_frame_alloc();", "if (!s->frames[VAR_0])\nreturn AVERROR(ENOMEM);", "s->frames[VAR_0]->nb_samples = 512;", "if ((VAR_1 = ff_get_buffer(avctx, s->frames[VAR_0], 0)) < 0) {", "return AVERROR(ENOMEM);", "}", "}", "return VAR_1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 35 ], [ 37 ] ]
8,427
int main (int argc, char *argv[]) { char *fnam = argv[0]; FILE *f; if (argv[0][0] != '/') { fnam = malloc (strlen (argv[0]) + 2); if (fnam == NULL) abort (); strcpy (fnam, "/"); strcat (fnam, argv[0]); } f = fopen (fnam, "rb"); if (f == NULL) abort (); close (f); /* Cover another execution path. */ if (fopen ("/nonexistent", "rb") != NULL || errno != ENOENT) abort (); printf ("pass\n"); return 0; }
true
qemu
2917dce477f91e933052f5555b4c6be961ff624e
int main (int argc, char *argv[]) { char *fnam = argv[0]; FILE *f; if (argv[0][0] != '/') { fnam = malloc (strlen (argv[0]) + 2); if (fnam == NULL) abort (); strcpy (fnam, "/"); strcat (fnam, argv[0]); } f = fopen (fnam, "rb"); if (f == NULL) abort (); close (f); if (fopen ("/nonexistent", "rb") != NULL || errno != ENOENT) abort (); printf ("pass\n"); return 0; }
{ "code": [ " close (f);", " close (f);" ], "line_no": [ 33, 33 ] }
int FUNC_0 (int VAR_0, char *VAR_1[]) { char *VAR_2 = VAR_1[0]; FILE *f; if (VAR_1[0][0] != '/') { VAR_2 = malloc (strlen (VAR_1[0]) + 2); if (VAR_2 == NULL) abort (); strcpy (VAR_2, "/"); strcat (VAR_2, VAR_1[0]); } f = fopen (VAR_2, "rb"); if (f == NULL) abort (); close (f); if (fopen ("/nonexistent", "rb") != NULL || errno != ENOENT) abort (); printf ("pass\n"); return 0; }
[ "int FUNC_0 (int VAR_0, char *VAR_1[])\n{", "char *VAR_2 = VAR_1[0];", "FILE *f;", "if (VAR_1[0][0] != '/')\n{", "VAR_2 = malloc (strlen (VAR_1[0]) + 2);", "if (VAR_2 == NULL)\nabort ();", "strcpy (VAR_2, \"/\");", "strcat (VAR_2, VAR_1[0]);", "}", "f = fopen (VAR_2, \"rb\");", "if (f == NULL)\nabort ();", "close (f);", "if (fopen (\"/nonexistent\", \"rb\") != NULL\n|| errno != ENOENT)\nabort ();", "printf (\"pass\\n\");", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 39, 41, 43 ], [ 45 ], [ 47 ], [ 49 ] ]
8,429
int xbzrle_decode_buffer(uint8_t *src, int slen, uint8_t *dst, int dlen) { int i = 0, d = 0; int ret; uint32_t count = 0; while (i < slen) { /* zrun */ if ((slen - i) < 2) { return -1; } ret = uleb128_decode_small(src + i, &count); if (ret < 0 || (i && !count)) { return -1; } i += ret; d += count; /* overflow */ if (d > dlen) { return -1; } /* nzrun */ if ((slen - i) < 2) { return -1; } ret = uleb128_decode_small(src + i, &count); if (ret < 0 || !count) { return -1; } i += ret; /* overflow */ if (d + count > dlen || i + count > slen) { return -1; } memcpy(dst + d, src + i, count); d += count; i += count; } return d; }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
int xbzrle_decode_buffer(uint8_t *src, int slen, uint8_t *dst, int dlen) { int i = 0, d = 0; int ret; uint32_t count = 0; while (i < slen) { if ((slen - i) < 2) { return -1; } ret = uleb128_decode_small(src + i, &count); if (ret < 0 || (i && !count)) { return -1; } i += ret; d += count; if (d > dlen) { return -1; } if ((slen - i) < 2) { return -1; } ret = uleb128_decode_small(src + i, &count); if (ret < 0 || !count) { return -1; } i += ret; if (d + count > dlen || i + count > slen) { return -1; } memcpy(dst + d, src + i, count); d += count; i += count; } return d; }
{ "code": [], "line_no": [] }
int FUNC_0(uint8_t *VAR_0, int VAR_1, uint8_t *VAR_2, int VAR_3) { int VAR_4 = 0, VAR_5 = 0; int VAR_6; uint32_t count = 0; while (VAR_4 < VAR_1) { if ((VAR_1 - VAR_4) < 2) { return -1; } VAR_6 = uleb128_decode_small(VAR_0 + VAR_4, &count); if (VAR_6 < 0 || (VAR_4 && !count)) { return -1; } VAR_4 += VAR_6; VAR_5 += count; if (VAR_5 > VAR_3) { return -1; } if ((VAR_1 - VAR_4) < 2) { return -1; } VAR_6 = uleb128_decode_small(VAR_0 + VAR_4, &count); if (VAR_6 < 0 || !count) { return -1; } VAR_4 += VAR_6; if (VAR_5 + count > VAR_3 || VAR_4 + count > VAR_1) { return -1; } memcpy(VAR_2 + VAR_5, VAR_0 + VAR_4, count); VAR_5 += count; VAR_4 += count; } return VAR_5; }
[ "int FUNC_0(uint8_t *VAR_0, int VAR_1, uint8_t *VAR_2, int VAR_3)\n{", "int VAR_4 = 0, VAR_5 = 0;", "int VAR_6;", "uint32_t count = 0;", "while (VAR_4 < VAR_1) {", "if ((VAR_1 - VAR_4) < 2) {", "return -1;", "}", "VAR_6 = uleb128_decode_small(VAR_0 + VAR_4, &count);", "if (VAR_6 < 0 || (VAR_4 && !count)) {", "return -1;", "}", "VAR_4 += VAR_6;", "VAR_5 += count;", "if (VAR_5 > VAR_3) {", "return -1;", "}", "if ((VAR_1 - VAR_4) < 2) {", "return -1;", "}", "VAR_6 = uleb128_decode_small(VAR_0 + VAR_4, &count);", "if (VAR_6 < 0 || !count) {", "return -1;", "}", "VAR_4 += VAR_6;", "if (VAR_5 + count > VAR_3 || VAR_4 + count > VAR_1) {", "return -1;", "}", "memcpy(VAR_2 + VAR_5, VAR_0 + VAR_4, count);", "VAR_5 += count;", "VAR_4 += count;", "}", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 43 ], [ 45 ], [ 47 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ] ]
8,430
av_cold void ff_vp8dsp_init(VP8DSPContext *dsp) { dsp->vp8_luma_dc_wht = vp8_luma_dc_wht_c; dsp->vp8_luma_dc_wht_dc = vp8_luma_dc_wht_dc_c; dsp->vp8_idct_add = vp8_idct_add_c; dsp->vp8_idct_dc_add = vp8_idct_dc_add_c; dsp->vp8_idct_dc_add4y = vp8_idct_dc_add4y_c; dsp->vp8_idct_dc_add4uv = vp8_idct_dc_add4uv_c; dsp->vp8_v_loop_filter16y = vp8_v_loop_filter16_c; dsp->vp8_h_loop_filter16y = vp8_h_loop_filter16_c; dsp->vp8_v_loop_filter8uv = vp8_v_loop_filter8uv_c; dsp->vp8_h_loop_filter8uv = vp8_h_loop_filter8uv_c; dsp->vp8_v_loop_filter16y_inner = vp8_v_loop_filter16_inner_c; dsp->vp8_h_loop_filter16y_inner = vp8_h_loop_filter16_inner_c; dsp->vp8_v_loop_filter8uv_inner = vp8_v_loop_filter8uv_inner_c; dsp->vp8_h_loop_filter8uv_inner = vp8_h_loop_filter8uv_inner_c; dsp->vp8_v_loop_filter_simple = vp8_v_loop_filter_simple_c; dsp->vp8_h_loop_filter_simple = vp8_h_loop_filter_simple_c; VP8_MC_FUNC(0, 16); VP8_MC_FUNC(1, 8); VP8_MC_FUNC(2, 4); VP8_BILINEAR_MC_FUNC(0, 16); VP8_BILINEAR_MC_FUNC(1, 8); VP8_BILINEAR_MC_FUNC(2, 4); if (ARCH_ARM) ff_vp8dsp_init_arm(dsp); if (ARCH_PPC) ff_vp8dsp_init_ppc(dsp); if (ARCH_X86) ff_vp8dsp_init_x86(dsp); }
false
FFmpeg
b8664c929437d6d079e16979c496a2db40cf2324
av_cold void ff_vp8dsp_init(VP8DSPContext *dsp) { dsp->vp8_luma_dc_wht = vp8_luma_dc_wht_c; dsp->vp8_luma_dc_wht_dc = vp8_luma_dc_wht_dc_c; dsp->vp8_idct_add = vp8_idct_add_c; dsp->vp8_idct_dc_add = vp8_idct_dc_add_c; dsp->vp8_idct_dc_add4y = vp8_idct_dc_add4y_c; dsp->vp8_idct_dc_add4uv = vp8_idct_dc_add4uv_c; dsp->vp8_v_loop_filter16y = vp8_v_loop_filter16_c; dsp->vp8_h_loop_filter16y = vp8_h_loop_filter16_c; dsp->vp8_v_loop_filter8uv = vp8_v_loop_filter8uv_c; dsp->vp8_h_loop_filter8uv = vp8_h_loop_filter8uv_c; dsp->vp8_v_loop_filter16y_inner = vp8_v_loop_filter16_inner_c; dsp->vp8_h_loop_filter16y_inner = vp8_h_loop_filter16_inner_c; dsp->vp8_v_loop_filter8uv_inner = vp8_v_loop_filter8uv_inner_c; dsp->vp8_h_loop_filter8uv_inner = vp8_h_loop_filter8uv_inner_c; dsp->vp8_v_loop_filter_simple = vp8_v_loop_filter_simple_c; dsp->vp8_h_loop_filter_simple = vp8_h_loop_filter_simple_c; VP8_MC_FUNC(0, 16); VP8_MC_FUNC(1, 8); VP8_MC_FUNC(2, 4); VP8_BILINEAR_MC_FUNC(0, 16); VP8_BILINEAR_MC_FUNC(1, 8); VP8_BILINEAR_MC_FUNC(2, 4); if (ARCH_ARM) ff_vp8dsp_init_arm(dsp); if (ARCH_PPC) ff_vp8dsp_init_ppc(dsp); if (ARCH_X86) ff_vp8dsp_init_x86(dsp); }
{ "code": [], "line_no": [] }
av_cold void FUNC_0(VP8DSPContext *dsp) { dsp->vp8_luma_dc_wht = vp8_luma_dc_wht_c; dsp->vp8_luma_dc_wht_dc = vp8_luma_dc_wht_dc_c; dsp->vp8_idct_add = vp8_idct_add_c; dsp->vp8_idct_dc_add = vp8_idct_dc_add_c; dsp->vp8_idct_dc_add4y = vp8_idct_dc_add4y_c; dsp->vp8_idct_dc_add4uv = vp8_idct_dc_add4uv_c; dsp->vp8_v_loop_filter16y = vp8_v_loop_filter16_c; dsp->vp8_h_loop_filter16y = vp8_h_loop_filter16_c; dsp->vp8_v_loop_filter8uv = vp8_v_loop_filter8uv_c; dsp->vp8_h_loop_filter8uv = vp8_h_loop_filter8uv_c; dsp->vp8_v_loop_filter16y_inner = vp8_v_loop_filter16_inner_c; dsp->vp8_h_loop_filter16y_inner = vp8_h_loop_filter16_inner_c; dsp->vp8_v_loop_filter8uv_inner = vp8_v_loop_filter8uv_inner_c; dsp->vp8_h_loop_filter8uv_inner = vp8_h_loop_filter8uv_inner_c; dsp->vp8_v_loop_filter_simple = vp8_v_loop_filter_simple_c; dsp->vp8_h_loop_filter_simple = vp8_h_loop_filter_simple_c; VP8_MC_FUNC(0, 16); VP8_MC_FUNC(1, 8); VP8_MC_FUNC(2, 4); VP8_BILINEAR_MC_FUNC(0, 16); VP8_BILINEAR_MC_FUNC(1, 8); VP8_BILINEAR_MC_FUNC(2, 4); if (ARCH_ARM) ff_vp8dsp_init_arm(dsp); if (ARCH_PPC) ff_vp8dsp_init_ppc(dsp); if (ARCH_X86) ff_vp8dsp_init_x86(dsp); }
[ "av_cold void FUNC_0(VP8DSPContext *dsp)\n{", "dsp->vp8_luma_dc_wht = vp8_luma_dc_wht_c;", "dsp->vp8_luma_dc_wht_dc = vp8_luma_dc_wht_dc_c;", "dsp->vp8_idct_add = vp8_idct_add_c;", "dsp->vp8_idct_dc_add = vp8_idct_dc_add_c;", "dsp->vp8_idct_dc_add4y = vp8_idct_dc_add4y_c;", "dsp->vp8_idct_dc_add4uv = vp8_idct_dc_add4uv_c;", "dsp->vp8_v_loop_filter16y = vp8_v_loop_filter16_c;", "dsp->vp8_h_loop_filter16y = vp8_h_loop_filter16_c;", "dsp->vp8_v_loop_filter8uv = vp8_v_loop_filter8uv_c;", "dsp->vp8_h_loop_filter8uv = vp8_h_loop_filter8uv_c;", "dsp->vp8_v_loop_filter16y_inner = vp8_v_loop_filter16_inner_c;", "dsp->vp8_h_loop_filter16y_inner = vp8_h_loop_filter16_inner_c;", "dsp->vp8_v_loop_filter8uv_inner = vp8_v_loop_filter8uv_inner_c;", "dsp->vp8_h_loop_filter8uv_inner = vp8_h_loop_filter8uv_inner_c;", "dsp->vp8_v_loop_filter_simple = vp8_v_loop_filter_simple_c;", "dsp->vp8_h_loop_filter_simple = vp8_h_loop_filter_simple_c;", "VP8_MC_FUNC(0, 16);", "VP8_MC_FUNC(1, 8);", "VP8_MC_FUNC(2, 4);", "VP8_BILINEAR_MC_FUNC(0, 16);", "VP8_BILINEAR_MC_FUNC(1, 8);", "VP8_BILINEAR_MC_FUNC(2, 4);", "if (ARCH_ARM)\nff_vp8dsp_init_arm(dsp);", "if (ARCH_PPC)\nff_vp8dsp_init_ppc(dsp);", "if (ARCH_X86)\nff_vp8dsp_init_x86(dsp);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 61, 63 ], [ 65, 67 ], [ 69, 71 ], [ 73 ] ]
8,432
static void throttle_fix_bucket(LeakyBucket *bkt) { double min; /* zero bucket level */ bkt->level = bkt->burst_level = 0; /* The following is done to cope with the Linux CFQ block scheduler * which regroup reads and writes by block of 100ms in the guest. * When they are two process one making reads and one making writes cfq * make a pattern looking like the following: * WWWWWWWWWWWRRRRRRRRRRRRRRWWWWWWWWWWWWWwRRRRRRRRRRRRRRRRR * Having a max burst value of 100ms of the average will help smooth the * throttling */ min = bkt->avg / 10; if (bkt->avg && !bkt->max) { bkt->max = min; } }
true
qemu
0770a7a6466cc2dbf4ac91841173ad4488e1fbc7
static void throttle_fix_bucket(LeakyBucket *bkt) { double min; bkt->level = bkt->burst_level = 0; min = bkt->avg / 10; if (bkt->avg && !bkt->max) { bkt->max = min; } }
{ "code": [], "line_no": [] }
static void FUNC_0(LeakyBucket *VAR_0) { double VAR_1; VAR_0->level = VAR_0->burst_level = 0; VAR_1 = VAR_0->avg / 10; if (VAR_0->avg && !VAR_0->max) { VAR_0->max = VAR_1; } }
[ "static void FUNC_0(LeakyBucket *VAR_0)\n{", "double VAR_1;", "VAR_0->level = VAR_0->burst_level = 0;", "VAR_1 = VAR_0->avg / 10;", "if (VAR_0->avg && !VAR_0->max) {", "VAR_0->max = VAR_1;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 11 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ] ]
8,433
int net_client_init(const char *device, const char *p) { static const char * const fd_params[] = { "vlan", "name", "fd", NULL }; char buf[1024]; int vlan_id, ret; VLANState *vlan; char *name = NULL; vlan_id = 0; if (get_param_value(buf, sizeof(buf), "vlan", p)) { vlan_id = strtol(buf, NULL, 0); } vlan = qemu_find_vlan(vlan_id); if (get_param_value(buf, sizeof(buf), "name", p)) { name = strdup(buf); } if (!strcmp(device, "nic")) { static const char * const nic_params[] = { "vlan", "name", "macaddr", "model", NULL }; NICInfo *nd; uint8_t *macaddr; int idx = nic_get_free_idx(); if (check_params(nic_params, p) < 0) { fprintf(stderr, "qemu: invalid parameter in '%s'\n", p); return -1; } if (idx == -1 || nb_nics >= MAX_NICS) { fprintf(stderr, "Too Many NICs\n"); ret = -1; goto out; } nd = &nd_table[idx]; macaddr = nd->macaddr; macaddr[0] = 0x52; macaddr[1] = 0x54; macaddr[2] = 0x00; macaddr[3] = 0x12; macaddr[4] = 0x34; macaddr[5] = 0x56 + idx; if (get_param_value(buf, sizeof(buf), "macaddr", p)) { if (parse_macaddr(macaddr, buf) < 0) { fprintf(stderr, "invalid syntax for ethernet address\n"); ret = -1; goto out; } } if (get_param_value(buf, sizeof(buf), "model", p)) { nd->model = strdup(buf); } nd->vlan = vlan; nd->name = name; nd->used = 1; name = NULL; nb_nics++; vlan->nb_guest_devs++; ret = idx; } else if (!strcmp(device, "none")) { if (*p != '\0') { fprintf(stderr, "qemu: 'none' takes no parameters\n"); return -1; } /* does nothing. It is needed to signal that no network cards are wanted */ ret = 0; } else #ifdef CONFIG_SLIRP if (!strcmp(device, "user")) { static const char * const slirp_params[] = { "vlan", "name", "hostname", "restrict", "ip", NULL }; if (check_params(slirp_params, p) < 0) { fprintf(stderr, "qemu: invalid parameter in '%s'\n", p); return -1; } if (get_param_value(buf, sizeof(buf), "hostname", p)) { pstrcpy(slirp_hostname, sizeof(slirp_hostname), buf); } if (get_param_value(buf, sizeof(buf), "restrict", p)) { slirp_restrict = (buf[0] == 'y') ? 1 : 0; } if (get_param_value(buf, sizeof(buf), "ip", p)) { slirp_ip = strdup(buf); } vlan->nb_host_devs++; ret = net_slirp_init(vlan, device, name); } else if (!strcmp(device, "channel")) { long port; char name[20], *devname; struct VMChannel *vmc; port = strtol(p, &devname, 10); devname++; if (port < 1 || port > 65535) { fprintf(stderr, "vmchannel wrong port number\n"); ret = -1; goto out; } vmc = malloc(sizeof(struct VMChannel)); snprintf(name, 20, "vmchannel%ld", port); vmc->hd = qemu_chr_open(name, devname, NULL); if (!vmc->hd) { fprintf(stderr, "qemu: could not open vmchannel device" "'%s'\n", devname); ret = -1; goto out; } vmc->port = port; slirp_add_exec(3, vmc->hd, 4, port); qemu_chr_add_handlers(vmc->hd, vmchannel_can_read, vmchannel_read, NULL, vmc); ret = 0; } else #endif #ifdef _WIN32 if (!strcmp(device, "tap")) { static const char * const tap_params[] = { "vlan", "name", "ifname", NULL }; char ifname[64]; if (check_params(tap_params, p) < 0) { fprintf(stderr, "qemu: invalid parameter in '%s'\n", p); return -1; } if (get_param_value(ifname, sizeof(ifname), "ifname", p) <= 0) { fprintf(stderr, "tap: no interface name\n"); ret = -1; goto out; } vlan->nb_host_devs++; ret = tap_win32_init(vlan, device, name, ifname); } else #elif defined (_AIX) #else if (!strcmp(device, "tap")) { char ifname[64]; char setup_script[1024], down_script[1024]; int fd; vlan->nb_host_devs++; if (get_param_value(buf, sizeof(buf), "fd", p) > 0) { if (check_params(fd_params, p) < 0) { fprintf(stderr, "qemu: invalid parameter in '%s'\n", p); return -1; } fd = strtol(buf, NULL, 0); fcntl(fd, F_SETFL, O_NONBLOCK); net_tap_fd_init(vlan, device, name, fd); ret = 0; } else { static const char * const tap_params[] = { "vlan", "name", "ifname", "script", "downscript", NULL }; if (check_params(tap_params, p) < 0) { fprintf(stderr, "qemu: invalid parameter in '%s'\n", p); return -1; } if (get_param_value(ifname, sizeof(ifname), "ifname", p) <= 0) { ifname[0] = '\0'; } if (get_param_value(setup_script, sizeof(setup_script), "script", p) == 0) { pstrcpy(setup_script, sizeof(setup_script), DEFAULT_NETWORK_SCRIPT); } if (get_param_value(down_script, sizeof(down_script), "downscript", p) == 0) { pstrcpy(down_script, sizeof(down_script), DEFAULT_NETWORK_DOWN_SCRIPT); } ret = net_tap_init(vlan, device, name, ifname, setup_script, down_script); } } else #endif if (!strcmp(device, "socket")) { if (get_param_value(buf, sizeof(buf), "fd", p) > 0) { int fd; if (check_params(fd_params, p) < 0) { fprintf(stderr, "qemu: invalid parameter in '%s'\n", p); return -1; } fd = strtol(buf, NULL, 0); ret = -1; if (net_socket_fd_init(vlan, device, name, fd, 1)) ret = 0; } else if (get_param_value(buf, sizeof(buf), "listen", p) > 0) { static const char * const listen_params[] = { "vlan", "name", "listen", NULL }; if (check_params(listen_params, p) < 0) { fprintf(stderr, "qemu: invalid parameter in '%s'\n", p); return -1; } ret = net_socket_listen_init(vlan, device, name, buf); } else if (get_param_value(buf, sizeof(buf), "connect", p) > 0) { static const char * const connect_params[] = { "vlan", "name", "connect", NULL }; if (check_params(connect_params, p) < 0) { fprintf(stderr, "qemu: invalid parameter in '%s'\n", p); return -1; } ret = net_socket_connect_init(vlan, device, name, buf); } else if (get_param_value(buf, sizeof(buf), "mcast", p) > 0) { static const char * const mcast_params[] = { "vlan", "name", "mcast", NULL }; if (check_params(mcast_params, p) < 0) { fprintf(stderr, "qemu: invalid parameter in '%s'\n", p); return -1; } ret = net_socket_mcast_init(vlan, device, name, buf); } else { fprintf(stderr, "Unknown socket options: %s\n", p); ret = -1; goto out; } vlan->nb_host_devs++; } else #ifdef CONFIG_VDE if (!strcmp(device, "vde")) { static const char * const vde_params[] = { "vlan", "name", "sock", "port", "group", "mode", NULL }; char vde_sock[1024], vde_group[512]; int vde_port, vde_mode; if (check_params(vde_params, p) < 0) { fprintf(stderr, "qemu: invalid parameter in '%s'\n", p); return -1; } vlan->nb_host_devs++; if (get_param_value(vde_sock, sizeof(vde_sock), "sock", p) <= 0) { vde_sock[0] = '\0'; } if (get_param_value(buf, sizeof(buf), "port", p) > 0) { vde_port = strtol(buf, NULL, 10); } else { vde_port = 0; } if (get_param_value(vde_group, sizeof(vde_group), "group", p) <= 0) { vde_group[0] = '\0'; } if (get_param_value(buf, sizeof(buf), "mode", p) > 0) { vde_mode = strtol(buf, NULL, 8); } else { vde_mode = 0700; } ret = net_vde_init(vlan, device, name, vde_sock, vde_port, vde_group, vde_mode); } else #endif if (!strcmp(device, "dump")) { int len = 65536; if (get_param_value(buf, sizeof(buf), "len", p) > 0) { len = strtol(buf, NULL, 0); } if (!get_param_value(buf, sizeof(buf), "file", p)) { snprintf(buf, sizeof(buf), "qemu-vlan%d.pcap", vlan_id); } ret = net_dump_init(vlan, device, name, buf, len); } else { fprintf(stderr, "Unknown network device: %s\n", device); ret = -1; goto out; } if (ret < 0) { fprintf(stderr, "Could not initialize device '%s'\n", device); } out: if (name) free(name); return ret; }
true
qemu
cda94b27821726df74eead0701d8401c1acda6ec
int net_client_init(const char *device, const char *p) { static const char * const fd_params[] = { "vlan", "name", "fd", NULL }; char buf[1024]; int vlan_id, ret; VLANState *vlan; char *name = NULL; vlan_id = 0; if (get_param_value(buf, sizeof(buf), "vlan", p)) { vlan_id = strtol(buf, NULL, 0); } vlan = qemu_find_vlan(vlan_id); if (get_param_value(buf, sizeof(buf), "name", p)) { name = strdup(buf); } if (!strcmp(device, "nic")) { static const char * const nic_params[] = { "vlan", "name", "macaddr", "model", NULL }; NICInfo *nd; uint8_t *macaddr; int idx = nic_get_free_idx(); if (check_params(nic_params, p) < 0) { fprintf(stderr, "qemu: invalid parameter in '%s'\n", p); return -1; } if (idx == -1 || nb_nics >= MAX_NICS) { fprintf(stderr, "Too Many NICs\n"); ret = -1; goto out; } nd = &nd_table[idx]; macaddr = nd->macaddr; macaddr[0] = 0x52; macaddr[1] = 0x54; macaddr[2] = 0x00; macaddr[3] = 0x12; macaddr[4] = 0x34; macaddr[5] = 0x56 + idx; if (get_param_value(buf, sizeof(buf), "macaddr", p)) { if (parse_macaddr(macaddr, buf) < 0) { fprintf(stderr, "invalid syntax for ethernet address\n"); ret = -1; goto out; } } if (get_param_value(buf, sizeof(buf), "model", p)) { nd->model = strdup(buf); } nd->vlan = vlan; nd->name = name; nd->used = 1; name = NULL; nb_nics++; vlan->nb_guest_devs++; ret = idx; } else if (!strcmp(device, "none")) { if (*p != '\0') { fprintf(stderr, "qemu: 'none' takes no parameters\n"); return -1; } ret = 0; } else #ifdef CONFIG_SLIRP if (!strcmp(device, "user")) { static const char * const slirp_params[] = { "vlan", "name", "hostname", "restrict", "ip", NULL }; if (check_params(slirp_params, p) < 0) { fprintf(stderr, "qemu: invalid parameter in '%s'\n", p); return -1; } if (get_param_value(buf, sizeof(buf), "hostname", p)) { pstrcpy(slirp_hostname, sizeof(slirp_hostname), buf); } if (get_param_value(buf, sizeof(buf), "restrict", p)) { slirp_restrict = (buf[0] == 'y') ? 1 : 0; } if (get_param_value(buf, sizeof(buf), "ip", p)) { slirp_ip = strdup(buf); } vlan->nb_host_devs++; ret = net_slirp_init(vlan, device, name); } else if (!strcmp(device, "channel")) { long port; char name[20], *devname; struct VMChannel *vmc; port = strtol(p, &devname, 10); devname++; if (port < 1 || port > 65535) { fprintf(stderr, "vmchannel wrong port number\n"); ret = -1; goto out; } vmc = malloc(sizeof(struct VMChannel)); snprintf(name, 20, "vmchannel%ld", port); vmc->hd = qemu_chr_open(name, devname, NULL); if (!vmc->hd) { fprintf(stderr, "qemu: could not open vmchannel device" "'%s'\n", devname); ret = -1; goto out; } vmc->port = port; slirp_add_exec(3, vmc->hd, 4, port); qemu_chr_add_handlers(vmc->hd, vmchannel_can_read, vmchannel_read, NULL, vmc); ret = 0; } else #endif #ifdef _WIN32 if (!strcmp(device, "tap")) { static const char * const tap_params[] = { "vlan", "name", "ifname", NULL }; char ifname[64]; if (check_params(tap_params, p) < 0) { fprintf(stderr, "qemu: invalid parameter in '%s'\n", p); return -1; } if (get_param_value(ifname, sizeof(ifname), "ifname", p) <= 0) { fprintf(stderr, "tap: no interface name\n"); ret = -1; goto out; } vlan->nb_host_devs++; ret = tap_win32_init(vlan, device, name, ifname); } else #elif defined (_AIX) #else if (!strcmp(device, "tap")) { char ifname[64]; char setup_script[1024], down_script[1024]; int fd; vlan->nb_host_devs++; if (get_param_value(buf, sizeof(buf), "fd", p) > 0) { if (check_params(fd_params, p) < 0) { fprintf(stderr, "qemu: invalid parameter in '%s'\n", p); return -1; } fd = strtol(buf, NULL, 0); fcntl(fd, F_SETFL, O_NONBLOCK); net_tap_fd_init(vlan, device, name, fd); ret = 0; } else { static const char * const tap_params[] = { "vlan", "name", "ifname", "script", "downscript", NULL }; if (check_params(tap_params, p) < 0) { fprintf(stderr, "qemu: invalid parameter in '%s'\n", p); return -1; } if (get_param_value(ifname, sizeof(ifname), "ifname", p) <= 0) { ifname[0] = '\0'; } if (get_param_value(setup_script, sizeof(setup_script), "script", p) == 0) { pstrcpy(setup_script, sizeof(setup_script), DEFAULT_NETWORK_SCRIPT); } if (get_param_value(down_script, sizeof(down_script), "downscript", p) == 0) { pstrcpy(down_script, sizeof(down_script), DEFAULT_NETWORK_DOWN_SCRIPT); } ret = net_tap_init(vlan, device, name, ifname, setup_script, down_script); } } else #endif if (!strcmp(device, "socket")) { if (get_param_value(buf, sizeof(buf), "fd", p) > 0) { int fd; if (check_params(fd_params, p) < 0) { fprintf(stderr, "qemu: invalid parameter in '%s'\n", p); return -1; } fd = strtol(buf, NULL, 0); ret = -1; if (net_socket_fd_init(vlan, device, name, fd, 1)) ret = 0; } else if (get_param_value(buf, sizeof(buf), "listen", p) > 0) { static const char * const listen_params[] = { "vlan", "name", "listen", NULL }; if (check_params(listen_params, p) < 0) { fprintf(stderr, "qemu: invalid parameter in '%s'\n", p); return -1; } ret = net_socket_listen_init(vlan, device, name, buf); } else if (get_param_value(buf, sizeof(buf), "connect", p) > 0) { static const char * const connect_params[] = { "vlan", "name", "connect", NULL }; if (check_params(connect_params, p) < 0) { fprintf(stderr, "qemu: invalid parameter in '%s'\n", p); return -1; } ret = net_socket_connect_init(vlan, device, name, buf); } else if (get_param_value(buf, sizeof(buf), "mcast", p) > 0) { static const char * const mcast_params[] = { "vlan", "name", "mcast", NULL }; if (check_params(mcast_params, p) < 0) { fprintf(stderr, "qemu: invalid parameter in '%s'\n", p); return -1; } ret = net_socket_mcast_init(vlan, device, name, buf); } else { fprintf(stderr, "Unknown socket options: %s\n", p); ret = -1; goto out; } vlan->nb_host_devs++; } else #ifdef CONFIG_VDE if (!strcmp(device, "vde")) { static const char * const vde_params[] = { "vlan", "name", "sock", "port", "group", "mode", NULL }; char vde_sock[1024], vde_group[512]; int vde_port, vde_mode; if (check_params(vde_params, p) < 0) { fprintf(stderr, "qemu: invalid parameter in '%s'\n", p); return -1; } vlan->nb_host_devs++; if (get_param_value(vde_sock, sizeof(vde_sock), "sock", p) <= 0) { vde_sock[0] = '\0'; } if (get_param_value(buf, sizeof(buf), "port", p) > 0) { vde_port = strtol(buf, NULL, 10); } else { vde_port = 0; } if (get_param_value(vde_group, sizeof(vde_group), "group", p) <= 0) { vde_group[0] = '\0'; } if (get_param_value(buf, sizeof(buf), "mode", p) > 0) { vde_mode = strtol(buf, NULL, 8); } else { vde_mode = 0700; } ret = net_vde_init(vlan, device, name, vde_sock, vde_port, vde_group, vde_mode); } else #endif if (!strcmp(device, "dump")) { int len = 65536; if (get_param_value(buf, sizeof(buf), "len", p) > 0) { len = strtol(buf, NULL, 0); } if (!get_param_value(buf, sizeof(buf), "file", p)) { snprintf(buf, sizeof(buf), "qemu-vlan%d.pcap", vlan_id); } ret = net_dump_init(vlan, device, name, buf, len); } else { fprintf(stderr, "Unknown network device: %s\n", device); ret = -1; goto out; } if (ret < 0) { fprintf(stderr, "Could not initialize device '%s'\n", device); } out: if (name) free(name); return ret; }
{ "code": [ " fprintf(stderr, \"qemu: invalid parameter in '%s'\\n\", p);", " fprintf(stderr, \"qemu: invalid parameter in '%s'\\n\", p);", " fprintf(stderr, \"qemu: invalid parameter in '%s'\\n\", p);", " fprintf(stderr, \"qemu: invalid parameter in '%s'\\n\", p);", " fprintf(stderr, \"qemu: invalid parameter in '%s'\\n\", p);", " fprintf(stderr, \"qemu: invalid parameter in '%s'\\n\", p);", " fprintf(stderr, \"qemu: invalid parameter in '%s'\\n\", p);", " fprintf(stderr, \"qemu: invalid parameter in '%s'\\n\", p);", " fprintf(stderr, \"qemu: invalid parameter in '%s'\\n\", p);", " fprintf(stderr, \"qemu: invalid parameter in '%s'\\n\", p);" ], "line_no": [ 57, 57, 57, 297, 297, 297, 297, 297, 297, 57 ] }
int FUNC_0(const char *VAR_0, const char *VAR_1) { static const char * const VAR_2[] = { "vlan", "VAR_6", "VAR_14", NULL }; char VAR_3[1024]; int VAR_4, VAR_5; VLANState *vlan; char *VAR_6 = NULL; VAR_4 = 0; if (get_param_value(VAR_3, sizeof(VAR_3), "vlan", VAR_1)) { VAR_4 = strtol(VAR_3, NULL, 0); } vlan = qemu_find_vlan(VAR_4); if (get_param_value(VAR_3, sizeof(VAR_3), "VAR_6", VAR_1)) { VAR_6 = strdup(VAR_3); } if (!strcmp(VAR_0, "nic")) { static const char * const VAR_7[] = { "vlan", "VAR_6", "macaddr", "model", NULL }; NICInfo *nd; uint8_t *macaddr; int VAR_8 = nic_get_free_idx(); if (check_params(VAR_7, VAR_1) < 0) { fprintf(stderr, "qemu: invalid parameter in '%s'\n", VAR_1); return -1; } if (VAR_8 == -1 || nb_nics >= MAX_NICS) { fprintf(stderr, "Too Many NICs\n"); VAR_5 = -1; goto out; } nd = &nd_table[VAR_8]; macaddr = nd->macaddr; macaddr[0] = 0x52; macaddr[1] = 0x54; macaddr[2] = 0x00; macaddr[3] = 0x12; macaddr[4] = 0x34; macaddr[5] = 0x56 + VAR_8; if (get_param_value(VAR_3, sizeof(VAR_3), "macaddr", VAR_1)) { if (parse_macaddr(macaddr, VAR_3) < 0) { fprintf(stderr, "invalid syntax for ethernet address\n"); VAR_5 = -1; goto out; } } if (get_param_value(VAR_3, sizeof(VAR_3), "model", VAR_1)) { nd->model = strdup(VAR_3); } nd->vlan = vlan; nd->VAR_6 = VAR_6; nd->used = 1; VAR_6 = NULL; nb_nics++; vlan->nb_guest_devs++; VAR_5 = VAR_8; } else if (!strcmp(VAR_0, "none")) { if (*VAR_1 != '\0') { fprintf(stderr, "qemu: 'none' takes no parameters\n"); return -1; } VAR_5 = 0; } else #ifdef CONFIG_SLIRP if (!strcmp(VAR_0, "user")) { static const char * const slirp_params[] = { "vlan", "VAR_6", "hostname", "restrict", "ip", NULL }; if (check_params(slirp_params, VAR_1) < 0) { fprintf(stderr, "qemu: invalid parameter in '%s'\n", VAR_1); return -1; } if (get_param_value(VAR_3, sizeof(VAR_3), "hostname", VAR_1)) { pstrcpy(slirp_hostname, sizeof(slirp_hostname), VAR_3); } if (get_param_value(VAR_3, sizeof(VAR_3), "restrict", VAR_1)) { slirp_restrict = (VAR_3[0] == 'y') ? 1 : 0; } if (get_param_value(VAR_3, sizeof(VAR_3), "ip", VAR_1)) { slirp_ip = strdup(VAR_3); } vlan->nb_host_devs++; VAR_5 = net_slirp_init(vlan, VAR_0, VAR_6); } else if (!strcmp(VAR_0, "channel")) { long port; char VAR_6[20], *devname; struct VMChannel *vmc; port = strtol(VAR_1, &devname, 10); devname++; if (port < 1 || port > 65535) { fprintf(stderr, "vmchannel wrong port number\n"); VAR_5 = -1; goto out; } vmc = malloc(sizeof(struct VMChannel)); snprintf(VAR_6, 20, "vmchannel%ld", port); vmc->hd = qemu_chr_open(VAR_6, devname, NULL); if (!vmc->hd) { fprintf(stderr, "qemu: could not open vmchannel VAR_0" "'%s'\n", devname); VAR_5 = -1; goto out; } vmc->port = port; slirp_add_exec(3, vmc->hd, 4, port); qemu_chr_add_handlers(vmc->hd, vmchannel_can_read, vmchannel_read, NULL, vmc); VAR_5 = 0; } else #endif #ifdef _WIN32 if (!strcmp(VAR_0, "tap")) { static const char * const VAR_13[] = { "vlan", "VAR_6", "VAR_9", NULL }; char VAR_9[64]; if (check_params(VAR_13, VAR_1) < 0) { fprintf(stderr, "qemu: invalid parameter in '%s'\n", VAR_1); return -1; } if (get_param_value(VAR_9, sizeof(VAR_9), "VAR_9", VAR_1) <= 0) { fprintf(stderr, "tap: no interface VAR_6\n"); VAR_5 = -1; goto out; } vlan->nb_host_devs++; VAR_5 = tap_win32_init(vlan, VAR_0, VAR_6, VAR_9); } else #elif defined (_AIX) #else if (!strcmp(VAR_0, "tap")) { char VAR_9[64]; char VAR_10[1024], VAR_11[1024]; int VAR_14; vlan->nb_host_devs++; if (get_param_value(VAR_3, sizeof(VAR_3), "VAR_14", VAR_1) > 0) { if (check_params(VAR_2, VAR_1) < 0) { fprintf(stderr, "qemu: invalid parameter in '%s'\n", VAR_1); return -1; } VAR_14 = strtol(VAR_3, NULL, 0); fcntl(VAR_14, F_SETFL, O_NONBLOCK); net_tap_fd_init(vlan, VAR_0, VAR_6, VAR_14); VAR_5 = 0; } else { static const char * const VAR_13[] = { "vlan", "VAR_6", "VAR_9", "script", "downscript", NULL }; if (check_params(VAR_13, VAR_1) < 0) { fprintf(stderr, "qemu: invalid parameter in '%s'\n", VAR_1); return -1; } if (get_param_value(VAR_9, sizeof(VAR_9), "VAR_9", VAR_1) <= 0) { VAR_9[0] = '\0'; } if (get_param_value(VAR_10, sizeof(VAR_10), "script", VAR_1) == 0) { pstrcpy(VAR_10, sizeof(VAR_10), DEFAULT_NETWORK_SCRIPT); } if (get_param_value(VAR_11, sizeof(VAR_11), "downscript", VAR_1) == 0) { pstrcpy(VAR_11, sizeof(VAR_11), DEFAULT_NETWORK_DOWN_SCRIPT); } VAR_5 = net_tap_init(vlan, VAR_0, VAR_6, VAR_9, VAR_10, VAR_11); } } else #endif if (!strcmp(VAR_0, "socket")) { if (get_param_value(VAR_3, sizeof(VAR_3), "VAR_14", VAR_1) > 0) { int VAR_14; if (check_params(VAR_2, VAR_1) < 0) { fprintf(stderr, "qemu: invalid parameter in '%s'\n", VAR_1); return -1; } VAR_14 = strtol(VAR_3, NULL, 0); VAR_5 = -1; if (net_socket_fd_init(vlan, VAR_0, VAR_6, VAR_14, 1)) VAR_5 = 0; } else if (get_param_value(VAR_3, sizeof(VAR_3), "listen", VAR_1) > 0) { static const char * const VAR_14[] = { "vlan", "VAR_6", "listen", NULL }; if (check_params(VAR_14, VAR_1) < 0) { fprintf(stderr, "qemu: invalid parameter in '%s'\n", VAR_1); return -1; } VAR_5 = net_socket_listen_init(vlan, VAR_0, VAR_6, VAR_3); } else if (get_param_value(VAR_3, sizeof(VAR_3), "connect", VAR_1) > 0) { static const char * const VAR_15[] = { "vlan", "VAR_6", "connect", NULL }; if (check_params(VAR_15, VAR_1) < 0) { fprintf(stderr, "qemu: invalid parameter in '%s'\n", VAR_1); return -1; } VAR_5 = net_socket_connect_init(vlan, VAR_0, VAR_6, VAR_3); } else if (get_param_value(VAR_3, sizeof(VAR_3), "mcast", VAR_1) > 0) { static const char * const VAR_16[] = { "vlan", "VAR_6", "mcast", NULL }; if (check_params(VAR_16, VAR_1) < 0) { fprintf(stderr, "qemu: invalid parameter in '%s'\n", VAR_1); return -1; } VAR_5 = net_socket_mcast_init(vlan, VAR_0, VAR_6, VAR_3); } else { fprintf(stderr, "Unknown socket options: %s\n", VAR_1); VAR_5 = -1; goto out; } vlan->nb_host_devs++; } else #ifdef CONFIG_VDE if (!strcmp(VAR_0, "vde")) { static const char * const vde_params[] = { "vlan", "VAR_6", "sock", "port", "group", "mode", NULL }; char vde_sock[1024], vde_group[512]; int vde_port, vde_mode; if (check_params(vde_params, VAR_1) < 0) { fprintf(stderr, "qemu: invalid parameter in '%s'\n", VAR_1); return -1; } vlan->nb_host_devs++; if (get_param_value(vde_sock, sizeof(vde_sock), "sock", VAR_1) <= 0) { vde_sock[0] = '\0'; } if (get_param_value(VAR_3, sizeof(VAR_3), "port", VAR_1) > 0) { vde_port = strtol(VAR_3, NULL, 10); } else { vde_port = 0; } if (get_param_value(vde_group, sizeof(vde_group), "group", VAR_1) <= 0) { vde_group[0] = '\0'; } if (get_param_value(VAR_3, sizeof(VAR_3), "mode", VAR_1) > 0) { vde_mode = strtol(VAR_3, NULL, 8); } else { vde_mode = 0700; } VAR_5 = net_vde_init(vlan, VAR_0, VAR_6, vde_sock, vde_port, vde_group, vde_mode); } else #endif if (!strcmp(VAR_0, "dump")) { int VAR_17 = 65536; if (get_param_value(VAR_3, sizeof(VAR_3), "VAR_17", VAR_1) > 0) { VAR_17 = strtol(VAR_3, NULL, 0); } if (!get_param_value(VAR_3, sizeof(VAR_3), "file", VAR_1)) { snprintf(VAR_3, sizeof(VAR_3), "qemu-vlan%d.pcap", VAR_4); } VAR_5 = net_dump_init(vlan, VAR_0, VAR_6, VAR_3, VAR_17); } else { fprintf(stderr, "Unknown network VAR_0: %s\n", VAR_0); VAR_5 = -1; goto out; } if (VAR_5 < 0) { fprintf(stderr, "Could not initialize VAR_0 '%s'\n", VAR_0); } out: if (VAR_6) free(VAR_6); return VAR_5; }
[ "int FUNC_0(const char *VAR_0, const char *VAR_1)\n{", "static const char * const VAR_2[] = {", "\"vlan\", \"VAR_6\", \"VAR_14\", NULL\n};", "char VAR_3[1024];", "int VAR_4, VAR_5;", "VLANState *vlan;", "char *VAR_6 = NULL;", "VAR_4 = 0;", "if (get_param_value(VAR_3, sizeof(VAR_3), \"vlan\", VAR_1)) {", "VAR_4 = strtol(VAR_3, NULL, 0);", "}", "vlan = qemu_find_vlan(VAR_4);", "if (get_param_value(VAR_3, sizeof(VAR_3), \"VAR_6\", VAR_1)) {", "VAR_6 = strdup(VAR_3);", "}", "if (!strcmp(VAR_0, \"nic\")) {", "static const char * const VAR_7[] = {", "\"vlan\", \"VAR_6\", \"macaddr\", \"model\", NULL\n};", "NICInfo *nd;", "uint8_t *macaddr;", "int VAR_8 = nic_get_free_idx();", "if (check_params(VAR_7, VAR_1) < 0) {", "fprintf(stderr, \"qemu: invalid parameter in '%s'\\n\", VAR_1);", "return -1;", "}", "if (VAR_8 == -1 || nb_nics >= MAX_NICS) {", "fprintf(stderr, \"Too Many NICs\\n\");", "VAR_5 = -1;", "goto out;", "}", "nd = &nd_table[VAR_8];", "macaddr = nd->macaddr;", "macaddr[0] = 0x52;", "macaddr[1] = 0x54;", "macaddr[2] = 0x00;", "macaddr[3] = 0x12;", "macaddr[4] = 0x34;", "macaddr[5] = 0x56 + VAR_8;", "if (get_param_value(VAR_3, sizeof(VAR_3), \"macaddr\", VAR_1)) {", "if (parse_macaddr(macaddr, VAR_3) < 0) {", "fprintf(stderr, \"invalid syntax for ethernet address\\n\");", "VAR_5 = -1;", "goto out;", "}", "}", "if (get_param_value(VAR_3, sizeof(VAR_3), \"model\", VAR_1)) {", "nd->model = strdup(VAR_3);", "}", "nd->vlan = vlan;", "nd->VAR_6 = VAR_6;", "nd->used = 1;", "VAR_6 = NULL;", "nb_nics++;", "vlan->nb_guest_devs++;", "VAR_5 = VAR_8;", "} else", "if (!strcmp(VAR_0, \"none\")) {", "if (*VAR_1 != '\\0') {", "fprintf(stderr, \"qemu: 'none' takes no parameters\\n\");", "return -1;", "}", "VAR_5 = 0;", "} else", "#ifdef CONFIG_SLIRP\nif (!strcmp(VAR_0, \"user\")) {", "static const char * const slirp_params[] = {", "\"vlan\", \"VAR_6\", \"hostname\", \"restrict\", \"ip\", NULL\n};", "if (check_params(slirp_params, VAR_1) < 0) {", "fprintf(stderr, \"qemu: invalid parameter in '%s'\\n\", VAR_1);", "return -1;", "}", "if (get_param_value(VAR_3, sizeof(VAR_3), \"hostname\", VAR_1)) {", "pstrcpy(slirp_hostname, sizeof(slirp_hostname), VAR_3);", "}", "if (get_param_value(VAR_3, sizeof(VAR_3), \"restrict\", VAR_1)) {", "slirp_restrict = (VAR_3[0] == 'y') ? 1 : 0;", "}", "if (get_param_value(VAR_3, sizeof(VAR_3), \"ip\", VAR_1)) {", "slirp_ip = strdup(VAR_3);", "}", "vlan->nb_host_devs++;", "VAR_5 = net_slirp_init(vlan, VAR_0, VAR_6);", "} else if (!strcmp(VAR_0, \"channel\")) {", "long port;", "char VAR_6[20], *devname;", "struct VMChannel *vmc;", "port = strtol(VAR_1, &devname, 10);", "devname++;", "if (port < 1 || port > 65535) {", "fprintf(stderr, \"vmchannel wrong port number\\n\");", "VAR_5 = -1;", "goto out;", "}", "vmc = malloc(sizeof(struct VMChannel));", "snprintf(VAR_6, 20, \"vmchannel%ld\", port);", "vmc->hd = qemu_chr_open(VAR_6, devname, NULL);", "if (!vmc->hd) {", "fprintf(stderr, \"qemu: could not open vmchannel VAR_0\"\n\"'%s'\\n\", devname);", "VAR_5 = -1;", "goto out;", "}", "vmc->port = port;", "slirp_add_exec(3, vmc->hd, 4, port);", "qemu_chr_add_handlers(vmc->hd, vmchannel_can_read, vmchannel_read,\nNULL, vmc);", "VAR_5 = 0;", "} else", "#endif\n#ifdef _WIN32\nif (!strcmp(VAR_0, \"tap\")) {", "static const char * const VAR_13[] = {", "\"vlan\", \"VAR_6\", \"VAR_9\", NULL\n};", "char VAR_9[64];", "if (check_params(VAR_13, VAR_1) < 0) {", "fprintf(stderr, \"qemu: invalid parameter in '%s'\\n\", VAR_1);", "return -1;", "}", "if (get_param_value(VAR_9, sizeof(VAR_9), \"VAR_9\", VAR_1) <= 0) {", "fprintf(stderr, \"tap: no interface VAR_6\\n\");", "VAR_5 = -1;", "goto out;", "}", "vlan->nb_host_devs++;", "VAR_5 = tap_win32_init(vlan, VAR_0, VAR_6, VAR_9);", "} else", "#elif defined (_AIX)\n#else\nif (!strcmp(VAR_0, \"tap\")) {", "char VAR_9[64];", "char VAR_10[1024], VAR_11[1024];", "int VAR_14;", "vlan->nb_host_devs++;", "if (get_param_value(VAR_3, sizeof(VAR_3), \"VAR_14\", VAR_1) > 0) {", "if (check_params(VAR_2, VAR_1) < 0) {", "fprintf(stderr, \"qemu: invalid parameter in '%s'\\n\", VAR_1);", "return -1;", "}", "VAR_14 = strtol(VAR_3, NULL, 0);", "fcntl(VAR_14, F_SETFL, O_NONBLOCK);", "net_tap_fd_init(vlan, VAR_0, VAR_6, VAR_14);", "VAR_5 = 0;", "} else {", "static const char * const VAR_13[] = {", "\"vlan\", \"VAR_6\", \"VAR_9\", \"script\", \"downscript\", NULL\n};", "if (check_params(VAR_13, VAR_1) < 0) {", "fprintf(stderr, \"qemu: invalid parameter in '%s'\\n\", VAR_1);", "return -1;", "}", "if (get_param_value(VAR_9, sizeof(VAR_9), \"VAR_9\", VAR_1) <= 0) {", "VAR_9[0] = '\\0';", "}", "if (get_param_value(VAR_10, sizeof(VAR_10), \"script\", VAR_1) == 0) {", "pstrcpy(VAR_10, sizeof(VAR_10), DEFAULT_NETWORK_SCRIPT);", "}", "if (get_param_value(VAR_11, sizeof(VAR_11), \"downscript\", VAR_1) == 0) {", "pstrcpy(VAR_11, sizeof(VAR_11), DEFAULT_NETWORK_DOWN_SCRIPT);", "}", "VAR_5 = net_tap_init(vlan, VAR_0, VAR_6, VAR_9, VAR_10, VAR_11);", "}", "} else", "#endif\nif (!strcmp(VAR_0, \"socket\")) {", "if (get_param_value(VAR_3, sizeof(VAR_3), \"VAR_14\", VAR_1) > 0) {", "int VAR_14;", "if (check_params(VAR_2, VAR_1) < 0) {", "fprintf(stderr, \"qemu: invalid parameter in '%s'\\n\", VAR_1);", "return -1;", "}", "VAR_14 = strtol(VAR_3, NULL, 0);", "VAR_5 = -1;", "if (net_socket_fd_init(vlan, VAR_0, VAR_6, VAR_14, 1))\nVAR_5 = 0;", "} else if (get_param_value(VAR_3, sizeof(VAR_3), \"listen\", VAR_1) > 0) {", "static const char * const VAR_14[] = {", "\"vlan\", \"VAR_6\", \"listen\", NULL\n};", "if (check_params(VAR_14, VAR_1) < 0) {", "fprintf(stderr, \"qemu: invalid parameter in '%s'\\n\", VAR_1);", "return -1;", "}", "VAR_5 = net_socket_listen_init(vlan, VAR_0, VAR_6, VAR_3);", "} else if (get_param_value(VAR_3, sizeof(VAR_3), \"connect\", VAR_1) > 0) {", "static const char * const VAR_15[] = {", "\"vlan\", \"VAR_6\", \"connect\", NULL\n};", "if (check_params(VAR_15, VAR_1) < 0) {", "fprintf(stderr, \"qemu: invalid parameter in '%s'\\n\", VAR_1);", "return -1;", "}", "VAR_5 = net_socket_connect_init(vlan, VAR_0, VAR_6, VAR_3);", "} else if (get_param_value(VAR_3, sizeof(VAR_3), \"mcast\", VAR_1) > 0) {", "static const char * const VAR_16[] = {", "\"vlan\", \"VAR_6\", \"mcast\", NULL\n};", "if (check_params(VAR_16, VAR_1) < 0) {", "fprintf(stderr, \"qemu: invalid parameter in '%s'\\n\", VAR_1);", "return -1;", "}", "VAR_5 = net_socket_mcast_init(vlan, VAR_0, VAR_6, VAR_3);", "} else {", "fprintf(stderr, \"Unknown socket options: %s\\n\", VAR_1);", "VAR_5 = -1;", "goto out;", "}", "vlan->nb_host_devs++;", "} else", "#ifdef CONFIG_VDE\nif (!strcmp(VAR_0, \"vde\")) {", "static const char * const vde_params[] = {", "\"vlan\", \"VAR_6\", \"sock\", \"port\", \"group\", \"mode\", NULL\n};", "char vde_sock[1024], vde_group[512];", "int vde_port, vde_mode;", "if (check_params(vde_params, VAR_1) < 0) {", "fprintf(stderr, \"qemu: invalid parameter in '%s'\\n\", VAR_1);", "return -1;", "}", "vlan->nb_host_devs++;", "if (get_param_value(vde_sock, sizeof(vde_sock), \"sock\", VAR_1) <= 0) {", "vde_sock[0] = '\\0';", "}", "if (get_param_value(VAR_3, sizeof(VAR_3), \"port\", VAR_1) > 0) {", "vde_port = strtol(VAR_3, NULL, 10);", "} else {", "vde_port = 0;", "}", "if (get_param_value(vde_group, sizeof(vde_group), \"group\", VAR_1) <= 0) {", "vde_group[0] = '\\0';", "}", "if (get_param_value(VAR_3, sizeof(VAR_3), \"mode\", VAR_1) > 0) {", "vde_mode = strtol(VAR_3, NULL, 8);", "} else {", "vde_mode = 0700;", "}", "VAR_5 = net_vde_init(vlan, VAR_0, VAR_6, vde_sock, vde_port, vde_group, vde_mode);", "} else", "#endif\nif (!strcmp(VAR_0, \"dump\")) {", "int VAR_17 = 65536;", "if (get_param_value(VAR_3, sizeof(VAR_3), \"VAR_17\", VAR_1) > 0) {", "VAR_17 = strtol(VAR_3, NULL, 0);", "}", "if (!get_param_value(VAR_3, sizeof(VAR_3), \"file\", VAR_1)) {", "snprintf(VAR_3, sizeof(VAR_3), \"qemu-vlan%d.pcap\", VAR_4);", "}", "VAR_5 = net_dump_init(vlan, VAR_0, VAR_6, VAR_3, VAR_17);", "} else {", "fprintf(stderr, \"Unknown network VAR_0: %s\\n\", VAR_0);", "VAR_5 = -1;", "goto out;", "}", "if (VAR_5 < 0) {", "fprintf(stderr, \"Could not initialize VAR_0 '%s'\\n\", VAR_0);", "}", "out:\nif (VAR_6)\nfree(VAR_6);", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 141 ], [ 143 ], [ 145, 147 ], [ 149 ], [ 151, 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217, 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231, 233 ], [ 235 ], [ 237 ], [ 239, 241, 243 ], [ 245 ], [ 247, 249 ], [ 251 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279, 281, 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315, 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351, 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371, 373 ], [ 375 ], [ 377 ], [ 379, 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 395 ], [ 397, 399 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ], [ 409 ], [ 411 ], [ 413 ], [ 415, 417 ], [ 419 ], [ 421 ], [ 423 ], [ 425 ], [ 427 ], [ 429 ], [ 431 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 443, 445 ], [ 447 ], [ 449, 451 ], [ 453 ], [ 455 ], [ 459 ], [ 461 ], [ 463 ], [ 465 ], [ 467 ], [ 469 ], [ 471 ], [ 473 ], [ 475 ], [ 477 ], [ 479 ], [ 481 ], [ 483 ], [ 485 ], [ 487 ], [ 489 ], [ 491 ], [ 493 ], [ 495 ], [ 497 ], [ 499 ], [ 501 ], [ 503 ], [ 505, 507 ], [ 509 ], [ 513 ], [ 515 ], [ 517 ], [ 519 ], [ 521 ], [ 523 ], [ 525 ], [ 527 ], [ 529 ], [ 531 ], [ 533 ], [ 535 ], [ 537 ], [ 539 ], [ 541 ], [ 543, 545, 547 ], [ 549 ], [ 551 ] ]
8,434
int MPA_encode_init(AVCodecContext *avctx) { MpegAudioContext *s = avctx->priv_data; int freq = avctx->sample_rate; int bitrate = avctx->bit_rate; int channels = avctx->channels; int i, v, table; float a; if (channels > 2) return -1; bitrate = bitrate / 1000; s->nb_channels = channels; s->freq = freq; s->bit_rate = bitrate * 1000; avctx->frame_size = MPA_FRAME_SIZE; avctx->key_frame = 1; /* always key frame */ /* encoding freq */ s->lsf = 0; for(i=0;i<3;i++) { if (mpa_freq_tab[i] == freq) break; if ((mpa_freq_tab[i] / 2) == freq) { s->lsf = 1; break; } } if (i == 3) return -1; s->freq_index = i; /* encoding bitrate & frequency */ for(i=0;i<15;i++) { if (mpa_bitrate_tab[s->lsf][1][i] == bitrate) break; } if (i == 15) return -1; s->bitrate_index = i; /* compute total header size & pad bit */ a = (float)(bitrate * 1000 * MPA_FRAME_SIZE) / (freq * 8.0); s->frame_size = ((int)a) * 8; /* frame fractional size to compute padding */ s->frame_frac = 0; s->frame_frac_incr = (int)((a - floor(a)) * 65536.0); /* select the right allocation table */ table = l2_select_table(bitrate, s->nb_channels, freq, s->lsf); /* number of used subbands */ s->sblimit = sblimit_table[table]; s->alloc_table = alloc_tables[table]; #ifdef DEBUG printf("%d kb/s, %d Hz, frame_size=%d bits, table=%d, padincr=%x\n", bitrate, freq, s->frame_size, table, s->frame_frac_incr); #endif for(i=0;i<s->nb_channels;i++) s->samples_offset[i] = 0; for(i=0;i<257;i++) { int v; v = (mpa_enwindow[i] + 2) >> 2; filter_bank[i] = v; if ((i & 63) != 0) v = -v; if (i != 0) filter_bank[512 - i] = v; } for(i=0;i<64;i++) { v = (int)(pow(2.0, (3 - i) / 3.0) * (1 << 20)); if (v <= 0) v = 1; scale_factor_table[i] = v; #ifdef USE_FLOATS scale_factor_inv_table[i] = pow(2.0, -(3 - i) / 3.0) / (float)(1 << 20); #else #define P 15 scale_factor_shift[i] = 21 - P - (i / 3); scale_factor_mult[i] = (1 << P) * pow(2.0, (i % 3) / 3.0); #endif } for(i=0;i<128;i++) { v = i - 64; if (v <= -3) v = 0; else if (v < 0) v = 1; else if (v == 0) v = 2; else if (v < 3) v = 3; else v = 4; scale_diff_table[i] = v; } for(i=0;i<17;i++) { v = quant_bits[i]; if (v < 0) v = -v; else v = v * 3; total_quant_bits[i] = 12 * v; } return 0; }
true
FFmpeg
afa982fdae1b49a8aee00a27da876bba10ba1073
int MPA_encode_init(AVCodecContext *avctx) { MpegAudioContext *s = avctx->priv_data; int freq = avctx->sample_rate; int bitrate = avctx->bit_rate; int channels = avctx->channels; int i, v, table; float a; if (channels > 2) return -1; bitrate = bitrate / 1000; s->nb_channels = channels; s->freq = freq; s->bit_rate = bitrate * 1000; avctx->frame_size = MPA_FRAME_SIZE; avctx->key_frame = 1; s->lsf = 0; for(i=0;i<3;i++) { if (mpa_freq_tab[i] == freq) break; if ((mpa_freq_tab[i] / 2) == freq) { s->lsf = 1; break; } } if (i == 3) return -1; s->freq_index = i; for(i=0;i<15;i++) { if (mpa_bitrate_tab[s->lsf][1][i] == bitrate) break; } if (i == 15) return -1; s->bitrate_index = i; a = (float)(bitrate * 1000 * MPA_FRAME_SIZE) / (freq * 8.0); s->frame_size = ((int)a) * 8; s->frame_frac = 0; s->frame_frac_incr = (int)((a - floor(a)) * 65536.0); table = l2_select_table(bitrate, s->nb_channels, freq, s->lsf); s->sblimit = sblimit_table[table]; s->alloc_table = alloc_tables[table]; #ifdef DEBUG printf("%d kb/s, %d Hz, frame_size=%d bits, table=%d, padincr=%x\n", bitrate, freq, s->frame_size, table, s->frame_frac_incr); #endif for(i=0;i<s->nb_channels;i++) s->samples_offset[i] = 0; for(i=0;i<257;i++) { int v; v = (mpa_enwindow[i] + 2) >> 2; filter_bank[i] = v; if ((i & 63) != 0) v = -v; if (i != 0) filter_bank[512 - i] = v; } for(i=0;i<64;i++) { v = (int)(pow(2.0, (3 - i) / 3.0) * (1 << 20)); if (v <= 0) v = 1; scale_factor_table[i] = v; #ifdef USE_FLOATS scale_factor_inv_table[i] = pow(2.0, -(3 - i) / 3.0) / (float)(1 << 20); #else #define P 15 scale_factor_shift[i] = 21 - P - (i / 3); scale_factor_mult[i] = (1 << P) * pow(2.0, (i % 3) / 3.0); #endif } for(i=0;i<128;i++) { v = i - 64; if (v <= -3) v = 0; else if (v < 0) v = 1; else if (v == 0) v = 2; else if (v < 3) v = 3; else v = 4; scale_diff_table[i] = v; } for(i=0;i<17;i++) { v = quant_bits[i]; if (v < 0) v = -v; else v = v * 3; total_quant_bits[i] = 12 * v; } return 0; }
{ "code": [ " v = (mpa_enwindow[i] + 2) >> 2;" ], "line_no": [ 135 ] }
int FUNC_0(AVCodecContext *VAR_0) { MpegAudioContext *s = VAR_0->priv_data; int VAR_1 = VAR_0->sample_rate; int VAR_2 = VAR_0->bit_rate; int VAR_3 = VAR_0->VAR_3; int VAR_4, VAR_8, VAR_6; float VAR_7; if (VAR_3 > 2) return -1; VAR_2 = VAR_2 / 1000; s->nb_channels = VAR_3; s->VAR_1 = VAR_1; s->bit_rate = VAR_2 * 1000; VAR_0->frame_size = MPA_FRAME_SIZE; VAR_0->key_frame = 1; s->lsf = 0; for(VAR_4=0;VAR_4<3;VAR_4++) { if (mpa_freq_tab[VAR_4] == VAR_1) break; if ((mpa_freq_tab[VAR_4] / 2) == VAR_1) { s->lsf = 1; break; } } if (VAR_4 == 3) return -1; s->freq_index = VAR_4; for(VAR_4=0;VAR_4<15;VAR_4++) { if (mpa_bitrate_tab[s->lsf][1][VAR_4] == VAR_2) break; } if (VAR_4 == 15) return -1; s->bitrate_index = VAR_4; VAR_7 = (float)(VAR_2 * 1000 * MPA_FRAME_SIZE) / (VAR_1 * 8.0); s->frame_size = ((int)VAR_7) * 8; s->frame_frac = 0; s->frame_frac_incr = (int)((VAR_7 - floor(VAR_7)) * 65536.0); VAR_6 = l2_select_table(VAR_2, s->nb_channels, VAR_1, s->lsf); s->sblimit = sblimit_table[VAR_6]; s->alloc_table = alloc_tables[VAR_6]; #ifdef DEBUG printf("%d kb/s, %d Hz, frame_size=%d bits, VAR_6=%d, padincr=%x\n", VAR_2, VAR_1, s->frame_size, VAR_6, s->frame_frac_incr); #endif for(VAR_4=0;VAR_4<s->nb_channels;VAR_4++) s->samples_offset[VAR_4] = 0; for(VAR_4=0;VAR_4<257;VAR_4++) { int VAR_8; VAR_8 = (mpa_enwindow[VAR_4] + 2) >> 2; filter_bank[VAR_4] = VAR_8; if ((VAR_4 & 63) != 0) VAR_8 = -VAR_8; if (VAR_4 != 0) filter_bank[512 - VAR_4] = VAR_8; } for(VAR_4=0;VAR_4<64;VAR_4++) { VAR_8 = (int)(pow(2.0, (3 - VAR_4) / 3.0) * (1 << 20)); if (VAR_8 <= 0) VAR_8 = 1; scale_factor_table[VAR_4] = VAR_8; #ifdef USE_FLOATS scale_factor_inv_table[VAR_4] = pow(2.0, -(3 - VAR_4) / 3.0) / (float)(1 << 20); #else #define P 15 scale_factor_shift[VAR_4] = 21 - P - (VAR_4 / 3); scale_factor_mult[VAR_4] = (1 << P) * pow(2.0, (VAR_4 % 3) / 3.0); #endif } for(VAR_4=0;VAR_4<128;VAR_4++) { VAR_8 = VAR_4 - 64; if (VAR_8 <= -3) VAR_8 = 0; else if (VAR_8 < 0) VAR_8 = 1; else if (VAR_8 == 0) VAR_8 = 2; else if (VAR_8 < 3) VAR_8 = 3; else VAR_8 = 4; scale_diff_table[VAR_4] = VAR_8; } for(VAR_4=0;VAR_4<17;VAR_4++) { VAR_8 = quant_bits[VAR_4]; if (VAR_8 < 0) VAR_8 = -VAR_8; else VAR_8 = VAR_8 * 3; total_quant_bits[VAR_4] = 12 * VAR_8; } return 0; }
[ "int FUNC_0(AVCodecContext *VAR_0)\n{", "MpegAudioContext *s = VAR_0->priv_data;", "int VAR_1 = VAR_0->sample_rate;", "int VAR_2 = VAR_0->bit_rate;", "int VAR_3 = VAR_0->VAR_3;", "int VAR_4, VAR_8, VAR_6;", "float VAR_7;", "if (VAR_3 > 2)\nreturn -1;", "VAR_2 = VAR_2 / 1000;", "s->nb_channels = VAR_3;", "s->VAR_1 = VAR_1;", "s->bit_rate = VAR_2 * 1000;", "VAR_0->frame_size = MPA_FRAME_SIZE;", "VAR_0->key_frame = 1;", "s->lsf = 0;", "for(VAR_4=0;VAR_4<3;VAR_4++) {", "if (mpa_freq_tab[VAR_4] == VAR_1)\nbreak;", "if ((mpa_freq_tab[VAR_4] / 2) == VAR_1) {", "s->lsf = 1;", "break;", "}", "}", "if (VAR_4 == 3)\nreturn -1;", "s->freq_index = VAR_4;", "for(VAR_4=0;VAR_4<15;VAR_4++) {", "if (mpa_bitrate_tab[s->lsf][1][VAR_4] == VAR_2)\nbreak;", "}", "if (VAR_4 == 15)\nreturn -1;", "s->bitrate_index = VAR_4;", "VAR_7 = (float)(VAR_2 * 1000 * MPA_FRAME_SIZE) / (VAR_1 * 8.0);", "s->frame_size = ((int)VAR_7) * 8;", "s->frame_frac = 0;", "s->frame_frac_incr = (int)((VAR_7 - floor(VAR_7)) * 65536.0);", "VAR_6 = l2_select_table(VAR_2, s->nb_channels, VAR_1, s->lsf);", "s->sblimit = sblimit_table[VAR_6];", "s->alloc_table = alloc_tables[VAR_6];", "#ifdef DEBUG\nprintf(\"%d kb/s, %d Hz, frame_size=%d bits, VAR_6=%d, padincr=%x\\n\",\nVAR_2, VAR_1, s->frame_size, VAR_6, s->frame_frac_incr);", "#endif\nfor(VAR_4=0;VAR_4<s->nb_channels;VAR_4++)", "s->samples_offset[VAR_4] = 0;", "for(VAR_4=0;VAR_4<257;VAR_4++) {", "int VAR_8;", "VAR_8 = (mpa_enwindow[VAR_4] + 2) >> 2;", "filter_bank[VAR_4] = VAR_8;", "if ((VAR_4 & 63) != 0)\nVAR_8 = -VAR_8;", "if (VAR_4 != 0)\nfilter_bank[512 - VAR_4] = VAR_8;", "}", "for(VAR_4=0;VAR_4<64;VAR_4++) {", "VAR_8 = (int)(pow(2.0, (3 - VAR_4) / 3.0) * (1 << 20));", "if (VAR_8 <= 0)\nVAR_8 = 1;", "scale_factor_table[VAR_4] = VAR_8;", "#ifdef USE_FLOATS\nscale_factor_inv_table[VAR_4] = pow(2.0, -(3 - VAR_4) / 3.0) / (float)(1 << 20);", "#else\n#define P 15\nscale_factor_shift[VAR_4] = 21 - P - (VAR_4 / 3);", "scale_factor_mult[VAR_4] = (1 << P) * pow(2.0, (VAR_4 % 3) / 3.0);", "#endif\n}", "for(VAR_4=0;VAR_4<128;VAR_4++) {", "VAR_8 = VAR_4 - 64;", "if (VAR_8 <= -3)\nVAR_8 = 0;", "else if (VAR_8 < 0)\nVAR_8 = 1;", "else if (VAR_8 == 0)\nVAR_8 = 2;", "else if (VAR_8 < 3)\nVAR_8 = 3;", "else\nVAR_8 = 4;", "scale_diff_table[VAR_4] = VAR_8;", "}", "for(VAR_4=0;VAR_4<17;VAR_4++) {", "VAR_8 = quant_bits[VAR_4];", "if (VAR_8 < 0)\nVAR_8 = -VAR_8;", "else\nVAR_8 = VAR_8 * 3;", "total_quant_bits[VAR_4] = 12 * VAR_8;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 87 ], [ 89 ], [ 95 ], [ 97 ], [ 103 ], [ 109 ], [ 111 ], [ 115, 117, 119 ], [ 121, 125 ], [ 127 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139, 141 ], [ 143, 145 ], [ 147 ], [ 151 ], [ 153 ], [ 155, 157 ], [ 159 ], [ 161, 163 ], [ 165, 167, 169 ], [ 171 ], [ 173, 175 ], [ 177 ], [ 179 ], [ 181, 183 ], [ 185, 187 ], [ 189, 191 ], [ 193, 195 ], [ 197, 199 ], [ 201 ], [ 203 ], [ 207 ], [ 209 ], [ 211, 213 ], [ 215, 217 ], [ 219 ], [ 221 ], [ 225 ], [ 227 ] ]
8,436
static void rv40_v_strong_loop_filter(uint8_t *src, const int stride, const int alpha, const int lims, const int dmode, const int chroma) { rv40_strong_loop_filter(src, 1, stride, alpha, lims, dmode, chroma); }
true
FFmpeg
3ab9a2a5577d445252724af4067d2a7c8a378efa
static void rv40_v_strong_loop_filter(uint8_t *src, const int stride, const int alpha, const int lims, const int dmode, const int chroma) { rv40_strong_loop_filter(src, 1, stride, alpha, lims, dmode, chroma); }
{ "code": [ "static void rv40_v_strong_loop_filter(uint8_t *src, const int stride," ], "line_no": [ 1 ] }
static void FUNC_0(uint8_t *VAR_0, const int VAR_1, const int VAR_2, const int VAR_3, const int VAR_4, const int VAR_5) { rv40_strong_loop_filter(VAR_0, 1, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5); }
[ "static void FUNC_0(uint8_t *VAR_0, const int VAR_1,\nconst int VAR_2, const int VAR_3,\nconst int VAR_4, const int VAR_5)\n{", "rv40_strong_loop_filter(VAR_0, 1, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5);", "}" ]
[ 1, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ] ]
8,437
static int mode_sense_page(SCSIRequest *req, int page, uint8_t *p) { SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, req->dev); BlockDriverState *bdrv = s->bs; int cylinders, heads, secs; switch (page) { case 4: /* Rigid disk device geometry page. */ p[0] = 4; p[1] = 0x16; /* if a geometry hint is available, use it */ bdrv_get_geometry_hint(bdrv, &cylinders, &heads, &secs); p[2] = (cylinders >> 16) & 0xff; p[3] = (cylinders >> 8) & 0xff; p[4] = cylinders & 0xff; p[5] = heads & 0xff; /* Write precomp start cylinder, disabled */ p[6] = (cylinders >> 16) & 0xff; p[7] = (cylinders >> 8) & 0xff; p[8] = cylinders & 0xff; /* Reduced current start cylinder, disabled */ p[9] = (cylinders >> 16) & 0xff; p[10] = (cylinders >> 8) & 0xff; p[11] = cylinders & 0xff; /* Device step rate [ns], 200ns */ p[12] = 0; p[13] = 200; /* Landing zone cylinder */ p[14] = 0xff; p[15] = 0xff; p[16] = 0xff; /* Medium rotation rate [rpm], 5400 rpm */ p[20] = (5400 >> 8) & 0xff; p[21] = 5400 & 0xff; return 0x16; case 5: /* Flexible disk device geometry page. */ p[0] = 5; p[1] = 0x1e; /* Transfer rate [kbit/s], 5Mbit/s */ p[2] = 5000 >> 8; p[3] = 5000 & 0xff; /* if a geometry hint is available, use it */ bdrv_get_geometry_hint(bdrv, &cylinders, &heads, &secs); p[4] = heads & 0xff; p[5] = secs & 0xff; p[6] = s->cluster_size * 2; p[8] = (cylinders >> 8) & 0xff; p[9] = cylinders & 0xff; /* Write precomp start cylinder, disabled */ p[10] = (cylinders >> 8) & 0xff; p[11] = cylinders & 0xff; /* Reduced current start cylinder, disabled */ p[12] = (cylinders >> 8) & 0xff; p[13] = cylinders & 0xff; /* Device step rate [100us], 100us */ p[14] = 0; p[15] = 1; /* Device step pulse width [us], 1us */ p[16] = 1; /* Device head settle delay [100us], 100us */ p[17] = 0; p[18] = 1; /* Motor on delay [0.1s], 0.1s */ p[19] = 1; /* Motor off delay [0.1s], 0.1s */ p[20] = 1; /* Medium rotation rate [rpm], 5400 rpm */ p[28] = (5400 >> 8) & 0xff; p[29] = 5400 & 0xff; return 0x1e; case 8: /* Caching page. */ p[0] = 8; p[1] = 0x12; if (bdrv_enable_write_cache(s->bs)) { p[2] = 4; /* WCE */ } return 20; case 0x2a: /* CD Capabilities and Mechanical Status page. */ if (bdrv_get_type_hint(bdrv) != BDRV_TYPE_CDROM) return 0; p[0] = 0x2a; p[1] = 0x14; p[2] = 3; // CD-R & CD-RW read p[3] = 0; // Writing not supported p[4] = 0x7f; /* Audio, composite, digital out, mode 2 form 1&2, multi session */ p[5] = 0xff; /* CD DA, DA accurate, RW supported, RW corrected, C2 errors, ISRC, UPC, Bar code */ p[6] = 0x2d | (bdrv_is_locked(s->bs)? 2 : 0); /* Locking supported, jumper present, eject, tray */ p[7] = 0; /* no volume & mute control, no changer */ p[8] = (50 * 176) >> 8; // 50x read speed p[9] = (50 * 176) & 0xff; p[10] = 0 >> 8; // No volume p[11] = 0 & 0xff; p[12] = 2048 >> 8; // 2M buffer p[13] = 2048 & 0xff; p[14] = (16 * 176) >> 8; // 16x read speed current p[15] = (16 * 176) & 0xff; p[18] = (16 * 176) >> 8; // 16x write speed p[19] = (16 * 176) & 0xff; p[20] = (16 * 176) >> 8; // 16x write speed current p[21] = (16 * 176) & 0xff; return 22; default: return 0; } }
true
qemu
282ab04eb1e6f4faa6c5d2827e3209c4a1eec40e
static int mode_sense_page(SCSIRequest *req, int page, uint8_t *p) { SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, req->dev); BlockDriverState *bdrv = s->bs; int cylinders, heads, secs; switch (page) { case 4: p[0] = 4; p[1] = 0x16; bdrv_get_geometry_hint(bdrv, &cylinders, &heads, &secs); p[2] = (cylinders >> 16) & 0xff; p[3] = (cylinders >> 8) & 0xff; p[4] = cylinders & 0xff; p[5] = heads & 0xff; p[6] = (cylinders >> 16) & 0xff; p[7] = (cylinders >> 8) & 0xff; p[8] = cylinders & 0xff; p[9] = (cylinders >> 16) & 0xff; p[10] = (cylinders >> 8) & 0xff; p[11] = cylinders & 0xff; p[12] = 0; p[13] = 200; p[14] = 0xff; p[15] = 0xff; p[16] = 0xff; p[20] = (5400 >> 8) & 0xff; p[21] = 5400 & 0xff; return 0x16; case 5: p[0] = 5; p[1] = 0x1e; p[2] = 5000 >> 8; p[3] = 5000 & 0xff; bdrv_get_geometry_hint(bdrv, &cylinders, &heads, &secs); p[4] = heads & 0xff; p[5] = secs & 0xff; p[6] = s->cluster_size * 2; p[8] = (cylinders >> 8) & 0xff; p[9] = cylinders & 0xff; p[10] = (cylinders >> 8) & 0xff; p[11] = cylinders & 0xff; p[12] = (cylinders >> 8) & 0xff; p[13] = cylinders & 0xff; p[14] = 0; p[15] = 1; p[16] = 1; p[17] = 0; p[18] = 1; p[19] = 1; p[20] = 1; p[28] = (5400 >> 8) & 0xff; p[29] = 5400 & 0xff; return 0x1e; case 8: p[0] = 8; p[1] = 0x12; if (bdrv_enable_write_cache(s->bs)) { p[2] = 4; } return 20; case 0x2a: if (bdrv_get_type_hint(bdrv) != BDRV_TYPE_CDROM) return 0; p[0] = 0x2a; p[1] = 0x14; p[2] = 3; p[3] = 0; p[4] = 0x7f; p[5] = 0xff; p[6] = 0x2d | (bdrv_is_locked(s->bs)? 2 : 0); p[7] = 0; p[8] = (50 * 176) >> 8; p[9] = (50 * 176) & 0xff; p[10] = 0 >> 8; p[11] = 0 & 0xff; p[12] = 2048 >> 8; p[13] = 2048 & 0xff; p[14] = (16 * 176) >> 8; p[15] = (16 * 176) & 0xff; p[18] = (16 * 176) >> 8; p[19] = (16 * 176) & 0xff; p[20] = (16 * 176) >> 8; current p[21] = (16 * 176) & 0xff; return 22; default: return 0; } }
{ "code": [ "static int mode_sense_page(SCSIRequest *req, int page, uint8_t *p)", " return 0x16;", " return 0x1e;", " return 20;", " return 22;" ], "line_no": [ 1, 69, 141, 157, 217 ] }
static int FUNC_0(SCSIRequest *VAR_0, int VAR_1, uint8_t *VAR_2) { SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, VAR_0->dev); BlockDriverState *bdrv = s->bs; int VAR_3, VAR_4, VAR_5; switch (VAR_1) { case 4: VAR_2[0] = 4; VAR_2[1] = 0x16; bdrv_get_geometry_hint(bdrv, &VAR_3, &VAR_4, &VAR_5); VAR_2[2] = (VAR_3 >> 16) & 0xff; VAR_2[3] = (VAR_3 >> 8) & 0xff; VAR_2[4] = VAR_3 & 0xff; VAR_2[5] = VAR_4 & 0xff; VAR_2[6] = (VAR_3 >> 16) & 0xff; VAR_2[7] = (VAR_3 >> 8) & 0xff; VAR_2[8] = VAR_3 & 0xff; VAR_2[9] = (VAR_3 >> 16) & 0xff; VAR_2[10] = (VAR_3 >> 8) & 0xff; VAR_2[11] = VAR_3 & 0xff; VAR_2[12] = 0; VAR_2[13] = 200; VAR_2[14] = 0xff; VAR_2[15] = 0xff; VAR_2[16] = 0xff; VAR_2[20] = (5400 >> 8) & 0xff; VAR_2[21] = 5400 & 0xff; return 0x16; case 5: VAR_2[0] = 5; VAR_2[1] = 0x1e; VAR_2[2] = 5000 >> 8; VAR_2[3] = 5000 & 0xff; bdrv_get_geometry_hint(bdrv, &VAR_3, &VAR_4, &VAR_5); VAR_2[4] = VAR_4 & 0xff; VAR_2[5] = VAR_5 & 0xff; VAR_2[6] = s->cluster_size * 2; VAR_2[8] = (VAR_3 >> 8) & 0xff; VAR_2[9] = VAR_3 & 0xff; VAR_2[10] = (VAR_3 >> 8) & 0xff; VAR_2[11] = VAR_3 & 0xff; VAR_2[12] = (VAR_3 >> 8) & 0xff; VAR_2[13] = VAR_3 & 0xff; VAR_2[14] = 0; VAR_2[15] = 1; VAR_2[16] = 1; VAR_2[17] = 0; VAR_2[18] = 1; VAR_2[19] = 1; VAR_2[20] = 1; VAR_2[28] = (5400 >> 8) & 0xff; VAR_2[29] = 5400 & 0xff; return 0x1e; case 8: VAR_2[0] = 8; VAR_2[1] = 0x12; if (bdrv_enable_write_cache(s->bs)) { VAR_2[2] = 4; } return 20; case 0x2a: if (bdrv_get_type_hint(bdrv) != BDRV_TYPE_CDROM) return 0; VAR_2[0] = 0x2a; VAR_2[1] = 0x14; VAR_2[2] = 3; VAR_2[3] = 0; VAR_2[4] = 0x7f; VAR_2[5] = 0xff; VAR_2[6] = 0x2d | (bdrv_is_locked(s->bs)? 2 : 0); VAR_2[7] = 0; VAR_2[8] = (50 * 176) >> 8; VAR_2[9] = (50 * 176) & 0xff; VAR_2[10] = 0 >> 8; VAR_2[11] = 0 & 0xff; VAR_2[12] = 2048 >> 8; VAR_2[13] = 2048 & 0xff; VAR_2[14] = (16 * 176) >> 8; VAR_2[15] = (16 * 176) & 0xff; VAR_2[18] = (16 * 176) >> 8; VAR_2[19] = (16 * 176) & 0xff; VAR_2[20] = (16 * 176) >> 8; current VAR_2[21] = (16 * 176) & 0xff; return 22; default: return 0; } }
[ "static int FUNC_0(SCSIRequest *VAR_0, int VAR_1, uint8_t *VAR_2)\n{", "SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, VAR_0->dev);", "BlockDriverState *bdrv = s->bs;", "int VAR_3, VAR_4, VAR_5;", "switch (VAR_1) {", "case 4:\nVAR_2[0] = 4;", "VAR_2[1] = 0x16;", "bdrv_get_geometry_hint(bdrv, &VAR_3, &VAR_4, &VAR_5);", "VAR_2[2] = (VAR_3 >> 16) & 0xff;", "VAR_2[3] = (VAR_3 >> 8) & 0xff;", "VAR_2[4] = VAR_3 & 0xff;", "VAR_2[5] = VAR_4 & 0xff;", "VAR_2[6] = (VAR_3 >> 16) & 0xff;", "VAR_2[7] = (VAR_3 >> 8) & 0xff;", "VAR_2[8] = VAR_3 & 0xff;", "VAR_2[9] = (VAR_3 >> 16) & 0xff;", "VAR_2[10] = (VAR_3 >> 8) & 0xff;", "VAR_2[11] = VAR_3 & 0xff;", "VAR_2[12] = 0;", "VAR_2[13] = 200;", "VAR_2[14] = 0xff;", "VAR_2[15] = 0xff;", "VAR_2[16] = 0xff;", "VAR_2[20] = (5400 >> 8) & 0xff;", "VAR_2[21] = 5400 & 0xff;", "return 0x16;", "case 5:\nVAR_2[0] = 5;", "VAR_2[1] = 0x1e;", "VAR_2[2] = 5000 >> 8;", "VAR_2[3] = 5000 & 0xff;", "bdrv_get_geometry_hint(bdrv, &VAR_3, &VAR_4, &VAR_5);", "VAR_2[4] = VAR_4 & 0xff;", "VAR_2[5] = VAR_5 & 0xff;", "VAR_2[6] = s->cluster_size * 2;", "VAR_2[8] = (VAR_3 >> 8) & 0xff;", "VAR_2[9] = VAR_3 & 0xff;", "VAR_2[10] = (VAR_3 >> 8) & 0xff;", "VAR_2[11] = VAR_3 & 0xff;", "VAR_2[12] = (VAR_3 >> 8) & 0xff;", "VAR_2[13] = VAR_3 & 0xff;", "VAR_2[14] = 0;", "VAR_2[15] = 1;", "VAR_2[16] = 1;", "VAR_2[17] = 0;", "VAR_2[18] = 1;", "VAR_2[19] = 1;", "VAR_2[20] = 1;", "VAR_2[28] = (5400 >> 8) & 0xff;", "VAR_2[29] = 5400 & 0xff;", "return 0x1e;", "case 8:\nVAR_2[0] = 8;", "VAR_2[1] = 0x12;", "if (bdrv_enable_write_cache(s->bs)) {", "VAR_2[2] = 4;", "}", "return 20;", "case 0x2a:\nif (bdrv_get_type_hint(bdrv) != BDRV_TYPE_CDROM)\nreturn 0;", "VAR_2[0] = 0x2a;", "VAR_2[1] = 0x14;", "VAR_2[2] = 3;", "VAR_2[3] = 0;", "VAR_2[4] = 0x7f;", "VAR_2[5] = 0xff;", "VAR_2[6] = 0x2d | (bdrv_is_locked(s->bs)? 2 : 0);", "VAR_2[7] = 0;", "VAR_2[8] = (50 * 176) >> 8;", "VAR_2[9] = (50 * 176) & 0xff;", "VAR_2[10] = 0 >> 8;", "VAR_2[11] = 0 & 0xff;", "VAR_2[12] = 2048 >> 8;", "VAR_2[13] = 2048 & 0xff;", "VAR_2[14] = (16 * 176) >> 8;", "VAR_2[15] = (16 * 176) & 0xff;", "VAR_2[18] = (16 * 176) >> 8;", "VAR_2[19] = (16 * 176) & 0xff;", "VAR_2[20] = (16 * 176) >> 8; current", "VAR_2[21] = (16 * 176) & 0xff;", "return 22;", "default:\nreturn 0;", "}", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 73, 75 ], [ 77 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 119 ], [ 123 ], [ 125 ], [ 129 ], [ 133 ], [ 137 ], [ 139 ], [ 141 ], [ 145, 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 161, 163, 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 179 ], [ 185 ], [ 189 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 221, 223 ], [ 225 ], [ 227 ] ]
8,438
static av_cold int init(AVFilterContext *ctx) { SendCmdContext *sendcmd = ctx->priv; int ret, i, j; if (sendcmd->commands_filename && sendcmd->commands_str) { av_log(ctx, AV_LOG_ERROR, "Only one of the filename or commands options must be specified\n"); return AVERROR(EINVAL); } if (sendcmd->commands_filename) { uint8_t *file_buf, *buf; size_t file_bufsize; ret = av_file_map(sendcmd->commands_filename, &file_buf, &file_bufsize, 0, ctx); if (ret < 0) return ret; /* create a 0-terminated string based on the read file */ buf = av_malloc(file_bufsize + 1); if (!buf) { av_file_unmap(file_buf, file_bufsize); return AVERROR(ENOMEM); } memcpy(buf, file_buf, file_bufsize); buf[file_bufsize] = 0; av_file_unmap(file_buf, file_bufsize); sendcmd->commands_str = buf; } if ((ret = parse_intervals(&sendcmd->intervals, &sendcmd->nb_intervals, sendcmd->commands_str, ctx)) < 0) return ret; if (sendcmd->nb_intervals == 0) { av_log(ctx, AV_LOG_ERROR, "No commands\n"); return AVERROR(EINVAL); } qsort(sendcmd->intervals, sendcmd->nb_intervals, sizeof(Interval), cmp_intervals); av_log(ctx, AV_LOG_DEBUG, "Parsed commands:\n"); for (i = 0; i < sendcmd->nb_intervals; i++) { AVBPrint pbuf; Interval *interval = &sendcmd->intervals[i]; av_log(ctx, AV_LOG_VERBOSE, "start_time:%f end_time:%f index:%d\n", (double)interval->start_ts/1000000, (double)interval->end_ts/1000000, interval->index); for (j = 0; j < interval->nb_commands; j++) { Command *cmd = &interval->commands[j]; av_log(ctx, AV_LOG_VERBOSE, " [%s] target:%s command:%s arg:%s index:%d\n", make_command_flags_str(&pbuf, cmd->flags), cmd->target, cmd->command, cmd->arg, cmd->index); } } return 0; }
true
FFmpeg
83ee820a1678937ab8343f2766e9662ef9fd420f
static av_cold int init(AVFilterContext *ctx) { SendCmdContext *sendcmd = ctx->priv; int ret, i, j; if (sendcmd->commands_filename && sendcmd->commands_str) { av_log(ctx, AV_LOG_ERROR, "Only one of the filename or commands options must be specified\n"); return AVERROR(EINVAL); } if (sendcmd->commands_filename) { uint8_t *file_buf, *buf; size_t file_bufsize; ret = av_file_map(sendcmd->commands_filename, &file_buf, &file_bufsize, 0, ctx); if (ret < 0) return ret; buf = av_malloc(file_bufsize + 1); if (!buf) { av_file_unmap(file_buf, file_bufsize); return AVERROR(ENOMEM); } memcpy(buf, file_buf, file_bufsize); buf[file_bufsize] = 0; av_file_unmap(file_buf, file_bufsize); sendcmd->commands_str = buf; } if ((ret = parse_intervals(&sendcmd->intervals, &sendcmd->nb_intervals, sendcmd->commands_str, ctx)) < 0) return ret; if (sendcmd->nb_intervals == 0) { av_log(ctx, AV_LOG_ERROR, "No commands\n"); return AVERROR(EINVAL); } qsort(sendcmd->intervals, sendcmd->nb_intervals, sizeof(Interval), cmp_intervals); av_log(ctx, AV_LOG_DEBUG, "Parsed commands:\n"); for (i = 0; i < sendcmd->nb_intervals; i++) { AVBPrint pbuf; Interval *interval = &sendcmd->intervals[i]; av_log(ctx, AV_LOG_VERBOSE, "start_time:%f end_time:%f index:%d\n", (double)interval->start_ts/1000000, (double)interval->end_ts/1000000, interval->index); for (j = 0; j < interval->nb_commands; j++) { Command *cmd = &interval->commands[j]; av_log(ctx, AV_LOG_VERBOSE, " [%s] target:%s command:%s arg:%s index:%d\n", make_command_flags_str(&pbuf, cmd->flags), cmd->target, cmd->command, cmd->arg, cmd->index); } } return 0; }
{ "code": [ " if (sendcmd->commands_filename && sendcmd->commands_str) {", " \"Only one of the filename or commands options must be specified\\n\");", " av_log(ctx, AV_LOG_ERROR, \"No commands\\n\");" ], "line_no": [ 11, 15, 73 ] }
static av_cold int FUNC_0(AVFilterContext *ctx) { SendCmdContext *sendcmd = ctx->priv; int VAR_0, VAR_1, VAR_2; if (sendcmd->commands_filename && sendcmd->commands_str) { av_log(ctx, AV_LOG_ERROR, "Only one of the filename or commands options must be specified\n"); return AVERROR(EINVAL); } if (sendcmd->commands_filename) { uint8_t *file_buf, *buf; size_t file_bufsize; VAR_0 = av_file_map(sendcmd->commands_filename, &file_buf, &file_bufsize, 0, ctx); if (VAR_0 < 0) return VAR_0; buf = av_malloc(file_bufsize + 1); if (!buf) { av_file_unmap(file_buf, file_bufsize); return AVERROR(ENOMEM); } memcpy(buf, file_buf, file_bufsize); buf[file_bufsize] = 0; av_file_unmap(file_buf, file_bufsize); sendcmd->commands_str = buf; } if ((VAR_0 = parse_intervals(&sendcmd->intervals, &sendcmd->nb_intervals, sendcmd->commands_str, ctx)) < 0) return VAR_0; if (sendcmd->nb_intervals == 0) { av_log(ctx, AV_LOG_ERROR, "No commands\n"); return AVERROR(EINVAL); } qsort(sendcmd->intervals, sendcmd->nb_intervals, sizeof(Interval), cmp_intervals); av_log(ctx, AV_LOG_DEBUG, "Parsed commands:\n"); for (VAR_1 = 0; VAR_1 < sendcmd->nb_intervals; VAR_1++) { AVBPrint pbuf; Interval *interval = &sendcmd->intervals[VAR_1]; av_log(ctx, AV_LOG_VERBOSE, "start_time:%f end_time:%f index:%d\n", (double)interval->start_ts/1000000, (double)interval->end_ts/1000000, interval->index); for (VAR_2 = 0; VAR_2 < interval->nb_commands; VAR_2++) { Command *cmd = &interval->commands[VAR_2]; av_log(ctx, AV_LOG_VERBOSE, " [%s] target:%s command:%s arg:%s index:%d\n", make_command_flags_str(&pbuf, cmd->flags), cmd->target, cmd->command, cmd->arg, cmd->index); } } return 0; }
[ "static av_cold int FUNC_0(AVFilterContext *ctx)\n{", "SendCmdContext *sendcmd = ctx->priv;", "int VAR_0, VAR_1, VAR_2;", "if (sendcmd->commands_filename && sendcmd->commands_str) {", "av_log(ctx, AV_LOG_ERROR,\n\"Only one of the filename or commands options must be specified\\n\");", "return AVERROR(EINVAL);", "}", "if (sendcmd->commands_filename) {", "uint8_t *file_buf, *buf;", "size_t file_bufsize;", "VAR_0 = av_file_map(sendcmd->commands_filename,\n&file_buf, &file_bufsize, 0, ctx);", "if (VAR_0 < 0)\nreturn VAR_0;", "buf = av_malloc(file_bufsize + 1);", "if (!buf) {", "av_file_unmap(file_buf, file_bufsize);", "return AVERROR(ENOMEM);", "}", "memcpy(buf, file_buf, file_bufsize);", "buf[file_bufsize] = 0;", "av_file_unmap(file_buf, file_bufsize);", "sendcmd->commands_str = buf;", "}", "if ((VAR_0 = parse_intervals(&sendcmd->intervals, &sendcmd->nb_intervals,\nsendcmd->commands_str, ctx)) < 0)\nreturn VAR_0;", "if (sendcmd->nb_intervals == 0) {", "av_log(ctx, AV_LOG_ERROR, \"No commands\\n\");", "return AVERROR(EINVAL);", "}", "qsort(sendcmd->intervals, sendcmd->nb_intervals, sizeof(Interval), cmp_intervals);", "av_log(ctx, AV_LOG_DEBUG, \"Parsed commands:\\n\");", "for (VAR_1 = 0; VAR_1 < sendcmd->nb_intervals; VAR_1++) {", "AVBPrint pbuf;", "Interval *interval = &sendcmd->intervals[VAR_1];", "av_log(ctx, AV_LOG_VERBOSE, \"start_time:%f end_time:%f index:%d\\n\",\n(double)interval->start_ts/1000000, (double)interval->end_ts/1000000, interval->index);", "for (VAR_2 = 0; VAR_2 < interval->nb_commands; VAR_2++) {", "Command *cmd = &interval->commands[VAR_2];", "av_log(ctx, AV_LOG_VERBOSE,\n\" [%s] target:%s command:%s arg:%s index:%d\\n\",\nmake_command_flags_str(&pbuf, cmd->flags), cmd->target, cmd->command, cmd->arg, cmd->index);", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33, 35 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63, 65, 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 101, 103, 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ] ]
8,439
int scsi_build_sense(uint8_t *in_buf, int in_len, uint8_t *buf, int len, bool fixed) { bool fixed_in; SCSISense sense; if (!fixed && len < 8) { return 0; } if (in_len == 0) { sense.key = NO_SENSE; sense.asc = 0; sense.ascq = 0; } else { fixed_in = (in_buf[0] & 2) == 0; if (fixed == fixed_in) { memcpy(buf, in_buf, MIN(len, in_len)); return MIN(len, in_len); } if (fixed_in) { sense.key = in_buf[2]; sense.asc = in_buf[12]; sense.ascq = in_buf[13]; } else { sense.key = in_buf[1]; sense.asc = in_buf[2]; sense.ascq = in_buf[3]; } } memset(buf, 0, len); if (fixed) { /* Return fixed format sense buffer */ buf[0] = 0x70; buf[2] = sense.key; buf[7] = 10; buf[12] = sense.asc; buf[13] = sense.ascq; return MIN(len, 18); } else { /* Return descriptor format sense buffer */ buf[0] = 0x72; buf[1] = sense.key; buf[2] = sense.asc; buf[3] = sense.ascq; return 8; } }
true
qemu
846424350b292f16b732b573273a5c1f195cd7a3
int scsi_build_sense(uint8_t *in_buf, int in_len, uint8_t *buf, int len, bool fixed) { bool fixed_in; SCSISense sense; if (!fixed && len < 8) { return 0; } if (in_len == 0) { sense.key = NO_SENSE; sense.asc = 0; sense.ascq = 0; } else { fixed_in = (in_buf[0] & 2) == 0; if (fixed == fixed_in) { memcpy(buf, in_buf, MIN(len, in_len)); return MIN(len, in_len); } if (fixed_in) { sense.key = in_buf[2]; sense.asc = in_buf[12]; sense.ascq = in_buf[13]; } else { sense.key = in_buf[1]; sense.asc = in_buf[2]; sense.ascq = in_buf[3]; } } memset(buf, 0, len); if (fixed) { buf[0] = 0x70; buf[2] = sense.key; buf[7] = 10; buf[12] = sense.asc; buf[13] = sense.ascq; return MIN(len, 18); } else { buf[0] = 0x72; buf[1] = sense.key; buf[2] = sense.asc; buf[3] = sense.ascq; return 8; } }
{ "code": [ " return MIN(len, 18);" ], "line_no": [ 81 ] }
int FUNC_0(uint8_t *VAR_0, int VAR_1, uint8_t *VAR_2, int VAR_3, bool VAR_4) { bool fixed_in; SCSISense sense; if (!VAR_4 && VAR_3 < 8) { return 0; } if (VAR_1 == 0) { sense.key = NO_SENSE; sense.asc = 0; sense.ascq = 0; } else { fixed_in = (VAR_0[0] & 2) == 0; if (VAR_4 == fixed_in) { memcpy(VAR_2, VAR_0, MIN(VAR_3, VAR_1)); return MIN(VAR_3, VAR_1); } if (fixed_in) { sense.key = VAR_0[2]; sense.asc = VAR_0[12]; sense.ascq = VAR_0[13]; } else { sense.key = VAR_0[1]; sense.asc = VAR_0[2]; sense.ascq = VAR_0[3]; } } memset(VAR_2, 0, VAR_3); if (VAR_4) { VAR_2[0] = 0x70; VAR_2[2] = sense.key; VAR_2[7] = 10; VAR_2[12] = sense.asc; VAR_2[13] = sense.ascq; return MIN(VAR_3, 18); } else { VAR_2[0] = 0x72; VAR_2[1] = sense.key; VAR_2[2] = sense.asc; VAR_2[3] = sense.ascq; return 8; } }
[ "int FUNC_0(uint8_t *VAR_0, int VAR_1,\nuint8_t *VAR_2, int VAR_3, bool VAR_4)\n{", "bool fixed_in;", "SCSISense sense;", "if (!VAR_4 && VAR_3 < 8) {", "return 0;", "}", "if (VAR_1 == 0) {", "sense.key = NO_SENSE;", "sense.asc = 0;", "sense.ascq = 0;", "} else {", "fixed_in = (VAR_0[0] & 2) == 0;", "if (VAR_4 == fixed_in) {", "memcpy(VAR_2, VAR_0, MIN(VAR_3, VAR_1));", "return MIN(VAR_3, VAR_1);", "}", "if (fixed_in) {", "sense.key = VAR_0[2];", "sense.asc = VAR_0[12];", "sense.ascq = VAR_0[13];", "} else {", "sense.key = VAR_0[1];", "sense.asc = VAR_0[2];", "sense.ascq = VAR_0[3];", "}", "}", "memset(VAR_2, 0, VAR_3);", "if (VAR_4) {", "VAR_2[0] = 0x70;", "VAR_2[2] = sense.key;", "VAR_2[7] = 10;", "VAR_2[12] = sense.asc;", "VAR_2[13] = sense.ascq;", "return MIN(VAR_3, 18);", "} else {", "VAR_2[0] = 0x72;", "VAR_2[1] = sense.key;", "VAR_2[2] = sense.asc;", "VAR_2[3] = sense.ascq;", "return 8;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ] ]
8,441
static void move_audio(vorbis_enc_context *venc, float *audio, int *samples, int sf_size) { AVFrame *cur = NULL; int frame_size = 1 << (venc->log2_blocksize[1] - 1); int subframes = frame_size / sf_size; for (int sf = 0; sf < subframes; sf++) { cur = ff_bufqueue_get(&venc->bufqueue); *samples += cur->nb_samples; for (int ch = 0; ch < venc->channels; ch++) { const float *input = (float *) cur->extended_data[ch]; const size_t len = cur->nb_samples * sizeof(float); memcpy(audio + ch*frame_size + sf*sf_size, input, len); } av_frame_free(&cur); } }
false
FFmpeg
5a2ad7ede33b5d63c1f1b1313a218da62e1c0d48
static void move_audio(vorbis_enc_context *venc, float *audio, int *samples, int sf_size) { AVFrame *cur = NULL; int frame_size = 1 << (venc->log2_blocksize[1] - 1); int subframes = frame_size / sf_size; for (int sf = 0; sf < subframes; sf++) { cur = ff_bufqueue_get(&venc->bufqueue); *samples += cur->nb_samples; for (int ch = 0; ch < venc->channels; ch++) { const float *input = (float *) cur->extended_data[ch]; const size_t len = cur->nb_samples * sizeof(float); memcpy(audio + ch*frame_size + sf*sf_size, input, len); } av_frame_free(&cur); } }
{ "code": [], "line_no": [] }
static void FUNC_0(vorbis_enc_context *VAR_0, float *VAR_1, int *VAR_2, int VAR_3) { AVFrame *cur = NULL; int VAR_4 = 1 << (VAR_0->log2_blocksize[1] - 1); int VAR_5 = VAR_4 / VAR_3; for (int VAR_6 = 0; VAR_6 < VAR_5; VAR_6++) { cur = ff_bufqueue_get(&VAR_0->bufqueue); *VAR_2 += cur->nb_samples; for (int ch = 0; ch < VAR_0->channels; ch++) { const float *input = (float *) cur->extended_data[ch]; const size_t len = cur->nb_samples * sizeof(float); memcpy(VAR_1 + ch*VAR_4 + VAR_6*VAR_3, input, len); } av_frame_free(&cur); } }
[ "static void FUNC_0(vorbis_enc_context *VAR_0, float *VAR_1, int *VAR_2, int VAR_3)\n{", "AVFrame *cur = NULL;", "int VAR_4 = 1 << (VAR_0->log2_blocksize[1] - 1);", "int VAR_5 = VAR_4 / VAR_3;", "for (int VAR_6 = 0; VAR_6 < VAR_5; VAR_6++) {", "cur = ff_bufqueue_get(&VAR_0->bufqueue);", "*VAR_2 += cur->nb_samples;", "for (int ch = 0; ch < VAR_0->channels; ch++) {", "const float *input = (float *) cur->extended_data[ch];", "const size_t len = cur->nb_samples * sizeof(float);", "memcpy(VAR_1 + ch*VAR_4 + VAR_6*VAR_3, input, len);", "}", "av_frame_free(&cur);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
8,442
static int push_single_pic(AVFilterLink *outlink) { AVFilterContext *ctx = outlink->src; AVFilterLink *inlink = ctx->inputs[0]; ShowWavesContext *showwaves = ctx->priv; int64_t n = 0, max_samples = showwaves->total_samples / outlink->w; AVFrame *out = showwaves->outpicref; struct frame_node *node; const int nb_channels = inlink->channels; const int x = 255 / (showwaves->split_channels ? 1 : nb_channels); const int ch_height = showwaves->split_channels ? outlink->h / nb_channels : outlink->h; const int linesize = out->linesize[0]; int col = 0; int64_t *sum = showwaves->sum; av_log(ctx, AV_LOG_DEBUG, "Create frame averaging %"PRId64" samples per column\n", max_samples); memset(sum, 0, nb_channels); for (node = showwaves->audio_frames; node; node = node->next) { int i; const AVFrame *frame = node->frame; const int16_t *p = (const int16_t *)frame->data[0]; for (i = 0; i < frame->nb_samples; i++) { int ch; for (ch = 0; ch < nb_channels; ch++) sum[ch] += abs(p[ch + i*nb_channels]) << 1; if (n++ == max_samples) { for (ch = 0; ch < nb_channels; ch++) { int16_t sample = sum[ch] / max_samples; uint8_t *buf = out->data[0] + col; if (showwaves->split_channels) buf += ch*ch_height*linesize; av_assert0(col < outlink->w); showwaves->draw_sample(buf, ch_height, linesize, sample, &showwaves->buf_idy[ch], x); sum[ch] = 0; col++; n = 0; return push_frame(outlink);
true
FFmpeg
a212a983c7f4faf06e600f32a165592dc5b6ae76
static int push_single_pic(AVFilterLink *outlink) { AVFilterContext *ctx = outlink->src; AVFilterLink *inlink = ctx->inputs[0]; ShowWavesContext *showwaves = ctx->priv; int64_t n = 0, max_samples = showwaves->total_samples / outlink->w; AVFrame *out = showwaves->outpicref; struct frame_node *node; const int nb_channels = inlink->channels; const int x = 255 / (showwaves->split_channels ? 1 : nb_channels); const int ch_height = showwaves->split_channels ? outlink->h / nb_channels : outlink->h; const int linesize = out->linesize[0]; int col = 0; int64_t *sum = showwaves->sum; av_log(ctx, AV_LOG_DEBUG, "Create frame averaging %"PRId64" samples per column\n", max_samples); memset(sum, 0, nb_channels); for (node = showwaves->audio_frames; node; node = node->next) { int i; const AVFrame *frame = node->frame; const int16_t *p = (const int16_t *)frame->data[0]; for (i = 0; i < frame->nb_samples; i++) { int ch; for (ch = 0; ch < nb_channels; ch++) sum[ch] += abs(p[ch + i*nb_channels]) << 1; if (n++ == max_samples) { for (ch = 0; ch < nb_channels; ch++) { int16_t sample = sum[ch] / max_samples; uint8_t *buf = out->data[0] + col; if (showwaves->split_channels) buf += ch*ch_height*linesize; av_assert0(col < outlink->w); showwaves->draw_sample(buf, ch_height, linesize, sample, &showwaves->buf_idy[ch], x); sum[ch] = 0; col++; n = 0; return push_frame(outlink);
{ "code": [], "line_no": [] }
static int FUNC_0(AVFilterLink *VAR_0) { AVFilterContext *ctx = VAR_0->src; AVFilterLink *inlink = ctx->inputs[0]; ShowWavesContext *showwaves = ctx->priv; int64_t n = 0, max_samples = showwaves->total_samples / VAR_0->w; AVFrame *out = showwaves->outpicref; struct frame_node *VAR_1; const int VAR_2 = inlink->channels; const int VAR_3 = 255 / (showwaves->split_channels ? 1 : VAR_2); const int VAR_4 = showwaves->split_channels ? VAR_0->h / VAR_2 : VAR_0->h; const int VAR_5 = out->VAR_5[0]; int VAR_6 = 0; int64_t *sum = showwaves->sum; av_log(ctx, AV_LOG_DEBUG, "Create VAR_8 averaging %"PRId64" samples per column\n", max_samples); memset(sum, 0, VAR_2); for (VAR_1 = showwaves->audio_frames; VAR_1; VAR_1 = VAR_1->next) { int VAR_7; const AVFrame *VAR_8 = VAR_1->VAR_8; const int16_t *VAR_9 = (const int16_t *)VAR_8->data[0]; for (VAR_7 = 0; VAR_7 < VAR_8->nb_samples; VAR_7++) { int ch; for (ch = 0; ch < VAR_2; ch++) sum[ch] += abs(VAR_9[ch + VAR_7*VAR_2]) << 1; if (n++ == max_samples) { for (ch = 0; ch < VAR_2; ch++) { int16_t sample = sum[ch] / max_samples; uint8_t *buf = out->data[0] + VAR_6; if (showwaves->split_channels) buf += ch*VAR_4*VAR_5; av_assert0(VAR_6 < VAR_0->w); showwaves->draw_sample(buf, VAR_4, VAR_5, sample, &showwaves->buf_idy[ch], VAR_3); sum[ch] = 0; VAR_6++; n = 0; return push_frame(VAR_0);
[ "static int FUNC_0(AVFilterLink *VAR_0)\n{", "AVFilterContext *ctx = VAR_0->src;", "AVFilterLink *inlink = ctx->inputs[0];", "ShowWavesContext *showwaves = ctx->priv;", "int64_t n = 0, max_samples = showwaves->total_samples / VAR_0->w;", "AVFrame *out = showwaves->outpicref;", "struct frame_node *VAR_1;", "const int VAR_2 = inlink->channels;", "const int VAR_3 = 255 / (showwaves->split_channels ? 1 : VAR_2);", "const int VAR_4 = showwaves->split_channels ? VAR_0->h / VAR_2 : VAR_0->h;", "const int VAR_5 = out->VAR_5[0];", "int VAR_6 = 0;", "int64_t *sum = showwaves->sum;", "av_log(ctx, AV_LOG_DEBUG, \"Create VAR_8 averaging %\"PRId64\" samples per column\\n\", max_samples);", "memset(sum, 0, VAR_2);", "for (VAR_1 = showwaves->audio_frames; VAR_1; VAR_1 = VAR_1->next) {", "int VAR_7;", "const AVFrame *VAR_8 = VAR_1->VAR_8;", "const int16_t *VAR_9 = (const int16_t *)VAR_8->data[0];", "for (VAR_7 = 0; VAR_7 < VAR_8->nb_samples; VAR_7++) {", "int ch;", "for (ch = 0; ch < VAR_2; ch++)", "sum[ch] += abs(VAR_9[ch + VAR_7*VAR_2]) << 1;", "if (n++ == max_samples) {", "for (ch = 0; ch < VAR_2; ch++) {", "int16_t sample = sum[ch] / max_samples;", "uint8_t *buf = out->data[0] + VAR_6;", "if (showwaves->split_channels)\nbuf += ch*VAR_4*VAR_5;", "av_assert0(VAR_6 < VAR_0->w);", "showwaves->draw_sample(buf, VAR_4, VAR_5, sample, &showwaves->buf_idy[ch], VAR_3);", "sum[ch] = 0;", "VAR_6++;", "n = 0;", "return push_frame(VAR_0);" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17 ], [ 18 ], [ 19 ], [ 20 ], [ 21 ], [ 22 ], [ 23 ], [ 24 ], [ 25 ], [ 26 ], [ 27 ], [ 28 ], [ 29, 30 ], [ 31 ], [ 32 ], [ 33 ], [ 34 ], [ 35 ], [ 36 ] ]
8,443
static void host_signal_handler(int host_signum, siginfo_t *info, void *puc) { int sig; target_siginfo_t tinfo; /* the CPU emulator uses some host signals to detect exceptions, we we forward to it some signals */ if (host_signum == SIGSEGV || host_signum == SIGBUS) { if (cpu_signal_handler(host_signum, info, puc)) return; } /* get target signal number */ sig = host_to_target_signal(host_signum); if (sig < 1 || sig > TARGET_NSIG) return; #if defined(DEBUG_SIGNAL) fprintf(stderr, "qemu: got signal %d\n", sig); dump_regs(puc); #endif host_to_target_siginfo_noswap(&tinfo, info); if (queue_signal(sig, &tinfo) == 1) { /* interrupt the virtual CPU as soon as possible */ cpu_interrupt(global_env, CPU_INTERRUPT_EXIT); } }
true
qemu
773b93ee0684a9b9d1f0029a936a251411289027
static void host_signal_handler(int host_signum, siginfo_t *info, void *puc) { int sig; target_siginfo_t tinfo; if (host_signum == SIGSEGV || host_signum == SIGBUS) { if (cpu_signal_handler(host_signum, info, puc)) return; } sig = host_to_target_signal(host_signum); if (sig < 1 || sig > TARGET_NSIG) return; #if defined(DEBUG_SIGNAL) fprintf(stderr, "qemu: got signal %d\n", sig); dump_regs(puc); #endif host_to_target_siginfo_noswap(&tinfo, info); if (queue_signal(sig, &tinfo) == 1) { cpu_interrupt(global_env, CPU_INTERRUPT_EXIT); } }
{ "code": [ "#if defined(DEBUG_SIGNAL)", "#endif", "#endif", " dump_regs(puc);" ], "line_no": [ 35, 41, 41, 39 ] }
static void FUNC_0(int VAR_0, siginfo_t *VAR_1, void *VAR_2) { int VAR_3; target_siginfo_t tinfo; if (VAR_0 == SIGSEGV || VAR_0 == SIGBUS) { if (cpu_signal_handler(VAR_0, VAR_1, VAR_2)) return; } VAR_3 = host_to_target_signal(VAR_0); if (VAR_3 < 1 || VAR_3 > TARGET_NSIG) return; #if defined(DEBUG_SIGNAL) fprintf(stderr, "qemu: got signal %d\n", VAR_3); dump_regs(VAR_2); #endif host_to_target_siginfo_noswap(&tinfo, VAR_1); if (queue_signal(VAR_3, &tinfo) == 1) { cpu_interrupt(global_env, CPU_INTERRUPT_EXIT); } }
[ "static void FUNC_0(int VAR_0, siginfo_t *VAR_1,\nvoid *VAR_2)\n{", "int VAR_3;", "target_siginfo_t tinfo;", "if (VAR_0 == SIGSEGV || VAR_0 == SIGBUS) {", "if (cpu_signal_handler(VAR_0, VAR_1, VAR_2))\nreturn;", "}", "VAR_3 = host_to_target_signal(VAR_0);", "if (VAR_3 < 1 || VAR_3 > TARGET_NSIG)\nreturn;", "#if defined(DEBUG_SIGNAL)\nfprintf(stderr, \"qemu: got signal %d\\n\", VAR_3);", "dump_regs(VAR_2);", "#endif\nhost_to_target_siginfo_noswap(&tinfo, VAR_1);", "if (queue_signal(VAR_3, &tinfo) == 1) {", "cpu_interrupt(global_env, CPU_INTERRUPT_EXIT);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 29 ], [ 31, 33 ], [ 35, 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ] ]
8,444
int ff_j2k_dwt_init(DWTContext *s, uint16_t border[2][2], int decomp_levels, int type) { int i, j, lev = decomp_levels, maxlen, b[2][2]; if (decomp_levels >= FF_DWT_MAX_DECLVLS) return AVERROR_INVALIDDATA; s->ndeclevels = decomp_levels; s->type = type; for (i = 0; i < 2; i++) for(j = 0; j < 2; j++) b[i][j] = border[i][j]; maxlen = FFMAX(b[0][1] - b[0][0], b[1][1] - b[1][0]); while(--lev >= 0){ for (i = 0; i < 2; i++){ s->linelen[lev][i] = b[i][1] - b[i][0]; s->mod[lev][i] = b[i][0] & 1; for (j = 0; j < 2; j++) b[i][j] = (b[i][j] + 1) >> 1; } } if (type == FF_DWT97) s->linebuf = av_malloc((maxlen + 12) * sizeof(float)); else if (type == FF_DWT53) s->linebuf = av_malloc((maxlen + 6) * sizeof(int)); else return -1; if (!s->linebuf) return AVERROR(ENOMEM); return 0; }
true
FFmpeg
1f99939a6361e2e6d6788494dd7c682b051c6c34
int ff_j2k_dwt_init(DWTContext *s, uint16_t border[2][2], int decomp_levels, int type) { int i, j, lev = decomp_levels, maxlen, b[2][2]; if (decomp_levels >= FF_DWT_MAX_DECLVLS) return AVERROR_INVALIDDATA; s->ndeclevels = decomp_levels; s->type = type; for (i = 0; i < 2; i++) for(j = 0; j < 2; j++) b[i][j] = border[i][j]; maxlen = FFMAX(b[0][1] - b[0][0], b[1][1] - b[1][0]); while(--lev >= 0){ for (i = 0; i < 2; i++){ s->linelen[lev][i] = b[i][1] - b[i][0]; s->mod[lev][i] = b[i][0] & 1; for (j = 0; j < 2; j++) b[i][j] = (b[i][j] + 1) >> 1; } } if (type == FF_DWT97) s->linebuf = av_malloc((maxlen + 12) * sizeof(float)); else if (type == FF_DWT53) s->linebuf = av_malloc((maxlen + 6) * sizeof(int)); else return -1; if (!s->linebuf) return AVERROR(ENOMEM); return 0; }
{ "code": [ " if (decomp_levels >= FF_DWT_MAX_DECLVLS)" ], "line_no": [ 11 ] }
int FUNC_0(DWTContext *VAR_0, uint16_t VAR_1[2][2], int VAR_2, int VAR_3) { int VAR_4, VAR_5, VAR_6 = VAR_2, VAR_7, VAR_8[2][2]; if (VAR_2 >= FF_DWT_MAX_DECLVLS) return AVERROR_INVALIDDATA; VAR_0->ndeclevels = VAR_2; VAR_0->VAR_3 = VAR_3; for (VAR_4 = 0; VAR_4 < 2; VAR_4++) for(VAR_5 = 0; VAR_5 < 2; VAR_5++) VAR_8[VAR_4][VAR_5] = VAR_1[VAR_4][VAR_5]; VAR_7 = FFMAX(VAR_8[0][1] - VAR_8[0][0], VAR_8[1][1] - VAR_8[1][0]); while(--VAR_6 >= 0){ for (VAR_4 = 0; VAR_4 < 2; VAR_4++){ VAR_0->linelen[VAR_6][VAR_4] = VAR_8[VAR_4][1] - VAR_8[VAR_4][0]; VAR_0->mod[VAR_6][VAR_4] = VAR_8[VAR_4][0] & 1; for (VAR_5 = 0; VAR_5 < 2; VAR_5++) VAR_8[VAR_4][VAR_5] = (VAR_8[VAR_4][VAR_5] + 1) >> 1; } } if (VAR_3 == FF_DWT97) VAR_0->linebuf = av_malloc((VAR_7 + 12) * sizeof(float)); else if (VAR_3 == FF_DWT53) VAR_0->linebuf = av_malloc((VAR_7 + 6) * sizeof(int)); else return -1; if (!VAR_0->linebuf) return AVERROR(ENOMEM); return 0; }
[ "int FUNC_0(DWTContext *VAR_0, uint16_t VAR_1[2][2], int VAR_2, int VAR_3)\n{", "int VAR_4, VAR_5, VAR_6 = VAR_2, VAR_7,\nVAR_8[2][2];", "if (VAR_2 >= FF_DWT_MAX_DECLVLS)\nreturn AVERROR_INVALIDDATA;", "VAR_0->ndeclevels = VAR_2;", "VAR_0->VAR_3 = VAR_3;", "for (VAR_4 = 0; VAR_4 < 2; VAR_4++)", "for(VAR_5 = 0; VAR_5 < 2; VAR_5++)", "VAR_8[VAR_4][VAR_5] = VAR_1[VAR_4][VAR_5];", "VAR_7 = FFMAX(VAR_8[0][1] - VAR_8[0][0],\nVAR_8[1][1] - VAR_8[1][0]);", "while(--VAR_6 >= 0){", "for (VAR_4 = 0; VAR_4 < 2; VAR_4++){", "VAR_0->linelen[VAR_6][VAR_4] = VAR_8[VAR_4][1] - VAR_8[VAR_4][0];", "VAR_0->mod[VAR_6][VAR_4] = VAR_8[VAR_4][0] & 1;", "for (VAR_5 = 0; VAR_5 < 2; VAR_5++)", "VAR_8[VAR_4][VAR_5] = (VAR_8[VAR_4][VAR_5] + 1) >> 1;", "}", "}", "if (VAR_3 == FF_DWT97)\nVAR_0->linebuf = av_malloc((VAR_7 + 12) * sizeof(float));", "else if (VAR_3 == FF_DWT53)\nVAR_0->linebuf = av_malloc((VAR_7 + 6) * sizeof(int));", "else\nreturn -1;", "if (!VAR_0->linebuf)\nreturn AVERROR(ENOMEM);", "return 0;", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 29, 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 55, 57 ], [ 59, 61 ], [ 65, 67 ], [ 71 ], [ 73 ] ]
8,445
static int read_block_types(AVCodecContext *avctx, GetBitContext *gb, Bundle *b) { int t, v; int last = 0; const uint8_t *dec_end; CHECK_READ_VAL(gb, b, t); dec_end = b->cur_dec + t; if (dec_end > b->data_end) { av_log(avctx, AV_LOG_ERROR, "Too many block type values\n"); return -1; } if (get_bits1(gb)) { v = get_bits(gb, 4); memset(b->cur_dec, v, t); b->cur_dec += t; } else { do { v = GET_HUFF(gb, b->tree); if (v < 12) { last = v; *b->cur_dec++ = v; } else { int run = bink_rlelens[v - 12]; memset(b->cur_dec, last, run); b->cur_dec += run; } } while (b->cur_dec < dec_end); } return 0; }
true
FFmpeg
a00676e48e49a3d794d6d2063ceca539e945a4a4
static int read_block_types(AVCodecContext *avctx, GetBitContext *gb, Bundle *b) { int t, v; int last = 0; const uint8_t *dec_end; CHECK_READ_VAL(gb, b, t); dec_end = b->cur_dec + t; if (dec_end > b->data_end) { av_log(avctx, AV_LOG_ERROR, "Too many block type values\n"); return -1; } if (get_bits1(gb)) { v = get_bits(gb, 4); memset(b->cur_dec, v, t); b->cur_dec += t; } else { do { v = GET_HUFF(gb, b->tree); if (v < 12) { last = v; *b->cur_dec++ = v; } else { int run = bink_rlelens[v - 12]; memset(b->cur_dec, last, run); b->cur_dec += run; } } while (b->cur_dec < dec_end); } return 0; }
{ "code": [ " do {", " } while (b->cur_dec < dec_end);", " do {", " } while (b->cur_dec < dec_end);" ], "line_no": [ 35, 57, 35, 57 ] }
static int FUNC_0(AVCodecContext *VAR_0, GetBitContext *VAR_1, Bundle *VAR_2) { int VAR_3, VAR_4; int VAR_5 = 0; const uint8_t *VAR_6; CHECK_READ_VAL(VAR_1, VAR_2, VAR_3); VAR_6 = VAR_2->cur_dec + VAR_3; if (VAR_6 > VAR_2->data_end) { av_log(VAR_0, AV_LOG_ERROR, "Too many block type values\n"); return -1; } if (get_bits1(VAR_1)) { VAR_4 = get_bits(VAR_1, 4); memset(VAR_2->cur_dec, VAR_4, VAR_3); VAR_2->cur_dec += VAR_3; } else { do { VAR_4 = GET_HUFF(VAR_1, VAR_2->tree); if (VAR_4 < 12) { VAR_5 = VAR_4; *VAR_2->cur_dec++ = VAR_4; } else { int VAR_7 = bink_rlelens[VAR_4 - 12]; memset(VAR_2->cur_dec, VAR_5, VAR_7); VAR_2->cur_dec += VAR_7; } } while (VAR_2->cur_dec < VAR_6); } return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0, GetBitContext *VAR_1, Bundle *VAR_2)\n{", "int VAR_3, VAR_4;", "int VAR_5 = 0;", "const uint8_t *VAR_6;", "CHECK_READ_VAL(VAR_1, VAR_2, VAR_3);", "VAR_6 = VAR_2->cur_dec + VAR_3;", "if (VAR_6 > VAR_2->data_end) {", "av_log(VAR_0, AV_LOG_ERROR, \"Too many block type values\\n\");", "return -1;", "}", "if (get_bits1(VAR_1)) {", "VAR_4 = get_bits(VAR_1, 4);", "memset(VAR_2->cur_dec, VAR_4, VAR_3);", "VAR_2->cur_dec += VAR_3;", "} else {", "do {", "VAR_4 = GET_HUFF(VAR_1, VAR_2->tree);", "if (VAR_4 < 12) {", "VAR_5 = VAR_4;", "*VAR_2->cur_dec++ = VAR_4;", "} else {", "int VAR_7 = bink_rlelens[VAR_4 - 12];", "memset(VAR_2->cur_dec, VAR_5, VAR_7);", "VAR_2->cur_dec += VAR_7;", "}", "} while (VAR_2->cur_dec < VAR_6);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ] ]
8,446
static int y41p_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { AVFrame *pic = data; uint8_t *src = avpkt->data; uint8_t *y, *u, *v; int i, j, ret; if (avpkt->size < 3LL * avctx->height * avctx->width / 2) { av_log(avctx, AV_LOG_ERROR, "Insufficient input data.\n"); return AVERROR(EINVAL); } if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; pic->key_frame = 1; pic->pict_type = AV_PICTURE_TYPE_I; for (i = avctx->height - 1; i >= 0 ; i--) { y = &pic->data[0][i * pic->linesize[0]]; u = &pic->data[1][i * pic->linesize[1]]; v = &pic->data[2][i * pic->linesize[2]]; for (j = 0; j < avctx->width; j += 8) { *(u++) = *src++; *(y++) = *src++; *(v++) = *src++; *(y++) = *src++; *(u++) = *src++; *(y++) = *src++; *(v++) = *src++; *(y++) = *src++; *(y++) = *src++; *(y++) = *src++; *(y++) = *src++; *(y++) = *src++; } } *got_frame = 1; return avpkt->size; }
true
FFmpeg
3d8d3729475c7dce52d8fb9ffb280fd2ea62e1a2
static int y41p_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { AVFrame *pic = data; uint8_t *src = avpkt->data; uint8_t *y, *u, *v; int i, j, ret; if (avpkt->size < 3LL * avctx->height * avctx->width / 2) { av_log(avctx, AV_LOG_ERROR, "Insufficient input data.\n"); return AVERROR(EINVAL); } if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; pic->key_frame = 1; pic->pict_type = AV_PICTURE_TYPE_I; for (i = avctx->height - 1; i >= 0 ; i--) { y = &pic->data[0][i * pic->linesize[0]]; u = &pic->data[1][i * pic->linesize[1]]; v = &pic->data[2][i * pic->linesize[2]]; for (j = 0; j < avctx->width; j += 8) { *(u++) = *src++; *(y++) = *src++; *(v++) = *src++; *(y++) = *src++; *(u++) = *src++; *(y++) = *src++; *(v++) = *src++; *(y++) = *src++; *(y++) = *src++; *(y++) = *src++; *(y++) = *src++; *(y++) = *src++; } } *got_frame = 1; return avpkt->size; }
{ "code": [ " if (avpkt->size < 3LL * avctx->height * avctx->width / 2) {" ], "line_no": [ 17 ] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { AVFrame *pic = VAR_1; uint8_t *src = VAR_3->VAR_1; uint8_t *y, *u, *v; int VAR_4, VAR_5, VAR_6; if (VAR_3->size < 3LL * VAR_0->height * VAR_0->width / 2) { av_log(VAR_0, AV_LOG_ERROR, "Insufficient input VAR_1.\n"); return AVERROR(EINVAL); } if ((VAR_6 = ff_get_buffer(VAR_0, pic, 0)) < 0) return VAR_6; pic->key_frame = 1; pic->pict_type = AV_PICTURE_TYPE_I; for (VAR_4 = VAR_0->height - 1; VAR_4 >= 0 ; VAR_4--) { y = &pic->VAR_1[0][VAR_4 * pic->linesize[0]]; u = &pic->VAR_1[1][VAR_4 * pic->linesize[1]]; v = &pic->VAR_1[2][VAR_4 * pic->linesize[2]]; for (VAR_5 = 0; VAR_5 < VAR_0->width; VAR_5 += 8) { *(u++) = *src++; *(y++) = *src++; *(v++) = *src++; *(y++) = *src++; *(u++) = *src++; *(y++) = *src++; *(v++) = *src++; *(y++) = *src++; *(y++) = *src++; *(y++) = *src++; *(y++) = *src++; *(y++) = *src++; } } *VAR_2 = 1; return VAR_3->size; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,\nint *VAR_2, AVPacket *VAR_3)\n{", "AVFrame *pic = VAR_1;", "uint8_t *src = VAR_3->VAR_1;", "uint8_t *y, *u, *v;", "int VAR_4, VAR_5, VAR_6;", "if (VAR_3->size < 3LL * VAR_0->height * VAR_0->width / 2) {", "av_log(VAR_0, AV_LOG_ERROR, \"Insufficient input VAR_1.\\n\");", "return AVERROR(EINVAL);", "}", "if ((VAR_6 = ff_get_buffer(VAR_0, pic, 0)) < 0)\nreturn VAR_6;", "pic->key_frame = 1;", "pic->pict_type = AV_PICTURE_TYPE_I;", "for (VAR_4 = VAR_0->height - 1; VAR_4 >= 0 ; VAR_4--) {", "y = &pic->VAR_1[0][VAR_4 * pic->linesize[0]];", "u = &pic->VAR_1[1][VAR_4 * pic->linesize[1]];", "v = &pic->VAR_1[2][VAR_4 * pic->linesize[2]];", "for (VAR_5 = 0; VAR_5 < VAR_0->width; VAR_5 += 8) {", "*(u++) = *src++;", "*(y++) = *src++;", "*(v++) = *src++;", "*(y++) = *src++;", "*(u++) = *src++;", "*(y++) = *src++;", "*(v++) = *src++;", "*(y++) = *src++;", "*(y++) = *src++;", "*(y++) = *src++;", "*(y++) = *src++;", "*(y++) = *src++;", "}", "}", "*VAR_2 = 1;", "return VAR_3->size;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27, 29 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 87 ], [ 89 ] ]
8,448
static void gen_msgsnd(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); #else if (unlikely(ctx->pr)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); return; } gen_helper_msgsnd(cpu_gpr[rB(ctx->opcode)]); #endif }
true
qemu
9b2fadda3e0196ffd485adde4fe9cdd6fae35300
static void gen_msgsnd(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); #else if (unlikely(ctx->pr)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); return; } gen_helper_msgsnd(cpu_gpr[rB(ctx->opcode)]); #endif }
{ "code": [ " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#if defined(CONFIG_USER_ONLY)", "#else", " if (unlikely(ctx->pr)) {", "#endif", "#if defined(CONFIG_USER_ONLY)", "#else", " if (unlikely(ctx->pr)) {", "#endif", "#endif", "#if defined(CONFIG_USER_ONLY)", "#else", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#else", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#else", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#else", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif" ], "line_no": [ 13, 7, 11, 13, 7, 11, 13, 7, 13, 5, 9, 11, 23, 5, 9, 11, 23, 23, 5, 9, 11, 7, 11, 13, 23, 11, 23, 11, 23, 11, 23, 11, 23, 11, 23, 11, 23, 11, 23, 11, 23, 11, 23, 11, 23, 11, 23, 7, 13, 23, 7, 11, 13, 23, 7, 13, 23, 7, 13, 23, 7, 11, 13, 23, 7, 11, 13, 23, 23, 7, 11, 13, 23, 7, 11, 13, 23, 7, 11, 13, 23, 7, 11, 13, 23, 7, 11, 13, 23, 7, 11, 13, 23, 7, 11, 13, 23, 7, 11, 13, 23, 7, 11, 13, 23, 7, 11, 13, 23, 11, 23, 11, 23, 11, 23, 11, 23, 5, 7, 9, 11, 13, 23, 7, 11, 13, 23, 5, 7, 9, 11, 13, 23, 5, 7, 9, 11, 13, 23, 7, 11, 13, 23, 7, 11, 13, 23, 7, 11, 13, 23, 7, 11, 13, 23, 7, 11, 13, 23, 7, 11, 13, 23, 7, 11, 13, 23, 7, 11, 13, 23, 7, 11, 13, 23, 7, 11, 13, 23, 5, 7, 11, 13, 23, 7, 11, 13, 23, 7, 11, 13, 23, 7, 11, 13, 23, 7, 11, 13, 23, 7, 11, 13, 23, 7, 11, 13, 23, 7, 11, 13, 23, 7, 11, 13, 23 ] }
static void FUNC_0(DisasContext *VAR_0) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC); #else if (unlikely(VAR_0->pr)) { gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC); return; } gen_helper_msgsnd(cpu_gpr[rB(VAR_0->opcode)]); #endif }
[ "static void FUNC_0(DisasContext *VAR_0)\n{", "#if defined(CONFIG_USER_ONLY)\ngen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC);", "#else\nif (unlikely(VAR_0->pr)) {", "gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC);", "return;", "}", "gen_helper_msgsnd(cpu_gpr[rB(VAR_0->opcode)]);", "#endif\n}" ]
[ 0, 1, 1, 1, 0, 0, 0, 1 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23, 25 ] ]
8,450
int ff_MPV_common_frame_size_change(MpegEncContext *s) { int i, err = 0; if (s->slice_context_count > 1) { for (i = 0; i < s->slice_context_count; i++) { free_duplicate_context(s->thread_context[i]); } for (i = 1; i < s->slice_context_count; i++) { av_freep(&s->thread_context[i]); } } else free_duplicate_context(s); if ((err = free_context_frame(s)) < 0) return err; if (s->picture) for (i = 0; i < MAX_PICTURE_COUNT; i++) { s->picture[i].needs_realloc = 1; } s->last_picture_ptr = s->next_picture_ptr = s->current_picture_ptr = NULL; // init if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO && !s->progressive_sequence) s->mb_height = (s->height + 31) / 32 * 2; else s->mb_height = (s->height + 15) / 16; if ((s->width || s->height) && av_image_check_size(s->width, s->height, 0, s->avctx)) return AVERROR_INVALIDDATA; if ((err = init_context_frame(s))) goto fail; s->thread_context[0] = s; if (s->width && s->height) { int nb_slices = s->slice_context_count; if (nb_slices > 1) { for (i = 1; i < nb_slices; i++) { s->thread_context[i] = av_malloc(sizeof(MpegEncContext)); memcpy(s->thread_context[i], s, sizeof(MpegEncContext)); } for (i = 0; i < nb_slices; i++) { if (init_duplicate_context(s->thread_context[i]) < 0) goto fail; s->thread_context[i]->start_mb_y = (s->mb_height * (i) + nb_slices / 2) / nb_slices; s->thread_context[i]->end_mb_y = (s->mb_height * (i + 1) + nb_slices / 2) / nb_slices; } } else { if (init_duplicate_context(s) < 0) goto fail; s->start_mb_y = 0; s->end_mb_y = s->mb_height; } s->slice_context_count = nb_slices; } return 0; fail: ff_MPV_common_end(s); return err; }
true
FFmpeg
712ef25116b4db6dcb84bef6e1517028bc103858
int ff_MPV_common_frame_size_change(MpegEncContext *s) { int i, err = 0; if (s->slice_context_count > 1) { for (i = 0; i < s->slice_context_count; i++) { free_duplicate_context(s->thread_context[i]); } for (i = 1; i < s->slice_context_count; i++) { av_freep(&s->thread_context[i]); } } else free_duplicate_context(s); if ((err = free_context_frame(s)) < 0) return err; if (s->picture) for (i = 0; i < MAX_PICTURE_COUNT; i++) { s->picture[i].needs_realloc = 1; } s->last_picture_ptr = s->next_picture_ptr = s->current_picture_ptr = NULL; if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO && !s->progressive_sequence) s->mb_height = (s->height + 31) / 32 * 2; else s->mb_height = (s->height + 15) / 16; if ((s->width || s->height) && av_image_check_size(s->width, s->height, 0, s->avctx)) return AVERROR_INVALIDDATA; if ((err = init_context_frame(s))) goto fail; s->thread_context[0] = s; if (s->width && s->height) { int nb_slices = s->slice_context_count; if (nb_slices > 1) { for (i = 1; i < nb_slices; i++) { s->thread_context[i] = av_malloc(sizeof(MpegEncContext)); memcpy(s->thread_context[i], s, sizeof(MpegEncContext)); } for (i = 0; i < nb_slices; i++) { if (init_duplicate_context(s->thread_context[i]) < 0) goto fail; s->thread_context[i]->start_mb_y = (s->mb_height * (i) + nb_slices / 2) / nb_slices; s->thread_context[i]->end_mb_y = (s->mb_height * (i + 1) + nb_slices / 2) / nb_slices; } } else { if (init_duplicate_context(s) < 0) goto fail; s->start_mb_y = 0; s->end_mb_y = s->mb_height; } s->slice_context_count = nb_slices; } return 0; fail: ff_MPV_common_end(s); return err; }
{ "code": [ " if (init_duplicate_context(s) < 0)" ], "line_no": [ 117 ] }
int FUNC_0(MpegEncContext *VAR_0) { int VAR_1, VAR_2 = 0; if (VAR_0->slice_context_count > 1) { for (VAR_1 = 0; VAR_1 < VAR_0->slice_context_count; VAR_1++) { free_duplicate_context(VAR_0->thread_context[VAR_1]); } for (VAR_1 = 1; VAR_1 < VAR_0->slice_context_count; VAR_1++) { av_freep(&VAR_0->thread_context[VAR_1]); } } else free_duplicate_context(VAR_0); if ((VAR_2 = free_context_frame(VAR_0)) < 0) return VAR_2; if (VAR_0->picture) for (VAR_1 = 0; VAR_1 < MAX_PICTURE_COUNT; VAR_1++) { VAR_0->picture[VAR_1].needs_realloc = 1; } VAR_0->last_picture_ptr = VAR_0->next_picture_ptr = VAR_0->current_picture_ptr = NULL; if (VAR_0->codec_id == AV_CODEC_ID_MPEG2VIDEO && !VAR_0->progressive_sequence) VAR_0->mb_height = (VAR_0->height + 31) / 32 * 2; else VAR_0->mb_height = (VAR_0->height + 15) / 16; if ((VAR_0->width || VAR_0->height) && av_image_check_size(VAR_0->width, VAR_0->height, 0, VAR_0->avctx)) return AVERROR_INVALIDDATA; if ((VAR_2 = init_context_frame(VAR_0))) goto fail; VAR_0->thread_context[0] = VAR_0; if (VAR_0->width && VAR_0->height) { int VAR_3 = VAR_0->slice_context_count; if (VAR_3 > 1) { for (VAR_1 = 1; VAR_1 < VAR_3; VAR_1++) { VAR_0->thread_context[VAR_1] = av_malloc(sizeof(MpegEncContext)); memcpy(VAR_0->thread_context[VAR_1], VAR_0, sizeof(MpegEncContext)); } for (VAR_1 = 0; VAR_1 < VAR_3; VAR_1++) { if (init_duplicate_context(VAR_0->thread_context[VAR_1]) < 0) goto fail; VAR_0->thread_context[VAR_1]->start_mb_y = (VAR_0->mb_height * (VAR_1) + VAR_3 / 2) / VAR_3; VAR_0->thread_context[VAR_1]->end_mb_y = (VAR_0->mb_height * (VAR_1 + 1) + VAR_3 / 2) / VAR_3; } } else { if (init_duplicate_context(VAR_0) < 0) goto fail; VAR_0->start_mb_y = 0; VAR_0->end_mb_y = VAR_0->mb_height; } VAR_0->slice_context_count = VAR_3; } return 0; fail: ff_MPV_common_end(VAR_0); return VAR_2; }
[ "int FUNC_0(MpegEncContext *VAR_0)\n{", "int VAR_1, VAR_2 = 0;", "if (VAR_0->slice_context_count > 1) {", "for (VAR_1 = 0; VAR_1 < VAR_0->slice_context_count; VAR_1++) {", "free_duplicate_context(VAR_0->thread_context[VAR_1]);", "}", "for (VAR_1 = 1; VAR_1 < VAR_0->slice_context_count; VAR_1++) {", "av_freep(&VAR_0->thread_context[VAR_1]);", "}", "} else", "free_duplicate_context(VAR_0);", "if ((VAR_2 = free_context_frame(VAR_0)) < 0)\nreturn VAR_2;", "if (VAR_0->picture)\nfor (VAR_1 = 0; VAR_1 < MAX_PICTURE_COUNT; VAR_1++) {", "VAR_0->picture[VAR_1].needs_realloc = 1;", "}", "VAR_0->last_picture_ptr =\nVAR_0->next_picture_ptr =\nVAR_0->current_picture_ptr = NULL;", "if (VAR_0->codec_id == AV_CODEC_ID_MPEG2VIDEO && !VAR_0->progressive_sequence)\nVAR_0->mb_height = (VAR_0->height + 31) / 32 * 2;", "else\nVAR_0->mb_height = (VAR_0->height + 15) / 16;", "if ((VAR_0->width || VAR_0->height) &&\nav_image_check_size(VAR_0->width, VAR_0->height, 0, VAR_0->avctx))\nreturn AVERROR_INVALIDDATA;", "if ((VAR_2 = init_context_frame(VAR_0)))\ngoto fail;", "VAR_0->thread_context[0] = VAR_0;", "if (VAR_0->width && VAR_0->height) {", "int VAR_3 = VAR_0->slice_context_count;", "if (VAR_3 > 1) {", "for (VAR_1 = 1; VAR_1 < VAR_3; VAR_1++) {", "VAR_0->thread_context[VAR_1] = av_malloc(sizeof(MpegEncContext));", "memcpy(VAR_0->thread_context[VAR_1], VAR_0, sizeof(MpegEncContext));", "}", "for (VAR_1 = 0; VAR_1 < VAR_3; VAR_1++) {", "if (init_duplicate_context(VAR_0->thread_context[VAR_1]) < 0)\ngoto fail;", "VAR_0->thread_context[VAR_1]->start_mb_y =\n(VAR_0->mb_height * (VAR_1) + VAR_3 / 2) / VAR_3;", "VAR_0->thread_context[VAR_1]->end_mb_y =\n(VAR_0->mb_height * (VAR_1 + 1) + VAR_3 / 2) / VAR_3;", "}", "} else {", "if (init_duplicate_context(VAR_0) < 0)\ngoto fail;", "VAR_0->start_mb_y = 0;", "VAR_0->end_mb_y = VAR_0->mb_height;", "}", "VAR_0->slice_context_count = VAR_3;", "}", "return 0;", "fail:\nff_MPV_common_end(VAR_0);", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29, 31 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 45, 47, 49 ], [ 55, 57 ], [ 59, 61 ], [ 65, 67, 69 ], [ 73, 75 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101, 103 ], [ 105, 107 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 141 ] ]
8,452
static void pc_isa_bios_init(MemoryRegion *rom_memory, MemoryRegion *flash_mem, int ram_size) { int isa_bios_size; MemoryRegion *isa_bios; uint64_t flash_size; void *flash_ptr, *isa_bios_ptr; flash_size = memory_region_size(flash_mem); /* map the last 128KB of the BIOS in ISA space */ isa_bios_size = flash_size; if (isa_bios_size > (128 * 1024)) { isa_bios_size = 128 * 1024; } isa_bios = g_malloc(sizeof(*isa_bios)); memory_region_init_ram(isa_bios, NULL, "isa-bios", isa_bios_size); vmstate_register_ram_global(isa_bios); memory_region_add_subregion_overlap(rom_memory, 0x100000 - isa_bios_size, isa_bios, 1); /* copy ISA rom image from top of flash memory */ flash_ptr = memory_region_get_ram_ptr(flash_mem); isa_bios_ptr = memory_region_get_ram_ptr(isa_bios); memcpy(isa_bios_ptr, ((uint8_t*)flash_ptr) + (flash_size - isa_bios_size), isa_bios_size); memory_region_set_readonly(isa_bios, true); }
true
qemu
7f87af39dc786a979e7ebba338d0781e366060ed
static void pc_isa_bios_init(MemoryRegion *rom_memory, MemoryRegion *flash_mem, int ram_size) { int isa_bios_size; MemoryRegion *isa_bios; uint64_t flash_size; void *flash_ptr, *isa_bios_ptr; flash_size = memory_region_size(flash_mem); isa_bios_size = flash_size; if (isa_bios_size > (128 * 1024)) { isa_bios_size = 128 * 1024; } isa_bios = g_malloc(sizeof(*isa_bios)); memory_region_init_ram(isa_bios, NULL, "isa-bios", isa_bios_size); vmstate_register_ram_global(isa_bios); memory_region_add_subregion_overlap(rom_memory, 0x100000 - isa_bios_size, isa_bios, 1); flash_ptr = memory_region_get_ram_ptr(flash_mem); isa_bios_ptr = memory_region_get_ram_ptr(isa_bios); memcpy(isa_bios_ptr, ((uint8_t*)flash_ptr) + (flash_size - isa_bios_size), isa_bios_size); memory_region_set_readonly(isa_bios, true); }
{ "code": [ " isa_bios_size = flash_size;", " if (isa_bios_size > (128 * 1024)) {", " isa_bios_size = 128 * 1024;" ], "line_no": [ 25, 27, 29 ] }
static void FUNC_0(MemoryRegion *VAR_0, MemoryRegion *VAR_1, int VAR_2) { int VAR_3; MemoryRegion *isa_bios; uint64_t flash_size; void *VAR_4, *VAR_5; flash_size = memory_region_size(VAR_1); VAR_3 = flash_size; if (VAR_3 > (128 * 1024)) { VAR_3 = 128 * 1024; } isa_bios = g_malloc(sizeof(*isa_bios)); memory_region_init_ram(isa_bios, NULL, "isa-bios", VAR_3); vmstate_register_ram_global(isa_bios); memory_region_add_subregion_overlap(VAR_0, 0x100000 - VAR_3, isa_bios, 1); VAR_4 = memory_region_get_ram_ptr(VAR_1); VAR_5 = memory_region_get_ram_ptr(isa_bios); memcpy(VAR_5, ((uint8_t*)VAR_4) + (flash_size - VAR_3), VAR_3); memory_region_set_readonly(isa_bios, true); }
[ "static void FUNC_0(MemoryRegion *VAR_0,\nMemoryRegion *VAR_1,\nint VAR_2)\n{", "int VAR_3;", "MemoryRegion *isa_bios;", "uint64_t flash_size;", "void *VAR_4, *VAR_5;", "flash_size = memory_region_size(VAR_1);", "VAR_3 = flash_size;", "if (VAR_3 > (128 * 1024)) {", "VAR_3 = 128 * 1024;", "}", "isa_bios = g_malloc(sizeof(*isa_bios));", "memory_region_init_ram(isa_bios, NULL, \"isa-bios\", VAR_3);", "vmstate_register_ram_global(isa_bios);", "memory_region_add_subregion_overlap(VAR_0,\n0x100000 - VAR_3,\nisa_bios,\n1);", "VAR_4 = memory_region_get_ram_ptr(VAR_1);", "VAR_5 = memory_region_get_ram_ptr(isa_bios);", "memcpy(VAR_5,\n((uint8_t*)VAR_4) + (flash_size - VAR_3),\nVAR_3);", "memory_region_set_readonly(isa_bios, true);", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41, 43, 45 ], [ 51 ], [ 53 ], [ 55, 57, 59 ], [ 63 ], [ 65 ] ]
8,453
static void gen_tlbivax_booke206(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); #else TCGv t0; if (unlikely(ctx->pr)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); return; } t0 = tcg_temp_new(); gen_addr_reg_index(ctx, t0); gen_helper_booke206_tlbivax(cpu_env, t0); tcg_temp_free(t0); #endif }
true
qemu
9b2fadda3e0196ffd485adde4fe9cdd6fae35300
static void gen_tlbivax_booke206(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); #else TCGv t0; if (unlikely(ctx->pr)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); return; } t0 = tcg_temp_new(); gen_addr_reg_index(ctx, t0); gen_helper_booke206_tlbivax(cpu_env, t0); tcg_temp_free(t0); #endif }
{ "code": [ " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#if defined(CONFIG_USER_ONLY)", "#else", " if (unlikely(ctx->pr)) {", "#endif", "#if defined(CONFIG_USER_ONLY)", "#else", " if (unlikely(ctx->pr)) {", "#endif", "#endif", "#if defined(CONFIG_USER_ONLY)", "#else", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#else", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#else", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#else", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif" ], "line_no": [ 15, 7, 13, 15, 7, 13, 15, 7, 15, 5, 9, 13, 33, 5, 9, 13, 33, 33, 5, 9, 13, 7, 13, 15, 33, 13, 33, 13, 33, 13, 33, 13, 33, 13, 33, 13, 33, 13, 33, 13, 33, 13, 33, 13, 33, 13, 33, 7, 15, 33, 7, 13, 15, 33, 7, 15, 33, 7, 15, 33, 7, 13, 15, 33, 7, 13, 15, 33, 33, 7, 13, 15, 33, 7, 13, 15, 33, 7, 13, 15, 33, 7, 13, 15, 33, 7, 13, 15, 33, 7, 13, 15, 33, 7, 13, 15, 33, 7, 13, 15, 33, 7, 13, 15, 33, 7, 13, 15, 33, 13, 33, 13, 33, 13, 33, 13, 33, 5, 7, 9, 13, 15, 33, 7, 13, 15, 33, 5, 7, 9, 13, 15, 33, 5, 7, 9, 13, 15, 33, 7, 13, 15, 33, 7, 13, 15, 33, 7, 13, 15, 33, 7, 13, 15, 33, 7, 13, 15, 33, 7, 13, 15, 33, 7, 13, 15, 33, 7, 13, 15, 33, 7, 13, 15, 33, 7, 13, 15, 33, 5, 7, 13, 15, 33, 7, 13, 15, 33, 7, 13, 15, 33, 7, 13, 15, 33, 7, 13, 15, 33, 7, 13, 15, 33, 7, 13, 15, 33, 7, 13, 15, 33, 7, 13, 15, 33 ] }
static void FUNC_0(DisasContext *VAR_0) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC); #else TCGv t0; if (unlikely(VAR_0->pr)) { gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC); return; } t0 = tcg_temp_new(); gen_addr_reg_index(VAR_0, t0); gen_helper_booke206_tlbivax(cpu_env, t0); tcg_temp_free(t0); #endif }
[ "static void FUNC_0(DisasContext *VAR_0)\n{", "#if defined(CONFIG_USER_ONLY)\ngen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC);", "#else\nTCGv t0;", "if (unlikely(VAR_0->pr)) {", "gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC);", "return;", "}", "t0 = tcg_temp_new();", "gen_addr_reg_index(VAR_0, t0);", "gen_helper_booke206_tlbivax(cpu_env, t0);", "tcg_temp_free(t0);", "#endif\n}" ]
[ 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33, 35 ] ]
8,454
void helper_ldf_asi(target_ulong addr, int asi, int size, int rd) { unsigned int i; target_ulong val; helper_check_align(addr, 3); addr = asi_address_mask(env, asi, addr); switch (asi) { case 0xf0: // Block load primary case 0xf1: // Block load secondary case 0xf8: // Block load primary LE case 0xf9: // Block load secondary LE *(uint32_t *)&env->fpr[rd++] = helper_ld_asi(addr, asi & 0x8f, 4, default: break; val = helper_ld_asi(addr, asi, size, 0); switch(size) { default: case 4: *((uint32_t *)&env->fpr[rd]) = val; break; case 8: *((int64_t *)&DT0) = val; break; case 16: // XXX break;
true
qemu
0e2fa9cab9c124788077de728f1e6744d1dd8bb2
void helper_ldf_asi(target_ulong addr, int asi, int size, int rd) { unsigned int i; target_ulong val; helper_check_align(addr, 3); addr = asi_address_mask(env, asi, addr); switch (asi) { case 0xf0: case 0xf1: case 0xf8: LE case 0xf9: LE *(uint32_t *)&env->fpr[rd++] = helper_ld_asi(addr, asi & 0x8f, 4, default: break; val = helper_ld_asi(addr, asi, size, 0); switch(size) { default: case 4: *((uint32_t *)&env->fpr[rd]) = val; break; case 8: *((int64_t *)&DT0) = val; break; case 16: break;
{ "code": [], "line_no": [] }
void FUNC_0(target_ulong VAR_0, int VAR_1, int VAR_2, int VAR_3) { unsigned int VAR_4; target_ulong val; helper_check_align(VAR_0, 3); VAR_0 = asi_address_mask(env, VAR_1, VAR_0); switch (VAR_1) { case 0xf0: case 0xf1: case 0xf8: LE case 0xf9: LE *(uint32_t *)&env->fpr[VAR_3++] = helper_ld_asi(VAR_0, VAR_1 & 0x8f, 4, default: break; val = helper_ld_asi(VAR_0, VAR_1, VAR_2, 0); switch(VAR_2) { default: case 4: *((uint32_t *)&env->fpr[VAR_3]) = val; break; case 8: *((int64_t *)&DT0) = val; break; case 16: break;
[ "void FUNC_0(target_ulong VAR_0, int VAR_1, int VAR_2, int VAR_3)\n{", "unsigned int VAR_4;", "target_ulong val;", "helper_check_align(VAR_0, 3);", "VAR_0 = asi_address_mask(env, VAR_1, VAR_0);", "switch (VAR_1) {", "case 0xf0:\ncase 0xf1:\ncase 0xf8: LE\ncase 0xf9: LE\n*(uint32_t *)&env->fpr[VAR_3++] = helper_ld_asi(VAR_0, VAR_1 & 0x8f, 4,\ndefault:\nbreak;", "val = helper_ld_asi(VAR_0, VAR_1, VAR_2, 0);", "switch(VAR_2) {", "default:\ncase 4:\n*((uint32_t *)&env->fpr[VAR_3]) = val;", "break;", "case 8:\n*((int64_t *)&DT0) = val;", "break;", "case 16:\nbreak;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8, 9, 10, 11, 12, 13, 14 ], [ 15 ], [ 16 ], [ 17, 18, 19 ], [ 20 ], [ 21, 22 ], [ 23 ], [ 24, 26 ] ]
8,455
static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss, int se, int Ah, int Al) { int mb_x, mb_y; int EOBRUN = 0; int c = s->comp_index[0]; uint8_t *data = s->picture_ptr->data[c]; int linesize = s->linesize[c]; int last_scan = 0; int16_t *quant_matrix = s->quant_matrixes[s->quant_sindex[0]]; int bytes_per_pixel = 1 + (s->bits > 8); av_assert0(ss>=0 && Ah>=0 && Al>=0); if (se < ss || se > 63) { av_log(s->avctx, AV_LOG_ERROR, "SS/SE %d/%d is invalid\n", ss, se); return AVERROR_INVALIDDATA; } if (!Al) { s->coefs_finished[c] |= (2LL << se) - (1LL << ss); last_scan = !~s->coefs_finished[c]; } if (s->interlaced && s->bottom_field) data += linesize >> 1; s->restart_count = 0; for (mb_y = 0; mb_y < s->mb_height; mb_y++) { uint8_t *ptr = data + (mb_y * linesize * 8 >> s->avctx->lowres); int block_idx = mb_y * s->block_stride[c]; int16_t (*block)[64] = &s->blocks[c][block_idx]; uint8_t *last_nnz = &s->last_nnz[c][block_idx]; for (mb_x = 0; mb_x < s->mb_width; mb_x++, block++, last_nnz++) { int ret; if (s->restart_interval && !s->restart_count) s->restart_count = s->restart_interval; if (Ah) ret = decode_block_refinement(s, *block, last_nnz, s->ac_index[0], quant_matrix, ss, se, Al, &EOBRUN); else ret = decode_block_progressive(s, *block, last_nnz, s->ac_index[0], quant_matrix, ss, se, Al, &EOBRUN); if (ret < 0) { av_log(s->avctx, AV_LOG_ERROR, "error y=%d x=%d\n", mb_y, mb_x); return AVERROR_INVALIDDATA; } if (last_scan) { s->dsp.idct_put(ptr, linesize, *block); if (s->bits & 7) shift_output(s, ptr, linesize); ptr += bytes_per_pixel*8 >> s->avctx->lowres; } if (handle_rstn(s, 0)) EOBRUN = 0; } } return 0; }
true
FFmpeg
e31727bd53fc69ace0373deabf48360ac6af94ec
static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss, int se, int Ah, int Al) { int mb_x, mb_y; int EOBRUN = 0; int c = s->comp_index[0]; uint8_t *data = s->picture_ptr->data[c]; int linesize = s->linesize[c]; int last_scan = 0; int16_t *quant_matrix = s->quant_matrixes[s->quant_sindex[0]]; int bytes_per_pixel = 1 + (s->bits > 8); av_assert0(ss>=0 && Ah>=0 && Al>=0); if (se < ss || se > 63) { av_log(s->avctx, AV_LOG_ERROR, "SS/SE %d/%d is invalid\n", ss, se); return AVERROR_INVALIDDATA; } if (!Al) { s->coefs_finished[c] |= (2LL << se) - (1LL << ss); last_scan = !~s->coefs_finished[c]; } if (s->interlaced && s->bottom_field) data += linesize >> 1; s->restart_count = 0; for (mb_y = 0; mb_y < s->mb_height; mb_y++) { uint8_t *ptr = data + (mb_y * linesize * 8 >> s->avctx->lowres); int block_idx = mb_y * s->block_stride[c]; int16_t (*block)[64] = &s->blocks[c][block_idx]; uint8_t *last_nnz = &s->last_nnz[c][block_idx]; for (mb_x = 0; mb_x < s->mb_width; mb_x++, block++, last_nnz++) { int ret; if (s->restart_interval && !s->restart_count) s->restart_count = s->restart_interval; if (Ah) ret = decode_block_refinement(s, *block, last_nnz, s->ac_index[0], quant_matrix, ss, se, Al, &EOBRUN); else ret = decode_block_progressive(s, *block, last_nnz, s->ac_index[0], quant_matrix, ss, se, Al, &EOBRUN); if (ret < 0) { av_log(s->avctx, AV_LOG_ERROR, "error y=%d x=%d\n", mb_y, mb_x); return AVERROR_INVALIDDATA; } if (last_scan) { s->dsp.idct_put(ptr, linesize, *block); if (s->bits & 7) shift_output(s, ptr, linesize); ptr += bytes_per_pixel*8 >> s->avctx->lowres; } if (handle_rstn(s, 0)) EOBRUN = 0; } } return 0; }
{ "code": [ " s->coefs_finished[c] |= (2LL << se) - (1LL << ss);" ], "line_no": [ 39 ] }
static int FUNC_0(MJpegDecodeContext *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4) { int VAR_5, VAR_6; int VAR_7 = 0; int VAR_8 = VAR_0->comp_index[0]; uint8_t *data = VAR_0->picture_ptr->data[VAR_8]; int VAR_9 = VAR_0->VAR_9[VAR_8]; int VAR_10 = 0; int16_t *quant_matrix = VAR_0->quant_matrixes[VAR_0->quant_sindex[0]]; int VAR_11 = 1 + (VAR_0->bits > 8); av_assert0(VAR_1>=0 && VAR_3>=0 && VAR_4>=0); if (VAR_2 < VAR_1 || VAR_2 > 63) { av_log(VAR_0->avctx, AV_LOG_ERROR, "SS/SE %d/%d is invalid\n", VAR_1, VAR_2); return AVERROR_INVALIDDATA; } if (!VAR_4) { VAR_0->coefs_finished[VAR_8] |= (2LL << VAR_2) - (1LL << VAR_1); VAR_10 = !~VAR_0->coefs_finished[VAR_8]; } if (VAR_0->interlaced && VAR_0->bottom_field) data += VAR_9 >> 1; VAR_0->restart_count = 0; for (VAR_6 = 0; VAR_6 < VAR_0->mb_height; VAR_6++) { uint8_t *ptr = data + (VAR_6 * VAR_9 * 8 >> VAR_0->avctx->lowres); int block_idx = VAR_6 * VAR_0->block_stride[VAR_8]; int16_t (*block)[64] = &VAR_0->blocks[VAR_8][block_idx]; uint8_t *last_nnz = &VAR_0->last_nnz[VAR_8][block_idx]; for (VAR_5 = 0; VAR_5 < VAR_0->mb_width; VAR_5++, block++, last_nnz++) { int ret; if (VAR_0->restart_interval && !VAR_0->restart_count) VAR_0->restart_count = VAR_0->restart_interval; if (VAR_3) ret = decode_block_refinement(VAR_0, *block, last_nnz, VAR_0->ac_index[0], quant_matrix, VAR_1, VAR_2, VAR_4, &VAR_7); else ret = decode_block_progressive(VAR_0, *block, last_nnz, VAR_0->ac_index[0], quant_matrix, VAR_1, VAR_2, VAR_4, &VAR_7); if (ret < 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "error y=%d x=%d\n", VAR_6, VAR_5); return AVERROR_INVALIDDATA; } if (VAR_10) { VAR_0->dsp.idct_put(ptr, VAR_9, *block); if (VAR_0->bits & 7) shift_output(VAR_0, ptr, VAR_9); ptr += VAR_11*8 >> VAR_0->avctx->lowres; } if (handle_rstn(VAR_0, 0)) VAR_7 = 0; } } return 0; }
[ "static int FUNC_0(MJpegDecodeContext *VAR_0, int VAR_1,\nint VAR_2, int VAR_3, int VAR_4)\n{", "int VAR_5, VAR_6;", "int VAR_7 = 0;", "int VAR_8 = VAR_0->comp_index[0];", "uint8_t *data = VAR_0->picture_ptr->data[VAR_8];", "int VAR_9 = VAR_0->VAR_9[VAR_8];", "int VAR_10 = 0;", "int16_t *quant_matrix = VAR_0->quant_matrixes[VAR_0->quant_sindex[0]];", "int VAR_11 = 1 + (VAR_0->bits > 8);", "av_assert0(VAR_1>=0 && VAR_3>=0 && VAR_4>=0);", "if (VAR_2 < VAR_1 || VAR_2 > 63) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"SS/SE %d/%d is invalid\\n\", VAR_1, VAR_2);", "return AVERROR_INVALIDDATA;", "}", "if (!VAR_4) {", "VAR_0->coefs_finished[VAR_8] |= (2LL << VAR_2) - (1LL << VAR_1);", "VAR_10 = !~VAR_0->coefs_finished[VAR_8];", "}", "if (VAR_0->interlaced && VAR_0->bottom_field)\ndata += VAR_9 >> 1;", "VAR_0->restart_count = 0;", "for (VAR_6 = 0; VAR_6 < VAR_0->mb_height; VAR_6++) {", "uint8_t *ptr = data + (VAR_6 * VAR_9 * 8 >> VAR_0->avctx->lowres);", "int block_idx = VAR_6 * VAR_0->block_stride[VAR_8];", "int16_t (*block)[64] = &VAR_0->blocks[VAR_8][block_idx];", "uint8_t *last_nnz = &VAR_0->last_nnz[VAR_8][block_idx];", "for (VAR_5 = 0; VAR_5 < VAR_0->mb_width; VAR_5++, block++, last_nnz++) {", "int ret;", "if (VAR_0->restart_interval && !VAR_0->restart_count)\nVAR_0->restart_count = VAR_0->restart_interval;", "if (VAR_3)\nret = decode_block_refinement(VAR_0, *block, last_nnz, VAR_0->ac_index[0],\nquant_matrix, VAR_1, VAR_2, VAR_4, &VAR_7);", "else\nret = decode_block_progressive(VAR_0, *block, last_nnz, VAR_0->ac_index[0],\nquant_matrix, VAR_1, VAR_2, VAR_4, &VAR_7);", "if (ret < 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"error y=%d x=%d\\n\", VAR_6, VAR_5);", "return AVERROR_INVALIDDATA;", "}", "if (VAR_10) {", "VAR_0->dsp.idct_put(ptr, VAR_9, *block);", "if (VAR_0->bits & 7)\nshift_output(VAR_0, ptr, VAR_9);", "ptr += VAR_11*8 >> VAR_0->avctx->lowres;", "}", "if (handle_rstn(VAR_0, 0))\nVAR_7 = 0;", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47, 49 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 77, 79, 81 ], [ 83, 85, 87 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105, 107 ], [ 109 ], [ 111 ], [ 113, 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ] ]
8,458
struct omap_dss_s *omap_dss_init(struct omap_target_agent_s *ta, MemoryRegion *sysmem, hwaddr l3_base, qemu_irq irq, qemu_irq drq, omap_clk fck1, omap_clk fck2, omap_clk ck54m, omap_clk ick1, omap_clk ick2) { struct omap_dss_s *s = (struct omap_dss_s *) g_malloc0(sizeof(struct omap_dss_s)); s->irq = irq; s->drq = drq; omap_dss_reset(s); memory_region_init_io(&s->iomem_diss1, NULL, &omap_diss_ops, s, "omap.diss1", omap_l4_region_size(ta, 0)); memory_region_init_io(&s->iomem_disc1, NULL, &omap_disc_ops, s, "omap.disc1", omap_l4_region_size(ta, 1)); memory_region_init_io(&s->iomem_rfbi1, NULL, &omap_rfbi_ops, s, "omap.rfbi1", omap_l4_region_size(ta, 2)); memory_region_init_io(&s->iomem_venc1, NULL, &omap_venc_ops, s, "omap.venc1", omap_l4_region_size(ta, 3)); memory_region_init_io(&s->iomem_im3, NULL, &omap_im3_ops, s, "omap.im3", 0x1000); omap_l4_attach(ta, 0, &s->iomem_diss1); omap_l4_attach(ta, 1, &s->iomem_disc1); omap_l4_attach(ta, 2, &s->iomem_rfbi1); omap_l4_attach(ta, 3, &s->iomem_venc1); memory_region_add_subregion(sysmem, l3_base, &s->iomem_im3); #if 0 s->state = graphic_console_init(omap_update_display, omap_invalidate_display, omap_screen_dump, s); #endif return s; }
true
qemu
b45c03f585ea9bb1af76c73e82195418c294919d
struct omap_dss_s *omap_dss_init(struct omap_target_agent_s *ta, MemoryRegion *sysmem, hwaddr l3_base, qemu_irq irq, qemu_irq drq, omap_clk fck1, omap_clk fck2, omap_clk ck54m, omap_clk ick1, omap_clk ick2) { struct omap_dss_s *s = (struct omap_dss_s *) g_malloc0(sizeof(struct omap_dss_s)); s->irq = irq; s->drq = drq; omap_dss_reset(s); memory_region_init_io(&s->iomem_diss1, NULL, &omap_diss_ops, s, "omap.diss1", omap_l4_region_size(ta, 0)); memory_region_init_io(&s->iomem_disc1, NULL, &omap_disc_ops, s, "omap.disc1", omap_l4_region_size(ta, 1)); memory_region_init_io(&s->iomem_rfbi1, NULL, &omap_rfbi_ops, s, "omap.rfbi1", omap_l4_region_size(ta, 2)); memory_region_init_io(&s->iomem_venc1, NULL, &omap_venc_ops, s, "omap.venc1", omap_l4_region_size(ta, 3)); memory_region_init_io(&s->iomem_im3, NULL, &omap_im3_ops, s, "omap.im3", 0x1000); omap_l4_attach(ta, 0, &s->iomem_diss1); omap_l4_attach(ta, 1, &s->iomem_disc1); omap_l4_attach(ta, 2, &s->iomem_rfbi1); omap_l4_attach(ta, 3, &s->iomem_venc1); memory_region_add_subregion(sysmem, l3_base, &s->iomem_im3); #if 0 s->state = graphic_console_init(omap_update_display, omap_invalidate_display, omap_screen_dump, s); #endif return s; }
{ "code": [ " struct omap_dss_s *s = (struct omap_dss_s *)", " g_malloc0(sizeof(struct omap_dss_s));" ], "line_no": [ 15, 17 ] }
struct omap_dss_s *FUNC_0(struct omap_target_agent_s *VAR_0, MemoryRegion *VAR_1, hwaddr VAR_2, qemu_irq VAR_3, qemu_irq VAR_4, omap_clk VAR_5, omap_clk VAR_6, omap_clk VAR_7, omap_clk VAR_8, omap_clk VAR_9) { struct omap_dss_s *VAR_10 = (struct omap_dss_s *) g_malloc0(sizeof(struct omap_dss_s)); VAR_10->VAR_3 = VAR_3; VAR_10->VAR_4 = VAR_4; omap_dss_reset(VAR_10); memory_region_init_io(&VAR_10->iomem_diss1, NULL, &omap_diss_ops, VAR_10, "omap.diss1", omap_l4_region_size(VAR_0, 0)); memory_region_init_io(&VAR_10->iomem_disc1, NULL, &omap_disc_ops, VAR_10, "omap.disc1", omap_l4_region_size(VAR_0, 1)); memory_region_init_io(&VAR_10->iomem_rfbi1, NULL, &omap_rfbi_ops, VAR_10, "omap.rfbi1", omap_l4_region_size(VAR_0, 2)); memory_region_init_io(&VAR_10->iomem_venc1, NULL, &omap_venc_ops, VAR_10, "omap.venc1", omap_l4_region_size(VAR_0, 3)); memory_region_init_io(&VAR_10->iomem_im3, NULL, &omap_im3_ops, VAR_10, "omap.im3", 0x1000); omap_l4_attach(VAR_0, 0, &VAR_10->iomem_diss1); omap_l4_attach(VAR_0, 1, &VAR_10->iomem_disc1); omap_l4_attach(VAR_0, 2, &VAR_10->iomem_rfbi1); omap_l4_attach(VAR_0, 3, &VAR_10->iomem_venc1); memory_region_add_subregion(VAR_1, VAR_2, &VAR_10->iomem_im3); #if 0 VAR_10->state = graphic_console_init(omap_update_display, omap_invalidate_display, omap_screen_dump, VAR_10); #endif return VAR_10; }
[ "struct omap_dss_s *FUNC_0(struct omap_target_agent_s *VAR_0,\nMemoryRegion *VAR_1,\nhwaddr VAR_2,\nqemu_irq VAR_3, qemu_irq VAR_4,\nomap_clk VAR_5, omap_clk VAR_6, omap_clk VAR_7,\nomap_clk VAR_8, omap_clk VAR_9)\n{", "struct omap_dss_s *VAR_10 = (struct omap_dss_s *)\ng_malloc0(sizeof(struct omap_dss_s));", "VAR_10->VAR_3 = VAR_3;", "VAR_10->VAR_4 = VAR_4;", "omap_dss_reset(VAR_10);", "memory_region_init_io(&VAR_10->iomem_diss1, NULL, &omap_diss_ops, VAR_10, \"omap.diss1\",\nomap_l4_region_size(VAR_0, 0));", "memory_region_init_io(&VAR_10->iomem_disc1, NULL, &omap_disc_ops, VAR_10, \"omap.disc1\",\nomap_l4_region_size(VAR_0, 1));", "memory_region_init_io(&VAR_10->iomem_rfbi1, NULL, &omap_rfbi_ops, VAR_10, \"omap.rfbi1\",\nomap_l4_region_size(VAR_0, 2));", "memory_region_init_io(&VAR_10->iomem_venc1, NULL, &omap_venc_ops, VAR_10, \"omap.venc1\",\nomap_l4_region_size(VAR_0, 3));", "memory_region_init_io(&VAR_10->iomem_im3, NULL, &omap_im3_ops, VAR_10,\n\"omap.im3\", 0x1000);", "omap_l4_attach(VAR_0, 0, &VAR_10->iomem_diss1);", "omap_l4_attach(VAR_0, 1, &VAR_10->iomem_disc1);", "omap_l4_attach(VAR_0, 2, &VAR_10->iomem_rfbi1);", "omap_l4_attach(VAR_0, 3, &VAR_10->iomem_venc1);", "memory_region_add_subregion(VAR_1, VAR_2, &VAR_10->iomem_im3);", "#if 0\nVAR_10->state = graphic_console_init(omap_update_display,\nomap_invalidate_display, omap_screen_dump, VAR_10);", "#endif\nreturn VAR_10;", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13 ], [ 15, 17 ], [ 21 ], [ 23 ], [ 25 ], [ 29, 31 ], [ 33, 35 ], [ 37, 39 ], [ 41, 43 ], [ 45, 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63, 65, 67 ], [ 69, 73 ], [ 75 ] ]
8,459
int attribute_align_arg sws_scale(struct SwsContext *c, const uint8_t * const srcSlice[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) { int i, ret; const uint8_t *src2[4]; uint8_t *dst2[4]; uint8_t *rgb0_tmp = NULL; if (!srcStride || !dstStride || !dst || !srcSlice) { av_log(c, AV_LOG_ERROR, "One of the input parameters to sws_scale() is NULL, please check the calling code\n"); return 0; if (c->gamma_flag && c->cascaded_context[0]) { ret = sws_scale(c->cascaded_context[0], srcSlice, srcStride, srcSliceY, srcSliceH, c->cascaded_tmp, c->cascaded_tmpStride); if (ret < 0) return ret; if (c->cascaded_context[2]) ret = sws_scale(c->cascaded_context[1], (const uint8_t * const *)c->cascaded_tmp, c->cascaded_tmpStride, srcSliceY, srcSliceH, c->cascaded1_tmp, c->cascaded1_tmpStride); else ret = sws_scale(c->cascaded_context[1], (const uint8_t * const *)c->cascaded_tmp, c->cascaded_tmpStride, srcSliceY, srcSliceH, dst, dstStride); if (ret < 0) return ret; if (c->cascaded_context[2]) { ret = sws_scale(c->cascaded_context[2], (const uint8_t * const *)c->cascaded1_tmp, c->cascaded1_tmpStride, c->cascaded_context[1]->dstY - ret, c->cascaded_context[1]->dstY, dst, dstStride); return ret; if (c->cascaded_context[0] && srcSliceY == 0 && srcSliceH == c->cascaded_context[0]->srcH) { ret = sws_scale(c->cascaded_context[0], srcSlice, srcStride, srcSliceY, srcSliceH, c->cascaded_tmp, c->cascaded_tmpStride); if (ret < 0) return ret; ret = sws_scale(c->cascaded_context[1], (const uint8_t * const * )c->cascaded_tmp, c->cascaded_tmpStride, 0, c->cascaded_context[0]->dstH, dst, dstStride); return ret; memcpy(src2, srcSlice, sizeof(src2)); memcpy(dst2, dst, sizeof(dst2)); // do not mess up sliceDir if we have a "trailing" 0-size slice if (srcSliceH == 0) return 0; if (!check_image_pointers(srcSlice, c->srcFormat, srcStride)) { av_log(c, AV_LOG_ERROR, "bad src image pointers\n"); return 0; if (!check_image_pointers((const uint8_t* const*)dst, c->dstFormat, dstStride)) { av_log(c, AV_LOG_ERROR, "bad dst image pointers\n"); return 0; if (c->sliceDir == 0 && srcSliceY != 0 && srcSliceY + srcSliceH != c->srcH) { av_log(c, AV_LOG_ERROR, "Slices start in the middle!\n"); return 0; if (c->sliceDir == 0) { if (srcSliceY == 0) c->sliceDir = 1; else c->sliceDir = -1; if (usePal(c->srcFormat)) { for (i = 0; i < 256; i++) { int r, g, b, y, u, v, a = 0xff; if (c->srcFormat == AV_PIX_FMT_PAL8) { uint32_t p = ((const uint32_t *)(srcSlice[1]))[i]; a = (p >> 24) & 0xFF; r = (p >> 16) & 0xFF; g = (p >> 8) & 0xFF; b = p & 0xFF; } else if (c->srcFormat == AV_PIX_FMT_RGB8) { r = ( i >> 5 ) * 36; g = ((i >> 2) & 7) * 36; b = ( i & 3) * 85; } else if (c->srcFormat == AV_PIX_FMT_BGR8) { b = ( i >> 6 ) * 85; g = ((i >> 3) & 7) * 36; r = ( i & 7) * 36; } else if (c->srcFormat == AV_PIX_FMT_RGB4_BYTE) { r = ( i >> 3 ) * 255; g = ((i >> 1) & 3) * 85; b = ( i & 1) * 255; } else if (c->srcFormat == AV_PIX_FMT_GRAY8 || c->srcFormat == AV_PIX_FMT_GRAY8A) { r = g = b = i; } else { av_assert1(c->srcFormat == AV_PIX_FMT_BGR4_BYTE); b = ( i >> 3 ) * 255; g = ((i >> 1) & 3) * 85; r = ( i & 1) * 255; #define RGB2YUV_SHIFT 15 #define BY ( (int) (0.114 * 219 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) #define BV (-(int) (0.081 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) #define BU ( (int) (0.500 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) #define GY ( (int) (0.587 * 219 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) #define GV (-(int) (0.419 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) #define GU (-(int) (0.331 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) #define RY ( (int) (0.299 * 219 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) #define RV ( (int) (0.500 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) #define RU (-(int) (0.169 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) y = av_clip_uint8((RY * r + GY * g + BY * b + ( 33 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT); u = av_clip_uint8((RU * r + GU * g + BU * b + (257 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT); v = av_clip_uint8((RV * r + GV * g + BV * b + (257 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT); c->pal_yuv[i]= y + (u<<8) + (v<<16) + ((unsigned)a<<24); switch (c->dstFormat) { case AV_PIX_FMT_BGR32: #if !HAVE_BIGENDIAN case AV_PIX_FMT_RGB24: #endif c->pal_rgb[i]= r + (g<<8) + (b<<16) + ((unsigned)a<<24); break; case AV_PIX_FMT_BGR32_1: #if HAVE_BIGENDIAN case AV_PIX_FMT_BGR24: #endif c->pal_rgb[i]= a + (r<<8) + (g<<16) + ((unsigned)b<<24); break; case AV_PIX_FMT_RGB32_1: #if HAVE_BIGENDIAN case AV_PIX_FMT_RGB24: #endif c->pal_rgb[i]= a + (b<<8) + (g<<16) + ((unsigned)r<<24); break; case AV_PIX_FMT_RGB32: #if !HAVE_BIGENDIAN case AV_PIX_FMT_BGR24: #endif default: c->pal_rgb[i]= b + (g<<8) + (r<<16) + ((unsigned)a<<24); if (c->src0Alpha && !c->dst0Alpha && isALPHA(c->dstFormat)) { uint8_t *base; int x,y; rgb0_tmp = av_malloc(FFABS(srcStride[0]) * srcSliceH + 32); if (!rgb0_tmp) return AVERROR(ENOMEM); base = srcStride[0] < 0 ? rgb0_tmp - srcStride[0] * (srcSliceH-1) : rgb0_tmp; for (y=0; y<srcSliceH; y++){ memcpy(base + srcStride[0]*y, src2[0] + srcStride[0]*y, 4*c->srcW); for (x=c->src0Alpha-1; x<4*c->srcW; x+=4) { base[ srcStride[0]*y + x] = 0xFF; src2[0] = base; if (c->srcXYZ && !(c->dstXYZ && c->srcW==c->dstW && c->srcH==c->dstH)) { uint8_t *base; rgb0_tmp = av_malloc(FFABS(srcStride[0]) * srcSliceH + 32); if (!rgb0_tmp) return AVERROR(ENOMEM); base = srcStride[0] < 0 ? rgb0_tmp - srcStride[0] * (srcSliceH-1) : rgb0_tmp; xyz12Torgb48(c, (uint16_t*)base, (const uint16_t*)src2[0], srcStride[0]/2, srcSliceH); src2[0] = base; if (!srcSliceY && (c->flags & SWS_BITEXACT) && c->dither == SWS_DITHER_ED && c->dither_error[0]) for (i = 0; i < 4; i++) memset(c->dither_error[i], 0, sizeof(c->dither_error[0][0]) * (c->dstW+2)); // copy strides, so they can safely be modified if (c->sliceDir == 1) { // slices go from top to bottom int srcStride2[4] = { srcStride[0], srcStride[1], srcStride[2], srcStride[3] }; int dstStride2[4] = { dstStride[0], dstStride[1], dstStride[2], dstStride[3] }; reset_ptr(src2, c->srcFormat); reset_ptr((void*)dst2, c->dstFormat); /* reset slice direction at end of frame */ if (srcSliceY + srcSliceH == c->srcH) c->sliceDir = 0; ret = c->swscale(c, src2, srcStride2, srcSliceY, srcSliceH, dst2, dstStride2); } else { // slices go from bottom to top => we flip the image internally int srcStride2[4] = { -srcStride[0], -srcStride[1], -srcStride[2], -srcStride[3] }; int dstStride2[4] = { -dstStride[0], -dstStride[1], -dstStride[2], -dstStride[3] }; src2[0] += (srcSliceH - 1) * srcStride[0]; if (!usePal(c->srcFormat)) src2[1] += ((srcSliceH >> c->chrSrcVSubSample) - 1) * srcStride[1]; src2[2] += ((srcSliceH >> c->chrSrcVSubSample) - 1) * srcStride[2]; src2[3] += (srcSliceH - 1) * srcStride[3]; dst2[0] += ( c->dstH - 1) * dstStride[0]; dst2[1] += ((c->dstH >> c->chrDstVSubSample) - 1) * dstStride[1]; dst2[2] += ((c->dstH >> c->chrDstVSubSample) - 1) * dstStride[2]; dst2[3] += ( c->dstH - 1) * dstStride[3]; reset_ptr(src2, c->srcFormat); reset_ptr((void*)dst2, c->dstFormat); /* reset slice direction at end of frame */ if (!srcSliceY) c->sliceDir = 0; ret = c->swscale(c, src2, srcStride2, c->srcH-srcSliceY-srcSliceH, srcSliceH, dst2, dstStride2); if (c->dstXYZ && !(c->srcXYZ && c->srcW==c->dstW && c->srcH==c->dstH)) { /* replace on the same data */ rgb48Toxyz12(c, (uint16_t*)dst2[0], (const uint16_t*)dst2[0], dstStride[0]/2, ret); av_free(rgb0_tmp); return ret;
true
FFmpeg
321e85e1769ca1fc1567025ae264760790ee7fc9
int attribute_align_arg sws_scale(struct SwsContext *c, const uint8_t * const srcSlice[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) { int i, ret; const uint8_t *src2[4]; uint8_t *dst2[4]; uint8_t *rgb0_tmp = NULL; if (!srcStride || !dstStride || !dst || !srcSlice) { av_log(c, AV_LOG_ERROR, "One of the input parameters to sws_scale() is NULL, please check the calling code\n"); return 0; if (c->gamma_flag && c->cascaded_context[0]) { ret = sws_scale(c->cascaded_context[0], srcSlice, srcStride, srcSliceY, srcSliceH, c->cascaded_tmp, c->cascaded_tmpStride); if (ret < 0) return ret; if (c->cascaded_context[2]) ret = sws_scale(c->cascaded_context[1], (const uint8_t * const *)c->cascaded_tmp, c->cascaded_tmpStride, srcSliceY, srcSliceH, c->cascaded1_tmp, c->cascaded1_tmpStride); else ret = sws_scale(c->cascaded_context[1], (const uint8_t * const *)c->cascaded_tmp, c->cascaded_tmpStride, srcSliceY, srcSliceH, dst, dstStride); if (ret < 0) return ret; if (c->cascaded_context[2]) { ret = sws_scale(c->cascaded_context[2], (const uint8_t * const *)c->cascaded1_tmp, c->cascaded1_tmpStride, c->cascaded_context[1]->dstY - ret, c->cascaded_context[1]->dstY, dst, dstStride); return ret; if (c->cascaded_context[0] && srcSliceY == 0 && srcSliceH == c->cascaded_context[0]->srcH) { ret = sws_scale(c->cascaded_context[0], srcSlice, srcStride, srcSliceY, srcSliceH, c->cascaded_tmp, c->cascaded_tmpStride); if (ret < 0) return ret; ret = sws_scale(c->cascaded_context[1], (const uint8_t * const * )c->cascaded_tmp, c->cascaded_tmpStride, 0, c->cascaded_context[0]->dstH, dst, dstStride); return ret; memcpy(src2, srcSlice, sizeof(src2)); memcpy(dst2, dst, sizeof(dst2)); if (srcSliceH == 0) return 0; if (!check_image_pointers(srcSlice, c->srcFormat, srcStride)) { av_log(c, AV_LOG_ERROR, "bad src image pointers\n"); return 0; if (!check_image_pointers((const uint8_t* const*)dst, c->dstFormat, dstStride)) { av_log(c, AV_LOG_ERROR, "bad dst image pointers\n"); return 0; if (c->sliceDir == 0 && srcSliceY != 0 && srcSliceY + srcSliceH != c->srcH) { av_log(c, AV_LOG_ERROR, "Slices start in the middle!\n"); return 0; if (c->sliceDir == 0) { if (srcSliceY == 0) c->sliceDir = 1; else c->sliceDir = -1; if (usePal(c->srcFormat)) { for (i = 0; i < 256; i++) { int r, g, b, y, u, v, a = 0xff; if (c->srcFormat == AV_PIX_FMT_PAL8) { uint32_t p = ((const uint32_t *)(srcSlice[1]))[i]; a = (p >> 24) & 0xFF; r = (p >> 16) & 0xFF; g = (p >> 8) & 0xFF; b = p & 0xFF; } else if (c->srcFormat == AV_PIX_FMT_RGB8) { r = ( i >> 5 ) * 36; g = ((i >> 2) & 7) * 36; b = ( i & 3) * 85; } else if (c->srcFormat == AV_PIX_FMT_BGR8) { b = ( i >> 6 ) * 85; g = ((i >> 3) & 7) * 36; r = ( i & 7) * 36; } else if (c->srcFormat == AV_PIX_FMT_RGB4_BYTE) { r = ( i >> 3 ) * 255; g = ((i >> 1) & 3) * 85; b = ( i & 1) * 255; } else if (c->srcFormat == AV_PIX_FMT_GRAY8 || c->srcFormat == AV_PIX_FMT_GRAY8A) { r = g = b = i; } else { av_assert1(c->srcFormat == AV_PIX_FMT_BGR4_BYTE); b = ( i >> 3 ) * 255; g = ((i >> 1) & 3) * 85; r = ( i & 1) * 255; #define RGB2YUV_SHIFT 15 #define BY ( (int) (0.114 * 219 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) #define BV (-(int) (0.081 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) #define BU ( (int) (0.500 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) #define GY ( (int) (0.587 * 219 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) #define GV (-(int) (0.419 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) #define GU (-(int) (0.331 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) #define RY ( (int) (0.299 * 219 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) #define RV ( (int) (0.500 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) #define RU (-(int) (0.169 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) y = av_clip_uint8((RY * r + GY * g + BY * b + ( 33 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT); u = av_clip_uint8((RU * r + GU * g + BU * b + (257 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT); v = av_clip_uint8((RV * r + GV * g + BV * b + (257 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT); c->pal_yuv[i]= y + (u<<8) + (v<<16) + ((unsigned)a<<24); switch (c->dstFormat) { case AV_PIX_FMT_BGR32: #if !HAVE_BIGENDIAN case AV_PIX_FMT_RGB24: #endif c->pal_rgb[i]= r + (g<<8) + (b<<16) + ((unsigned)a<<24); break; case AV_PIX_FMT_BGR32_1: #if HAVE_BIGENDIAN case AV_PIX_FMT_BGR24: #endif c->pal_rgb[i]= a + (r<<8) + (g<<16) + ((unsigned)b<<24); break; case AV_PIX_FMT_RGB32_1: #if HAVE_BIGENDIAN case AV_PIX_FMT_RGB24: #endif c->pal_rgb[i]= a + (b<<8) + (g<<16) + ((unsigned)r<<24); break; case AV_PIX_FMT_RGB32: #if !HAVE_BIGENDIAN case AV_PIX_FMT_BGR24: #endif default: c->pal_rgb[i]= b + (g<<8) + (r<<16) + ((unsigned)a<<24); if (c->src0Alpha && !c->dst0Alpha && isALPHA(c->dstFormat)) { uint8_t *base; int x,y; rgb0_tmp = av_malloc(FFABS(srcStride[0]) * srcSliceH + 32); if (!rgb0_tmp) return AVERROR(ENOMEM); base = srcStride[0] < 0 ? rgb0_tmp - srcStride[0] * (srcSliceH-1) : rgb0_tmp; for (y=0; y<srcSliceH; y++){ memcpy(base + srcStride[0]*y, src2[0] + srcStride[0]*y, 4*c->srcW); for (x=c->src0Alpha-1; x<4*c->srcW; x+=4) { base[ srcStride[0]*y + x] = 0xFF; src2[0] = base; if (c->srcXYZ && !(c->dstXYZ && c->srcW==c->dstW && c->srcH==c->dstH)) { uint8_t *base; rgb0_tmp = av_malloc(FFABS(srcStride[0]) * srcSliceH + 32); if (!rgb0_tmp) return AVERROR(ENOMEM); base = srcStride[0] < 0 ? rgb0_tmp - srcStride[0] * (srcSliceH-1) : rgb0_tmp; xyz12Torgb48(c, (uint16_t*)base, (const uint16_t*)src2[0], srcStride[0]/2, srcSliceH); src2[0] = base; if (!srcSliceY && (c->flags & SWS_BITEXACT) && c->dither == SWS_DITHER_ED && c->dither_error[0]) for (i = 0; i < 4; i++) memset(c->dither_error[i], 0, sizeof(c->dither_error[0][0]) * (c->dstW+2)); if (c->sliceDir == 1) { int srcStride2[4] = { srcStride[0], srcStride[1], srcStride[2], srcStride[3] }; int dstStride2[4] = { dstStride[0], dstStride[1], dstStride[2], dstStride[3] }; reset_ptr(src2, c->srcFormat); reset_ptr((void*)dst2, c->dstFormat); if (srcSliceY + srcSliceH == c->srcH) c->sliceDir = 0; ret = c->swscale(c, src2, srcStride2, srcSliceY, srcSliceH, dst2, dstStride2); } else { int srcStride2[4] = { -srcStride[0], -srcStride[1], -srcStride[2], -srcStride[3] }; int dstStride2[4] = { -dstStride[0], -dstStride[1], -dstStride[2], -dstStride[3] }; src2[0] += (srcSliceH - 1) * srcStride[0]; if (!usePal(c->srcFormat)) src2[1] += ((srcSliceH >> c->chrSrcVSubSample) - 1) * srcStride[1]; src2[2] += ((srcSliceH >> c->chrSrcVSubSample) - 1) * srcStride[2]; src2[3] += (srcSliceH - 1) * srcStride[3]; dst2[0] += ( c->dstH - 1) * dstStride[0]; dst2[1] += ((c->dstH >> c->chrDstVSubSample) - 1) * dstStride[1]; dst2[2] += ((c->dstH >> c->chrDstVSubSample) - 1) * dstStride[2]; dst2[3] += ( c->dstH - 1) * dstStride[3]; reset_ptr(src2, c->srcFormat); reset_ptr((void*)dst2, c->dstFormat); if (!srcSliceY) c->sliceDir = 0; ret = c->swscale(c, src2, srcStride2, c->srcH-srcSliceY-srcSliceH, srcSliceH, dst2, dstStride2); if (c->dstXYZ && !(c->srcXYZ && c->srcW==c->dstW && c->srcH==c->dstH)) { rgb48Toxyz12(c, (uint16_t*)dst2[0], (const uint16_t*)dst2[0], dstStride[0]/2, ret); av_free(rgb0_tmp); return ret;
{ "code": [], "line_no": [] }
int VAR_0 sws_scale(struct SwsContext *c, const uint8_t * const srcSlice[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]) { int i, ret; const uint8_t *src2[4]; uint8_t *dst2[4]; uint8_t *rgb0_tmp = NULL; if (!srcStride || !dstStride || !dst || !srcSlice) { av_log(c, AV_LOG_ERROR, "One of the input parameters to sws_scale() is NULL, please check the calling code\n"); return 0; if (c->gamma_flag && c->cascaded_context[0]) { ret = sws_scale(c->cascaded_context[0], srcSlice, srcStride, srcSliceY, srcSliceH, c->cascaded_tmp, c->cascaded_tmpStride); if (ret < 0) return ret; if (c->cascaded_context[2]) ret = sws_scale(c->cascaded_context[1], (const uint8_t * const *)c->cascaded_tmp, c->cascaded_tmpStride, srcSliceY, srcSliceH, c->cascaded1_tmp, c->cascaded1_tmpStride); else ret = sws_scale(c->cascaded_context[1], (const uint8_t * const *)c->cascaded_tmp, c->cascaded_tmpStride, srcSliceY, srcSliceH, dst, dstStride); if (ret < 0) return ret; if (c->cascaded_context[2]) { ret = sws_scale(c->cascaded_context[2], (const uint8_t * const *)c->cascaded1_tmp, c->cascaded1_tmpStride, c->cascaded_context[1]->dstY - ret, c->cascaded_context[1]->dstY, dst, dstStride); return ret; if (c->cascaded_context[0] && srcSliceY == 0 && srcSliceH == c->cascaded_context[0]->srcH) { ret = sws_scale(c->cascaded_context[0], srcSlice, srcStride, srcSliceY, srcSliceH, c->cascaded_tmp, c->cascaded_tmpStride); if (ret < 0) return ret; ret = sws_scale(c->cascaded_context[1], (const uint8_t * const * )c->cascaded_tmp, c->cascaded_tmpStride, 0, c->cascaded_context[0]->dstH, dst, dstStride); return ret; memcpy(src2, srcSlice, sizeof(src2)); memcpy(dst2, dst, sizeof(dst2)); if (srcSliceH == 0) return 0; if (!check_image_pointers(srcSlice, c->srcFormat, srcStride)) { av_log(c, AV_LOG_ERROR, "bad src image pointers\n"); return 0; if (!check_image_pointers((const uint8_t* const*)dst, c->dstFormat, dstStride)) { av_log(c, AV_LOG_ERROR, "bad dst image pointers\n"); return 0; if (c->sliceDir == 0 && srcSliceY != 0 && srcSliceY + srcSliceH != c->srcH) { av_log(c, AV_LOG_ERROR, "Slices start in the middle!\n"); return 0; if (c->sliceDir == 0) { if (srcSliceY == 0) c->sliceDir = 1; else c->sliceDir = -1; if (usePal(c->srcFormat)) { for (i = 0; i < 256; i++) { int r, g, b, y, u, v, a = 0xff; if (c->srcFormat == AV_PIX_FMT_PAL8) { uint32_t p = ((const uint32_t *)(srcSlice[1]))[i]; a = (p >> 24) & 0xFF; r = (p >> 16) & 0xFF; g = (p >> 8) & 0xFF; b = p & 0xFF; } else if (c->srcFormat == AV_PIX_FMT_RGB8) { r = ( i >> 5 ) * 36; g = ((i >> 2) & 7) * 36; b = ( i & 3) * 85; } else if (c->srcFormat == AV_PIX_FMT_BGR8) { b = ( i >> 6 ) * 85; g = ((i >> 3) & 7) * 36; r = ( i & 7) * 36; } else if (c->srcFormat == AV_PIX_FMT_RGB4_BYTE) { r = ( i >> 3 ) * 255; g = ((i >> 1) & 3) * 85; b = ( i & 1) * 255; } else if (c->srcFormat == AV_PIX_FMT_GRAY8 || c->srcFormat == AV_PIX_FMT_GRAY8A) { r = g = b = i; } else { av_assert1(c->srcFormat == AV_PIX_FMT_BGR4_BYTE); b = ( i >> 3 ) * 255; g = ((i >> 1) & 3) * 85; r = ( i & 1) * 255; #define RGB2YUV_SHIFT 15 #define BY ( (int) (0.114 * 219 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) #define BV (-(int) (0.081 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) #define BU ( (int) (0.500 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) #define GY ( (int) (0.587 * 219 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) #define GV (-(int) (0.419 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) #define GU (-(int) (0.331 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) #define RY ( (int) (0.299 * 219 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) #define RV ( (int) (0.500 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) #define RU (-(int) (0.169 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5)) y = av_clip_uint8((RY * r + GY * g + BY * b + ( 33 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT); u = av_clip_uint8((RU * r + GU * g + BU * b + (257 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT); v = av_clip_uint8((RV * r + GV * g + BV * b + (257 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT); c->pal_yuv[i]= y + (u<<8) + (v<<16) + ((unsigned)a<<24); switch (c->dstFormat) { case AV_PIX_FMT_BGR32: #if !HAVE_BIGENDIAN case AV_PIX_FMT_RGB24: #endif c->pal_rgb[i]= r + (g<<8) + (b<<16) + ((unsigned)a<<24); break; case AV_PIX_FMT_BGR32_1: #if HAVE_BIGENDIAN case AV_PIX_FMT_BGR24: #endif c->pal_rgb[i]= a + (r<<8) + (g<<16) + ((unsigned)b<<24); break; case AV_PIX_FMT_RGB32_1: #if HAVE_BIGENDIAN case AV_PIX_FMT_RGB24: #endif c->pal_rgb[i]= a + (b<<8) + (g<<16) + ((unsigned)r<<24); break; case AV_PIX_FMT_RGB32: #if !HAVE_BIGENDIAN case AV_PIX_FMT_BGR24: #endif default: c->pal_rgb[i]= b + (g<<8) + (r<<16) + ((unsigned)a<<24); if (c->src0Alpha && !c->dst0Alpha && isALPHA(c->dstFormat)) { uint8_t *base; int x,y; rgb0_tmp = av_malloc(FFABS(srcStride[0]) * srcSliceH + 32); if (!rgb0_tmp) return AVERROR(ENOMEM); base = srcStride[0] < 0 ? rgb0_tmp - srcStride[0] * (srcSliceH-1) : rgb0_tmp; for (y=0; y<srcSliceH; y++){ memcpy(base + srcStride[0]*y, src2[0] + srcStride[0]*y, 4*c->srcW); for (x=c->src0Alpha-1; x<4*c->srcW; x+=4) { base[ srcStride[0]*y + x] = 0xFF; src2[0] = base; if (c->srcXYZ && !(c->dstXYZ && c->srcW==c->dstW && c->srcH==c->dstH)) { uint8_t *base; rgb0_tmp = av_malloc(FFABS(srcStride[0]) * srcSliceH + 32); if (!rgb0_tmp) return AVERROR(ENOMEM); base = srcStride[0] < 0 ? rgb0_tmp - srcStride[0] * (srcSliceH-1) : rgb0_tmp; xyz12Torgb48(c, (uint16_t*)base, (const uint16_t*)src2[0], srcStride[0]/2, srcSliceH); src2[0] = base; if (!srcSliceY && (c->flags & SWS_BITEXACT) && c->dither == SWS_DITHER_ED && c->dither_error[0]) for (i = 0; i < 4; i++) memset(c->dither_error[i], 0, sizeof(c->dither_error[0][0]) * (c->dstW+2)); if (c->sliceDir == 1) { int srcStride2[4] = { srcStride[0], srcStride[1], srcStride[2], srcStride[3] }; int dstStride2[4] = { dstStride[0], dstStride[1], dstStride[2], dstStride[3] }; reset_ptr(src2, c->srcFormat); reset_ptr((void*)dst2, c->dstFormat); if (srcSliceY + srcSliceH == c->srcH) c->sliceDir = 0; ret = c->swscale(c, src2, srcStride2, srcSliceY, srcSliceH, dst2, dstStride2); } else { int srcStride2[4] = { -srcStride[0], -srcStride[1], -srcStride[2], -srcStride[3] }; int dstStride2[4] = { -dstStride[0], -dstStride[1], -dstStride[2], -dstStride[3] }; src2[0] += (srcSliceH - 1) * srcStride[0]; if (!usePal(c->srcFormat)) src2[1] += ((srcSliceH >> c->chrSrcVSubSample) - 1) * srcStride[1]; src2[2] += ((srcSliceH >> c->chrSrcVSubSample) - 1) * srcStride[2]; src2[3] += (srcSliceH - 1) * srcStride[3]; dst2[0] += ( c->dstH - 1) * dstStride[0]; dst2[1] += ((c->dstH >> c->chrDstVSubSample) - 1) * dstStride[1]; dst2[2] += ((c->dstH >> c->chrDstVSubSample) - 1) * dstStride[2]; dst2[3] += ( c->dstH - 1) * dstStride[3]; reset_ptr(src2, c->srcFormat); reset_ptr((void*)dst2, c->dstFormat); if (!srcSliceY) c->sliceDir = 0; ret = c->swscale(c, src2, srcStride2, c->srcH-srcSliceY-srcSliceH, srcSliceH, dst2, dstStride2); if (c->dstXYZ && !(c->srcXYZ && c->srcW==c->dstW && c->srcH==c->dstH)) { rgb48Toxyz12(c, (uint16_t*)dst2[0], (const uint16_t*)dst2[0], dstStride[0]/2, ret); av_free(rgb0_tmp); return ret;
[ "int VAR_0 sws_scale(struct SwsContext *c,\nconst uint8_t * const srcSlice[],\nconst int srcStride[], int srcSliceY,\nint srcSliceH, uint8_t *const dst[],\nconst int dstStride[])\n{", "int i, ret;", "const uint8_t *src2[4];", "uint8_t *dst2[4];", "uint8_t *rgb0_tmp = NULL;", "if (!srcStride || !dstStride || !dst || !srcSlice) {", "av_log(c, AV_LOG_ERROR, \"One of the input parameters to sws_scale() is NULL, please check the calling code\\n\");", "return 0;", "if (c->gamma_flag && c->cascaded_context[0]) {", "ret = sws_scale(c->cascaded_context[0],\nsrcSlice, srcStride, srcSliceY, srcSliceH,\nc->cascaded_tmp, c->cascaded_tmpStride);", "if (ret < 0)\nreturn ret;", "if (c->cascaded_context[2])\nret = sws_scale(c->cascaded_context[1], (const uint8_t * const *)c->cascaded_tmp, c->cascaded_tmpStride, srcSliceY, srcSliceH, c->cascaded1_tmp, c->cascaded1_tmpStride);", "else\nret = sws_scale(c->cascaded_context[1], (const uint8_t * const *)c->cascaded_tmp, c->cascaded_tmpStride, srcSliceY, srcSliceH, dst, dstStride);", "if (ret < 0)\nreturn ret;", "if (c->cascaded_context[2]) {", "ret = sws_scale(c->cascaded_context[2],\n(const uint8_t * const *)c->cascaded1_tmp, c->cascaded1_tmpStride, c->cascaded_context[1]->dstY - ret, c->cascaded_context[1]->dstY,\ndst, dstStride);", "return ret;", "if (c->cascaded_context[0] && srcSliceY == 0 && srcSliceH == c->cascaded_context[0]->srcH) {", "ret = sws_scale(c->cascaded_context[0],\nsrcSlice, srcStride, srcSliceY, srcSliceH,\nc->cascaded_tmp, c->cascaded_tmpStride);", "if (ret < 0)\nreturn ret;", "ret = sws_scale(c->cascaded_context[1],\n(const uint8_t * const * )c->cascaded_tmp, c->cascaded_tmpStride, 0, c->cascaded_context[0]->dstH,\ndst, dstStride);", "return ret;", "memcpy(src2, srcSlice, sizeof(src2));", "memcpy(dst2, dst, sizeof(dst2));", "if (srcSliceH == 0)\nreturn 0;", "if (!check_image_pointers(srcSlice, c->srcFormat, srcStride)) {", "av_log(c, AV_LOG_ERROR, \"bad src image pointers\\n\");", "return 0;", "if (!check_image_pointers((const uint8_t* const*)dst, c->dstFormat, dstStride)) {", "av_log(c, AV_LOG_ERROR, \"bad dst image pointers\\n\");", "return 0;", "if (c->sliceDir == 0 && srcSliceY != 0 && srcSliceY + srcSliceH != c->srcH) {", "av_log(c, AV_LOG_ERROR, \"Slices start in the middle!\\n\");", "return 0;", "if (c->sliceDir == 0) {", "if (srcSliceY == 0) c->sliceDir = 1; else c->sliceDir = -1;", "if (usePal(c->srcFormat)) {", "for (i = 0; i < 256; i++) {", "int r, g, b, y, u, v, a = 0xff;", "if (c->srcFormat == AV_PIX_FMT_PAL8) {", "uint32_t p = ((const uint32_t *)(srcSlice[1]))[i];", "a = (p >> 24) & 0xFF;", "r = (p >> 16) & 0xFF;", "g = (p >> 8) & 0xFF;", "b = p & 0xFF;", "} else if (c->srcFormat == AV_PIX_FMT_RGB8) {", "r = ( i >> 5 ) * 36;", "g = ((i >> 2) & 7) * 36;", "b = ( i & 3) * 85;", "} else if (c->srcFormat == AV_PIX_FMT_BGR8) {", "b = ( i >> 6 ) * 85;", "g = ((i >> 3) & 7) * 36;", "r = ( i & 7) * 36;", "} else if (c->srcFormat == AV_PIX_FMT_RGB4_BYTE) {", "r = ( i >> 3 ) * 255;", "g = ((i >> 1) & 3) * 85;", "b = ( i & 1) * 255;", "} else if (c->srcFormat == AV_PIX_FMT_GRAY8 || c->srcFormat == AV_PIX_FMT_GRAY8A) {", "r = g = b = i;", "} else {", "av_assert1(c->srcFormat == AV_PIX_FMT_BGR4_BYTE);", "b = ( i >> 3 ) * 255;", "g = ((i >> 1) & 3) * 85;", "r = ( i & 1) * 255;", "#define RGB2YUV_SHIFT 15\n#define BY ( (int) (0.114 * 219 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))\n#define BV (-(int) (0.081 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))\n#define BU ( (int) (0.500 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))\n#define GY ( (int) (0.587 * 219 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))\n#define GV (-(int) (0.419 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))\n#define GU (-(int) (0.331 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))\n#define RY ( (int) (0.299 * 219 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))\n#define RV ( (int) (0.500 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))\n#define RU (-(int) (0.169 * 224 / 255 * (1 << RGB2YUV_SHIFT) + 0.5))\ny = av_clip_uint8((RY * r + GY * g + BY * b + ( 33 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT);", "u = av_clip_uint8((RU * r + GU * g + BU * b + (257 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT);", "v = av_clip_uint8((RV * r + GV * g + BV * b + (257 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT);", "c->pal_yuv[i]= y + (u<<8) + (v<<16) + ((unsigned)a<<24);", "switch (c->dstFormat) {", "case AV_PIX_FMT_BGR32:\n#if !HAVE_BIGENDIAN\ncase AV_PIX_FMT_RGB24:\n#endif\nc->pal_rgb[i]= r + (g<<8) + (b<<16) + ((unsigned)a<<24);", "break;", "case AV_PIX_FMT_BGR32_1:\n#if HAVE_BIGENDIAN\ncase AV_PIX_FMT_BGR24:\n#endif\nc->pal_rgb[i]= a + (r<<8) + (g<<16) + ((unsigned)b<<24);", "break;", "case AV_PIX_FMT_RGB32_1:\n#if HAVE_BIGENDIAN\ncase AV_PIX_FMT_RGB24:\n#endif\nc->pal_rgb[i]= a + (b<<8) + (g<<16) + ((unsigned)r<<24);", "break;", "case AV_PIX_FMT_RGB32:\n#if !HAVE_BIGENDIAN\ncase AV_PIX_FMT_BGR24:\n#endif\ndefault:\nc->pal_rgb[i]= b + (g<<8) + (r<<16) + ((unsigned)a<<24);", "if (c->src0Alpha && !c->dst0Alpha && isALPHA(c->dstFormat)) {", "uint8_t *base;", "int x,y;", "rgb0_tmp = av_malloc(FFABS(srcStride[0]) * srcSliceH + 32);", "if (!rgb0_tmp)\nreturn AVERROR(ENOMEM);", "base = srcStride[0] < 0 ? rgb0_tmp - srcStride[0] * (srcSliceH-1) : rgb0_tmp;", "for (y=0; y<srcSliceH; y++){", "memcpy(base + srcStride[0]*y, src2[0] + srcStride[0]*y, 4*c->srcW);", "for (x=c->src0Alpha-1; x<4*c->srcW; x+=4) {", "base[ srcStride[0]*y + x] = 0xFF;", "src2[0] = base;", "if (c->srcXYZ && !(c->dstXYZ && c->srcW==c->dstW && c->srcH==c->dstH)) {", "uint8_t *base;", "rgb0_tmp = av_malloc(FFABS(srcStride[0]) * srcSliceH + 32);", "if (!rgb0_tmp)\nreturn AVERROR(ENOMEM);", "base = srcStride[0] < 0 ? rgb0_tmp - srcStride[0] * (srcSliceH-1) : rgb0_tmp;", "xyz12Torgb48(c, (uint16_t*)base, (const uint16_t*)src2[0], srcStride[0]/2, srcSliceH);", "src2[0] = base;", "if (!srcSliceY && (c->flags & SWS_BITEXACT) && c->dither == SWS_DITHER_ED && c->dither_error[0])\nfor (i = 0; i < 4; i++)", "memset(c->dither_error[i], 0, sizeof(c->dither_error[0][0]) * (c->dstW+2));", "if (c->sliceDir == 1) {", "int srcStride2[4] = { srcStride[0], srcStride[1], srcStride[2],", "srcStride[3] };", "int dstStride2[4] = { dstStride[0], dstStride[1], dstStride[2],", "dstStride[3] };", "reset_ptr(src2, c->srcFormat);", "reset_ptr((void*)dst2, c->dstFormat);", "if (srcSliceY + srcSliceH == c->srcH)\nc->sliceDir = 0;", "ret = c->swscale(c, src2, srcStride2, srcSliceY, srcSliceH, dst2,\ndstStride2);", "} else {", "int srcStride2[4] = { -srcStride[0], -srcStride[1], -srcStride[2],", "-srcStride[3] };", "int dstStride2[4] = { -dstStride[0], -dstStride[1], -dstStride[2],", "-dstStride[3] };", "src2[0] += (srcSliceH - 1) * srcStride[0];", "if (!usePal(c->srcFormat))\nsrc2[1] += ((srcSliceH >> c->chrSrcVSubSample) - 1) * srcStride[1];", "src2[2] += ((srcSliceH >> c->chrSrcVSubSample) - 1) * srcStride[2];", "src2[3] += (srcSliceH - 1) * srcStride[3];", "dst2[0] += ( c->dstH - 1) * dstStride[0];", "dst2[1] += ((c->dstH >> c->chrDstVSubSample) - 1) * dstStride[1];", "dst2[2] += ((c->dstH >> c->chrDstVSubSample) - 1) * dstStride[2];", "dst2[3] += ( c->dstH - 1) * dstStride[3];", "reset_ptr(src2, c->srcFormat);", "reset_ptr((void*)dst2, c->dstFormat);", "if (!srcSliceY)\nc->sliceDir = 0;", "ret = c->swscale(c, src2, srcStride2, c->srcH-srcSliceY-srcSliceH,\nsrcSliceH, dst2, dstStride2);", "if (c->dstXYZ && !(c->srcXYZ && c->srcW==c->dstW && c->srcH==c->dstH)) {", "rgb48Toxyz12(c, (uint16_t*)dst2[0], (const uint16_t*)dst2[0], dstStride[0]/2, ret);", "av_free(rgb0_tmp);", "return ret;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3, 4, 5, 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15, 16, 17 ], [ 18, 19 ], [ 20, 21 ], [ 22, 23 ], [ 24, 25 ], [ 26 ], [ 27, 28, 29 ], [ 30 ], [ 31 ], [ 32, 33, 34 ], [ 35, 36 ], [ 37, 38, 39 ], [ 40 ], [ 41 ], [ 42 ], [ 44, 45 ], [ 46 ], [ 47 ], [ 48 ], [ 49 ], [ 50 ], [ 51 ], [ 52 ], [ 53 ], [ 54 ], [ 55 ], [ 56 ], [ 57 ], [ 58 ], [ 59 ], [ 60 ], [ 61 ], [ 62 ], [ 63 ], [ 64 ], [ 65 ], [ 66 ], [ 67 ], [ 68 ], [ 69 ], [ 70 ], [ 71 ], [ 72 ], [ 73 ], [ 74 ], [ 75 ], [ 76 ], [ 77 ], [ 78 ], [ 79 ], [ 80 ], [ 81 ], [ 82 ], [ 83 ], [ 84 ], [ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95 ], [ 96 ], [ 97 ], [ 98 ], [ 99 ], [ 100, 101, 102, 103, 104 ], [ 105 ], [ 106, 107, 108, 109, 110 ], [ 111 ], [ 112, 113, 114, 115, 116 ], [ 117 ], [ 118, 119, 120, 121, 122, 123 ], [ 124 ], [ 125 ], [ 126 ], [ 127 ], [ 128, 129 ], [ 130 ], [ 131 ], [ 132 ], [ 133 ], [ 134 ], [ 135 ], [ 136 ], [ 137 ], [ 138 ], [ 139, 140 ], [ 141 ], [ 142 ], [ 143 ], [ 144, 145 ], [ 146 ], [ 148 ], [ 150 ], [ 151 ], [ 152 ], [ 153 ], [ 154 ], [ 155 ], [ 157, 158 ], [ 159, 160 ], [ 161 ], [ 163 ], [ 164 ], [ 165 ], [ 166 ], [ 167 ], [ 168, 169 ], [ 170 ], [ 171 ], [ 172 ], [ 173 ], [ 174 ], [ 175 ], [ 176 ], [ 177 ], [ 179, 180 ], [ 181, 182 ], [ 183 ], [ 185 ], [ 186 ], [ 187 ] ]
8,461
static int select_voice(cst_voice **voice, const char *voice_name, void *log_ctx) { int i; for (i = 0; i < FF_ARRAY_ELEMS(voice_entries); i++) { struct voice_entry *entry = &voice_entries[i]; if (!strcmp(entry->name, voice_name)) { *voice = entry->register_fn(NULL); if (!*voice) { av_log(log_ctx, AV_LOG_ERROR, "Could not register voice '%s'\n", voice_name); return AVERROR_UNKNOWN; } return 0; } } av_log(log_ctx, AV_LOG_ERROR, "Could not find voice '%s'\n", voice_name); av_log(log_ctx, AV_LOG_INFO, "Choose between the voices: "); list_voices(log_ctx, ", "); return AVERROR(EINVAL); }
true
FFmpeg
4ce87ecf2a8a8a9348f9bdbb420f3bee92e6513f
static int select_voice(cst_voice **voice, const char *voice_name, void *log_ctx) { int i; for (i = 0; i < FF_ARRAY_ELEMS(voice_entries); i++) { struct voice_entry *entry = &voice_entries[i]; if (!strcmp(entry->name, voice_name)) { *voice = entry->register_fn(NULL); if (!*voice) { av_log(log_ctx, AV_LOG_ERROR, "Could not register voice '%s'\n", voice_name); return AVERROR_UNKNOWN; } return 0; } } av_log(log_ctx, AV_LOG_ERROR, "Could not find voice '%s'\n", voice_name); av_log(log_ctx, AV_LOG_INFO, "Choose between the voices: "); list_voices(log_ctx, ", "); return AVERROR(EINVAL); }
{ "code": [ "static int select_voice(cst_voice **voice, const char *voice_name, void *log_ctx)", " *voice = entry->register_fn(NULL);", " if (!*voice) {" ], "line_no": [ 1, 15, 17 ] }
static int FUNC_0(cst_voice **VAR_0, const char *VAR_1, void *VAR_2) { int VAR_3; for (VAR_3 = 0; VAR_3 < FF_ARRAY_ELEMS(voice_entries); VAR_3++) { struct voice_entry *entry = &voice_entries[VAR_3]; if (!strcmp(entry->name, VAR_1)) { *VAR_0 = entry->register_fn(NULL); if (!*VAR_0) { av_log(VAR_2, AV_LOG_ERROR, "Could not register VAR_0 '%s'\n", VAR_1); return AVERROR_UNKNOWN; } return 0; } } av_log(VAR_2, AV_LOG_ERROR, "Could not find VAR_0 '%s'\n", VAR_1); av_log(VAR_2, AV_LOG_INFO, "Choose between the voices: "); list_voices(VAR_2, ", "); return AVERROR(EINVAL); }
[ "static int FUNC_0(cst_voice **VAR_0, const char *VAR_1, void *VAR_2)\n{", "int VAR_3;", "for (VAR_3 = 0; VAR_3 < FF_ARRAY_ELEMS(voice_entries); VAR_3++) {", "struct voice_entry *entry = &voice_entries[VAR_3];", "if (!strcmp(entry->name, VAR_1)) {", "*VAR_0 = entry->register_fn(NULL);", "if (!*VAR_0) {", "av_log(VAR_2, AV_LOG_ERROR,\n\"Could not register VAR_0 '%s'\\n\", VAR_1);", "return AVERROR_UNKNOWN;", "}", "return 0;", "}", "}", "av_log(VAR_2, AV_LOG_ERROR, \"Could not find VAR_0 '%s'\\n\", VAR_1);", "av_log(VAR_2, AV_LOG_INFO, \"Choose between the voices: \");", "list_voices(VAR_2, \", \");", "return AVERROR(EINVAL);", "}" ]
[ 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ] ]
8,462
int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options, int flags, BlockDriver *drv) { int ret; /* TODO: extra byte is a hack to ensure MAX_PATH space on Windows. */ char tmp_filename[PATH_MAX + 1]; BlockDriverState *file = NULL; QDict *file_options = NULL; /* NULL means an empty set of options */ if (options == NULL) { options = qdict_new(); } bs->options = options; options = qdict_clone_shallow(options); /* For snapshot=on, create a temporary qcow2 overlay */ if (flags & BDRV_O_SNAPSHOT) { BlockDriverState *bs1; int64_t total_size; BlockDriver *bdrv_qcow2; QEMUOptionParameter *create_options; char backing_filename[PATH_MAX]; if (qdict_size(options) != 0) { error_report("Can't use snapshot=on with driver-specific options"); ret = -EINVAL; goto fail; } assert(filename != NULL); /* if snapshot, we create a temporary backing file and open it instead of opening 'filename' directly */ /* if there is a backing file, use it */ bs1 = bdrv_new(""); ret = bdrv_open(bs1, filename, NULL, 0, drv); if (ret < 0) { bdrv_delete(bs1); goto fail; } total_size = bdrv_getlength(bs1) & BDRV_SECTOR_MASK; bdrv_delete(bs1); ret = get_tmp_filename(tmp_filename, sizeof(tmp_filename)); if (ret < 0) { goto fail; } /* Real path is meaningless for protocols */ if (path_has_protocol(filename)) { snprintf(backing_filename, sizeof(backing_filename), "%s", filename); } else if (!realpath(filename, backing_filename)) { ret = -errno; goto fail; } bdrv_qcow2 = bdrv_find_format("qcow2"); create_options = parse_option_parameters("", bdrv_qcow2->create_options, NULL); set_option_parameter_int(create_options, BLOCK_OPT_SIZE, total_size); set_option_parameter(create_options, BLOCK_OPT_BACKING_FILE, backing_filename); if (drv) { set_option_parameter(create_options, BLOCK_OPT_BACKING_FMT, drv->format_name); } ret = bdrv_create(bdrv_qcow2, tmp_filename, create_options); free_option_parameters(create_options); if (ret < 0) { goto fail; } filename = tmp_filename; drv = bdrv_qcow2; bs->is_temporary = 1; } /* Open image file without format layer */ if (flags & BDRV_O_RDWR) { flags |= BDRV_O_ALLOW_RDWR; } extract_subqdict(options, &file_options, "file."); ret = bdrv_file_open(&file, filename, file_options, bdrv_open_flags(bs, flags)); if (ret < 0) { goto fail; } /* Find the right image format driver */ if (!drv) { ret = find_image_format(file, filename, &drv); } if (!drv) { goto unlink_and_fail; } /* Open the image */ ret = bdrv_open_common(bs, file, filename, options, flags, drv); if (ret < 0) { goto unlink_and_fail; } if (bs->file != file) { bdrv_delete(file); file = NULL; } /* If there is a backing file, use it */ if ((flags & BDRV_O_NO_BACKING) == 0) { ret = bdrv_open_backing_file(bs); if (ret < 0) { goto close_and_fail; } } /* Check if any unknown options were used */ if (qdict_size(options) != 0) { const QDictEntry *entry = qdict_first(options); qerror_report(ERROR_CLASS_GENERIC_ERROR, "Block format '%s' used by " "device '%s' doesn't support the option '%s'", drv->format_name, bs->device_name, entry->key); ret = -EINVAL; goto close_and_fail; } QDECREF(options); if (!bdrv_key_required(bs)) { bdrv_dev_change_media_cb(bs, true); } /* throttling disk I/O limits */ if (bs->io_limits_enabled) { bdrv_io_limits_enable(bs); } return 0; unlink_and_fail: if (file != NULL) { bdrv_delete(file); } if (bs->is_temporary) { unlink(filename); } fail: QDECREF(bs->options); QDECREF(options); bs->options = NULL; return ret; close_and_fail: bdrv_close(bs); QDECREF(options); return ret; }
true
qemu
31ca6d077c24b7aaa322d8930e3e5debbdb4a047
int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options, int flags, BlockDriver *drv) { int ret; char tmp_filename[PATH_MAX + 1]; BlockDriverState *file = NULL; QDict *file_options = NULL; if (options == NULL) { options = qdict_new(); } bs->options = options; options = qdict_clone_shallow(options); if (flags & BDRV_O_SNAPSHOT) { BlockDriverState *bs1; int64_t total_size; BlockDriver *bdrv_qcow2; QEMUOptionParameter *create_options; char backing_filename[PATH_MAX]; if (qdict_size(options) != 0) { error_report("Can't use snapshot=on with driver-specific options"); ret = -EINVAL; goto fail; } assert(filename != NULL); bs1 = bdrv_new(""); ret = bdrv_open(bs1, filename, NULL, 0, drv); if (ret < 0) { bdrv_delete(bs1); goto fail; } total_size = bdrv_getlength(bs1) & BDRV_SECTOR_MASK; bdrv_delete(bs1); ret = get_tmp_filename(tmp_filename, sizeof(tmp_filename)); if (ret < 0) { goto fail; } if (path_has_protocol(filename)) { snprintf(backing_filename, sizeof(backing_filename), "%s", filename); } else if (!realpath(filename, backing_filename)) { ret = -errno; goto fail; } bdrv_qcow2 = bdrv_find_format("qcow2"); create_options = parse_option_parameters("", bdrv_qcow2->create_options, NULL); set_option_parameter_int(create_options, BLOCK_OPT_SIZE, total_size); set_option_parameter(create_options, BLOCK_OPT_BACKING_FILE, backing_filename); if (drv) { set_option_parameter(create_options, BLOCK_OPT_BACKING_FMT, drv->format_name); } ret = bdrv_create(bdrv_qcow2, tmp_filename, create_options); free_option_parameters(create_options); if (ret < 0) { goto fail; } filename = tmp_filename; drv = bdrv_qcow2; bs->is_temporary = 1; } if (flags & BDRV_O_RDWR) { flags |= BDRV_O_ALLOW_RDWR; } extract_subqdict(options, &file_options, "file."); ret = bdrv_file_open(&file, filename, file_options, bdrv_open_flags(bs, flags)); if (ret < 0) { goto fail; } if (!drv) { ret = find_image_format(file, filename, &drv); } if (!drv) { goto unlink_and_fail; } ret = bdrv_open_common(bs, file, filename, options, flags, drv); if (ret < 0) { goto unlink_and_fail; } if (bs->file != file) { bdrv_delete(file); file = NULL; } if ((flags & BDRV_O_NO_BACKING) == 0) { ret = bdrv_open_backing_file(bs); if (ret < 0) { goto close_and_fail; } } if (qdict_size(options) != 0) { const QDictEntry *entry = qdict_first(options); qerror_report(ERROR_CLASS_GENERIC_ERROR, "Block format '%s' used by " "device '%s' doesn't support the option '%s'", drv->format_name, bs->device_name, entry->key); ret = -EINVAL; goto close_and_fail; } QDECREF(options); if (!bdrv_key_required(bs)) { bdrv_dev_change_media_cb(bs, true); } if (bs->io_limits_enabled) { bdrv_io_limits_enable(bs); } return 0; unlink_and_fail: if (file != NULL) { bdrv_delete(file); } if (bs->is_temporary) { unlink(filename); } fail: QDECREF(bs->options); QDECREF(options); bs->options = NULL; return ret; close_and_fail: bdrv_close(bs); QDECREF(options); return ret; }
{ "code": [ " ret = bdrv_open_backing_file(bs);" ], "line_no": [ 237 ] }
int FUNC_0(BlockDriverState *VAR_0, const char *VAR_1, QDict *VAR_2, int VAR_3, BlockDriver *VAR_4) { int VAR_5; char VAR_6[PATH_MAX + 1]; BlockDriverState *file = NULL; QDict *file_options = NULL; if (VAR_2 == NULL) { VAR_2 = qdict_new(); } VAR_0->VAR_2 = VAR_2; VAR_2 = qdict_clone_shallow(VAR_2); if (VAR_3 & BDRV_O_SNAPSHOT) { BlockDriverState *bs1; int64_t total_size; BlockDriver *bdrv_qcow2; QEMUOptionParameter *create_options; char VAR_7[PATH_MAX]; if (qdict_size(VAR_2) != 0) { error_report("Can't use snapshot=on with driver-specific VAR_2"); VAR_5 = -EINVAL; goto fail; } assert(VAR_1 != NULL); bs1 = bdrv_new(""); VAR_5 = FUNC_0(bs1, VAR_1, NULL, 0, VAR_4); if (VAR_5 < 0) { bdrv_delete(bs1); goto fail; } total_size = bdrv_getlength(bs1) & BDRV_SECTOR_MASK; bdrv_delete(bs1); VAR_5 = get_tmp_filename(VAR_6, sizeof(VAR_6)); if (VAR_5 < 0) { goto fail; } if (path_has_protocol(VAR_1)) { snprintf(VAR_7, sizeof(VAR_7), "%s", VAR_1); } else if (!realpath(VAR_1, VAR_7)) { VAR_5 = -errno; goto fail; } bdrv_qcow2 = bdrv_find_format("qcow2"); create_options = parse_option_parameters("", bdrv_qcow2->create_options, NULL); set_option_parameter_int(create_options, BLOCK_OPT_SIZE, total_size); set_option_parameter(create_options, BLOCK_OPT_BACKING_FILE, VAR_7); if (VAR_4) { set_option_parameter(create_options, BLOCK_OPT_BACKING_FMT, VAR_4->format_name); } VAR_5 = bdrv_create(bdrv_qcow2, VAR_6, create_options); free_option_parameters(create_options); if (VAR_5 < 0) { goto fail; } VAR_1 = VAR_6; VAR_4 = bdrv_qcow2; VAR_0->is_temporary = 1; } if (VAR_3 & BDRV_O_RDWR) { VAR_3 |= BDRV_O_ALLOW_RDWR; } extract_subqdict(VAR_2, &file_options, "file."); VAR_5 = bdrv_file_open(&file, VAR_1, file_options, bdrv_open_flags(VAR_0, VAR_3)); if (VAR_5 < 0) { goto fail; } if (!VAR_4) { VAR_5 = find_image_format(file, VAR_1, &VAR_4); } if (!VAR_4) { goto unlink_and_fail; } VAR_5 = bdrv_open_common(VAR_0, file, VAR_1, VAR_2, VAR_3, VAR_4); if (VAR_5 < 0) { goto unlink_and_fail; } if (VAR_0->file != file) { bdrv_delete(file); file = NULL; } if ((VAR_3 & BDRV_O_NO_BACKING) == 0) { VAR_5 = bdrv_open_backing_file(VAR_0); if (VAR_5 < 0) { goto close_and_fail; } } if (qdict_size(VAR_2) != 0) { const QDictEntry *VAR_8 = qdict_first(VAR_2); qerror_report(ERROR_CLASS_GENERIC_ERROR, "Block format '%s' used by " "device '%s' doesn't support the option '%s'", VAR_4->format_name, VAR_0->device_name, VAR_8->key); VAR_5 = -EINVAL; goto close_and_fail; } QDECREF(VAR_2); if (!bdrv_key_required(VAR_0)) { bdrv_dev_change_media_cb(VAR_0, true); } if (VAR_0->io_limits_enabled) { bdrv_io_limits_enable(VAR_0); } return 0; unlink_and_fail: if (file != NULL) { bdrv_delete(file); } if (VAR_0->is_temporary) { unlink(VAR_1); } fail: QDECREF(VAR_0->VAR_2); QDECREF(VAR_2); VAR_0->VAR_2 = NULL; return VAR_5; close_and_fail: bdrv_close(VAR_0); QDECREF(VAR_2); return VAR_5; }
[ "int FUNC_0(BlockDriverState *VAR_0, const char *VAR_1, QDict *VAR_2,\nint VAR_3, BlockDriver *VAR_4)\n{", "int VAR_5;", "char VAR_6[PATH_MAX + 1];", "BlockDriverState *file = NULL;", "QDict *file_options = NULL;", "if (VAR_2 == NULL) {", "VAR_2 = qdict_new();", "}", "VAR_0->VAR_2 = VAR_2;", "VAR_2 = qdict_clone_shallow(VAR_2);", "if (VAR_3 & BDRV_O_SNAPSHOT) {", "BlockDriverState *bs1;", "int64_t total_size;", "BlockDriver *bdrv_qcow2;", "QEMUOptionParameter *create_options;", "char VAR_7[PATH_MAX];", "if (qdict_size(VAR_2) != 0) {", "error_report(\"Can't use snapshot=on with driver-specific VAR_2\");", "VAR_5 = -EINVAL;", "goto fail;", "}", "assert(VAR_1 != NULL);", "bs1 = bdrv_new(\"\");", "VAR_5 = FUNC_0(bs1, VAR_1, NULL, 0, VAR_4);", "if (VAR_5 < 0) {", "bdrv_delete(bs1);", "goto fail;", "}", "total_size = bdrv_getlength(bs1) & BDRV_SECTOR_MASK;", "bdrv_delete(bs1);", "VAR_5 = get_tmp_filename(VAR_6, sizeof(VAR_6));", "if (VAR_5 < 0) {", "goto fail;", "}", "if (path_has_protocol(VAR_1)) {", "snprintf(VAR_7, sizeof(VAR_7),\n\"%s\", VAR_1);", "} else if (!realpath(VAR_1, VAR_7)) {", "VAR_5 = -errno;", "goto fail;", "}", "bdrv_qcow2 = bdrv_find_format(\"qcow2\");", "create_options = parse_option_parameters(\"\", bdrv_qcow2->create_options,\nNULL);", "set_option_parameter_int(create_options, BLOCK_OPT_SIZE, total_size);", "set_option_parameter(create_options, BLOCK_OPT_BACKING_FILE,\nVAR_7);", "if (VAR_4) {", "set_option_parameter(create_options, BLOCK_OPT_BACKING_FMT,\nVAR_4->format_name);", "}", "VAR_5 = bdrv_create(bdrv_qcow2, VAR_6, create_options);", "free_option_parameters(create_options);", "if (VAR_5 < 0) {", "goto fail;", "}", "VAR_1 = VAR_6;", "VAR_4 = bdrv_qcow2;", "VAR_0->is_temporary = 1;", "}", "if (VAR_3 & BDRV_O_RDWR) {", "VAR_3 |= BDRV_O_ALLOW_RDWR;", "}", "extract_subqdict(VAR_2, &file_options, \"file.\");", "VAR_5 = bdrv_file_open(&file, VAR_1, file_options,\nbdrv_open_flags(VAR_0, VAR_3));", "if (VAR_5 < 0) {", "goto fail;", "}", "if (!VAR_4) {", "VAR_5 = find_image_format(file, VAR_1, &VAR_4);", "}", "if (!VAR_4) {", "goto unlink_and_fail;", "}", "VAR_5 = bdrv_open_common(VAR_0, file, VAR_1, VAR_2, VAR_3, VAR_4);", "if (VAR_5 < 0) {", "goto unlink_and_fail;", "}", "if (VAR_0->file != file) {", "bdrv_delete(file);", "file = NULL;", "}", "if ((VAR_3 & BDRV_O_NO_BACKING) == 0) {", "VAR_5 = bdrv_open_backing_file(VAR_0);", "if (VAR_5 < 0) {", "goto close_and_fail;", "}", "}", "if (qdict_size(VAR_2) != 0) {", "const QDictEntry *VAR_8 = qdict_first(VAR_2);", "qerror_report(ERROR_CLASS_GENERIC_ERROR, \"Block format '%s' used by \"\n\"device '%s' doesn't support the option '%s'\",\nVAR_4->format_name, VAR_0->device_name, VAR_8->key);", "VAR_5 = -EINVAL;", "goto close_and_fail;", "}", "QDECREF(VAR_2);", "if (!bdrv_key_required(VAR_0)) {", "bdrv_dev_change_media_cb(VAR_0, true);", "}", "if (VAR_0->io_limits_enabled) {", "bdrv_io_limits_enable(VAR_0);", "}", "return 0;", "unlink_and_fail:\nif (file != NULL) {", "bdrv_delete(file);", "}", "if (VAR_0->is_temporary) {", "unlink(VAR_1);", "}", "fail:\nQDECREF(VAR_0->VAR_2);", "QDECREF(VAR_2);", "VAR_0->VAR_2 = NULL;", "return VAR_5;", "close_and_fail:\nbdrv_close(VAR_0);", "QDECREF(VAR_2);", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 105 ], [ 107, 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123, 125 ], [ 129 ], [ 131, 133 ], [ 135 ], [ 137, 139 ], [ 141 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 169 ], [ 171 ], [ 173 ], [ 177 ], [ 181, 183 ], [ 185 ], [ 187 ], [ 189 ], [ 195 ], [ 197 ], [ 199 ], [ 203 ], [ 205 ], [ 207 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 251 ], [ 253 ], [ 255, 257, 259 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 273 ], [ 275 ], [ 277 ], [ 283 ], [ 285 ], [ 287 ], [ 291 ], [ 295, 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309, 311 ], [ 313 ], [ 315 ], [ 317 ], [ 321, 323 ], [ 325 ], [ 327 ], [ 329 ] ]
8,463
int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, int level) { VDPAUHWContext *hwctx = avctx->hwaccel_context; VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data; VdpVideoSurfaceQueryCapabilities *surface_query_caps; VdpDecoderQueryCapabilities *decoder_query_caps; VdpDecoderCreate *create; VdpGetInformationString *info; const char *info_string; void *func; VdpStatus status; VdpBool supported; uint32_t max_level, max_mb, max_width, max_height; VdpChromaType type; uint32_t width; uint32_t height; vdctx->width = UINT32_MAX; vdctx->height = UINT32_MAX; if (av_vdpau_get_surface_parameters(avctx, &type, &width, &height)) return AVERROR(ENOSYS); if (hwctx) { hwctx->reset = 0; if (hwctx->context.decoder != VDP_INVALID_HANDLE) { vdctx->decoder = hwctx->context.decoder; vdctx->render = hwctx->context.render; vdctx->device = VDP_INVALID_HANDLE; return 0; /* Decoder created by user */ vdctx->device = hwctx->device; vdctx->get_proc_address = hwctx->get_proc_address; if (hwctx->flags & AV_HWACCEL_FLAG_IGNORE_LEVEL) level = 0; if (!(hwctx->flags & AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH) && type != VDP_CHROMA_TYPE_420) return AVERROR(ENOSYS); } else { AVHWFramesContext *frames_ctx = NULL; AVVDPAUDeviceContext *dev_ctx; // We assume the hw_frames_ctx always survives until ff_vdpau_common_uninit // is called. This holds true as the user is not allowed to touch // hw_device_ctx, or hw_frames_ctx after get_format (and ff_get_format // itself also uninits before unreffing hw_frames_ctx). if (avctx->hw_frames_ctx) { frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data; } else if (avctx->hw_device_ctx) { int ret; avctx->hw_frames_ctx = av_hwframe_ctx_alloc(avctx->hw_device_ctx); if (!avctx->hw_frames_ctx) return AVERROR(ENOMEM); frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data; frames_ctx->format = AV_PIX_FMT_VDPAU; frames_ctx->sw_format = avctx->sw_pix_fmt; frames_ctx->width = avctx->coded_width; frames_ctx->height = avctx->coded_height; ret = av_hwframe_ctx_init(avctx->hw_frames_ctx); if (ret < 0) { av_buffer_unref(&avctx->hw_frames_ctx); return ret; if (!frames_ctx) { av_log(avctx, AV_LOG_ERROR, "A hardware frames context is " "required for VDPAU decoding.\n"); return AVERROR(EINVAL); dev_ctx = frames_ctx->device_ctx->hwctx; vdctx->device = dev_ctx->device; vdctx->get_proc_address = dev_ctx->get_proc_address; if (avctx->hwaccel_flags & AV_HWACCEL_FLAG_IGNORE_LEVEL) level = 0; if (level < 0) VDP_FUNC_ID_VIDEO_SURFACE_QUERY_CAPABILITIES, surface_query_caps = func; status = surface_query_caps(vdctx->device, type, &supported, &max_width, &max_height); if (supported != VDP_TRUE || max_width < width || max_height < height) VDP_FUNC_ID_DECODER_QUERY_CAPABILITIES, decoder_query_caps = func; status = decoder_query_caps(vdctx->device, profile, &supported, &max_level, &max_mb, &max_width, &max_height); #ifdef VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE if ((status != VDP_STATUS_OK || supported != VDP_TRUE) && profile == VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE) { profile = VDP_DECODER_PROFILE_H264_MAIN; status = decoder_query_caps(vdctx->device, profile, &supported, &max_level, &max_mb, &max_width, &max_height); #endif if (supported != VDP_TRUE || max_level < level || max_width < width || max_height < height) status = vdctx->get_proc_address(vdctx->device, VDP_FUNC_ID_DECODER_CREATE, create = func; status = vdctx->get_proc_address(vdctx->device, VDP_FUNC_ID_DECODER_RENDER, vdctx->render = func; status = create(vdctx->device, profile, width, height, avctx->refs, &vdctx->decoder); if (status == VDP_STATUS_OK) { vdctx->width = avctx->coded_width; vdctx->height = avctx->coded_height;
true
FFmpeg
64ecb78b7179cab2dbdf835463104679dbb7c895
int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, int level) { VDPAUHWContext *hwctx = avctx->hwaccel_context; VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data; VdpVideoSurfaceQueryCapabilities *surface_query_caps; VdpDecoderQueryCapabilities *decoder_query_caps; VdpDecoderCreate *create; VdpGetInformationString *info; const char *info_string; void *func; VdpStatus status; VdpBool supported; uint32_t max_level, max_mb, max_width, max_height; VdpChromaType type; uint32_t width; uint32_t height; vdctx->width = UINT32_MAX; vdctx->height = UINT32_MAX; if (av_vdpau_get_surface_parameters(avctx, &type, &width, &height)) return AVERROR(ENOSYS); if (hwctx) { hwctx->reset = 0; if (hwctx->context.decoder != VDP_INVALID_HANDLE) { vdctx->decoder = hwctx->context.decoder; vdctx->render = hwctx->context.render; vdctx->device = VDP_INVALID_HANDLE; return 0; vdctx->device = hwctx->device; vdctx->get_proc_address = hwctx->get_proc_address; if (hwctx->flags & AV_HWACCEL_FLAG_IGNORE_LEVEL) level = 0; if (!(hwctx->flags & AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH) && type != VDP_CHROMA_TYPE_420) return AVERROR(ENOSYS); } else { AVHWFramesContext *frames_ctx = NULL; AVVDPAUDeviceContext *dev_ctx; if (avctx->hw_frames_ctx) { frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data; } else if (avctx->hw_device_ctx) { int ret; avctx->hw_frames_ctx = av_hwframe_ctx_alloc(avctx->hw_device_ctx); if (!avctx->hw_frames_ctx) return AVERROR(ENOMEM); frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data; frames_ctx->format = AV_PIX_FMT_VDPAU; frames_ctx->sw_format = avctx->sw_pix_fmt; frames_ctx->width = avctx->coded_width; frames_ctx->height = avctx->coded_height; ret = av_hwframe_ctx_init(avctx->hw_frames_ctx); if (ret < 0) { av_buffer_unref(&avctx->hw_frames_ctx); return ret; if (!frames_ctx) { av_log(avctx, AV_LOG_ERROR, "A hardware frames context is " "required for VDPAU decoding.\n"); return AVERROR(EINVAL); dev_ctx = frames_ctx->device_ctx->hwctx; vdctx->device = dev_ctx->device; vdctx->get_proc_address = dev_ctx->get_proc_address; if (avctx->hwaccel_flags & AV_HWACCEL_FLAG_IGNORE_LEVEL) level = 0; if (level < 0) VDP_FUNC_ID_VIDEO_SURFACE_QUERY_CAPABILITIES, surface_query_caps = func; status = surface_query_caps(vdctx->device, type, &supported, &max_width, &max_height); if (supported != VDP_TRUE || max_width < width || max_height < height) VDP_FUNC_ID_DECODER_QUERY_CAPABILITIES, decoder_query_caps = func; status = decoder_query_caps(vdctx->device, profile, &supported, &max_level, &max_mb, &max_width, &max_height); #ifdef VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE if ((status != VDP_STATUS_OK || supported != VDP_TRUE) && profile == VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE) { profile = VDP_DECODER_PROFILE_H264_MAIN; status = decoder_query_caps(vdctx->device, profile, &supported, &max_level, &max_mb, &max_width, &max_height); #endif if (supported != VDP_TRUE || max_level < level || max_width < width || max_height < height) status = vdctx->get_proc_address(vdctx->device, VDP_FUNC_ID_DECODER_CREATE, create = func; status = vdctx->get_proc_address(vdctx->device, VDP_FUNC_ID_DECODER_RENDER, vdctx->render = func; status = create(vdctx->device, profile, width, height, avctx->refs, &vdctx->decoder); if (status == VDP_STATUS_OK) { vdctx->width = avctx->coded_width; vdctx->height = avctx->coded_height;
{ "code": [], "line_no": [] }
int FUNC_0(AVCodecContext *VAR_0, VdpDecoderProfile VAR_1, int VAR_2) { VDPAUHWContext *hwctx = VAR_0->hwaccel_context; VDPAUContext *vdctx = VAR_0->internal->hwaccel_priv_data; VdpVideoSurfaceQueryCapabilities *surface_query_caps; VdpDecoderQueryCapabilities *decoder_query_caps; VdpDecoderCreate *create; VdpGetInformationString *info; const char *VAR_3; void *VAR_4; VdpStatus status; VdpBool supported; uint32_t max_level, max_mb, max_width, max_height; VdpChromaType type; uint32_t width; uint32_t height; vdctx->width = UINT32_MAX; vdctx->height = UINT32_MAX; if (av_vdpau_get_surface_parameters(VAR_0, &type, &width, &height)) return AVERROR(ENOSYS); if (hwctx) { hwctx->reset = 0; if (hwctx->context.decoder != VDP_INVALID_HANDLE) { vdctx->decoder = hwctx->context.decoder; vdctx->render = hwctx->context.render; vdctx->device = VDP_INVALID_HANDLE; return 0; vdctx->device = hwctx->device; vdctx->get_proc_address = hwctx->get_proc_address; if (hwctx->flags & AV_HWACCEL_FLAG_IGNORE_LEVEL) VAR_2 = 0; if (!(hwctx->flags & AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH) && type != VDP_CHROMA_TYPE_420) return AVERROR(ENOSYS); } else { AVHWFramesContext *frames_ctx = NULL; AVVDPAUDeviceContext *dev_ctx; if (VAR_0->hw_frames_ctx) { frames_ctx = (AVHWFramesContext*)VAR_0->hw_frames_ctx->data; } else if (VAR_0->hw_device_ctx) { int VAR_5; VAR_0->hw_frames_ctx = av_hwframe_ctx_alloc(VAR_0->hw_device_ctx); if (!VAR_0->hw_frames_ctx) return AVERROR(ENOMEM); frames_ctx = (AVHWFramesContext*)VAR_0->hw_frames_ctx->data; frames_ctx->format = AV_PIX_FMT_VDPAU; frames_ctx->sw_format = VAR_0->sw_pix_fmt; frames_ctx->width = VAR_0->coded_width; frames_ctx->height = VAR_0->coded_height; VAR_5 = av_hwframe_ctx_init(VAR_0->hw_frames_ctx); if (VAR_5 < 0) { av_buffer_unref(&VAR_0->hw_frames_ctx); return VAR_5; if (!frames_ctx) { av_log(VAR_0, AV_LOG_ERROR, "A hardware frames context is " "required for VDPAU decoding.\n"); return AVERROR(EINVAL); dev_ctx = frames_ctx->device_ctx->hwctx; vdctx->device = dev_ctx->device; vdctx->get_proc_address = dev_ctx->get_proc_address; if (VAR_0->hwaccel_flags & AV_HWACCEL_FLAG_IGNORE_LEVEL) VAR_2 = 0; if (VAR_2 < 0) VDP_FUNC_ID_VIDEO_SURFACE_QUERY_CAPABILITIES, surface_query_caps = VAR_4; status = surface_query_caps(vdctx->device, type, &supported, &max_width, &max_height); if (supported != VDP_TRUE || max_width < width || max_height < height) VDP_FUNC_ID_DECODER_QUERY_CAPABILITIES, decoder_query_caps = VAR_4; status = decoder_query_caps(vdctx->device, VAR_1, &supported, &max_level, &max_mb, &max_width, &max_height); #ifdef VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE if ((status != VDP_STATUS_OK || supported != VDP_TRUE) && VAR_1 == VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE) { VAR_1 = VDP_DECODER_PROFILE_H264_MAIN; status = decoder_query_caps(vdctx->device, VAR_1, &supported, &max_level, &max_mb, &max_width, &max_height); #endif if (supported != VDP_TRUE || max_level < VAR_2 || max_width < width || max_height < height) status = vdctx->get_proc_address(vdctx->device, VDP_FUNC_ID_DECODER_CREATE, create = VAR_4; status = vdctx->get_proc_address(vdctx->device, VDP_FUNC_ID_DECODER_RENDER, vdctx->render = VAR_4; status = create(vdctx->device, VAR_1, width, height, VAR_0->refs, &vdctx->decoder); if (status == VDP_STATUS_OK) { vdctx->width = VAR_0->coded_width; vdctx->height = VAR_0->coded_height;
[ "int FUNC_0(AVCodecContext *VAR_0, VdpDecoderProfile VAR_1,\nint VAR_2)\n{", "VDPAUHWContext *hwctx = VAR_0->hwaccel_context;", "VDPAUContext *vdctx = VAR_0->internal->hwaccel_priv_data;", "VdpVideoSurfaceQueryCapabilities *surface_query_caps;", "VdpDecoderQueryCapabilities *decoder_query_caps;", "VdpDecoderCreate *create;", "VdpGetInformationString *info;", "const char *VAR_3;", "void *VAR_4;", "VdpStatus status;", "VdpBool supported;", "uint32_t max_level, max_mb, max_width, max_height;", "VdpChromaType type;", "uint32_t width;", "uint32_t height;", "vdctx->width = UINT32_MAX;", "vdctx->height = UINT32_MAX;", "if (av_vdpau_get_surface_parameters(VAR_0, &type, &width, &height))\nreturn AVERROR(ENOSYS);", "if (hwctx) {", "hwctx->reset = 0;", "if (hwctx->context.decoder != VDP_INVALID_HANDLE) {", "vdctx->decoder = hwctx->context.decoder;", "vdctx->render = hwctx->context.render;", "vdctx->device = VDP_INVALID_HANDLE;", "return 0;", "vdctx->device = hwctx->device;", "vdctx->get_proc_address = hwctx->get_proc_address;", "if (hwctx->flags & AV_HWACCEL_FLAG_IGNORE_LEVEL)\nVAR_2 = 0;", "if (!(hwctx->flags & AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH) &&\ntype != VDP_CHROMA_TYPE_420)\nreturn AVERROR(ENOSYS);", "} else {", "AVHWFramesContext *frames_ctx = NULL;", "AVVDPAUDeviceContext *dev_ctx;", "if (VAR_0->hw_frames_ctx) {", "frames_ctx = (AVHWFramesContext*)VAR_0->hw_frames_ctx->data;", "} else if (VAR_0->hw_device_ctx) {", "int VAR_5;", "VAR_0->hw_frames_ctx = av_hwframe_ctx_alloc(VAR_0->hw_device_ctx);", "if (!VAR_0->hw_frames_ctx)\nreturn AVERROR(ENOMEM);", "frames_ctx = (AVHWFramesContext*)VAR_0->hw_frames_ctx->data;", "frames_ctx->format = AV_PIX_FMT_VDPAU;", "frames_ctx->sw_format = VAR_0->sw_pix_fmt;", "frames_ctx->width = VAR_0->coded_width;", "frames_ctx->height = VAR_0->coded_height;", "VAR_5 = av_hwframe_ctx_init(VAR_0->hw_frames_ctx);", "if (VAR_5 < 0) {", "av_buffer_unref(&VAR_0->hw_frames_ctx);", "return VAR_5;", "if (!frames_ctx) {", "av_log(VAR_0, AV_LOG_ERROR, \"A hardware frames context is \"\n\"required for VDPAU decoding.\\n\");", "return AVERROR(EINVAL);", "dev_ctx = frames_ctx->device_ctx->hwctx;", "vdctx->device = dev_ctx->device;", "vdctx->get_proc_address = dev_ctx->get_proc_address;", "if (VAR_0->hwaccel_flags & AV_HWACCEL_FLAG_IGNORE_LEVEL)\nVAR_2 = 0;", "if (VAR_2 < 0)\nVDP_FUNC_ID_VIDEO_SURFACE_QUERY_CAPABILITIES,\nsurface_query_caps = VAR_4;", "status = surface_query_caps(vdctx->device, type, &supported,\n&max_width, &max_height);", "if (supported != VDP_TRUE ||\nmax_width < width || max_height < height)\nVDP_FUNC_ID_DECODER_QUERY_CAPABILITIES,\ndecoder_query_caps = VAR_4;", "status = decoder_query_caps(vdctx->device, VAR_1, &supported, &max_level,\n&max_mb, &max_width, &max_height);", "#ifdef VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE\nif ((status != VDP_STATUS_OK || supported != VDP_TRUE) && VAR_1 == VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE) {", "VAR_1 = VDP_DECODER_PROFILE_H264_MAIN;", "status = decoder_query_caps(vdctx->device, VAR_1, &supported,\n&max_level, &max_mb,\n&max_width, &max_height);", "#endif\nif (supported != VDP_TRUE || max_level < VAR_2 ||\nmax_width < width || max_height < height)\nstatus = vdctx->get_proc_address(vdctx->device, VDP_FUNC_ID_DECODER_CREATE,\ncreate = VAR_4;", "status = vdctx->get_proc_address(vdctx->device, VDP_FUNC_ID_DECODER_RENDER,\nvdctx->render = VAR_4;", "status = create(vdctx->device, VAR_1, width, height, VAR_0->refs,\n&vdctx->decoder);", "if (status == VDP_STATUS_OK) {", "vdctx->width = VAR_0->coded_width;", "vdctx->height = VAR_0->coded_height;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17 ], [ 18 ], [ 19 ], [ 20, 21 ], [ 22 ], [ 23 ], [ 24 ], [ 25 ], [ 26 ], [ 27 ], [ 28 ], [ 29 ], [ 30 ], [ 31, 32 ], [ 33, 34, 35 ], [ 36 ], [ 37 ], [ 38 ], [ 43 ], [ 44 ], [ 45 ], [ 46 ], [ 47 ], [ 48, 49 ], [ 50 ], [ 51 ], [ 52 ], [ 53 ], [ 54 ], [ 55 ], [ 56 ], [ 57 ], [ 58 ], [ 59 ], [ 60, 61 ], [ 62 ], [ 63 ], [ 64 ], [ 65 ], [ 66, 67 ], [ 68, 69, 70 ], [ 71, 72 ], [ 73, 74, 75, 76 ], [ 77, 78 ], [ 79, 80 ], [ 81 ], [ 82, 83, 84 ], [ 85, 86, 87, 88, 89 ], [ 90, 91 ], [ 92, 93 ], [ 94 ], [ 95 ], [ 96 ] ]
8,464
int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data) { MigrationState *s = NULL; const char *p; int detach = qdict_get_try_bool(qdict, "detach", 0); int blk = qdict_get_try_bool(qdict, "blk", 0); int inc = qdict_get_try_bool(qdict, "inc", 0); const char *uri = qdict_get_str(qdict, "uri"); if (current_migration && current_migration->get_status(current_migration) == MIG_STATE_ACTIVE) { monitor_printf(mon, "migration already in progress\n"); if (strstart(uri, "tcp:", &p)) { s = tcp_start_outgoing_migration(mon, p, max_throttle, detach, blk, inc); #if !defined(WIN32) } else if (strstart(uri, "exec:", &p)) { s = exec_start_outgoing_migration(mon, p, max_throttle, detach, blk, inc); } else if (strstart(uri, "unix:", &p)) { s = unix_start_outgoing_migration(mon, p, max_throttle, detach, blk, inc); } else if (strstart(uri, "fd:", &p)) { s = fd_start_outgoing_migration(mon, p, max_throttle, detach, blk, inc); #endif } else { monitor_printf(mon, "unknown migration protocol: %s\n", uri); if (s == NULL) { monitor_printf(mon, "migration failed\n"); if (current_migration) { current_migration->release(current_migration); current_migration = s; return 0;
true
qemu
dc9121210eaf34e768901ffc6992dd13062c743a
int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data) { MigrationState *s = NULL; const char *p; int detach = qdict_get_try_bool(qdict, "detach", 0); int blk = qdict_get_try_bool(qdict, "blk", 0); int inc = qdict_get_try_bool(qdict, "inc", 0); const char *uri = qdict_get_str(qdict, "uri"); if (current_migration && current_migration->get_status(current_migration) == MIG_STATE_ACTIVE) { monitor_printf(mon, "migration already in progress\n"); if (strstart(uri, "tcp:", &p)) { s = tcp_start_outgoing_migration(mon, p, max_throttle, detach, blk, inc); #if !defined(WIN32) } else if (strstart(uri, "exec:", &p)) { s = exec_start_outgoing_migration(mon, p, max_throttle, detach, blk, inc); } else if (strstart(uri, "unix:", &p)) { s = unix_start_outgoing_migration(mon, p, max_throttle, detach, blk, inc); } else if (strstart(uri, "fd:", &p)) { s = fd_start_outgoing_migration(mon, p, max_throttle, detach, blk, inc); #endif } else { monitor_printf(mon, "unknown migration protocol: %s\n", uri); if (s == NULL) { monitor_printf(mon, "migration failed\n"); if (current_migration) { current_migration->release(current_migration); current_migration = s; return 0;
{ "code": [ " return 0;" ], "line_no": [ 33 ] }
int FUNC_0(Monitor *VAR_0, const QDict *VAR_1, QObject **VAR_2) { MigrationState *s = NULL; const char *VAR_3; int VAR_4 = qdict_get_try_bool(VAR_1, "VAR_4", 0); int VAR_5 = qdict_get_try_bool(VAR_1, "VAR_5", 0); int VAR_6 = qdict_get_try_bool(VAR_1, "VAR_6", 0); const char *VAR_7 = qdict_get_str(VAR_1, "VAR_7"); if (current_migration && current_migration->get_status(current_migration) == MIG_STATE_ACTIVE) { monitor_printf(VAR_0, "migration already in progress\n"); if (strstart(VAR_7, "tcp:", &VAR_3)) { s = tcp_start_outgoing_migration(VAR_0, VAR_3, max_throttle, VAR_4, VAR_5, VAR_6); #if !defined(WIN32) } else if (strstart(VAR_7, "exec:", &VAR_3)) { s = exec_start_outgoing_migration(VAR_0, VAR_3, max_throttle, VAR_4, VAR_5, VAR_6); } else if (strstart(VAR_7, "unix:", &VAR_3)) { s = unix_start_outgoing_migration(VAR_0, VAR_3, max_throttle, VAR_4, VAR_5, VAR_6); } else if (strstart(VAR_7, "fd:", &VAR_3)) { s = fd_start_outgoing_migration(VAR_0, VAR_3, max_throttle, VAR_4, VAR_5, VAR_6); #endif } else { monitor_printf(VAR_0, "unknown migration protocol: %s\n", VAR_7); if (s == NULL) { monitor_printf(VAR_0, "migration failed\n"); if (current_migration) { current_migration->release(current_migration); current_migration = s; return 0;
[ "int FUNC_0(Monitor *VAR_0, const QDict *VAR_1, QObject **VAR_2)\n{", "MigrationState *s = NULL;", "const char *VAR_3;", "int VAR_4 = qdict_get_try_bool(VAR_1, \"VAR_4\", 0);", "int VAR_5 = qdict_get_try_bool(VAR_1, \"VAR_5\", 0);", "int VAR_6 = qdict_get_try_bool(VAR_1, \"VAR_6\", 0);", "const char *VAR_7 = qdict_get_str(VAR_1, \"VAR_7\");", "if (current_migration &&\ncurrent_migration->get_status(current_migration) == MIG_STATE_ACTIVE) {", "monitor_printf(VAR_0, \"migration already in progress\\n\");", "if (strstart(VAR_7, \"tcp:\", &VAR_3)) {", "s = tcp_start_outgoing_migration(VAR_0, VAR_3, max_throttle, VAR_4,\nVAR_5, VAR_6);", "#if !defined(WIN32)\n} else if (strstart(VAR_7, \"exec:\", &VAR_3)) {", "s = exec_start_outgoing_migration(VAR_0, VAR_3, max_throttle, VAR_4,\nVAR_5, VAR_6);", "} else if (strstart(VAR_7, \"unix:\", &VAR_3)) {", "s = unix_start_outgoing_migration(VAR_0, VAR_3, max_throttle, VAR_4,\nVAR_5, VAR_6);", "} else if (strstart(VAR_7, \"fd:\", &VAR_3)) {", "s = fd_start_outgoing_migration(VAR_0, VAR_3, max_throttle, VAR_4,\nVAR_5, VAR_6);", "#endif\n} else {", "monitor_printf(VAR_0, \"unknown migration protocol: %s\\n\", VAR_7);", "if (s == NULL) {", "monitor_printf(VAR_0, \"migration failed\\n\");", "if (current_migration) {", "current_migration->release(current_migration);", "current_migration = s;", "return 0;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9, 10 ], [ 11 ], [ 12 ], [ 13, 14 ], [ 15, 16 ], [ 17, 18 ], [ 19 ], [ 20, 21 ], [ 22 ], [ 23, 24 ], [ 25, 26 ], [ 27 ], [ 28 ], [ 29 ], [ 30 ], [ 31 ], [ 32 ], [ 33 ] ]
8,465
static void init_custom_qm(VC2EncContext *s) { int level, orientation; if (s->quant_matrix == VC2_QM_DEF) { for (level = 0; level < s->wavelet_depth; level++) { for (orientation = 0; orientation < 4; orientation++) { if (level <= 3) s->quant[level][orientation] = ff_dirac_default_qmat[s->wavelet_idx][level][orientation]; else s->quant[level][orientation] = vc2_qm_col_tab[level][orientation]; } } } else if (s->quant_matrix == VC2_QM_COL) { for (level = 0; level < s->wavelet_depth; level++) { for (orientation = 0; orientation < 4; orientation++) { s->quant[level][orientation] = vc2_qm_col_tab[level][orientation]; } } } else { for (level = 0; level < s->wavelet_depth; level++) { for (orientation = 0; orientation < 4; orientation++) { s->quant[level][orientation] = vc2_qm_flat_tab[level][orientation]; } } } }
true
FFmpeg
b88be742fac7a77a8095e8155ba8790db4b77568
static void init_custom_qm(VC2EncContext *s) { int level, orientation; if (s->quant_matrix == VC2_QM_DEF) { for (level = 0; level < s->wavelet_depth; level++) { for (orientation = 0; orientation < 4; orientation++) { if (level <= 3) s->quant[level][orientation] = ff_dirac_default_qmat[s->wavelet_idx][level][orientation]; else s->quant[level][orientation] = vc2_qm_col_tab[level][orientation]; } } } else if (s->quant_matrix == VC2_QM_COL) { for (level = 0; level < s->wavelet_depth; level++) { for (orientation = 0; orientation < 4; orientation++) { s->quant[level][orientation] = vc2_qm_col_tab[level][orientation]; } } } else { for (level = 0; level < s->wavelet_depth; level++) { for (orientation = 0; orientation < 4; orientation++) { s->quant[level][orientation] = vc2_qm_flat_tab[level][orientation]; } } } }
{ "code": [ " } else {", "static void init_custom_qm(VC2EncContext *s)", " } else {", " for (level = 0; level < s->wavelet_depth; level++) {", " } else {" ], "line_no": [ 39, 1, 39, 11, 39 ] }
static void FUNC_0(VC2EncContext *VAR_0) { int VAR_1, VAR_2; if (VAR_0->quant_matrix == VC2_QM_DEF) { for (VAR_1 = 0; VAR_1 < VAR_0->wavelet_depth; VAR_1++) { for (VAR_2 = 0; VAR_2 < 4; VAR_2++) { if (VAR_1 <= 3) VAR_0->quant[VAR_1][VAR_2] = ff_dirac_default_qmat[VAR_0->wavelet_idx][VAR_1][VAR_2]; else VAR_0->quant[VAR_1][VAR_2] = vc2_qm_col_tab[VAR_1][VAR_2]; } } } else if (VAR_0->quant_matrix == VC2_QM_COL) { for (VAR_1 = 0; VAR_1 < VAR_0->wavelet_depth; VAR_1++) { for (VAR_2 = 0; VAR_2 < 4; VAR_2++) { VAR_0->quant[VAR_1][VAR_2] = vc2_qm_col_tab[VAR_1][VAR_2]; } } } else { for (VAR_1 = 0; VAR_1 < VAR_0->wavelet_depth; VAR_1++) { for (VAR_2 = 0; VAR_2 < 4; VAR_2++) { VAR_0->quant[VAR_1][VAR_2] = vc2_qm_flat_tab[VAR_1][VAR_2]; } } } }
[ "static void FUNC_0(VC2EncContext *VAR_0)\n{", "int VAR_1, VAR_2;", "if (VAR_0->quant_matrix == VC2_QM_DEF) {", "for (VAR_1 = 0; VAR_1 < VAR_0->wavelet_depth; VAR_1++) {", "for (VAR_2 = 0; VAR_2 < 4; VAR_2++) {", "if (VAR_1 <= 3)\nVAR_0->quant[VAR_1][VAR_2] = ff_dirac_default_qmat[VAR_0->wavelet_idx][VAR_1][VAR_2];", "else\nVAR_0->quant[VAR_1][VAR_2] = vc2_qm_col_tab[VAR_1][VAR_2];", "}", "}", "} else if (VAR_0->quant_matrix == VC2_QM_COL) {", "for (VAR_1 = 0; VAR_1 < VAR_0->wavelet_depth; VAR_1++) {", "for (VAR_2 = 0; VAR_2 < 4; VAR_2++) {", "VAR_0->quant[VAR_1][VAR_2] = vc2_qm_col_tab[VAR_1][VAR_2];", "}", "}", "} else {", "for (VAR_1 = 0; VAR_1 < VAR_0->wavelet_depth; VAR_1++) {", "for (VAR_2 = 0; VAR_2 < 4; VAR_2++) {", "VAR_0->quant[VAR_1][VAR_2] = vc2_qm_flat_tab[VAR_1][VAR_2];", "}", "}", "}", "}" ]
[ 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15, 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ] ]
8,467
void bareetraxfs_init (ram_addr_t ram_size, const char *boot_device, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { DeviceState *dev; SysBusDevice *s; CPUState *env; qemu_irq irq[30], nmi[2], *cpu_irq; void *etraxfs_dmac; struct etraxfs_dma_client *eth[2] = {NULL, NULL}; int kernel_size; DriveInfo *dinfo; int i; ram_addr_t phys_ram; ram_addr_t phys_flash; ram_addr_t phys_intmem; /* init CPUs */ if (cpu_model == NULL) { cpu_model = "crisv32"; } env = cpu_init(cpu_model); qemu_register_reset(main_cpu_reset, env); /* allocate RAM */ phys_ram = qemu_ram_alloc(ram_size); cpu_register_physical_memory(0x40000000, ram_size, phys_ram | IO_MEM_RAM); /* The ETRAX-FS has 128Kb on chip ram, the docs refer to it as the internal memory. */ phys_intmem = qemu_ram_alloc(INTMEM_SIZE); cpu_register_physical_memory(0x38000000, INTMEM_SIZE, phys_intmem | IO_MEM_RAM); phys_flash = qemu_ram_alloc(FLASH_SIZE); dinfo = drive_get(IF_PFLASH, 0, 0); pflash_cfi02_register(0x0, phys_flash, dinfo ? dinfo->bdrv : NULL, (64 * 1024), FLASH_SIZE >> 16, 1, 2, 0x0000, 0x0000, 0x0000, 0x0000, 0x555, 0x2aa); cpu_irq = cris_pic_init_cpu(env); dev = qdev_create(NULL, "etraxfs,pic"); /* FIXME: Is there a proper way to signal vectors to the CPU core? */ qdev_prop_set_ptr(dev, "interrupt_vector", &env->interrupt_vector); qdev_init(dev); s = sysbus_from_qdev(dev); sysbus_mmio_map(s, 0, 0x3001c000); sysbus_connect_irq(s, 0, cpu_irq[0]); sysbus_connect_irq(s, 1, cpu_irq[1]); for (i = 0; i < 30; i++) { irq[i] = qdev_get_gpio_in(dev, i); } nmi[0] = qdev_get_gpio_in(dev, 30); nmi[1] = qdev_get_gpio_in(dev, 31); etraxfs_dmac = etraxfs_dmac_init(0x30000000, 10); for (i = 0; i < 10; i++) { /* On ETRAX, odd numbered channels are inputs. */ etraxfs_dmac_connect(etraxfs_dmac, i, irq + 7 + i, i & 1); } /* Add the two ethernet blocks. */ eth[0] = etraxfs_eth_init(&nd_table[0], 0x30034000, 1); if (nb_nics > 1) eth[1] = etraxfs_eth_init(&nd_table[1], 0x30036000, 2); /* The DMA Connector block is missing, hardwire things for now. */ etraxfs_dmac_connect_client(etraxfs_dmac, 0, eth[0]); etraxfs_dmac_connect_client(etraxfs_dmac, 1, eth[0] + 1); if (eth[1]) { etraxfs_dmac_connect_client(etraxfs_dmac, 6, eth[1]); etraxfs_dmac_connect_client(etraxfs_dmac, 7, eth[1] + 1); } /* 2 timers. */ sysbus_create_varargs("etraxfs,timer", 0x3001e000, irq[0x1b], nmi[1], NULL); sysbus_create_varargs("etraxfs,timer", 0x3005e000, irq[0x1b], nmi[1], NULL); for (i = 0; i < 4; i++) { sysbus_create_simple("etraxfs,serial", 0x30026000 + i * 0x2000, irq[0x14 + i]); } if (kernel_filename) { uint64_t entry, high; int kcmdline_len; /* Boots a kernel elf binary, os/linux-2.6/vmlinux from the axis devboard SDK. */ kernel_size = load_elf(kernel_filename, -0x80000000LL, &entry, NULL, &high, 0, ELF_MACHINE, 0); bootstrap_pc = entry; if (kernel_size < 0) { /* Takes a kimage from the axis devboard SDK. */ kernel_size = load_image_targphys(kernel_filename, 0x40004000, ram_size); bootstrap_pc = 0x40004000; env->regs[9] = 0x40004000 + kernel_size; } env->regs[8] = 0x56902387; /* RAM init magic. */ if (kernel_cmdline && (kcmdline_len = strlen(kernel_cmdline))) { if (kcmdline_len > 256) { fprintf(stderr, "Too long CRIS kernel cmdline (max 256)\n"); exit(1); } /* Let the kernel know we are modifying the cmdline. */ env->regs[10] = 0x87109563; env->regs[11] = 0x40000000; pstrcpy_targphys(env->regs[11], 256, kernel_cmdline); } } env->pc = bootstrap_pc; printf ("pc =%x\n", env->pc); printf ("ram size =%ld\n", ram_size); }
true
qemu
e23a1b33b53d25510320b26d9f154e19c6c99725
void bareetraxfs_init (ram_addr_t ram_size, const char *boot_device, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { DeviceState *dev; SysBusDevice *s; CPUState *env; qemu_irq irq[30], nmi[2], *cpu_irq; void *etraxfs_dmac; struct etraxfs_dma_client *eth[2] = {NULL, NULL}; int kernel_size; DriveInfo *dinfo; int i; ram_addr_t phys_ram; ram_addr_t phys_flash; ram_addr_t phys_intmem; if (cpu_model == NULL) { cpu_model = "crisv32"; } env = cpu_init(cpu_model); qemu_register_reset(main_cpu_reset, env); phys_ram = qemu_ram_alloc(ram_size); cpu_register_physical_memory(0x40000000, ram_size, phys_ram | IO_MEM_RAM); phys_intmem = qemu_ram_alloc(INTMEM_SIZE); cpu_register_physical_memory(0x38000000, INTMEM_SIZE, phys_intmem | IO_MEM_RAM); phys_flash = qemu_ram_alloc(FLASH_SIZE); dinfo = drive_get(IF_PFLASH, 0, 0); pflash_cfi02_register(0x0, phys_flash, dinfo ? dinfo->bdrv : NULL, (64 * 1024), FLASH_SIZE >> 16, 1, 2, 0x0000, 0x0000, 0x0000, 0x0000, 0x555, 0x2aa); cpu_irq = cris_pic_init_cpu(env); dev = qdev_create(NULL, "etraxfs,pic"); qdev_prop_set_ptr(dev, "interrupt_vector", &env->interrupt_vector); qdev_init(dev); s = sysbus_from_qdev(dev); sysbus_mmio_map(s, 0, 0x3001c000); sysbus_connect_irq(s, 0, cpu_irq[0]); sysbus_connect_irq(s, 1, cpu_irq[1]); for (i = 0; i < 30; i++) { irq[i] = qdev_get_gpio_in(dev, i); } nmi[0] = qdev_get_gpio_in(dev, 30); nmi[1] = qdev_get_gpio_in(dev, 31); etraxfs_dmac = etraxfs_dmac_init(0x30000000, 10); for (i = 0; i < 10; i++) { etraxfs_dmac_connect(etraxfs_dmac, i, irq + 7 + i, i & 1); } eth[0] = etraxfs_eth_init(&nd_table[0], 0x30034000, 1); if (nb_nics > 1) eth[1] = etraxfs_eth_init(&nd_table[1], 0x30036000, 2); etraxfs_dmac_connect_client(etraxfs_dmac, 0, eth[0]); etraxfs_dmac_connect_client(etraxfs_dmac, 1, eth[0] + 1); if (eth[1]) { etraxfs_dmac_connect_client(etraxfs_dmac, 6, eth[1]); etraxfs_dmac_connect_client(etraxfs_dmac, 7, eth[1] + 1); } sysbus_create_varargs("etraxfs,timer", 0x3001e000, irq[0x1b], nmi[1], NULL); sysbus_create_varargs("etraxfs,timer", 0x3005e000, irq[0x1b], nmi[1], NULL); for (i = 0; i < 4; i++) { sysbus_create_simple("etraxfs,serial", 0x30026000 + i * 0x2000, irq[0x14 + i]); } if (kernel_filename) { uint64_t entry, high; int kcmdline_len; kernel_size = load_elf(kernel_filename, -0x80000000LL, &entry, NULL, &high, 0, ELF_MACHINE, 0); bootstrap_pc = entry; if (kernel_size < 0) { kernel_size = load_image_targphys(kernel_filename, 0x40004000, ram_size); bootstrap_pc = 0x40004000; env->regs[9] = 0x40004000 + kernel_size; } env->regs[8] = 0x56902387; if (kernel_cmdline && (kcmdline_len = strlen(kernel_cmdline))) { if (kcmdline_len > 256) { fprintf(stderr, "Too long CRIS kernel cmdline (max 256)\n"); exit(1); } env->regs[10] = 0x87109563; env->regs[11] = 0x40000000; pstrcpy_targphys(env->regs[11], 256, kernel_cmdline); } } env->pc = bootstrap_pc; printf ("pc =%x\n", env->pc); printf ("ram size =%ld\n", ram_size); }
{ "code": [ " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);" ], "line_no": [ 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95 ] }
void FUNC_0 (ram_addr_t VAR_0, const char *VAR_1, const char *VAR_2, const char *VAR_3, const char *VAR_4, const char *VAR_5) { DeviceState *dev; SysBusDevice *s; CPUState *env; qemu_irq irq[30], nmi[2], *cpu_irq; void *VAR_6; struct etraxfs_dma_client *VAR_7[2] = {NULL, NULL}; int VAR_8; DriveInfo *dinfo; int VAR_9; ram_addr_t phys_ram; ram_addr_t phys_flash; ram_addr_t phys_intmem; if (VAR_5 == NULL) { VAR_5 = "crisv32"; } env = cpu_init(VAR_5); qemu_register_reset(main_cpu_reset, env); phys_ram = qemu_ram_alloc(VAR_0); cpu_register_physical_memory(0x40000000, VAR_0, phys_ram | IO_MEM_RAM); phys_intmem = qemu_ram_alloc(INTMEM_SIZE); cpu_register_physical_memory(0x38000000, INTMEM_SIZE, phys_intmem | IO_MEM_RAM); phys_flash = qemu_ram_alloc(FLASH_SIZE); dinfo = drive_get(IF_PFLASH, 0, 0); pflash_cfi02_register(0x0, phys_flash, dinfo ? dinfo->bdrv : NULL, (64 * 1024), FLASH_SIZE >> 16, 1, 2, 0x0000, 0x0000, 0x0000, 0x0000, 0x555, 0x2aa); cpu_irq = cris_pic_init_cpu(env); dev = qdev_create(NULL, "etraxfs,pic"); qdev_prop_set_ptr(dev, "interrupt_vector", &env->interrupt_vector); qdev_init(dev); s = sysbus_from_qdev(dev); sysbus_mmio_map(s, 0, 0x3001c000); sysbus_connect_irq(s, 0, cpu_irq[0]); sysbus_connect_irq(s, 1, cpu_irq[1]); for (VAR_9 = 0; VAR_9 < 30; VAR_9++) { irq[VAR_9] = qdev_get_gpio_in(dev, VAR_9); } nmi[0] = qdev_get_gpio_in(dev, 30); nmi[1] = qdev_get_gpio_in(dev, 31); VAR_6 = etraxfs_dmac_init(0x30000000, 10); for (VAR_9 = 0; VAR_9 < 10; VAR_9++) { etraxfs_dmac_connect(VAR_6, VAR_9, irq + 7 + VAR_9, VAR_9 & 1); } VAR_7[0] = etraxfs_eth_init(&nd_table[0], 0x30034000, 1); if (nb_nics > 1) VAR_7[1] = etraxfs_eth_init(&nd_table[1], 0x30036000, 2); etraxfs_dmac_connect_client(VAR_6, 0, VAR_7[0]); etraxfs_dmac_connect_client(VAR_6, 1, VAR_7[0] + 1); if (VAR_7[1]) { etraxfs_dmac_connect_client(VAR_6, 6, VAR_7[1]); etraxfs_dmac_connect_client(VAR_6, 7, VAR_7[1] + 1); } sysbus_create_varargs("etraxfs,timer", 0x3001e000, irq[0x1b], nmi[1], NULL); sysbus_create_varargs("etraxfs,timer", 0x3005e000, irq[0x1b], nmi[1], NULL); for (VAR_9 = 0; VAR_9 < 4; VAR_9++) { sysbus_create_simple("etraxfs,serial", 0x30026000 + VAR_9 * 0x2000, irq[0x14 + VAR_9]); } if (VAR_2) { uint64_t entry, high; int VAR_10; VAR_8 = load_elf(VAR_2, -0x80000000LL, &entry, NULL, &high, 0, ELF_MACHINE, 0); bootstrap_pc = entry; if (VAR_8 < 0) { VAR_8 = load_image_targphys(VAR_2, 0x40004000, VAR_0); bootstrap_pc = 0x40004000; env->regs[9] = 0x40004000 + VAR_8; } env->regs[8] = 0x56902387; if (VAR_3 && (VAR_10 = strlen(VAR_3))) { if (VAR_10 > 256) { fprintf(stderr, "Too long CRIS kernel cmdline (max 256)\n"); exit(1); } env->regs[10] = 0x87109563; env->regs[11] = 0x40000000; pstrcpy_targphys(env->regs[11], 256, VAR_3); } } env->pc = bootstrap_pc; printf ("pc =%x\n", env->pc); printf ("ram size =%ld\n", VAR_0); }
[ "void FUNC_0 (ram_addr_t VAR_0,\nconst char *VAR_1,\nconst char *VAR_2, const char *VAR_3,\nconst char *VAR_4, const char *VAR_5)\n{", "DeviceState *dev;", "SysBusDevice *s;", "CPUState *env;", "qemu_irq irq[30], nmi[2], *cpu_irq;", "void *VAR_6;", "struct etraxfs_dma_client *VAR_7[2] = {NULL, NULL};", "int VAR_8;", "DriveInfo *dinfo;", "int VAR_9;", "ram_addr_t phys_ram;", "ram_addr_t phys_flash;", "ram_addr_t phys_intmem;", "if (VAR_5 == NULL) {", "VAR_5 = \"crisv32\";", "}", "env = cpu_init(VAR_5);", "qemu_register_reset(main_cpu_reset, env);", "phys_ram = qemu_ram_alloc(VAR_0);", "cpu_register_physical_memory(0x40000000, VAR_0, phys_ram | IO_MEM_RAM);", "phys_intmem = qemu_ram_alloc(INTMEM_SIZE);", "cpu_register_physical_memory(0x38000000, INTMEM_SIZE,\nphys_intmem | IO_MEM_RAM);", "phys_flash = qemu_ram_alloc(FLASH_SIZE);", "dinfo = drive_get(IF_PFLASH, 0, 0);", "pflash_cfi02_register(0x0, phys_flash,\ndinfo ? dinfo->bdrv : NULL, (64 * 1024),\nFLASH_SIZE >> 16,\n1, 2, 0x0000, 0x0000, 0x0000, 0x0000,\n0x555, 0x2aa);", "cpu_irq = cris_pic_init_cpu(env);", "dev = qdev_create(NULL, \"etraxfs,pic\");", "qdev_prop_set_ptr(dev, \"interrupt_vector\", &env->interrupt_vector);", "qdev_init(dev);", "s = sysbus_from_qdev(dev);", "sysbus_mmio_map(s, 0, 0x3001c000);", "sysbus_connect_irq(s, 0, cpu_irq[0]);", "sysbus_connect_irq(s, 1, cpu_irq[1]);", "for (VAR_9 = 0; VAR_9 < 30; VAR_9++) {", "irq[VAR_9] = qdev_get_gpio_in(dev, VAR_9);", "}", "nmi[0] = qdev_get_gpio_in(dev, 30);", "nmi[1] = qdev_get_gpio_in(dev, 31);", "VAR_6 = etraxfs_dmac_init(0x30000000, 10);", "for (VAR_9 = 0; VAR_9 < 10; VAR_9++) {", "etraxfs_dmac_connect(VAR_6, VAR_9, irq + 7 + VAR_9, VAR_9 & 1);", "}", "VAR_7[0] = etraxfs_eth_init(&nd_table[0], 0x30034000, 1);", "if (nb_nics > 1)\nVAR_7[1] = etraxfs_eth_init(&nd_table[1], 0x30036000, 2);", "etraxfs_dmac_connect_client(VAR_6, 0, VAR_7[0]);", "etraxfs_dmac_connect_client(VAR_6, 1, VAR_7[0] + 1);", "if (VAR_7[1]) {", "etraxfs_dmac_connect_client(VAR_6, 6, VAR_7[1]);", "etraxfs_dmac_connect_client(VAR_6, 7, VAR_7[1] + 1);", "}", "sysbus_create_varargs(\"etraxfs,timer\", 0x3001e000, irq[0x1b], nmi[1], NULL);", "sysbus_create_varargs(\"etraxfs,timer\", 0x3005e000, irq[0x1b], nmi[1], NULL);", "for (VAR_9 = 0; VAR_9 < 4; VAR_9++) {", "sysbus_create_simple(\"etraxfs,serial\", 0x30026000 + VAR_9 * 0x2000,\nirq[0x14 + VAR_9]);", "}", "if (VAR_2) {", "uint64_t entry, high;", "int VAR_10;", "VAR_8 = load_elf(VAR_2, -0x80000000LL,\n&entry, NULL, &high, 0, ELF_MACHINE, 0);", "bootstrap_pc = entry;", "if (VAR_8 < 0) {", "VAR_8 = load_image_targphys(VAR_2, 0x40004000,\nVAR_0);", "bootstrap_pc = 0x40004000;", "env->regs[9] = 0x40004000 + VAR_8;", "}", "env->regs[8] = 0x56902387;", "if (VAR_3 && (VAR_10 = strlen(VAR_3))) {", "if (VAR_10 > 256) {", "fprintf(stderr, \"Too long CRIS kernel cmdline (max 256)\\n\");", "exit(1);", "}", "env->regs[10] = 0x87109563;", "env->regs[11] = 0x40000000;", "pstrcpy_targphys(env->regs[11], 256, VAR_3);", "}", "}", "env->pc = bootstrap_pc;", "printf (\"pc =%x\\n\", env->pc);", "printf (\"ram size =%ld\\n\", VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 53 ], [ 55 ], [ 63 ], [ 65, 67 ], [ 73 ], [ 75 ], [ 77, 79, 81, 83, 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 131 ], [ 133, 135 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 157 ], [ 159 ], [ 163 ], [ 165, 167 ], [ 169 ], [ 173 ], [ 175 ], [ 177 ], [ 185, 187 ], [ 189 ], [ 191 ], [ 195, 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 235 ], [ 237 ], [ 239 ] ]
8,468
envlist_to_environ(const envlist_t *envlist, size_t *count) { struct envlist_entry *entry; char **env, **penv; penv = env = malloc((envlist->el_count + 1) * sizeof (char *)); if (env == NULL) return (NULL); for (entry = envlist->el_entries.lh_first; entry != NULL; entry = entry->ev_link.le_next) { *(penv++) = strdup(entry->ev_var); } *penv = NULL; /* NULL terminate the list */ if (count != NULL) *count = envlist->el_count; return (env); }
true
qemu
ec45bbe5f1921c6553fbf9c0c76b358b0403c22d
envlist_to_environ(const envlist_t *envlist, size_t *count) { struct envlist_entry *entry; char **env, **penv; penv = env = malloc((envlist->el_count + 1) * sizeof (char *)); if (env == NULL) return (NULL); for (entry = envlist->el_entries.lh_first; entry != NULL; entry = entry->ev_link.le_next) { *(penv++) = strdup(entry->ev_var); } *penv = NULL; if (count != NULL) *count = envlist->el_count; return (env); }
{ "code": [ "\t\treturn (NULL);", "\tpenv = env = malloc((envlist->el_count + 1) * sizeof (char *));", "\tif (env == NULL)", "\t\treturn (NULL);", "\t\t*(penv++) = strdup(entry->ev_var);" ], "line_no": [ 15, 11, 13, 15, 23 ] }
FUNC_0(const envlist_t *VAR_0, size_t *VAR_1) { struct envlist_entry *VAR_2; char **VAR_3, **VAR_4; VAR_4 = VAR_3 = malloc((VAR_0->el_count + 1) * sizeof (char *)); if (VAR_3 == NULL) return (NULL); for (VAR_2 = VAR_0->el_entries.lh_first; VAR_2 != NULL; VAR_2 = VAR_2->ev_link.le_next) { *(VAR_4++) = strdup(VAR_2->ev_var); } *VAR_4 = NULL; if (VAR_1 != NULL) *VAR_1 = VAR_0->el_count; return (VAR_3); }
[ "FUNC_0(const envlist_t *VAR_0, size_t *VAR_1)\n{", "struct envlist_entry *VAR_2;", "char **VAR_3, **VAR_4;", "VAR_4 = VAR_3 = malloc((VAR_0->el_count + 1) * sizeof (char *));", "if (VAR_3 == NULL)\nreturn (NULL);", "for (VAR_2 = VAR_0->el_entries.lh_first; VAR_2 != NULL;", "VAR_2 = VAR_2->ev_link.le_next) {", "*(VAR_4++) = strdup(VAR_2->ev_var);", "}", "*VAR_4 = NULL;", "if (VAR_1 != NULL)\n*VAR_1 = VAR_0->el_count;", "return (VAR_3);", "}" ]
[ 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31, 33 ], [ 37 ], [ 39 ] ]
8,470
void monitor_flush(Monitor *mon) { int rc; size_t len; const char *buf; if (mon->skip_flush) { return; } buf = qstring_get_str(mon->outbuf); len = qstring_get_length(mon->outbuf); if (len && !mon->mux_out) { rc = qemu_chr_fe_write(mon->chr, (const uint8_t *) buf, len); if (rc == len) { /* all flushed */ QDECREF(mon->outbuf); mon->outbuf = qstring_new(); return; } if (rc > 0) { /* partinal write */ QString *tmp = qstring_from_str(buf + rc); QDECREF(mon->outbuf); mon->outbuf = tmp; } if (mon->watch == 0) { mon->watch = qemu_chr_fe_add_watch(mon->chr, G_IO_OUT, monitor_unblocked, mon); } } }
true
qemu
056f49ff2cf645dc484956b00b65a3aa18a1a9a3
void monitor_flush(Monitor *mon) { int rc; size_t len; const char *buf; if (mon->skip_flush) { return; } buf = qstring_get_str(mon->outbuf); len = qstring_get_length(mon->outbuf); if (len && !mon->mux_out) { rc = qemu_chr_fe_write(mon->chr, (const uint8_t *) buf, len); if (rc == len) { QDECREF(mon->outbuf); mon->outbuf = qstring_new(); return; } if (rc > 0) { QString *tmp = qstring_from_str(buf + rc); QDECREF(mon->outbuf); mon->outbuf = tmp; } if (mon->watch == 0) { mon->watch = qemu_chr_fe_add_watch(mon->chr, G_IO_OUT, monitor_unblocked, mon); } } }
{ "code": [ " if (rc == len) {" ], "line_no": [ 31 ] }
void FUNC_0(Monitor *VAR_0) { int VAR_1; size_t len; const char *VAR_2; if (VAR_0->skip_flush) { return; } VAR_2 = qstring_get_str(VAR_0->outbuf); len = qstring_get_length(VAR_0->outbuf); if (len && !VAR_0->mux_out) { VAR_1 = qemu_chr_fe_write(VAR_0->chr, (const uint8_t *) VAR_2, len); if (VAR_1 == len) { QDECREF(VAR_0->outbuf); VAR_0->outbuf = qstring_new(); return; } if (VAR_1 > 0) { QString *tmp = qstring_from_str(VAR_2 + VAR_1); QDECREF(VAR_0->outbuf); VAR_0->outbuf = tmp; } if (VAR_0->watch == 0) { VAR_0->watch = qemu_chr_fe_add_watch(VAR_0->chr, G_IO_OUT, monitor_unblocked, VAR_0); } } }
[ "void FUNC_0(Monitor *VAR_0)\n{", "int VAR_1;", "size_t len;", "const char *VAR_2;", "if (VAR_0->skip_flush) {", "return;", "}", "VAR_2 = qstring_get_str(VAR_0->outbuf);", "len = qstring_get_length(VAR_0->outbuf);", "if (len && !VAR_0->mux_out) {", "VAR_1 = qemu_chr_fe_write(VAR_0->chr, (const uint8_t *) VAR_2, len);", "if (VAR_1 == len) {", "QDECREF(VAR_0->outbuf);", "VAR_0->outbuf = qstring_new();", "return;", "}", "if (VAR_1 > 0) {", "QString *tmp = qstring_from_str(VAR_2 + VAR_1);", "QDECREF(VAR_0->outbuf);", "VAR_0->outbuf = tmp;", "}", "if (VAR_0->watch == 0) {", "VAR_0->watch = qemu_chr_fe_add_watch(VAR_0->chr, G_IO_OUT,\nmonitor_unblocked, VAR_0);", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 65 ] ]
8,471
static ssize_t sdp_attr_get(struct bt_l2cap_sdp_state_s *sdp, uint8_t *rsp, const uint8_t *req, ssize_t len) { ssize_t seqlen; int i, start, end, max; int32_t handle; struct sdp_service_record_s *record; uint8_t *lst; /* Perform the search */ if (len < 7) return -SDP_INVALID_SYNTAX; memcpy(&handle, req, 4); req += 4; len -= 4; if (handle < 0 || handle > sdp->services) return -SDP_INVALID_RECORD_HANDLE; record = &sdp->service_list[handle]; for (i = 0; i < record->attributes; i ++) record->attribute_list[i].match = 0; max = (req[0] << 8) | req[1]; req += 2; len -= 2; if (max < 0x0007) return -SDP_INVALID_SYNTAX; if ((*req & ~SDP_DSIZE_MASK) == SDP_DTYPE_SEQ) { seqlen = sdp_datalen(&req, &len); if (seqlen < 3 || len < seqlen) return -SDP_INVALID_SYNTAX; len -= seqlen; while (seqlen) if (sdp_attr_match(record, &req, &seqlen)) return -SDP_INVALID_SYNTAX; } else if (sdp_attr_match(record, &req, &seqlen)) return -SDP_INVALID_SYNTAX; if (len < 1) return -SDP_INVALID_SYNTAX; if (*req) { if (len <= sizeof(int)) return -SDP_INVALID_SYNTAX; len -= sizeof(int); memcpy(&start, req + 1, sizeof(int)); } else start = 0; if (len > 1) return -SDP_INVALID_SYNTAX; /* Output the results */ lst = rsp + 2; max = MIN(max, MAX_RSP_PARAM_SIZE); len = 3 - start; end = 0; for (i = 0; i < record->attributes; i ++) if (record->attribute_list[i].match) { if (len >= 0 && len + record->attribute_list[i].len < max) { memcpy(lst + len, record->attribute_list[i].pair, record->attribute_list[i].len); end = len + record->attribute_list[i].len; } len += record->attribute_list[i].len; } if (0 >= start) { lst[0] = SDP_DTYPE_SEQ | SDP_DSIZE_NEXT2; lst[1] = (len + start - 3) >> 8; lst[2] = (len + start - 3) & 0xff; } rsp[0] = end >> 8; rsp[1] = end & 0xff; if (end < len) { len = end + start; lst[end ++] = sizeof(int); memcpy(lst + end, &len, sizeof(int)); end += sizeof(int); } else lst[end ++] = 0; return end + 2; }
true
qemu
374ec0669a1aa3affac7850a16c6cad18221c439
static ssize_t sdp_attr_get(struct bt_l2cap_sdp_state_s *sdp, uint8_t *rsp, const uint8_t *req, ssize_t len) { ssize_t seqlen; int i, start, end, max; int32_t handle; struct sdp_service_record_s *record; uint8_t *lst; if (len < 7) return -SDP_INVALID_SYNTAX; memcpy(&handle, req, 4); req += 4; len -= 4; if (handle < 0 || handle > sdp->services) return -SDP_INVALID_RECORD_HANDLE; record = &sdp->service_list[handle]; for (i = 0; i < record->attributes; i ++) record->attribute_list[i].match = 0; max = (req[0] << 8) | req[1]; req += 2; len -= 2; if (max < 0x0007) return -SDP_INVALID_SYNTAX; if ((*req & ~SDP_DSIZE_MASK) == SDP_DTYPE_SEQ) { seqlen = sdp_datalen(&req, &len); if (seqlen < 3 || len < seqlen) return -SDP_INVALID_SYNTAX; len -= seqlen; while (seqlen) if (sdp_attr_match(record, &req, &seqlen)) return -SDP_INVALID_SYNTAX; } else if (sdp_attr_match(record, &req, &seqlen)) return -SDP_INVALID_SYNTAX; if (len < 1) return -SDP_INVALID_SYNTAX; if (*req) { if (len <= sizeof(int)) return -SDP_INVALID_SYNTAX; len -= sizeof(int); memcpy(&start, req + 1, sizeof(int)); } else start = 0; if (len > 1) return -SDP_INVALID_SYNTAX; lst = rsp + 2; max = MIN(max, MAX_RSP_PARAM_SIZE); len = 3 - start; end = 0; for (i = 0; i < record->attributes; i ++) if (record->attribute_list[i].match) { if (len >= 0 && len + record->attribute_list[i].len < max) { memcpy(lst + len, record->attribute_list[i].pair, record->attribute_list[i].len); end = len + record->attribute_list[i].len; } len += record->attribute_list[i].len; } if (0 >= start) { lst[0] = SDP_DTYPE_SEQ | SDP_DSIZE_NEXT2; lst[1] = (len + start - 3) >> 8; lst[2] = (len + start - 3) & 0xff; } rsp[0] = end >> 8; rsp[1] = end & 0xff; if (end < len) { len = end + start; lst[end ++] = sizeof(int); memcpy(lst + end, &len, sizeof(int)); end += sizeof(int); } else lst[end ++] = 0; return end + 2; }
{ "code": [ " return -SDP_INVALID_SYNTAX;", " } else if (sdp_attr_match(record, &req, &seqlen))", " return -SDP_INVALID_SYNTAX;", " return -SDP_INVALID_SYNTAX;", " return -SDP_INVALID_SYNTAX;" ], "line_no": [ 23, 77, 23, 23, 23 ] }
static ssize_t FUNC_0(struct bt_l2cap_sdp_state_s *sdp, uint8_t *rsp, const uint8_t *req, ssize_t len) { ssize_t seqlen; int VAR_0, VAR_1, VAR_2, VAR_3; int32_t handle; struct sdp_service_record_s *VAR_4; uint8_t *lst; if (len < 7) return -SDP_INVALID_SYNTAX; memcpy(&handle, req, 4); req += 4; len -= 4; if (handle < 0 || handle > sdp->services) return -SDP_INVALID_RECORD_HANDLE; VAR_4 = &sdp->service_list[handle]; for (VAR_0 = 0; VAR_0 < VAR_4->attributes; VAR_0 ++) VAR_4->attribute_list[VAR_0].match = 0; VAR_3 = (req[0] << 8) | req[1]; req += 2; len -= 2; if (VAR_3 < 0x0007) return -SDP_INVALID_SYNTAX; if ((*req & ~SDP_DSIZE_MASK) == SDP_DTYPE_SEQ) { seqlen = sdp_datalen(&req, &len); if (seqlen < 3 || len < seqlen) return -SDP_INVALID_SYNTAX; len -= seqlen; while (seqlen) if (sdp_attr_match(VAR_4, &req, &seqlen)) return -SDP_INVALID_SYNTAX; } else if (sdp_attr_match(VAR_4, &req, &seqlen)) return -SDP_INVALID_SYNTAX; if (len < 1) return -SDP_INVALID_SYNTAX; if (*req) { if (len <= sizeof(int)) return -SDP_INVALID_SYNTAX; len -= sizeof(int); memcpy(&VAR_1, req + 1, sizeof(int)); } else VAR_1 = 0; if (len > 1) return -SDP_INVALID_SYNTAX; lst = rsp + 2; VAR_3 = MIN(VAR_3, MAX_RSP_PARAM_SIZE); len = 3 - VAR_1; VAR_2 = 0; for (VAR_0 = 0; VAR_0 < VAR_4->attributes; VAR_0 ++) if (VAR_4->attribute_list[VAR_0].match) { if (len >= 0 && len + VAR_4->attribute_list[VAR_0].len < VAR_3) { memcpy(lst + len, VAR_4->attribute_list[VAR_0].pair, VAR_4->attribute_list[VAR_0].len); VAR_2 = len + VAR_4->attribute_list[VAR_0].len; } len += VAR_4->attribute_list[VAR_0].len; } if (0 >= VAR_1) { lst[0] = SDP_DTYPE_SEQ | SDP_DSIZE_NEXT2; lst[1] = (len + VAR_1 - 3) >> 8; lst[2] = (len + VAR_1 - 3) & 0xff; } rsp[0] = VAR_2 >> 8; rsp[1] = VAR_2 & 0xff; if (VAR_2 < len) { len = VAR_2 + VAR_1; lst[VAR_2 ++] = sizeof(int); memcpy(lst + VAR_2, &len, sizeof(int)); VAR_2 += sizeof(int); } else lst[VAR_2 ++] = 0; return VAR_2 + 2; }
[ "static ssize_t FUNC_0(struct bt_l2cap_sdp_state_s *sdp,\nuint8_t *rsp, const uint8_t *req, ssize_t len)\n{", "ssize_t seqlen;", "int VAR_0, VAR_1, VAR_2, VAR_3;", "int32_t handle;", "struct sdp_service_record_s *VAR_4;", "uint8_t *lst;", "if (len < 7)\nreturn -SDP_INVALID_SYNTAX;", "memcpy(&handle, req, 4);", "req += 4;", "len -= 4;", "if (handle < 0 || handle > sdp->services)\nreturn -SDP_INVALID_RECORD_HANDLE;", "VAR_4 = &sdp->service_list[handle];", "for (VAR_0 = 0; VAR_0 < VAR_4->attributes; VAR_0 ++)", "VAR_4->attribute_list[VAR_0].match = 0;", "VAR_3 = (req[0] << 8) | req[1];", "req += 2;", "len -= 2;", "if (VAR_3 < 0x0007)\nreturn -SDP_INVALID_SYNTAX;", "if ((*req & ~SDP_DSIZE_MASK) == SDP_DTYPE_SEQ) {", "seqlen = sdp_datalen(&req, &len);", "if (seqlen < 3 || len < seqlen)\nreturn -SDP_INVALID_SYNTAX;", "len -= seqlen;", "while (seqlen)\nif (sdp_attr_match(VAR_4, &req, &seqlen))\nreturn -SDP_INVALID_SYNTAX;", "} else if (sdp_attr_match(VAR_4, &req, &seqlen))", "return -SDP_INVALID_SYNTAX;", "if (len < 1)\nreturn -SDP_INVALID_SYNTAX;", "if (*req) {", "if (len <= sizeof(int))\nreturn -SDP_INVALID_SYNTAX;", "len -= sizeof(int);", "memcpy(&VAR_1, req + 1, sizeof(int));", "} else", "VAR_1 = 0;", "if (len > 1)\nreturn -SDP_INVALID_SYNTAX;", "lst = rsp + 2;", "VAR_3 = MIN(VAR_3, MAX_RSP_PARAM_SIZE);", "len = 3 - VAR_1;", "VAR_2 = 0;", "for (VAR_0 = 0; VAR_0 < VAR_4->attributes; VAR_0 ++)", "if (VAR_4->attribute_list[VAR_0].match) {", "if (len >= 0 && len + VAR_4->attribute_list[VAR_0].len < VAR_3) {", "memcpy(lst + len, VAR_4->attribute_list[VAR_0].pair,\nVAR_4->attribute_list[VAR_0].len);", "VAR_2 = len + VAR_4->attribute_list[VAR_0].len;", "}", "len += VAR_4->attribute_list[VAR_0].len;", "}", "if (0 >= VAR_1) {", "lst[0] = SDP_DTYPE_SEQ | SDP_DSIZE_NEXT2;", "lst[1] = (len + VAR_1 - 3) >> 8;", "lst[2] = (len + VAR_1 - 3) & 0xff;", "}", "rsp[0] = VAR_2 >> 8;", "rsp[1] = VAR_2 & 0xff;", "if (VAR_2 < len) {", "len = VAR_2 + VAR_1;", "lst[VAR_2 ++] = sizeof(int);", "memcpy(lst + VAR_2, &len, sizeof(int));", "VAR_2 += sizeof(int);", "} else", "lst[VAR_2 ++] = 0;", "return VAR_2 + 2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33, 35 ], [ 37 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 71, 73, 75 ], [ 77 ], [ 79 ], [ 83, 85 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105, 107 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 153 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 173 ], [ 175 ] ]
8,472
static void virtio_pci_device_plugged(DeviceState *d) { VirtIOPCIProxy *proxy = VIRTIO_PCI(d); VirtioBusState *bus = &proxy->bus; uint8_t *config; uint32_t size; VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); config = proxy->pci_dev.config; if (proxy->class_code) { pci_config_set_class(config, proxy->class_code); } pci_set_word(config + PCI_SUBSYSTEM_VENDOR_ID, pci_get_word(config + PCI_VENDOR_ID)); pci_set_word(config + PCI_SUBSYSTEM_ID, virtio_bus_get_vdev_id(bus)); config[PCI_INTERRUPT_PIN] = 1; if (proxy->nvectors && msix_init_exclusive_bar(&proxy->pci_dev, proxy->nvectors, 1)) { error_report("unable to init msix vectors to %" PRIu32, proxy->nvectors); proxy->nvectors = 0; } proxy->pci_dev.config_write = virtio_write_config; size = VIRTIO_PCI_REGION_SIZE(&proxy->pci_dev) + virtio_bus_get_vdev_config_len(bus); if (size & (size - 1)) { size = 1 << qemu_fls(size); } memory_region_init_io(&proxy->bar, OBJECT(proxy), &virtio_pci_config_ops, proxy, "virtio-pci", size); pci_register_bar(&proxy->pci_dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &proxy->bar); if (!kvm_has_many_ioeventfds()) { proxy->flags &= ~VIRTIO_PCI_FLAG_USE_IOEVENTFD; } virtio_add_feature(&vdev->host_features, VIRTIO_F_BAD_FEATURE); }
true
qemu
e83980455c8c7eb066405de512be7c4bace3ac4d
static void virtio_pci_device_plugged(DeviceState *d) { VirtIOPCIProxy *proxy = VIRTIO_PCI(d); VirtioBusState *bus = &proxy->bus; uint8_t *config; uint32_t size; VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); config = proxy->pci_dev.config; if (proxy->class_code) { pci_config_set_class(config, proxy->class_code); } pci_set_word(config + PCI_SUBSYSTEM_VENDOR_ID, pci_get_word(config + PCI_VENDOR_ID)); pci_set_word(config + PCI_SUBSYSTEM_ID, virtio_bus_get_vdev_id(bus)); config[PCI_INTERRUPT_PIN] = 1; if (proxy->nvectors && msix_init_exclusive_bar(&proxy->pci_dev, proxy->nvectors, 1)) { error_report("unable to init msix vectors to %" PRIu32, proxy->nvectors); proxy->nvectors = 0; } proxy->pci_dev.config_write = virtio_write_config; size = VIRTIO_PCI_REGION_SIZE(&proxy->pci_dev) + virtio_bus_get_vdev_config_len(bus); if (size & (size - 1)) { size = 1 << qemu_fls(size); } memory_region_init_io(&proxy->bar, OBJECT(proxy), &virtio_pci_config_ops, proxy, "virtio-pci", size); pci_register_bar(&proxy->pci_dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &proxy->bar); if (!kvm_has_many_ioeventfds()) { proxy->flags &= ~VIRTIO_PCI_FLAG_USE_IOEVENTFD; } virtio_add_feature(&vdev->host_features, VIRTIO_F_BAD_FEATURE); }
{ "code": [ "static void virtio_pci_device_plugged(DeviceState *d)" ], "line_no": [ 1 ] }
static void FUNC_0(DeviceState *VAR_0) { VirtIOPCIProxy *proxy = VIRTIO_PCI(VAR_0); VirtioBusState *bus = &proxy->bus; uint8_t *config; uint32_t size; VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); config = proxy->pci_dev.config; if (proxy->class_code) { pci_config_set_class(config, proxy->class_code); } pci_set_word(config + PCI_SUBSYSTEM_VENDOR_ID, pci_get_word(config + PCI_VENDOR_ID)); pci_set_word(config + PCI_SUBSYSTEM_ID, virtio_bus_get_vdev_id(bus)); config[PCI_INTERRUPT_PIN] = 1; if (proxy->nvectors && msix_init_exclusive_bar(&proxy->pci_dev, proxy->nvectors, 1)) { error_report("unable to init msix vectors to %" PRIu32, proxy->nvectors); proxy->nvectors = 0; } proxy->pci_dev.config_write = virtio_write_config; size = VIRTIO_PCI_REGION_SIZE(&proxy->pci_dev) + virtio_bus_get_vdev_config_len(bus); if (size & (size - 1)) { size = 1 << qemu_fls(size); } memory_region_init_io(&proxy->bar, OBJECT(proxy), &virtio_pci_config_ops, proxy, "virtio-pci", size); pci_register_bar(&proxy->pci_dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &proxy->bar); if (!kvm_has_many_ioeventfds()) { proxy->flags &= ~VIRTIO_PCI_FLAG_USE_IOEVENTFD; } virtio_add_feature(&vdev->host_features, VIRTIO_F_BAD_FEATURE); }
[ "static void FUNC_0(DeviceState *VAR_0)\n{", "VirtIOPCIProxy *proxy = VIRTIO_PCI(VAR_0);", "VirtioBusState *bus = &proxy->bus;", "uint8_t *config;", "uint32_t size;", "VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);", "config = proxy->pci_dev.config;", "if (proxy->class_code) {", "pci_config_set_class(config, proxy->class_code);", "}", "pci_set_word(config + PCI_SUBSYSTEM_VENDOR_ID,\npci_get_word(config + PCI_VENDOR_ID));", "pci_set_word(config + PCI_SUBSYSTEM_ID, virtio_bus_get_vdev_id(bus));", "config[PCI_INTERRUPT_PIN] = 1;", "if (proxy->nvectors &&\nmsix_init_exclusive_bar(&proxy->pci_dev, proxy->nvectors, 1)) {", "error_report(\"unable to init msix vectors to %\" PRIu32,\nproxy->nvectors);", "proxy->nvectors = 0;", "}", "proxy->pci_dev.config_write = virtio_write_config;", "size = VIRTIO_PCI_REGION_SIZE(&proxy->pci_dev)\n+ virtio_bus_get_vdev_config_len(bus);", "if (size & (size - 1)) {", "size = 1 << qemu_fls(size);", "}", "memory_region_init_io(&proxy->bar, OBJECT(proxy), &virtio_pci_config_ops,\nproxy, \"virtio-pci\", size);", "pci_register_bar(&proxy->pci_dev, 0, PCI_BASE_ADDRESS_SPACE_IO,\n&proxy->bar);", "if (!kvm_has_many_ioeventfds()) {", "proxy->flags &= ~VIRTIO_PCI_FLAG_USE_IOEVENTFD;", "}", "virtio_add_feature(&vdev->host_features, VIRTIO_F_BAD_FEATURE);", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 35, 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 49 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65, 67 ], [ 69, 71 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ] ]
8,473
static void vc1_decode_b_mb_intfi(VC1Context *v) { MpegEncContext *s = &v->s; GetBitContext *gb = &s->gb; int i, j; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; int cbp = 0; /* cbp decoding stuff */ int mqdiff, mquant; /* MB quantization */ int ttmb = v->ttfrm; /* MB Transform type */ int mb_has_coeffs = 0; /* last_flag */ int val; /* temp value */ int first_block = 1; int dst_idx, off; int fwd; int dmv_x[2], dmv_y[2], pred_flag[2]; int bmvtype = BMV_TYPE_BACKWARD; int idx_mbmode; int av_uninit(interpmvp); mquant = v->pq; /* Lossy initialization */ s->mb_intra = 0; idx_mbmode = get_vlc2(gb, v->mbmode_vlc->table, VC1_IF_MBMODE_VLC_BITS, 2); if (idx_mbmode <= 1) { // intra MB s->mb_intra = v->is_intra[s->mb_x] = 1; s->current_picture.motion_val[1][s->block_index[0]][0] = 0; s->current_picture.motion_val[1][s->block_index[0]][1] = 0; s->current_picture.mb_type[mb_pos + v->mb_off] = MB_TYPE_INTRA; GET_MQUANT(); s->current_picture.qscale_table[mb_pos] = mquant; /* Set DC scale - y and c use the same (not sure if necessary here) */ s->y_dc_scale = s->y_dc_scale_table[mquant]; s->c_dc_scale = s->c_dc_scale_table[mquant]; v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb); mb_has_coeffs = idx_mbmode & 1; if (mb_has_coeffs) cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_ICBPCY_VLC_BITS, 2); dst_idx = 0; for (i = 0; i < 6; i++) { s->dc_val[0][s->block_index[i]] = 0; dst_idx += i >> 2; val = ((cbp >> (5 - i)) & 1); v->mb_type[0][s->block_index[i]] = s->mb_intra; v->a_avail = v->c_avail = 0; if (i == 2 || i == 3 || !s->first_slice_line) v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]]; if (i == 1 || i == 3 || s->mb_x) v->c_avail = v->mb_type[0][s->block_index[i] - 1]; vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i & 4) ? v->codingset2 : v->codingset); if ((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); if (v->rangeredfrm) for (j = 0; j < 64; j++) s->block[i][j] <<= 1; off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize); // TODO: yet to perform loop filter } } else { s->mb_intra = v->is_intra[s->mb_x] = 0; s->current_picture.mb_type[mb_pos + v->mb_off] = MB_TYPE_16x16; for (i = 0; i < 6; i++) v->mb_type[0][s->block_index[i]] = 0; if (v->fmb_is_raw) fwd = v->forward_mb_plane[mb_pos] = get_bits1(gb); else fwd = v->forward_mb_plane[mb_pos]; if (idx_mbmode <= 5) { // 1-MV dmv_x[0] = dmv_x[1] = dmv_y[0] = dmv_y[1] = 0; pred_flag[0] = pred_flag[1] = 0; if (fwd) bmvtype = BMV_TYPE_FORWARD; else { bmvtype = decode012(gb); switch (bmvtype) { case 0: bmvtype = BMV_TYPE_BACKWARD; break; case 1: bmvtype = BMV_TYPE_DIRECT; break; case 2: bmvtype = BMV_TYPE_INTERPOLATED; interpmvp = get_bits1(gb); } } v->bmvtype = bmvtype; if (bmvtype != BMV_TYPE_DIRECT && idx_mbmode & 1) { get_mvdata_interlaced(v, &dmv_x[bmvtype == BMV_TYPE_BACKWARD], &dmv_y[bmvtype == BMV_TYPE_BACKWARD], &pred_flag[bmvtype == BMV_TYPE_BACKWARD]); } if (bmvtype == BMV_TYPE_INTERPOLATED && interpmvp) { get_mvdata_interlaced(v, &dmv_x[1], &dmv_y[1], &pred_flag[1]); } if (bmvtype == BMV_TYPE_DIRECT) { dmv_x[0] = dmv_y[0] = pred_flag[0] = 0; dmv_x[1] = dmv_y[1] = pred_flag[0] = 0; } vc1_pred_b_mv_intfi(v, 0, dmv_x, dmv_y, 1, pred_flag); vc1_b_mc(v, dmv_x, dmv_y, (bmvtype == BMV_TYPE_DIRECT), bmvtype); mb_has_coeffs = !(idx_mbmode & 2); } else { // 4-MV if (fwd) bmvtype = BMV_TYPE_FORWARD; v->bmvtype = bmvtype; v->fourmvbp = get_vlc2(gb, v->fourmvbp_vlc->table, VC1_4MV_BLOCK_PATTERN_VLC_BITS, 1); for (i = 0; i < 6; i++) { if (i < 4) { dmv_x[0] = dmv_y[0] = pred_flag[0] = 0; dmv_x[1] = dmv_y[1] = pred_flag[1] = 0; val = ((v->fourmvbp >> (3 - i)) & 1); if (val) { get_mvdata_interlaced(v, &dmv_x[bmvtype == BMV_TYPE_BACKWARD], &dmv_y[bmvtype == BMV_TYPE_BACKWARD], &pred_flag[bmvtype == BMV_TYPE_BACKWARD]); } vc1_pred_b_mv_intfi(v, i, dmv_x, dmv_y, 0, pred_flag); vc1_mc_4mv_luma(v, i, bmvtype == BMV_TYPE_BACKWARD, 0); } else if (i == 4) vc1_mc_4mv_chroma(v, bmvtype == BMV_TYPE_BACKWARD); } mb_has_coeffs = idx_mbmode & 1; } if (mb_has_coeffs) cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); if (cbp) { GET_MQUANT(); } s->current_picture.qscale_table[mb_pos] = mquant; if (!v->ttmbf && cbp) { ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); } dst_idx = 0; for (i = 0; i < 6; i++) { s->dc_val[0][s->block_index[i]] = 0; dst_idx += i >> 2; val = ((cbp >> (5 - i)) & 1); off = (i & 4) ? 0 : (i & 1) * 8 + (i & 2) * 4 * s->linesize; if (val) { vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize, (i & 4) && (s->flags & CODEC_FLAG_GRAY), NULL); if (!v->ttmbf && ttmb < 8) ttmb = -1; first_block = 0; } } } }
true
FFmpeg
ebe8c7fe520145243ad46ac839dffe8a32278582
static void vc1_decode_b_mb_intfi(VC1Context *v) { MpegEncContext *s = &v->s; GetBitContext *gb = &s->gb; int i, j; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; int cbp = 0; int mqdiff, mquant; int ttmb = v->ttfrm; int mb_has_coeffs = 0; int val; int first_block = 1; int dst_idx, off; int fwd; int dmv_x[2], dmv_y[2], pred_flag[2]; int bmvtype = BMV_TYPE_BACKWARD; int idx_mbmode; int av_uninit(interpmvp); mquant = v->pq; s->mb_intra = 0; idx_mbmode = get_vlc2(gb, v->mbmode_vlc->table, VC1_IF_MBMODE_VLC_BITS, 2); if (idx_mbmode <= 1) { s->mb_intra = v->is_intra[s->mb_x] = 1; s->current_picture.motion_val[1][s->block_index[0]][0] = 0; s->current_picture.motion_val[1][s->block_index[0]][1] = 0; s->current_picture.mb_type[mb_pos + v->mb_off] = MB_TYPE_INTRA; GET_MQUANT(); s->current_picture.qscale_table[mb_pos] = mquant; s->y_dc_scale = s->y_dc_scale_table[mquant]; s->c_dc_scale = s->c_dc_scale_table[mquant]; v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb); mb_has_coeffs = idx_mbmode & 1; if (mb_has_coeffs) cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_ICBPCY_VLC_BITS, 2); dst_idx = 0; for (i = 0; i < 6; i++) { s->dc_val[0][s->block_index[i]] = 0; dst_idx += i >> 2; val = ((cbp >> (5 - i)) & 1); v->mb_type[0][s->block_index[i]] = s->mb_intra; v->a_avail = v->c_avail = 0; if (i == 2 || i == 3 || !s->first_slice_line) v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]]; if (i == 1 || i == 3 || s->mb_x) v->c_avail = v->mb_type[0][s->block_index[i] - 1]; vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i & 4) ? v->codingset2 : v->codingset); if ((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); if (v->rangeredfrm) for (j = 0; j < 64; j++) s->block[i][j] <<= 1; off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize); } } else { s->mb_intra = v->is_intra[s->mb_x] = 0; s->current_picture.mb_type[mb_pos + v->mb_off] = MB_TYPE_16x16; for (i = 0; i < 6; i++) v->mb_type[0][s->block_index[i]] = 0; if (v->fmb_is_raw) fwd = v->forward_mb_plane[mb_pos] = get_bits1(gb); else fwd = v->forward_mb_plane[mb_pos]; if (idx_mbmode <= 5) { dmv_x[0] = dmv_x[1] = dmv_y[0] = dmv_y[1] = 0; pred_flag[0] = pred_flag[1] = 0; if (fwd) bmvtype = BMV_TYPE_FORWARD; else { bmvtype = decode012(gb); switch (bmvtype) { case 0: bmvtype = BMV_TYPE_BACKWARD; break; case 1: bmvtype = BMV_TYPE_DIRECT; break; case 2: bmvtype = BMV_TYPE_INTERPOLATED; interpmvp = get_bits1(gb); } } v->bmvtype = bmvtype; if (bmvtype != BMV_TYPE_DIRECT && idx_mbmode & 1) { get_mvdata_interlaced(v, &dmv_x[bmvtype == BMV_TYPE_BACKWARD], &dmv_y[bmvtype == BMV_TYPE_BACKWARD], &pred_flag[bmvtype == BMV_TYPE_BACKWARD]); } if (bmvtype == BMV_TYPE_INTERPOLATED && interpmvp) { get_mvdata_interlaced(v, &dmv_x[1], &dmv_y[1], &pred_flag[1]); } if (bmvtype == BMV_TYPE_DIRECT) { dmv_x[0] = dmv_y[0] = pred_flag[0] = 0; dmv_x[1] = dmv_y[1] = pred_flag[0] = 0; } vc1_pred_b_mv_intfi(v, 0, dmv_x, dmv_y, 1, pred_flag); vc1_b_mc(v, dmv_x, dmv_y, (bmvtype == BMV_TYPE_DIRECT), bmvtype); mb_has_coeffs = !(idx_mbmode & 2); } else { if (fwd) bmvtype = BMV_TYPE_FORWARD; v->bmvtype = bmvtype; v->fourmvbp = get_vlc2(gb, v->fourmvbp_vlc->table, VC1_4MV_BLOCK_PATTERN_VLC_BITS, 1); for (i = 0; i < 6; i++) { if (i < 4) { dmv_x[0] = dmv_y[0] = pred_flag[0] = 0; dmv_x[1] = dmv_y[1] = pred_flag[1] = 0; val = ((v->fourmvbp >> (3 - i)) & 1); if (val) { get_mvdata_interlaced(v, &dmv_x[bmvtype == BMV_TYPE_BACKWARD], &dmv_y[bmvtype == BMV_TYPE_BACKWARD], &pred_flag[bmvtype == BMV_TYPE_BACKWARD]); } vc1_pred_b_mv_intfi(v, i, dmv_x, dmv_y, 0, pred_flag); vc1_mc_4mv_luma(v, i, bmvtype == BMV_TYPE_BACKWARD, 0); } else if (i == 4) vc1_mc_4mv_chroma(v, bmvtype == BMV_TYPE_BACKWARD); } mb_has_coeffs = idx_mbmode & 1; } if (mb_has_coeffs) cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); if (cbp) { GET_MQUANT(); } s->current_picture.qscale_table[mb_pos] = mquant; if (!v->ttmbf && cbp) { ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); } dst_idx = 0; for (i = 0; i < 6; i++) { s->dc_val[0][s->block_index[i]] = 0; dst_idx += i >> 2; val = ((cbp >> (5 - i)) & 1); off = (i & 4) ? 0 : (i & 1) * 8 + (i & 2) * 4 * s->linesize; if (val) { vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize, (i & 4) && (s->flags & CODEC_FLAG_GRAY), NULL); if (!v->ttmbf && ttmb < 8) ttmb = -1; first_block = 0; } } } }
{ "code": [ " int av_uninit(interpmvp);", " if (bmvtype == BMV_TYPE_INTERPOLATED && interpmvp) {" ], "line_no": [ 35, 185 ] }
static void FUNC_0(VC1Context *VAR_0) { MpegEncContext *s = &VAR_0->s; GetBitContext *gb = &s->gb; int VAR_1, VAR_2; int VAR_3 = s->mb_x + s->mb_y * s->mb_stride; int VAR_4 = 0; int VAR_5, VAR_6; int VAR_7 = VAR_0->ttfrm; int VAR_8 = 0; int VAR_9; int VAR_10 = 1; int VAR_11, VAR_12; int VAR_13; int VAR_14[2], VAR_15[2], VAR_16[2]; int VAR_17 = BMV_TYPE_BACKWARD; int VAR_18; int FUNC_1(interpmvp); VAR_6 = VAR_0->pq; s->mb_intra = 0; VAR_18 = get_vlc2(gb, VAR_0->mbmode_vlc->table, VC1_IF_MBMODE_VLC_BITS, 2); if (VAR_18 <= 1) { s->mb_intra = VAR_0->is_intra[s->mb_x] = 1; s->current_picture.motion_val[1][s->block_index[0]][0] = 0; s->current_picture.motion_val[1][s->block_index[0]][1] = 0; s->current_picture.mb_type[VAR_3 + VAR_0->mb_off] = MB_TYPE_INTRA; GET_MQUANT(); s->current_picture.qscale_table[VAR_3] = VAR_6; s->y_dc_scale = s->y_dc_scale_table[VAR_6]; s->c_dc_scale = s->c_dc_scale_table[VAR_6]; VAR_0->s.ac_pred = VAR_0->acpred_plane[VAR_3] = get_bits1(gb); VAR_8 = VAR_18 & 1; if (VAR_8) VAR_4 = 1 + get_vlc2(&VAR_0->s.gb, VAR_0->cbpcy_vlc->table, VC1_ICBPCY_VLC_BITS, 2); VAR_11 = 0; for (VAR_1 = 0; VAR_1 < 6; VAR_1++) { s->dc_val[0][s->block_index[VAR_1]] = 0; VAR_11 += VAR_1 >> 2; VAR_9 = ((VAR_4 >> (5 - VAR_1)) & 1); VAR_0->mb_type[0][s->block_index[VAR_1]] = s->mb_intra; VAR_0->a_avail = VAR_0->c_avail = 0; if (VAR_1 == 2 || VAR_1 == 3 || !s->first_slice_line) VAR_0->a_avail = VAR_0->mb_type[0][s->block_index[VAR_1] - s->block_wrap[VAR_1]]; if (VAR_1 == 1 || VAR_1 == 3 || s->mb_x) VAR_0->c_avail = VAR_0->mb_type[0][s->block_index[VAR_1] - 1]; vc1_decode_intra_block(VAR_0, s->block[VAR_1], VAR_1, VAR_9, VAR_6, (VAR_1 & 4) ? VAR_0->codingset2 : VAR_0->codingset); if ((VAR_1>3) && (s->flags & CODEC_FLAG_GRAY)) continue; VAR_0->vc1dsp.vc1_inv_trans_8x8(s->block[VAR_1]); if (VAR_0->rangeredfrm) for (VAR_2 = 0; VAR_2 < 64; VAR_2++) s->block[VAR_1][VAR_2] <<= 1; VAR_12 = (VAR_1 & 4) ? 0 : ((VAR_1 & 1) * 8 + (VAR_1 & 2) * 4 * s->linesize); s->dsp.put_signed_pixels_clamped(s->block[VAR_1], s->dest[VAR_11] + VAR_12, (VAR_1 & 4) ? s->uvlinesize : s->linesize); } } else { s->mb_intra = VAR_0->is_intra[s->mb_x] = 0; s->current_picture.mb_type[VAR_3 + VAR_0->mb_off] = MB_TYPE_16x16; for (VAR_1 = 0; VAR_1 < 6; VAR_1++) VAR_0->mb_type[0][s->block_index[VAR_1]] = 0; if (VAR_0->fmb_is_raw) VAR_13 = VAR_0->forward_mb_plane[VAR_3] = get_bits1(gb); else VAR_13 = VAR_0->forward_mb_plane[VAR_3]; if (VAR_18 <= 5) { VAR_14[0] = VAR_14[1] = VAR_15[0] = VAR_15[1] = 0; VAR_16[0] = VAR_16[1] = 0; if (VAR_13) VAR_17 = BMV_TYPE_FORWARD; else { VAR_17 = decode012(gb); switch (VAR_17) { case 0: VAR_17 = BMV_TYPE_BACKWARD; break; case 1: VAR_17 = BMV_TYPE_DIRECT; break; case 2: VAR_17 = BMV_TYPE_INTERPOLATED; interpmvp = get_bits1(gb); } } VAR_0->VAR_17 = VAR_17; if (VAR_17 != BMV_TYPE_DIRECT && VAR_18 & 1) { get_mvdata_interlaced(VAR_0, &VAR_14[VAR_17 == BMV_TYPE_BACKWARD], &VAR_15[VAR_17 == BMV_TYPE_BACKWARD], &VAR_16[VAR_17 == BMV_TYPE_BACKWARD]); } if (VAR_17 == BMV_TYPE_INTERPOLATED && interpmvp) { get_mvdata_interlaced(VAR_0, &VAR_14[1], &VAR_15[1], &VAR_16[1]); } if (VAR_17 == BMV_TYPE_DIRECT) { VAR_14[0] = VAR_15[0] = VAR_16[0] = 0; VAR_14[1] = VAR_15[1] = VAR_16[0] = 0; } vc1_pred_b_mv_intfi(VAR_0, 0, VAR_14, VAR_15, 1, VAR_16); vc1_b_mc(VAR_0, VAR_14, VAR_15, (VAR_17 == BMV_TYPE_DIRECT), VAR_17); VAR_8 = !(VAR_18 & 2); } else { if (VAR_13) VAR_17 = BMV_TYPE_FORWARD; VAR_0->VAR_17 = VAR_17; VAR_0->fourmvbp = get_vlc2(gb, VAR_0->fourmvbp_vlc->table, VC1_4MV_BLOCK_PATTERN_VLC_BITS, 1); for (VAR_1 = 0; VAR_1 < 6; VAR_1++) { if (VAR_1 < 4) { VAR_14[0] = VAR_15[0] = VAR_16[0] = 0; VAR_14[1] = VAR_15[1] = VAR_16[1] = 0; VAR_9 = ((VAR_0->fourmvbp >> (3 - VAR_1)) & 1); if (VAR_9) { get_mvdata_interlaced(VAR_0, &VAR_14[VAR_17 == BMV_TYPE_BACKWARD], &VAR_15[VAR_17 == BMV_TYPE_BACKWARD], &VAR_16[VAR_17 == BMV_TYPE_BACKWARD]); } vc1_pred_b_mv_intfi(VAR_0, VAR_1, VAR_14, VAR_15, 0, VAR_16); vc1_mc_4mv_luma(VAR_0, VAR_1, VAR_17 == BMV_TYPE_BACKWARD, 0); } else if (VAR_1 == 4) vc1_mc_4mv_chroma(VAR_0, VAR_17 == BMV_TYPE_BACKWARD); } VAR_8 = VAR_18 & 1; } if (VAR_8) VAR_4 = 1 + get_vlc2(&VAR_0->s.gb, VAR_0->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); if (VAR_4) { GET_MQUANT(); } s->current_picture.qscale_table[VAR_3] = VAR_6; if (!VAR_0->ttmbf && VAR_4) { VAR_7 = get_vlc2(gb, ff_vc1_ttmb_vlc[VAR_0->tt_index].table, VC1_TTMB_VLC_BITS, 2); } VAR_11 = 0; for (VAR_1 = 0; VAR_1 < 6; VAR_1++) { s->dc_val[0][s->block_index[VAR_1]] = 0; VAR_11 += VAR_1 >> 2; VAR_9 = ((VAR_4 >> (5 - VAR_1)) & 1); VAR_12 = (VAR_1 & 4) ? 0 : (VAR_1 & 1) * 8 + (VAR_1 & 2) * 4 * s->linesize; if (VAR_9) { vc1_decode_p_block(VAR_0, s->block[VAR_1], VAR_1, VAR_6, VAR_7, VAR_10, s->dest[VAR_11] + VAR_12, (VAR_1 & 4) ? s->uvlinesize : s->linesize, (VAR_1 & 4) && (s->flags & CODEC_FLAG_GRAY), NULL); if (!VAR_0->ttmbf && VAR_7 < 8) VAR_7 = -1; VAR_10 = 0; } } } }
[ "static void FUNC_0(VC1Context *VAR_0)\n{", "MpegEncContext *s = &VAR_0->s;", "GetBitContext *gb = &s->gb;", "int VAR_1, VAR_2;", "int VAR_3 = s->mb_x + s->mb_y * s->mb_stride;", "int VAR_4 = 0;", "int VAR_5, VAR_6;", "int VAR_7 = VAR_0->ttfrm;", "int VAR_8 = 0;", "int VAR_9;", "int VAR_10 = 1;", "int VAR_11, VAR_12;", "int VAR_13;", "int VAR_14[2], VAR_15[2], VAR_16[2];", "int VAR_17 = BMV_TYPE_BACKWARD;", "int VAR_18;", "int FUNC_1(interpmvp);", "VAR_6 = VAR_0->pq;", "s->mb_intra = 0;", "VAR_18 = get_vlc2(gb, VAR_0->mbmode_vlc->table, VC1_IF_MBMODE_VLC_BITS, 2);", "if (VAR_18 <= 1) {", "s->mb_intra = VAR_0->is_intra[s->mb_x] = 1;", "s->current_picture.motion_val[1][s->block_index[0]][0] = 0;", "s->current_picture.motion_val[1][s->block_index[0]][1] = 0;", "s->current_picture.mb_type[VAR_3 + VAR_0->mb_off] = MB_TYPE_INTRA;", "GET_MQUANT();", "s->current_picture.qscale_table[VAR_3] = VAR_6;", "s->y_dc_scale = s->y_dc_scale_table[VAR_6];", "s->c_dc_scale = s->c_dc_scale_table[VAR_6];", "VAR_0->s.ac_pred = VAR_0->acpred_plane[VAR_3] = get_bits1(gb);", "VAR_8 = VAR_18 & 1;", "if (VAR_8)\nVAR_4 = 1 + get_vlc2(&VAR_0->s.gb, VAR_0->cbpcy_vlc->table, VC1_ICBPCY_VLC_BITS, 2);", "VAR_11 = 0;", "for (VAR_1 = 0; VAR_1 < 6; VAR_1++) {", "s->dc_val[0][s->block_index[VAR_1]] = 0;", "VAR_11 += VAR_1 >> 2;", "VAR_9 = ((VAR_4 >> (5 - VAR_1)) & 1);", "VAR_0->mb_type[0][s->block_index[VAR_1]] = s->mb_intra;", "VAR_0->a_avail = VAR_0->c_avail = 0;", "if (VAR_1 == 2 || VAR_1 == 3 || !s->first_slice_line)\nVAR_0->a_avail = VAR_0->mb_type[0][s->block_index[VAR_1] - s->block_wrap[VAR_1]];", "if (VAR_1 == 1 || VAR_1 == 3 || s->mb_x)\nVAR_0->c_avail = VAR_0->mb_type[0][s->block_index[VAR_1] - 1];", "vc1_decode_intra_block(VAR_0, s->block[VAR_1], VAR_1, VAR_9, VAR_6,\n(VAR_1 & 4) ? VAR_0->codingset2 : VAR_0->codingset);", "if ((VAR_1>3) && (s->flags & CODEC_FLAG_GRAY))\ncontinue;", "VAR_0->vc1dsp.vc1_inv_trans_8x8(s->block[VAR_1]);", "if (VAR_0->rangeredfrm)\nfor (VAR_2 = 0; VAR_2 < 64; VAR_2++)", "s->block[VAR_1][VAR_2] <<= 1;", "VAR_12 = (VAR_1 & 4) ? 0 : ((VAR_1 & 1) * 8 + (VAR_1 & 2) * 4 * s->linesize);", "s->dsp.put_signed_pixels_clamped(s->block[VAR_1], s->dest[VAR_11] + VAR_12, (VAR_1 & 4) ? s->uvlinesize : s->linesize);", "}", "} else {", "s->mb_intra = VAR_0->is_intra[s->mb_x] = 0;", "s->current_picture.mb_type[VAR_3 + VAR_0->mb_off] = MB_TYPE_16x16;", "for (VAR_1 = 0; VAR_1 < 6; VAR_1++) VAR_0->mb_type[0][s->block_index[VAR_1]] = 0;", "if (VAR_0->fmb_is_raw)\nVAR_13 = VAR_0->forward_mb_plane[VAR_3] = get_bits1(gb);", "else\nVAR_13 = VAR_0->forward_mb_plane[VAR_3];", "if (VAR_18 <= 5) {", "VAR_14[0] = VAR_14[1] = VAR_15[0] = VAR_15[1] = 0;", "VAR_16[0] = VAR_16[1] = 0;", "if (VAR_13)\nVAR_17 = BMV_TYPE_FORWARD;", "else {", "VAR_17 = decode012(gb);", "switch (VAR_17) {", "case 0:\nVAR_17 = BMV_TYPE_BACKWARD;", "break;", "case 1:\nVAR_17 = BMV_TYPE_DIRECT;", "break;", "case 2:\nVAR_17 = BMV_TYPE_INTERPOLATED;", "interpmvp = get_bits1(gb);", "}", "}", "VAR_0->VAR_17 = VAR_17;", "if (VAR_17 != BMV_TYPE_DIRECT && VAR_18 & 1) {", "get_mvdata_interlaced(VAR_0, &VAR_14[VAR_17 == BMV_TYPE_BACKWARD], &VAR_15[VAR_17 == BMV_TYPE_BACKWARD], &VAR_16[VAR_17 == BMV_TYPE_BACKWARD]);", "}", "if (VAR_17 == BMV_TYPE_INTERPOLATED && interpmvp) {", "get_mvdata_interlaced(VAR_0, &VAR_14[1], &VAR_15[1], &VAR_16[1]);", "}", "if (VAR_17 == BMV_TYPE_DIRECT) {", "VAR_14[0] = VAR_15[0] = VAR_16[0] = 0;", "VAR_14[1] = VAR_15[1] = VAR_16[0] = 0;", "}", "vc1_pred_b_mv_intfi(VAR_0, 0, VAR_14, VAR_15, 1, VAR_16);", "vc1_b_mc(VAR_0, VAR_14, VAR_15, (VAR_17 == BMV_TYPE_DIRECT), VAR_17);", "VAR_8 = !(VAR_18 & 2);", "} else {", "if (VAR_13)\nVAR_17 = BMV_TYPE_FORWARD;", "VAR_0->VAR_17 = VAR_17;", "VAR_0->fourmvbp = get_vlc2(gb, VAR_0->fourmvbp_vlc->table, VC1_4MV_BLOCK_PATTERN_VLC_BITS, 1);", "for (VAR_1 = 0; VAR_1 < 6; VAR_1++) {", "if (VAR_1 < 4) {", "VAR_14[0] = VAR_15[0] = VAR_16[0] = 0;", "VAR_14[1] = VAR_15[1] = VAR_16[1] = 0;", "VAR_9 = ((VAR_0->fourmvbp >> (3 - VAR_1)) & 1);", "if (VAR_9) {", "get_mvdata_interlaced(VAR_0, &VAR_14[VAR_17 == BMV_TYPE_BACKWARD],\n&VAR_15[VAR_17 == BMV_TYPE_BACKWARD],\n&VAR_16[VAR_17 == BMV_TYPE_BACKWARD]);", "}", "vc1_pred_b_mv_intfi(VAR_0, VAR_1, VAR_14, VAR_15, 0, VAR_16);", "vc1_mc_4mv_luma(VAR_0, VAR_1, VAR_17 == BMV_TYPE_BACKWARD, 0);", "} else if (VAR_1 == 4)", "vc1_mc_4mv_chroma(VAR_0, VAR_17 == BMV_TYPE_BACKWARD);", "}", "VAR_8 = VAR_18 & 1;", "}", "if (VAR_8)\nVAR_4 = 1 + get_vlc2(&VAR_0->s.gb, VAR_0->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);", "if (VAR_4) {", "GET_MQUANT();", "}", "s->current_picture.qscale_table[VAR_3] = VAR_6;", "if (!VAR_0->ttmbf && VAR_4) {", "VAR_7 = get_vlc2(gb, ff_vc1_ttmb_vlc[VAR_0->tt_index].table, VC1_TTMB_VLC_BITS, 2);", "}", "VAR_11 = 0;", "for (VAR_1 = 0; VAR_1 < 6; VAR_1++) {", "s->dc_val[0][s->block_index[VAR_1]] = 0;", "VAR_11 += VAR_1 >> 2;", "VAR_9 = ((VAR_4 >> (5 - VAR_1)) & 1);", "VAR_12 = (VAR_1 & 4) ? 0 : (VAR_1 & 1) * 8 + (VAR_1 & 2) * 4 * s->linesize;", "if (VAR_9) {", "vc1_decode_p_block(VAR_0, s->block[VAR_1], VAR_1, VAR_6, VAR_7,\nVAR_10, s->dest[VAR_11] + VAR_12,\n(VAR_1 & 4) ? s->uvlinesize : s->linesize,\n(VAR_1 & 4) && (s->flags & CODEC_FLAG_GRAY), NULL);", "if (!VAR_0->ttmbf && VAR_7 < 8)\nVAR_7 = -1;", "VAR_10 = 0;", "}", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 93, 95 ], [ 99, 101 ], [ 103, 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131, 133 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145, 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155, 157 ], [ 159 ], [ 161, 163 ], [ 165 ], [ 167, 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207, 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227, 229, 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249, 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281, 283, 285, 287 ], [ 289, 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ] ]