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
26,881
static S390PCIBusDevice *s390_pci_find_dev_by_uid(uint16_t uid) { int i; S390PCIBusDevice *pbdev; S390pciState *s = s390_get_phb(); for (i = 0; i < PCI_SLOT_MAX; i++) { pbdev = s->pbdev[i]; if (!pbdev) { continue; } if (pbdev->uid == uid) { return pbdev; } } return NULL; }
false
qemu
e70377dfa4bbc2e101066ca35675bed4129c5a8c
static S390PCIBusDevice *s390_pci_find_dev_by_uid(uint16_t uid) { int i; S390PCIBusDevice *pbdev; S390pciState *s = s390_get_phb(); for (i = 0; i < PCI_SLOT_MAX; i++) { pbdev = s->pbdev[i]; if (!pbdev) { continue; } if (pbdev->uid == uid) { return pbdev; } } return NULL; }
{ "code": [], "line_no": [] }
static S390PCIBusDevice *FUNC_0(uint16_t uid) { int VAR_0; S390PCIBusDevice *pbdev; S390pciState *s = s390_get_phb(); for (VAR_0 = 0; VAR_0 < PCI_SLOT_MAX; VAR_0++) { pbdev = s->pbdev[VAR_0]; if (!pbdev) { continue; } if (pbdev->uid == uid) { return pbdev; } } return NULL; }
[ "static S390PCIBusDevice *FUNC_0(uint16_t uid)\n{", "int VAR_0;", "S390PCIBusDevice *pbdev;", "S390pciState *s = s390_get_phb();", "for (VAR_0 = 0; VAR_0 < PCI_SLOT_MAX; VAR_0++) {", "pbdev = s->pbdev[VAR_0];", "if (!pbdev) {", "continue;", "}", "if (pbdev->uid == uid) {", "return pbdev;", "}"...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ] ]
26,882
static int usb_host_usbfs_type(USBHostDevice *s, USBPacket *p) { static const int usbfs[] = { [USB_ENDPOINT_XFER_CONTROL] = USBDEVFS_URB_TYPE_CONTROL, [USB_ENDPOINT_XFER_ISOC] = USBDEVFS_URB_TYPE_ISO, [USB_ENDPOINT_XFER_BULK] = USBDEVFS_URB_TYPE_BULK, [USB_ENDPOINT_XFER_INT] = USBDEVFS_URB_TYPE_INTERRUPT, }; uint8_t type = usb_ep_get_type(&s->dev, p->pid, p->devep); assert(type < ARRAY_SIZE(usbfs)); return usbfs[type]; }
false
qemu
079d0b7f1eedcc634c371fe05b617fdc55c8b762
static int usb_host_usbfs_type(USBHostDevice *s, USBPacket *p) { static const int usbfs[] = { [USB_ENDPOINT_XFER_CONTROL] = USBDEVFS_URB_TYPE_CONTROL, [USB_ENDPOINT_XFER_ISOC] = USBDEVFS_URB_TYPE_ISO, [USB_ENDPOINT_XFER_BULK] = USBDEVFS_URB_TYPE_BULK, [USB_ENDPOINT_XFER_INT] = USBDEVFS_URB_TYPE_INTERRUPT, }; uint8_t type = usb_ep_get_type(&s->dev, p->pid, p->devep); assert(type < ARRAY_SIZE(usbfs)); return usbfs[type]; }
{ "code": [], "line_no": [] }
static int FUNC_0(USBHostDevice *VAR_0, USBPacket *VAR_1) { static const int VAR_2[] = { [USB_ENDPOINT_XFER_CONTROL] = USBDEVFS_URB_TYPE_CONTROL, [USB_ENDPOINT_XFER_ISOC] = USBDEVFS_URB_TYPE_ISO, [USB_ENDPOINT_XFER_BULK] = USBDEVFS_URB_TYPE_BULK, [USB_ENDPOINT_XFER_INT] = USBDEVFS_URB_TYPE_INTERRUPT, }; uint8_t type = usb_ep_get_type(&VAR_0->dev, VAR_1->pid, VAR_1->devep); assert(type < ARRAY_SIZE(VAR_2)); return VAR_2[type]; }
[ "static int FUNC_0(USBHostDevice *VAR_0, USBPacket *VAR_1)\n{", "static const int VAR_2[] = {", "[USB_ENDPOINT_XFER_CONTROL] = USBDEVFS_URB_TYPE_CONTROL,\n[USB_ENDPOINT_XFER_ISOC] = USBDEVFS_URB_TYPE_ISO,\n[USB_ENDPOINT_XFER_BULK] = USBDEVFS_URB_TYPE_BULK,\n[USB_ENDPOINT_XFER_INT] = USBDEVFS_URB_TYPE_...
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9, 11, 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
26,883
static void scsi_cancel_io(SCSIRequest *req) { SCSIDiskReq *r = DO_UPCAST(SCSIDiskReq, req, req); DPRINTF("Cancel tag=0x%x\n", req->tag); if (r->req.aiocb) { bdrv_aio_cancel(r->req.aiocb); /* This reference was left in by scsi_*_data. We take ownership of * it the moment scsi_req_cancel is called, independent of whether * bdrv_aio_cancel completes the request or not. */ scsi_req_unref(&r->req); } r->req.aiocb = NULL; }
false
qemu
3df9caf88f5c0859ae380101fea47609ba1dbfbd
static void scsi_cancel_io(SCSIRequest *req) { SCSIDiskReq *r = DO_UPCAST(SCSIDiskReq, req, req); DPRINTF("Cancel tag=0x%x\n", req->tag); if (r->req.aiocb) { bdrv_aio_cancel(r->req.aiocb); scsi_req_unref(&r->req); } r->req.aiocb = NULL; }
{ "code": [], "line_no": [] }
static void FUNC_0(SCSIRequest *VAR_0) { SCSIDiskReq *r = DO_UPCAST(SCSIDiskReq, VAR_0, VAR_0); DPRINTF("Cancel tag=0x%x\n", VAR_0->tag); if (r->VAR_0.aiocb) { bdrv_aio_cancel(r->VAR_0.aiocb); scsi_req_unref(&r->VAR_0); } r->VAR_0.aiocb = NULL; }
[ "static void FUNC_0(SCSIRequest *VAR_0)\n{", "SCSIDiskReq *r = DO_UPCAST(SCSIDiskReq, VAR_0, VAR_0);", "DPRINTF(\"Cancel tag=0x%x\\n\", VAR_0->tag);", "if (r->VAR_0.aiocb) {", "bdrv_aio_cancel(r->VAR_0.aiocb);", "scsi_req_unref(&r->VAR_0);", "}", "r->VAR_0.aiocb = NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ] ]
26,885
static uint32_t drc_unisolate_logical(sPAPRDRConnector *drc) { /* cannot unisolate a non-existent resource, and, or resources * which are in an 'UNUSABLE' allocation state. (PAPR 2.7, * 13.5.3.5) */ if (!drc->dev || drc->allocation_state == SPAPR_DR_ALLOCATION_STATE_UNUSABLE) { return RTAS_OUT_NO_SUCH_INDICATOR; } drc->isolation_state = SPAPR_DR_ISOLATION_STATE_UNISOLATED; return RTAS_OUT_SUCCESS; }
false
qemu
9d4c0f4f0a71e74fd7e04d73620268484d693adf
static uint32_t drc_unisolate_logical(sPAPRDRConnector *drc) { if (!drc->dev || drc->allocation_state == SPAPR_DR_ALLOCATION_STATE_UNUSABLE) { return RTAS_OUT_NO_SUCH_INDICATOR; } drc->isolation_state = SPAPR_DR_ISOLATION_STATE_UNISOLATED; return RTAS_OUT_SUCCESS; }
{ "code": [], "line_no": [] }
static uint32_t FUNC_0(sPAPRDRConnector *drc) { if (!drc->dev || drc->allocation_state == SPAPR_DR_ALLOCATION_STATE_UNUSABLE) { return RTAS_OUT_NO_SUCH_INDICATOR; } drc->isolation_state = SPAPR_DR_ISOLATION_STATE_UNISOLATED; return RTAS_OUT_SUCCESS; }
[ "static uint32_t FUNC_0(sPAPRDRConnector *drc)\n{", "if (!drc->dev ||\ndrc->allocation_state == SPAPR_DR_ALLOCATION_STATE_UNUSABLE) {", "return RTAS_OUT_NO_SUCH_INDICATOR;", "}", "drc->isolation_state = SPAPR_DR_ISOLATION_STATE_UNISOLATED;", "return RTAS_OUT_SUCCESS;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 23 ], [ 27 ], [ 29 ] ]
26,887
void do_blockdev_backup(const char *job_id, const char *device, const char *target, enum MirrorSyncMode sync, bool has_speed, int64_t speed, bool has_on_source_error, BlockdevOnError on_source_error, bool has_on_target_error, BlockdevOnError on_target_error, BlockJobTxn *txn, Error **errp) { BlockBackend *blk; BlockDriverState *bs; BlockDriverState *target_bs; Error *local_err = NULL; AioContext *aio_context; if (!has_speed) { speed = 0; } if (!has_on_source_error) { on_source_error = BLOCKDEV_ON_ERROR_REPORT; } if (!has_on_target_error) { on_target_error = BLOCKDEV_ON_ERROR_REPORT; } blk = blk_by_name(device); if (!blk) { error_setg(errp, "Device '%s' not found", device); return; } aio_context = blk_get_aio_context(blk); aio_context_acquire(aio_context); if (!blk_is_available(blk)) { error_setg(errp, "Device '%s' has no medium", device); goto out; } bs = blk_bs(blk); target_bs = bdrv_lookup_bs(target, target, errp); if (!target_bs) { goto out; } if (bdrv_get_aio_context(target_bs) != aio_context) { if (!bdrv_has_blk(target_bs)) { /* The target BDS is not attached, we can safely move it to another * AioContext. */ bdrv_set_aio_context(target_bs, aio_context); } else { error_setg(errp, "Target is attached to a different thread from " "source."); goto out; } } backup_start(job_id, bs, target_bs, speed, sync, NULL, on_source_error, on_target_error, block_job_cb, bs, txn, &local_err); if (local_err != NULL) { error_propagate(errp, local_err); } out: aio_context_release(aio_context); }
false
qemu
cef34eebf3d0f252a3b3e9a2a459b6c3ecc56f68
void do_blockdev_backup(const char *job_id, const char *device, const char *target, enum MirrorSyncMode sync, bool has_speed, int64_t speed, bool has_on_source_error, BlockdevOnError on_source_error, bool has_on_target_error, BlockdevOnError on_target_error, BlockJobTxn *txn, Error **errp) { BlockBackend *blk; BlockDriverState *bs; BlockDriverState *target_bs; Error *local_err = NULL; AioContext *aio_context; if (!has_speed) { speed = 0; } if (!has_on_source_error) { on_source_error = BLOCKDEV_ON_ERROR_REPORT; } if (!has_on_target_error) { on_target_error = BLOCKDEV_ON_ERROR_REPORT; } blk = blk_by_name(device); if (!blk) { error_setg(errp, "Device '%s' not found", device); return; } aio_context = blk_get_aio_context(blk); aio_context_acquire(aio_context); if (!blk_is_available(blk)) { error_setg(errp, "Device '%s' has no medium", device); goto out; } bs = blk_bs(blk); target_bs = bdrv_lookup_bs(target, target, errp); if (!target_bs) { goto out; } if (bdrv_get_aio_context(target_bs) != aio_context) { if (!bdrv_has_blk(target_bs)) { bdrv_set_aio_context(target_bs, aio_context); } else { error_setg(errp, "Target is attached to a different thread from " "source."); goto out; } } backup_start(job_id, bs, target_bs, speed, sync, NULL, on_source_error, on_target_error, block_job_cb, bs, txn, &local_err); if (local_err != NULL) { error_propagate(errp, local_err); } out: aio_context_release(aio_context); }
{ "code": [], "line_no": [] }
void FUNC_0(const char *VAR_0, const char *VAR_1, const char *VAR_2, enum MirrorSyncMode VAR_3, bool VAR_4, int64_t VAR_5, bool VAR_6, BlockdevOnError VAR_7, bool VAR_8, BlockdevOnError VAR_9, BlockJobTxn *VAR_10, Error **VAR_11) { BlockBackend *blk; BlockDriverState *bs; BlockDriverState *target_bs; Error *local_err = NULL; AioContext *aio_context; if (!VAR_4) { VAR_5 = 0; } if (!VAR_6) { VAR_7 = BLOCKDEV_ON_ERROR_REPORT; } if (!VAR_8) { VAR_9 = BLOCKDEV_ON_ERROR_REPORT; } blk = blk_by_name(VAR_1); if (!blk) { error_setg(VAR_11, "Device '%s' not found", VAR_1); return; } aio_context = blk_get_aio_context(blk); aio_context_acquire(aio_context); if (!blk_is_available(blk)) { error_setg(VAR_11, "Device '%s' has no medium", VAR_1); goto out; } bs = blk_bs(blk); target_bs = bdrv_lookup_bs(VAR_2, VAR_2, VAR_11); if (!target_bs) { goto out; } if (bdrv_get_aio_context(target_bs) != aio_context) { if (!bdrv_has_blk(target_bs)) { bdrv_set_aio_context(target_bs, aio_context); } else { error_setg(VAR_11, "Target is attached to a different thread from " "source."); goto out; } } backup_start(VAR_0, bs, target_bs, VAR_5, VAR_3, NULL, VAR_7, VAR_9, block_job_cb, bs, VAR_10, &local_err); if (local_err != NULL) { error_propagate(VAR_11, local_err); } out: aio_context_release(aio_context); }
[ "void FUNC_0(const char *VAR_0, const char *VAR_1,\nconst char *VAR_2, enum MirrorSyncMode VAR_3,\nbool VAR_4, int64_t VAR_5,\nbool VAR_6,\nBlockdevOnError VAR_7,\nbool VAR_8,\nBlockdevOnError VAR_9,\nBlockJobTxn *VAR_10, Error **VAR_11)\n{", "BlockBackend *blk;", "BlockDriverState *bs;", "BlockDriverState *t...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [...
26,888
BlockDeviceInfo *bdrv_block_device_info(BlockBackend *blk, BlockDriverState *bs, Error **errp) { ImageInfo **p_image_info; BlockDriverState *bs0; BlockDeviceInfo *info = g_malloc0(sizeof(*info)); info->file = g_strdup(bs->filename); info->ro = bs->read_only; info->drv = g_strdup(bs->drv->format_name); info->encrypted = bs->encrypted; info->encryption_key_missing = false; info->cache = g_new(BlockdevCacheInfo, 1); *info->cache = (BlockdevCacheInfo) { .writeback = blk ? blk_enable_write_cache(blk) : true, .direct = !!(bs->open_flags & BDRV_O_NOCACHE), .no_flush = !!(bs->open_flags & BDRV_O_NO_FLUSH), }; if (bs->node_name[0]) { info->has_node_name = true; info->node_name = g_strdup(bs->node_name); } if (bs->backing_file[0]) { info->has_backing_file = true; info->backing_file = g_strdup(bs->backing_file); } info->detect_zeroes = bs->detect_zeroes; if (blk && blk_get_public(blk)->throttle_state) { ThrottleConfig cfg; throttle_group_get_config(blk, &cfg); info->bps = cfg.buckets[THROTTLE_BPS_TOTAL].avg; info->bps_rd = cfg.buckets[THROTTLE_BPS_READ].avg; info->bps_wr = cfg.buckets[THROTTLE_BPS_WRITE].avg; info->iops = cfg.buckets[THROTTLE_OPS_TOTAL].avg; info->iops_rd = cfg.buckets[THROTTLE_OPS_READ].avg; info->iops_wr = cfg.buckets[THROTTLE_OPS_WRITE].avg; info->has_bps_max = cfg.buckets[THROTTLE_BPS_TOTAL].max; info->bps_max = cfg.buckets[THROTTLE_BPS_TOTAL].max; info->has_bps_rd_max = cfg.buckets[THROTTLE_BPS_READ].max; info->bps_rd_max = cfg.buckets[THROTTLE_BPS_READ].max; info->has_bps_wr_max = cfg.buckets[THROTTLE_BPS_WRITE].max; info->bps_wr_max = cfg.buckets[THROTTLE_BPS_WRITE].max; info->has_iops_max = cfg.buckets[THROTTLE_OPS_TOTAL].max; info->iops_max = cfg.buckets[THROTTLE_OPS_TOTAL].max; info->has_iops_rd_max = cfg.buckets[THROTTLE_OPS_READ].max; info->iops_rd_max = cfg.buckets[THROTTLE_OPS_READ].max; info->has_iops_wr_max = cfg.buckets[THROTTLE_OPS_WRITE].max; info->iops_wr_max = cfg.buckets[THROTTLE_OPS_WRITE].max; info->has_bps_max_length = info->has_bps_max; info->bps_max_length = cfg.buckets[THROTTLE_BPS_TOTAL].burst_length; info->has_bps_rd_max_length = info->has_bps_rd_max; info->bps_rd_max_length = cfg.buckets[THROTTLE_BPS_READ].burst_length; info->has_bps_wr_max_length = info->has_bps_wr_max; info->bps_wr_max_length = cfg.buckets[THROTTLE_BPS_WRITE].burst_length; info->has_iops_max_length = info->has_iops_max; info->iops_max_length = cfg.buckets[THROTTLE_OPS_TOTAL].burst_length; info->has_iops_rd_max_length = info->has_iops_rd_max; info->iops_rd_max_length = cfg.buckets[THROTTLE_OPS_READ].burst_length; info->has_iops_wr_max_length = info->has_iops_wr_max; info->iops_wr_max_length = cfg.buckets[THROTTLE_OPS_WRITE].burst_length; info->has_iops_size = cfg.op_size; info->iops_size = cfg.op_size; info->has_group = true; info->group = g_strdup(throttle_group_get_name(blk)); } info->write_threshold = bdrv_write_threshold_get(bs); bs0 = bs; p_image_info = &info->image; info->backing_file_depth = 0; while (1) { Error *local_err = NULL; bdrv_query_image_info(bs0, p_image_info, &local_err); if (local_err) { error_propagate(errp, local_err); qapi_free_BlockDeviceInfo(info); return NULL; } if (bs0->drv && bs0->backing) { info->backing_file_depth++; bs0 = bs0->backing->bs; (*p_image_info)->has_backing_image = true; p_image_info = &((*p_image_info)->backing_image); } else { break; } /* Skip automatically inserted nodes that the user isn't aware of for * query-block (blk != NULL), but not for query-named-block-nodes */ while (blk && bs0 && bs0->drv && bs0->implicit) { bs0 = backing_bs(bs0); } } return info; }
false
qemu
8e8eb0a9035e5b6c6447c82138570e388282cfa2
BlockDeviceInfo *bdrv_block_device_info(BlockBackend *blk, BlockDriverState *bs, Error **errp) { ImageInfo **p_image_info; BlockDriverState *bs0; BlockDeviceInfo *info = g_malloc0(sizeof(*info)); info->file = g_strdup(bs->filename); info->ro = bs->read_only; info->drv = g_strdup(bs->drv->format_name); info->encrypted = bs->encrypted; info->encryption_key_missing = false; info->cache = g_new(BlockdevCacheInfo, 1); *info->cache = (BlockdevCacheInfo) { .writeback = blk ? blk_enable_write_cache(blk) : true, .direct = !!(bs->open_flags & BDRV_O_NOCACHE), .no_flush = !!(bs->open_flags & BDRV_O_NO_FLUSH), }; if (bs->node_name[0]) { info->has_node_name = true; info->node_name = g_strdup(bs->node_name); } if (bs->backing_file[0]) { info->has_backing_file = true; info->backing_file = g_strdup(bs->backing_file); } info->detect_zeroes = bs->detect_zeroes; if (blk && blk_get_public(blk)->throttle_state) { ThrottleConfig cfg; throttle_group_get_config(blk, &cfg); info->bps = cfg.buckets[THROTTLE_BPS_TOTAL].avg; info->bps_rd = cfg.buckets[THROTTLE_BPS_READ].avg; info->bps_wr = cfg.buckets[THROTTLE_BPS_WRITE].avg; info->iops = cfg.buckets[THROTTLE_OPS_TOTAL].avg; info->iops_rd = cfg.buckets[THROTTLE_OPS_READ].avg; info->iops_wr = cfg.buckets[THROTTLE_OPS_WRITE].avg; info->has_bps_max = cfg.buckets[THROTTLE_BPS_TOTAL].max; info->bps_max = cfg.buckets[THROTTLE_BPS_TOTAL].max; info->has_bps_rd_max = cfg.buckets[THROTTLE_BPS_READ].max; info->bps_rd_max = cfg.buckets[THROTTLE_BPS_READ].max; info->has_bps_wr_max = cfg.buckets[THROTTLE_BPS_WRITE].max; info->bps_wr_max = cfg.buckets[THROTTLE_BPS_WRITE].max; info->has_iops_max = cfg.buckets[THROTTLE_OPS_TOTAL].max; info->iops_max = cfg.buckets[THROTTLE_OPS_TOTAL].max; info->has_iops_rd_max = cfg.buckets[THROTTLE_OPS_READ].max; info->iops_rd_max = cfg.buckets[THROTTLE_OPS_READ].max; info->has_iops_wr_max = cfg.buckets[THROTTLE_OPS_WRITE].max; info->iops_wr_max = cfg.buckets[THROTTLE_OPS_WRITE].max; info->has_bps_max_length = info->has_bps_max; info->bps_max_length = cfg.buckets[THROTTLE_BPS_TOTAL].burst_length; info->has_bps_rd_max_length = info->has_bps_rd_max; info->bps_rd_max_length = cfg.buckets[THROTTLE_BPS_READ].burst_length; info->has_bps_wr_max_length = info->has_bps_wr_max; info->bps_wr_max_length = cfg.buckets[THROTTLE_BPS_WRITE].burst_length; info->has_iops_max_length = info->has_iops_max; info->iops_max_length = cfg.buckets[THROTTLE_OPS_TOTAL].burst_length; info->has_iops_rd_max_length = info->has_iops_rd_max; info->iops_rd_max_length = cfg.buckets[THROTTLE_OPS_READ].burst_length; info->has_iops_wr_max_length = info->has_iops_wr_max; info->iops_wr_max_length = cfg.buckets[THROTTLE_OPS_WRITE].burst_length; info->has_iops_size = cfg.op_size; info->iops_size = cfg.op_size; info->has_group = true; info->group = g_strdup(throttle_group_get_name(blk)); } info->write_threshold = bdrv_write_threshold_get(bs); bs0 = bs; p_image_info = &info->image; info->backing_file_depth = 0; while (1) { Error *local_err = NULL; bdrv_query_image_info(bs0, p_image_info, &local_err); if (local_err) { error_propagate(errp, local_err); qapi_free_BlockDeviceInfo(info); return NULL; } if (bs0->drv && bs0->backing) { info->backing_file_depth++; bs0 = bs0->backing->bs; (*p_image_info)->has_backing_image = true; p_image_info = &((*p_image_info)->backing_image); } else { break; } while (blk && bs0 && bs0->drv && bs0->implicit) { bs0 = backing_bs(bs0); } } return info; }
{ "code": [], "line_no": [] }
BlockDeviceInfo *FUNC_0(BlockBackend *blk, BlockDriverState *bs, Error **errp) { ImageInfo **p_image_info; BlockDriverState *bs0; BlockDeviceInfo *info = g_malloc0(sizeof(*info)); info->file = g_strdup(bs->filename); info->ro = bs->read_only; info->drv = g_strdup(bs->drv->format_name); info->encrypted = bs->encrypted; info->encryption_key_missing = false; info->cache = g_new(BlockdevCacheInfo, 1); *info->cache = (BlockdevCacheInfo) { .writeback = blk ? blk_enable_write_cache(blk) : true, .direct = !!(bs->open_flags & BDRV_O_NOCACHE), .no_flush = !!(bs->open_flags & BDRV_O_NO_FLUSH), }; if (bs->node_name[0]) { info->has_node_name = true; info->node_name = g_strdup(bs->node_name); } if (bs->backing_file[0]) { info->has_backing_file = true; info->backing_file = g_strdup(bs->backing_file); } info->detect_zeroes = bs->detect_zeroes; if (blk && blk_get_public(blk)->throttle_state) { ThrottleConfig cfg; throttle_group_get_config(blk, &cfg); info->bps = cfg.buckets[THROTTLE_BPS_TOTAL].avg; info->bps_rd = cfg.buckets[THROTTLE_BPS_READ].avg; info->bps_wr = cfg.buckets[THROTTLE_BPS_WRITE].avg; info->iops = cfg.buckets[THROTTLE_OPS_TOTAL].avg; info->iops_rd = cfg.buckets[THROTTLE_OPS_READ].avg; info->iops_wr = cfg.buckets[THROTTLE_OPS_WRITE].avg; info->has_bps_max = cfg.buckets[THROTTLE_BPS_TOTAL].max; info->bps_max = cfg.buckets[THROTTLE_BPS_TOTAL].max; info->has_bps_rd_max = cfg.buckets[THROTTLE_BPS_READ].max; info->bps_rd_max = cfg.buckets[THROTTLE_BPS_READ].max; info->has_bps_wr_max = cfg.buckets[THROTTLE_BPS_WRITE].max; info->bps_wr_max = cfg.buckets[THROTTLE_BPS_WRITE].max; info->has_iops_max = cfg.buckets[THROTTLE_OPS_TOTAL].max; info->iops_max = cfg.buckets[THROTTLE_OPS_TOTAL].max; info->has_iops_rd_max = cfg.buckets[THROTTLE_OPS_READ].max; info->iops_rd_max = cfg.buckets[THROTTLE_OPS_READ].max; info->has_iops_wr_max = cfg.buckets[THROTTLE_OPS_WRITE].max; info->iops_wr_max = cfg.buckets[THROTTLE_OPS_WRITE].max; info->has_bps_max_length = info->has_bps_max; info->bps_max_length = cfg.buckets[THROTTLE_BPS_TOTAL].burst_length; info->has_bps_rd_max_length = info->has_bps_rd_max; info->bps_rd_max_length = cfg.buckets[THROTTLE_BPS_READ].burst_length; info->has_bps_wr_max_length = info->has_bps_wr_max; info->bps_wr_max_length = cfg.buckets[THROTTLE_BPS_WRITE].burst_length; info->has_iops_max_length = info->has_iops_max; info->iops_max_length = cfg.buckets[THROTTLE_OPS_TOTAL].burst_length; info->has_iops_rd_max_length = info->has_iops_rd_max; info->iops_rd_max_length = cfg.buckets[THROTTLE_OPS_READ].burst_length; info->has_iops_wr_max_length = info->has_iops_wr_max; info->iops_wr_max_length = cfg.buckets[THROTTLE_OPS_WRITE].burst_length; info->has_iops_size = cfg.op_size; info->iops_size = cfg.op_size; info->has_group = true; info->group = g_strdup(throttle_group_get_name(blk)); } info->write_threshold = bdrv_write_threshold_get(bs); bs0 = bs; p_image_info = &info->image; info->backing_file_depth = 0; while (1) { Error *local_err = NULL; bdrv_query_image_info(bs0, p_image_info, &local_err); if (local_err) { error_propagate(errp, local_err); qapi_free_BlockDeviceInfo(info); return NULL; } if (bs0->drv && bs0->backing) { info->backing_file_depth++; bs0 = bs0->backing->bs; (*p_image_info)->has_backing_image = true; p_image_info = &((*p_image_info)->backing_image); } else { break; } while (blk && bs0 && bs0->drv && bs0->implicit) { bs0 = backing_bs(bs0); } } return info; }
[ "BlockDeviceInfo *FUNC_0(BlockBackend *blk,\nBlockDriverState *bs, Error **errp)\n{", "ImageInfo **p_image_info;", "BlockDriverState *bs0;", "BlockDeviceInfo *info = g_malloc0(sizeof(*info));", "info->file = g_strdup(bs->filename);", "info->ro = bs->read_only;", "in...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31, 33, 35, 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ...
26,889
void qemu_clock_unregister_reset_notifier(QEMUClockType type, Notifier *notifier) { notifier_remove(notifier); }
false
qemu
c2b38b277a7882a592f4f2ec955084b2b756daaa
void qemu_clock_unregister_reset_notifier(QEMUClockType type, Notifier *notifier) { notifier_remove(notifier); }
{ "code": [], "line_no": [] }
void FUNC_0(QEMUClockType VAR_0, Notifier *VAR_1) { notifier_remove(VAR_1); }
[ "void FUNC_0(QEMUClockType VAR_0,\nNotifier *VAR_1)\n{", "notifier_remove(VAR_1);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
26,890
static void ppc_core99_init (int ram_size, int vga_ram_size, const char *boot_device, DisplayState *ds, const char **fd_filename, int snapshot, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { CPUState *env = NULL, *envs[MAX_CPUS]; char buf[1024]; qemu_irq *pic, **openpic_irqs; int unin_memory; int linux_boot, i; unsigned long bios_offset, vga_bios_offset; uint32_t kernel_base, kernel_size, initrd_base, initrd_size; PCIBus *pci_bus; nvram_t nvram; #if 0 MacIONVRAMState *nvr; int nvram_mem_index; #endif m48t59_t *m48t59; int vga_bios_size, bios_size; qemu_irq *dummy_irq; int pic_mem_index, dbdma_mem_index, cuda_mem_index; int ide_mem_index[2]; int ppc_boot_device = boot_device[0]; linux_boot = (kernel_filename != NULL); /* init CPUs */ if (cpu_model == NULL) cpu_model = "default"; for (i = 0; i < smp_cpus; i++) { env = cpu_init(cpu_model); if (!env) { fprintf(stderr, "Unable to find PowerPC CPU definition\n"); exit(1); } /* Set time-base frequency to 100 Mhz */ cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL); #if 0 env->osi_call = vga_osi_call; #endif qemu_register_reset(&cpu_ppc_reset, env); register_savevm("cpu", 0, 3, cpu_save, cpu_load, env); envs[i] = env; } if (env->nip < 0xFFF80000) { /* Special test for PowerPC 601: * the boot vector is at 0xFFF00100, then we need a 1MB BIOS. * But the NVRAM is located at 0xFFF04000... */ cpu_abort(env, "Mac99 hardware can not handle 1 MB BIOS\n"); } /* allocate RAM */ cpu_register_physical_memory(0, ram_size, IO_MEM_RAM); /* allocate and load BIOS */ bios_offset = ram_size + vga_ram_size; if (bios_name == NULL) bios_name = BIOS_FILENAME; snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name); bios_size = load_image(buf, phys_ram_base + bios_offset); if (bios_size < 0 || bios_size > BIOS_SIZE) { cpu_abort(env, "qemu: could not load PowerPC bios '%s'\n", buf); exit(1); } bios_size = (bios_size + 0xfff) & ~0xfff; if (bios_size > 0x00080000) { /* As the NVRAM is located at 0xFFF04000, we cannot use 1 MB BIOSes */ cpu_abort(env, "Mac99 hardware can not handle 1 MB BIOS\n"); } cpu_register_physical_memory((uint32_t)(-bios_size), bios_size, bios_offset | IO_MEM_ROM); /* allocate and load VGA BIOS */ vga_bios_offset = bios_offset + bios_size; snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_FILENAME); vga_bios_size = load_image(buf, phys_ram_base + vga_bios_offset + 8); if (vga_bios_size < 0) { /* if no bios is present, we can still work */ fprintf(stderr, "qemu: warning: could not load VGA bios '%s'\n", buf); vga_bios_size = 0; } else { /* set a specific header (XXX: find real Apple format for NDRV drivers) */ phys_ram_base[vga_bios_offset] = 'N'; phys_ram_base[vga_bios_offset + 1] = 'D'; phys_ram_base[vga_bios_offset + 2] = 'R'; phys_ram_base[vga_bios_offset + 3] = 'V'; cpu_to_be32w((uint32_t *)(phys_ram_base + vga_bios_offset + 4), vga_bios_size); vga_bios_size += 8; } vga_bios_size = (vga_bios_size + 0xfff) & ~0xfff; if (linux_boot) { kernel_base = KERNEL_LOAD_ADDR; /* now we can load the kernel */ kernel_size = load_image(kernel_filename, phys_ram_base + kernel_base); if (kernel_size < 0) { cpu_abort(env, "qemu: could not load kernel '%s'\n", kernel_filename); exit(1); } /* load initrd */ if (initrd_filename) { initrd_base = INITRD_LOAD_ADDR; initrd_size = load_image(initrd_filename, phys_ram_base + initrd_base); if (initrd_size < 0) { cpu_abort(env, "qemu: could not load initial ram disk '%s'\n", initrd_filename); exit(1); } } else { initrd_base = 0; initrd_size = 0; } ppc_boot_device = 'm'; } else { kernel_base = 0; kernel_size = 0; initrd_base = 0; initrd_size = 0; } isa_mem_base = 0x80000000; /* Register 8 MB of ISA IO space */ isa_mmio_init(0xf2000000, 0x00800000); /* UniN init */ unin_memory = cpu_register_io_memory(0, unin_read, unin_write, NULL); cpu_register_physical_memory(0xf8000000, 0x00001000, unin_memory); openpic_irqs = qemu_mallocz(smp_cpus * sizeof(qemu_irq *)); openpic_irqs[0] = qemu_mallocz(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: cpu_abort(env, "Bus model not supported on mac99 machine\n"); exit(1); } } pic = openpic_init(NULL, &pic_mem_index, smp_cpus, openpic_irqs, NULL); pci_bus = pci_pmac_init(pic); /* init basic PC hardware */ pci_vga_init(pci_bus, ds, phys_ram_base + ram_size, ram_size, vga_ram_size, vga_bios_offset, vga_bios_size); /* XXX: suppress that */ dummy_irq = i8259_init(NULL); /* XXX: use Mac Serial port */ serial_init(0x3f8, dummy_irq[4], serial_hds[0]); for(i = 0; i < nb_nics; i++) { if (!nd_table[i].model) nd_table[i].model = "ne2k_pci"; pci_nic_init(pci_bus, &nd_table[i], -1); } #if 1 ide_mem_index[0] = pmac_ide_init(&bs_table[0], pic[0x13]); ide_mem_index[1] = pmac_ide_init(&bs_table[2], pic[0x14]); #else pci_cmd646_ide_init(pci_bus, &bs_table[0], 0); #endif /* cuda also initialize ADB */ cuda_init(&cuda_mem_index, pic[0x19]); adb_kbd_init(&adb_bus); adb_mouse_init(&adb_bus); dbdma_init(&dbdma_mem_index); macio_init(pci_bus, 0x0022, 0, pic_mem_index, dbdma_mem_index, cuda_mem_index, NULL, 2, ide_mem_index); if (usb_enabled) { usb_ohci_init_pci(pci_bus, 3, -1); } if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8) graphic_depth = 15; #if 0 /* XXX: this is ugly but needed for now, or OHW won't boot */ /* The NewWorld NVRAM is not located in the MacIO device */ nvr = macio_nvram_init(&nvram_mem_index, 0x2000); pmac_format_nvram_partition(nvr, 0x2000); macio_nvram_map(nvr, 0xFFF04000); nvram.opaque = nvr; nvram.read_fn = &macio_nvram_read; nvram.write_fn = &macio_nvram_write; #else m48t59 = m48t59_init(dummy_irq[8], 0xFFF04000, 0x0074, NVRAM_SIZE, 59); nvram.opaque = m48t59; nvram.read_fn = &m48t59_read; nvram.write_fn = &m48t59_write; #endif PPC_NVRAM_set_params(&nvram, NVRAM_SIZE, "MAC99", ram_size, ppc_boot_device, kernel_base, kernel_size, kernel_cmdline, initrd_base, initrd_size, /* XXX: need an option to load a NVRAM image */ 0, graphic_width, graphic_height, graphic_depth); /* No PCI init: the BIOS will do it */ /* Special port to get debug messages from Open-Firmware */ register_ioport_write(0x0F00, 4, 1, &PPC_debug_write, NULL); }
false
qemu
28c5af54c661e73e5596918fa67a22b5e87c2022
static void ppc_core99_init (int ram_size, int vga_ram_size, const char *boot_device, DisplayState *ds, const char **fd_filename, int snapshot, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { CPUState *env = NULL, *envs[MAX_CPUS]; char buf[1024]; qemu_irq *pic, **openpic_irqs; int unin_memory; int linux_boot, i; unsigned long bios_offset, vga_bios_offset; uint32_t kernel_base, kernel_size, initrd_base, initrd_size; PCIBus *pci_bus; nvram_t nvram; #if 0 MacIONVRAMState *nvr; int nvram_mem_index; #endif m48t59_t *m48t59; int vga_bios_size, bios_size; qemu_irq *dummy_irq; int pic_mem_index, dbdma_mem_index, cuda_mem_index; int ide_mem_index[2]; int ppc_boot_device = boot_device[0]; linux_boot = (kernel_filename != NULL); if (cpu_model == NULL) cpu_model = "default"; for (i = 0; i < smp_cpus; i++) { env = cpu_init(cpu_model); if (!env) { fprintf(stderr, "Unable to find PowerPC CPU definition\n"); exit(1); } cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL); #if 0 env->osi_call = vga_osi_call; #endif qemu_register_reset(&cpu_ppc_reset, env); register_savevm("cpu", 0, 3, cpu_save, cpu_load, env); envs[i] = env; } if (env->nip < 0xFFF80000) { cpu_abort(env, "Mac99 hardware can not handle 1 MB BIOS\n"); } cpu_register_physical_memory(0, ram_size, IO_MEM_RAM); bios_offset = ram_size + vga_ram_size; if (bios_name == NULL) bios_name = BIOS_FILENAME; snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name); bios_size = load_image(buf, phys_ram_base + bios_offset); if (bios_size < 0 || bios_size > BIOS_SIZE) { cpu_abort(env, "qemu: could not load PowerPC bios '%s'\n", buf); exit(1); } bios_size = (bios_size + 0xfff) & ~0xfff; if (bios_size > 0x00080000) { cpu_abort(env, "Mac99 hardware can not handle 1 MB BIOS\n"); } cpu_register_physical_memory((uint32_t)(-bios_size), bios_size, bios_offset | IO_MEM_ROM); vga_bios_offset = bios_offset + bios_size; snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_FILENAME); vga_bios_size = load_image(buf, phys_ram_base + vga_bios_offset + 8); if (vga_bios_size < 0) { fprintf(stderr, "qemu: warning: could not load VGA bios '%s'\n", buf); vga_bios_size = 0; } else { phys_ram_base[vga_bios_offset] = 'N'; phys_ram_base[vga_bios_offset + 1] = 'D'; phys_ram_base[vga_bios_offset + 2] = 'R'; phys_ram_base[vga_bios_offset + 3] = 'V'; cpu_to_be32w((uint32_t *)(phys_ram_base + vga_bios_offset + 4), vga_bios_size); vga_bios_size += 8; } vga_bios_size = (vga_bios_size + 0xfff) & ~0xfff; if (linux_boot) { kernel_base = KERNEL_LOAD_ADDR; kernel_size = load_image(kernel_filename, phys_ram_base + kernel_base); if (kernel_size < 0) { cpu_abort(env, "qemu: could not load kernel '%s'\n", kernel_filename); exit(1); } if (initrd_filename) { initrd_base = INITRD_LOAD_ADDR; initrd_size = load_image(initrd_filename, phys_ram_base + initrd_base); if (initrd_size < 0) { cpu_abort(env, "qemu: could not load initial ram disk '%s'\n", initrd_filename); exit(1); } } else { initrd_base = 0; initrd_size = 0; } ppc_boot_device = 'm'; } else { kernel_base = 0; kernel_size = 0; initrd_base = 0; initrd_size = 0; } isa_mem_base = 0x80000000; isa_mmio_init(0xf2000000, 0x00800000); unin_memory = cpu_register_io_memory(0, unin_read, unin_write, NULL); cpu_register_physical_memory(0xf8000000, 0x00001000, unin_memory); openpic_irqs = qemu_mallocz(smp_cpus * sizeof(qemu_irq *)); openpic_irqs[0] = qemu_mallocz(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: cpu_abort(env, "Bus model not supported on mac99 machine\n"); exit(1); } } pic = openpic_init(NULL, &pic_mem_index, smp_cpus, openpic_irqs, NULL); pci_bus = pci_pmac_init(pic); pci_vga_init(pci_bus, ds, phys_ram_base + ram_size, ram_size, vga_ram_size, vga_bios_offset, vga_bios_size); dummy_irq = i8259_init(NULL); serial_init(0x3f8, dummy_irq[4], serial_hds[0]); for(i = 0; i < nb_nics; i++) { if (!nd_table[i].model) nd_table[i].model = "ne2k_pci"; pci_nic_init(pci_bus, &nd_table[i], -1); } #if 1 ide_mem_index[0] = pmac_ide_init(&bs_table[0], pic[0x13]); ide_mem_index[1] = pmac_ide_init(&bs_table[2], pic[0x14]); #else pci_cmd646_ide_init(pci_bus, &bs_table[0], 0); #endif cuda_init(&cuda_mem_index, pic[0x19]); adb_kbd_init(&adb_bus); adb_mouse_init(&adb_bus); dbdma_init(&dbdma_mem_index); macio_init(pci_bus, 0x0022, 0, pic_mem_index, dbdma_mem_index, cuda_mem_index, NULL, 2, ide_mem_index); if (usb_enabled) { usb_ohci_init_pci(pci_bus, 3, -1); } if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8) graphic_depth = 15; #if 0 nvr = macio_nvram_init(&nvram_mem_index, 0x2000); pmac_format_nvram_partition(nvr, 0x2000); macio_nvram_map(nvr, 0xFFF04000); nvram.opaque = nvr; nvram.read_fn = &macio_nvram_read; nvram.write_fn = &macio_nvram_write; #else m48t59 = m48t59_init(dummy_irq[8], 0xFFF04000, 0x0074, NVRAM_SIZE, 59); nvram.opaque = m48t59; nvram.read_fn = &m48t59_read; nvram.write_fn = &m48t59_write; #endif PPC_NVRAM_set_params(&nvram, NVRAM_SIZE, "MAC99", ram_size, ppc_boot_device, kernel_base, kernel_size, kernel_cmdline, initrd_base, initrd_size, 0, graphic_width, graphic_height, graphic_depth); register_ioport_write(0x0F00, 4, 1, &PPC_debug_write, NULL); }
{ "code": [], "line_no": [] }
static void FUNC_0 (int VAR_0, int VAR_1, const char *VAR_2, DisplayState *VAR_3, const char **VAR_4, int VAR_5, const char *VAR_6, const char *VAR_7, const char *VAR_8, const char *VAR_9) { CPUState *env = NULL, *envs[MAX_CPUS]; char VAR_10[1024]; qemu_irq *pic, **openpic_irqs; int VAR_11; int VAR_12, VAR_13; unsigned long VAR_14, VAR_15; uint32_t kernel_base, kernel_size, initrd_base, initrd_size; PCIBus *pci_bus; nvram_t nvram; #if 0 MacIONVRAMState *nvr; int nvram_mem_index; #endif m48t59_t *m48t59; int VAR_16, VAR_17; qemu_irq *dummy_irq; int VAR_18, VAR_19, VAR_20; int VAR_21[2]; int VAR_22 = VAR_2[0]; VAR_12 = (VAR_6 != NULL); if (VAR_9 == NULL) VAR_9 = "default"; for (VAR_13 = 0; VAR_13 < smp_cpus; VAR_13++) { env = cpu_init(VAR_9); if (!env) { fprintf(stderr, "Unable to find PowerPC CPU definition\n"); exit(1); } cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL); #if 0 env->osi_call = vga_osi_call; #endif qemu_register_reset(&cpu_ppc_reset, env); register_savevm("cpu", 0, 3, cpu_save, cpu_load, env); envs[VAR_13] = env; } if (env->nip < 0xFFF80000) { cpu_abort(env, "Mac99 hardware can not handle 1 MB BIOS\n"); } cpu_register_physical_memory(0, VAR_0, IO_MEM_RAM); VAR_14 = VAR_0 + VAR_1; if (bios_name == NULL) bios_name = BIOS_FILENAME; snprintf(VAR_10, sizeof(VAR_10), "%s/%s", bios_dir, bios_name); VAR_17 = load_image(VAR_10, phys_ram_base + VAR_14); if (VAR_17 < 0 || VAR_17 > BIOS_SIZE) { cpu_abort(env, "qemu: could not load PowerPC bios '%s'\n", VAR_10); exit(1); } VAR_17 = (VAR_17 + 0xfff) & ~0xfff; if (VAR_17 > 0x00080000) { cpu_abort(env, "Mac99 hardware can not handle 1 MB BIOS\n"); } cpu_register_physical_memory((uint32_t)(-VAR_17), VAR_17, VAR_14 | IO_MEM_ROM); VAR_15 = VAR_14 + VAR_17; snprintf(VAR_10, sizeof(VAR_10), "%s/%s", bios_dir, VGABIOS_FILENAME); VAR_16 = load_image(VAR_10, phys_ram_base + VAR_15 + 8); if (VAR_16 < 0) { fprintf(stderr, "qemu: warning: could not load VGA bios '%s'\n", VAR_10); VAR_16 = 0; } else { phys_ram_base[VAR_15] = 'N'; phys_ram_base[VAR_15 + 1] = 'D'; phys_ram_base[VAR_15 + 2] = 'R'; phys_ram_base[VAR_15 + 3] = 'V'; cpu_to_be32w((uint32_t *)(phys_ram_base + VAR_15 + 4), VAR_16); VAR_16 += 8; } VAR_16 = (VAR_16 + 0xfff) & ~0xfff; if (VAR_12) { kernel_base = KERNEL_LOAD_ADDR; kernel_size = load_image(VAR_6, phys_ram_base + kernel_base); if (kernel_size < 0) { cpu_abort(env, "qemu: could not load kernel '%s'\n", VAR_6); exit(1); } if (VAR_8) { initrd_base = INITRD_LOAD_ADDR; initrd_size = load_image(VAR_8, phys_ram_base + initrd_base); if (initrd_size < 0) { cpu_abort(env, "qemu: could not load initial ram disk '%s'\n", VAR_8); exit(1); } } else { initrd_base = 0; initrd_size = 0; } VAR_22 = 'm'; } else { kernel_base = 0; kernel_size = 0; initrd_base = 0; initrd_size = 0; } isa_mem_base = 0x80000000; isa_mmio_init(0xf2000000, 0x00800000); VAR_11 = cpu_register_io_memory(0, unin_read, unin_write, NULL); cpu_register_physical_memory(0xf8000000, 0x00001000, VAR_11); openpic_irqs = qemu_mallocz(smp_cpus * sizeof(qemu_irq *)); openpic_irqs[0] = qemu_mallocz(smp_cpus * sizeof(qemu_irq) * OPENPIC_OUTPUT_NB); for (VAR_13 = 0; VAR_13 < smp_cpus; VAR_13++) { switch (PPC_INPUT(env)) { case PPC_FLAGS_INPUT_6xx: openpic_irqs[VAR_13] = openpic_irqs[0] + (VAR_13 * OPENPIC_OUTPUT_NB); openpic_irqs[VAR_13][OPENPIC_OUTPUT_INT] = ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_INT]; openpic_irqs[VAR_13][OPENPIC_OUTPUT_CINT] = ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_INT]; openpic_irqs[VAR_13][OPENPIC_OUTPUT_MCK] = ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_MCP]; openpic_irqs[VAR_13][OPENPIC_OUTPUT_DEBUG] = NULL; openpic_irqs[VAR_13][OPENPIC_OUTPUT_RESET] = ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_HRESET]; break; #if defined(TARGET_PPC64) case PPC_FLAGS_INPUT_970: openpic_irqs[VAR_13] = openpic_irqs[0] + (VAR_13 * OPENPIC_OUTPUT_NB); openpic_irqs[VAR_13][OPENPIC_OUTPUT_INT] = ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_INT]; openpic_irqs[VAR_13][OPENPIC_OUTPUT_CINT] = ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_INT]; openpic_irqs[VAR_13][OPENPIC_OUTPUT_MCK] = ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_MCP]; openpic_irqs[VAR_13][OPENPIC_OUTPUT_DEBUG] = NULL; openpic_irqs[VAR_13][OPENPIC_OUTPUT_RESET] = ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_HRESET]; break; #endif default: cpu_abort(env, "Bus model not supported on mac99 machine\n"); exit(1); } } pic = openpic_init(NULL, &VAR_18, smp_cpus, openpic_irqs, NULL); pci_bus = pci_pmac_init(pic); pci_vga_init(pci_bus, VAR_3, phys_ram_base + VAR_0, VAR_0, VAR_1, VAR_15, VAR_16); dummy_irq = i8259_init(NULL); serial_init(0x3f8, dummy_irq[4], serial_hds[0]); for(VAR_13 = 0; VAR_13 < nb_nics; VAR_13++) { if (!nd_table[VAR_13].model) nd_table[VAR_13].model = "ne2k_pci"; pci_nic_init(pci_bus, &nd_table[VAR_13], -1); } #if 1 VAR_21[0] = pmac_ide_init(&bs_table[0], pic[0x13]); VAR_21[1] = pmac_ide_init(&bs_table[2], pic[0x14]); #else pci_cmd646_ide_init(pci_bus, &bs_table[0], 0); #endif cuda_init(&VAR_20, pic[0x19]); adb_kbd_init(&adb_bus); adb_mouse_init(&adb_bus); dbdma_init(&VAR_19); macio_init(pci_bus, 0x0022, 0, VAR_18, VAR_19, VAR_20, NULL, 2, VAR_21); if (usb_enabled) { usb_ohci_init_pci(pci_bus, 3, -1); } if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8) graphic_depth = 15; #if 0 nvr = macio_nvram_init(&nvram_mem_index, 0x2000); pmac_format_nvram_partition(nvr, 0x2000); macio_nvram_map(nvr, 0xFFF04000); nvram.opaque = nvr; nvram.read_fn = &macio_nvram_read; nvram.write_fn = &macio_nvram_write; #else m48t59 = m48t59_init(dummy_irq[8], 0xFFF04000, 0x0074, NVRAM_SIZE, 59); nvram.opaque = m48t59; nvram.read_fn = &m48t59_read; nvram.write_fn = &m48t59_write; #endif PPC_NVRAM_set_params(&nvram, NVRAM_SIZE, "MAC99", VAR_0, VAR_22, kernel_base, kernel_size, VAR_7, initrd_base, initrd_size, 0, graphic_width, graphic_height, graphic_depth); register_ioport_write(0x0F00, 4, 1, &PPC_debug_write, NULL); }
[ "static void FUNC_0 (int VAR_0, int VAR_1,\nconst char *VAR_2, DisplayState *VAR_3,\nconst char **VAR_4, int VAR_5,\nconst char *VAR_6,\nconst char *VAR_7,\nconst char *VAR_8,\nconst char *VAR_9)\n{", "CPUState *env = NULL, *envs[MAX_CPUS];", "char VAR_10[1024];", "qemu_irq *pic, **openpic_irqs;", "int 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, 0, 0, 0, 0, 0, 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 ...
26,891
POWERPC_FAMILY(POWER5P)(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); dc->fw_name = "PowerPC,POWER5"; dc->desc = "POWER5+"; pcc->init_proc = init_proc_power5plus; pcc->check_pow = check_pow_970FX; pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB | PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX | PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ | PPC_MEM_SYNC | PPC_MEM_EIEIO | PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_64B | PPC_SEGMENT_64B | PPC_SLBI; pcc->msr_mask = (1ull << MSR_SF) | (1ull << MSR_VR) | (1ull << MSR_POW) | (1ull << MSR_EE) | (1ull << MSR_PR) | (1ull << MSR_FP) | (1ull << MSR_ME) | (1ull << MSR_FE0) | (1ull << MSR_SE) | (1ull << MSR_DE) | (1ull << MSR_FE1) | (1ull << MSR_IR) | (1ull << MSR_DR) | (1ull << MSR_PMM) | (1ull << MSR_RI); pcc->mmu_model = POWERPC_MMU_64B; #if defined(CONFIG_SOFTMMU) pcc->handle_mmu_fault = ppc_hash64_handle_mmu_fault; #endif pcc->excp_model = POWERPC_EXCP_970; pcc->bus_model = PPC_FLAGS_INPUT_970; pcc->bfd_mach = bfd_mach_ppc64; pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE | POWERPC_FLAG_BE | POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK; pcc->l1_dcache_size = 0x8000; pcc->l1_icache_size = 0x10000; }
false
qemu
90618f4f4d1e7b5b9fe40834646adac1e21d1b07
POWERPC_FAMILY(POWER5P)(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); dc->fw_name = "PowerPC,POWER5"; dc->desc = "POWER5+"; pcc->init_proc = init_proc_power5plus; pcc->check_pow = check_pow_970FX; pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB | PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX | PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ | PPC_MEM_SYNC | PPC_MEM_EIEIO | PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_64B | PPC_SEGMENT_64B | PPC_SLBI; pcc->msr_mask = (1ull << MSR_SF) | (1ull << MSR_VR) | (1ull << MSR_POW) | (1ull << MSR_EE) | (1ull << MSR_PR) | (1ull << MSR_FP) | (1ull << MSR_ME) | (1ull << MSR_FE0) | (1ull << MSR_SE) | (1ull << MSR_DE) | (1ull << MSR_FE1) | (1ull << MSR_IR) | (1ull << MSR_DR) | (1ull << MSR_PMM) | (1ull << MSR_RI); pcc->mmu_model = POWERPC_MMU_64B; #if defined(CONFIG_SOFTMMU) pcc->handle_mmu_fault = ppc_hash64_handle_mmu_fault; #endif pcc->excp_model = POWERPC_EXCP_970; pcc->bus_model = PPC_FLAGS_INPUT_970; pcc->bfd_mach = bfd_mach_ppc64; pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE | POWERPC_FLAG_BE | POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK; pcc->l1_dcache_size = 0x8000; pcc->l1_icache_size = 0x10000; }
{ "code": [], "line_no": [] }
FUNC_0(POWER5P)(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); dc->fw_name = "PowerPC,POWER5"; dc->desc = "POWER5+"; pcc->init_proc = init_proc_power5plus; pcc->check_pow = check_pow_970FX; pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB | PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE | PPC_FLOAT_STFIWX | PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ | PPC_MEM_SYNC | PPC_MEM_EIEIO | PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_64B | PPC_SEGMENT_64B | PPC_SLBI; pcc->msr_mask = (1ull << MSR_SF) | (1ull << MSR_VR) | (1ull << MSR_POW) | (1ull << MSR_EE) | (1ull << MSR_PR) | (1ull << MSR_FP) | (1ull << MSR_ME) | (1ull << MSR_FE0) | (1ull << MSR_SE) | (1ull << MSR_DE) | (1ull << MSR_FE1) | (1ull << MSR_IR) | (1ull << MSR_DR) | (1ull << MSR_PMM) | (1ull << MSR_RI); pcc->mmu_model = POWERPC_MMU_64B; #if defined(CONFIG_SOFTMMU) pcc->handle_mmu_fault = ppc_hash64_handle_mmu_fault; #endif pcc->excp_model = POWERPC_EXCP_970; pcc->bus_model = PPC_FLAGS_INPUT_970; pcc->bfd_mach = bfd_mach_ppc64; pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE | POWERPC_FLAG_BE | POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK; pcc->l1_dcache_size = 0x8000; pcc->l1_icache_size = 0x10000; }
[ "FUNC_0(POWER5P)(ObjectClass *oc, void *data)\n{", "DeviceClass *dc = DEVICE_CLASS(oc);", "PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);", "dc->fw_name = \"PowerPC,POWER5\";", "dc->desc = \"POWER5+\";", "pcc->init_proc = init_proc_power5plus;", "pcc->check_pow = check_pow_970FX;", "pcc->insns_flags = ...
[ 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, 29, 31, 33, 35 ], [ 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65...
26,894
static unsigned int dec_addi_acr(DisasContext *dc) { TCGv t0; DIS(fprintf (logfile, "addi.%c $r%u, $r%u, $acr\n", memsize_char(memsize_zz(dc)), dc->op2, dc->op1)); cris_cc_mask(dc, 0); t0 = tcg_temp_new(TCG_TYPE_TL); tcg_gen_shl_tl(t0, cpu_R[dc->op2], tcg_const_tl(dc->zzsize)); tcg_gen_add_tl(cpu_R[R_ACR], cpu_R[dc->op1], t0); tcg_temp_free(t0); return 2; }
false
qemu
a7812ae412311d7d47f8aa85656faadac9d64b56
static unsigned int dec_addi_acr(DisasContext *dc) { TCGv t0; DIS(fprintf (logfile, "addi.%c $r%u, $r%u, $acr\n", memsize_char(memsize_zz(dc)), dc->op2, dc->op1)); cris_cc_mask(dc, 0); t0 = tcg_temp_new(TCG_TYPE_TL); tcg_gen_shl_tl(t0, cpu_R[dc->op2], tcg_const_tl(dc->zzsize)); tcg_gen_add_tl(cpu_R[R_ACR], cpu_R[dc->op1], t0); tcg_temp_free(t0); return 2; }
{ "code": [], "line_no": [] }
static unsigned int FUNC_0(DisasContext *VAR_0) { TCGv t0; DIS(fprintf (logfile, "addi.%c $r%u, $r%u, $acr\n", memsize_char(memsize_zz(VAR_0)), VAR_0->op2, VAR_0->op1)); cris_cc_mask(VAR_0, 0); t0 = tcg_temp_new(TCG_TYPE_TL); tcg_gen_shl_tl(t0, cpu_R[VAR_0->op2], tcg_const_tl(VAR_0->zzsize)); tcg_gen_add_tl(cpu_R[R_ACR], cpu_R[VAR_0->op1], t0); tcg_temp_free(t0); return 2; }
[ "static unsigned int FUNC_0(DisasContext *VAR_0)\n{", "TCGv t0;", "DIS(fprintf (logfile, \"addi.%c $r%u, $r%u, $acr\\n\",\nmemsize_char(memsize_zz(VAR_0)), VAR_0->op2, VAR_0->op1));", "cris_cc_mask(VAR_0, 0);", "t0 = tcg_temp_new(TCG_TYPE_TL);", "tcg_gen_shl_tl(t0, cpu_R[VAR_0->op2], tcg_const_tl(VAR_0->z...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
26,895
static void test_visitor_out_list_qapi_free(TestOutputVisitorData *data, const void *unused) { UserDefTwoList *p, *head = NULL; const char string[] = "foo bar"; int i, max_count = 1024; for (i = 0; i < max_count; i++) { p = g_malloc0(sizeof(*p)); p->value = g_malloc0(sizeof(*p->value)); p->value->string0 = g_strdup(string); p->value->dict1 = g_new0(UserDefTwoDict, 1); p->value->dict1->string1 = g_strdup(string); p->value->dict1->dict2 = g_new0(UserDefTwoDictDict, 1); p->value->dict1->dict2->userdef = g_new0(UserDefOne, 1); p->value->dict1->dict2->userdef->string = g_strdup(string); p->value->dict1->dict2->userdef->integer = 42; p->value->dict1->dict2->string = g_strdup(string); p->value->dict1->has_dict3 = false; p->next = head; head = p; } qapi_free_UserDefTwoList(head); }
false
qemu
b3db211f3c80bb996a704d665fe275619f728bd4
static void test_visitor_out_list_qapi_free(TestOutputVisitorData *data, const void *unused) { UserDefTwoList *p, *head = NULL; const char string[] = "foo bar"; int i, max_count = 1024; for (i = 0; i < max_count; i++) { p = g_malloc0(sizeof(*p)); p->value = g_malloc0(sizeof(*p->value)); p->value->string0 = g_strdup(string); p->value->dict1 = g_new0(UserDefTwoDict, 1); p->value->dict1->string1 = g_strdup(string); p->value->dict1->dict2 = g_new0(UserDefTwoDictDict, 1); p->value->dict1->dict2->userdef = g_new0(UserDefOne, 1); p->value->dict1->dict2->userdef->string = g_strdup(string); p->value->dict1->dict2->userdef->integer = 42; p->value->dict1->dict2->string = g_strdup(string); p->value->dict1->has_dict3 = false; p->next = head; head = p; } qapi_free_UserDefTwoList(head); }
{ "code": [], "line_no": [] }
static void FUNC_0(TestOutputVisitorData *VAR_0, const void *VAR_1) { UserDefTwoList *p, *head = NULL; const char VAR_2[] = "foo bar"; int VAR_3, VAR_4 = 1024; for (VAR_3 = 0; VAR_3 < VAR_4; VAR_3++) { p = g_malloc0(sizeof(*p)); p->value = g_malloc0(sizeof(*p->value)); p->value->string0 = g_strdup(VAR_2); p->value->dict1 = g_new0(UserDefTwoDict, 1); p->value->dict1->string1 = g_strdup(VAR_2); p->value->dict1->dict2 = g_new0(UserDefTwoDictDict, 1); p->value->dict1->dict2->userdef = g_new0(UserDefOne, 1); p->value->dict1->dict2->userdef->VAR_2 = g_strdup(VAR_2); p->value->dict1->dict2->userdef->integer = 42; p->value->dict1->dict2->VAR_2 = g_strdup(VAR_2); p->value->dict1->has_dict3 = false; p->next = head; head = p; } qapi_free_UserDefTwoList(head); }
[ "static void FUNC_0(TestOutputVisitorData *VAR_0,\nconst void *VAR_1)\n{", "UserDefTwoList *p, *head = NULL;", "const char VAR_2[] = \"foo bar\";", "int VAR_3, VAR_4 = 1024;", "for (VAR_3 = 0; VAR_3 < VAR_4; VAR_3++) {", "p = g_malloc0(sizeof(*p));", "p->value = g_malloc0(sizeof(*p->value));", "p->val...
[ 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 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [...
26,896
void bdrv_io_limits_enable(BlockDriverState *bs, const char *group) { assert(!bs->throttle_state); throttle_group_register_bs(bs, group); }
false
qemu
31dce3ccca98bc9f9eb57f8b08b008edd07661ba
void bdrv_io_limits_enable(BlockDriverState *bs, const char *group) { assert(!bs->throttle_state); throttle_group_register_bs(bs, group); }
{ "code": [], "line_no": [] }
void FUNC_0(BlockDriverState *VAR_0, const char *VAR_1) { assert(!VAR_0->throttle_state); throttle_group_register_bs(VAR_0, VAR_1); }
[ "void FUNC_0(BlockDriverState *VAR_0, const char *VAR_1)\n{", "assert(!VAR_0->throttle_state);", "throttle_group_register_bs(VAR_0, VAR_1);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
26,897
static bool select_accel_fn(const void *buf, size_t len) { uintptr_t ibuf = (uintptr_t)buf; #ifdef CONFIG_AVX2_OPT if (len % 128 == 0 && ibuf % 32 == 0 && (cpuid_cache & CACHE_AVX2)) { return buffer_zero_avx2(buf, len); } if (len % 64 == 0 && ibuf % 16 == 0 && (cpuid_cache & CACHE_SSE4)) { return buffer_zero_sse4(buf, len); } #endif if (len % 64 == 0 && ibuf % 16 == 0 && (cpuid_cache & CACHE_SSE2)) { return buffer_zero_sse2(buf, len); } return buffer_zero_int(buf, len); }
false
qemu
d9911d14e01f5e97c6ac1fe681ef15334250d149
static bool select_accel_fn(const void *buf, size_t len) { uintptr_t ibuf = (uintptr_t)buf; #ifdef CONFIG_AVX2_OPT if (len % 128 == 0 && ibuf % 32 == 0 && (cpuid_cache & CACHE_AVX2)) { return buffer_zero_avx2(buf, len); } if (len % 64 == 0 && ibuf % 16 == 0 && (cpuid_cache & CACHE_SSE4)) { return buffer_zero_sse4(buf, len); } #endif if (len % 64 == 0 && ibuf % 16 == 0 && (cpuid_cache & CACHE_SSE2)) { return buffer_zero_sse2(buf, len); } return buffer_zero_int(buf, len); }
{ "code": [], "line_no": [] }
static bool FUNC_0(const void *buf, size_t len) { uintptr_t ibuf = (uintptr_t)buf; #ifdef CONFIG_AVX2_OPT if (len % 128 == 0 && ibuf % 32 == 0 && (cpuid_cache & CACHE_AVX2)) { return buffer_zero_avx2(buf, len); } if (len % 64 == 0 && ibuf % 16 == 0 && (cpuid_cache & CACHE_SSE4)) { return buffer_zero_sse4(buf, len); } #endif if (len % 64 == 0 && ibuf % 16 == 0 && (cpuid_cache & CACHE_SSE2)) { return buffer_zero_sse2(buf, len); } return buffer_zero_int(buf, len); }
[ "static bool FUNC_0(const void *buf, size_t len)\n{", "uintptr_t ibuf = (uintptr_t)buf;", "#ifdef CONFIG_AVX2_OPT\nif (len % 128 == 0 && ibuf % 32 == 0 && (cpuid_cache & CACHE_AVX2)) {", "return buffer_zero_avx2(buf, len);", "}", "if (len % 64 == 0 && ibuf % 16 == 0 && (cpuid_cache & CACHE_SSE4)) {", "r...
[ 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 ] ]
26,898
static void cpu_ppc_set_tb_clk (void *opaque, uint32_t freq) { CPUState *env = opaque; ppc_tb_t *tb_env = env->tb_env; tb_env->tb_freq = freq; tb_env->decr_freq = freq; /* There is a bug in Linux 2.4 kernels: * if a decrementer exception is pending when it enables msr_ee at startup, * it's not ready to handle it... */ _cpu_ppc_store_decr(env, 0xFFFFFFFF, 0xFFFFFFFF, 0); #if defined(TARGET_PPC64H) _cpu_ppc_store_hdecr(env, 0xFFFFFFFF, 0xFFFFFFFF, 0); cpu_ppc_store_purr(env, 0x0000000000000000ULL); #endif /* defined(TARGET_PPC64H) */ }
false
qemu
b172c56a6d849554f7e43adc95983a9d6c042689
static void cpu_ppc_set_tb_clk (void *opaque, uint32_t freq) { CPUState *env = opaque; ppc_tb_t *tb_env = env->tb_env; tb_env->tb_freq = freq; tb_env->decr_freq = freq; _cpu_ppc_store_decr(env, 0xFFFFFFFF, 0xFFFFFFFF, 0); #if defined(TARGET_PPC64H) _cpu_ppc_store_hdecr(env, 0xFFFFFFFF, 0xFFFFFFFF, 0); cpu_ppc_store_purr(env, 0x0000000000000000ULL); #endif }
{ "code": [], "line_no": [] }
static void FUNC_0 (void *VAR_0, uint32_t VAR_1) { CPUState *env = VAR_0; ppc_tb_t *tb_env = env->tb_env; tb_env->tb_freq = VAR_1; tb_env->decr_freq = VAR_1; _cpu_ppc_store_decr(env, 0xFFFFFFFF, 0xFFFFFFFF, 0); #if defined(TARGET_PPC64H) _cpu_ppc_store_hdecr(env, 0xFFFFFFFF, 0xFFFFFFFF, 0); cpu_ppc_store_purr(env, 0x0000000000000000ULL); #endif }
[ "static void FUNC_0 (void *VAR_0, uint32_t VAR_1)\n{", "CPUState *env = VAR_0;", "ppc_tb_t *tb_env = env->tb_env;", "tb_env->tb_freq = VAR_1;", "tb_env->decr_freq = VAR_1;", "_cpu_ppc_store_decr(env, 0xFFFFFFFF, 0xFFFFFFFF, 0);", "#if defined(TARGET_PPC64H)\n_cpu_ppc_store_hdecr(env, 0xFFFFFFFF, 0xFFFFF...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31, 33 ] ]
26,899
static int init_filter_param(AVFilterContext *ctx, FilterParam *fp, const char *effect_type, int width) { int z; const char *effect = fp->amount == 0 ? "none" : fp->amount < 0 ? "blur" : "sharpen"; if (!(fp->msize_x & fp->msize_y & 1)) { av_log(ctx, AV_LOG_ERROR, "Invalid even size for %s matrix size %dx%d\n", effect_type, fp->msize_x, fp->msize_y); return AVERROR(EINVAL); } av_log(ctx, AV_LOG_VERBOSE, "effect:%s type:%s msize_x:%d msize_y:%d amount:%0.2f\n", effect, effect_type, fp->msize_x, fp->msize_y, fp->amount / 65535.0); for (z = 0; z < 2 * fp->steps_y; z++) fp->sc[z] = av_malloc(sizeof(*(fp->sc[z])) * (width + 2 * fp->steps_x)); return 0; }
false
FFmpeg
89505f2c3f8ee1b0b68fc220a226c8bf3cef24cd
static int init_filter_param(AVFilterContext *ctx, FilterParam *fp, const char *effect_type, int width) { int z; const char *effect = fp->amount == 0 ? "none" : fp->amount < 0 ? "blur" : "sharpen"; if (!(fp->msize_x & fp->msize_y & 1)) { av_log(ctx, AV_LOG_ERROR, "Invalid even size for %s matrix size %dx%d\n", effect_type, fp->msize_x, fp->msize_y); return AVERROR(EINVAL); } av_log(ctx, AV_LOG_VERBOSE, "effect:%s type:%s msize_x:%d msize_y:%d amount:%0.2f\n", effect, effect_type, fp->msize_x, fp->msize_y, fp->amount / 65535.0); for (z = 0; z < 2 * fp->steps_y; z++) fp->sc[z] = av_malloc(sizeof(*(fp->sc[z])) * (width + 2 * fp->steps_x)); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFilterContext *VAR_0, FilterParam *VAR_1, const char *VAR_2, int VAR_3) { int VAR_4; const char *VAR_5 = VAR_1->amount == 0 ? "none" : VAR_1->amount < 0 ? "blur" : "sharpen"; if (!(VAR_1->msize_x & VAR_1->msize_y & 1)) { av_log(VAR_0, AV_LOG_ERROR, "Invalid even size for %s matrix size %dx%d\n", VAR_2, VAR_1->msize_x, VAR_1->msize_y); return AVERROR(EINVAL); } av_log(VAR_0, AV_LOG_VERBOSE, "VAR_5:%s type:%s msize_x:%d msize_y:%d amount:%0.2f\n", VAR_5, VAR_2, VAR_1->msize_x, VAR_1->msize_y, VAR_1->amount / 65535.0); for (VAR_4 = 0; VAR_4 < 2 * VAR_1->steps_y; VAR_4++) VAR_1->sc[VAR_4] = av_malloc(sizeof(*(VAR_1->sc[VAR_4])) * (VAR_3 + 2 * VAR_1->steps_x)); return 0; }
[ "static int FUNC_0(AVFilterContext *VAR_0, FilterParam *VAR_1, const char *VAR_2, int VAR_3)\n{", "int VAR_4;", "const char *VAR_5 = VAR_1->amount == 0 ? \"none\" : VAR_1->amount < 0 ? \"blur\" : \"sharpen\";", "if (!(VAR_1->msize_x & VAR_1->msize_y & 1)) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"Invalid even si...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13, 15, 17 ], [ 19 ], [ 21 ], [ 25, 27 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ] ]
26,900
static void do_video_out(AVFormatContext *s, AVOutputStream *ost, AVInputStream *ist, AVFrame *in_picture, int *frame_size) { int nb_frames, i, ret; AVFrame *final_picture, *formatted_picture, *resampling_dst, *padding_src; AVFrame picture_crop_temp, picture_pad_temp; AVCodecContext *enc, *dec; avcodec_get_frame_defaults(&picture_crop_temp); avcodec_get_frame_defaults(&picture_pad_temp); enc = ost->st->codec; dec = ist->st->codec; /* by default, we output a single frame */ nb_frames = 1; *frame_size = 0; if(video_sync_method>0 || (video_sync_method && av_q2d(enc->time_base) > 0.001)){ double vdelta; vdelta = get_sync_ipts(ost) / av_q2d(enc->time_base) - ost->sync_opts; //FIXME set to 0.5 after we fix some dts/pts bugs like in avidec.c if (vdelta < -1.1) nb_frames = 0; else if (video_sync_method == 2) ost->sync_opts= lrintf(get_sync_ipts(ost) / av_q2d(enc->time_base)); else if (vdelta > 1.1) nb_frames = lrintf(vdelta); //fprintf(stderr, "vdelta:%f, ost->sync_opts:%"PRId64", ost->sync_ipts:%f nb_frames:%d\n", vdelta, ost->sync_opts, ost->sync_ipts, nb_frames); if (nb_frames == 0){ ++nb_frames_drop; if (verbose>2) fprintf(stderr, "*** drop!\n"); }else if (nb_frames > 1) { nb_frames_dup += nb_frames; if (verbose>2) fprintf(stderr, "*** %d dup!\n", nb_frames-1); } }else ost->sync_opts= lrintf(get_sync_ipts(ost) / av_q2d(enc->time_base)); nb_frames= FFMIN(nb_frames, max_frames[CODEC_TYPE_VIDEO] - ost->frame_number); if (nb_frames <= 0) return; if (ost->video_crop) { if (av_picture_crop((AVPicture *)&picture_crop_temp, (AVPicture *)in_picture, dec->pix_fmt, ost->topBand, ost->leftBand) < 0) { av_log(NULL, AV_LOG_ERROR, "error cropping picture\n"); if (exit_on_error) av_exit(1); return; } formatted_picture = &picture_crop_temp; } else { formatted_picture = in_picture; } final_picture = formatted_picture; padding_src = formatted_picture; resampling_dst = &ost->pict_tmp; if (ost->video_pad) { final_picture = &ost->pict_tmp; if (ost->video_resample) { if (av_picture_crop((AVPicture *)&picture_pad_temp, (AVPicture *)final_picture, enc->pix_fmt, ost->padtop, ost->padleft) < 0) { av_log(NULL, AV_LOG_ERROR, "error padding picture\n"); if (exit_on_error) av_exit(1); return; } resampling_dst = &picture_pad_temp; } } if (ost->video_resample) { padding_src = NULL; final_picture = &ost->pict_tmp; sws_scale(ost->img_resample_ctx, formatted_picture->data, formatted_picture->linesize, 0, ost->resample_height, resampling_dst->data, resampling_dst->linesize); } if (ost->video_pad) { av_picture_pad((AVPicture*)final_picture, (AVPicture *)padding_src, enc->height, enc->width, enc->pix_fmt, ost->padtop, ost->padbottom, ost->padleft, ost->padright, padcolor); } /* duplicates frame if needed */ for(i=0;i<nb_frames;i++) { AVPacket pkt; av_init_packet(&pkt); pkt.stream_index= ost->index; if (s->oformat->flags & AVFMT_RAWPICTURE) { /* raw pictures are written as AVPicture structure to avoid any copies. We support temorarily the older method. */ AVFrame* old_frame = enc->coded_frame; enc->coded_frame = dec->coded_frame; //FIXME/XXX remove this hack pkt.data= (uint8_t *)final_picture; pkt.size= sizeof(AVPicture); pkt.pts= av_rescale_q(ost->sync_opts, enc->time_base, ost->st->time_base); pkt.flags |= PKT_FLAG_KEY; write_frame(s, &pkt, ost->st->codec, bitstream_filters[ost->file_index][pkt.stream_index]); enc->coded_frame = old_frame; } else { AVFrame big_picture; big_picture= *final_picture; /* better than nothing: use input picture interlaced settings */ big_picture.interlaced_frame = in_picture->interlaced_frame; if(avctx_opts[CODEC_TYPE_VIDEO]->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME)){ if(top_field_first == -1) big_picture.top_field_first = in_picture->top_field_first; else big_picture.top_field_first = top_field_first; } /* handles sameq here. This is not correct because it may not be a global option */ if (same_quality) { big_picture.quality = ist->st->quality; }else big_picture.quality = ost->st->quality; if(!me_threshold) big_picture.pict_type = 0; // big_picture.pts = AV_NOPTS_VALUE; big_picture.pts= ost->sync_opts; // big_picture.pts= av_rescale(ost->sync_opts, AV_TIME_BASE*(int64_t)enc->time_base.num, enc->time_base.den); //av_log(NULL, AV_LOG_DEBUG, "%"PRId64" -> encoder\n", ost->sync_opts); ret = avcodec_encode_video(enc, bit_buffer, bit_buffer_size, &big_picture); if (ret == -1) { fprintf(stderr, "Video encoding failed\n"); av_exit(1); } //enc->frame_number = enc->real_pict_num; if(ret>0){ pkt.data= bit_buffer; pkt.size= ret; if(enc->coded_frame->pts != AV_NOPTS_VALUE) pkt.pts= av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base); /*av_log(NULL, AV_LOG_DEBUG, "encoder -> %"PRId64"/%"PRId64"\n", pkt.pts != AV_NOPTS_VALUE ? av_rescale(pkt.pts, enc->time_base.den, AV_TIME_BASE*(int64_t)enc->time_base.num) : -1, pkt.dts != AV_NOPTS_VALUE ? av_rescale(pkt.dts, enc->time_base.den, AV_TIME_BASE*(int64_t)enc->time_base.num) : -1);*/ if(enc->coded_frame->key_frame) pkt.flags |= PKT_FLAG_KEY; write_frame(s, &pkt, ost->st->codec, bitstream_filters[ost->file_index][pkt.stream_index]); *frame_size = ret; video_size += ret; //fprintf(stderr,"\nFrame: %3d %3d size: %5d type: %d", // enc->frame_number-1, enc->real_pict_num, ret, // enc->pict_type); /* if two pass, output log */ if (ost->logfile && enc->stats_out) { fprintf(ost->logfile, "%s", enc->stats_out); } } } ost->sync_opts++; ost->frame_number++; } }
false
FFmpeg
95af5e1c8158667066e1b39217bbf6e62cedeb4c
static void do_video_out(AVFormatContext *s, AVOutputStream *ost, AVInputStream *ist, AVFrame *in_picture, int *frame_size) { int nb_frames, i, ret; AVFrame *final_picture, *formatted_picture, *resampling_dst, *padding_src; AVFrame picture_crop_temp, picture_pad_temp; AVCodecContext *enc, *dec; avcodec_get_frame_defaults(&picture_crop_temp); avcodec_get_frame_defaults(&picture_pad_temp); enc = ost->st->codec; dec = ist->st->codec; nb_frames = 1; *frame_size = 0; if(video_sync_method>0 || (video_sync_method && av_q2d(enc->time_base) > 0.001)){ double vdelta; vdelta = get_sync_ipts(ost) / av_q2d(enc->time_base) - ost->sync_opts; if (vdelta < -1.1) nb_frames = 0; else if (video_sync_method == 2) ost->sync_opts= lrintf(get_sync_ipts(ost) / av_q2d(enc->time_base)); else if (vdelta > 1.1) nb_frames = lrintf(vdelta); if (nb_frames == 0){ ++nb_frames_drop; if (verbose>2) fprintf(stderr, "*** drop!\n"); }else if (nb_frames > 1) { nb_frames_dup += nb_frames; if (verbose>2) fprintf(stderr, "*** %d dup!\n", nb_frames-1); } }else ost->sync_opts= lrintf(get_sync_ipts(ost) / av_q2d(enc->time_base)); nb_frames= FFMIN(nb_frames, max_frames[CODEC_TYPE_VIDEO] - ost->frame_number); if (nb_frames <= 0) return; if (ost->video_crop) { if (av_picture_crop((AVPicture *)&picture_crop_temp, (AVPicture *)in_picture, dec->pix_fmt, ost->topBand, ost->leftBand) < 0) { av_log(NULL, AV_LOG_ERROR, "error cropping picture\n"); if (exit_on_error) av_exit(1); return; } formatted_picture = &picture_crop_temp; } else { formatted_picture = in_picture; } final_picture = formatted_picture; padding_src = formatted_picture; resampling_dst = &ost->pict_tmp; if (ost->video_pad) { final_picture = &ost->pict_tmp; if (ost->video_resample) { if (av_picture_crop((AVPicture *)&picture_pad_temp, (AVPicture *)final_picture, enc->pix_fmt, ost->padtop, ost->padleft) < 0) { av_log(NULL, AV_LOG_ERROR, "error padding picture\n"); if (exit_on_error) av_exit(1); return; } resampling_dst = &picture_pad_temp; } } if (ost->video_resample) { padding_src = NULL; final_picture = &ost->pict_tmp; sws_scale(ost->img_resample_ctx, formatted_picture->data, formatted_picture->linesize, 0, ost->resample_height, resampling_dst->data, resampling_dst->linesize); } if (ost->video_pad) { av_picture_pad((AVPicture*)final_picture, (AVPicture *)padding_src, enc->height, enc->width, enc->pix_fmt, ost->padtop, ost->padbottom, ost->padleft, ost->padright, padcolor); } for(i=0;i<nb_frames;i++) { AVPacket pkt; av_init_packet(&pkt); pkt.stream_index= ost->index; if (s->oformat->flags & AVFMT_RAWPICTURE) { AVFrame* old_frame = enc->coded_frame; enc->coded_frame = dec->coded_frame; pkt.data= (uint8_t *)final_picture; pkt.size= sizeof(AVPicture); pkt.pts= av_rescale_q(ost->sync_opts, enc->time_base, ost->st->time_base); pkt.flags |= PKT_FLAG_KEY; write_frame(s, &pkt, ost->st->codec, bitstream_filters[ost->file_index][pkt.stream_index]); enc->coded_frame = old_frame; } else { AVFrame big_picture; big_picture= *final_picture; big_picture.interlaced_frame = in_picture->interlaced_frame; if(avctx_opts[CODEC_TYPE_VIDEO]->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME)){ if(top_field_first == -1) big_picture.top_field_first = in_picture->top_field_first; else big_picture.top_field_first = top_field_first; } if (same_quality) { big_picture.quality = ist->st->quality; }else big_picture.quality = ost->st->quality; if(!me_threshold) big_picture.pict_type = 0; big_picture.pts= ost->sync_opts; ret = avcodec_encode_video(enc, bit_buffer, bit_buffer_size, &big_picture); if (ret == -1) { fprintf(stderr, "Video encoding failed\n"); av_exit(1); } if(ret>0){ pkt.data= bit_buffer; pkt.size= ret; if(enc->coded_frame->pts != AV_NOPTS_VALUE) pkt.pts= av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base); if(enc->coded_frame->key_frame) pkt.flags |= PKT_FLAG_KEY; write_frame(s, &pkt, ost->st->codec, bitstream_filters[ost->file_index][pkt.stream_index]); *frame_size = ret; video_size += ret; if (ost->logfile && enc->stats_out) { fprintf(ost->logfile, "%s", enc->stats_out); } } } ost->sync_opts++; ost->frame_number++; } }
{ "code": [], "line_no": [] }
static void FUNC_0(AVFormatContext *VAR_0, AVOutputStream *VAR_1, AVInputStream *VAR_2, AVFrame *VAR_3, int *VAR_4) { int VAR_5, VAR_6, VAR_7; AVFrame *final_picture, *formatted_picture, *resampling_dst, *padding_src; AVFrame picture_crop_temp, picture_pad_temp; AVCodecContext *enc, *dec; avcodec_get_frame_defaults(&picture_crop_temp); avcodec_get_frame_defaults(&picture_pad_temp); enc = VAR_1->st->codec; dec = VAR_2->st->codec; VAR_5 = 1; *VAR_4 = 0; if(video_sync_method>0 || (video_sync_method && av_q2d(enc->time_base) > 0.001)){ double VAR_8; VAR_8 = get_sync_ipts(VAR_1) / av_q2d(enc->time_base) - VAR_1->sync_opts; if (VAR_8 < -1.1) VAR_5 = 0; else if (video_sync_method == 2) VAR_1->sync_opts= lrintf(get_sync_ipts(VAR_1) / av_q2d(enc->time_base)); else if (VAR_8 > 1.1) VAR_5 = lrintf(VAR_8); if (VAR_5 == 0){ ++nb_frames_drop; if (verbose>2) fprintf(stderr, "*** drop!\n"); }else if (VAR_5 > 1) { nb_frames_dup += VAR_5; if (verbose>2) fprintf(stderr, "*** %d dup!\n", VAR_5-1); } }else VAR_1->sync_opts= lrintf(get_sync_ipts(VAR_1) / av_q2d(enc->time_base)); VAR_5= FFMIN(VAR_5, max_frames[CODEC_TYPE_VIDEO] - VAR_1->frame_number); if (VAR_5 <= 0) return; if (VAR_1->video_crop) { if (av_picture_crop((AVPicture *)&picture_crop_temp, (AVPicture *)VAR_3, dec->pix_fmt, VAR_1->topBand, VAR_1->leftBand) < 0) { av_log(NULL, AV_LOG_ERROR, "error cropping picture\n"); if (exit_on_error) av_exit(1); return; } formatted_picture = &picture_crop_temp; } else { formatted_picture = VAR_3; } final_picture = formatted_picture; padding_src = formatted_picture; resampling_dst = &VAR_1->pict_tmp; if (VAR_1->video_pad) { final_picture = &VAR_1->pict_tmp; if (VAR_1->video_resample) { if (av_picture_crop((AVPicture *)&picture_pad_temp, (AVPicture *)final_picture, enc->pix_fmt, VAR_1->padtop, VAR_1->padleft) < 0) { av_log(NULL, AV_LOG_ERROR, "error padding picture\n"); if (exit_on_error) av_exit(1); return; } resampling_dst = &picture_pad_temp; } } if (VAR_1->video_resample) { padding_src = NULL; final_picture = &VAR_1->pict_tmp; sws_scale(VAR_1->img_resample_ctx, formatted_picture->data, formatted_picture->linesize, 0, VAR_1->resample_height, resampling_dst->data, resampling_dst->linesize); } if (VAR_1->video_pad) { av_picture_pad((AVPicture*)final_picture, (AVPicture *)padding_src, enc->height, enc->width, enc->pix_fmt, VAR_1->padtop, VAR_1->padbottom, VAR_1->padleft, VAR_1->padright, padcolor); } for(VAR_6=0;VAR_6<VAR_5;VAR_6++) { AVPacket pkt; av_init_packet(&pkt); pkt.stream_index= VAR_1->index; if (VAR_0->oformat->flags & AVFMT_RAWPICTURE) { AVFrame* old_frame = enc->coded_frame; enc->coded_frame = dec->coded_frame; pkt.data= (uint8_t *)final_picture; pkt.size= sizeof(AVPicture); pkt.pts= av_rescale_q(VAR_1->sync_opts, enc->time_base, VAR_1->st->time_base); pkt.flags |= PKT_FLAG_KEY; write_frame(VAR_0, &pkt, VAR_1->st->codec, bitstream_filters[VAR_1->file_index][pkt.stream_index]); enc->coded_frame = old_frame; } else { AVFrame big_picture; big_picture= *final_picture; big_picture.interlaced_frame = VAR_3->interlaced_frame; if(avctx_opts[CODEC_TYPE_VIDEO]->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME)){ if(top_field_first == -1) big_picture.top_field_first = VAR_3->top_field_first; else big_picture.top_field_first = top_field_first; } if (same_quality) { big_picture.quality = VAR_2->st->quality; }else big_picture.quality = VAR_1->st->quality; if(!me_threshold) big_picture.pict_type = 0; big_picture.pts= VAR_1->sync_opts; VAR_7 = avcodec_encode_video(enc, bit_buffer, bit_buffer_size, &big_picture); if (VAR_7 == -1) { fprintf(stderr, "Video encoding failed\n"); av_exit(1); } if(VAR_7>0){ pkt.data= bit_buffer; pkt.size= VAR_7; if(enc->coded_frame->pts != AV_NOPTS_VALUE) pkt.pts= av_rescale_q(enc->coded_frame->pts, enc->time_base, VAR_1->st->time_base); if(enc->coded_frame->key_frame) pkt.flags |= PKT_FLAG_KEY; write_frame(VAR_0, &pkt, VAR_1->st->codec, bitstream_filters[VAR_1->file_index][pkt.stream_index]); *VAR_4 = VAR_7; video_size += VAR_7; if (VAR_1->logfile && enc->stats_out) { fprintf(VAR_1->logfile, "%VAR_0", enc->stats_out); } } } VAR_1->sync_opts++; VAR_1->frame_number++; } }
[ "static void FUNC_0(AVFormatContext *VAR_0,\nAVOutputStream *VAR_1,\nAVInputStream *VAR_2,\nAVFrame *VAR_3,\nint *VAR_4)\n{", "int VAR_5, VAR_6, VAR_7;", "AVFrame *final_picture, *formatted_picture, *resampling_dst, *padding_src;", "AVFrame picture_crop_temp, picture_pad_temp;", "AVCodecContext *enc, *dec;"...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 29 ], [ 31 ], [ 37 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 53, 55 ], [ 57, 59 ], [ 61,...
26,901
static void pci_apb_iowritel (void *opaque, target_phys_addr_t addr, uint32_t val) { cpu_outl(addr & IOPORTS_MASK, bswap32(val)); }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void pci_apb_iowritel (void *opaque, target_phys_addr_t addr, uint32_t val) { cpu_outl(addr & IOPORTS_MASK, bswap32(val)); }
{ "code": [], "line_no": [] }
static void FUNC_0 (void *VAR_0, target_phys_addr_t VAR_1, uint32_t VAR_2) { cpu_outl(VAR_1 & IOPORTS_MASK, bswap32(VAR_2)); }
[ "static void FUNC_0 (void *VAR_0, target_phys_addr_t VAR_1,\nuint32_t VAR_2)\n{", "cpu_outl(VAR_1 & IOPORTS_MASK, bswap32(VAR_2));", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
26,902
tight_detect_smooth_image24(VncState *vs, int w, int h) { int off; int x, y, d, dx; uint c; uint stats[256]; int pixels = 0; int pix, left[3]; uint errors; unsigned char *buf = vs->tight.buffer; /* * If client is big-endian, color samples begin from the second * byte (offset 1) of a 32-bit pixel value. */ off = !!(vs->clientds.flags & QEMU_BIG_ENDIAN_FLAG); memset(stats, 0, sizeof (stats)); for (y = 0, x = 0; y < h && x < w;) { for (d = 0; d < h - y && d < w - x - VNC_TIGHT_DETECT_SUBROW_WIDTH; d++) { for (c = 0; c < 3; c++) { left[c] = buf[((y+d)*w+x+d)*4+off+c] & 0xFF; } for (dx = 1; dx <= VNC_TIGHT_DETECT_SUBROW_WIDTH; dx++) { for (c = 0; c < 3; c++) { pix = buf[((y+d)*w+x+d+dx)*4+off+c] & 0xFF; stats[abs(pix - left[c])]++; left[c] = pix; } pixels++; } } if (w > h) { x += h; y = 0; } else { x = 0; y += w; } } /* 95% smooth or more ... */ if (stats[0] * 33 / pixels >= 95) { return 0; } errors = 0; for (c = 1; c < 8; c++) { errors += stats[c] * (c * c); if (stats[c] == 0 || stats[c] > stats[c-1] * 2) { return 0; } } for (; c < 256; c++) { errors += stats[c] * (c * c); } errors /= (pixels * 3 - stats[0]); return errors; }
false
qemu
245f7b51c0ea04fb2224b1127430a096c91aee70
tight_detect_smooth_image24(VncState *vs, int w, int h) { int off; int x, y, d, dx; uint c; uint stats[256]; int pixels = 0; int pix, left[3]; uint errors; unsigned char *buf = vs->tight.buffer; off = !!(vs->clientds.flags & QEMU_BIG_ENDIAN_FLAG); memset(stats, 0, sizeof (stats)); for (y = 0, x = 0; y < h && x < w;) { for (d = 0; d < h - y && d < w - x - VNC_TIGHT_DETECT_SUBROW_WIDTH; d++) { for (c = 0; c < 3; c++) { left[c] = buf[((y+d)*w+x+d)*4+off+c] & 0xFF; } for (dx = 1; dx <= VNC_TIGHT_DETECT_SUBROW_WIDTH; dx++) { for (c = 0; c < 3; c++) { pix = buf[((y+d)*w+x+d+dx)*4+off+c] & 0xFF; stats[abs(pix - left[c])]++; left[c] = pix; } pixels++; } } if (w > h) { x += h; y = 0; } else { x = 0; y += w; } } if (stats[0] * 33 / pixels >= 95) { return 0; } errors = 0; for (c = 1; c < 8; c++) { errors += stats[c] * (c * c); if (stats[c] == 0 || stats[c] > stats[c-1] * 2) { return 0; } } for (; c < 256; c++) { errors += stats[c] * (c * c); } errors /= (pixels * 3 - stats[0]); return errors; }
{ "code": [], "line_no": [] }
FUNC_0(VncState *VAR_0, int VAR_1, int VAR_2) { int VAR_3; int VAR_4, VAR_5, VAR_6, VAR_7; uint c; uint stats[256]; int VAR_8 = 0; int VAR_9, VAR_10[3]; uint errors; unsigned char *VAR_11 = VAR_0->tight.buffer; VAR_3 = !!(VAR_0->clientds.flags & QEMU_BIG_ENDIAN_FLAG); memset(stats, 0, sizeof (stats)); for (VAR_5 = 0, VAR_4 = 0; VAR_5 < VAR_2 && VAR_4 < VAR_1;) { for (VAR_6 = 0; VAR_6 < VAR_2 - VAR_5 && VAR_6 < VAR_1 - VAR_4 - VNC_TIGHT_DETECT_SUBROW_WIDTH; VAR_6++) { for (c = 0; c < 3; c++) { VAR_10[c] = VAR_11[((VAR_5+VAR_6)*VAR_1+VAR_4+VAR_6)*4+VAR_3+c] & 0xFF; } for (VAR_7 = 1; VAR_7 <= VNC_TIGHT_DETECT_SUBROW_WIDTH; VAR_7++) { for (c = 0; c < 3; c++) { VAR_9 = VAR_11[((VAR_5+VAR_6)*VAR_1+VAR_4+VAR_6+VAR_7)*4+VAR_3+c] & 0xFF; stats[abs(VAR_9 - VAR_10[c])]++; VAR_10[c] = VAR_9; } VAR_8++; } } if (VAR_1 > VAR_2) { VAR_4 += VAR_2; VAR_5 = 0; } else { VAR_4 = 0; VAR_5 += VAR_1; } } if (stats[0] * 33 / VAR_8 >= 95) { return 0; } errors = 0; for (c = 1; c < 8; c++) { errors += stats[c] * (c * c); if (stats[c] == 0 || stats[c] > stats[c-1] * 2) { return 0; } } for (; c < 256; c++) { errors += stats[c] * (c * c); } errors /= (VAR_8 * 3 - stats[0]); return errors; }
[ "FUNC_0(VncState *VAR_0, int VAR_1, int VAR_2)\n{", "int VAR_3;", "int VAR_4, VAR_5, VAR_6, VAR_7;", "uint c;", "uint stats[256];", "int VAR_8 = 0;", "int VAR_9, VAR_10[3];", "uint errors;", "unsigned char *VAR_11 = VAR_0->tight.buffer;", "VAR_3 = !!(VAR_0->clientds.flags & QEMU_BIG_ENDIAN_FLAG);"...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 31 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ...
26,903
static void csselr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { env->cp15.c0_cssel = value & 0xf; }
false
qemu
8d5c773e323b22402abdd0beef4c7d2fc91dd0eb
static void csselr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { env->cp15.c0_cssel = value & 0xf; }
{ "code": [], "line_no": [] }
static void FUNC_0(CPUARMState *VAR_0, const ARMCPRegInfo *VAR_1, uint64_t VAR_2) { VAR_0->cp15.c0_cssel = VAR_2 & 0xf; }
[ "static void FUNC_0(CPUARMState *VAR_0, const ARMCPRegInfo *VAR_1,\nuint64_t VAR_2)\n{", "VAR_0->cp15.c0_cssel = VAR_2 & 0xf;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
26,905
bool net_tx_pkt_send(struct NetTxPkt *pkt, NetClientState *nc) { assert(pkt); if (!pkt->has_virt_hdr && pkt->virt_hdr.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) { net_tx_pkt_do_sw_csum(pkt); } /* * Since underlying infrastructure does not support IP datagrams longer * than 64K we should drop such packets and don't even try to send */ if (VIRTIO_NET_HDR_GSO_NONE != pkt->virt_hdr.gso_type) { if (pkt->payload_len > ETH_MAX_IP_DGRAM_LEN - pkt->vec[NET_TX_PKT_L3HDR_FRAG].iov_len) { return false; } } if (pkt->has_virt_hdr || pkt->virt_hdr.gso_type == VIRTIO_NET_HDR_GSO_NONE) { qemu_sendv_packet(nc, pkt->vec, pkt->payload_frags + NET_TX_PKT_PL_START_FRAG); return true; } return net_tx_pkt_do_sw_fragmentation(pkt, nc); }
false
qemu
eb700029c7836798046191d62d595363d92c84d4
bool net_tx_pkt_send(struct NetTxPkt *pkt, NetClientState *nc) { assert(pkt); if (!pkt->has_virt_hdr && pkt->virt_hdr.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) { net_tx_pkt_do_sw_csum(pkt); } if (VIRTIO_NET_HDR_GSO_NONE != pkt->virt_hdr.gso_type) { if (pkt->payload_len > ETH_MAX_IP_DGRAM_LEN - pkt->vec[NET_TX_PKT_L3HDR_FRAG].iov_len) { return false; } } if (pkt->has_virt_hdr || pkt->virt_hdr.gso_type == VIRTIO_NET_HDR_GSO_NONE) { qemu_sendv_packet(nc, pkt->vec, pkt->payload_frags + NET_TX_PKT_PL_START_FRAG); return true; } return net_tx_pkt_do_sw_fragmentation(pkt, nc); }
{ "code": [], "line_no": [] }
bool FUNC_0(struct NetTxPkt *pkt, NetClientState *nc) { assert(pkt); if (!pkt->has_virt_hdr && pkt->virt_hdr.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) { net_tx_pkt_do_sw_csum(pkt); } if (VIRTIO_NET_HDR_GSO_NONE != pkt->virt_hdr.gso_type) { if (pkt->payload_len > ETH_MAX_IP_DGRAM_LEN - pkt->vec[NET_TX_PKT_L3HDR_FRAG].iov_len) { return false; } } if (pkt->has_virt_hdr || pkt->virt_hdr.gso_type == VIRTIO_NET_HDR_GSO_NONE) { qemu_sendv_packet(nc, pkt->vec, pkt->payload_frags + NET_TX_PKT_PL_START_FRAG); return true; } return net_tx_pkt_do_sw_fragmentation(pkt, nc); }
[ "bool FUNC_0(struct NetTxPkt *pkt, NetClientState *nc)\n{", "assert(pkt);", "if (!pkt->has_virt_hdr &&\npkt->virt_hdr.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) {", "net_tx_pkt_do_sw_csum(pkt);", "}", "if (VIRTIO_NET_HDR_GSO_NONE != pkt->virt_hdr.gso_type) {", "if (pkt->payload_len >\nETH_MAX_IP_DGRAM_LEN -\n...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 27 ], [ 29, 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43, 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ] ]
26,907
static int mmu40x_get_physical_address (CPUState *env, mmu_ctx_t *ctx, target_ulong address, int rw, int access_type) { ppcemb_tlb_t *tlb; target_phys_addr_t raddr; int i, ret, zsel, zpr, pr; ret = -1; raddr = (target_phys_addr_t)-1ULL; pr = msr_pr; for (i = 0; i < env->nb_tlb; i++) { tlb = &env->tlb[i].tlbe; if (ppcemb_tlb_check(env, tlb, &raddr, address, env->spr[SPR_40x_PID], 0, i) < 0) continue; zsel = (tlb->attr >> 4) & 0xF; zpr = (env->spr[SPR_40x_ZPR] >> (28 - (2 * zsel))) & 0x3; LOG_SWTLB("%s: TLB %d zsel %d zpr %d rw %d attr %08x\n", __func__, i, zsel, zpr, rw, tlb->attr); /* Check execute enable bit */ switch (zpr) { case 0x2: if (pr != 0) goto check_perms; /* No break here */ case 0x3: /* All accesses granted */ ctx->prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; ret = 0; break; case 0x0: if (pr != 0) { ctx->prot = 0; ret = -2; break; } /* No break here */ case 0x1: check_perms: /* Check from TLB entry */ /* XXX: there is a problem here or in the TLB fill code... */ ctx->prot = tlb->prot; ctx->prot |= PAGE_EXEC; ret = check_prot(ctx->prot, rw, access_type); break; } if (ret >= 0) { ctx->raddr = raddr; LOG_SWTLB("%s: access granted " TARGET_FMT_lx " => " TARGET_FMT_plx " %d %d\n", __func__, address, ctx->raddr, ctx->prot, ret); return 0; } } LOG_SWTLB("%s: access refused " TARGET_FMT_lx " => " TARGET_FMT_plx " %d %d\n", __func__, address, raddr, ctx->prot, ret); return ret; }
false
qemu
ec5c3e487eb49100e6cb1b84e7f0bd022fbbf54b
static int mmu40x_get_physical_address (CPUState *env, mmu_ctx_t *ctx, target_ulong address, int rw, int access_type) { ppcemb_tlb_t *tlb; target_phys_addr_t raddr; int i, ret, zsel, zpr, pr; ret = -1; raddr = (target_phys_addr_t)-1ULL; pr = msr_pr; for (i = 0; i < env->nb_tlb; i++) { tlb = &env->tlb[i].tlbe; if (ppcemb_tlb_check(env, tlb, &raddr, address, env->spr[SPR_40x_PID], 0, i) < 0) continue; zsel = (tlb->attr >> 4) & 0xF; zpr = (env->spr[SPR_40x_ZPR] >> (28 - (2 * zsel))) & 0x3; LOG_SWTLB("%s: TLB %d zsel %d zpr %d rw %d attr %08x\n", __func__, i, zsel, zpr, rw, tlb->attr); switch (zpr) { case 0x2: if (pr != 0) goto check_perms; case 0x3: ctx->prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; ret = 0; break; case 0x0: if (pr != 0) { ctx->prot = 0; ret = -2; break; } case 0x1: check_perms: ctx->prot = tlb->prot; ctx->prot |= PAGE_EXEC; ret = check_prot(ctx->prot, rw, access_type); break; } if (ret >= 0) { ctx->raddr = raddr; LOG_SWTLB("%s: access granted " TARGET_FMT_lx " => " TARGET_FMT_plx " %d %d\n", __func__, address, ctx->raddr, ctx->prot, ret); return 0; } } LOG_SWTLB("%s: access refused " TARGET_FMT_lx " => " TARGET_FMT_plx " %d %d\n", __func__, address, raddr, ctx->prot, ret); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0 (CPUState *VAR_0, mmu_ctx_t *VAR_1, target_ulong VAR_2, int VAR_3, int VAR_4) { ppcemb_tlb_t *tlb; target_phys_addr_t raddr; int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9; VAR_6 = -1; raddr = (target_phys_addr_t)-1ULL; VAR_9 = msr_pr; for (VAR_5 = 0; VAR_5 < VAR_0->nb_tlb; VAR_5++) { tlb = &VAR_0->tlb[VAR_5].tlbe; if (ppcemb_tlb_check(VAR_0, tlb, &raddr, VAR_2, VAR_0->spr[SPR_40x_PID], 0, VAR_5) < 0) continue; VAR_7 = (tlb->attr >> 4) & 0xF; VAR_8 = (VAR_0->spr[SPR_40x_ZPR] >> (28 - (2 * VAR_7))) & 0x3; LOG_SWTLB("%s: TLB %d VAR_7 %d VAR_8 %d VAR_3 %d attr %08x\n", __func__, VAR_5, VAR_7, VAR_8, VAR_3, tlb->attr); switch (VAR_8) { case 0x2: if (VAR_9 != 0) goto check_perms; case 0x3: VAR_1->prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; VAR_6 = 0; break; case 0x0: if (VAR_9 != 0) { VAR_1->prot = 0; VAR_6 = -2; break; } case 0x1: check_perms: VAR_1->prot = tlb->prot; VAR_1->prot |= PAGE_EXEC; VAR_6 = check_prot(VAR_1->prot, VAR_3, VAR_4); break; } if (VAR_6 >= 0) { VAR_1->raddr = raddr; LOG_SWTLB("%s: access granted " TARGET_FMT_lx " => " TARGET_FMT_plx " %d %d\n", __func__, VAR_2, VAR_1->raddr, VAR_1->prot, VAR_6); return 0; } } LOG_SWTLB("%s: access refused " TARGET_FMT_lx " => " TARGET_FMT_plx " %d %d\n", __func__, VAR_2, raddr, VAR_1->prot, VAR_6); return VAR_6; }
[ "static int FUNC_0 (CPUState *VAR_0, mmu_ctx_t *VAR_1,\ntarget_ulong VAR_2, int VAR_3, int VAR_4)\n{", "ppcemb_tlb_t *tlb;", "target_phys_addr_t raddr;", "int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;", "VAR_6 = -1;", "raddr = (target_phys_addr_t)-1ULL;", "VAR_9 = msr_pr;", "for (VAR_5 = 0; VAR_5 < VAR_0->nb...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27, 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 41 ], [ 43, 45, 47 ], [ 51, 55 ], [...
26,908
int bdrv_read(BlockDriverState *bs, int64_t sector_num, uint8_t *buf, int nb_sectors) { BlockDriver *drv = bs->drv; if (!drv) return -ENOMEDIUM; if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) { memcpy(buf, bs->boot_sector_data, 512); sector_num++; nb_sectors--; buf += 512; if (nb_sectors == 0) return 0; } if (drv->bdrv_pread) { int ret, len; len = nb_sectors * 512; ret = drv->bdrv_pread(bs, sector_num * 512, buf, len); if (ret < 0) return ret; else if (ret != len) return -EINVAL; else { bs->rd_bytes += (unsigned) len; bs->rd_ops ++; return 0; } } else { return drv->bdrv_read(bs, sector_num, buf, nb_sectors); } }
false
qemu
4fc9af53d88c0a2a810704a06cb39a7182982e4e
int bdrv_read(BlockDriverState *bs, int64_t sector_num, uint8_t *buf, int nb_sectors) { BlockDriver *drv = bs->drv; if (!drv) return -ENOMEDIUM; if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) { memcpy(buf, bs->boot_sector_data, 512); sector_num++; nb_sectors--; buf += 512; if (nb_sectors == 0) return 0; } if (drv->bdrv_pread) { int ret, len; len = nb_sectors * 512; ret = drv->bdrv_pread(bs, sector_num * 512, buf, len); if (ret < 0) return ret; else if (ret != len) return -EINVAL; else { bs->rd_bytes += (unsigned) len; bs->rd_ops ++; return 0; } } else { return drv->bdrv_read(bs, sector_num, buf, nb_sectors); } }
{ "code": [], "line_no": [] }
int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1, uint8_t *VAR_2, int VAR_3) { BlockDriver *drv = VAR_0->drv; if (!drv) return -ENOMEDIUM; if (VAR_1 == 0 && VAR_0->boot_sector_enabled && VAR_3 > 0) { memcpy(VAR_2, VAR_0->boot_sector_data, 512); VAR_1++; VAR_3--; VAR_2 += 512; if (VAR_3 == 0) return 0; } if (drv->bdrv_pread) { int VAR_4, VAR_5; VAR_5 = VAR_3 * 512; VAR_4 = drv->bdrv_pread(VAR_0, VAR_1 * 512, VAR_2, VAR_5); if (VAR_4 < 0) return VAR_4; else if (VAR_4 != VAR_5) return -EINVAL; else { VAR_0->rd_bytes += (unsigned) VAR_5; VAR_0->rd_ops ++; return 0; } } else { return drv->FUNC_0(VAR_0, VAR_1, VAR_2, VAR_3); } }
[ "int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1,\nuint8_t *VAR_2, int VAR_3)\n{", "BlockDriver *drv = VAR_0->drv;", "if (!drv)\nreturn -ENOMEDIUM;", "if (VAR_1 == 0 && VAR_0->boot_sector_enabled && VAR_3 > 0) {", "memcpy(VAR_2, VAR_0->boot_sector_data, 512);", "VAR_1++;", "VAR_3--;", "VAR_2 += 512;...
[ 0, 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 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45, 47 ], [ 49 ], ...
26,909
int socket_connect(SocketAddress *addr, Error **errp, NonBlockingConnectHandler *callback, void *opaque) { int fd; switch (addr->type) { case SOCKET_ADDRESS_KIND_INET: fd = inet_connect_saddr(addr->u.inet, errp, callback, opaque); break; case SOCKET_ADDRESS_KIND_UNIX: fd = unix_connect_saddr(addr->u.q_unix, errp, callback, opaque); break; case SOCKET_ADDRESS_KIND_FD: fd = monitor_get_fd(cur_mon, addr->u.fd->str, errp); if (fd >= 0 && callback) { qemu_set_nonblock(fd); callback(fd, NULL, opaque); } break; default: abort(); } return fd; }
false
qemu
32bafa8fdd098d52fbf1102d5a5e48d29398c0aa
int socket_connect(SocketAddress *addr, Error **errp, NonBlockingConnectHandler *callback, void *opaque) { int fd; switch (addr->type) { case SOCKET_ADDRESS_KIND_INET: fd = inet_connect_saddr(addr->u.inet, errp, callback, opaque); break; case SOCKET_ADDRESS_KIND_UNIX: fd = unix_connect_saddr(addr->u.q_unix, errp, callback, opaque); break; case SOCKET_ADDRESS_KIND_FD: fd = monitor_get_fd(cur_mon, addr->u.fd->str, errp); if (fd >= 0 && callback) { qemu_set_nonblock(fd); callback(fd, NULL, opaque); } break; default: abort(); } return fd; }
{ "code": [], "line_no": [] }
int FUNC_0(SocketAddress *VAR_0, Error **VAR_1, NonBlockingConnectHandler *VAR_2, void *VAR_3) { int VAR_4; switch (VAR_0->type) { case SOCKET_ADDRESS_KIND_INET: VAR_4 = inet_connect_saddr(VAR_0->u.inet, VAR_1, VAR_2, VAR_3); break; case SOCKET_ADDRESS_KIND_UNIX: VAR_4 = unix_connect_saddr(VAR_0->u.q_unix, VAR_1, VAR_2, VAR_3); break; case SOCKET_ADDRESS_KIND_FD: VAR_4 = monitor_get_fd(cur_mon, VAR_0->u.VAR_4->str, VAR_1); if (VAR_4 >= 0 && VAR_2) { qemu_set_nonblock(VAR_4); VAR_2(VAR_4, NULL, VAR_3); } break; default: abort(); } return VAR_4; }
[ "int FUNC_0(SocketAddress *VAR_0, Error **VAR_1,\nNonBlockingConnectHandler *VAR_2, void *VAR_3)\n{", "int VAR_4;", "switch (VAR_0->type) {", "case SOCKET_ADDRESS_KIND_INET:\nVAR_4 = inet_connect_saddr(VAR_0->u.inet, VAR_1, VAR_2, VAR_3);", "break;", "case SOCKET_ADDRESS_KIND_UNIX:\nVAR_4 = unix_connect_s...
[ 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 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ] ]
26,910
static int process_ea_header(AVFormatContext *s) { uint32_t blockid, size = 0; EaDemuxContext *ea = s->priv_data; ByteIOContext *pb = &s->pb; blockid = get_le32(pb); if (blockid == MVhd_TAG) { size = get_le32(pb); process_video_header_vp6(s); url_fskip(pb, size-32); blockid = get_le32(pb); } if (blockid != SCHl_TAG) return 0; size += get_le32(pb); blockid = get_le32(pb); if (blockid == GSTR_TAG) { url_fskip(pb, 4); } else if (blockid != PT00_TAG) { av_log (s, AV_LOG_ERROR, "unknown SCHl headerid\n"); return 0; } process_audio_header_elements(s); /* skip to the start of the data */ url_fseek(pb, size, SEEK_SET); return 1; }
false
FFmpeg
f8cab062caacba2982a0d0bccd504b11c073caf6
static int process_ea_header(AVFormatContext *s) { uint32_t blockid, size = 0; EaDemuxContext *ea = s->priv_data; ByteIOContext *pb = &s->pb; blockid = get_le32(pb); if (blockid == MVhd_TAG) { size = get_le32(pb); process_video_header_vp6(s); url_fskip(pb, size-32); blockid = get_le32(pb); } if (blockid != SCHl_TAG) return 0; size += get_le32(pb); blockid = get_le32(pb); if (blockid == GSTR_TAG) { url_fskip(pb, 4); } else if (blockid != PT00_TAG) { av_log (s, AV_LOG_ERROR, "unknown SCHl headerid\n"); return 0; } process_audio_header_elements(s); url_fseek(pb, size, SEEK_SET); return 1; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0) { uint32_t blockid, size = 0; EaDemuxContext *ea = VAR_0->priv_data; ByteIOContext *pb = &VAR_0->pb; blockid = get_le32(pb); if (blockid == MVhd_TAG) { size = get_le32(pb); process_video_header_vp6(VAR_0); url_fskip(pb, size-32); blockid = get_le32(pb); } if (blockid != SCHl_TAG) return 0; size += get_le32(pb); blockid = get_le32(pb); if (blockid == GSTR_TAG) { url_fskip(pb, 4); } else if (blockid != PT00_TAG) { av_log (VAR_0, AV_LOG_ERROR, "unknown SCHl headerid\n"); return 0; } process_audio_header_elements(VAR_0); url_fseek(pb, size, SEEK_SET); return 1; }
[ "static int FUNC_0(AVFormatContext *VAR_0) {", "uint32_t blockid, size = 0;", "EaDemuxContext *ea = VAR_0->priv_data;", "ByteIOContext *pb = &VAR_0->pb;", "blockid = get_le32(pb);", "if (blockid == MVhd_TAG) {", "size = get_le32(pb);", "process_video_header_vp6(VAR_0);", "url_fskip(pb, size-32);", ...
[ 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 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43...
26,911
static void check_external_clock_sync(VideoState *is, double pts) { if (fabs(get_external_clock(is) - pts) > AV_NOSYNC_THRESHOLD) { update_external_clock_pts(is, pts); } }
false
FFmpeg
daece4c6745b42e8b1e171fb4bf485d5d64fc53f
static void check_external_clock_sync(VideoState *is, double pts) { if (fabs(get_external_clock(is) - pts) > AV_NOSYNC_THRESHOLD) { update_external_clock_pts(is, pts); } }
{ "code": [], "line_no": [] }
static void FUNC_0(VideoState *VAR_0, double VAR_1) { if (fabs(get_external_clock(VAR_0) - VAR_1) > AV_NOSYNC_THRESHOLD) { update_external_clock_pts(VAR_0, VAR_1); } }
[ "static void FUNC_0(VideoState *VAR_0, double VAR_1) {", "if (fabs(get_external_clock(VAR_0) - VAR_1) > AV_NOSYNC_THRESHOLD) {", "update_external_clock_pts(VAR_0, VAR_1);", "}", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ] ]
26,912
static int vhost_client_sync_dirty_bitmap(CPUPhysMemoryClient *client, target_phys_addr_t start_addr, target_phys_addr_t end_addr) { struct vhost_dev *dev = container_of(client, struct vhost_dev, client); int i; if (!dev->log_enabled || !dev->started) { return 0; } for (i = 0; i < dev->mem->nregions; ++i) { struct vhost_memory_region *reg = dev->mem->regions + i; vhost_dev_sync_region(dev, start_addr, end_addr, reg->guest_phys_addr, range_get_last(reg->guest_phys_addr, reg->memory_size)); } for (i = 0; i < dev->nvqs; ++i) { struct vhost_virtqueue *vq = dev->vqs + i; vhost_dev_sync_region(dev, start_addr, end_addr, vq->used_phys, range_get_last(vq->used_phys, vq->used_size)); } return 0; }
true
qemu
04097f7c5957273c578f72b9bd603ba6b1d69e33
static int vhost_client_sync_dirty_bitmap(CPUPhysMemoryClient *client, target_phys_addr_t start_addr, target_phys_addr_t end_addr) { struct vhost_dev *dev = container_of(client, struct vhost_dev, client); int i; if (!dev->log_enabled || !dev->started) { return 0; } for (i = 0; i < dev->mem->nregions; ++i) { struct vhost_memory_region *reg = dev->mem->regions + i; vhost_dev_sync_region(dev, start_addr, end_addr, reg->guest_phys_addr, range_get_last(reg->guest_phys_addr, reg->memory_size)); } for (i = 0; i < dev->nvqs; ++i) { struct vhost_virtqueue *vq = dev->vqs + i; vhost_dev_sync_region(dev, start_addr, end_addr, vq->used_phys, range_get_last(vq->used_phys, vq->used_size)); } return 0; }
{ "code": [ "static int vhost_client_sync_dirty_bitmap(CPUPhysMemoryClient *client,", " target_phys_addr_t start_addr,", " target_phys_addr_t end_addr)", " struct vhost_dev *dev = container_of(client, struct vhost_dev, client);", " struct vhost_dev *dev = container_of(client, struct vhost_dev, client);", " struct vhost_dev *dev = container_of(client, struct vhost_dev, client);" ], "line_no": [ 1, 3, 5, 9, 9, 9 ] }
static int FUNC_0(CPUPhysMemoryClient *VAR_0, target_phys_addr_t VAR_1, target_phys_addr_t VAR_2) { struct vhost_dev *VAR_3 = container_of(VAR_0, struct vhost_dev, VAR_0); int VAR_4; if (!VAR_3->log_enabled || !VAR_3->started) { return 0; } for (VAR_4 = 0; VAR_4 < VAR_3->mem->nregions; ++VAR_4) { struct vhost_memory_region *VAR_5 = VAR_3->mem->regions + VAR_4; vhost_dev_sync_region(VAR_3, VAR_1, VAR_2, VAR_5->guest_phys_addr, range_get_last(VAR_5->guest_phys_addr, VAR_5->memory_size)); } for (VAR_4 = 0; VAR_4 < VAR_3->nvqs; ++VAR_4) { struct vhost_virtqueue *VAR_6 = VAR_3->vqs + VAR_4; vhost_dev_sync_region(VAR_3, VAR_1, VAR_2, VAR_6->used_phys, range_get_last(VAR_6->used_phys, VAR_6->used_size)); } return 0; }
[ "static int FUNC_0(CPUPhysMemoryClient *VAR_0,\ntarget_phys_addr_t VAR_1,\ntarget_phys_addr_t VAR_2)\n{", "struct vhost_dev *VAR_3 = container_of(VAR_0, struct vhost_dev, VAR_0);", "int VAR_4;", "if (!VAR_3->log_enabled || !VAR_3->started) {", "return 0;", "}", "for (VAR_4 = 0; VAR_4 < VAR_3->mem->nregi...
[ 1, 1, 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 ] ]
26,913
static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) { AVStream *st = c->fc->streams[c->fc->nb_streams-1]; MOVStreamContext *sc = (MOVStreamContext *)st->priv_data; int entries, frames_per_sample; uint32_t format; print_atom("stsd", atom); get_byte(pb); /* version */ get_byte(pb); get_byte(pb); get_byte(pb); /* flags */ entries = get_be32(pb); while(entries--) { enum CodecID id; int size = get_be32(pb); /* size */ format = get_le32(pb); /* data format */ get_be32(pb); /* reserved */ get_be16(pb); /* reserved */ get_be16(pb); /* index */ /* for MPEG4: set codec type by looking for it */ id = codec_get_id(mov_video_tags, format); if (id >= 0) { AVCodec *codec; codec = avcodec_find_decoder(id); if (codec) st->codec.codec_type = codec->type; } #ifdef DEBUG printf("size=%d 4CC= %c%c%c%c codec_type=%d\n", size, (format >> 0) & 0xff, (format >> 8) & 0xff, (format >> 16) & 0xff, (format >> 24) & 0xff, st->codec.codec_type); #endif st->codec.codec_tag = format; if(st->codec.codec_type==CODEC_TYPE_VIDEO) { MOV_atom_t a = { 0, 0, 0 }; st->codec.codec_id = id; get_be16(pb); /* version */ get_be16(pb); /* revision level */ get_be32(pb); /* vendor */ get_be32(pb); /* temporal quality */ get_be32(pb); /* spacial quality */ st->codec.width = get_be16(pb); /* width */ st->codec.height = get_be16(pb); /* height */ #if 1 if (st->codec.codec_id == CODEC_ID_MPEG4) { /* in some MPEG4 the width/height are not correct, so we ignore this info */ st->codec.width = 0; st->codec.height = 0; } #endif get_be32(pb); /* horiz resolution */ get_be32(pb); /* vert resolution */ get_be32(pb); /* data size, always 0 */ frames_per_sample = get_be16(pb); /* frames per samples */ #ifdef DEBUG printf("frames/samples = %d\n", frames_per_sample); #endif get_buffer(pb, (uint8_t *)st->codec.codec_name, 32); /* codec name */ st->codec.bits_per_sample = get_be16(pb); /* depth */ st->codec.color_table_id = get_be16(pb); /* colortable id */ st->codec.frame_rate = 25; st->codec.frame_rate_base = 1; size -= (16+8*4+2+32+2*2); #if 0 while (size >= 8) { MOV_atom_t a; int64_t start_pos; a.size = get_be32(pb); a.type = get_le32(pb); size -= 8; #ifdef DEBUG printf("VIDEO: atom_type=%c%c%c%c atom.size=%Ld size_left=%d\n", (a.type >> 0) & 0xff, (a.type >> 8) & 0xff, (a.type >> 16) & 0xff, (a.type >> 24) & 0xff, a.size, size); #endif start_pos = url_ftell(pb); switch(a.type) { case MKTAG('e', 's', 'd', 's'): { int tag, len; /* Well, broken but suffisant for some MP4 streams */ get_be32(pb); /* version + flags */ len = mov_mp4_read_descr(pb, &tag); if (tag == 0x03) { /* MP4ESDescrTag */ get_be16(pb); /* ID */ get_byte(pb); /* priority */ len = mov_mp4_read_descr(pb, &tag); if (tag != 0x04) goto fail; /* MP4DecConfigDescrTag */ get_byte(pb); /* objectTypeId */ get_be32(pb); /* streamType + buffer size */ get_be32(pb); /* max bit rate */ get_be32(pb); /* avg bit rate */ len = mp4_read_descr(pb, &tag); if (tag != 0x05) goto fail; /* MP4DecSpecificDescrTag */ #ifdef DEBUG printf("Specific MPEG4 header len=%d\n", len); #endif sc->header_data = av_mallocz(len); if (sc->header_data) { get_buffer(pb, sc->header_data, len); sc->header_len = len; } } /* in any case, skip garbage */ } break; default: break; } fail: printf("ATOMENEWSIZE %Ld %d\n", atom.size, url_ftell(pb) - start_pos); if (atom.size > 8) { url_fskip(pb, (atom.size - 8) - ((url_ftell(pb) - start_pos))); size -= atom.size - 8; } } if (size > 0) { /* unknown extension */ url_fskip(pb, size); } #else a.size = size; mov_read_default(c, pb, a); #endif } else { get_be16(pb); /* version */ get_be16(pb); /* revision level */ get_be32(pb); /* vendor */ st->codec.channels = get_be16(pb); /* channel count */ st->codec.bits_per_sample = get_be16(pb); /* sample size */ st->codec.codec_id = codec_get_id(mov_audio_tags, format); /* handle specific s8 codec */ get_be16(pb); /* compression id = 0*/ get_be16(pb); /* packet size = 0 */ st->codec.sample_rate = ((get_be32(pb) >> 16)); //printf("CODECID %d %d %.4s\n", st->codec.codec_id, CODEC_ID_PCM_S16BE, (char*)&format); switch (st->codec.codec_id) { case CODEC_ID_PCM_S16BE: if (st->codec.bits_per_sample == 8) st->codec.codec_id = CODEC_ID_PCM_S8; /* fall */ case CODEC_ID_PCM_U8: st->codec.bit_rate = st->codec.sample_rate * 8; break; default: ; } get_be32(pb); /* samples per packet */ get_be32(pb); /* bytes per packet */ get_be32(pb); /* bytes per frame */ get_be32(pb); /* bytes per sample */ { MOV_atom_t a = { format, url_ftell(pb), size - (16 + 20 + 16 + 8) }; mov_read_default(c, pb, a); } } } return 0; }
true
FFmpeg
fd6e513ee1dc13174256de8adaeeb2c2691eee95
static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) { AVStream *st = c->fc->streams[c->fc->nb_streams-1]; MOVStreamContext *sc = (MOVStreamContext *)st->priv_data; int entries, frames_per_sample; uint32_t format; print_atom("stsd", atom); get_byte(pb); get_byte(pb); get_byte(pb); get_byte(pb); entries = get_be32(pb); while(entries--) { enum CodecID id; int size = get_be32(pb); format = get_le32(pb); get_be32(pb); get_be16(pb); get_be16(pb); id = codec_get_id(mov_video_tags, format); if (id >= 0) { AVCodec *codec; codec = avcodec_find_decoder(id); if (codec) st->codec.codec_type = codec->type; } #ifdef DEBUG printf("size=%d 4CC= %c%c%c%c codec_type=%d\n", size, (format >> 0) & 0xff, (format >> 8) & 0xff, (format >> 16) & 0xff, (format >> 24) & 0xff, st->codec.codec_type); #endif st->codec.codec_tag = format; if(st->codec.codec_type==CODEC_TYPE_VIDEO) { MOV_atom_t a = { 0, 0, 0 }; st->codec.codec_id = id; get_be16(pb); get_be16(pb); get_be32(pb); get_be32(pb); get_be32(pb); st->codec.width = get_be16(pb); st->codec.height = get_be16(pb); #if 1 if (st->codec.codec_id == CODEC_ID_MPEG4) { st->codec.width = 0; st->codec.height = 0; } #endif get_be32(pb); get_be32(pb); get_be32(pb); frames_per_sample = get_be16(pb); #ifdef DEBUG printf("frames/samples = %d\n", frames_per_sample); #endif get_buffer(pb, (uint8_t *)st->codec.codec_name, 32); st->codec.bits_per_sample = get_be16(pb); st->codec.color_table_id = get_be16(pb); st->codec.frame_rate = 25; st->codec.frame_rate_base = 1; size -= (16+8*4+2+32+2*2); #if 0 while (size >= 8) { MOV_atom_t a; int64_t start_pos; a.size = get_be32(pb); a.type = get_le32(pb); size -= 8; #ifdef DEBUG printf("VIDEO: atom_type=%c%c%c%c atom.size=%Ld size_left=%d\n", (a.type >> 0) & 0xff, (a.type >> 8) & 0xff, (a.type >> 16) & 0xff, (a.type >> 24) & 0xff, a.size, size); #endif start_pos = url_ftell(pb); switch(a.type) { case MKTAG('e', 's', 'd', 's'): { int tag, len; get_be32(pb); len = mov_mp4_read_descr(pb, &tag); if (tag == 0x03) { get_be16(pb); get_byte(pb); len = mov_mp4_read_descr(pb, &tag); if (tag != 0x04) goto fail; get_byte(pb); get_be32(pb); get_be32(pb); get_be32(pb); len = mp4_read_descr(pb, &tag); if (tag != 0x05) goto fail; #ifdef DEBUG printf("Specific MPEG4 header len=%d\n", len); #endif sc->header_data = av_mallocz(len); if (sc->header_data) { get_buffer(pb, sc->header_data, len); sc->header_len = len; } } } break; default: break; } fail: printf("ATOMENEWSIZE %Ld %d\n", atom.size, url_ftell(pb) - start_pos); if (atom.size > 8) { url_fskip(pb, (atom.size - 8) - ((url_ftell(pb) - start_pos))); size -= atom.size - 8; } } if (size > 0) { url_fskip(pb, size); } #else a.size = size; mov_read_default(c, pb, a); #endif } else { get_be16(pb); get_be16(pb); get_be32(pb); st->codec.channels = get_be16(pb); st->codec.bits_per_sample = get_be16(pb); st->codec.codec_id = codec_get_id(mov_audio_tags, format); get_be16(pb); get_be16(pb); st->codec.sample_rate = ((get_be32(pb) >> 16)); switch (st->codec.codec_id) { case CODEC_ID_PCM_S16BE: if (st->codec.bits_per_sample == 8) st->codec.codec_id = CODEC_ID_PCM_S8; case CODEC_ID_PCM_U8: st->codec.bit_rate = st->codec.sample_rate * 8; break; default: ; } get_be32(pb); get_be32(pb); get_be32(pb); get_be32(pb); { MOV_atom_t a = { format, url_ftell(pb), size - (16 + 20 + 16 + 8) }; mov_read_default(c, pb, a); } } } return 0; }
{ "code": [ " AVStream *st = c->fc->streams[c->fc->nb_streams-1];", " MOVStreamContext *sc = (MOVStreamContext *)st->priv_data;", " MOVStreamContext *sc = (MOVStreamContext *)st->priv_data;" ], "line_no": [ 5, 7, 7 ] }
static int FUNC_0(MOVContext *VAR_0, ByteIOContext *VAR_1, MOV_atom_t VAR_2) { AVStream *st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1]; MOVStreamContext *sc = (MOVStreamContext *)st->priv_data; int VAR_3, VAR_4; uint32_t format; print_atom("stsd", VAR_2); get_byte(VAR_1); get_byte(VAR_1); get_byte(VAR_1); get_byte(VAR_1); VAR_3 = get_be32(VAR_1); while(VAR_3--) { enum CodecID VAR_5; int VAR_6 = get_be32(VAR_1); format = get_le32(VAR_1); get_be32(VAR_1); get_be16(VAR_1); get_be16(VAR_1); VAR_5 = codec_get_id(mov_video_tags, format); if (VAR_5 >= 0) { AVCodec *codec; codec = avcodec_find_decoder(VAR_5); if (codec) st->codec.codec_type = codec->type; } #ifdef DEBUG printf("VAR_6=%d 4CC= %VAR_0%VAR_0%VAR_0%VAR_0 codec_type=%d\n", VAR_6, (format >> 0) & 0xff, (format >> 8) & 0xff, (format >> 16) & 0xff, (format >> 24) & 0xff, st->codec.codec_type); #endif st->codec.codec_tag = format; if(st->codec.codec_type==CODEC_TYPE_VIDEO) { MOV_atom_t a = { 0, 0, 0 }; st->codec.codec_id = VAR_5; get_be16(VAR_1); get_be16(VAR_1); get_be32(VAR_1); get_be32(VAR_1); get_be32(VAR_1); st->codec.width = get_be16(VAR_1); st->codec.height = get_be16(VAR_1); #if 1 if (st->codec.codec_id == CODEC_ID_MPEG4) { st->codec.width = 0; st->codec.height = 0; } #endif get_be32(VAR_1); get_be32(VAR_1); get_be32(VAR_1); VAR_4 = get_be16(VAR_1); #ifdef DEBUG printf("frames/samples = %d\n", VAR_4); #endif get_buffer(VAR_1, (uint8_t *)st->codec.codec_name, 32); st->codec.bits_per_sample = get_be16(VAR_1); st->codec.color_table_id = get_be16(VAR_1); st->codec.frame_rate = 25; st->codec.frame_rate_base = 1; VAR_6 -= (16+8*4+2+32+2*2); #if 0 while (VAR_6 >= 8) { MOV_atom_t a; int64_t start_pos; a.VAR_6 = get_be32(VAR_1); a.type = get_le32(VAR_1); VAR_6 -= 8; #ifdef DEBUG printf("VIDEO: atom_type=%VAR_0%VAR_0%VAR_0%VAR_0 VAR_2.VAR_6=%Ld size_left=%d\n", (a.type >> 0) & 0xff, (a.type >> 8) & 0xff, (a.type >> 16) & 0xff, (a.type >> 24) & 0xff, a.VAR_6, VAR_6); #endif start_pos = url_ftell(VAR_1); switch(a.type) { case MKTAG('e', 's', 'd', 's'): { int tag, len; get_be32(VAR_1); len = mov_mp4_read_descr(VAR_1, &tag); if (tag == 0x03) { get_be16(VAR_1); get_byte(VAR_1); len = mov_mp4_read_descr(VAR_1, &tag); if (tag != 0x04) goto fail; get_byte(VAR_1); get_be32(VAR_1); get_be32(VAR_1); get_be32(VAR_1); len = mp4_read_descr(VAR_1, &tag); if (tag != 0x05) goto fail; #ifdef DEBUG printf("Specific MPEG4 header len=%d\n", len); #endif sc->header_data = av_mallocz(len); if (sc->header_data) { get_buffer(VAR_1, sc->header_data, len); sc->header_len = len; } } } break; default: break; } fail: printf("ATOMENEWSIZE %Ld %d\n", VAR_2.VAR_6, url_ftell(VAR_1) - start_pos); if (VAR_2.VAR_6 > 8) { url_fskip(VAR_1, (VAR_2.VAR_6 - 8) - ((url_ftell(VAR_1) - start_pos))); VAR_6 -= VAR_2.VAR_6 - 8; } } if (VAR_6 > 0) { url_fskip(VAR_1, VAR_6); } #else a.VAR_6 = VAR_6; mov_read_default(VAR_0, VAR_1, a); #endif } else { get_be16(VAR_1); get_be16(VAR_1); get_be32(VAR_1); st->codec.channels = get_be16(VAR_1); st->codec.bits_per_sample = get_be16(VAR_1); st->codec.codec_id = codec_get_id(mov_audio_tags, format); get_be16(VAR_1); get_be16(VAR_1); st->codec.sample_rate = ((get_be32(VAR_1) >> 16)); switch (st->codec.codec_id) { case CODEC_ID_PCM_S16BE: if (st->codec.bits_per_sample == 8) st->codec.codec_id = CODEC_ID_PCM_S8; case CODEC_ID_PCM_U8: st->codec.bit_rate = st->codec.sample_rate * 8; break; default: ; } get_be32(VAR_1); get_be32(VAR_1); get_be32(VAR_1); get_be32(VAR_1); { MOV_atom_t a = { format, url_ftell(VAR_1), VAR_6 - (16 + 20 + 16 + 8) }; mov_read_default(VAR_0, VAR_1, a); } } } return 0; }
[ "static int FUNC_0(MOVContext *VAR_0, ByteIOContext *VAR_1, MOV_atom_t VAR_2)\n{", "AVStream *st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1];", "MOVStreamContext *sc = (MOVStreamContext *)st->priv_data;", "int VAR_3, VAR_4;", "uint32_t format;", "print_atom(\"stsd\", VAR_2);", "get_byte(VAR_1);", "g...
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ...
26,914
void scsi_req_free(SCSIRequest *req) { scsi_req_dequeue(req); qemu_free(req); }
true
qemu
ad2d30f79d3b0812f02c741be2189796b788d6d7
void scsi_req_free(SCSIRequest *req) { scsi_req_dequeue(req); qemu_free(req); }
{ "code": [ "void scsi_req_free(SCSIRequest *req)", " scsi_req_dequeue(req);", " qemu_free(req);" ], "line_no": [ 1, 5, 7 ] }
void FUNC_0(SCSIRequest *VAR_0) { scsi_req_dequeue(VAR_0); qemu_free(VAR_0); }
[ "void FUNC_0(SCSIRequest *VAR_0)\n{", "scsi_req_dequeue(VAR_0);", "qemu_free(VAR_0);", "}" ]
[ 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
26,915
void qpci_memwrite(QPCIDevice *dev, void *data, const void *buf, size_t len) { uintptr_t addr = (uintptr_t)data; g_assert(addr >= QPCI_PIO_LIMIT); dev->bus->memwrite(dev->bus, addr, buf, len); }
true
qemu
b4ba67d9a702507793c2724e56f98e9b0f7be02b
void qpci_memwrite(QPCIDevice *dev, void *data, const void *buf, size_t len) { uintptr_t addr = (uintptr_t)data; g_assert(addr >= QPCI_PIO_LIMIT); dev->bus->memwrite(dev->bus, addr, buf, len); }
{ "code": [ " uintptr_t addr = (uintptr_t)data;", " uintptr_t addr = (uintptr_t)data;", " uintptr_t addr = (uintptr_t)data;", " uintptr_t addr = (uintptr_t)data;", " uintptr_t addr = (uintptr_t)data;", " uintptr_t addr = (uintptr_t)data;", " uintptr_t addr = (uintptr_t)data;", " uintptr_t addr = (uintptr_t)data;", " uintptr_t addr = (uintptr_t)data;", " g_assert(addr >= QPCI_PIO_LIMIT);", "void qpci_memwrite(QPCIDevice *dev, void *data, const void *buf, size_t len)", " uintptr_t addr = (uintptr_t)data;", " g_assert(addr >= QPCI_PIO_LIMIT);", " dev->bus->memwrite(dev->bus, addr, buf, len);" ], "line_no": [ 5, 5, 5, 5, 5, 5, 5, 5, 5, 9, 1, 5, 9, 11 ] }
void FUNC_0(QPCIDevice *VAR_0, void *VAR_1, const void *VAR_2, size_t VAR_3) { uintptr_t addr = (uintptr_t)VAR_1; g_assert(addr >= QPCI_PIO_LIMIT); VAR_0->bus->memwrite(VAR_0->bus, addr, VAR_2, VAR_3); }
[ "void FUNC_0(QPCIDevice *VAR_0, void *VAR_1, const void *VAR_2, size_t VAR_3)\n{", "uintptr_t addr = (uintptr_t)VAR_1;", "g_assert(addr >= QPCI_PIO_LIMIT);", "VAR_0->bus->memwrite(VAR_0->bus, addr, VAR_2, VAR_3);", "}" ]
[ 1, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ] ]
26,916
e1000e_init_msi(E1000EState *s) { int res; res = msi_init(PCI_DEVICE(s), 0xD0, /* MSI capability offset */ 1, /* MAC MSI interrupts */ true, /* 64-bit message addresses supported */ false); /* Per vector mask supported */ if (res > 0) { s->intr_state |= E1000E_USE_MSI; } else { trace_e1000e_msi_init_fail(res); } }
true
qemu
1108b2f8a939fb5778d384149e2f1b99062a72da
e1000e_init_msi(E1000EState *s) { int res; res = msi_init(PCI_DEVICE(s), 0xD0, 1, true, false); if (res > 0) { s->intr_state |= E1000E_USE_MSI; } else { trace_e1000e_msi_init_fail(res); } }
{ "code": [ " res = msi_init(PCI_DEVICE(s),", " if (res > 0) {", " int res;", " } else {" ], "line_no": [ 9, 21, 5, 25 ] }
FUNC_0(E1000EState *VAR_0) { int VAR_1; VAR_1 = msi_init(PCI_DEVICE(VAR_0), 0xD0, 1, true, false); if (VAR_1 > 0) { VAR_0->intr_state |= E1000E_USE_MSI; } else { trace_e1000e_msi_init_fail(VAR_1); } }
[ "FUNC_0(E1000EState *VAR_0)\n{", "int VAR_1;", "VAR_1 = msi_init(PCI_DEVICE(VAR_0),\n0xD0,\n1,\ntrue,\nfalse);", "if (VAR_1 > 0) {", "VAR_0->intr_state |= E1000E_USE_MSI;", "} else {", "trace_e1000e_msi_init_fail(VAR_1);", "}", "}" ]
[ 0, 1, 1, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11, 13, 15, 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ] ]
26,917
int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type, uint8_t *data, size_t size) { int elems = pkt->side_data_elems; if ((unsigned)elems + 1 > INT_MAX / sizeof(*pkt->side_data)) return AVERROR(ERANGE); pkt->side_data = av_realloc(pkt->side_data, (elems + 1) * sizeof(*pkt->side_data)); if (!pkt->side_data) return AVERROR(ENOMEM); pkt->side_data[elems].data = data; pkt->side_data[elems].size = size; pkt->side_data[elems].type = type; pkt->side_data_elems++; return 0; }
true
FFmpeg
574929d8b6de32ae712fcca7ab09f01a3e4616be
int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type, uint8_t *data, size_t size) { int elems = pkt->side_data_elems; if ((unsigned)elems + 1 > INT_MAX / sizeof(*pkt->side_data)) return AVERROR(ERANGE); pkt->side_data = av_realloc(pkt->side_data, (elems + 1) * sizeof(*pkt->side_data)); if (!pkt->side_data) return AVERROR(ENOMEM); pkt->side_data[elems].data = data; pkt->side_data[elems].size = size; pkt->side_data[elems].type = type; pkt->side_data_elems++; return 0; }
{ "code": [ " pkt->side_data = av_realloc(pkt->side_data,", " (elems + 1) * sizeof(*pkt->side_data));", " if (!pkt->side_data)" ], "line_no": [ 17, 19, 21 ] }
int FUNC_0(AVPacket *VAR_0, enum AVPacketSideDataType VAR_1, uint8_t *VAR_2, size_t VAR_3) { int VAR_4 = VAR_0->side_data_elems; if ((unsigned)VAR_4 + 1 > INT_MAX / sizeof(*VAR_0->side_data)) return AVERROR(ERANGE); VAR_0->side_data = av_realloc(VAR_0->side_data, (VAR_4 + 1) * sizeof(*VAR_0->side_data)); if (!VAR_0->side_data) return AVERROR(ENOMEM); VAR_0->side_data[VAR_4].VAR_2 = VAR_2; VAR_0->side_data[VAR_4].VAR_3 = VAR_3; VAR_0->side_data[VAR_4].VAR_1 = VAR_1; VAR_0->side_data_elems++; return 0; }
[ "int FUNC_0(AVPacket *VAR_0, enum AVPacketSideDataType VAR_1,\nuint8_t *VAR_2, size_t VAR_3)\n{", "int VAR_4 = VAR_0->side_data_elems;", "if ((unsigned)VAR_4 + 1 > INT_MAX / sizeof(*VAR_0->side_data))\nreturn AVERROR(ERANGE);", "VAR_0->side_data = av_realloc(VAR_0->side_data,\n(VAR_4 + 1) * sizeof(*VAR_0->sid...
[ 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11, 13 ], [ 17, 19 ], [ 21, 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ] ]
26,918
static coroutine_fn int qcow_co_readv(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *qiov) { BDRVQcowState *s = bs->opaque; int index_in_cluster; int ret = 0, n; uint64_t cluster_offset; struct iovec hd_iov; QEMUIOVector hd_qiov; uint8_t *buf; void *orig_buf; if (qiov->niov > 1) { buf = orig_buf = qemu_try_blockalign(bs, qiov->size); if (buf == NULL) { return -ENOMEM; } } else { orig_buf = NULL; buf = (uint8_t *)qiov->iov->iov_base; } qemu_co_mutex_lock(&s->lock); while (nb_sectors != 0) { /* prepare next request */ cluster_offset = get_cluster_offset(bs, sector_num << 9, 0, 0, 0, 0); index_in_cluster = sector_num & (s->cluster_sectors - 1); n = s->cluster_sectors - index_in_cluster; if (n > nb_sectors) { n = nb_sectors; } if (!cluster_offset) { if (bs->backing) { /* read from the base image */ hd_iov.iov_base = (void *)buf; hd_iov.iov_len = n * 512; qemu_iovec_init_external(&hd_qiov, &hd_iov, 1); qemu_co_mutex_unlock(&s->lock); ret = bdrv_co_readv(bs->backing, sector_num, n, &hd_qiov); qemu_co_mutex_lock(&s->lock); if (ret < 0) { goto fail; } } else { /* Note: in this case, no need to wait */ memset(buf, 0, 512 * n); } } else if (cluster_offset & QCOW_OFLAG_COMPRESSED) { /* add AIO support for compressed blocks ? */ if (decompress_cluster(bs, cluster_offset) < 0) { goto fail; } memcpy(buf, s->cluster_cache + index_in_cluster * 512, 512 * n); } else { if ((cluster_offset & 511) != 0) { goto fail; } hd_iov.iov_base = (void *)buf; hd_iov.iov_len = n * 512; qemu_iovec_init_external(&hd_qiov, &hd_iov, 1); qemu_co_mutex_unlock(&s->lock); ret = bdrv_co_readv(bs->file, (cluster_offset >> 9) + index_in_cluster, n, &hd_qiov); qemu_co_mutex_lock(&s->lock); if (ret < 0) { break; } if (bs->encrypted) { assert(s->crypto); if (qcrypto_block_decrypt(s->crypto, sector_num, buf, n * BDRV_SECTOR_SIZE, NULL) < 0) { goto fail; } } } ret = 0; nb_sectors -= n; sector_num += n; buf += n * 512; } done: qemu_co_mutex_unlock(&s->lock); if (qiov->niov > 1) { qemu_iovec_from_buf(qiov, 0, orig_buf, qiov->size); qemu_vfree(orig_buf); } return ret; fail: ret = -EIO; goto done; }
true
qemu
56439e9d55626b65ecb887f1ac3714652555312e
static coroutine_fn int qcow_co_readv(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *qiov) { BDRVQcowState *s = bs->opaque; int index_in_cluster; int ret = 0, n; uint64_t cluster_offset; struct iovec hd_iov; QEMUIOVector hd_qiov; uint8_t *buf; void *orig_buf; if (qiov->niov > 1) { buf = orig_buf = qemu_try_blockalign(bs, qiov->size); if (buf == NULL) { return -ENOMEM; } } else { orig_buf = NULL; buf = (uint8_t *)qiov->iov->iov_base; } qemu_co_mutex_lock(&s->lock); while (nb_sectors != 0) { cluster_offset = get_cluster_offset(bs, sector_num << 9, 0, 0, 0, 0); index_in_cluster = sector_num & (s->cluster_sectors - 1); n = s->cluster_sectors - index_in_cluster; if (n > nb_sectors) { n = nb_sectors; } if (!cluster_offset) { if (bs->backing) { hd_iov.iov_base = (void *)buf; hd_iov.iov_len = n * 512; qemu_iovec_init_external(&hd_qiov, &hd_iov, 1); qemu_co_mutex_unlock(&s->lock); ret = bdrv_co_readv(bs->backing, sector_num, n, &hd_qiov); qemu_co_mutex_lock(&s->lock); if (ret < 0) { goto fail; } } else { memset(buf, 0, 512 * n); } } else if (cluster_offset & QCOW_OFLAG_COMPRESSED) { if (decompress_cluster(bs, cluster_offset) < 0) { goto fail; } memcpy(buf, s->cluster_cache + index_in_cluster * 512, 512 * n); } else { if ((cluster_offset & 511) != 0) { goto fail; } hd_iov.iov_base = (void *)buf; hd_iov.iov_len = n * 512; qemu_iovec_init_external(&hd_qiov, &hd_iov, 1); qemu_co_mutex_unlock(&s->lock); ret = bdrv_co_readv(bs->file, (cluster_offset >> 9) + index_in_cluster, n, &hd_qiov); qemu_co_mutex_lock(&s->lock); if (ret < 0) { break; } if (bs->encrypted) { assert(s->crypto); if (qcrypto_block_decrypt(s->crypto, sector_num, buf, n * BDRV_SECTOR_SIZE, NULL) < 0) { goto fail; } } } ret = 0; nb_sectors -= n; sector_num += n; buf += n * 512; } done: qemu_co_mutex_unlock(&s->lock); if (qiov->niov > 1) { qemu_iovec_from_buf(qiov, 0, orig_buf, qiov->size); qemu_vfree(orig_buf); } return ret; fail: ret = -EIO; goto done; }
{ "code": [ " cluster_offset = get_cluster_offset(bs, sector_num << 9,", " 0, 0, 0, 0);", " goto fail;", " goto fail;", " goto fail;", " goto fail;", "done:", "fail:", " ret = -EIO;", " goto done;" ], "line_no": [ 53, 55, 89, 107, 107, 89, 175, 195, 197, 199 ] }
static coroutine_fn int FUNC_0(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *qiov) { BDRVQcowState *s = bs->opaque; int VAR_0; int VAR_1 = 0, VAR_2; uint64_t cluster_offset; struct iovec VAR_3; QEMUIOVector hd_qiov; uint8_t *buf; void *VAR_4; if (qiov->niov > 1) { buf = VAR_4 = qemu_try_blockalign(bs, qiov->size); if (buf == NULL) { return -ENOMEM; } } else { VAR_4 = NULL; buf = (uint8_t *)qiov->iov->iov_base; } qemu_co_mutex_lock(&s->lock); while (nb_sectors != 0) { cluster_offset = get_cluster_offset(bs, sector_num << 9, 0, 0, 0, 0); VAR_0 = sector_num & (s->cluster_sectors - 1); VAR_2 = s->cluster_sectors - VAR_0; if (VAR_2 > nb_sectors) { VAR_2 = nb_sectors; } if (!cluster_offset) { if (bs->backing) { VAR_3.iov_base = (void *)buf; VAR_3.iov_len = VAR_2 * 512; qemu_iovec_init_external(&hd_qiov, &VAR_3, 1); qemu_co_mutex_unlock(&s->lock); VAR_1 = bdrv_co_readv(bs->backing, sector_num, VAR_2, &hd_qiov); qemu_co_mutex_lock(&s->lock); if (VAR_1 < 0) { goto fail; } } else { memset(buf, 0, 512 * VAR_2); } } else if (cluster_offset & QCOW_OFLAG_COMPRESSED) { if (decompress_cluster(bs, cluster_offset) < 0) { goto fail; } memcpy(buf, s->cluster_cache + VAR_0 * 512, 512 * VAR_2); } else { if ((cluster_offset & 511) != 0) { goto fail; } VAR_3.iov_base = (void *)buf; VAR_3.iov_len = VAR_2 * 512; qemu_iovec_init_external(&hd_qiov, &VAR_3, 1); qemu_co_mutex_unlock(&s->lock); VAR_1 = bdrv_co_readv(bs->file, (cluster_offset >> 9) + VAR_0, VAR_2, &hd_qiov); qemu_co_mutex_lock(&s->lock); if (VAR_1 < 0) { break; } if (bs->encrypted) { assert(s->crypto); if (qcrypto_block_decrypt(s->crypto, sector_num, buf, VAR_2 * BDRV_SECTOR_SIZE, NULL) < 0) { goto fail; } } } VAR_1 = 0; nb_sectors -= VAR_2; sector_num += VAR_2; buf += VAR_2 * 512; } done: qemu_co_mutex_unlock(&s->lock); if (qiov->niov > 1) { qemu_iovec_from_buf(qiov, 0, VAR_4, qiov->size); qemu_vfree(VAR_4); } return VAR_1; fail: VAR_1 = -EIO; goto done; }
[ "static coroutine_fn int FUNC_0(BlockDriverState *bs, int64_t sector_num,\nint nb_sectors, QEMUIOVector *qiov)\n{", "BDRVQcowState *s = bs->opaque;", "int VAR_0;", "int VAR_1 = 0, VAR_2;", "uint64_t cluster_offset;", "struct iovec VAR_3;", "QEMUIOVector hd_qiov;", "uint8_t *buf;", "void *VAR_4;", ...
[ 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, 1, 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 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [...
26,919
static inline I2CBus *aux_bridge_get_i2c_bus(AUXTOI2CState *bridge) { return bridge->i2c_bus; }
true
qemu
e0dadc1e9ef1f35208e5d2af9c7740c18a0b769f
static inline I2CBus *aux_bridge_get_i2c_bus(AUXTOI2CState *bridge) { return bridge->i2c_bus; }
{ "code": [], "line_no": [] }
static inline I2CBus *FUNC_0(AUXTOI2CState *bridge) { return bridge->i2c_bus; }
[ "static inline I2CBus *FUNC_0(AUXTOI2CState *bridge)\n{", "return bridge->i2c_bus;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
26,920
static int usb_host_auto_scan(void *opaque, int bus_num, int addr, int class_id, int vendor_id, int product_id, const char *product_name, int speed) { struct USBAutoFilter *f; struct USBDevice *dev; /* Ignore hubs */ if (class_id == 9) return 0; for (f = usb_auto_filter; f; f = f->next) { if (f->bus_num >= 0 && f->bus_num != bus_num) continue; if (f->addr >= 0 && f->addr != addr) continue; if (f->vendor_id >= 0 && f->vendor_id != vendor_id) continue; if (f->product_id >= 0 && f->product_id != product_id) continue; /* We got a match */ /* Allredy attached ? */ if (hostdev_find(bus_num, addr)) return 0; dprintf("husb: auto open: bus_num %d addr %d\n", bus_num, addr); dev = usb_host_device_open_addr(bus_num, addr, product_name); } return 0; }
true
qemu
33e66b86d89040f0a9e99aa53deb74ce8936a649
static int usb_host_auto_scan(void *opaque, int bus_num, int addr, int class_id, int vendor_id, int product_id, const char *product_name, int speed) { struct USBAutoFilter *f; struct USBDevice *dev; if (class_id == 9) return 0; for (f = usb_auto_filter; f; f = f->next) { if (f->bus_num >= 0 && f->bus_num != bus_num) continue; if (f->addr >= 0 && f->addr != addr) continue; if (f->vendor_id >= 0 && f->vendor_id != vendor_id) continue; if (f->product_id >= 0 && f->product_id != product_id) continue; if (hostdev_find(bus_num, addr)) return 0; dprintf("husb: auto open: bus_num %d addr %d\n", bus_num, addr); dev = usb_host_device_open_addr(bus_num, addr, product_name); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(void *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5, const char *VAR_6, int VAR_7) { struct USBAutoFilter *VAR_8; struct USBDevice *VAR_9; if (VAR_3 == 9) return 0; for (VAR_8 = usb_auto_filter; VAR_8; VAR_8 = VAR_8->next) { if (VAR_8->VAR_1 >= 0 && VAR_8->VAR_1 != VAR_1) continue; if (VAR_8->VAR_2 >= 0 && VAR_8->VAR_2 != VAR_2) continue; if (VAR_8->VAR_4 >= 0 && VAR_8->VAR_4 != VAR_4) continue; if (VAR_8->VAR_5 >= 0 && VAR_8->VAR_5 != VAR_5) continue; if (hostdev_find(VAR_1, VAR_2)) return 0; dprintf("husb: auto open: VAR_1 %d VAR_2 %d\n", VAR_1, VAR_2); VAR_9 = usb_host_device_open_addr(VAR_1, VAR_2, VAR_6); } return 0; }
[ "static int FUNC_0(void *VAR_0, int VAR_1, int VAR_2,\nint VAR_3, int VAR_4, int VAR_5,\nconst char *VAR_6, int VAR_7)\n{", "struct USBAutoFilter *VAR_8;", "struct USBDevice *VAR_9;", "if (VAR_3 == 9)\nreturn 0;", "for (VAR_8 = usb_auto_filter; VAR_8; VAR_8 = VAR_8->next) {", "if (VAR_8->VAR_1 >= 0 && VAR...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 17, 19 ], [ 23 ], [ 25, 27 ], [ 31, 33 ], [ 37, 39 ], [ 43, 45 ], [ 55, 57 ], [ 61 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ] ]
26,921
static int get_siz(J2kDecoderContext *s) { int i, ret; if (s->buf_end - s->buf < 36) bytestream_get_be16(&s->buf); // Rsiz (skipped) s->width = bytestream_get_be32(&s->buf); // width s->height = bytestream_get_be32(&s->buf); // height s->image_offset_x = bytestream_get_be32(&s->buf); // X0Siz s->image_offset_y = bytestream_get_be32(&s->buf); // Y0Siz s->tile_width = bytestream_get_be32(&s->buf); // XTSiz s->tile_height = bytestream_get_be32(&s->buf); // YTSiz s->tile_offset_x = bytestream_get_be32(&s->buf); // XT0Siz s->tile_offset_y = bytestream_get_be32(&s->buf); // YT0Siz s->ncomponents = bytestream_get_be16(&s->buf); // CSiz if (s->buf_end - s->buf < 2 * s->ncomponents) for (i = 0; i < s->ncomponents; i++){ // Ssiz_i XRsiz_i, YRsiz_i uint8_t x = bytestream_get_byte(&s->buf); s->cbps[i] = (x & 0x7f) + 1; s->precision = FFMAX(s->cbps[i], s->precision); s->sgnd[i] = !!(x & 0x80); s->cdx[i] = bytestream_get_byte(&s->buf); s->cdy[i] = bytestream_get_byte(&s->buf); } s->numXtiles = ff_j2k_ceildiv(s->width - s->tile_offset_x, s->tile_width); s->numYtiles = ff_j2k_ceildiv(s->height - s->tile_offset_y, s->tile_height); s->tile = av_mallocz(s->numXtiles * s->numYtiles * sizeof(J2kTile)); if (!s->tile) return AVERROR(ENOMEM); for (i = 0; i < s->numXtiles * s->numYtiles; i++){ J2kTile *tile = s->tile + i; tile->comp = av_mallocz(s->ncomponents * sizeof(J2kComponent)); if (!tile->comp) return AVERROR(ENOMEM); } s->avctx->width = s->width - s->image_offset_x; s->avctx->height = s->height - s->image_offset_y; switch(s->ncomponents){ case 1: if (s->precision > 8) { s->avctx->pix_fmt = PIX_FMT_GRAY16; } else s->avctx->pix_fmt = PIX_FMT_GRAY8; break; case 3: if (s->precision > 8) { s->avctx->pix_fmt = PIX_FMT_RGB48; } else s->avctx->pix_fmt = PIX_FMT_RGB24; break; case 4: s->avctx->pix_fmt = PIX_FMT_BGRA; break; } if (s->picture.data[0]) s->avctx->release_buffer(s->avctx, &s->picture); if ((ret = s->avctx->get_buffer(s->avctx, &s->picture)) < 0) return ret; s->picture.pict_type = FF_I_TYPE; s->picture.key_frame = 1; return 0; }
true
FFmpeg
628c9dcca3fb3f46f960f0df8236591653c6e512
static int get_siz(J2kDecoderContext *s) { int i, ret; if (s->buf_end - s->buf < 36) bytestream_get_be16(&s->buf); s->width = bytestream_get_be32(&s->buf); s->height = bytestream_get_be32(&s->buf); s->image_offset_x = bytestream_get_be32(&s->buf); s->image_offset_y = bytestream_get_be32(&s->buf); s->tile_width = bytestream_get_be32(&s->buf); s->tile_height = bytestream_get_be32(&s->buf); s->tile_offset_x = bytestream_get_be32(&s->buf); s->tile_offset_y = bytestream_get_be32(&s->buf); s->ncomponents = bytestream_get_be16(&s->buf); if (s->buf_end - s->buf < 2 * s->ncomponents) for (i = 0; i < s->ncomponents; i++){ uint8_t x = bytestream_get_byte(&s->buf); s->cbps[i] = (x & 0x7f) + 1; s->precision = FFMAX(s->cbps[i], s->precision); s->sgnd[i] = !!(x & 0x80); s->cdx[i] = bytestream_get_byte(&s->buf); s->cdy[i] = bytestream_get_byte(&s->buf); } s->numXtiles = ff_j2k_ceildiv(s->width - s->tile_offset_x, s->tile_width); s->numYtiles = ff_j2k_ceildiv(s->height - s->tile_offset_y, s->tile_height); s->tile = av_mallocz(s->numXtiles * s->numYtiles * sizeof(J2kTile)); if (!s->tile) return AVERROR(ENOMEM); for (i = 0; i < s->numXtiles * s->numYtiles; i++){ J2kTile *tile = s->tile + i; tile->comp = av_mallocz(s->ncomponents * sizeof(J2kComponent)); if (!tile->comp) return AVERROR(ENOMEM); } s->avctx->width = s->width - s->image_offset_x; s->avctx->height = s->height - s->image_offset_y; switch(s->ncomponents){ case 1: if (s->precision > 8) { s->avctx->pix_fmt = PIX_FMT_GRAY16; } else s->avctx->pix_fmt = PIX_FMT_GRAY8; break; case 3: if (s->precision > 8) { s->avctx->pix_fmt = PIX_FMT_RGB48; } else s->avctx->pix_fmt = PIX_FMT_RGB24; break; case 4: s->avctx->pix_fmt = PIX_FMT_BGRA; break; } if (s->picture.data[0]) s->avctx->release_buffer(s->avctx, &s->picture); if ((ret = s->avctx->get_buffer(s->avctx, &s->picture)) < 0) return ret; s->picture.pict_type = FF_I_TYPE; s->picture.key_frame = 1; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(J2kDecoderContext *VAR_0) { int VAR_1, VAR_2; if (VAR_0->buf_end - VAR_0->buf < 36) bytestream_get_be16(&VAR_0->buf); VAR_0->width = bytestream_get_be32(&VAR_0->buf); VAR_0->height = bytestream_get_be32(&VAR_0->buf); VAR_0->image_offset_x = bytestream_get_be32(&VAR_0->buf); VAR_0->image_offset_y = bytestream_get_be32(&VAR_0->buf); VAR_0->tile_width = bytestream_get_be32(&VAR_0->buf); VAR_0->tile_height = bytestream_get_be32(&VAR_0->buf); VAR_0->tile_offset_x = bytestream_get_be32(&VAR_0->buf); VAR_0->tile_offset_y = bytestream_get_be32(&VAR_0->buf); VAR_0->ncomponents = bytestream_get_be16(&VAR_0->buf); if (VAR_0->buf_end - VAR_0->buf < 2 * VAR_0->ncomponents) for (VAR_1 = 0; VAR_1 < VAR_0->ncomponents; VAR_1++){ uint8_t x = bytestream_get_byte(&VAR_0->buf); VAR_0->cbps[VAR_1] = (x & 0x7f) + 1; VAR_0->precision = FFMAX(VAR_0->cbps[VAR_1], VAR_0->precision); VAR_0->sgnd[VAR_1] = !!(x & 0x80); VAR_0->cdx[VAR_1] = bytestream_get_byte(&VAR_0->buf); VAR_0->cdy[VAR_1] = bytestream_get_byte(&VAR_0->buf); } VAR_0->numXtiles = ff_j2k_ceildiv(VAR_0->width - VAR_0->tile_offset_x, VAR_0->tile_width); VAR_0->numYtiles = ff_j2k_ceildiv(VAR_0->height - VAR_0->tile_offset_y, VAR_0->tile_height); VAR_0->tile = av_mallocz(VAR_0->numXtiles * VAR_0->numYtiles * sizeof(J2kTile)); if (!VAR_0->tile) return AVERROR(ENOMEM); for (VAR_1 = 0; VAR_1 < VAR_0->numXtiles * VAR_0->numYtiles; VAR_1++){ J2kTile *tile = VAR_0->tile + VAR_1; tile->comp = av_mallocz(VAR_0->ncomponents * sizeof(J2kComponent)); if (!tile->comp) return AVERROR(ENOMEM); } VAR_0->avctx->width = VAR_0->width - VAR_0->image_offset_x; VAR_0->avctx->height = VAR_0->height - VAR_0->image_offset_y; switch(VAR_0->ncomponents){ case 1: if (VAR_0->precision > 8) { VAR_0->avctx->pix_fmt = PIX_FMT_GRAY16; } else VAR_0->avctx->pix_fmt = PIX_FMT_GRAY8; break; case 3: if (VAR_0->precision > 8) { VAR_0->avctx->pix_fmt = PIX_FMT_RGB48; } else VAR_0->avctx->pix_fmt = PIX_FMT_RGB24; break; case 4: VAR_0->avctx->pix_fmt = PIX_FMT_BGRA; break; } if (VAR_0->picture.data[0]) VAR_0->avctx->release_buffer(VAR_0->avctx, &VAR_0->picture); if ((VAR_2 = VAR_0->avctx->get_buffer(VAR_0->avctx, &VAR_0->picture)) < 0) return VAR_2; VAR_0->picture.pict_type = FF_I_TYPE; VAR_0->picture.key_frame = 1; return 0; }
[ "static int FUNC_0(J2kDecoderContext *VAR_0)\n{", "int VAR_1, VAR_2;", "if (VAR_0->buf_end - VAR_0->buf < 36)\nbytestream_get_be16(&VAR_0->buf);", "VAR_0->width = bytestream_get_be32(&VAR_0->buf);", "VAR_0->height = bytestream_get_be32(&VAR_0->buf);", "VAR_0->image_offset_x = bytestream_get_be32(&VAR_0->b...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ],...
26,922
static int decode_ref_pic_marking(H264Context *h, GetBitContext *gb){ MpegEncContext * const s = &h->s; int i; if(h->nal_unit_type == NAL_IDR_SLICE){ //FIXME fields s->broken_link= get_bits1(gb) -1; h->mmco[0].long_arg= get_bits1(gb) - 1; // current_long_term_idx if(h->mmco[0].long_arg == -1) else{ h->mmco[0].opcode= MMCO_LONG; h->mmco_index= 1; } }else{ if(get_bits1(gb)){ // adaptive_ref_pic_marking_mode_flag for(i= 0; i<MAX_MMCO_COUNT; i++) { MMCOOpcode opcode= get_ue_golomb(gb); h->mmco[i].opcode= opcode; if(opcode==MMCO_SHORT2UNUSED || opcode==MMCO_SHORT2LONG){ h->mmco[i].short_pic_num= (h->curr_pic_num - get_ue_golomb(gb) - 1) & (h->max_pic_num - 1); /* if(h->mmco[i].short_pic_num >= h->short_ref_count || h->short_ref[ h->mmco[i].short_pic_num ] == NULL){ av_log(s->avctx, AV_LOG_ERROR, "illegal short ref in memory management control operation %d\n", mmco); return -1; }*/ } if(opcode==MMCO_SHORT2LONG || opcode==MMCO_LONG2UNUSED || opcode==MMCO_LONG || opcode==MMCO_SET_MAX_LONG){ unsigned int long_arg= get_ue_golomb(gb); if(long_arg >= 32 || (long_arg >= 16 && !(opcode == MMCO_LONG2UNUSED && FIELD_PICTURE))){ av_log(h->s.avctx, AV_LOG_ERROR, "illegal long ref in memory management control operation %d\n", opcode); return -1; } h->mmco[i].long_arg= long_arg; } if(opcode > (unsigned)MMCO_LONG){ av_log(h->s.avctx, AV_LOG_ERROR, "illegal memory management control operation %d\n", opcode); return -1; } if(opcode == MMCO_END) break; } h->mmco_index= i; }else{ assert(h->long_ref_count + h->short_ref_count <= h->sps.ref_frame_count); if(h->short_ref_count && h->long_ref_count + h->short_ref_count == h->sps.ref_frame_count && !(FIELD_PICTURE && !s->first_field && s->current_picture_ptr->reference)) { h->mmco[0].opcode= MMCO_SHORT2UNUSED; h->mmco[0].short_pic_num= h->short_ref[ h->short_ref_count - 1 ]->frame_num; h->mmco_index= 1; if (FIELD_PICTURE) { h->mmco[0].short_pic_num *= 2; h->mmco[1].opcode= MMCO_SHORT2UNUSED; h->mmco[1].short_pic_num= h->mmco[0].short_pic_num + 1; h->mmco_index= 2; } }else } } return 0; }
true
FFmpeg
d9fe1749fc1009b14252030dda9142de624670c0
static int decode_ref_pic_marking(H264Context *h, GetBitContext *gb){ MpegEncContext * const s = &h->s; int i; if(h->nal_unit_type == NAL_IDR_SLICE){ s->broken_link= get_bits1(gb) -1; h->mmco[0].long_arg= get_bits1(gb) - 1; if(h->mmco[0].long_arg == -1) else{ h->mmco[0].opcode= MMCO_LONG; h->mmco_index= 1; } }else{ if(get_bits1(gb)){ for(i= 0; i<MAX_MMCO_COUNT; i++) { MMCOOpcode opcode= get_ue_golomb(gb); h->mmco[i].opcode= opcode; if(opcode==MMCO_SHORT2UNUSED || opcode==MMCO_SHORT2LONG){ h->mmco[i].short_pic_num= (h->curr_pic_num - get_ue_golomb(gb) - 1) & (h->max_pic_num - 1); } if(opcode==MMCO_SHORT2LONG || opcode==MMCO_LONG2UNUSED || opcode==MMCO_LONG || opcode==MMCO_SET_MAX_LONG){ unsigned int long_arg= get_ue_golomb(gb); if(long_arg >= 32 || (long_arg >= 16 && !(opcode == MMCO_LONG2UNUSED && FIELD_PICTURE))){ av_log(h->s.avctx, AV_LOG_ERROR, "illegal long ref in memory management control operation %d\n", opcode); return -1; } h->mmco[i].long_arg= long_arg; } if(opcode > (unsigned)MMCO_LONG){ av_log(h->s.avctx, AV_LOG_ERROR, "illegal memory management control operation %d\n", opcode); return -1; } if(opcode == MMCO_END) break; } h->mmco_index= i; }else{ assert(h->long_ref_count + h->short_ref_count <= h->sps.ref_frame_count); if(h->short_ref_count && h->long_ref_count + h->short_ref_count == h->sps.ref_frame_count && !(FIELD_PICTURE && !s->first_field && s->current_picture_ptr->reference)) { h->mmco[0].opcode= MMCO_SHORT2UNUSED; h->mmco[0].short_pic_num= h->short_ref[ h->short_ref_count - 1 ]->frame_num; h->mmco_index= 1; if (FIELD_PICTURE) { h->mmco[0].short_pic_num *= 2; h->mmco[1].opcode= MMCO_SHORT2UNUSED; h->mmco[1].short_pic_num= h->mmco[0].short_pic_num + 1; h->mmco_index= 2; } }else } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(H264Context *VAR_0, GetBitContext *VAR_1){ MpegEncContext * const s = &VAR_0->s; int VAR_2; if(VAR_0->nal_unit_type == NAL_IDR_SLICE){ s->broken_link= get_bits1(VAR_1) -1; VAR_0->mmco[0].long_arg= get_bits1(VAR_1) - 1; if(VAR_0->mmco[0].long_arg == -1) else{ VAR_0->mmco[0].opcode= MMCO_LONG; VAR_0->mmco_index= 1; } }else{ if(get_bits1(VAR_1)){ for(VAR_2= 0; VAR_2<MAX_MMCO_COUNT; VAR_2++) { MMCOOpcode opcode= get_ue_golomb(VAR_1); VAR_0->mmco[VAR_2].opcode= opcode; if(opcode==MMCO_SHORT2UNUSED || opcode==MMCO_SHORT2LONG){ VAR_0->mmco[VAR_2].short_pic_num= (VAR_0->curr_pic_num - get_ue_golomb(VAR_1) - 1) & (VAR_0->max_pic_num - 1); } if(opcode==MMCO_SHORT2LONG || opcode==MMCO_LONG2UNUSED || opcode==MMCO_LONG || opcode==MMCO_SET_MAX_LONG){ unsigned int long_arg= get_ue_golomb(VAR_1); if(long_arg >= 32 || (long_arg >= 16 && !(opcode == MMCO_LONG2UNUSED && FIELD_PICTURE))){ av_log(VAR_0->s.avctx, AV_LOG_ERROR, "illegal long ref in memory management control operation %d\n", opcode); return -1; } VAR_0->mmco[VAR_2].long_arg= long_arg; } if(opcode > (unsigned)MMCO_LONG){ av_log(VAR_0->s.avctx, AV_LOG_ERROR, "illegal memory management control operation %d\n", opcode); return -1; } if(opcode == MMCO_END) break; } VAR_0->mmco_index= VAR_2; }else{ assert(VAR_0->long_ref_count + VAR_0->short_ref_count <= VAR_0->sps.ref_frame_count); if(VAR_0->short_ref_count && VAR_0->long_ref_count + VAR_0->short_ref_count == VAR_0->sps.ref_frame_count && !(FIELD_PICTURE && !s->first_field && s->current_picture_ptr->reference)) { VAR_0->mmco[0].opcode= MMCO_SHORT2UNUSED; VAR_0->mmco[0].short_pic_num= VAR_0->short_ref[ VAR_0->short_ref_count - 1 ]->frame_num; VAR_0->mmco_index= 1; if (FIELD_PICTURE) { VAR_0->mmco[0].short_pic_num *= 2; VAR_0->mmco[1].opcode= MMCO_SHORT2UNUSED; VAR_0->mmco[1].short_pic_num= VAR_0->mmco[0].short_pic_num + 1; VAR_0->mmco_index= 2; } }else } } return 0; }
[ "static int FUNC_0(H264Context *VAR_0, GetBitContext *VAR_1){", "MpegEncContext * const s = &VAR_0->s;", "int VAR_2;", "if(VAR_0->nal_unit_type == NAL_IDR_SLICE){", "s->broken_link= get_bits1(VAR_1) -1;", "VAR_0->mmco[0].long_arg= get_bits1(VAR_1) - 1;", "if(VAR_0->mmco[0].long_arg == -1)\nelse{", "VA...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 10 ], [ 12 ], [ 14 ], [ 16, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 51 ], [ 53 ], [ 5...
26,923
static int decode_main_header(NUTContext *nut){ AVFormatContext *s= nut->avf; ByteIOContext *bc = &s->pb; uint64_t tmp, end; unsigned int stream_count; int i, j, tmp_stream, tmp_mul, tmp_pts, tmp_size, count, tmp_res; end= get_packetheader(nut, bc, 1); end += url_ftell(bc) - 4; GET_V(tmp , tmp >=2 && tmp <= 3) GET_V(stream_count , tmp > 0 && tmp <=MAX_STREAMS) nut->max_distance = get_v(bc); if(nut->max_distance > 65536){ av_log(s, AV_LOG_DEBUG, "max_distance %d\n", nut->max_distance); nut->max_distance= 65536; } GET_V(nut->time_base_count, tmp>0 && tmp<INT_MAX / sizeof(AVRational)) nut->time_base= av_malloc(nut->time_base_count * sizeof(AVRational)); for(i=0; i<nut->time_base_count; i++){ GET_V(nut->time_base[i].num, tmp>0 && tmp<(1ULL<<31)) GET_V(nut->time_base[i].den, tmp>0 && tmp<(1ULL<<31)) if(ff_gcd(nut->time_base[i].num, nut->time_base[i].den) != 1){ av_log(s, AV_LOG_ERROR, "time base invalid\n"); return -1; } } tmp_pts=0; tmp_mul=1; tmp_stream=0; for(i=0; i<256;){ int tmp_flags = get_v(bc); int tmp_fields= get_v(bc); if(tmp_fields>0) tmp_pts = get_s(bc); if(tmp_fields>1) tmp_mul = get_v(bc); if(tmp_fields>2) tmp_stream= get_v(bc); if(tmp_fields>3) tmp_size = get_v(bc); else tmp_size = 0; if(tmp_fields>4) tmp_res = get_v(bc); else tmp_res = 0; if(tmp_fields>5) count = get_v(bc); else count = tmp_mul - tmp_size; while(tmp_fields-- > 6) get_v(bc); if(count == 0 || i+count > 256){ av_log(s, AV_LOG_ERROR, "illegal count %d at %d\n", count, i); return -1; } if(tmp_stream >= stream_count){ av_log(s, AV_LOG_ERROR, "illegal stream number\n"); return -1; } for(j=0; j<count; j++,i++){ if (i == 'N') { nut->frame_code[i].flags= FLAG_INVALID; j--; continue; } nut->frame_code[i].flags = tmp_flags ; nut->frame_code[i].pts_delta = tmp_pts ; nut->frame_code[i].stream_id = tmp_stream; nut->frame_code[i].size_mul = tmp_mul ; nut->frame_code[i].size_lsb = tmp_size+j; nut->frame_code[i].reserved_count = tmp_res ; } } assert(nut->frame_code['N'].flags == FLAG_INVALID); if(skip_reserved(bc, end) || check_checksum(bc)){ av_log(s, AV_LOG_ERROR, "Main header checksum mismatch\n"); return -1; } nut->stream = av_mallocz(sizeof(StreamContext)*stream_count); for(i=0; i<stream_count; i++){ av_new_stream(s, i); } return 0; }
true
FFmpeg
5d97d9d53ea1cc2c28411ad734565372ddeccc32
static int decode_main_header(NUTContext *nut){ AVFormatContext *s= nut->avf; ByteIOContext *bc = &s->pb; uint64_t tmp, end; unsigned int stream_count; int i, j, tmp_stream, tmp_mul, tmp_pts, tmp_size, count, tmp_res; end= get_packetheader(nut, bc, 1); end += url_ftell(bc) - 4; GET_V(tmp , tmp >=2 && tmp <= 3) GET_V(stream_count , tmp > 0 && tmp <=MAX_STREAMS) nut->max_distance = get_v(bc); if(nut->max_distance > 65536){ av_log(s, AV_LOG_DEBUG, "max_distance %d\n", nut->max_distance); nut->max_distance= 65536; } GET_V(nut->time_base_count, tmp>0 && tmp<INT_MAX / sizeof(AVRational)) nut->time_base= av_malloc(nut->time_base_count * sizeof(AVRational)); for(i=0; i<nut->time_base_count; i++){ GET_V(nut->time_base[i].num, tmp>0 && tmp<(1ULL<<31)) GET_V(nut->time_base[i].den, tmp>0 && tmp<(1ULL<<31)) if(ff_gcd(nut->time_base[i].num, nut->time_base[i].den) != 1){ av_log(s, AV_LOG_ERROR, "time base invalid\n"); return -1; } } tmp_pts=0; tmp_mul=1; tmp_stream=0; for(i=0; i<256;){ int tmp_flags = get_v(bc); int tmp_fields= get_v(bc); if(tmp_fields>0) tmp_pts = get_s(bc); if(tmp_fields>1) tmp_mul = get_v(bc); if(tmp_fields>2) tmp_stream= get_v(bc); if(tmp_fields>3) tmp_size = get_v(bc); else tmp_size = 0; if(tmp_fields>4) tmp_res = get_v(bc); else tmp_res = 0; if(tmp_fields>5) count = get_v(bc); else count = tmp_mul - tmp_size; while(tmp_fields-- > 6) get_v(bc); if(count == 0 || i+count > 256){ av_log(s, AV_LOG_ERROR, "illegal count %d at %d\n", count, i); return -1; } if(tmp_stream >= stream_count){ av_log(s, AV_LOG_ERROR, "illegal stream number\n"); return -1; } for(j=0; j<count; j++,i++){ if (i == 'N') { nut->frame_code[i].flags= FLAG_INVALID; j--; continue; } nut->frame_code[i].flags = tmp_flags ; nut->frame_code[i].pts_delta = tmp_pts ; nut->frame_code[i].stream_id = tmp_stream; nut->frame_code[i].size_mul = tmp_mul ; nut->frame_code[i].size_lsb = tmp_size+j; nut->frame_code[i].reserved_count = tmp_res ; } } assert(nut->frame_code['N'].flags == FLAG_INVALID); if(skip_reserved(bc, end) || check_checksum(bc)){ av_log(s, AV_LOG_ERROR, "Main header checksum mismatch\n"); return -1; } nut->stream = av_mallocz(sizeof(StreamContext)*stream_count); for(i=0; i<stream_count; i++){ av_new_stream(s, i); } return 0; }
{ "code": [ " return 0;", " end += url_ftell(bc) - 4;", " if(skip_reserved(bc, end) || check_checksum(bc)){", " end += url_ftell(bc) - 4;", " if(skip_reserved(bc, end) || check_checksum(bc)){", " end += url_ftell(bc) - 4;", " if(skip_reserved(bc, end) || check_checksum(bc)){", " end += url_ftell(bc) - 4;", " if(skip_reserved(bc, end) || check_checksum(bc)){", " end += url_ftell(bc) - 4;", " if(skip_reserved(bc, end) || check_checksum(bc)){" ], "line_no": [ 169, 17, 149, 17, 149, 17, 149, 17, 149, 17, 149 ] }
static int FUNC_0(NUTContext *VAR_0){ AVFormatContext *s= VAR_0->avf; ByteIOContext *bc = &s->pb; uint64_t tmp, end; unsigned int VAR_1; int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9; end= get_packetheader(VAR_0, bc, 1); end += url_ftell(bc) - 4; GET_V(tmp , tmp >=2 && tmp <= 3) GET_V(VAR_1 , tmp > 0 && tmp <=MAX_STREAMS) VAR_0->max_distance = get_v(bc); if(VAR_0->max_distance > 65536){ av_log(s, AV_LOG_DEBUG, "max_distance %d\n", VAR_0->max_distance); VAR_0->max_distance= 65536; } GET_V(VAR_0->time_base_count, tmp>0 && tmp<INT_MAX / sizeof(AVRational)) VAR_0->time_base= av_malloc(VAR_0->time_base_count * sizeof(AVRational)); for(VAR_2=0; VAR_2<VAR_0->time_base_count; VAR_2++){ GET_V(VAR_0->time_base[VAR_2].num, tmp>0 && tmp<(1ULL<<31)) GET_V(VAR_0->time_base[VAR_2].den, tmp>0 && tmp<(1ULL<<31)) if(ff_gcd(VAR_0->time_base[VAR_2].num, VAR_0->time_base[VAR_2].den) != 1){ av_log(s, AV_LOG_ERROR, "time base invalid\n"); return -1; } } VAR_6=0; VAR_5=1; VAR_4=0; for(VAR_2=0; VAR_2<256;){ int VAR_10 = get_v(bc); int VAR_11= get_v(bc); if(VAR_11>0) VAR_6 = get_s(bc); if(VAR_11>1) VAR_5 = get_v(bc); if(VAR_11>2) VAR_4= get_v(bc); if(VAR_11>3) VAR_7 = get_v(bc); else VAR_7 = 0; if(VAR_11>4) VAR_9 = get_v(bc); else VAR_9 = 0; if(VAR_11>5) VAR_8 = get_v(bc); else VAR_8 = VAR_5 - VAR_7; while(VAR_11-- > 6) get_v(bc); if(VAR_8 == 0 || VAR_2+VAR_8 > 256){ av_log(s, AV_LOG_ERROR, "illegal VAR_8 %d at %d\n", VAR_8, VAR_2); return -1; } if(VAR_4 >= VAR_1){ av_log(s, AV_LOG_ERROR, "illegal stream number\n"); return -1; } for(VAR_3=0; VAR_3<VAR_8; VAR_3++,VAR_2++){ if (VAR_2 == 'N') { VAR_0->frame_code[VAR_2].flags= FLAG_INVALID; VAR_3--; continue; } VAR_0->frame_code[VAR_2].flags = VAR_10 ; VAR_0->frame_code[VAR_2].pts_delta = VAR_6 ; VAR_0->frame_code[VAR_2].stream_id = VAR_4; VAR_0->frame_code[VAR_2].size_mul = VAR_5 ; VAR_0->frame_code[VAR_2].size_lsb = VAR_7+VAR_3; VAR_0->frame_code[VAR_2].reserved_count = VAR_9 ; } } assert(VAR_0->frame_code['N'].flags == FLAG_INVALID); if(skip_reserved(bc, end) || check_checksum(bc)){ av_log(s, AV_LOG_ERROR, "Main header checksum mismatch\n"); return -1; } VAR_0->stream = av_mallocz(sizeof(StreamContext)*VAR_1); for(VAR_2=0; VAR_2<VAR_1; VAR_2++){ av_new_stream(s, VAR_2); } return 0; }
[ "static int FUNC_0(NUTContext *VAR_0){", "AVFormatContext *s= VAR_0->avf;", "ByteIOContext *bc = &s->pb;", "uint64_t tmp, end;", "unsigned int VAR_1;", "int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;", "end= get_packetheader(VAR_0, bc, 1);", "end += url_ftell(bc) - 4;", "GET_V(tmp ...
[ 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, 0, 0, 0, 0...
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 21, 23, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39, 41 ], [ 45 ], [ 47, 49, 51 ], [ 53 ], [ 55 ...
26,924
void do_POWER_divso (void) { if (((int32_t)T0 == INT32_MIN && (int32_t)T1 == -1) || (int32_t)T1 == 0) { T0 = (long)((-1) * (T0 >> 31)); env->spr[SPR_MQ] = 0; xer_ov = 1; xer_so = 1; } else { T0 = (int32_t)T0 / (int32_t)T1; env->spr[SPR_MQ] = (int32_t)T0 % (int32_t)T1; xer_ov = 0; } }
true
qemu
6f2d8978728c48ca46f5c01835438508aace5c64
void do_POWER_divso (void) { if (((int32_t)T0 == INT32_MIN && (int32_t)T1 == -1) || (int32_t)T1 == 0) { T0 = (long)((-1) * (T0 >> 31)); env->spr[SPR_MQ] = 0; xer_ov = 1; xer_so = 1; } else { T0 = (int32_t)T0 / (int32_t)T1; env->spr[SPR_MQ] = (int32_t)T0 % (int32_t)T1; xer_ov = 0; } }
{ "code": [ " xer_so = 1;", " xer_so = 1;", " xer_so = 1;", " if (((int32_t)T0 == INT32_MIN && (int32_t)T1 == -1) || (int32_t)T1 == 0) {", " T0 = (long)((-1) * (T0 >> 31));", " if (((int32_t)T0 == INT32_MIN && (int32_t)T1 == -1) || (int32_t)T1 == 0) {", " T0 = (long)((-1) * (T0 >> 31));", " xer_so = 1;", " if (((int32_t)T0 == INT32_MIN && (int32_t)T1 == -1) || (int32_t)T1 == 0) {", " T0 = (long)((-1) * (T0 >> 31));", " if (((int32_t)T0 == INT32_MIN && (int32_t)T1 == -1) || (int32_t)T1 == 0) {", " T0 = (long)((-1) * (T0 >> 31));", " xer_so = 1;" ], "line_no": [ 13, 13, 13, 5, 7, 5, 7, 13, 5, 7, 5, 7, 13 ] }
void FUNC_0 (void) { if (((int32_t)T0 == INT32_MIN && (int32_t)T1 == -1) || (int32_t)T1 == 0) { T0 = (long)((-1) * (T0 >> 31)); env->spr[SPR_MQ] = 0; xer_ov = 1; xer_so = 1; } else { T0 = (int32_t)T0 / (int32_t)T1; env->spr[SPR_MQ] = (int32_t)T0 % (int32_t)T1; xer_ov = 0; } }
[ "void FUNC_0 (void)\n{", "if (((int32_t)T0 == INT32_MIN && (int32_t)T1 == -1) || (int32_t)T1 == 0) {", "T0 = (long)((-1) * (T0 >> 31));", "env->spr[SPR_MQ] = 0;", "xer_ov = 1;", "xer_so = 1;", "} else {", "T0 = (int32_t)T0 / (int32_t)T1;", "env->spr[SPR_MQ] = (int32_t)T0 % (int32_t)T1;", "xer_ov =...
[ 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
26,925
void add_migration_state_change_notifier(Notifier *notify) { notifier_list_add(&migration_state_notifiers, notify); }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
void add_migration_state_change_notifier(Notifier *notify) { notifier_list_add(&migration_state_notifiers, notify); }
{ "code": [], "line_no": [] }
void FUNC_0(Notifier *VAR_0) { notifier_list_add(&migration_state_notifiers, VAR_0); }
[ "void FUNC_0(Notifier *VAR_0)\n{", "notifier_list_add(&migration_state_notifiers, VAR_0);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
26,926
static void enqueue_packet(RTPDemuxContext *s, uint8_t *buf, int len) { uint16_t seq = AV_RB16(buf + 2); RTPPacket **cur = &s->queue, *packet; /* Find the correct place in the queue to insert the packet */ while (*cur) { int16_t diff = seq - (*cur)->seq; if (diff < 0) break; cur = &(*cur)->next; } packet = av_mallocz(sizeof(*packet)); if (!packet) return; packet->recvtime = av_gettime_relative(); packet->seq = seq; packet->len = len; packet->buf = buf; packet->next = *cur; *cur = packet; s->queue_len++; }
true
FFmpeg
22cc57da64bfd73f2206969486b0aa183ee76479
static void enqueue_packet(RTPDemuxContext *s, uint8_t *buf, int len) { uint16_t seq = AV_RB16(buf + 2); RTPPacket **cur = &s->queue, *packet; while (*cur) { int16_t diff = seq - (*cur)->seq; if (diff < 0) break; cur = &(*cur)->next; } packet = av_mallocz(sizeof(*packet)); if (!packet) return; packet->recvtime = av_gettime_relative(); packet->seq = seq; packet->len = len; packet->buf = buf; packet->next = *cur; *cur = packet; s->queue_len++; }
{ "code": [ "static void enqueue_packet(RTPDemuxContext *s, uint8_t *buf, int len)" ], "line_no": [ 1 ] }
static void FUNC_0(RTPDemuxContext *VAR_0, uint8_t *VAR_1, int VAR_2) { uint16_t seq = AV_RB16(VAR_1 + 2); RTPPacket **cur = &VAR_0->queue, *packet; while (*cur) { int16_t diff = seq - (*cur)->seq; if (diff < 0) break; cur = &(*cur)->next; } packet = av_mallocz(sizeof(*packet)); if (!packet) return; packet->recvtime = av_gettime_relative(); packet->seq = seq; packet->VAR_2 = VAR_2; packet->VAR_1 = VAR_1; packet->next = *cur; *cur = packet; VAR_0->queue_len++; }
[ "static void FUNC_0(RTPDemuxContext *VAR_0, uint8_t *VAR_1, int VAR_2)\n{", "uint16_t seq = AV_RB16(VAR_1 + 2);", "RTPPacket **cur = &VAR_0->queue, *packet;", "while (*cur) {", "int16_t diff = seq - (*cur)->seq;", "if (diff < 0)\nbreak;", "cur = &(*cur)->next;", "}", "packet = av_mallocz(sizeof(*p...
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ] ]
26,927
int ff_rv34_decode_frame(AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size) { RV34DecContext *r = avctx->priv_data; MpegEncContext *s = &r->s; AVFrame *pict = data; SliceInfo si; int i; int slice_count; const uint8_t *slices_hdr = NULL; int last = 0; /* no supplementary picture */ if (buf_size == 0) { /* special case for last picture */ if (s->low_delay==0 && s->next_picture_ptr) { *pict= *(AVFrame*)s->next_picture_ptr; s->next_picture_ptr= NULL; *data_size = sizeof(AVFrame); } return 0; } if(!avctx->slice_count){ slice_count = (*buf++) + 1; slices_hdr = buf + 4; buf += 8 * slice_count; }else slice_count = avctx->slice_count; for(i=0; i<slice_count; i++){ int offset= get_slice_offset(avctx, slices_hdr, i); int size; if(i+1 == slice_count) size= buf_size - offset; else size= get_slice_offset(avctx, slices_hdr, i+1) - offset; if(offset > buf_size){ av_log(avctx, AV_LOG_ERROR, "Slice offset is greater than frame size\n"); break; } r->si.end = s->mb_width * s->mb_height; if(i+1 < slice_count){ init_get_bits(&s->gb, buf+get_slice_offset(avctx, slices_hdr, i+1), (buf_size-get_slice_offset(avctx, slices_hdr, i+1))*8); if(r->parse_slice_header(r, &r->s.gb, &si) < 0){ if(i+2 < slice_count) size = get_slice_offset(avctx, slices_hdr, i+2) - offset; else size = buf_size - offset; }else r->si.end = si.start; } if(!i && si.type == FF_B_TYPE && (!s->last_picture_ptr || !s->last_picture_ptr->data[0])) return -1; last = rv34_decode_slice(r, r->si.end, buf + offset, size); s->mb_num_left = r->s.mb_x + r->s.mb_y*r->s.mb_width - r->si.start; if(last) break; } if(last){ if(r->loop_filter) r->loop_filter(r, s->mb_height - 1); ff_er_frame_end(s); MPV_frame_end(s); if (s->pict_type == FF_B_TYPE || s->low_delay) { *pict= *(AVFrame*)s->current_picture_ptr; } else if (s->last_picture_ptr != NULL) { *pict= *(AVFrame*)s->last_picture_ptr; } if(s->last_picture_ptr || s->low_delay){ *data_size = sizeof(AVFrame); ff_print_debug_info(s, pict); } s->current_picture_ptr= NULL; //so we can detect if frame_end wasnt called (find some nicer solution...) } return buf_size; }
false
FFmpeg
432f1f11ea7f95b1c1f1adb546151f09c1d7a932
int ff_rv34_decode_frame(AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size) { RV34DecContext *r = avctx->priv_data; MpegEncContext *s = &r->s; AVFrame *pict = data; SliceInfo si; int i; int slice_count; const uint8_t *slices_hdr = NULL; int last = 0; if (buf_size == 0) { if (s->low_delay==0 && s->next_picture_ptr) { *pict= *(AVFrame*)s->next_picture_ptr; s->next_picture_ptr= NULL; *data_size = sizeof(AVFrame); } return 0; } if(!avctx->slice_count){ slice_count = (*buf++) + 1; slices_hdr = buf + 4; buf += 8 * slice_count; }else slice_count = avctx->slice_count; for(i=0; i<slice_count; i++){ int offset= get_slice_offset(avctx, slices_hdr, i); int size; if(i+1 == slice_count) size= buf_size - offset; else size= get_slice_offset(avctx, slices_hdr, i+1) - offset; if(offset > buf_size){ av_log(avctx, AV_LOG_ERROR, "Slice offset is greater than frame size\n"); break; } r->si.end = s->mb_width * s->mb_height; if(i+1 < slice_count){ init_get_bits(&s->gb, buf+get_slice_offset(avctx, slices_hdr, i+1), (buf_size-get_slice_offset(avctx, slices_hdr, i+1))*8); if(r->parse_slice_header(r, &r->s.gb, &si) < 0){ if(i+2 < slice_count) size = get_slice_offset(avctx, slices_hdr, i+2) - offset; else size = buf_size - offset; }else r->si.end = si.start; } if(!i && si.type == FF_B_TYPE && (!s->last_picture_ptr || !s->last_picture_ptr->data[0])) return -1; last = rv34_decode_slice(r, r->si.end, buf + offset, size); s->mb_num_left = r->s.mb_x + r->s.mb_y*r->s.mb_width - r->si.start; if(last) break; } if(last){ if(r->loop_filter) r->loop_filter(r, s->mb_height - 1); ff_er_frame_end(s); MPV_frame_end(s); if (s->pict_type == FF_B_TYPE || s->low_delay) { *pict= *(AVFrame*)s->current_picture_ptr; } else if (s->last_picture_ptr != NULL) { *pict= *(AVFrame*)s->last_picture_ptr; } if(s->last_picture_ptr || s->low_delay){ *data_size = sizeof(AVFrame); ff_print_debug_info(s, pict); } s->current_picture_ptr= NULL; } return buf_size; }
{ "code": [], "line_no": [] }
int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, const uint8_t *VAR_3, int VAR_4) { RV34DecContext *r = VAR_0->priv_data; MpegEncContext *s = &r->s; AVFrame *pict = VAR_1; SliceInfo si; int VAR_5; int VAR_6; const uint8_t *VAR_7 = NULL; int VAR_8 = 0; if (VAR_4 == 0) { if (s->low_delay==0 && s->next_picture_ptr) { *pict= *(AVFrame*)s->next_picture_ptr; s->next_picture_ptr= NULL; *VAR_2 = sizeof(AVFrame); } return 0; } if(!VAR_0->VAR_6){ VAR_6 = (*VAR_3++) + 1; VAR_7 = VAR_3 + 4; VAR_3 += 8 * VAR_6; }else VAR_6 = VAR_0->VAR_6; for(VAR_5=0; VAR_5<VAR_6; VAR_5++){ int VAR_9= get_slice_offset(VAR_0, VAR_7, VAR_5); int VAR_10; if(VAR_5+1 == VAR_6) VAR_10= VAR_4 - VAR_9; else VAR_10= get_slice_offset(VAR_0, VAR_7, VAR_5+1) - VAR_9; if(VAR_9 > VAR_4){ av_log(VAR_0, AV_LOG_ERROR, "Slice VAR_9 is greater than frame VAR_10\n"); break; } r->si.end = s->mb_width * s->mb_height; if(VAR_5+1 < VAR_6){ init_get_bits(&s->gb, VAR_3+get_slice_offset(VAR_0, VAR_7, VAR_5+1), (VAR_4-get_slice_offset(VAR_0, VAR_7, VAR_5+1))*8); if(r->parse_slice_header(r, &r->s.gb, &si) < 0){ if(VAR_5+2 < VAR_6) VAR_10 = get_slice_offset(VAR_0, VAR_7, VAR_5+2) - VAR_9; else VAR_10 = VAR_4 - VAR_9; }else r->si.end = si.start; } if(!VAR_5 && si.type == FF_B_TYPE && (!s->last_picture_ptr || !s->last_picture_ptr->VAR_1[0])) return -1; VAR_8 = rv34_decode_slice(r, r->si.end, VAR_3 + VAR_9, VAR_10); s->mb_num_left = r->s.mb_x + r->s.mb_y*r->s.mb_width - r->si.start; if(VAR_8) break; } if(VAR_8){ if(r->loop_filter) r->loop_filter(r, s->mb_height - 1); ff_er_frame_end(s); MPV_frame_end(s); if (s->pict_type == FF_B_TYPE || s->low_delay) { *pict= *(AVFrame*)s->current_picture_ptr; } else if (s->last_picture_ptr != NULL) { *pict= *(AVFrame*)s->last_picture_ptr; } if(s->last_picture_ptr || s->low_delay){ *VAR_2 = sizeof(AVFrame); ff_print_debug_info(s, pict); } s->current_picture_ptr= NULL; } return VAR_4; }
[ "int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2,\nconst uint8_t *VAR_3, int VAR_4)\n{", "RV34DecContext *r = VAR_0->priv_data;", "MpegEncContext *s = &r->s;", "AVFrame *pict = VAR_1;", "SliceInfo si;", "int VAR_5;", "int VAR_6;", "const uint8_t *VAR_7 = NULL;", "int VAR_8 = 0;", "if (V...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ...
26,928
static av_cold int mss2_decode_init(AVCodecContext *avctx) { MSS2Context * const ctx = avctx->priv_data; MSS12Context *c = &ctx->c; int ret; c->avctx = avctx; avctx->coded_frame = &ctx->pic; if (ret = ff_mss12_decode_init(c, 1, &ctx->sc[0], &ctx->sc[1])) return ret; c->pal_stride = c->mask_stride; c->pal_pic = av_malloc(c->pal_stride * avctx->height); c->last_pal_pic = av_malloc(c->pal_stride * avctx->height); if (!c->pal_pic || !c->last_pal_pic) { mss2_decode_end(avctx); return AVERROR(ENOMEM); } if (ret = wmv9_init(avctx)) { mss2_decode_end(avctx); return ret; } ff_mss2dsp_init(&ctx->dsp); avctx->pix_fmt = c->free_colours == 127 ? AV_PIX_FMT_RGB555 : AV_PIX_FMT_RGB24; return 0; }
true
FFmpeg
802713c4e7b41bc2deed754d78649945c3442063
static av_cold int mss2_decode_init(AVCodecContext *avctx) { MSS2Context * const ctx = avctx->priv_data; MSS12Context *c = &ctx->c; int ret; c->avctx = avctx; avctx->coded_frame = &ctx->pic; if (ret = ff_mss12_decode_init(c, 1, &ctx->sc[0], &ctx->sc[1])) return ret; c->pal_stride = c->mask_stride; c->pal_pic = av_malloc(c->pal_stride * avctx->height); c->last_pal_pic = av_malloc(c->pal_stride * avctx->height); if (!c->pal_pic || !c->last_pal_pic) { mss2_decode_end(avctx); return AVERROR(ENOMEM); } if (ret = wmv9_init(avctx)) { mss2_decode_end(avctx); return ret; } ff_mss2dsp_init(&ctx->dsp); avctx->pix_fmt = c->free_colours == 127 ? AV_PIX_FMT_RGB555 : AV_PIX_FMT_RGB24; return 0; }
{ "code": [ " c->pal_pic = av_malloc(c->pal_stride * avctx->height);", " c->last_pal_pic = av_malloc(c->pal_stride * avctx->height);" ], "line_no": [ 21, 23 ] }
static av_cold int FUNC_0(AVCodecContext *avctx) { MSS2Context * const ctx = avctx->priv_data; MSS12Context *c = &ctx->c; int VAR_0; c->avctx = avctx; avctx->coded_frame = &ctx->pic; if (VAR_0 = ff_mss12_decode_init(c, 1, &ctx->sc[0], &ctx->sc[1])) return VAR_0; c->pal_stride = c->mask_stride; c->pal_pic = av_malloc(c->pal_stride * avctx->height); c->last_pal_pic = av_malloc(c->pal_stride * avctx->height); if (!c->pal_pic || !c->last_pal_pic) { mss2_decode_end(avctx); return AVERROR(ENOMEM); } if (VAR_0 = wmv9_init(avctx)) { mss2_decode_end(avctx); return VAR_0; } ff_mss2dsp_init(&ctx->dsp); avctx->pix_fmt = c->free_colours == 127 ? AV_PIX_FMT_RGB555 : AV_PIX_FMT_RGB24; return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "MSS2Context * const ctx = avctx->priv_data;", "MSS12Context *c = &ctx->c;", "int VAR_0;", "c->avctx = avctx;", "avctx->coded_frame = &ctx->pic;", "if (VAR_0 = ff_mss12_decode_init(c, 1, &ctx->sc[0], &ctx->sc[1]))\nreturn VAR_0;", "c->pal_stride ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 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 ], [...
26,929
static void build_file_streams(void) { FFStream *stream, *stream_next; AVFormatContext *infile; int i; /* gather all streams */ for(stream = first_stream; stream != NULL; stream = stream_next) { stream_next = stream->next; if (stream->stream_type == STREAM_TYPE_LIVE && !stream->feed) { /* the stream comes from a file */ /* try to open the file */ /* open stream */ stream->ap_in = av_mallocz(sizeof(AVFormatParameters)); if (!strcmp(stream->fmt->name, "rtp")) { /* specific case : if transport stream output to RTP, we use a raw transport stream reader */ stream->ap_in->mpeg2ts_raw = 1; stream->ap_in->mpeg2ts_compute_pcr = 1; } if (av_open_input_file(&infile, stream->feed_filename, stream->ifmt, 0, stream->ap_in) < 0) { http_log("%s not found", stream->feed_filename); /* remove stream (no need to spend more time on it) */ fail: remove_stream(stream); } else { /* find all the AVStreams inside and reference them in 'stream' */ if (av_find_stream_info(infile) < 0) { http_log("Could not find codec parameters from '%s'", stream->feed_filename); av_close_input_file(infile); goto fail; } extract_mpeg4_header(infile); for(i=0;i<infile->nb_streams;i++) add_av_stream1(stream, infile->streams[i]->codec); av_close_input_file(infile); } } } }
true
FFmpeg
25e3e53d4092e7b69a4d681824fa0f7b2731bb1e
static void build_file_streams(void) { FFStream *stream, *stream_next; AVFormatContext *infile; int i; for(stream = first_stream; stream != NULL; stream = stream_next) { stream_next = stream->next; if (stream->stream_type == STREAM_TYPE_LIVE && !stream->feed) { stream->ap_in = av_mallocz(sizeof(AVFormatParameters)); if (!strcmp(stream->fmt->name, "rtp")) { stream->ap_in->mpeg2ts_raw = 1; stream->ap_in->mpeg2ts_compute_pcr = 1; } if (av_open_input_file(&infile, stream->feed_filename, stream->ifmt, 0, stream->ap_in) < 0) { http_log("%s not found", stream->feed_filename); fail: remove_stream(stream); } else { if (av_find_stream_info(infile) < 0) { http_log("Could not find codec parameters from '%s'", stream->feed_filename); av_close_input_file(infile); goto fail; } extract_mpeg4_header(infile); for(i=0;i<infile->nb_streams;i++) add_av_stream1(stream, infile->streams[i]->codec); av_close_input_file(infile); } } } }
{ "code": [ " if (!strcmp(stream->fmt->name, \"rtp\")) {" ], "line_no": [ 31 ] }
static void FUNC_0(void) { FFStream *stream, *stream_next; AVFormatContext *infile; int VAR_0; for(stream = first_stream; stream != NULL; stream = stream_next) { stream_next = stream->next; if (stream->stream_type == STREAM_TYPE_LIVE && !stream->feed) { stream->ap_in = av_mallocz(sizeof(AVFormatParameters)); if (!strcmp(stream->fmt->name, "rtp")) { stream->ap_in->mpeg2ts_raw = 1; stream->ap_in->mpeg2ts_compute_pcr = 1; } if (av_open_input_file(&infile, stream->feed_filename, stream->ifmt, 0, stream->ap_in) < 0) { http_log("%s not found", stream->feed_filename); fail: remove_stream(stream); } else { if (av_find_stream_info(infile) < 0) { http_log("Could not find codec parameters from '%s'", stream->feed_filename); av_close_input_file(infile); goto fail; } extract_mpeg4_header(infile); for(VAR_0=0;VAR_0<infile->nb_streams;VAR_0++) add_av_stream1(stream, infile->streams[VAR_0]->codec); av_close_input_file(infile); } } } }
[ "static void FUNC_0(void)\n{", "FFStream *stream, *stream_next;", "AVFormatContext *infile;", "int VAR_0;", "for(stream = first_stream; stream != NULL; stream = stream_next) {", "stream_next = stream->next;", "if (stream->stream_type == STREAM_TYPE_LIVE &&\n!stream->feed) {", "stream->ap_in = av_mallo...
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 29 ], [ 31 ], [ 37 ], [ 39 ], [ 41 ], [ 45, 47 ], [ 49 ], [ 53, 55 ], [ 57 ], [ 63 ], [ 65, 67 ...
26,930
void OPPROTO op_addco (void) { do_addco(); RETURN(); }
true
qemu
d9bce9d99f4656ae0b0127f7472db9067b8f84ab
void OPPROTO op_addco (void) { do_addco(); RETURN(); }
{ "code": [ " RETURN();", "void OPPROTO op_addco (void)", " do_addco();", " RETURN();" ], "line_no": [ 7, 1, 5, 7 ] }
void VAR_0 op_addco (void) { do_addco(); RETURN(); }
[ "void VAR_0 op_addco (void)\n{", "do_addco();", "RETURN();", "}" ]
[ 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
26,931
static inline void vring_used_flags_set_bit(VirtQueue *vq, int mask) { VRingMemoryRegionCaches *caches = atomic_rcu_read(&vq->vring.caches); VirtIODevice *vdev = vq->vdev; hwaddr pa = offsetof(VRingUsed, flags); uint16_t flags = virtio_lduw_phys_cached(vq->vdev, &caches->used, pa); virtio_stw_phys_cached(vdev, &caches->used, pa, flags | mask); address_space_cache_invalidate(&caches->used, pa, sizeof(flags)); }
true
qemu
e0e2d644096c79a71099b176d08f465f6803a8b1
static inline void vring_used_flags_set_bit(VirtQueue *vq, int mask) { VRingMemoryRegionCaches *caches = atomic_rcu_read(&vq->vring.caches); VirtIODevice *vdev = vq->vdev; hwaddr pa = offsetof(VRingUsed, flags); uint16_t flags = virtio_lduw_phys_cached(vq->vdev, &caches->used, pa); virtio_stw_phys_cached(vdev, &caches->used, pa, flags | mask); address_space_cache_invalidate(&caches->used, pa, sizeof(flags)); }
{ "code": [ " VRingMemoryRegionCaches *caches = atomic_rcu_read(&vq->vring.caches);", " VRingMemoryRegionCaches *caches = atomic_rcu_read(&vq->vring.caches);", " VRingMemoryRegionCaches *caches = atomic_rcu_read(&vq->vring.caches);", " VRingMemoryRegionCaches *caches = atomic_rcu_read(&vq->vring.caches);", " VRingMemoryRegionCaches *caches = atomic_rcu_read(&vq->vring.caches);", " VRingMemoryRegionCaches *caches = atomic_rcu_read(&vq->vring.caches);", " VRingMemoryRegionCaches *caches = atomic_rcu_read(&vq->vring.caches);", " VRingMemoryRegionCaches *caches = atomic_rcu_read(&vq->vring.caches);" ], "line_no": [ 5, 5, 5, 5, 5, 5, 5, 5 ] }
static inline void FUNC_0(VirtQueue *VAR_0, int VAR_1) { VRingMemoryRegionCaches *caches = atomic_rcu_read(&VAR_0->vring.caches); VirtIODevice *vdev = VAR_0->vdev; hwaddr pa = offsetof(VRingUsed, flags); uint16_t flags = virtio_lduw_phys_cached(VAR_0->vdev, &caches->used, pa); virtio_stw_phys_cached(vdev, &caches->used, pa, flags | VAR_1); address_space_cache_invalidate(&caches->used, pa, sizeof(flags)); }
[ "static inline void FUNC_0(VirtQueue *VAR_0, int VAR_1)\n{", "VRingMemoryRegionCaches *caches = atomic_rcu_read(&VAR_0->vring.caches);", "VirtIODevice *vdev = VAR_0->vdev;", "hwaddr pa = offsetof(VRingUsed, flags);", "uint16_t flags = virtio_lduw_phys_cached(VAR_0->vdev, &caches->used, pa);", "virtio_stw_...
[ 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ] ]
26,932
static int iscsi_truncate(BlockDriverState *bs, int64_t offset) { IscsiLun *iscsilun = bs->opaque; Error *local_err = NULL; if (iscsilun->type != TYPE_DISK) { return -ENOTSUP; } iscsi_readcapacity_sync(iscsilun, &local_err); if (local_err != NULL) { error_free(local_err); return -EIO; } if (offset > iscsi_getlength(bs)) { return -EINVAL; } if (iscsilun->allocationmap != NULL) { g_free(iscsilun->allocationmap); iscsilun->allocationmap = bitmap_new(DIV_ROUND_UP(bs->total_sectors, iscsilun->cluster_sectors)); } return 0; }
true
qemu
d832fb4d66ead62da4af7e44cce34cd939e865e1
static int iscsi_truncate(BlockDriverState *bs, int64_t offset) { IscsiLun *iscsilun = bs->opaque; Error *local_err = NULL; if (iscsilun->type != TYPE_DISK) { return -ENOTSUP; } iscsi_readcapacity_sync(iscsilun, &local_err); if (local_err != NULL) { error_free(local_err); return -EIO; } if (offset > iscsi_getlength(bs)) { return -EINVAL; } if (iscsilun->allocationmap != NULL) { g_free(iscsilun->allocationmap); iscsilun->allocationmap = bitmap_new(DIV_ROUND_UP(bs->total_sectors, iscsilun->cluster_sectors)); } return 0; }
{ "code": [ " bitmap_new(DIV_ROUND_UP(bs->total_sectors," ], "line_no": [ 45 ] }
static int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1) { IscsiLun *iscsilun = VAR_0->opaque; Error *local_err = NULL; if (iscsilun->type != TYPE_DISK) { return -ENOTSUP; } iscsi_readcapacity_sync(iscsilun, &local_err); if (local_err != NULL) { error_free(local_err); return -EIO; } if (VAR_1 > iscsi_getlength(VAR_0)) { return -EINVAL; } if (iscsilun->allocationmap != NULL) { g_free(iscsilun->allocationmap); iscsilun->allocationmap = bitmap_new(DIV_ROUND_UP(VAR_0->total_sectors, iscsilun->cluster_sectors)); } return 0; }
[ "static int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1)\n{", "IscsiLun *iscsilun = VAR_0->opaque;", "Error *local_err = NULL;", "if (iscsilun->type != TYPE_DISK) {", "return -ENOTSUP;", "}", "iscsi_readcapacity_sync(iscsilun, &local_err);", "if (local_err != NULL) {", "error_free(local_err);", ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43, 45, 47 ], [ 49 ], [ 53...
26,936
static void xan_unpack(unsigned char *dest, unsigned char *src) { unsigned char opcode; int size; int offset; int byte1, byte2, byte3; for (;;) { opcode = *src++; if ( (opcode & 0x80) == 0 ) { offset = *src++; size = opcode & 3; bytecopy(dest, src, size); dest += size; src += size; size = ((opcode & 0x1c) >> 2) + 3; bytecopy (dest, dest - (((opcode & 0x60) << 3) + offset + 1), size); dest += size; } else if ( (opcode & 0x40) == 0 ) { byte1 = *src++; byte2 = *src++; size = byte1 >> 6; bytecopy (dest, src, size); dest += size; src += size; size = (opcode & 0x3f) + 4; bytecopy (dest, dest - (((byte1 & 0x3f) << 8) + byte2 + 1), size); dest += size; } else if ( (opcode & 0x20) == 0 ) { byte1 = *src++; byte2 = *src++; byte3 = *src++; size = opcode & 3; bytecopy (dest, src, size); dest += size; src += size; size = byte3 + 5 + ((opcode & 0xc) << 6); bytecopy (dest, dest - ((((opcode & 0x10) >> 4) << 0x10) + 1 + (byte1 << 8) + byte2), size); dest += size; } else { size = ((opcode & 0x1f) << 2) + 4; if (size > 0x70) break; bytecopy (dest, src, size); dest += size; src += size; } } size = opcode & 3; bytecopy(dest, src, size); dest += size; src += size; }
false
FFmpeg
ca16618b01abfde44b4eaf92dc89b01aa1b4a91e
static void xan_unpack(unsigned char *dest, unsigned char *src) { unsigned char opcode; int size; int offset; int byte1, byte2, byte3; for (;;) { opcode = *src++; if ( (opcode & 0x80) == 0 ) { offset = *src++; size = opcode & 3; bytecopy(dest, src, size); dest += size; src += size; size = ((opcode & 0x1c) >> 2) + 3; bytecopy (dest, dest - (((opcode & 0x60) << 3) + offset + 1), size); dest += size; } else if ( (opcode & 0x40) == 0 ) { byte1 = *src++; byte2 = *src++; size = byte1 >> 6; bytecopy (dest, src, size); dest += size; src += size; size = (opcode & 0x3f) + 4; bytecopy (dest, dest - (((byte1 & 0x3f) << 8) + byte2 + 1), size); dest += size; } else if ( (opcode & 0x20) == 0 ) { byte1 = *src++; byte2 = *src++; byte3 = *src++; size = opcode & 3; bytecopy (dest, src, size); dest += size; src += size; size = byte3 + 5 + ((opcode & 0xc) << 6); bytecopy (dest, dest - ((((opcode & 0x10) >> 4) << 0x10) + 1 + (byte1 << 8) + byte2), size); dest += size; } else { size = ((opcode & 0x1f) << 2) + 4; if (size > 0x70) break; bytecopy (dest, src, size); dest += size; src += size; } } size = opcode & 3; bytecopy(dest, src, size); dest += size; src += size; }
{ "code": [], "line_no": [] }
static void FUNC_0(unsigned char *VAR_0, unsigned char *VAR_1) { unsigned char VAR_2; int VAR_3; int VAR_4; int VAR_5, VAR_6, VAR_7; for (;;) { VAR_2 = *VAR_1++; if ( (VAR_2 & 0x80) == 0 ) { VAR_4 = *VAR_1++; VAR_3 = VAR_2 & 3; bytecopy(VAR_0, VAR_1, VAR_3); VAR_0 += VAR_3; VAR_1 += VAR_3; VAR_3 = ((VAR_2 & 0x1c) >> 2) + 3; bytecopy (VAR_0, VAR_0 - (((VAR_2 & 0x60) << 3) + VAR_4 + 1), VAR_3); VAR_0 += VAR_3; } else if ( (VAR_2 & 0x40) == 0 ) { VAR_5 = *VAR_1++; VAR_6 = *VAR_1++; VAR_3 = VAR_5 >> 6; bytecopy (VAR_0, VAR_1, VAR_3); VAR_0 += VAR_3; VAR_1 += VAR_3; VAR_3 = (VAR_2 & 0x3f) + 4; bytecopy (VAR_0, VAR_0 - (((VAR_5 & 0x3f) << 8) + VAR_6 + 1), VAR_3); VAR_0 += VAR_3; } else if ( (VAR_2 & 0x20) == 0 ) { VAR_5 = *VAR_1++; VAR_6 = *VAR_1++; VAR_7 = *VAR_1++; VAR_3 = VAR_2 & 3; bytecopy (VAR_0, VAR_1, VAR_3); VAR_0 += VAR_3; VAR_1 += VAR_3; VAR_3 = VAR_7 + 5 + ((VAR_2 & 0xc) << 6); bytecopy (VAR_0, VAR_0 - ((((VAR_2 & 0x10) >> 4) << 0x10) + 1 + (VAR_5 << 8) + VAR_6), VAR_3); VAR_0 += VAR_3; } else { VAR_3 = ((VAR_2 & 0x1f) << 2) + 4; if (VAR_3 > 0x70) break; bytecopy (VAR_0, VAR_1, VAR_3); VAR_0 += VAR_3; VAR_1 += VAR_3; } } VAR_3 = VAR_2 & 3; bytecopy(VAR_0, VAR_1, VAR_3); VAR_0 += VAR_3; VAR_1 += VAR_3; }
[ "static void FUNC_0(unsigned char *VAR_0, unsigned char *VAR_1)\n{", "unsigned char VAR_2;", "int VAR_3;", "int VAR_4;", "int VAR_5, VAR_6, VAR_7;", "for (;;) {", "VAR_2 = *VAR_1++;", "if ( (VAR_2 & 0x80) == 0 ) {", "VAR_4 = *VAR_1++;", "VAR_3 = VAR_2 & 3;", "bytecopy(VAR_0, VAR_1, VAR_3); 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, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 25 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 59 ...
26,937
START_TEST(qdict_del_test) { const char *key = "key test"; qdict_put(tests_dict, key, qstring_from_str("foo")); fail_unless(qdict_size(tests_dict) == 1); qdict_del(tests_dict, key); fail_unless(qdict_size(tests_dict) == 0); fail_unless(qdict_haskey(tests_dict, key) == 0); }
false
qemu
ac531cb6e542b1e61d668604adf9dc5306a948c0
START_TEST(qdict_del_test) { const char *key = "key test"; qdict_put(tests_dict, key, qstring_from_str("foo")); fail_unless(qdict_size(tests_dict) == 1); qdict_del(tests_dict, key); fail_unless(qdict_size(tests_dict) == 0); fail_unless(qdict_haskey(tests_dict, key) == 0); }
{ "code": [], "line_no": [] }
FUNC_0(VAR_0) { const char *VAR_1 = "VAR_1 test"; qdict_put(tests_dict, VAR_1, qstring_from_str("foo")); fail_unless(qdict_size(tests_dict) == 1); qdict_del(tests_dict, VAR_1); fail_unless(qdict_size(tests_dict) == 0); fail_unless(qdict_haskey(tests_dict, VAR_1) == 0); }
[ "FUNC_0(VAR_0)\n{", "const char *VAR_1 = \"VAR_1 test\";", "qdict_put(tests_dict, VAR_1, qstring_from_str(\"foo\"));", "fail_unless(qdict_size(tests_dict) == 1);", "qdict_del(tests_dict, VAR_1);", "fail_unless(qdict_size(tests_dict) == 0);", "fail_unless(qdict_haskey(tests_dict, VAR_1) == 0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ] ]
26,938
static void spawn_thread(ThreadPool *pool) { pool->cur_threads++; pool->new_threads++; /* If there are threads being created, they will spawn new workers, so * we don't spend time creating many threads in a loop holding a mutex or * starving the current vcpu. * * If there are no idle threads, ask the main thread to create one, so we * inherit the correct affinity instead of the vcpu affinity. */ if (!pool->pending_threads) { qemu_bh_schedule(pool->new_thread_bh); } }
false
qemu
c2b38b277a7882a592f4f2ec955084b2b756daaa
static void spawn_thread(ThreadPool *pool) { pool->cur_threads++; pool->new_threads++; if (!pool->pending_threads) { qemu_bh_schedule(pool->new_thread_bh); } }
{ "code": [], "line_no": [] }
static void FUNC_0(ThreadPool *VAR_0) { VAR_0->cur_threads++; VAR_0->new_threads++; if (!VAR_0->pending_threads) { qemu_bh_schedule(VAR_0->new_thread_bh); } }
[ "static void FUNC_0(ThreadPool *VAR_0)\n{", "VAR_0->cur_threads++;", "VAR_0->new_threads++;", "if (!VAR_0->pending_threads) {", "qemu_bh_schedule(VAR_0->new_thread_bh);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ] ]
26,939
static void vnc_display_close(VncDisplay *vs) { if (!vs) return; g_free(vs->display); vs->display = NULL; if (vs->lsock != -1) { qemu_set_fd_handler2(vs->lsock, NULL, NULL, NULL, NULL); close(vs->lsock); vs->lsock = -1; } #ifdef CONFIG_VNC_WS g_free(vs->ws_display); vs->ws_display = NULL; if (vs->lwebsock != -1) { qemu_set_fd_handler2(vs->lwebsock, NULL, NULL, NULL, NULL); close(vs->lwebsock); vs->lwebsock = -1; } #endif /* CONFIG_VNC_WS */ vs->auth = VNC_AUTH_INVALID; #ifdef CONFIG_VNC_TLS vs->subauth = VNC_AUTH_INVALID; vs->tls.x509verify = 0; #endif }
false
qemu
bf7aa45e7b378691ea0e8616a2aeae2aaabb7bc3
static void vnc_display_close(VncDisplay *vs) { if (!vs) return; g_free(vs->display); vs->display = NULL; if (vs->lsock != -1) { qemu_set_fd_handler2(vs->lsock, NULL, NULL, NULL, NULL); close(vs->lsock); vs->lsock = -1; } #ifdef CONFIG_VNC_WS g_free(vs->ws_display); vs->ws_display = NULL; if (vs->lwebsock != -1) { qemu_set_fd_handler2(vs->lwebsock, NULL, NULL, NULL, NULL); close(vs->lwebsock); vs->lwebsock = -1; } #endif vs->auth = VNC_AUTH_INVALID; #ifdef CONFIG_VNC_TLS vs->subauth = VNC_AUTH_INVALID; vs->tls.x509verify = 0; #endif }
{ "code": [], "line_no": [] }
static void FUNC_0(VncDisplay *VAR_0) { if (!VAR_0) return; g_free(VAR_0->display); VAR_0->display = NULL; if (VAR_0->lsock != -1) { qemu_set_fd_handler2(VAR_0->lsock, NULL, NULL, NULL, NULL); close(VAR_0->lsock); VAR_0->lsock = -1; } #ifdef CONFIG_VNC_WS g_free(VAR_0->ws_display); VAR_0->ws_display = NULL; if (VAR_0->lwebsock != -1) { qemu_set_fd_handler2(VAR_0->lwebsock, NULL, NULL, NULL, NULL); close(VAR_0->lwebsock); VAR_0->lwebsock = -1; } #endif VAR_0->auth = VNC_AUTH_INVALID; #ifdef CONFIG_VNC_TLS VAR_0->subauth = VNC_AUTH_INVALID; VAR_0->tls.x509verify = 0; #endif }
[ "static void FUNC_0(VncDisplay *VAR_0)\n{", "if (!VAR_0)\nreturn;", "g_free(VAR_0->display);", "VAR_0->display = NULL;", "if (VAR_0->lsock != -1) {", "qemu_set_fd_handler2(VAR_0->lsock, NULL, NULL, NULL, NULL);", "close(VAR_0->lsock);", "VAR_0->lsock = -1;", "}", "#ifdef CONFIG_VNC_WS\ng_free(VAR_...
[ 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 ...
26,940
void kvm_s390_crw_mchk(S390CPU *cpu) { kvm_s390_interrupt_internal(cpu, KVM_S390_MCHK, 1 << 28, 0x00400f1d40330000, 1); }
false
qemu
de13d2161473d02ae97ec0f8e4503147554892dd
void kvm_s390_crw_mchk(S390CPU *cpu) { kvm_s390_interrupt_internal(cpu, KVM_S390_MCHK, 1 << 28, 0x00400f1d40330000, 1); }
{ "code": [], "line_no": [] }
void FUNC_0(S390CPU *VAR_0) { kvm_s390_interrupt_internal(VAR_0, KVM_S390_MCHK, 1 << 28, 0x00400f1d40330000, 1); }
[ "void FUNC_0(S390CPU *VAR_0)\n{", "kvm_s390_interrupt_internal(VAR_0, KVM_S390_MCHK, 1 << 28,\n0x00400f1d40330000, 1);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ] ]
26,942
static int pxa2xx_i2c_slave_init(I2CSlave *i2c) { /* Nothing to do. */ return 0; }
false
qemu
9e41bade85ef338afd983c109368d1bbbe931f80
static int pxa2xx_i2c_slave_init(I2CSlave *i2c) { return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(I2CSlave *VAR_0) { return 0; }
[ "static int FUNC_0(I2CSlave *VAR_0)\n{", "return 0;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 7 ], [ 9 ] ]
26,943
static void openpic_cpu_write_internal(void *opaque, hwaddr addr, uint32_t val, int idx) { openpic_t *opp = opaque; IRQ_src_t *src; IRQ_dst_t *dst; int s_IRQ, n_IRQ; DPRINTF("%s: cpu %d addr " TARGET_FMT_plx " <= %08x\n", __func__, idx, addr, val); if (addr & 0xF) return; dst = &opp->dst[idx]; addr &= 0xFF0; switch (addr) { case 0x40: /* IPIDR */ case 0x50: case 0x60: case 0x70: idx = (addr - 0x40) >> 4; /* we use IDE as mask which CPUs to deliver the IPI to still. */ write_IRQreg_ide(opp, opp->irq_ipi0 + idx, opp->src[opp->irq_ipi0 + idx].ide | val); openpic_set_irq(opp, opp->irq_ipi0 + idx, 1); openpic_set_irq(opp, opp->irq_ipi0 + idx, 0); break; case 0x80: /* PCTP */ dst->pctp = val & 0x0000000F; break; case 0x90: /* WHOAMI */ /* Read-only register */ break; case 0xA0: /* PIAC */ /* Read-only register */ break; case 0xB0: /* PEOI */ DPRINTF("PEOI\n"); s_IRQ = IRQ_get_next(opp, &dst->servicing); IRQ_resetbit(&dst->servicing, s_IRQ); dst->servicing.next = -1; /* Set up next servicing IRQ */ s_IRQ = IRQ_get_next(opp, &dst->servicing); /* Check queued interrupts. */ n_IRQ = IRQ_get_next(opp, &dst->raised); src = &opp->src[n_IRQ]; if (n_IRQ != -1 && (s_IRQ == -1 || IPVP_PRIORITY(src->ipvp) > dst->servicing.priority)) { DPRINTF("Raise OpenPIC INT output cpu %d irq %d\n", idx, n_IRQ); opp->irq_raise(opp, idx, src); } break; default: break; } }
false
qemu
5861a33898bbddfd1a80c2e202cb9352e3b1ba62
static void openpic_cpu_write_internal(void *opaque, hwaddr addr, uint32_t val, int idx) { openpic_t *opp = opaque; IRQ_src_t *src; IRQ_dst_t *dst; int s_IRQ, n_IRQ; DPRINTF("%s: cpu %d addr " TARGET_FMT_plx " <= %08x\n", __func__, idx, addr, val); if (addr & 0xF) return; dst = &opp->dst[idx]; addr &= 0xFF0; switch (addr) { case 0x40: case 0x50: case 0x60: case 0x70: idx = (addr - 0x40) >> 4; write_IRQreg_ide(opp, opp->irq_ipi0 + idx, opp->src[opp->irq_ipi0 + idx].ide | val); openpic_set_irq(opp, opp->irq_ipi0 + idx, 1); openpic_set_irq(opp, opp->irq_ipi0 + idx, 0); break; case 0x80: dst->pctp = val & 0x0000000F; break; case 0x90: break; case 0xA0: break; case 0xB0: DPRINTF("PEOI\n"); s_IRQ = IRQ_get_next(opp, &dst->servicing); IRQ_resetbit(&dst->servicing, s_IRQ); dst->servicing.next = -1; s_IRQ = IRQ_get_next(opp, &dst->servicing); n_IRQ = IRQ_get_next(opp, &dst->raised); src = &opp->src[n_IRQ]; if (n_IRQ != -1 && (s_IRQ == -1 || IPVP_PRIORITY(src->ipvp) > dst->servicing.priority)) { DPRINTF("Raise OpenPIC INT output cpu %d irq %d\n", idx, n_IRQ); opp->irq_raise(opp, idx, src); } break; default: break; } }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, hwaddr VAR_1, uint32_t VAR_2, int VAR_3) { openpic_t *opp = VAR_0; IRQ_src_t *src; IRQ_dst_t *dst; int VAR_4, VAR_5; DPRINTF("%s: cpu %d VAR_1 " TARGET_FMT_plx " <= %08x\n", __func__, VAR_3, VAR_1, VAR_2); if (VAR_1 & 0xF) return; dst = &opp->dst[VAR_3]; VAR_1 &= 0xFF0; switch (VAR_1) { case 0x40: case 0x50: case 0x60: case 0x70: VAR_3 = (VAR_1 - 0x40) >> 4; write_IRQreg_ide(opp, opp->irq_ipi0 + VAR_3, opp->src[opp->irq_ipi0 + VAR_3].ide | VAR_2); openpic_set_irq(opp, opp->irq_ipi0 + VAR_3, 1); openpic_set_irq(opp, opp->irq_ipi0 + VAR_3, 0); break; case 0x80: dst->pctp = VAR_2 & 0x0000000F; break; case 0x90: break; case 0xA0: break; case 0xB0: DPRINTF("PEOI\n"); VAR_4 = IRQ_get_next(opp, &dst->servicing); IRQ_resetbit(&dst->servicing, VAR_4); dst->servicing.next = -1; VAR_4 = IRQ_get_next(opp, &dst->servicing); VAR_5 = IRQ_get_next(opp, &dst->raised); src = &opp->src[VAR_5]; if (VAR_5 != -1 && (VAR_4 == -1 || IPVP_PRIORITY(src->ipvp) > dst->servicing.priority)) { DPRINTF("Raise OpenPIC INT output cpu %d irq %d\n", VAR_3, VAR_5); opp->irq_raise(opp, VAR_3, src); } break; default: break; } }
[ "static void FUNC_0(void *VAR_0, hwaddr VAR_1,\nuint32_t VAR_2, int VAR_3)\n{", "openpic_t *opp = VAR_0;", "IRQ_src_t *src;", "IRQ_dst_t *dst;", "int VAR_4, VAR_5;", "DPRINTF(\"%s: cpu %d VAR_1 \" TARGET_FMT_plx \" <= %08x\\n\", __func__, VAR_3,\nVAR_1, VAR_2);", "if (VAR_1 & 0xF)\nreturn;", "dst = &o...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 33, 35, 37, 39 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53,...
26,944
static inline int dmg_read_chunk(BDRVDMGState *s,int sector_num) { if(!is_sector_in_chunk(s,s->current_chunk,sector_num)) { int ret; uint32_t chunk = search_chunk(s,sector_num); if(chunk>=s->n_chunks) return -1; s->current_chunk = s->n_chunks; switch(s->types[chunk]) { case 0x80000005: { /* zlib compressed */ int i; /* we need to buffer, because only the chunk as whole can be * inflated. */ i=0; do { ret = pread(s->fd, s->compressed_chunk+i, s->lengths[chunk]-i, s->offsets[chunk] + i); if(ret<0 && errno==EINTR) ret=0; i+=ret; } while(ret>=0 && ret+i<s->lengths[chunk]); if (ret != s->lengths[chunk]) return -1; s->zstream.next_in = s->compressed_chunk; s->zstream.avail_in = s->lengths[chunk]; s->zstream.next_out = s->uncompressed_chunk; s->zstream.avail_out = 512*s->sectorcounts[chunk]; ret = inflateReset(&s->zstream); if(ret != Z_OK) return -1; ret = inflate(&s->zstream, Z_FINISH); if(ret != Z_STREAM_END || s->zstream.total_out != 512*s->sectorcounts[chunk]) return -1; break; } case 1: /* copy */ ret = pread(s->fd, s->uncompressed_chunk, s->lengths[chunk], s->offsets[chunk]); if (ret != s->lengths[chunk]) return -1; break; case 2: /* zero */ memset(s->uncompressed_chunk, 0, 512*s->sectorcounts[chunk]); break; } s->current_chunk = chunk; } return 0; }
false
qemu
64a31d5c3d73396a88563d7a504654edc85aa854
static inline int dmg_read_chunk(BDRVDMGState *s,int sector_num) { if(!is_sector_in_chunk(s,s->current_chunk,sector_num)) { int ret; uint32_t chunk = search_chunk(s,sector_num); if(chunk>=s->n_chunks) return -1; s->current_chunk = s->n_chunks; switch(s->types[chunk]) { case 0x80000005: { int i; i=0; do { ret = pread(s->fd, s->compressed_chunk+i, s->lengths[chunk]-i, s->offsets[chunk] + i); if(ret<0 && errno==EINTR) ret=0; i+=ret; } while(ret>=0 && ret+i<s->lengths[chunk]); if (ret != s->lengths[chunk]) return -1; s->zstream.next_in = s->compressed_chunk; s->zstream.avail_in = s->lengths[chunk]; s->zstream.next_out = s->uncompressed_chunk; s->zstream.avail_out = 512*s->sectorcounts[chunk]; ret = inflateReset(&s->zstream); if(ret != Z_OK) return -1; ret = inflate(&s->zstream, Z_FINISH); if(ret != Z_STREAM_END || s->zstream.total_out != 512*s->sectorcounts[chunk]) return -1; break; } case 1: ret = pread(s->fd, s->uncompressed_chunk, s->lengths[chunk], s->offsets[chunk]); if (ret != s->lengths[chunk]) return -1; break; case 2: memset(s->uncompressed_chunk, 0, 512*s->sectorcounts[chunk]); break; } s->current_chunk = chunk; } return 0; }
{ "code": [], "line_no": [] }
static inline int FUNC_0(BDRVDMGState *VAR_0,int VAR_1) { if(!is_sector_in_chunk(VAR_0,VAR_0->current_chunk,VAR_1)) { int VAR_2; uint32_t chunk = search_chunk(VAR_0,VAR_1); if(chunk>=VAR_0->n_chunks) return -1; VAR_0->current_chunk = VAR_0->n_chunks; switch(VAR_0->types[chunk]) { case 0x80000005: { int VAR_3; VAR_3=0; do { VAR_2 = pread(VAR_0->fd, VAR_0->compressed_chunk+VAR_3, VAR_0->lengths[chunk]-VAR_3, VAR_0->offsets[chunk] + VAR_3); if(VAR_2<0 && errno==EINTR) VAR_2=0; VAR_3+=VAR_2; } while(VAR_2>=0 && VAR_2+VAR_3<VAR_0->lengths[chunk]); if (VAR_2 != VAR_0->lengths[chunk]) return -1; VAR_0->zstream.next_in = VAR_0->compressed_chunk; VAR_0->zstream.avail_in = VAR_0->lengths[chunk]; VAR_0->zstream.next_out = VAR_0->uncompressed_chunk; VAR_0->zstream.avail_out = 512*VAR_0->sectorcounts[chunk]; VAR_2 = inflateReset(&VAR_0->zstream); if(VAR_2 != Z_OK) return -1; VAR_2 = inflate(&VAR_0->zstream, Z_FINISH); if(VAR_2 != Z_STREAM_END || VAR_0->zstream.total_out != 512*VAR_0->sectorcounts[chunk]) return -1; break; } case 1: VAR_2 = pread(VAR_0->fd, VAR_0->uncompressed_chunk, VAR_0->lengths[chunk], VAR_0->offsets[chunk]); if (VAR_2 != VAR_0->lengths[chunk]) return -1; break; case 2: memset(VAR_0->uncompressed_chunk, 0, 512*VAR_0->sectorcounts[chunk]); break; } VAR_0->current_chunk = chunk; } return 0; }
[ "static inline int FUNC_0(BDRVDMGState *VAR_0,int VAR_1)\n{", "if(!is_sector_in_chunk(VAR_0,VAR_0->current_chunk,VAR_1)) {", "int VAR_2;", "uint32_t chunk = search_chunk(VAR_0,VAR_1);", "if(chunk>=VAR_0->n_chunks)\nreturn -1;", "VAR_0->current_chunk = VAR_0->n_chunks;", "switch(VAR_0->types[chunk]) {", ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 51, 53 ], [ 57 ], [ 59 ...
26,948
static QObject *pci_get_dev_dict(PCIDevice *dev, PCIBus *bus, int bus_num) { int class; QObject *obj; obj = qobject_from_jsonf("{ 'bus': %d, 'slot': %d, 'function': %d," "'class_info': %p, 'id': %p, 'regions': %p," " 'qdev_id': %s }", bus_num, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn), pci_get_dev_class(dev), pci_get_dev_id(dev), pci_get_regions_list(dev), dev->qdev.id ? dev->qdev.id : ""); if (dev->config[PCI_INTERRUPT_PIN] != 0) { QDict *qdict = qobject_to_qdict(obj); qdict_put(qdict, "irq", qint_from_int(dev->config[PCI_INTERRUPT_LINE])); } class = pci_get_word(dev->config + PCI_CLASS_DEVICE); if (class == 0x0604) { QDict *qdict; QObject *pci_bridge; pci_bridge = qobject_from_jsonf("{ 'bus': " "{ 'number': %d, 'secondary': %d, 'subordinate': %d }, " "'io_range': { 'base': %" PRId64 ", 'limit': %" PRId64 "}, " "'memory_range': { 'base': %" PRId64 ", 'limit': %" PRId64 "}, " "'prefetchable_range': { 'base': %" PRId64 ", 'limit': %" PRId64 "} }", dev->config[0x19], dev->config[PCI_SECONDARY_BUS], dev->config[PCI_SUBORDINATE_BUS], pci_bridge_get_base(dev, PCI_BASE_ADDRESS_SPACE_IO), pci_bridge_get_limit(dev, PCI_BASE_ADDRESS_SPACE_IO), pci_bridge_get_base(dev, PCI_BASE_ADDRESS_SPACE_MEMORY), pci_bridge_get_limit(dev, PCI_BASE_ADDRESS_SPACE_MEMORY), pci_bridge_get_base(dev, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_PREFETCH), pci_bridge_get_limit(dev, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_PREFETCH)); if (dev->config[0x19] != 0) { qdict = qobject_to_qdict(pci_bridge); qdict_put_obj(qdict, "devices", pci_get_devices_list(bus, dev->config[0x19])); } qdict = qobject_to_qdict(obj); qdict_put_obj(qdict, "pci_bridge", pci_bridge); } return obj; }
false
qemu
c021f8e65f5009a5ab5711d9d5326fcab553ef1c
static QObject *pci_get_dev_dict(PCIDevice *dev, PCIBus *bus, int bus_num) { int class; QObject *obj; obj = qobject_from_jsonf("{ 'bus': %d, 'slot': %d, 'function': %d," "'class_info': %p, 'id': %p, 'regions': %p," " 'qdev_id': %s }", bus_num, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn), pci_get_dev_class(dev), pci_get_dev_id(dev), pci_get_regions_list(dev), dev->qdev.id ? dev->qdev.id : ""); if (dev->config[PCI_INTERRUPT_PIN] != 0) { QDict *qdict = qobject_to_qdict(obj); qdict_put(qdict, "irq", qint_from_int(dev->config[PCI_INTERRUPT_LINE])); } class = pci_get_word(dev->config + PCI_CLASS_DEVICE); if (class == 0x0604) { QDict *qdict; QObject *pci_bridge; pci_bridge = qobject_from_jsonf("{ 'bus': " "{ 'number': %d, 'secondary': %d, 'subordinate': %d }, " "'io_range': { 'base': %" PRId64 ", 'limit': %" PRId64 "}, " "'memory_range': { 'base': %" PRId64 ", 'limit': %" PRId64 "}, " "'prefetchable_range': { 'base': %" PRId64 ", 'limit': %" PRId64 "} }", dev->config[0x19], dev->config[PCI_SECONDARY_BUS], dev->config[PCI_SUBORDINATE_BUS], pci_bridge_get_base(dev, PCI_BASE_ADDRESS_SPACE_IO), pci_bridge_get_limit(dev, PCI_BASE_ADDRESS_SPACE_IO), pci_bridge_get_base(dev, PCI_BASE_ADDRESS_SPACE_MEMORY), pci_bridge_get_limit(dev, PCI_BASE_ADDRESS_SPACE_MEMORY), pci_bridge_get_base(dev, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_PREFETCH), pci_bridge_get_limit(dev, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_PREFETCH)); if (dev->config[0x19] != 0) { qdict = qobject_to_qdict(pci_bridge); qdict_put_obj(qdict, "devices", pci_get_devices_list(bus, dev->config[0x19])); } qdict = qobject_to_qdict(obj); qdict_put_obj(qdict, "pci_bridge", pci_bridge); } return obj; }
{ "code": [], "line_no": [] }
static QObject *FUNC_0(PCIDevice *dev, PCIBus *bus, int bus_num) { int VAR_0; QObject *obj; obj = qobject_from_jsonf("{ 'bus': %d, 'slot': %d, 'function': %d," "'class_info': %p, 'id': %p, 'regions': %p," " 'qdev_id': %s }", bus_num, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn), pci_get_dev_class(dev), pci_get_dev_id(dev), pci_get_regions_list(dev), dev->qdev.id ? dev->qdev.id : ""); if (dev->config[PCI_INTERRUPT_PIN] != 0) { QDict *qdict = qobject_to_qdict(obj); qdict_put(qdict, "irq", qint_from_int(dev->config[PCI_INTERRUPT_LINE])); } VAR_0 = pci_get_word(dev->config + PCI_CLASS_DEVICE); if (VAR_0 == 0x0604) { QDict *qdict; QObject *pci_bridge; pci_bridge = qobject_from_jsonf("{ 'bus': " "{ 'number': %d, 'secondary': %d, 'subordinate': %d }, " "'io_range': { 'base': %" PRId64 ", 'limit': %" PRId64 "}, " "'memory_range': { 'base': %" PRId64 ", 'limit': %" PRId64 "}, " "'prefetchable_range': { 'base': %" PRId64 ", 'limit': %" PRId64 "} }", dev->config[0x19], dev->config[PCI_SECONDARY_BUS], dev->config[PCI_SUBORDINATE_BUS], pci_bridge_get_base(dev, PCI_BASE_ADDRESS_SPACE_IO), pci_bridge_get_limit(dev, PCI_BASE_ADDRESS_SPACE_IO), pci_bridge_get_base(dev, PCI_BASE_ADDRESS_SPACE_MEMORY), pci_bridge_get_limit(dev, PCI_BASE_ADDRESS_SPACE_MEMORY), pci_bridge_get_base(dev, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_PREFETCH), pci_bridge_get_limit(dev, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_PREFETCH)); if (dev->config[0x19] != 0) { qdict = qobject_to_qdict(pci_bridge); qdict_put_obj(qdict, "devices", pci_get_devices_list(bus, dev->config[0x19])); } qdict = qobject_to_qdict(obj); qdict_put_obj(qdict, "pci_bridge", pci_bridge); } return obj; }
[ "static QObject *FUNC_0(PCIDevice *dev, PCIBus *bus, int bus_num)\n{", "int VAR_0;", "QObject *obj;", "obj = qobject_from_jsonf(\"{ 'bus': %d, 'slot': %d, 'function': %d,\" \"'class_info': %p, 'id': %p, 'regions': %p,\"", "\" 'qdev_id': %s }\",", "bus_num,\nPCI_SLOT(d...
[ 0, 0, 0, 0, 0, 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, 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53...
26,949
static void vga_draw_graphic(VGAState *s, int full_update) { int y1, y, update, page_min, page_max, linesize, y_start, double_scan, mask, depth; int width, height, shift_control, line_offset, page0, page1, bwidth, bits; int disp_width, multi_scan, multi_run; uint8_t *d; uint32_t v, addr1, addr; vga_draw_line_func *vga_draw_line; full_update |= update_basic_params(s); if (!full_update) vga_sync_dirty_bitmap(s); s->get_resolution(s, &width, &height); disp_width = width; shift_control = (s->gr[0x05] >> 5) & 3; double_scan = (s->cr[0x09] >> 7); if (shift_control != 1) { multi_scan = (((s->cr[0x09] & 0x1f) + 1) << double_scan) - 1; } else { /* in CGA modes, multi_scan is ignored */ /* XXX: is it correct ? */ multi_scan = double_scan; } multi_run = multi_scan; if (shift_control != s->shift_control || double_scan != s->double_scan) { full_update = 1; s->shift_control = shift_control; s->double_scan = double_scan; } depth = s->get_bpp(s); if (s->line_offset != s->last_line_offset || disp_width != s->last_width || height != s->last_height || s->last_depth != depth) { #if defined(WORDS_BIGENDIAN) == defined(TARGET_WORDS_BIGENDIAN) if (depth == 16 || depth == 32) { #else if (depth == 32) { #endif if (is_graphic_console()) { qemu_free_displaysurface(s->ds); s->ds->surface = qemu_create_displaysurface_from(disp_width, height, depth, s->line_offset, s->vram_ptr + (s->start_addr * 4)); #if defined(WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN) s->ds->surface->pf = qemu_different_endianness_pixelformat(depth); #endif dpy_resize(s->ds); } else { qemu_console_resize(s->ds, disp_width, height); } } else { qemu_console_resize(s->ds, disp_width, height); } s->last_scr_width = disp_width; s->last_scr_height = height; s->last_width = disp_width; s->last_height = height; s->last_line_offset = s->line_offset; s->last_depth = depth; full_update = 1; } else if (is_graphic_console() && is_buffer_shared(s->ds->surface) && (full_update || s->ds->surface->data != s->vram_ptr + (s->start_addr * 4))) { s->ds->surface->data = s->vram_ptr + (s->start_addr * 4); dpy_setdata(s->ds); } s->rgb_to_pixel = rgb_to_pixel_dup_table[get_depth_index(s->ds)]; if (shift_control == 0) { full_update |= update_palette16(s); if (s->sr[0x01] & 8) { v = VGA_DRAW_LINE4D2; disp_width <<= 1; } else { v = VGA_DRAW_LINE4; } bits = 4; } else if (shift_control == 1) { full_update |= update_palette16(s); if (s->sr[0x01] & 8) { v = VGA_DRAW_LINE2D2; disp_width <<= 1; } else { v = VGA_DRAW_LINE2; } bits = 4; } else { switch(s->get_bpp(s)) { default: case 0: full_update |= update_palette256(s); v = VGA_DRAW_LINE8D2; bits = 4; break; case 8: full_update |= update_palette256(s); v = VGA_DRAW_LINE8; bits = 8; break; case 15: v = VGA_DRAW_LINE15; bits = 16; break; case 16: v = VGA_DRAW_LINE16; bits = 16; break; case 24: v = VGA_DRAW_LINE24; bits = 24; break; case 32: v = VGA_DRAW_LINE32; bits = 32; break; } } vga_draw_line = vga_draw_line_table[v * NB_DEPTHS + get_depth_index(s->ds)]; if (!is_buffer_shared(s->ds->surface) && s->cursor_invalidate) s->cursor_invalidate(s); line_offset = s->line_offset; #if 0 printf("w=%d h=%d v=%d line_offset=%d cr[0x09]=0x%02x cr[0x17]=0x%02x linecmp=%d sr[0x01]=0x%02x\n", width, height, v, line_offset, s->cr[9], s->cr[0x17], s->line_compare, s->sr[0x01]); #endif addr1 = (s->start_addr * 4); bwidth = (width * bits + 7) / 8; y_start = -1; page_min = 0x7fffffff; page_max = -1; d = ds_get_data(s->ds); linesize = ds_get_linesize(s->ds); y1 = 0; for(y = 0; y < height; y++) { addr = addr1; if (!(s->cr[0x17] & 1)) { int shift; /* CGA compatibility handling */ shift = 14 + ((s->cr[0x17] >> 6) & 1); addr = (addr & ~(1 << shift)) | ((y1 & 1) << shift); } if (!(s->cr[0x17] & 2)) { addr = (addr & ~0x8000) | ((y1 & 2) << 14); } page0 = s->vram_offset + (addr & TARGET_PAGE_MASK); page1 = s->vram_offset + ((addr + bwidth - 1) & TARGET_PAGE_MASK); update = full_update | cpu_physical_memory_get_dirty(page0, VGA_DIRTY_FLAG) | cpu_physical_memory_get_dirty(page1, VGA_DIRTY_FLAG); if ((page1 - page0) > TARGET_PAGE_SIZE) { /* if wide line, can use another page */ update |= cpu_physical_memory_get_dirty(page0 + TARGET_PAGE_SIZE, VGA_DIRTY_FLAG); } /* explicit invalidation for the hardware cursor */ update |= (s->invalidated_y_table[y >> 5] >> (y & 0x1f)) & 1; if (update) { if (y_start < 0) y_start = y; if (page0 < page_min) page_min = page0; if (page1 > page_max) page_max = page1; if (!(is_buffer_shared(s->ds->surface))) { vga_draw_line(s, d, s->vram_ptr + addr, width); if (s->cursor_draw_line) s->cursor_draw_line(s, d, y); } } else { if (y_start >= 0) { /* flush to display */ dpy_update(s->ds, 0, y_start, disp_width, y - y_start); y_start = -1; } } if (!multi_run) { mask = (s->cr[0x17] & 3) ^ 3; if ((y1 & mask) == mask) addr1 += line_offset; y1++; multi_run = multi_scan; } else { multi_run--; } /* line compare acts on the displayed lines */ if (y == s->line_compare) addr1 = 0; d += linesize; } if (y_start >= 0) { /* flush to display */ dpy_update(s->ds, 0, y_start, disp_width, y - y_start); } /* reset modified pages */ if (page_max != -1) { cpu_physical_memory_reset_dirty(page_min, page_max + TARGET_PAGE_SIZE, VGA_DIRTY_FLAG); } memset(s->invalidated_y_table, 0, ((height + 31) >> 5) * 4); }
false
qemu
b8c18e4c901edae8cc14c07baa36f852be1f1ad0
static void vga_draw_graphic(VGAState *s, int full_update) { int y1, y, update, page_min, page_max, linesize, y_start, double_scan, mask, depth; int width, height, shift_control, line_offset, page0, page1, bwidth, bits; int disp_width, multi_scan, multi_run; uint8_t *d; uint32_t v, addr1, addr; vga_draw_line_func *vga_draw_line; full_update |= update_basic_params(s); if (!full_update) vga_sync_dirty_bitmap(s); s->get_resolution(s, &width, &height); disp_width = width; shift_control = (s->gr[0x05] >> 5) & 3; double_scan = (s->cr[0x09] >> 7); if (shift_control != 1) { multi_scan = (((s->cr[0x09] & 0x1f) + 1) << double_scan) - 1; } else { multi_scan = double_scan; } multi_run = multi_scan; if (shift_control != s->shift_control || double_scan != s->double_scan) { full_update = 1; s->shift_control = shift_control; s->double_scan = double_scan; } depth = s->get_bpp(s); if (s->line_offset != s->last_line_offset || disp_width != s->last_width || height != s->last_height || s->last_depth != depth) { #if defined(WORDS_BIGENDIAN) == defined(TARGET_WORDS_BIGENDIAN) if (depth == 16 || depth == 32) { #else if (depth == 32) { #endif if (is_graphic_console()) { qemu_free_displaysurface(s->ds); s->ds->surface = qemu_create_displaysurface_from(disp_width, height, depth, s->line_offset, s->vram_ptr + (s->start_addr * 4)); #if defined(WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN) s->ds->surface->pf = qemu_different_endianness_pixelformat(depth); #endif dpy_resize(s->ds); } else { qemu_console_resize(s->ds, disp_width, height); } } else { qemu_console_resize(s->ds, disp_width, height); } s->last_scr_width = disp_width; s->last_scr_height = height; s->last_width = disp_width; s->last_height = height; s->last_line_offset = s->line_offset; s->last_depth = depth; full_update = 1; } else if (is_graphic_console() && is_buffer_shared(s->ds->surface) && (full_update || s->ds->surface->data != s->vram_ptr + (s->start_addr * 4))) { s->ds->surface->data = s->vram_ptr + (s->start_addr * 4); dpy_setdata(s->ds); } s->rgb_to_pixel = rgb_to_pixel_dup_table[get_depth_index(s->ds)]; if (shift_control == 0) { full_update |= update_palette16(s); if (s->sr[0x01] & 8) { v = VGA_DRAW_LINE4D2; disp_width <<= 1; } else { v = VGA_DRAW_LINE4; } bits = 4; } else if (shift_control == 1) { full_update |= update_palette16(s); if (s->sr[0x01] & 8) { v = VGA_DRAW_LINE2D2; disp_width <<= 1; } else { v = VGA_DRAW_LINE2; } bits = 4; } else { switch(s->get_bpp(s)) { default: case 0: full_update |= update_palette256(s); v = VGA_DRAW_LINE8D2; bits = 4; break; case 8: full_update |= update_palette256(s); v = VGA_DRAW_LINE8; bits = 8; break; case 15: v = VGA_DRAW_LINE15; bits = 16; break; case 16: v = VGA_DRAW_LINE16; bits = 16; break; case 24: v = VGA_DRAW_LINE24; bits = 24; break; case 32: v = VGA_DRAW_LINE32; bits = 32; break; } } vga_draw_line = vga_draw_line_table[v * NB_DEPTHS + get_depth_index(s->ds)]; if (!is_buffer_shared(s->ds->surface) && s->cursor_invalidate) s->cursor_invalidate(s); line_offset = s->line_offset; #if 0 printf("w=%d h=%d v=%d line_offset=%d cr[0x09]=0x%02x cr[0x17]=0x%02x linecmp=%d sr[0x01]=0x%02x\n", width, height, v, line_offset, s->cr[9], s->cr[0x17], s->line_compare, s->sr[0x01]); #endif addr1 = (s->start_addr * 4); bwidth = (width * bits + 7) / 8; y_start = -1; page_min = 0x7fffffff; page_max = -1; d = ds_get_data(s->ds); linesize = ds_get_linesize(s->ds); y1 = 0; for(y = 0; y < height; y++) { addr = addr1; if (!(s->cr[0x17] & 1)) { int shift; shift = 14 + ((s->cr[0x17] >> 6) & 1); addr = (addr & ~(1 << shift)) | ((y1 & 1) << shift); } if (!(s->cr[0x17] & 2)) { addr = (addr & ~0x8000) | ((y1 & 2) << 14); } page0 = s->vram_offset + (addr & TARGET_PAGE_MASK); page1 = s->vram_offset + ((addr + bwidth - 1) & TARGET_PAGE_MASK); update = full_update | cpu_physical_memory_get_dirty(page0, VGA_DIRTY_FLAG) | cpu_physical_memory_get_dirty(page1, VGA_DIRTY_FLAG); if ((page1 - page0) > TARGET_PAGE_SIZE) { update |= cpu_physical_memory_get_dirty(page0 + TARGET_PAGE_SIZE, VGA_DIRTY_FLAG); } update |= (s->invalidated_y_table[y >> 5] >> (y & 0x1f)) & 1; if (update) { if (y_start < 0) y_start = y; if (page0 < page_min) page_min = page0; if (page1 > page_max) page_max = page1; if (!(is_buffer_shared(s->ds->surface))) { vga_draw_line(s, d, s->vram_ptr + addr, width); if (s->cursor_draw_line) s->cursor_draw_line(s, d, y); } } else { if (y_start >= 0) { dpy_update(s->ds, 0, y_start, disp_width, y - y_start); y_start = -1; } } if (!multi_run) { mask = (s->cr[0x17] & 3) ^ 3; if ((y1 & mask) == mask) addr1 += line_offset; y1++; multi_run = multi_scan; } else { multi_run--; } if (y == s->line_compare) addr1 = 0; d += linesize; } if (y_start >= 0) { dpy_update(s->ds, 0, y_start, disp_width, y - y_start); } if (page_max != -1) { cpu_physical_memory_reset_dirty(page_min, page_max + TARGET_PAGE_SIZE, VGA_DIRTY_FLAG); } memset(s->invalidated_y_table, 0, ((height + 31) >> 5) * 4); }
{ "code": [], "line_no": [] }
static void FUNC_0(VGAState *VAR_0, int VAR_1) { int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11; int VAR_12, VAR_13, VAR_14, VAR_15, VAR_16, VAR_17, VAR_18, VAR_19; int VAR_20, VAR_21, VAR_22; uint8_t *d; uint32_t v, addr1, addr; vga_draw_line_func *vga_draw_line; VAR_1 |= update_basic_params(VAR_0); if (!VAR_1) vga_sync_dirty_bitmap(VAR_0); VAR_0->get_resolution(VAR_0, &VAR_12, &VAR_13); VAR_20 = VAR_12; VAR_14 = (VAR_0->gr[0x05] >> 5) & 3; VAR_9 = (VAR_0->cr[0x09] >> 7); if (VAR_14 != 1) { VAR_21 = (((VAR_0->cr[0x09] & 0x1f) + 1) << VAR_9) - 1; } else { VAR_21 = VAR_9; } VAR_22 = VAR_21; if (VAR_14 != VAR_0->VAR_14 || VAR_9 != VAR_0->VAR_9) { VAR_1 = 1; VAR_0->VAR_14 = VAR_14; VAR_0->VAR_9 = VAR_9; } VAR_11 = VAR_0->get_bpp(VAR_0); if (VAR_0->VAR_15 != VAR_0->last_line_offset || VAR_20 != VAR_0->last_width || VAR_13 != VAR_0->last_height || VAR_0->last_depth != VAR_11) { #if defined(WORDS_BIGENDIAN) == defined(TARGET_WORDS_BIGENDIAN) if (VAR_11 == 16 || VAR_11 == 32) { #else if (VAR_11 == 32) { #endif if (is_graphic_console()) { qemu_free_displaysurface(VAR_0->ds); VAR_0->ds->surface = qemu_create_displaysurface_from(VAR_20, VAR_13, VAR_11, VAR_0->VAR_15, VAR_0->vram_ptr + (VAR_0->start_addr * 4)); #if defined(WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN) VAR_0->ds->surface->pf = qemu_different_endianness_pixelformat(VAR_11); #endif dpy_resize(VAR_0->ds); } else { qemu_console_resize(VAR_0->ds, VAR_20, VAR_13); } } else { qemu_console_resize(VAR_0->ds, VAR_20, VAR_13); } VAR_0->last_scr_width = VAR_20; VAR_0->last_scr_height = VAR_13; VAR_0->last_width = VAR_20; VAR_0->last_height = VAR_13; VAR_0->last_line_offset = VAR_0->VAR_15; VAR_0->last_depth = VAR_11; VAR_1 = 1; } else if (is_graphic_console() && is_buffer_shared(VAR_0->ds->surface) && (VAR_1 || VAR_0->ds->surface->data != VAR_0->vram_ptr + (VAR_0->start_addr * 4))) { VAR_0->ds->surface->data = VAR_0->vram_ptr + (VAR_0->start_addr * 4); dpy_setdata(VAR_0->ds); } VAR_0->rgb_to_pixel = rgb_to_pixel_dup_table[get_depth_index(VAR_0->ds)]; if (VAR_14 == 0) { VAR_1 |= update_palette16(VAR_0); if (VAR_0->sr[0x01] & 8) { v = VGA_DRAW_LINE4D2; VAR_20 <<= 1; } else { v = VGA_DRAW_LINE4; } VAR_19 = 4; } else if (VAR_14 == 1) { VAR_1 |= update_palette16(VAR_0); if (VAR_0->sr[0x01] & 8) { v = VGA_DRAW_LINE2D2; VAR_20 <<= 1; } else { v = VGA_DRAW_LINE2; } VAR_19 = 4; } else { switch(VAR_0->get_bpp(VAR_0)) { default: case 0: VAR_1 |= update_palette256(VAR_0); v = VGA_DRAW_LINE8D2; VAR_19 = 4; break; case 8: VAR_1 |= update_palette256(VAR_0); v = VGA_DRAW_LINE8; VAR_19 = 8; break; case 15: v = VGA_DRAW_LINE15; VAR_19 = 16; break; case 16: v = VGA_DRAW_LINE16; VAR_19 = 16; break; case 24: v = VGA_DRAW_LINE24; VAR_19 = 24; break; case 32: v = VGA_DRAW_LINE32; VAR_19 = 32; break; } } vga_draw_line = vga_draw_line_table[v * NB_DEPTHS + get_depth_index(VAR_0->ds)]; if (!is_buffer_shared(VAR_0->ds->surface) && VAR_0->cursor_invalidate) VAR_0->cursor_invalidate(VAR_0); VAR_15 = VAR_0->VAR_15; #if 0 printf("w=%d h=%d v=%d VAR_15=%d cr[0x09]=0x%02x cr[0x17]=0x%02x linecmp=%d sr[0x01]=0x%02x\n", VAR_12, VAR_13, v, VAR_15, VAR_0->cr[9], VAR_0->cr[0x17], VAR_0->line_compare, VAR_0->sr[0x01]); #endif addr1 = (VAR_0->start_addr * 4); VAR_18 = (VAR_12 * VAR_19 + 7) / 8; VAR_8 = -1; VAR_5 = 0x7fffffff; VAR_6 = -1; d = ds_get_data(VAR_0->ds); VAR_7 = ds_get_linesize(VAR_0->ds); VAR_2 = 0; for(VAR_3 = 0; VAR_3 < VAR_13; VAR_3++) { addr = addr1; if (!(VAR_0->cr[0x17] & 1)) { int VAR_23; VAR_23 = 14 + ((VAR_0->cr[0x17] >> 6) & 1); addr = (addr & ~(1 << VAR_23)) | ((VAR_2 & 1) << VAR_23); } if (!(VAR_0->cr[0x17] & 2)) { addr = (addr & ~0x8000) | ((VAR_2 & 2) << 14); } VAR_16 = VAR_0->vram_offset + (addr & TARGET_PAGE_MASK); VAR_17 = VAR_0->vram_offset + ((addr + VAR_18 - 1) & TARGET_PAGE_MASK); VAR_4 = VAR_1 | cpu_physical_memory_get_dirty(VAR_16, VGA_DIRTY_FLAG) | cpu_physical_memory_get_dirty(VAR_17, VGA_DIRTY_FLAG); if ((VAR_17 - VAR_16) > TARGET_PAGE_SIZE) { VAR_4 |= cpu_physical_memory_get_dirty(VAR_16 + TARGET_PAGE_SIZE, VGA_DIRTY_FLAG); } VAR_4 |= (VAR_0->invalidated_y_table[VAR_3 >> 5] >> (VAR_3 & 0x1f)) & 1; if (VAR_4) { if (VAR_8 < 0) VAR_8 = VAR_3; if (VAR_16 < VAR_5) VAR_5 = VAR_16; if (VAR_17 > VAR_6) VAR_6 = VAR_17; if (!(is_buffer_shared(VAR_0->ds->surface))) { vga_draw_line(VAR_0, d, VAR_0->vram_ptr + addr, VAR_12); if (VAR_0->cursor_draw_line) VAR_0->cursor_draw_line(VAR_0, d, VAR_3); } } else { if (VAR_8 >= 0) { dpy_update(VAR_0->ds, 0, VAR_8, VAR_20, VAR_3 - VAR_8); VAR_8 = -1; } } if (!VAR_22) { VAR_10 = (VAR_0->cr[0x17] & 3) ^ 3; if ((VAR_2 & VAR_10) == VAR_10) addr1 += VAR_15; VAR_2++; VAR_22 = VAR_21; } else { VAR_22--; } if (VAR_3 == VAR_0->line_compare) addr1 = 0; d += VAR_7; } if (VAR_8 >= 0) { dpy_update(VAR_0->ds, 0, VAR_8, VAR_20, VAR_3 - VAR_8); } if (VAR_6 != -1) { cpu_physical_memory_reset_dirty(VAR_5, VAR_6 + TARGET_PAGE_SIZE, VGA_DIRTY_FLAG); } memset(VAR_0->invalidated_y_table, 0, ((VAR_13 + 31) >> 5) * 4); }
[ "static void FUNC_0(VGAState *VAR_0, int VAR_1)\n{", "int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11;", "int VAR_12, VAR_13, VAR_14, VAR_15, VAR_16, VAR_17, VAR_18, VAR_19;", "int VAR_20, VAR_21, VAR_22;", "uint8_t *d;", "uint32_t v, addr1, addr;", "vga_draw_line_func *vga_dr...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 23, 25 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 49 ], [ 51 ], [ 53 ], [...
26,950
static void qtest_process_command(CharDriverState *chr, gchar **words) { const gchar *command; g_assert(words); command = words[0]; if (qtest_log_fp) { qemu_timeval tv; int i; qtest_get_time(&tv); fprintf(qtest_log_fp, "[R +" FMT_timeval "]", (long) tv.tv_sec, (long) tv.tv_usec); for (i = 0; words[i]; i++) { fprintf(qtest_log_fp, " %s", words[i]); } fprintf(qtest_log_fp, "\n"); } g_assert(command); if (strcmp(words[0], "irq_intercept_out") == 0 || strcmp(words[0], "irq_intercept_in") == 0) { DeviceState *dev; NamedGPIOList *ngl; g_assert(words[1]); dev = DEVICE(object_resolve_path(words[1], NULL)); if (!dev) { qtest_send_prefix(chr); qtest_send(chr, "FAIL Unknown device\n"); return; } if (irq_intercept_dev) { qtest_send_prefix(chr); if (irq_intercept_dev != dev) { qtest_send(chr, "FAIL IRQ intercept already enabled\n"); } else { qtest_send(chr, "OK\n"); } return; } QLIST_FOREACH(ngl, &dev->gpios, node) { /* We don't support intercept of named GPIOs yet */ if (ngl->name) { continue; } if (words[0][14] == 'o') { int i; for (i = 0; i < ngl->num_out; ++i) { qemu_irq *disconnected = g_new0(qemu_irq, 1); qemu_irq icpt = qemu_allocate_irq(qtest_irq_handler, disconnected, i); *disconnected = qdev_intercept_gpio_out(dev, icpt, ngl->name, i); } } else { qemu_irq_intercept_in(ngl->in, qtest_irq_handler, ngl->num_in); } } irq_intercept_dev = dev; qtest_send_prefix(chr); qtest_send(chr, "OK\n"); } else if (strcmp(words[0], "outb") == 0 || strcmp(words[0], "outw") == 0 || strcmp(words[0], "outl") == 0) { uint16_t addr; uint32_t value; g_assert(words[1] && words[2]); addr = strtoul(words[1], NULL, 0); value = strtoul(words[2], NULL, 0); if (words[0][3] == 'b') { cpu_outb(addr, value); } else if (words[0][3] == 'w') { cpu_outw(addr, value); } else if (words[0][3] == 'l') { cpu_outl(addr, value); } qtest_send_prefix(chr); qtest_send(chr, "OK\n"); } else if (strcmp(words[0], "inb") == 0 || strcmp(words[0], "inw") == 0 || strcmp(words[0], "inl") == 0) { uint16_t addr; uint32_t value = -1U; g_assert(words[1]); addr = strtoul(words[1], NULL, 0); if (words[0][2] == 'b') { value = cpu_inb(addr); } else if (words[0][2] == 'w') { value = cpu_inw(addr); } else if (words[0][2] == 'l') { value = cpu_inl(addr); } qtest_send_prefix(chr); qtest_sendf(chr, "OK 0x%04x\n", value); } else if (strcmp(words[0], "writeb") == 0 || strcmp(words[0], "writew") == 0 || strcmp(words[0], "writel") == 0 || strcmp(words[0], "writeq") == 0) { uint64_t addr; uint64_t value; g_assert(words[1] && words[2]); addr = strtoull(words[1], NULL, 0); value = strtoull(words[2], NULL, 0); if (words[0][5] == 'b') { uint8_t data = value; cpu_physical_memory_write(addr, &data, 1); } else if (words[0][5] == 'w') { uint16_t data = value; tswap16s(&data); cpu_physical_memory_write(addr, &data, 2); } else if (words[0][5] == 'l') { uint32_t data = value; tswap32s(&data); cpu_physical_memory_write(addr, &data, 4); } else if (words[0][5] == 'q') { uint64_t data = value; tswap64s(&data); cpu_physical_memory_write(addr, &data, 8); } qtest_send_prefix(chr); qtest_send(chr, "OK\n"); } else if (strcmp(words[0], "readb") == 0 || strcmp(words[0], "readw") == 0 || strcmp(words[0], "readl") == 0 || strcmp(words[0], "readq") == 0) { uint64_t addr; uint64_t value = UINT64_C(-1); g_assert(words[1]); addr = strtoull(words[1], NULL, 0); if (words[0][4] == 'b') { uint8_t data; cpu_physical_memory_read(addr, &data, 1); value = data; } else if (words[0][4] == 'w') { uint16_t data; cpu_physical_memory_read(addr, &data, 2); value = tswap16(data); } else if (words[0][4] == 'l') { uint32_t data; cpu_physical_memory_read(addr, &data, 4); value = tswap32(data); } else if (words[0][4] == 'q') { cpu_physical_memory_read(addr, &value, 8); tswap64s(&value); } qtest_send_prefix(chr); qtest_sendf(chr, "OK 0x%016" PRIx64 "\n", value); } else if (strcmp(words[0], "read") == 0) { uint64_t addr, len, i; uint8_t *data; char *enc; g_assert(words[1] && words[2]); addr = strtoull(words[1], NULL, 0); len = strtoull(words[2], NULL, 0); data = g_malloc(len); cpu_physical_memory_read(addr, data, len); enc = g_malloc(2 * len + 1); for (i = 0; i < len; i++) { sprintf(&enc[i * 2], "%02x", data[i]); } qtest_send_prefix(chr); qtest_sendf(chr, "OK 0x%s\n", enc); g_free(data); g_free(enc); } else if (strcmp(words[0], "b64read") == 0) { uint64_t addr, len; uint8_t *data; gchar *b64_data; g_assert(words[1] && words[2]); addr = strtoull(words[1], NULL, 0); len = strtoull(words[2], NULL, 0); data = g_malloc(len); cpu_physical_memory_read(addr, data, len); b64_data = g_base64_encode(data, len); qtest_send_prefix(chr); qtest_sendf(chr, "OK %s\n", b64_data); g_free(data); g_free(b64_data); } else if (strcmp(words[0], "write") == 0) { uint64_t addr, len, i; uint8_t *data; size_t data_len; g_assert(words[1] && words[2] && words[3]); addr = strtoull(words[1], NULL, 0); len = strtoull(words[2], NULL, 0); data_len = strlen(words[3]); if (data_len < 3) { qtest_send(chr, "ERR invalid argument size\n"); return; } data = g_malloc(len); for (i = 0; i < len; i++) { if ((i * 2 + 4) <= data_len) { data[i] = hex2nib(words[3][i * 2 + 2]) << 4; data[i] |= hex2nib(words[3][i * 2 + 3]); } else { data[i] = 0; } } cpu_physical_memory_write(addr, data, len); g_free(data); qtest_send_prefix(chr); qtest_send(chr, "OK\n"); } else if (strcmp(words[0], "memset") == 0) { uint64_t addr, len; uint8_t *data; uint8_t pattern; g_assert(words[1] && words[2] && words[3]); addr = strtoull(words[1], NULL, 0); len = strtoull(words[2], NULL, 0); pattern = strtoull(words[3], NULL, 0); if (len) { data = g_malloc(len); memset(data, pattern, len); cpu_physical_memory_write(addr, data, len); g_free(data); } qtest_send_prefix(chr); qtest_send(chr, "OK\n"); } else if (strcmp(words[0], "b64write") == 0) { uint64_t addr, len; uint8_t *data; size_t data_len; gsize out_len; g_assert(words[1] && words[2] && words[3]); addr = strtoull(words[1], NULL, 0); len = strtoull(words[2], NULL, 0); data_len = strlen(words[3]); if (data_len < 3) { qtest_send(chr, "ERR invalid argument size\n"); return; } data = g_base64_decode_inplace(words[3], &out_len); if (out_len != len) { qtest_log_send("b64write: data length mismatch (told %"PRIu64", " "found %zu)\n", len, out_len); out_len = MIN(out_len, len); } cpu_physical_memory_write(addr, data, out_len); qtest_send_prefix(chr); qtest_send(chr, "OK\n"); } else if (qtest_enabled() && strcmp(words[0], "clock_step") == 0) { int64_t ns; if (words[1]) { ns = strtoll(words[1], NULL, 0); } else { ns = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL); } qtest_clock_warp(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + ns); qtest_send_prefix(chr); qtest_sendf(chr, "OK %"PRIi64"\n", (int64_t)qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL)); } else if (qtest_enabled() && strcmp(words[0], "clock_set") == 0) { int64_t ns; g_assert(words[1]); ns = strtoll(words[1], NULL, 0); qtest_clock_warp(ns); qtest_send_prefix(chr); qtest_sendf(chr, "OK %"PRIi64"\n", (int64_t)qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL)); } else { qtest_send_prefix(chr); qtest_sendf(chr, "FAIL Unknown command '%s'\n", words[0]); } }
false
qemu
aa15f497178a8a3d489bf410171c3b6dfa0d9f49
static void qtest_process_command(CharDriverState *chr, gchar **words) { const gchar *command; g_assert(words); command = words[0]; if (qtest_log_fp) { qemu_timeval tv; int i; qtest_get_time(&tv); fprintf(qtest_log_fp, "[R +" FMT_timeval "]", (long) tv.tv_sec, (long) tv.tv_usec); for (i = 0; words[i]; i++) { fprintf(qtest_log_fp, " %s", words[i]); } fprintf(qtest_log_fp, "\n"); } g_assert(command); if (strcmp(words[0], "irq_intercept_out") == 0 || strcmp(words[0], "irq_intercept_in") == 0) { DeviceState *dev; NamedGPIOList *ngl; g_assert(words[1]); dev = DEVICE(object_resolve_path(words[1], NULL)); if (!dev) { qtest_send_prefix(chr); qtest_send(chr, "FAIL Unknown device\n"); return; } if (irq_intercept_dev) { qtest_send_prefix(chr); if (irq_intercept_dev != dev) { qtest_send(chr, "FAIL IRQ intercept already enabled\n"); } else { qtest_send(chr, "OK\n"); } return; } QLIST_FOREACH(ngl, &dev->gpios, node) { if (ngl->name) { continue; } if (words[0][14] == 'o') { int i; for (i = 0; i < ngl->num_out; ++i) { qemu_irq *disconnected = g_new0(qemu_irq, 1); qemu_irq icpt = qemu_allocate_irq(qtest_irq_handler, disconnected, i); *disconnected = qdev_intercept_gpio_out(dev, icpt, ngl->name, i); } } else { qemu_irq_intercept_in(ngl->in, qtest_irq_handler, ngl->num_in); } } irq_intercept_dev = dev; qtest_send_prefix(chr); qtest_send(chr, "OK\n"); } else if (strcmp(words[0], "outb") == 0 || strcmp(words[0], "outw") == 0 || strcmp(words[0], "outl") == 0) { uint16_t addr; uint32_t value; g_assert(words[1] && words[2]); addr = strtoul(words[1], NULL, 0); value = strtoul(words[2], NULL, 0); if (words[0][3] == 'b') { cpu_outb(addr, value); } else if (words[0][3] == 'w') { cpu_outw(addr, value); } else if (words[0][3] == 'l') { cpu_outl(addr, value); } qtest_send_prefix(chr); qtest_send(chr, "OK\n"); } else if (strcmp(words[0], "inb") == 0 || strcmp(words[0], "inw") == 0 || strcmp(words[0], "inl") == 0) { uint16_t addr; uint32_t value = -1U; g_assert(words[1]); addr = strtoul(words[1], NULL, 0); if (words[0][2] == 'b') { value = cpu_inb(addr); } else if (words[0][2] == 'w') { value = cpu_inw(addr); } else if (words[0][2] == 'l') { value = cpu_inl(addr); } qtest_send_prefix(chr); qtest_sendf(chr, "OK 0x%04x\n", value); } else if (strcmp(words[0], "writeb") == 0 || strcmp(words[0], "writew") == 0 || strcmp(words[0], "writel") == 0 || strcmp(words[0], "writeq") == 0) { uint64_t addr; uint64_t value; g_assert(words[1] && words[2]); addr = strtoull(words[1], NULL, 0); value = strtoull(words[2], NULL, 0); if (words[0][5] == 'b') { uint8_t data = value; cpu_physical_memory_write(addr, &data, 1); } else if (words[0][5] == 'w') { uint16_t data = value; tswap16s(&data); cpu_physical_memory_write(addr, &data, 2); } else if (words[0][5] == 'l') { uint32_t data = value; tswap32s(&data); cpu_physical_memory_write(addr, &data, 4); } else if (words[0][5] == 'q') { uint64_t data = value; tswap64s(&data); cpu_physical_memory_write(addr, &data, 8); } qtest_send_prefix(chr); qtest_send(chr, "OK\n"); } else if (strcmp(words[0], "readb") == 0 || strcmp(words[0], "readw") == 0 || strcmp(words[0], "readl") == 0 || strcmp(words[0], "readq") == 0) { uint64_t addr; uint64_t value = UINT64_C(-1); g_assert(words[1]); addr = strtoull(words[1], NULL, 0); if (words[0][4] == 'b') { uint8_t data; cpu_physical_memory_read(addr, &data, 1); value = data; } else if (words[0][4] == 'w') { uint16_t data; cpu_physical_memory_read(addr, &data, 2); value = tswap16(data); } else if (words[0][4] == 'l') { uint32_t data; cpu_physical_memory_read(addr, &data, 4); value = tswap32(data); } else if (words[0][4] == 'q') { cpu_physical_memory_read(addr, &value, 8); tswap64s(&value); } qtest_send_prefix(chr); qtest_sendf(chr, "OK 0x%016" PRIx64 "\n", value); } else if (strcmp(words[0], "read") == 0) { uint64_t addr, len, i; uint8_t *data; char *enc; g_assert(words[1] && words[2]); addr = strtoull(words[1], NULL, 0); len = strtoull(words[2], NULL, 0); data = g_malloc(len); cpu_physical_memory_read(addr, data, len); enc = g_malloc(2 * len + 1); for (i = 0; i < len; i++) { sprintf(&enc[i * 2], "%02x", data[i]); } qtest_send_prefix(chr); qtest_sendf(chr, "OK 0x%s\n", enc); g_free(data); g_free(enc); } else if (strcmp(words[0], "b64read") == 0) { uint64_t addr, len; uint8_t *data; gchar *b64_data; g_assert(words[1] && words[2]); addr = strtoull(words[1], NULL, 0); len = strtoull(words[2], NULL, 0); data = g_malloc(len); cpu_physical_memory_read(addr, data, len); b64_data = g_base64_encode(data, len); qtest_send_prefix(chr); qtest_sendf(chr, "OK %s\n", b64_data); g_free(data); g_free(b64_data); } else if (strcmp(words[0], "write") == 0) { uint64_t addr, len, i; uint8_t *data; size_t data_len; g_assert(words[1] && words[2] && words[3]); addr = strtoull(words[1], NULL, 0); len = strtoull(words[2], NULL, 0); data_len = strlen(words[3]); if (data_len < 3) { qtest_send(chr, "ERR invalid argument size\n"); return; } data = g_malloc(len); for (i = 0; i < len; i++) { if ((i * 2 + 4) <= data_len) { data[i] = hex2nib(words[3][i * 2 + 2]) << 4; data[i] |= hex2nib(words[3][i * 2 + 3]); } else { data[i] = 0; } } cpu_physical_memory_write(addr, data, len); g_free(data); qtest_send_prefix(chr); qtest_send(chr, "OK\n"); } else if (strcmp(words[0], "memset") == 0) { uint64_t addr, len; uint8_t *data; uint8_t pattern; g_assert(words[1] && words[2] && words[3]); addr = strtoull(words[1], NULL, 0); len = strtoull(words[2], NULL, 0); pattern = strtoull(words[3], NULL, 0); if (len) { data = g_malloc(len); memset(data, pattern, len); cpu_physical_memory_write(addr, data, len); g_free(data); } qtest_send_prefix(chr); qtest_send(chr, "OK\n"); } else if (strcmp(words[0], "b64write") == 0) { uint64_t addr, len; uint8_t *data; size_t data_len; gsize out_len; g_assert(words[1] && words[2] && words[3]); addr = strtoull(words[1], NULL, 0); len = strtoull(words[2], NULL, 0); data_len = strlen(words[3]); if (data_len < 3) { qtest_send(chr, "ERR invalid argument size\n"); return; } data = g_base64_decode_inplace(words[3], &out_len); if (out_len != len) { qtest_log_send("b64write: data length mismatch (told %"PRIu64", " "found %zu)\n", len, out_len); out_len = MIN(out_len, len); } cpu_physical_memory_write(addr, data, out_len); qtest_send_prefix(chr); qtest_send(chr, "OK\n"); } else if (qtest_enabled() && strcmp(words[0], "clock_step") == 0) { int64_t ns; if (words[1]) { ns = strtoll(words[1], NULL, 0); } else { ns = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL); } qtest_clock_warp(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + ns); qtest_send_prefix(chr); qtest_sendf(chr, "OK %"PRIi64"\n", (int64_t)qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL)); } else if (qtest_enabled() && strcmp(words[0], "clock_set") == 0) { int64_t ns; g_assert(words[1]); ns = strtoll(words[1], NULL, 0); qtest_clock_warp(ns); qtest_send_prefix(chr); qtest_sendf(chr, "OK %"PRIi64"\n", (int64_t)qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL)); } else { qtest_send_prefix(chr); qtest_sendf(chr, "FAIL Unknown command '%s'\n", words[0]); } }
{ "code": [], "line_no": [] }
static void FUNC_0(CharDriverState *VAR_0, gchar **VAR_1) { const gchar *VAR_2; g_assert(VAR_1); VAR_2 = VAR_1[0]; if (qtest_log_fp) { qemu_timeval tv; int VAR_3; qtest_get_time(&tv); fprintf(qtest_log_fp, "[R +" FMT_timeval "]", (long) tv.tv_sec, (long) tv.tv_usec); for (VAR_3 = 0; VAR_1[VAR_3]; VAR_3++) { fprintf(qtest_log_fp, " %s", VAR_1[VAR_3]); } fprintf(qtest_log_fp, "\n"); } g_assert(VAR_2); if (strcmp(VAR_1[0], "irq_intercept_out") == 0 || strcmp(VAR_1[0], "irq_intercept_in") == 0) { DeviceState *dev; NamedGPIOList *ngl; g_assert(VAR_1[1]); dev = DEVICE(object_resolve_path(VAR_1[1], NULL)); if (!dev) { qtest_send_prefix(VAR_0); qtest_send(VAR_0, "FAIL Unknown device\n"); return; } if (irq_intercept_dev) { qtest_send_prefix(VAR_0); if (irq_intercept_dev != dev) { qtest_send(VAR_0, "FAIL IRQ intercept already enabled\n"); } else { qtest_send(VAR_0, "OK\n"); } return; } QLIST_FOREACH(ngl, &dev->gpios, node) { if (ngl->name) { continue; } if (VAR_1[0][14] == 'o') { int VAR_3; for (VAR_3 = 0; VAR_3 < ngl->num_out; ++VAR_3) { qemu_irq *disconnected = g_new0(qemu_irq, 1); qemu_irq icpt = qemu_allocate_irq(qtest_irq_handler, disconnected, VAR_3); *disconnected = qdev_intercept_gpio_out(dev, icpt, ngl->name, VAR_3); } } else { qemu_irq_intercept_in(ngl->in, qtest_irq_handler, ngl->num_in); } } irq_intercept_dev = dev; qtest_send_prefix(VAR_0); qtest_send(VAR_0, "OK\n"); } else if (strcmp(VAR_1[0], "outb") == 0 || strcmp(VAR_1[0], "outw") == 0 || strcmp(VAR_1[0], "outl") == 0) { uint16_t addr; uint32_t value; g_assert(VAR_1[1] && VAR_1[2]); addr = strtoul(VAR_1[1], NULL, 0); value = strtoul(VAR_1[2], NULL, 0); if (VAR_1[0][3] == 'b') { cpu_outb(addr, value); } else if (VAR_1[0][3] == 'w') { cpu_outw(addr, value); } else if (VAR_1[0][3] == 'l') { cpu_outl(addr, value); } qtest_send_prefix(VAR_0); qtest_send(VAR_0, "OK\n"); } else if (strcmp(VAR_1[0], "inb") == 0 || strcmp(VAR_1[0], "inw") == 0 || strcmp(VAR_1[0], "inl") == 0) { uint16_t addr; uint32_t value = -1U; g_assert(VAR_1[1]); addr = strtoul(VAR_1[1], NULL, 0); if (VAR_1[0][2] == 'b') { value = cpu_inb(addr); } else if (VAR_1[0][2] == 'w') { value = cpu_inw(addr); } else if (VAR_1[0][2] == 'l') { value = cpu_inl(addr); } qtest_send_prefix(VAR_0); qtest_sendf(VAR_0, "OK 0x%04x\n", value); } else if (strcmp(VAR_1[0], "writeb") == 0 || strcmp(VAR_1[0], "writew") == 0 || strcmp(VAR_1[0], "writel") == 0 || strcmp(VAR_1[0], "writeq") == 0) { uint64_t addr; uint64_t value; g_assert(VAR_1[1] && VAR_1[2]); addr = strtoull(VAR_1[1], NULL, 0); value = strtoull(VAR_1[2], NULL, 0); if (VAR_1[0][5] == 'b') { uint8_t data = value; cpu_physical_memory_write(addr, &data, 1); } else if (VAR_1[0][5] == 'w') { uint16_t data = value; tswap16s(&data); cpu_physical_memory_write(addr, &data, 2); } else if (VAR_1[0][5] == 'l') { uint32_t data = value; tswap32s(&data); cpu_physical_memory_write(addr, &data, 4); } else if (VAR_1[0][5] == 'q') { uint64_t data = value; tswap64s(&data); cpu_physical_memory_write(addr, &data, 8); } qtest_send_prefix(VAR_0); qtest_send(VAR_0, "OK\n"); } else if (strcmp(VAR_1[0], "readb") == 0 || strcmp(VAR_1[0], "readw") == 0 || strcmp(VAR_1[0], "readl") == 0 || strcmp(VAR_1[0], "readq") == 0) { uint64_t addr; uint64_t value = UINT64_C(-1); g_assert(VAR_1[1]); addr = strtoull(VAR_1[1], NULL, 0); if (VAR_1[0][4] == 'b') { uint8_t data; cpu_physical_memory_read(addr, &data, 1); value = data; } else if (VAR_1[0][4] == 'w') { uint16_t data; cpu_physical_memory_read(addr, &data, 2); value = tswap16(data); } else if (VAR_1[0][4] == 'l') { uint32_t data; cpu_physical_memory_read(addr, &data, 4); value = tswap32(data); } else if (VAR_1[0][4] == 'q') { cpu_physical_memory_read(addr, &value, 8); tswap64s(&value); } qtest_send_prefix(VAR_0); qtest_sendf(VAR_0, "OK 0x%016" PRIx64 "\n", value); } else if (strcmp(VAR_1[0], "read") == 0) { uint64_t addr, len, VAR_3; uint8_t *data; char *VAR_4; g_assert(VAR_1[1] && VAR_1[2]); addr = strtoull(VAR_1[1], NULL, 0); len = strtoull(VAR_1[2], NULL, 0); data = g_malloc(len); cpu_physical_memory_read(addr, data, len); VAR_4 = g_malloc(2 * len + 1); for (VAR_3 = 0; VAR_3 < len; VAR_3++) { sprintf(&VAR_4[VAR_3 * 2], "%02x", data[VAR_3]); } qtest_send_prefix(VAR_0); qtest_sendf(VAR_0, "OK 0x%s\n", VAR_4); g_free(data); g_free(VAR_4); } else if (strcmp(VAR_1[0], "b64read") == 0) { uint64_t addr, len; uint8_t *data; gchar *b64_data; g_assert(VAR_1[1] && VAR_1[2]); addr = strtoull(VAR_1[1], NULL, 0); len = strtoull(VAR_1[2], NULL, 0); data = g_malloc(len); cpu_physical_memory_read(addr, data, len); b64_data = g_base64_encode(data, len); qtest_send_prefix(VAR_0); qtest_sendf(VAR_0, "OK %s\n", b64_data); g_free(data); g_free(b64_data); } else if (strcmp(VAR_1[0], "write") == 0) { uint64_t addr, len, VAR_3; uint8_t *data; size_t data_len; g_assert(VAR_1[1] && VAR_1[2] && VAR_1[3]); addr = strtoull(VAR_1[1], NULL, 0); len = strtoull(VAR_1[2], NULL, 0); data_len = strlen(VAR_1[3]); if (data_len < 3) { qtest_send(VAR_0, "ERR invalid argument size\n"); return; } data = g_malloc(len); for (VAR_3 = 0; VAR_3 < len; VAR_3++) { if ((VAR_3 * 2 + 4) <= data_len) { data[VAR_3] = hex2nib(VAR_1[3][VAR_3 * 2 + 2]) << 4; data[VAR_3] |= hex2nib(VAR_1[3][VAR_3 * 2 + 3]); } else { data[VAR_3] = 0; } } cpu_physical_memory_write(addr, data, len); g_free(data); qtest_send_prefix(VAR_0); qtest_send(VAR_0, "OK\n"); } else if (strcmp(VAR_1[0], "memset") == 0) { uint64_t addr, len; uint8_t *data; uint8_t pattern; g_assert(VAR_1[1] && VAR_1[2] && VAR_1[3]); addr = strtoull(VAR_1[1], NULL, 0); len = strtoull(VAR_1[2], NULL, 0); pattern = strtoull(VAR_1[3], NULL, 0); if (len) { data = g_malloc(len); memset(data, pattern, len); cpu_physical_memory_write(addr, data, len); g_free(data); } qtest_send_prefix(VAR_0); qtest_send(VAR_0, "OK\n"); } else if (strcmp(VAR_1[0], "b64write") == 0) { uint64_t addr, len; uint8_t *data; size_t data_len; gsize out_len; g_assert(VAR_1[1] && VAR_1[2] && VAR_1[3]); addr = strtoull(VAR_1[1], NULL, 0); len = strtoull(VAR_1[2], NULL, 0); data_len = strlen(VAR_1[3]); if (data_len < 3) { qtest_send(VAR_0, "ERR invalid argument size\n"); return; } data = g_base64_decode_inplace(VAR_1[3], &out_len); if (out_len != len) { qtest_log_send("b64write: data length mismatch (told %"PRIu64", " "found %zu)\n", len, out_len); out_len = MIN(out_len, len); } cpu_physical_memory_write(addr, data, out_len); qtest_send_prefix(VAR_0); qtest_send(VAR_0, "OK\n"); } else if (qtest_enabled() && strcmp(VAR_1[0], "clock_step") == 0) { int64_t ns; if (VAR_1[1]) { ns = strtoll(VAR_1[1], NULL, 0); } else { ns = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL); } qtest_clock_warp(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + ns); qtest_send_prefix(VAR_0); qtest_sendf(VAR_0, "OK %"PRIi64"\n", (int64_t)qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL)); } else if (qtest_enabled() && strcmp(VAR_1[0], "clock_set") == 0) { int64_t ns; g_assert(VAR_1[1]); ns = strtoll(VAR_1[1], NULL, 0); qtest_clock_warp(ns); qtest_send_prefix(VAR_0); qtest_sendf(VAR_0, "OK %"PRIi64"\n", (int64_t)qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL)); } else { qtest_send_prefix(VAR_0); qtest_sendf(VAR_0, "FAIL Unknown VAR_2 '%s'\n", VAR_1[0]); } }
[ "static void FUNC_0(CharDriverState *VAR_0, gchar **VAR_1)\n{", "const gchar *VAR_2;", "g_assert(VAR_1);", "VAR_2 = VAR_1[0];", "if (qtest_log_fp) {", "qemu_timeval tv;", "int VAR_3;", "qtest_get_time(&tv);", "fprintf(qtest_log_fp, \"[R +\" FMT_timeval \"]\",\n(long) tv.tv_sec, (long) tv.tv_usec);",...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 55...
26,951
static RemoveResult remove_hpte(PowerPCCPU *cpu, target_ulong ptex, target_ulong avpn, target_ulong flags, target_ulong *vp, target_ulong *rp) { CPUPPCState *env = &cpu->env; uint64_t token; target_ulong v, r; if (!valid_pte_index(env, ptex)) { return REMOVE_PARM; } token = ppc_hash64_start_access(cpu, ptex); v = ppc_hash64_load_hpte0(cpu, token, 0); r = ppc_hash64_load_hpte1(cpu, token, 0); ppc_hash64_stop_access(token); if ((v & HPTE64_V_VALID) == 0 || ((flags & H_AVPN) && (v & ~0x7fULL) != avpn) || ((flags & H_ANDCOND) && (v & avpn) != 0)) { return REMOVE_NOT_FOUND; } *vp = v; *rp = r; ppc_hash64_store_hpte(cpu, ptex, HPTE64_V_HPTE_DIRTY, 0); ppc_hash64_tlb_flush_hpte(cpu, ptex, v, r); return REMOVE_SUCCESS; }
false
qemu
c18ad9a54b75495ce61e8b28d353f8eec51768fc
static RemoveResult remove_hpte(PowerPCCPU *cpu, target_ulong ptex, target_ulong avpn, target_ulong flags, target_ulong *vp, target_ulong *rp) { CPUPPCState *env = &cpu->env; uint64_t token; target_ulong v, r; if (!valid_pte_index(env, ptex)) { return REMOVE_PARM; } token = ppc_hash64_start_access(cpu, ptex); v = ppc_hash64_load_hpte0(cpu, token, 0); r = ppc_hash64_load_hpte1(cpu, token, 0); ppc_hash64_stop_access(token); if ((v & HPTE64_V_VALID) == 0 || ((flags & H_AVPN) && (v & ~0x7fULL) != avpn) || ((flags & H_ANDCOND) && (v & avpn) != 0)) { return REMOVE_NOT_FOUND; } *vp = v; *rp = r; ppc_hash64_store_hpte(cpu, ptex, HPTE64_V_HPTE_DIRTY, 0); ppc_hash64_tlb_flush_hpte(cpu, ptex, v, r); return REMOVE_SUCCESS; }
{ "code": [], "line_no": [] }
static RemoveResult FUNC_0(PowerPCCPU *cpu, target_ulong ptex, target_ulong avpn, target_ulong flags, target_ulong *vp, target_ulong *rp) { CPUPPCState *env = &cpu->env; uint64_t token; target_ulong v, r; if (!valid_pte_index(env, ptex)) { return REMOVE_PARM; } token = ppc_hash64_start_access(cpu, ptex); v = ppc_hash64_load_hpte0(cpu, token, 0); r = ppc_hash64_load_hpte1(cpu, token, 0); ppc_hash64_stop_access(token); if ((v & HPTE64_V_VALID) == 0 || ((flags & H_AVPN) && (v & ~0x7fULL) != avpn) || ((flags & H_ANDCOND) && (v & avpn) != 0)) { return REMOVE_NOT_FOUND; } *vp = v; *rp = r; ppc_hash64_store_hpte(cpu, ptex, HPTE64_V_HPTE_DIRTY, 0); ppc_hash64_tlb_flush_hpte(cpu, ptex, v, r); return REMOVE_SUCCESS; }
[ "static RemoveResult FUNC_0(PowerPCCPU *cpu, target_ulong ptex,\ntarget_ulong avpn,\ntarget_ulong flags,\ntarget_ulong *vp, target_ulong *rp)\n{", "CPUPPCState *env = &cpu->env;", "uint64_t token;", "target_ulong v, r;", "if (!valid_pte_index(env, ptex)) {", "return REMOVE_PARM;", "}", "token = ppc_ha...
[ 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 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37, 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [...
26,952
static void bdrv_aio_co_cancel_em(BlockDriverAIOCB *blockacb) { BlockDriverAIOCBCoroutine *acb = container_of(blockacb, BlockDriverAIOCBCoroutine, common); bool done = false; acb->done = &done; while (!done) { qemu_aio_wait(); } }
false
qemu
2572b37a4751cc967582d7d04f21d9bf97187ae5
static void bdrv_aio_co_cancel_em(BlockDriverAIOCB *blockacb) { BlockDriverAIOCBCoroutine *acb = container_of(blockacb, BlockDriverAIOCBCoroutine, common); bool done = false; acb->done = &done; while (!done) { qemu_aio_wait(); } }
{ "code": [], "line_no": [] }
static void FUNC_0(BlockDriverAIOCB *VAR_0) { BlockDriverAIOCBCoroutine *acb = container_of(VAR_0, BlockDriverAIOCBCoroutine, common); bool done = false; acb->done = &done; while (!done) { qemu_aio_wait(); } }
[ "static void FUNC_0(BlockDriverAIOCB *VAR_0)\n{", "BlockDriverAIOCBCoroutine *acb =\ncontainer_of(VAR_0, BlockDriverAIOCBCoroutine, common);", "bool done = false;", "acb->done = &done;", "while (!done) {", "qemu_aio_wait();", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
26,954
static uint64_t vfio_rtl8168_window_quirk_read(void *opaque, hwaddr addr, unsigned size) { VFIOQuirk *quirk = opaque; VFIOPCIDevice *vdev = quirk->vdev; switch (addr) { case 4: /* address */ if (quirk->data.flags) { trace_vfio_rtl8168_window_quirk_read_fake( memory_region_name(&quirk->mem), vdev->vbasedev.name); return quirk->data.address_match ^ 0x10000000U; } break; case 0: /* data */ if (quirk->data.flags) { uint64_t val; trace_vfio_rtl8168_window_quirk_read_table( memory_region_name(&quirk->mem), vdev->vbasedev.name); if (!(vdev->pdev.cap_present & QEMU_PCI_CAP_MSIX)) { return 0; } memory_region_dispatch_read(&vdev->pdev.msix_table_mmio, (hwaddr)(quirk->data.address_match & 0xfff), &val, size, MEMTXATTRS_UNSPECIFIED); return val; } } trace_vfio_rtl8168_window_quirk_read_direct(memory_region_name(&quirk->mem), vdev->vbasedev.name); return vfio_region_read(&vdev->bars[quirk->data.bar].region, addr + 0x70, size); }
false
qemu
69970fcef937bddd7f745efe39501c7716fdfe56
static uint64_t vfio_rtl8168_window_quirk_read(void *opaque, hwaddr addr, unsigned size) { VFIOQuirk *quirk = opaque; VFIOPCIDevice *vdev = quirk->vdev; switch (addr) { case 4: if (quirk->data.flags) { trace_vfio_rtl8168_window_quirk_read_fake( memory_region_name(&quirk->mem), vdev->vbasedev.name); return quirk->data.address_match ^ 0x10000000U; } break; case 0: if (quirk->data.flags) { uint64_t val; trace_vfio_rtl8168_window_quirk_read_table( memory_region_name(&quirk->mem), vdev->vbasedev.name); if (!(vdev->pdev.cap_present & QEMU_PCI_CAP_MSIX)) { return 0; } memory_region_dispatch_read(&vdev->pdev.msix_table_mmio, (hwaddr)(quirk->data.address_match & 0xfff), &val, size, MEMTXATTRS_UNSPECIFIED); return val; } } trace_vfio_rtl8168_window_quirk_read_direct(memory_region_name(&quirk->mem), vdev->vbasedev.name); return vfio_region_read(&vdev->bars[quirk->data.bar].region, addr + 0x70, size); }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(void *opaque, hwaddr addr, unsigned size) { VFIOQuirk *quirk = opaque; VFIOPCIDevice *vdev = quirk->vdev; switch (addr) { case 4: if (quirk->data.flags) { trace_vfio_rtl8168_window_quirk_read_fake( memory_region_name(&quirk->mem), vdev->vbasedev.name); return quirk->data.address_match ^ 0x10000000U; } break; case 0: if (quirk->data.flags) { uint64_t val; trace_vfio_rtl8168_window_quirk_read_table( memory_region_name(&quirk->mem), vdev->vbasedev.name); if (!(vdev->pdev.cap_present & QEMU_PCI_CAP_MSIX)) { return 0; } memory_region_dispatch_read(&vdev->pdev.msix_table_mmio, (hwaddr)(quirk->data.address_match & 0xfff), &val, size, MEMTXATTRS_UNSPECIFIED); return val; } } trace_vfio_rtl8168_window_quirk_read_direct(memory_region_name(&quirk->mem), vdev->vbasedev.name); return vfio_region_read(&vdev->bars[quirk->data.bar].region, addr + 0x70, size); }
[ "static uint64_t FUNC_0(void *opaque,\nhwaddr addr, unsigned size)\n{", "VFIOQuirk *quirk = opaque;", "VFIOPCIDevice *vdev = quirk->vdev;", "switch (addr) {", "case 4:\nif (quirk->data.flags) {", "trace_vfio_rtl8168_window_quirk_read_fake(\nmemory_region_name(&quirk->mem),\nvdev->vbasedev.name);", "retu...
[ 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, 21, 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 41, 43, 45 ], [ 49 ], [ 51 ], [ 53 ], [ 57, 59,...
26,955
static void init_event_facility(Object *obj) { SCLPEventFacility *event_facility = EVENT_FACILITY(obj); DeviceState *sdev = DEVICE(obj); /* Spawn a new bus for SCLP events */ qbus_create_inplace(&event_facility->sbus, sizeof(event_facility->sbus), TYPE_SCLP_EVENTS_BUS, sdev, NULL); object_initialize(&event_facility->quiesce_event, sizeof(SCLPEvent), TYPE_SCLP_QUIESCE); qdev_set_parent_bus(DEVICE(&event_facility->quiesce_event), &event_facility->sbus.qbus); object_initialize(&event_facility->cpu_hotplug_event, sizeof(SCLPEvent), TYPE_SCLP_CPU_HOTPLUG); qdev_set_parent_bus(DEVICE(&event_facility->cpu_hotplug_event), &event_facility->sbus.qbus); /* the facility will automatically realize the devices via the bus */ }
false
qemu
7059384c7e27d68c502d8636eb711873a9a6a597
static void init_event_facility(Object *obj) { SCLPEventFacility *event_facility = EVENT_FACILITY(obj); DeviceState *sdev = DEVICE(obj); qbus_create_inplace(&event_facility->sbus, sizeof(event_facility->sbus), TYPE_SCLP_EVENTS_BUS, sdev, NULL); object_initialize(&event_facility->quiesce_event, sizeof(SCLPEvent), TYPE_SCLP_QUIESCE); qdev_set_parent_bus(DEVICE(&event_facility->quiesce_event), &event_facility->sbus.qbus); object_initialize(&event_facility->cpu_hotplug_event, sizeof(SCLPEvent), TYPE_SCLP_CPU_HOTPLUG); qdev_set_parent_bus(DEVICE(&event_facility->cpu_hotplug_event), &event_facility->sbus.qbus); }
{ "code": [], "line_no": [] }
static void FUNC_0(Object *VAR_0) { SCLPEventFacility *event_facility = EVENT_FACILITY(VAR_0); DeviceState *sdev = DEVICE(VAR_0); qbus_create_inplace(&event_facility->sbus, sizeof(event_facility->sbus), TYPE_SCLP_EVENTS_BUS, sdev, NULL); object_initialize(&event_facility->quiesce_event, sizeof(SCLPEvent), TYPE_SCLP_QUIESCE); qdev_set_parent_bus(DEVICE(&event_facility->quiesce_event), &event_facility->sbus.qbus); object_initialize(&event_facility->cpu_hotplug_event, sizeof(SCLPEvent), TYPE_SCLP_CPU_HOTPLUG); qdev_set_parent_bus(DEVICE(&event_facility->cpu_hotplug_event), &event_facility->sbus.qbus); }
[ "static void FUNC_0(Object *VAR_0)\n{", "SCLPEventFacility *event_facility = EVENT_FACILITY(VAR_0);", "DeviceState *sdev = DEVICE(VAR_0);", "qbus_create_inplace(&event_facility->sbus, sizeof(event_facility->sbus),\nTYPE_SCLP_EVENTS_BUS, sdev, NULL);", "object_initialize(&event_facility->quiesce_event, sizeo...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13, 15 ], [ 19, 21 ], [ 23, 25 ], [ 27, 29 ], [ 31, 33 ], [ 37 ] ]
26,956
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, 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.f.motion_val[1][s->block_index[0]][0] = 0; s->current_picture.f.motion_val[1][s->block_index[0]][1] = 0; s->current_picture.f.mb_type[mb_pos + v->mb_off] = MB_TYPE_INTRA; GET_MQUANT(); s->current_picture.f.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); off += v->second_field ? ((i & 4) ? s->current_picture_ptr->f.linesize[1] : s->current_picture_ptr->f.linesize[0]) : 0; 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.f.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); } 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.f.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 (v->second_field) off += (i & 4) ? s->current_picture_ptr->f.linesize[1] : s->current_picture_ptr->f.linesize[0]; 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; } } } }
false
FFmpeg
0d194ee51ed477f843900e657a7edbcbecdffa42
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, 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.f.motion_val[1][s->block_index[0]][0] = 0; s->current_picture.f.motion_val[1][s->block_index[0]][1] = 0; s->current_picture.f.mb_type[mb_pos + v->mb_off] = MB_TYPE_INTRA; GET_MQUANT(); s->current_picture.f.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); off += v->second_field ? ((i & 4) ? s->current_picture_ptr->f.linesize[1] : s->current_picture_ptr->f.linesize[0]) : 0; 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.f.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); } 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.f.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 (v->second_field) off += (i & 4) ? s->current_picture_ptr->f.linesize[1] : s->current_picture_ptr->f.linesize[0]; 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": [], "line_no": [] }
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, VAR_19; 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.f.motion_val[1][s->block_index[0]][0] = 0; s->current_picture.f.motion_val[1][s->block_index[0]][1] = 0; s->current_picture.f.mb_type[VAR_3 + VAR_0->mb_off] = MB_TYPE_INTRA; GET_MQUANT(); s->current_picture.f.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); VAR_12 += VAR_0->second_field ? ((VAR_1 & 4) ? s->current_picture_ptr->f.linesize[1] : s->current_picture_ptr->f.linesize[0]) : 0; 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.f.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; VAR_19 = 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 && VAR_19) { 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); } 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.f.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_0->second_field) VAR_12 += (VAR_1 & 4) ? s->current_picture_ptr->f.linesize[1] : s->current_picture_ptr->f.linesize[0]; 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;"...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ...
26,957
static int hls_window(AVFormatContext *s, int last) { HLSContext *hls = s->priv_data; ListEntry *en; int64_t target_duration = 0; int ret = 0; AVIOContext *out = NULL; char temp_filename[1024]; int64_t sequence = FFMAX(hls->start_sequence, hls->sequence - hls->size); snprintf(temp_filename, sizeof(temp_filename), "%s.tmp", s->filename); if ((ret = avio_open2(&out, temp_filename, AVIO_FLAG_WRITE, &s->interrupt_callback, NULL)) < 0) goto fail; for (en = hls->list; en; en = en->next) { if (target_duration < en->duration) target_duration = en->duration; } avio_printf(out, "#EXTM3U\n"); avio_printf(out, "#EXT-X-VERSION:%d\n", hls->version); if (hls->allowcache == 0 || hls->allowcache == 1) { avio_printf(out, "#EXT-X-ALLOW-CACHE:%s\n", hls->allowcache == 0 ? "NO" : "YES"); } avio_printf(out, "#EXT-X-TARGETDURATION:%"PRId64"\n", av_rescale_rnd(target_duration, 1, AV_TIME_BASE, AV_ROUND_UP)); avio_printf(out, "#EXT-X-MEDIA-SEQUENCE:%"PRId64"\n", sequence); av_log(s, AV_LOG_VERBOSE, "EXT-X-MEDIA-SEQUENCE:%"PRId64"\n", sequence); for (en = hls->list; en; en = en->next) { if (hls->version > 2) avio_printf(out, "#EXTINF:%f\n", (double)en->duration / AV_TIME_BASE); else avio_printf(out, "#EXTINF:%"PRId64",\n", av_rescale(en->duration, 1, AV_TIME_BASE)); if (hls->baseurl) avio_printf(out, "%s", hls->baseurl); avio_printf(out, "%s\n", en->name); } if (last) avio_printf(out, "#EXT-X-ENDLIST\n"); fail: avio_closep(&out); if (ret >= 0) ff_rename(temp_filename, s->filename); return ret; }
false
FFmpeg
9f61abc8111c7c43f49ca012e957a108b9cc7610
static int hls_window(AVFormatContext *s, int last) { HLSContext *hls = s->priv_data; ListEntry *en; int64_t target_duration = 0; int ret = 0; AVIOContext *out = NULL; char temp_filename[1024]; int64_t sequence = FFMAX(hls->start_sequence, hls->sequence - hls->size); snprintf(temp_filename, sizeof(temp_filename), "%s.tmp", s->filename); if ((ret = avio_open2(&out, temp_filename, AVIO_FLAG_WRITE, &s->interrupt_callback, NULL)) < 0) goto fail; for (en = hls->list; en; en = en->next) { if (target_duration < en->duration) target_duration = en->duration; } avio_printf(out, "#EXTM3U\n"); avio_printf(out, "#EXT-X-VERSION:%d\n", hls->version); if (hls->allowcache == 0 || hls->allowcache == 1) { avio_printf(out, "#EXT-X-ALLOW-CACHE:%s\n", hls->allowcache == 0 ? "NO" : "YES"); } avio_printf(out, "#EXT-X-TARGETDURATION:%"PRId64"\n", av_rescale_rnd(target_duration, 1, AV_TIME_BASE, AV_ROUND_UP)); avio_printf(out, "#EXT-X-MEDIA-SEQUENCE:%"PRId64"\n", sequence); av_log(s, AV_LOG_VERBOSE, "EXT-X-MEDIA-SEQUENCE:%"PRId64"\n", sequence); for (en = hls->list; en; en = en->next) { if (hls->version > 2) avio_printf(out, "#EXTINF:%f\n", (double)en->duration / AV_TIME_BASE); else avio_printf(out, "#EXTINF:%"PRId64",\n", av_rescale(en->duration, 1, AV_TIME_BASE)); if (hls->baseurl) avio_printf(out, "%s", hls->baseurl); avio_printf(out, "%s\n", en->name); } if (last) avio_printf(out, "#EXT-X-ENDLIST\n"); fail: avio_closep(&out); if (ret >= 0) ff_rename(temp_filename, s->filename); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, int VAR_1) { HLSContext *hls = VAR_0->priv_data; ListEntry *en; int64_t target_duration = 0; int VAR_2 = 0; AVIOContext *out = NULL; char VAR_3[1024]; int64_t sequence = FFMAX(hls->start_sequence, hls->sequence - hls->size); snprintf(VAR_3, sizeof(VAR_3), "%VAR_0.tmp", VAR_0->filename); if ((VAR_2 = avio_open2(&out, VAR_3, AVIO_FLAG_WRITE, &VAR_0->interrupt_callback, NULL)) < 0) goto fail; for (en = hls->list; en; en = en->next) { if (target_duration < en->duration) target_duration = en->duration; } avio_printf(out, "#EXTM3U\n"); avio_printf(out, "#EXT-X-VERSION:%d\n", hls->version); if (hls->allowcache == 0 || hls->allowcache == 1) { avio_printf(out, "#EXT-X-ALLOW-CACHE:%VAR_0\n", hls->allowcache == 0 ? "NO" : "YES"); } avio_printf(out, "#EXT-X-TARGETDURATION:%"PRId64"\n", av_rescale_rnd(target_duration, 1, AV_TIME_BASE, AV_ROUND_UP)); avio_printf(out, "#EXT-X-MEDIA-SEQUENCE:%"PRId64"\n", sequence); av_log(VAR_0, AV_LOG_VERBOSE, "EXT-X-MEDIA-SEQUENCE:%"PRId64"\n", sequence); for (en = hls->list; en; en = en->next) { if (hls->version > 2) avio_printf(out, "#EXTINF:%f\n", (double)en->duration / AV_TIME_BASE); else avio_printf(out, "#EXTINF:%"PRId64",\n", av_rescale(en->duration, 1, AV_TIME_BASE)); if (hls->baseurl) avio_printf(out, "%VAR_0", hls->baseurl); avio_printf(out, "%VAR_0\n", en->name); } if (VAR_1) avio_printf(out, "#EXT-X-ENDLIST\n"); fail: avio_closep(&out); if (VAR_2 >= 0) ff_rename(VAR_3, VAR_0->filename); return VAR_2; }
[ "static int FUNC_0(AVFormatContext *VAR_0, int VAR_1)\n{", "HLSContext *hls = VAR_0->priv_data;", "ListEntry *en;", "int64_t target_duration = 0;", "int VAR_2 = 0;", "AVIOContext *out = NULL;", "char VAR_3[1024];", "int64_t sequence = FFMAX(hls->start_sequence, hls->sequence - hls->size);", "snprint...
[ 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [...
26,958
pvscsi_dbg_dump_tx_rings_config(PVSCSICmdDescSetupRings *rc) { int i; trace_pvscsi_tx_rings_ppn("Rings State", rc->ringsStatePPN); trace_pvscsi_tx_rings_num_pages("Request Ring", rc->reqRingNumPages); for (i = 0; i < rc->reqRingNumPages; i++) { trace_pvscsi_tx_rings_ppn("Request Ring", rc->reqRingPPNs[i]); } trace_pvscsi_tx_rings_num_pages("Confirm Ring", rc->cmpRingNumPages); for (i = 0; i < rc->cmpRingNumPages; i++) { trace_pvscsi_tx_rings_ppn("Confirm Ring", rc->reqRingPPNs[i]); } }
false
qemu
7f61f4690dd153be98900a2a508b88989e692753
pvscsi_dbg_dump_tx_rings_config(PVSCSICmdDescSetupRings *rc) { int i; trace_pvscsi_tx_rings_ppn("Rings State", rc->ringsStatePPN); trace_pvscsi_tx_rings_num_pages("Request Ring", rc->reqRingNumPages); for (i = 0; i < rc->reqRingNumPages; i++) { trace_pvscsi_tx_rings_ppn("Request Ring", rc->reqRingPPNs[i]); } trace_pvscsi_tx_rings_num_pages("Confirm Ring", rc->cmpRingNumPages); for (i = 0; i < rc->cmpRingNumPages; i++) { trace_pvscsi_tx_rings_ppn("Confirm Ring", rc->reqRingPPNs[i]); } }
{ "code": [], "line_no": [] }
FUNC_0(PVSCSICmdDescSetupRings *VAR_0) { int VAR_1; trace_pvscsi_tx_rings_ppn("Rings State", VAR_0->ringsStatePPN); trace_pvscsi_tx_rings_num_pages("Request Ring", VAR_0->reqRingNumPages); for (VAR_1 = 0; VAR_1 < VAR_0->reqRingNumPages; VAR_1++) { trace_pvscsi_tx_rings_ppn("Request Ring", VAR_0->reqRingPPNs[VAR_1]); } trace_pvscsi_tx_rings_num_pages("Confirm Ring", VAR_0->cmpRingNumPages); for (VAR_1 = 0; VAR_1 < VAR_0->cmpRingNumPages; VAR_1++) { trace_pvscsi_tx_rings_ppn("Confirm Ring", VAR_0->reqRingPPNs[VAR_1]); } }
[ "FUNC_0(PVSCSICmdDescSetupRings *VAR_0)\n{", "int VAR_1;", "trace_pvscsi_tx_rings_ppn(\"Rings State\", VAR_0->ringsStatePPN);", "trace_pvscsi_tx_rings_num_pages(\"Request Ring\", VAR_0->reqRingNumPages);", "for (VAR_1 = 0; VAR_1 < VAR_0->reqRingNumPages; VAR_1++) {", "trace_pvscsi_tx_rings_ppn(\"Request R...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ] ]
26,959
void ioinst_handle_ssch(S390CPU *cpu, uint64_t reg1, uint32_t ipb) { int cssid, ssid, schid, m; SubchDev *sch; ORB orig_orb, orb; uint64_t addr; int ret = -ENODEV; int cc; CPUS390XState *env = &cpu->env; uint8_t ar; addr = decode_basedisp_s(env, ipb, &ar); if (addr & 3) { program_interrupt(env, PGM_SPECIFICATION, 2); return; } if (s390_cpu_virt_mem_read(cpu, addr, ar, &orig_orb, sizeof(orb))) { return; } copy_orb_from_guest(&orb, &orig_orb); if (ioinst_disassemble_sch_ident(reg1, &m, &cssid, &ssid, &schid) || !ioinst_orb_valid(&orb)) { program_interrupt(env, PGM_OPERAND, 2); return; } trace_ioinst_sch_id("ssch", cssid, ssid, schid); sch = css_find_subch(m, cssid, ssid, schid); if (sch && css_subch_visible(sch)) { ret = css_do_ssch(sch, &orb); } switch (ret) { case -ENODEV: cc = 3; break; case -EBUSY: cc = 2; break; case -EFAULT: /* * TODO: * I'm wondering whether there is something better * to do for us here (like setting some device or * subchannel status). */ program_interrupt(env, PGM_ADDRESSING, 4); return; case 0: cc = 0; break; default: cc = 1; break; } setcc(cpu, cc); }
false
qemu
7e01376daea75e888c370aab521a7d4aeaf2ffd1
void ioinst_handle_ssch(S390CPU *cpu, uint64_t reg1, uint32_t ipb) { int cssid, ssid, schid, m; SubchDev *sch; ORB orig_orb, orb; uint64_t addr; int ret = -ENODEV; int cc; CPUS390XState *env = &cpu->env; uint8_t ar; addr = decode_basedisp_s(env, ipb, &ar); if (addr & 3) { program_interrupt(env, PGM_SPECIFICATION, 2); return; } if (s390_cpu_virt_mem_read(cpu, addr, ar, &orig_orb, sizeof(orb))) { return; } copy_orb_from_guest(&orb, &orig_orb); if (ioinst_disassemble_sch_ident(reg1, &m, &cssid, &ssid, &schid) || !ioinst_orb_valid(&orb)) { program_interrupt(env, PGM_OPERAND, 2); return; } trace_ioinst_sch_id("ssch", cssid, ssid, schid); sch = css_find_subch(m, cssid, ssid, schid); if (sch && css_subch_visible(sch)) { ret = css_do_ssch(sch, &orb); } switch (ret) { case -ENODEV: cc = 3; break; case -EBUSY: cc = 2; break; case -EFAULT: program_interrupt(env, PGM_ADDRESSING, 4); return; case 0: cc = 0; break; default: cc = 1; break; } setcc(cpu, cc); }
{ "code": [], "line_no": [] }
void FUNC_0(S390CPU *VAR_0, uint64_t VAR_1, uint32_t VAR_2) { int VAR_3, VAR_4, VAR_5, VAR_6; SubchDev *sch; ORB orig_orb, orb; uint64_t addr; int VAR_7 = -ENODEV; int VAR_8; CPUS390XState *env = &VAR_0->env; uint8_t ar; addr = decode_basedisp_s(env, VAR_2, &ar); if (addr & 3) { program_interrupt(env, PGM_SPECIFICATION, 2); return; } if (s390_cpu_virt_mem_read(VAR_0, addr, ar, &orig_orb, sizeof(orb))) { return; } copy_orb_from_guest(&orb, &orig_orb); if (ioinst_disassemble_sch_ident(VAR_1, &VAR_6, &VAR_3, &VAR_4, &VAR_5) || !ioinst_orb_valid(&orb)) { program_interrupt(env, PGM_OPERAND, 2); return; } trace_ioinst_sch_id("ssch", VAR_3, VAR_4, VAR_5); sch = css_find_subch(VAR_6, VAR_3, VAR_4, VAR_5); if (sch && css_subch_visible(sch)) { VAR_7 = css_do_ssch(sch, &orb); } switch (VAR_7) { case -ENODEV: VAR_8 = 3; break; case -EBUSY: VAR_8 = 2; break; case -EFAULT: program_interrupt(env, PGM_ADDRESSING, 4); return; case 0: VAR_8 = 0; break; default: VAR_8 = 1; break; } setcc(VAR_0, VAR_8); }
[ "void FUNC_0(S390CPU *VAR_0, uint64_t VAR_1, uint32_t VAR_2)\n{", "int VAR_3, VAR_4, VAR_5, VAR_6;", "SubchDev *sch;", "ORB orig_orb, orb;", "uint64_t addr;", "int VAR_7 = -ENODEV;", "int VAR_8;", "CPUS390XState *env = &VAR_0->env;", "uint8_t ar;", "addr = decode_basedisp_s(env, VAR_2, &ar);", "...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [...
26,960
static av_cold int imc_decode_init(AVCodecContext *avctx) { int i, j, ret; IMCContext *q = avctx->priv_data; double r1, r2; if ((avctx->codec_id == AV_CODEC_ID_IMC && avctx->channels != 1) || (avctx->codec_id == AV_CODEC_ID_IAC && avctx->channels > 2)) { av_log_ask_for_sample(avctx, "Number of channels is not supported\n"); return AVERROR_PATCHWELCOME; } for (j = 0; j < avctx->channels; j++) { q->chctx[j].decoder_reset = 1; for (i = 0; i < BANDS; i++) q->chctx[j].old_floor[i] = 1.0; for (i = 0; i < COEFFS / 2; i++) q->chctx[j].last_fft_im[i] = 0; } /* Build mdct window, a simple sine window normalized with sqrt(2) */ ff_sine_window_init(q->mdct_sine_window, COEFFS); for (i = 0; i < COEFFS; i++) q->mdct_sine_window[i] *= sqrt(2.0); for (i = 0; i < COEFFS / 2; i++) { q->post_cos[i] = (1.0f / 32768) * cos(i / 256.0 * M_PI); q->post_sin[i] = (1.0f / 32768) * sin(i / 256.0 * M_PI); r1 = sin((i * 4.0 + 1.0) / 1024.0 * M_PI); r2 = cos((i * 4.0 + 1.0) / 1024.0 * M_PI); if (i & 0x1) { q->pre_coef1[i] = (r1 + r2) * sqrt(2.0); q->pre_coef2[i] = -(r1 - r2) * sqrt(2.0); } else { q->pre_coef1[i] = -(r1 + r2) * sqrt(2.0); q->pre_coef2[i] = (r1 - r2) * sqrt(2.0); } } /* Generate a square root table */ for (i = 0; i < 30; i++) q->sqrt_tab[i] = sqrt(i); /* initialize the VLC tables */ for (i = 0; i < 4 ; i++) { for (j = 0; j < 4; j++) { huffman_vlc[i][j].table = &vlc_tables[vlc_offsets[i * 4 + j]]; huffman_vlc[i][j].table_allocated = vlc_offsets[i * 4 + j + 1] - vlc_offsets[i * 4 + j]; init_vlc(&huffman_vlc[i][j], 9, imc_huffman_sizes[i], imc_huffman_lens[i][j], 1, 1, imc_huffman_bits[i][j], 2, 2, INIT_VLC_USE_NEW_STATIC); } } if (avctx->codec_id == AV_CODEC_ID_IAC) { iac_generate_tabs(q, avctx->sample_rate); } else { memcpy(q->cyclTab, cyclTab, sizeof(cyclTab)); memcpy(q->cyclTab2, cyclTab2, sizeof(cyclTab2)); memcpy(q->weights1, imc_weights1, sizeof(imc_weights1)); memcpy(q->weights2, imc_weights2, sizeof(imc_weights2)); } if ((ret = ff_fft_init(&q->fft, 7, 1))) { av_log(avctx, AV_LOG_INFO, "FFT init failed\n"); return ret; } ff_dsputil_init(&q->dsp, avctx); avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; avctx->channel_layout = avctx->channels == 1 ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO; avcodec_get_frame_defaults(&q->frame); avctx->coded_frame = &q->frame; return 0; }
false
FFmpeg
1c7a0161538a9e8417086759a5d6d3295337c433
static av_cold int imc_decode_init(AVCodecContext *avctx) { int i, j, ret; IMCContext *q = avctx->priv_data; double r1, r2; if ((avctx->codec_id == AV_CODEC_ID_IMC && avctx->channels != 1) || (avctx->codec_id == AV_CODEC_ID_IAC && avctx->channels > 2)) { av_log_ask_for_sample(avctx, "Number of channels is not supported\n"); return AVERROR_PATCHWELCOME; } for (j = 0; j < avctx->channels; j++) { q->chctx[j].decoder_reset = 1; for (i = 0; i < BANDS; i++) q->chctx[j].old_floor[i] = 1.0; for (i = 0; i < COEFFS / 2; i++) q->chctx[j].last_fft_im[i] = 0; } ff_sine_window_init(q->mdct_sine_window, COEFFS); for (i = 0; i < COEFFS; i++) q->mdct_sine_window[i] *= sqrt(2.0); for (i = 0; i < COEFFS / 2; i++) { q->post_cos[i] = (1.0f / 32768) * cos(i / 256.0 * M_PI); q->post_sin[i] = (1.0f / 32768) * sin(i / 256.0 * M_PI); r1 = sin((i * 4.0 + 1.0) / 1024.0 * M_PI); r2 = cos((i * 4.0 + 1.0) / 1024.0 * M_PI); if (i & 0x1) { q->pre_coef1[i] = (r1 + r2) * sqrt(2.0); q->pre_coef2[i] = -(r1 - r2) * sqrt(2.0); } else { q->pre_coef1[i] = -(r1 + r2) * sqrt(2.0); q->pre_coef2[i] = (r1 - r2) * sqrt(2.0); } } for (i = 0; i < 30; i++) q->sqrt_tab[i] = sqrt(i); for (i = 0; i < 4 ; i++) { for (j = 0; j < 4; j++) { huffman_vlc[i][j].table = &vlc_tables[vlc_offsets[i * 4 + j]]; huffman_vlc[i][j].table_allocated = vlc_offsets[i * 4 + j + 1] - vlc_offsets[i * 4 + j]; init_vlc(&huffman_vlc[i][j], 9, imc_huffman_sizes[i], imc_huffman_lens[i][j], 1, 1, imc_huffman_bits[i][j], 2, 2, INIT_VLC_USE_NEW_STATIC); } } if (avctx->codec_id == AV_CODEC_ID_IAC) { iac_generate_tabs(q, avctx->sample_rate); } else { memcpy(q->cyclTab, cyclTab, sizeof(cyclTab)); memcpy(q->cyclTab2, cyclTab2, sizeof(cyclTab2)); memcpy(q->weights1, imc_weights1, sizeof(imc_weights1)); memcpy(q->weights2, imc_weights2, sizeof(imc_weights2)); } if ((ret = ff_fft_init(&q->fft, 7, 1))) { av_log(avctx, AV_LOG_INFO, "FFT init failed\n"); return ret; } ff_dsputil_init(&q->dsp, avctx); avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; avctx->channel_layout = avctx->channels == 1 ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO; avcodec_get_frame_defaults(&q->frame); avctx->coded_frame = &q->frame; return 0; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx) { int VAR_0, VAR_1, VAR_2; IMCContext *q = avctx->priv_data; double VAR_3, VAR_4; if ((avctx->codec_id == AV_CODEC_ID_IMC && avctx->channels != 1) || (avctx->codec_id == AV_CODEC_ID_IAC && avctx->channels > 2)) { av_log_ask_for_sample(avctx, "Number of channels is not supported\n"); return AVERROR_PATCHWELCOME; } for (VAR_1 = 0; VAR_1 < avctx->channels; VAR_1++) { q->chctx[VAR_1].decoder_reset = 1; for (VAR_0 = 0; VAR_0 < BANDS; VAR_0++) q->chctx[VAR_1].old_floor[VAR_0] = 1.0; for (VAR_0 = 0; VAR_0 < COEFFS / 2; VAR_0++) q->chctx[VAR_1].last_fft_im[VAR_0] = 0; } ff_sine_window_init(q->mdct_sine_window, COEFFS); for (VAR_0 = 0; VAR_0 < COEFFS; VAR_0++) q->mdct_sine_window[VAR_0] *= sqrt(2.0); for (VAR_0 = 0; VAR_0 < COEFFS / 2; VAR_0++) { q->post_cos[VAR_0] = (1.0f / 32768) * cos(VAR_0 / 256.0 * M_PI); q->post_sin[VAR_0] = (1.0f / 32768) * sin(VAR_0 / 256.0 * M_PI); VAR_3 = sin((VAR_0 * 4.0 + 1.0) / 1024.0 * M_PI); VAR_4 = cos((VAR_0 * 4.0 + 1.0) / 1024.0 * M_PI); if (VAR_0 & 0x1) { q->pre_coef1[VAR_0] = (VAR_3 + VAR_4) * sqrt(2.0); q->pre_coef2[VAR_0] = -(VAR_3 - VAR_4) * sqrt(2.0); } else { q->pre_coef1[VAR_0] = -(VAR_3 + VAR_4) * sqrt(2.0); q->pre_coef2[VAR_0] = (VAR_3 - VAR_4) * sqrt(2.0); } } for (VAR_0 = 0; VAR_0 < 30; VAR_0++) q->sqrt_tab[VAR_0] = sqrt(VAR_0); for (VAR_0 = 0; VAR_0 < 4 ; VAR_0++) { for (VAR_1 = 0; VAR_1 < 4; VAR_1++) { huffman_vlc[VAR_0][VAR_1].table = &vlc_tables[vlc_offsets[VAR_0 * 4 + VAR_1]]; huffman_vlc[VAR_0][VAR_1].table_allocated = vlc_offsets[VAR_0 * 4 + VAR_1 + 1] - vlc_offsets[VAR_0 * 4 + VAR_1]; init_vlc(&huffman_vlc[VAR_0][VAR_1], 9, imc_huffman_sizes[VAR_0], imc_huffman_lens[VAR_0][VAR_1], 1, 1, imc_huffman_bits[VAR_0][VAR_1], 2, 2, INIT_VLC_USE_NEW_STATIC); } } if (avctx->codec_id == AV_CODEC_ID_IAC) { iac_generate_tabs(q, avctx->sample_rate); } else { memcpy(q->cyclTab, cyclTab, sizeof(cyclTab)); memcpy(q->cyclTab2, cyclTab2, sizeof(cyclTab2)); memcpy(q->weights1, imc_weights1, sizeof(imc_weights1)); memcpy(q->weights2, imc_weights2, sizeof(imc_weights2)); } if ((VAR_2 = ff_fft_init(&q->fft, 7, 1))) { av_log(avctx, AV_LOG_INFO, "FFT init failed\n"); return VAR_2; } ff_dsputil_init(&q->dsp, avctx); avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; avctx->channel_layout = avctx->channels == 1 ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO; avcodec_get_frame_defaults(&q->frame); avctx->coded_frame = &q->frame; return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "int VAR_0, VAR_1, VAR_2;", "IMCContext *q = avctx->priv_data;", "double VAR_3, VAR_4;", "if ((avctx->codec_id == AV_CODEC_ID_IMC && avctx->channels != 1)\n|| (avctx->codec_id == AV_CODEC_ID_IAC && avctx->channels > 2)) {", "av_log_ask_for_sample(avct...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 21 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [...
26,961
static void setup_frame(int sig, struct target_sigaction *ka, target_sigset_t *set, CPUPPCState *env) { struct target_sigframe *frame; struct target_sigcontext *sc; target_ulong frame_addr, newsp; int err = 0; int signal; frame_addr = get_sigframe(ka, env, sizeof(*frame)); if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 1)) goto sigsegv; sc = &frame->sctx; signal = current_exec_domain_sig(sig); __put_user(ka->_sa_handler, &sc->handler); __put_user(set->sig[0], &sc->oldmask); #if defined(TARGET_PPC64) __put_user(set->sig[0] >> 32, &sc->_unused[3]); #else __put_user(set->sig[1], &sc->_unused[3]); #endif __put_user(h2g(&frame->mctx), &sc->regs); __put_user(sig, &sc->signal); /* Save user regs. */ err |= save_user_regs(env, &frame->mctx, TARGET_NR_sigreturn); /* The kernel checks for the presence of a VDSO here. We don't emulate a vdso, so use a sigreturn system call. */ env->lr = (target_ulong) h2g(frame->mctx.tramp); /* Turn off all fp exceptions. */ env->fpscr = 0; /* Create a stack frame for the caller of the handler. */ newsp = frame_addr - SIGNAL_FRAMESIZE; err |= put_user(env->gpr[1], newsp, target_ulong); if (err) goto sigsegv; /* Set up registers for signal handler. */ env->gpr[1] = newsp; env->gpr[3] = signal; env->gpr[4] = frame_addr + offsetof(struct target_sigframe, sctx); env->nip = (target_ulong) ka->_sa_handler; /* Signal handlers are entered in big-endian mode. */ env->msr &= ~MSR_LE; unlock_user_struct(frame, frame_addr, 1); return; sigsegv: unlock_user_struct(frame, frame_addr, 1); qemu_log("segfaulting from setup_frame\n"); force_sig(TARGET_SIGSEGV); }
false
qemu
c650c008e326f3a1e84083bc269265456057a212
static void setup_frame(int sig, struct target_sigaction *ka, target_sigset_t *set, CPUPPCState *env) { struct target_sigframe *frame; struct target_sigcontext *sc; target_ulong frame_addr, newsp; int err = 0; int signal; frame_addr = get_sigframe(ka, env, sizeof(*frame)); if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 1)) goto sigsegv; sc = &frame->sctx; signal = current_exec_domain_sig(sig); __put_user(ka->_sa_handler, &sc->handler); __put_user(set->sig[0], &sc->oldmask); #if defined(TARGET_PPC64) __put_user(set->sig[0] >> 32, &sc->_unused[3]); #else __put_user(set->sig[1], &sc->_unused[3]); #endif __put_user(h2g(&frame->mctx), &sc->regs); __put_user(sig, &sc->signal); err |= save_user_regs(env, &frame->mctx, TARGET_NR_sigreturn); env->lr = (target_ulong) h2g(frame->mctx.tramp); env->fpscr = 0; newsp = frame_addr - SIGNAL_FRAMESIZE; err |= put_user(env->gpr[1], newsp, target_ulong); if (err) goto sigsegv; env->gpr[1] = newsp; env->gpr[3] = signal; env->gpr[4] = frame_addr + offsetof(struct target_sigframe, sctx); env->nip = (target_ulong) ka->_sa_handler; env->msr &= ~MSR_LE; unlock_user_struct(frame, frame_addr, 1); return; sigsegv: unlock_user_struct(frame, frame_addr, 1); qemu_log("segfaulting from setup_frame\n"); force_sig(TARGET_SIGSEGV); }
{ "code": [], "line_no": [] }
static void FUNC_0(int VAR_0, struct target_sigaction *VAR_1, target_sigset_t *VAR_2, CPUPPCState *VAR_3) { struct target_sigframe *VAR_4; struct target_sigcontext *VAR_5; target_ulong frame_addr, newsp; int VAR_6 = 0; int VAR_7; frame_addr = get_sigframe(VAR_1, VAR_3, sizeof(*VAR_4)); if (!lock_user_struct(VERIFY_WRITE, VAR_4, frame_addr, 1)) goto sigsegv; VAR_5 = &VAR_4->sctx; VAR_7 = current_exec_domain_sig(VAR_0); __put_user(VAR_1->_sa_handler, &VAR_5->handler); __put_user(VAR_2->VAR_0[0], &VAR_5->oldmask); #if defined(TARGET_PPC64) __put_user(VAR_2->VAR_0[0] >> 32, &VAR_5->_unused[3]); #else __put_user(VAR_2->VAR_0[1], &VAR_5->_unused[3]); #endif __put_user(h2g(&VAR_4->mctx), &VAR_5->regs); __put_user(VAR_0, &VAR_5->VAR_7); VAR_6 |= save_user_regs(VAR_3, &VAR_4->mctx, TARGET_NR_sigreturn); VAR_3->lr = (target_ulong) h2g(VAR_4->mctx.tramp); VAR_3->fpscr = 0; newsp = frame_addr - SIGNAL_FRAMESIZE; VAR_6 |= put_user(VAR_3->gpr[1], newsp, target_ulong); if (VAR_6) goto sigsegv; VAR_3->gpr[1] = newsp; VAR_3->gpr[3] = VAR_7; VAR_3->gpr[4] = frame_addr + offsetof(struct target_sigframe, sctx); VAR_3->nip = (target_ulong) VAR_1->_sa_handler; VAR_3->msr &= ~MSR_LE; unlock_user_struct(VAR_4, frame_addr, 1); return; sigsegv: unlock_user_struct(VAR_4, frame_addr, 1); qemu_log("segfaulting from FUNC_0\n"); force_sig(TARGET_SIGSEGV); }
[ "static void FUNC_0(int VAR_0, struct target_sigaction *VAR_1,\ntarget_sigset_t *VAR_2, CPUPPCState *VAR_3)\n{", "struct target_sigframe *VAR_4;", "struct target_sigcontext *VAR_5;", "target_ulong frame_addr, newsp;", "int VAR_6 = 0;", "int VAR_7;", "frame_addr = get_sigframe(VAR_1, VAR_3, sizeof(*VAR_4...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 33 ], [ 35 ], [ 37, 39 ], [ 41, 43 ], [ 45, 47 ], [ 49 ], [ 55 ], [...
26,962
void aio_context_ref(AioContext *ctx) { g_source_ref(&ctx->source); }
false
qemu
c2b38b277a7882a592f4f2ec955084b2b756daaa
void aio_context_ref(AioContext *ctx) { g_source_ref(&ctx->source); }
{ "code": [], "line_no": [] }
void FUNC_0(AioContext *VAR_0) { g_source_ref(&VAR_0->source); }
[ "void FUNC_0(AioContext *VAR_0)\n{", "g_source_ref(&VAR_0->source);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
26,963
static uint64_t mv88w8618_audio_read(void *opaque, target_phys_addr_t offset, unsigned size) { mv88w8618_audio_state *s = opaque; switch (offset) { case MP_AUDIO_PLAYBACK_MODE: return s->playback_mode; case MP_AUDIO_CLOCK_DIV: return s->clock_div; case MP_AUDIO_IRQ_STATUS: return s->status; case MP_AUDIO_IRQ_ENABLE: return s->irq_enable; case MP_AUDIO_TX_STATUS: return s->play_pos >> 2; default: return 0; } }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static uint64_t mv88w8618_audio_read(void *opaque, target_phys_addr_t offset, unsigned size) { mv88w8618_audio_state *s = opaque; switch (offset) { case MP_AUDIO_PLAYBACK_MODE: return s->playback_mode; case MP_AUDIO_CLOCK_DIV: return s->clock_div; case MP_AUDIO_IRQ_STATUS: return s->status; case MP_AUDIO_IRQ_ENABLE: return s->irq_enable; case MP_AUDIO_TX_STATUS: return s->play_pos >> 2; default: return 0; } }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(void *opaque, target_phys_addr_t offset, unsigned size) { mv88w8618_audio_state *s = opaque; switch (offset) { case MP_AUDIO_PLAYBACK_MODE: return s->playback_mode; case MP_AUDIO_CLOCK_DIV: return s->clock_div; case MP_AUDIO_IRQ_STATUS: return s->status; case MP_AUDIO_IRQ_ENABLE: return s->irq_enable; case MP_AUDIO_TX_STATUS: return s->play_pos >> 2; default: return 0; } }
[ "static uint64_t FUNC_0(void *opaque, target_phys_addr_t offset,\nunsigned size)\n{", "mv88w8618_audio_state *s = opaque;", "switch (offset) {", "case MP_AUDIO_PLAYBACK_MODE:\nreturn s->playback_mode;", "case MP_AUDIO_CLOCK_DIV:\nreturn s->clock_div;", "case MP_AUDIO_IRQ_STATUS:\nreturn s->status;", "ca...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 19, 21 ], [ 25, 27 ], [ 31, 33 ], [ 37, 39 ], [ 43, 45 ], [ 47 ], [ 49 ] ]
26,964
static void free_drive(DeviceState *dev, Property *prop) { DriveInfo **ptr = qdev_get_prop_ptr(dev, prop); if (*ptr) { blockdev_auto_del((*ptr)->bdrv); } }
false
qemu
f8b6cc0070aab8b75bd082582c829be1353f395f
static void free_drive(DeviceState *dev, Property *prop) { DriveInfo **ptr = qdev_get_prop_ptr(dev, prop); if (*ptr) { blockdev_auto_del((*ptr)->bdrv); } }
{ "code": [], "line_no": [] }
static void FUNC_0(DeviceState *VAR_0, Property *VAR_1) { DriveInfo **ptr = qdev_get_prop_ptr(VAR_0, VAR_1); if (*ptr) { blockdev_auto_del((*ptr)->bdrv); } }
[ "static void FUNC_0(DeviceState *VAR_0, Property *VAR_1)\n{", "DriveInfo **ptr = qdev_get_prop_ptr(VAR_0, VAR_1);", "if (*ptr) {", "blockdev_auto_del((*ptr)->bdrv);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
26,966
void scsi_device_purge_requests(SCSIDevice *sdev, SCSISense sense) { SCSIRequest *req; while (!QTAILQ_EMPTY(&sdev->requests)) { req = QTAILQ_FIRST(&sdev->requests); scsi_req_cancel(req); } sdev->unit_attention = sense; }
false
qemu
e48e84ea80cb2e7fe6e48196ce187cfba6e3eb2c
void scsi_device_purge_requests(SCSIDevice *sdev, SCSISense sense) { SCSIRequest *req; while (!QTAILQ_EMPTY(&sdev->requests)) { req = QTAILQ_FIRST(&sdev->requests); scsi_req_cancel(req); } sdev->unit_attention = sense; }
{ "code": [], "line_no": [] }
void FUNC_0(SCSIDevice *VAR_0, SCSISense VAR_1) { SCSIRequest *req; while (!QTAILQ_EMPTY(&VAR_0->requests)) { req = QTAILQ_FIRST(&VAR_0->requests); scsi_req_cancel(req); } VAR_0->unit_attention = VAR_1; }
[ "void FUNC_0(SCSIDevice *VAR_0, SCSISense VAR_1)\n{", "SCSIRequest *req;", "while (!QTAILQ_EMPTY(&VAR_0->requests)) {", "req = QTAILQ_FIRST(&VAR_0->requests);", "scsi_req_cancel(req);", "}", "VAR_0->unit_attention = VAR_1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
26,967
uint64_t cpu_get_apic_base(DeviceState *d) { if (d) { APICCommonState *s = APIC_COMMON(d); trace_cpu_get_apic_base((uint64_t)s->apicbase); return s->apicbase; } else { trace_cpu_get_apic_base(0); return 0; } }
false
qemu
dd673288a8ff73ad77fcc1c255486d2466a772e1
uint64_t cpu_get_apic_base(DeviceState *d) { if (d) { APICCommonState *s = APIC_COMMON(d); trace_cpu_get_apic_base((uint64_t)s->apicbase); return s->apicbase; } else { trace_cpu_get_apic_base(0); return 0; } }
{ "code": [], "line_no": [] }
uint64_t FUNC_0(DeviceState *d) { if (d) { APICCommonState *s = APIC_COMMON(d); trace_cpu_get_apic_base((uint64_t)s->apicbase); return s->apicbase; } else { trace_cpu_get_apic_base(0); return 0; } }
[ "uint64_t FUNC_0(DeviceState *d)\n{", "if (d) {", "APICCommonState *s = APIC_COMMON(d);", "trace_cpu_get_apic_base((uint64_t)s->apicbase);", "return s->apicbase;", "} else {", "trace_cpu_get_apic_base(0);", "return 0;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
26,968
static int ram_save_complete(QEMUFile *f, void *opaque) { rcu_read_lock(); if (!migration_in_postcopy(migrate_get_current())) { migration_bitmap_sync(); } ram_control_before_iterate(f, RAM_CONTROL_FINISH); /* try transferring iterative blocks of memory */ /* flush all remaining blocks regardless of rate limiting */ while (true) { int pages; pages = ram_find_and_save_block(f, true, &bytes_transferred); /* no more blocks to sent */ if (pages == 0) { break; } } flush_compressed_data(f); ram_control_after_iterate(f, RAM_CONTROL_FINISH); rcu_read_unlock(); qemu_put_be64(f, RAM_SAVE_FLAG_EOS); return 0; }
false
qemu
a91246c95f913dc6fd391eee32f6c9796de70183
static int ram_save_complete(QEMUFile *f, void *opaque) { rcu_read_lock(); if (!migration_in_postcopy(migrate_get_current())) { migration_bitmap_sync(); } ram_control_before_iterate(f, RAM_CONTROL_FINISH); while (true) { int pages; pages = ram_find_and_save_block(f, true, &bytes_transferred); if (pages == 0) { break; } } flush_compressed_data(f); ram_control_after_iterate(f, RAM_CONTROL_FINISH); rcu_read_unlock(); qemu_put_be64(f, RAM_SAVE_FLAG_EOS); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(QEMUFile *VAR_0, void *VAR_1) { rcu_read_lock(); if (!migration_in_postcopy(migrate_get_current())) { migration_bitmap_sync(); } ram_control_before_iterate(VAR_0, RAM_CONTROL_FINISH); while (true) { int VAR_2; VAR_2 = ram_find_and_save_block(VAR_0, true, &bytes_transferred); if (VAR_2 == 0) { break; } } flush_compressed_data(VAR_0); ram_control_after_iterate(VAR_0, RAM_CONTROL_FINISH); rcu_read_unlock(); qemu_put_be64(VAR_0, RAM_SAVE_FLAG_EOS); return 0; }
[ "static int FUNC_0(QEMUFile *VAR_0, void *VAR_1)\n{", "rcu_read_lock();", "if (!migration_in_postcopy(migrate_get_current())) {", "migration_bitmap_sync();", "}", "ram_control_before_iterate(VAR_0, RAM_CONTROL_FINISH);", "while (true) {", "int VAR_2;", "VAR_2 = ram_find_and_save_block(VAR_0, true, &...
[ 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 ], [ 17 ], [ 27 ], [ 29 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 53 ], [ 57 ], [ 61 ], [ 63 ] ]
26,970
uint32_t HELPER(lpxbr)(CPUS390XState *env, uint32_t f1, uint32_t f2) { CPU_QuadU v1; CPU_QuadU v2; v2.ll.upper = env->fregs[f2].ll; v2.ll.lower = env->fregs[f2 + 2].ll; v1.q = float128_abs(v2.q); env->fregs[f1].ll = v1.ll.upper; env->fregs[f1 + 2].ll = v1.ll.lower; return set_cc_nz_f128(v1.q); }
false
qemu
5d7fd045cafeac1831c1999cb9e1251b7906c6b2
uint32_t HELPER(lpxbr)(CPUS390XState *env, uint32_t f1, uint32_t f2) { CPU_QuadU v1; CPU_QuadU v2; v2.ll.upper = env->fregs[f2].ll; v2.ll.lower = env->fregs[f2 + 2].ll; v1.q = float128_abs(v2.q); env->fregs[f1].ll = v1.ll.upper; env->fregs[f1 + 2].ll = v1.ll.lower; return set_cc_nz_f128(v1.q); }
{ "code": [], "line_no": [] }
uint32_t FUNC_0(lpxbr)(CPUS390XState *env, uint32_t f1, uint32_t f2) { CPU_QuadU v1; CPU_QuadU v2; v2.ll.upper = env->fregs[f2].ll; v2.ll.lower = env->fregs[f2 + 2].ll; v1.q = float128_abs(v2.q); env->fregs[f1].ll = v1.ll.upper; env->fregs[f1 + 2].ll = v1.ll.lower; return set_cc_nz_f128(v1.q); }
[ "uint32_t FUNC_0(lpxbr)(CPUS390XState *env, uint32_t f1, uint32_t f2)\n{", "CPU_QuadU v1;", "CPU_QuadU v2;", "v2.ll.upper = env->fregs[f2].ll;", "v2.ll.lower = env->fregs[f2 + 2].ll;", "v1.q = float128_abs(v2.q);", "env->fregs[f1].ll = v1.ll.upper;", "env->fregs[f1 + 2].ll = v1.ll.lower;", "return s...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
26,972
static int v9fs_synth_statfs(FsContext *s, V9fsPath *fs_path, struct statfs *stbuf) { stbuf->f_type = 0xABCD; stbuf->f_bsize = 512; stbuf->f_blocks = 0; stbuf->f_files = v9fs_synth_node_count; stbuf->f_namelen = NAME_MAX; return 0; }
false
qemu
364031f17932814484657e5551ba12957d993d7e
static int v9fs_synth_statfs(FsContext *s, V9fsPath *fs_path, struct statfs *stbuf) { stbuf->f_type = 0xABCD; stbuf->f_bsize = 512; stbuf->f_blocks = 0; stbuf->f_files = v9fs_synth_node_count; stbuf->f_namelen = NAME_MAX; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1, struct statfs *VAR_2) { VAR_2->f_type = 0xABCD; VAR_2->f_bsize = 512; VAR_2->f_blocks = 0; VAR_2->f_files = v9fs_synth_node_count; VAR_2->f_namelen = NAME_MAX; return 0; }
[ "static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1,\nstruct statfs *VAR_2)\n{", "VAR_2->f_type = 0xABCD;", "VAR_2->f_bsize = 512;", "VAR_2->f_blocks = 0;", "VAR_2->f_files = v9fs_synth_node_count;", "VAR_2->f_namelen = NAME_MAX;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
26,973
static void m5206_mbar_writew(void *opaque, target_phys_addr_t offset, uint32_t value) { m5206_mbar_state *s = (m5206_mbar_state *)opaque; int width; offset &= 0x3ff; if (offset >= 0x200) { hw_error("Bad MBAR write offset 0x%x", (int)offset); } width = m5206_mbar_width[offset >> 2]; if (width > 2) { uint32_t tmp; tmp = m5206_mbar_readl(opaque, offset & ~3); if (offset & 3) { tmp = (tmp & 0xffff0000) | value; } else { tmp = (tmp & 0x0000ffff) | (value << 16); } m5206_mbar_writel(opaque, offset & ~3, tmp); return; } else if (width < 2) { m5206_mbar_writeb(opaque, offset, value >> 8); m5206_mbar_writeb(opaque, offset + 1, value & 0xff); return; } m5206_mbar_write(s, offset, value, 2); }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void m5206_mbar_writew(void *opaque, target_phys_addr_t offset, uint32_t value) { m5206_mbar_state *s = (m5206_mbar_state *)opaque; int width; offset &= 0x3ff; if (offset >= 0x200) { hw_error("Bad MBAR write offset 0x%x", (int)offset); } width = m5206_mbar_width[offset >> 2]; if (width > 2) { uint32_t tmp; tmp = m5206_mbar_readl(opaque, offset & ~3); if (offset & 3) { tmp = (tmp & 0xffff0000) | value; } else { tmp = (tmp & 0x0000ffff) | (value << 16); } m5206_mbar_writel(opaque, offset & ~3, tmp); return; } else if (width < 2) { m5206_mbar_writeb(opaque, offset, value >> 8); m5206_mbar_writeb(opaque, offset + 1, value & 0xff); return; } m5206_mbar_write(s, offset, value, 2); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint32_t VAR_2) { m5206_mbar_state *s = (m5206_mbar_state *)VAR_0; int VAR_3; VAR_1 &= 0x3ff; if (VAR_1 >= 0x200) { hw_error("Bad MBAR write VAR_1 0x%x", (int)VAR_1); } VAR_3 = m5206_mbar_width[VAR_1 >> 2]; if (VAR_3 > 2) { uint32_t tmp; tmp = m5206_mbar_readl(VAR_0, VAR_1 & ~3); if (VAR_1 & 3) { tmp = (tmp & 0xffff0000) | VAR_2; } else { tmp = (tmp & 0x0000ffff) | (VAR_2 << 16); } m5206_mbar_writel(VAR_0, VAR_1 & ~3, tmp); return; } else if (VAR_3 < 2) { m5206_mbar_writeb(VAR_0, VAR_1, VAR_2 >> 8); m5206_mbar_writeb(VAR_0, VAR_1 + 1, VAR_2 & 0xff); return; } m5206_mbar_write(s, VAR_1, VAR_2, 2); }
[ "static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint32_t VAR_2)\n{", "m5206_mbar_state *s = (m5206_mbar_state *)VAR_0;", "int VAR_3;", "VAR_1 &= 0x3ff;", "if (VAR_1 >= 0x200) {", "hw_error(\"Bad MBAR write VAR_1 0x%x\", (int)VAR_1);", "}", "VAR_3 = m5206_mbar_width[VAR_1 >> 2];", "if (VA...
[ 0, 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 ], [...
26,974
hwaddr memory_region_section_get_iotlb(CPUArchState *env, MemoryRegionSection *section, target_ulong vaddr, hwaddr paddr, int prot, target_ulong *address) { hwaddr iotlb; CPUWatchpoint *wp; if (memory_region_is_ram(section->mr)) { /* Normal RAM. */ iotlb = (memory_region_get_ram_addr(section->mr) & TARGET_PAGE_MASK) + memory_region_section_addr(section, paddr); if (!section->readonly) { iotlb |= phys_section_notdirty; } else { iotlb |= phys_section_rom; } } else { iotlb = section - phys_sections; iotlb += memory_region_section_addr(section, paddr); } /* Make accesses to pages with watchpoints go via the watchpoint trap routines. */ QTAILQ_FOREACH(wp, &env->watchpoints, entry) { if (vaddr == (wp->vaddr & TARGET_PAGE_MASK)) { /* Avoid trapping reads of pages with a write breakpoint. */ if ((prot & PAGE_WRITE) || (wp->flags & BP_MEM_READ)) { iotlb = phys_section_watch + paddr; *address |= TLB_MMIO; break; } } } return iotlb; }
false
qemu
149f54b53b7666a3facd45e86eece60ce7d3b114
hwaddr memory_region_section_get_iotlb(CPUArchState *env, MemoryRegionSection *section, target_ulong vaddr, hwaddr paddr, int prot, target_ulong *address) { hwaddr iotlb; CPUWatchpoint *wp; if (memory_region_is_ram(section->mr)) { iotlb = (memory_region_get_ram_addr(section->mr) & TARGET_PAGE_MASK) + memory_region_section_addr(section, paddr); if (!section->readonly) { iotlb |= phys_section_notdirty; } else { iotlb |= phys_section_rom; } } else { iotlb = section - phys_sections; iotlb += memory_region_section_addr(section, paddr); } QTAILQ_FOREACH(wp, &env->watchpoints, entry) { if (vaddr == (wp->vaddr & TARGET_PAGE_MASK)) { if ((prot & PAGE_WRITE) || (wp->flags & BP_MEM_READ)) { iotlb = phys_section_watch + paddr; *address |= TLB_MMIO; break; } } } return iotlb; }
{ "code": [], "line_no": [] }
hwaddr FUNC_0(CPUArchState *env, MemoryRegionSection *section, target_ulong vaddr, hwaddr paddr, int prot, target_ulong *address) { hwaddr iotlb; CPUWatchpoint *wp; if (memory_region_is_ram(section->mr)) { iotlb = (memory_region_get_ram_addr(section->mr) & TARGET_PAGE_MASK) + memory_region_section_addr(section, paddr); if (!section->readonly) { iotlb |= phys_section_notdirty; } else { iotlb |= phys_section_rom; } } else { iotlb = section - phys_sections; iotlb += memory_region_section_addr(section, paddr); } QTAILQ_FOREACH(wp, &env->watchpoints, entry) { if (vaddr == (wp->vaddr & TARGET_PAGE_MASK)) { if ((prot & PAGE_WRITE) || (wp->flags & BP_MEM_READ)) { iotlb = phys_section_watch + paddr; *address |= TLB_MMIO; break; } } } return iotlb; }
[ "hwaddr FUNC_0(CPUArchState *env,\nMemoryRegionSection *section,\ntarget_ulong vaddr,\nhwaddr paddr,\nint prot,\ntarget_ulong *address)\n{", "hwaddr iotlb;", "CPUWatchpoint *wp;", "if (memory_region_is_ram(section->mr)) {", "iotlb = (memory_region_get_ram_addr(section->mr) & TARGET_PAGE_MASK)\n+ memory_regi...
[ 0, 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 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 53 ], [ 55 ], [ 59 ...
26,975
static void term_init(void) { struct termios tty; tcgetattr (0, &tty); oldtty = tty; tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP |INLCR|IGNCR|ICRNL|IXON); tty.c_oflag |= OPOST; tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN); tty.c_cflag &= ~(CSIZE|PARENB); tty.c_cflag |= CS8; tty.c_cc[VMIN] = 1; tty.c_cc[VTIME] = 0; tcsetattr (0, TCSANOW, &tty); atexit(term_exit); }
false
qemu
d57e4e482e3997b1382625c84149ad0b69155fc0
static void term_init(void) { struct termios tty; tcgetattr (0, &tty); oldtty = tty; tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP |INLCR|IGNCR|ICRNL|IXON); tty.c_oflag |= OPOST; tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN); tty.c_cflag &= ~(CSIZE|PARENB); tty.c_cflag |= CS8; tty.c_cc[VMIN] = 1; tty.c_cc[VTIME] = 0; tcsetattr (0, TCSANOW, &tty); atexit(term_exit); }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { struct termios VAR_0; tcgetattr (0, &VAR_0); oldtty = VAR_0; VAR_0.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP |INLCR|IGNCR|ICRNL|IXON); VAR_0.c_oflag |= OPOST; VAR_0.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN); VAR_0.c_cflag &= ~(CSIZE|PARENB); VAR_0.c_cflag |= CS8; VAR_0.c_cc[VMIN] = 1; VAR_0.c_cc[VTIME] = 0; tcsetattr (0, TCSANOW, &VAR_0); atexit(term_exit); }
[ "static void FUNC_0(void)\n{", "struct termios VAR_0;", "tcgetattr (0, &VAR_0);", "oldtty = VAR_0;", "VAR_0.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP\n|INLCR|IGNCR|ICRNL|IXON);", "VAR_0.c_oflag |= OPOST;", "VAR_0.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN);", "VAR_0.c_cflag &= ~(CSIZE|PARENB);", "VAR_0.c...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 37 ], [ 39 ] ]
26,976
static void xics_kvm_realize(DeviceState *dev, Error **errp) { KVMXICSState *icpkvm = KVM_XICS(dev); XICSState *icp = XICS_COMMON(dev); int i, rc; Error *error = NULL; struct kvm_create_device xics_create_device = { .type = KVM_DEV_TYPE_XICS, .flags = 0, }; if (!kvm_enabled() || !kvm_check_extension(kvm_state, KVM_CAP_IRQ_XICS)) { error_setg(errp, "KVM and IRQ_XICS capability must be present for in-kernel XICS"); goto fail; } spapr_rtas_register(RTAS_IBM_SET_XIVE, "ibm,set-xive", rtas_dummy); spapr_rtas_register(RTAS_IBM_GET_XIVE, "ibm,get-xive", rtas_dummy); spapr_rtas_register(RTAS_IBM_INT_OFF, "ibm,int-off", rtas_dummy); spapr_rtas_register(RTAS_IBM_INT_ON, "ibm,int-on", rtas_dummy); rc = kvmppc_define_rtas_kernel_token(RTAS_IBM_SET_XIVE, "ibm,set-xive"); if (rc < 0) { error_setg(errp, "kvmppc_define_rtas_kernel_token: ibm,set-xive"); goto fail; } rc = kvmppc_define_rtas_kernel_token(RTAS_IBM_GET_XIVE, "ibm,get-xive"); if (rc < 0) { error_setg(errp, "kvmppc_define_rtas_kernel_token: ibm,get-xive"); goto fail; } rc = kvmppc_define_rtas_kernel_token(RTAS_IBM_INT_ON, "ibm,int-on"); if (rc < 0) { error_setg(errp, "kvmppc_define_rtas_kernel_token: ibm,int-on"); goto fail; } rc = kvmppc_define_rtas_kernel_token(RTAS_IBM_INT_OFF, "ibm,int-off"); if (rc < 0) { error_setg(errp, "kvmppc_define_rtas_kernel_token: ibm,int-off"); goto fail; } /* Create the kernel ICP */ rc = kvm_vm_ioctl(kvm_state, KVM_CREATE_DEVICE, &xics_create_device); if (rc < 0) { error_setg_errno(errp, -rc, "Error on KVM_CREATE_DEVICE for XICS"); goto fail; } icpkvm->kernel_xics_fd = xics_create_device.fd; object_property_set_bool(OBJECT(icp->ics), true, "realized", &error); if (error) { error_propagate(errp, error); goto fail; } assert(icp->nr_servers); for (i = 0; i < icp->nr_servers; i++) { object_property_set_bool(OBJECT(&icp->ss[i]), true, "realized", &error); if (error) { error_propagate(errp, error); goto fail; } } kvm_kernel_irqchip = true; kvm_irqfds_allowed = true; kvm_msi_via_irqfd_allowed = true; kvm_gsi_direct_mapping = true; return; fail: kvmppc_define_rtas_kernel_token(0, "ibm,set-xive"); kvmppc_define_rtas_kernel_token(0, "ibm,get-xive"); kvmppc_define_rtas_kernel_token(0, "ibm,int-on"); kvmppc_define_rtas_kernel_token(0, "ibm,int-off"); }
false
qemu
f41389ae3c54bd5e2040e3f95a2872981c3ed965
static void xics_kvm_realize(DeviceState *dev, Error **errp) { KVMXICSState *icpkvm = KVM_XICS(dev); XICSState *icp = XICS_COMMON(dev); int i, rc; Error *error = NULL; struct kvm_create_device xics_create_device = { .type = KVM_DEV_TYPE_XICS, .flags = 0, }; if (!kvm_enabled() || !kvm_check_extension(kvm_state, KVM_CAP_IRQ_XICS)) { error_setg(errp, "KVM and IRQ_XICS capability must be present for in-kernel XICS"); goto fail; } spapr_rtas_register(RTAS_IBM_SET_XIVE, "ibm,set-xive", rtas_dummy); spapr_rtas_register(RTAS_IBM_GET_XIVE, "ibm,get-xive", rtas_dummy); spapr_rtas_register(RTAS_IBM_INT_OFF, "ibm,int-off", rtas_dummy); spapr_rtas_register(RTAS_IBM_INT_ON, "ibm,int-on", rtas_dummy); rc = kvmppc_define_rtas_kernel_token(RTAS_IBM_SET_XIVE, "ibm,set-xive"); if (rc < 0) { error_setg(errp, "kvmppc_define_rtas_kernel_token: ibm,set-xive"); goto fail; } rc = kvmppc_define_rtas_kernel_token(RTAS_IBM_GET_XIVE, "ibm,get-xive"); if (rc < 0) { error_setg(errp, "kvmppc_define_rtas_kernel_token: ibm,get-xive"); goto fail; } rc = kvmppc_define_rtas_kernel_token(RTAS_IBM_INT_ON, "ibm,int-on"); if (rc < 0) { error_setg(errp, "kvmppc_define_rtas_kernel_token: ibm,int-on"); goto fail; } rc = kvmppc_define_rtas_kernel_token(RTAS_IBM_INT_OFF, "ibm,int-off"); if (rc < 0) { error_setg(errp, "kvmppc_define_rtas_kernel_token: ibm,int-off"); goto fail; } rc = kvm_vm_ioctl(kvm_state, KVM_CREATE_DEVICE, &xics_create_device); if (rc < 0) { error_setg_errno(errp, -rc, "Error on KVM_CREATE_DEVICE for XICS"); goto fail; } icpkvm->kernel_xics_fd = xics_create_device.fd; object_property_set_bool(OBJECT(icp->ics), true, "realized", &error); if (error) { error_propagate(errp, error); goto fail; } assert(icp->nr_servers); for (i = 0; i < icp->nr_servers; i++) { object_property_set_bool(OBJECT(&icp->ss[i]), true, "realized", &error); if (error) { error_propagate(errp, error); goto fail; } } kvm_kernel_irqchip = true; kvm_irqfds_allowed = true; kvm_msi_via_irqfd_allowed = true; kvm_gsi_direct_mapping = true; return; fail: kvmppc_define_rtas_kernel_token(0, "ibm,set-xive"); kvmppc_define_rtas_kernel_token(0, "ibm,get-xive"); kvmppc_define_rtas_kernel_token(0, "ibm,int-on"); kvmppc_define_rtas_kernel_token(0, "ibm,int-off"); }
{ "code": [], "line_no": [] }
static void FUNC_0(DeviceState *VAR_0, Error **VAR_1) { KVMXICSState *icpkvm = KVM_XICS(VAR_0); XICSState *icp = XICS_COMMON(VAR_0); int VAR_2, VAR_3; Error *error = NULL; struct kvm_create_device VAR_4 = { .type = KVM_DEV_TYPE_XICS, .flags = 0, }; if (!kvm_enabled() || !kvm_check_extension(kvm_state, KVM_CAP_IRQ_XICS)) { error_setg(VAR_1, "KVM and IRQ_XICS capability must be present for in-kernel XICS"); goto fail; } spapr_rtas_register(RTAS_IBM_SET_XIVE, "ibm,set-xive", rtas_dummy); spapr_rtas_register(RTAS_IBM_GET_XIVE, "ibm,get-xive", rtas_dummy); spapr_rtas_register(RTAS_IBM_INT_OFF, "ibm,int-off", rtas_dummy); spapr_rtas_register(RTAS_IBM_INT_ON, "ibm,int-on", rtas_dummy); VAR_3 = kvmppc_define_rtas_kernel_token(RTAS_IBM_SET_XIVE, "ibm,set-xive"); if (VAR_3 < 0) { error_setg(VAR_1, "kvmppc_define_rtas_kernel_token: ibm,set-xive"); goto fail; } VAR_3 = kvmppc_define_rtas_kernel_token(RTAS_IBM_GET_XIVE, "ibm,get-xive"); if (VAR_3 < 0) { error_setg(VAR_1, "kvmppc_define_rtas_kernel_token: ibm,get-xive"); goto fail; } VAR_3 = kvmppc_define_rtas_kernel_token(RTAS_IBM_INT_ON, "ibm,int-on"); if (VAR_3 < 0) { error_setg(VAR_1, "kvmppc_define_rtas_kernel_token: ibm,int-on"); goto fail; } VAR_3 = kvmppc_define_rtas_kernel_token(RTAS_IBM_INT_OFF, "ibm,int-off"); if (VAR_3 < 0) { error_setg(VAR_1, "kvmppc_define_rtas_kernel_token: ibm,int-off"); goto fail; } VAR_3 = kvm_vm_ioctl(kvm_state, KVM_CREATE_DEVICE, &VAR_4); if (VAR_3 < 0) { error_setg_errno(VAR_1, -VAR_3, "Error on KVM_CREATE_DEVICE for XICS"); goto fail; } icpkvm->kernel_xics_fd = VAR_4.fd; object_property_set_bool(OBJECT(icp->ics), true, "realized", &error); if (error) { error_propagate(VAR_1, error); goto fail; } assert(icp->nr_servers); for (VAR_2 = 0; VAR_2 < icp->nr_servers; VAR_2++) { object_property_set_bool(OBJECT(&icp->ss[VAR_2]), true, "realized", &error); if (error) { error_propagate(VAR_1, error); goto fail; } } kvm_kernel_irqchip = true; kvm_irqfds_allowed = true; kvm_msi_via_irqfd_allowed = true; kvm_gsi_direct_mapping = true; return; fail: kvmppc_define_rtas_kernel_token(0, "ibm,set-xive"); kvmppc_define_rtas_kernel_token(0, "ibm,get-xive"); kvmppc_define_rtas_kernel_token(0, "ibm,int-on"); kvmppc_define_rtas_kernel_token(0, "ibm,int-off"); }
[ "static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)\n{", "KVMXICSState *icpkvm = KVM_XICS(VAR_0);", "XICSState *icp = XICS_COMMON(VAR_0);", "int VAR_2, VAR_3;", "Error *error = NULL;", "struct kvm_create_device VAR_4 = {", ".type = KVM_DEV_TYPE_XICS,\n.flags = 0,\n};", "if (!kvm_enabled() || !kvm_c...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [...
26,977
static int http_prepare_data(HTTPContext *c, long cur_time) { int i; switch(c->state) { case HTTPSTATE_SEND_DATA_HEADER: memset(&c->fmt_ctx, 0, sizeof(c->fmt_ctx)); pstrcpy(c->fmt_ctx.author, sizeof(c->fmt_ctx.author), c->stream->author); pstrcpy(c->fmt_ctx.comment, sizeof(c->fmt_ctx.comment), c->stream->comment); pstrcpy(c->fmt_ctx.copyright, sizeof(c->fmt_ctx.copyright), c->stream->copyright); pstrcpy(c->fmt_ctx.title, sizeof(c->fmt_ctx.title), c->stream->title); if (c->stream->feed) { /* open output stream by using specified codecs */ c->fmt_ctx.oformat = c->stream->fmt; c->fmt_ctx.nb_streams = c->stream->nb_streams; for(i=0;i<c->fmt_ctx.nb_streams;i++) { AVStream *st; st = av_mallocz(sizeof(AVStream)); c->fmt_ctx.streams[i] = st; if (c->stream->feed == c->stream) memcpy(st, c->stream->streams[i], sizeof(AVStream)); else memcpy(st, c->stream->feed->streams[c->stream->feed_streams[i]], sizeof(AVStream)); st->codec.frame_number = 0; /* XXX: should be done in AVStream, not in codec */ } c->got_key_frame = 0; } else { /* open output stream by using codecs in specified file */ c->fmt_ctx.oformat = c->stream->fmt; c->fmt_ctx.nb_streams = c->fmt_in->nb_streams; for(i=0;i<c->fmt_ctx.nb_streams;i++) { AVStream *st; st = av_mallocz(sizeof(AVStream)); c->fmt_ctx.streams[i] = st; memcpy(st, c->fmt_in->streams[i], sizeof(AVStream)); st->codec.frame_number = 0; /* XXX: should be done in AVStream, not in codec */ } c->got_key_frame = 0; } init_put_byte(&c->fmt_ctx.pb, c->pbuffer, c->pbuffer_size, 1, c, NULL, http_write_packet, NULL); c->fmt_ctx.pb.is_streamed = 1; /* prepare header */ av_write_header(&c->fmt_ctx); c->state = HTTPSTATE_SEND_DATA; c->last_packet_sent = 0; break; case HTTPSTATE_SEND_DATA: /* find a new packet */ #if 0 fifo_total_size = http_fifo_write_count - c->last_http_fifo_write_count; if (fifo_total_size >= ((3 * FIFO_MAX_SIZE) / 4)) { /* overflow : resync. We suppose that wptr is at this point a pointer to a valid packet */ c->rptr = http_fifo.wptr; c->got_key_frame = 0; } start_rptr = c->rptr; if (fifo_read(&http_fifo, (UINT8 *)&hdr, sizeof(hdr), &c->rptr) < 0) return 0; payload_size = ntohs(hdr.payload_size); payload = av_malloc(payload_size); if (fifo_read(&http_fifo, payload, payload_size, &c->rptr) < 0) { /* cannot read all the payload */ av_free(payload); c->rptr = start_rptr; return 0; } c->last_http_fifo_write_count = http_fifo_write_count - fifo_size(&http_fifo, c->rptr); if (c->stream->stream_type != STREAM_TYPE_MASTER) { /* test if the packet can be handled by this format */ ret = 0; for(i=0;i<c->fmt_ctx.nb_streams;i++) { AVStream *st = c->fmt_ctx.streams[i]; if (test_header(&hdr, &st->codec)) { /* only begin sending when got a key frame */ if (st->codec.key_frame) c->got_key_frame |= 1 << i; if (c->got_key_frame & (1 << i)) { ret = c->fmt_ctx.format->write_packet(&c->fmt_ctx, i, payload, payload_size); } break; } } if (ret) { /* must send trailer now */ c->state = HTTPSTATE_SEND_DATA_TRAILER; } } else { /* master case : send everything */ char *q; q = c->buffer; memcpy(q, &hdr, sizeof(hdr)); q += sizeof(hdr); memcpy(q, payload, payload_size); q += payload_size; c->buffer_ptr = c->buffer; c->buffer_end = q; } av_free(payload); #endif { AVPacket pkt; /* read a packet from the input stream */ if (c->stream->feed) { ffm_set_write_index(c->fmt_in, c->stream->feed->feed_write_index, c->stream->feed->feed_size); } if (c->stream->max_time && c->stream->max_time + c->start_time - cur_time < 0) { /* We have timed out */ c->state = HTTPSTATE_SEND_DATA_TRAILER; } else if (av_read_packet(c->fmt_in, &pkt) < 0) { if (c->stream->feed && c->stream->feed->feed_opened) { /* if coming from feed, it means we reached the end of the ffm file, so must wait for more data */ c->state = HTTPSTATE_WAIT_FEED; return 1; /* state changed */ } else { /* must send trailer now because eof or error */ c->state = HTTPSTATE_SEND_DATA_TRAILER; } } else { /* send it to the appropriate stream */ if (c->stream->feed) { /* if coming from a feed, select the right stream */ if (c->switch_pending) { c->switch_pending = 0; for(i=0;i<c->stream->nb_streams;i++) { if (c->switch_feed_streams[i] == pkt.stream_index) { if (pkt.flags & PKT_FLAG_KEY) { do_switch_stream(c, i); } } if (c->switch_feed_streams[i] >= 0) { c->switch_pending = 1; } } } for(i=0;i<c->stream->nb_streams;i++) { if (c->feed_streams[i] == pkt.stream_index) { pkt.stream_index = i; if (pkt.flags & PKT_FLAG_KEY) { c->got_key_frame |= 1 << i; } /* See if we have all the key frames, then * we start to send. This logic is not quite * right, but it works for the case of a * single video stream with one or more * audio streams (for which every frame is * typically a key frame). */ if (!c->stream->send_on_key || ((c->got_key_frame + 1) >> c->stream->nb_streams)) { goto send_it; } } } } else { AVCodecContext *codec; send_it: /* Fudge here */ codec = &c->fmt_ctx.streams[pkt.stream_index]->codec; codec->key_frame = ((pkt.flags & PKT_FLAG_KEY) != 0); #ifdef PJSG if (codec->codec_type == CODEC_TYPE_AUDIO) { codec->frame_size = (codec->sample_rate * pkt.duration + 500000) / 1000000; /* printf("Calculated size %d, from sr %d, duration %d\n", codec->frame_size, codec->sample_rate, pkt.duration); */ } #endif if (av_write_packet(&c->fmt_ctx, &pkt, 0)) c->state = HTTPSTATE_SEND_DATA_TRAILER; codec->frame_number++; } av_free_packet(&pkt); } } break; default: case HTTPSTATE_SEND_DATA_TRAILER: /* last packet test ? */ if (c->last_packet_sent) return -1; /* prepare header */ av_write_trailer(&c->fmt_ctx); c->last_packet_sent = 1; break; } return 0; }
true
FFmpeg
5eb765ef341c3ec1bea31914c897750f88476ede
static int http_prepare_data(HTTPContext *c, long cur_time) { int i; switch(c->state) { case HTTPSTATE_SEND_DATA_HEADER: memset(&c->fmt_ctx, 0, sizeof(c->fmt_ctx)); pstrcpy(c->fmt_ctx.author, sizeof(c->fmt_ctx.author), c->stream->author); pstrcpy(c->fmt_ctx.comment, sizeof(c->fmt_ctx.comment), c->stream->comment); pstrcpy(c->fmt_ctx.copyright, sizeof(c->fmt_ctx.copyright), c->stream->copyright); pstrcpy(c->fmt_ctx.title, sizeof(c->fmt_ctx.title), c->stream->title); if (c->stream->feed) { c->fmt_ctx.oformat = c->stream->fmt; c->fmt_ctx.nb_streams = c->stream->nb_streams; for(i=0;i<c->fmt_ctx.nb_streams;i++) { AVStream *st; st = av_mallocz(sizeof(AVStream)); c->fmt_ctx.streams[i] = st; if (c->stream->feed == c->stream) memcpy(st, c->stream->streams[i], sizeof(AVStream)); else memcpy(st, c->stream->feed->streams[c->stream->feed_streams[i]], sizeof(AVStream)); st->codec.frame_number = 0; } c->got_key_frame = 0; } else { c->fmt_ctx.oformat = c->stream->fmt; c->fmt_ctx.nb_streams = c->fmt_in->nb_streams; for(i=0;i<c->fmt_ctx.nb_streams;i++) { AVStream *st; st = av_mallocz(sizeof(AVStream)); c->fmt_ctx.streams[i] = st; memcpy(st, c->fmt_in->streams[i], sizeof(AVStream)); st->codec.frame_number = 0; } c->got_key_frame = 0; } init_put_byte(&c->fmt_ctx.pb, c->pbuffer, c->pbuffer_size, 1, c, NULL, http_write_packet, NULL); c->fmt_ctx.pb.is_streamed = 1; av_write_header(&c->fmt_ctx); c->state = HTTPSTATE_SEND_DATA; c->last_packet_sent = 0; break; case HTTPSTATE_SEND_DATA: #if 0 fifo_total_size = http_fifo_write_count - c->last_http_fifo_write_count; if (fifo_total_size >= ((3 * FIFO_MAX_SIZE) / 4)) { c->rptr = http_fifo.wptr; c->got_key_frame = 0; } start_rptr = c->rptr; if (fifo_read(&http_fifo, (UINT8 *)&hdr, sizeof(hdr), &c->rptr) < 0) return 0; payload_size = ntohs(hdr.payload_size); payload = av_malloc(payload_size); if (fifo_read(&http_fifo, payload, payload_size, &c->rptr) < 0) { av_free(payload); c->rptr = start_rptr; return 0; } c->last_http_fifo_write_count = http_fifo_write_count - fifo_size(&http_fifo, c->rptr); if (c->stream->stream_type != STREAM_TYPE_MASTER) { ret = 0; for(i=0;i<c->fmt_ctx.nb_streams;i++) { AVStream *st = c->fmt_ctx.streams[i]; if (test_header(&hdr, &st->codec)) { if (st->codec.key_frame) c->got_key_frame |= 1 << i; if (c->got_key_frame & (1 << i)) { ret = c->fmt_ctx.format->write_packet(&c->fmt_ctx, i, payload, payload_size); } break; } } if (ret) { c->state = HTTPSTATE_SEND_DATA_TRAILER; } } else { char *q; q = c->buffer; memcpy(q, &hdr, sizeof(hdr)); q += sizeof(hdr); memcpy(q, payload, payload_size); q += payload_size; c->buffer_ptr = c->buffer; c->buffer_end = q; } av_free(payload); #endif { AVPacket pkt; if (c->stream->feed) { ffm_set_write_index(c->fmt_in, c->stream->feed->feed_write_index, c->stream->feed->feed_size); } if (c->stream->max_time && c->stream->max_time + c->start_time - cur_time < 0) { c->state = HTTPSTATE_SEND_DATA_TRAILER; } else if (av_read_packet(c->fmt_in, &pkt) < 0) { if (c->stream->feed && c->stream->feed->feed_opened) { c->state = HTTPSTATE_WAIT_FEED; return 1; } else { c->state = HTTPSTATE_SEND_DATA_TRAILER; } } else { if (c->stream->feed) { if (c->switch_pending) { c->switch_pending = 0; for(i=0;i<c->stream->nb_streams;i++) { if (c->switch_feed_streams[i] == pkt.stream_index) { if (pkt.flags & PKT_FLAG_KEY) { do_switch_stream(c, i); } } if (c->switch_feed_streams[i] >= 0) { c->switch_pending = 1; } } } for(i=0;i<c->stream->nb_streams;i++) { if (c->feed_streams[i] == pkt.stream_index) { pkt.stream_index = i; if (pkt.flags & PKT_FLAG_KEY) { c->got_key_frame |= 1 << i; } if (!c->stream->send_on_key || ((c->got_key_frame + 1) >> c->stream->nb_streams)) { goto send_it; } } } } else { AVCodecContext *codec; send_it: codec = &c->fmt_ctx.streams[pkt.stream_index]->codec; codec->key_frame = ((pkt.flags & PKT_FLAG_KEY) != 0); #ifdef PJSG if (codec->codec_type == CODEC_TYPE_AUDIO) { codec->frame_size = (codec->sample_rate * pkt.duration + 500000) / 1000000; } #endif if (av_write_packet(&c->fmt_ctx, &pkt, 0)) c->state = HTTPSTATE_SEND_DATA_TRAILER; codec->frame_number++; } av_free_packet(&pkt); } } break; default: case HTTPSTATE_SEND_DATA_TRAILER: if (c->last_packet_sent) return -1; av_write_trailer(&c->fmt_ctx); c->last_packet_sent = 1; break; } return 0; }
{ "code": [ "static int http_prepare_data(HTTPContext *c, long cur_time)" ], "line_no": [ 1 ] }
static int FUNC_0(HTTPContext *VAR_0, long VAR_1) { int VAR_2; switch(VAR_0->state) { case HTTPSTATE_SEND_DATA_HEADER: memset(&VAR_0->fmt_ctx, 0, sizeof(VAR_0->fmt_ctx)); pstrcpy(VAR_0->fmt_ctx.author, sizeof(VAR_0->fmt_ctx.author), VAR_0->stream->author); pstrcpy(VAR_0->fmt_ctx.comment, sizeof(VAR_0->fmt_ctx.comment), VAR_0->stream->comment); pstrcpy(VAR_0->fmt_ctx.copyright, sizeof(VAR_0->fmt_ctx.copyright), VAR_0->stream->copyright); pstrcpy(VAR_0->fmt_ctx.title, sizeof(VAR_0->fmt_ctx.title), VAR_0->stream->title); if (VAR_0->stream->feed) { VAR_0->fmt_ctx.oformat = VAR_0->stream->fmt; VAR_0->fmt_ctx.nb_streams = VAR_0->stream->nb_streams; for(VAR_2=0;VAR_2<VAR_0->fmt_ctx.nb_streams;VAR_2++) { AVStream *st; st = av_mallocz(sizeof(AVStream)); VAR_0->fmt_ctx.streams[VAR_2] = st; if (VAR_0->stream->feed == VAR_0->stream) memcpy(st, VAR_0->stream->streams[VAR_2], sizeof(AVStream)); else memcpy(st, VAR_0->stream->feed->streams[VAR_0->stream->feed_streams[VAR_2]], sizeof(AVStream)); st->codec.frame_number = 0; } VAR_0->got_key_frame = 0; } else { VAR_0->fmt_ctx.oformat = VAR_0->stream->fmt; VAR_0->fmt_ctx.nb_streams = VAR_0->fmt_in->nb_streams; for(VAR_2=0;VAR_2<VAR_0->fmt_ctx.nb_streams;VAR_2++) { AVStream *st; st = av_mallocz(sizeof(AVStream)); VAR_0->fmt_ctx.streams[VAR_2] = st; memcpy(st, VAR_0->fmt_in->streams[VAR_2], sizeof(AVStream)); st->codec.frame_number = 0; } VAR_0->got_key_frame = 0; } init_put_byte(&VAR_0->fmt_ctx.pb, VAR_0->pbuffer, VAR_0->pbuffer_size, 1, VAR_0, NULL, http_write_packet, NULL); VAR_0->fmt_ctx.pb.is_streamed = 1; av_write_header(&VAR_0->fmt_ctx); VAR_0->state = HTTPSTATE_SEND_DATA; VAR_0->last_packet_sent = 0; break; case HTTPSTATE_SEND_DATA: #if 0 fifo_total_size = http_fifo_write_count - VAR_0->last_http_fifo_write_count; if (fifo_total_size >= ((3 * FIFO_MAX_SIZE) / 4)) { VAR_0->rptr = http_fifo.wptr; VAR_0->got_key_frame = 0; } start_rptr = VAR_0->rptr; if (fifo_read(&http_fifo, (UINT8 *)&hdr, sizeof(hdr), &VAR_0->rptr) < 0) return 0; payload_size = ntohs(hdr.payload_size); payload = av_malloc(payload_size); if (fifo_read(&http_fifo, payload, payload_size, &VAR_0->rptr) < 0) { av_free(payload); VAR_0->rptr = start_rptr; return 0; } VAR_0->last_http_fifo_write_count = http_fifo_write_count - fifo_size(&http_fifo, VAR_0->rptr); if (VAR_0->stream->stream_type != STREAM_TYPE_MASTER) { ret = 0; for(VAR_2=0;VAR_2<VAR_0->fmt_ctx.nb_streams;VAR_2++) { AVStream *st = VAR_0->fmt_ctx.streams[VAR_2]; if (test_header(&hdr, &st->codec)) { if (st->codec.key_frame) VAR_0->got_key_frame |= 1 << VAR_2; if (VAR_0->got_key_frame & (1 << VAR_2)) { ret = VAR_0->fmt_ctx.format->write_packet(&VAR_0->fmt_ctx, VAR_2, payload, payload_size); } break; } } if (ret) { VAR_0->state = HTTPSTATE_SEND_DATA_TRAILER; } } else { char *q; q = VAR_0->buffer; memcpy(q, &hdr, sizeof(hdr)); q += sizeof(hdr); memcpy(q, payload, payload_size); q += payload_size; VAR_0->buffer_ptr = VAR_0->buffer; VAR_0->buffer_end = q; } av_free(payload); #endif { AVPacket pkt; if (VAR_0->stream->feed) { ffm_set_write_index(VAR_0->fmt_in, VAR_0->stream->feed->feed_write_index, VAR_0->stream->feed->feed_size); } if (VAR_0->stream->max_time && VAR_0->stream->max_time + VAR_0->start_time - VAR_1 < 0) { VAR_0->state = HTTPSTATE_SEND_DATA_TRAILER; } else if (av_read_packet(VAR_0->fmt_in, &pkt) < 0) { if (VAR_0->stream->feed && VAR_0->stream->feed->feed_opened) { VAR_0->state = HTTPSTATE_WAIT_FEED; return 1; } else { VAR_0->state = HTTPSTATE_SEND_DATA_TRAILER; } } else { if (VAR_0->stream->feed) { if (VAR_0->switch_pending) { VAR_0->switch_pending = 0; for(VAR_2=0;VAR_2<VAR_0->stream->nb_streams;VAR_2++) { if (VAR_0->switch_feed_streams[VAR_2] == pkt.stream_index) { if (pkt.flags & PKT_FLAG_KEY) { do_switch_stream(VAR_0, VAR_2); } } if (VAR_0->switch_feed_streams[VAR_2] >= 0) { VAR_0->switch_pending = 1; } } } for(VAR_2=0;VAR_2<VAR_0->stream->nb_streams;VAR_2++) { if (VAR_0->feed_streams[VAR_2] == pkt.stream_index) { pkt.stream_index = VAR_2; if (pkt.flags & PKT_FLAG_KEY) { VAR_0->got_key_frame |= 1 << VAR_2; } if (!VAR_0->stream->send_on_key || ((VAR_0->got_key_frame + 1) >> VAR_0->stream->nb_streams)) { goto send_it; } } } } else { AVCodecContext *codec; send_it: codec = &VAR_0->fmt_ctx.streams[pkt.stream_index]->codec; codec->key_frame = ((pkt.flags & PKT_FLAG_KEY) != 0); #ifdef PJSG if (codec->codec_type == CODEC_TYPE_AUDIO) { codec->frame_size = (codec->sample_rate * pkt.duration + 500000) / 1000000; } #endif if (av_write_packet(&VAR_0->fmt_ctx, &pkt, 0)) VAR_0->state = HTTPSTATE_SEND_DATA_TRAILER; codec->frame_number++; } av_free_packet(&pkt); } } break; default: case HTTPSTATE_SEND_DATA_TRAILER: if (VAR_0->last_packet_sent) return -1; av_write_trailer(&VAR_0->fmt_ctx); VAR_0->last_packet_sent = 1; break; } return 0; }
[ "static int FUNC_0(HTTPContext *VAR_0, long VAR_1)\n{", "int VAR_2;", "switch(VAR_0->state) {", "case HTTPSTATE_SEND_DATA_HEADER:\nmemset(&VAR_0->fmt_ctx, 0, sizeof(VAR_0->fmt_ctx));", "pstrcpy(VAR_0->fmt_ctx.author, sizeof(VAR_0->fmt_ctx.author), VAR_0->stream->author);", "pstrcpy(VAR_0->fmt_ctx.comment,...
[ 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...
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45, 47 ], [ 51 ], ...
26,978
void net_rx_pkt_dump(struct NetRxPkt *pkt) { #ifdef NET_RX_PKT_DEBUG assert(pkt); printf("RX PKT: tot_len: %d, vlan_stripped: %d, vlan_tag: %d\n", pkt->tot_len, pkt->vlan_stripped, pkt->tci); #endif }
true
qemu
df8bf7a7fe75eb5d5caffa55f5cd4292b757aea6
void net_rx_pkt_dump(struct NetRxPkt *pkt) { #ifdef NET_RX_PKT_DEBUG assert(pkt); printf("RX PKT: tot_len: %d, vlan_stripped: %d, vlan_tag: %d\n", pkt->tot_len, pkt->vlan_stripped, pkt->tci); #endif }
{ "code": [ " printf(\"RX PKT: tot_len: %d, vlan_stripped: %d, vlan_tag: %d\\n\",", " pkt->tot_len, pkt->vlan_stripped, pkt->tci);" ], "line_no": [ 11, 13 ] }
void FUNC_0(struct NetRxPkt *VAR_0) { #ifdef NET_RX_PKT_DEBUG assert(VAR_0); printf("RX PKT: tot_len: %d, vlan_stripped: %d, vlan_tag: %d\n", VAR_0->tot_len, VAR_0->vlan_stripped, VAR_0->tci); #endif }
[ "void FUNC_0(struct NetRxPkt *VAR_0)\n{", "#ifdef NET_RX_PKT_DEBUG\nassert(VAR_0);", "printf(\"RX PKT: tot_len: %d, vlan_stripped: %d, vlan_tag: %d\\n\",\nVAR_0->tot_len, VAR_0->vlan_stripped, VAR_0->tci);", "#endif\n}" ]
[ 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 11, 13 ], [ 15, 17 ] ]
26,979
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *pkt) { BinkContext * const c = avctx->priv_data; GetBitContext gb; int blk; int i, j, plane, plane_idx, bx, by; uint8_t *dst, *prev, *ref, *ref_start, *ref_end; int v, col[2]; const uint8_t *scan; int xoff, yoff; DECLARE_ALIGNED_16(DCTELEM, block[64]); DECLARE_ALIGNED_16(uint8_t, ublock[64]); int coordmap[64]; if(c->pic.data[0]) avctx->release_buffer(avctx, &c->pic); if(avctx->get_buffer(avctx, &c->pic) < 0){ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } init_get_bits(&gb, pkt->data, pkt->size*8); if (c->version >= 'i') skip_bits_long(&gb, 32); for (plane = 0; plane < 3; plane++) { const int stride = c->pic.linesize[plane]; int bw = plane ? (avctx->width + 15) >> 4 : (avctx->width + 7) >> 3; int bh = plane ? (avctx->height + 15) >> 4 : (avctx->height + 7) >> 3; int width = avctx->width >> !!plane; init_lengths(c, FFMAX(width, 8), bw); for (i = 0; i < BINK_NB_SRC; i++) read_bundle(&gb, c, i); plane_idx = (!plane || !c->swap_planes) ? plane : (plane ^ 3); ref_start = c->last.data[plane_idx]; ref_end = c->last.data[plane_idx] + (bw - 1 + c->last.linesize[plane_idx] * (bh - 1)) * 8; for (i = 0; i < 64; i++) coordmap[i] = (i & 7) + (i >> 3) * stride; for (by = 0; by < bh; by++) { if (read_block_types(avctx, &gb, &c->bundle[BINK_SRC_BLOCK_TYPES]) < 0) return -1; if (read_block_types(avctx, &gb, &c->bundle[BINK_SRC_SUB_BLOCK_TYPES]) < 0) return -1; if (read_colors(&gb, &c->bundle[BINK_SRC_COLORS], c) < 0) return -1; if (read_patterns(avctx, &gb, &c->bundle[BINK_SRC_PATTERN]) < 0) return -1; if (read_motion_values(avctx, &gb, &c->bundle[BINK_SRC_X_OFF]) < 0) return -1; if (read_motion_values(avctx, &gb, &c->bundle[BINK_SRC_Y_OFF]) < 0) return -1; if (read_dcs(avctx, &gb, &c->bundle[BINK_SRC_INTRA_DC], DC_START_BITS, 0) < 0) return -1; if (read_dcs(avctx, &gb, &c->bundle[BINK_SRC_INTER_DC], DC_START_BITS, 1) < 0) return -1; if (read_runs(avctx, &gb, &c->bundle[BINK_SRC_RUN]) < 0) return -1; if (by == bh) break; dst = c->pic.data[plane_idx] + 8*by*stride; prev = c->last.data[plane_idx] + 8*by*stride; for (bx = 0; bx < bw; bx++, dst += 8, prev += 8) { blk = get_value(c, BINK_SRC_BLOCK_TYPES); // 16x16 block type on odd line means part of the already decoded block, so skip it if ((by & 1) && blk == SCALED_BLOCK) { bx++; dst += 8; prev += 8; continue; } switch (blk) { case SKIP_BLOCK: c->dsp.put_pixels_tab[1][0](dst, prev, stride, 8); break; case SCALED_BLOCK: blk = get_value(c, BINK_SRC_SUB_BLOCK_TYPES); switch (blk) { case RUN_BLOCK: scan = bink_patterns[get_bits(&gb, 4)]; i = 0; do { int run = get_value(c, BINK_SRC_RUN) + 1; i += run; if (i > 64) { av_log(avctx, AV_LOG_ERROR, "Run went out of bounds\n"); return -1; } if (get_bits1(&gb)) { v = get_value(c, BINK_SRC_COLORS); for (j = 0; j < run; j++) ublock[*scan++] = v; } else { for (j = 0; j < run; j++) ublock[*scan++] = get_value(c, BINK_SRC_COLORS); } } while (i < 63); if (i == 63) ublock[*scan++] = get_value(c, BINK_SRC_COLORS); break; case INTRA_BLOCK: c->dsp.clear_block(block); block[0] = get_value(c, BINK_SRC_INTRA_DC); read_dct_coeffs(&gb, block, c->scantable.permutated, 1); c->dsp.idct(block); c->dsp.put_pixels_nonclamped(block, ublock, 8); break; case FILL_BLOCK: v = get_value(c, BINK_SRC_COLORS); c->dsp.fill_block_tab[0](dst, v, stride, 16); break; case PATTERN_BLOCK: for (i = 0; i < 2; i++) col[i] = get_value(c, BINK_SRC_COLORS); for (j = 0; j < 8; j++) { v = get_value(c, BINK_SRC_PATTERN); for (i = 0; i < 8; i++, v >>= 1) ublock[i + j*8] = col[v & 1]; } break; case RAW_BLOCK: for (j = 0; j < 8; j++) for (i = 0; i < 8; i++) ublock[i + j*8] = get_value(c, BINK_SRC_COLORS); break; default: av_log(avctx, AV_LOG_ERROR, "Incorrect 16x16 block type %d\n", blk); return -1; } if (blk != FILL_BLOCK) c->dsp.scale_block(ublock, dst, stride); bx++; dst += 8; prev += 8; break; case MOTION_BLOCK: xoff = get_value(c, BINK_SRC_X_OFF); yoff = get_value(c, BINK_SRC_Y_OFF); ref = prev + xoff + yoff * stride; if (ref < ref_start || ref > ref_end) { av_log(avctx, AV_LOG_ERROR, "Copy out of bounds @%d, %d\n", bx*8 + xoff, by*8 + yoff); return -1; } c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8); break; case RUN_BLOCK: scan = bink_patterns[get_bits(&gb, 4)]; i = 0; do { int run = get_value(c, BINK_SRC_RUN) + 1; i += run; if (i > 64) { av_log(avctx, AV_LOG_ERROR, "Run went out of bounds\n"); return -1; } if (get_bits1(&gb)) { v = get_value(c, BINK_SRC_COLORS); for (j = 0; j < run; j++) dst[coordmap[*scan++]] = v; } else { for (j = 0; j < run; j++) dst[coordmap[*scan++]] = get_value(c, BINK_SRC_COLORS); } } while (i < 63); if (i == 63) dst[coordmap[*scan++]] = get_value(c, BINK_SRC_COLORS); break; case RESIDUE_BLOCK: xoff = get_value(c, BINK_SRC_X_OFF); yoff = get_value(c, BINK_SRC_Y_OFF); ref = prev + xoff + yoff * stride; if (ref < ref_start || ref > ref_end) { av_log(avctx, AV_LOG_ERROR, "Copy out of bounds @%d, %d\n", bx*8 + xoff, by*8 + yoff); return -1; } c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8); c->dsp.clear_block(block); v = get_bits(&gb, 7); read_residue(&gb, block, v); c->dsp.add_pixels8(dst, block, stride); break; case INTRA_BLOCK: c->dsp.clear_block(block); block[0] = get_value(c, BINK_SRC_INTRA_DC); read_dct_coeffs(&gb, block, c->scantable.permutated, 1); c->dsp.idct_put(dst, stride, block); break; case FILL_BLOCK: v = get_value(c, BINK_SRC_COLORS); c->dsp.fill_block_tab[1](dst, v, stride, 8); break; case INTER_BLOCK: xoff = get_value(c, BINK_SRC_X_OFF); yoff = get_value(c, BINK_SRC_Y_OFF); ref = prev + xoff + yoff * stride; c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8); c->dsp.clear_block(block); block[0] = get_value(c, BINK_SRC_INTER_DC); read_dct_coeffs(&gb, block, c->scantable.permutated, 0); c->dsp.idct_add(dst, stride, block); break; case PATTERN_BLOCK: for (i = 0; i < 2; i++) col[i] = get_value(c, BINK_SRC_COLORS); for (i = 0; i < 8; i++) { v = get_value(c, BINK_SRC_PATTERN); for (j = 0; j < 8; j++, v >>= 1) dst[i*stride + j] = col[v & 1]; } break; case RAW_BLOCK: for (i = 0; i < 8; i++) memcpy(dst + i*stride, c->bundle[BINK_SRC_COLORS].cur_ptr + i*8, 8); c->bundle[BINK_SRC_COLORS].cur_ptr += 64; break; default: av_log(avctx, AV_LOG_ERROR, "Unknown block type %d\n", blk); return -1; } } } if (get_bits_count(&gb) & 0x1F) //next plane data starts at 32-bit boundary skip_bits_long(&gb, 32 - (get_bits_count(&gb) & 0x1F)); } emms_c(); *data_size = sizeof(AVFrame); *(AVFrame*)data = c->pic; FFSWAP(AVFrame, c->pic, c->last); /* always report that the buffer was completely consumed */ return pkt->size; }
true
FFmpeg
bb29fee3a6a289f6b191177098ddce3720d8c417
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *pkt) { BinkContext * const c = avctx->priv_data; GetBitContext gb; int blk; int i, j, plane, plane_idx, bx, by; uint8_t *dst, *prev, *ref, *ref_start, *ref_end; int v, col[2]; const uint8_t *scan; int xoff, yoff; DECLARE_ALIGNED_16(DCTELEM, block[64]); DECLARE_ALIGNED_16(uint8_t, ublock[64]); int coordmap[64]; if(c->pic.data[0]) avctx->release_buffer(avctx, &c->pic); if(avctx->get_buffer(avctx, &c->pic) < 0){ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } init_get_bits(&gb, pkt->data, pkt->size*8); if (c->version >= 'i') skip_bits_long(&gb, 32); for (plane = 0; plane < 3; plane++) { const int stride = c->pic.linesize[plane]; int bw = plane ? (avctx->width + 15) >> 4 : (avctx->width + 7) >> 3; int bh = plane ? (avctx->height + 15) >> 4 : (avctx->height + 7) >> 3; int width = avctx->width >> !!plane; init_lengths(c, FFMAX(width, 8), bw); for (i = 0; i < BINK_NB_SRC; i++) read_bundle(&gb, c, i); plane_idx = (!plane || !c->swap_planes) ? plane : (plane ^ 3); ref_start = c->last.data[plane_idx]; ref_end = c->last.data[plane_idx] + (bw - 1 + c->last.linesize[plane_idx] * (bh - 1)) * 8; for (i = 0; i < 64; i++) coordmap[i] = (i & 7) + (i >> 3) * stride; for (by = 0; by < bh; by++) { if (read_block_types(avctx, &gb, &c->bundle[BINK_SRC_BLOCK_TYPES]) < 0) return -1; if (read_block_types(avctx, &gb, &c->bundle[BINK_SRC_SUB_BLOCK_TYPES]) < 0) return -1; if (read_colors(&gb, &c->bundle[BINK_SRC_COLORS], c) < 0) return -1; if (read_patterns(avctx, &gb, &c->bundle[BINK_SRC_PATTERN]) < 0) return -1; if (read_motion_values(avctx, &gb, &c->bundle[BINK_SRC_X_OFF]) < 0) return -1; if (read_motion_values(avctx, &gb, &c->bundle[BINK_SRC_Y_OFF]) < 0) return -1; if (read_dcs(avctx, &gb, &c->bundle[BINK_SRC_INTRA_DC], DC_START_BITS, 0) < 0) return -1; if (read_dcs(avctx, &gb, &c->bundle[BINK_SRC_INTER_DC], DC_START_BITS, 1) < 0) return -1; if (read_runs(avctx, &gb, &c->bundle[BINK_SRC_RUN]) < 0) return -1; if (by == bh) break; dst = c->pic.data[plane_idx] + 8*by*stride; prev = c->last.data[plane_idx] + 8*by*stride; for (bx = 0; bx < bw; bx++, dst += 8, prev += 8) { blk = get_value(c, BINK_SRC_BLOCK_TYPES); if ((by & 1) && blk == SCALED_BLOCK) { bx++; dst += 8; prev += 8; continue; } switch (blk) { case SKIP_BLOCK: c->dsp.put_pixels_tab[1][0](dst, prev, stride, 8); break; case SCALED_BLOCK: blk = get_value(c, BINK_SRC_SUB_BLOCK_TYPES); switch (blk) { case RUN_BLOCK: scan = bink_patterns[get_bits(&gb, 4)]; i = 0; do { int run = get_value(c, BINK_SRC_RUN) + 1; i += run; if (i > 64) { av_log(avctx, AV_LOG_ERROR, "Run went out of bounds\n"); return -1; } if (get_bits1(&gb)) { v = get_value(c, BINK_SRC_COLORS); for (j = 0; j < run; j++) ublock[*scan++] = v; } else { for (j = 0; j < run; j++) ublock[*scan++] = get_value(c, BINK_SRC_COLORS); } } while (i < 63); if (i == 63) ublock[*scan++] = get_value(c, BINK_SRC_COLORS); break; case INTRA_BLOCK: c->dsp.clear_block(block); block[0] = get_value(c, BINK_SRC_INTRA_DC); read_dct_coeffs(&gb, block, c->scantable.permutated, 1); c->dsp.idct(block); c->dsp.put_pixels_nonclamped(block, ublock, 8); break; case FILL_BLOCK: v = get_value(c, BINK_SRC_COLORS); c->dsp.fill_block_tab[0](dst, v, stride, 16); break; case PATTERN_BLOCK: for (i = 0; i < 2; i++) col[i] = get_value(c, BINK_SRC_COLORS); for (j = 0; j < 8; j++) { v = get_value(c, BINK_SRC_PATTERN); for (i = 0; i < 8; i++, v >>= 1) ublock[i + j*8] = col[v & 1]; } break; case RAW_BLOCK: for (j = 0; j < 8; j++) for (i = 0; i < 8; i++) ublock[i + j*8] = get_value(c, BINK_SRC_COLORS); break; default: av_log(avctx, AV_LOG_ERROR, "Incorrect 16x16 block type %d\n", blk); return -1; } if (blk != FILL_BLOCK) c->dsp.scale_block(ublock, dst, stride); bx++; dst += 8; prev += 8; break; case MOTION_BLOCK: xoff = get_value(c, BINK_SRC_X_OFF); yoff = get_value(c, BINK_SRC_Y_OFF); ref = prev + xoff + yoff * stride; if (ref < ref_start || ref > ref_end) { av_log(avctx, AV_LOG_ERROR, "Copy out of bounds @%d, %d\n", bx*8 + xoff, by*8 + yoff); return -1; } c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8); break; case RUN_BLOCK: scan = bink_patterns[get_bits(&gb, 4)]; i = 0; do { int run = get_value(c, BINK_SRC_RUN) + 1; i += run; if (i > 64) { av_log(avctx, AV_LOG_ERROR, "Run went out of bounds\n"); return -1; } if (get_bits1(&gb)) { v = get_value(c, BINK_SRC_COLORS); for (j = 0; j < run; j++) dst[coordmap[*scan++]] = v; } else { for (j = 0; j < run; j++) dst[coordmap[*scan++]] = get_value(c, BINK_SRC_COLORS); } } while (i < 63); if (i == 63) dst[coordmap[*scan++]] = get_value(c, BINK_SRC_COLORS); break; case RESIDUE_BLOCK: xoff = get_value(c, BINK_SRC_X_OFF); yoff = get_value(c, BINK_SRC_Y_OFF); ref = prev + xoff + yoff * stride; if (ref < ref_start || ref > ref_end) { av_log(avctx, AV_LOG_ERROR, "Copy out of bounds @%d, %d\n", bx*8 + xoff, by*8 + yoff); return -1; } c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8); c->dsp.clear_block(block); v = get_bits(&gb, 7); read_residue(&gb, block, v); c->dsp.add_pixels8(dst, block, stride); break; case INTRA_BLOCK: c->dsp.clear_block(block); block[0] = get_value(c, BINK_SRC_INTRA_DC); read_dct_coeffs(&gb, block, c->scantable.permutated, 1); c->dsp.idct_put(dst, stride, block); break; case FILL_BLOCK: v = get_value(c, BINK_SRC_COLORS); c->dsp.fill_block_tab[1](dst, v, stride, 8); break; case INTER_BLOCK: xoff = get_value(c, BINK_SRC_X_OFF); yoff = get_value(c, BINK_SRC_Y_OFF); ref = prev + xoff + yoff * stride; c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8); c->dsp.clear_block(block); block[0] = get_value(c, BINK_SRC_INTER_DC); read_dct_coeffs(&gb, block, c->scantable.permutated, 0); c->dsp.idct_add(dst, stride, block); break; case PATTERN_BLOCK: for (i = 0; i < 2; i++) col[i] = get_value(c, BINK_SRC_COLORS); for (i = 0; i < 8; i++) { v = get_value(c, BINK_SRC_PATTERN); for (j = 0; j < 8; j++, v >>= 1) dst[i*stride + j] = col[v & 1]; } break; case RAW_BLOCK: for (i = 0; i < 8; i++) memcpy(dst + i*stride, c->bundle[BINK_SRC_COLORS].cur_ptr + i*8, 8); c->bundle[BINK_SRC_COLORS].cur_ptr += 64; break; default: av_log(avctx, AV_LOG_ERROR, "Unknown block type %d\n", blk); return -1; } } } if (get_bits_count(&gb) & 0x1F) skip_bits_long(&gb, 32 - (get_bits_count(&gb) & 0x1F)); } emms_c(); *data_size = sizeof(AVFrame); *(AVFrame*)data = c->pic; FFSWAP(AVFrame, c->pic, c->last); return pkt->size; }
{ "code": [ " init_get_bits(&gb, pkt->data, pkt->size*8);" ], "line_no": [ 45 ] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { BinkContext * const c = VAR_0->priv_data; GetBitContext gb; int VAR_4; int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10; uint8_t *dst, *prev, *ref, *ref_start, *ref_end; int VAR_11, VAR_12[2]; const uint8_t *VAR_13; int VAR_14, VAR_15; DECLARE_ALIGNED_16(DCTELEM, block[64]); DECLARE_ALIGNED_16(uint8_t, ublock[64]); int VAR_16[64]; if(c->pic.VAR_1[0]) VAR_0->release_buffer(VAR_0, &c->pic); if(VAR_0->get_buffer(VAR_0, &c->pic) < 0){ av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } init_get_bits(&gb, VAR_3->VAR_1, VAR_3->size*8); if (c->version >= 'VAR_5') skip_bits_long(&gb, 32); for (VAR_7 = 0; VAR_7 < 3; VAR_7++) { const int VAR_17 = c->pic.linesize[VAR_7]; int VAR_18 = VAR_7 ? (VAR_0->VAR_20 + 15) >> 4 : (VAR_0->VAR_20 + 7) >> 3; int VAR_19 = VAR_7 ? (VAR_0->height + 15) >> 4 : (VAR_0->height + 7) >> 3; int VAR_20 = VAR_0->VAR_20 >> !!VAR_7; init_lengths(c, FFMAX(VAR_20, 8), VAR_18); for (VAR_5 = 0; VAR_5 < BINK_NB_SRC; VAR_5++) read_bundle(&gb, c, VAR_5); VAR_8 = (!VAR_7 || !c->swap_planes) ? VAR_7 : (VAR_7 ^ 3); ref_start = c->last.VAR_1[VAR_8]; ref_end = c->last.VAR_1[VAR_8] + (VAR_18 - 1 + c->last.linesize[VAR_8] * (VAR_19 - 1)) * 8; for (VAR_5 = 0; VAR_5 < 64; VAR_5++) VAR_16[VAR_5] = (VAR_5 & 7) + (VAR_5 >> 3) * VAR_17; for (VAR_10 = 0; VAR_10 < VAR_19; VAR_10++) { if (read_block_types(VAR_0, &gb, &c->bundle[BINK_SRC_BLOCK_TYPES]) < 0) return -1; if (read_block_types(VAR_0, &gb, &c->bundle[BINK_SRC_SUB_BLOCK_TYPES]) < 0) return -1; if (read_colors(&gb, &c->bundle[BINK_SRC_COLORS], c) < 0) return -1; if (read_patterns(VAR_0, &gb, &c->bundle[BINK_SRC_PATTERN]) < 0) return -1; if (read_motion_values(VAR_0, &gb, &c->bundle[BINK_SRC_X_OFF]) < 0) return -1; if (read_motion_values(VAR_0, &gb, &c->bundle[BINK_SRC_Y_OFF]) < 0) return -1; if (read_dcs(VAR_0, &gb, &c->bundle[BINK_SRC_INTRA_DC], DC_START_BITS, 0) < 0) return -1; if (read_dcs(VAR_0, &gb, &c->bundle[BINK_SRC_INTER_DC], DC_START_BITS, 1) < 0) return -1; if (read_runs(VAR_0, &gb, &c->bundle[BINK_SRC_RUN]) < 0) return -1; if (VAR_10 == VAR_19) break; dst = c->pic.VAR_1[VAR_8] + 8*VAR_10*VAR_17; prev = c->last.VAR_1[VAR_8] + 8*VAR_10*VAR_17; for (VAR_9 = 0; VAR_9 < VAR_18; VAR_9++, dst += 8, prev += 8) { VAR_4 = get_value(c, BINK_SRC_BLOCK_TYPES); if ((VAR_10 & 1) && VAR_4 == SCALED_BLOCK) { VAR_9++; dst += 8; prev += 8; continue; } switch (VAR_4) { case SKIP_BLOCK: c->dsp.put_pixels_tab[1][0](dst, prev, VAR_17, 8); break; case SCALED_BLOCK: VAR_4 = get_value(c, BINK_SRC_SUB_BLOCK_TYPES); switch (VAR_4) { case RUN_BLOCK: VAR_13 = bink_patterns[get_bits(&gb, 4)]; VAR_5 = 0; do { int VAR_22 = get_value(c, BINK_SRC_RUN) + 1; VAR_5 += VAR_22; if (VAR_5 > 64) { av_log(VAR_0, AV_LOG_ERROR, "Run went out of bounds\n"); return -1; } if (get_bits1(&gb)) { VAR_11 = get_value(c, BINK_SRC_COLORS); for (VAR_6 = 0; VAR_6 < VAR_22; VAR_6++) ublock[*VAR_13++] = VAR_11; } else { for (VAR_6 = 0; VAR_6 < VAR_22; VAR_6++) ublock[*VAR_13++] = get_value(c, BINK_SRC_COLORS); } } while (VAR_5 < 63); if (VAR_5 == 63) ublock[*VAR_13++] = get_value(c, BINK_SRC_COLORS); break; case INTRA_BLOCK: c->dsp.clear_block(block); block[0] = get_value(c, BINK_SRC_INTRA_DC); read_dct_coeffs(&gb, block, c->scantable.permutated, 1); c->dsp.idct(block); c->dsp.put_pixels_nonclamped(block, ublock, 8); break; case FILL_BLOCK: VAR_11 = get_value(c, BINK_SRC_COLORS); c->dsp.fill_block_tab[0](dst, VAR_11, VAR_17, 16); break; case PATTERN_BLOCK: for (VAR_5 = 0; VAR_5 < 2; VAR_5++) VAR_12[VAR_5] = get_value(c, BINK_SRC_COLORS); for (VAR_6 = 0; VAR_6 < 8; VAR_6++) { VAR_11 = get_value(c, BINK_SRC_PATTERN); for (VAR_5 = 0; VAR_5 < 8; VAR_5++, VAR_11 >>= 1) ublock[VAR_5 + VAR_6*8] = VAR_12[VAR_11 & 1]; } break; case RAW_BLOCK: for (VAR_6 = 0; VAR_6 < 8; VAR_6++) for (VAR_5 = 0; VAR_5 < 8; VAR_5++) ublock[VAR_5 + VAR_6*8] = get_value(c, BINK_SRC_COLORS); break; default: av_log(VAR_0, AV_LOG_ERROR, "Incorrect 16x16 block type %d\n", VAR_4); return -1; } if (VAR_4 != FILL_BLOCK) c->dsp.scale_block(ublock, dst, VAR_17); VAR_9++; dst += 8; prev += 8; break; case MOTION_BLOCK: VAR_14 = get_value(c, BINK_SRC_X_OFF); VAR_15 = get_value(c, BINK_SRC_Y_OFF); ref = prev + VAR_14 + VAR_15 * VAR_17; if (ref < ref_start || ref > ref_end) { av_log(VAR_0, AV_LOG_ERROR, "Copy out of bounds @%d, %d\n", VAR_9*8 + VAR_14, VAR_10*8 + VAR_15); return -1; } c->dsp.put_pixels_tab[1][0](dst, ref, VAR_17, 8); break; case RUN_BLOCK: VAR_13 = bink_patterns[get_bits(&gb, 4)]; VAR_5 = 0; do { int VAR_22 = get_value(c, BINK_SRC_RUN) + 1; VAR_5 += VAR_22; if (VAR_5 > 64) { av_log(VAR_0, AV_LOG_ERROR, "Run went out of bounds\n"); return -1; } if (get_bits1(&gb)) { VAR_11 = get_value(c, BINK_SRC_COLORS); for (VAR_6 = 0; VAR_6 < VAR_22; VAR_6++) dst[VAR_16[*VAR_13++]] = VAR_11; } else { for (VAR_6 = 0; VAR_6 < VAR_22; VAR_6++) dst[VAR_16[*VAR_13++]] = get_value(c, BINK_SRC_COLORS); } } while (VAR_5 < 63); if (VAR_5 == 63) dst[VAR_16[*VAR_13++]] = get_value(c, BINK_SRC_COLORS); break; case RESIDUE_BLOCK: VAR_14 = get_value(c, BINK_SRC_X_OFF); VAR_15 = get_value(c, BINK_SRC_Y_OFF); ref = prev + VAR_14 + VAR_15 * VAR_17; if (ref < ref_start || ref > ref_end) { av_log(VAR_0, AV_LOG_ERROR, "Copy out of bounds @%d, %d\n", VAR_9*8 + VAR_14, VAR_10*8 + VAR_15); return -1; } c->dsp.put_pixels_tab[1][0](dst, ref, VAR_17, 8); c->dsp.clear_block(block); VAR_11 = get_bits(&gb, 7); read_residue(&gb, block, VAR_11); c->dsp.add_pixels8(dst, block, VAR_17); break; case INTRA_BLOCK: c->dsp.clear_block(block); block[0] = get_value(c, BINK_SRC_INTRA_DC); read_dct_coeffs(&gb, block, c->scantable.permutated, 1); c->dsp.idct_put(dst, VAR_17, block); break; case FILL_BLOCK: VAR_11 = get_value(c, BINK_SRC_COLORS); c->dsp.fill_block_tab[1](dst, VAR_11, VAR_17, 8); break; case INTER_BLOCK: VAR_14 = get_value(c, BINK_SRC_X_OFF); VAR_15 = get_value(c, BINK_SRC_Y_OFF); ref = prev + VAR_14 + VAR_15 * VAR_17; c->dsp.put_pixels_tab[1][0](dst, ref, VAR_17, 8); c->dsp.clear_block(block); block[0] = get_value(c, BINK_SRC_INTER_DC); read_dct_coeffs(&gb, block, c->scantable.permutated, 0); c->dsp.idct_add(dst, VAR_17, block); break; case PATTERN_BLOCK: for (VAR_5 = 0; VAR_5 < 2; VAR_5++) VAR_12[VAR_5] = get_value(c, BINK_SRC_COLORS); for (VAR_5 = 0; VAR_5 < 8; VAR_5++) { VAR_11 = get_value(c, BINK_SRC_PATTERN); for (VAR_6 = 0; VAR_6 < 8; VAR_6++, VAR_11 >>= 1) dst[VAR_5*VAR_17 + VAR_6] = VAR_12[VAR_11 & 1]; } break; case RAW_BLOCK: for (VAR_5 = 0; VAR_5 < 8; VAR_5++) memcpy(dst + VAR_5*VAR_17, c->bundle[BINK_SRC_COLORS].cur_ptr + VAR_5*8, 8); c->bundle[BINK_SRC_COLORS].cur_ptr += 64; break; default: av_log(VAR_0, AV_LOG_ERROR, "Unknown block type %d\n", VAR_4); return -1; } } } if (get_bits_count(&gb) & 0x1F) skip_bits_long(&gb, 32 - (get_bits_count(&gb) & 0x1F)); } emms_c(); *VAR_2 = sizeof(AVFrame); *(AVFrame*)VAR_1 = c->pic; FFSWAP(AVFrame, c->pic, c->last); return VAR_3->size; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3)\n{", "BinkContext * const c = VAR_0->priv_data;", "GetBitContext gb;", "int VAR_4;", "int VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;", "uint8_t *dst, *prev, *ref, *ref_start, *ref_end;", "int VAR_11, VAR_12[2];", "cons...
[ 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...
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29, 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47, 49 ...
26,980
static void gen_msa_elm_df(CPUMIPSState *env, DisasContext *ctx, uint32_t df, uint32_t n) { #define MASK_MSA_ELM(op) (MASK_MSA_MINOR(op) | (op & (0xf << 22))) uint8_t ws = (ctx->opcode >> 11) & 0x1f; uint8_t wd = (ctx->opcode >> 6) & 0x1f; TCGv_i32 tws = tcg_const_i32(ws); TCGv_i32 twd = tcg_const_i32(wd); TCGv_i32 tn = tcg_const_i32(n); TCGv_i32 tdf = tcg_const_i32(df); switch (MASK_MSA_ELM(ctx->opcode)) { case OPC_SLDI_df: gen_helper_msa_sldi_df(cpu_env, tdf, twd, tws, tn); break; case OPC_SPLATI_df: gen_helper_msa_splati_df(cpu_env, tdf, twd, tws, tn); break; case OPC_INSVE_df: gen_helper_msa_insve_df(cpu_env, tdf, twd, tws, tn); break; case OPC_COPY_S_df: case OPC_COPY_U_df: case OPC_INSERT_df: #if !defined(TARGET_MIPS64) /* Double format valid only for MIPS64 */ if (df == DF_DOUBLE) { generate_exception_end(ctx, EXCP_RI); break; } #endif switch (MASK_MSA_ELM(ctx->opcode)) { case OPC_COPY_S_df: gen_helper_msa_copy_s_df(cpu_env, tdf, twd, tws, tn); break; case OPC_COPY_U_df: gen_helper_msa_copy_u_df(cpu_env, tdf, twd, tws, tn); break; case OPC_INSERT_df: gen_helper_msa_insert_df(cpu_env, tdf, twd, tws, tn); break; } break; default: MIPS_INVAL("MSA instruction"); generate_exception_end(ctx, EXCP_RI); } tcg_temp_free_i32(twd); tcg_temp_free_i32(tws); tcg_temp_free_i32(tn); tcg_temp_free_i32(tdf); }
true
qemu
cab4888136a92250fdd401402622824994f7ce0b
static void gen_msa_elm_df(CPUMIPSState *env, DisasContext *ctx, uint32_t df, uint32_t n) { #define MASK_MSA_ELM(op) (MASK_MSA_MINOR(op) | (op & (0xf << 22))) uint8_t ws = (ctx->opcode >> 11) & 0x1f; uint8_t wd = (ctx->opcode >> 6) & 0x1f; TCGv_i32 tws = tcg_const_i32(ws); TCGv_i32 twd = tcg_const_i32(wd); TCGv_i32 tn = tcg_const_i32(n); TCGv_i32 tdf = tcg_const_i32(df); switch (MASK_MSA_ELM(ctx->opcode)) { case OPC_SLDI_df: gen_helper_msa_sldi_df(cpu_env, tdf, twd, tws, tn); break; case OPC_SPLATI_df: gen_helper_msa_splati_df(cpu_env, tdf, twd, tws, tn); break; case OPC_INSVE_df: gen_helper_msa_insve_df(cpu_env, tdf, twd, tws, tn); break; case OPC_COPY_S_df: case OPC_COPY_U_df: case OPC_INSERT_df: #if !defined(TARGET_MIPS64) if (df == DF_DOUBLE) { generate_exception_end(ctx, EXCP_RI); break; } #endif switch (MASK_MSA_ELM(ctx->opcode)) { case OPC_COPY_S_df: gen_helper_msa_copy_s_df(cpu_env, tdf, twd, tws, tn); break; case OPC_COPY_U_df: gen_helper_msa_copy_u_df(cpu_env, tdf, twd, tws, tn); break; case OPC_INSERT_df: gen_helper_msa_insert_df(cpu_env, tdf, twd, tws, tn); break; } break; default: MIPS_INVAL("MSA instruction"); generate_exception_end(ctx, EXCP_RI); } tcg_temp_free_i32(twd); tcg_temp_free_i32(tws); tcg_temp_free_i32(tn); tcg_temp_free_i32(tdf); }
{ "code": [ " gen_helper_msa_copy_s_df(cpu_env, tdf, twd, tws, tn);", " gen_helper_msa_copy_u_df(cpu_env, tdf, twd, tws, tn);" ], "line_no": [ 69, 75 ] }
static void FUNC_0(CPUMIPSState *VAR_0, DisasContext *VAR_1, uint32_t VAR_2, uint32_t VAR_3) { #define MASK_MSA_ELM(op) (MASK_MSA_MINOR(op) | (op & (0xf << 22))) uint8_t ws = (VAR_1->opcode >> 11) & 0x1f; uint8_t wd = (VAR_1->opcode >> 6) & 0x1f; TCGv_i32 tws = tcg_const_i32(ws); TCGv_i32 twd = tcg_const_i32(wd); TCGv_i32 tn = tcg_const_i32(VAR_3); TCGv_i32 tdf = tcg_const_i32(VAR_2); switch (MASK_MSA_ELM(VAR_1->opcode)) { case OPC_SLDI_df: gen_helper_msa_sldi_df(cpu_env, tdf, twd, tws, tn); break; case OPC_SPLATI_df: gen_helper_msa_splati_df(cpu_env, tdf, twd, tws, tn); break; case OPC_INSVE_df: gen_helper_msa_insve_df(cpu_env, tdf, twd, tws, tn); break; case OPC_COPY_S_df: case OPC_COPY_U_df: case OPC_INSERT_df: #if !defined(TARGET_MIPS64) if (VAR_2 == DF_DOUBLE) { generate_exception_end(VAR_1, EXCP_RI); break; } #endif switch (MASK_MSA_ELM(VAR_1->opcode)) { case OPC_COPY_S_df: gen_helper_msa_copy_s_df(cpu_env, tdf, twd, tws, tn); break; case OPC_COPY_U_df: gen_helper_msa_copy_u_df(cpu_env, tdf, twd, tws, tn); break; case OPC_INSERT_df: gen_helper_msa_insert_df(cpu_env, tdf, twd, tws, tn); break; } break; default: MIPS_INVAL("MSA instruction"); generate_exception_end(VAR_1, EXCP_RI); } tcg_temp_free_i32(twd); tcg_temp_free_i32(tws); tcg_temp_free_i32(tn); tcg_temp_free_i32(tdf); }
[ "static void FUNC_0(CPUMIPSState *VAR_0, DisasContext *VAR_1, uint32_t VAR_2,\nuint32_t VAR_3)\n{", "#define MASK_MSA_ELM(op) (MASK_MSA_MINOR(op) | (op & (0xf << 22)))\nuint8_t ws = (VAR_1->opcode >> 11) & 0x1f;", "uint8_t wd = (VAR_1->opcode >> 6) & 0x1f;", "TCGv_i32 tws = tcg_const_i32(ws);", "TCGv_i32...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7, 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45, 47, 49, 51, 55 ], [...
26,981
static int png_write_row(PNGContext *s, const uint8_t *data, int size) { int ret; s->zstream.avail_in = size; s->zstream.next_in = (uint8_t *)data; while (s->zstream.avail_in > 0) { ret = deflate(&s->zstream, Z_NO_FLUSH); if (ret != Z_OK) return -1; if (s->zstream.avail_out == 0) { png_write_chunk(&s->bytestream, MKTAG('I', 'D', 'A', 'T'), s->buf, IOBUF_SIZE); s->zstream.avail_out = IOBUF_SIZE; s->zstream.next_out = s->buf; } } return 0; }
true
FFmpeg
0ecca7a49f8e254c12a3a1de048d738bfbb614c6
static int png_write_row(PNGContext *s, const uint8_t *data, int size) { int ret; s->zstream.avail_in = size; s->zstream.next_in = (uint8_t *)data; while (s->zstream.avail_in > 0) { ret = deflate(&s->zstream, Z_NO_FLUSH); if (ret != Z_OK) return -1; if (s->zstream.avail_out == 0) { png_write_chunk(&s->bytestream, MKTAG('I', 'D', 'A', 'T'), s->buf, IOBUF_SIZE); s->zstream.avail_out = IOBUF_SIZE; s->zstream.next_out = s->buf; } } return 0; }
{ "code": [ " png_write_chunk(&s->bytestream, MKTAG('I', 'D', 'A', 'T'), s->buf, IOBUF_SIZE);" ], "line_no": [ 23 ] }
static int FUNC_0(PNGContext *VAR_0, const uint8_t *VAR_1, int VAR_2) { int VAR_3; VAR_0->zstream.avail_in = VAR_2; VAR_0->zstream.next_in = (uint8_t *)VAR_1; while (VAR_0->zstream.avail_in > 0) { VAR_3 = deflate(&VAR_0->zstream, Z_NO_FLUSH); if (VAR_3 != Z_OK) return -1; if (VAR_0->zstream.avail_out == 0) { png_write_chunk(&VAR_0->bytestream, MKTAG('I', 'D', 'A', 'T'), VAR_0->buf, IOBUF_SIZE); VAR_0->zstream.avail_out = IOBUF_SIZE; VAR_0->zstream.next_out = VAR_0->buf; } } return 0; }
[ "static int FUNC_0(PNGContext *VAR_0, const uint8_t *VAR_1, int VAR_2)\n{", "int VAR_3;", "VAR_0->zstream.avail_in = VAR_2;", "VAR_0->zstream.next_in = (uint8_t *)VAR_1;", "while (VAR_0->zstream.avail_in > 0) {", "VAR_3 = deflate(&VAR_0->zstream, Z_NO_FLUSH);", "if (VAR_3 != Z_OK)\nreturn -1;", "if (V...
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
26,982
static uint32_t get_features(VirtIODevice *vdev, uint32_t features) { VirtIOSerial *vser; vser = DO_UPCAST(VirtIOSerial, vdev, vdev); if (vser->bus->max_nr_ports > 1) { features |= (1 << VIRTIO_CONSOLE_F_MULTIPORT); } return features; }
true
qemu
5e52e5f903b2648c59030637e1610b32e965d615
static uint32_t get_features(VirtIODevice *vdev, uint32_t features) { VirtIOSerial *vser; vser = DO_UPCAST(VirtIOSerial, vdev, vdev); if (vser->bus->max_nr_ports > 1) { features |= (1 << VIRTIO_CONSOLE_F_MULTIPORT); } return features; }
{ "code": [ " if (vser->bus->max_nr_ports > 1) {" ], "line_no": [ 13 ] }
static uint32_t FUNC_0(VirtIODevice *vdev, uint32_t features) { VirtIOSerial *vser; vser = DO_UPCAST(VirtIOSerial, vdev, vdev); if (vser->bus->max_nr_ports > 1) { features |= (1 << VIRTIO_CONSOLE_F_MULTIPORT); } return features; }
[ "static uint32_t FUNC_0(VirtIODevice *vdev, uint32_t features)\n{", "VirtIOSerial *vser;", "vser = DO_UPCAST(VirtIOSerial, vdev, vdev);", "if (vser->bus->max_nr_ports > 1) {", "features |= (1 << VIRTIO_CONSOLE_F_MULTIPORT);", "}", "return features;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
26,985
static void FUNCC(pred4x4_127_dc)(uint8_t *_src, const uint8_t *topright, int _stride){ pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); ((pixel4*)(src+0*stride))[0]= ((pixel4*)(src+1*stride))[0]= ((pixel4*)(src+2*stride))[0]= ((pixel4*)(src+3*stride))[0]= PIXEL_SPLAT_X4((1<<(BIT_DEPTH-1))-1); }
true
FFmpeg
2caf19e90f270abe1e80a3e85acaf0eb5c9d0aac
static void FUNCC(pred4x4_127_dc)(uint8_t *_src, const uint8_t *topright, int _stride){ pixel *src = (pixel*)_src; int stride = _stride/sizeof(pixel); ((pixel4*)(src+0*stride))[0]= ((pixel4*)(src+1*stride))[0]= ((pixel4*)(src+2*stride))[0]= ((pixel4*)(src+3*stride))[0]= PIXEL_SPLAT_X4((1<<(BIT_DEPTH-1))-1); }
{ "code": [ " ((pixel4*)(src+0*stride))[0]=", " ((pixel4*)(src+1*stride))[0]=", " ((pixel4*)(src+2*stride))[0]=", " ((pixel4*)(src+0*stride))[0]=", " ((pixel4*)(src+1*stride))[0]=", " ((pixel4*)(src+2*stride))[0]=", " ((pixel4*)(src+0*stride))[0]=", " ((pixel4*)(src+1*stride))[0]=", " ((pixel4*)(src+2*stride))[0]=", " ((pixel4*)(src+0*stride))[0]=", " ((pixel4*)(src+1*stride))[0]=", " ((pixel4*)(src+2*stride))[0]=", " ((pixel4*)(src+0*stride))[0]=", " ((pixel4*)(src+1*stride))[0]=", " ((pixel4*)(src+2*stride))[0]=", " ((pixel4*)(src+3*stride))[0]= PIXEL_SPLAT_X4((1<<(BIT_DEPTH-1))-1);", " ((pixel4*)(src+0*stride))[0]=", " ((pixel4*)(src+1*stride))[0]=", " ((pixel4*)(src+2*stride))[0]=" ], "line_no": [ 7, 9, 11, 7, 9, 11, 7, 9, 11, 7, 9, 11, 7, 9, 11, 13, 7, 9, 11 ] }
static void FUNC_0(pred4x4_127_dc)(uint8_t *_src, const uint8_t *topright, int _stride){ pixel *src = (pixel*)_src; int VAR_0 = _stride/sizeof(pixel); ((pixel4*)(src+0*VAR_0))[0]= ((pixel4*)(src+1*VAR_0))[0]= ((pixel4*)(src+2*VAR_0))[0]= ((pixel4*)(src+3*VAR_0))[0]= PIXEL_SPLAT_X4((1<<(BIT_DEPTH-1))-1); }
[ "static void FUNC_0(pred4x4_127_dc)(uint8_t *_src, const uint8_t *topright, int _stride){", "pixel *src = (pixel*)_src;", "int VAR_0 = _stride/sizeof(pixel);", "((pixel4*)(src+0*VAR_0))[0]=\n((pixel4*)(src+1*VAR_0))[0]=\n((pixel4*)(src+2*VAR_0))[0]=\n((pixel4*)(src+3*VAR_0))[0]= PIXEL_SPLAT_X4((1<<(BIT_DEPTH-...
[ 0, 0, 0, 1, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7, 9, 11, 13 ], [ 15 ] ]
26,986
av_cold int ff_vaapi_encode_close(AVCodecContext *avctx) { VAAPIEncodeContext *ctx = avctx->priv_data; VAAPIEncodePicture *pic, *next; for (pic = ctx->pic_start; pic; pic = next) { next = pic->next; vaapi_encode_free(avctx, pic); } if (ctx->va_context != VA_INVALID_ID) vaDestroyContext(ctx->hwctx->display, ctx->va_context); if (ctx->va_config != VA_INVALID_ID) vaDestroyConfig(ctx->hwctx->display, ctx->va_config); if (ctx->codec->close) ctx->codec->close(avctx); av_freep(&ctx->codec_sequence_params); av_freep(&ctx->codec_picture_params); av_buffer_unref(&ctx->recon_frames_ref); av_buffer_unref(&ctx->input_frames_ref); av_buffer_unref(&ctx->device_ref); av_freep(&ctx->priv_data); return 0; }
true
FFmpeg
2bfa067d0b636e7b2004fb0ad5a53d0d48c6de32
av_cold int ff_vaapi_encode_close(AVCodecContext *avctx) { VAAPIEncodeContext *ctx = avctx->priv_data; VAAPIEncodePicture *pic, *next; for (pic = ctx->pic_start; pic; pic = next) { next = pic->next; vaapi_encode_free(avctx, pic); } if (ctx->va_context != VA_INVALID_ID) vaDestroyContext(ctx->hwctx->display, ctx->va_context); if (ctx->va_config != VA_INVALID_ID) vaDestroyConfig(ctx->hwctx->display, ctx->va_config); if (ctx->codec->close) ctx->codec->close(avctx); av_freep(&ctx->codec_sequence_params); av_freep(&ctx->codec_picture_params); av_buffer_unref(&ctx->recon_frames_ref); av_buffer_unref(&ctx->input_frames_ref); av_buffer_unref(&ctx->device_ref); av_freep(&ctx->priv_data); return 0; }
{ "code": [ " if (ctx->va_context != VA_INVALID_ID)", " if (ctx->va_config != VA_INVALID_ID)" ], "line_no": [ 21, 27 ] }
av_cold int FUNC_0(AVCodecContext *avctx) { VAAPIEncodeContext *ctx = avctx->priv_data; VAAPIEncodePicture *pic, *next; for (pic = ctx->pic_start; pic; pic = next) { next = pic->next; vaapi_encode_free(avctx, pic); } if (ctx->va_context != VA_INVALID_ID) vaDestroyContext(ctx->hwctx->display, ctx->va_context); if (ctx->va_config != VA_INVALID_ID) vaDestroyConfig(ctx->hwctx->display, ctx->va_config); if (ctx->codec->close) ctx->codec->close(avctx); av_freep(&ctx->codec_sequence_params); av_freep(&ctx->codec_picture_params); av_buffer_unref(&ctx->recon_frames_ref); av_buffer_unref(&ctx->input_frames_ref); av_buffer_unref(&ctx->device_ref); av_freep(&ctx->priv_data); return 0; }
[ "av_cold int FUNC_0(AVCodecContext *avctx)\n{", "VAAPIEncodeContext *ctx = avctx->priv_data;", "VAAPIEncodePicture *pic, *next;", "for (pic = ctx->pic_start; pic; pic = next) {", "next = pic->next;", "vaapi_encode_free(avctx, pic);", "}", "if (ctx->va_context != VA_INVALID_ID)\nvaDestroyContext(ctx->h...
[ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 27, 29 ], [ 33, 35 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 57 ], [ 59 ] ]
26,989
static int trim_filter_frame(AVFilterLink *inlink, AVFrame *frame) { AVFilterContext *ctx = inlink->dst; TrimContext *s = ctx->priv; int drop; /* drop everything if EOF has already been returned */ if (s->eof) { av_frame_free(&frame); return 0; } if (s->start_frame >= 0 || s->start_pts != AV_NOPTS_VALUE) { drop = 1; if (s->start_frame >= 0 && s->nb_frames >= s->start_frame) drop = 0; if (s->start_pts != AV_NOPTS_VALUE && frame->pts != AV_NOPTS_VALUE && frame->pts >= s->start_pts) drop = 0; if (drop) goto drop; } if (s->first_pts == AV_NOPTS_VALUE && frame->pts != AV_NOPTS_VALUE) s->first_pts = frame->pts; if (s->end_frame != INT64_MAX || s->end_pts != AV_NOPTS_VALUE || s->duration_tb) { drop = 1; if (s->end_frame != INT64_MAX && s->nb_frames < s->end_frame) drop = 0; if (s->end_pts != AV_NOPTS_VALUE && frame->pts != AV_NOPTS_VALUE && frame->pts < s->end_pts) drop = 0; if (s->duration_tb && frame->pts != AV_NOPTS_VALUE && frame->pts - s->first_pts < s->duration_tb) drop = 0; if (drop) { s->eof = 1; goto drop; } } s->nb_frames++; s->got_output = 1; return ff_filter_frame(ctx->outputs[0], frame); drop: s->nb_frames++; av_frame_free(&frame); return 0; }
false
FFmpeg
ed1c83508ec920bfef773e3aa3ac1764a65826ec
static int trim_filter_frame(AVFilterLink *inlink, AVFrame *frame) { AVFilterContext *ctx = inlink->dst; TrimContext *s = ctx->priv; int drop; if (s->eof) { av_frame_free(&frame); return 0; } if (s->start_frame >= 0 || s->start_pts != AV_NOPTS_VALUE) { drop = 1; if (s->start_frame >= 0 && s->nb_frames >= s->start_frame) drop = 0; if (s->start_pts != AV_NOPTS_VALUE && frame->pts != AV_NOPTS_VALUE && frame->pts >= s->start_pts) drop = 0; if (drop) goto drop; } if (s->first_pts == AV_NOPTS_VALUE && frame->pts != AV_NOPTS_VALUE) s->first_pts = frame->pts; if (s->end_frame != INT64_MAX || s->end_pts != AV_NOPTS_VALUE || s->duration_tb) { drop = 1; if (s->end_frame != INT64_MAX && s->nb_frames < s->end_frame) drop = 0; if (s->end_pts != AV_NOPTS_VALUE && frame->pts != AV_NOPTS_VALUE && frame->pts < s->end_pts) drop = 0; if (s->duration_tb && frame->pts != AV_NOPTS_VALUE && frame->pts - s->first_pts < s->duration_tb) drop = 0; if (drop) { s->eof = 1; goto drop; } } s->nb_frames++; s->got_output = 1; return ff_filter_frame(ctx->outputs[0], frame); drop: s->nb_frames++; av_frame_free(&frame); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFilterLink *VAR_0, AVFrame *VAR_1) { AVFilterContext *ctx = VAR_0->dst; TrimContext *s = ctx->priv; int VAR_2; if (s->eof) { av_frame_free(&VAR_1); return 0; } if (s->start_frame >= 0 || s->start_pts != AV_NOPTS_VALUE) { VAR_2 = 1; if (s->start_frame >= 0 && s->nb_frames >= s->start_frame) VAR_2 = 0; if (s->start_pts != AV_NOPTS_VALUE && VAR_1->pts != AV_NOPTS_VALUE && VAR_1->pts >= s->start_pts) VAR_2 = 0; if (VAR_2) goto VAR_2; } if (s->first_pts == AV_NOPTS_VALUE && VAR_1->pts != AV_NOPTS_VALUE) s->first_pts = VAR_1->pts; if (s->end_frame != INT64_MAX || s->end_pts != AV_NOPTS_VALUE || s->duration_tb) { VAR_2 = 1; if (s->end_frame != INT64_MAX && s->nb_frames < s->end_frame) VAR_2 = 0; if (s->end_pts != AV_NOPTS_VALUE && VAR_1->pts != AV_NOPTS_VALUE && VAR_1->pts < s->end_pts) VAR_2 = 0; if (s->duration_tb && VAR_1->pts != AV_NOPTS_VALUE && VAR_1->pts - s->first_pts < s->duration_tb) VAR_2 = 0; if (VAR_2) { s->eof = 1; goto VAR_2; } } s->nb_frames++; s->got_output = 1; return ff_filter_frame(ctx->outputs[0], VAR_1); VAR_2: s->nb_frames++; av_frame_free(&VAR_1); return 0; }
[ "static int FUNC_0(AVFilterLink *VAR_0, AVFrame *VAR_1)\n{", "AVFilterContext *ctx = VAR_0->dst;", "TrimContext *s = ctx->priv;", "int VAR_2;", "if (s->eof) {", "av_frame_free(&VAR_1);", "return 0;", "}", "if (s->start_frame >= 0 || s->start_pts != AV_NOPTS_VALUE) {", "VAR_2 = 1;", "if (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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33, 35, 37 ], [ 39, 41 ], [ 43 ], [ 47, 49 ], [ 53 ], [ 55 ], [...
26,990
static void RENAME(yuv2rgb32_2)(SwsContext *c, const uint16_t *buf0, const uint16_t *buf1, const uint16_t *ubuf0, const uint16_t *ubuf1, const uint16_t *vbuf0, const uint16_t *vbuf1, const uint16_t *abuf0, const uint16_t *abuf1, uint8_t *dest, int dstW, int yalpha, int uvalpha, int y) { if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) { #if ARCH_X86_64 __asm__ volatile( YSCALEYUV2RGB(%%r8, %5) YSCALEYUV2RGB_YA(%%r8, %5, %6, %7) "psraw $3, %%mm1 \n\t" /* abuf0[eax] - abuf1[eax] >>7*/ "psraw $3, %%mm7 \n\t" /* abuf0[eax] - abuf1[eax] >>7*/ "packuswb %%mm7, %%mm1 \n\t" WRITEBGR32(%4, 8280(%5), %%r8, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6) :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "r" (dest), "a" (&c->redDither), "r" (abuf0), "r" (abuf1) : "%r8" ); #else *(const uint16_t **)(&c->u_temp)=abuf0; *(const uint16_t **)(&c->v_temp)=abuf1; __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB(%%REGBP, %5) "push %0 \n\t" "push %1 \n\t" "mov "U_TEMP"(%5), %0 \n\t" "mov "V_TEMP"(%5), %1 \n\t" YSCALEYUV2RGB_YA(%%REGBP, %5, %0, %1) "psraw $3, %%mm1 \n\t" /* abuf0[eax] - abuf1[eax] >>7*/ "psraw $3, %%mm7 \n\t" /* abuf0[eax] - abuf1[eax] >>7*/ "packuswb %%mm7, %%mm1 \n\t" "pop %1 \n\t" "pop %0 \n\t" WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest), "a" (&c->redDither) ); #endif } else { __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB(%%REGBP, %5) "pcmpeqd %%mm7, %%mm7 \n\t" WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest), "a" (&c->redDither) ); } }
false
FFmpeg
13a099799e89a76eb921ca452e1b04a7a28a9855
static void RENAME(yuv2rgb32_2)(SwsContext *c, const uint16_t *buf0, const uint16_t *buf1, const uint16_t *ubuf0, const uint16_t *ubuf1, const uint16_t *vbuf0, const uint16_t *vbuf1, const uint16_t *abuf0, const uint16_t *abuf1, uint8_t *dest, int dstW, int yalpha, int uvalpha, int y) { if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) { #if ARCH_X86_64 __asm__ volatile( YSCALEYUV2RGB(%%r8, %5) YSCALEYUV2RGB_YA(%%r8, %5, %6, %7) "psraw $3, %%mm1 \n\t" "psraw $3, %%mm7 \n\t" "packuswb %%mm7, %%mm1 \n\t" WRITEBGR32(%4, 8280(%5), %%r8, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6) :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "r" (dest), "a" (&c->redDither), "r" (abuf0), "r" (abuf1) : "%r8" ); #else *(const uint16_t **)(&c->u_temp)=abuf0; *(const uint16_t **)(&c->v_temp)=abuf1; __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB(%%REGBP, %5) "push %0 \n\t" "push %1 \n\t" "mov "U_TEMP"(%5), %0 \n\t" "mov "V_TEMP"(%5), %1 \n\t" YSCALEYUV2RGB_YA(%%REGBP, %5, %0, %1) "psraw $3, %%mm1 \n\t" "psraw $3, %%mm7 \n\t" "packuswb %%mm7, %%mm1 \n\t" "pop %1 \n\t" "pop %0 \n\t" WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest), "a" (&c->redDither) ); #endif } else { __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB(%%REGBP, %5) "pcmpeqd %%mm7, %%mm7 \n\t" WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest), "a" (&c->redDither) ); } }
{ "code": [], "line_no": [] }
static void FUNC_0(yuv2rgb32_2)(SwsContext *c, const uint16_t *buf0, const uint16_t *buf1, const uint16_t *ubuf0, const uint16_t *ubuf1, const uint16_t *vbuf0, const uint16_t *vbuf1, const uint16_t *abuf0, const uint16_t *abuf1, uint8_t *dest, int dstW, int yalpha, int uvalpha, int y) { if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) { #if ARCH_X86_64 __asm__ volatile( YSCALEYUV2RGB(%%r8, %5) YSCALEYUV2RGB_YA(%%r8, %5, %6, %7) "psraw $3, %%mm1 \n\t" "psraw $3, %%mm7 \n\t" "packuswb %%mm7, %%mm1 \n\t" WRITEBGR32(%4, 8280(%5), %%r8, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6) :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "r" (dest), "a" (&c->redDither), "r" (abuf0), "r" (abuf1) : "%r8" ); #else *(const uint16_t **)(&c->u_temp)=abuf0; *(const uint16_t **)(&c->v_temp)=abuf1; __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB(%%REGBP, %5) "push %0 \n\t" "push %1 \n\t" "mov "U_TEMP"(%5), %0 \n\t" "mov "V_TEMP"(%5), %1 \n\t" YSCALEYUV2RGB_YA(%%REGBP, %5, %0, %1) "psraw $3, %%mm1 \n\t" "psraw $3, %%mm7 \n\t" "packuswb %%mm7, %%mm1 \n\t" "pop %1 \n\t" "pop %0 \n\t" WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest), "a" (&c->redDither) ); #endif } else { __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB(%%REGBP, %5) "pcmpeqd %%mm7, %%mm7 \n\t" WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest), "a" (&c->redDither) ); } }
[ "static void FUNC_0(yuv2rgb32_2)(SwsContext *c, const uint16_t *buf0,\nconst uint16_t *buf1, const uint16_t *ubuf0,\nconst uint16_t *ubuf1, const uint16_t *vbuf0,\nconst uint16_t *vbuf1, const uint16_t *abuf0,\nconst uint16_t *abuf1, uint8_t *dest,\nint dstW, int yalpha, int uvalpha, int y)\n{", "if (CONFIG_SWSCA...
[ 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,...
26,991
static int read_line(AVIOContext * pb, char* line, int bufsize) { int i; for (i = 0; i < bufsize - 1; i++) { int b = avio_r8(pb); if (b == 0) break; if (b == '\n') { line[i] = '\0'; return 0; } line[i] = b; } line[i] = '\0'; return -1; }
false
FFmpeg
43abef9fde0cf87153cc9031cad61f75b02cfa01
static int read_line(AVIOContext * pb, char* line, int bufsize) { int i; for (i = 0; i < bufsize - 1; i++) { int b = avio_r8(pb); if (b == 0) break; if (b == '\n') { line[i] = '\0'; return 0; } line[i] = b; } line[i] = '\0'; return -1; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVIOContext * VAR_0, char* VAR_1, int VAR_2) { int VAR_3; for (VAR_3 = 0; VAR_3 < VAR_2 - 1; VAR_3++) { int VAR_4 = avio_r8(VAR_0); if (VAR_4 == 0) break; if (VAR_4 == '\n') { VAR_1[VAR_3] = '\0'; return 0; } VAR_1[VAR_3] = VAR_4; } VAR_1[VAR_3] = '\0'; return -1; }
[ "static int FUNC_0(AVIOContext * VAR_0, char* VAR_1, int VAR_2)\n{", "int VAR_3;", "for (VAR_3 = 0; VAR_3 < VAR_2 - 1; VAR_3++) {", "int VAR_4 = avio_r8(VAR_0);", "if (VAR_4 == 0)\nbreak;", "if (VAR_4 == '\\n') {", "VAR_1[VAR_3] = '\\0';", "return 0;", "}", "VAR_1[VAR_3] = VAR_4;", "}", "VAR_1...
[ 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 ] ]
26,992
static int tiff_decode_tag(TiffContext *s) { unsigned tag, type, count, off, value = 0; int i, j, k, pos, start; int ret; uint32_t *pal; double *dp; tag = tget_short(&s->gb, s->le); type = tget_short(&s->gb, s->le); count = tget_long(&s->gb, s->le); off = tget_long(&s->gb, s->le); start = bytestream2_tell(&s->gb); if (type == 0 || type >= FF_ARRAY_ELEMS(type_sizes)) { av_log(s->avctx, AV_LOG_DEBUG, "Unknown tiff type (%u) encountered\n", type); return 0; } if (count == 1) { switch (type) { case TIFF_BYTE: case TIFF_SHORT: bytestream2_seek(&s->gb, -4, SEEK_CUR); value = tget(&s->gb, type, s->le); break; case TIFF_LONG: value = off; break; case TIFF_STRING: if (count <= 4) { bytestream2_seek(&s->gb, -4, SEEK_CUR); break; } default: value = UINT_MAX; bytestream2_seek(&s->gb, off, SEEK_SET); } } else { if (count <= 4 && type_sizes[type] * count <= 4) { bytestream2_seek(&s->gb, -4, SEEK_CUR); } else { bytestream2_seek(&s->gb, off, SEEK_SET); } } switch (tag) { case TIFF_WIDTH: s->width = value; break; case TIFF_HEIGHT: s->height = value; break; case TIFF_BPP: s->bppcount = count; if (count > 4) { av_log(s->avctx, AV_LOG_ERROR, "This format is not supported (bpp=%d, %d components)\n", s->bpp, count); return AVERROR_INVALIDDATA; } if (count == 1) s->bpp = value; else { switch (type) { case TIFF_BYTE: s->bpp = (off & 0xFF) + ((off >> 8) & 0xFF) + ((off >> 16) & 0xFF) + ((off >> 24) & 0xFF); break; case TIFF_SHORT: case TIFF_LONG: s->bpp = 0; if (bytestream2_get_bytes_left(&s->gb) < type_sizes[type] * count) return AVERROR_INVALIDDATA; for (i = 0; i < count; i++) s->bpp += tget(&s->gb, type, s->le); break; default: s->bpp = -1; } } break; case TIFF_SAMPLES_PER_PIXEL: if (count != 1) { av_log(s->avctx, AV_LOG_ERROR, "Samples per pixel requires a single value, many provided\n"); return AVERROR_INVALIDDATA; } if (s->bppcount == 1) s->bpp *= value; s->bppcount = value; break; case TIFF_COMPR: s->compr = value; s->predictor = 0; switch (s->compr) { case TIFF_RAW: case TIFF_PACKBITS: case TIFF_LZW: case TIFF_CCITT_RLE: break; case TIFF_G3: case TIFF_G4: s->fax_opts = 0; break; case TIFF_DEFLATE: case TIFF_ADOBE_DEFLATE: #if CONFIG_ZLIB break; #else av_log(s->avctx, AV_LOG_ERROR, "Deflate: ZLib not compiled in\n"); return AVERROR(ENOSYS); #endif case TIFF_JPEG: case TIFF_NEWJPEG: av_log(s->avctx, AV_LOG_ERROR, "JPEG compression is not supported\n"); return AVERROR_PATCHWELCOME; default: av_log(s->avctx, AV_LOG_ERROR, "Unknown compression method %i\n", s->compr); return AVERROR_INVALIDDATA; } break; case TIFF_ROWSPERSTRIP: if (type == TIFF_LONG && value == UINT_MAX) value = s->height; if (value < 1) { av_log(s->avctx, AV_LOG_ERROR, "Incorrect value of rows per strip\n"); return AVERROR_INVALIDDATA; } s->rps = value; break; case TIFF_STRIP_OFFS: if (count == 1) { s->strippos = 0; s->stripoff = value; } else s->strippos = off; s->strips = count; if (s->strips == 1) s->rps = s->height; s->sot = type; if (s->strippos > bytestream2_size(&s->gb)) { av_log(s->avctx, AV_LOG_ERROR, "Tag referencing position outside the image\n"); return AVERROR_INVALIDDATA; } break; case TIFF_STRIP_SIZE: if (count == 1) { s->stripsizesoff = 0; s->stripsize = value; s->strips = 1; } else { s->stripsizesoff = off; } s->strips = count; s->sstype = type; if (s->stripsizesoff > bytestream2_size(&s->gb)) { av_log(s->avctx, AV_LOG_ERROR, "Tag referencing position outside the image\n"); return AVERROR_INVALIDDATA; } break; case TIFF_TILE_BYTE_COUNTS: case TIFF_TILE_LENGTH: case TIFF_TILE_OFFSETS: case TIFF_TILE_WIDTH: av_log(s->avctx, AV_LOG_ERROR, "Tiled images are not supported\n"); return AVERROR_PATCHWELCOME; break; case TIFF_PREDICTOR: s->predictor = value; break; case TIFF_INVERT: switch (value) { case 0: s->invert = 1; break; case 1: s->invert = 0; break; case 2: case 3: break; default: av_log(s->avctx, AV_LOG_ERROR, "Color mode %d is not supported\n", value); return AVERROR_INVALIDDATA; } break; case TIFF_FILL_ORDER: if (value < 1 || value > 2) { av_log(s->avctx, AV_LOG_ERROR, "Unknown FillOrder value %d, trying default one\n", value); value = 1; } s->fill_order = value - 1; break; case TIFF_PAL: pal = (uint32_t *) s->palette; off = type_sizes[type]; if (count / 3 > 256 || bytestream2_get_bytes_left(&s->gb) < count / 3 * off * 3) return AVERROR_INVALIDDATA; off = (type_sizes[type] - 1) << 3; for (k = 2; k >= 0; k--) { for (i = 0; i < count / 3; i++) { if (k == 2) pal[i] = 0xFFU << 24; j = (tget(&s->gb, type, s->le) >> off) << (k * 8); pal[i] |= j; } } s->palette_is_set = 1; break; case TIFF_PLANAR: if (value == 2) { av_log(s->avctx, AV_LOG_ERROR, "Planar format is not supported\n"); return AVERROR_PATCHWELCOME; } break; case TIFF_T4OPTIONS: if (s->compr == TIFF_G3) s->fax_opts = value; break; case TIFF_T6OPTIONS: if (s->compr == TIFF_G4) s->fax_opts = value; break; #define ADD_METADATA(count, name, sep)\ if ((ret = add_metadata(count, type, name, sep, s)) < 0) {\ av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n");\ return ret;\ } case TIFF_MODEL_PIXEL_SCALE: ADD_METADATA(count, "ModelPixelScaleTag", NULL); break; case TIFF_MODEL_TRANSFORMATION: ADD_METADATA(count, "ModelTransformationTag", NULL); break; case TIFF_MODEL_TIEPOINT: ADD_METADATA(count, "ModelTiepointTag", NULL); break; case TIFF_GEO_KEY_DIRECTORY: ADD_METADATA(1, "GeoTIFF_Version", NULL); ADD_METADATA(2, "GeoTIFF_Key_Revision", "."); s->geotag_count = tget_short(&s->gb, s->le); if (s->geotag_count > count / 4 - 1) { s->geotag_count = count / 4 - 1; av_log(s->avctx, AV_LOG_WARNING, "GeoTIFF key directory buffer shorter than specified\n"); } if (bytestream2_get_bytes_left(&s->gb) < s->geotag_count * sizeof(int16_t) * 4) return -1; s->geotags = av_mallocz(sizeof(TiffGeoTag) * s->geotag_count); if (!s->geotags) { av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n"); return AVERROR(ENOMEM); } for (i = 0; i < s->geotag_count; i++) { s->geotags[i].key = tget_short(&s->gb, s->le); s->geotags[i].type = tget_short(&s->gb, s->le); s->geotags[i].count = tget_short(&s->gb, s->le); if (!s->geotags[i].type) s->geotags[i].val = get_geokey_val(s->geotags[i].key, tget_short(&s->gb, s->le)); else s->geotags[i].offset = tget_short(&s->gb, s->le); } break; case TIFF_GEO_DOUBLE_PARAMS: if (count >= INT_MAX / sizeof(int64_t)) return AVERROR_INVALIDDATA; if (bytestream2_get_bytes_left(&s->gb) < count * sizeof(int64_t)) return AVERROR_INVALIDDATA; dp = av_malloc(count * sizeof(double)); if (!dp) { av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n"); return AVERROR(ENOMEM); } for (i = 0; i < count; i++) dp[i] = tget_double(&s->gb, s->le); for (i = 0; i < s->geotag_count; i++) { if (s->geotags[i].type == TIFF_GEO_DOUBLE_PARAMS) { if (s->geotags[i].count == 0 || s->geotags[i].offset + s->geotags[i].count > count) { av_log(s->avctx, AV_LOG_WARNING, "Invalid GeoTIFF key %d\n", s->geotags[i].key); } else { char *ap = doubles2str(&dp[s->geotags[i].offset], s->geotags[i].count, ", "); if (!ap) { av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n"); av_freep(&dp); return AVERROR(ENOMEM); } s->geotags[i].val = ap; } } } av_freep(&dp); break; case TIFF_GEO_ASCII_PARAMS: pos = bytestream2_tell(&s->gb); for (i = 0; i < s->geotag_count; i++) { if (s->geotags[i].type == TIFF_GEO_ASCII_PARAMS) { if (s->geotags[i].count == 0 || s->geotags[i].offset + s->geotags[i].count > count) { av_log(s->avctx, AV_LOG_WARNING, "Invalid GeoTIFF key %d\n", s->geotags[i].key); } else { char *ap; bytestream2_seek(&s->gb, pos + s->geotags[i].offset, SEEK_SET); if (bytestream2_get_bytes_left(&s->gb) < s->geotags[i].count) return AVERROR_INVALIDDATA; ap = av_malloc(s->geotags[i].count); if (!ap) { av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n"); return AVERROR(ENOMEM); } bytestream2_get_bufferu(&s->gb, ap, s->geotags[i].count); ap[s->geotags[i].count - 1] = '\0'; //replace the "|" delimiter with a 0 byte s->geotags[i].val = ap; } } } break; case TIFF_ARTIST: ADD_METADATA(count, "artist", NULL); break; case TIFF_COPYRIGHT: ADD_METADATA(count, "copyright", NULL); break; case TIFF_DATE: ADD_METADATA(count, "date", NULL); break; case TIFF_DOCUMENT_NAME: ADD_METADATA(count, "document_name", NULL); break; case TIFF_HOST_COMPUTER: ADD_METADATA(count, "computer", NULL); break; case TIFF_IMAGE_DESCRIPTION: ADD_METADATA(count, "description", NULL); break; case TIFF_MAKE: ADD_METADATA(count, "make", NULL); break; case TIFF_MODEL: ADD_METADATA(count, "model", NULL); break; case TIFF_PAGE_NAME: ADD_METADATA(count, "page_name", NULL); break; case TIFF_PAGE_NUMBER: ADD_METADATA(count, "page_number", " / "); break; case TIFF_SOFTWARE_NAME: ADD_METADATA(count, "software", NULL); break; default: av_log(s->avctx, AV_LOG_DEBUG, "Unknown or unsupported tag %d/0X%0X\n", tag, tag); } bytestream2_seek(&s->gb, start, SEEK_SET); return 0; }
false
FFmpeg
0e3dacb11eacf6a944691bb4a12f4dd56b6d7ce6
static int tiff_decode_tag(TiffContext *s) { unsigned tag, type, count, off, value = 0; int i, j, k, pos, start; int ret; uint32_t *pal; double *dp; tag = tget_short(&s->gb, s->le); type = tget_short(&s->gb, s->le); count = tget_long(&s->gb, s->le); off = tget_long(&s->gb, s->le); start = bytestream2_tell(&s->gb); if (type == 0 || type >= FF_ARRAY_ELEMS(type_sizes)) { av_log(s->avctx, AV_LOG_DEBUG, "Unknown tiff type (%u) encountered\n", type); return 0; } if (count == 1) { switch (type) { case TIFF_BYTE: case TIFF_SHORT: bytestream2_seek(&s->gb, -4, SEEK_CUR); value = tget(&s->gb, type, s->le); break; case TIFF_LONG: value = off; break; case TIFF_STRING: if (count <= 4) { bytestream2_seek(&s->gb, -4, SEEK_CUR); break; } default: value = UINT_MAX; bytestream2_seek(&s->gb, off, SEEK_SET); } } else { if (count <= 4 && type_sizes[type] * count <= 4) { bytestream2_seek(&s->gb, -4, SEEK_CUR); } else { bytestream2_seek(&s->gb, off, SEEK_SET); } } switch (tag) { case TIFF_WIDTH: s->width = value; break; case TIFF_HEIGHT: s->height = value; break; case TIFF_BPP: s->bppcount = count; if (count > 4) { av_log(s->avctx, AV_LOG_ERROR, "This format is not supported (bpp=%d, %d components)\n", s->bpp, count); return AVERROR_INVALIDDATA; } if (count == 1) s->bpp = value; else { switch (type) { case TIFF_BYTE: s->bpp = (off & 0xFF) + ((off >> 8) & 0xFF) + ((off >> 16) & 0xFF) + ((off >> 24) & 0xFF); break; case TIFF_SHORT: case TIFF_LONG: s->bpp = 0; if (bytestream2_get_bytes_left(&s->gb) < type_sizes[type] * count) return AVERROR_INVALIDDATA; for (i = 0; i < count; i++) s->bpp += tget(&s->gb, type, s->le); break; default: s->bpp = -1; } } break; case TIFF_SAMPLES_PER_PIXEL: if (count != 1) { av_log(s->avctx, AV_LOG_ERROR, "Samples per pixel requires a single value, many provided\n"); return AVERROR_INVALIDDATA; } if (s->bppcount == 1) s->bpp *= value; s->bppcount = value; break; case TIFF_COMPR: s->compr = value; s->predictor = 0; switch (s->compr) { case TIFF_RAW: case TIFF_PACKBITS: case TIFF_LZW: case TIFF_CCITT_RLE: break; case TIFF_G3: case TIFF_G4: s->fax_opts = 0; break; case TIFF_DEFLATE: case TIFF_ADOBE_DEFLATE: #if CONFIG_ZLIB break; #else av_log(s->avctx, AV_LOG_ERROR, "Deflate: ZLib not compiled in\n"); return AVERROR(ENOSYS); #endif case TIFF_JPEG: case TIFF_NEWJPEG: av_log(s->avctx, AV_LOG_ERROR, "JPEG compression is not supported\n"); return AVERROR_PATCHWELCOME; default: av_log(s->avctx, AV_LOG_ERROR, "Unknown compression method %i\n", s->compr); return AVERROR_INVALIDDATA; } break; case TIFF_ROWSPERSTRIP: if (type == TIFF_LONG && value == UINT_MAX) value = s->height; if (value < 1) { av_log(s->avctx, AV_LOG_ERROR, "Incorrect value of rows per strip\n"); return AVERROR_INVALIDDATA; } s->rps = value; break; case TIFF_STRIP_OFFS: if (count == 1) { s->strippos = 0; s->stripoff = value; } else s->strippos = off; s->strips = count; if (s->strips == 1) s->rps = s->height; s->sot = type; if (s->strippos > bytestream2_size(&s->gb)) { av_log(s->avctx, AV_LOG_ERROR, "Tag referencing position outside the image\n"); return AVERROR_INVALIDDATA; } break; case TIFF_STRIP_SIZE: if (count == 1) { s->stripsizesoff = 0; s->stripsize = value; s->strips = 1; } else { s->stripsizesoff = off; } s->strips = count; s->sstype = type; if (s->stripsizesoff > bytestream2_size(&s->gb)) { av_log(s->avctx, AV_LOG_ERROR, "Tag referencing position outside the image\n"); return AVERROR_INVALIDDATA; } break; case TIFF_TILE_BYTE_COUNTS: case TIFF_TILE_LENGTH: case TIFF_TILE_OFFSETS: case TIFF_TILE_WIDTH: av_log(s->avctx, AV_LOG_ERROR, "Tiled images are not supported\n"); return AVERROR_PATCHWELCOME; break; case TIFF_PREDICTOR: s->predictor = value; break; case TIFF_INVERT: switch (value) { case 0: s->invert = 1; break; case 1: s->invert = 0; break; case 2: case 3: break; default: av_log(s->avctx, AV_LOG_ERROR, "Color mode %d is not supported\n", value); return AVERROR_INVALIDDATA; } break; case TIFF_FILL_ORDER: if (value < 1 || value > 2) { av_log(s->avctx, AV_LOG_ERROR, "Unknown FillOrder value %d, trying default one\n", value); value = 1; } s->fill_order = value - 1; break; case TIFF_PAL: pal = (uint32_t *) s->palette; off = type_sizes[type]; if (count / 3 > 256 || bytestream2_get_bytes_left(&s->gb) < count / 3 * off * 3) return AVERROR_INVALIDDATA; off = (type_sizes[type] - 1) << 3; for (k = 2; k >= 0; k--) { for (i = 0; i < count / 3; i++) { if (k == 2) pal[i] = 0xFFU << 24; j = (tget(&s->gb, type, s->le) >> off) << (k * 8); pal[i] |= j; } } s->palette_is_set = 1; break; case TIFF_PLANAR: if (value == 2) { av_log(s->avctx, AV_LOG_ERROR, "Planar format is not supported\n"); return AVERROR_PATCHWELCOME; } break; case TIFF_T4OPTIONS: if (s->compr == TIFF_G3) s->fax_opts = value; break; case TIFF_T6OPTIONS: if (s->compr == TIFF_G4) s->fax_opts = value; break; #define ADD_METADATA(count, name, sep)\ if ((ret = add_metadata(count, type, name, sep, s)) < 0) {\ av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n");\ return ret;\ } case TIFF_MODEL_PIXEL_SCALE: ADD_METADATA(count, "ModelPixelScaleTag", NULL); break; case TIFF_MODEL_TRANSFORMATION: ADD_METADATA(count, "ModelTransformationTag", NULL); break; case TIFF_MODEL_TIEPOINT: ADD_METADATA(count, "ModelTiepointTag", NULL); break; case TIFF_GEO_KEY_DIRECTORY: ADD_METADATA(1, "GeoTIFF_Version", NULL); ADD_METADATA(2, "GeoTIFF_Key_Revision", "."); s->geotag_count = tget_short(&s->gb, s->le); if (s->geotag_count > count / 4 - 1) { s->geotag_count = count / 4 - 1; av_log(s->avctx, AV_LOG_WARNING, "GeoTIFF key directory buffer shorter than specified\n"); } if (bytestream2_get_bytes_left(&s->gb) < s->geotag_count * sizeof(int16_t) * 4) return -1; s->geotags = av_mallocz(sizeof(TiffGeoTag) * s->geotag_count); if (!s->geotags) { av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n"); return AVERROR(ENOMEM); } for (i = 0; i < s->geotag_count; i++) { s->geotags[i].key = tget_short(&s->gb, s->le); s->geotags[i].type = tget_short(&s->gb, s->le); s->geotags[i].count = tget_short(&s->gb, s->le); if (!s->geotags[i].type) s->geotags[i].val = get_geokey_val(s->geotags[i].key, tget_short(&s->gb, s->le)); else s->geotags[i].offset = tget_short(&s->gb, s->le); } break; case TIFF_GEO_DOUBLE_PARAMS: if (count >= INT_MAX / sizeof(int64_t)) return AVERROR_INVALIDDATA; if (bytestream2_get_bytes_left(&s->gb) < count * sizeof(int64_t)) return AVERROR_INVALIDDATA; dp = av_malloc(count * sizeof(double)); if (!dp) { av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n"); return AVERROR(ENOMEM); } for (i = 0; i < count; i++) dp[i] = tget_double(&s->gb, s->le); for (i = 0; i < s->geotag_count; i++) { if (s->geotags[i].type == TIFF_GEO_DOUBLE_PARAMS) { if (s->geotags[i].count == 0 || s->geotags[i].offset + s->geotags[i].count > count) { av_log(s->avctx, AV_LOG_WARNING, "Invalid GeoTIFF key %d\n", s->geotags[i].key); } else { char *ap = doubles2str(&dp[s->geotags[i].offset], s->geotags[i].count, ", "); if (!ap) { av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n"); av_freep(&dp); return AVERROR(ENOMEM); } s->geotags[i].val = ap; } } } av_freep(&dp); break; case TIFF_GEO_ASCII_PARAMS: pos = bytestream2_tell(&s->gb); for (i = 0; i < s->geotag_count; i++) { if (s->geotags[i].type == TIFF_GEO_ASCII_PARAMS) { if (s->geotags[i].count == 0 || s->geotags[i].offset + s->geotags[i].count > count) { av_log(s->avctx, AV_LOG_WARNING, "Invalid GeoTIFF key %d\n", s->geotags[i].key); } else { char *ap; bytestream2_seek(&s->gb, pos + s->geotags[i].offset, SEEK_SET); if (bytestream2_get_bytes_left(&s->gb) < s->geotags[i].count) return AVERROR_INVALIDDATA; ap = av_malloc(s->geotags[i].count); if (!ap) { av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n"); return AVERROR(ENOMEM); } bytestream2_get_bufferu(&s->gb, ap, s->geotags[i].count); ap[s->geotags[i].count - 1] = '\0'; s->geotags[i].val = ap; } } } break; case TIFF_ARTIST: ADD_METADATA(count, "artist", NULL); break; case TIFF_COPYRIGHT: ADD_METADATA(count, "copyright", NULL); break; case TIFF_DATE: ADD_METADATA(count, "date", NULL); break; case TIFF_DOCUMENT_NAME: ADD_METADATA(count, "document_name", NULL); break; case TIFF_HOST_COMPUTER: ADD_METADATA(count, "computer", NULL); break; case TIFF_IMAGE_DESCRIPTION: ADD_METADATA(count, "description", NULL); break; case TIFF_MAKE: ADD_METADATA(count, "make", NULL); break; case TIFF_MODEL: ADD_METADATA(count, "model", NULL); break; case TIFF_PAGE_NAME: ADD_METADATA(count, "page_name", NULL); break; case TIFF_PAGE_NUMBER: ADD_METADATA(count, "page_number", " / "); break; case TIFF_SOFTWARE_NAME: ADD_METADATA(count, "software", NULL); break; default: av_log(s->avctx, AV_LOG_DEBUG, "Unknown or unsupported tag %d/0X%0X\n", tag, tag); } bytestream2_seek(&s->gb, start, SEEK_SET); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(TiffContext *VAR_0) { unsigned VAR_1, VAR_2, VAR_3, VAR_4, VAR_5 = 0; int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10; int VAR_11; uint32_t *pal; double *VAR_12; VAR_1 = tget_short(&VAR_0->gb, VAR_0->le); VAR_2 = tget_short(&VAR_0->gb, VAR_0->le); VAR_3 = tget_long(&VAR_0->gb, VAR_0->le); VAR_4 = tget_long(&VAR_0->gb, VAR_0->le); VAR_10 = bytestream2_tell(&VAR_0->gb); if (VAR_2 == 0 || VAR_2 >= FF_ARRAY_ELEMS(type_sizes)) { av_log(VAR_0->avctx, AV_LOG_DEBUG, "Unknown tiff VAR_2 (%u) encountered\n", VAR_2); return 0; } if (VAR_3 == 1) { switch (VAR_2) { case TIFF_BYTE: case TIFF_SHORT: bytestream2_seek(&VAR_0->gb, -4, SEEK_CUR); VAR_5 = tget(&VAR_0->gb, VAR_2, VAR_0->le); break; case TIFF_LONG: VAR_5 = VAR_4; break; case TIFF_STRING: if (VAR_3 <= 4) { bytestream2_seek(&VAR_0->gb, -4, SEEK_CUR); break; } default: VAR_5 = UINT_MAX; bytestream2_seek(&VAR_0->gb, VAR_4, SEEK_SET); } } else { if (VAR_3 <= 4 && type_sizes[VAR_2] * VAR_3 <= 4) { bytestream2_seek(&VAR_0->gb, -4, SEEK_CUR); } else { bytestream2_seek(&VAR_0->gb, VAR_4, SEEK_SET); } } switch (VAR_1) { case TIFF_WIDTH: VAR_0->width = VAR_5; break; case TIFF_HEIGHT: VAR_0->height = VAR_5; break; case TIFF_BPP: VAR_0->bppcount = VAR_3; if (VAR_3 > 4) { av_log(VAR_0->avctx, AV_LOG_ERROR, "This format is not supported (bpp=%d, %d components)\n", VAR_0->bpp, VAR_3); return AVERROR_INVALIDDATA; } if (VAR_3 == 1) VAR_0->bpp = VAR_5; else { switch (VAR_2) { case TIFF_BYTE: VAR_0->bpp = (VAR_4 & 0xFF) + ((VAR_4 >> 8) & 0xFF) + ((VAR_4 >> 16) & 0xFF) + ((VAR_4 >> 24) & 0xFF); break; case TIFF_SHORT: case TIFF_LONG: VAR_0->bpp = 0; if (bytestream2_get_bytes_left(&VAR_0->gb) < type_sizes[VAR_2] * VAR_3) return AVERROR_INVALIDDATA; for (VAR_6 = 0; VAR_6 < VAR_3; VAR_6++) VAR_0->bpp += tget(&VAR_0->gb, VAR_2, VAR_0->le); break; default: VAR_0->bpp = -1; } } break; case TIFF_SAMPLES_PER_PIXEL: if (VAR_3 != 1) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Samples per pixel requires a single VAR_5, many provided\n"); return AVERROR_INVALIDDATA; } if (VAR_0->bppcount == 1) VAR_0->bpp *= VAR_5; VAR_0->bppcount = VAR_5; break; case TIFF_COMPR: VAR_0->compr = VAR_5; VAR_0->predictor = 0; switch (VAR_0->compr) { case TIFF_RAW: case TIFF_PACKBITS: case TIFF_LZW: case TIFF_CCITT_RLE: break; case TIFF_G3: case TIFF_G4: VAR_0->fax_opts = 0; break; case TIFF_DEFLATE: case TIFF_ADOBE_DEFLATE: #if CONFIG_ZLIB break; #else av_log(VAR_0->avctx, AV_LOG_ERROR, "Deflate: ZLib not compiled in\n"); return AVERROR(ENOSYS); #endif case TIFF_JPEG: case TIFF_NEWJPEG: av_log(VAR_0->avctx, AV_LOG_ERROR, "JPEG compression is not supported\n"); return AVERROR_PATCHWELCOME; default: av_log(VAR_0->avctx, AV_LOG_ERROR, "Unknown compression method %VAR_6\n", VAR_0->compr); return AVERROR_INVALIDDATA; } break; case TIFF_ROWSPERSTRIP: if (VAR_2 == TIFF_LONG && VAR_5 == UINT_MAX) VAR_5 = VAR_0->height; if (VAR_5 < 1) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Incorrect VAR_5 of rows per strip\n"); return AVERROR_INVALIDDATA; } VAR_0->rps = VAR_5; break; case TIFF_STRIP_OFFS: if (VAR_3 == 1) { VAR_0->strippos = 0; VAR_0->stripoff = VAR_5; } else VAR_0->strippos = VAR_4; VAR_0->strips = VAR_3; if (VAR_0->strips == 1) VAR_0->rps = VAR_0->height; VAR_0->sot = VAR_2; if (VAR_0->strippos > bytestream2_size(&VAR_0->gb)) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Tag referencing position outside the image\n"); return AVERROR_INVALIDDATA; } break; case TIFF_STRIP_SIZE: if (VAR_3 == 1) { VAR_0->stripsizesoff = 0; VAR_0->stripsize = VAR_5; VAR_0->strips = 1; } else { VAR_0->stripsizesoff = VAR_4; } VAR_0->strips = VAR_3; VAR_0->sstype = VAR_2; if (VAR_0->stripsizesoff > bytestream2_size(&VAR_0->gb)) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Tag referencing position outside the image\n"); return AVERROR_INVALIDDATA; } break; case TIFF_TILE_BYTE_COUNTS: case TIFF_TILE_LENGTH: case TIFF_TILE_OFFSETS: case TIFF_TILE_WIDTH: av_log(VAR_0->avctx, AV_LOG_ERROR, "Tiled images are not supported\n"); return AVERROR_PATCHWELCOME; break; case TIFF_PREDICTOR: VAR_0->predictor = VAR_5; break; case TIFF_INVERT: switch (VAR_5) { case 0: VAR_0->invert = 1; break; case 1: VAR_0->invert = 0; break; case 2: case 3: break; default: av_log(VAR_0->avctx, AV_LOG_ERROR, "Color mode %d is not supported\n", VAR_5); return AVERROR_INVALIDDATA; } break; case TIFF_FILL_ORDER: if (VAR_5 < 1 || VAR_5 > 2) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Unknown FillOrder VAR_5 %d, trying default one\n", VAR_5); VAR_5 = 1; } VAR_0->fill_order = VAR_5 - 1; break; case TIFF_PAL: pal = (uint32_t *) VAR_0->palette; VAR_4 = type_sizes[VAR_2]; if (VAR_3 / 3 > 256 || bytestream2_get_bytes_left(&VAR_0->gb) < VAR_3 / 3 * VAR_4 * 3) return AVERROR_INVALIDDATA; VAR_4 = (type_sizes[VAR_2] - 1) << 3; for (VAR_8 = 2; VAR_8 >= 0; VAR_8--) { for (VAR_6 = 0; VAR_6 < VAR_3 / 3; VAR_6++) { if (VAR_8 == 2) pal[VAR_6] = 0xFFU << 24; VAR_7 = (tget(&VAR_0->gb, VAR_2, VAR_0->le) >> VAR_4) << (VAR_8 * 8); pal[VAR_6] |= VAR_7; } } VAR_0->palette_is_set = 1; break; case TIFF_PLANAR: if (VAR_5 == 2) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Planar format is not supported\n"); return AVERROR_PATCHWELCOME; } break; case TIFF_T4OPTIONS: if (VAR_0->compr == TIFF_G3) VAR_0->fax_opts = VAR_5; break; case TIFF_T6OPTIONS: if (VAR_0->compr == TIFF_G4) VAR_0->fax_opts = VAR_5; break; #define ADD_METADATA(VAR_3, name, sep)\ if ((VAR_11 = add_metadata(VAR_3, VAR_2, name, sep, VAR_0)) < 0) {\ av_log(VAR_0->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n");\ return VAR_11;\ } case TIFF_MODEL_PIXEL_SCALE: ADD_METADATA(VAR_3, "ModelPixelScaleTag", NULL); break; case TIFF_MODEL_TRANSFORMATION: ADD_METADATA(VAR_3, "ModelTransformationTag", NULL); break; case TIFF_MODEL_TIEPOINT: ADD_METADATA(VAR_3, "ModelTiepointTag", NULL); break; case TIFF_GEO_KEY_DIRECTORY: ADD_METADATA(1, "GeoTIFF_Version", NULL); ADD_METADATA(2, "GeoTIFF_Key_Revision", "."); VAR_0->geotag_count = tget_short(&VAR_0->gb, VAR_0->le); if (VAR_0->geotag_count > VAR_3 / 4 - 1) { VAR_0->geotag_count = VAR_3 / 4 - 1; av_log(VAR_0->avctx, AV_LOG_WARNING, "GeoTIFF key directory buffer shorter than specified\n"); } if (bytestream2_get_bytes_left(&VAR_0->gb) < VAR_0->geotag_count * sizeof(int16_t) * 4) return -1; VAR_0->geotags = av_mallocz(sizeof(TiffGeoTag) * VAR_0->geotag_count); if (!VAR_0->geotags) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n"); return AVERROR(ENOMEM); } for (VAR_6 = 0; VAR_6 < VAR_0->geotag_count; VAR_6++) { VAR_0->geotags[VAR_6].key = tget_short(&VAR_0->gb, VAR_0->le); VAR_0->geotags[VAR_6].VAR_2 = tget_short(&VAR_0->gb, VAR_0->le); VAR_0->geotags[VAR_6].VAR_3 = tget_short(&VAR_0->gb, VAR_0->le); if (!VAR_0->geotags[VAR_6].VAR_2) VAR_0->geotags[VAR_6].val = get_geokey_val(VAR_0->geotags[VAR_6].key, tget_short(&VAR_0->gb, VAR_0->le)); else VAR_0->geotags[VAR_6].offset = tget_short(&VAR_0->gb, VAR_0->le); } break; case TIFF_GEO_DOUBLE_PARAMS: if (VAR_3 >= INT_MAX / sizeof(int64_t)) return AVERROR_INVALIDDATA; if (bytestream2_get_bytes_left(&VAR_0->gb) < VAR_3 * sizeof(int64_t)) return AVERROR_INVALIDDATA; VAR_12 = av_malloc(VAR_3 * sizeof(double)); if (!VAR_12) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n"); return AVERROR(ENOMEM); } for (VAR_6 = 0; VAR_6 < VAR_3; VAR_6++) VAR_12[VAR_6] = tget_double(&VAR_0->gb, VAR_0->le); for (VAR_6 = 0; VAR_6 < VAR_0->geotag_count; VAR_6++) { if (VAR_0->geotags[VAR_6].VAR_2 == TIFF_GEO_DOUBLE_PARAMS) { if (VAR_0->geotags[VAR_6].VAR_3 == 0 || VAR_0->geotags[VAR_6].offset + VAR_0->geotags[VAR_6].VAR_3 > VAR_3) { av_log(VAR_0->avctx, AV_LOG_WARNING, "Invalid GeoTIFF key %d\n", VAR_0->geotags[VAR_6].key); } else { char *ap = doubles2str(&VAR_12[VAR_0->geotags[VAR_6].offset], VAR_0->geotags[VAR_6].VAR_3, ", "); if (!ap) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n"); av_freep(&VAR_12); return AVERROR(ENOMEM); } VAR_0->geotags[VAR_6].val = ap; } } } av_freep(&VAR_12); break; case TIFF_GEO_ASCII_PARAMS: VAR_9 = bytestream2_tell(&VAR_0->gb); for (VAR_6 = 0; VAR_6 < VAR_0->geotag_count; VAR_6++) { if (VAR_0->geotags[VAR_6].VAR_2 == TIFF_GEO_ASCII_PARAMS) { if (VAR_0->geotags[VAR_6].VAR_3 == 0 || VAR_0->geotags[VAR_6].offset + VAR_0->geotags[VAR_6].VAR_3 > VAR_3) { av_log(VAR_0->avctx, AV_LOG_WARNING, "Invalid GeoTIFF key %d\n", VAR_0->geotags[VAR_6].key); } else { char *ap; bytestream2_seek(&VAR_0->gb, VAR_9 + VAR_0->geotags[VAR_6].offset, SEEK_SET); if (bytestream2_get_bytes_left(&VAR_0->gb) < VAR_0->geotags[VAR_6].VAR_3) return AVERROR_INVALIDDATA; ap = av_malloc(VAR_0->geotags[VAR_6].VAR_3); if (!ap) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n"); return AVERROR(ENOMEM); } bytestream2_get_bufferu(&VAR_0->gb, ap, VAR_0->geotags[VAR_6].VAR_3); ap[VAR_0->geotags[VAR_6].VAR_3 - 1] = '\0'; VAR_0->geotags[VAR_6].val = ap; } } } break; case TIFF_ARTIST: ADD_METADATA(VAR_3, "artist", NULL); break; case TIFF_COPYRIGHT: ADD_METADATA(VAR_3, "copyright", NULL); break; case TIFF_DATE: ADD_METADATA(VAR_3, "date", NULL); break; case TIFF_DOCUMENT_NAME: ADD_METADATA(VAR_3, "document_name", NULL); break; case TIFF_HOST_COMPUTER: ADD_METADATA(VAR_3, "computer", NULL); break; case TIFF_IMAGE_DESCRIPTION: ADD_METADATA(VAR_3, "description", NULL); break; case TIFF_MAKE: ADD_METADATA(VAR_3, "make", NULL); break; case TIFF_MODEL: ADD_METADATA(VAR_3, "model", NULL); break; case TIFF_PAGE_NAME: ADD_METADATA(VAR_3, "page_name", NULL); break; case TIFF_PAGE_NUMBER: ADD_METADATA(VAR_3, "page_number", " / "); break; case TIFF_SOFTWARE_NAME: ADD_METADATA(VAR_3, "software", NULL); break; default: av_log(VAR_0->avctx, AV_LOG_DEBUG, "Unknown or unsupported VAR_1 %d/0X%0X\n", VAR_1, VAR_1); } bytestream2_seek(&VAR_0->gb, VAR_10, SEEK_SET); return 0; }
[ "static int FUNC_0(TiffContext *VAR_0)\n{", "unsigned VAR_1, VAR_2, VAR_3, VAR_4, VAR_5 = 0;", "int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;", "int VAR_11;", "uint32_t *pal;", "double *VAR_12;", "VAR_1 = tget_short(&VAR_0->gb, VAR_0->le);", "VAR_2 = tget_short(&VAR_0->gb, VAR_0->le);", "VAR_3 = tget_l...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45, 47, 49 ], [...
26,994
void av_log_default_callback(void *avcl, int level, const char *fmt, va_list vl) { static int print_prefix = 1; static int count; static char prev[1024]; char line[1024]; static int is_atty; AVClass* avc = avcl ? *(AVClass **) avcl : NULL; int tint = av_clip(level >> 8, 0, 256); level &= 0xff; if (level > av_log_level) return; line[0] = 0; if (print_prefix && avc) { if (avc->parent_log_context_offset) { AVClass** parent = *(AVClass ***) (((uint8_t *) avcl) + avc->parent_log_context_offset); if (parent && *parent) { snprintf(line, sizeof(line), "[%s @ %p] ", (*parent)->item_name(parent), parent); } } snprintf(line + strlen(line), sizeof(line) - strlen(line), "[%s @ %p] ", avc->item_name(avcl), avcl); } vsnprintf(line + strlen(line), sizeof(line) - strlen(line), fmt, vl); print_prefix = strlen(line) && line[strlen(line) - 1] == '\n'; #if HAVE_ISATTY if (!is_atty) is_atty = isatty(2) ? 1 : -1; #endif if (print_prefix && (flags & AV_LOG_SKIP_REPEATED) && !strncmp(line, prev, sizeof line)) { count++; if (is_atty == 1) fprintf(stderr, " Last message repeated %d times\r", count); return; } if (count > 0) { fprintf(stderr, " Last message repeated %d times\n", count); count = 0; } colored_fputs(av_clip(level >> 3, 0, 6), tint, line); av_strlcpy(prev, line, sizeof line); }
true
FFmpeg
28b9ac4e48f3405a82e8e87ead336188215cf1e6
void av_log_default_callback(void *avcl, int level, const char *fmt, va_list vl) { static int print_prefix = 1; static int count; static char prev[1024]; char line[1024]; static int is_atty; AVClass* avc = avcl ? *(AVClass **) avcl : NULL; int tint = av_clip(level >> 8, 0, 256); level &= 0xff; if (level > av_log_level) return; line[0] = 0; if (print_prefix && avc) { if (avc->parent_log_context_offset) { AVClass** parent = *(AVClass ***) (((uint8_t *) avcl) + avc->parent_log_context_offset); if (parent && *parent) { snprintf(line, sizeof(line), "[%s @ %p] ", (*parent)->item_name(parent), parent); } } snprintf(line + strlen(line), sizeof(line) - strlen(line), "[%s @ %p] ", avc->item_name(avcl), avcl); } vsnprintf(line + strlen(line), sizeof(line) - strlen(line), fmt, vl); print_prefix = strlen(line) && line[strlen(line) - 1] == '\n'; #if HAVE_ISATTY if (!is_atty) is_atty = isatty(2) ? 1 : -1; #endif if (print_prefix && (flags & AV_LOG_SKIP_REPEATED) && !strncmp(line, prev, sizeof line)) { count++; if (is_atty == 1) fprintf(stderr, " Last message repeated %d times\r", count); return; } if (count > 0) { fprintf(stderr, " Last message repeated %d times\n", count); count = 0; } colored_fputs(av_clip(level >> 3, 0, 6), tint, line); av_strlcpy(prev, line, sizeof line); }
{ "code": [ " int tint = av_clip(level >> 8, 0, 256);", " colored_fputs(av_clip(level >> 3, 0, 6), tint, line);" ], "line_no": [ 17, 97 ] }
void FUNC_0(void *VAR_0, int VAR_1, const char *VAR_2, va_list VAR_3) { static int VAR_4 = 1; static int VAR_5; static char VAR_6[1024]; char VAR_7[1024]; static int VAR_8; AVClass* avc = VAR_0 ? *(AVClass **) VAR_0 : NULL; int VAR_9 = av_clip(VAR_1 >> 8, 0, 256); VAR_1 &= 0xff; if (VAR_1 > av_log_level) return; VAR_7[0] = 0; if (VAR_4 && avc) { if (avc->parent_log_context_offset) { AVClass** parent = *(AVClass ***) (((uint8_t *) VAR_0) + avc->parent_log_context_offset); if (parent && *parent) { snprintf(VAR_7, sizeof(VAR_7), "[%s @ %p] ", (*parent)->item_name(parent), parent); } } snprintf(VAR_7 + strlen(VAR_7), sizeof(VAR_7) - strlen(VAR_7), "[%s @ %p] ", avc->item_name(VAR_0), VAR_0); } vsnprintf(VAR_7 + strlen(VAR_7), sizeof(VAR_7) - strlen(VAR_7), VAR_2, VAR_3); VAR_4 = strlen(VAR_7) && VAR_7[strlen(VAR_7) - 1] == '\n'; #if HAVE_ISATTY if (!VAR_8) VAR_8 = isatty(2) ? 1 : -1; #endif if (VAR_4 && (flags & AV_LOG_SKIP_REPEATED) && !strncmp(VAR_7, VAR_6, sizeof VAR_7)) { VAR_5++; if (VAR_8 == 1) fprintf(stderr, " Last message repeated %d times\r", VAR_5); return; } if (VAR_5 > 0) { fprintf(stderr, " Last message repeated %d times\n", VAR_5); VAR_5 = 0; } colored_fputs(av_clip(VAR_1 >> 3, 0, 6), VAR_9, VAR_7); av_strlcpy(VAR_6, VAR_7, sizeof VAR_7); }
[ "void FUNC_0(void *VAR_0, int VAR_1, const char *VAR_2, va_list VAR_3)\n{", "static int VAR_4 = 1;", "static int VAR_5;", "static char VAR_6[1024];", "char VAR_7[1024];", "static int VAR_8;", "AVClass* avc = VAR_0 ? *(AVClass **) VAR_0 : NULL;", "int VAR_9 = av_clip(VAR_1 >> 8, 0, 256);", "VAR_1 &= ...
[ 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, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [...
26,995
void block_job_completed(BlockJob *job, int ret) { BlockDriverState *bs = job->bs; assert(bs->job == job); job->cb(job->opaque, ret); bs->job = NULL; bdrv_op_unblock_all(bs, job->blocker); error_free(job->blocker); g_free(job); }
true
qemu
970311646a701eecb103eb28093e8924d2fa6861
void block_job_completed(BlockJob *job, int ret) { BlockDriverState *bs = job->bs; assert(bs->job == job); job->cb(job->opaque, ret); bs->job = NULL; bdrv_op_unblock_all(bs, job->blocker); error_free(job->blocker); g_free(job); }
{ "code": [ "void block_job_completed(BlockJob *job, int ret)", " BlockDriverState *bs = job->bs;", " assert(bs->job == job);", " job->cb(job->opaque, ret);" ], "line_no": [ 1, 5, 9, 11 ] }
void FUNC_0(BlockJob *VAR_0, int VAR_1) { BlockDriverState *bs = VAR_0->bs; assert(bs->VAR_0 == VAR_0); VAR_0->cb(VAR_0->opaque, VAR_1); bs->VAR_0 = NULL; bdrv_op_unblock_all(bs, VAR_0->blocker); error_free(VAR_0->blocker); g_free(VAR_0); }
[ "void FUNC_0(BlockJob *VAR_0, int VAR_1)\n{", "BlockDriverState *bs = VAR_0->bs;", "assert(bs->VAR_0 == VAR_0);", "VAR_0->cb(VAR_0->opaque, VAR_1);", "bs->VAR_0 = NULL;", "bdrv_op_unblock_all(bs, VAR_0->blocker);", "error_free(VAR_0->blocker);", "g_free(VAR_0);", "}" ]
[ 1, 1, 1, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
26,996
static void set_tco_timeout(const TestData *d, uint16_t ticks) { qpci_io_writew(d->dev, d->tco_io_base + TCO_TMR, ticks); }
true
qemu
b4ba67d9a702507793c2724e56f98e9b0f7be02b
static void set_tco_timeout(const TestData *d, uint16_t ticks) { qpci_io_writew(d->dev, d->tco_io_base + TCO_TMR, ticks); }
{ "code": [ " qpci_io_writew(d->dev, d->tco_io_base + TCO_TMR, ticks);" ], "line_no": [ 5 ] }
static void FUNC_0(const TestData *VAR_0, uint16_t VAR_1) { qpci_io_writew(VAR_0->dev, VAR_0->tco_io_base + TCO_TMR, VAR_1); }
[ "static void FUNC_0(const TestData *VAR_0, uint16_t VAR_1)\n{", "qpci_io_writew(VAR_0->dev, VAR_0->tco_io_base + TCO_TMR, VAR_1);", "}" ]
[ 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
26,998
int vnc_display_password(DisplayState *ds, const char *password) { VncDisplay *vs = ds ? (VncDisplay *)ds->opaque : vnc_display; if (!vs) { return -EINVAL; } if (!password) { /* This is not the intention of this interface but err on the side of being safe */ return vnc_display_disable_login(ds); } if (vs->password) { g_free(vs->password); vs->password = NULL; } vs->password = g_strdup(password); if (vs->auth == VNC_AUTH_NONE) { vs->auth = VNC_AUTH_VNC; } return 0; }
true
qemu
21ef45d71221b4577330fe3aacfb06afad91ad46
int vnc_display_password(DisplayState *ds, const char *password) { VncDisplay *vs = ds ? (VncDisplay *)ds->opaque : vnc_display; if (!vs) { return -EINVAL; } if (!password) { return vnc_display_disable_login(ds); } if (vs->password) { g_free(vs->password); vs->password = NULL; } vs->password = g_strdup(password); if (vs->auth == VNC_AUTH_NONE) { vs->auth = VNC_AUTH_VNC; } return 0; }
{ "code": [ " VncDisplay *vs = ds ? (VncDisplay *)ds->opaque : vnc_display;", " VncDisplay *vs = ds ? (VncDisplay *)ds->opaque : vnc_display;", " VncDisplay *vs = ds ? (VncDisplay *)ds->opaque : vnc_display;", " VncDisplay *vs = ds ? (VncDisplay *)ds->opaque : vnc_display;", " VncDisplay *vs = ds ? (VncDisplay *)ds->opaque : vnc_display;", " VncDisplay *vs = ds ? (VncDisplay *)ds->opaque : vnc_display;", " VncDisplay *vs = ds ? (VncDisplay *)ds->opaque : vnc_display;" ], "line_no": [ 5, 5, 5, 5, 5, 5, 5 ] }
int FUNC_0(DisplayState *VAR_0, const char *VAR_1) { VncDisplay *vs = VAR_0 ? (VncDisplay *)VAR_0->opaque : vnc_display; if (!vs) { return -EINVAL; } if (!VAR_1) { return vnc_display_disable_login(VAR_0); } if (vs->VAR_1) { g_free(vs->VAR_1); vs->VAR_1 = NULL; } vs->VAR_1 = g_strdup(VAR_1); if (vs->auth == VNC_AUTH_NONE) { vs->auth = VNC_AUTH_VNC; } return 0; }
[ "int FUNC_0(DisplayState *VAR_0, const char *VAR_1)\n{", "VncDisplay *vs = VAR_0 ? (VncDisplay *)VAR_0->opaque : vnc_display;", "if (!vs) {", "return -EINVAL;", "}", "if (!VAR_1) {", "return vnc_display_disable_login(VAR_0);", "}", "if (vs->VAR_1) {", "g_free(vs->VAR_1);", "vs->VAR_1 = NULL;", ...
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ] ]
26,999
static void data_plane_remove_op_blockers(VirtIOBlockDataPlane *s) { if (s->blocker) { blk_op_unblock_all(s->conf->conf.blk, s->blocker); error_free(s->blocker); s->blocker = NULL; } }
false
qemu
348295838384941d1e5420d10e57366c4e303d45
static void data_plane_remove_op_blockers(VirtIOBlockDataPlane *s) { if (s->blocker) { blk_op_unblock_all(s->conf->conf.blk, s->blocker); error_free(s->blocker); s->blocker = NULL; } }
{ "code": [], "line_no": [] }
static void FUNC_0(VirtIOBlockDataPlane *VAR_0) { if (VAR_0->blocker) { blk_op_unblock_all(VAR_0->conf->conf.blk, VAR_0->blocker); error_free(VAR_0->blocker); VAR_0->blocker = NULL; } }
[ "static void FUNC_0(VirtIOBlockDataPlane *VAR_0)\n{", "if (VAR_0->blocker) {", "blk_op_unblock_all(VAR_0->conf->conf.blk, VAR_0->blocker);", "error_free(VAR_0->blocker);", "VAR_0->blocker = NULL;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
27,001
static int no_run_in (HWVoiceIn *hw) { NoVoiceIn *no = (NoVoiceIn *) hw; int live = audio_pcm_hw_get_live_in (hw); int dead = hw->samples - live; int samples = 0; if (dead) { int64_t now = qemu_get_clock (vm_clock); int64_t ticks = now - no->old_ticks; int64_t bytes = muldiv64 (ticks, hw->info.bytes_per_second, get_ticks_per_sec ()); no->old_ticks = now; bytes = audio_MIN (bytes, INT_MAX); samples = bytes >> hw->info.shift; samples = audio_MIN (samples, dead); } return samples; }
false
qemu
74475455442398a64355428b37422d14ccc293cb
static int no_run_in (HWVoiceIn *hw) { NoVoiceIn *no = (NoVoiceIn *) hw; int live = audio_pcm_hw_get_live_in (hw); int dead = hw->samples - live; int samples = 0; if (dead) { int64_t now = qemu_get_clock (vm_clock); int64_t ticks = now - no->old_ticks; int64_t bytes = muldiv64 (ticks, hw->info.bytes_per_second, get_ticks_per_sec ()); no->old_ticks = now; bytes = audio_MIN (bytes, INT_MAX); samples = bytes >> hw->info.shift; samples = audio_MIN (samples, dead); } return samples; }
{ "code": [], "line_no": [] }
static int FUNC_0 (HWVoiceIn *VAR_0) { NoVoiceIn *no = (NoVoiceIn *) VAR_0; int VAR_1 = audio_pcm_hw_get_live_in (VAR_0); int VAR_2 = VAR_0->VAR_3 - VAR_1; int VAR_3 = 0; if (VAR_2) { int64_t now = qemu_get_clock (vm_clock); int64_t ticks = now - no->old_ticks; int64_t bytes = muldiv64 (ticks, VAR_0->info.bytes_per_second, get_ticks_per_sec ()); no->old_ticks = now; bytes = audio_MIN (bytes, INT_MAX); VAR_3 = bytes >> VAR_0->info.shift; VAR_3 = audio_MIN (VAR_3, VAR_2); } return VAR_3; }
[ "static int FUNC_0 (HWVoiceIn *VAR_0)\n{", "NoVoiceIn *no = (NoVoiceIn *) VAR_0;", "int VAR_1 = audio_pcm_hw_get_live_in (VAR_0);", "int VAR_2 = VAR_0->VAR_3 - VAR_1;", "int VAR_3 = 0;", "if (VAR_2) {", "int64_t now = qemu_get_clock (vm_clock);", "int64_t ticks = now - no->old_ticks;", "int64_t byte...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ] ]
27,002
int vfio_region_setup(Object *obj, VFIODevice *vbasedev, VFIORegion *region, int index, const char *name) { struct vfio_region_info *info; int ret; ret = vfio_get_region_info(vbasedev, index, &info); if (ret) { return ret; } region->vbasedev = vbasedev; region->flags = info->flags; region->size = info->size; region->fd_offset = info->offset; region->nr = index; if (region->size) { region->mem = g_new0(MemoryRegion, 1); memory_region_init_io(region->mem, obj, &vfio_region_ops, region, name, region->size); if (!vbasedev->no_mmap && region->flags & VFIO_REGION_INFO_FLAG_MMAP && !(region->size & ~qemu_real_host_page_mask)) { ret = vfio_setup_region_sparse_mmaps(region, info); if (ret) { region->nr_mmaps = 1; region->mmaps = g_new0(VFIOMmap, region->nr_mmaps); region->mmaps[0].offset = 0; region->mmaps[0].size = region->size; } } } g_free(info); trace_vfio_region_setup(vbasedev->name, index, name, region->flags, region->fd_offset, region->size); return 0; }
false
qemu
95251725e335af2b885e2ab33dd29c86f8084663
int vfio_region_setup(Object *obj, VFIODevice *vbasedev, VFIORegion *region, int index, const char *name) { struct vfio_region_info *info; int ret; ret = vfio_get_region_info(vbasedev, index, &info); if (ret) { return ret; } region->vbasedev = vbasedev; region->flags = info->flags; region->size = info->size; region->fd_offset = info->offset; region->nr = index; if (region->size) { region->mem = g_new0(MemoryRegion, 1); memory_region_init_io(region->mem, obj, &vfio_region_ops, region, name, region->size); if (!vbasedev->no_mmap && region->flags & VFIO_REGION_INFO_FLAG_MMAP && !(region->size & ~qemu_real_host_page_mask)) { ret = vfio_setup_region_sparse_mmaps(region, info); if (ret) { region->nr_mmaps = 1; region->mmaps = g_new0(VFIOMmap, region->nr_mmaps); region->mmaps[0].offset = 0; region->mmaps[0].size = region->size; } } } g_free(info); trace_vfio_region_setup(vbasedev->name, index, name, region->flags, region->fd_offset, region->size); return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(Object *VAR_0, VFIODevice *VAR_1, VFIORegion *VAR_2, int VAR_3, const char *VAR_4) { struct vfio_region_info *VAR_5; int VAR_6; VAR_6 = vfio_get_region_info(VAR_1, VAR_3, &VAR_5); if (VAR_6) { return VAR_6; } VAR_2->VAR_1 = VAR_1; VAR_2->flags = VAR_5->flags; VAR_2->size = VAR_5->size; VAR_2->fd_offset = VAR_5->offset; VAR_2->nr = VAR_3; if (VAR_2->size) { VAR_2->mem = g_new0(MemoryRegion, 1); memory_region_init_io(VAR_2->mem, VAR_0, &vfio_region_ops, VAR_2, VAR_4, VAR_2->size); if (!VAR_1->no_mmap && VAR_2->flags & VFIO_REGION_INFO_FLAG_MMAP && !(VAR_2->size & ~qemu_real_host_page_mask)) { VAR_6 = vfio_setup_region_sparse_mmaps(VAR_2, VAR_5); if (VAR_6) { VAR_2->nr_mmaps = 1; VAR_2->mmaps = g_new0(VFIOMmap, VAR_2->nr_mmaps); VAR_2->mmaps[0].offset = 0; VAR_2->mmaps[0].size = VAR_2->size; } } } g_free(VAR_5); trace_vfio_region_setup(VAR_1->VAR_4, VAR_3, VAR_4, VAR_2->flags, VAR_2->fd_offset, VAR_2->size); return 0; }
[ "int FUNC_0(Object *VAR_0, VFIODevice *VAR_1, VFIORegion *VAR_2,\nint VAR_3, const char *VAR_4)\n{", "struct vfio_region_info *VAR_5;", "int VAR_6;", "VAR_6 = vfio_get_region_info(VAR_1, VAR_3, &VAR_5);", "if (VAR_6) {", "return VAR_6;", "}", "VAR_2->VAR_1 = VAR_1;", "VAR_2->flags = VAR_5->flags;", ...
[ 0, 0, 0, 0, 0, 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 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 45, 47, 49 ], [ 53 ], [ 57 ...
27,003
static ssize_t nbd_co_send_reply(NBDRequestData *req, NBDReply *reply, int len) { NBDClient *client = req->client; ssize_t rc, ret; g_assert(qemu_in_coroutine()); qemu_co_mutex_lock(&client->send_lock); client->send_coroutine = qemu_coroutine_self(); if (!len) { rc = nbd_send_reply(client->ioc, reply); } else { qio_channel_set_cork(client->ioc, true); rc = nbd_send_reply(client->ioc, reply); if (rc >= 0) { ret = write_sync(client->ioc, req->data, len, NULL); if (ret < 0) { rc = -EIO; } } qio_channel_set_cork(client->ioc, false); } client->send_coroutine = NULL; qemu_co_mutex_unlock(&client->send_lock); return rc; }
false
qemu
d1fdf257d52822695f5ace6c586e059aa17d4b79
static ssize_t nbd_co_send_reply(NBDRequestData *req, NBDReply *reply, int len) { NBDClient *client = req->client; ssize_t rc, ret; g_assert(qemu_in_coroutine()); qemu_co_mutex_lock(&client->send_lock); client->send_coroutine = qemu_coroutine_self(); if (!len) { rc = nbd_send_reply(client->ioc, reply); } else { qio_channel_set_cork(client->ioc, true); rc = nbd_send_reply(client->ioc, reply); if (rc >= 0) { ret = write_sync(client->ioc, req->data, len, NULL); if (ret < 0) { rc = -EIO; } } qio_channel_set_cork(client->ioc, false); } client->send_coroutine = NULL; qemu_co_mutex_unlock(&client->send_lock); return rc; }
{ "code": [], "line_no": [] }
static ssize_t FUNC_0(NBDRequestData *req, NBDReply *reply, int len) { NBDClient *client = req->client; ssize_t rc, ret; g_assert(qemu_in_coroutine()); qemu_co_mutex_lock(&client->send_lock); client->send_coroutine = qemu_coroutine_self(); if (!len) { rc = nbd_send_reply(client->ioc, reply); } else { qio_channel_set_cork(client->ioc, true); rc = nbd_send_reply(client->ioc, reply); if (rc >= 0) { ret = write_sync(client->ioc, req->data, len, NULL); if (ret < 0) { rc = -EIO; } } qio_channel_set_cork(client->ioc, false); } client->send_coroutine = NULL; qemu_co_mutex_unlock(&client->send_lock); return rc; }
[ "static ssize_t FUNC_0(NBDRequestData *req, NBDReply *reply,\nint len)\n{", "NBDClient *client = req->client;", "ssize_t rc, ret;", "g_assert(qemu_in_coroutine());", "qemu_co_mutex_lock(&client->send_lock);", "client->send_coroutine = qemu_coroutine_self();", "if (!len) {", "rc = nbd_send_reply(client...
[ 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 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [...
27,004
static void kzm_init(MachineState *machine) { IMX31KZM *s = g_new0(IMX31KZM, 1); unsigned int ram_size; unsigned int alias_offset; unsigned int i; object_initialize(&s->soc, sizeof(s->soc), TYPE_FSL_IMX31); object_property_add_child(OBJECT(machine), "soc", OBJECT(&s->soc), &error_abort); object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_fatal); /* Check the amount of memory is compatible with the SOC */ if (machine->ram_size > (FSL_IMX31_SDRAM0_SIZE + FSL_IMX31_SDRAM1_SIZE)) { error_report("WARNING: RAM size " RAM_ADDR_FMT " above max supported, " "reduced to %x", machine->ram_size, FSL_IMX31_SDRAM0_SIZE + FSL_IMX31_SDRAM1_SIZE); machine->ram_size = FSL_IMX31_SDRAM0_SIZE + FSL_IMX31_SDRAM1_SIZE; } memory_region_allocate_system_memory(&s->ram, NULL, "kzm.ram", machine->ram_size); memory_region_add_subregion(get_system_memory(), FSL_IMX31_SDRAM0_ADDR, &s->ram); /* initialize the alias memory if any */ for (i = 0, ram_size = machine->ram_size, alias_offset = 0; (i < 2) && ram_size; i++) { unsigned int size; static const struct { hwaddr addr; unsigned int size; } ram[2] = { { FSL_IMX31_SDRAM0_ADDR, FSL_IMX31_SDRAM0_SIZE }, { FSL_IMX31_SDRAM1_ADDR, FSL_IMX31_SDRAM1_SIZE }, }; size = MIN(ram_size, ram[i].size); ram_size -= size; if (size < ram[i].size) { memory_region_init_alias(&s->ram_alias, NULL, "ram.alias", &s->ram, alias_offset, ram[i].size - size); memory_region_add_subregion(get_system_memory(), ram[i].addr + size, &s->ram_alias); } alias_offset += ram[i].size; } if (nd_table[0].used) { lan9118_init(&nd_table[0], KZM_LAN9118_ADDR, qdev_get_gpio_in(DEVICE(&s->soc.avic), 52)); } if (serial_hds[2]) { /* touchscreen */ serial_mm_init(get_system_memory(), KZM_FPGA_ADDR+0x10, 0, qdev_get_gpio_in(DEVICE(&s->soc.avic), 52), 14745600, serial_hds[2], DEVICE_NATIVE_ENDIAN); } kzm_binfo.ram_size = machine->ram_size; kzm_binfo.kernel_filename = machine->kernel_filename; kzm_binfo.kernel_cmdline = machine->kernel_cmdline; kzm_binfo.initrd_filename = machine->initrd_filename; kzm_binfo.nb_cpus = 1; if (!qtest_enabled()) { arm_load_kernel(&s->soc.cpu, &kzm_binfo); } }
false
qemu
3dc6f8693694a649a9c83f1e2746565b47683923
static void kzm_init(MachineState *machine) { IMX31KZM *s = g_new0(IMX31KZM, 1); unsigned int ram_size; unsigned int alias_offset; unsigned int i; object_initialize(&s->soc, sizeof(s->soc), TYPE_FSL_IMX31); object_property_add_child(OBJECT(machine), "soc", OBJECT(&s->soc), &error_abort); object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_fatal); if (machine->ram_size > (FSL_IMX31_SDRAM0_SIZE + FSL_IMX31_SDRAM1_SIZE)) { error_report("WARNING: RAM size " RAM_ADDR_FMT " above max supported, " "reduced to %x", machine->ram_size, FSL_IMX31_SDRAM0_SIZE + FSL_IMX31_SDRAM1_SIZE); machine->ram_size = FSL_IMX31_SDRAM0_SIZE + FSL_IMX31_SDRAM1_SIZE; } memory_region_allocate_system_memory(&s->ram, NULL, "kzm.ram", machine->ram_size); memory_region_add_subregion(get_system_memory(), FSL_IMX31_SDRAM0_ADDR, &s->ram); for (i = 0, ram_size = machine->ram_size, alias_offset = 0; (i < 2) && ram_size; i++) { unsigned int size; static const struct { hwaddr addr; unsigned int size; } ram[2] = { { FSL_IMX31_SDRAM0_ADDR, FSL_IMX31_SDRAM0_SIZE }, { FSL_IMX31_SDRAM1_ADDR, FSL_IMX31_SDRAM1_SIZE }, }; size = MIN(ram_size, ram[i].size); ram_size -= size; if (size < ram[i].size) { memory_region_init_alias(&s->ram_alias, NULL, "ram.alias", &s->ram, alias_offset, ram[i].size - size); memory_region_add_subregion(get_system_memory(), ram[i].addr + size, &s->ram_alias); } alias_offset += ram[i].size; } if (nd_table[0].used) { lan9118_init(&nd_table[0], KZM_LAN9118_ADDR, qdev_get_gpio_in(DEVICE(&s->soc.avic), 52)); } if (serial_hds[2]) { serial_mm_init(get_system_memory(), KZM_FPGA_ADDR+0x10, 0, qdev_get_gpio_in(DEVICE(&s->soc.avic), 52), 14745600, serial_hds[2], DEVICE_NATIVE_ENDIAN); } kzm_binfo.ram_size = machine->ram_size; kzm_binfo.kernel_filename = machine->kernel_filename; kzm_binfo.kernel_cmdline = machine->kernel_cmdline; kzm_binfo.initrd_filename = machine->initrd_filename; kzm_binfo.nb_cpus = 1; if (!qtest_enabled()) { arm_load_kernel(&s->soc.cpu, &kzm_binfo); } }
{ "code": [], "line_no": [] }
static void FUNC_0(MachineState *VAR_0) { IMX31KZM *s = g_new0(IMX31KZM, 1); unsigned int VAR_1; unsigned int VAR_2; unsigned int VAR_3; object_initialize(&s->soc, sizeof(s->soc), TYPE_FSL_IMX31); object_property_add_child(OBJECT(VAR_0), "soc", OBJECT(&s->soc), &error_abort); object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_fatal); if (VAR_0->VAR_1 > (FSL_IMX31_SDRAM0_SIZE + FSL_IMX31_SDRAM1_SIZE)) { error_report("WARNING: RAM VAR_4 " RAM_ADDR_FMT " above max supported, " "reduced to %x", VAR_0->VAR_1, FSL_IMX31_SDRAM0_SIZE + FSL_IMX31_SDRAM1_SIZE); VAR_0->VAR_1 = FSL_IMX31_SDRAM0_SIZE + FSL_IMX31_SDRAM1_SIZE; } memory_region_allocate_system_memory(&s->VAR_5, NULL, "kzm.VAR_5", VAR_0->VAR_1); memory_region_add_subregion(get_system_memory(), FSL_IMX31_SDRAM0_ADDR, &s->VAR_5); for (VAR_3 = 0, VAR_1 = VAR_0->VAR_1, VAR_2 = 0; (VAR_3 < 2) && VAR_1; VAR_3++) { unsigned int VAR_4; static const struct { hwaddr addr; unsigned int VAR_4; } VAR_5[2] = { { FSL_IMX31_SDRAM0_ADDR, FSL_IMX31_SDRAM0_SIZE }, { FSL_IMX31_SDRAM1_ADDR, FSL_IMX31_SDRAM1_SIZE }, }; VAR_4 = MIN(VAR_1, VAR_5[VAR_3].VAR_4); VAR_1 -= VAR_4; if (VAR_4 < VAR_5[VAR_3].VAR_4) { memory_region_init_alias(&s->ram_alias, NULL, "VAR_5.alias", &s->VAR_5, VAR_2, VAR_5[VAR_3].VAR_4 - VAR_4); memory_region_add_subregion(get_system_memory(), VAR_5[VAR_3].addr + VAR_4, &s->ram_alias); } VAR_2 += VAR_5[VAR_3].VAR_4; } if (nd_table[0].used) { lan9118_init(&nd_table[0], KZM_LAN9118_ADDR, qdev_get_gpio_in(DEVICE(&s->soc.avic), 52)); } if (serial_hds[2]) { serial_mm_init(get_system_memory(), KZM_FPGA_ADDR+0x10, 0, qdev_get_gpio_in(DEVICE(&s->soc.avic), 52), 14745600, serial_hds[2], DEVICE_NATIVE_ENDIAN); } kzm_binfo.VAR_1 = VAR_0->VAR_1; kzm_binfo.kernel_filename = VAR_0->kernel_filename; kzm_binfo.kernel_cmdline = VAR_0->kernel_cmdline; kzm_binfo.initrd_filename = VAR_0->initrd_filename; kzm_binfo.nb_cpus = 1; if (!qtest_enabled()) { arm_load_kernel(&s->soc.cpu, &kzm_binfo); } }
[ "static void FUNC_0(MachineState *VAR_0)\n{", "IMX31KZM *s = g_new0(IMX31KZM, 1);", "unsigned int VAR_1;", "unsigned int VAR_2;", "unsigned int VAR_3;", "object_initialize(&s->soc, sizeof(s->soc), TYPE_FSL_IMX31);", "object_property_add_child(OBJECT(VAR_0), \"soc\", OBJECT(&s->soc),\n&error_abort);", ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 19 ], [ 23 ], [ 29 ], [ 31, 33, 35 ], [ 37 ], [ 39 ], [ 43, 45 ], [ 47, 49 ], [ 55 ], [ 57 ], [ 59 ], [...