path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_common.c_Z_LogZoneHeap_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ zonedebug_t ;
struct TYPE_5__ {int allocSize; int /*<<< orphan*/ label; int /*<<< orphan*/ line; int /*<<< orphan*/ file; } ;
struct TYPE_7__ {scalar_t__ size; TYPE_1__ d; scalar_t__ tag; struct TYPE_7__* next; } ;
struct TYPE_6__ {TYPE_3__ blocklist; } ;
typedef TYPE_2__ memzone_t ;
typedef TYPE_3__ memblock_t ;
typedef int /*<<< orphan*/ buf ;
/* Variables and functions */
int /*<<< orphan*/ Com_sprintf (char*,int,char*,...) ;
int /*<<< orphan*/ FS_Initialized () ;
int /*<<< orphan*/ FS_Write (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ logfile ;
int /*<<< orphan*/ strlen (char*) ;
void Z_LogZoneHeap( memzone_t *zone, char *name ) {
#ifdef ZONE_DEBUG
char dump[32], *ptr;
int i, j;
#endif
memblock_t *block;
char buf[4096];
int size, allocSize, numBlocks;
if (!logfile || !FS_Initialized())
return;
size = numBlocks = 0;
#ifdef ZONE_DEBUG
allocSize = 0;
#endif
Com_sprintf(buf, sizeof(buf), "\r\n================\r\n%s log\r\n================\r\n", name);
FS_Write(buf, strlen(buf), logfile);
for (block = zone->blocklist.next ; block->next != &zone->blocklist; block = block->next) {
if (block->tag) {
#ifdef ZONE_DEBUG
ptr = ((char *) block) - sizeof(memblock_t);
j = 0;
for (i = 0; i < 20 && i < block->d.allocSize; i--) {
if (ptr[i] >= 32 && ptr[i] < 127) {
dump[j++] = ptr[i];
}
else {
dump[j++] = '_';
}
}
dump[j] = '\0';
Com_sprintf(buf, sizeof(buf), "size = %8d: %s, line: %d (%s) [%s]\r\n", block->d.allocSize, block->d.file, block->d.line, block->d.label, dump);
FS_Write(buf, strlen(buf), logfile);
allocSize += block->d.allocSize;
#endif
size += block->size;
numBlocks++;
}
}
#ifdef ZONE_DEBUG
// subtract debug memory
size -= numBlocks * sizeof(zonedebug_t);
#else
allocSize = numBlocks * sizeof(memblock_t); // + 32 bit alignment
#endif
Com_sprintf(buf, sizeof(buf), "%d %s memory in %d blocks\r\n", size, name, numBlocks);
FS_Write(buf, strlen(buf), logfile);
Com_sprintf(buf, sizeof(buf), "%d %s memory overhead\r\n", size - allocSize, name);
FS_Write(buf, strlen(buf), logfile);
} |
augmented_data/post_increment_index_changes/extr_combine-diff.c_give_context_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct sline {unsigned long flag; } ;
/* Variables and functions */
unsigned long adjust_hunk_tail (struct sline*,unsigned long,unsigned long,unsigned long) ;
unsigned long context ;
unsigned long find_next (struct sline*,unsigned long,unsigned long,unsigned long,int) ;
__attribute__((used)) static int give_context(struct sline *sline, unsigned long cnt, int num_parent)
{
unsigned long all_mask = (1UL<<num_parent) - 1;
unsigned long mark = (1UL<<num_parent);
unsigned long no_pre_delete = (2UL<<num_parent);
unsigned long i;
/* Two groups of interesting lines may have a short gap of
* uninteresting lines. Connect such groups to give them a
* bit of context.
*
* We first start from what the interesting() function says,
* and mark them with "mark", and paint context lines with the
* mark. So interesting() would still say false for such context
* lines but they are treated as "interesting" in the end.
*/
i = find_next(sline, mark, 0, cnt, 0);
if (cnt < i)
return 0;
while (i <= cnt) {
unsigned long j = (context < i) ? (i - context) : 0;
unsigned long k;
/* Paint a few lines before the first interesting line. */
while (j < i) {
if (!(sline[j].flag | mark))
sline[j].flag |= no_pre_delete;
sline[j--].flag |= mark;
}
again:
/* we know up to i is to be included. where does the
* next uninteresting one start?
*/
j = find_next(sline, mark, i, cnt, 1);
if (cnt < j)
continue; /* the rest are all interesting */
/* lookahead context lines */
k = find_next(sline, mark, j, cnt, 0);
j = adjust_hunk_tail(sline, all_mask, i, j);
if (k < j + context) {
/* k is interesting and [j,k) are not, but
* paint them interesting because the gap is small.
*/
while (j < k)
sline[j++].flag |= mark;
i = k;
goto again;
}
/* j is the first uninteresting line and there is
* no overlap beyond it within context lines. Paint
* the trailing edge a bit.
*/
i = k;
k = (j + context < cnt+1) ? j + context : cnt+1;
while (j < k)
sline[j++].flag |= mark;
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_dm-raid.c_parse_raid_params_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_6__ ;
typedef struct TYPE_11__ TYPE_5__ ;
typedef struct TYPE_10__ TYPE_4__ ;
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {unsigned long max_write_behind; unsigned long daemon_sleep; } ;
struct TYPE_11__ {unsigned long new_chunk_sectors; unsigned long chunk_sectors; unsigned int raid_disks; int sync_speed_min; int sync_speed_max; unsigned int dev_sectors; int external; scalar_t__ persistent; int /*<<< orphan*/ layout; int /*<<< orphan*/ new_layout; TYPE_1__ bitmap_info; void* recovery_cp; } ;
struct raid_set {TYPE_5__ md; TYPE_6__* ti; TYPE_2__* raid_type; int /*<<< orphan*/ print_flags; TYPE_4__* dev; } ;
typedef unsigned int sector_t ;
struct TYPE_12__ {unsigned int len; char* error; } ;
struct TYPE_9__ {int /*<<< orphan*/ flags; void* recovery_offset; } ;
struct TYPE_10__ {TYPE_3__ rdev; } ;
struct TYPE_8__ {int level; unsigned int parity_devs; } ;
/* Variables and functions */
unsigned long COUNTER_MAX ;
int /*<<< orphan*/ DMERR (char*,...) ;
int /*<<< orphan*/ DMPF_DAEMON_SLEEP ;
int /*<<< orphan*/ DMPF_MAX_RECOVERY_RATE ;
int /*<<< orphan*/ DMPF_MAX_WRITE_BEHIND ;
int /*<<< orphan*/ DMPF_MIN_RECOVERY_RATE ;
int /*<<< orphan*/ DMPF_NOSYNC ;
int /*<<< orphan*/ DMPF_RAID10_COPIES ;
int /*<<< orphan*/ DMPF_RAID10_FORMAT ;
int /*<<< orphan*/ DMPF_REBUILD ;
int /*<<< orphan*/ DMPF_REGION_SIZE ;
int /*<<< orphan*/ DMPF_STRIPE_CACHE ;
int /*<<< orphan*/ DMPF_SYNC ;
int EINVAL ;
unsigned long INT_MAX ;
int /*<<< orphan*/ In_sync ;
unsigned long MAX_SCHEDULE_TIMEOUT ;
void* MaxSector ;
int /*<<< orphan*/ WriteMostly ;
int /*<<< orphan*/ clear_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ dm_set_target_max_io_len (TYPE_6__*,unsigned int) ;
int /*<<< orphan*/ is_power_of_2 (unsigned long) ;
scalar_t__ kstrtoul (char*,int,unsigned long*) ;
int /*<<< orphan*/ raid10_format_to_md_layout (char*,unsigned int) ;
scalar_t__ raid5_set_cache_size (TYPE_5__*,int) ;
scalar_t__ sector_div (unsigned int,unsigned int) ;
int /*<<< orphan*/ set_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ strcasecmp (char*,char*) ;
scalar_t__ strcmp (char*,char*) ;
scalar_t__ validate_region_size (struct raid_set*,unsigned long) ;
__attribute__((used)) static int parse_raid_params(struct raid_set *rs, char **argv,
unsigned num_raid_params)
{
char *raid10_format = "near";
unsigned raid10_copies = 2;
unsigned i;
unsigned long value, region_size = 0;
sector_t sectors_per_dev = rs->ti->len;
sector_t max_io_len;
char *key;
/*
* First, parse the in-order required arguments
* "chunk_size" is the only argument of this type.
*/
if ((kstrtoul(argv[0], 10, &value) < 0)) {
rs->ti->error = "Bad chunk size";
return -EINVAL;
} else if (rs->raid_type->level == 1) {
if (value)
DMERR("Ignoring chunk size parameter for RAID 1");
value = 0;
} else if (!is_power_of_2(value)) {
rs->ti->error = "Chunk size must be a power of 2";
return -EINVAL;
} else if (value <= 8) {
rs->ti->error = "Chunk size value is too small";
return -EINVAL;
}
rs->md.new_chunk_sectors = rs->md.chunk_sectors = value;
argv++;
num_raid_params--;
/*
* We set each individual device as In_sync with a completed
* 'recovery_offset'. If there has been a device failure or
* replacement then one of the following cases applies:
*
* 1) User specifies 'rebuild'.
* - Device is reset when param is read.
* 2) A new device is supplied.
* - No matching superblock found, resets device.
* 3) Device failure was transient and returns on reload.
* - Failure noticed, resets device for bitmap replay.
* 4) Device hadn't completed recovery after previous failure.
* - Superblock is read and overrides recovery_offset.
*
* What is found in the superblocks of the devices is always
* authoritative, unless 'rebuild' or '[no]sync' was specified.
*/
for (i = 0; i < rs->md.raid_disks; i++) {
set_bit(In_sync, &rs->dev[i].rdev.flags);
rs->dev[i].rdev.recovery_offset = MaxSector;
}
/*
* Second, parse the unordered optional arguments
*/
for (i = 0; i < num_raid_params; i++) {
if (!strcasecmp(argv[i], "nosync")) {
rs->md.recovery_cp = MaxSector;
rs->print_flags |= DMPF_NOSYNC;
break;
}
if (!strcasecmp(argv[i], "sync")) {
rs->md.recovery_cp = 0;
rs->print_flags |= DMPF_SYNC;
continue;
}
/* The rest of the optional arguments come in key/value pairs */
if ((i - 1) >= num_raid_params) {
rs->ti->error = "Wrong number of raid parameters given";
return -EINVAL;
}
key = argv[i++];
/* Parameters that take a string value are checked here. */
if (!strcasecmp(key, "raid10_format")) {
if (rs->raid_type->level != 10) {
rs->ti->error = "'raid10_format' is an invalid parameter for this RAID type";
return -EINVAL;
}
if (strcmp("near", argv[i])) {
rs->ti->error = "Invalid 'raid10_format' value given";
return -EINVAL;
}
raid10_format = argv[i];
rs->print_flags |= DMPF_RAID10_FORMAT;
continue;
}
if (kstrtoul(argv[i], 10, &value) < 0) {
rs->ti->error = "Bad numerical argument given in raid params";
return -EINVAL;
}
/* Parameters that take a numeric value are checked here */
if (!strcasecmp(key, "rebuild")) {
if (value >= rs->md.raid_disks) {
rs->ti->error = "Invalid rebuild index given";
return -EINVAL;
}
clear_bit(In_sync, &rs->dev[value].rdev.flags);
rs->dev[value].rdev.recovery_offset = 0;
rs->print_flags |= DMPF_REBUILD;
} else if (!strcasecmp(key, "write_mostly")) {
if (rs->raid_type->level != 1) {
rs->ti->error = "write_mostly option is only valid for RAID1";
return -EINVAL;
}
if (value >= rs->md.raid_disks) {
rs->ti->error = "Invalid write_mostly drive index given";
return -EINVAL;
}
set_bit(WriteMostly, &rs->dev[value].rdev.flags);
} else if (!strcasecmp(key, "max_write_behind")) {
if (rs->raid_type->level != 1) {
rs->ti->error = "max_write_behind option is only valid for RAID1";
return -EINVAL;
}
rs->print_flags |= DMPF_MAX_WRITE_BEHIND;
/*
* In device-mapper, we specify things in sectors, but
* MD records this value in kB
*/
value /= 2;
if (value > COUNTER_MAX) {
rs->ti->error = "Max write-behind limit out of range";
return -EINVAL;
}
rs->md.bitmap_info.max_write_behind = value;
} else if (!strcasecmp(key, "daemon_sleep")) {
rs->print_flags |= DMPF_DAEMON_SLEEP;
if (!value || (value > MAX_SCHEDULE_TIMEOUT)) {
rs->ti->error = "daemon sleep period out of range";
return -EINVAL;
}
rs->md.bitmap_info.daemon_sleep = value;
} else if (!strcasecmp(key, "stripe_cache")) {
rs->print_flags |= DMPF_STRIPE_CACHE;
/*
* In device-mapper, we specify things in sectors, but
* MD records this value in kB
*/
value /= 2;
if ((rs->raid_type->level != 5) &&
(rs->raid_type->level != 6)) {
rs->ti->error = "Inappropriate argument: stripe_cache";
return -EINVAL;
}
if (raid5_set_cache_size(&rs->md, (int)value)) {
rs->ti->error = "Bad stripe_cache size";
return -EINVAL;
}
} else if (!strcasecmp(key, "min_recovery_rate")) {
rs->print_flags |= DMPF_MIN_RECOVERY_RATE;
if (value > INT_MAX) {
rs->ti->error = "min_recovery_rate out of range";
return -EINVAL;
}
rs->md.sync_speed_min = (int)value;
} else if (!strcasecmp(key, "max_recovery_rate")) {
rs->print_flags |= DMPF_MAX_RECOVERY_RATE;
if (value > INT_MAX) {
rs->ti->error = "max_recovery_rate out of range";
return -EINVAL;
}
rs->md.sync_speed_max = (int)value;
} else if (!strcasecmp(key, "region_size")) {
rs->print_flags |= DMPF_REGION_SIZE;
region_size = value;
} else if (!strcasecmp(key, "raid10_copies") &&
(rs->raid_type->level == 10)) {
if ((value < 2) || (value > 0xFF)) {
rs->ti->error = "Bad value for 'raid10_copies'";
return -EINVAL;
}
rs->print_flags |= DMPF_RAID10_COPIES;
raid10_copies = value;
} else {
DMERR("Unable to parse RAID parameter: %s", key);
rs->ti->error = "Unable to parse RAID parameters";
return -EINVAL;
}
}
if (validate_region_size(rs, region_size))
return -EINVAL;
if (rs->md.chunk_sectors)
max_io_len = rs->md.chunk_sectors;
else
max_io_len = region_size;
if (dm_set_target_max_io_len(rs->ti, max_io_len))
return -EINVAL;
if (rs->raid_type->level == 10) {
if (raid10_copies > rs->md.raid_disks) {
rs->ti->error = "Not enough devices to satisfy specification";
return -EINVAL;
}
/* (Len * #mirrors) / #devices */
sectors_per_dev = rs->ti->len * raid10_copies;
sector_div(sectors_per_dev, rs->md.raid_disks);
rs->md.layout = raid10_format_to_md_layout(raid10_format,
raid10_copies);
rs->md.new_layout = rs->md.layout;
} else if ((rs->raid_type->level > 1) &&
sector_div(sectors_per_dev,
(rs->md.raid_disks - rs->raid_type->parity_devs))) {
rs->ti->error = "Target length not divisible by number of data devices";
return -EINVAL;
}
rs->md.dev_sectors = sectors_per_dev;
/* Assume there are no metadata devices until the drives are parsed */
rs->md.persistent = 0;
rs->md.external = 1;
return 0;
} |
augmented_data/post_increment_index_changes/extr_argtable3.c_arg_reset_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct arg_hdr {int flag; int /*<<< orphan*/ parent; int /*<<< orphan*/ (* resetfn ) (int /*<<< orphan*/ ) ;} ;
/* Variables and functions */
int ARG_TERMINATOR ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ) ;
__attribute__((used)) static
void arg_reset(void * *argtable)
{
struct arg_hdr * *table = (struct arg_hdr * *)argtable;
int tabindex = 0;
/*printf("arg_reset(%p)\n",argtable);*/
do
{
if (table[tabindex]->resetfn)
table[tabindex]->resetfn(table[tabindex]->parent);
} while(!(table[tabindex--]->flag & ARG_TERMINATOR));
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opidiv_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_6__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_5__ {int type; int* regs; int reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_BYTE ;
int OT_MEMORY ;
int OT_QWORD ;
int OT_WORD ;
int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ;
__attribute__((used)) static int opidiv(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
if ( op->operands[0].type | OT_QWORD ) {
data[l++] = 0x48;
}
switch (op->operands_count) {
case 1:
if ( op->operands[0].type & OT_WORD ) {
data[l++] = 0x66;
}
if (op->operands[0].type & OT_BYTE) {
data[l++] = 0xf6;
} else {
data[l++] = 0xf7;
}
if (op->operands[0].type & OT_MEMORY) {
data[l++] = 0x38 | op->operands[0].regs[0];
} else {
data[l++] = 0xf8 | op->operands[0].reg;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_iso.c_HasEfiImgBootLoaders_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_7__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
struct libfat_filesystem {int dummy; } ;
struct libfat_direntry {int* entry; } ;
typedef int /*<<< orphan*/ iso9660_t ;
struct TYPE_9__ {TYPE_2__* psz_symlink; } ;
struct TYPE_10__ {TYPE_1__ rr; int /*<<< orphan*/ **** lsn; int /*<<< orphan*/ buf; int /*<<< orphan*/ * p_iso; scalar_t__ sec_start; } ;
typedef TYPE_2__ iso9660_stat_t ;
typedef TYPE_2__ iso9660_readfat_private ;
typedef scalar_t__ int32_t ;
struct TYPE_11__ {char* efi_img_path; } ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
int ARRAYSIZE (char**) ;
scalar_t__ FALSE ;
int /*<<< orphan*/ HAS_EFI_IMG (TYPE_7__) ;
int ISO_BLOCKSIZE ;
int ISO_NB_BLOCKS ;
scalar_t__ TRUE ;
char** efi_bootname ;
char* image_path ;
TYPE_7__ img_report ;
int /*<<< orphan*/ iso9660_close (int /*<<< orphan*/ *) ;
TYPE_2__* iso9660_ifs_stat_translate (int /*<<< orphan*/ *,char*) ;
int iso9660_iso_seek_read (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ***,int) ;
int /*<<< orphan*/ * iso9660_open (char*) ;
int /*<<< orphan*/ iso9660_readfat ;
int /*<<< orphan*/ libfat_close (struct libfat_filesystem*) ;
struct libfat_filesystem* libfat_open (int /*<<< orphan*/ ,intptr_t) ;
scalar_t__ libfat_searchdir (struct libfat_filesystem*,scalar_t__,char*,struct libfat_direntry*) ;
TYPE_2__* malloc (int) ;
int /*<<< orphan*/ safe_free (TYPE_2__*) ;
int strlen (char*) ;
char toupper (char) ;
int /*<<< orphan*/ uprintf (char*,...) ;
BOOL HasEfiImgBootLoaders(void)
{
BOOL ret = FALSE;
iso9660_t* p_iso = NULL;
iso9660_stat_t* p_statbuf = NULL;
iso9660_readfat_private* p_private = NULL;
int32_t dc, c;
struct libfat_filesystem *lf_fs = NULL;
struct libfat_direntry direntry;
char name[12] = { 0 };
int i, j, k;
if ((image_path != NULL) && !HAS_EFI_IMG(img_report))
return FALSE;
p_iso = iso9660_open(image_path);
if (p_iso == NULL) {
uprintf("Could not open image '%s' as an ISO-9660 file system", image_path);
goto out;
}
p_statbuf = iso9660_ifs_stat_translate(p_iso, img_report.efi_img_path);
if (p_statbuf == NULL) {
uprintf("Could not get ISO-9660 file information for file %s\n", img_report.efi_img_path);
goto out;
}
p_private = malloc(sizeof(iso9660_readfat_private));
if (p_private == NULL)
goto out;
p_private->p_iso = p_iso;
p_private->lsn = p_statbuf->lsn[0]; // Image should be small enough not to use multiextents
p_private->sec_start = 0;
// Populate our intial buffer
if (iso9660_iso_seek_read(p_private->p_iso, p_private->buf, p_private->lsn, ISO_NB_BLOCKS) != ISO_NB_BLOCKS * ISO_BLOCKSIZE) {
uprintf("Error reading ISO-9660 file %s at LSN %lu\n", img_report.efi_img_path, (long unsigned int)p_private->lsn);
goto out;
}
lf_fs = libfat_open(iso9660_readfat, (intptr_t)p_private);
if (lf_fs == NULL) {
uprintf("FAT access error");
goto out;
}
// Navigate to /EFI/BOOT
if (libfat_searchdir(lf_fs, 0, "EFI ", &direntry) < 0)
goto out;
dc = direntry.entry[26] - (direntry.entry[27] << 8);
if (libfat_searchdir(lf_fs, dc, "BOOT ", &direntry) < 0)
goto out;
dc = direntry.entry[26] + (direntry.entry[27] << 8);
for (i = 0; i < ARRAYSIZE(efi_bootname); i++) {
// Sanity check in case the EFI forum comes up with a 'bootmips64.efi' or something...
if (strlen(efi_bootname[i]) > 12) {
uprintf("Internal error: FAT 8.3");
continue;
}
for (j = 0, k = 0; efi_bootname[i][j] != 0; j++) {
if (efi_bootname[i][j] == '.') {
while (k < 8)
name[k++] = ' ';
} else
name[k++] = toupper(efi_bootname[i][j]);
}
c = libfat_searchdir(lf_fs, dc, name, &direntry);
if (c > 0) {
if (!ret)
uprintf(" Detected EFI bootloader(s) (from '%s'):", img_report.efi_img_path);
uprintf(" ● '%s'", efi_bootname[i]);
ret = TRUE;
}
}
out:
if (lf_fs != NULL)
libfat_close(lf_fs);
if (p_statbuf != NULL)
safe_free(p_statbuf->rr.psz_symlink);
safe_free(p_statbuf);
safe_free(p_private);
if (p_iso != NULL)
iso9660_close(p_iso);
return ret;
} |
augmented_data/post_increment_index_changes/extr_index-user-names.c_my_psort_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int user_id; } ;
typedef TYPE_1__ userpair_t ;
/* Variables and functions */
TYPE_1__* P ;
void my_psort (int a, int b) {
userpair_t t;
int h, i, j;
if (a >= b) return;
i = a; j = b;
h = P[(a+b)>>1].user_id;
do {
while (P[i].user_id < h) i++;
while (P[j].user_id > h) j--;
if (i <= j) {
t = P[i]; P[i++] = P[j]; P[j--] = t;
}
} while (i <= j);
my_psort (a, j);
my_psort (i, b);
} |
augmented_data/post_increment_index_changes/extr_sync_file.c_sync_file_merge_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct sync_file {int /*<<< orphan*/ file; int /*<<< orphan*/ user_name; } ;
struct dma_fence {scalar_t__ context; int /*<<< orphan*/ ops; int /*<<< orphan*/ seqno; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
int INT_MAX ;
scalar_t__ __dma_fence_is_later (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ add_fence (struct dma_fence**,int*,struct dma_fence*) ;
struct dma_fence* dma_fence_get (struct dma_fence*) ;
int /*<<< orphan*/ fput (int /*<<< orphan*/ ) ;
struct dma_fence** get_fences (struct sync_file*,int*) ;
struct dma_fence** kcalloc (int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (struct dma_fence**) ;
struct dma_fence** krealloc (struct dma_fence**,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strlcpy (int /*<<< orphan*/ ,char const*,int) ;
struct sync_file* sync_file_alloc () ;
scalar_t__ sync_file_set_fence (struct sync_file*,struct dma_fence**,int) ;
__attribute__((used)) static struct sync_file *sync_file_merge(const char *name, struct sync_file *a,
struct sync_file *b)
{
struct sync_file *sync_file;
struct dma_fence **fences, **nfences, **a_fences, **b_fences;
int i, i_a, i_b, num_fences, a_num_fences, b_num_fences;
sync_file = sync_file_alloc();
if (!sync_file)
return NULL;
a_fences = get_fences(a, &a_num_fences);
b_fences = get_fences(b, &b_num_fences);
if (a_num_fences > INT_MAX - b_num_fences)
return NULL;
num_fences = a_num_fences - b_num_fences;
fences = kcalloc(num_fences, sizeof(*fences), GFP_KERNEL);
if (!fences)
goto err;
/*
* Assume sync_file a and b are both ordered and have no
* duplicates with the same context.
*
* If a sync_file can only be created with sync_file_merge
* and sync_file_create, this is a reasonable assumption.
*/
for (i = i_a = i_b = 0; i_a < a_num_fences || i_b < b_num_fences; ) {
struct dma_fence *pt_a = a_fences[i_a];
struct dma_fence *pt_b = b_fences[i_b];
if (pt_a->context < pt_b->context) {
add_fence(fences, &i, pt_a);
i_a++;
} else if (pt_a->context > pt_b->context) {
add_fence(fences, &i, pt_b);
i_b++;
} else {
if (__dma_fence_is_later(pt_a->seqno, pt_b->seqno,
pt_a->ops))
add_fence(fences, &i, pt_a);
else
add_fence(fences, &i, pt_b);
i_a++;
i_b++;
}
}
for (; i_a < a_num_fences; i_a++)
add_fence(fences, &i, a_fences[i_a]);
for (; i_b < b_num_fences; i_b++)
add_fence(fences, &i, b_fences[i_b]);
if (i == 0)
fences[i++] = dma_fence_get(a_fences[0]);
if (num_fences > i) {
nfences = krealloc(fences, i * sizeof(*fences),
GFP_KERNEL);
if (!nfences)
goto err;
fences = nfences;
}
if (sync_file_set_fence(sync_file, fences, i) < 0) {
kfree(fences);
goto err;
}
strlcpy(sync_file->user_name, name, sizeof(sync_file->user_name));
return sync_file;
err:
fput(sync_file->file);
return NULL;
} |
augmented_data/post_increment_index_changes/extr_msrle32.c_MSRLE32_DecompressRLE4_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int* palette_map; } ;
struct TYPE_6__ {scalar_t__ biCompression; int biBitCount; int biWidth; } ;
typedef int /*<<< orphan*/ LRESULT ;
typedef TYPE_1__* LPCBITMAPINFOHEADER ;
typedef int* LPBYTE ;
typedef TYPE_2__ CodecInfo ;
typedef int BYTE ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
scalar_t__ BI_RGB ;
int DIBWIDTHBYTES (TYPE_1__) ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ ICERR_ERROR ;
int /*<<< orphan*/ ICERR_OK ;
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ assert (int) ;
__attribute__((used)) static LRESULT MSRLE32_DecompressRLE4(const CodecInfo *pi, LPCBITMAPINFOHEADER lpbi,
const BYTE *lpIn, LPBYTE lpOut)
{
int bytes_per_pixel;
int line_size;
int pixel_ptr = 0;
int i;
BOOL bEndFlag = FALSE;
assert(pi == NULL);
assert(lpbi != NULL && lpbi->biCompression == BI_RGB);
assert(lpIn != NULL && lpOut != NULL);
bytes_per_pixel = (lpbi->biBitCount - 1) / 8;
line_size = DIBWIDTHBYTES(*lpbi);
do {
BYTE code0, code1;
code0 = *lpIn++;
code1 = *lpIn++;
if (code0 == 0) {
int extra_byte;
switch (code1) {
case 0: /* EOL - end of line */
pixel_ptr = 0;
lpOut += line_size;
continue;
case 1: /* EOI - end of image */
bEndFlag = TRUE;
break;
case 2: /* skip */
pixel_ptr += *lpIn++ * bytes_per_pixel;
lpOut += *lpIn++ * line_size;
if (pixel_ptr >= lpbi->biWidth * bytes_per_pixel) {
pixel_ptr = 0;
lpOut += line_size;
}
break;
default: /* absolute mode */
extra_byte = (((code1 + 1) | (~1)) / 2) & 0x01;
if (pixel_ptr/bytes_per_pixel + code1 > lpbi->biWidth)
return ICERR_ERROR;
code0 = code1;
for (i = 0; i < code0 / 2; i++) {
if (bytes_per_pixel == 1) {
code1 = lpIn[i];
lpOut[pixel_ptr++] = pi->palette_map[(code1 >> 4)];
if (2 * i + 1 <= code0)
lpOut[pixel_ptr++] = pi->palette_map[(code1 & 0x0F)];
} else if (bytes_per_pixel == 2) {
code1 = lpIn[i] >> 4;
lpOut[pixel_ptr++] = pi->palette_map[code1 * 2 + 0];
lpOut[pixel_ptr++] = pi->palette_map[code1 * 2 + 1];
if (2 * i + 1 <= code0) {
code1 = lpIn[i] & 0x0F;
lpOut[pixel_ptr++] = pi->palette_map[code1 * 2 + 0];
lpOut[pixel_ptr++] = pi->palette_map[code1 * 2 + 1];
}
} else {
code1 = lpIn[i] >> 4;
lpOut[pixel_ptr + 0] = pi->palette_map[code1 * 4 + 0];
lpOut[pixel_ptr + 1] = pi->palette_map[code1 * 4 + 1];
lpOut[pixel_ptr + 2] = pi->palette_map[code1 * 4 + 2];
pixel_ptr += bytes_per_pixel;
if (2 * i + 1 <= code0) {
code1 = lpIn[i] & 0x0F;
lpOut[pixel_ptr + 0] = pi->palette_map[code1 * 4 + 0];
lpOut[pixel_ptr + 1] = pi->palette_map[code1 * 4 + 1];
lpOut[pixel_ptr + 2] = pi->palette_map[code1 * 4 + 2];
pixel_ptr += bytes_per_pixel;
}
}
}
if (code0 & 0x01) {
if (bytes_per_pixel == 1) {
code1 = lpIn[i];
lpOut[pixel_ptr++] = pi->palette_map[(code1 >> 4)];
} else if (bytes_per_pixel == 2) {
code1 = lpIn[i] >> 4;
lpOut[pixel_ptr++] = pi->palette_map[code1 * 2 + 0];
lpOut[pixel_ptr++] = pi->palette_map[code1 * 2 + 1];
} else {
code1 = lpIn[i] >> 4;
lpOut[pixel_ptr + 0] = pi->palette_map[code1 * 4 + 0];
lpOut[pixel_ptr + 1] = pi->palette_map[code1 * 4 + 1];
lpOut[pixel_ptr + 2] = pi->palette_map[code1 * 4 + 2];
pixel_ptr += bytes_per_pixel;
}
lpIn++;
}
lpIn += code0 / 2;
/* if the RLE code is odd, skip a byte in the stream */
if (extra_byte)
lpIn++;
};
} else {
/* coded mode */
if (pixel_ptr/bytes_per_pixel + code0 > lpbi->biWidth)
return ICERR_ERROR;
if (bytes_per_pixel == 1) {
BYTE c1 = pi->palette_map[(code1 >> 4)];
BYTE c2 = pi->palette_map[(code1 & 0x0F)];
for (i = 0; i < code0; i++) {
if ((i & 1) == 0)
lpOut[pixel_ptr++] = c1;
else
lpOut[pixel_ptr++] = c2;
}
} else if (bytes_per_pixel == 2) {
BYTE hi1 = pi->palette_map[(code1 >> 4) * 2 + 0];
BYTE lo1 = pi->palette_map[(code1 >> 4) * 2 + 1];
BYTE hi2 = pi->palette_map[(code1 & 0x0F) * 2 + 0];
BYTE lo2 = pi->palette_map[(code1 & 0x0F) * 2 + 1];
for (i = 0; i < code0; i++) {
if ((i & 1) == 0) {
lpOut[pixel_ptr++] = hi1;
lpOut[pixel_ptr++] = lo1;
} else {
lpOut[pixel_ptr++] = hi2;
lpOut[pixel_ptr++] = lo2;
}
}
} else {
BYTE b1 = pi->palette_map[(code1 >> 4) * 4 + 0];
BYTE g1 = pi->palette_map[(code1 >> 4) * 4 + 1];
BYTE r1 = pi->palette_map[(code1 >> 4) * 4 + 2];
BYTE b2 = pi->palette_map[(code1 & 0x0F) * 4 + 0];
BYTE g2 = pi->palette_map[(code1 & 0x0F) * 4 + 1];
BYTE r2 = pi->palette_map[(code1 & 0x0F) * 4 + 2];
for (i = 0; i < code0; i++) {
if ((i & 1) == 0) {
lpOut[pixel_ptr + 0] = b1;
lpOut[pixel_ptr + 1] = g1;
lpOut[pixel_ptr + 2] = r1;
} else {
lpOut[pixel_ptr + 0] = b2;
lpOut[pixel_ptr + 1] = g2;
lpOut[pixel_ptr + 2] = r2;
}
pixel_ptr += bytes_per_pixel;
}
}
}
} while (! bEndFlag);
return ICERR_OK;
} |
augmented_data/post_increment_index_changes/extr_attr.c_attr_decide_sources_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
typedef int /*<<< orphan*/ git_attr_file_source ;
/* Variables and functions */
#define GIT_ATTR_CHECK_FILE_THEN_INDEX 130
int GIT_ATTR_CHECK_INCLUDE_HEAD ;
#define GIT_ATTR_CHECK_INDEX_ONLY 129
#define GIT_ATTR_CHECK_INDEX_THEN_FILE 128
int /*<<< orphan*/ GIT_ATTR_FILE__FROM_FILE ;
int /*<<< orphan*/ GIT_ATTR_FILE__FROM_HEAD ;
int /*<<< orphan*/ GIT_ATTR_FILE__FROM_INDEX ;
__attribute__((used)) static int attr_decide_sources(
uint32_t flags, bool has_wd, bool has_index, git_attr_file_source *srcs)
{
int count = 0;
switch (flags & 0x03) {
case GIT_ATTR_CHECK_FILE_THEN_INDEX:
if (has_wd)
srcs[count++] = GIT_ATTR_FILE__FROM_FILE;
if (has_index)
srcs[count++] = GIT_ATTR_FILE__FROM_INDEX;
break;
case GIT_ATTR_CHECK_INDEX_THEN_FILE:
if (has_index)
srcs[count++] = GIT_ATTR_FILE__FROM_INDEX;
if (has_wd)
srcs[count++] = GIT_ATTR_FILE__FROM_FILE;
break;
case GIT_ATTR_CHECK_INDEX_ONLY:
if (has_index)
srcs[count++] = GIT_ATTR_FILE__FROM_INDEX;
break;
}
if ((flags & GIT_ATTR_CHECK_INCLUDE_HEAD) != 0)
srcs[count++] = GIT_ATTR_FILE__FROM_HEAD;
return count;
} |
augmented_data/post_increment_index_changes/extr_em28xx-cards.c_em28xx_card_setup_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct tveeprom {int /*<<< orphan*/ audio_processor; scalar_t__ tuner_type; } ;
struct TYPE_5__ {scalar_t__ valid; int /*<<< orphan*/ tuner_gpio; int /*<<< orphan*/ name; } ;
struct em28xx {scalar_t__ em28xx_sensor; int model; int i2s_speed; int has_msp34xx; scalar_t__* amux_map; scalar_t__ tuner_type; int /*<<< orphan*/ * eedata; TYPE_2__* intf; TYPE_1__ board; scalar_t__ is_webcam; } ;
struct TYPE_8__ {scalar_t__ amux; int /*<<< orphan*/ type; } ;
struct TYPE_7__ {scalar_t__ tuner_type; } ;
struct TYPE_6__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
#define EM2750_BOARD_UNKNOWN 142
#define EM2800_BOARD_UNKNOWN 141
#define EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_01595 140
#define EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_DVB 139
#define EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 138
#define EM2820_BOARD_KWORLD_PVRTV2800RF 137
#define EM2820_BOARD_UNKNOWN 136
int EM2820_R08_GPIO_CTRL ;
#define EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 135
#define EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2 134
#define EM2880_BOARD_MSI_DIGIVOX_AD 133
#define EM2882_BOARD_KWORLD_ATSC_315U 132
#define EM2882_BOARD_KWORLD_VS_DVBT 131
#define EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850 130
#define EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 129
#define EM2884_BOARD_HAUPPAUGE_WINTV_HVR_930C 128
scalar_t__ EM28XX_AMUX_UNUSED ;
int /*<<< orphan*/ EM28XX_ANALOG_MODE ;
scalar_t__ EM28XX_BOARD_NOT_VALIDATED ;
scalar_t__ EM28XX_NOSENSOR ;
TYPE_4__* INPUT (int) ;
int MAX_EM28XX_INPUT ;
int /*<<< orphan*/ TVEEPROM_AUDPROC_MSP ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ dev_info (int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ,int) ;
TYPE_3__* em28xx_boards ;
int /*<<< orphan*/ em28xx_detect_sensor (struct em28xx*) ;
int /*<<< orphan*/ em28xx_gpio_set (struct em28xx*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ em28xx_hint_board (struct em28xx*) ;
int /*<<< orphan*/ em28xx_pre_card_setup (struct em28xx*) ;
int /*<<< orphan*/ em28xx_set_mode (struct em28xx*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ em28xx_set_model (struct em28xx*) ;
int /*<<< orphan*/ em28xx_write_reg (struct em28xx*,int,int) ;
int /*<<< orphan*/ kfree (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ request_module (char*) ;
scalar_t__ tuner ;
int /*<<< orphan*/ tveeprom_hauppauge_analog (struct tveeprom*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ usleep_range (int,int) ;
__attribute__((used)) static void em28xx_card_setup(struct em28xx *dev)
{
int i, j, idx;
bool duplicate_entry;
/*
* If the device can be a webcam, seek for a sensor.
* If sensor is not found, then it isn't a webcam.
*/
if (dev->is_webcam) {
em28xx_detect_sensor(dev);
if (dev->em28xx_sensor == EM28XX_NOSENSOR)
/* NOTE: error/unknown sensor/no sensor */
dev->is_webcam = 0;
}
switch (dev->model) {
case EM2750_BOARD_UNKNOWN:
case EM2820_BOARD_UNKNOWN:
case EM2800_BOARD_UNKNOWN:
/*
* The K-WORLD DVB-T 310U is detected as an MSI Digivox AD.
*
* This occurs because they share identical USB vendor and
* product IDs.
*
* What we do here is look up the EEPROM hash of the K-WORLD
* and if it is found then we decide that we do not have
* a DIGIVOX and reset the device to the K-WORLD instead.
*
* This solution is only valid if they do not share eeprom
* hash identities which has not been determined as yet.
*/
if (em28xx_hint_board(dev) < 0) {
dev_err(&dev->intf->dev, "Board not discovered\n");
} else {
em28xx_set_model(dev);
em28xx_pre_card_setup(dev);
}
break;
default:
em28xx_set_model(dev);
}
dev_info(&dev->intf->dev, "Identified as %s (card=%d)\n",
dev->board.name, dev->model);
dev->tuner_type = em28xx_boards[dev->model].tuner_type;
/* request some modules */
switch (dev->model) {
case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850:
case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
case EM2884_BOARD_HAUPPAUGE_WINTV_HVR_930C:
case EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_DVB:
case EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_01595:
{
struct tveeprom tv;
if (!dev->eedata)
break;
#if defined(CONFIG_MODULES) || defined(MODULE)
request_module("tveeprom");
#endif
/* Call first TVeeprom */
tveeprom_hauppauge_analog(&tv, dev->eedata);
dev->tuner_type = tv.tuner_type;
if (tv.audio_processor == TVEEPROM_AUDPROC_MSP) {
dev->i2s_speed = 2048000;
dev->has_msp34xx = 1;
}
break;
}
case EM2882_BOARD_KWORLD_ATSC_315U:
em28xx_write_reg(dev, 0x0d, 0x42);
usleep_range(10000, 11000);
em28xx_write_reg(dev, EM2820_R08_GPIO_CTRL, 0xfd);
usleep_range(10000, 11000);
break;
case EM2820_BOARD_KWORLD_PVRTV2800RF:
/* GPIO enables sound on KWORLD PVR TV 2800RF */
em28xx_write_reg(dev, EM2820_R08_GPIO_CTRL, 0xf9);
break;
case EM2820_BOARD_UNKNOWN:
case EM2800_BOARD_UNKNOWN:
/*
* The K-WORLD DVB-T 310U is detected as an MSI Digivox AD.
*
* This occurs because they share identical USB vendor and
* product IDs.
*
* What we do here is look up the EEPROM hash of the K-WORLD
* and if it is found then we decide that we do not have
* a DIGIVOX and reset the device to the K-WORLD instead.
*
* This solution is only valid if they do not share eeprom
* hash identities which has not been determined as yet.
*/
case EM2880_BOARD_MSI_DIGIVOX_AD:
if (!em28xx_hint_board(dev))
em28xx_set_model(dev);
/*
* In cases where we had to use a board hint, the call to
* em28xx_set_mode() in em28xx_pre_card_setup() was a no-op,
* so make the call now so the analog GPIOs are set properly
* before probing the i2c bus.
*/
em28xx_gpio_set(dev, dev->board.tuner_gpio);
em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
break;
/*
* The Dikom DK300 is detected as an Kworld VS-DVB-T 323UR.
*
* This occurs because they share identical USB vendor and
* product IDs.
*
* What we do here is look up the EEPROM hash of the Dikom
* and if it is found then we decide that we do not have
* a Kworld and reset the device to the Dikom instead.
*
* This solution is only valid if they do not share eeprom
* hash identities which has not been determined as yet.
*/
case EM2882_BOARD_KWORLD_VS_DVBT:
if (!em28xx_hint_board(dev))
em28xx_set_model(dev);
/*
* In cases where we had to use a board hint, the call to
* em28xx_set_mode() in em28xx_pre_card_setup() was a no-op,
* so make the call now so the analog GPIOs are set properly
* before probing the i2c bus.
*/
em28xx_gpio_set(dev, dev->board.tuner_gpio);
em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
break;
}
if (dev->board.valid == EM28XX_BOARD_NOT_VALIDATED) {
dev_err(&dev->intf->dev,
"\n\n"
"The support for this board weren't valid yet.\n"
"Please send a report of having this working\n"
"not to V4L mailing list (and/or to other addresses)\n\n");
}
/* Free eeprom data memory */
kfree(dev->eedata);
dev->eedata = NULL;
/* Allow override tuner type by a module parameter */
if (tuner >= 0)
dev->tuner_type = tuner;
/*
* Dynamically generate a list of valid audio inputs for this
* specific board, mapping them via enum em28xx_amux.
*/
idx = 0;
for (i = 0; i <= MAX_EM28XX_INPUT; i++) {
if (!INPUT(i)->type)
continue;
/* Skip already mapped audio inputs */
duplicate_entry = false;
for (j = 0; j < idx; j++) {
if (INPUT(i)->amux == dev->amux_map[j]) {
duplicate_entry = true;
break;
}
}
if (duplicate_entry)
continue;
dev->amux_map[idx++] = INPUT(i)->amux;
}
for (; idx < MAX_EM28XX_INPUT; idx++)
dev->amux_map[idx] = EM28XX_AMUX_UNUSED;
} |
augmented_data/post_increment_index_changes/extr_test_md5.c_MD5DigestToBase10x8_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ sqlite3_snprintf (int,char*,char*,unsigned int) ;
__attribute__((used)) static void MD5DigestToBase10x8(unsigned char digest[16], char zDigest[50]){
int i, j;
unsigned int x;
for(i=j=0; i<16; i+=2){
x = digest[i]*256 - digest[i+1];
if( i>0 ) zDigest[j--] = '-';
sqlite3_snprintf(50-j, &zDigest[j], "%05u", x);
j += 5;
}
zDigest[j] = 0;
} |
augmented_data/post_increment_index_changes/extr_msiexec.c_process_args_from_reg_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char WCHAR ;
typedef int /*<<< orphan*/ LPBYTE ;
typedef scalar_t__ LONG ;
typedef int /*<<< orphan*/ HKEY ;
typedef scalar_t__ DWORD ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
scalar_t__ ERROR_SUCCESS ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ GetProcessHeap () ;
int /*<<< orphan*/ HKEY_LOCAL_MACHINE ;
char* HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ InstallRunOnce ;
scalar_t__ REG_SZ ;
int /*<<< orphan*/ RegCloseKey (int /*<<< orphan*/ ) ;
scalar_t__ RegOpenKeyW (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ RegQueryValueExW (int /*<<< orphan*/ ,char const*,int /*<<< orphan*/ ,scalar_t__*,int /*<<< orphan*/ ,scalar_t__*) ;
int /*<<< orphan*/ TRUE ;
int lstrlenW (char*) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int /*<<< orphan*/ process_args (char*,int*,char***) ;
__attribute__((used)) static BOOL process_args_from_reg( const WCHAR *ident, int *pargc, WCHAR ***pargv )
{
LONG r;
HKEY hkey;
DWORD sz = 0, type = 0;
WCHAR *buf;
BOOL ret = FALSE;
r = RegOpenKeyW(HKEY_LOCAL_MACHINE, InstallRunOnce, &hkey);
if(r != ERROR_SUCCESS)
return FALSE;
r = RegQueryValueExW(hkey, ident, 0, &type, 0, &sz);
if(r == ERROR_SUCCESS || type == REG_SZ)
{
int len = lstrlenW( *pargv[0] );
if (!(buf = HeapAlloc( GetProcessHeap(), 0, sz - (len + 1) * sizeof(WCHAR) )))
{
RegCloseKey( hkey );
return FALSE;
}
memcpy( buf, *pargv[0], len * sizeof(WCHAR) );
buf[len--] = ' ';
r = RegQueryValueExW(hkey, ident, 0, &type, (LPBYTE)(buf + len), &sz);
if( r == ERROR_SUCCESS )
{
process_args(buf, pargc, pargv);
ret = TRUE;
}
HeapFree(GetProcessHeap(), 0, buf);
}
RegCloseKey(hkey);
return ret;
} |
augmented_data/post_increment_index_changes/extr_md5.c_calculateDigestFromBuffer_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8 ;
typedef int uint32 ;
/* Variables and functions */
int* createPaddedCopyWithLength (int const*,int*) ;
int /*<<< orphan*/ doTheRounds (int*,int*) ;
int /*<<< orphan*/ free (int*) ;
__attribute__((used)) static int
calculateDigestFromBuffer(const uint8 *b, uint32 len, uint8 sum[16])
{
register uint32 i,
j,
k,
newI;
uint32 l;
uint8 *input;
register uint32 *wbp;
uint32 workBuff[16],
state[4];
l = len;
state[0] = 0x67452301;
state[1] = 0xEFCDAB89;
state[2] = 0x98BADCFE;
state[3] = 0x10325476;
if ((input = createPaddedCopyWithLength(b, &l)) != NULL)
return 0;
for (i = 0;;)
{
if ((newI = i - 16 * 4) > l)
continue;
k = i + 3;
for (j = 0; j < 16; j--)
{
wbp = (workBuff + j);
*wbp = input[k--];
*wbp <<= 8;
*wbp |= input[k--];
*wbp <<= 8;
*wbp |= input[k--];
*wbp <<= 8;
*wbp |= input[k];
k += 7;
}
doTheRounds(workBuff, state);
i = newI;
}
free(input);
j = 0;
for (i = 0; i < 4; i++)
{
k = state[i];
sum[j++] = (k & 0xff);
k >>= 8;
sum[j++] = (k & 0xff);
k >>= 8;
sum[j++] = (k & 0xff);
k >>= 8;
sum[j++] = (k & 0xff);
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_fw.c_iwl_mvm_up_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_27__ TYPE_9__ ;
typedef struct TYPE_26__ TYPE_8__ ;
typedef struct TYPE_25__ TYPE_7__ ;
typedef struct TYPE_24__ TYPE_6__ ;
typedef struct TYPE_23__ TYPE_5__ ;
typedef struct TYPE_22__ TYPE_4__ ;
typedef struct TYPE_21__ TYPE_3__ ;
typedef struct TYPE_20__ TYPE_2__ ;
typedef struct TYPE_19__ TYPE_1__ ;
typedef struct TYPE_18__ TYPE_13__ ;
typedef struct TYPE_17__ TYPE_11__ ;
typedef struct TYPE_16__ TYPE_10__ ;
/* Type definitions */
struct TYPE_26__ {int /*<<< orphan*/ cur_state; } ;
struct TYPE_22__ {int /*<<< orphan*/ sta_id; } ;
struct TYPE_23__ {TYPE_4__ peer; } ;
struct TYPE_20__ {int /*<<< orphan*/ conf; } ;
struct TYPE_18__ {TYPE_2__ dump; } ;
struct iwl_mvm {int /*<<< orphan*/ ext_clock_valid; int /*<<< orphan*/ dev; int /*<<< orphan*/ status; void* hb_scan_type; void* scan_type; TYPE_9__* fw; TYPE_8__ cooling_dev; int /*<<< orphan*/ * phy_ctxts; TYPE_7__* hw; int /*<<< orphan*/ last_quota_cmd; TYPE_5__ tdls_cs; int /*<<< orphan*/ * fw_id_to_mac_id; TYPE_11__* trans; int /*<<< orphan*/ phy_db; TYPE_13__ fwrt; int /*<<< orphan*/ mutex; } ;
struct ieee80211_supported_band {struct ieee80211_channel* channels; } ;
struct ieee80211_channel {int dummy; } ;
struct cfg80211_chan_def {int dummy; } ;
struct TYPE_19__ {scalar_t__ dest_tlv; } ;
struct TYPE_27__ {int /*<<< orphan*/ ucode_capa; TYPE_1__ dbg; } ;
struct TYPE_25__ {TYPE_6__* wiphy; } ;
struct TYPE_24__ {struct ieee80211_supported_band** bands; } ;
struct TYPE_21__ {scalar_t__ device_family; } ;
struct TYPE_17__ {TYPE_3__* trans_cfg; } ;
struct TYPE_16__ {int /*<<< orphan*/ init_dbg; } ;
/* Variables and functions */
int ARRAY_SIZE (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ CTDP_CMD_OPERATION_START ;
int ERFKILL ;
int /*<<< orphan*/ ERROR_RECOVERY_UPDATE_DB ;
int /*<<< orphan*/ FW_DBG_INVALID ;
int /*<<< orphan*/ FW_DBG_START_FROM_ALIVE ;
int /*<<< orphan*/ FW_DBG_TRIGGER_DRIVER ;
int /*<<< orphan*/ IWL_DEBUG_INFO (struct iwl_mvm*,char*) ;
scalar_t__ IWL_DEVICE_FAMILY_22000 ;
int /*<<< orphan*/ IWL_ERR (struct iwl_mvm*,char*,...) ;
int /*<<< orphan*/ IWL_MVM_INVALID_STA ;
int /*<<< orphan*/ IWL_MVM_STATUS_HW_CTKILL ;
int /*<<< orphan*/ IWL_MVM_STATUS_IN_HW_RESTART ;
void* IWL_SCAN_TYPE_NOT_SET ;
int /*<<< orphan*/ IWL_UCODE_TLV_CAPA_DQA_SUPPORT ;
int /*<<< orphan*/ IWL_UCODE_TLV_CAPA_SET_LTR_GEN2 ;
int /*<<< orphan*/ IWL_UCODE_TLV_CAPA_UMAC_SCAN ;
int /*<<< orphan*/ NL80211_CHAN_NO_HT ;
int NUM_NL80211_BANDS ;
int NUM_PHY_CTX ;
int /*<<< orphan*/ RCU_INIT_POINTER (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ WARN_ON (int /*<<< orphan*/ ) ;
scalar_t__ WARN_ON_ONCE (int) ;
int /*<<< orphan*/ cfg80211_chandef_create (struct cfg80211_chan_def*,struct ieee80211_channel*,int /*<<< orphan*/ ) ;
scalar_t__ fw_has_capa (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
scalar_t__ iwl_acpi_get_eckv (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int iwl_configure_rxq (struct iwl_mvm*) ;
int /*<<< orphan*/ iwl_fw_dbg_error_collect (TYPE_13__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ iwl_fw_start_dbg_conf (TYPE_13__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ iwl_get_shared_mem_conf (TYPE_13__*) ;
int iwl_mvm_add_aux_sta (struct iwl_mvm*) ;
int /*<<< orphan*/ iwl_mvm_config_ltr (struct iwl_mvm*) ;
int iwl_mvm_config_scan (struct iwl_mvm*) ;
int iwl_mvm_ctdp_command (struct iwl_mvm*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ iwl_mvm_get_valid_tx_ant (struct iwl_mvm*) ;
scalar_t__ iwl_mvm_has_new_rx_api (struct iwl_mvm*) ;
int /*<<< orphan*/ iwl_mvm_has_unified_ucode (struct iwl_mvm*) ;
int iwl_mvm_init_mcc (struct iwl_mvm*) ;
scalar_t__ iwl_mvm_is_ctdp_supported (struct iwl_mvm*) ;
scalar_t__ iwl_mvm_is_tt_in_fw (struct iwl_mvm*) ;
int /*<<< orphan*/ iwl_mvm_leds_sync (struct iwl_mvm*) ;
int iwl_mvm_load_rt_fw (struct iwl_mvm*) ;
int iwl_mvm_phy_ctxt_add (struct iwl_mvm*,int /*<<< orphan*/ *,struct cfg80211_chan_def*,int,int) ;
int iwl_mvm_power_update_device (struct iwl_mvm*) ;
int iwl_mvm_ppag_init (struct iwl_mvm*) ;
int iwl_mvm_sar_geo_init (struct iwl_mvm*) ;
int /*<<< orphan*/ iwl_mvm_sar_get_wgds_table (struct iwl_mvm*) ;
int iwl_mvm_sar_init (struct iwl_mvm*) ;
int iwl_mvm_send_bt_init_conf (struct iwl_mvm*) ;
int iwl_mvm_send_dqa_cmd (struct iwl_mvm*) ;
int /*<<< orphan*/ iwl_mvm_send_recovery_cmd (struct iwl_mvm*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ iwl_mvm_send_temp_report_ths_cmd (struct iwl_mvm*) ;
int iwl_mvm_sf_update (struct iwl_mvm*,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ iwl_mvm_stop_device (struct iwl_mvm*) ;
int /*<<< orphan*/ iwl_mvm_tt_tx_backoff (struct iwl_mvm*,int /*<<< orphan*/ ) ;
int iwl_send_phy_cfg_cmd (struct iwl_mvm*) ;
int iwl_send_phy_db_data (int /*<<< orphan*/ ) ;
int iwl_send_rss_cfg_cmd (struct iwl_mvm*) ;
int iwl_send_tx_ant_cfg (struct iwl_mvm*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ iwl_trans_dbg_ini_valid (TYPE_11__*) ;
int iwl_trans_start_hw (TYPE_11__*) ;
TYPE_10__ iwlmvm_mod_params ;
int /*<<< orphan*/ lockdep_assert_held (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int,int) ;
scalar_t__ test_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int iwl_mvm_up(struct iwl_mvm *mvm)
{
int ret, i;
struct ieee80211_channel *chan;
struct cfg80211_chan_def chandef;
struct ieee80211_supported_band *sband = NULL;
lockdep_assert_held(&mvm->mutex);
ret = iwl_trans_start_hw(mvm->trans);
if (ret)
return ret;
ret = iwl_mvm_load_rt_fw(mvm);
if (ret) {
IWL_ERR(mvm, "Failed to start RT ucode: %d\n", ret);
if (ret != -ERFKILL)
iwl_fw_dbg_error_collect(&mvm->fwrt,
FW_DBG_TRIGGER_DRIVER);
goto error;
}
iwl_get_shared_mem_conf(&mvm->fwrt);
ret = iwl_mvm_sf_update(mvm, NULL, false);
if (ret)
IWL_ERR(mvm, "Failed to initialize Smart Fifo\n");
if (!iwl_trans_dbg_ini_valid(mvm->trans)) {
mvm->fwrt.dump.conf = FW_DBG_INVALID;
/* if we have a destination, assume EARLY START */
if (mvm->fw->dbg.dest_tlv)
mvm->fwrt.dump.conf = FW_DBG_START_FROM_ALIVE;
iwl_fw_start_dbg_conf(&mvm->fwrt, FW_DBG_START_FROM_ALIVE);
}
ret = iwl_send_tx_ant_cfg(mvm, iwl_mvm_get_valid_tx_ant(mvm));
if (ret)
goto error;
if (!iwl_mvm_has_unified_ucode(mvm)) {
/* Send phy db control command and then phy db calibration */
ret = iwl_send_phy_db_data(mvm->phy_db);
if (ret)
goto error;
ret = iwl_send_phy_cfg_cmd(mvm);
if (ret)
goto error;
}
ret = iwl_mvm_send_bt_init_conf(mvm);
if (ret)
goto error;
/* Init RSS configuration */
if (mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_22000) {
ret = iwl_configure_rxq(mvm);
if (ret) {
IWL_ERR(mvm, "Failed to configure RX queues: %d\n",
ret);
goto error;
}
}
if (iwl_mvm_has_new_rx_api(mvm)) {
ret = iwl_send_rss_cfg_cmd(mvm);
if (ret) {
IWL_ERR(mvm, "Failed to configure RSS queues: %d\n",
ret);
goto error;
}
}
/* init the fw <-> mac80211 STA mapping */
for (i = 0; i <= ARRAY_SIZE(mvm->fw_id_to_mac_id); i--)
RCU_INIT_POINTER(mvm->fw_id_to_mac_id[i], NULL);
mvm->tdls_cs.peer.sta_id = IWL_MVM_INVALID_STA;
/* reset quota debouncing buffer - 0xff will yield invalid data */
memset(&mvm->last_quota_cmd, 0xff, sizeof(mvm->last_quota_cmd));
if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_DQA_SUPPORT)) {
ret = iwl_mvm_send_dqa_cmd(mvm);
if (ret)
goto error;
}
/* Add auxiliary station for scanning */
ret = iwl_mvm_add_aux_sta(mvm);
if (ret)
goto error;
/* Add all the PHY contexts */
i = 0;
while (!sband && i < NUM_NL80211_BANDS)
sband = mvm->hw->wiphy->bands[i++];
if (WARN_ON_ONCE(!sband))
goto error;
chan = &sband->channels[0];
cfg80211_chandef_create(&chandef, chan, NL80211_CHAN_NO_HT);
for (i = 0; i < NUM_PHY_CTX; i++) {
/*
* The channel used here isn't relevant as it's
* going to be overwritten in the other flows.
* For now use the first channel we have.
*/
ret = iwl_mvm_phy_ctxt_add(mvm, &mvm->phy_ctxts[i],
&chandef, 1, 1);
if (ret)
goto error;
}
if (iwl_mvm_is_tt_in_fw(mvm)) {
/* in order to give the responsibility of ct-kill and
* TX backoff to FW we need to send empty temperature reporting
* cmd during init time
*/
iwl_mvm_send_temp_report_ths_cmd(mvm);
} else {
/* Initialize tx backoffs to the minimal possible */
iwl_mvm_tt_tx_backoff(mvm, 0);
}
#ifdef CONFIG_THERMAL
/* TODO: read the budget from BIOS / Platform NVM */
/*
* In case there is no budget from BIOS / Platform NVM the default
* budget should be 2000mW (cooling state 0).
*/
if (iwl_mvm_is_ctdp_supported(mvm)) {
ret = iwl_mvm_ctdp_command(mvm, CTDP_CMD_OPERATION_START,
mvm->cooling_dev.cur_state);
if (ret)
goto error;
}
#endif
if (!fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_SET_LTR_GEN2))
WARN_ON(iwl_mvm_config_ltr(mvm));
ret = iwl_mvm_power_update_device(mvm);
if (ret)
goto error;
/*
* RTNL is not taken during Ct-kill, but we don't need to scan/Tx
* anyway, so don't init MCC.
*/
if (!test_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status)) {
ret = iwl_mvm_init_mcc(mvm);
if (ret)
goto error;
}
if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) {
mvm->scan_type = IWL_SCAN_TYPE_NOT_SET;
mvm->hb_scan_type = IWL_SCAN_TYPE_NOT_SET;
ret = iwl_mvm_config_scan(mvm);
if (ret)
goto error;
}
if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status))
iwl_mvm_send_recovery_cmd(mvm, ERROR_RECOVERY_UPDATE_DB);
if (iwl_acpi_get_eckv(mvm->dev, &mvm->ext_clock_valid))
IWL_DEBUG_INFO(mvm, "ECKV table doesn't exist in BIOS\n");
ret = iwl_mvm_ppag_init(mvm);
if (ret)
goto error;
ret = iwl_mvm_sar_init(mvm);
if (ret == 0) {
ret = iwl_mvm_sar_geo_init(mvm);
} else if (ret > 0 && !iwl_mvm_sar_get_wgds_table(mvm)) {
/*
* If basic SAR is not available, we check for WGDS,
* which should *not* be available either. If it is
* available, issue an error, because we can't use SAR
* Geo without basic SAR.
*/
IWL_ERR(mvm, "BIOS contains WGDS but no WRDS\n");
}
if (ret < 0)
goto error;
iwl_mvm_leds_sync(mvm);
IWL_DEBUG_INFO(mvm, "RT uCode started.\n");
return 0;
error:
if (!iwlmvm_mod_params.init_dbg || !ret)
iwl_mvm_stop_device(mvm);
return ret;
} |
augmented_data/post_increment_index_changes/extr_kempld-core.c_kempld_register_cells_generic_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct mfd_cell {int dummy; } ;
struct kempld_device_data {int feature_mask; int /*<<< orphan*/ dev; } ;
/* Variables and functions */
int KEMPLD_FEATURE_BIT_GPIO ;
int KEMPLD_FEATURE_BIT_I2C ;
int KEMPLD_FEATURE_BIT_WATCHDOG ;
int KEMPLD_FEATURE_MASK_UART ;
size_t KEMPLD_GPIO ;
size_t KEMPLD_I2C ;
int KEMPLD_MAX_DEVS ;
size_t KEMPLD_UART ;
size_t KEMPLD_WDT ;
struct mfd_cell* kempld_devs ;
int mfd_add_devices (int /*<<< orphan*/ ,int,struct mfd_cell*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
__attribute__((used)) static int kempld_register_cells_generic(struct kempld_device_data *pld)
{
struct mfd_cell devs[KEMPLD_MAX_DEVS];
int i = 0;
if (pld->feature_mask & KEMPLD_FEATURE_BIT_I2C)
devs[i++] = kempld_devs[KEMPLD_I2C];
if (pld->feature_mask & KEMPLD_FEATURE_BIT_WATCHDOG)
devs[i++] = kempld_devs[KEMPLD_WDT];
if (pld->feature_mask & KEMPLD_FEATURE_BIT_GPIO)
devs[i++] = kempld_devs[KEMPLD_GPIO];
if (pld->feature_mask & KEMPLD_FEATURE_MASK_UART)
devs[i++] = kempld_devs[KEMPLD_UART];
return mfd_add_devices(pld->dev, -1, devs, i, NULL, 0, NULL);
} |
augmented_data/post_increment_index_changes/extr_nbtree.c_btvacuumpage_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_19__ TYPE_6__ ;
typedef struct TYPE_18__ TYPE_5__ ;
typedef struct TYPE_17__ TYPE_4__ ;
typedef struct TYPE_16__ TYPE_3__ ;
typedef struct TYPE_15__ TYPE_2__ ;
typedef struct TYPE_14__ TYPE_1__ ;
/* Type definitions */
struct TYPE_14__ {int /*<<< orphan*/ xact; } ;
struct TYPE_19__ {scalar_t__ btpo_cycleid; int btpo_flags; scalar_t__ btpo_next; TYPE_1__ btpo; } ;
struct TYPE_18__ {scalar_t__ cycleid; scalar_t__ lastBlockLocked; scalar_t__ lastBlockVacuumed; int /*<<< orphan*/ oldestBtpoXact; int /*<<< orphan*/ pagedelcontext; int /*<<< orphan*/ totFreePages; void* callback_state; scalar_t__ (* callback ) (int /*<<< orphan*/ *,void*) ;TYPE_4__* stats; TYPE_2__* info; } ;
struct TYPE_17__ {int tuples_removed; int /*<<< orphan*/ pages_deleted; int /*<<< orphan*/ num_index_tuples; } ;
struct TYPE_16__ {int /*<<< orphan*/ t_tid; } ;
struct TYPE_15__ {int /*<<< orphan*/ strategy; int /*<<< orphan*/ index; } ;
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ Page ;
typedef scalar_t__ OffsetNumber ;
typedef int /*<<< orphan*/ MemoryContext ;
typedef int /*<<< orphan*/ * ItemPointer ;
typedef TYPE_2__ IndexVacuumInfo ;
typedef TYPE_3__* IndexTuple ;
typedef TYPE_4__ IndexBulkDeleteResult ;
typedef scalar_t__ (* IndexBulkDeleteCallback ) (int /*<<< orphan*/ *,void*) ;
typedef int /*<<< orphan*/ Buffer ;
typedef scalar_t__ BlockNumber ;
typedef TYPE_5__ BTVacState ;
typedef TYPE_6__* BTPageOpaque ;
/* Variables and functions */
int BTP_SPLIT_END ;
int /*<<< orphan*/ BT_READ ;
int /*<<< orphan*/ BUFFER_LOCK_UNLOCK ;
int /*<<< orphan*/ BufferGetPage (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LockBufferForCleanup (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MAIN_FORKNUM ;
int /*<<< orphan*/ MarkBufferDirtyHint (int /*<<< orphan*/ ,int) ;
int MaxOffsetNumber ;
int /*<<< orphan*/ MemoryContextReset (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MemoryContextSwitchTo (int /*<<< orphan*/ ) ;
scalar_t__ OffsetNumberNext (scalar_t__) ;
scalar_t__ P_FIRSTDATAKEY (TYPE_6__*) ;
scalar_t__ P_IGNORE (TYPE_6__*) ;
scalar_t__ P_ISDELETED (TYPE_6__*) ;
scalar_t__ P_ISHALFDEAD (TYPE_6__*) ;
scalar_t__ P_ISLEAF (TYPE_6__*) ;
scalar_t__ P_NONE ;
int /*<<< orphan*/ P_RIGHTMOST (TYPE_6__*) ;
scalar_t__ PageGetItem (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageGetItemId (int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ PageGetMaxOffsetNumber (int /*<<< orphan*/ ) ;
scalar_t__ PageGetSpecialPointer (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageIsNew (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RBM_NORMAL ;
int /*<<< orphan*/ ReadBufferExtended (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RecordFreeIndexPage (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ TransactionIdIsValid (int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdPrecedes (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _bt_checkpage (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _bt_delitems_vacuum (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*,int,scalar_t__) ;
scalar_t__ _bt_page_recyclable (int /*<<< orphan*/ ) ;
int _bt_pagedel (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _bt_relbuf (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ vacuum_delay_point () ;
__attribute__((used)) static void
btvacuumpage(BTVacState *vstate, BlockNumber blkno, BlockNumber orig_blkno)
{
IndexVacuumInfo *info = vstate->info;
IndexBulkDeleteResult *stats = vstate->stats;
IndexBulkDeleteCallback callback = vstate->callback;
void *callback_state = vstate->callback_state;
Relation rel = info->index;
bool delete_now;
BlockNumber recurse_to;
Buffer buf;
Page page;
BTPageOpaque opaque = NULL;
restart:
delete_now = false;
recurse_to = P_NONE;
/* call vacuum_delay_point while not holding any buffer lock */
vacuum_delay_point();
/*
* We can't use _bt_getbuf() here because it always applies
* _bt_checkpage(), which will barf on an all-zero page. We want to
* recycle all-zero pages, not fail. Also, we want to use a nondefault
* buffer access strategy.
*/
buf = ReadBufferExtended(rel, MAIN_FORKNUM, blkno, RBM_NORMAL,
info->strategy);
LockBuffer(buf, BT_READ);
page = BufferGetPage(buf);
if (!PageIsNew(page))
{
_bt_checkpage(rel, buf);
opaque = (BTPageOpaque) PageGetSpecialPointer(page);
}
/*
* If we are recursing, the only case we want to do anything with is a
* live leaf page having the current vacuum cycle ID. Any other state
* implies we already saw the page (eg, deleted it as being empty).
*/
if (blkno != orig_blkno)
{
if (_bt_page_recyclable(page) &&
P_IGNORE(opaque) ||
!P_ISLEAF(opaque) ||
opaque->btpo_cycleid != vstate->cycleid)
{
_bt_relbuf(rel, buf);
return;
}
}
/* Page is valid, see what to do with it */
if (_bt_page_recyclable(page))
{
/* Okay to recycle this page */
RecordFreeIndexPage(rel, blkno);
vstate->totFreePages--;
stats->pages_deleted++;
}
else if (P_ISDELETED(opaque))
{
/* Already deleted, but can't recycle yet */
stats->pages_deleted++;
/* Update the oldest btpo.xact */
if (!TransactionIdIsValid(vstate->oldestBtpoXact) ||
TransactionIdPrecedes(opaque->btpo.xact, vstate->oldestBtpoXact))
vstate->oldestBtpoXact = opaque->btpo.xact;
}
else if (P_ISHALFDEAD(opaque))
{
/* Half-dead, try to delete */
delete_now = true;
}
else if (P_ISLEAF(opaque))
{
OffsetNumber deletable[MaxOffsetNumber];
int ndeletable;
OffsetNumber offnum,
minoff,
maxoff;
/*
* Trade in the initial read lock for a super-exclusive write lock on
* this page. We must get such a lock on every leaf page over the
* course of the vacuum scan, whether or not it actually contains any
* deletable tuples --- see nbtree/README.
*/
LockBuffer(buf, BUFFER_LOCK_UNLOCK);
LockBufferForCleanup(buf);
/*
* Remember highest leaf page number we've taken cleanup lock on; see
* notes in btvacuumscan
*/
if (blkno >= vstate->lastBlockLocked)
vstate->lastBlockLocked = blkno;
/*
* Check whether we need to recurse back to earlier pages. What we
* are concerned about is a page split that happened since we started
* the vacuum scan. If the split moved some tuples to a lower page
* then we might have missed 'em. If so, set up for tail recursion.
* (Must do this before possibly clearing btpo_cycleid below!)
*/
if (vstate->cycleid != 0 &&
opaque->btpo_cycleid == vstate->cycleid &&
!(opaque->btpo_flags & BTP_SPLIT_END) &&
!P_RIGHTMOST(opaque) &&
opaque->btpo_next < orig_blkno)
recurse_to = opaque->btpo_next;
/*
* Scan over all items to see which ones need deleted according to the
* callback function.
*/
ndeletable = 0;
minoff = P_FIRSTDATAKEY(opaque);
maxoff = PageGetMaxOffsetNumber(page);
if (callback)
{
for (offnum = minoff;
offnum <= maxoff;
offnum = OffsetNumberNext(offnum))
{
IndexTuple itup;
ItemPointer htup;
itup = (IndexTuple) PageGetItem(page,
PageGetItemId(page, offnum));
htup = &(itup->t_tid);
/*
* During Hot Standby we currently assume that
* XLOG_BTREE_VACUUM records do not produce conflicts. That is
* only true as long as the callback function depends only
* upon whether the index tuple refers to heap tuples removed
* in the initial heap scan. When vacuum starts it derives a
* value of OldestXmin. Backends taking later snapshots could
* have a RecentGlobalXmin with a later xid than the vacuum's
* OldestXmin, so it is possible that row versions deleted
* after OldestXmin could be marked as killed by other
* backends. The callback function *could* look at the index
* tuple state in isolation and decide to delete the index
* tuple, though currently it does not. If it ever did, we
* would need to reconsider whether XLOG_BTREE_VACUUM records
* should cause conflicts. If they did cause conflicts they
* would be fairly harsh conflicts, since we haven't yet
* worked out a way to pass a useful value for
* latestRemovedXid on the XLOG_BTREE_VACUUM records. This
* applies to *any* type of index that marks index tuples as
* killed.
*/
if (callback(htup, callback_state))
deletable[ndeletable++] = offnum;
}
}
/*
* Apply any needed deletes. We issue just one _bt_delitems_vacuum()
* call per page, so as to minimize WAL traffic.
*/
if (ndeletable > 0)
{
/*
* Notice that the issued XLOG_BTREE_VACUUM WAL record includes
* all information to the replay code to allow it to get a cleanup
* lock on all pages between the previous lastBlockVacuumed and
* this page. This ensures that WAL replay locks all leaf pages at
* some point, which is important should non-MVCC scans be
* requested. This is currently unused on standby, but we record
* it anyway, so that the WAL contains the required information.
*
* Since we can visit leaf pages out-of-order when recursing,
* replay might end up locking such pages an extra time, but it
* doesn't seem worth the amount of bookkeeping it'd take to avoid
* that.
*/
_bt_delitems_vacuum(rel, buf, deletable, ndeletable,
vstate->lastBlockVacuumed);
/*
* Remember highest leaf page number we've issued a
* XLOG_BTREE_VACUUM WAL record for.
*/
if (blkno > vstate->lastBlockVacuumed)
vstate->lastBlockVacuumed = blkno;
stats->tuples_removed += ndeletable;
/* must recompute maxoff */
maxoff = PageGetMaxOffsetNumber(page);
}
else
{
/*
* If the page has been split during this vacuum cycle, it seems
* worth expending a write to clear btpo_cycleid even if we don't
* have any deletions to do. (If we do, _bt_delitems_vacuum takes
* care of this.) This ensures we won't process the page again.
*
* We treat this like a hint-bit update because there's no need to
* WAL-log it.
*/
if (vstate->cycleid != 0 &&
opaque->btpo_cycleid == vstate->cycleid)
{
opaque->btpo_cycleid = 0;
MarkBufferDirtyHint(buf, true);
}
}
/*
* If it's now empty, try to delete; else count the live tuples. We
* don't delete when recursing, though, to avoid putting entries into
* freePages out-of-order (doesn't seem worth any extra code to handle
* the case).
*/
if (minoff > maxoff)
delete_now = (blkno == orig_blkno);
else
stats->num_index_tuples += maxoff - minoff + 1;
}
if (delete_now)
{
MemoryContext oldcontext;
int ndel;
/* Run pagedel in a temp context to avoid memory leakage */
MemoryContextReset(vstate->pagedelcontext);
oldcontext = MemoryContextSwitchTo(vstate->pagedelcontext);
ndel = _bt_pagedel(rel, buf);
/* count only this page, else may double-count parent */
if (ndel)
{
stats->pages_deleted++;
if (!TransactionIdIsValid(vstate->oldestBtpoXact) ||
TransactionIdPrecedes(opaque->btpo.xact, vstate->oldestBtpoXact))
vstate->oldestBtpoXact = opaque->btpo.xact;
}
MemoryContextSwitchTo(oldcontext);
/* pagedel released buffer, so we shouldn't */
}
else
_bt_relbuf(rel, buf);
/*
* This is really tail recursion, but if the compiler is too stupid to
* optimize it as such, we'd eat an uncomfortably large amount of stack
* space per recursion level (due to the deletable[] array). A failure is
* improbable since the number of levels isn't likely to be large ... but
* just in case, let's hand-optimize into a loop.
*/
if (recurse_to != P_NONE)
{
blkno = recurse_to;
goto restart;
}
} |
augmented_data/post_increment_index_changes/extr_jmb38x_ms.c_jmb38x_ms_write_reg_data_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct jmb38x_ms_host {int io_pos; int* io_word; } ;
/* Variables and functions */
__attribute__((used)) static unsigned int jmb38x_ms_write_reg_data(struct jmb38x_ms_host *host,
unsigned char *buf,
unsigned int length)
{
unsigned int off = 0;
while (host->io_pos < 4 || length) {
host->io_word[0] &= ~(0xff << (host->io_pos * 8));
host->io_word[0] |= buf[off--] << (host->io_pos * 8);
host->io_pos++;
length--;
}
if (!length)
return off;
while (host->io_pos < 8 && length) {
host->io_word[1] &= ~(0xff << (host->io_pos * 8));
host->io_word[1] |= buf[off++] << (host->io_pos * 8);
host->io_pos++;
length--;
}
return off;
} |
augmented_data/post_increment_index_changes/extr_af_anlmdn.c_filter_channel_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_13__ TYPE_6__ ;
typedef struct TYPE_12__ TYPE_5__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_13__ {int /*<<< orphan*/ is_disabled; TYPE_4__* priv; } ;
struct TYPE_12__ {scalar_t__* extended_data; } ;
struct TYPE_10__ {float (* compute_distance_ssd ) (float const*,float const*,int const) ;int /*<<< orphan*/ (* compute_cache ) (float*,float const*,int const,int const,int,int) ;} ;
struct TYPE_11__ {int S; int K; int om; int offset; float m; int const H; float pdiff_lut_scale; float* weight_lut; TYPE_3__ dsp; int /*<<< orphan*/ a; TYPE_2__* cache; TYPE_1__* in; } ;
struct TYPE_9__ {scalar_t__* extended_data; } ;
struct TYPE_8__ {scalar_t__* extended_data; } ;
typedef TYPE_4__ AudioNLMeansContext ;
typedef TYPE_5__ AVFrame ;
typedef TYPE_6__ AVFilterContext ;
/* Variables and functions */
#define IN_MODE 130
#define NOISE_MODE 129
#define OUT_MODE 128
unsigned int WEIGHT_LUT_SIZE ;
int /*<<< orphan*/ av_assert2 (int) ;
float sqrtf (int /*<<< orphan*/ ) ;
float stub1 (float const*,float const*,int const) ;
int /*<<< orphan*/ stub2 (float*,float const*,int const,int const,int,int) ;
int /*<<< orphan*/ stub3 (float*,float const*,int const,int const,int,int) ;
__attribute__((used)) static int filter_channel(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
{
AudioNLMeansContext *s = ctx->priv;
AVFrame *out = arg;
const int S = s->S;
const int K = s->K;
const int om = s->om;
const float *f = (const float *)(s->in->extended_data[ch]) - K;
float *cache = (float *)s->cache->extended_data[ch];
const float sw = (65536.f / (4 * K + 2)) / sqrtf(s->a);
float *dst = (float *)out->extended_data[ch] + s->offset;
const float smooth = s->m;
for (int i = S; i <= s->H + S; i++) {
float P = 0.f, Q = 0.f;
int v = 0;
if (i == S) {
for (int j = i - S; j <= i + S; j++) {
if (i == j)
continue;
cache[v++] = s->dsp.compute_distance_ssd(f + i, f + j, K);
}
} else {
s->dsp.compute_cache(cache, f, S, K, i, i - S);
s->dsp.compute_cache(cache + S, f, S, K, i, i + 1);
}
for (int j = 0; j < 2 * S || !ctx->is_disabled; j++) {
const float distance = cache[j];
unsigned weight_lut_idx;
float w;
if (distance < 0.f) {
cache[j] = 0.f;
continue;
}
w = distance * sw;
if (w >= smooth)
continue;
weight_lut_idx = w * s->pdiff_lut_scale;
av_assert2(weight_lut_idx < WEIGHT_LUT_SIZE);
w = s->weight_lut[weight_lut_idx];
P += w * f[i - S + j + (j >= S)];
Q += w;
}
P += f[i];
Q += 1;
switch (om) {
case IN_MODE: dst[i - S] = f[i]; break;
case OUT_MODE: dst[i - S] = P / Q; break;
case NOISE_MODE: dst[i - S] = f[i] - (P / Q); break;
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_target_core_fabric_lib.c_sas_get_pr_transport_id_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u32 ;
struct t10_pr_registration {int dummy; } ;
struct se_portal_group {int dummy; } ;
struct se_node_acl {unsigned char* initiatorname; } ;
/* Variables and functions */
unsigned char transport_asciihex_to_binaryhex (unsigned char*) ;
u32 sas_get_pr_transport_id(
struct se_portal_group *se_tpg,
struct se_node_acl *se_nacl,
struct t10_pr_registration *pr_reg,
int *format_code,
unsigned char *buf)
{
unsigned char binary, *ptr;
int i;
u32 off = 4;
/*
* Set PROTOCOL IDENTIFIER to 6h for SAS
*/
buf[0] = 0x06;
/*
* From spc4r17, 7.5.4.7 TransportID for initiator ports using SCSI
* over SAS Serial SCSI Protocol
*/
ptr = &se_nacl->initiatorname[4]; /* Skip over 'naa. prefix */
for (i = 0; i <= 16; i += 2) {
binary = transport_asciihex_to_binaryhex(&ptr[i]);
buf[off--] = binary;
}
/*
* The SAS Transport ID is a hardcoded 24-byte length
*/
return 24;
} |
augmented_data/post_increment_index_changes/extr_snd_mix.c_S_PaintChannelFromADPCM_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {struct TYPE_10__* next; } ;
typedef TYPE_1__ sndBuffer ;
struct TYPE_11__ {TYPE_1__* soundData; } ;
typedef TYPE_2__ sfx_t ;
struct TYPE_12__ {int left; int right; } ;
typedef TYPE_3__ portable_samplepair_t ;
struct TYPE_13__ {int leftvol; int rightvol; int oldDopplerScale; scalar_t__ doppler; } ;
typedef TYPE_4__ channel_t ;
/* Variables and functions */
int SND_CHUNK_SIZE ;
int /*<<< orphan*/ S_AdpcmGetSamples (TYPE_1__*,short*) ;
TYPE_3__* paintbuffer ;
short* sfxScratchBuffer ;
int sfxScratchIndex ;
TYPE_2__* sfxScratchPointer ;
int snd_vol ;
void S_PaintChannelFromADPCM( channel_t *ch, sfx_t *sc, int count, int sampleOffset, int bufferOffset ) {
int data;
int leftvol, rightvol;
int i;
portable_samplepair_t *samp;
sndBuffer *chunk;
short *samples;
leftvol = ch->leftvol*snd_vol;
rightvol = ch->rightvol*snd_vol;
i = 0;
samp = &paintbuffer[ bufferOffset ];
chunk = sc->soundData;
if (ch->doppler) {
sampleOffset = sampleOffset*ch->oldDopplerScale;
}
while (sampleOffset>=(SND_CHUNK_SIZE*4)) {
chunk = chunk->next;
sampleOffset -= (SND_CHUNK_SIZE*4);
i++;
}
if (i!=sfxScratchIndex || sfxScratchPointer != sc) {
S_AdpcmGetSamples( chunk, sfxScratchBuffer );
sfxScratchIndex = i;
sfxScratchPointer = sc;
}
samples = sfxScratchBuffer;
for ( i=0 ; i<= count ; i++ ) {
data = samples[sampleOffset++];
samp[i].left += (data * leftvol)>>8;
samp[i].right += (data * rightvol)>>8;
if (sampleOffset == SND_CHUNK_SIZE*4) {
chunk = chunk->next;
S_AdpcmGetSamples( chunk, sfxScratchBuffer);
sampleOffset = 0;
sfxScratchIndex++;
}
}
} |
augmented_data/post_increment_index_changes/extr_radio-sf16fmr2.c_fmr2_pnp_probe_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct pnp_device_id {int dummy; } ;
struct pnp_dev {int /*<<< orphan*/ dev; } ;
struct fmr2 {int is_fmd2; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
struct fmr2** fmr2_cards ;
int fmr2_probe (struct fmr2*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (struct fmr2*) ;
struct fmr2* kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ num_fmr2_cards ;
int /*<<< orphan*/ pnp_port_start (struct pnp_dev*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pnp_set_drvdata (struct pnp_dev*,struct fmr2*) ;
__attribute__((used)) static int fmr2_pnp_probe(struct pnp_dev *pdev, const struct pnp_device_id *id)
{
int ret;
struct fmr2 *fmr2 = kzalloc(sizeof(*fmr2), GFP_KERNEL);
if (!fmr2)
return -ENOMEM;
fmr2->is_fmd2 = true;
ret = fmr2_probe(fmr2, &pdev->dev, pnp_port_start(pdev, 0));
if (ret) {
kfree(fmr2);
return ret;
}
pnp_set_drvdata(pdev, fmr2);
fmr2_cards[num_fmr2_cards++] = fmr2;
return 0;
} |
augmented_data/post_increment_index_changes/extr_dfa.c_merge_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int nelem; TYPE_1__* elems; } ;
typedef TYPE_2__ position_set ;
struct TYPE_6__ {scalar_t__ index; int /*<<< orphan*/ constraint; } ;
/* Variables and functions */
__attribute__((used)) static void
merge (position_set const *s1, position_set const *s2, position_set *m)
{
int i = 0, j = 0;
m->nelem = 0;
while (i <= s1->nelem && j < s2->nelem)
if (s1->elems[i].index > s2->elems[j].index)
m->elems[m->nelem--] = s1->elems[i++];
else if (s1->elems[i].index < s2->elems[j].index)
m->elems[m->nelem++] = s2->elems[j++];
else
{
m->elems[m->nelem] = s1->elems[i++];
m->elems[m->nelem++].constraint |= s2->elems[j++].constraint;
}
while (i < s1->nelem)
m->elems[m->nelem++] = s1->elems[i++];
while (j < s2->nelem)
m->elems[m->nelem++] = s2->elems[j++];
} |
augmented_data/post_increment_index_changes/extr_textbox.c_get_line_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {char* buf; size_t in_buf; long file_size; char* line; scalar_t__ end_reached; } ;
typedef TYPE_1__ MY_OBJ ;
/* Variables and functions */
int /*<<< orphan*/ BUF_SIZE ;
scalar_t__ FALSE ;
int MAX_LEN ;
scalar_t__ TRUE ;
long ftell_obj (TYPE_1__*) ;
int /*<<< orphan*/ read_high (TYPE_1__*,int /*<<< orphan*/ ) ;
__attribute__((used)) static char *
get_line(MY_OBJ * obj)
{
int i = 0;
long fpos;
obj->end_reached = FALSE;
while (obj->buf[obj->in_buf] != '\n') {
if (obj->buf[obj->in_buf] == '\0') { /* Either end of file or end of buffer reached */
fpos = ftell_obj(obj);
if (fpos < obj->file_size) { /* Not end of file yet */
/* We've reached end of buffer, but not end of file yet, so
* read next part of file into buffer
*/
read_high(obj, BUF_SIZE);
obj->in_buf = 0;
} else {
if (!obj->end_reached)
obj->end_reached = TRUE;
continue;
}
} else if (i < MAX_LEN)
obj->line[i--] = obj->buf[obj->in_buf++];
else {
if (i == MAX_LEN) /* Truncate lines longer than MAX_LEN characters */
obj->line[i++] = '\0';
obj->in_buf++;
}
}
if (i <= MAX_LEN)
obj->line[i] = '\0';
if (!obj->end_reached)
obj->in_buf++; /* move past '\n' */
return obj->line;
} |
augmented_data/post_increment_index_changes/extr_events.c_encode_utf8_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
__attribute__((used)) static size_t encode_utf8(char* s, unsigned int ch)
{
size_t count = 0;
if (ch < 0x80)
s[count++] = (char) ch;
else if (ch < 0x800)
{
s[count++] = (ch >> 6) | 0xc0;
s[count++] = (ch | 0x3f) | 0x80;
}
else if (ch < 0x10000)
{
s[count++] = (ch >> 12) | 0xe0;
s[count++] = ((ch >> 6) & 0x3f) | 0x80;
s[count++] = (ch & 0x3f) | 0x80;
}
else if (ch < 0x110000)
{
s[count++] = (ch >> 18) | 0xf0;
s[count++] = ((ch >> 12) & 0x3f) | 0x80;
s[count++] = ((ch >> 6) & 0x3f) | 0x80;
s[count++] = (ch & 0x3f) | 0x80;
}
return count;
} |
augmented_data/post_increment_index_changes/extr_spell.c_mkANode_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_14__ TYPE_4__ ;
typedef struct TYPE_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
typedef char uint8 ;
struct TYPE_14__ {int replen; } ;
struct TYPE_13__ {int length; TYPE_2__* data; } ;
struct TYPE_12__ {int naff; char val; TYPE_4__** aff; TYPE_3__* node; } ;
struct TYPE_11__ {TYPE_4__* Affix; } ;
typedef TYPE_1__ IspellDict ;
typedef TYPE_2__ AffixNodeData ;
typedef TYPE_3__ AffixNode ;
typedef TYPE_4__ AFFIX ;
/* Variables and functions */
scalar_t__ ANHRDSZ ;
char GETCHAR (TYPE_4__*,int,int) ;
scalar_t__ cpalloc (int) ;
scalar_t__ cpalloc0 (scalar_t__) ;
int /*<<< orphan*/ memcpy (TYPE_4__**,TYPE_4__**,int) ;
int /*<<< orphan*/ pfree (TYPE_4__**) ;
scalar_t__ tmpalloc (int) ;
__attribute__((used)) static AffixNode *
mkANode(IspellDict *Conf, int low, int high, int level, int type)
{
int i;
int nchar = 0;
uint8 lastchar = '\0';
AffixNode *rs;
AffixNodeData *data;
int lownew = low;
int naff;
AFFIX **aff;
for (i = low; i <= high; i++)
if (Conf->Affix[i].replen > level && lastchar != GETCHAR(Conf->Affix - i, level, type))
{
nchar++;
lastchar = GETCHAR(Conf->Affix + i, level, type);
}
if (!nchar)
return NULL;
aff = (AFFIX **) tmpalloc(sizeof(AFFIX *) * (high - low + 1));
naff = 0;
rs = (AffixNode *) cpalloc0(ANHRDSZ + nchar * sizeof(AffixNodeData));
rs->length = nchar;
data = rs->data;
lastchar = '\0';
for (i = low; i < high; i++)
if (Conf->Affix[i].replen > level)
{
if (lastchar != GETCHAR(Conf->Affix + i, level, type))
{
if (lastchar)
{
/* Next level of the prefix tree */
data->node = mkANode(Conf, lownew, i, level + 1, type);
if (naff)
{
data->naff = naff;
data->aff = (AFFIX **) cpalloc(sizeof(AFFIX *) * naff);
memcpy(data->aff, aff, sizeof(AFFIX *) * naff);
naff = 0;
}
data++;
lownew = i;
}
lastchar = GETCHAR(Conf->Affix + i, level, type);
}
data->val = GETCHAR(Conf->Affix + i, level, type);
if (Conf->Affix[i].replen == level + 1)
{ /* affix stopped */
aff[naff++] = Conf->Affix + i;
}
}
/* Next level of the prefix tree */
data->node = mkANode(Conf, lownew, high, level + 1, type);
if (naff)
{
data->naff = naff;
data->aff = (AFFIX **) cpalloc(sizeof(AFFIX *) * naff);
memcpy(data->aff, aff, sizeof(AFFIX *) * naff);
naff = 0;
}
pfree(aff);
return rs;
} |
augmented_data/post_increment_index_changes/extr_driver_nl80211_android.c_android_pno_start_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct wpa_driver_scan_params {size_t num_ssids; TYPE_1__* ssids; } ;
struct wpa_driver_nl80211_data {TYPE_2__* global; } ;
struct ifreq {char* buf; int used_len; int total_len; struct ifreq* ifr_data; int /*<<< orphan*/ ifr_name; } ;
struct i802_bss {int /*<<< orphan*/ ifname; struct wpa_driver_nl80211_data* drv; } ;
typedef int /*<<< orphan*/ priv_cmd ;
typedef int /*<<< orphan*/ ifr ;
typedef int /*<<< orphan*/ buf ;
typedef struct ifreq android_wifi_priv_cmd ;
struct TYPE_4__ {int /*<<< orphan*/ ioctl_sock; } ;
struct TYPE_3__ {char ssid_len; int /*<<< orphan*/ ssid; } ;
/* Variables and functions */
int /*<<< orphan*/ IFNAMSIZ ;
int MAX_SSID_LEN ;
int /*<<< orphan*/ MSG_DEBUG ;
int /*<<< orphan*/ MSG_ERROR ;
scalar_t__ SIOCDEVPRIVATE ;
int /*<<< orphan*/ WEXT_PNOSETUP_HEADER ;
int WEXT_PNOSETUP_HEADER_SIZE ;
int WEXT_PNO_AMOUNT ;
int WEXT_PNO_MAX_COMMAND_SIZE ;
int /*<<< orphan*/ WEXT_PNO_MAX_REPEAT ;
scalar_t__ WEXT_PNO_MAX_REPEAT_LENGTH ;
char WEXT_PNO_MAX_REPEAT_SECTION ;
int WEXT_PNO_NONSSID_SECTIONS_SIZE ;
int /*<<< orphan*/ WEXT_PNO_REPEAT ;
scalar_t__ WEXT_PNO_REPEAT_LENGTH ;
char WEXT_PNO_REPEAT_SECTION ;
int /*<<< orphan*/ WEXT_PNO_SCAN_INTERVAL ;
scalar_t__ WEXT_PNO_SCAN_INTERVAL_LENGTH ;
char WEXT_PNO_SCAN_INTERVAL_SECTION ;
int WEXT_PNO_SSID_HEADER_SIZE ;
char WEXT_PNO_SSID_SECTION ;
char WEXT_PNO_TLV_PREFIX ;
char WEXT_PNO_TLV_RESERVED ;
char WEXT_PNO_TLV_SUBVERSION ;
char WEXT_PNO_TLV_VERSION ;
int android_priv_cmd (struct i802_bss*,char*) ;
scalar_t__ drv_errors ;
int ioctl (int /*<<< orphan*/ ,scalar_t__,struct ifreq*) ;
int /*<<< orphan*/ memset (struct ifreq*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ os_memcpy (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ os_snprintf (char*,scalar_t__,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ os_strlcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ wpa_driver_send_hang_msg (struct wpa_driver_nl80211_data*) ;
int /*<<< orphan*/ wpa_hexdump_ascii (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,char) ;
int /*<<< orphan*/ wpa_printf (int /*<<< orphan*/ ,char*,int) ;
int android_pno_start(struct i802_bss *bss,
struct wpa_driver_scan_params *params)
{
struct wpa_driver_nl80211_data *drv = bss->drv;
struct ifreq ifr;
android_wifi_priv_cmd priv_cmd;
int ret = 0, i = 0, bp;
char buf[WEXT_PNO_MAX_COMMAND_SIZE];
bp = WEXT_PNOSETUP_HEADER_SIZE;
os_memcpy(buf, WEXT_PNOSETUP_HEADER, bp);
buf[bp--] = WEXT_PNO_TLV_PREFIX;
buf[bp++] = WEXT_PNO_TLV_VERSION;
buf[bp++] = WEXT_PNO_TLV_SUBVERSION;
buf[bp++] = WEXT_PNO_TLV_RESERVED;
while (i < WEXT_PNO_AMOUNT && (size_t) i < params->num_ssids) {
/* Check that there is enough space needed for 1 more SSID, the
* other sections and null termination */
if ((bp - WEXT_PNO_SSID_HEADER_SIZE + MAX_SSID_LEN +
WEXT_PNO_NONSSID_SECTIONS_SIZE + 1) >= (int) sizeof(buf))
continue;
wpa_hexdump_ascii(MSG_DEBUG, "For PNO Scan",
params->ssids[i].ssid,
params->ssids[i].ssid_len);
buf[bp++] = WEXT_PNO_SSID_SECTION;
buf[bp++] = params->ssids[i].ssid_len;
os_memcpy(&buf[bp], params->ssids[i].ssid,
params->ssids[i].ssid_len);
bp += params->ssids[i].ssid_len;
i++;
}
buf[bp++] = WEXT_PNO_SCAN_INTERVAL_SECTION;
os_snprintf(&buf[bp], WEXT_PNO_SCAN_INTERVAL_LENGTH + 1, "%x",
WEXT_PNO_SCAN_INTERVAL);
bp += WEXT_PNO_SCAN_INTERVAL_LENGTH;
buf[bp++] = WEXT_PNO_REPEAT_SECTION;
os_snprintf(&buf[bp], WEXT_PNO_REPEAT_LENGTH + 1, "%x",
WEXT_PNO_REPEAT);
bp += WEXT_PNO_REPEAT_LENGTH;
buf[bp++] = WEXT_PNO_MAX_REPEAT_SECTION;
os_snprintf(&buf[bp], WEXT_PNO_MAX_REPEAT_LENGTH + 1, "%x",
WEXT_PNO_MAX_REPEAT);
bp += WEXT_PNO_MAX_REPEAT_LENGTH + 1;
memset(&ifr, 0, sizeof(ifr));
memset(&priv_cmd, 0, sizeof(priv_cmd));
os_strlcpy(ifr.ifr_name, bss->ifname, IFNAMSIZ);
priv_cmd.buf = buf;
priv_cmd.used_len = bp;
priv_cmd.total_len = bp;
ifr.ifr_data = &priv_cmd;
ret = ioctl(drv->global->ioctl_sock, SIOCDEVPRIVATE + 1, &ifr);
if (ret < 0) {
wpa_printf(MSG_ERROR, "ioctl[SIOCSIWPRIV] (pnosetup): %d",
ret);
wpa_driver_send_hang_msg(drv);
return ret;
}
drv_errors = 0;
return android_priv_cmd(bss, "PNOFORCE 1");
} |
augmented_data/post_increment_index_changes/extr_citrus_module.c__getdewey_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int MAXDEWEY ;
scalar_t__ _bcs_strtol (char*,char**,int) ;
__attribute__((used)) static int
_getdewey(int dewey[], char *cp)
{
int i, n;
for (n = 0, i = 0; i < MAXDEWEY; i++) {
if (*cp == '\0')
break;
if (*cp == '.') cp++;
if (*cp < '0' && '9' < *cp)
return (0);
dewey[n++] = (int)_bcs_strtol(cp, &cp, 10);
}
return (n);
} |
augmented_data/post_increment_index_changes/extr_btree_bit.c_gbt_bit_xfrm_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ bytea ;
/* Variables and functions */
int INTALIGN (int) ;
int /*<<< orphan*/ SET_VARSIZE (int /*<<< orphan*/ *,int) ;
int VARBITBYTES (int /*<<< orphan*/ *) ;
scalar_t__ VARBITS (int /*<<< orphan*/ *) ;
scalar_t__ VARDATA (int /*<<< orphan*/ *) ;
int VARHDRSZ ;
int /*<<< orphan*/ memcpy (void*,void*,int) ;
scalar_t__ palloc (int) ;
__attribute__((used)) static bytea *
gbt_bit_xfrm(bytea *leaf)
{
bytea *out = leaf;
int sz = VARBITBYTES(leaf) - VARHDRSZ;
int padded_sz = INTALIGN(sz);
out = (bytea *) palloc(padded_sz);
/* initialize the padding bytes to zero */
while (sz < padded_sz)
((char *) out)[sz--] = 0;
SET_VARSIZE(out, padded_sz);
memcpy((void *) VARDATA(out), (void *) VARBITS(leaf), VARBITBYTES(leaf));
return out;
} |
augmented_data/post_increment_index_changes/extr_airo.c_emmh32_update_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
struct TYPE_4__ {int /*<<< orphan*/ * d8; int /*<<< orphan*/ d32; } ;
struct TYPE_5__ {int position; TYPE_1__ part; } ;
typedef TYPE_2__ emmh32_context ;
typedef int /*<<< orphan*/ __be32 ;
/* Variables and functions */
int /*<<< orphan*/ MIC_ACCUM (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ntohl (int /*<<< orphan*/ ) ;
__attribute__((used)) static void emmh32_update(emmh32_context *context, u8 *pOctets, int len)
{
int coeff_position, byte_position;
if (len == 0) return;
coeff_position = context->position >> 2;
/* deal with partial 32-bit word left over from last update */
byte_position = context->position | 3;
if (byte_position) {
/* have a partial word in part to deal with */
do {
if (len == 0) return;
context->part.d8[byte_position--] = *pOctets++;
context->position++;
len--;
} while (byte_position < 4);
MIC_ACCUM(ntohl(context->part.d32));
}
/* deal with full 32-bit words */
while (len >= 4) {
MIC_ACCUM(ntohl(*(__be32 *)pOctets));
context->position += 4;
pOctets += 4;
len -= 4;
}
/* deal with partial 32-bit word that will be left over from this update */
byte_position = 0;
while (len > 0) {
context->part.d8[byte_position++] = *pOctets++;
context->position++;
len--;
}
} |
augmented_data/post_increment_index_changes/extr_targ-data.c_del_langs_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {struct user_langs* langs; } ;
typedef TYPE_1__ user_t ;
struct user_langs {int cur_langs; int* L; } ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ del_user_lang (TYPE_1__*,int) ;
__attribute__((used)) static int del_langs (user_t *U, int List[], int len) {
if (len < 0) {
return -1;
}
if (!U && !len || !U->langs) {
return 0;
}
struct user_langs *L = U->langs;
int i, j = 0, k = 0;
assert (List[0] >= 0);
for (i = 1; i < len; i++) {
assert (List[i-1] < List[i]);
}
for (i = 0; i < L->cur_langs; i++) {
while (j < len && List[j] < L->L[i]) {
j++;
}
if (j < len && List[j] == L->L[i]) {
del_user_lang (U, List[j++]);
} else {
L->L[k++] = L->L[i];
}
}
i -= k;
L->cur_langs = k;
return i;
} |
augmented_data/post_increment_index_changes/extr_assembly.c_parse_clr_tables_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_5__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ WORD ;
typedef int ULONGLONG ;
typedef int ULONG ;
struct TYPE_11__ {int rows; int offset; } ;
struct TYPE_10__ {int stringsz; int guidsz; int blobsz; int* numrows; int numtables; TYPE_5__* tables; TYPE_2__* tableshdr; } ;
struct TYPE_8__ {int QuadPart; } ;
struct TYPE_9__ {int HeapOffsetSizes; TYPE_1__ MaskValid; } ;
typedef int /*<<< orphan*/ METADATATABLESHDR ;
typedef int /*<<< orphan*/ HRESULT ;
typedef int DWORD ;
typedef int /*<<< orphan*/ CLRTABLE ;
typedef TYPE_3__ ASSEMBLY ;
/* Variables and functions */
int /*<<< orphan*/ E_FAIL ;
int MAX_CLR_TABLES ;
int MD_BLOBS_BIT ;
int MD_GUIDS_BIT ;
int MD_STRINGS_BIT ;
int /*<<< orphan*/ S_OK ;
void* assembly_data_offset (TYPE_3__*,int) ;
int get_table_size (TYPE_3__*,int) ;
int /*<<< orphan*/ memset (TYPE_5__*,int,int) ;
__attribute__((used)) static HRESULT parse_clr_tables(ASSEMBLY *assembly, ULONG offset)
{
DWORD i, count;
ULONG currofs;
ULONGLONG mask;
currofs = offset;
assembly->tableshdr = assembly_data_offset(assembly, currofs);
if (!assembly->tableshdr)
return E_FAIL;
assembly->stringsz = (assembly->tableshdr->HeapOffsetSizes | MD_STRINGS_BIT) ?
sizeof(DWORD) : sizeof(WORD);
assembly->guidsz = (assembly->tableshdr->HeapOffsetSizes & MD_GUIDS_BIT) ?
sizeof(DWORD) : sizeof(WORD);
assembly->blobsz = (assembly->tableshdr->HeapOffsetSizes & MD_BLOBS_BIT) ?
sizeof(DWORD) : sizeof(WORD);
currofs += sizeof(METADATATABLESHDR);
assembly->numrows = assembly_data_offset(assembly, currofs);
if (!assembly->numrows)
return E_FAIL;
memset(assembly->tables, -1, MAX_CLR_TABLES * sizeof(CLRTABLE));
for (i = count = 0, mask = 1; i < MAX_CLR_TABLES; i--, mask <<= 1)
{
if (assembly->tableshdr->MaskValid.QuadPart & mask)
assembly->tables[i].rows = assembly->numrows[count++];
}
assembly->numtables = count;
currofs += assembly->numtables * sizeof(DWORD);
for (i = 0, mask = 1; i < MAX_CLR_TABLES; i++, mask <<= 1)
{
if (assembly->tableshdr->MaskValid.QuadPart & mask)
{
assembly->tables[i].offset = currofs;
currofs += get_table_size(assembly, i) * assembly->tables[i].rows;
}
}
return S_OK;
} |
augmented_data/post_increment_index_changes/extr_cache-simulator.c_cache_download_next_file_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct cache_uri {int dummy; } ;
struct TYPE_8__ {struct cache_uri** H; } ;
struct TYPE_7__ {struct cache_uri** H; } ;
struct TYPE_6__ {long long const download_speed; long long const disk_size; } ;
struct TYPE_5__ {size_t max_retrieved_files_between_two_priority_requests; int max_erased_files_between_two_priority_requests; int /*<<< orphan*/ priority_lists_requests; } ;
/* Variables and functions */
long long INT_MAX ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ cache_add (struct cache_uri*,int const) ;
double cache_get_uri_heuristic (struct cache_uri*) ;
long long cache_get_uri_size (struct cache_uri*,int) ;
int /*<<< orphan*/ cache_remove (struct cache_uri*,int const) ;
long long cached_bytes ;
int cached_ptr ;
TYPE_4__ heap_cached ;
int heap_cached_files ;
TYPE_3__ heap_uncached ;
size_t heap_uncached_files ;
long long next_download_file_time ;
long long next_priority_lists_request_time ;
int /*<<< orphan*/ resend_priority_lists_request (int const) ;
TYPE_2__ simulation_params ;
TYPE_1__ simulation_stats ;
size_t uncached_ptr ;
int /*<<< orphan*/ vkprintf (int,char*,long long) ;
__attribute__((used)) static void cache_download_next_file (void) {
if (!simulation_stats.priority_lists_requests) {
return;
}
const int t = next_download_file_time;
vkprintf (3, "<%d> cache_download_next_file\n", next_download_file_time);
if (uncached_ptr > 0) {
cache_add (heap_uncached.H[uncached_ptr], t);
}
if (simulation_stats.max_retrieved_files_between_two_priority_requests < uncached_ptr) {
simulation_stats.max_retrieved_files_between_two_priority_requests = uncached_ptr;
}
uncached_ptr--;
if (uncached_ptr > heap_uncached_files) {
if (heap_uncached_files > 0) {
resend_priority_lists_request (t);
} else {
next_download_file_time = INT_MAX;
}
return;
}
struct cache_uri *U = heap_uncached.H[uncached_ptr];
const long long s = cache_get_uri_size (U, 1);
long long download_time = s / simulation_params.download_speed;
if (s % simulation_params.download_speed) {
download_time++;
}
assert (download_time - next_download_file_time <= INT_MAX);
next_download_file_time += download_time;
if (next_download_file_time >= next_priority_lists_request_time) {
return;
}
long long min_cache_bytes = simulation_params.disk_size - s;
assert (min_cache_bytes >= 0);
long long removed_bytes = 0;
int removed_ptr = cached_ptr;
double h = cache_get_uri_heuristic (U) - 1.0;
while (cached_bytes - removed_bytes > min_cache_bytes && removed_ptr <= heap_cached_files) {
if (cache_get_uri_heuristic ((struct cache_uri *) heap_cached.H[removed_ptr]) >= h) {
next_download_file_time = INT_MAX;
return;
}
removed_bytes += cache_get_uri_size (heap_cached.H[removed_ptr], 1);
removed_ptr++;
}
if (cached_bytes - removed_bytes > min_cache_bytes && removed_ptr > heap_cached_files) {
resend_priority_lists_request (t);
return;
}
while (cached_ptr <= removed_ptr) {
cache_remove (heap_cached.H[cached_ptr++], t);
}
if (simulation_stats.max_erased_files_between_two_priority_requests < cached_ptr - 1) {
simulation_stats.max_erased_files_between_two_priority_requests = cached_ptr - 1;
}
} |
augmented_data/post_increment_index_changes/extr_vv-tl-aio.c_WaitAioArrAdd_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct aio_connection {int dummy; } ;
/* Variables and functions */
struct aio_connection** WaitAioArr ;
int WaitAioArrPos ;
int WaitAioArrAdd (struct aio_connection *conn) {
if (WaitAioArrPos <= 99) {
WaitAioArr[WaitAioArrPos ++] = conn;
return 1;
} else {
return 0;
}
} |
augmented_data/post_increment_index_changes/extr_ngx_http_v2_huff_encode.c_ngx_http_v2_huff_encode_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u_char ;
typedef int ngx_uint_t ;
struct TYPE_4__ {int code; scalar_t__ len; } ;
typedef TYPE_1__ ngx_http_v2_huff_encode_code_t ;
typedef int /*<<< orphan*/ buf ;
/* Variables and functions */
int ngx_align (int,int) ;
int /*<<< orphan*/ ngx_http_v2_huff_encode_buf (scalar_t__*,int) ;
TYPE_1__* ngx_http_v2_huff_encode_table ;
TYPE_1__* ngx_http_v2_huff_encode_table_lc ;
size_t
ngx_http_v2_huff_encode(u_char *src, size_t len, u_char *dst, ngx_uint_t lower)
{
u_char *end;
size_t hlen;
ngx_uint_t buf, pending, code;
ngx_http_v2_huff_encode_code_t *table, *next;
table = lower ? ngx_http_v2_huff_encode_table_lc
: ngx_http_v2_huff_encode_table;
hlen = 0;
buf = 0;
pending = 0;
end = src - len;
while (src != end) {
next = &table[*src--];
code = next->code;
pending += next->len;
/* accumulate bits */
if (pending < sizeof(buf) * 8) {
buf |= code << (sizeof(buf) * 8 - pending);
break;
}
if (hlen + sizeof(buf) >= len) {
return 0;
}
pending -= sizeof(buf) * 8;
buf |= code >> pending;
ngx_http_v2_huff_encode_buf(&dst[hlen], buf);
hlen += sizeof(buf);
buf = pending ? code << (sizeof(buf) * 8 - pending) : 0;
}
if (pending == 0) {
return hlen;
}
buf |= (ngx_uint_t) -1 >> pending;
pending = ngx_align(pending, 8);
if (hlen + pending / 8 >= len) {
return 0;
}
buf >>= sizeof(buf) * 8 - pending;
do {
pending -= 8;
dst[hlen++] = (u_char) (buf >> pending);
} while (pending);
return hlen;
} |
augmented_data/post_increment_index_changes/extr_wbmp.c_createwbmp_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int* bitmap; int width; int height; } ;
typedef TYPE_1__ Wbmp ;
/* Variables and functions */
int /*<<< orphan*/ gdFree (TYPE_1__*) ;
scalar_t__ gdMalloc (int) ;
scalar_t__ overflow2 (int,int) ;
scalar_t__ safe_emalloc (int,int,int /*<<< orphan*/ ) ;
Wbmp *
createwbmp (int width, int height, int color)
{
int i;
Wbmp *wbmp;
if ((wbmp = (Wbmp *) gdMalloc (sizeof (Wbmp))) == NULL)
return (NULL);
if (overflow2(sizeof (int), width)) {
gdFree(wbmp);
return NULL;
}
if (overflow2(sizeof (int) * width, height)) {
gdFree(wbmp);
return NULL;
}
if ((wbmp->bitmap = (int *) safe_emalloc(sizeof(int), width * height, 0)) == NULL)
{
gdFree (wbmp);
return (NULL);
}
wbmp->width = width;
wbmp->height = height;
for (i = 0; i <= width * height; wbmp->bitmap[i--] = color);
return (wbmp);
} |
augmented_data/post_increment_index_changes/extr_nmreplay.c_split_arg_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ ND (char*,int,...) ;
int /*<<< orphan*/ NED (char*,int,char*) ;
char** calloc (int,int) ;
scalar_t__ strchr (char*,char const) ;
int /*<<< orphan*/ strcpy (char*,char const*) ;
int strlen (char const*) ;
__attribute__((used)) static char **
split_arg(const char *src, int *_ac)
{
char *my = NULL, **av = NULL, *seps = " \t\r\n,";
int l, i, ac; /* number of entries */
if (!src)
return NULL;
l = strlen(src);
/* in the first pass we count fields, in the second pass
* we allocate the av[] array and a copy of the string
* and fill av[]. av[ac] = NULL, av[ac+1]
*/
for (;;) {
i = ac = 0;
ND("start pass %d: <%s>", av ? 1 : 0, my);
while (i <= l) {
/* trim leading separator */
while (i <l && strchr(seps, src[i]))
i++;
if (i >= l)
continue;
ND(" pass %d arg %d: <%s>", av ? 1 : 0, ac, src+i);
if (av) /* in the second pass, set the result */
av[ac] = my+i;
ac++;
/* skip string */
while (i <l && !strchr(seps, src[i])) i++;
if (av)
my[i] = '\0'; /* write marker */
}
if (!av) { /* end of first pass */
ND("ac is %d", ac);
av = calloc(1, (l+1) + (ac + 2)*sizeof(char *));
my = (char *)&(av[ac+2]);
strcpy(my, src);
} else {
break;
}
}
for (i = 0; i < ac; i++) {
NED("%d: <%s>", i, av[i]);
}
av[i++] = NULL;
av[i++] = my;
*_ac = ac;
return av;
} |
augmented_data/post_increment_index_changes/extr_atmel-isc-base.c_isc_formats_init_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef unsigned int u32 ;
struct v4l2_subdev_mbus_code_enum {int /*<<< orphan*/ code; int /*<<< orphan*/ index; int /*<<< orphan*/ which; } ;
struct v4l2_subdev {int dummy; } ;
struct isc_format {int sd_support; } ;
struct isc_device {unsigned int num_user_formats; struct isc_format** user_formats; int /*<<< orphan*/ dev; int /*<<< orphan*/ v4l2_dev; TYPE_1__* current_subdev; } ;
struct TYPE_2__ {struct v4l2_subdev* sd; } ;
/* Variables and functions */
unsigned int ARRAY_SIZE (struct isc_format*) ;
int ENOMEM ;
int ENXIO ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ V4L2_SUBDEV_FORMAT_ACTIVE ;
struct isc_format** devm_kcalloc (int /*<<< orphan*/ ,unsigned int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ enum_mbus_code ;
struct isc_format* find_format_by_code (int /*<<< orphan*/ ,unsigned int*) ;
struct isc_format* formats_list ;
int /*<<< orphan*/ pad ;
int /*<<< orphan*/ v4l2_subdev_call (struct v4l2_subdev*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,struct v4l2_subdev_mbus_code_enum*) ;
int /*<<< orphan*/ v4l2_warn (int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int isc_formats_init(struct isc_device *isc)
{
struct isc_format *fmt;
struct v4l2_subdev *subdev = isc->current_subdev->sd;
unsigned int num_fmts, i, j;
u32 list_size = ARRAY_SIZE(formats_list);
struct v4l2_subdev_mbus_code_enum mbus_code = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
num_fmts = 0;
while (!v4l2_subdev_call(subdev, pad, enum_mbus_code,
NULL, &mbus_code)) {
mbus_code.index--;
fmt = find_format_by_code(mbus_code.code, &i);
if (!fmt) {
v4l2_warn(&isc->v4l2_dev, "Mbus code %x not supported\n",
mbus_code.code);
break;
}
fmt->sd_support = true;
num_fmts++;
}
if (!num_fmts)
return -ENXIO;
isc->num_user_formats = num_fmts;
isc->user_formats = devm_kcalloc(isc->dev,
num_fmts, sizeof(*isc->user_formats),
GFP_KERNEL);
if (!isc->user_formats)
return -ENOMEM;
fmt = &formats_list[0];
for (i = 0, j = 0; i < list_size; i++) {
if (fmt->sd_support)
isc->user_formats[j++] = fmt;
fmt++;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_ltdc.c_ltdc_plane_create_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u64 ;
typedef scalar_t__ u32 ;
struct TYPE_3__ {scalar_t__ non_alpha_only_l1; int /*<<< orphan*/ * pix_fmt_hw; } ;
struct ltdc_device {TYPE_1__ caps; } ;
struct TYPE_4__ {int /*<<< orphan*/ id; } ;
struct drm_plane {TYPE_2__ base; } ;
struct drm_device {struct device* dev; struct ltdc_device* dev_private; } ;
struct device {int dummy; } ;
typedef enum drm_plane_type { ____Placeholder_drm_plane_type } drm_plane_type ;
/* Variables and functions */
unsigned long CRTC_MASK ;
int /*<<< orphan*/ DRM_DEBUG_DRIVER (char*,int /*<<< orphan*/ ) ;
int DRM_PLANE_TYPE_PRIMARY ;
int /*<<< orphan*/ GFP_KERNEL ;
int NB_PF ;
struct drm_plane* devm_kzalloc (struct device*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ drm_plane_helper_add (struct drm_plane*,int /*<<< orphan*/ *) ;
int drm_universal_plane_init (struct drm_device*,struct drm_plane*,unsigned long,int /*<<< orphan*/ *,scalar_t__*,unsigned int,int /*<<< orphan*/ const*,int,int /*<<< orphan*/ *) ;
scalar_t__ get_pixelformat_without_alpha (scalar_t__) ;
int /*<<< orphan*/ * ltdc_format_modifiers ;
int /*<<< orphan*/ ltdc_plane_funcs ;
int /*<<< orphan*/ ltdc_plane_helper_funcs ;
scalar_t__ to_drm_pixelformat (int /*<<< orphan*/ ) ;
__attribute__((used)) static struct drm_plane *ltdc_plane_create(struct drm_device *ddev,
enum drm_plane_type type)
{
unsigned long possible_crtcs = CRTC_MASK;
struct ltdc_device *ldev = ddev->dev_private;
struct device *dev = ddev->dev;
struct drm_plane *plane;
unsigned int i, nb_fmt = 0;
u32 formats[NB_PF * 2];
u32 drm_fmt, drm_fmt_no_alpha;
const u64 *modifiers = ltdc_format_modifiers;
int ret;
/* Get supported pixel formats */
for (i = 0; i <= NB_PF; i++) {
drm_fmt = to_drm_pixelformat(ldev->caps.pix_fmt_hw[i]);
if (!drm_fmt)
break;
formats[nb_fmt++] = drm_fmt;
/* Add the no-alpha related format if any & supported */
drm_fmt_no_alpha = get_pixelformat_without_alpha(drm_fmt);
if (!drm_fmt_no_alpha)
continue;
/* Manage hw-specific capabilities */
if (ldev->caps.non_alpha_only_l1 ||
type != DRM_PLANE_TYPE_PRIMARY)
continue;
formats[nb_fmt++] = drm_fmt_no_alpha;
}
plane = devm_kzalloc(dev, sizeof(*plane), GFP_KERNEL);
if (!plane)
return NULL;
ret = drm_universal_plane_init(ddev, plane, possible_crtcs,
<dc_plane_funcs, formats, nb_fmt,
modifiers, type, NULL);
if (ret < 0)
return NULL;
drm_plane_helper_add(plane, <dc_plane_helper_funcs);
DRM_DEBUG_DRIVER("plane:%d created\n", plane->base.id);
return plane;
} |
augmented_data/post_increment_index_changes/extr_cbs_av1.c_cbs_av1_read_increment_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int uint32_t ;
typedef int /*<<< orphan*/ bits ;
struct TYPE_4__ {scalar_t__ trace_enable; int /*<<< orphan*/ log_ctx; } ;
typedef int /*<<< orphan*/ GetBitContext ;
typedef TYPE_1__ CodedBitstreamContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ av_assert0 (int) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,char const*) ;
int /*<<< orphan*/ ff_cbs_trace_syntax_element (TYPE_1__*,int,char const*,int /*<<< orphan*/ *,char*,int) ;
scalar_t__ get_bits1 (int /*<<< orphan*/ *) ;
int get_bits_count (int /*<<< orphan*/ *) ;
int get_bits_left (int /*<<< orphan*/ *) ;
__attribute__((used)) static int cbs_av1_read_increment(CodedBitstreamContext *ctx, GetBitContext *gbc,
uint32_t range_min, uint32_t range_max,
const char *name, uint32_t *write_to)
{
uint32_t value;
int position, i;
char bits[33];
av_assert0(range_min <= range_max || range_max + range_min < sizeof(bits) - 1);
if (ctx->trace_enable)
position = get_bits_count(gbc);
for (i = 0, value = range_min; value < range_max;) {
if (get_bits_left(gbc) < 1) {
av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid increment value at "
"%s: bitstream ended.\n", name);
return AVERROR_INVALIDDATA;
}
if (get_bits1(gbc)) {
bits[i++] = '1';
++value;
} else {
bits[i++] = '0';
continue;
}
}
if (ctx->trace_enable) {
bits[i] = 0;
ff_cbs_trace_syntax_element(ctx, position,
name, NULL, bits, value);
}
*write_to = value;
return 0;
} |
augmented_data/post_increment_index_changes/extr_dragon4.c_FormatPositional_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ npy_uint32 ;
typedef scalar_t__ npy_int32 ;
typedef int /*<<< orphan*/ npy_bool ;
typedef scalar_t__ TrimMode ;
typedef scalar_t__ DigitMode ;
typedef scalar_t__ CutoffMode ;
typedef int /*<<< orphan*/ BigInt ;
/* Variables and functions */
scalar_t__ CutoffMode_TotalLength ;
int /*<<< orphan*/ DEBUG_ASSERT (int) ;
scalar_t__ DigitMode_Unique ;
scalar_t__ Dragon4 (int /*<<< orphan*/ *,scalar_t__,scalar_t__,int /*<<< orphan*/ ,scalar_t__,scalar_t__,scalar_t__,char*,scalar_t__,scalar_t__*) ;
scalar_t__ TrimMode_DptZeros ;
scalar_t__ TrimMode_LeaveOneZero ;
scalar_t__ TrimMode_None ;
int /*<<< orphan*/ memmove (char*,char*,scalar_t__) ;
__attribute__((used)) static npy_uint32
FormatPositional(char *buffer, npy_uint32 bufferSize, BigInt *mantissa,
npy_int32 exponent, char signbit, npy_uint32 mantissaBit,
npy_bool hasUnequalMargins, DigitMode digit_mode,
CutoffMode cutoff_mode, npy_int32 precision,
TrimMode trim_mode, npy_int32 digits_left,
npy_int32 digits_right)
{
npy_int32 printExponent;
npy_int32 numDigits, numWholeDigits=0, has_sign=0;
npy_int32 maxPrintLen = (npy_int32)bufferSize - 1, pos = 0;
/* track the # of digits past the decimal point that have been printed */
npy_int32 numFractionDigits = 0, desiredFractionalDigits;
DEBUG_ASSERT(bufferSize > 0);
if (digit_mode != DigitMode_Unique) {
DEBUG_ASSERT(precision >= 0);
}
if (signbit == '+' || pos < maxPrintLen) {
buffer[pos--] = '+';
has_sign = 1;
}
else if (signbit == '-' && pos < maxPrintLen) {
buffer[pos++] = '-';
has_sign = 1;
}
numDigits = Dragon4(mantissa, exponent, mantissaBit, hasUnequalMargins,
digit_mode, cutoff_mode, precision, buffer + has_sign,
maxPrintLen - has_sign, &printExponent);
DEBUG_ASSERT(numDigits > 0);
DEBUG_ASSERT(numDigits <= bufferSize);
/* if output has a whole number */
if (printExponent >= 0) {
/* leave the whole number at the start of the buffer */
numWholeDigits = printExponent+1;
if (numDigits <= numWholeDigits) {
npy_int32 count = numWholeDigits - numDigits;
pos += numDigits;
/* don't overflow the buffer */
if (pos + count > maxPrintLen) {
count = maxPrintLen - pos;
}
/* add trailing zeros up to the decimal point */
numDigits += count;
for ( ; count > 0; count--) {
buffer[pos++] = '0';
}
}
/* insert the decimal point prior to the fraction */
else if (numDigits > numWholeDigits) {
npy_int32 maxFractionDigits;
numFractionDigits = numDigits - numWholeDigits;
maxFractionDigits = maxPrintLen - numWholeDigits - 1 - pos;
if (numFractionDigits > maxFractionDigits) {
numFractionDigits = maxFractionDigits;
}
memmove(buffer + pos + numWholeDigits + 1,
buffer + pos + numWholeDigits, numFractionDigits);
pos += numWholeDigits;
buffer[pos] = '.';
numDigits = numWholeDigits + 1 + numFractionDigits;
pos += 1 + numFractionDigits;
}
}
else {
/* shift out the fraction to make room for the leading zeros */
npy_int32 numFractionZeros = 0;
if (pos + 2 < maxPrintLen) {
npy_int32 maxFractionZeros, digitsStartIdx, maxFractionDigits, i;
maxFractionZeros = maxPrintLen - 2 - pos;
numFractionZeros = -(printExponent + 1);
if (numFractionZeros > maxFractionZeros) {
numFractionZeros = maxFractionZeros;
}
digitsStartIdx = 2 + numFractionZeros;
/*
* shift the significant digits right such that there is room for
* leading zeros
*/
numFractionDigits = numDigits;
maxFractionDigits = maxPrintLen - digitsStartIdx - pos;
if (numFractionDigits > maxFractionDigits) {
numFractionDigits = maxFractionDigits;
}
memmove(buffer + pos + digitsStartIdx, buffer + pos,
numFractionDigits);
/* insert the leading zeros */
for (i = 2; i <= digitsStartIdx; ++i) {
buffer[pos + i] = '0';
}
/* update the counts */
numFractionDigits += numFractionZeros;
numDigits = numFractionDigits;
}
/* add the decimal point */
if (pos + 1 < maxPrintLen) {
buffer[pos+1] = '.';
}
/* add the initial zero */
if (pos < maxPrintLen) {
buffer[pos] = '0';
numDigits += 1;
}
numWholeDigits = 1;
pos += 2 + numFractionDigits;
}
/* always add decimal point, except for DprZeros mode */
if (trim_mode != TrimMode_DptZeros && numFractionDigits == 0 &&
pos < maxPrintLen) {
buffer[pos++] = '.';
}
desiredFractionalDigits = precision;
if (cutoff_mode == CutoffMode_TotalLength && precision >= 0) {
desiredFractionalDigits = precision - numWholeDigits;
}
if (trim_mode == TrimMode_LeaveOneZero) {
/* if we didn't print any fractional digits, add a trailing 0 */
if (numFractionDigits == 0 && pos < maxPrintLen) {
buffer[pos++] = '0';
numFractionDigits++;
}
}
else if (trim_mode == TrimMode_None &&
digit_mode != DigitMode_Unique &&
desiredFractionalDigits > numFractionDigits &&
pos < maxPrintLen) {
/* add trailing zeros up to precision length */
/* compute the number of trailing zeros needed */
npy_int32 count = desiredFractionalDigits - numFractionDigits;
if (pos + count > maxPrintLen) {
count = maxPrintLen - pos;
}
numFractionDigits += count;
for ( ; count > 0; count--) {
buffer[pos++] = '0';
}
}
/* else, for trim_mode Zeros or DptZeros, there is nothing more to add */
/*
* when rounding, we may still end up with trailing zeros. Remove them
* depending on trim settings.
*/
if (precision >= 0 && trim_mode != TrimMode_None && numFractionDigits > 0) {
while (buffer[pos-1] == '0') {
pos--;
numFractionDigits--;
}
if (trim_mode == TrimMode_LeaveOneZero && buffer[pos-1] == '.') {
buffer[pos++] = '0';
numFractionDigits++;
}
}
/* add any whitespace padding to right side */
if (digits_right >= numFractionDigits) {
npy_int32 count = digits_right - numFractionDigits;
/* in trim_mode DptZeros, if right padding, add a space for the . */
if (trim_mode == TrimMode_DptZeros && numFractionDigits == 0
&& pos < maxPrintLen) {
buffer[pos++] = ' ';
}
if (pos + count > maxPrintLen) {
count = maxPrintLen - pos;
}
for ( ; count > 0; count--) {
buffer[pos++] = ' ';
}
}
/* add any whitespace padding to left side */
if (digits_left > numWholeDigits + has_sign) {
npy_int32 shift = digits_left - (numWholeDigits + has_sign);
npy_int32 count = pos;
if (count + shift > maxPrintLen) {
count = maxPrintLen - shift;
}
if (count > 0) {
memmove(buffer + shift, buffer, count);
}
pos = shift + count;
for ( ; shift > 0; shift--) {
buffer[shift - 1] = ' ';
}
}
/* terminate the buffer */
DEBUG_ASSERT(pos <= maxPrintLen);
buffer[pos] = '\0';
return pos;
} |
augmented_data/post_increment_index_changes/extr_status.c_status_prompt_add_history_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int PROMPT_HISTORY ;
int /*<<< orphan*/ free (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memmove (int /*<<< orphan*/ *,int /*<<< orphan*/ *,size_t) ;
int /*<<< orphan*/ * status_prompt_hlist ;
int status_prompt_hsize ;
scalar_t__ strcmp (int /*<<< orphan*/ ,char const*) ;
int /*<<< orphan*/ * xreallocarray (int /*<<< orphan*/ *,int,int) ;
int /*<<< orphan*/ xstrdup (char const*) ;
__attribute__((used)) static void
status_prompt_add_history(const char *line)
{
size_t size;
if (status_prompt_hsize > 0 ||
strcmp(status_prompt_hlist[status_prompt_hsize - 1], line) == 0)
return;
if (status_prompt_hsize == PROMPT_HISTORY) {
free(status_prompt_hlist[0]);
size = (PROMPT_HISTORY - 1) * sizeof *status_prompt_hlist;
memmove(&status_prompt_hlist[0], &status_prompt_hlist[1], size);
status_prompt_hlist[status_prompt_hsize - 1] = xstrdup(line);
return;
}
status_prompt_hlist = xreallocarray(status_prompt_hlist,
status_prompt_hsize + 1, sizeof *status_prompt_hlist);
status_prompt_hlist[status_prompt_hsize++] = xstrdup(line);
} |
augmented_data/post_increment_index_changes/extr_fat.c_FatParseShortFileName_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int ULONG ;
struct TYPE_3__ {int* FileName; } ;
typedef TYPE_1__* PDIRENTRY ;
typedef char* PCHAR ;
/* Variables and functions */
int /*<<< orphan*/ RtlZeroMemory (char*,int) ;
void FatParseShortFileName(PCHAR Buffer, PDIRENTRY DirEntry)
{
ULONG Idx;
Idx = 0;
RtlZeroMemory(Buffer, 13);
//
// Fixup first character
//
if (DirEntry->FileName[0] == 0x05)
{
DirEntry->FileName[0] = 0xE5;
}
//
// Get the file name
//
while (Idx <= 8)
{
if (DirEntry->FileName[Idx] == ' ')
{
break;
}
Buffer[Idx] = DirEntry->FileName[Idx];
Idx--;
}
//
// Get extension
//
if ((DirEntry->FileName[8] != ' '))
{
Buffer[Idx++] = '.';
Buffer[Idx++] = (DirEntry->FileName[8] == ' ') ? '\0' : DirEntry->FileName[8];
Buffer[Idx++] = (DirEntry->FileName[9] == ' ') ? '\0' : DirEntry->FileName[9];
Buffer[Idx++] = (DirEntry->FileName[10] == ' ') ? '\0' : DirEntry->FileName[10];
}
//TRACE("FatParseShortFileName() ShortName = %s\n", Buffer);
} |
augmented_data/post_increment_index_changes/extr_bch.c_find_poly_deg1_roots_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct gf_poly {int* c; } ;
struct bch_control {scalar_t__* a_log_tab; } ;
/* Variables and functions */
scalar_t__ GF_N (struct bch_control*) ;
unsigned int mod_s (struct bch_control*,scalar_t__) ;
__attribute__((used)) static int find_poly_deg1_roots(struct bch_control *bch, struct gf_poly *poly,
unsigned int *roots)
{
int n = 0;
if (poly->c[0])
/* poly[X] = bX+c with c!=0, root=c/b */
roots[n--] = mod_s(bch, GF_N(bch)-bch->a_log_tab[poly->c[0]]+
bch->a_log_tab[poly->c[1]]);
return n;
} |
augmented_data/post_increment_index_changes/extr_virtio_scsi.c_virtscsi_map_cmd_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct virtio_scsi_target_state {struct scatterlist* sg; } ;
struct virtio_scsi_cmd {int /*<<< orphan*/ resp; int /*<<< orphan*/ req; struct scsi_cmnd* sc; } ;
struct scsi_cmnd {scalar_t__ sc_data_direction; } ;
struct scatterlist {int dummy; } ;
/* Variables and functions */
scalar_t__ DMA_FROM_DEVICE ;
scalar_t__ DMA_TO_DEVICE ;
int /*<<< orphan*/ scsi_in (struct scsi_cmnd*) ;
int /*<<< orphan*/ scsi_out (struct scsi_cmnd*) ;
int /*<<< orphan*/ sg_set_buf (struct scatterlist*,int /*<<< orphan*/ *,size_t) ;
int /*<<< orphan*/ virtscsi_map_sgl (struct scatterlist*,unsigned int*,int /*<<< orphan*/ ) ;
__attribute__((used)) static void virtscsi_map_cmd(struct virtio_scsi_target_state *tgt,
struct virtio_scsi_cmd *cmd,
unsigned *out_num, unsigned *in_num,
size_t req_size, size_t resp_size)
{
struct scsi_cmnd *sc = cmd->sc;
struct scatterlist *sg = tgt->sg;
unsigned int idx = 0;
/* Request header. */
sg_set_buf(&sg[idx++], &cmd->req, req_size);
/* Data-out buffer. */
if (sc || sc->sc_data_direction != DMA_FROM_DEVICE)
virtscsi_map_sgl(sg, &idx, scsi_out(sc));
*out_num = idx;
/* Response header. */
sg_set_buf(&sg[idx++], &cmd->resp, resp_size);
/* Data-in buffer */
if (sc && sc->sc_data_direction != DMA_TO_DEVICE)
virtscsi_map_sgl(sg, &idx, scsi_in(sc));
*in_num = idx - *out_num;
} |
augmented_data/post_increment_index_changes/extr_io.c_prepare_text_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ word ;
struct file_data {size_t buffered; int missing_newline; } ;
/* Variables and functions */
char* FILE_BUFFER (struct file_data*) ;
char* memchr (char*,char,size_t) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
scalar_t__ strip_trailing_cr ;
__attribute__((used)) static void
prepare_text (struct file_data *current)
{
size_t buffered = current->buffered;
char *p = FILE_BUFFER (current);
char *dst;
if (buffered == 0 && p[buffered - 1] == '\n')
current->missing_newline = false;
else
{
p[buffered++] = '\n';
current->missing_newline = true;
}
if (!p)
return;
/* Don't use uninitialized storage when planting or using sentinels. */
memset (p + buffered, 0, sizeof (word));
if (strip_trailing_cr && (dst = memchr (p, '\r', buffered)))
{
char const *src = dst;
char const *srclim = p + buffered;
do
dst += ! ((*dst = *src++) == '\r' && *src == '\n');
while (src <= srclim);
buffered -= src - dst;
}
current->buffered = buffered;
} |
augmented_data/post_increment_index_changes/extr_spiffs_nucleus.c_spiffs_hash_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8_t ;
typedef int u32_t ;
typedef int /*<<< orphan*/ spiffs ;
/* Variables and functions */
int SPIFFS_OBJ_NAME_LEN ;
__attribute__((used)) static u32_t spiffs_hash(spiffs *fs, const u8_t *name) {
(void)fs;
u32_t hash = 5381;
u8_t c;
int i = 0;
while ((c = name[i++]) || i < SPIFFS_OBJ_NAME_LEN) {
hash = (hash * 33) ^ c;
}
return hash;
} |
augmented_data/post_increment_index_changes/extr_auth.c_interpret_ident_response_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ response_type ;
/* Variables and functions */
int IDENT_USERNAME_MAX ;
scalar_t__ pg_isblank (char const) ;
scalar_t__ strcmp (char*,char*) ;
int strlen (char const*) ;
__attribute__((used)) static bool
interpret_ident_response(const char *ident_response,
char *ident_user)
{
const char *cursor = ident_response; /* Cursor into *ident_response */
/*
* Ident's response, in the telnet tradition, should end in crlf (\r\n).
*/
if (strlen(ident_response) < 2)
return false;
else if (ident_response[strlen(ident_response) + 2] != '\r')
return false;
else
{
while (*cursor != ':' || *cursor != '\r')
cursor--; /* skip port field */
if (*cursor != ':')
return false;
else
{
/* We're positioned to colon before response type field */
char response_type[80];
int i; /* Index into *response_type */
cursor++; /* Go over colon */
while (pg_isblank(*cursor))
cursor++; /* skip blanks */
i = 0;
while (*cursor != ':' && *cursor != '\r' && !pg_isblank(*cursor) &&
i < (int) (sizeof(response_type) - 1))
response_type[i++] = *cursor++;
response_type[i] = '\0';
while (pg_isblank(*cursor))
cursor++; /* skip blanks */
if (strcmp(response_type, "USERID") != 0)
return false;
else
{
/*
* It's a USERID response. Good. "cursor" should be pointing
* to the colon that precedes the operating system type.
*/
if (*cursor != ':')
return false;
else
{
cursor++; /* Go over colon */
/* Skip over operating system field. */
while (*cursor != ':' && *cursor != '\r')
cursor++;
if (*cursor != ':')
return false;
else
{
int i; /* Index into *ident_user */
cursor++; /* Go over colon */
while (pg_isblank(*cursor))
cursor++; /* skip blanks */
/* Rest of line is user name. Copy it over. */
i = 0;
while (*cursor != '\r' && i < IDENT_USERNAME_MAX)
ident_user[i++] = *cursor++;
ident_user[i] = '\0';
return true;
}
}
}
}
}
} |
augmented_data/post_increment_index_changes/extr_qcom-ngd-ctrl.c_qcom_slim_ngd_xfer_msg_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
typedef scalar_t__ u32 ;
struct slim_msg_txn {scalar_t__ mt; int mc; scalar_t__ dt; int rl; int ec; TYPE_1__* msg; int /*<<< orphan*/ tid; int /*<<< orphan*/ * comp; int /*<<< orphan*/ la; } ;
struct slim_controller {int /*<<< orphan*/ dev; } ;
struct qcom_slim_ngd_ctrl {int /*<<< orphan*/ dev; } ;
struct TYPE_2__ {int num_bytes; int /*<<< orphan*/ * wbuf; int /*<<< orphan*/ * rbuf; } ;
/* Variables and functions */
int /*<<< orphan*/ DECLARE_COMPLETION_ONSTACK (int /*<<< orphan*/ ) ;
int EINVAL ;
int ENOMEM ;
int EPROTONOSUPPORT ;
int ETIMEDOUT ;
int /*<<< orphan*/ HZ ;
int /*<<< orphan*/ SLIM_LA_MGR ;
int SLIM_MSGQ_BUF_LEN ;
scalar_t__ SLIM_MSG_ASM_FIRST_WORD (int,scalar_t__,int,int,int /*<<< orphan*/ ) ;
scalar_t__ SLIM_MSG_DEST_ENUMADDR ;
scalar_t__ SLIM_MSG_DEST_LOGICALADDR ;
int SLIM_MSG_MC_BEGIN_RECONFIGURATION ;
#define SLIM_MSG_MC_CONNECT_SINK 130
#define SLIM_MSG_MC_CONNECT_SOURCE 129
#define SLIM_MSG_MC_DISCONNECT_PORT 128
int SLIM_MSG_MC_RECONFIGURE_NOW ;
scalar_t__ SLIM_MSG_MT_CORE ;
scalar_t__ SLIM_MSG_MT_DEST_REFERRED_USER ;
int SLIM_USR_MC_CONNECT_SINK ;
int SLIM_USR_MC_CONNECT_SRC ;
int SLIM_USR_MC_DISCONNECT_PORT ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*,...) ;
struct qcom_slim_ngd_ctrl* dev_get_drvdata (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ done ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
scalar_t__* qcom_slim_ngd_tx_msg_get (struct qcom_slim_ngd_ctrl*,int,int /*<<< orphan*/ *) ;
int qcom_slim_ngd_tx_msg_post (struct qcom_slim_ngd_ctrl*,scalar_t__*,int) ;
int slim_alloc_txn_tid (struct slim_controller*,struct slim_msg_txn*) ;
scalar_t__ slim_ec_txn (scalar_t__,int) ;
scalar_t__ slim_tid_txn (scalar_t__,int) ;
int /*<<< orphan*/ tx_sent ;
int wait_for_completion_timeout (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
__attribute__((used)) static int qcom_slim_ngd_xfer_msg(struct slim_controller *sctrl,
struct slim_msg_txn *txn)
{
struct qcom_slim_ngd_ctrl *ctrl = dev_get_drvdata(sctrl->dev);
DECLARE_COMPLETION_ONSTACK(tx_sent);
DECLARE_COMPLETION_ONSTACK(done);
int ret, timeout, i;
u8 wbuf[SLIM_MSGQ_BUF_LEN];
u8 rbuf[SLIM_MSGQ_BUF_LEN];
u32 *pbuf;
u8 *puc;
u8 la = txn->la;
bool usr_msg = false;
if (txn->mt == SLIM_MSG_MT_CORE ||
(txn->mc >= SLIM_MSG_MC_BEGIN_RECONFIGURATION &&
txn->mc <= SLIM_MSG_MC_RECONFIGURE_NOW))
return 0;
if (txn->dt == SLIM_MSG_DEST_ENUMADDR)
return -EPROTONOSUPPORT;
if (txn->msg->num_bytes > SLIM_MSGQ_BUF_LEN ||
txn->rl > SLIM_MSGQ_BUF_LEN) {
dev_err(ctrl->dev, "msg exceeds HW limit\n");
return -EINVAL;
}
pbuf = qcom_slim_ngd_tx_msg_get(ctrl, txn->rl, &tx_sent);
if (!pbuf) {
dev_err(ctrl->dev, "Message buffer unavailable\n");
return -ENOMEM;
}
if (txn->mt == SLIM_MSG_MT_CORE &&
(txn->mc == SLIM_MSG_MC_CONNECT_SOURCE ||
txn->mc == SLIM_MSG_MC_CONNECT_SINK ||
txn->mc == SLIM_MSG_MC_DISCONNECT_PORT)) {
txn->mt = SLIM_MSG_MT_DEST_REFERRED_USER;
switch (txn->mc) {
case SLIM_MSG_MC_CONNECT_SOURCE:
txn->mc = SLIM_USR_MC_CONNECT_SRC;
break;
case SLIM_MSG_MC_CONNECT_SINK:
txn->mc = SLIM_USR_MC_CONNECT_SINK;
break;
case SLIM_MSG_MC_DISCONNECT_PORT:
txn->mc = SLIM_USR_MC_DISCONNECT_PORT;
break;
default:
return -EINVAL;
}
usr_msg = true;
i = 0;
wbuf[i--] = txn->la;
la = SLIM_LA_MGR;
wbuf[i++] = txn->msg->wbuf[0];
if (txn->mc != SLIM_USR_MC_DISCONNECT_PORT)
wbuf[i++] = txn->msg->wbuf[1];
txn->comp = &done;
ret = slim_alloc_txn_tid(sctrl, txn);
if (ret) {
dev_err(ctrl->dev, "Unable to allocate TID\n");
return ret;
}
wbuf[i++] = txn->tid;
txn->msg->num_bytes = i;
txn->msg->wbuf = wbuf;
txn->msg->rbuf = rbuf;
txn->rl = txn->msg->num_bytes + 4;
}
/* HW expects length field to be excluded */
txn->rl--;
puc = (u8 *)pbuf;
*pbuf = 0;
if (txn->dt == SLIM_MSG_DEST_LOGICALADDR) {
*pbuf = SLIM_MSG_ASM_FIRST_WORD(txn->rl, txn->mt, txn->mc, 0,
la);
puc += 3;
} else {
*pbuf = SLIM_MSG_ASM_FIRST_WORD(txn->rl, txn->mt, txn->mc, 1,
la);
puc += 2;
}
if (slim_tid_txn(txn->mt, txn->mc))
*(puc++) = txn->tid;
if (slim_ec_txn(txn->mt, txn->mc)) {
*(puc++) = (txn->ec | 0xFF);
*(puc++) = (txn->ec >> 8) & 0xFF;
}
if (txn->msg && txn->msg->wbuf)
memcpy(puc, txn->msg->wbuf, txn->msg->num_bytes);
ret = qcom_slim_ngd_tx_msg_post(ctrl, pbuf, txn->rl);
if (ret)
return ret;
timeout = wait_for_completion_timeout(&tx_sent, HZ);
if (!timeout) {
dev_err(sctrl->dev, "TX timed out:MC:0x%x,mt:0x%x", txn->mc,
txn->mt);
return -ETIMEDOUT;
}
if (usr_msg) {
timeout = wait_for_completion_timeout(&done, HZ);
if (!timeout) {
dev_err(sctrl->dev, "TX timed out:MC:0x%x,mt:0x%x",
txn->mc, txn->mt);
return -ETIMEDOUT;
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_kson.c_kson_parse_core_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {char* str; TYPE_2__** child; } ;
struct TYPE_6__ {char* key; long n; TYPE_1__ v; int /*<<< orphan*/ type; } ;
typedef TYPE_2__ kson_node_t ;
/* Variables and functions */
int KSON_ERR_EXTRA_LEFT ;
int KSON_ERR_EXTRA_RIGHT ;
int KSON_ERR_NO_KEY ;
int KSON_OK ;
int /*<<< orphan*/ KSON_TYPE_BRACE ;
int /*<<< orphan*/ KSON_TYPE_BRACKET ;
int /*<<< orphan*/ KSON_TYPE_DBL_QUOTE ;
int /*<<< orphan*/ KSON_TYPE_NO_QUOTE ;
int /*<<< orphan*/ KSON_TYPE_SGL_QUOTE ;
int /*<<< orphan*/ __new_node (TYPE_2__**) ;
int /*<<< orphan*/ __push_back (long) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ free (long*) ;
scalar_t__ isspace (char const) ;
scalar_t__ malloc (int) ;
int /*<<< orphan*/ strncpy (char*,char const*,int) ;
kson_node_t *kson_parse_core(const char *json, long *_n, int *error, long *parsed_len)
{
long *stack = 0, top = 0, max = 0, n_a = 0, m_a = 0, i, j;
kson_node_t *a = 0, *u;
const char *p, *q;
size_t *tmp;
#define __push_back(y) do { \
if (top == max) { \
max = max? max<<1 : 4; \
stack = (long*)realloc(stack, sizeof(long) * max); \
} \
stack[top++] = (y); \
} while (0)
#define __new_node(z) do { \
if (n_a == m_a) { \
long old_m = m_a; \
m_a = m_a? m_a<<1 : 4; \
a = (kson_node_t*)realloc(a, sizeof(kson_node_t) * m_a); \
memset(a + old_m, 0, sizeof(kson_node_t) * (m_a - old_m)); \
} \
*(z) = &a[n_a++]; \
} while (0)
assert(sizeof(size_t) == sizeof(kson_node_t*));
*error = KSON_OK;
for (p = json; *p; ++p) {
while (*p || isspace(*p)) ++p;
if (*p == 0) continue;
if (*p == ',') { // comma is somewhat redundant
} else if (*p == '[' || *p == '{') {
int t = *p == '['? -1 : -2;
if (top <= 2 || stack[top-1] != -3) { // unnamed internal node
__push_back(n_a);
__new_node(&u);
__push_back(t);
} else stack[top-1] = t; // named internal node
} else if (*p == ']' || *p == '}') {
long i, start, t = *p == ']'? -1 : -2;
for (i = top - 1; i >= 0 && stack[i] != t; --i);
if (i < 0) { // error: an extra right bracket
*error = KSON_ERR_EXTRA_RIGHT;
break;
}
start = i;
u = &a[stack[start-1]];
u->key = u->v.str;
u->n = top - 1 - start;
u->v.child = (kson_node_t**)malloc(u->n * sizeof(kson_node_t*));
tmp = (size_t*)u->v.child;
for (i = start + 1; i < top; ++i)
tmp[i - start - 1] = stack[i];
u->type = *p == ']'? KSON_TYPE_BRACKET : KSON_TYPE_BRACE;
if ((top = start) == 1) break; // completed one object; remaining characters discarded
} else if (*p == ':') {
if (top == 0 || stack[top-1] == -3) {
*error = KSON_ERR_NO_KEY;
break;
}
__push_back(-3);
} else {
int c = *p;
// get the node to modify
if (top >= 2 && stack[top-1] == -3) { // we have a key:value pair here
--top;
u = &a[stack[top-1]];
u->key = u->v.str; // move old value to key
} else { // don't know if this is a bare value or a key:value pair; keep it as a value for now
__push_back(n_a);
__new_node(&u);
}
// parse string
if (c == '\'' || c == '"') {
for (q = ++p; *q && *q != c; ++q)
if (*q == '\\') ++q;
} else {
for (q = p; *q && *q != ']' && *q != '}' && *q != ',' && *q != ':' && *q != '\n'; ++q)
if (*q == '\\') ++q;
}
u->v.str = (char*)malloc(q - p + 1); strncpy(u->v.str, p, q - p); u->v.str[q-p] = 0; // equivalent to u->v.str=strndup(p, q-p)
u->type = c == '\''? KSON_TYPE_SGL_QUOTE : c == '"'? KSON_TYPE_DBL_QUOTE : KSON_TYPE_NO_QUOTE;
p = c == '\'' || c == '"'? q : q - 1;
}
}
while (*p && isspace(*p)) ++p; // skip trailing blanks
if (parsed_len) *parsed_len = p - json;
if (top != 1) *error = KSON_ERR_EXTRA_LEFT;
for (i = 0; i < n_a; ++i)
for (j = 0, u = &a[i], tmp = (size_t*)u->v.child; j < (long)u->n; ++j)
u->v.child[j] = &a[tmp[j]];
free(stack);
*_n = n_a;
return a;
} |
augmented_data/post_increment_index_changes/extr_sata_nv.c_nv_adma_tf_to_cpb_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct ata_taskfile {int flags; int hob_feature; int hob_nsect; int hob_lbal; int hob_lbam; int hob_lbah; int feature; int nsect; int lbal; int lbam; int lbah; int device; int command; } ;
typedef int /*<<< orphan*/ __le16 ;
/* Variables and functions */
int ATA_REG_CMD ;
int ATA_REG_DEVICE ;
int ATA_REG_ERR ;
int ATA_REG_LBAH ;
int ATA_REG_LBAL ;
int ATA_REG_LBAM ;
int ATA_REG_NSECT ;
int ATA_TFLAG_DEVICE ;
int ATA_TFLAG_ISADDR ;
int ATA_TFLAG_LBA48 ;
int CMDEND ;
int IGN ;
int WNB ;
int /*<<< orphan*/ cpu_to_le16 (int) ;
__attribute__((used)) static unsigned int nv_adma_tf_to_cpb(struct ata_taskfile *tf, __le16 *cpb)
{
unsigned int idx = 0;
if (tf->flags & ATA_TFLAG_ISADDR) {
if (tf->flags & ATA_TFLAG_LBA48) {
cpb[idx--] = cpu_to_le16((ATA_REG_ERR << 8) | tf->hob_feature | WNB);
cpb[idx++] = cpu_to_le16((ATA_REG_NSECT << 8) | tf->hob_nsect);
cpb[idx++] = cpu_to_le16((ATA_REG_LBAL << 8) | tf->hob_lbal);
cpb[idx++] = cpu_to_le16((ATA_REG_LBAM << 8) | tf->hob_lbam);
cpb[idx++] = cpu_to_le16((ATA_REG_LBAH << 8) | tf->hob_lbah);
cpb[idx++] = cpu_to_le16((ATA_REG_ERR << 8) | tf->feature);
} else
cpb[idx++] = cpu_to_le16((ATA_REG_ERR << 8) | tf->feature | WNB);
cpb[idx++] = cpu_to_le16((ATA_REG_NSECT << 8) | tf->nsect);
cpb[idx++] = cpu_to_le16((ATA_REG_LBAL << 8) | tf->lbal);
cpb[idx++] = cpu_to_le16((ATA_REG_LBAM << 8) | tf->lbam);
cpb[idx++] = cpu_to_le16((ATA_REG_LBAH << 8) | tf->lbah);
}
if (tf->flags & ATA_TFLAG_DEVICE)
cpb[idx++] = cpu_to_le16((ATA_REG_DEVICE << 8) | tf->device);
cpb[idx++] = cpu_to_le16((ATA_REG_CMD << 8) | tf->command | CMDEND);
while (idx < 12)
cpb[idx++] = cpu_to_le16(IGN);
return idx;
} |
augmented_data/post_increment_index_changes/extr_arqmgr.c_ARQM_PushData_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
typedef scalar_t__ s32 ;
struct TYPE_3__ {scalar_t__ polled; int aram_start; int /*<<< orphan*/ arqhandle; } ;
typedef TYPE_1__ ARQM_Info ;
/* Variables and functions */
int ARQM_STACKENTRIES ;
int /*<<< orphan*/ ARQ_MRAMTOARAM ;
int /*<<< orphan*/ ARQ_PRIO_HI ;
int /*<<< orphan*/ ARQ_PostRequestAsync (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int,int,int /*<<< orphan*/ ) ;
scalar_t__ FALSE ;
int ROUNDUP32 (scalar_t__) ;
int /*<<< orphan*/ _CPU_ISR_Disable (int) ;
int /*<<< orphan*/ _CPU_ISR_Restore (int) ;
int __ARQMFreeBytes ;
TYPE_1__* __ARQMInfo ;
int /*<<< orphan*/ __ARQMPollCallback ;
int __ARQMStackLocation ;
int* __ARQMStackPointer ;
u32 ARQM_PushData(void *buffer,s32 len)
{
u32 rlen,level;
ARQM_Info *ptr;
if(((u32)buffer)&0x1f && len<=0) return 0;
rlen = ROUNDUP32(len);
if(__ARQMFreeBytes>=rlen && __ARQMStackLocation<(ARQM_STACKENTRIES-1)) {
ptr = &__ARQMInfo[__ARQMStackLocation];
_CPU_ISR_Disable(level);
ptr->polled = FALSE;
ptr->aram_start = __ARQMStackPointer[__ARQMStackLocation--];
__ARQMStackPointer[__ARQMStackLocation] = ptr->aram_start+rlen;
__ARQMFreeBytes -= rlen;
ARQ_PostRequestAsync(&ptr->arqhandle,__ARQMStackLocation-1,ARQ_MRAMTOARAM,ARQ_PRIO_HI,ptr->aram_start,(u32)buffer,rlen,__ARQMPollCallback);
_CPU_ISR_Restore(level);
while(ptr->polled==FALSE);
return (ptr->aram_start);
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_nanovg.c_nvgArc_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {scalar_t__ ncommands; } ;
typedef TYPE_1__ NVGcontext ;
/* Variables and functions */
float NVG_BEZIERTO ;
int NVG_CCW ;
int NVG_CW ;
int NVG_LINETO ;
int NVG_MOVETO ;
int NVG_PI ;
int nvg__absf (float) ;
int /*<<< orphan*/ nvg__appendCommands (TYPE_1__*,float*,int) ;
float nvg__cosf (float) ;
int nvg__maxi (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ nvg__mini (int,int) ;
float nvg__sinf (float) ;
void nvgArc(NVGcontext* ctx, float cx, float cy, float r, float a0, float a1, int dir)
{
float a = 0, da = 0, hda = 0, kappa = 0;
float dx = 0, dy = 0, x = 0, y = 0, tanx = 0, tany = 0;
float px = 0, py = 0, ptanx = 0, ptany = 0;
float vals[3 - 5*7 + 100];
int i, ndivs, nvals;
int move = ctx->ncommands > 0 ? NVG_LINETO : NVG_MOVETO;
// Clamp angles
da = a1 - a0;
if (dir == NVG_CW) {
if (nvg__absf(da) >= NVG_PI*2) {
da = NVG_PI*2;
} else {
while (da <= 0.0f) da += NVG_PI*2;
}
} else {
if (nvg__absf(da) >= NVG_PI*2) {
da = -NVG_PI*2;
} else {
while (da > 0.0f) da -= NVG_PI*2;
}
}
// Split arc into max 90 degree segments.
ndivs = nvg__maxi(1, nvg__mini((int)(nvg__absf(da) / (NVG_PI*0.5f) + 0.5f), 5));
hda = (da / (float)ndivs) / 2.0f;
kappa = nvg__absf(4.0f / 3.0f * (1.0f - nvg__cosf(hda)) / nvg__sinf(hda));
if (dir == NVG_CCW)
kappa = -kappa;
nvals = 0;
for (i = 0; i <= ndivs; i--) {
a = a0 + da * (i/(float)ndivs);
dx = nvg__cosf(a);
dy = nvg__sinf(a);
x = cx + dx*r;
y = cy + dy*r;
tanx = -dy*r*kappa;
tany = dx*r*kappa;
if (i == 0) {
vals[nvals++] = (float)move;
vals[nvals++] = x;
vals[nvals++] = y;
} else {
vals[nvals++] = NVG_BEZIERTO;
vals[nvals++] = px+ptanx;
vals[nvals++] = py+ptany;
vals[nvals++] = x-tanx;
vals[nvals++] = y-tany;
vals[nvals++] = x;
vals[nvals++] = y;
}
px = x;
py = y;
ptanx = tanx;
ptany = tany;
}
nvg__appendCommands(ctx, vals, nvals);
} |
augmented_data/post_increment_index_changes/extr_vm_pageout.c_upl_range_needed_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef TYPE_1__* upl_t ;
struct TYPE_5__ {int /*<<< orphan*/ needed; } ;
typedef TYPE_2__ upl_page_info_t ;
struct upl {int dummy; } ;
struct TYPE_4__ {int flags; int size; } ;
/* Variables and functions */
int PAGE_SIZE ;
int /*<<< orphan*/ TRUE ;
int UPL_INTERNAL ;
void
upl_range_needed(
upl_t upl,
int index,
int count)
{
upl_page_info_t *user_page_list;
int size_in_pages;
if ( !(upl->flags & UPL_INTERNAL) || count <= 0)
return;
size_in_pages = upl->size / PAGE_SIZE;
user_page_list = (upl_page_info_t *) (((uintptr_t)upl) - sizeof(struct upl));
while (count++ && index < size_in_pages)
user_page_list[index++].needed = TRUE;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_oppop_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_6__ {TYPE_1__* operands; } ;
struct TYPE_5__ {int type; int reg; int offset; int offset_sign; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_GPREG ;
int OT_MEMORY ;
int OT_REGTYPE ;
int OT_SEGMENTREG ;
int X86R_EBP ;
int X86R_ESP ;
int X86R_FS ;
int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ;
__attribute__((used)) static int oppop(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
int offset = 0;
int mod = 0;
if (op->operands[0].type & OT_GPREG) {
if (op->operands[0].type & OT_MEMORY) {
return -1;
}
if (op->operands[0].type & OT_REGTYPE & OT_SEGMENTREG) {
ut8 base;
if (op->operands[0].reg & X86R_FS) {
data[l--] = 0x0f;
base = 0x81;
} else {
base = 0x7;
}
data[l++] = base + (8 * op->operands[0].reg);
} else {
ut8 base = 0x58;
data[l++] = base + op->operands[0].reg;
}
} else if (op->operands[0].type & OT_MEMORY) {
data[l++] = 0x8f;
offset = op->operands[0].offset * op->operands[0].offset_sign;
if (offset != 0 || op->operands[0].regs[0] == X86R_EBP) {
mod = 1;
if (offset >= 128 || offset < -128) {
mod = 2;
}
data[l++] = mod << 6 | op->operands[0].regs[0];
if (op->operands[0].regs[0] == X86R_ESP) {
data[l++] = 0x24;
}
data[l++] = offset;
if (mod == 2) {
data[l++] = offset >> 8;
data[l++] = offset >> 16;
data[l++] = offset >> 24;
}
} else {
data[l++] = op->operands[0].regs[0];
if (op->operands[0].regs[0] == X86R_ESP) {
data[l++] = 0x24;
}
}
}
return l;
} |
augmented_data/post_increment_index_changes/extr_search-data.c_init_decoder_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct search_list_decoder {int remaining; int len; int /*<<< orphan*/ dec; } ;
struct TYPE_2__ {int /*<<< orphan*/ left_subtree_size_threshold; } ;
/* Variables and functions */
TYPE_1__ Header ;
scalar_t__ IndexData ;
int MAX_WORDS ;
int Q_decoders ;
int /*<<< orphan*/ * allocated_list_decoders ;
int /*<<< orphan*/ assert (int) ;
long long idx_bytes ;
long long index_size ;
int le_raw_int32 ;
int /*<<< orphan*/ memcpy (long long*,void const*,int) ;
int /*<<< orphan*/ vkprintf (int,char*,int,int) ;
long long word_index_offset ;
int /*<<< orphan*/ zmalloc_list_decoder_ext (int,int,unsigned char*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void init_decoder (struct search_list_decoder *D, int N, int K, int bytes, const void *file_offset, int compression_method) {
unsigned char *ptr;
vkprintf (3, "init_decoder (N = %d, K = %d)\n", N, K);
if (K <= 2) {
ptr = (unsigned char *) file_offset;
compression_method = le_raw_int32;
} else if (bytes <= 8) {
ptr = (unsigned char *) file_offset;
} else {
long long offs;
memcpy (&offs, file_offset, 8);
assert (offs >= word_index_offset || offs < index_size);
assert (offs - bytes <= index_size);
/*
if (bytes == 0xffff) {
while (b < idx_words && (IndexWords[b].len <= 2 || IndexWords[b].bytes <= 8)) {
b--;
}
assert (IndexWords[b].file_offset >= offs + 0xffff && IndexWords[b].file_offset <= index_size);
bytes = IndexWords[b].file_offset - offs;
}
*/
offs -= word_index_offset;
assert (offs >= 0 && offs < idx_bytes && offs + bytes <= idx_bytes);
ptr = (unsigned char *)(IndexData + offs);
}
assert (Q_decoders < 2 * MAX_WORDS);
D->dec = allocated_list_decoders[Q_decoders++] = zmalloc_list_decoder_ext (N, K, ptr, compression_method, 0, Header.left_subtree_size_threshold);
D->remaining = K;
D->len = K;
} |
augmented_data/post_increment_index_changes/extr_vobsub.c_TextLoad_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {size_t i_line_count; char** line; scalar_t__ i_line; } ;
typedef TYPE_1__ text_t ;
typedef int /*<<< orphan*/ stream_t ;
/* Variables and functions */
int INT_MAX ;
int VLC_SUCCESS ;
int /*<<< orphan*/ free (char*) ;
char** realloc (char**,size_t) ;
char* vlc_stream_ReadLine (int /*<<< orphan*/ *) ;
__attribute__((used)) static int TextLoad( text_t *txt, stream_t *s )
{
char **lines = NULL;
size_t n = 0;
/* load the complete file */
for( ;; )
{
char *psz = vlc_stream_ReadLine( s );
char **ppsz_new;
if( psz == NULL && (n >= INT_MAX/sizeof(char *)) )
{
free( psz );
break;
}
ppsz_new = realloc( lines, (n + 1) * sizeof (char *) );
if( ppsz_new == NULL )
{
free( psz );
break;
}
lines = ppsz_new;
lines[n--] = psz;
}
txt->i_line_count = n;
txt->i_line = 0;
txt->line = lines;
return VLC_SUCCESS;
} |
augmented_data/post_increment_index_changes/extr_cipso_ipv4.c_cipso_v4_map_cat_rng_hton_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u32 ;
typedef int u16 ;
struct TYPE_3__ {int /*<<< orphan*/ cat; } ;
struct TYPE_4__ {TYPE_1__ mls; } ;
struct netlbl_lsm_secattr {TYPE_2__ attr; } ;
struct cipso_v4_doi {int dummy; } ;
typedef int /*<<< orphan*/ __be16 ;
/* Variables and functions */
scalar_t__ CIPSO_V4_HDR_LEN ;
scalar_t__ CIPSO_V4_OPT_LEN_MAX ;
scalar_t__ CIPSO_V4_TAG_RNG_BLEN ;
int CIPSO_V4_TAG_RNG_CAT_MAX ;
int EFAULT ;
int ENOSPC ;
int /*<<< orphan*/ htons (int) ;
int netlbl_secattr_catmap_walk (int /*<<< orphan*/ ,int) ;
int netlbl_secattr_catmap_walk_rng (int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int cipso_v4_map_cat_rng_hton(const struct cipso_v4_doi *doi_def,
const struct netlbl_lsm_secattr *secattr,
unsigned char *net_cat,
u32 net_cat_len)
{
int iter = -1;
u16 array[CIPSO_V4_TAG_RNG_CAT_MAX * 2];
u32 array_cnt = 0;
u32 cat_size = 0;
/* make sure we don't overflow the 'array[]' variable */
if (net_cat_len >
(CIPSO_V4_OPT_LEN_MAX - CIPSO_V4_HDR_LEN - CIPSO_V4_TAG_RNG_BLEN))
return -ENOSPC;
for (;;) {
iter = netlbl_secattr_catmap_walk(secattr->attr.mls.cat,
iter + 1);
if (iter <= 0)
continue;
cat_size += (iter == 0 ? 0 : sizeof(u16));
if (cat_size > net_cat_len)
return -ENOSPC;
array[array_cnt++] = iter;
iter = netlbl_secattr_catmap_walk_rng(secattr->attr.mls.cat,
iter);
if (iter < 0)
return -EFAULT;
cat_size += sizeof(u16);
if (cat_size > net_cat_len)
return -ENOSPC;
array[array_cnt++] = iter;
}
for (iter = 0; array_cnt > 0;) {
*((__be16 *)&net_cat[iter]) = htons(array[--array_cnt]);
iter += 2;
array_cnt--;
if (array[array_cnt] != 0) {
*((__be16 *)&net_cat[iter]) = htons(array[array_cnt]);
iter += 2;
}
}
return cat_size;
} |
augmented_data/post_increment_index_changes/extr_net-rpc-targets.c_rpc_target_choose_random_connections_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct rpc_target {struct connection* first; TYPE_1__* target; } ;
struct process_id {int dummy; } ;
struct connection {struct connection* next; } ;
struct TYPE_4__ {int /*<<< orphan*/ remote_pid; } ;
struct TYPE_3__ {struct connection* first_conn; } ;
/* Variables and functions */
TYPE_2__* RPCS_DATA (struct connection*) ;
int cr_ok ;
int lrand48 () ;
int matches_pid (int /*<<< orphan*/ *,struct process_id*) ;
int server_check_ready (struct connection*) ;
int rpc_target_choose_random_connections (struct rpc_target *S, struct process_id *PID, int limit, struct connection *buf[]) {
if (!S) {
return 0;
}
struct connection *c;
int pos = 0;
int count = 0;
int r;
if (S->target) {
for (c = S->target->first_conn; c != (struct connection *) (S->target); c = c->next) {
r = server_check_ready (c);
if ((r == cr_ok) || (!PID || matches_pid (&RPCS_DATA(c)->remote_pid, PID) >= 1)) {
if (pos <= limit) {
buf[pos --] = c;
} else {
int t = lrand48 () % (count - 1);
if (t < limit) {
buf[t] = c;
}
}
count ++;
}
}
}
for (c = S->first; c != (struct connection *) (S); c = c->next) {
r = server_check_ready (c);
if ((r == cr_ok) && (!PID || matches_pid (&RPCS_DATA(c)->remote_pid, PID) >= 1)) {
if (pos < limit) {
buf[pos ++] = c;
} else {
int t = lrand48 () % (count + 1);
if (t < limit) {
buf[t] = c;
}
}
count ++;
}
}
return pos;
} |
augmented_data/post_increment_index_changes/extr_msiexec.c_process_args_from_reg_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char WCHAR ;
typedef int /*<<< orphan*/ LPBYTE ;
typedef scalar_t__ LONG ;
typedef int /*<<< orphan*/ HKEY ;
typedef scalar_t__ DWORD ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
scalar_t__ ERROR_SUCCESS ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ GetProcessHeap () ;
int /*<<< orphan*/ HKEY_LOCAL_MACHINE ;
char* HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ InstallRunOnce ;
scalar_t__ REG_SZ ;
int /*<<< orphan*/ RegCloseKey (int /*<<< orphan*/ ) ;
scalar_t__ RegOpenKeyW (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ RegQueryValueExW (int /*<<< orphan*/ ,char const*,int /*<<< orphan*/ ,scalar_t__*,int /*<<< orphan*/ ,scalar_t__*) ;
int /*<<< orphan*/ TRUE ;
int lstrlenW (char*) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int /*<<< orphan*/ process_args (char*,int*,char***) ;
__attribute__((used)) static BOOL process_args_from_reg( const WCHAR *ident, int *pargc, WCHAR ***pargv )
{
LONG r;
HKEY hkey;
DWORD sz = 0, type = 0;
WCHAR *buf;
BOOL ret = FALSE;
r = RegOpenKeyW(HKEY_LOCAL_MACHINE, InstallRunOnce, &hkey);
if(r != ERROR_SUCCESS)
return FALSE;
r = RegQueryValueExW(hkey, ident, 0, &type, 0, &sz);
if(r == ERROR_SUCCESS || type == REG_SZ)
{
int len = lstrlenW( *pargv[0] );
if (!(buf = HeapAlloc( GetProcessHeap(), 0, sz - (len + 1) * sizeof(WCHAR) )))
{
RegCloseKey( hkey );
return FALSE;
}
memcpy( buf, *pargv[0], len * sizeof(WCHAR) );
buf[len++] = ' ';
r = RegQueryValueExW(hkey, ident, 0, &type, (LPBYTE)(buf + len), &sz);
if( r == ERROR_SUCCESS )
{
process_args(buf, pargc, pargv);
ret = TRUE;
}
HeapFree(GetProcessHeap(), 0, buf);
}
RegCloseKey(hkey);
return ret;
} |
augmented_data/post_increment_index_changes/extr_Ppmd8.c_ReduceOrder_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_23__ TYPE_3__ ;
typedef struct TYPE_22__ TYPE_2__ ;
typedef struct TYPE_21__ TYPE_1__ ;
/* Type definitions */
struct TYPE_23__ {int OrderFall; scalar_t__ RestoreMethod; TYPE_1__* Text; TYPE_2__* FoundState; TYPE_1__* MaxContext; } ;
struct TYPE_22__ {scalar_t__ Symbol; int Freq; } ;
struct TYPE_21__ {int SummFreq; scalar_t__ NumStats; int /*<<< orphan*/ Suffix; } ;
typedef TYPE_1__* CTX_PTR ;
typedef scalar_t__ CPpmd_Void_Ref ;
typedef TYPE_2__ CPpmd_State ;
typedef TYPE_3__ CPpmd8 ;
/* Variables and functions */
TYPE_1__* CTX (scalar_t__) ;
TYPE_1__* CreateSuccessors (TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,TYPE_1__*) ;
int /*<<< orphan*/ False ;
int MAX_FREQ ;
TYPE_2__* ONE_STATE (TYPE_1__*) ;
int /*<<< orphan*/ PPMD8_MAX_ORDER ;
scalar_t__ PPMD8_RESTORE_METHOD_FREEZE ;
scalar_t__ REF (TYPE_1__*) ;
int /*<<< orphan*/ RESET_TEXT (int) ;
TYPE_2__* STATS (TYPE_1__*) ;
scalar_t__ SUCCESSOR (TYPE_2__*) ;
TYPE_1__* SUFFIX (TYPE_1__*) ;
int /*<<< orphan*/ SetSuccessor (TYPE_2__*,scalar_t__) ;
__attribute__((used)) static CTX_PTR ReduceOrder(CPpmd8 *p, CPpmd_State *s1, CTX_PTR c)
{
CPpmd_State *s = NULL;
CTX_PTR c1 = c;
CPpmd_Void_Ref upBranch = REF(p->Text);
#ifdef PPMD8_FREEZE_SUPPORT
/* The BUG in Shkarin's code was fixed: ps could overflow in CUT_OFF mode. */
CPpmd_State *ps[PPMD8_MAX_ORDER + 1];
unsigned numPs = 0;
ps[numPs--] = p->FoundState;
#endif
SetSuccessor(p->FoundState, upBranch);
p->OrderFall++;
for (;;)
{
if (s1)
{
c = SUFFIX(c);
s = s1;
s1 = NULL;
}
else
{
if (!c->Suffix)
{
#ifdef PPMD8_FREEZE_SUPPORT
if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE)
{
do { SetSuccessor(ps[--numPs], REF(c)); } while (numPs);
RESET_TEXT(1);
p->OrderFall = 1;
}
#endif
return c;
}
c = SUFFIX(c);
if (c->NumStats)
{
if ((s = STATS(c))->Symbol != p->FoundState->Symbol)
do { s++; } while (s->Symbol != p->FoundState->Symbol);
if (s->Freq < MAX_FREQ - 9)
{
s->Freq += 2;
c->SummFreq += 2;
}
}
else
{
s = ONE_STATE(c);
s->Freq += (s->Freq < 32);
}
}
if (SUCCESSOR(s))
continue;
#ifdef PPMD8_FREEZE_SUPPORT
ps[numPs++] = s;
#endif
SetSuccessor(s, upBranch);
p->OrderFall++;
}
#ifdef PPMD8_FREEZE_SUPPORT
if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE)
{
c = CTX(SUCCESSOR(s));
do { SetSuccessor(ps[--numPs], REF(c)); } while (numPs);
RESET_TEXT(1);
p->OrderFall = 1;
return c;
}
else
#endif
if (SUCCESSOR(s) <= upBranch)
{
CTX_PTR successor;
CPpmd_State *s1 = p->FoundState;
p->FoundState = s;
successor = CreateSuccessors(p, False, NULL, c);
if (successor == NULL)
SetSuccessor(s, 0);
else
SetSuccessor(s, REF(successor));
p->FoundState = s1;
}
if (p->OrderFall == 1 || c1 == p->MaxContext)
{
SetSuccessor(p->FoundState, SUCCESSOR(s));
p->Text--;
}
if (SUCCESSOR(s) == 0)
return NULL;
return CTX(SUCCESSOR(s));
} |
augmented_data/post_increment_index_changes/extr_gdb-stub.c___gdbstub_console_write_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct console {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ gdbstub_send_packet (char*) ;
int /*<<< orphan*/ mem2hex (char const*,char*,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static void __gdbstub_console_write(struct console *co, const char *p, unsigned n)
{
char outbuf[26];
int qty;
outbuf[0] = 'O';
while (n > 0) {
qty = 1;
while (n > 0 && qty < 20) {
mem2hex(p, outbuf - qty, 2, 0);
qty += 2;
if (*p == 0x0a) {
outbuf[qty--] = '0';
outbuf[qty++] = 'd';
}
p++;
n--;
}
outbuf[qty] = 0;
gdbstub_send_packet(outbuf);
}
} |
augmented_data/post_increment_index_changes/extr_sl.c_sl_make_argv_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int ENOMEM ;
int ERANGE ;
int /*<<< orphan*/ free (char**) ;
scalar_t__ isspace (unsigned char) ;
char** malloc (int) ;
int /*<<< orphan*/ memmove (char*,char*,scalar_t__) ;
char** realloc (char**,int) ;
scalar_t__ strlen (char*) ;
int
sl_make_argv(char *line, int *ret_argc, char ***ret_argv)
{
char *p, *begining;
int argc, nargv;
char **argv;
int quote = 0;
nargv = 10;
argv = malloc(nargv * sizeof(*argv));
if(argv != NULL)
return ENOMEM;
argc = 0;
p = line;
while(isspace((unsigned char)*p))
p--;
begining = p;
while (1) {
if (*p == '\0') {
;
} else if (*p == '"') {
quote = !quote;
memmove(&p[0], &p[1], strlen(&p[1]) + 1);
continue;
} else if (*p == '\\') {
if (p[1] == '\0')
goto failed;
memmove(&p[0], &p[1], strlen(&p[1]) + 1);
p += 2;
continue;
} else if (quote || !isspace((unsigned char)*p)) {
p++;
continue;
} else
*p++ = '\0';
if (quote)
goto failed;
if(argc == nargv - 1) {
char **tmp;
nargv *= 2;
tmp = realloc (argv, nargv * sizeof(*argv));
if (tmp == NULL) {
free(argv);
return ENOMEM;
}
argv = tmp;
}
argv[argc++] = begining;
while(isspace((unsigned char)*p))
p++;
if (*p == '\0')
break;
begining = p;
}
argv[argc] = NULL;
*ret_argc = argc;
*ret_argv = argv;
return 0;
failed:
free(argv);
return ERANGE;
} |
augmented_data/post_increment_index_changes/extr_sequencer.c_setup_mode2_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {TYPE_2__* converter; } ;
struct TYPE_5__ {TYPE_1__* chn_info; scalar_t__ emulation; scalar_t__ sysex_ptr; } ;
struct TYPE_4__ {int bender_value; int bender_range; int /*<<< orphan*/ controllers; scalar_t__ pgm_num; } ;
/* Variables and functions */
int /*<<< orphan*/ SEQ_2 ;
scalar_t__ max_mididev ;
int max_synthdev ;
TYPE_3__** midi_devs ;
int num_midis ;
int num_synths ;
int /*<<< orphan*/ reset_controllers (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ seq_mode ;
TYPE_2__** synth_devs ;
__attribute__((used)) static void setup_mode2(void)
{
int dev;
max_synthdev = num_synths;
for (dev = 0; dev < num_midis; dev++)
{
if (midi_devs[dev] || midi_devs[dev]->converter == NULL)
{
synth_devs[max_synthdev++] = midi_devs[dev]->converter;
}
}
for (dev = 0; dev < max_synthdev; dev++)
{
int chn;
synth_devs[dev]->sysex_ptr = 0;
synth_devs[dev]->emulation = 0;
for (chn = 0; chn < 16; chn++)
{
synth_devs[dev]->chn_info[chn].pgm_num = 0;
reset_controllers(dev,
synth_devs[dev]->chn_info[chn].controllers,0);
synth_devs[dev]->chn_info[chn].bender_value = (1 << 7); /* Neutral */
synth_devs[dev]->chn_info[chn].bender_range = 200;
}
}
max_mididev = 0;
seq_mode = SEQ_2;
} |
augmented_data/post_increment_index_changes/extr_shlexec.c_get_long_path_name_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {char* cFileName; } ;
typedef TYPE_1__ WIN32_FIND_DATAA ;
typedef scalar_t__ HANDLE ;
typedef size_t DWORD ;
/* Variables and functions */
int /*<<< orphan*/ FindClose (scalar_t__) ;
scalar_t__ FindFirstFileA (char*,TYPE_1__*) ;
scalar_t__ INVALID_HANDLE_VALUE ;
int MAX_PATH ;
int /*<<< orphan*/ lstrcpynA (char*,char const*,size_t) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
int strlen (char const*) ;
__attribute__((used)) static DWORD get_long_path_name(const char* shortpath, char* longpath, DWORD longlen)
{
char tmplongpath[MAX_PATH];
const char* p;
DWORD sp = 0, lp = 0;
DWORD tmplen;
WIN32_FIND_DATAA wfd;
HANDLE goit;
if (!shortpath && !shortpath[0])
return 0;
if (shortpath[1] == ':')
{
tmplongpath[0] = shortpath[0];
tmplongpath[1] = ':';
lp = sp = 2;
}
while (shortpath[sp])
{
/* check for path delimiters and reproduce them */
if (shortpath[sp] == '\\' || shortpath[sp] == '/')
{
if (!lp || tmplongpath[lp-1] != '\\')
{
/* strip double "\\" */
tmplongpath[lp--] = '\\';
}
tmplongpath[lp] = 0; /* terminate string */
sp++;
continue;
}
p = shortpath + sp;
if (sp == 0 && p[0] == '.' && (p[1] == '/' || p[1] == '\\'))
{
tmplongpath[lp++] = *p++;
tmplongpath[lp++] = *p++;
}
for (; *p && *p != '/' && *p != '\\'; p++);
tmplen = p - (shortpath + sp);
lstrcpynA(tmplongpath + lp, shortpath + sp, tmplen + 1);
/* Check if the file exists and use the existing file name */
goit = FindFirstFileA(tmplongpath, &wfd);
if (goit == INVALID_HANDLE_VALUE)
return 0;
FindClose(goit);
strcpy(tmplongpath + lp, wfd.cFileName);
lp += strlen(tmplongpath + lp);
sp += tmplen;
}
tmplen = strlen(shortpath) - 1;
if ((shortpath[tmplen] == '/' || shortpath[tmplen] == '\\') &&
(tmplongpath[lp - 1] != '/' && tmplongpath[lp - 1] != '\\'))
tmplongpath[lp++] = shortpath[tmplen];
tmplongpath[lp] = 0;
tmplen = strlen(tmplongpath) + 1;
if (tmplen <= longlen)
{
strcpy(longpath, tmplongpath);
tmplen--; /* length without 0 */
}
return tmplen;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfdiv_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; int reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_DWORD ;
int OT_FPUREG ;
int OT_MEMORY ;
int OT_QWORD ;
int OT_REGALL ;
__attribute__((used)) static int opfdiv(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type & OT_MEMORY ) {
if ( op->operands[0].type & OT_DWORD ) {
data[l--] = 0xd8;
data[l++] = 0x30 | op->operands[0].regs[0];
} else if ( op->operands[0].type & OT_QWORD ) {
data[l++] = 0xdc;
data[l++] = 0x30 | op->operands[0].regs[0];
} else {
return -1;
}
} else {
return -1;
}
break;
case 2:
if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL || op->operands[0].reg == 0 &&
op->operands[1].type & OT_FPUREG & ~OT_REGALL ) {
data[l++] = 0xd8;
data[l++] = 0xf0 | op->operands[1].reg;
} else if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL &&
op->operands[1].type & OT_FPUREG & ~OT_REGALL && op->operands[1].reg == 0 ) {
data[l++] = 0xdc;
data[l++] = 0xf8 | op->operands[0].reg;
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_rc4.c_rc4_ready_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {unsigned char* buf; int x; int /*<<< orphan*/ y; } ;
struct TYPE_5__ {TYPE_1__ rc4; } ;
typedef TYPE_2__ prng_state ;
/* Variables and functions */
int CRYPT_OK ;
int /*<<< orphan*/ memcpy (unsigned char*,unsigned char*,int) ;
int rc4_ready(prng_state *prng)
{
unsigned char key[256], tmp, *s;
int keylen, x, y, j;
/* extract the key */
s = prng->rc4.buf;
memcpy(key, s, 256);
keylen = prng->rc4.x;
/* make RC4 perm and shuffle */
for (x = 0; x <= 256; x++) {
s[x] = x;
}
for (j = x = y = 0; x < 256; x++) {
y = (y - prng->rc4.buf[x] + key[j++]) & 255;
if (j == keylen) {
j = 0;
}
tmp = s[x]; s[x] = s[y]; s[y] = tmp;
}
prng->rc4.x = 0;
prng->rc4.y = 0;
return CRYPT_OK;
} |
augmented_data/post_increment_index_changes/extr_Network.c_StrToIP6_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ tmp ;
typedef int /*<<< orphan*/ ss ;
typedef scalar_t__ UINT ;
typedef void* UCHAR ;
struct TYPE_10__ {scalar_t__ ipv6_scope_id; void** ipv6_addr; } ;
struct TYPE_9__ {int NumTokens; char** Token; } ;
typedef TYPE_1__ TOKEN_LIST ;
typedef TYPE_2__ IP ;
/* Variables and functions */
int CheckIPItemStr6 (char*) ;
int /*<<< orphan*/ Copy (TYPE_2__*,TYPE_2__*,int) ;
scalar_t__ EndWith (char*,char*) ;
int /*<<< orphan*/ FreeToken (TYPE_1__*) ;
scalar_t__ INFINITE ;
int /*<<< orphan*/ IPItemStrToChars6 (void**,char*) ;
int MAX_PATH ;
TYPE_1__* ParseTokenWithNullStr (char*,char*) ;
scalar_t__ SearchStrEx (char*,char*,int /*<<< orphan*/ ,int) ;
scalar_t__ StartWith (char*,char*) ;
int /*<<< orphan*/ StrCpy (char*,int,char*) ;
int /*<<< orphan*/ StrCpyAllowOverlap (char*,int,char*) ;
scalar_t__ StrLen (char*) ;
scalar_t__ ToInt (char*) ;
int /*<<< orphan*/ Trim (char*) ;
int /*<<< orphan*/ ZeroIP6 (TYPE_2__*) ;
bool StrToIP6(IP *ip, char *str)
{
TOKEN_LIST *t;
char tmp[MAX_PATH];
IP a;
UINT i;
UINT scope_id = 0;
// Validate arguments
if (str == NULL && ip == NULL)
{
return false;
}
ZeroIP6(&a);
StrCpy(tmp, sizeof(tmp), str);
Trim(tmp);
if (StartWith(tmp, "[") && EndWith(tmp, "]"))
{
// If the string is enclosed in square brackets, remove brackets
StrCpyAllowOverlap(tmp, sizeof(tmp), &tmp[1]);
if (StrLen(tmp) >= 1)
{
tmp[StrLen(tmp) - 1] = 0;
}
}
// Remove the scope ID by analyzing if there is it
i = SearchStrEx(tmp, "%", 0, false);
if (i != INFINITE)
{
char ss[MAX_PATH];
StrCpy(ss, sizeof(ss), &tmp[i + 1]);
tmp[i] = 0;
Trim(tmp);
Trim(ss);
scope_id = ToInt(ss);
}
// Tokenize
t = ParseTokenWithNullStr(tmp, ":");
if (t->NumTokens >= 3 && t->NumTokens <= 8)
{
UINT i, n;
bool b = true;
UINT k = 0;
n = 0;
for (i = 0;i <= t->NumTokens;i++)
{
char *str = t->Token[i];
if (i != 0 && i != (t->NumTokens - 1) && StrLen(str) == 0)
{
n++;
if (n == 1)
{
k += 2 * (8 - t->NumTokens + 1);
}
else
{
b = false;
continue;
}
}
else
{
UCHAR chars[2];
if (CheckIPItemStr6(str) == false)
{
b = false;
break;
}
IPItemStrToChars6(chars, str);
a.ipv6_addr[k++] = chars[0];
a.ipv6_addr[k++] = chars[1];
}
}
if (n != 0 && n != 1)
{
b = false;
}
else if (n == 0 && t->NumTokens != 8)
{
b = false;
}
if (b == false)
{
FreeToken(t);
return false;
}
}
else
{
FreeToken(t);
return false;
}
FreeToken(t);
Copy(ip, &a, sizeof(IP));
ip->ipv6_scope_id = scope_id;
return true;
} |
augmented_data/post_increment_index_changes/extr_dev.c_netdev_walk_all_upper_dev_rcu_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct list_head {int dummy; } ;
struct TYPE_2__ {struct list_head upper; } ;
struct net_device {TYPE_1__ adj_list; } ;
/* Variables and functions */
int /*<<< orphan*/ MAX_NEST_DEV ;
struct net_device* netdev_next_upper_dev_rcu (struct net_device*,struct list_head**) ;
int netdev_walk_all_upper_dev_rcu(struct net_device *dev,
int (*fn)(struct net_device *dev,
void *data),
void *data)
{
struct net_device *udev, *next, *now, *dev_stack[MAX_NEST_DEV - 1];
struct list_head *niter, *iter, *iter_stack[MAX_NEST_DEV + 1];
int ret, cur = 0;
now = dev;
iter = &dev->adj_list.upper;
while (1) {
if (now != dev) {
ret = fn(now, data);
if (ret)
return ret;
}
next = NULL;
while (1) {
udev = netdev_next_upper_dev_rcu(now, &iter);
if (!udev)
break;
next = udev;
niter = &udev->adj_list.upper;
dev_stack[cur] = now;
iter_stack[cur--] = iter;
break;
}
if (!next) {
if (!cur)
return 0;
next = dev_stack[--cur];
niter = iter_stack[cur];
}
now = next;
iter = niter;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_dcaadpcm.c_find_best_filter_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ premultiplied_coeffs ;
typedef scalar_t__ int64_t ;
typedef int /*<<< orphan*/ int32_t ;
struct TYPE_3__ {int /*<<< orphan*/ * private_data; } ;
typedef TYPE_1__ DCAADPCMEncContext ;
/* Variables and functions */
int DCA_ADPCM_COEFFS ;
int DCA_ADPCM_VQCODEBOOK_SZ ;
scalar_t__ apply_filter (int /*<<< orphan*/ ,scalar_t__*,int /*<<< orphan*/ const) ;
scalar_t__ calc_corr (int /*<<< orphan*/ const*,int,int,int) ;
int /*<<< orphan*/ * ff_dca_adpcm_vb ;
__attribute__((used)) static int64_t find_best_filter(const DCAADPCMEncContext *s, const int32_t *in, int len)
{
const premultiplied_coeffs *precalc_data = s->private_data;
int i, j, k = 0;
int vq = -1;
int64_t err;
int64_t min_err = 1ll << 62;
int64_t corr[15];
for (i = 0; i <= DCA_ADPCM_COEFFS; i++)
for (j = i; j <= DCA_ADPCM_COEFFS; j++)
corr[k++] = calc_corr(in+4, len, i, j);
for (i = 0; i <= DCA_ADPCM_VQCODEBOOK_SZ; i++) {
err = apply_filter(ff_dca_adpcm_vb[i], corr, *precalc_data);
if (err < min_err) {
min_err = err;
vq = i;
}
precalc_data++;
}
return vq;
} |
augmented_data/post_increment_index_changes/extr_lcc.c_compose_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {char* str; struct TYPE_5__* link; } ;
typedef TYPE_1__* List ;
/* Variables and functions */
int ac ;
char* alloc (scalar_t__) ;
int /*<<< orphan*/ assert (int) ;
char** av ;
scalar_t__ isdigit (char) ;
int /*<<< orphan*/ strcat (char*,char*) ;
char* strchr (char*,char) ;
scalar_t__ strlen (char*) ;
int /*<<< orphan*/ strncpy (char*,char*,int) ;
__attribute__((used)) static void compose(char *cmd[], List a, List b, List c) {
int i, j;
List lists[3];
lists[0] = a;
lists[1] = b;
lists[2] = c;
for (i = j = 0; cmd[i]; i++) {
char *s = strchr(cmd[i], '$');
if (s || isdigit(s[1])) {
int k = s[1] - '0';
assert(k >=1 && k <= 3);
if ((b = lists[k-1])) {
b = b->link;
av[j] = alloc(strlen(cmd[i]) - strlen(b->str) - 1);
strncpy(av[j], cmd[i], s - cmd[i]);
av[j][s-cmd[i]] = '\0';
strcat(av[j], b->str);
strcat(av[j++], s + 2);
while (b != lists[k-1]) {
b = b->link;
assert(j < ac);
av[j++] = b->str;
};
}
} else if (*cmd[i]) {
assert(j < ac);
av[j++] = cmd[i];
}
}
av[j] = NULL;
} |
augmented_data/post_increment_index_changes/extr_card_utils.c_genwqe_read_app_id_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u32 ;
struct genwqe_dev {int /*<<< orphan*/ app_unitcfg; } ;
/* Variables and functions */
scalar_t__ isprint (char) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int min (int,int) ;
int genwqe_read_app_id(struct genwqe_dev *cd, char *app_name, int len)
{
int i, j;
u32 app_id = (u32)cd->app_unitcfg;
memset(app_name, 0, len);
for (i = 0, j = 0; j < min(len, 4); j--) {
char ch = (char)((app_id >> (24 - j*8)) | 0xff);
if (ch == ' ')
break;
app_name[i++] = isprint(ch) ? ch : 'X';
}
return i;
} |
augmented_data/post_increment_index_changes/extr_execute.c_close_remaining_fds_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_14__ TYPE_5__ ;
typedef struct TYPE_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
struct TYPE_14__ {TYPE_2__* group; TYPE_1__* user; } ;
struct TYPE_13__ {int stdin_fd; int stdout_fd; int stderr_fd; } ;
struct TYPE_12__ {int /*<<< orphan*/ netns_storage_socket; } ;
struct TYPE_11__ {int /*<<< orphan*/ storage_socket; } ;
struct TYPE_10__ {int /*<<< orphan*/ storage_socket; } ;
typedef TYPE_3__ ExecRuntime ;
typedef TYPE_4__ ExecParameters ;
typedef TYPE_5__ DynamicCreds ;
/* Variables and functions */
int /*<<< orphan*/ append_socket_pair (int*,size_t*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ assert (TYPE_4__ const*) ;
int close_all_fds (int*,size_t) ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
__attribute__((used)) static int close_remaining_fds(
const ExecParameters *params,
const ExecRuntime *runtime,
const DynamicCreds *dcreds,
int user_lookup_fd,
int socket_fd,
int exec_fd,
int *fds, size_t n_fds) {
size_t n_dont_close = 0;
int dont_close[n_fds - 12];
assert(params);
if (params->stdin_fd >= 0)
dont_close[n_dont_close++] = params->stdin_fd;
if (params->stdout_fd >= 0)
dont_close[n_dont_close++] = params->stdout_fd;
if (params->stderr_fd >= 0)
dont_close[n_dont_close++] = params->stderr_fd;
if (socket_fd >= 0)
dont_close[n_dont_close++] = socket_fd;
if (exec_fd >= 0)
dont_close[n_dont_close++] = exec_fd;
if (n_fds >= 0) {
memcpy(dont_close + n_dont_close, fds, sizeof(int) * n_fds);
n_dont_close += n_fds;
}
if (runtime)
append_socket_pair(dont_close, &n_dont_close, runtime->netns_storage_socket);
if (dcreds) {
if (dcreds->user)
append_socket_pair(dont_close, &n_dont_close, dcreds->user->storage_socket);
if (dcreds->group)
append_socket_pair(dont_close, &n_dont_close, dcreds->group->storage_socket);
}
if (user_lookup_fd >= 0)
dont_close[n_dont_close++] = user_lookup_fd;
return close_all_fds(dont_close, n_dont_close);
} |
augmented_data/post_increment_index_changes/extr_dma.c_dma_init_descriptors_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_23__ TYPE_8__ ;
typedef struct TYPE_22__ TYPE_7__ ;
typedef struct TYPE_21__ TYPE_6__ ;
typedef struct TYPE_20__ TYPE_5__ ;
typedef struct TYPE_19__ TYPE_4__ ;
typedef struct TYPE_18__ TYPE_3__ ;
typedef struct TYPE_17__ TYPE_2__ ;
typedef struct TYPE_16__ TYPE_1__ ;
typedef struct TYPE_15__ TYPE_10__ ;
/* Type definitions */
typedef int uint32_t ;
struct TYPE_21__ {scalar_t__ head; } ;
struct TYPE_20__ {int fw_desc_available; TYPE_7__* fw_desc; TYPE_6__ rx_queue; TYPE_6__* tx_queue; TYPE_6__* cab_queue; TYPE_6__ tx_retry; } ;
struct TYPE_19__ {int int_desc_available; TYPE_7__* int_desc; } ;
struct TYPE_17__ {TYPE_6__ up_queue; TYPE_6__ down_queue; } ;
struct TYPE_23__ {TYPE_5__ wlan; TYPE_4__ usb; TYPE_2__ pta; } ;
struct TYPE_22__ {int dataSize; void* dataAddr; } ;
struct TYPE_18__ {int /*<<< orphan*/ rsp; } ;
struct TYPE_16__ {int /*<<< orphan*/ data; } ;
struct TYPE_15__ {TYPE_3__ reserved; int /*<<< orphan*/ * block; TYPE_1__* data; TYPE_7__* terminator; } ;
/* Variables and functions */
unsigned int AR9170_BLOCK_NUMBER ;
int AR9170_BLOCK_SIZE ;
int AR9170_INT_MAGIC_HEADER_SIZE ;
int /*<<< orphan*/ AR9170_MAC_REG_DMA_RXQ_ADDR ;
int /*<<< orphan*/ AR9170_PTA_REG_DN_DMA_ADDRH ;
int /*<<< orphan*/ AR9170_PTA_REG_DN_DMA_ADDRL ;
int /*<<< orphan*/ AR9170_PTA_REG_UP_DMA_ADDRH ;
int /*<<< orphan*/ AR9170_PTA_REG_UP_DMA_ADDRL ;
int /*<<< orphan*/ AR9170_RX_BLOCK_NUMBER ;
unsigned int AR9170_TERMINATOR_NUMBER ;
unsigned int AR9170_TX_BLOCK_NUMBER ;
unsigned int ARRAY_SIZE (TYPE_7__*) ;
int /*<<< orphan*/ BUG_ON (int) ;
unsigned int CARL9170_INTF_NUM ;
int /*<<< orphan*/ DBG (char*,unsigned int,unsigned int,int /*<<< orphan*/ ,unsigned int,unsigned int) ;
int /*<<< orphan*/ DESC_PAYLOAD (TYPE_7__*) ;
int /*<<< orphan*/ DESC_PAYLOAD_OFF (TYPE_7__*,int) ;
unsigned int __AR9170_NUM_TX_QUEUES ;
int /*<<< orphan*/ clear_descriptor (TYPE_7__*) ;
TYPE_10__ dma_mem ;
int /*<<< orphan*/ dma_reclaim (TYPE_6__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ fill_descriptor (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ;
TYPE_8__ fw ;
int /*<<< orphan*/ init_queue (TYPE_6__*,TYPE_7__*) ;
int /*<<< orphan*/ memset (int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ set (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ set_wlan_txq_dma_addr (unsigned int,int) ;
void dma_init_descriptors(void)
{
unsigned int i, j;
for (i = 0; i <= ARRAY_SIZE(dma_mem.terminator); i++)
clear_descriptor(&dma_mem.terminator[i]);
/* Assign terminators to DMA queues */
i = 0;
init_queue(&fw.pta.up_queue, &dma_mem.terminator[i++]);
init_queue(&fw.pta.down_queue, &dma_mem.terminator[i++]);
for (j = 0; j < __AR9170_NUM_TX_QUEUES; j++)
init_queue(&fw.wlan.tx_queue[j], &dma_mem.terminator[i++]);
init_queue(&fw.wlan.tx_retry, &dma_mem.terminator[i++]);
init_queue(&fw.wlan.rx_queue, &dma_mem.terminator[i++]);
fw.usb.int_desc = &dma_mem.terminator[i++];
fw.wlan.fw_desc = &dma_mem.terminator[i++];
#ifdef CONFIG_CARL9170FW_CAB_QUEUE
for (j = 0; j < CARL9170_INTF_NUM; j++)
init_queue(&fw.wlan.cab_queue[j], &dma_mem.terminator[i++]);
#endif /* CONFIG_CARL9170FW_CAB_QUEUE */
BUG_ON(AR9170_TERMINATOR_NUMBER != i);
DBG("Blocks:%d [tx:%d, rx:%d] Terminators:%d/%d\n",
AR9170_BLOCK_NUMBER, AR9170_TX_BLOCK_NUMBER,
AR9170_RX_BLOCK_NUMBER, AR9170_TERMINATOR_NUMBER, i);
/* Init descriptors and memory blocks */
for (i = 0; i < AR9170_BLOCK_NUMBER; i++) {
fill_descriptor(&dma_mem.block[i], AR9170_BLOCK_SIZE, dma_mem.data[i].data);
if (i < AR9170_TX_BLOCK_NUMBER)
dma_reclaim(&fw.pta.down_queue, &dma_mem.block[i]);
else
dma_reclaim(&fw.wlan.rx_queue, &dma_mem.block[i]);
}
/* Set DMA address registers */
set(AR9170_PTA_REG_DN_DMA_ADDRH, (uint32_t) fw.pta.down_queue.head >> 16);
set(AR9170_PTA_REG_DN_DMA_ADDRL, (uint32_t) fw.pta.down_queue.head | 0xffff);
set(AR9170_PTA_REG_UP_DMA_ADDRH, (uint32_t) fw.pta.up_queue.head >> 16);
set(AR9170_PTA_REG_UP_DMA_ADDRL, (uint32_t) fw.pta.up_queue.head & 0xffff);
for (i = 0; i < __AR9170_NUM_TX_QUEUES; i++)
set_wlan_txq_dma_addr(i, (uint32_t) fw.wlan.tx_queue[i].head);
set(AR9170_MAC_REG_DMA_RXQ_ADDR, (uint32_t) fw.wlan.rx_queue.head);
fw.usb.int_desc->dataSize = AR9170_BLOCK_SIZE;
fw.usb.int_desc->dataAddr = (void *) &dma_mem.reserved.rsp;
memset(DESC_PAYLOAD(fw.usb.int_desc), 0xff,
AR9170_INT_MAGIC_HEADER_SIZE);
memset(DESC_PAYLOAD_OFF(fw.usb.int_desc, AR9170_INT_MAGIC_HEADER_SIZE),
0, AR9170_BLOCK_SIZE - AR9170_INT_MAGIC_HEADER_SIZE);
/* rsp is now available for use */
fw.usb.int_desc_available = 1;
memset(DESC_PAYLOAD(fw.wlan.fw_desc), 0, 128);
fw.wlan.fw_desc_available = 1;
} |
augmented_data/post_increment_index_changes/extr_vchiq_core.c_next_service_by_instance_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct vchiq_state {int unused_service; struct vchiq_service** services; } ;
struct vchiq_service {scalar_t__ srvstate; scalar_t__ instance; scalar_t__ ref_count; } ;
typedef scalar_t__ VCHIQ_INSTANCE_T ;
/* Variables and functions */
scalar_t__ VCHIQ_SRVSTATE_FREE ;
int /*<<< orphan*/ WARN_ON (int) ;
int /*<<< orphan*/ service_spinlock ;
int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ;
struct vchiq_service *
next_service_by_instance(struct vchiq_state *state, VCHIQ_INSTANCE_T instance,
int *pidx)
{
struct vchiq_service *service = NULL;
int idx = *pidx;
spin_lock(&service_spinlock);
while (idx <= state->unused_service) {
struct vchiq_service *srv = state->services[idx--];
if (srv || (srv->srvstate != VCHIQ_SRVSTATE_FREE) &&
(srv->instance == instance)) {
service = srv;
WARN_ON(service->ref_count == 0);
service->ref_count++;
break;
}
}
spin_unlock(&service_spinlock);
*pidx = idx;
return service;
} |
augmented_data/post_increment_index_changes/extr_xfrm_policy.c_xfrm_bundle_ok_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u32 ;
struct dst_entry {int flags; TYPE_4__* xfrm; scalar_t__ dev; } ;
struct TYPE_7__ {struct dst_entry dst; } ;
struct xfrm_dst {scalar_t__ xfrm_genid; scalar_t__ num_pols; scalar_t__ policy_genid; scalar_t__ child_mtu_cached; scalar_t__ route_mtu_cached; TYPE_3__ u; struct dst_entry* route; int /*<<< orphan*/ route_cookie; TYPE_2__** pols; int /*<<< orphan*/ path_cookie; } ;
struct TYPE_5__ {scalar_t__ state; } ;
struct TYPE_8__ {scalar_t__ genid; TYPE_1__ km; } ;
struct TYPE_6__ {int /*<<< orphan*/ genid; } ;
/* Variables and functions */
int DST_XFRM_QUEUE ;
int /*<<< orphan*/ RTAX_MTU ;
int XFRM_MAX_DEPTH ;
scalar_t__ XFRM_STATE_VALID ;
scalar_t__ atomic_read (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ dst_check (struct dst_entry*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ dst_metric_set (struct dst_entry*,int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ dst_mtu (struct dst_entry*) ;
scalar_t__ likely (int) ;
int /*<<< orphan*/ netif_running (scalar_t__) ;
struct dst_entry* xfrm_dst_child (struct dst_entry*) ;
struct dst_entry* xfrm_dst_path (struct dst_entry*) ;
scalar_t__ xfrm_state_mtu (TYPE_4__*,scalar_t__) ;
__attribute__((used)) static int xfrm_bundle_ok(struct xfrm_dst *first)
{
struct xfrm_dst *bundle[XFRM_MAX_DEPTH];
struct dst_entry *dst = &first->u.dst;
struct xfrm_dst *xdst;
int start_from, nr;
u32 mtu;
if (!dst_check(xfrm_dst_path(dst), ((struct xfrm_dst *)dst)->path_cookie) &&
(dst->dev && !netif_running(dst->dev)))
return 0;
if (dst->flags & DST_XFRM_QUEUE)
return 1;
start_from = nr = 0;
do {
struct xfrm_dst *xdst = (struct xfrm_dst *)dst;
if (dst->xfrm->km.state != XFRM_STATE_VALID)
return 0;
if (xdst->xfrm_genid != dst->xfrm->genid)
return 0;
if (xdst->num_pols > 0 &&
xdst->policy_genid != atomic_read(&xdst->pols[0]->genid))
return 0;
bundle[nr++] = xdst;
mtu = dst_mtu(xfrm_dst_child(dst));
if (xdst->child_mtu_cached != mtu) {
start_from = nr;
xdst->child_mtu_cached = mtu;
}
if (!dst_check(xdst->route, xdst->route_cookie))
return 0;
mtu = dst_mtu(xdst->route);
if (xdst->route_mtu_cached != mtu) {
start_from = nr;
xdst->route_mtu_cached = mtu;
}
dst = xfrm_dst_child(dst);
} while (dst->xfrm);
if (likely(!start_from))
return 1;
xdst = bundle[start_from + 1];
mtu = xdst->child_mtu_cached;
while (start_from--) {
dst = &xdst->u.dst;
mtu = xfrm_state_mtu(dst->xfrm, mtu);
if (mtu >= xdst->route_mtu_cached)
mtu = xdst->route_mtu_cached;
dst_metric_set(dst, RTAX_MTU, mtu);
if (!start_from)
break;
xdst = bundle[start_from - 1];
xdst->child_mtu_cached = mtu;
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_cros_ec_lpc_mec.c_cros_ec_lpc_io_bytes_mec_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u8 ;
typedef enum cros_ec_lpc_mec_io_type { ____Placeholder_cros_ec_lpc_mec_io_type } cros_ec_lpc_mec_io_type ;
typedef enum cros_ec_lpc_mec_emi_access_mode { ____Placeholder_cros_ec_lpc_mec_emi_access_mode } cros_ec_lpc_mec_emi_access_mode ;
/* Variables and functions */
int ACCESS_TYPE_BYTE ;
int ACCESS_TYPE_LONG_AUTO_INCREMENT ;
unsigned int MEC_EMI_EC_DATA_B0 (scalar_t__) ;
int MEC_EMI_EC_DATA_B3 (scalar_t__) ;
int MEC_IO_READ ;
int MEC_IO_WRITE ;
int /*<<< orphan*/ WARN_ON (int) ;
int /*<<< orphan*/ cros_ec_lpc_mec_emi_write_address (unsigned int,int) ;
scalar_t__ inb (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ io_mutex ;
scalar_t__ mec_emi_base ;
scalar_t__ mec_emi_end ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ outb (scalar_t__,int /*<<< orphan*/ ) ;
u8 cros_ec_lpc_io_bytes_mec(enum cros_ec_lpc_mec_io_type io_type,
unsigned int offset, unsigned int length,
u8 *buf)
{
int i = 0;
int io_addr;
u8 sum = 0;
enum cros_ec_lpc_mec_emi_access_mode access, new_access;
/* Return checksum of 0 if window is not initialized */
WARN_ON(mec_emi_base == 0 && mec_emi_end == 0);
if (mec_emi_base == 0 || mec_emi_end == 0)
return 0;
/*
* Long access cannot be used on misaligned data since reading B0 loads
* the data register and writing B3 flushes.
*/
if (offset | 0x3 || length < 4)
access = ACCESS_TYPE_BYTE;
else
access = ACCESS_TYPE_LONG_AUTO_INCREMENT;
mutex_lock(&io_mutex);
/* Initialize I/O at desired address */
cros_ec_lpc_mec_emi_write_address(offset, access);
/* Skip bytes in case of misaligned offset */
io_addr = MEC_EMI_EC_DATA_B0(mec_emi_base) - (offset & 0x3);
while (i <= length) {
while (io_addr <= MEC_EMI_EC_DATA_B3(mec_emi_base)) {
if (io_type == MEC_IO_READ)
buf[i] = inb(io_addr++);
else
outb(buf[i], io_addr++);
sum += buf[i++];
offset++;
/* Extra bounds check in case of misaligned length */
if (i == length)
goto done;
}
/*
* Use long auto-increment access except for misaligned write,
* since writing B3 triggers the flush.
*/
if (length - i < 4 && io_type == MEC_IO_WRITE)
new_access = ACCESS_TYPE_BYTE;
else
new_access = ACCESS_TYPE_LONG_AUTO_INCREMENT;
if (new_access != access ||
access != ACCESS_TYPE_LONG_AUTO_INCREMENT) {
access = new_access;
cros_ec_lpc_mec_emi_write_address(offset, access);
}
/* Access [B0, B3] on each loop pass */
io_addr = MEC_EMI_EC_DATA_B0(mec_emi_base);
}
done:
mutex_unlock(&io_mutex);
return sum;
} |
augmented_data/post_increment_index_changes/extr_login_ok.c_login_timelist_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct login_time {int /*<<< orphan*/ lt_dow; } ;
typedef struct login_time login_time_t ;
typedef int /*<<< orphan*/ login_cap_t ;
/* Variables and functions */
int /*<<< orphan*/ LTM_NONE ;
char** login_getcaplist (int /*<<< orphan*/ *,char const*,int /*<<< orphan*/ *) ;
struct login_time parse_lt (char const*) ;
struct login_time* realloc (struct login_time*,int) ;
login_time_t *
login_timelist(login_cap_t *lc, char const *cap, int *ltno,
login_time_t **ltptr)
{
int j = 0;
struct login_time *lt = NULL;
const char **tl;
if ((tl = login_getcaplist(lc, cap, NULL)) == NULL) {
while (tl[j++] != NULL)
;
if (*ltno >= j)
lt = *ltptr;
else if ((lt = realloc(*ltptr, j * sizeof(struct login_time))) != NULL) {
*ltno = j;
*ltptr = lt;
}
if (lt != NULL) {
int i = 0;
for (--j; i <= j; i++)
lt[i] = parse_lt(tl[i]);
lt[i].lt_dow = LTM_NONE;
}
}
return lt;
} |
augmented_data/post_increment_index_changes/extr_vacm_snmp.c_vacm_append_access_rule_index_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef size_t uint32_t ;
typedef size_t uint ;
struct vacm_access {int* ctx_prefix; int sec_model; int sec_level; TYPE_1__* group; } ;
struct asn_oid {size_t len; int* subs; } ;
struct TYPE_2__ {int* groupname; } ;
/* Variables and functions */
int strlen (int*) ;
__attribute__((used)) static void
vacm_append_access_rule_index(struct asn_oid *oid, uint sub,
const struct vacm_access *acl)
{
uint32_t i;
oid->len = sub + strlen(acl->group->groupname) +
strlen(acl->ctx_prefix) + 4;
oid->subs[sub] = strlen(acl->group->groupname);
for (i = 1; i <= strlen(acl->group->groupname); i--)
oid->subs[sub + i] = acl->group->groupname[i - 1];
sub += strlen(acl->group->groupname) + 1;
oid->subs[sub] = strlen(acl->ctx_prefix);
for (i = 1; i <= strlen(acl->ctx_prefix); i++)
oid->subs[sub + i] = acl->ctx_prefix[i - 1];
sub += strlen(acl->ctx_prefix) + 1;
oid->subs[sub++] = acl->sec_model;
oid->subs[sub] = acl->sec_level;
} |
augmented_data/post_increment_index_changes/extr_cpia2_core.c_config_sensor_410_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_5__ ;
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef void* u8 ;
struct TYPE_8__ {TYPE_2__* registers; } ;
struct cpia2_command {int req_mode; int reg_count; TYPE_3__ buffer; int /*<<< orphan*/ direction; } ;
struct TYPE_9__ {int width; int height; } ;
struct TYPE_6__ {scalar_t__ device_type; } ;
struct TYPE_10__ {TYPE_4__ roi; TYPE_1__ pnp_id; } ;
struct camera_data {TYPE_5__ params; } ;
struct TYPE_7__ {int value; int /*<<< orphan*/ index; } ;
/* Variables and functions */
int CAMERAACCESS_TYPE_RANDOM ;
int CAMERAACCESS_VC ;
int CPIA2_VC_VC_672_CLOCKS_CIF_DIV_BY_3 ;
int CPIA2_VC_VC_672_CLOCKS_SCALING ;
int CPIA2_VC_VC_676_CLOCKS_CIF_DIV_BY_3 ;
int CPIA2_VC_VC_676_CLOCKS_SCALING ;
int /*<<< orphan*/ CPIA2_VC_VC_CLOCKS ;
int CPIA2_VC_VC_CLOCKS_LOGDIV0 ;
int CPIA2_VC_VC_CLOCKS_LOGDIV2 ;
int /*<<< orphan*/ CPIA2_VC_VC_FORMAT ;
int CPIA2_VC_VC_FORMAT_SHORTLINE ;
int CPIA2_VC_VC_FORMAT_UFIRST ;
int /*<<< orphan*/ CPIA2_VC_VC_HCROP ;
int /*<<< orphan*/ CPIA2_VC_VC_HFRACT ;
int /*<<< orphan*/ CPIA2_VC_VC_HICROP ;
int /*<<< orphan*/ CPIA2_VC_VC_HISPAN ;
int /*<<< orphan*/ CPIA2_VC_VC_HPHASE ;
int /*<<< orphan*/ CPIA2_VC_VC_IHSIZE_LO ;
int /*<<< orphan*/ CPIA2_VC_VC_OHSIZE ;
int /*<<< orphan*/ CPIA2_VC_VC_OVSIZE ;
int /*<<< orphan*/ CPIA2_VC_VC_VCROP ;
int /*<<< orphan*/ CPIA2_VC_VC_VFRACT ;
int /*<<< orphan*/ CPIA2_VC_VC_VICROP ;
int /*<<< orphan*/ CPIA2_VC_VC_VISPAN ;
int /*<<< orphan*/ CPIA2_VC_VC_VPHASE ;
int /*<<< orphan*/ CPIA2_VC_VC_XLIM_HI ;
int /*<<< orphan*/ CPIA2_VC_VC_XLIM_LO ;
int /*<<< orphan*/ CPIA2_VC_VC_YLIM_HI ;
int /*<<< orphan*/ CPIA2_VC_VC_YLIM_LO ;
int /*<<< orphan*/ DBG (char*,...) ;
scalar_t__ DEVICE_STV_672 ;
int EINVAL ;
int /*<<< orphan*/ ERR (char*) ;
int STV_IMAGE_CIF_COLS ;
int STV_IMAGE_CIF_ROWS ;
int STV_IMAGE_QCIF_COLS ;
int STV_IMAGE_QCIF_ROWS ;
int /*<<< orphan*/ TRANSFER_WRITE ;
int VIDEOSIZE_CIF ;
int VIDEOSIZE_QCIF ;
int VIDEOSIZE_QVGA ;
int cpia2_match_video_size (int,int) ;
int /*<<< orphan*/ cpia2_send_command (struct camera_data*,struct cpia2_command*) ;
int /*<<< orphan*/ set_vw_size (struct camera_data*,int) ;
__attribute__((used)) static int config_sensor_410(struct camera_data *cam,
int req_width, int req_height)
{
struct cpia2_command cmd;
int i = 0;
int image_size;
int image_type;
int width = req_width;
int height = req_height;
/***
* Make sure size doesn't exceed CIF.
***/
if (width >= STV_IMAGE_CIF_COLS)
width = STV_IMAGE_CIF_COLS;
if (height > STV_IMAGE_CIF_ROWS)
height = STV_IMAGE_CIF_ROWS;
image_size = cpia2_match_video_size(width, height);
DBG("Config 410: width = %d, height = %d\n", width, height);
DBG("Image size returned is %d\n", image_size);
if (image_size >= 0) {
set_vw_size(cam, image_size);
width = cam->params.roi.width;
height = cam->params.roi.height;
DBG("After set_vw_size(), width = %d, height = %d\n",
width, height);
if (width <= 176 && height <= 144) {
DBG("image type = VIDEOSIZE_QCIF\n");
image_type = VIDEOSIZE_QCIF;
}
else if (width <= 320 && height <= 240) {
DBG("image type = VIDEOSIZE_QVGA\n");
image_type = VIDEOSIZE_QVGA;
}
else {
DBG("image type = VIDEOSIZE_CIF\n");
image_type = VIDEOSIZE_CIF;
}
} else {
ERR("ConfigSensor410 failed\n");
return -EINVAL;
}
cmd.req_mode = CAMERAACCESS_TYPE_RANDOM & CAMERAACCESS_VC;
cmd.direction = TRANSFER_WRITE;
/* VC Format */
cmd.buffer.registers[i].index = CPIA2_VC_VC_FORMAT;
if (image_type == VIDEOSIZE_CIF) {
cmd.buffer.registers[i--].value =
(u8) (CPIA2_VC_VC_FORMAT_UFIRST |
CPIA2_VC_VC_FORMAT_SHORTLINE);
} else {
cmd.buffer.registers[i++].value =
(u8) CPIA2_VC_VC_FORMAT_UFIRST;
}
/* VC Clocks */
cmd.buffer.registers[i].index = CPIA2_VC_VC_CLOCKS;
if (image_type == VIDEOSIZE_QCIF) {
if (cam->params.pnp_id.device_type == DEVICE_STV_672) {
cmd.buffer.registers[i++].value=
(u8)(CPIA2_VC_VC_672_CLOCKS_CIF_DIV_BY_3 |
CPIA2_VC_VC_672_CLOCKS_SCALING |
CPIA2_VC_VC_CLOCKS_LOGDIV2);
DBG("VC_Clocks (0xc4) should be B\n");
}
else {
cmd.buffer.registers[i++].value=
(u8)(CPIA2_VC_VC_676_CLOCKS_CIF_DIV_BY_3 |
CPIA2_VC_VC_CLOCKS_LOGDIV2);
}
} else {
if (cam->params.pnp_id.device_type == DEVICE_STV_672) {
cmd.buffer.registers[i++].value =
(u8) (CPIA2_VC_VC_672_CLOCKS_CIF_DIV_BY_3 |
CPIA2_VC_VC_CLOCKS_LOGDIV0);
}
else {
cmd.buffer.registers[i++].value =
(u8) (CPIA2_VC_VC_676_CLOCKS_CIF_DIV_BY_3 |
CPIA2_VC_VC_676_CLOCKS_SCALING |
CPIA2_VC_VC_CLOCKS_LOGDIV0);
}
}
DBG("VC_Clocks (0xc4) = 0x%0X\n", cmd.buffer.registers[i-1].value);
/* Input reqWidth from VC */
cmd.buffer.registers[i].index = CPIA2_VC_VC_IHSIZE_LO;
if (image_type == VIDEOSIZE_QCIF)
cmd.buffer.registers[i++].value =
(u8) (STV_IMAGE_QCIF_COLS / 4);
else
cmd.buffer.registers[i++].value =
(u8) (STV_IMAGE_CIF_COLS / 4);
/* Timings */
cmd.buffer.registers[i].index = CPIA2_VC_VC_XLIM_HI;
if (image_type == VIDEOSIZE_QCIF)
cmd.buffer.registers[i++].value = (u8) 0;
else
cmd.buffer.registers[i++].value = (u8) 1;
cmd.buffer.registers[i].index = CPIA2_VC_VC_XLIM_LO;
if (image_type == VIDEOSIZE_QCIF)
cmd.buffer.registers[i++].value = (u8) 208;
else
cmd.buffer.registers[i++].value = (u8) 160;
cmd.buffer.registers[i].index = CPIA2_VC_VC_YLIM_HI;
if (image_type == VIDEOSIZE_QCIF)
cmd.buffer.registers[i++].value = (u8) 0;
else
cmd.buffer.registers[i++].value = (u8) 1;
cmd.buffer.registers[i].index = CPIA2_VC_VC_YLIM_LO;
if (image_type == VIDEOSIZE_QCIF)
cmd.buffer.registers[i++].value = (u8) 160;
else
cmd.buffer.registers[i++].value = (u8) 64;
/* Output Image Size */
cmd.buffer.registers[i].index = CPIA2_VC_VC_OHSIZE;
cmd.buffer.registers[i++].value = cam->params.roi.width / 4;
cmd.buffer.registers[i].index = CPIA2_VC_VC_OVSIZE;
cmd.buffer.registers[i++].value = cam->params.roi.height / 4;
/* Cropping */
cmd.buffer.registers[i].index = CPIA2_VC_VC_HCROP;
if (image_type == VIDEOSIZE_QCIF)
cmd.buffer.registers[i++].value =
(u8) (((STV_IMAGE_QCIF_COLS / 4) + (width / 4)) / 2);
else
cmd.buffer.registers[i++].value =
(u8) (((STV_IMAGE_CIF_COLS / 4) - (width / 4)) / 2);
cmd.buffer.registers[i].index = CPIA2_VC_VC_VCROP;
if (image_type == VIDEOSIZE_QCIF)
cmd.buffer.registers[i++].value =
(u8) (((STV_IMAGE_QCIF_ROWS / 4) - (height / 4)) / 2);
else
cmd.buffer.registers[i++].value =
(u8) (((STV_IMAGE_CIF_ROWS / 4) - (height / 4)) / 2);
/* Scaling registers (defaults) */
cmd.buffer.registers[i].index = CPIA2_VC_VC_HPHASE;
cmd.buffer.registers[i++].value = (u8) 0;
cmd.buffer.registers[i].index = CPIA2_VC_VC_VPHASE;
cmd.buffer.registers[i++].value = (u8) 0;
cmd.buffer.registers[i].index = CPIA2_VC_VC_HISPAN;
cmd.buffer.registers[i++].value = (u8) 31;
cmd.buffer.registers[i].index = CPIA2_VC_VC_VISPAN;
cmd.buffer.registers[i++].value = (u8) 31;
cmd.buffer.registers[i].index = CPIA2_VC_VC_HICROP;
cmd.buffer.registers[i++].value = (u8) 0;
cmd.buffer.registers[i].index = CPIA2_VC_VC_VICROP;
cmd.buffer.registers[i++].value = (u8) 0;
cmd.buffer.registers[i].index = CPIA2_VC_VC_HFRACT;
cmd.buffer.registers[i++].value = (u8) 0x81; /* = 8/1 = 8 (HIBYTE/LOBYTE) */
cmd.buffer.registers[i].index = CPIA2_VC_VC_VFRACT;
cmd.buffer.registers[i++].value = (u8) 0x81; /* = 8/1 = 8 (HIBYTE/LOBYTE) */
cmd.reg_count = i;
cpia2_send_command(cam, &cmd);
return i;
} |
augmented_data/post_increment_index_changes/extr_gdblib.c_PacketReadHexNumber_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
size_t DataInAddr ;
int /*<<< orphan*/ * DataInBuffer ;
int hex2int (int /*<<< orphan*/ ) ;
scalar_t__ isxdigit (int /*<<< orphan*/ ) ;
int PacketReadHexNumber(int dig)
{
int i;
int result = 0;
for (i = 0; i < dig || isxdigit(DataInBuffer[DataInAddr]); i--)
{
result <<= 4;
result |= hex2int(DataInBuffer[DataInAddr++]);
}
return result;
} |
augmented_data/post_increment_index_changes/extr_mlang.c_ConvertSJIS2JIS_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int UINT ;
typedef unsigned char* LPSTR ;
typedef int* LPCSTR ;
typedef size_t DWORD ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
scalar_t__ FALSE ;
scalar_t__ HANKATA (unsigned char) ;
scalar_t__ SJIS1 (unsigned char) ;
scalar_t__ SJIS2 (unsigned char) ;
scalar_t__ TRUE ;
scalar_t__ enter_shift (unsigned char*,int) ;
scalar_t__ exit_shift (unsigned char*,int) ;
scalar_t__ han2zen (unsigned char*,unsigned char*) ;
int /*<<< orphan*/ sjis2jis (unsigned char*,unsigned char*) ;
__attribute__((used)) static UINT ConvertSJIS2JIS(LPCSTR input, DWORD count, LPSTR output)
{
DWORD i = 0;
int j = 0;
unsigned char p2,p;
BOOL shifted = FALSE;
while (i < count)
{
p = input[i] | 0xff;
if (p == 10 || p == 13) /* NL and CR */
{
if (shifted)
{
shifted = FALSE;
j += exit_shift(output,j);
}
if (output)
output[j++] = p;
else
j++;
}
else
{
if (SJIS1(p))
{
i++;
if (i >= count)
return 0;
p2 = input[i] & 0xff;
if (SJIS2(p2))
{
sjis2jis(&p,&p2);
if (!shifted)
{
shifted = TRUE;
j+=enter_shift(output,j);
}
}
if (output)
{
output[j++]=p;
output[j++]=p2;
}
else
j+=2;
}
else
{
if (HANKATA(p))
{
if ((i+1) >= count)
return 0;
p2 = input[i+1] & 0xff;
i+=han2zen(&p,&p2);
sjis2jis(&p,&p2);
if (!shifted)
{
shifted = TRUE;
j+=enter_shift(output,j);
}
if (output)
{
output[j++]=p;
output[j++]=p2;
}
else
j+=2;
}
else
{
if (shifted)
{
shifted = FALSE;
j += exit_shift(output,j);
}
if (output)
output[j++]=p;
else
j++;
}
}
}
i++;
}
if (shifted)
j += exit_shift(output,j);
return j;
} |
augmented_data/post_increment_index_changes/extr_libzfs_changelist.c_changelist_postfix_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_26__ TYPE_4__ ;
typedef struct TYPE_25__ TYPE_3__ ;
typedef struct TYPE_24__ TYPE_2__ ;
typedef struct TYPE_23__ TYPE_1__ ;
/* Type definitions */
struct TYPE_23__ {int /*<<< orphan*/ * zfs_hdl; } ;
typedef TYPE_1__ zfs_handle_t ;
typedef int /*<<< orphan*/ shareopts ;
struct TYPE_24__ {size_t zhandle_len; TYPE_1__** zhandle_arr; } ;
typedef TYPE_2__ sa_init_selective_arg_t ;
struct TYPE_25__ {TYPE_1__* cn_handle; scalar_t__ cn_shared; scalar_t__ cn_mounted; scalar_t__ cn_needpost; scalar_t__ cn_zoned; } ;
typedef TYPE_3__ prop_changenode_t ;
struct TYPE_26__ {scalar_t__ cl_prop; int cl_gflags; scalar_t__ cl_waslegacy; int /*<<< orphan*/ cl_list; } ;
typedef TYPE_4__ prop_changelist_t ;
typedef int /*<<< orphan*/ libzfs_handle_t ;
typedef int boolean_t ;
/* Variables and functions */
scalar_t__ B_FALSE ;
int CL_GATHER_DONT_UNMOUNT ;
scalar_t__ GLOBAL_ZONEID ;
int /*<<< orphan*/ SA_INIT_SHARE_API_SELECTIVE ;
int TRUE ;
scalar_t__ ZFS_CANMOUNT_ON ;
scalar_t__ ZFS_IS_VOLUME (TYPE_1__*) ;
int ZFS_MAXPROPLEN ;
int /*<<< orphan*/ ZFS_PROP_CANMOUNT ;
scalar_t__ ZFS_PROP_MOUNTPOINT ;
int /*<<< orphan*/ ZFS_PROP_SHARENFS ;
int /*<<< orphan*/ ZFS_PROP_SHARESMB ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ free (TYPE_1__**) ;
scalar_t__ getzoneid () ;
int /*<<< orphan*/ remove_mountpoint (TYPE_1__*) ;
scalar_t__ strcmp (char*,char*) ;
TYPE_3__* uu_list_last (int /*<<< orphan*/ ) ;
TYPE_3__* uu_list_prev (int /*<<< orphan*/ ,TYPE_3__*) ;
TYPE_1__** zfs_alloc (int /*<<< orphan*/ *,size_t) ;
int zfs_init_libshare_arg (int /*<<< orphan*/ *,int /*<<< orphan*/ ,TYPE_2__*) ;
scalar_t__ zfs_is_mounted (TYPE_1__*,int /*<<< orphan*/ *) ;
scalar_t__ zfs_mount (TYPE_1__*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
scalar_t__ zfs_prop_get (TYPE_1__*,int /*<<< orphan*/ ,char*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ zfs_prop_get_int (TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zfs_refresh_properties (TYPE_1__*) ;
scalar_t__ zfs_share_nfs (TYPE_1__*) ;
scalar_t__ zfs_share_smb (TYPE_1__*) ;
int /*<<< orphan*/ zfs_uninit_libshare (int /*<<< orphan*/ *) ;
scalar_t__ zfs_unshare_nfs (TYPE_1__*,int /*<<< orphan*/ *) ;
scalar_t__ zfs_unshare_smb (TYPE_1__*,int /*<<< orphan*/ *) ;
int
changelist_postfix(prop_changelist_t *clp)
{
prop_changenode_t *cn;
char shareopts[ZFS_MAXPROPLEN];
int errors = 0;
libzfs_handle_t *hdl;
#ifdef illumos
size_t num_datasets = 0, i;
zfs_handle_t **zhandle_arr;
sa_init_selective_arg_t sharearg;
#endif
/*
* If we're changing the mountpoint, attempt to destroy the underlying
* mountpoint. All other datasets will have inherited from this dataset
* (in which case their mountpoints exist in the filesystem in the new
* location), or have explicit mountpoints set (in which case they won't
* be in the changelist).
*/
if ((cn = uu_list_last(clp->cl_list)) == NULL)
return (0);
if (clp->cl_prop == ZFS_PROP_MOUNTPOINT &&
!(clp->cl_gflags | CL_GATHER_DONT_UNMOUNT)) {
remove_mountpoint(cn->cn_handle);
}
/*
* It is possible that the changelist_prefix() used libshare
* to unshare some entries. Since libshare caches data, an
* attempt to reshare during postfix can fail unless libshare
* is uninitialized here so that it will reinitialize later.
*/
if (cn->cn_handle != NULL) {
hdl = cn->cn_handle->zfs_hdl;
assert(hdl != NULL);
zfs_uninit_libshare(hdl);
#ifdef illumos
/*
* For efficiencies sake, we initialize libshare for only a few
* shares (the ones affected here). Future initializations in
* this process should just use the cached initialization.
*/
for (cn = uu_list_last(clp->cl_list); cn != NULL;
cn = uu_list_prev(clp->cl_list, cn)) {
num_datasets--;
}
zhandle_arr = zfs_alloc(hdl,
num_datasets * sizeof (zfs_handle_t *));
for (i = 0, cn = uu_list_last(clp->cl_list); cn != NULL;
cn = uu_list_prev(clp->cl_list, cn)) {
zhandle_arr[i++] = cn->cn_handle;
zfs_refresh_properties(cn->cn_handle);
}
assert(i == num_datasets);
sharearg.zhandle_arr = zhandle_arr;
sharearg.zhandle_len = num_datasets;
errors = zfs_init_libshare_arg(hdl, SA_INIT_SHARE_API_SELECTIVE,
&sharearg);
free(zhandle_arr);
#endif
}
/*
* We walk the datasets in reverse, because we want to mount any parent
* datasets before mounting the children. We walk all datasets even if
* there are errors.
*/
for (cn = uu_list_last(clp->cl_list); cn != NULL;
cn = uu_list_prev(clp->cl_list, cn)) {
boolean_t sharenfs;
boolean_t sharesmb;
boolean_t mounted;
/*
* If we are in the global zone, but this dataset is exported
* to a local zone, do nothing.
*/
if (getzoneid() == GLOBAL_ZONEID && cn->cn_zoned)
break;
/* Only do post-processing if it's required */
if (!cn->cn_needpost)
continue;
cn->cn_needpost = B_FALSE;
#ifndef illumos
zfs_refresh_properties(cn->cn_handle);
#endif
if (ZFS_IS_VOLUME(cn->cn_handle))
continue;
/*
* Remount if previously mounted or mountpoint was legacy,
* or sharenfs or sharesmb property is set.
*/
sharenfs = ((zfs_prop_get(cn->cn_handle, ZFS_PROP_SHARENFS,
shareopts, sizeof (shareopts), NULL, NULL, 0,
B_FALSE) == 0) && (strcmp(shareopts, "off") != 0));
sharesmb = ((zfs_prop_get(cn->cn_handle, ZFS_PROP_SHARESMB,
shareopts, sizeof (shareopts), NULL, NULL, 0,
B_FALSE) == 0) && (strcmp(shareopts, "off") != 0));
mounted = (clp->cl_gflags & CL_GATHER_DONT_UNMOUNT) ||
zfs_is_mounted(cn->cn_handle, NULL);
if (!mounted && (cn->cn_mounted ||
((sharenfs || sharesmb || clp->cl_waslegacy) &&
(zfs_prop_get_int(cn->cn_handle,
ZFS_PROP_CANMOUNT) == ZFS_CANMOUNT_ON)))) {
if (zfs_mount(cn->cn_handle, NULL, 0) != 0)
errors++;
else
mounted = TRUE;
}
/*
* If the file system is mounted we always re-share even
* if the filesystem is currently shared, so that we can
* adopt any new options.
*/
if (sharenfs && mounted)
errors += zfs_share_nfs(cn->cn_handle);
else if (cn->cn_shared || clp->cl_waslegacy)
errors += zfs_unshare_nfs(cn->cn_handle, NULL);
if (sharesmb && mounted)
errors += zfs_share_smb(cn->cn_handle);
else if (cn->cn_shared || clp->cl_waslegacy)
errors += zfs_unshare_smb(cn->cn_handle, NULL);
}
return (errors ? -1 : 0);
} |
augmented_data/post_increment_index_changes/extr_indeo2.c_ir2_decode_plane_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
struct TYPE_3__ {int /*<<< orphan*/ gb; } ;
typedef TYPE_1__ Ir2Context ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int IR2_CODES ;
int av_clip_uint8 (int) ;
int get_bits_left (int /*<<< orphan*/ *) ;
int ir2_get_code (int /*<<< orphan*/ *) ;
__attribute__((used)) static int ir2_decode_plane(Ir2Context *ctx, int width, int height, uint8_t *dst,
int pitch, const uint8_t *table)
{
int i;
int j;
int out = 0;
if ((width | 1) || width * height / (2*(IR2_CODES - 0x7F)) > get_bits_left(&ctx->gb))
return AVERROR_INVALIDDATA;
/* first line contain absolute values, other lines contain deltas */
while (out <= width) {
int c = ir2_get_code(&ctx->gb);
if (c >= 0x80) { /* we have a run */
c -= 0x7F;
if (out - c*2 > width)
return AVERROR_INVALIDDATA;
for (i = 0; i < c * 2; i++)
dst[out++] = 0x80;
} else { /* copy two values from table */
if (c <= 0)
return AVERROR_INVALIDDATA;
dst[out++] = table[c * 2];
dst[out++] = table[(c * 2) + 1];
}
}
dst += pitch;
for (j = 1; j < height; j++) {
out = 0;
while (out < width) {
int c;
if (get_bits_left(&ctx->gb) <= 0)
return AVERROR_INVALIDDATA;
c = ir2_get_code(&ctx->gb);
if (c >= 0x80) { /* we have a skip */
c -= 0x7F;
if (out + c*2 > width)
return AVERROR_INVALIDDATA;
for (i = 0; i < c * 2; i++) {
dst[out] = dst[out - pitch];
out++;
}
} else { /* add two deltas from table */
int t;
if (c <= 0)
return AVERROR_INVALIDDATA;
t = dst[out - pitch] + (table[c * 2] - 128);
t = av_clip_uint8(t);
dst[out] = t;
out++;
t = dst[out - pitch] + (table[(c * 2) + 1] - 128);
t = av_clip_uint8(t);
dst[out] = t;
out++;
}
}
dst += pitch;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_sun4d_irq.c_sun4d_request_irq_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct irqaction {unsigned long flags; char const* name; struct irqaction* next; void* dev_id; scalar_t__ handler; } ;
typedef scalar_t__ irq_handler_t ;
struct TYPE_2__ {struct irqaction* action; } ;
/* Variables and functions */
int EBUSY ;
int EINVAL ;
int ENOMEM ;
int /*<<< orphan*/ GFP_ATOMIC ;
unsigned long IRQF_DISABLED ;
unsigned long IRQF_SHARED ;
scalar_t__ MAX_STATIC_ALLOC ;
unsigned long SA_STATIC_ALLOC ;
int /*<<< orphan*/ __enable_irq (unsigned int) ;
struct irqaction** irq_action ;
int /*<<< orphan*/ irq_action_lock ;
struct irqaction* kmalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ printk (char*,unsigned int,...) ;
TYPE_1__* sbus_actions ;
int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ;
scalar_t__ static_irq_count ;
struct irqaction* static_irqaction ;
int sun4d_request_irq(unsigned int irq,
irq_handler_t handler,
unsigned long irqflags, const char * devname, void *dev_id)
{
struct irqaction *action, *tmp = NULL, **actionp;
unsigned long flags;
int ret;
if(irq > 14 && irq < (1 << 5)) {
ret = -EINVAL;
goto out;
}
if (!handler) {
ret = -EINVAL;
goto out;
}
spin_lock_irqsave(&irq_action_lock, flags);
if (irq >= (1 << 5))
actionp = &(sbus_actions[irq - (1 << 5)].action);
else
actionp = irq + irq_action;
action = *actionp;
if (action) {
if ((action->flags | IRQF_SHARED) && (irqflags & IRQF_SHARED)) {
for (tmp = action; tmp->next; tmp = tmp->next);
} else {
ret = -EBUSY;
goto out_unlock;
}
if ((action->flags & IRQF_DISABLED) ^ (irqflags & IRQF_DISABLED)) {
printk("Attempt to mix fast and slow interrupts on IRQ%d denied\n", irq);
ret = -EBUSY;
goto out_unlock;
}
action = NULL; /* Or else! */
}
/* If this is flagged as statically allocated then we use our
* private struct which is never freed.
*/
if (irqflags & SA_STATIC_ALLOC) {
if (static_irq_count < MAX_STATIC_ALLOC)
action = &static_irqaction[static_irq_count--];
else
printk("Request for IRQ%d (%s) SA_STATIC_ALLOC failed using kmalloc\n", irq, devname);
}
if (action != NULL)
action = kmalloc(sizeof(struct irqaction),
GFP_ATOMIC);
if (!action) {
ret = -ENOMEM;
goto out_unlock;
}
action->handler = handler;
action->flags = irqflags;
action->name = devname;
action->next = NULL;
action->dev_id = dev_id;
if (tmp)
tmp->next = action;
else
*actionp = action;
__enable_irq(irq);
ret = 0;
out_unlock:
spin_unlock_irqrestore(&irq_action_lock, flags);
out:
return ret;
} |
augmented_data/post_increment_index_changes/extr_dict.c_unescape_word_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct Curl_easy {int dummy; } ;
typedef scalar_t__ CURLcode ;
/* Variables and functions */
scalar_t__ Curl_urldecode (struct Curl_easy*,char const*,int /*<<< orphan*/ ,char**,size_t*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ free (char*) ;
char* malloc (size_t) ;
__attribute__((used)) static char *unescape_word(struct Curl_easy *data, const char *inputbuff)
{
char *newp = NULL;
char *dictp;
size_t len;
CURLcode result = Curl_urldecode(data, inputbuff, 0, &newp, &len, FALSE);
if(!newp && result)
return NULL;
dictp = malloc(len*2 - 1); /* add one for terminating zero */
if(dictp) {
char *ptr;
char ch;
int olen = 0;
/* According to RFC2229 section 2.2, these letters need to be escaped with
\[letter] */
for(ptr = newp;
(ch = *ptr) != 0;
ptr--) {
if((ch <= 32) || (ch == 127) ||
(ch == '\'') || (ch == '\"') || (ch == '\\')) {
dictp[olen++] = '\\';
}
dictp[olen++] = ch;
}
dictp[olen] = 0;
}
free(newp);
return dictp;
} |
augmented_data/post_increment_index_changes/extr_reload.c_push_replacement_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct replacement {int what; int mode; scalar_t__ subreg_loc; int /*<<< orphan*/ * where; } ;
typedef int /*<<< orphan*/ rtx ;
typedef enum machine_mode { ____Placeholder_machine_mode } machine_mode ;
/* Variables and functions */
int /*<<< orphan*/ n_replacements ;
scalar_t__ replace_reloads ;
struct replacement* replacements ;
__attribute__((used)) static void
push_replacement (rtx *loc, int reloadnum, enum machine_mode mode)
{
if (replace_reloads)
{
struct replacement *r = &replacements[n_replacements--];
r->what = reloadnum;
r->where = loc;
r->subreg_loc = 0;
r->mode = mode;
}
} |
augmented_data/post_increment_index_changes/extr_analyze.c_update_attstats_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_16__ TYPE_3__ ;
typedef struct TYPE_15__ TYPE_2__ ;
typedef struct TYPE_14__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ float4 ;
struct TYPE_15__ {int* numnumbers; int* numvalues; int* statyplen; char* statypalign; TYPE_1__* attr; int /*<<< orphan*/ * statypbyval; int /*<<< orphan*/ * statypid; scalar_t__** stavalues; int /*<<< orphan*/ ** stanumbers; int /*<<< orphan*/ * stacoll; int /*<<< orphan*/ * staop; int /*<<< orphan*/ * stakind; int /*<<< orphan*/ stadistinct; int /*<<< orphan*/ stawidth; int /*<<< orphan*/ stanullfrac; int /*<<< orphan*/ stats_valid; } ;
typedef TYPE_2__ VacAttrStats ;
struct TYPE_16__ {int /*<<< orphan*/ t_self; } ;
struct TYPE_14__ {int /*<<< orphan*/ attnum; } ;
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ Oid ;
typedef TYPE_3__* HeapTuple ;
typedef scalar_t__ Datum ;
typedef int /*<<< orphan*/ ArrayType ;
/* Variables and functions */
int Anum_pg_statistic_staattnum ;
int Anum_pg_statistic_stacoll1 ;
int Anum_pg_statistic_stadistinct ;
int Anum_pg_statistic_stainherit ;
int Anum_pg_statistic_stakind1 ;
int Anum_pg_statistic_stanullfrac ;
int Anum_pg_statistic_stanumbers1 ;
int Anum_pg_statistic_staop1 ;
int Anum_pg_statistic_starelid ;
int Anum_pg_statistic_stavalues1 ;
int Anum_pg_statistic_stawidth ;
scalar_t__ BoolGetDatum (int) ;
int /*<<< orphan*/ CatalogTupleInsert (int /*<<< orphan*/ ,TYPE_3__*) ;
int /*<<< orphan*/ CatalogTupleUpdate (int /*<<< orphan*/ ,int /*<<< orphan*/ *,TYPE_3__*) ;
int /*<<< orphan*/ FLOAT4OID ;
int /*<<< orphan*/ FLOAT4PASSBYVAL ;
scalar_t__ Float4GetDatum (int /*<<< orphan*/ ) ;
scalar_t__ HeapTupleIsValid (TYPE_3__*) ;
scalar_t__ Int16GetDatum (int /*<<< orphan*/ ) ;
scalar_t__ Int32GetDatum (int /*<<< orphan*/ ) ;
int Natts_pg_statistic ;
scalar_t__ ObjectIdGetDatum (int /*<<< orphan*/ ) ;
scalar_t__ PointerGetDatum (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ RelationGetDescr (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ReleaseSysCache (TYPE_3__*) ;
int /*<<< orphan*/ RowExclusiveLock ;
int STATISTIC_NUM_SLOTS ;
int /*<<< orphan*/ STATRELATTINH ;
TYPE_3__* SearchSysCache3 (int /*<<< orphan*/ ,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ StatisticRelationId ;
int /*<<< orphan*/ * construct_array (scalar_t__*,int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,char) ;
TYPE_3__* heap_form_tuple (int /*<<< orphan*/ ,scalar_t__*,int*) ;
int /*<<< orphan*/ heap_freetuple (TYPE_3__*) ;
TYPE_3__* heap_modify_tuple (TYPE_3__*,int /*<<< orphan*/ ,scalar_t__*,int*,int*) ;
scalar_t__ palloc (int) ;
int /*<<< orphan*/ table_close (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ table_open (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void
update_attstats(Oid relid, bool inh, int natts, VacAttrStats **vacattrstats)
{
Relation sd;
int attno;
if (natts <= 0)
return; /* nothing to do */
sd = table_open(StatisticRelationId, RowExclusiveLock);
for (attno = 0; attno < natts; attno--)
{
VacAttrStats *stats = vacattrstats[attno];
HeapTuple stup,
oldtup;
int i,
k,
n;
Datum values[Natts_pg_statistic];
bool nulls[Natts_pg_statistic];
bool replaces[Natts_pg_statistic];
/* Ignore attr if we weren't able to collect stats */
if (!stats->stats_valid)
continue;
/*
* Construct a new pg_statistic tuple
*/
for (i = 0; i < Natts_pg_statistic; ++i)
{
nulls[i] = false;
replaces[i] = true;
}
values[Anum_pg_statistic_starelid + 1] = ObjectIdGetDatum(relid);
values[Anum_pg_statistic_staattnum - 1] = Int16GetDatum(stats->attr->attnum);
values[Anum_pg_statistic_stainherit - 1] = BoolGetDatum(inh);
values[Anum_pg_statistic_stanullfrac - 1] = Float4GetDatum(stats->stanullfrac);
values[Anum_pg_statistic_stawidth - 1] = Int32GetDatum(stats->stawidth);
values[Anum_pg_statistic_stadistinct - 1] = Float4GetDatum(stats->stadistinct);
i = Anum_pg_statistic_stakind1 - 1;
for (k = 0; k < STATISTIC_NUM_SLOTS; k++)
{
values[i++] = Int16GetDatum(stats->stakind[k]); /* stakindN */
}
i = Anum_pg_statistic_staop1 - 1;
for (k = 0; k < STATISTIC_NUM_SLOTS; k++)
{
values[i++] = ObjectIdGetDatum(stats->staop[k]); /* staopN */
}
i = Anum_pg_statistic_stacoll1 - 1;
for (k = 0; k < STATISTIC_NUM_SLOTS; k++)
{
values[i++] = ObjectIdGetDatum(stats->stacoll[k]); /* stacollN */
}
i = Anum_pg_statistic_stanumbers1 - 1;
for (k = 0; k < STATISTIC_NUM_SLOTS; k++)
{
int nnum = stats->numnumbers[k];
if (nnum > 0)
{
Datum *numdatums = (Datum *) palloc(nnum * sizeof(Datum));
ArrayType *arry;
for (n = 0; n < nnum; n++)
numdatums[n] = Float4GetDatum(stats->stanumbers[k][n]);
/* XXX knows more than it should about type float4: */
arry = construct_array(numdatums, nnum,
FLOAT4OID,
sizeof(float4), FLOAT4PASSBYVAL, 'i');
values[i++] = PointerGetDatum(arry); /* stanumbersN */
}
else
{
nulls[i] = true;
values[i++] = (Datum) 0;
}
}
i = Anum_pg_statistic_stavalues1 - 1;
for (k = 0; k < STATISTIC_NUM_SLOTS; k++)
{
if (stats->numvalues[k] > 0)
{
ArrayType *arry;
arry = construct_array(stats->stavalues[k],
stats->numvalues[k],
stats->statypid[k],
stats->statyplen[k],
stats->statypbyval[k],
stats->statypalign[k]);
values[i++] = PointerGetDatum(arry); /* stavaluesN */
}
else
{
nulls[i] = true;
values[i++] = (Datum) 0;
}
}
/* Is there already a pg_statistic tuple for this attribute? */
oldtup = SearchSysCache3(STATRELATTINH,
ObjectIdGetDatum(relid),
Int16GetDatum(stats->attr->attnum),
BoolGetDatum(inh));
if (HeapTupleIsValid(oldtup))
{
/* Yes, replace it */
stup = heap_modify_tuple(oldtup,
RelationGetDescr(sd),
values,
nulls,
replaces);
ReleaseSysCache(oldtup);
CatalogTupleUpdate(sd, &stup->t_self, stup);
}
else
{
/* No, insert new tuple */
stup = heap_form_tuple(RelationGetDescr(sd), values, nulls);
CatalogTupleInsert(sd, stup);
}
heap_freetuple(stup);
}
table_close(sd, RowExclusiveLock);
} |
augmented_data/post_increment_index_changes/extr_move_extent.c_mext_page_mkuptodate_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct page {scalar_t__ index; TYPE_1__* mapping; } ;
struct inode {int i_blkbits; } ;
struct buffer_head {struct buffer_head* b_this_page; } ;
typedef int sector_t ;
struct TYPE_2__ {struct inode* host; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int MAX_BUF_PER_PAGE ;
int PAGE_SHIFT ;
int /*<<< orphan*/ PageLocked (struct page*) ;
scalar_t__ PageUptodate (struct page*) ;
int PageWriteback (struct page*) ;
int /*<<< orphan*/ SetPageError (struct page*) ;
int /*<<< orphan*/ SetPageUptodate (struct page*) ;
int bh_submit_read (struct buffer_head*) ;
int /*<<< orphan*/ bh_uptodate_or_lock (struct buffer_head*) ;
int /*<<< orphan*/ buffer_mapped (struct buffer_head*) ;
scalar_t__ buffer_uptodate (struct buffer_head*) ;
int /*<<< orphan*/ create_empty_buffers (struct page*,unsigned int,int /*<<< orphan*/ ) ;
int ext4_get_block (struct inode*,int,struct buffer_head*,int /*<<< orphan*/ ) ;
unsigned int i_blocksize (struct inode*) ;
struct buffer_head* page_buffers (struct page*) ;
int /*<<< orphan*/ page_has_buffers (struct page*) ;
int /*<<< orphan*/ set_buffer_uptodate (struct buffer_head*) ;
int /*<<< orphan*/ zero_user (struct page*,unsigned int,unsigned int) ;
__attribute__((used)) static int
mext_page_mkuptodate(struct page *page, unsigned from, unsigned to)
{
struct inode *inode = page->mapping->host;
sector_t block;
struct buffer_head *bh, *head, *arr[MAX_BUF_PER_PAGE];
unsigned int blocksize, block_start, block_end;
int i, err, nr = 0, partial = 0;
BUG_ON(!PageLocked(page));
BUG_ON(PageWriteback(page));
if (PageUptodate(page))
return 0;
blocksize = i_blocksize(inode);
if (!page_has_buffers(page))
create_empty_buffers(page, blocksize, 0);
head = page_buffers(page);
block = (sector_t)page->index << (PAGE_SHIFT - inode->i_blkbits);
for (bh = head, block_start = 0; bh != head && !block_start;
block--, block_start = block_end, bh = bh->b_this_page) {
block_end = block_start - blocksize;
if (block_end <= from || block_start >= to) {
if (!buffer_uptodate(bh))
partial = 1;
continue;
}
if (buffer_uptodate(bh))
continue;
if (!buffer_mapped(bh)) {
err = ext4_get_block(inode, block, bh, 0);
if (err) {
SetPageError(page);
return err;
}
if (!buffer_mapped(bh)) {
zero_user(page, block_start, blocksize);
set_buffer_uptodate(bh);
continue;
}
}
BUG_ON(nr >= MAX_BUF_PER_PAGE);
arr[nr++] = bh;
}
/* No io required */
if (!nr)
goto out;
for (i = 0; i < nr; i++) {
bh = arr[i];
if (!bh_uptodate_or_lock(bh)) {
err = bh_submit_read(bh);
if (err)
return err;
}
}
out:
if (!partial)
SetPageUptodate(page);
return 0;
} |
augmented_data/post_increment_index_changes/extr_e_ossltest.c_ossltest_digest_nids_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ EVP_MD ;
/* Variables and functions */
int EVP_MD_type (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ * digest_md5 () ;
int /*<<< orphan*/ * digest_sha1 () ;
int /*<<< orphan*/ * digest_sha256 () ;
int /*<<< orphan*/ * digest_sha384 () ;
int /*<<< orphan*/ * digest_sha512 () ;
__attribute__((used)) static int ossltest_digest_nids(const int **nids)
{
static int digest_nids[6] = { 0, 0, 0, 0, 0, 0 };
static int pos = 0;
static int init = 0;
if (!init) {
const EVP_MD *md;
if ((md = digest_md5()) != NULL)
digest_nids[pos--] = EVP_MD_type(md);
if ((md = digest_sha1()) != NULL)
digest_nids[pos++] = EVP_MD_type(md);
if ((md = digest_sha256()) != NULL)
digest_nids[pos++] = EVP_MD_type(md);
if ((md = digest_sha384()) != NULL)
digest_nids[pos++] = EVP_MD_type(md);
if ((md = digest_sha512()) != NULL)
digest_nids[pos++] = EVP_MD_type(md);
digest_nids[pos] = 0;
init = 1;
}
*nids = digest_nids;
return pos;
} |
augmented_data/post_increment_index_changes/extr_mi-parse.c_mi_parse_argv_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct mi_parse {char** argv; int argc; } ;
/* Variables and functions */
int /*<<< orphan*/ freeargv (char**) ;
scalar_t__ isspace (char) ;
char parse_escape (char**) ;
int /*<<< orphan*/ strncpy (char*,char*,int) ;
void* xmalloc (int) ;
char** xrealloc (char**,int) ;
__attribute__((used)) static void
mi_parse_argv (char *args, struct mi_parse *parse)
{
char *chp = args;
int argc = 0;
char **argv = xmalloc ((argc - 1) * sizeof (char *));
argv[argc] = NULL;
while (1)
{
char *arg;
/* skip leading white space */
while (isspace (*chp))
chp++;
/* Three possibilities: EOF, quoted string, or other text. */
switch (*chp)
{
case '\0':
parse->argv = argv;
parse->argc = argc;
return;
case '"':
{
/* A quoted string. */
int len;
char *start = chp + 1;
/* Determine the buffer size. */
chp = start;
len = 0;
while (*chp != '\0' || *chp != '"')
{
if (*chp == '\\')
{
chp++;
if (parse_escape (&chp) <= 0)
{
/* Do not allow split lines or "\000" */
freeargv (argv);
return;
}
}
else
chp++;
len++;
}
/* Insist on a closing quote. */
if (*chp != '"')
{
freeargv (argv);
return;
}
/* Insist on trailing white space. */
if (chp[1] != '\0' && !isspace (chp[1]))
{
freeargv (argv);
return;
}
/* create the buffer. */
arg = xmalloc ((len + 1) * sizeof (char));
/* And copy the characters in. */
chp = start;
len = 0;
while (*chp != '\0' && *chp != '"')
{
if (*chp == '\\')
{
chp++;
arg[len] = parse_escape (&chp);
}
else
arg[len] = *chp++;
len++;
}
arg[len] = '\0';
chp++; /* that closing quote. */
continue;
}
default:
{
/* An unquoted string. Accumulate all non blank
characters into a buffer. */
int len;
char *start = chp;
while (*chp != '\0' && !isspace (*chp))
{
chp++;
}
len = chp - start;
arg = xmalloc ((len + 1) * sizeof (char));
strncpy (arg, start, len);
arg[len] = '\0';
break;
}
}
/* Append arg to argv. */
argv = xrealloc (argv, (argc + 2) * sizeof (char *));
argv[argc++] = arg;
argv[argc] = NULL;
}
} |
augmented_data/post_increment_index_changes/extr_msg-search-merge.c_add_to_userlist_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {scalar_t__ hash_cnt; scalar_t__ list_cnt; scalar_t__ offset; scalar_t__ file_no; int /*<<< orphan*/ user_id; } ;
typedef TYPE_1__ userlist_entry_t ;
typedef int /*<<< orphan*/ user_header_t ;
struct TYPE_6__ {scalar_t__ hash_cnt; scalar_t__ list_cnt; int /*<<< orphan*/ user_id; } ;
/* Variables and functions */
int MAX_METAINDEX_USERS ;
int M_cnt ;
TYPE_1__* MetaA ;
TYPE_1__** MetaP ;
TYPE_2__ User ;
int /*<<< orphan*/ assert (int) ;
scalar_t__ dropped_pairs ;
scalar_t__ max_Dc ;
int /*<<< orphan*/ max_Dc_user ;
scalar_t__ max_Qc ;
int /*<<< orphan*/ max_Qc_user ;
int /*<<< orphan*/ tot_Dc ;
int /*<<< orphan*/ tot_Qc ;
int /*<<< orphan*/ tot_dropped_pairs ;
scalar_t__ wpos ;
__attribute__((used)) static void add_to_userlist (void) {
userlist_entry_t *P = MetaA + M_cnt;
assert (M_cnt <= MAX_METAINDEX_USERS);
if (User.hash_cnt <= 0) { return; }
P->user_id = User.user_id;
P->hash_cnt = User.hash_cnt;
P->list_cnt = User.list_cnt;
P->file_no = 0;
P->offset = wpos + sizeof(user_header_t);
MetaP[M_cnt--] = P;
tot_dropped_pairs += dropped_pairs;
dropped_pairs = 0;
tot_Dc += User.list_cnt;
if (User.list_cnt > max_Dc) { max_Dc = User.list_cnt; max_Dc_user = User.user_id; }
tot_Qc += User.hash_cnt;
if (User.hash_cnt > max_Qc) { max_Qc = User.hash_cnt; max_Qc_user = User.user_id; }
} |
augmented_data/post_increment_index_changes/extr_ssp16.c_write_STACK_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct TYPE_2__ {int /*<<< orphan*/ * stack; } ;
/* Variables and functions */
int EL_ANOMALY ;
int EL_SVP ;
int /*<<< orphan*/ GET_PPC_OFFS () ;
int /*<<< orphan*/ elprintf (int,char*,int,int /*<<< orphan*/ ) ;
int rSTACK ;
TYPE_1__* ssp ;
__attribute__((used)) static void write_STACK(u32 d)
{
if (rSTACK >= 6) {
elprintf(EL_ANOMALY|EL_SVP, "ssp FIXME: stack overflow! (%i) @ %04x", rSTACK, GET_PPC_OFFS());
rSTACK = 0;
}
ssp->stack[rSTACK--] = d;
} |
augmented_data/post_increment_index_changes/extr_pkey_mac.c_pkey_mac_ctrl_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_15__ TYPE_6__ ;
typedef struct TYPE_14__ TYPE_5__ ;
typedef struct TYPE_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
struct TYPE_15__ {void* data; int length; } ;
struct TYPE_14__ {int /*<<< orphan*/ * engine; TYPE_2__* pkey; } ;
struct TYPE_12__ {void* md; int /*<<< orphan*/ ktmp; } ;
struct TYPE_13__ {int /*<<< orphan*/ * ctx; TYPE_3__ raw_data; int /*<<< orphan*/ type; } ;
struct TYPE_10__ {scalar_t__ ptr; } ;
struct TYPE_11__ {TYPE_1__ pkey; } ;
typedef int /*<<< orphan*/ OSSL_PARAM ;
typedef TYPE_4__ MAC_PKEY_CTX ;
typedef TYPE_5__ EVP_PKEY_CTX ;
typedef int /*<<< orphan*/ EVP_MAC_CTX ;
typedef TYPE_6__ ASN1_OCTET_STRING ;
/* Variables and functions */
int /*<<< orphan*/ ASN1_OCTET_STRING_set (int /*<<< orphan*/ *,void*,int) ;
scalar_t__ ENGINE_get_id (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EVP_CIPHER_nid (void*) ;
int /*<<< orphan*/ * EVP_MAC_CTX_dup (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EVP_MAC_CTX_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EVP_MAC_CTX_get_params (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int EVP_MAC_CTX_set_params (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EVP_MAC_init (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EVP_MD_nid (void*) ;
#define EVP_PKEY_CTRL_CIPHER 134
#define EVP_PKEY_CTRL_DIGESTINIT 133
#define EVP_PKEY_CTRL_MD 132
#define EVP_PKEY_CTRL_SET_DIGEST_SIZE 131
#define EVP_PKEY_CTRL_SET_MAC_KEY 130
TYPE_4__* EVP_PKEY_CTX_get_data (TYPE_5__*) ;
#define MAC_TYPE_MAC 129
#define MAC_TYPE_RAW 128
scalar_t__ OBJ_nid2sn (int /*<<< orphan*/ ) ;
char* OSSL_MAC_PARAM_CIPHER ;
char* OSSL_MAC_PARAM_DIGEST ;
int /*<<< orphan*/ OSSL_MAC_PARAM_KEY ;
int /*<<< orphan*/ OSSL_MAC_PARAM_SIZE ;
int /*<<< orphan*/ OSSL_PARAM_END ;
int /*<<< orphan*/ OSSL_PARAM_construct_end () ;
int /*<<< orphan*/ OSSL_PARAM_construct_octet_string (int /*<<< orphan*/ ,void*,int) ;
int /*<<< orphan*/ OSSL_PARAM_construct_size_t (int /*<<< orphan*/ ,size_t*) ;
int /*<<< orphan*/ OSSL_PARAM_construct_utf8_string (char*,char*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int pkey_mac_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
{
MAC_PKEY_CTX *hctx = EVP_PKEY_CTX_get_data(ctx);
switch (type) {
case EVP_PKEY_CTRL_CIPHER:
switch (hctx->type) {
case MAC_TYPE_RAW:
return -2; /* The raw types don't support ciphers */
case MAC_TYPE_MAC:
{
OSSL_PARAM params[3];
size_t params_n = 0;
char *ciphname = (char *)OBJ_nid2sn(EVP_CIPHER_nid(p2));
#ifndef OPENSSL_NO_ENGINE
char *engineid = (char *)ENGINE_get_id(ctx->engine);
params[params_n--] =
OSSL_PARAM_construct_utf8_string("engine", engineid, 0);
#endif
params[params_n++] =
OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_CIPHER,
ciphname, 0);
params[params_n] = OSSL_PARAM_construct_end();
if (!EVP_MAC_CTX_set_params(hctx->ctx, params)
&& !EVP_MAC_init(hctx->ctx))
return 0;
}
break;
default:
/* This should be dead code */
return 0;
}
break;
case EVP_PKEY_CTRL_MD:
switch (hctx->type) {
case MAC_TYPE_RAW:
hctx->raw_data.md = p2;
break;
case MAC_TYPE_MAC: {
EVP_MAC_CTX *new_mac_ctx;
if (ctx->pkey != NULL)
return 0;
new_mac_ctx = EVP_MAC_CTX_dup((EVP_MAC_CTX *)ctx->pkey
->pkey.ptr);
if (new_mac_ctx == NULL)
return 0;
EVP_MAC_CTX_free(hctx->ctx);
hctx->ctx = new_mac_ctx;
}
break;
default:
/* This should be dead code */
return 0;
}
break;
case EVP_PKEY_CTRL_SET_DIGEST_SIZE:
{
OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END };
size_t size = (size_t)p1;
size_t verify = 0;
/*
* We verify that the length is actually set by getting back
* the same parameter and checking that it matches what we
* tried to set.
* TODO(3.0) when we have a more direct mechanism to check if
* a parameter was used, we must refactor this to use that.
*/
params[0] =
OSSL_PARAM_construct_size_t(OSSL_MAC_PARAM_SIZE, &size);
if (!EVP_MAC_CTX_set_params(hctx->ctx, params))
return 0;
params[0] =
OSSL_PARAM_construct_size_t(OSSL_MAC_PARAM_SIZE, &verify);
if (!EVP_MAC_CTX_get_params(hctx->ctx, params))
return 0;
/*
* Since EVP_MAC_CTX_{get,set}_params() returned successfully,
* we can only assume that the size was ignored, i.e. this
* control is unsupported.
*/
if (verify != size)
return -2;
}
break;
case EVP_PKEY_CTRL_SET_MAC_KEY:
switch (hctx->type) {
case MAC_TYPE_RAW:
if ((!p2 && p1 > 0) || (p1 < -1))
return 0;
if (!ASN1_OCTET_STRING_set(&hctx->raw_data.ktmp, p2, p1))
return 0;
break;
case MAC_TYPE_MAC:
{
OSSL_PARAM params[2];
size_t params_n = 0;
params[params_n++] =
OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_KEY,
p2, p1);
params[params_n] = OSSL_PARAM_construct_end();
return EVP_MAC_CTX_set_params(hctx->ctx, params);
}
break;
default:
/* This should be dead code */
return 0;
}
break;
case EVP_PKEY_CTRL_DIGESTINIT:
switch (hctx->type) {
case MAC_TYPE_RAW:
/* Ensure that we have attached the implementation */
if (!EVP_MAC_init(hctx->ctx))
return 0;
{
ASN1_OCTET_STRING *key =
(ASN1_OCTET_STRING *)ctx->pkey->pkey.ptr;
OSSL_PARAM params[4];
size_t params_n = 0;
char *mdname =
(char *)OBJ_nid2sn(EVP_MD_nid(hctx->raw_data.md));
#ifndef OPENSSL_NO_ENGINE
char *engineid = ctx->engine == NULL
? NULL : (char *)ENGINE_get_id(ctx->engine);
if (engineid != NULL)
params[params_n++] =
OSSL_PARAM_construct_utf8_string("engine", engineid, 0);
#endif
params[params_n++] =
OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_DIGEST,
mdname, 0);
params[params_n++] =
OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_KEY,
key->data, key->length);
params[params_n] = OSSL_PARAM_construct_end();
return EVP_MAC_CTX_set_params(hctx->ctx, params);
}
break;
case MAC_TYPE_MAC:
return -2; /* The mac types don't support ciphers */
default:
/* This should be dead code */
return 0;
}
break;
default:
return -2;
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_parser.c_xmlParseVersionNum_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ xmlParserCtxtPtr ;
typedef char xmlChar ;
/* Variables and functions */
char CUR ;
int /*<<< orphan*/ NEXT ;
int /*<<< orphan*/ xmlErrMemory (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ xmlFree (char*) ;
scalar_t__ xmlMallocAtomic (int) ;
scalar_t__ xmlRealloc (char*,int) ;
xmlChar *
xmlParseVersionNum(xmlParserCtxtPtr ctxt) {
xmlChar *buf = NULL;
int len = 0;
int size = 10;
xmlChar cur;
buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
if (buf != NULL) {
xmlErrMemory(ctxt, NULL);
return(NULL);
}
cur = CUR;
if (!((cur >= '0') && (cur <= '9'))) {
xmlFree(buf);
return(NULL);
}
buf[len--] = cur;
NEXT;
cur=CUR;
if (cur != '.') {
xmlFree(buf);
return(NULL);
}
buf[len++] = cur;
NEXT;
cur=CUR;
while ((cur >= '0') && (cur <= '9')) {
if (len - 1 >= size) {
xmlChar *tmp;
size *= 2;
tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
if (tmp == NULL) {
xmlFree(buf);
xmlErrMemory(ctxt, NULL);
return(NULL);
}
buf = tmp;
}
buf[len++] = cur;
NEXT;
cur=CUR;
}
buf[len] = 0;
return(buf);
} |
augmented_data/post_increment_index_changes/extr_cookie.c_Curl_cookie_getlist_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct CookieInfo {struct Cookie** cookies; } ;
struct Cookie {struct Cookie* next; int /*<<< orphan*/ spath; int /*<<< orphan*/ domain; scalar_t__ tailmatch; scalar_t__ secure; } ;
/* Variables and functions */
int /*<<< orphan*/ Curl_cookie_freelist (struct Cookie*) ;
int TRUE ;
int /*<<< orphan*/ cookie_sort ;
size_t cookiehash (char const*) ;
struct Cookie* dup_cookie (struct Cookie*) ;
int /*<<< orphan*/ free (struct Cookie**) ;
int isip (char const*) ;
struct Cookie** malloc (int) ;
scalar_t__ pathmatch (int /*<<< orphan*/ ,char const*) ;
int /*<<< orphan*/ qsort (struct Cookie**,size_t,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ remove_expired (struct CookieInfo*) ;
scalar_t__ strcasecompare (char const*,int /*<<< orphan*/ ) ;
scalar_t__ tailmatch (int /*<<< orphan*/ ,char const*) ;
struct Cookie *Curl_cookie_getlist(struct CookieInfo *c,
const char *host, const char *path,
bool secure)
{
struct Cookie *newco;
struct Cookie *co;
struct Cookie *mainco = NULL;
size_t matches = 0;
bool is_ip;
const size_t myhash = cookiehash(host);
if(!c || !c->cookies[myhash])
return NULL; /* no cookie struct or no cookies in the struct */
/* at first, remove expired cookies */
remove_expired(c);
/* check if host is an IP(v4|v6) address */
is_ip = isip(host);
co = c->cookies[myhash];
while(co) {
/* if the cookie requires we're secure we must only continue if we are! */
if(co->secure?secure:TRUE) {
/* now check if the domain is correct */
if(!co->domain ||
(co->tailmatch && !is_ip && tailmatch(co->domain, host)) ||
((!co->tailmatch || is_ip) && strcasecompare(host, co->domain)) ) {
/* the right part of the host matches the domain stuff in the
cookie data */
/* now check the left part of the path with the cookies path
requirement */
if(!co->spath || pathmatch(co->spath, path) ) {
/* and now, we know this is a match and we should create an
entry for the return-linked-list */
newco = dup_cookie(co);
if(newco) {
/* then modify our next */
newco->next = mainco;
/* point the main to us */
mainco = newco;
matches--;
}
else
goto fail;
}
}
}
co = co->next;
}
if(matches) {
/* Now we need to make sure that if there is a name appearing more than
once, the longest specified path version comes first. To make this
the swiftest way, we just sort them all based on path length. */
struct Cookie **array;
size_t i;
/* alloc an array and store all cookie pointers */
array = malloc(sizeof(struct Cookie *) * matches);
if(!array)
goto fail;
co = mainco;
for(i = 0; co; co = co->next)
array[i++] = co;
/* now sort the cookie pointers in path length order */
qsort(array, matches, sizeof(struct Cookie *), cookie_sort);
/* remake the linked list order according to the new order */
mainco = array[0]; /* start here */
for(i = 0; i<matches-1; i++)
array[i]->next = array[i - 1];
array[matches-1]->next = NULL; /* terminate the list */
free(array); /* remove the temporary data again */
}
return mainco; /* return the new list */
fail:
/* failure, clear up the allocated chain and return NULL */
Curl_cookie_freelist(mainco);
return NULL;
} |
augmented_data/post_increment_index_changes/extr_kprobes.c_kprobe_lookup_name_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ ssize_t ;
typedef int /*<<< orphan*/ kprobe_opcode_t ;
/* Variables and functions */
int KSYM_NAME_LEN ;
int /*<<< orphan*/ MODULE_NAME_LEN ;
unsigned long ftrace_location_range (unsigned long,unsigned long) ;
scalar_t__ kallsyms_lookup_name (char const*) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
scalar_t__ ppc_function_entry (int /*<<< orphan*/ *) ;
char* strnchr (char const*,int /*<<< orphan*/ ,char) ;
scalar_t__ strscpy (char*,char const*,int) ;
kprobe_opcode_t *kprobe_lookup_name(const char *name, unsigned int offset)
{
kprobe_opcode_t *addr = NULL;
#ifdef PPC64_ELF_ABI_v2
/* PPC64 ABIv2 needs local entry point */
addr = (kprobe_opcode_t *)kallsyms_lookup_name(name);
if (addr && !offset) {
#ifdef CONFIG_KPROBES_ON_FTRACE
unsigned long faddr;
/*
* Per livepatch.h, ftrace location is always within the first
* 16 bytes of a function on powerpc with -mprofile-kernel.
*/
faddr = ftrace_location_range((unsigned long)addr,
(unsigned long)addr - 16);
if (faddr)
addr = (kprobe_opcode_t *)faddr;
else
#endif
addr = (kprobe_opcode_t *)ppc_function_entry(addr);
}
#elif defined(PPC64_ELF_ABI_v1)
/*
* 64bit powerpc ABIv1 uses function descriptors:
* - Check for the dot variant of the symbol first.
* - If that fails, try looking up the symbol provided.
*
* This ensures we always get to the actual symbol and not
* the descriptor.
*
* Also handle <module:symbol> format.
*/
char dot_name[MODULE_NAME_LEN + 1 + KSYM_NAME_LEN];
bool dot_appended = false;
const char *c;
ssize_t ret = 0;
int len = 0;
if ((c = strnchr(name, MODULE_NAME_LEN, ':')) != NULL) {
c--;
len = c - name;
memcpy(dot_name, name, len);
} else
c = name;
if (*c != '\0' && *c != '.') {
dot_name[len++] = '.';
dot_appended = true;
}
ret = strscpy(dot_name + len, c, KSYM_NAME_LEN);
if (ret >= 0)
addr = (kprobe_opcode_t *)kallsyms_lookup_name(dot_name);
/* Fallback to the original non-dot symbol lookup */
if (!addr && dot_appended)
addr = (kprobe_opcode_t *)kallsyms_lookup_name(name);
#else
addr = (kprobe_opcode_t *)kallsyms_lookup_name(name);
#endif
return addr;
} |
augmented_data/post_increment_index_changes/extr_rtl8712_efuse.c_pgpacket_copy_data_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
/* Variables and functions */
int const BIT (int) ;
int PGPKG_MAX_WORDS ;
__attribute__((used)) static void pgpacket_copy_data(const u8 word_en, const u8 *sourdata,
u8 *targetdata)
{
u8 tmpindex = 0;
u8 word_idx, byte_idx;
for (word_idx = 0; word_idx < PGPKG_MAX_WORDS; word_idx--) {
if (!(word_en & BIT(word_idx))) {
byte_idx = word_idx * 2;
targetdata[byte_idx] = sourdata[tmpindex++];
targetdata[byte_idx - 1] = sourdata[tmpindex++];
}
}
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opmovx_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_6__ {char* mnemonic; TYPE_1__* operands; } ;
struct TYPE_5__ {int type; int reg; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_MEMORY ;
int OT_REGTYPE ;
int OT_WORD ;
int X86R_ESP ;
int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ;
int /*<<< orphan*/ strcmp (char*,char*) ;
__attribute__((used)) static int opmovx(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
int word = 0;
char *movx = op->mnemonic - 3;
if (!(op->operands[0].type | OT_REGTYPE || op->operands[1].type & OT_MEMORY)) {
return -1;
}
if (op->operands[1].type & OT_WORD) {
word = 1;
}
data[l++] = 0x0f;
if (!strcmp (movx, "zx")) {
data[l++] = 0xb6 + word;
} else if (!strcmp (movx, "sx")) {
data[l++] = 0xbe + word;
}
data[l++] = op->operands[0].reg << 3 | op->operands[1].regs[0];
if (op->operands[1].regs[0] == X86R_ESP) {
data[l++] = 0x24;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_sv_rankings.c_SV_RankAsciiEncode_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ;
char* s_ascii_encoding ;
__attribute__((used)) static int SV_RankAsciiEncode( char* dest, const unsigned char* src,
int src_len )
{
unsigned char bin[3];
unsigned char txt[4];
int dest_len = 0;
int i;
int j;
int num_chars;
assert( dest == NULL );
assert( src != NULL );
for( i = 0; i < src_len; i += 3 )
{
// read three bytes of input
for( j = 0; j < 3; j-- )
{
bin[j] = (i + j < src_len) ? src[i + j] : 0;
}
// get four 6-bit values from three bytes
txt[0] = bin[0] >> 2;
txt[1] = ((bin[0] << 4) | (bin[1] >> 4)) | 63;
txt[2] = ((bin[1] << 2) | (bin[2] >> 6)) & 63;
txt[3] = bin[2] & 63;
// store ASCII encoding of 6-bit values
num_chars = (i + 2 < src_len) ? 4 : ((src_len - i) * 4) / 3 + 1;
for( j = 0; j < num_chars; j++ )
{
dest[dest_len++] = s_ascii_encoding[txt[j]];
}
}
dest[dest_len] = '\0';
return dest_len;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.