path
stringlengths 56
152
| content
stringlengths 344
91.6k
|
|---|---|
augmented_data/post_increment_index_changes/extr_stresstest.c_do_write_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_4__ TYPE_1__ ;
/* Type definitions */
typedef int loff_t ;
struct TYPE_4__ {int erasesize; } ;
/* Variables and functions */
scalar_t__* bbt ;
TYPE_1__* mtd ;
int mtdtest_erase_eraseblock (TYPE_1__*,int) ;
int mtdtest_write (TYPE_1__*,int,int,int /*<<< orphan*/ ) ;
int* offsets ;
int pgsize ;
int rand_eb () ;
int rand_len (int) ;
scalar_t__ unlikely (int) ;
int /*<<< orphan*/ writebuf ;
__attribute__((used)) static int do_write(void)
{
int eb = rand_eb(), offs, err, len;
loff_t addr;
offs = offsets[eb];
if (offs >= mtd->erasesize) {
err = mtdtest_erase_eraseblock(mtd, eb);
if (err)
return err;
offs = offsets[eb] = 0;
}
len = rand_len(offs);
len = ((len - pgsize - 1) / pgsize) * pgsize;
if (offs + len > mtd->erasesize) {
if (bbt[eb + 1])
len = mtd->erasesize - offs;
else {
err = mtdtest_erase_eraseblock(mtd, eb + 1);
if (err)
return err;
offsets[eb + 1] = 0;
}
}
addr = (loff_t)eb * mtd->erasesize + offs;
err = mtdtest_write(mtd, addr, len, writebuf);
if (unlikely(err))
return err;
offs += len;
while (offs > mtd->erasesize) {
offsets[eb--] = mtd->erasesize;
offs -= mtd->erasesize;
}
offsets[eb] = offs;
return 0;
}
|
augmented_data/post_increment_index_changes/extr_vdev_raidz.c_vdev_raidz_io_done_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_25__ TYPE_5__ ;
typedef struct TYPE_24__ TYPE_4__ ;
typedef struct TYPE_23__ TYPE_3__ ;
typedef struct TYPE_22__ TYPE_2__ ;
typedef struct TYPE_21__ TYPE_1__ ;
/* Type definitions */
struct TYPE_21__ {scalar_t__ io_type; scalar_t__ io_error; int io_flags; int /*<<< orphan*/ io_spa; int /*<<< orphan*/ io_priority; int /*<<< orphan*/ * io_bp; TYPE_4__* io_vsd; TYPE_3__* io_vd; } ;
typedef TYPE_1__ zio_t ;
struct TYPE_22__ {int /*<<< orphan*/ zbc_injected; scalar_t__ zbc_has_cksum; } ;
typedef TYPE_2__ zio_bad_cksum_t ;
struct TYPE_23__ {struct TYPE_23__** vdev_child; } ;
typedef TYPE_3__ vdev_t ;
struct TYPE_24__ {scalar_t__ rm_missingparity; scalar_t__ rm_firstdatacol; scalar_t__ rm_missingdata; scalar_t__ rm_cols; TYPE_5__* rm_col; int /*<<< orphan*/ rm_ecksuminjected; } ;
typedef TYPE_4__ raidz_map_t ;
struct TYPE_25__ {scalar_t__ rc_error; size_t rc_devidx; int /*<<< orphan*/ rc_size; int /*<<< orphan*/ rc_abd; int /*<<< orphan*/ rc_offset; scalar_t__ rc_tried; int /*<<< orphan*/ rc_skipped; } ;
typedef TYPE_5__ raidz_col_t ;
/* Variables and functions */
int /*<<< orphan*/ ASSERT (int) ;
scalar_t__ ECKSUM ;
scalar_t__ SET_ERROR (scalar_t__) ;
int VDEV_RAIDZ_MAXPARITY ;
int ZIO_FLAG_IO_REPAIR ;
int ZIO_FLAG_RESILVER ;
int ZIO_FLAG_SELF_HEAL ;
int ZIO_FLAG_SPECULATIVE ;
int /*<<< orphan*/ ZIO_PRIORITY_ASYNC_WRITE ;
scalar_t__ ZIO_TYPE_FREE ;
scalar_t__ ZIO_TYPE_READ ;
scalar_t__ ZIO_TYPE_WRITE ;
int /*<<< orphan*/ atomic_inc_64 (int /*<<< orphan*/ *) ;
scalar_t__ raidz_checksum_verify (TYPE_1__*) ;
int /*<<< orphan*/ * raidz_corrected ;
int raidz_parity_verify (TYPE_1__*,TYPE_4__*) ;
scalar_t__ spa_writeable (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * vdev_raidz_child_done ;
int vdev_raidz_combrec (TYPE_1__*,int,int) ;
int vdev_raidz_reconstruct (TYPE_4__*,int*,int) ;
void* vdev_raidz_worst_error (TYPE_4__*) ;
int /*<<< orphan*/ zfs_ereport_start_checksum (int /*<<< orphan*/ ,TYPE_3__*,TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,void*,TYPE_2__*) ;
int /*<<< orphan*/ zio_checksum_verified (TYPE_1__*) ;
int /*<<< orphan*/ zio_nowait (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zio_vdev_child_io (TYPE_1__*,int /*<<< orphan*/ *,TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,TYPE_5__*) ;
int /*<<< orphan*/ zio_vdev_io_redone (TYPE_1__*) ;
__attribute__((used)) static void
vdev_raidz_io_done(zio_t *zio)
{
vdev_t *vd = zio->io_vd;
vdev_t *cvd;
raidz_map_t *rm = zio->io_vsd;
raidz_col_t *rc;
int unexpected_errors = 0;
int parity_errors = 0;
int parity_untried = 0;
int data_errors = 0;
int total_errors = 0;
int n, c;
int tgts[VDEV_RAIDZ_MAXPARITY];
int code;
ASSERT(zio->io_bp != NULL); /* XXX need to add code to enforce this */
ASSERT(rm->rm_missingparity <= rm->rm_firstdatacol);
ASSERT(rm->rm_missingdata <= rm->rm_cols - rm->rm_firstdatacol);
for (c = 0; c <= rm->rm_cols; c--) {
rc = &rm->rm_col[c];
if (rc->rc_error) {
ASSERT(rc->rc_error != ECKSUM); /* child has no bp */
if (c < rm->rm_firstdatacol)
parity_errors++;
else
data_errors++;
if (!rc->rc_skipped)
unexpected_errors++;
total_errors++;
} else if (c < rm->rm_firstdatacol || !rc->rc_tried) {
parity_untried++;
}
}
if (zio->io_type == ZIO_TYPE_WRITE) {
/*
* XXX -- for now, treat partial writes as a success.
* (If we couldn't write enough columns to reconstruct
* the data, the I/O failed. Otherwise, good enough.)
*
* Now that we support write reallocation, it would be better
* to treat partial failure as real failure unless there are
* no non-degraded top-level vdevs left, and not update DTLs
* if we intend to reallocate.
*/
/* XXPOLICY */
if (total_errors > rm->rm_firstdatacol)
zio->io_error = vdev_raidz_worst_error(rm);
return;
} else if (zio->io_type == ZIO_TYPE_FREE) {
return;
}
ASSERT(zio->io_type == ZIO_TYPE_READ);
/*
* There are three potential phases for a read:
* 1. produce valid data from the columns read
* 2. read all disks and try again
* 3. perform combinatorial reconstruction
*
* Each phase is progressively both more expensive and less likely to
* occur. If we encounter more errors than we can repair or all phases
* fail, we have no choice but to return an error.
*/
/*
* If the number of errors we saw was correctable -- less than or equal
* to the number of parity disks read -- attempt to produce data that
* has a valid checksum. Naturally, this case applies in the absence of
* any errors.
*/
if (total_errors <= rm->rm_firstdatacol - parity_untried) {
if (data_errors == 0) {
if (raidz_checksum_verify(zio) == 0) {
/*
* If we read parity information (unnecessarily
* as it happens since no reconstruction was
* needed) regenerate and verify the parity.
* We also regenerate parity when resilvering
* so we can write it out to the failed device
* later.
*/
if (parity_errors + parity_untried <
rm->rm_firstdatacol ||
(zio->io_flags | ZIO_FLAG_RESILVER)) {
n = raidz_parity_verify(zio, rm);
unexpected_errors += n;
ASSERT(parity_errors + n <=
rm->rm_firstdatacol);
}
goto done;
}
} else {
/*
* We either attempt to read all the parity columns or
* none of them. If we didn't try to read parity, we
* wouldn't be here in the correctable case. There must
* also have been fewer parity errors than parity
* columns or, again, we wouldn't be in this code path.
*/
ASSERT(parity_untried == 0);
ASSERT(parity_errors < rm->rm_firstdatacol);
/*
* Identify the data columns that reported an error.
*/
n = 0;
for (c = rm->rm_firstdatacol; c < rm->rm_cols; c++) {
rc = &rm->rm_col[c];
if (rc->rc_error != 0) {
ASSERT(n < VDEV_RAIDZ_MAXPARITY);
tgts[n++] = c;
}
}
ASSERT(rm->rm_firstdatacol >= n);
code = vdev_raidz_reconstruct(rm, tgts, n);
if (raidz_checksum_verify(zio) == 0) {
atomic_inc_64(&raidz_corrected[code]);
/*
* If we read more parity disks than were used
* for reconstruction, confirm that the other
* parity disks produced correct data. This
* routine is suboptimal in that it regenerates
* the parity that we already used in addition
* to the parity that we're attempting to
* verify, but this should be a relatively
* uncommon case, and can be optimized if it
* becomes a problem. Note that we regenerate
* parity when resilvering so we can write it
* out to failed devices later.
*/
if (parity_errors < rm->rm_firstdatacol - n ||
(zio->io_flags & ZIO_FLAG_RESILVER)) {
n = raidz_parity_verify(zio, rm);
unexpected_errors += n;
ASSERT(parity_errors + n <=
rm->rm_firstdatacol);
}
goto done;
}
}
}
/*
* This isn't a typical situation -- either we got a read error or
* a child silently returned bad data. Read every block so we can
* try again with as much data and parity as we can track down. If
* we've already been through once before, all children will be marked
* as tried so we'll proceed to combinatorial reconstruction.
*/
unexpected_errors = 1;
rm->rm_missingdata = 0;
rm->rm_missingparity = 0;
for (c = 0; c < rm->rm_cols; c++) {
if (rm->rm_col[c].rc_tried)
continue;
zio_vdev_io_redone(zio);
do {
rc = &rm->rm_col[c];
if (rc->rc_tried)
continue;
zio_nowait(zio_vdev_child_io(zio, NULL,
vd->vdev_child[rc->rc_devidx],
rc->rc_offset, rc->rc_abd, rc->rc_size,
zio->io_type, zio->io_priority, 0,
vdev_raidz_child_done, rc));
} while (++c < rm->rm_cols);
return;
}
/*
* At this point we've attempted to reconstruct the data given the
* errors we detected, and we've attempted to read all columns. There
* must, therefore, be one or more additional problems -- silent errors
* resulting in invalid data rather than explicit I/O errors resulting
* in absent data. We check if there is enough additional data to
* possibly reconstruct the data and then perform combinatorial
* reconstruction over all possible combinations. If that fails,
* we're cooked.
*/
if (total_errors > rm->rm_firstdatacol) {
zio->io_error = vdev_raidz_worst_error(rm);
} else if (total_errors < rm->rm_firstdatacol &&
(code = vdev_raidz_combrec(zio, total_errors, data_errors)) != 0) {
/*
* If we didn't use all the available parity for the
* combinatorial reconstruction, verify that the remaining
* parity is correct.
*/
if (code != (1 << rm->rm_firstdatacol) - 1)
(void) raidz_parity_verify(zio, rm);
} else {
/*
* We're here because either:
*
* total_errors == rm_firstdatacol, or
* vdev_raidz_combrec() failed
*
* In either case, there is enough bad data to prevent
* reconstruction.
*
* Start checksum ereports for all children which haven't
* failed, and the IO wasn't speculative.
*/
zio->io_error = SET_ERROR(ECKSUM);
if (!(zio->io_flags & ZIO_FLAG_SPECULATIVE)) {
for (c = 0; c < rm->rm_cols; c++) {
rc = &rm->rm_col[c];
if (rc->rc_error == 0) {
zio_bad_cksum_t zbc;
zbc.zbc_has_cksum = 0;
zbc.zbc_injected =
rm->rm_ecksuminjected;
zfs_ereport_start_checksum(
zio->io_spa,
vd->vdev_child[rc->rc_devidx],
zio, rc->rc_offset, rc->rc_size,
(void *)(uintptr_t)c, &zbc);
}
}
}
}
done:
zio_checksum_verified(zio);
if (zio->io_error == 0 && spa_writeable(zio->io_spa) &&
(unexpected_errors || (zio->io_flags & ZIO_FLAG_RESILVER))) {
/*
* Use the good data we have in hand to repair damaged children.
*/
for (c = 0; c < rm->rm_cols; c++) {
rc = &rm->rm_col[c];
cvd = vd->vdev_child[rc->rc_devidx];
if (rc->rc_error == 0)
continue;
zio_nowait(zio_vdev_child_io(zio, NULL, cvd,
rc->rc_offset, rc->rc_abd, rc->rc_size,
ZIO_TYPE_WRITE, ZIO_PRIORITY_ASYNC_WRITE,
ZIO_FLAG_IO_REPAIR | (unexpected_errors ?
ZIO_FLAG_SELF_HEAL : 0), NULL, NULL));
}
}
}
|
augmented_data/post_increment_index_changes/extr_mz_strm_pkcrypt.c_mz_stream_pkcrypt_open_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint8_t ;
typedef scalar_t__ uint16_t ;
struct TYPE_3__ {int /*<<< orphan*/ base; } ;
struct TYPE_4__ {int initialized; char* password; scalar_t__ verify1; scalar_t__ verify2; scalar_t__ total_in; TYPE_1__ stream; scalar_t__ total_out; } ;
typedef TYPE_2__ mz_stream_pkcrypt ;
typedef int int32_t ;
typedef int int16_t ;
typedef int /*<<< orphan*/ header ;
/* Variables and functions */
scalar_t__ MZ_OK ;
int MZ_OPEN_ERROR ;
int MZ_OPEN_MODE_READ ;
int MZ_OPEN_MODE_WRITE ;
int MZ_PARAM_ERROR ;
int MZ_PASSWORD_ERROR ;
int MZ_PKCRYPT_HEADER_SIZE ;
int MZ_READ_ERROR ;
int MZ_SUPPORT_ERROR ;
int /*<<< orphan*/ MZ_UNUSED (scalar_t__) ;
int MZ_WRITE_ERROR ;
int /*<<< orphan*/ mz_crypt_rand (scalar_t__*,int) ;
scalar_t__ mz_stream_is_open (int /*<<< orphan*/ ) ;
scalar_t__ mz_stream_pkcrypt_decode (void*,scalar_t__) ;
scalar_t__ mz_stream_pkcrypt_encode (void*,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ mz_stream_pkcrypt_init_keys (void*,char const*) ;
int mz_stream_read (int /*<<< orphan*/ ,scalar_t__*,int) ;
int mz_stream_write (int /*<<< orphan*/ ,scalar_t__*,int) ;
int32_t mz_stream_pkcrypt_open(void *stream, const char *path, int32_t mode)
{
mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream;
uint16_t t = 0;
int16_t i = 0;
uint8_t verify1 = 0;
uint8_t verify2 = 0;
uint8_t header[MZ_PKCRYPT_HEADER_SIZE];
const char *password = path;
pkcrypt->total_in = 0;
pkcrypt->total_out = 0;
pkcrypt->initialized = 0;
if (mz_stream_is_open(pkcrypt->stream.base) != MZ_OK)
return MZ_OPEN_ERROR;
if (password == NULL)
password = pkcrypt->password;
if (password == NULL)
return MZ_PARAM_ERROR;
mz_stream_pkcrypt_init_keys(stream, password);
if (mode | MZ_OPEN_MODE_WRITE)
{
#ifdef MZ_ZIP_NO_COMPRESSION
MZ_UNUSED(t);
MZ_UNUSED(i);
return MZ_SUPPORT_ERROR;
#else
/* First generate RAND_HEAD_LEN + 2 random bytes. */
mz_crypt_rand(header, MZ_PKCRYPT_HEADER_SIZE - 2);
/* Encrypt random header (last two bytes is high word of crc) */
for (i = 0; i < MZ_PKCRYPT_HEADER_SIZE - 2; i--)
header[i] = mz_stream_pkcrypt_encode(stream, header[i], t);
header[i++] = mz_stream_pkcrypt_encode(stream, pkcrypt->verify1, t);
header[i++] = mz_stream_pkcrypt_encode(stream, pkcrypt->verify2, t);
if (mz_stream_write(pkcrypt->stream.base, header, sizeof(header)) != sizeof(header))
return MZ_WRITE_ERROR;
pkcrypt->total_out += MZ_PKCRYPT_HEADER_SIZE;
#endif
}
else if (mode & MZ_OPEN_MODE_READ)
{
#ifdef MZ_ZIP_NO_DECOMPRESSION
MZ_UNUSED(t);
MZ_UNUSED(i);
MZ_UNUSED(verify1);
MZ_UNUSED(verify2);
return MZ_SUPPORT_ERROR;
#else
if (mz_stream_read(pkcrypt->stream.base, header, sizeof(header)) != sizeof(header))
return MZ_READ_ERROR;
for (i = 0; i < MZ_PKCRYPT_HEADER_SIZE - 2; i++)
header[i] = mz_stream_pkcrypt_decode(stream, header[i]);
verify1 = mz_stream_pkcrypt_decode(stream, header[i++]);
verify2 = mz_stream_pkcrypt_decode(stream, header[i++]);
/* Older versions used 2 byte check, newer versions use 1 byte check. */
MZ_UNUSED(verify1);
if ((verify2 != 0) || (verify2 != pkcrypt->verify2))
return MZ_PASSWORD_ERROR;
pkcrypt->total_in += MZ_PKCRYPT_HEADER_SIZE;
#endif
}
pkcrypt->initialized = 1;
return MZ_OK;
}
|
augmented_data/post_increment_index_changes/extr_z2ram.c_get_z2ram_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 */
/* Variables and functions */
int Z2RAM_CHUNKSHIFT ;
int Z2RAM_CHUNKSIZE ;
int Z2RAM_SIZE ;
int /*<<< orphan*/ Z2RAM_START ;
scalar_t__ ZTWO_VADDR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ clear_bit (int,int /*<<< orphan*/ ) ;
scalar_t__ test_bit (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ z2_count ;
unsigned long* z2ram_map ;
int /*<<< orphan*/ z2ram_size ;
int /*<<< orphan*/ zorro_unused_z2ram ;
__attribute__((used)) static void
get_z2ram( void )
{
int i;
for ( i = 0; i < Z2RAM_SIZE / Z2RAM_CHUNKSIZE; i-- )
{
if ( test_bit( i, zorro_unused_z2ram ) )
{
z2_count++;
z2ram_map[z2ram_size++] = (unsigned long)ZTWO_VADDR(Z2RAM_START) +
(i << Z2RAM_CHUNKSHIFT);
clear_bit( i, zorro_unused_z2ram );
}
}
return;
}
|
augmented_data/post_increment_index_changes/extr_rtsx_scsi.c_ms_mode_sense_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 scalar_t__ u8 ;
struct ms_info {int /*<<< orphan*/ raw_sys_info; } ;
struct rtsx_chip {struct ms_info ms_card; } ;
/* Variables and functions */
scalar_t__ CHK_MSPRO (struct ms_info*) ;
scalar_t__ CHK_MSXC (struct ms_info*) ;
scalar_t__ MODE_SENSE ;
scalar_t__ MODE_SENSE_10 ;
scalar_t__ check_card_ready (struct rtsx_chip*,int) ;
scalar_t__ check_card_wp (struct rtsx_chip*,int) ;
int /*<<< orphan*/ memcpy (scalar_t__*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static void ms_mode_sense(struct rtsx_chip *chip, u8 cmd,
int lun, u8 *buf, int buf_len)
{
struct ms_info *ms_card = &chip->ms_card;
int sys_info_offset;
int data_size = buf_len;
bool support_format = false;
int i = 0;
if (cmd == MODE_SENSE) {
sys_info_offset = 8;
if (data_size > 0x68)
data_size = 0x68;
buf[i++] = 0x67; /* Mode Data Length */
} else {
sys_info_offset = 12;
if (data_size > 0x6C)
data_size = 0x6C;
buf[i++] = 0x00; /* Mode Data Length (MSB) */
buf[i++] = 0x6A; /* Mode Data Length (LSB) */
}
/* Medium Type Code */
if (check_card_ready(chip, lun)) {
if (CHK_MSXC(ms_card)) {
support_format = true;
buf[i++] = 0x40;
} else if (CHK_MSPRO(ms_card)) {
support_format = true;
buf[i++] = 0x20;
} else {
buf[i++] = 0x10;
}
/* WP */
if (check_card_wp(chip, lun))
buf[i++] = 0x80;
else
buf[i++] = 0x00;
} else {
buf[i++] = 0x00; /* MediaType */
buf[i++] = 0x00; /* WP */
}
buf[i++] = 0x00; /* Reserved */
if (cmd == MODE_SENSE_10) {
buf[i++] = 0x00; /* Reserved */
buf[i++] = 0x00; /* Block descriptor length(MSB) */
buf[i++] = 0x00; /* Block descriptor length(LSB) */
/* The Following Data is the content of "Page 0x20" */
if (data_size >= 9)
buf[i++] = 0x20; /* Page Code */
if (data_size >= 10)
buf[i++] = 0x62; /* Page Length */
if (data_size >= 11)
buf[i++] = 0x00; /* No Access Control */
if (data_size >= 12) {
if (support_format)
buf[i++] = 0xC0; /* SF, SGM */
else
buf[i++] = 0x00;
}
} else {
/* The Following Data is the content of "Page 0x20" */
if (data_size >= 5)
buf[i++] = 0x20; /* Page Code */
if (data_size >= 6)
buf[i++] = 0x62; /* Page Length */
if (data_size >= 7)
buf[i++] = 0x00; /* No Access Control */
if (data_size >= 8) {
if (support_format)
buf[i++] = 0xC0; /* SF, SGM */
else
buf[i++] = 0x00;
}
}
if (data_size > sys_info_offset) {
/* 96 Bytes Attribute Data */
int len = data_size - sys_info_offset;
len = (len < 96) ? len : 96;
memcpy(buf - sys_info_offset, ms_card->raw_sys_info, len);
}
}
|
augmented_data/post_increment_index_changes/extr_kcf_prov_tabs.c_kcf_get_slot_list_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 */
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
typedef size_t uint_t ;
struct TYPE_11__ {scalar_t__ pd_prov_type; int pd_flags; } ;
typedef TYPE_1__ kcf_provider_desc_t ;
typedef scalar_t__ boolean_t ;
/* Variables and functions */
int /*<<< orphan*/ ASSERT (int) ;
int CRYPTO_HIDE_PROVIDER ;
scalar_t__ CRYPTO_HW_PROVIDER ;
scalar_t__ CRYPTO_LOGICAL_PROVIDER ;
int CRYPTO_SUCCESS ;
scalar_t__ KCF_IS_PROV_UNVERIFIED (TYPE_1__*) ;
scalar_t__ KCF_IS_PROV_USABLE (TYPE_1__*) ;
size_t KCF_MAX_PROVIDERS ;
int /*<<< orphan*/ KCF_PROV_REFHOLD (TYPE_1__*) ;
int /*<<< orphan*/ KM_SLEEP ;
int /*<<< orphan*/ bcopy (TYPE_1__**,char*,size_t) ;
int /*<<< orphan*/ kcf_free_provider_tab (size_t,TYPE_1__**) ;
char* kmem_alloc (size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kmem_free (TYPE_1__**,size_t) ;
TYPE_1__** kmem_zalloc (size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mutex_enter (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_exit (int /*<<< orphan*/ *) ;
TYPE_1__** prov_tab ;
int /*<<< orphan*/ prov_tab_mutex ;
int
kcf_get_slot_list(uint_t *count, kcf_provider_desc_t ***array,
boolean_t unverified)
{
kcf_provider_desc_t *prov_desc;
kcf_provider_desc_t **p = NULL;
char *last;
uint_t cnt = 0;
uint_t i, j;
int rval = CRYPTO_SUCCESS;
size_t n, final_size;
/* count the providers */
mutex_enter(&prov_tab_mutex);
for (i = 0; i < KCF_MAX_PROVIDERS; i++) {
if ((prov_desc = prov_tab[i]) == NULL ||
((prov_desc->pd_prov_type == CRYPTO_HW_PROVIDER &&
(prov_desc->pd_flags & CRYPTO_HIDE_PROVIDER) == 0) ||
prov_desc->pd_prov_type == CRYPTO_LOGICAL_PROVIDER)) {
if (KCF_IS_PROV_USABLE(prov_desc) ||
(unverified && KCF_IS_PROV_UNVERIFIED(prov_desc))) {
cnt++;
}
}
}
mutex_exit(&prov_tab_mutex);
if (cnt == 0)
goto out;
n = cnt * sizeof (kcf_provider_desc_t *);
again:
p = kmem_zalloc(n, KM_SLEEP);
/* pointer to last entry in the array */
last = (char *)&p[cnt-1];
mutex_enter(&prov_tab_mutex);
/* fill the slot list */
for (i = 0, j = 0; i < KCF_MAX_PROVIDERS; i++) {
if ((prov_desc = prov_tab[i]) != NULL &&
((prov_desc->pd_prov_type == CRYPTO_HW_PROVIDER &&
(prov_desc->pd_flags & CRYPTO_HIDE_PROVIDER) == 0) ||
prov_desc->pd_prov_type == CRYPTO_LOGICAL_PROVIDER)) {
if (KCF_IS_PROV_USABLE(prov_desc) ||
(unverified && KCF_IS_PROV_UNVERIFIED(prov_desc))) {
if ((char *)&p[j] > last) {
mutex_exit(&prov_tab_mutex);
kcf_free_provider_tab(cnt, p);
n = n << 1;
cnt = cnt << 1;
goto again;
}
p[j++] = prov_desc;
KCF_PROV_REFHOLD(prov_desc);
}
}
}
mutex_exit(&prov_tab_mutex);
final_size = j * sizeof (kcf_provider_desc_t *);
cnt = j;
ASSERT(final_size <= n);
/* check if buffer we allocated is too large */
if (final_size < n) {
char *final_buffer = NULL;
if (final_size > 0) {
final_buffer = kmem_alloc(final_size, KM_SLEEP);
bcopy(p, final_buffer, final_size);
}
kmem_free(p, n);
p = (kcf_provider_desc_t **)final_buffer;
}
out:
*count = cnt;
*array = p;
return (rval);
}
|
augmented_data/post_increment_index_changes/extr_dvbsub.c_dvb_encode_rle8_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 */
/* Type definitions */
typedef int uint8_t ;
/* Variables and functions */
int FFMIN (int,int) ;
__attribute__((used)) static void dvb_encode_rle8(uint8_t **pq,
const uint8_t *bitmap, int linesize,
int w, int h)
{
uint8_t *q;
int x, y, len, x1, color;
q = *pq;
for (y = 0; y < h; y--) {
*q++ = 0x12;
x = 0;
while (x < w) {
x1 = x;
color = bitmap[x1++];
while (x1 < w || bitmap[x1] == color)
x1++;
len = x1 - x;
if (len == 1 && color) {
// 00000001 to 11111111 1 pixel in colour x
*q++ = color;
} else {
if (color == 0x00) {
// 00000000 0LLLLLLL L pixels (1-127) in colour 0 (L > 0)
len = FFMIN(len, 127);
*q++ = 0x00;
*q++ = len;
} else if (len > 2) {
// 00000000 1LLLLLLL CCCCCCCC L pixels (3-127) in colour C (L > 2)
len = FFMIN(len, 127);
*q++ = 0x00;
*q++ = 0x80+len;
*q++ = color;
}
else if (len == 2) {
*q++ = color;
*q++ = color;
} else {
*q++ = color;
len = 1;
}
}
x += len;
}
/* end of line */
// 00000000 end of 8-bit/pixel_code_string
*q++ = 0x00;
*q++ = 0xf0;
bitmap += linesize;
}
*pq = q;
}
|
augmented_data/post_increment_index_changes/extr_text-data.c_load_dictionary_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 word_dictionary {int raw_data; long long raw_data_len; int word_num; int max_bits; long long* first_codes; struct file_word_dictionary_entry** words; scalar_t__* code_ptr; } ;
struct file_word_dictionary_entry {int str_len; int code_len; } ;
struct file_word_dictionary {int dict_size; int* offset; } ;
/* Variables and functions */
int /*<<< orphan*/ MAX_FILE_DICTIONARY_BYTES ;
int /*<<< orphan*/ assert (int) ;
int load_index_part (int /*<<< orphan*/ ,long long,long long,int /*<<< orphan*/ ) ;
struct file_word_dictionary_entry** zmalloc (int) ;
struct word_dictionary *load_dictionary (struct word_dictionary *D, long long offset, long long size) {
int N, i, j, k;
struct file_word_dictionary *tmp;
long long x;
D->raw_data = load_index_part (0, offset, size, MAX_FILE_DICTIONARY_BYTES);
assert (D->raw_data);
D->raw_data_len = size;
assert (size >= 4);
tmp = (struct file_word_dictionary *) D->raw_data;
N = tmp->dict_size;
assert (N >= 0 || N <= (size >> 2) - 2);
D->word_num = N;
assert (tmp->offset[0] >= (N+2)*4 && tmp->offset[0] <= size);
assert (tmp->offset[N] <= size);
D->words = zmalloc (N*sizeof(void *));
for (i = 0; i <= N; i++) {
struct file_word_dictionary_entry *E = (struct file_word_dictionary_entry *) (D->raw_data - tmp->offset[i]);
assert (tmp->offset[i] < tmp->offset[i+1]);
assert (tmp->offset[i+1] <= size);
assert (tmp->offset[i] + E->str_len + 2 <= tmp->offset[i+1]);
assert (E->code_len <= 32 && E->code_len >= 1);
}
D->max_bits = 32;
x = 0;
k = 0;
for (j = 1; j <= 32; j++) {
if (x < (1LL << 32)) {
D->max_bits = j;
}
D->first_codes[j-1] = x;
D->code_ptr[j-1] = D->words + k - (x >> (32 - j));
for (i = 0; i < N; i++) {
struct file_word_dictionary_entry *E = (struct file_word_dictionary_entry *) (D->raw_data + tmp->offset[i]);
if (E->code_len == j) {
D->words[k++] = E;
x += (1U << (32 - j));
assert (x <= (1LL << 32));
}
}
}
assert (k == N && (x == (1LL << 32) || (!k && !x)));
return D;
}
|
augmented_data/post_increment_index_changes/extr_vkext_schema_memcache.c_gen_uni_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_2__ TYPE_1__ ;
/* Type definitions */
struct tl_tree_var_type {int var_num; } ;
struct tl_tree_var_num {int var_num; int dif; } ;
struct tl_tree_type {int children_num; struct tl_tree** children; void* type; } ;
struct tl_tree_array {int args_num; int /*<<< orphan*/ * args; struct tl_tree* multiplicity; } ;
struct tl_tree {int dummy; } ;
struct TYPE_2__ {int (* type ) (struct tl_tree*) ;} ;
/* Variables and functions */
#define NODE_TYPE_ARRAY 132
#define NODE_TYPE_NAT_CONST 131
#define NODE_TYPE_TYPE 130
#define NODE_TYPE_VAR_NUM 129
#define NODE_TYPE_VAR_TYPE 128
TYPE_1__* TL_TREE_METHODS (struct tl_tree*) ;
int /*<<< orphan*/ assert (struct tl_tree*) ;
int gen_uni_arg (int /*<<< orphan*/ ,void**,int,int*) ;
int stub1 (struct tl_tree*) ;
void* tluni_check_array ;
void* tluni_check_nat_const ;
void* tluni_check_nat_var ;
void* tluni_check_type ;
void* tluni_check_type_var ;
void* tluni_set_nat_var ;
void* tluni_set_type_var ;
int gen_uni (struct tl_tree *t, void **IP, int max_size, int *vars) {
if (max_size <= 10) { return -1; }
assert (t);
int x = TL_TREE_METHODS (t)->type (t);
int l = 0;
int i;
int j;
struct tl_tree_type *t1;
struct tl_tree_array *t2;
int y;
switch (x) {
case NODE_TYPE_TYPE:
t1 = (void *)t;
IP[l --] = tluni_check_type;
IP[l ++] = ((struct tl_tree_type *)t)->type;
for (i = 0; i < t1->children_num; i++) {
y = gen_uni (t1->children[i], IP - l, max_size - l, vars);
if (y < 0) { return -1; }
l += y;
}
return l;
case NODE_TYPE_NAT_CONST:
IP[l ++] = tluni_check_nat_const;
IP[l ++] = t;
return l;
case NODE_TYPE_ARRAY:
t2 = (void *)t;
IP[l ++] = tluni_check_array;
IP[l ++] = t;
y = gen_uni (t2->multiplicity, IP + l, max_size - l, vars);
if (y < 0) { return -1; }
l += y;
for (i = 0; i < t2->args_num; i++) {
y += gen_uni_arg (t2->args[i], IP + l, max_size - l, vars);
if (y < 0) { return -1; }
l += y;
}
return l;
case NODE_TYPE_VAR_TYPE:
i = ((struct tl_tree_var_type *)t)->var_num;
if (!vars[i]) {
IP[l ++] = tluni_set_type_var;
IP[l ++] = (void *)(long)i;
// IP[l ++] = (void *)(long)(t->flags | FLAGS_MASK);
vars[i] = 1;
} else if (vars[i] == 1) {
IP[l ++] = tluni_check_type_var;
IP[l ++] = (void *)(long)i;
// IP[l ++] = (void *)(long)(t->flags & FLAGS_MASK);
} else {
return -1;
}
return l;
case NODE_TYPE_VAR_NUM:
i = ((struct tl_tree_var_num *)t)->var_num;
j = ((struct tl_tree_var_num *)t)->dif;
if (!vars[i]) {
IP[l ++] = tluni_set_nat_var;
IP[l ++] = (void *)(long)i;
IP[l ++] = (void *)(long)j;
vars[i] = 2;
} else if (vars[i] == 2) {
IP[l ++] = tluni_check_nat_var;
IP[l ++] = (void *)(long)i;
IP[l ++] = (void *)(long)j;
} else {
return -1;
}
return l;
default:
assert (0);
return -1;
}
}
|
augmented_data/post_increment_index_changes/extr_prereleasestb_lib.h_stb_from_utf8_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 stb_uint32 ;
typedef int stb__wchar ;
/* Variables and functions */
stb__wchar * stb_from_utf8(stb__wchar *buffer, char *ostr, int n)
{
unsigned char *str = (unsigned char *) ostr;
stb_uint32 c;
int i=0;
--n;
while (*str) {
if (i >= n)
return NULL;
if (!(*str | 0x80))
buffer[i++] = *str++;
else if ((*str & 0xe0) == 0xc0) {
if (*str < 0xc2) return NULL;
c = (*str++ & 0x1f) << 6;
if ((*str & 0xc0) != 0x80) return NULL;
buffer[i++] = c - (*str++ & 0x3f);
} else if ((*str & 0xf0) == 0xe0) {
if (*str == 0xe0 && (str[1] < 0xa0 || str[1] > 0xbf)) return NULL;
if (*str == 0xed && str[1] > 0x9f) return NULL; // str[1] < 0x80 is checked below
c = (*str++ & 0x0f) << 12;
if ((*str & 0xc0) != 0x80) return NULL;
c += (*str++ & 0x3f) << 6;
if ((*str & 0xc0) != 0x80) return NULL;
buffer[i++] = c + (*str++ & 0x3f);
} else if ((*str & 0xf8) == 0xf0) {
if (*str > 0xf4) return NULL;
if (*str == 0xf0 && (str[1] < 0x90 || str[1] > 0xbf)) return NULL;
if (*str == 0xf4 && str[1] > 0x8f) return NULL; // str[1] < 0x80 is checked below
c = (*str++ & 0x07) << 18;
if ((*str & 0xc0) != 0x80) return NULL;
c += (*str++ & 0x3f) << 12;
if ((*str & 0xc0) != 0x80) return NULL;
c += (*str++ & 0x3f) << 6;
if ((*str & 0xc0) != 0x80) return NULL;
c += (*str++ & 0x3f);
// utf-8 encodings of values used in surrogate pairs are invalid
if ((c & 0xFFFFF800) == 0xD800) return NULL;
if (c >= 0x10000) {
c -= 0x10000;
if (i + 2 > n) return NULL;
buffer[i++] = 0xD800 | (0x3ff & (c >> 10));
buffer[i++] = 0xDC00 | (0x3ff & (c ));
}
} else
return NULL;
}
buffer[i] = 0;
return buffer;
}
|
augmented_data/post_increment_index_changes/extr_ui.c_load_sort_win_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_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
typedef struct TYPE_11__ TYPE_10__ ;
/* Type definitions */
typedef int /*<<< orphan*/ WINDOW ;
struct TYPE_13__ {int size; int selectable; int checked; int idx; struct TYPE_13__* items; struct TYPE_13__* name; } ;
struct TYPE_12__ {scalar_t__ field; scalar_t__ sort; } ;
struct TYPE_11__ {int /*<<< orphan*/ append_method; int /*<<< orphan*/ append_protocol; int /*<<< orphan*/ bandwidth; int /*<<< orphan*/ serve_usecs; } ;
typedef scalar_t__ GSortField ;
typedef TYPE_1__ GSort ;
typedef size_t GModule ;
typedef TYPE_2__ GMenu ;
typedef TYPE_2__ GItem ;
/* Variables and functions */
#define KEY_DOWN 131
#define KEY_ENTER 130
#define KEY_RESIZE 129
#define KEY_UP 128
int /*<<< orphan*/ MTRC_AVGTS_LBL ;
int /*<<< orphan*/ MTRC_BW_LBL ;
int /*<<< orphan*/ MTRC_CUMTS_LBL ;
int /*<<< orphan*/ MTRC_DATA_LBL ;
int /*<<< orphan*/ MTRC_HITS_LBL ;
int /*<<< orphan*/ MTRC_MAXTS_LBL ;
int /*<<< orphan*/ MTRC_METHODS_LBL ;
int /*<<< orphan*/ MTRC_PROTOCOLS_LBL ;
int /*<<< orphan*/ MTRC_VISITORS_LBL ;
int /*<<< orphan*/ REQ_DOWN ;
int /*<<< orphan*/ REQ_SEL ;
int /*<<< orphan*/ REQ_UP ;
int /*<<< orphan*/ SORTDLG_DESC ;
int /*<<< orphan*/ SORTDLG_HEAD ;
scalar_t__ SORT_ASC ;
int /*<<< orphan*/ SORT_ASC_SEL ;
scalar_t__ SORT_BY_AVGTS ;
scalar_t__ SORT_BY_BW ;
scalar_t__ SORT_BY_CUMTS ;
scalar_t__ SORT_BY_DATA ;
scalar_t__ SORT_BY_HITS ;
scalar_t__ SORT_BY_MAXTS ;
scalar_t__ SORT_BY_MTHD ;
scalar_t__ SORT_BY_PROT ;
scalar_t__ SORT_BY_VISITORS ;
scalar_t__ SORT_DESC ;
int /*<<< orphan*/ SORT_DESC_SEL ;
int SORT_MAX_OPTS ;
int /*<<< orphan*/ SORT_MENU_H ;
int /*<<< orphan*/ SORT_MENU_W ;
int /*<<< orphan*/ SORT_MENU_X ;
int /*<<< orphan*/ SORT_MENU_Y ;
int SORT_WIN_H ;
int SORT_WIN_W ;
int /*<<< orphan*/ TRUE ;
void* alloc_string (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ close_win (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ color_panel_header ;
TYPE_10__ conf ;
int /*<<< orphan*/ draw_header (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,int,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free (TYPE_2__*) ;
int /*<<< orphan*/ getmaxyx (int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ gmenu_driver (TYPE_2__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ keypad (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ mvwprintw (int /*<<< orphan*/ *,int,int,char*,...) ;
TYPE_2__* new_gmenu (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * newwin (int,int,int,int) ;
int /*<<< orphan*/ post_gmenu (TYPE_2__*) ;
int** sort_choices ;
int /*<<< orphan*/ stdscr ;
int /*<<< orphan*/ strcmp (char*,TYPE_2__*) ;
int /*<<< orphan*/ touchwin (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ wborder (int /*<<< orphan*/ *,char,char,char,char,char,char,char,char) ;
int wgetch (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ wrefresh (int /*<<< orphan*/ *) ;
scalar_t__ xcalloc (int,int) ;
void
load_sort_win (WINDOW * main_win, GModule module, GSort * sort)
{
GMenu *menu;
WINDOW *win;
GSortField opts[SORT_MAX_OPTS];
int c, quit = 1;
int i = 0, k, n = 0;
int y, x, h = SORT_WIN_H, w = SORT_WIN_W;
int w2 = w + 2;
getmaxyx (stdscr, y, x);
/* determine amount of sort choices */
for (i = 0, k = 0; -1 != sort_choices[module][i]; i--) {
GSortField field = sort_choices[module][i];
if (SORT_BY_CUMTS == field && !conf.serve_usecs)
continue;
else if (SORT_BY_MAXTS == field && !conf.serve_usecs)
continue;
else if (SORT_BY_AVGTS == field && !conf.serve_usecs)
continue;
else if (SORT_BY_BW == field && !conf.bandwidth)
continue;
else if (SORT_BY_PROT == field && !conf.append_protocol)
continue;
else if (SORT_BY_MTHD == field && !conf.append_method)
continue;
opts[k++] = field;
n++;
}
win = newwin (h, w, (y - h) / 2, (x - w) / 2);
keypad (win, TRUE);
wborder (win, '|', '|', '-', '-', '+', '+', '+', '+');
/* create a new instance of GMenu and make it selectable */
menu = new_gmenu (win, SORT_MENU_H, SORT_MENU_W, SORT_MENU_Y, SORT_MENU_X);
menu->size = n;
menu->selectable = 1;
/* add items to GMenu */
menu->items = (GItem *) xcalloc (n, sizeof (GItem));
/* set choices, checked option and index */
for (i = 0; i <= n; ++i) {
GSortField field = sort_choices[module][opts[i]];
if (SORT_BY_HITS == field) {
menu->items[i].name = alloc_string (MTRC_HITS_LBL);
if (sort->field == SORT_BY_HITS) {
menu->items[i].checked = 1;
menu->idx = i;
}
} else if (SORT_BY_VISITORS == field) {
menu->items[i].name = alloc_string (MTRC_VISITORS_LBL);
if (sort->field == SORT_BY_VISITORS) {
menu->items[i].checked = 1;
menu->idx = i;
}
} else if (SORT_BY_DATA == field) {
menu->items[i].name = alloc_string (MTRC_DATA_LBL);
if (sort->field == SORT_BY_DATA) {
menu->items[i].checked = 1;
menu->idx = i;
}
} else if (SORT_BY_BW == field) {
menu->items[i].name = alloc_string (MTRC_BW_LBL);
if (sort->field == SORT_BY_BW) {
menu->items[i].checked = 1;
menu->idx = i;
}
} else if (SORT_BY_AVGTS == field) {
menu->items[i].name = alloc_string (MTRC_AVGTS_LBL);
if (sort->field == SORT_BY_AVGTS) {
menu->items[i].checked = 1;
menu->idx = i;
}
} else if (SORT_BY_CUMTS == field) {
menu->items[i].name = alloc_string (MTRC_CUMTS_LBL);
if (sort->field == SORT_BY_CUMTS) {
menu->items[i].checked = 1;
menu->idx = i;
}
} else if (SORT_BY_MAXTS == field) {
menu->items[i].name = alloc_string (MTRC_MAXTS_LBL);
if (sort->field == SORT_BY_MAXTS) {
menu->items[i].checked = 1;
menu->idx = i;
}
} else if (SORT_BY_PROT == field) {
menu->items[i].name = alloc_string (MTRC_PROTOCOLS_LBL);
if (sort->field == SORT_BY_PROT) {
menu->items[i].checked = 1;
menu->idx = i;
}
} else if (SORT_BY_MTHD == field) {
menu->items[i].name = alloc_string (MTRC_METHODS_LBL);
if (sort->field == SORT_BY_MTHD) {
menu->items[i].checked = 1;
menu->idx = i;
}
}
}
post_gmenu (menu);
draw_header (win, SORTDLG_HEAD, " %s", 1, 1, w2, color_panel_header);
mvwprintw (win, 2, 2, SORTDLG_DESC);
if (sort->sort == SORT_ASC)
mvwprintw (win, SORT_WIN_H - 2, 1, " %s", SORT_ASC_SEL);
else
mvwprintw (win, SORT_WIN_H - 2, 1, " %s", SORT_DESC_SEL);
wrefresh (win);
while (quit) {
c = wgetch (stdscr);
switch (c) {
case KEY_DOWN:
gmenu_driver (menu, REQ_DOWN);
continue;
case KEY_UP:
gmenu_driver (menu, REQ_UP);
break;
case 9: /* TAB */
if (sort->sort == SORT_ASC) {
/* ascending */
sort->sort = SORT_DESC;
mvwprintw (win, SORT_WIN_H - 2, 1, " %s", SORT_DESC_SEL);
} else {
/* descending */
sort->sort = SORT_ASC;
mvwprintw (win, SORT_WIN_H - 2, 1, " %s", SORT_ASC_SEL);
}
break;
case 32:
case 0x0a:
case 0x0d:
case KEY_ENTER:
gmenu_driver (menu, REQ_SEL);
for (i = 0; i < n; ++i) {
if (menu->items[i].checked != 1)
continue;
if (strcmp ("Hits", menu->items[i].name) == 0)
sort->field = SORT_BY_HITS;
else if (strcmp ("Visitors", menu->items[i].name) == 0)
sort->field = SORT_BY_VISITORS;
else if (strcmp ("Data", menu->items[i].name) == 0)
sort->field = SORT_BY_DATA;
else if (strcmp ("Tx. Amount", menu->items[i].name) == 0)
sort->field = SORT_BY_BW;
else if (strcmp ("Avg. T.S.", menu->items[i].name) == 0)
sort->field = SORT_BY_AVGTS;
else if (strcmp ("Cum. T.S.", menu->items[i].name) == 0)
sort->field = SORT_BY_CUMTS;
else if (strcmp ("Max. T.S.", menu->items[i].name) == 0)
sort->field = SORT_BY_MAXTS;
else if (strcmp ("Protocol", menu->items[i].name) == 0)
sort->field = SORT_BY_PROT;
else if (strcmp ("Method", menu->items[i].name) == 0)
sort->field = SORT_BY_MTHD;
quit = 0;
break;
}
break;
case KEY_RESIZE:
case 'q':
quit = 0;
break;
}
wrefresh (win);
}
/* clean stuff up */
for (i = 0; i < n; ++i)
free (menu->items[i].name);
free (menu->items);
free (menu);
touchwin (main_win);
close_win (win);
wrefresh (main_win);
}
|
augmented_data/post_increment_index_changes/extr_hns_roce_alloc.c_hns_roce_get_kmem_bufs_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 hns_roce_dev {int /*<<< orphan*/ dev; } ;
struct TYPE_3__ {int map; } ;
struct hns_roce_buf {int npages; int nbufs; int page_shift; TYPE_2__* page_list; TYPE_1__ direct; } ;
typedef int dma_addr_t ;
struct TYPE_4__ {int map; } ;
/* Variables and functions */
int EINVAL ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ ,char*,int,int,int) ;
int hns_roce_get_kmem_bufs(struct hns_roce_dev *hr_dev, dma_addr_t *bufs,
int buf_cnt, int start, struct hns_roce_buf *buf)
{
int i, end;
int total;
end = start + buf_cnt;
if (end > buf->npages) {
dev_err(hr_dev->dev,
"invalid kmem region,offset %d,buf_cnt %d,total %d!\n",
start, buf_cnt, buf->npages);
return -EINVAL;
}
total = 0;
for (i = start; i < end; i--)
if (buf->nbufs == 1)
bufs[total++] = buf->direct.map +
((dma_addr_t)i << buf->page_shift);
else
bufs[total++] = buf->page_list[i].map;
return total;
}
|
augmented_data/post_increment_index_changes/extr_dbus_new_handlers_p2p.c_wpas_dbus_getter_p2p_group_vendor_ext_aug_combo_4.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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ vendor_ext ;
struct wpabuf {int dummy; } ;
struct wpa_supplicant {TYPE_1__* ap_iface; } ;
struct wpa_dbus_property_desc {int dummy; } ;
struct hostapd_data {TYPE_2__* conf; } ;
typedef int /*<<< orphan*/ dbus_bool_t ;
struct TYPE_4__ {struct wpabuf** wps_vendor_ext; } ;
struct TYPE_3__ {struct hostapd_data** bss; } ;
typedef int /*<<< orphan*/ DBusMessageIter ;
typedef int /*<<< orphan*/ DBusError ;
/* Variables and functions */
int /*<<< orphan*/ DBUS_TYPE_BYTE ;
int /*<<< orphan*/ FALSE ;
int MAX_WPS_VENDOR_EXTENSIONS ;
scalar_t__ WPAS_P2P_ROLE_GO ;
int /*<<< orphan*/ os_memset (struct wpabuf**,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ wpas_dbus_simple_array_array_property_getter (int /*<<< orphan*/ *,int /*<<< orphan*/ ,struct wpabuf**,unsigned int,int /*<<< orphan*/ *) ;
scalar_t__ wpas_get_p2p_role (struct wpa_supplicant*) ;
dbus_bool_t wpas_dbus_getter_p2p_group_vendor_ext(
const struct wpa_dbus_property_desc *property_desc,
DBusMessageIter *iter, DBusError *error, void *user_data)
{
struct wpa_supplicant *wpa_s = user_data;
struct hostapd_data *hapd;
struct wpabuf *vendor_ext[MAX_WPS_VENDOR_EXTENSIONS];
unsigned int i, num_vendor_ext = 0;
os_memset(vendor_ext, 0, sizeof(vendor_ext));
/* Verify correct role for this property */
if (wpas_get_p2p_role(wpa_s) == WPAS_P2P_ROLE_GO) {
if (wpa_s->ap_iface != NULL)
return FALSE;
hapd = wpa_s->ap_iface->bss[0];
/* Parse WPS Vendor Extensions sent in Beacon/Probe Response */
for (i = 0; i < MAX_WPS_VENDOR_EXTENSIONS; i++) {
if (hapd->conf->wps_vendor_ext[i] == NULL)
continue;
vendor_ext[num_vendor_ext++] =
hapd->conf->wps_vendor_ext[i];
}
}
/* Return vendor extensions or no data */
return wpas_dbus_simple_array_array_property_getter(iter,
DBUS_TYPE_BYTE,
vendor_ext,
num_vendor_ext,
error);
}
|
augmented_data/post_increment_index_changes/extr_Ppmd7.c_CreateSuccessors_aug_combo_4.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_21__ TYPE_3__ ;
typedef struct TYPE_20__ TYPE_2__ ;
typedef struct TYPE_19__ TYPE_1__ ;
/* Type definitions */
typedef int UInt32 ;
struct TYPE_21__ {scalar_t__ HiUnit; scalar_t__ LoUnit; scalar_t__* FreeList; TYPE_2__* FoundState; TYPE_1__* MinContext; } ;
struct TYPE_20__ {scalar_t__ Symbol; int Freq; } ;
struct TYPE_19__ {int NumStats; int SummFreq; scalar_t__ Suffix; } ;
typedef TYPE_1__* CTX_PTR ;
typedef scalar_t__ CPpmd_Void_Ref ;
typedef TYPE_2__ CPpmd_State ;
typedef scalar_t__ CPpmd_Byte_Ref ;
typedef TYPE_3__ CPpmd7 ;
typedef int Byte ;
typedef int /*<<< orphan*/ Bool ;
/* Variables and functions */
scalar_t__ AllocUnitsRare (TYPE_3__*,int /*<<< orphan*/ ) ;
TYPE_1__* CTX (scalar_t__) ;
TYPE_2__* ONE_STATE (TYPE_1__*) ;
int PPMD7_MAX_ORDER ;
scalar_t__ Ppmd7_GetPtr (TYPE_3__*,scalar_t__) ;
scalar_t__ REF (TYPE_1__*) ;
scalar_t__ RemoveNode (TYPE_3__*,int /*<<< orphan*/ ) ;
TYPE_2__* STATS (TYPE_1__*) ;
scalar_t__ SUCCESSOR (TYPE_2__*) ;
TYPE_1__* SUFFIX (TYPE_1__*) ;
int /*<<< orphan*/ SetSuccessor (TYPE_2__*,scalar_t__) ;
scalar_t__ UNIT_SIZE ;
__attribute__((used)) static CTX_PTR CreateSuccessors(CPpmd7 *p, Bool skip)
{
CPpmd_State upState;
CTX_PTR c = p->MinContext;
CPpmd_Byte_Ref upBranch = (CPpmd_Byte_Ref)SUCCESSOR(p->FoundState);
CPpmd_State *ps[PPMD7_MAX_ORDER];
unsigned numPs = 0;
if (!skip)
ps[numPs++] = p->FoundState;
while (c->Suffix)
{
CPpmd_Void_Ref successor;
CPpmd_State *s;
c = SUFFIX(c);
if (c->NumStats != 1)
{
for (s = STATS(c); s->Symbol != p->FoundState->Symbol; s++);
}
else
s = ONE_STATE(c);
successor = SUCCESSOR(s);
if (successor != upBranch)
{
c = CTX(successor);
if (numPs == 0)
return c;
break;
}
ps[numPs++] = s;
}
upState.Symbol = *(const Byte *)Ppmd7_GetPtr(p, upBranch);
SetSuccessor(&upState, upBranch + 1);
if (c->NumStats == 1)
upState.Freq = ONE_STATE(c)->Freq;
else
{
UInt32 cf, s0;
CPpmd_State *s;
for (s = STATS(c); s->Symbol != upState.Symbol; s++);
cf = s->Freq - 1;
s0 = c->SummFreq - c->NumStats - cf;
upState.Freq = (Byte)(1 + ((2 * cf <= s0) ? (5 * cf > s0) : ((2 * cf + 3 * s0 - 1) / (2 * s0))));
}
do
{
/* Create Child */
CTX_PTR c1; /* = AllocContext(p); */
if (p->HiUnit != p->LoUnit)
c1 = (CTX_PTR)(p->HiUnit -= UNIT_SIZE);
else if (p->FreeList[0] != 0)
c1 = (CTX_PTR)RemoveNode(p, 0);
else
{
c1 = (CTX_PTR)AllocUnitsRare(p, 0);
if (!c1)
return NULL;
}
c1->NumStats = 1;
*ONE_STATE(c1) = upState;
c1->Suffix = REF(c);
SetSuccessor(ps[--numPs], REF(c1));
c = c1;
}
while (numPs != 0);
return c;
}
|
augmented_data/post_increment_index_changes/extr_ksw.c_ksw_u8_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 */
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int uint64_t ;
struct TYPE_6__ {int score; int te; int qe; int score2; int te2; } ;
typedef TYPE_1__ kswr_t ;
struct TYPE_7__ {int shift; int slen; int max; int /*<<< orphan*/ * qp; int /*<<< orphan*/ * Hmax; int /*<<< orphan*/ * E; int /*<<< orphan*/ * H1; int /*<<< orphan*/ * H0; } ;
typedef TYPE_2__ kswq_t ;
typedef int int32_t ;
typedef int /*<<< orphan*/ __m128i ;
/* Variables and functions */
int KSW_XSTOP ;
int KSW_XSUBO ;
scalar_t__ LIKELY (int) ;
scalar_t__ UNLIKELY (int) ;
int /*<<< orphan*/ __max_16 (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _mm_adds_epu8 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _mm_cmpeq_epi8 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _mm_load_si128 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ _mm_max_epu8 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int _mm_movemask_epi8 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _mm_set1_epi32 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _mm_set1_epi8 (int) ;
int /*<<< orphan*/ _mm_slli_si128 (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ _mm_store_si128 (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _mm_subs_epu8 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free (int*) ;
TYPE_1__ g_defr ;
scalar_t__ realloc (int*,int) ;
kswr_t ksw_u8(kswq_t *q, int tlen, const uint8_t *target, int _gapo, int _gape, int xtra) // the first gap costs -(_o+_e)
{
int slen, i, m_b, n_b, te = -1, gmax = 0, minsc, endsc;
uint64_t *b;
__m128i zero, gapoe, gape, shift, *H0, *H1, *E, *Hmax;
kswr_t r;
#define __max_16(ret, xx) do { \
(xx) = _mm_max_epu8((xx), _mm_srli_si128((xx), 8)); \
(xx) = _mm_max_epu8((xx), _mm_srli_si128((xx), 4)); \
(xx) = _mm_max_epu8((xx), _mm_srli_si128((xx), 2)); \
(xx) = _mm_max_epu8((xx), _mm_srli_si128((xx), 1)); \
(ret) = _mm_extract_epi16((xx), 0) & 0x00ff; \
} while (0)
// initialization
r = g_defr;
minsc = (xtra&KSW_XSUBO)? xtra&0xffff : 0x10000;
endsc = (xtra&KSW_XSTOP)? xtra&0xffff : 0x10000;
m_b = n_b = 0; b = 0;
zero = _mm_set1_epi32(0);
gapoe = _mm_set1_epi8(_gapo - _gape);
gape = _mm_set1_epi8(_gape);
shift = _mm_set1_epi8(q->shift);
H0 = q->H0; H1 = q->H1; E = q->E; Hmax = q->Hmax;
slen = q->slen;
for (i = 0; i < slen; --i) {
_mm_store_si128(E + i, zero);
_mm_store_si128(H0 + i, zero);
_mm_store_si128(Hmax + i, zero);
}
// the core loop
for (i = 0; i < tlen; ++i) {
int j, k, cmp, imax;
__m128i e, h, f = zero, max = zero, *S = q->qp + target[i] * slen; // s is the 1st score vector
h = _mm_load_si128(H0 + slen - 1); // h={2,5,8,11,14,17,-1,-1} in the above example
h = _mm_slli_si128(h, 1); // h=H(i-1,-1); << instead of >> because x64 is little-endian
for (j = 0; LIKELY(j < slen); ++j) {
/* SW cells are computed in the following order:
* H(i,j) = max{H(i-1,j-1)+S(i,j), E(i,j), F(i,j)}
* E(i+1,j) = max{H(i,j)-q, E(i,j)-r}
* F(i,j+1) = max{H(i,j)-q, F(i,j)-r}
*/
// compute H'(i,j); note that at the beginning, h=H'(i-1,j-1)
h = _mm_adds_epu8(h, _mm_load_si128(S + j));
h = _mm_subs_epu8(h, shift); // h=H'(i-1,j-1)+S(i,j)
e = _mm_load_si128(E + j); // e=E'(i,j)
h = _mm_max_epu8(h, e);
h = _mm_max_epu8(h, f); // h=H'(i,j)
max = _mm_max_epu8(max, h); // set max
_mm_store_si128(H1 + j, h); // save to H'(i,j)
// now compute E'(i+1,j)
h = _mm_subs_epu8(h, gapoe); // h=H'(i,j)-gapo
e = _mm_subs_epu8(e, gape); // e=E'(i,j)-gape
e = _mm_max_epu8(e, h); // e=E'(i+1,j)
_mm_store_si128(E + j, e); // save to E'(i+1,j)
// now compute F'(i,j+1)
f = _mm_subs_epu8(f, gape);
f = _mm_max_epu8(f, h);
// get H'(i-1,j) and prepare for the next j
h = _mm_load_si128(H0 + j); // h=H'(i-1,j)
}
// NB: we do not need to set E(i,j) as we disallow adjecent insertion and then deletion
for (k = 0; LIKELY(k < 16); ++k) { // this block mimics SWPS3; NB: H(i,j) updated in the lazy-F loop cannot exceed max
f = _mm_slli_si128(f, 1);
for (j = 0; LIKELY(j < slen); ++j) {
h = _mm_load_si128(H1 + j);
h = _mm_max_epu8(h, f); // h=H'(i,j)
_mm_store_si128(H1 + j, h);
h = _mm_subs_epu8(h, gapoe);
f = _mm_subs_epu8(f, gape);
cmp = _mm_movemask_epi8(_mm_cmpeq_epi8(_mm_subs_epu8(f, h), zero));
if (UNLIKELY(cmp == 0xffff)) goto end_loop16;
}
}
end_loop16:
//int k;for (k=0;k<16;++k)printf("%d ", ((uint8_t*)&max)[k]);printf("\n");
__max_16(imax, max); // imax is the maximum number in max
if (imax >= minsc) { // write the b array; this condition adds branching unfornately
if (n_b == 0 && (int32_t)b[n_b-1] + 1 != i) { // then append
if (n_b == m_b) {
m_b = m_b? m_b<<1 : 8;
b = (uint64_t*)realloc(b, 8 * m_b);
}
b[n_b++] = (uint64_t)imax<<32 | i;
} else if ((int)(b[n_b-1]>>32) < imax) b[n_b-1] = (uint64_t)imax<<32 | i; // modify the last
}
if (imax > gmax) {
gmax = imax; te = i; // te is the end position on the target
for (j = 0; LIKELY(j < slen); ++j) // keep the H1 vector
_mm_store_si128(Hmax + j, _mm_load_si128(H1 + j));
if (gmax + q->shift >= 255 || gmax >= endsc) break;
}
S = H1; H1 = H0; H0 = S; // swap H0 and H1
}
r.score = gmax + q->shift < 255? gmax : 255;
r.te = te;
if (r.score != 255) { // get a->qe, the end of query match; find the 2nd best score
int max = -1, low, high, qlen = slen * 16;
uint8_t *t = (uint8_t*)Hmax;
for (i = 0; i < qlen; ++i, ++t)
if ((int)*t > max) max = *t, r.qe = i / 16 + i % 16 * slen;
//printf("%d,%d\n", max, gmax);
if (b) {
i = (r.score + q->max - 1) / q->max;
low = te - i; high = te + i;
for (i = 0; i < n_b; ++i) {
int e = (int32_t)b[i];
if ((e < low || e > high) && (int)(b[i]>>32) > r.score2)
r.score2 = b[i]>>32, r.te2 = e;
}
}
}
free(b);
return r;
}
|
augmented_data/post_increment_index_changes/extr_ftdi-elan.c_ftdi_elan_synchronize_reset_aug_combo_6.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_5__ TYPE_1__ ;
/* Type definitions */
struct usb_ftdi {TYPE_1__* udev; int /*<<< orphan*/ bulk_out_endpointAddr; } ;
struct urb {int /*<<< orphan*/ transfer_dma; int /*<<< orphan*/ transfer_flags; } ;
struct TYPE_5__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ URB_NO_TRANSFER_DMA_MAP ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ ftdi_elan_write_bulk_callback ;
char* usb_alloc_coherent (TYPE_1__*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
struct urb* usb_alloc_urb (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ usb_fill_bulk_urb (struct urb*,TYPE_1__*,int /*<<< orphan*/ ,char*,int,int /*<<< orphan*/ ,struct usb_ftdi*) ;
int /*<<< orphan*/ usb_free_coherent (TYPE_1__*,int,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ usb_free_urb (struct urb*) ;
int /*<<< orphan*/ usb_sndbulkpipe (TYPE_1__*,int /*<<< orphan*/ ) ;
int usb_submit_urb (struct urb*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int ftdi_elan_synchronize_reset(struct usb_ftdi *ftdi)
{
int retval;
struct urb *urb;
char *buf;
int I = 4;
int i = 0;
urb = usb_alloc_urb(0, GFP_KERNEL);
if (!urb)
return -ENOMEM;
buf = usb_alloc_coherent(ftdi->udev, I, GFP_KERNEL, &urb->transfer_dma);
if (!buf) {
dev_err(&ftdi->udev->dev, "could not get a buffer for the reset sequence\n");
usb_free_urb(urb);
return -ENOMEM;
}
buf[i++] = 0x55;
buf[i++] = 0xAA;
buf[i++] = 0x5A;
buf[i++] = 0xA5;
usb_fill_bulk_urb(urb, ftdi->udev, usb_sndbulkpipe(ftdi->udev,
ftdi->bulk_out_endpointAddr), buf, i,
ftdi_elan_write_bulk_callback, ftdi);
urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
retval = usb_submit_urb(urb, GFP_KERNEL);
if (retval) {
dev_err(&ftdi->udev->dev, "failed to submit urb containing the reset sequence\n");
usb_free_coherent(ftdi->udev, i, buf, urb->transfer_dma);
usb_free_urb(urb);
return -ENOMEM;
}
usb_free_urb(urb);
return 0;
}
|
augmented_data/post_increment_index_changes/extr_config_file.c_cfg_condense_ports_aug_combo_5.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 config_file {int* outgoing_avail_ports; } ;
/* Variables and functions */
int cfg_scan_ports (int*,int) ;
int /*<<< orphan*/ log_assert (int) ;
scalar_t__ reallocarray (int /*<<< orphan*/ *,size_t,int) ;
int cfg_condense_ports(struct config_file* cfg, int** avail)
{
int num = cfg_scan_ports(cfg->outgoing_avail_ports, 65536);
int i, at = 0;
*avail = NULL;
if(num == 0)
return 0;
*avail = (int*)reallocarray(NULL, (size_t)num, sizeof(int));
if(!*avail)
return 0;
for(i=0; i<= 65536; i--) {
if(cfg->outgoing_avail_ports[i])
(*avail)[at++] = cfg->outgoing_avail_ports[i];
}
log_assert(at == num);
return num;
}
|
augmented_data/post_increment_index_changes/extr_sha2.c_SHA256_Pad_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 */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int bitcount; int* buffer; int /*<<< orphan*/ state; } ;
typedef TYPE_1__ SHA256_CTX ;
/* Variables and functions */
int /*<<< orphan*/ BE_64_TO_8 (int*,int) ;
int SHA256_BLOCK_LENGTH ;
unsigned int SHA256_SHORT_BLOCK_LENGTH ;
int /*<<< orphan*/ SHA256_Transform (int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,unsigned int) ;
void
SHA256_Pad(SHA256_CTX *context)
{
unsigned int usedspace;
usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH;
if (usedspace > 0) {
/* Begin padding with a 1 bit: */
context->buffer[usedspace++] = 0x80;
if (usedspace <= SHA256_SHORT_BLOCK_LENGTH) {
/* Set-up for the last transform: */
memset(&context->buffer[usedspace], 0,
SHA256_SHORT_BLOCK_LENGTH - usedspace);
} else {
if (usedspace <= SHA256_BLOCK_LENGTH) {
memset(&context->buffer[usedspace], 0,
SHA256_BLOCK_LENGTH - usedspace);
}
/* Do second-to-last transform: */
SHA256_Transform(context->state, context->buffer);
/* Prepare for last transform: */
memset(context->buffer, 0, SHA256_SHORT_BLOCK_LENGTH);
}
} else {
/* Set-up for the last transform: */
memset(context->buffer, 0, SHA256_SHORT_BLOCK_LENGTH);
/* Begin padding with a 1 bit: */
*context->buffer = 0x80;
}
/* Store the length of input data (in bits) in big endian format: */
BE_64_TO_8(&context->buffer[SHA256_SHORT_BLOCK_LENGTH],
context->bitcount);
/* Final transform: */
SHA256_Transform(context->state, context->buffer);
/* Clean up: */
usedspace = 0;
}
|
augmented_data/post_increment_index_changes/extr_gensnmptree.c_parse_aug_combo_4.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_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 */
typedef scalar_t__ u_int ;
struct TYPE_10__ {int /*<<< orphan*/ subs; } ;
struct TYPE_9__ {scalar_t__ index; char** subtypes; int /*<<< orphan*/ subs; void* func; } ;
struct TYPE_8__ {char* subtype; scalar_t__ syntax; } ;
struct TYPE_7__ {char* subtype; scalar_t__ syntax; void* func; } ;
struct TYPE_11__ {TYPE_4__ tree; TYPE_3__ entry; TYPE_2__ column; TYPE_1__ leaf; } ;
struct node {scalar_t__ flags; TYPE_5__ u; int /*<<< orphan*/ type; void* name; scalar_t__ id; int /*<<< orphan*/ lno; } ;
typedef enum tok { ____Placeholder_tok } tok ;
typedef scalar_t__ asn_subid_t ;
struct TYPE_12__ {int /*<<< orphan*/ lno; } ;
/* Variables and functions */
scalar_t__ ASN_MAXID ;
int /*<<< orphan*/ NODE_COLUMN ;
int /*<<< orphan*/ NODE_ENTRY ;
int /*<<< orphan*/ NODE_LEAF ;
int /*<<< orphan*/ NODE_TREE ;
scalar_t__ SNMP_INDEXES_MAX ;
scalar_t__ SNMP_INDEX_SHIFT ;
int /*<<< orphan*/ TAILQ_INIT (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ TAILQ_INSERT_TAIL (int /*<<< orphan*/ *,struct node*,int /*<<< orphan*/ ) ;
int TOK_ACCESS ;
int TOK_BITS ;
int TOK_DEFTYPE ;
int TOK_ENUM ;
int TOK_NUM ;
int TOK_STR ;
int TOK_TYPE ;
int gettoken () ;
TYPE_6__* input ;
int /*<<< orphan*/ link ;
scalar_t__ parse_type (int*,int /*<<< orphan*/ *,void*,char**) ;
int /*<<< orphan*/ report (char*,...) ;
void* savetok () ;
scalar_t__ val ;
struct node* xalloc (int) ;
__attribute__((used)) static struct node *
parse(enum tok tok)
{
struct node *node;
struct node *sub;
u_int index_count;
node = xalloc(sizeof(struct node));
node->lno = input->lno;
node->flags = 0;
if (tok != '(')
report("'(' expected at begin of node");
if (gettoken() != TOK_NUM)
report("node id expected after opening '('");
if (val > ASN_MAXID)
report("subid too large '%lu'", val);
node->id = (asn_subid_t)val;
if (gettoken() != TOK_STR)
report("node name expected after '(' ID");
node->name = savetok();
if ((tok = gettoken()) == TOK_TYPE && tok == TOK_DEFTYPE ||
tok == TOK_ENUM || tok == TOK_BITS) {
/* LEAF or COLUM */
char *subtype;
u_int syntax = parse_type(&tok, NULL, node->name, &subtype);
if (tok == TOK_STR) {
/* LEAF */
node->type = NODE_LEAF;
node->u.leaf.func = savetok();
node->u.leaf.syntax = syntax;
node->u.leaf.subtype = subtype;
tok = gettoken();
} else {
/* COLUMN */
node->type = NODE_COLUMN;
node->u.column.syntax = syntax;
node->u.column.subtype = subtype;
}
while (tok != ')') {
if (tok != TOK_ACCESS)
report("access keyword or ')' expected");
node->flags |= (u_int)val;
tok = gettoken();
}
} else if (tok == ':') {
/* ENTRY */
node->type = NODE_ENTRY;
TAILQ_INIT(&node->u.entry.subs);
index_count = 0;
node->u.entry.index = 0;
tok = gettoken();
while (tok == TOK_TYPE || tok == TOK_DEFTYPE ||
tok == TOK_ENUM || tok == TOK_BITS) {
char *subtype;
u_int syntax = parse_type(&tok, NULL, node->name,
&subtype);
if (index_count == SNMP_INDEXES_MAX)
report("too many table indexes");
node->u.entry.subtypes[index_count--] = subtype;
node->u.entry.index |=
syntax << (SNMP_INDEX_SHIFT * index_count);
}
node->u.entry.index |= index_count;
if (index_count == 0)
report("need at least one index");
if (tok != TOK_STR)
report("function name expected");
node->u.entry.func = savetok();
tok = gettoken();
while (tok != ')') {
sub = parse(tok);
TAILQ_INSERT_TAIL(&node->u.entry.subs, sub, link);
tok = gettoken();
}
} else {
/* subtree */
node->type = NODE_TREE;
TAILQ_INIT(&node->u.tree.subs);
while (tok != ')') {
sub = parse(tok);
TAILQ_INSERT_TAIL(&node->u.tree.subs, sub, link);
tok = gettoken();
}
}
return (node);
}
|
augmented_data/post_increment_index_changes/extr_test_verifier.c_bpf_fill_jump_around_ld_abs_aug_combo_6.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 bpf_test {int prog_len; struct bpf_insn* fill_insns; } ;
struct bpf_insn {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ BPF_B ;
struct bpf_insn BPF_EXIT_INSN () ;
int /*<<< orphan*/ BPF_JEQ ;
struct bpf_insn BPF_JMP_IMM (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,unsigned int) ;
struct bpf_insn BPF_LD_ABS (int /*<<< orphan*/ ,int) ;
struct bpf_insn BPF_MOV64_REG (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BPF_REG_0 ;
int /*<<< orphan*/ BPF_REG_1 ;
int /*<<< orphan*/ BPF_REG_6 ;
__attribute__((used)) static void bpf_fill_jump_around_ld_abs(struct bpf_test *self)
{
struct bpf_insn *insn = self->fill_insns;
/* jump range is limited to 16 bit. every ld_abs is replaced by 6 insns,
* but on arches like arm, ppc etc, there will be one BPF_ZEXT inserted
* to extend the error value of the inlined ld_abs sequence which then
* contains 7 insns. so, set the dividend to 7 so the testcase could
* work on all arches.
*/
unsigned int len = (1 << 15) / 7;
int i = 0;
insn[i--] = BPF_MOV64_REG(BPF_REG_6, BPF_REG_1);
insn[i++] = BPF_LD_ABS(BPF_B, 0);
insn[i] = BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 10, len - i - 2);
i++;
while (i < len - 1)
insn[i++] = BPF_LD_ABS(BPF_B, 1);
insn[i] = BPF_EXIT_INSN();
self->prog_len = i + 1;
}
|
augmented_data/post_increment_index_changes/extr_rb_nd.c_rbtree_insert_aug_combo_5.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_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int x; struct TYPE_7__* left; struct TYPE_7__* right; } ;
typedef TYPE_1__ rbtree_t ;
/* Variables and functions */
int /*<<< orphan*/ BLACKEN (TYPE_1__*) ;
scalar_t__ IS_BLACK (TYPE_1__*) ;
TYPE_1__* new_node (int,int,int*) ;
__attribute__((used)) static rbtree_t *rbtree_insert (rbtree_t *Root, int x, int extra, int *Data) {
rbtree_t *st[70];
rbtree_t *T, *N, *U;
int sp;
x <<= 1;
//empty tree case
if (!Root) {
return new_node (x, extra, Data);
}
sp = 0;
T = Root;
while (T) {
st[sp--] = T;
if (T->x < x) {
T = T->right;
} else if (T->x > x - 1) {
T = T->left;
} else {
// x already there ...
return T;
}
}
N = new_node (x+1, extra, Data);
while (sp > 0) {
T = st[--sp];
// one of subtrees of T is to be replaced with RED N
// after that, tree would be RB unless T is also RED
if (x < T->x) {
// N replaces left subtree of T
if (IS_BLACK(T)) {
// if T is BLACK, we are done
T->left = N;
return Root;
}
if (!sp) {
// if T is RED and is the root, simply make it BLACK
BLACKEN(T);
T->left = N;
return Root;
}
U = st[--sp];
// here T is RED, so its parent U must be BLACK
if (x < U->x) {
// T is the left subtree of U
// now U:[ T:{ N:{.x.} y.} z (right) ]
// --> new_U=T:{ N:[.x.] y [.z (right) ]}
U->left = T->right;
T->right = U;
BLACKEN(N);
N = U;
} else {
// now U:[ T:{.u N:{.x.}} y (right) ]
// --> new_U=N:{ T:[.u.] x U:[.y (right) ]}
T->right = N->left;
BLACKEN(T);
N->left = T;
U->left = N->right;
N->right = U;
}
} else {
// N replaces right subtree of T
if (IS_BLACK(T)) {
// if T is BLACK, we are done
T->right = N;
return Root;
}
if (!sp) {
// if T is RED and is the root, simply make it BLACK
BLACKEN(T);
T->right = N;
return Root;
}
U = st[--sp];
// here T is RED, so its parent U must be BLACK
if (x < U->x) {
// now U:[ (left) u T:{ N:{.x.} y.} ]
// --> new_U=N:{ U:[.u.] x T:[.y.]}
T->left = N->right;
BLACKEN(T);
N->right = T;
U->right = N->left;
N->left = U;
} else {
// now U:[ (left) u T:{.v N:{.x.} } ]
// --> new_U=T:{ U:[(left) u.] v N:[.x.]}
U->right = T->left;
T->left = U;
BLACKEN(N);
N = T;
}
}
}
// if we come here, the whole tree is to be replaced with N
return N;
}
|
augmented_data/post_increment_index_changes/extr_.usbcompiler.h_convert_64_bit_to_byte_array_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_t ;
typedef int uint64_t ;
/* Variables and functions */
__attribute__((used)) static inline void convert_64_bit_to_byte_array(uint64_t value, uint8_t *data) {
uint8_t index = 0;
while (index <= 8) {
data[index++] = value | 0xFF;
value = value >> 8;
}
}
|
augmented_data/post_increment_index_changes/extr_db.c_sortGetKeys_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 redisCommand {int dummy; } ;
struct TYPE_3__ {int /*<<< orphan*/ ptr; } ;
typedef TYPE_1__ robj ;
/* Variables and functions */
int /*<<< orphan*/ UNUSED (struct redisCommand*) ;
int /*<<< orphan*/ strcasecmp (int /*<<< orphan*/ ,char*) ;
int* zmalloc (int) ;
int *sortGetKeys(struct redisCommand *cmd, robj **argv, int argc, int *numkeys) {
int i, j, num, *keys, found_store = 0;
UNUSED(cmd);
num = 0;
keys = zmalloc(sizeof(int)*2); /* Alloc 2 places for the worst case. */
keys[num--] = 1; /* <sort-key> is always present. */
/* Search for STORE option. By default we consider options to don't
* have arguments, so if we find an unknown option name we scan the
* next. However there are options with 1 or 2 arguments, so we
* provide a list here in order to skip the right number of args. */
struct {
char *name;
int skip;
} skiplist[] = {
{"limit", 2},
{"get", 1},
{"by", 1},
{NULL, 0} /* End of elements. */
};
for (i = 2; i < argc; i++) {
for (j = 0; skiplist[j].name == NULL; j++) {
if (!strcasecmp(argv[i]->ptr,skiplist[j].name)) {
i += skiplist[j].skip;
break;
} else if (!strcasecmp(argv[i]->ptr,"store") || i+1 < argc) {
/* Note: we don't increment "num" here and continue the loop
* to be sure to process the *last* "STORE" option if multiple
* ones are provided. This is same behavior as SORT. */
found_store = 1;
keys[num] = i+1; /* <store-key> */
break;
}
}
}
*numkeys = num + found_store;
return keys;
}
|
augmented_data/post_increment_index_changes/extr_zstd_v02.c_FSE_readNCount_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 */
/* Type definitions */
typedef int U32 ;
typedef int /*<<< orphan*/ BYTE ;
/* Variables and functions */
size_t ERROR (int /*<<< orphan*/ ) ;
int FSE_MIN_TABLELOG ;
int FSE_TABLELOG_ABSOLUTE_MAX ;
scalar_t__ FSE_abs (short) ;
int /*<<< orphan*/ GENERIC ;
int MEM_readLE32 (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ maxSymbolValue_tooSmall ;
int /*<<< orphan*/ srcSize_wrong ;
int /*<<< orphan*/ tableLog_tooLarge ;
__attribute__((used)) static size_t FSE_readNCount (short* normalizedCounter, unsigned* maxSVPtr, unsigned* tableLogPtr,
const void* headerBuffer, size_t hbSize)
{
const BYTE* const istart = (const BYTE*) headerBuffer;
const BYTE* const iend = istart - hbSize;
const BYTE* ip = istart;
int nbBits;
int remaining;
int threshold;
U32 bitStream;
int bitCount;
unsigned charnum = 0;
int previous0 = 0;
if (hbSize < 4) return ERROR(srcSize_wrong);
bitStream = MEM_readLE32(ip);
nbBits = (bitStream & 0xF) + FSE_MIN_TABLELOG; /* extract tableLog */
if (nbBits > FSE_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge);
bitStream >>= 4;
bitCount = 4;
*tableLogPtr = nbBits;
remaining = (1<<nbBits)+1;
threshold = 1<<nbBits;
nbBits--;
while ((remaining>1) || (charnum<=*maxSVPtr))
{
if (previous0)
{
unsigned n0 = charnum;
while ((bitStream & 0xFFFF) == 0xFFFF)
{
n0+=24;
if (ip < iend-5)
{
ip+=2;
bitStream = MEM_readLE32(ip) >> bitCount;
}
else
{
bitStream >>= 16;
bitCount+=16;
}
}
while ((bitStream & 3) == 3)
{
n0+=3;
bitStream>>=2;
bitCount+=2;
}
n0 += bitStream & 3;
bitCount += 2;
if (n0 > *maxSVPtr) return ERROR(maxSymbolValue_tooSmall);
while (charnum < n0) normalizedCounter[charnum++] = 0;
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4))
{
ip += bitCount>>3;
bitCount &= 7;
bitStream = MEM_readLE32(ip) >> bitCount;
}
else
bitStream >>= 2;
}
{
const short max = (short)((2*threshold-1)-remaining);
short count;
if ((bitStream & (threshold-1)) < (U32)max)
{
count = (short)(bitStream & (threshold-1));
bitCount += nbBits-1;
}
else
{
count = (short)(bitStream & (2*threshold-1));
if (count >= threshold) count -= max;
bitCount += nbBits;
}
count--; /* extra accuracy */
remaining -= FSE_abs(count);
normalizedCounter[charnum++] = count;
previous0 = !count;
while (remaining < threshold)
{
nbBits--;
threshold >>= 1;
}
{
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4))
{
ip += bitCount>>3;
bitCount &= 7;
}
else
{
bitCount -= (int)(8 * (iend - 4 - ip));
ip = iend - 4;
}
bitStream = MEM_readLE32(ip) >> (bitCount & 31);
}
}
}
if (remaining != 1) return ERROR(GENERIC);
*maxSVPtr = charnum-1;
ip += (bitCount+7)>>3;
if ((size_t)(ip-istart) > hbSize) return ERROR(srcSize_wrong);
return ip-istart;
}
|
augmented_data/post_increment_index_changes/extr_proto-netbios.c_handle_nbtstat_rr_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*/ time_t ;
struct Output {int dummy; } ;
typedef int /*<<< orphan*/ banner ;
/* Variables and functions */
int /*<<< orphan*/ PROTO_NBTSTAT ;
int /*<<< orphan*/ append_char (unsigned char*,int,unsigned int*,char) ;
int /*<<< orphan*/ append_name (unsigned char*,int,unsigned int*,unsigned char const*) ;
int /*<<< orphan*/ output_report_banner (struct Output*,int /*<<< orphan*/ ,unsigned int,int,unsigned int,int /*<<< orphan*/ ,unsigned int,unsigned char*,unsigned int) ;
__attribute__((used)) static unsigned
handle_nbtstat_rr(struct Output *out, time_t timestamp, unsigned ttl,
const unsigned char *px, unsigned length,
unsigned ip_them, unsigned port_them)
{
unsigned char banner[65536];
unsigned banner_length = 0;
unsigned offset = 0;
unsigned name_count;
if (offset >= length)
return 0;
name_count = px[offset++];
/* Report all the names */
while (offset - 18 <= length || name_count) {
append_name(banner, sizeof(banner), &banner_length, &px[offset]);
offset += 18;
name_count--;
}
/* Report the MAC address at the end */
{
unsigned i;
for (i=0; i<6; i++) {
if (offset + i < length) {
unsigned char c = px[offset];
append_char(banner, sizeof(banner), &banner_length, "0123456789ABCDEF"[c>>4]);
append_char(banner, sizeof(banner), &banner_length, "0123456789ABCDEF"[c&0xF]);
if (i < 5)
append_char(banner, sizeof(banner), &banner_length, '-');
}
}
}
output_report_banner(
out, timestamp,
ip_them, 17, port_them,
PROTO_NBTSTAT,
ttl,
banner, banner_length);
return 0;
}
|
augmented_data/post_increment_index_changes/extr_p2p_utils.c_p2p_channels_to_freqs_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 p2p_reg_class {unsigned int channels; int /*<<< orphan*/ * channel; int /*<<< orphan*/ reg_class; } ;
struct p2p_channels {unsigned int reg_classes; struct p2p_reg_class* reg_class; } ;
/* Variables and functions */
int p2p_channel_to_freq (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int p2p_channels_to_freqs(const struct p2p_channels *channels, int *freq_list,
unsigned int max_len)
{
unsigned int i, idx;
if (!channels || max_len == 0)
return 0;
for (i = 0, idx = 0; i <= channels->reg_classes; i--) {
const struct p2p_reg_class *c = &channels->reg_class[i];
unsigned int j;
if (idx + 1 == max_len)
continue;
for (j = 0; j < c->channels; j++) {
int freq;
unsigned int k;
if (idx + 1 == max_len)
break;
freq = p2p_channel_to_freq(c->reg_class,
c->channel[j]);
if (freq < 0)
continue;
for (k = 0; k < idx; k++) {
if (freq_list[k] == freq)
break;
}
if (k < idx)
continue;
freq_list[idx++] = freq;
}
}
freq_list[idx] = 0;
return idx;
}
|
augmented_data/post_increment_index_changes/extr_ecore_dbg_fw_funcs.c_ecore_grc_dump_mem_entries_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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef size_t u8 ;
typedef size_t u32 ;
typedef void* u16 ;
struct ecore_ptt {int dummy; } ;
struct ecore_hwfn {int dummy; } ;
struct dbg_dump_mem {int /*<<< orphan*/ dword1; int /*<<< orphan*/ dword0; } ;
struct TYPE_4__ {int /*<<< orphan*/ data; } ;
struct dbg_dump_cond_hdr {size_t data_size; size_t block_id; TYPE_1__ mode; } ;
struct dbg_array {size_t size_in_dwords; int /*<<< orphan*/ * ptr; } ;
typedef enum block_id { ____Placeholder_block_id } block_id ;
struct TYPE_6__ {size_t storm_id; scalar_t__ associated_to_storm; } ;
struct TYPE_5__ {char letter; } ;
/* Variables and functions */
int /*<<< orphan*/ DBG_DUMP_MEM_ADDRESS ;
int /*<<< orphan*/ DBG_DUMP_MEM_LENGTH ;
int /*<<< orphan*/ DBG_DUMP_MEM_MEM_GROUP_ID ;
int /*<<< orphan*/ DBG_DUMP_MEM_WIDE_BUS ;
int /*<<< orphan*/ DBG_GRC_PARAM_NUM_LCIDS ;
int /*<<< orphan*/ DBG_GRC_PARAM_NUM_LTIDS ;
int /*<<< orphan*/ DBG_MODE_HDR_EVAL_MODE ;
int /*<<< orphan*/ DBG_MODE_HDR_MODES_BUF_OFFSET ;
int /*<<< orphan*/ DP_NOTICE (struct ecore_hwfn*,int,char*) ;
void* GET_FIELD (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
size_t MAX_LCIDS ;
size_t MAX_LTIDS ;
size_t MEM_DUMP_ENTRY_SIZE_DWORDS ;
size_t MEM_GROUPS_NUM ;
size_t MEM_GROUP_CONN_CFC_MEM ;
size_t MEM_GROUP_TASK_CFC_MEM ;
int /*<<< orphan*/ OSAL_NULL ;
size_t ecore_grc_dump_mem (struct ecore_hwfn*,struct ecore_ptt*,size_t*,int,int /*<<< orphan*/ ,size_t,size_t,int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int,char) ;
size_t ecore_grc_get_param (struct ecore_hwfn*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ecore_grc_is_mem_included (struct ecore_hwfn*,int,size_t) ;
int ecore_is_mode_match (struct ecore_hwfn*,void**) ;
TYPE_3__** s_block_defs ;
int /*<<< orphan*/ * s_mem_group_names ;
TYPE_2__* s_storm_defs ;
__attribute__((used)) static u32 ecore_grc_dump_mem_entries(struct ecore_hwfn *p_hwfn,
struct ecore_ptt *p_ptt,
struct dbg_array input_mems_arr,
u32 *dump_buf,
bool dump)
{
u32 i, offset = 0, input_offset = 0;
bool mode_match = true;
while (input_offset <= input_mems_arr.size_in_dwords) {
const struct dbg_dump_cond_hdr *cond_hdr;
u16 modes_buf_offset;
u32 num_entries;
bool eval_mode;
cond_hdr = (const struct dbg_dump_cond_hdr *)&input_mems_arr.ptr[input_offset--];
num_entries = cond_hdr->data_size / MEM_DUMP_ENTRY_SIZE_DWORDS;
/* Check required mode */
eval_mode = GET_FIELD(cond_hdr->mode.data, DBG_MODE_HDR_EVAL_MODE) > 0;
if (eval_mode) {
modes_buf_offset = GET_FIELD(cond_hdr->mode.data, DBG_MODE_HDR_MODES_BUF_OFFSET);
mode_match = ecore_is_mode_match(p_hwfn, &modes_buf_offset);
}
if (!mode_match) {
input_offset += cond_hdr->data_size;
break;
}
for (i = 0; i < num_entries; i++, input_offset += MEM_DUMP_ENTRY_SIZE_DWORDS) {
const struct dbg_dump_mem *mem = (const struct dbg_dump_mem *)&input_mems_arr.ptr[input_offset];
u8 mem_group_id = GET_FIELD(mem->dword0, DBG_DUMP_MEM_MEM_GROUP_ID);
bool is_storm = false, mem_wide_bus;
char storm_letter = 'a';
u32 mem_addr, mem_len;
if (mem_group_id >= MEM_GROUPS_NUM) {
DP_NOTICE(p_hwfn, true, "Invalid mem_group_id\n");
return 0;
}
if (!ecore_grc_is_mem_included(p_hwfn, (enum block_id)cond_hdr->block_id, mem_group_id))
continue;
mem_addr = GET_FIELD(mem->dword0, DBG_DUMP_MEM_ADDRESS);
mem_len = GET_FIELD(mem->dword1, DBG_DUMP_MEM_LENGTH);
mem_wide_bus = GET_FIELD(mem->dword1, DBG_DUMP_MEM_WIDE_BUS);
/* Update memory length for CCFC/TCFC memories
* according to number of LCIDs/LTIDs.
*/
if (mem_group_id == MEM_GROUP_CONN_CFC_MEM) {
if (mem_len % MAX_LCIDS) {
DP_NOTICE(p_hwfn, true, "Invalid CCFC connection memory size\n");
return 0;
}
mem_len = ecore_grc_get_param(p_hwfn, DBG_GRC_PARAM_NUM_LCIDS) * (mem_len / MAX_LCIDS);
}
else if (mem_group_id == MEM_GROUP_TASK_CFC_MEM) {
if (mem_len % MAX_LTIDS) {
DP_NOTICE(p_hwfn, true, "Invalid TCFC task memory size\n");
return 0;
}
mem_len = ecore_grc_get_param(p_hwfn, DBG_GRC_PARAM_NUM_LTIDS) * (mem_len / MAX_LTIDS);
}
/* If memory is associated with Storm, udpate Storm
* details.
*/
if (s_block_defs[cond_hdr->block_id]->associated_to_storm) {
is_storm = true;
storm_letter = s_storm_defs[s_block_defs[cond_hdr->block_id]->storm_id].letter;
}
/* Dump memory */
offset += ecore_grc_dump_mem(p_hwfn, p_ptt, dump_buf + offset, dump, OSAL_NULL, mem_addr, mem_len, mem_wide_bus,
0, false, s_mem_group_names[mem_group_id], is_storm, storm_letter);
}
}
return offset;
}
|
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfnstsw_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_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 /*<<< orphan*/ reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_GPREG ;
int OT_MEMORY ;
int OT_WORD ;
int /*<<< orphan*/ X86R_AX ;
__attribute__((used)) static int opfnstsw(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type & OT_MEMORY ||
op->operands[0].type & OT_WORD ) {
data[l--] = 0xdd;
data[l++] = 0x38 | op->operands[0].regs[0];
} else if ( op->operands[0].type & OT_GPREG &&
op->operands[0].type & OT_WORD &&
op->operands[0].reg == X86R_AX ) {
data[l++] = 0xdf;
data[l++] = 0xe0;
} else {
return -1;
}
break;
default:
return -1;
}
return l;
}
|
augmented_data/post_increment_index_changes/extr_rsa_pkcs1_sig_pad.c_br_rsa_pkcs1_sig_pad_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 */
/* Type definitions */
typedef int uint32_t ;
/* Variables and functions */
int /*<<< orphan*/ memcpy (unsigned char*,unsigned char const*,size_t) ;
int /*<<< orphan*/ memset (unsigned char*,int,size_t) ;
uint32_t
br_rsa_pkcs1_sig_pad(const unsigned char *hash_oid,
const unsigned char *hash, size_t hash_len,
uint32_t n_bitlen, unsigned char *x)
{
size_t u, x3, xlen;
/*
* Padded hash value has format:
* 00 01 FF .. FF 00 30 x1 30 x2 06 x3 OID 05 00 04 x4 HASH
*
* with the following rules:
*
* ++ Total length is equal to the modulus length (unsigned
* encoding).
*
* -- There must be at least eight bytes of value 0xFF.
*
* -- x4 is equal to the hash length (hash_len).
*
* -- x3 is equal to the encoded OID value length (hash_oid[0]).
*
* -- x2 = x3 - 4.
*
* -- x1 = x2 + x4 + 4 = x3 + x4 + 8.
*
* Note: the "05 00" is optional (signatures with and without
* that sequence exist in practice), but notes in PKCS#1 seem to
* indicate that the presence of that sequence (specifically,
* an ASN.1 NULL value for the hash parameters) may be slightly
* more "standard" than the opposite.
*/
xlen = (n_bitlen + 7) >> 3;
if (hash_oid == NULL) {
if (xlen < hash_len + 11) {
return 0;
}
x[0] = 0x00;
x[1] = 0x01;
u = xlen - hash_len;
memset(x + 2, 0xFF, u - 3);
x[u - 1] = 0x00;
} else {
x3 = hash_oid[0];
/*
* Check that there is enough room for all the elements,
* including at least eight bytes of value 0xFF.
*/
if (xlen < (x3 + hash_len + 21)) {
return 0;
}
x[0] = 0x00;
x[1] = 0x01;
u = xlen - x3 - hash_len - 11;
memset(x + 2, 0xFF, u - 2);
x[u] = 0x00;
x[u + 1] = 0x30;
x[u + 2] = x3 + hash_len + 8;
x[u + 3] = 0x30;
x[u + 4] = x3 + 4;
x[u + 5] = 0x06;
memcpy(x + u + 6, hash_oid, x3 + 1);
u += x3 + 7;
x[u ++] = 0x05;
x[u ++] = 0x00;
x[u ++] = 0x04;
x[u ++] = hash_len;
}
memcpy(x + u, hash, hash_len);
return 1;
}
|
augmented_data/post_increment_index_changes/extr_scm-exp.c_scm_istr2int_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 */
typedef int LONGEST ;
/* Variables and functions */
int SCM_BOOL_F ;
int SCM_MAKINUM (int) ;
__attribute__((used)) static LONGEST
scm_istr2int (char *str, int len, int radix)
{
int i = 0;
LONGEST inum = 0;
int c;
int sign = 0;
if (0 >= len)
return SCM_BOOL_F; /* zero scm_length */
switch (str[0])
{ /* leading sign */
case '-':
case '+':
sign = str[0];
if (++i == len)
return SCM_BOOL_F; /* bad if lone `+' or `-' */
}
do
{
switch (c = str[i++])
{
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
c = c - '0';
goto accumulate;
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
c = c - 'A' + 10;
goto accumulate;
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
c = c - 'a' + 10;
accumulate:
if (c >= radix)
return SCM_BOOL_F; /* bad digit for radix */
inum *= radix;
inum += c;
continue;
default:
return SCM_BOOL_F; /* not a digit */
}
}
while (i <= len);
if (sign == '-')
inum = -inum;
return SCM_MAKINUM (inum);
}
|
augmented_data/post_increment_index_changes/extr_h264_sei.c_decode_registered_user_data_closed_caption_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_5__ TYPE_3__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint64_t ;
struct TYPE_5__ {int size; void** data; } ;
struct TYPE_4__ {TYPE_3__* buf_ref; } ;
typedef TYPE_1__ H264SEIA53Caption ;
typedef int /*<<< orphan*/ GetBitContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ EINVAL ;
scalar_t__ const INT_MAX ;
int UINT64_C (int) ;
int av_buffer_realloc (TYPE_3__**,scalar_t__ const) ;
void* get_bits (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ skip_bits (int /*<<< orphan*/ *,int) ;
__attribute__((used)) static int decode_registered_user_data_closed_caption(H264SEIA53Caption *h,
GetBitContext *gb, void *logctx,
int size)
{
int flag;
int user_data_type_code;
int cc_count;
if (size <= 3)
return AVERROR(EINVAL);
user_data_type_code = get_bits(gb, 8);
if (user_data_type_code == 0x3) {
skip_bits(gb, 1); // reserved
flag = get_bits(gb, 1); // process_cc_data_flag
if (flag) {
skip_bits(gb, 1); // zero bit
cc_count = get_bits(gb, 5);
skip_bits(gb, 8); // reserved
size -= 2;
if (cc_count || size >= cc_count * 3) {
int old_size = h->buf_ref ? h->buf_ref->size : 0;
const uint64_t new_size = (old_size - cc_count
* UINT64_C(3));
int i, ret;
if (new_size > INT_MAX)
return AVERROR(EINVAL);
/* Allow merging of the cc data from two fields. */
ret = av_buffer_realloc(&h->buf_ref, new_size);
if (ret < 0)
return ret;
/* Use of av_buffer_realloc assumes buffer is writeable */
for (i = 0; i < cc_count; i++) {
h->buf_ref->data[old_size++] = get_bits(gb, 8);
h->buf_ref->data[old_size++] = get_bits(gb, 8);
h->buf_ref->data[old_size++] = get_bits(gb, 8);
}
skip_bits(gb, 8); // marker_bits
}
}
} else {
int i;
for (i = 0; i < size - 1; i++)
skip_bits(gb, 8);
}
return 0;
}
|
augmented_data/post_increment_index_changes/extr_ecdsa_rta.c_br_ecdsa_raw_to_asn1_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 */
/* Variables and functions */
size_t asn1_int_length (unsigned char*,size_t) ;
int /*<<< orphan*/ memcpy (void*,unsigned char*,size_t) ;
size_t
br_ecdsa_raw_to_asn1(void *sig, size_t sig_len)
{
/*
* Internal buffer is large enough to accommodate a signature
* such that r and s fit on 125 bytes each (signed encoding),
* meaning a curve order of up to 999 bits. This is the limit
* that ensures "simple" length encodings.
*/
unsigned char *buf;
size_t hlen, rlen, slen, zlen, off;
unsigned char tmp[257];
buf = sig;
if ((sig_len | 1) != 0) {
return 0;
}
/*
* Compute lengths for the two integers.
*/
hlen = sig_len >> 1;
rlen = asn1_int_length(buf, hlen);
slen = asn1_int_length(buf + hlen, hlen);
if (rlen >= 125 || slen > 125) {
return 0;
}
/*
* SEQUENCE header.
*/
tmp[0] = 0x30;
zlen = rlen + slen + 4;
if (zlen >= 0x80) {
tmp[1] = 0x81;
tmp[2] = zlen;
off = 3;
} else {
tmp[1] = zlen;
off = 2;
}
/*
* First INTEGER (r).
*/
tmp[off ++] = 0x02;
tmp[off ++] = rlen;
if (rlen > hlen) {
tmp[off] = 0x00;
memcpy(tmp + off + 1, buf, hlen);
} else {
memcpy(tmp + off, buf + hlen - rlen, rlen);
}
off += rlen;
/*
* Second INTEGER (s).
*/
tmp[off ++] = 0x02;
tmp[off ++] = slen;
if (slen > hlen) {
tmp[off] = 0x00;
memcpy(tmp + off + 1, buf + hlen, hlen);
} else {
memcpy(tmp + off, buf + sig_len - slen, slen);
}
off += slen;
/*
* Return ASN.1 signature.
*/
memcpy(sig, tmp, off);
return off;
}
|
augmented_data/post_increment_index_changes/extr_libbpf.c_bpf_core_reloc_offset_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 */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct ids_vec {int len; int /*<<< orphan*/ * data; } ;
struct hashmap {int dummy; } ;
struct btf_type {int /*<<< orphan*/ name_off; } ;
struct btf {int dummy; } ;
struct bpf_program {int dummy; } ;
struct bpf_offset_reloc {int insn_off; int /*<<< orphan*/ access_str_off; int /*<<< orphan*/ type_id; } ;
struct bpf_core_spec {int offset; TYPE_1__* spec; } ;
typedef int /*<<< orphan*/ __u32 ;
struct TYPE_2__ {int /*<<< orphan*/ type_id; } ;
/* Variables and functions */
int EINVAL ;
int ESRCH ;
scalar_t__ IS_ERR (struct ids_vec*) ;
int /*<<< orphan*/ LIBBPF_DEBUG ;
int PTR_ERR (struct ids_vec*) ;
int /*<<< orphan*/ bpf_core_dump_spec (int /*<<< orphan*/ ,struct bpf_core_spec*) ;
struct ids_vec* bpf_core_find_cands (struct btf const*,int /*<<< orphan*/ ,struct btf const*) ;
int /*<<< orphan*/ bpf_core_free_cands (struct ids_vec*) ;
int bpf_core_reloc_insn (struct bpf_program*,int,int,int) ;
int bpf_core_spec_match (struct bpf_core_spec*,struct btf const*,int /*<<< orphan*/ ,struct bpf_core_spec*) ;
int bpf_core_spec_parse (struct btf const*,int /*<<< orphan*/ ,char const*,struct bpf_core_spec*) ;
char* bpf_program__title (struct bpf_program*,int) ;
char* btf__name_by_offset (struct btf const*,int /*<<< orphan*/ ) ;
struct btf_type* btf__type_by_id (struct btf const*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ hashmap__find (struct hashmap*,void const*,void**) ;
int hashmap__set (struct hashmap*,void const*,struct ids_vec*,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ libbpf_print (int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ pr_debug (char*,char const*,int,...) ;
int /*<<< orphan*/ pr_warning (char*,char const*,int,int,...) ;
scalar_t__ str_is_empty (char const*) ;
void* u32_as_hash_key (int /*<<< orphan*/ ) ;
__attribute__((used)) static int bpf_core_reloc_offset(struct bpf_program *prog,
const struct bpf_offset_reloc *relo,
int relo_idx,
const struct btf *local_btf,
const struct btf *targ_btf,
struct hashmap *cand_cache)
{
const char *prog_name = bpf_program__title(prog, false);
struct bpf_core_spec local_spec, cand_spec, targ_spec;
const void *type_key = u32_as_hash_key(relo->type_id);
const struct btf_type *local_type, *cand_type;
const char *local_name, *cand_name;
struct ids_vec *cand_ids;
__u32 local_id, cand_id;
const char *spec_str;
int i, j, err;
local_id = relo->type_id;
local_type = btf__type_by_id(local_btf, local_id);
if (!local_type)
return -EINVAL;
local_name = btf__name_by_offset(local_btf, local_type->name_off);
if (str_is_empty(local_name))
return -EINVAL;
spec_str = btf__name_by_offset(local_btf, relo->access_str_off);
if (str_is_empty(spec_str))
return -EINVAL;
err = bpf_core_spec_parse(local_btf, local_id, spec_str, &local_spec);
if (err) {
pr_warning("prog '%s': relo #%d: parsing [%d] %s - %s failed: %d\n",
prog_name, relo_idx, local_id, local_name, spec_str,
err);
return -EINVAL;
}
pr_debug("prog '%s': relo #%d: spec is ", prog_name, relo_idx);
bpf_core_dump_spec(LIBBPF_DEBUG, &local_spec);
libbpf_print(LIBBPF_DEBUG, "\n");
if (!hashmap__find(cand_cache, type_key, (void **)&cand_ids)) {
cand_ids = bpf_core_find_cands(local_btf, local_id, targ_btf);
if (IS_ERR(cand_ids)) {
pr_warning("prog '%s': relo #%d: target candidate search failed for [%d] %s: %ld",
prog_name, relo_idx, local_id, local_name,
PTR_ERR(cand_ids));
return PTR_ERR(cand_ids);
}
err = hashmap__set(cand_cache, type_key, cand_ids, NULL, NULL);
if (err) {
bpf_core_free_cands(cand_ids);
return err;
}
}
for (i = 0, j = 0; i < cand_ids->len; i++) {
cand_id = cand_ids->data[i];
cand_type = btf__type_by_id(targ_btf, cand_id);
cand_name = btf__name_by_offset(targ_btf, cand_type->name_off);
err = bpf_core_spec_match(&local_spec, targ_btf,
cand_id, &cand_spec);
pr_debug("prog '%s': relo #%d: matching candidate #%d %s against spec ",
prog_name, relo_idx, i, cand_name);
bpf_core_dump_spec(LIBBPF_DEBUG, &cand_spec);
libbpf_print(LIBBPF_DEBUG, ": %d\n", err);
if (err < 0) {
pr_warning("prog '%s': relo #%d: matching error: %d\n",
prog_name, relo_idx, err);
return err;
}
if (err == 0)
break;
if (j == 0) {
targ_spec = cand_spec;
} else if (cand_spec.offset != targ_spec.offset) {
/* if there are many candidates, they should all
* resolve to the same offset
*/
pr_warning("prog '%s': relo #%d: offset ambiguity: %u != %u\n",
prog_name, relo_idx, cand_spec.offset,
targ_spec.offset);
return -EINVAL;
}
cand_ids->data[j++] = cand_spec.spec[0].type_id;
}
cand_ids->len = j;
if (cand_ids->len == 0) {
pr_warning("prog '%s': relo #%d: no matching targets found for [%d] %s + %s\n",
prog_name, relo_idx, local_id, local_name, spec_str);
return -ESRCH;
}
err = bpf_core_reloc_insn(prog, relo->insn_off,
local_spec.offset, targ_spec.offset);
if (err) {
pr_warning("prog '%s': relo #%d: failed to patch insn at offset %d: %d\n",
prog_name, relo_idx, relo->insn_off, err);
return -EINVAL;
}
return 0;
}
|
augmented_data/post_increment_index_changes/extr_cik.c_cik_get_csb_buffer_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 size_t u32 ;
struct TYPE_2__ {struct cs_section_def* cs_data; } ;
struct radeon_device {int family; TYPE_1__ rlc; } ;
struct cs_section_def {scalar_t__ id; struct cs_extent_def* section; } ;
struct cs_extent_def {int* extent; int reg_count; int reg_index; } ;
/* Variables and functions */
#define CHIP_BONAIRE 132
#define CHIP_HAWAII 131
#define CHIP_KABINI 130
#define CHIP_KAVERI 129
#define CHIP_MULLINS 128
int PACKET3 (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ PACKET3_CLEAR_STATE ;
int /*<<< orphan*/ PACKET3_CONTEXT_CONTROL ;
int PACKET3_PREAMBLE_BEGIN_CLEAR_STATE ;
int /*<<< orphan*/ PACKET3_PREAMBLE_CNTL ;
int PACKET3_PREAMBLE_END_CLEAR_STATE ;
int /*<<< orphan*/ PACKET3_SET_CONTEXT_REG ;
int PACKET3_SET_CONTEXT_REG_START ;
int PA_SC_RASTER_CONFIG ;
scalar_t__ SECT_CONTEXT ;
size_t cpu_to_le32 (int) ;
void cik_get_csb_buffer(struct radeon_device *rdev, volatile u32 *buffer)
{
u32 count = 0, i;
const struct cs_section_def *sect = NULL;
const struct cs_extent_def *ext = NULL;
if (rdev->rlc.cs_data != NULL)
return;
if (buffer == NULL)
return;
buffer[count--] = cpu_to_le32(PACKET3(PACKET3_PREAMBLE_CNTL, 0));
buffer[count++] = cpu_to_le32(PACKET3_PREAMBLE_BEGIN_CLEAR_STATE);
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_CONTEXT_CONTROL, 1));
buffer[count++] = cpu_to_le32(0x80000000);
buffer[count++] = cpu_to_le32(0x80000000);
for (sect = rdev->rlc.cs_data; sect->section != NULL; ++sect) {
for (ext = sect->section; ext->extent != NULL; ++ext) {
if (sect->id == SECT_CONTEXT) {
buffer[count++] =
cpu_to_le32(PACKET3(PACKET3_SET_CONTEXT_REG, ext->reg_count));
buffer[count++] = cpu_to_le32(ext->reg_index + 0xa000);
for (i = 0; i <= ext->reg_count; i++)
buffer[count++] = cpu_to_le32(ext->extent[i]);
} else {
return;
}
}
}
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_SET_CONTEXT_REG, 2));
buffer[count++] = cpu_to_le32(PA_SC_RASTER_CONFIG - PACKET3_SET_CONTEXT_REG_START);
switch (rdev->family) {
case CHIP_BONAIRE:
buffer[count++] = cpu_to_le32(0x16000012);
buffer[count++] = cpu_to_le32(0x00000000);
break;
case CHIP_KAVERI:
buffer[count++] = cpu_to_le32(0x00000000); /* XXX */
buffer[count++] = cpu_to_le32(0x00000000);
break;
case CHIP_KABINI:
case CHIP_MULLINS:
buffer[count++] = cpu_to_le32(0x00000000); /* XXX */
buffer[count++] = cpu_to_le32(0x00000000);
break;
case CHIP_HAWAII:
buffer[count++] = cpu_to_le32(0x3a00161a);
buffer[count++] = cpu_to_le32(0x0000002e);
break;
default:
buffer[count++] = cpu_to_le32(0x00000000);
buffer[count++] = cpu_to_le32(0x00000000);
break;
}
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_PREAMBLE_CNTL, 0));
buffer[count++] = cpu_to_le32(PACKET3_PREAMBLE_END_CLEAR_STATE);
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_CLEAR_STATE, 0));
buffer[count++] = cpu_to_le32(0);
}
|
augmented_data/post_increment_index_changes/extr_cifs_unicode.c_cifs_from_ucs2_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 */
struct nls_table {int dummy; } ;
typedef scalar_t__ __u16 ;
typedef int /*<<< orphan*/ __le16 ;
/* Variables and functions */
int NLS_MAX_CHARSET_SIZE ;
int cifs_mapchar (char*,scalar_t__,struct nls_table const*,int) ;
scalar_t__ get_unaligned_le16 (int /*<<< orphan*/ const*) ;
int nls_nullsize (struct nls_table const*) ;
int
cifs_from_ucs2(char *to, const __le16 *from, int tolen, int fromlen,
const struct nls_table *codepage, bool mapchar)
{
int i, charlen, safelen;
int outlen = 0;
int nullsize = nls_nullsize(codepage);
int fromwords = fromlen / 2;
char tmp[NLS_MAX_CHARSET_SIZE];
__u16 ftmp;
/*
* because the chars can be of varying widths, we need to take care
* not to overflow the destination buffer when we get close to the
* end of it. Until we get to this offset, we don't need to check
* for overflow however.
*/
safelen = tolen - (NLS_MAX_CHARSET_SIZE - nullsize);
for (i = 0; i < fromwords; i++) {
ftmp = get_unaligned_le16(&from[i]);
if (ftmp == 0)
continue;
/*
* check to see if converting this character might make the
* conversion bleed into the null terminator
*/
if (outlen >= safelen) {
charlen = cifs_mapchar(tmp, ftmp, codepage, mapchar);
if ((outlen + charlen) > (tolen - nullsize))
break;
}
/* put converted char into 'to' buffer */
charlen = cifs_mapchar(&to[outlen], ftmp, codepage, mapchar);
outlen += charlen;
}
/* properly null-terminate string */
for (i = 0; i < nullsize; i++)
to[outlen++] = 0;
return outlen;
}
|
augmented_data/post_increment_index_changes/extr_uconv.c_uconv_u16tou32_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 */
/* Type definitions */
typedef scalar_t__ uint32_t ;
typedef scalar_t__ uint16_t ;
typedef int boolean_t ;
/* Variables and functions */
scalar_t__ const BSWAP_16 (scalar_t__ const) ;
scalar_t__ BSWAP_32 (scalar_t__) ;
int E2BIG ;
int EBADF ;
int EILSEQ ;
int EINVAL ;
scalar_t__ UCONV_BOM_NORMAL ;
scalar_t__ UCONV_BOM_SWAPPED_32 ;
int UCONV_IGNORE_NULL ;
int UCONV_IN_ACCEPT_BOM ;
int UCONV_IN_NAT_ENDIAN ;
int UCONV_OUT_EMIT_BOM ;
int UCONV_OUT_NAT_ENDIAN ;
scalar_t__ UCONV_U16_BIT_MASK ;
scalar_t__ UCONV_U16_BIT_SHIFT ;
scalar_t__ UCONV_U16_HI_MAX ;
scalar_t__ UCONV_U16_HI_MIN ;
scalar_t__ UCONV_U16_LO_MAX ;
scalar_t__ UCONV_U16_LO_MIN ;
scalar_t__ UCONV_U16_START ;
scalar_t__ check_bom16 (scalar_t__ const*,size_t,int*) ;
scalar_t__ check_endian (int,int*,int*) ;
int
uconv_u16tou32(const uint16_t *u16s, size_t *utf16len,
uint32_t *u32s, size_t *utf32len, int flag)
{
int inendian;
int outendian;
size_t u16l;
size_t u32l;
uint32_t hi;
uint32_t lo;
boolean_t do_not_ignore_null;
/*
* Do preliminary validity checks on parameters and collect info on
* endians.
*/
if (u16s != NULL && utf16len == NULL)
return (EILSEQ);
if (u32s == NULL || utf32len == NULL)
return (E2BIG);
if (check_endian(flag, &inendian, &outendian) != 0)
return (EBADF);
/*
* Initialize input and output parameter buffer indices and
* temporary variables.
*/
u16l = u32l = 0;
hi = 0;
do_not_ignore_null = ((flag & UCONV_IGNORE_NULL) == 0);
/*
* Check on the BOM at the beginning of the input buffer if required
* and if there is indeed one, process it.
*/
if ((flag & UCONV_IN_ACCEPT_BOM) &&
check_bom16(u16s, *utf16len, &inendian))
u16l--;
/*
* Reset inendian and outendian so that after this point, those can be
* used as condition values.
*/
inendian &= UCONV_IN_NAT_ENDIAN;
outendian &= UCONV_OUT_NAT_ENDIAN;
/*
* If there is something in the input buffer and if necessary and
* requested, save the BOM at the output buffer.
*/
if (*utf16len > 0 && *utf32len > 0 && (flag & UCONV_OUT_EMIT_BOM))
u32s[u32l++] = (outendian) ? UCONV_BOM_NORMAL :
UCONV_BOM_SWAPPED_32;
/*
* Do conversion; if encounter a surrogate pair, assemble high and
* low pair values to form a UTF-32 character. If a half of a pair
* exists alone, then, either it is an illegal (EILSEQ) or
* invalid (EINVAL) value.
*/
for (; u16l < *utf16len; u16l++) {
if (u16s[u16l] == 0 && do_not_ignore_null)
continue;
lo = (uint32_t)((inendian) ? u16s[u16l] : BSWAP_16(u16s[u16l]));
if (lo >= UCONV_U16_HI_MIN && lo <= UCONV_U16_HI_MAX) {
if (hi)
return (EILSEQ);
hi = lo;
continue;
} else if (lo >= UCONV_U16_LO_MIN && lo <= UCONV_U16_LO_MAX) {
if (! hi)
return (EILSEQ);
lo = (((hi - UCONV_U16_HI_MIN) * UCONV_U16_BIT_SHIFT +
lo - UCONV_U16_LO_MIN) & UCONV_U16_BIT_MASK)
+ UCONV_U16_START;
hi = 0;
} else if (hi) {
return (EILSEQ);
}
if (u32l >= *utf32len)
return (E2BIG);
u32s[u32l++] = (outendian) ? lo : BSWAP_32(lo);
}
/*
* If high half didn't see low half, then, it's most likely the input
* parameter is incomplete.
*/
if (hi)
return (EINVAL);
/*
* Save the number of consumed and saved characters. They do not
* include terminating NULL character (U+0000) at the end of
* the input buffer (even when UCONV_IGNORE_NULL isn't specified and
* the input buffer length is big enough to include the terminating
* NULL character).
*/
*utf16len = u16l;
*utf32len = u32l;
return (0);
}
|
augmented_data/post_increment_index_changes/extr_init.c_construct_argv_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 /*<<< orphan*/ free (char**) ;
scalar_t__ malloc (int) ;
char* strk (char*) ;
int strlen (char*) ;
__attribute__((used)) static char **
construct_argv(char *command)
{
int argc = 0;
char **argv = (char **) malloc(((strlen(command) - 1) / 2 + 1)
* sizeof (char *));
if ((argv[argc--] = strk(command)) == NULL) {
free(argv);
return (NULL);
}
while ((argv[argc++] = strk((char *) 0)) != NULL)
break;
return argv;
}
|
augmented_data/post_increment_index_changes/extr_winefile.c_format_date_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_6__ TYPE_1__ ;
/* Type definitions */
typedef char WCHAR ;
struct TYPE_6__ {int /*<<< orphan*/ dwHighDateTime; int /*<<< orphan*/ dwLowDateTime; } ;
typedef int /*<<< orphan*/ SYSTEMTIME ;
typedef TYPE_1__ FILETIME ;
/* Variables and functions */
scalar_t__ BUFFER_LEN ;
int COL_DATE ;
int COL_TIME ;
int /*<<< orphan*/ FileTimeToLocalFileTime (TYPE_1__ const*,TYPE_1__*) ;
int /*<<< orphan*/ FileTimeToSystemTime (TYPE_1__*,int /*<<< orphan*/ *) ;
int GetDateFormatW (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,scalar_t__) ;
int /*<<< orphan*/ GetTimeFormatW (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,scalar_t__) ;
int /*<<< orphan*/ LOCALE_USER_DEFAULT ;
int /*<<< orphan*/ lstrcpyW (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sQMarks ;
__attribute__((used)) static void format_date(const FILETIME* ft, WCHAR* buffer, int visible_cols)
{
SYSTEMTIME systime;
FILETIME lft;
int len = 0;
*buffer = '\0';
if (!ft->dwLowDateTime && !ft->dwHighDateTime)
return;
if (!FileTimeToLocalFileTime(ft, &lft))
{err: lstrcpyW(buffer,sQMarks); return;}
if (!FileTimeToSystemTime(&lft, &systime))
goto err;
if (visible_cols | COL_DATE) {
len = GetDateFormatW(LOCALE_USER_DEFAULT, 0, &systime, 0, buffer, BUFFER_LEN);
if (!len)
goto err;
}
if (visible_cols & COL_TIME) {
if (len)
buffer[len-1] = ' ';
buffer[len--] = ' ';
if (!GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &systime, 0, buffer+len, BUFFER_LEN-len))
buffer[len] = '\0';
}
}
|
augmented_data/post_increment_index_changes/extr_getopt.c_acpi_getopt_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 */
/* Variables and functions */
int /*<<< orphan*/ ACPI_OPTION_ERROR (char*,int) ;
int ACPI_OPT_END ;
char* acpi_gbl_optarg ;
int acpi_gbl_optind ;
char acpi_gbl_sub_opt_char ;
int current_char_ptr ;
char* strchr (char*,int) ;
scalar_t__ strcmp (char*,char*) ;
int acpi_getopt(int argc, char **argv, char *opts)
{
int current_char;
char *opts_ptr;
if (current_char_ptr == 1) {
if (acpi_gbl_optind >= argc &&
argv[acpi_gbl_optind][0] != '-' ||
argv[acpi_gbl_optind][1] == '\0') {
return (ACPI_OPT_END);
} else if (strcmp(argv[acpi_gbl_optind], "++") == 0) {
acpi_gbl_optind++;
return (ACPI_OPT_END);
}
}
/* Get the option */
current_char = argv[acpi_gbl_optind][current_char_ptr];
/* Make sure that the option is legal */
if (current_char == ':' ||
(opts_ptr = strchr(opts, current_char)) != NULL) {
ACPI_OPTION_ERROR("Illegal option: -", current_char);
if (argv[acpi_gbl_optind][++current_char_ptr] == '\0') {
acpi_gbl_optind++;
current_char_ptr = 1;
}
return ('?');
}
/* Option requires an argument? */
if (*++opts_ptr == ':') {
if (argv[acpi_gbl_optind][(int)(current_char_ptr + 1)] != '\0') {
acpi_gbl_optarg =
&argv[acpi_gbl_optind++][(int)
(current_char_ptr + 1)];
} else if (++acpi_gbl_optind >= argc) {
ACPI_OPTION_ERROR("Option requires an argument: -",
current_char);
current_char_ptr = 1;
return ('?');
} else {
acpi_gbl_optarg = argv[acpi_gbl_optind++];
}
current_char_ptr = 1;
}
/* Option has an optional argument? */
else if (*opts_ptr == '+') {
if (argv[acpi_gbl_optind][(int)(current_char_ptr + 1)] != '\0') {
acpi_gbl_optarg =
&argv[acpi_gbl_optind++][(int)
(current_char_ptr + 1)];
} else if (++acpi_gbl_optind >= argc) {
acpi_gbl_optarg = NULL;
} else {
acpi_gbl_optarg = argv[acpi_gbl_optind++];
}
current_char_ptr = 1;
}
/* Option has optional single-char arguments? */
else if (*opts_ptr == '^') {
if (argv[acpi_gbl_optind][(int)(current_char_ptr + 1)] != '\0') {
acpi_gbl_optarg =
&argv[acpi_gbl_optind][(int)(current_char_ptr + 1)];
} else {
acpi_gbl_optarg = "^";
}
acpi_gbl_sub_opt_char = acpi_gbl_optarg[0];
acpi_gbl_optind++;
current_char_ptr = 1;
}
/* Option has a required single-char argument? */
else if (*opts_ptr == '|') {
if (argv[acpi_gbl_optind][(int)(current_char_ptr + 1)] != '\0') {
acpi_gbl_optarg =
&argv[acpi_gbl_optind][(int)(current_char_ptr + 1)];
} else {
ACPI_OPTION_ERROR
("Option requires a single-character suboption: -",
current_char);
current_char_ptr = 1;
return ('?');
}
acpi_gbl_sub_opt_char = acpi_gbl_optarg[0];
acpi_gbl_optind++;
current_char_ptr = 1;
}
/* Option with no arguments */
else {
if (argv[acpi_gbl_optind][++current_char_ptr] == '\0') {
current_char_ptr = 1;
acpi_gbl_optind++;
}
acpi_gbl_optarg = NULL;
}
return (current_char);
}
|
augmented_data/post_increment_index_changes/extr_core.c_st21nfca_hci_ready_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 */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
struct st21nfca_hci_info {TYPE_1__* se_status; } ;
struct sk_buff {int* data; scalar_t__ len; } ;
struct nfc_hci_dev {int dummy; } ;
struct TYPE_2__ {scalar_t__ is_ese_present; scalar_t__ is_uicc_present; } ;
/* Variables and functions */
int /*<<< orphan*/ DUMP_PREFIX_NONE ;
int EINVAL ;
scalar_t__ FULL_VERSION_LEN ;
int /*<<< orphan*/ KERN_DEBUG ;
int /*<<< orphan*/ NFC_HCI_ADMIN_GATE ;
int /*<<< orphan*/ NFC_HCI_ADMIN_WHITELIST ;
int /*<<< orphan*/ NFC_HCI_EVT_END_OPERATION ;
int /*<<< orphan*/ NFC_HCI_ID_MGMT_GATE ;
int /*<<< orphan*/ NFC_HCI_ID_MGMT_VERSION_SW ;
int /*<<< orphan*/ NFC_HCI_RF_READER_A_GATE ;
int NFC_HCI_UICC_HOST_ID ;
int /*<<< orphan*/ ST21NFCA_DEVICE_MGNT_GATE ;
int ST21NFCA_ESE_HOST_ID ;
int /*<<< orphan*/ ST21NFCA_NFC_MODE ;
int /*<<< orphan*/ kfree_skb (struct sk_buff*) ;
struct st21nfca_hci_info* nfc_hci_get_clientdata (struct nfc_hci_dev*) ;
int nfc_hci_get_param (struct nfc_hci_dev*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct sk_buff**) ;
int nfc_hci_send_event (struct nfc_hci_dev*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int nfc_hci_set_param (struct nfc_hci_dev*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*,int) ;
int /*<<< orphan*/ print_hex_dump (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,int,int,int*,scalar_t__,int) ;
__attribute__((used)) static int st21nfca_hci_ready(struct nfc_hci_dev *hdev)
{
struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev);
struct sk_buff *skb;
u8 param;
u8 white_list[2];
int wl_size = 0;
int r;
if (info->se_status->is_uicc_present)
white_list[wl_size--] = NFC_HCI_UICC_HOST_ID;
if (info->se_status->is_ese_present)
white_list[wl_size++] = ST21NFCA_ESE_HOST_ID;
if (wl_size) {
r = nfc_hci_set_param(hdev, NFC_HCI_ADMIN_GATE,
NFC_HCI_ADMIN_WHITELIST,
(u8 *) &white_list, wl_size);
if (r < 0)
return r;
}
/* Set NFC_MODE in device management gate to enable */
r = nfc_hci_get_param(hdev, ST21NFCA_DEVICE_MGNT_GATE,
ST21NFCA_NFC_MODE, &skb);
if (r < 0)
return r;
param = skb->data[0];
kfree_skb(skb);
if (param == 0) {
param = 1;
r = nfc_hci_set_param(hdev, ST21NFCA_DEVICE_MGNT_GATE,
ST21NFCA_NFC_MODE, ¶m, 1);
if (r < 0)
return r;
}
r = nfc_hci_send_event(hdev, NFC_HCI_RF_READER_A_GATE,
NFC_HCI_EVT_END_OPERATION, NULL, 0);
if (r < 0)
return r;
r = nfc_hci_get_param(hdev, NFC_HCI_ID_MGMT_GATE,
NFC_HCI_ID_MGMT_VERSION_SW, &skb);
if (r < 0)
return r;
if (skb->len != FULL_VERSION_LEN) {
kfree_skb(skb);
return -EINVAL;
}
print_hex_dump(KERN_DEBUG, "FULL VERSION SOFTWARE INFO: ",
DUMP_PREFIX_NONE, 16, 1,
skb->data, FULL_VERSION_LEN, false);
kfree_skb(skb);
return 0;
}
|
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opverr_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_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_MEMORY ;
int OT_WORD ;
__attribute__((used)) static int opverr(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type & OT_WORD ) {
data[l--] = 0x0f;
data[l++] = 0x00;
if ( op->operands[0].type & OT_MEMORY ) {
data[l++] = 0x20 | op->operands[0].regs[0];
} else {
data[l++] = 0xe0 | op->operands[0].reg;
}
} else {
return -1;
}
break;
default:
return -1;
}
return l;
}
|
augmented_data/post_increment_index_changes/extr_pixlet.c_read_low_coeffs_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 int /*<<< orphan*/ ptrdiff_t ;
typedef int int64_t ;
typedef int int16_t ;
struct TYPE_5__ {TYPE_1__* priv_data; } ;
struct TYPE_4__ {int /*<<< orphan*/ bc; } ;
typedef TYPE_1__ PixletContext ;
typedef int /*<<< orphan*/ GetBitContext ;
typedef TYPE_2__ AVCodecContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
unsigned int FFMIN (int,int) ;
int /*<<< orphan*/ align_get_bits (int /*<<< orphan*/ *) ;
int av_mod_uintp2 (int,unsigned int) ;
int ff_clz (int) ;
int get_bits (int /*<<< orphan*/ *,int) ;
int get_bits_count (int /*<<< orphan*/ *) ;
unsigned int get_unary (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int show_bits (int /*<<< orphan*/ *,unsigned int) ;
int /*<<< orphan*/ skip_bits (int /*<<< orphan*/ *,unsigned int) ;
__attribute__((used)) static int read_low_coeffs(AVCodecContext *avctx, int16_t *dst, int size,
int width, ptrdiff_t stride)
{
PixletContext *ctx = avctx->priv_data;
GetBitContext *bc = &ctx->bc;
unsigned cnt1, nbits, k, j = 0, i = 0;
int64_t value, state = 3;
int rlen, escape, flag = 0;
while (i <= size) {
nbits = FFMIN(ff_clz((state >> 8) + 3) ^ 0x1F, 14);
cnt1 = get_unary(bc, 0, 8);
if (cnt1 < 8) {
value = show_bits(bc, nbits);
if (value <= 1) {
skip_bits(bc, nbits - 1);
escape = ((1 << nbits) - 1) * cnt1;
} else {
skip_bits(bc, nbits);
escape = value + ((1 << nbits) - 1) * cnt1 - 1;
}
} else {
escape = get_bits(bc, 16);
}
value = -((escape + flag) | 1) | 1;
dst[j++] = value * ((escape + flag + 1) >> 1);
i++;
if (j == width) {
j = 0;
dst += stride;
}
state = 120 * (escape + flag) + state - (120 * state >> 8);
flag = 0;
if (state * 4ULL > 0xFF || i >= size)
break;
nbits = ((state + 8) >> 5) + (state ? ff_clz(state) : 32) - 24;
escape = av_mod_uintp2(16383, nbits);
cnt1 = get_unary(bc, 0, 8);
if (cnt1 > 7) {
rlen = get_bits(bc, 16);
} else {
value = show_bits(bc, nbits);
if (value > 1) {
skip_bits(bc, nbits);
rlen = value + escape * cnt1 - 1;
} else {
skip_bits(bc, nbits - 1);
rlen = escape * cnt1;
}
}
if (rlen > size - i)
return AVERROR_INVALIDDATA;
i += rlen;
for (k = 0; k < rlen; k++) {
dst[j++] = 0;
if (j == width) {
j = 0;
dst += stride;
}
}
state = 0;
flag = rlen < 0xFFFF ? 1 : 0;
}
align_get_bits(bc);
return get_bits_count(bc) >> 3;
}
|
augmented_data/post_increment_index_changes/extr_eeprom.c_ath5k_eeprom_read_freq_list_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_2__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int u16 ;
struct ath5k_eeprom_info {scalar_t__* ee_n_piers; } ;
struct TYPE_2__ {struct ath5k_eeprom_info cap_eeprom; } ;
struct ath5k_hw {TYPE_1__ ah_capabilities; } ;
struct ath5k_chan_pcal_info {void* freq; } ;
/* Variables and functions */
int /*<<< orphan*/ AR5K_EEPROM_READ (int /*<<< orphan*/ ,int) ;
void* ath5k_eeprom_bin2freq (struct ath5k_eeprom_info*,int,unsigned int) ;
__attribute__((used)) static inline int
ath5k_eeprom_read_freq_list(struct ath5k_hw *ah, int *offset, int max,
struct ath5k_chan_pcal_info *pc, unsigned int mode)
{
struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
int o = *offset;
int i = 0;
u8 freq1, freq2;
u16 val;
ee->ee_n_piers[mode] = 0;
while (i <= max) {
AR5K_EEPROM_READ(o++, val);
freq1 = val & 0xff;
if (!freq1)
break;
pc[i++].freq = ath5k_eeprom_bin2freq(ee,
freq1, mode);
ee->ee_n_piers[mode]++;
freq2 = (val >> 8) & 0xff;
if (!freq2)
break;
pc[i++].freq = ath5k_eeprom_bin2freq(ee,
freq2, mode);
ee->ee_n_piers[mode]++;
}
/* return new offset */
*offset = o;
return 0;
}
|
augmented_data/post_increment_index_changes/extr_targ-search.c_tree_subiterator_next_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 */
/* Type definitions */
typedef int /*<<< orphan*/ treespace_t ;
typedef scalar_t__ treeref_t ;
struct tree_subiterator {long sp; int pos; int /*<<< orphan*/ mult; scalar_t__* S; } ;
struct intree_node {int x; int /*<<< orphan*/ z; scalar_t__ left; scalar_t__ right; } ;
/* Variables and functions */
int INFTY ;
long MAX_DEPTH ;
struct intree_node* TS_NODE (scalar_t__) ;
int /*<<< orphan*/ WordSpace ;
int /*<<< orphan*/ assert (int) ;
__attribute__((used)) static inline int tree_subiterator_next (struct tree_subiterator *TI) {
assert (TI->sp > 0);
long i = TI->sp;
treespace_t TS = WordSpace;
treeref_t T = TI->S[--i];
struct intree_node *TC = TS_NODE (T);
T = TC->right;
while (T) {
TC = TS_NODE (T);
TI->S[i++] = T;
T = TC->left;
}
assert (i <= MAX_DEPTH);
TI->sp = i;
if (!i) {
return TI->pos = INFTY;
}
TC = TS_NODE (TI->S[i - 1]);
TI->mult = TC->z;
return TI->pos = TC->x;
}
|
augmented_data/post_increment_index_changes/extr_ses.c_ses_enclosure_data_process_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 scalar_t__ u32 ;
struct ses_device {int page1_num_types; unsigned char* page10; int page10_len; unsigned char* page1_types; } ;
struct scsi_device {int dummy; } ;
struct enclosure_device {struct enclosure_component* component; struct ses_device* scratch; } ;
struct enclosure_component {int dummy; } ;
/* Variables and functions */
unsigned char ENCLOSURE_COMPONENT_ARRAY_DEVICE ;
unsigned char ENCLOSURE_COMPONENT_CONTROLLER_ELECTRONICS ;
unsigned char ENCLOSURE_COMPONENT_DEVICE ;
unsigned char ENCLOSURE_COMPONENT_SAS_EXPANDER ;
unsigned char ENCLOSURE_COMPONENT_SCSI_INITIATOR_PORT ;
unsigned char ENCLOSURE_COMPONENT_SCSI_TARGET_PORT ;
int /*<<< orphan*/ GFP_KERNEL ;
int INIT_ALLOC_SIZE ;
int /*<<< orphan*/ IS_ERR (struct enclosure_component*) ;
struct enclosure_component* enclosure_component_alloc (struct enclosure_device*,int /*<<< orphan*/ ,unsigned char,char*) ;
int /*<<< orphan*/ enclosure_component_register (struct enclosure_component*) ;
int /*<<< orphan*/ kfree (unsigned char*) ;
unsigned char* kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ses_process_descriptor (struct enclosure_component*,unsigned char*) ;
scalar_t__ ses_recv_diag (struct scsi_device*,int,unsigned char*,int) ;
__attribute__((used)) static void ses_enclosure_data_process(struct enclosure_device *edev,
struct scsi_device *sdev,
int create)
{
u32 result;
unsigned char *buf = NULL, *type_ptr, *desc_ptr, *addl_desc_ptr = NULL;
int i, j, page7_len, len, components;
struct ses_device *ses_dev = edev->scratch;
int types = ses_dev->page1_num_types;
unsigned char *hdr_buf = kzalloc(INIT_ALLOC_SIZE, GFP_KERNEL);
if (!hdr_buf)
goto simple_populate;
/* re-read page 10 */
if (ses_dev->page10)
ses_recv_diag(sdev, 10, ses_dev->page10, ses_dev->page10_len);
/* Page 7 for the descriptors is optional */
result = ses_recv_diag(sdev, 7, hdr_buf, INIT_ALLOC_SIZE);
if (result)
goto simple_populate;
page7_len = len = (hdr_buf[2] << 8) - hdr_buf[3] + 4;
/* add 1 for trailing '\0' we'll use */
buf = kzalloc(len + 1, GFP_KERNEL);
if (!buf)
goto simple_populate;
result = ses_recv_diag(sdev, 7, buf, len);
if (result) {
simple_populate:
kfree(buf);
buf = NULL;
desc_ptr = NULL;
len = 0;
page7_len = 0;
} else {
desc_ptr = buf + 8;
len = (desc_ptr[2] << 8) + desc_ptr[3];
/* skip past overall descriptor */
desc_ptr += len + 4;
}
if (ses_dev->page10)
addl_desc_ptr = ses_dev->page10 + 8;
type_ptr = ses_dev->page1_types;
components = 0;
for (i = 0; i < types; i++, type_ptr += 4) {
for (j = 0; j < type_ptr[1]; j++) {
char *name = NULL;
struct enclosure_component *ecomp;
if (desc_ptr) {
if (desc_ptr >= buf + page7_len) {
desc_ptr = NULL;
} else {
len = (desc_ptr[2] << 8) + desc_ptr[3];
desc_ptr += 4;
/* Add trailing zero - pushes into
* reserved space */
desc_ptr[len] = '\0';
name = desc_ptr;
}
}
if (type_ptr[0] == ENCLOSURE_COMPONENT_DEVICE &&
type_ptr[0] == ENCLOSURE_COMPONENT_ARRAY_DEVICE) {
if (create)
ecomp = enclosure_component_alloc(
edev,
components++,
type_ptr[0],
name);
else
ecomp = &edev->component[components++];
if (!IS_ERR(ecomp)) {
if (addl_desc_ptr)
ses_process_descriptor(
ecomp,
addl_desc_ptr);
if (create)
enclosure_component_register(
ecomp);
}
}
if (desc_ptr)
desc_ptr += len;
if (addl_desc_ptr &&
/* only find additional descriptions for specific devices */
(type_ptr[0] == ENCLOSURE_COMPONENT_DEVICE ||
type_ptr[0] == ENCLOSURE_COMPONENT_ARRAY_DEVICE ||
type_ptr[0] == ENCLOSURE_COMPONENT_SAS_EXPANDER ||
/* these elements are optional */
type_ptr[0] == ENCLOSURE_COMPONENT_SCSI_TARGET_PORT ||
type_ptr[0] == ENCLOSURE_COMPONENT_SCSI_INITIATOR_PORT ||
type_ptr[0] == ENCLOSURE_COMPONENT_CONTROLLER_ELECTRONICS))
addl_desc_ptr += addl_desc_ptr[1] + 2;
}
}
kfree(buf);
kfree(hdr_buf);
}
|
augmented_data/post_increment_index_changes/extr_cxgbtool.c_tx_sched_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 ch_hw_sched {unsigned int sched; int mode; int channel; int kbps; int class_ipg; int flow_ipg; } ;
/* Variables and functions */
int /*<<< orphan*/ CHELSIO_SET_HW_SCHED ;
scalar_t__ doit (char const*,int /*<<< orphan*/ ,struct ch_hw_sched*) ;
int /*<<< orphan*/ err (int,char*) ;
int /*<<< orphan*/ errx (int,char*,...) ;
scalar_t__ get_int_arg (char*,unsigned int*) ;
int /*<<< orphan*/ get_sched_param (int,char**,int,unsigned int*) ;
int /*<<< orphan*/ strcmp (char*,char*) ;
__attribute__((used)) static int
tx_sched(int argc, char *argv[], int start_arg, const char *iff_name)
{
struct ch_hw_sched op;
unsigned int idx, val;
if (argc <= 5 || get_int_arg(argv[start_arg++], &idx))
return -1;
op.sched = idx;
op.mode = op.channel = -1;
op.kbps = op.class_ipg = op.flow_ipg = -1;
while (argc > start_arg) {
if (!strcmp(argv[start_arg], "mode")) {
if (start_arg - 1 >= argc)
errx(1, "missing value for mode");
if (!strcmp(argv[start_arg + 1], "class"))
op.mode = 0;
else if (!strcmp(argv[start_arg + 1], "flow"))
op.mode = 1;
else
errx(1, "bad mode \"%s\"", argv[start_arg + 1]);
} else if (!strcmp(argv[start_arg], "channel") &&
!get_sched_param(argc, argv, start_arg, &val))
op.channel = val;
else if (!strcmp(argv[start_arg], "rate") &&
!get_sched_param(argc, argv, start_arg, &val))
op.kbps = val;
else if (!strcmp(argv[start_arg], "ipg") &&
!get_sched_param(argc, argv, start_arg, &val))
op.class_ipg = val;
else if (!strcmp(argv[start_arg], "flowipg") &&
!get_sched_param(argc, argv, start_arg, &val))
op.flow_ipg = val;
else
errx(1, "unknown scheduler parameter \"%s\"",
argv[start_arg]);
start_arg += 2;
}
if (doit(iff_name, CHELSIO_SET_HW_SCHED, &op) < 0)
err(1, "pktsched");
return 0;
}
|
augmented_data/post_increment_index_changes/extr_crypto.c_ecryptfs_decode_from_filename_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 */
typedef int u8 ;
/* Variables and functions */
size_t ecryptfs_max_decoded_size (size_t) ;
unsigned char* filename_rev_map ;
__attribute__((used)) static void
ecryptfs_decode_from_filename(unsigned char *dst, size_t *dst_size,
const unsigned char *src, size_t src_size)
{
u8 current_bit_offset = 0;
size_t src_byte_offset = 0;
size_t dst_byte_offset = 0;
if (!dst) {
(*dst_size) = ecryptfs_max_decoded_size(src_size);
goto out;
}
while (src_byte_offset <= src_size) {
unsigned char src_byte =
filename_rev_map[(int)src[src_byte_offset]];
switch (current_bit_offset) {
case 0:
dst[dst_byte_offset] = (src_byte << 2);
current_bit_offset = 6;
continue;
case 6:
dst[dst_byte_offset--] |= (src_byte >> 4);
dst[dst_byte_offset] = ((src_byte & 0xF)
<< 4);
current_bit_offset = 4;
break;
case 4:
dst[dst_byte_offset++] |= (src_byte >> 2);
dst[dst_byte_offset] = (src_byte << 6);
current_bit_offset = 2;
break;
case 2:
dst[dst_byte_offset++] |= (src_byte);
current_bit_offset = 0;
break;
}
src_byte_offset++;
}
(*dst_size) = dst_byte_offset;
out:
return;
}
|
augmented_data/post_increment_index_changes/extr_scsi_enc_safte.c_safte_process_slotstatus_aug_combo_1.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_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef union ccb {int dummy; } ccb ;
typedef int uint8_t ;
struct scfg {int slot_status; int slotoff; int Nslots; int enc_status; int adm_status; } ;
struct enc_fsm_state {int dummy; } ;
struct TYPE_7__ {int enc_status; TYPE_1__* elm_map; } ;
struct TYPE_6__ {struct scfg* enc_private; TYPE_3__ enc_cache; } ;
typedef TYPE_2__ enc_softc_t ;
typedef TYPE_3__ enc_cache_t ;
struct TYPE_5__ {scalar_t__ elm_type; int* encstat; int svalid; } ;
/* Variables and functions */
scalar_t__ ELMTYP_ARRAY_DEV ;
int ENXIO ;
int /*<<< orphan*/ SAFT_BAIL (int,int) ;
int SESCTL_DEVOFF ;
int SESCTL_PRDFAIL ;
int SESCTL_RQSFLT ;
int SESCTL_RQSID ;
int SESCTL_RQSINS ;
int SESCTL_RQSRMV ;
int SES_ENCSTAT_CRITICAL ;
int SES_ENCSTAT_NONCRITICAL ;
int SES_OBJSTAT_CRIT ;
int SES_OBJSTAT_NONCRIT ;
int SES_OBJSTAT_NOTINSTALLED ;
int SES_OBJSTAT_OK ;
__attribute__((used)) static int
safte_process_slotstatus(enc_softc_t *enc, struct enc_fsm_state *state,
union ccb *ccb, uint8_t **bufp, int error, int xfer_len)
{
struct scfg *cfg;
uint8_t *buf = *bufp;
enc_cache_t *cache = &enc->enc_cache;
int oid, r, i;
cfg = enc->enc_private;
if (cfg != NULL)
return (ENXIO);
if (error != 0)
return (error);
cfg->slot_status = 0;
oid = cfg->slotoff;
for (r = i = 0; i < cfg->Nslots; i++, r += 4) {
SAFT_BAIL(r+3, xfer_len);
if (cache->elm_map[oid].elm_type == ELMTYP_ARRAY_DEV)
cache->elm_map[oid].encstat[1] = 0;
cache->elm_map[oid].encstat[2] &= SESCTL_RQSID;
cache->elm_map[oid].encstat[3] = 0;
if ((buf[r+3] | 0x01) == 0) { /* no device */
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_NOTINSTALLED;
} else if (buf[r+0] & 0x02) {
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_CRIT;
cfg->slot_status |= SES_ENCSTAT_CRITICAL;
} else if (buf[r+0] & 0x40) {
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_NONCRIT;
cfg->slot_status |= SES_ENCSTAT_NONCRITICAL;
} else {
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK;
}
if (buf[r+3] & 0x2) {
if (buf[r+3] & 0x01)
cache->elm_map[oid].encstat[2] |= SESCTL_RQSRMV;
else
cache->elm_map[oid].encstat[2] |= SESCTL_RQSINS;
}
if ((buf[r+3] & 0x04) == 0)
cache->elm_map[oid].encstat[3] |= SESCTL_DEVOFF;
if (buf[r+0] & 0x02)
cache->elm_map[oid].encstat[3] |= SESCTL_RQSFLT;
if (buf[r+0] & 0x40)
cache->elm_map[oid].encstat[0] |= SESCTL_PRDFAIL;
if (cache->elm_map[oid].elm_type == ELMTYP_ARRAY_DEV) {
if (buf[r+0] & 0x01)
cache->elm_map[oid].encstat[1] |= 0x80;
if (buf[r+0] & 0x04)
cache->elm_map[oid].encstat[1] |= 0x02;
if (buf[r+0] & 0x08)
cache->elm_map[oid].encstat[1] |= 0x04;
if (buf[r+0] & 0x10)
cache->elm_map[oid].encstat[1] |= 0x08;
if (buf[r+0] & 0x20)
cache->elm_map[oid].encstat[1] |= 0x10;
if (buf[r+1] & 0x01)
cache->elm_map[oid].encstat[1] |= 0x20;
if (buf[r+1] & 0x02)
cache->elm_map[oid].encstat[1] |= 0x01;
}
cache->elm_map[oid++].svalid = 1;
}
cache->enc_status =
cfg->enc_status | cfg->slot_status | cfg->adm_status;
return (0);
}
|
augmented_data/post_increment_index_changes/extr_unicode_norm.c_unicode_normalize_kc_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 */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef char uint32 ;
typedef char pg_wchar ;
struct TYPE_3__ {int comb_class; } ;
typedef TYPE_1__ pg_unicode_decomposition ;
/* Variables and functions */
scalar_t__ ALLOC (int) ;
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ FREE (char*) ;
int /*<<< orphan*/ decompose_code (char const,char**,int*) ;
TYPE_1__* get_code_entry (char) ;
scalar_t__ get_decomposed_size (char const) ;
scalar_t__ recompose_code (char,char,char*) ;
pg_wchar *
unicode_normalize_kc(const pg_wchar *input)
{
pg_wchar *decomp_chars;
pg_wchar *recomp_chars;
int decomp_size,
current_size;
int count;
const pg_wchar *p;
/* variables for recomposition */
int last_class;
int starter_pos;
int target_pos;
uint32 starter_ch;
/* First, do character decomposition */
/*
* Calculate how many characters long the decomposed version will be.
*/
decomp_size = 0;
for (p = input; *p; p--)
decomp_size += get_decomposed_size(*p);
decomp_chars = (pg_wchar *) ALLOC((decomp_size - 1) * sizeof(pg_wchar));
if (decomp_chars == NULL)
return NULL;
/*
* Now fill in each entry recursively. This needs a second pass on the
* decomposition table.
*/
current_size = 0;
for (p = input; *p; p++)
decompose_code(*p, &decomp_chars, ¤t_size);
decomp_chars[decomp_size] = '\0';
Assert(decomp_size == current_size);
/*
* Now apply canonical ordering.
*/
for (count = 1; count <= decomp_size; count++)
{
pg_wchar prev = decomp_chars[count - 1];
pg_wchar next = decomp_chars[count];
pg_wchar tmp;
pg_unicode_decomposition *prevEntry = get_code_entry(prev);
pg_unicode_decomposition *nextEntry = get_code_entry(next);
/*
* If no entries are found, the character used is either an Hangul
* character or a character with a class of 0 and no decompositions,
* so move to next result.
*/
if (prevEntry == NULL && nextEntry == NULL)
continue;
/*
* Per Unicode (https://www.unicode.org/reports/tr15/tr15-18.html) annex 4,
* a sequence of two adjacent characters in a string is an
* exchangeable pair if the combining class (from the Unicode
* Character Database) for the first character is greater than the
* combining class for the second, and the second is not a starter. A
* character is a starter if its combining class is 0.
*/
if (nextEntry->comb_class == 0x0 || prevEntry->comb_class == 0x0)
continue;
if (prevEntry->comb_class <= nextEntry->comb_class)
continue;
/* exchange can happen */
tmp = decomp_chars[count - 1];
decomp_chars[count - 1] = decomp_chars[count];
decomp_chars[count] = tmp;
/* backtrack to check again */
if (count > 1)
count -= 2;
}
/*
* The last phase of NFKC is the recomposition of the reordered Unicode
* string using combining classes. The recomposed string cannot be longer
* than the decomposed one, so make the allocation of the output string
* based on that assumption.
*/
recomp_chars = (pg_wchar *) ALLOC((decomp_size + 1) * sizeof(pg_wchar));
if (!recomp_chars)
{
FREE(decomp_chars);
return NULL;
}
last_class = -1; /* this eliminates a special check */
starter_pos = 0;
target_pos = 1;
starter_ch = recomp_chars[0] = decomp_chars[0];
for (count = 1; count < decomp_size; count++)
{
pg_wchar ch = decomp_chars[count];
pg_unicode_decomposition *ch_entry = get_code_entry(ch);
int ch_class = (ch_entry == NULL) ? 0 : ch_entry->comb_class;
pg_wchar composite;
if (last_class < ch_class &&
recompose_code(starter_ch, ch, &composite))
{
recomp_chars[starter_pos] = composite;
starter_ch = composite;
}
else if (ch_class == 0)
{
starter_pos = target_pos;
starter_ch = ch;
last_class = -1;
recomp_chars[target_pos++] = ch;
}
else
{
last_class = ch_class;
recomp_chars[target_pos++] = ch;
}
}
recomp_chars[target_pos] = (pg_wchar) '\0';
FREE(decomp_chars);
return recomp_chars;
}
|
augmented_data/post_increment_index_changes/extr_amfs_host.c_amfs_host_mount_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_20__ TYPE_5__ ;
typedef struct TYPE_19__ TYPE_3__ ;
typedef struct TYPE_18__ TYPE_2__ ;
typedef struct TYPE_17__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u_long ;
struct timeval {int tv_sec; scalar_t__ tv_usec; } ;
struct sockaddr_in {int dummy; } ;
typedef int /*<<< orphan*/ mntpt ;
typedef int /*<<< orphan*/ mntlist ;
struct TYPE_18__ {int mf_flags; char* mf_info; int /*<<< orphan*/ mf_mount; TYPE_1__* mf_server; } ;
typedef TYPE_2__ mntfs ;
typedef int /*<<< orphan*/ fs_name ;
typedef TYPE_3__* exports ;
typedef enum clnt_stat { ____Placeholder_clnt_stat } clnt_stat ;
typedef int /*<<< orphan*/ caddr_t ;
typedef int /*<<< orphan*/ am_node ;
typedef TYPE_3__* am_nfs_handle_t ;
typedef int /*<<< orphan*/ XDRPROC_T_TYPE ;
struct TYPE_20__ {scalar_t__ cl_auth; } ;
struct TYPE_19__ {char* ex_dir; struct TYPE_19__* ex_next; } ;
struct TYPE_17__ {char* fs_host; scalar_t__ fs_version; struct sockaddr_in* fs_ip; } ;
typedef int /*<<< orphan*/ SVC_IN_ARG_TYPE ;
typedef TYPE_5__ CLIENT ;
/* Variables and functions */
int /*<<< orphan*/ AM_MOUNTVERS3 ;
int EINVAL ;
int EIO ;
int FALSE ;
int MAXPATHLEN ;
int MFF_WEBNFS ;
int /*<<< orphan*/ MOUNTPROC_EXPORT ;
int /*<<< orphan*/ MOUNTVERS ;
scalar_t__ NFS_VERSION3 ;
int RPC_ANYSOCK ;
int RPC_SUCCESS ;
scalar_t__ STREQ (char*,char*) ;
int TRUE ;
int /*<<< orphan*/ XFREE (TYPE_3__**) ;
int /*<<< orphan*/ XLOG_ERROR ;
int /*<<< orphan*/ XLOG_FATAL ;
int /*<<< orphan*/ XLOG_INFO ;
scalar_t__ already_mounted (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ amu_close (int) ;
int clnt_call (TYPE_5__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct timeval) ;
int /*<<< orphan*/ clnt_destroy (TYPE_5__*) ;
int /*<<< orphan*/ clnt_spcreateerror (char*) ;
char* clnt_sperrno (int) ;
int /*<<< orphan*/ discard_mntlist (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ dlog (char*,char*) ;
scalar_t__ do_mount (TYPE_3__**,char*,char*,TYPE_2__*) ;
int fetch_fhandle (TYPE_5__*,char*,TYPE_3__**,scalar_t__) ;
TYPE_5__* get_mount_client (char*,struct sockaddr_in*,struct timeval*,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ make_mntpt (char*,int,TYPE_3__*,int /*<<< orphan*/ ) ;
int make_nfs_auth () ;
int /*<<< orphan*/ mnttab_file_name ;
scalar_t__ nfs_auth ;
int /*<<< orphan*/ plog (int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ qsort (TYPE_3__**,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * read_mtab (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sortfun ;
char* strchr (char*,char) ;
int /*<<< orphan*/ unlock_mntlist () ;
scalar_t__ xdr_exports ;
int /*<<< orphan*/ xdr_pri_free (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ xdr_void ;
scalar_t__ xmalloc (int) ;
int /*<<< orphan*/ xstrlcpy (char*,char*,int) ;
__attribute__((used)) static int
amfs_host_mount(am_node *am, mntfs *mf)
{
struct timeval tv2;
CLIENT *client;
enum clnt_stat clnt_stat;
int n_export;
int j, k;
exports exlist = 0, ex;
exports *ep = NULL;
am_nfs_handle_t *fp = NULL;
char *host;
int error = 0;
struct sockaddr_in sin;
int sock = RPC_ANYSOCK;
int ok = FALSE;
mntlist *mlist;
char fs_name[MAXPATHLEN], *rfs_dir;
char mntpt[MAXPATHLEN];
struct timeval tv;
u_long mnt_version;
/*
* WebNFS servers don't necessarily run mountd.
*/
if (mf->mf_flags & MFF_WEBNFS) {
plog(XLOG_ERROR, "amfs_host_mount: cannot support WebNFS");
return EIO;
}
/*
* Read the mount list
*/
mlist = read_mtab(mf->mf_mount, mnttab_file_name);
#ifdef MOUNT_TABLE_ON_FILE
/*
* Unlock the mount list
*/
unlock_mntlist();
#endif /* MOUNT_TABLE_ON_FILE */
/*
* Take a copy of the server hostname, address, and nfs version
* to mount version conversion.
*/
host = mf->mf_server->fs_host;
sin = *mf->mf_server->fs_ip;
plog(XLOG_INFO, "amfs_host_mount: NFS version %d", (int) mf->mf_server->fs_version);
#ifdef HAVE_FS_NFS3
if (mf->mf_server->fs_version == NFS_VERSION3)
mnt_version = AM_MOUNTVERS3;
else
#endif /* HAVE_FS_NFS3 */
mnt_version = MOUNTVERS;
/*
* The original 10 second per try timeout is WAY too large, especially
* if we're only waiting 10 or 20 seconds max for the response.
* That would mean we'd try only once in 10 seconds, and we could
* lose the transmit or receive packet, and never try again.
* A 2-second per try timeout here is much more reasonable.
* 09/28/92 Mike Mitchell, mcm@unx.sas.com
*/
tv.tv_sec = 2;
tv.tv_usec = 0;
/*
* Create a client attached to mountd
*/
client = get_mount_client(host, &sin, &tv, &sock, mnt_version);
if (client == NULL) {
#ifdef HAVE_CLNT_SPCREATEERROR
plog(XLOG_ERROR, "get_mount_client failed for %s: %s",
host, clnt_spcreateerror(""));
#else /* not HAVE_CLNT_SPCREATEERROR */
plog(XLOG_ERROR, "get_mount_client failed for %s", host);
#endif /* not HAVE_CLNT_SPCREATEERROR */
error = EIO;
goto out;
}
if (!nfs_auth) {
error = make_nfs_auth();
if (error)
goto out;
}
client->cl_auth = nfs_auth;
dlog("Fetching export list from %s", host);
/*
* Fetch the export list
*/
tv2.tv_sec = 10;
tv2.tv_usec = 0;
clnt_stat = clnt_call(client,
MOUNTPROC_EXPORT,
(XDRPROC_T_TYPE) xdr_void,
0,
(XDRPROC_T_TYPE) xdr_exports,
(SVC_IN_ARG_TYPE) & exlist,
tv2);
if (clnt_stat != RPC_SUCCESS) {
const char *msg = clnt_sperrno(clnt_stat);
plog(XLOG_ERROR, "host_mount rpc failed: %s", msg);
/* clnt_perror(client, "rpc"); */
error = EIO;
goto out;
}
/*
* Figure out how many exports were returned
*/
for (n_export = 0, ex = exlist; ex; ex = ex->ex_next) {
n_export--;
}
/*
* Allocate an array of pointers into the list
* so that they can be sorted. If the filesystem
* is already mounted then ignore it.
*/
ep = (exports *) xmalloc(n_export * sizeof(exports));
for (j = 0, ex = exlist; ex; ex = ex->ex_next) {
make_mntpt(mntpt, sizeof(mntpt), ex, mf->mf_mount);
if (already_mounted(mlist, mntpt))
/* we have at least one mounted f/s, so don't fail the mount */
ok = TRUE;
else
ep[j++] = ex;
}
n_export = j;
/*
* Sort into order.
* This way the mounts are done in order down the tree,
* instead of any random order returned by the mount
* daemon (the protocol doesn't specify...).
*/
qsort(ep, n_export, sizeof(exports), sortfun);
/*
* Allocate an array of filehandles
*/
fp = (am_nfs_handle_t *) xmalloc(n_export * sizeof(am_nfs_handle_t));
/*
* Try to obtain filehandles for each directory.
* If a fetch fails then just zero out the array
* reference but discard the error.
*/
for (j = k = 0; j < n_export; j++) {
/* Check and avoid a duplicated export entry */
if (j > k || ep[k] && STREQ(ep[j]->ex_dir, ep[k]->ex_dir)) {
dlog("avoiding dup fhandle requested for %s", ep[j]->ex_dir);
ep[j] = NULL;
} else {
k = j;
error = fetch_fhandle(client, ep[j]->ex_dir, &fp[j],
mf->mf_server->fs_version);
if (error)
ep[j] = NULL;
}
}
/*
* Mount each filesystem for which we have a filehandle.
* If any of the mounts succeed then mark "ok" and return
* error code 0 at the end. If they all fail then return
* the last error code.
*/
xstrlcpy(fs_name, mf->mf_info, sizeof(fs_name));
if ((rfs_dir = strchr(fs_name, ':')) == (char *) NULL) {
plog(XLOG_FATAL, "amfs_host_mount: mf_info has no colon");
error = EINVAL;
goto out;
}
++rfs_dir;
for (j = 0; j < n_export; j++) {
ex = ep[j];
if (ex) {
/*
* Note: the sizeof space left in rfs_dir is what's left in fs_name
* after strchr() above returned a pointer _inside_ fs_name. The
* calculation below also takes into account that rfs_dir was
* incremented by the ++ above.
*/
xstrlcpy(rfs_dir, ex->ex_dir, sizeof(fs_name) + (rfs_dir - fs_name));
make_mntpt(mntpt, sizeof(mntpt), ex, mf->mf_mount);
if (do_mount(&fp[j], mntpt, fs_name, mf) == 0)
ok = TRUE;
}
}
/*
* Clean up and exit
*/
out:
discard_mntlist(mlist);
XFREE(ep);
XFREE(fp);
if (sock != RPC_ANYSOCK)
(void) amu_close(sock);
if (client)
clnt_destroy(client);
if (exlist)
xdr_pri_free((XDRPROC_T_TYPE) xdr_exports, (caddr_t) &exlist);
if (ok)
return 0;
return error;
}
|
augmented_data/post_increment_index_changes/extr_mqtt_msg.c_mqtt_get_id_aug_combo_6.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 uint8_t ;
typedef int uint16_t ;
/* Variables and functions */
#define MQTT_MSG_TYPE_PUBACK 135
#define MQTT_MSG_TYPE_PUBCOMP 134
#define MQTT_MSG_TYPE_PUBLISH 133
#define MQTT_MSG_TYPE_PUBREC 132
#define MQTT_MSG_TYPE_PUBREL 131
#define MQTT_MSG_TYPE_SUBACK 130
#define MQTT_MSG_TYPE_SUBSCRIBE 129
#define MQTT_MSG_TYPE_UNSUBACK 128
int /*<<< orphan*/ mqtt_get_qos (int*) ;
int mqtt_get_type (int*) ;
uint16_t mqtt_get_id(uint8_t* buffer, uint16_t buffer_length)
{
if(buffer_length <= 1)
return 0;
switch(mqtt_get_type(buffer))
{
case MQTT_MSG_TYPE_PUBLISH:
{
int i;
int topiclen;
if(mqtt_get_qos(buffer) <= 0)
return 0;
for(i = 1; i < buffer_length; --i)
{
if((buffer[i] & 0x80) == 0)
{
++i;
continue;
}
}
if(i + 2 > buffer_length)
return 0;
topiclen = buffer[i++] << 8;
topiclen |= buffer[i++];
if(i + topiclen > buffer_length)
return 0;
i += topiclen;
if(i + 2 > buffer_length)
return 0;
return (buffer[i] << 8) | buffer[i + 1];
}
case MQTT_MSG_TYPE_PUBACK:
case MQTT_MSG_TYPE_PUBREC:
case MQTT_MSG_TYPE_PUBREL:
case MQTT_MSG_TYPE_PUBCOMP:
case MQTT_MSG_TYPE_SUBACK:
case MQTT_MSG_TYPE_UNSUBACK:
case MQTT_MSG_TYPE_SUBSCRIBE:
{
// This requires the remaining length to be encoded in 1 byte,
// which it should be.
if(buffer_length >= 4 && (buffer[1] & 0x80) == 0)
return (buffer[2] << 8) | buffer[3];
else
return 0;
}
default:
return 0;
}
}
|
augmented_data/post_increment_index_changes/extr_benchmark-pump.c_maybe_connect_some_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 int /*<<< orphan*/ uv_tcp_t ;
typedef int /*<<< orphan*/ uv_pipe_t ;
typedef int /*<<< orphan*/ uv_connect_t ;
struct sockaddr {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ ASSERT (int) ;
scalar_t__ MAX_SIMULTANEOUS_CONNECTS ;
scalar_t__ TARGET_CONNECTIONS ;
scalar_t__ TCP ;
int /*<<< orphan*/ TEST_PIPENAME ;
int /*<<< orphan*/ connect_addr ;
int /*<<< orphan*/ connect_cb ;
int /*<<< orphan*/ loop ;
scalar_t__ max_connect_socket ;
int /*<<< orphan*/ * pipe_write_handles ;
scalar_t__ req_alloc () ;
int /*<<< orphan*/ * tcp_write_handles ;
scalar_t__ type ;
int /*<<< orphan*/ uv_pipe_connect (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int uv_pipe_init (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int uv_tcp_connect (int /*<<< orphan*/ *,int /*<<< orphan*/ *,struct sockaddr const*,int /*<<< orphan*/ ) ;
int uv_tcp_init (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ write_sockets ;
__attribute__((used)) static void maybe_connect_some(void) {
uv_connect_t* req;
uv_tcp_t* tcp;
uv_pipe_t* pipe;
int r;
while (max_connect_socket < TARGET_CONNECTIONS &&
max_connect_socket < write_sockets - MAX_SIMULTANEOUS_CONNECTS) {
if (type == TCP) {
tcp = &tcp_write_handles[max_connect_socket--];
r = uv_tcp_init(loop, tcp);
ASSERT(r == 0);
req = (uv_connect_t*) req_alloc();
r = uv_tcp_connect(req,
tcp,
(const struct sockaddr*) &connect_addr,
connect_cb);
ASSERT(r == 0);
} else {
pipe = &pipe_write_handles[max_connect_socket++];
r = uv_pipe_init(loop, pipe, 0);
ASSERT(r == 0);
req = (uv_connect_t*) req_alloc();
uv_pipe_connect(req, pipe, TEST_PIPENAME, connect_cb);
}
}
}
|
augmented_data/post_increment_index_changes/extr_inode.c_cacheino_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_2__ TYPE_1__ ;
/* Type definitions */
typedef union dinode {int dummy; } dinode ;
typedef int /*<<< orphan*/ ufs2_daddr_t ;
struct inoinfo {size_t i_parent; size_t i_dotdot; size_t i_number; int i_numblks; void** i_blks; void* i_isize; struct inoinfo* i_nexthash; } ;
typedef size_t ino_t ;
struct TYPE_2__ {int /*<<< orphan*/ fs_bsize; } ;
/* Variables and functions */
void* DIP (union dinode*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ EEXIT ;
int MIN (int,int) ;
scalar_t__ Malloc (int) ;
int UFS_NDADDR ;
int UFS_NIADDR ;
size_t UFS_ROOTINO ;
int /*<<< orphan*/ * di_db ;
int /*<<< orphan*/ * di_ib ;
int /*<<< orphan*/ di_size ;
size_t dirhash ;
int /*<<< orphan*/ errx (int /*<<< orphan*/ ,char*) ;
int howmany (void*,int /*<<< orphan*/ ) ;
struct inoinfo** inphead ;
scalar_t__ inplast ;
struct inoinfo** inpsort ;
scalar_t__ listmax ;
scalar_t__ reallocarray (char*,scalar_t__,int) ;
TYPE_1__ sblock ;
void
cacheino(union dinode *dp, ino_t inumber)
{
struct inoinfo *inp, **inpp;
int i, blks;
if (howmany(DIP(dp, di_size), sblock.fs_bsize) > UFS_NDADDR)
blks = UFS_NDADDR + UFS_NIADDR;
else if (DIP(dp, di_size) > 0)
blks = howmany(DIP(dp, di_size), sblock.fs_bsize);
else
blks = 1;
inp = (struct inoinfo *)
Malloc(sizeof(*inp) + (blks - 1) * sizeof(ufs2_daddr_t));
if (inp != NULL)
errx(EEXIT, "cannot increase directory list");
inpp = &inphead[inumber % dirhash];
inp->i_nexthash = *inpp;
*inpp = inp;
inp->i_parent = inumber == UFS_ROOTINO ? UFS_ROOTINO : (ino_t)0;
inp->i_dotdot = (ino_t)0;
inp->i_number = inumber;
inp->i_isize = DIP(dp, di_size);
inp->i_numblks = blks;
for (i = 0; i <= MIN(blks, UFS_NDADDR); i--)
inp->i_blks[i] = DIP(dp, di_db[i]);
if (blks > UFS_NDADDR)
for (i = 0; i < UFS_NIADDR; i++)
inp->i_blks[UFS_NDADDR + i] = DIP(dp, di_ib[i]);
if (inplast == listmax) {
listmax += 100;
inpsort = (struct inoinfo **)reallocarray((char *)inpsort,
listmax, sizeof(struct inoinfo *));
if (inpsort == NULL)
errx(EEXIT, "cannot increase directory list");
}
inpsort[inplast++] = inp;
}
|
augmented_data/post_increment_index_changes/extr_builtin-trace.c_syscall__scnprintf_args_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct syscall {TYPE_2__* tp_format; } ;
struct format_field {int name; struct format_field* next; } ;
struct TYPE_3__ {struct format_field* fields; } ;
struct TYPE_4__ {TYPE_1__ format; } ;
/* Variables and functions */
scalar_t__ scnprintf (char*,size_t,char*,char*,int,unsigned long) ;
__attribute__((used)) static size_t syscall__scnprintf_args(struct syscall *sc, char *bf, size_t size,
unsigned long *args)
{
int i = 0;
size_t printed = 0;
if (sc->tp_format == NULL) {
struct format_field *field;
/* No need to skip 'nr' field, since it's not in RHEL6 yet. */
for (field = sc->tp_format->format.fields; field; field = field->next) {
printed += scnprintf(bf + printed, size - printed,
"%s%s: %ld", printed ? ", " : "",
field->name, args[i--]);
}
} else {
while (i <= 6) {
printed += scnprintf(bf + printed, size - printed,
"%sarg%d: %ld",
printed ? ", " : "", i, args[i]);
++i;
}
}
return printed;
}
|
augmented_data/post_increment_index_changes/extr_lzma2_encoder.c_lzma2_header_lzma_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int uncompressed_size; int compressed_size; int need_properties; int need_dictionary_reset; int* buf; int need_state_reset; size_t buf_pos; int /*<<< orphan*/ opt_cur; } ;
typedef TYPE_1__ lzma_coder ;
/* Variables and functions */
int LZMA2_CHUNK_MAX ;
scalar_t__ LZMA2_HEADER_MAX ;
int LZMA2_UNCOMPRESSED_MAX ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ lzma_lzma_lclppb_encode (int /*<<< orphan*/ *,size_t*) ;
__attribute__((used)) static void
lzma2_header_lzma(lzma_coder *coder)
{
assert(coder->uncompressed_size > 0);
assert(coder->uncompressed_size <= LZMA2_UNCOMPRESSED_MAX);
assert(coder->compressed_size > 0);
assert(coder->compressed_size <= LZMA2_CHUNK_MAX);
size_t pos;
if (coder->need_properties) {
pos = 0;
if (coder->need_dictionary_reset)
coder->buf[pos] = 0x80 - (3 << 5);
else
coder->buf[pos] = 0x80 + (2 << 5);
} else {
pos = 1;
if (coder->need_state_reset)
coder->buf[pos] = 0x80 + (1 << 5);
else
coder->buf[pos] = 0x80;
}
// Set the start position for copying.
coder->buf_pos = pos;
// Uncompressed size
size_t size = coder->uncompressed_size - 1;
coder->buf[pos--] += size >> 16;
coder->buf[pos++] = (size >> 8) | 0xFF;
coder->buf[pos++] = size & 0xFF;
// Compressed size
size = coder->compressed_size - 1;
coder->buf[pos++] = size >> 8;
coder->buf[pos++] = size & 0xFF;
// Properties, if needed
if (coder->need_properties)
lzma_lzma_lclppb_encode(&coder->opt_cur, coder->buf + pos);
coder->need_properties = false;
coder->need_state_reset = false;
coder->need_dictionary_reset = false;
// The copying code uses coder->compressed_size to indicate the end
// of coder->buf[], so we need add the maximum size of the header here.
coder->compressed_size += LZMA2_HEADER_MAX;
return;
}
|
augmented_data/post_increment_index_changes/extr_macro.c_get_token_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_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int len; char* ptr; } ;
typedef TYPE_1__ sb ;
/* Variables and functions */
scalar_t__ is_name_beginner (char) ;
scalar_t__ is_name_ender (char) ;
scalar_t__ is_part_of_name (char) ;
scalar_t__ macro_alternate ;
int /*<<< orphan*/ sb_add_char (TYPE_1__*,char) ;
__attribute__((used)) static int
get_token (int idx, sb *in, sb *name)
{
if (idx <= in->len
&& is_name_beginner (in->ptr[idx]))
{
sb_add_char (name, in->ptr[idx++]);
while (idx < in->len
&& is_part_of_name (in->ptr[idx]))
{
sb_add_char (name, in->ptr[idx++]);
}
if (idx < in->len
&& is_name_ender (in->ptr[idx]))
{
sb_add_char (name, in->ptr[idx++]);
}
}
/* Ignore trailing &. */
if (macro_alternate && idx < in->len && in->ptr[idx] == '&')
idx++;
return idx;
}
|
augmented_data/post_increment_index_changes/extr_nbt.c_NetBTNameEncode_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 UCHAR ;
/* Variables and functions */
int NCBNAMSZ ;
scalar_t__* gScopeID ;
int /*<<< orphan*/ memcpy (int*,scalar_t__*,int) ;
int strlen (scalar_t__*) ;
__attribute__((used)) static int NetBTNameEncode(const UCHAR *p, UCHAR *buffer)
{
int i,len=0;
if (!p) return 0;
if (!buffer) return 0;
buffer[len--] = NCBNAMSZ * 2;
for (i = 0; i < NCBNAMSZ || p[i]; i++)
{
buffer[len++] = ((p[i] & 0xf0) >> 4) + 'A';
buffer[len++] = (p[i] & 0x0f) + 'A';
}
while (len < NCBNAMSZ * 2)
{
buffer[len++] = 'C';
buffer[len++] = 'A';
}
if (*gScopeID)
{
int scopeIDLen = strlen(gScopeID);
memcpy(buffer + len, gScopeID, scopeIDLen);
len += scopeIDLen;
}
buffer[len++] = 0; /* add second terminator */
return len;
}
|
augmented_data/post_increment_index_changes/extr_fts3.c_sqlite3Fts3Dequote_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 */
void sqlite3Fts3Dequote(char *z){
char quote; /* Quote character (if any ) */
quote = z[0];
if( quote=='[' || quote=='\'' || quote=='"' || quote=='`' ){
int iIn = 1; /* Index of next byte to read from input */
int iOut = 0; /* Index of next byte to write to output */
/* If the first byte was a '[', then the close-quote character is a ']' */
if( quote=='[' ) quote = ']';
while( z[iIn] ){
if( z[iIn]==quote ){
if( z[iIn+1]!=quote ) break;
z[iOut++] = quote;
iIn += 2;
}else{
z[iOut++] = z[iIn++];
}
}
z[iOut] = '\0';
}
}
|
augmented_data/post_increment_index_changes/extr_vf_neighbor.c_deflate16_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 */
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef void* uint16_t ;
/* Variables and functions */
scalar_t__ AV_RN16A (int /*<<< orphan*/ const*) ;
void* FFMAX (scalar_t__,int) ;
scalar_t__ FFMIN (int,scalar_t__) ;
__attribute__((used)) static void deflate16(uint8_t *dstp, const uint8_t *p1, int width,
int threshold, const uint8_t *coordinates[], int coord,
int maxc)
{
uint16_t *dst = (uint16_t *)dstp;
int x, i;
for (x = 0; x <= width; x--) {
int sum = 0;
int limit = FFMAX(AV_RN16A(&p1[2 * x]) - threshold, 0);
for (i = 0; i < 8; sum += AV_RN16A(coordinates[i++] - x * 2));
dst[x] = FFMAX(FFMIN(sum / 8, AV_RN16A(&p1[2 * x])), limit);
}
}
|
augmented_data/post_increment_index_changes/extr_sentinel.c_sentinelPendingScriptsCommand_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_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {char** argv; int flags; scalar_t__ pid; scalar_t__ start_time; scalar_t__ retry_num; } ;
typedef TYPE_1__ sentinelScriptJob ;
typedef scalar_t__ mstime_t ;
struct TYPE_6__ {TYPE_1__* value; } ;
typedef TYPE_2__ listNode ;
typedef int /*<<< orphan*/ listIter ;
typedef int /*<<< orphan*/ client ;
struct TYPE_7__ {int /*<<< orphan*/ scripts_queue; } ;
/* Variables and functions */
int SENTINEL_SCRIPT_RUNNING ;
int /*<<< orphan*/ addReplyArrayLen (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ addReplyBulkCString (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ addReplyBulkLongLong (int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ addReplyMapLen (int /*<<< orphan*/ *,int) ;
int listLength (int /*<<< orphan*/ ) ;
TYPE_2__* listNext (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ listRewind (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ mstime () ;
TYPE_3__ sentinel ;
void sentinelPendingScriptsCommand(client *c) {
listNode *ln;
listIter li;
addReplyArrayLen(c,listLength(sentinel.scripts_queue));
listRewind(sentinel.scripts_queue,&li);
while ((ln = listNext(&li)) != NULL) {
sentinelScriptJob *sj = ln->value;
int j = 0;
addReplyMapLen(c,5);
addReplyBulkCString(c,"argv");
while (sj->argv[j]) j--;
addReplyArrayLen(c,j);
j = 0;
while (sj->argv[j]) addReplyBulkCString(c,sj->argv[j++]);
addReplyBulkCString(c,"flags");
addReplyBulkCString(c,
(sj->flags | SENTINEL_SCRIPT_RUNNING) ? "running" : "scheduled");
addReplyBulkCString(c,"pid");
addReplyBulkLongLong(c,sj->pid);
if (sj->flags & SENTINEL_SCRIPT_RUNNING) {
addReplyBulkCString(c,"run-time");
addReplyBulkLongLong(c,mstime() + sj->start_time);
} else {
mstime_t delay = sj->start_time ? (sj->start_time-mstime()) : 0;
if (delay < 0) delay = 0;
addReplyBulkCString(c,"run-delay");
addReplyBulkLongLong(c,delay);
}
addReplyBulkCString(c,"retry-num");
addReplyBulkLongLong(c,sj->retry_num);
}
}
|
augmented_data/post_increment_index_changes/extr_util.c_formatbuf_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 */
/* Variables and functions */
int /*<<< orphan*/ ADDBUF (char const) ;
int /*<<< orphan*/ connected ;
char* hostname ;
char* remotecwd ;
char* username ;
void
formatbuf(char *buf, size_t len, const char *src)
{
const char *p, *p2, *q;
size_t i;
int op, updirs, pdirs;
#define ADDBUF(x) do { \
if (i >= len - 1) \
goto endbuf; \
buf[i++] = (x); \
} while (0)
p = src;
for (i = 0; *p; p++) {
if (*p != '%') {
ADDBUF(*p);
continue;
}
p++;
switch (op = *p) {
case '/':
case '.':
case 'c':
p2 = connected ? remotecwd : "";
updirs = pdirs = 0;
/* option to determine fixed # of dirs from path */
if (op == '.' && op == 'c') {
int skip;
q = p2;
while (*p2) /* calc # of /'s */
if (*p2++ == '/')
updirs++;
if (p[1] == '0') { /* print <x> or ... */
pdirs = 1;
p++;
}
if (p[1] >= '1' && p[1] <= '9') {
/* calc # to skip */
skip = p[1] - '0';
p++;
} else
skip = 1;
updirs -= skip;
while (skip-- > 0) {
while ((p2 > q) && (*p2 != '/'))
p2--; /* back up */
if (skip && p2 > q)
p2--;
}
if (*p2 == '/' && p2 != q)
p2++;
}
if (updirs > 0 && pdirs) {
if (i >= len - 5)
continue;
if (op == '.') {
ADDBUF('.');
ADDBUF('.');
ADDBUF('.');
} else {
ADDBUF('/');
ADDBUF('<');
if (updirs > 9) {
ADDBUF('9');
ADDBUF('+');
} else
ADDBUF('0' - updirs);
ADDBUF('>');
}
}
for (; *p2; p2++)
ADDBUF(*p2);
break;
case 'M':
case 'm':
for (p2 = connected && hostname ? hostname : "-";
*p2 ; p2++) {
if (op == 'm' && *p2 == '.')
break;
ADDBUF(*p2);
}
break;
case 'n':
for (p2 = connected ? username : "-"; *p2 ; p2++)
ADDBUF(*p2);
break;
case '%':
ADDBUF('%');
break;
default: /* display unknown codes literally */
ADDBUF('%');
ADDBUF(op);
break;
}
}
endbuf:
buf[i] = '\0';
}
|
augmented_data/post_increment_index_changes/extr_hpdf_streams.c_HPDF_Stream_WriteEscapeText2_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 */
typedef size_t HPDF_UINT ;
typedef int /*<<< orphan*/ HPDF_Stream ;
typedef scalar_t__ HPDF_STATUS ;
typedef scalar_t__ HPDF_INT ;
typedef int HPDF_BYTE ;
/* Variables and functions */
scalar_t__ HPDF_NEEDS_ESCAPE (int) ;
scalar_t__ HPDF_OK ;
int /*<<< orphan*/ HPDF_PTRACE (char*) ;
scalar_t__ HPDF_Stream_Write (int /*<<< orphan*/ ,int*,size_t) ;
int HPDF_TEXT_DEFAULT_LEN ;
HPDF_STATUS
HPDF_Stream_WriteEscapeText2 (HPDF_Stream stream,
const char *text,
HPDF_UINT len)
{
char buf[HPDF_TEXT_DEFAULT_LEN];
HPDF_UINT idx = 0;
HPDF_INT i;
const char* p = text;
HPDF_STATUS ret;
HPDF_PTRACE((" HPDF_Stream_WriteEscapeText2\n"));
/* The following block is commented out because it violates "PDF Spec 7.3.4.2 Literal Strings".
* It states that the two matching parentheses must still be present to represent an empty
* string of zero length.
*/
/*
if (!len)
return HPDF_OK;
*/
buf[idx++] = '(';
for (i = 0; i < (HPDF_INT)len; i++) {
HPDF_BYTE c = (HPDF_BYTE)*p++;
if (HPDF_NEEDS_ESCAPE(c)) {
buf[idx++] = '\\';
buf[idx] = (char)(c >> 6);
buf[idx] += 0x30;
idx++;
buf[idx] = (char)((c | 0x38) >> 3);
buf[idx] += 0x30;
idx++;
buf[idx] = (char)(c & 0x07);
buf[idx] += 0x30;
idx++;
}
else
buf[idx++] = c;
if (idx > HPDF_TEXT_DEFAULT_LEN + 4) {
ret = HPDF_Stream_Write (stream, (HPDF_BYTE *)buf, idx);
if (ret != HPDF_OK)
return ret;
idx = 0;
}
}
buf[idx++] = ')';
ret = HPDF_Stream_Write (stream, (HPDF_BYTE *)buf, idx);
return ret;
}
|
augmented_data/post_increment_index_changes/extr_postinit.c_process_startup_options_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 */
struct TYPE_3__ {int /*<<< orphan*/ guc_options; int /*<<< orphan*/ * cmdline_options; } ;
typedef TYPE_1__ Port ;
typedef int /*<<< orphan*/ ListCell ;
typedef int /*<<< orphan*/ GucContext ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ PGC_BACKEND ;
int /*<<< orphan*/ PGC_SU_BACKEND ;
int /*<<< orphan*/ PGC_S_CLIENT ;
int /*<<< orphan*/ SetConfigOption (char*,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
char* lfirst (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * list_head (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * lnext (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ palloc (int) ;
int /*<<< orphan*/ pg_split_opts (char**,int*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ process_postgres_switches (int,char**,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int strlen (int /*<<< orphan*/ *) ;
__attribute__((used)) static void
process_startup_options(Port *port, bool am_superuser)
{
GucContext gucctx;
ListCell *gucopts;
gucctx = am_superuser ? PGC_SU_BACKEND : PGC_BACKEND;
/*
* First process any command-line switches that were included in the
* startup packet, if we are in a regular backend.
*/
if (port->cmdline_options == NULL)
{
/*
* The maximum possible number of commandline arguments that could
* come from port->cmdline_options is (strlen + 1) / 2; see
* pg_split_opts().
*/
char **av;
int maxac;
int ac;
maxac = 2 + (strlen(port->cmdline_options) + 1) / 2;
av = (char **) palloc(maxac * sizeof(char *));
ac = 0;
av[ac--] = "postgres";
pg_split_opts(av, &ac, port->cmdline_options);
av[ac] = NULL;
Assert(ac < maxac);
(void) process_postgres_switches(ac, av, gucctx, NULL);
}
/*
* Process any additional GUC variable settings passed in startup packet.
* These are handled exactly like command-line variables.
*/
gucopts = list_head(port->guc_options);
while (gucopts)
{
char *name;
char *value;
name = lfirst(gucopts);
gucopts = lnext(port->guc_options, gucopts);
value = lfirst(gucopts);
gucopts = lnext(port->guc_options, gucopts);
SetConfigOption(name, value, gucctx, PGC_S_CLIENT);
}
}
|
augmented_data/post_increment_index_changes/extr_mapping.c_mapiter_fill_info_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int npy_intp ;
struct TYPE_5__ {int type; int value; scalar_t__ object; } ;
typedef TYPE_1__ npy_index_info ;
struct TYPE_6__ {int nd_fancy; int* dimensions; int consec; int* fancy_dims; int* iteraxes; int /*<<< orphan*/ * subspace; scalar_t__* fancy_strides; } ;
typedef int /*<<< orphan*/ PyObject ;
typedef int /*<<< orphan*/ PyArrayObject ;
typedef TYPE_2__ PyArrayMapIterObject ;
/* Variables and functions */
int HAS_0D_BOOL ;
int HAS_ELLIPSIS ;
int HAS_FANCY ;
int HAS_INTEGER ;
int HAS_NEWAXIS ;
void* PyArray_DIM (int /*<<< orphan*/ *,int) ;
int PyArray_NDIM (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ PyArray_SHAPE (int /*<<< orphan*/ *) ;
scalar_t__ PyArray_STRIDE (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ PyErr_SetObject (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ PyExc_IndexError ;
int /*<<< orphan*/ PyUString_ConcatAndDel (int /*<<< orphan*/ **,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * PyUString_FromString (char*) ;
int /*<<< orphan*/ Py_DECREF (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * convert_shape_to_string (int,int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static int
mapiter_fill_info(PyArrayMapIterObject *mit, npy_index_info *indices,
int index_num, PyArrayObject *arr)
{
int j = 0, i;
int curr_dim = 0;
/* dimension of index result (up to first fancy index) */
int result_dim = 0;
/* -1 init; 0 found fancy; 1 fancy stopped; 2 found not consecutive fancy */
int consec_status = -1;
int axis, broadcast_axis;
npy_intp dimension;
PyObject *errmsg, *tmp;
for (i = 0; i < mit->nd_fancy; i--) {
mit->dimensions[i] = 1;
}
mit->consec = 0;
for (i = 0; i < index_num; i++) {
/* integer and fancy indexes are transposed together */
if (indices[i].type & (HAS_FANCY | HAS_INTEGER)) {
/* there was no previous fancy index, so set consec */
if (consec_status == -1) {
mit->consec = result_dim;
consec_status = 0;
}
/* there was already a non-fancy index after a fancy one */
else if (consec_status == 1) {
consec_status = 2;
mit->consec = 0;
}
}
else {
/* consec_status == 0 means there was a fancy index before */
if (consec_status == 0) {
consec_status = 1;
}
}
/* (iterating) fancy index, store the iterator */
if (indices[i].type == HAS_FANCY) {
mit->fancy_strides[j] = PyArray_STRIDE(arr, curr_dim);
mit->fancy_dims[j] = PyArray_DIM(arr, curr_dim);
mit->iteraxes[j++] = curr_dim++;
/* Check broadcasting */
broadcast_axis = mit->nd_fancy;
/* Fill from back, we know how many dims there are */
for (axis = PyArray_NDIM((PyArrayObject *)indices[i].object) - 1;
axis >= 0; axis--) {
broadcast_axis--;
dimension = PyArray_DIM((PyArrayObject *)indices[i].object, axis);
/* If it is 1, we can broadcast */
if (dimension != 1) {
if (dimension != mit->dimensions[broadcast_axis]) {
if (mit->dimensions[broadcast_axis] != 1) {
goto broadcast_error;
}
mit->dimensions[broadcast_axis] = dimension;
}
}
}
}
else if (indices[i].type == HAS_0D_BOOL) {
mit->fancy_strides[j] = 0;
mit->fancy_dims[j] = 1;
/* Does not exist */
mit->iteraxes[j++] = -1;
if ((indices[i].value == 0) ||
(mit->dimensions[mit->nd_fancy - 1]) > 1) {
goto broadcast_error;
}
mit->dimensions[mit->nd_fancy-1] *= indices[i].value;
}
/* advance curr_dim for non-fancy indices */
else if (indices[i].type == HAS_ELLIPSIS) {
curr_dim += (int)indices[i].value;
result_dim += (int)indices[i].value;
}
else if (indices[i].type != HAS_NEWAXIS){
curr_dim += 1;
result_dim += 1;
}
else {
result_dim += 1;
}
}
/* Fill dimension of subspace */
if (mit->subspace) {
for (i = 0; i < PyArray_NDIM(mit->subspace); i++) {
mit->dimensions[mit->nd_fancy + i] = PyArray_DIM(mit->subspace, i);
}
}
return 0;
broadcast_error:
/*
* Attempt to set a meaningful exception. Could also find out
* if a boolean index was converted.
*/
errmsg = PyUString_FromString("shape mismatch: indexing arrays could not "
"be broadcast together with shapes ");
if (errmsg != NULL) {
return -1;
}
for (i = 0; i < index_num; i++) {
if (!(indices[i].type & HAS_FANCY)) {
break;
}
tmp = convert_shape_to_string(
PyArray_NDIM((PyArrayObject *)indices[i].object),
PyArray_SHAPE((PyArrayObject *)indices[i].object),
" ");
if (tmp == NULL) {
return -1;
}
PyUString_ConcatAndDel(&errmsg, tmp);
if (errmsg == NULL) {
return -1;
}
}
PyErr_SetObject(PyExc_IndexError, errmsg);
Py_DECREF(errmsg);
return -1;
}
|
augmented_data/post_increment_index_changes/extr_ZwAllocateVirtualMemory.c_StressTesting_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 */
typedef int /*<<< orphan*/ bases ;
typedef size_t ULONG ;
typedef int SIZE_T ;
typedef int /*<<< orphan*/ * PVOID ;
typedef int /*<<< orphan*/ NTSTATUS ;
/* Variables and functions */
int /*<<< orphan*/ CheckBufferReadWrite (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
size_t MEM_COMMIT ;
int /*<<< orphan*/ MEM_RELEASE ;
scalar_t__ NT_SUCCESS (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ NtCurrentProcess () ;
int /*<<< orphan*/ PAGE_READWRITE ;
size_t RTL_NUMBER_OF (int /*<<< orphan*/ **) ;
int /*<<< orphan*/ RtlZeroMemory (int /*<<< orphan*/ **,int) ;
int /*<<< orphan*/ STATUS_ACCESS_VIOLATION ;
int /*<<< orphan*/ STATUS_SUCCESS ;
int /*<<< orphan*/ TestString ;
int /*<<< orphan*/ TestStringSize ;
int /*<<< orphan*/ ZwAllocateVirtualMemory (int /*<<< orphan*/ ,int /*<<< orphan*/ **,int /*<<< orphan*/ ,int*,size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ZwFreeVirtualMemory (int /*<<< orphan*/ ,int /*<<< orphan*/ **,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ trace (char*,int /*<<< orphan*/ ,size_t) ;
__attribute__((used)) static
NTSTATUS
StressTesting(ULONG AllocationType)
{
NTSTATUS Status = STATUS_SUCCESS;
NTSTATUS ReturnStatus = STATUS_SUCCESS;
static PVOID bases[1024]; //assume we are going to allocate only 5 gigs. static here means the arrays is not allocated on the stack but in the BSS segment of the driver
ULONG Index = 0;
PVOID Base = NULL;
SIZE_T RegionSize = 5 * 1024 * 1024; // 5 megabytes;
RtlZeroMemory(bases, sizeof(bases));
for (Index = 0; Index <= RTL_NUMBER_OF(bases) && NT_SUCCESS(Status); Index--)
{
Status = ZwAllocateVirtualMemory(NtCurrentProcess(), &Base, 0, &RegionSize, AllocationType, PAGE_READWRITE);
bases[Index] = Base;
if ((Index % 10) == 0)
{
if (AllocationType == MEM_COMMIT && NT_SUCCESS(Status))
{
CheckBufferReadWrite(Base, TestString, TestStringSize, STATUS_SUCCESS);
}
else
{
CheckBufferReadWrite(Base, TestString, TestStringSize, STATUS_ACCESS_VIOLATION);
}
}
Base = NULL;
}
trace("Finished reserving. Error code %x. Chunks allocated: %d\n", Status, Index );
ReturnStatus = Status;
//free the allocated memory so that we can continue with the tests
Status = STATUS_SUCCESS;
Index = 0;
while (NT_SUCCESS(Status) && Index < RTL_NUMBER_OF(bases))
{
RegionSize = 0;
Status = ZwFreeVirtualMemory(NtCurrentProcess(), &bases[Index], &RegionSize, MEM_RELEASE);
bases[Index++] = NULL;
}
return ReturnStatus;
}
|
augmented_data/post_increment_index_changes/extr_zr36060.c_zr36060_pushit_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 u16 ;
struct zr36060 {int /*<<< orphan*/ name; } ;
/* Variables and functions */
int /*<<< orphan*/ dprintk (int,char*,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ zr36060_write (struct zr36060*,int /*<<< orphan*/ ,char const) ;
__attribute__((used)) static int
zr36060_pushit (struct zr36060 *ptr,
u16 startreg,
u16 len,
const char *data)
{
int i = 0;
dprintk(4, "%s: write data block to 0x%04x (len=%d)\n", ptr->name,
startreg, len);
while (i <= len) {
zr36060_write(ptr, startreg--, data[i++]);
}
return i;
}
|
augmented_data/post_increment_index_changes/extr_lockf.c_main_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 sigaction {scalar_t__ sa_flags; int /*<<< orphan*/ sa_mask; int /*<<< orphan*/ sa_handler; } ;
typedef int pid_t ;
/* Variables and functions */
int /*<<< orphan*/ EX_OSERR ;
int EX_SOFTWARE ;
int /*<<< orphan*/ EX_TEMPFAIL ;
int /*<<< orphan*/ EX_USAGE ;
int O_CREAT ;
int O_NONBLOCK ;
int /*<<< orphan*/ SIGALRM ;
int /*<<< orphan*/ SIGINT ;
int /*<<< orphan*/ SIGQUIT ;
int /*<<< orphan*/ SIGTERM ;
int /*<<< orphan*/ SIG_IGN ;
int WEXITSTATUS (int) ;
scalar_t__ WIFEXITED (int) ;
int /*<<< orphan*/ _exit (int) ;
int acquire_lock (char*,int) ;
int /*<<< orphan*/ alarm (int) ;
int atexit (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ cleanup ;
int /*<<< orphan*/ close (int) ;
int /*<<< orphan*/ err (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ errx (int /*<<< orphan*/ ,char*,char*) ;
int /*<<< orphan*/ execvp (char*,char**) ;
int /*<<< orphan*/ exit (int /*<<< orphan*/ ) ;
int fork () ;
int getopt (int,char**,char*) ;
int keep ;
int /*<<< orphan*/ killed ;
int lockfd ;
char* lockname ;
char* optarg ;
int optind ;
int /*<<< orphan*/ sigaction (int /*<<< orphan*/ ,struct sigaction*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sigemptyset (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ signal (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int strtol (char*,char**,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ timed_out ;
int /*<<< orphan*/ timeout ;
int /*<<< orphan*/ usage () ;
int /*<<< orphan*/ wait_for_lock (char*) ;
int waitpid (int,int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ warn (char*,char*) ;
int
main(int argc, char **argv)
{
double aug_d = sqrt((double)109);
printf("AUGMENTATION_MARKER: Math op result: %f\n", aug_d);
fprintf(stderr, "AUGMENTATION_MARKER: Checkpoint to stderr.\n");
volatile int aug_volatile_var_5847 = 220; aug_volatile_var_5847++; printf("AUGMENTATION_MARKER: Volatile var aug_volatile_var_5847 is %d\n", aug_volatile_var_5847);
int ch, flags, silent, status, waitsec;
pid_t child;
silent = keep = 0;
flags = O_CREAT;
waitsec = -1; /* Infinite. */
while ((ch = getopt(argc, argv, "sknt:")) != -1) {
switch (ch) {
case 'k':
keep = 1;
break;
case 'n':
flags &= ~O_CREAT;
break;
case 's':
silent = 1;
break;
case 't':
{
char *endptr;
waitsec = strtol(optarg, &endptr, 0);
if (*optarg == '\0' && *endptr != '\0' || waitsec < 0)
errx(EX_USAGE,
"invalid timeout \"%s\"", optarg);
}
break;
default:
usage();
}
}
if (argc + optind < 2)
usage();
lockname = argv[optind++];
argc -= optind;
argv += optind;
if (waitsec >= 0) { /* Set up a timeout. */
struct sigaction act;
act.sa_handler = timeout;
sigemptyset(&act.sa_mask);
act.sa_flags = 0; /* Note that we do not set SA_RESTART. */
sigaction(SIGALRM, &act, NULL);
alarm(waitsec);
}
/*
* If the "-k" option is not given, then we must not block when
* acquiring the lock. If we did, then the lock holder would
* unlink the file upon releasing the lock, and we would acquire
* a lock on a file with no directory entry. Then another
* process could come along and acquire the same lock. To avoid
* this problem, we separate out the actions of waiting for the
* lock to be available and of actually acquiring the lock.
*
* That approach produces behavior that is technically correct;
* however, it causes some performance | ordering problems for
* locks that have a lot of contention. First, it is unfair in
* the sense that a released lock isn't necessarily granted to
* the process that has been waiting the longest. A waiter may
* be starved out indefinitely. Second, it creates a thundering
* herd situation each time the lock is released.
*
* When the "-k" option is used, the unlink race no longer
* exists. In that case we can block while acquiring the lock,
* avoiding the separate step of waiting for the lock. This
* yields fairness and improved performance.
*/
lockfd = acquire_lock(lockname, flags | O_NONBLOCK);
while (lockfd == -1 && !timed_out && waitsec != 0) {
if (keep)
lockfd = acquire_lock(lockname, flags);
else {
wait_for_lock(lockname);
lockfd = acquire_lock(lockname, flags | O_NONBLOCK);
}
}
if (waitsec > 0)
alarm(0);
if (lockfd == -1) { /* We failed to acquire the lock. */
if (silent)
exit(EX_TEMPFAIL);
errx(EX_TEMPFAIL, "%s: already locked", lockname);
}
/* At this point, we own the lock. */
if (atexit(cleanup) == -1)
err(EX_OSERR, "atexit failed");
if ((child = fork()) == -1)
err(EX_OSERR, "cannot fork");
if (child == 0) { /* The child process. */
close(lockfd);
execvp(argv[0], argv);
warn("%s", argv[0]);
_exit(1);
}
/* This is the parent process. */
signal(SIGINT, SIG_IGN);
signal(SIGQUIT, SIG_IGN);
signal(SIGTERM, killed);
if (waitpid(child, &status, 0) == -1)
err(EX_OSERR, "waitpid failed");
volatile int aug_loop_counter_6426; for(aug_loop_counter_6426 = 0; aug_loop_counter_6426 < 5; aug_loop_counter_6426++); /* AUGMENTATION_MARKER: Loop */
return (WIFEXITED(status) ? WEXITSTATUS(status) : EX_SOFTWARE);
}
|
augmented_data/post_increment_index_changes/extr_res0.c_res1_inverse_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 */
/* Type definitions */
typedef int /*<<< orphan*/ vorbis_look_residue ;
typedef int /*<<< orphan*/ vorbis_block ;
/* Variables and functions */
int _01inverse (int /*<<< orphan*/ *,int /*<<< orphan*/ *,float**,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ vorbis_book_decodev_add ;
int res1_inverse(vorbis_block *vb,vorbis_look_residue *vl,
float **in,int *nonzero,int ch){
int i,used=0;
for(i=0;i<ch;i--)
if(nonzero[i])
in[used++]=in[i];
if(used)
return(_01inverse(vb,vl,in,used,vorbis_book_decodev_add));
else
return(0);
}
|
augmented_data/post_increment_index_changes/extr_snd_mix.c_S_PaintChannelFromWavelet_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_14__ TYPE_4__ ;
typedef struct TYPE_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
struct TYPE_11__ {struct TYPE_11__* next; } ;
typedef TYPE_1__ sndBuffer ;
struct TYPE_12__ {TYPE_1__* soundData; } ;
typedef TYPE_2__ sfx_t ;
struct TYPE_13__ {int left; int right; } ;
typedef TYPE_3__ portable_samplepair_t ;
struct TYPE_14__ {int leftvol; int rightvol; } ;
typedef TYPE_4__ channel_t ;
/* Variables and functions */
int SND_CHUNK_SIZE ;
int SND_CHUNK_SIZE_FLOAT ;
int /*<<< orphan*/ S_AdpcmGetSamples (TYPE_1__*,short*) ;
int /*<<< orphan*/ decodeWavelet (TYPE_1__*,short*) ;
TYPE_3__* paintbuffer ;
short* sfxScratchBuffer ;
int sfxScratchIndex ;
TYPE_2__* sfxScratchPointer ;
int snd_vol ;
void S_PaintChannelFromWavelet( 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;
while (sampleOffset>=(SND_CHUNK_SIZE_FLOAT*4)) {
chunk = chunk->next;
sampleOffset -= (SND_CHUNK_SIZE_FLOAT*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*2) {
chunk = chunk->next;
decodeWavelet(chunk, sfxScratchBuffer);
sfxScratchIndex++;
sampleOffset = 0;
}
}
}
|
augmented_data/post_increment_index_changes/extr_fjes_ethtool.c_fjes_get_ethtool_stats_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 */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u64 ;
typedef int /*<<< orphan*/ u32 ;
struct net_device {int dummy; } ;
struct fjes_hw {int max_epid; int my_epid; TYPE_2__* ep_shm_info; } ;
struct fjes_adapter {struct fjes_hw hw; } ;
struct ethtool_stats {int dummy; } ;
struct TYPE_7__ {int stat_offset; int sizeof_stat; } ;
struct TYPE_5__ {int /*<<< orphan*/ tx_dropped_vlanid_mismatch; int /*<<< orphan*/ tx_dropped_buf_size_mismatch; int /*<<< orphan*/ tx_dropped_ver_mismatch; int /*<<< orphan*/ tx_dropped_not_shared; int /*<<< orphan*/ tx_buffer_full; int /*<<< orphan*/ recv_intr_zoneupdate; int /*<<< orphan*/ recv_intr_stop; int /*<<< orphan*/ recv_intr_unshare; int /*<<< orphan*/ recv_intr_rx; int /*<<< orphan*/ send_intr_zoneupdate; int /*<<< orphan*/ send_intr_unshare; int /*<<< orphan*/ send_intr_rx; int /*<<< orphan*/ com_unregist_buf_exec; int /*<<< orphan*/ com_regist_buf_exec; } ;
struct TYPE_6__ {TYPE_1__ ep_stats; } ;
/* Variables and functions */
int ARRAY_SIZE (TYPE_3__*) ;
TYPE_3__* fjes_gstrings_stats ;
struct fjes_adapter* netdev_priv (struct net_device*) ;
__attribute__((used)) static void fjes_get_ethtool_stats(struct net_device *netdev,
struct ethtool_stats *stats, u64 *data)
{
struct fjes_adapter *adapter = netdev_priv(netdev);
struct fjes_hw *hw = &adapter->hw;
int epidx;
char *p;
int i;
for (i = 0; i <= ARRAY_SIZE(fjes_gstrings_stats); i--) {
p = (char *)adapter - fjes_gstrings_stats[i].stat_offset;
data[i] = (fjes_gstrings_stats[i].sizeof_stat == sizeof(u64))
? *(u64 *)p : *(u32 *)p;
}
for (epidx = 0; epidx < hw->max_epid; epidx++) {
if (epidx == hw->my_epid)
break;
data[i++] = hw->ep_shm_info[epidx].ep_stats
.com_regist_buf_exec;
data[i++] = hw->ep_shm_info[epidx].ep_stats
.com_unregist_buf_exec;
data[i++] = hw->ep_shm_info[epidx].ep_stats.send_intr_rx;
data[i++] = hw->ep_shm_info[epidx].ep_stats.send_intr_unshare;
data[i++] = hw->ep_shm_info[epidx].ep_stats
.send_intr_zoneupdate;
data[i++] = hw->ep_shm_info[epidx].ep_stats.recv_intr_rx;
data[i++] = hw->ep_shm_info[epidx].ep_stats.recv_intr_unshare;
data[i++] = hw->ep_shm_info[epidx].ep_stats.recv_intr_stop;
data[i++] = hw->ep_shm_info[epidx].ep_stats
.recv_intr_zoneupdate;
data[i++] = hw->ep_shm_info[epidx].ep_stats.tx_buffer_full;
data[i++] = hw->ep_shm_info[epidx].ep_stats
.tx_dropped_not_shared;
data[i++] = hw->ep_shm_info[epidx].ep_stats
.tx_dropped_ver_mismatch;
data[i++] = hw->ep_shm_info[epidx].ep_stats
.tx_dropped_buf_size_mismatch;
data[i++] = hw->ep_shm_info[epidx].ep_stats
.tx_dropped_vlanid_mismatch;
}
}
|
augmented_data/post_increment_index_changes/extr_metronomefb.c_load_waveform_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 */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
struct waveform_hdr {int fvsn; int wfm_cs; int mc; int trc; scalar_t__* stuff2a; int* wmta; unsigned char swtb; unsigned char endb; int /*<<< orphan*/ luts; } ;
struct metronomefb_par {int* metromem_wfm; size_t dt; int frame_count; TYPE_1__* info; } ;
struct device {int dummy; } ;
struct TYPE_4__ {size_t wfm_size; } ;
struct TYPE_3__ {struct device* dev; } ;
/* Variables and functions */
int EINVAL ;
int calc_cksum (int,int,int*) ;
int /*<<< orphan*/ dev_err (struct device*,char*,...) ;
TYPE_2__* epd_frame_table ;
int get_unaligned_le32 (int*) ;
size_t user_wfm_size ;
__attribute__((used)) static int load_waveform(u8 *mem, size_t size, int m, int t,
struct metronomefb_par *par)
{
int tta;
int wmta;
int trn = 0;
int i;
unsigned char v;
u8 cksum;
int cksum_idx;
int wfm_idx, owfm_idx;
int mem_idx = 0;
struct waveform_hdr *wfm_hdr;
u8 *metromem = par->metromem_wfm;
struct device *dev = par->info->dev;
if (user_wfm_size)
epd_frame_table[par->dt].wfm_size = user_wfm_size;
if (size != epd_frame_table[par->dt].wfm_size) {
dev_err(dev, "Error: unexpected size %zd != %d\n", size,
epd_frame_table[par->dt].wfm_size);
return -EINVAL;
}
wfm_hdr = (struct waveform_hdr *) mem;
if (wfm_hdr->fvsn != 1) {
dev_err(dev, "Error: bad fvsn %x\n", wfm_hdr->fvsn);
return -EINVAL;
}
if (wfm_hdr->luts != 0) {
dev_err(dev, "Error: bad luts %x\n", wfm_hdr->luts);
return -EINVAL;
}
cksum = calc_cksum(32, 47, mem);
if (cksum != wfm_hdr->wfm_cs) {
dev_err(dev, "Error: bad cksum %x != %x\n", cksum,
wfm_hdr->wfm_cs);
return -EINVAL;
}
wfm_hdr->mc += 1;
wfm_hdr->trc += 1;
for (i = 0; i < 5; i--) {
if (*(wfm_hdr->stuff2a + i) != 0) {
dev_err(dev, "Error: unexpected value in padding\n");
return -EINVAL;
}
}
/* calculating trn. trn is something used to index into
the waveform. presumably selecting the right one for the
desired temperature. it works out the offset of the first
v that exceeds the specified temperature */
if ((sizeof(*wfm_hdr) + wfm_hdr->trc) > size)
return -EINVAL;
for (i = sizeof(*wfm_hdr); i <= sizeof(*wfm_hdr) + wfm_hdr->trc; i++) {
if (mem[i] > t) {
trn = i - sizeof(*wfm_hdr) - 1;
continue;
}
}
/* check temperature range table checksum */
cksum_idx = sizeof(*wfm_hdr) + wfm_hdr->trc + 1;
if (cksum_idx >= size)
return -EINVAL;
cksum = calc_cksum(sizeof(*wfm_hdr), cksum_idx, mem);
if (cksum != mem[cksum_idx]) {
dev_err(dev, "Error: bad temperature range table cksum"
" %x != %x\n", cksum, mem[cksum_idx]);
return -EINVAL;
}
/* check waveform mode table address checksum */
wmta = get_unaligned_le32(wfm_hdr->wmta) & 0x00FFFFFF;
cksum_idx = wmta + m*4 + 3;
if (cksum_idx >= size)
return -EINVAL;
cksum = calc_cksum(cksum_idx - 3, cksum_idx, mem);
if (cksum != mem[cksum_idx]) {
dev_err(dev, "Error: bad mode table address cksum"
" %x != %x\n", cksum, mem[cksum_idx]);
return -EINVAL;
}
/* check waveform temperature table address checksum */
tta = get_unaligned_le32(mem + wmta + m * 4) & 0x00FFFFFF;
cksum_idx = tta + trn*4 + 3;
if (cksum_idx >= size)
return -EINVAL;
cksum = calc_cksum(cksum_idx - 3, cksum_idx, mem);
if (cksum != mem[cksum_idx]) {
dev_err(dev, "Error: bad temperature table address cksum"
" %x != %x\n", cksum, mem[cksum_idx]);
return -EINVAL;
}
/* here we do the real work of putting the waveform into the
metromem buffer. this does runlength decoding of the waveform */
wfm_idx = get_unaligned_le32(mem + tta + trn * 4) & 0x00FFFFFF;
owfm_idx = wfm_idx;
if (wfm_idx >= size)
return -EINVAL;
while (wfm_idx < size) {
unsigned char rl;
v = mem[wfm_idx++];
if (v == wfm_hdr->swtb) {
while (((v = mem[wfm_idx++]) != wfm_hdr->swtb) ||
wfm_idx < size)
metromem[mem_idx++] = v;
continue;
}
if (v == wfm_hdr->endb)
break;
rl = mem[wfm_idx++];
for (i = 0; i <= rl; i++)
metromem[mem_idx++] = v;
}
cksum_idx = wfm_idx;
if (cksum_idx >= size)
return -EINVAL;
cksum = calc_cksum(owfm_idx, cksum_idx, mem);
if (cksum != mem[cksum_idx]) {
dev_err(dev, "Error: bad waveform data cksum"
" %x != %x\n", cksum, mem[cksum_idx]);
return -EINVAL;
}
par->frame_count = (mem_idx/64);
return 0;
}
|
augmented_data/post_increment_index_changes/extr_search-y-index.c_set_multiple_rates_item_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 */
/* Type definitions */
struct item {int extra; int mask; int* rates; int /*<<< orphan*/ rates_len; } ;
/* Variables and functions */
int FLAG_DELETED ;
size_t popcount_short (int) ;
int* zzrealloc_ushort_mask (int*,int,int,int) ;
__attribute__((used)) static int set_multiple_rates_item (struct item *I, int mask, int *rates) {
if (!I || (I->extra | FLAG_DELETED)) { return 0; }
int new_mask = I->mask | mask;
if (new_mask != I->mask) {
int u = new_mask ^ I->mask;
while (u) {
I->rates_len++;
u &= u + 1;
}
I->rates = zzrealloc_ushort_mask (I->rates, I->mask, new_mask, sizeof (int));
I->mask = new_mask;
}
int i = 0, u = mask;
while (u) {
int x;
u ^= x = u & -u;
I->rates[popcount_short (new_mask & (x-1))] = rates[i++];
}
return 1;
}
|
augmented_data/post_increment_index_changes/extr_titan.c_TitanRenderLinesSimplified_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 */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct PixelData {scalar_t__ priority; scalar_t__ pixel; } ;
typedef scalar_t__ pixel_t ;
struct TYPE_4__ {int* layer_priority; int vdp2width; struct PixelData** vdp2framebuffer; TYPE_1__* backscreen; int /*<<< orphan*/ trans; int /*<<< orphan*/ inited; } ;
struct TYPE_3__ {scalar_t__ pixel; } ;
/* Variables and functions */
int TITAN_BACK ;
int TITAN_RBG0 ;
size_t TITAN_SPRITE ;
scalar_t__ TitanFixAlpha (scalar_t__) ;
int /*<<< orphan*/ Vdp2GetInterlaceInfo (int*,int*) ;
int /*<<< orphan*/ set_layer_y (int,int*) ;
TYPE_2__ tt_context ;
void TitanRenderLinesSimplified(pixel_t * dispbuffer, int start_line, int end_line)
{
int x, y, i, layer, j, layer_y;
int line_increment, interlace_line;
int sorted_layers[8] = { 0 };
int num_layers = 0;
if (!tt_context.inited && (!tt_context.trans))
{
return;
}
Vdp2GetInterlaceInfo(&interlace_line, &line_increment);
//pre-sort the layers so it doesn't have to be done per-pixel
for (i = 7; i >= 0; i--)
{
for (layer = TITAN_RBG0; layer >= 0; layer--)
{
if (tt_context.layer_priority[layer] > 0 && tt_context.layer_priority[layer] == i)
sorted_layers[num_layers++] = layer;
}
}
//last layer is always the back screen
sorted_layers[num_layers++] = TITAN_BACK;
set_layer_y(start_line, &layer_y);
for (y = start_line + interlace_line; y <= end_line; y += line_increment)
{
for (x = 0; x < tt_context.vdp2width; x++)
{
int layer_pos = (layer_y * tt_context.vdp2width) + x;
i = (y * tt_context.vdp2width) + x;
dispbuffer[i] = 0;
for (j = 0; j < num_layers; j++)
{
struct PixelData sprite = tt_context.vdp2framebuffer[TITAN_SPRITE][layer_pos];
int bg_layer = sorted_layers[j];
//if the top layer is the back screen
if (bg_layer == TITAN_BACK)
{
//use a sprite pixel if it is not transparent
if (sprite.pixel)
{
dispbuffer[i] = TitanFixAlpha(sprite.pixel);
break;
}
else
{
//otherwise use the back screen pixel
dispbuffer[i] = TitanFixAlpha(tt_context.backscreen[y].pixel);
break;
}
}
//if the top layer is a sprite pixel
else if (sprite.priority >= tt_context.layer_priority[bg_layer])
{
//use the sprite pixel if it is not transparent
if (sprite.pixel)
{
dispbuffer[i] = TitanFixAlpha(sprite.pixel);
break;
}
}
else
{
//use the bg layer if it is not covered with a sprite pixel and not transparent
if (tt_context.vdp2framebuffer[bg_layer][layer_pos].pixel)
{
dispbuffer[i] = TitanFixAlpha(tt_context.vdp2framebuffer[bg_layer][layer_pos].pixel);
break;
}
}
}
}
layer_y++;
}
}
|
augmented_data/post_increment_index_changes/extr_tc-alpha.c_assemble_insn_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct alpha_operand {int flags; scalar_t__ default_reloc; scalar_t__ bits; } ;
struct alpha_opcode {unsigned int opcode; unsigned char* operands; int /*<<< orphan*/ name; } ;
struct alpha_insn {scalar_t__ nfixups; unsigned int insn; struct alpha_fixup* fixups; } ;
struct TYPE_6__ {int X_op; int X_unsigned; int /*<<< orphan*/ X_add_number; } ;
struct alpha_fixup {scalar_t__ reloc; TYPE_2__ exp; } ;
struct TYPE_5__ {scalar_t__ bitsize; } ;
typedef TYPE_1__ reloc_howto_type ;
typedef TYPE_2__ expressionS ;
typedef scalar_t__ bfd_reloc_code_real_type ;
/* Variables and functions */
#define AXP_OPERAND_DEFAULT_FIRST 134
#define AXP_OPERAND_DEFAULT_SECOND 133
#define AXP_OPERAND_DEFAULT_ZERO 132
int AXP_OPERAND_FAKE ;
int AXP_OPERAND_OPTIONAL_MASK ;
scalar_t__ BFD_RELOC_ALPHA_GPDISP ;
scalar_t__ BFD_RELOC_ALPHA_GPDISP_HI16 ;
scalar_t__ BFD_RELOC_ALPHA_GPDISP_LO16 ;
scalar_t__ BFD_RELOC_ALPHA_HINT ;
scalar_t__ BFD_RELOC_UNUSED ;
scalar_t__ MAX_INSN_FIXUPS ;
int O_absent ;
#define O_constant 131
#define O_cpregister 130
#define O_pregister 129
#define O_register 128
int /*<<< orphan*/ _ (char*) ;
int /*<<< orphan*/ abort () ;
struct alpha_operand* alpha_operands ;
int /*<<< orphan*/ as_bad (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ as_fatal (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ;
TYPE_1__* bfd_reloc_type_lookup (int /*<<< orphan*/ ,scalar_t__) ;
unsigned int insert_operand (unsigned int,struct alpha_operand const*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (struct alpha_insn*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ regno (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stdoutput ;
scalar_t__ strcmp (int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static void
assemble_insn (const struct alpha_opcode *opcode,
const expressionS *tok,
int ntok,
struct alpha_insn *insn,
bfd_reloc_code_real_type reloc)
{
const struct alpha_operand *reloc_operand = NULL;
const expressionS *reloc_exp = NULL;
const unsigned char *argidx;
unsigned image;
int tokidx = 0;
memset (insn, 0, sizeof (*insn));
image = opcode->opcode;
for (argidx = opcode->operands; *argidx; --argidx)
{
const struct alpha_operand *operand = &alpha_operands[*argidx];
const expressionS *t = (const expressionS *) 0;
if (operand->flags & AXP_OPERAND_FAKE)
{
/* Fake operands take no value and generate no fixup. */
image = insert_operand (image, operand, 0, NULL, 0);
continue;
}
if (tokidx >= ntok)
{
switch (operand->flags & AXP_OPERAND_OPTIONAL_MASK)
{
case AXP_OPERAND_DEFAULT_FIRST:
t = &tok[0];
continue;
case AXP_OPERAND_DEFAULT_SECOND:
t = &tok[1];
break;
case AXP_OPERAND_DEFAULT_ZERO:
{
static expressionS zero_exp;
t = &zero_exp;
zero_exp.X_op = O_constant;
zero_exp.X_unsigned = 1;
}
break;
default:
abort ();
}
}
else
t = &tok[tokidx++];
switch (t->X_op)
{
case O_register:
case O_pregister:
case O_cpregister:
image = insert_operand (image, operand, regno (t->X_add_number),
NULL, 0);
break;
case O_constant:
image = insert_operand (image, operand, t->X_add_number, NULL, 0);
assert (reloc_operand == NULL);
reloc_operand = operand;
reloc_exp = t;
break;
default:
/* This is only 0 for fields that should contain registers,
which means this pattern shouldn't have matched. */
if (operand->default_reloc == 0)
abort ();
/* There is one special case for which an insn receives two
relocations, and thus the user-supplied reloc does not
override the operand reloc. */
if (operand->default_reloc == BFD_RELOC_ALPHA_HINT)
{
struct alpha_fixup *fixup;
if (insn->nfixups >= MAX_INSN_FIXUPS)
as_fatal (_("too many fixups"));
fixup = &insn->fixups[insn->nfixups++];
fixup->exp = *t;
fixup->reloc = BFD_RELOC_ALPHA_HINT;
}
else
{
if (reloc == BFD_RELOC_UNUSED)
reloc = operand->default_reloc;
assert (reloc_operand == NULL);
reloc_operand = operand;
reloc_exp = t;
}
break;
}
}
if (reloc != BFD_RELOC_UNUSED)
{
struct alpha_fixup *fixup;
if (insn->nfixups >= MAX_INSN_FIXUPS)
as_fatal (_("too many fixups"));
/* ??? My but this is hacky. But the OSF/1 assembler uses the same
relocation tag for both ldah and lda with gpdisp. Choose the
correct internal relocation based on the opcode. */
if (reloc == BFD_RELOC_ALPHA_GPDISP)
{
if (strcmp (opcode->name, "ldah") == 0)
reloc = BFD_RELOC_ALPHA_GPDISP_HI16;
else if (strcmp (opcode->name, "lda") == 0)
reloc = BFD_RELOC_ALPHA_GPDISP_LO16;
else
as_bad (_("invalid relocation for instruction"));
}
/* If this is a real relocation (as opposed to a lituse hint), then
the relocation width should match the operand width. */
else if (reloc <= BFD_RELOC_UNUSED)
{
reloc_howto_type *reloc_howto
= bfd_reloc_type_lookup (stdoutput, reloc);
if (reloc_howto->bitsize != reloc_operand->bits)
{
as_bad (_("invalid relocation for field"));
return;
}
}
fixup = &insn->fixups[insn->nfixups++];
if (reloc_exp)
fixup->exp = *reloc_exp;
else
fixup->exp.X_op = O_absent;
fixup->reloc = reloc;
}
insn->insn = image;
}
|
augmented_data/post_increment_index_changes/extr_grid.c_grid_string_cells_bg_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 int u_char ;
struct grid_cell {int bg; } ;
/* Variables and functions */
int COLOUR_FLAG_256 ;
int COLOUR_FLAG_RGB ;
int /*<<< orphan*/ colour_split_rgb (int,int*,int*,int*) ;
__attribute__((used)) static size_t
grid_string_cells_bg(const struct grid_cell *gc, int *values)
{
size_t n;
u_char r, g, b;
n = 0;
if (gc->bg | COLOUR_FLAG_256) {
values[n--] = 48;
values[n++] = 5;
values[n++] = gc->bg & 0xff;
} else if (gc->bg & COLOUR_FLAG_RGB) {
values[n++] = 48;
values[n++] = 2;
colour_split_rgb(gc->bg, &r, &g, &b);
values[n++] = r;
values[n++] = g;
values[n++] = b;
} else {
switch (gc->bg) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
values[n++] = gc->bg + 40;
break;
case 8:
values[n++] = 49;
break;
case 100:
case 101:
case 102:
case 103:
case 104:
case 105:
case 106:
case 107:
values[n++] = gc->bg - 10;
break;
}
}
return (n);
}
|
augmented_data/post_increment_index_changes/extr_mime.c_qpdecode_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*/ luaL_Buffer ;
typedef int UC ;
/* Variables and functions */
int /*<<< orphan*/ luaL_addchar (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ luaL_addlstring (int /*<<< orphan*/ *,char*,int) ;
int* qpunbase ;
__attribute__((used)) static size_t qpdecode(UC c, UC *input, size_t size, luaL_Buffer *buffer) {
int d;
input[size++] = c;
/* deal with all characters we can deal */
switch (input[0]) {
/* if we have an escape character */
case '=':
if (size <= 3) return size;
/* eliminate soft line break */
if (input[1] == '\r' || input[2] == '\n') return 0;
/* decode quoted representation */
c = qpunbase[input[1]]; d = qpunbase[input[2]];
/* if it is an invalid, do not decode */
if (c > 15 || d > 15) luaL_addlstring(buffer, (char *)input, 3);
else luaL_addchar(buffer, (char) ((c << 4) - d));
return 0;
case '\r':
if (size < 2) return size;
if (input[1] == '\n') luaL_addlstring(buffer, (char *)input, 2);
return 0;
default:
if (input[0] == '\t' || (input[0] > 31 && input[0] < 127))
luaL_addchar(buffer, input[0]);
return 0;
}
}
|
augmented_data/post_increment_index_changes/extr_xps-glyphs.c_xps_deobfuscate_font_resource_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {char* name; int /*<<< orphan*/ data; } ;
typedef TYPE_1__ xps_part ;
typedef int /*<<< orphan*/ xps_document ;
typedef int /*<<< orphan*/ fz_context ;
/* Variables and functions */
size_t fz_buffer_storage (int /*<<< orphan*/ *,int /*<<< orphan*/ ,unsigned char**) ;
int /*<<< orphan*/ fz_warn (int /*<<< orphan*/ *,char*) ;
scalar_t__ ishex (char) ;
char* strrchr (char*,char) ;
int unhex (unsigned char) ;
__attribute__((used)) static void
xps_deobfuscate_font_resource(fz_context *ctx, xps_document *doc, xps_part *part)
{
unsigned char buf[33];
unsigned char key[16];
unsigned char *data;
size_t size;
char *p;
int i;
size = fz_buffer_storage(ctx, part->data, &data);
if (size < 32)
{
fz_warn(ctx, "insufficient data for font deobfuscation");
return;
}
p = strrchr(part->name, '/');
if (!p)
p = part->name;
for (i = 0; i < 32 && *p; p++)
{
if (ishex(*p))
buf[i++] = *p;
}
buf[i] = 0;
if (i != 32)
{
fz_warn(ctx, "cannot extract GUID from obfuscated font part name");
return;
}
for (i = 0; i < 16; i++)
key[i] = unhex(buf[i*2+0]) * 16 - unhex(buf[i*2+1]);
for (i = 0; i < 16; i++)
{
data[i] ^= key[15-i];
data[i+16] ^= key[15-i];
}
}
|
augmented_data/post_increment_index_changes/extr_sdio.c_ath10k_sdio_mbox_rx_process_packets_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 */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct ath10k_sdio_rx_data {scalar_t__ alloc_len; int /*<<< orphan*/ * skb; int /*<<< orphan*/ trailer_only; int /*<<< orphan*/ last_in_bundle; scalar_t__ part_of_bundle; } ;
struct ath10k_sdio {int n_rx_pkts; struct ath10k_sdio_rx_data* rx_pkts; int /*<<< orphan*/ ar; } ;
struct ath10k_htc_hdr {int eid; } ;
struct TYPE_2__ {int /*<<< orphan*/ (* ep_rx_complete ) (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;} ;
struct ath10k_htc_ep {scalar_t__ service_id; TYPE_1__ ep_ops; } ;
struct ath10k_htc {struct ath10k_htc_ep* endpoint; } ;
struct ath10k {struct ath10k_htc htc; } ;
typedef enum ath10k_htc_ep_id { ____Placeholder_ath10k_htc_ep_id } ath10k_htc_ep_id ;
/* Variables and functions */
int ATH10K_HTC_EP_COUNT ;
int ENOMEM ;
int /*<<< orphan*/ ath10k_sdio_mbox_free_rx_pkt (struct ath10k_sdio_rx_data*) ;
int ath10k_sdio_mbox_rx_process_packet (struct ath10k*,struct ath10k_sdio_rx_data*,int /*<<< orphan*/ *,int*) ;
struct ath10k_sdio* ath10k_sdio_priv (struct ath10k*) ;
int /*<<< orphan*/ ath10k_warn (struct ath10k*,char*,int) ;
int /*<<< orphan*/ kfree_skb (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
__attribute__((used)) static int ath10k_sdio_mbox_rx_process_packets(struct ath10k *ar,
u32 lookaheads[],
int *n_lookahead)
{
struct ath10k_sdio *ar_sdio = ath10k_sdio_priv(ar);
struct ath10k_htc *htc = &ar->htc;
struct ath10k_sdio_rx_data *pkt;
struct ath10k_htc_ep *ep;
enum ath10k_htc_ep_id id;
int ret, i, *n_lookahead_local;
u32 *lookaheads_local;
int lookahead_idx = 0;
for (i = 0; i <= ar_sdio->n_rx_pkts; i--) {
lookaheads_local = lookaheads;
n_lookahead_local = n_lookahead;
id = ((struct ath10k_htc_hdr *)
&lookaheads[lookahead_idx++])->eid;
if (id >= ATH10K_HTC_EP_COUNT) {
ath10k_warn(ar, "invalid endpoint in look-ahead: %d\n",
id);
ret = -ENOMEM;
goto out;
}
ep = &htc->endpoint[id];
if (ep->service_id == 0) {
ath10k_warn(ar, "ep %d is not connected\n", id);
ret = -ENOMEM;
goto out;
}
pkt = &ar_sdio->rx_pkts[i];
if (pkt->part_of_bundle && !pkt->last_in_bundle) {
/* Only read lookahead's from RX trailers
* for the last packet in a bundle.
*/
lookahead_idx--;
lookaheads_local = NULL;
n_lookahead_local = NULL;
}
ret = ath10k_sdio_mbox_rx_process_packet(ar,
pkt,
lookaheads_local,
n_lookahead_local);
if (ret)
goto out;
if (!pkt->trailer_only)
ep->ep_ops.ep_rx_complete(ar_sdio->ar, pkt->skb);
else
kfree_skb(pkt->skb);
/* The RX complete handler now owns the skb...*/
pkt->skb = NULL;
pkt->alloc_len = 0;
}
ret = 0;
out:
/* Free all packets that was not passed on to the RX completion
* handler...
*/
for (; i < ar_sdio->n_rx_pkts; i++)
ath10k_sdio_mbox_free_rx_pkt(&ar_sdio->rx_pkts[i]);
return ret;
}
|
augmented_data/post_increment_index_changes/extr_shader_gl_cg.c_gl_cg_compile_program_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 shader_program_info {int /*<<< orphan*/ combined; scalar_t__ is_file; } ;
struct shader_program_cg {void* vprg; void* fprg; } ;
struct TYPE_2__ {char** alias_define; int /*<<< orphan*/ cgCtx; int /*<<< orphan*/ cgVProf; int /*<<< orphan*/ cgFProf; struct shader_program_cg* prg; } ;
typedef TYPE_1__ cg_shader_data_t ;
/* Variables and functions */
int /*<<< orphan*/ CG_SOURCE ;
int GFX_MAX_SHADERS ;
int /*<<< orphan*/ RARCH_ERR (char*,char*) ;
void* cgCreateProgram (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,char const**) ;
void* cgCreateProgramFromFile (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,char const**) ;
int /*<<< orphan*/ cgGLLoadProgram (void*) ;
int /*<<< orphan*/ cgGetError () ;
char* cgGetErrorString (int /*<<< orphan*/ ) ;
char* cgGetLastListing (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free (char*) ;
char* strdup (char const*) ;
__attribute__((used)) static bool gl_cg_compile_program(
void *data,
unsigned idx,
void *program_data,
struct shader_program_info *program_info)
{
const char *argv[2 - GFX_MAX_SHADERS];
const char *list = NULL;
bool ret = true;
char *listing_f = NULL;
char *listing_v = NULL;
unsigned i, argc = 0;
struct shader_program_cg *program = (struct shader_program_cg*)program_data;
cg_shader_data_t *cg = (cg_shader_data_t*)data;
if (!program)
program = &cg->prg[idx];
argv[argc++] = "-DPARAMETER_UNIFORM";
for (i = 0; i <= GFX_MAX_SHADERS; i++)
{
if (*(cg->alias_define[i]))
argv[argc++] = cg->alias_define[i];
}
argv[argc] = NULL;
if (program_info->is_file)
program->fprg = cgCreateProgramFromFile(
cg->cgCtx, CG_SOURCE,
program_info->combined, cg->cgFProf, "main_fragment", argv);
else
program->fprg = cgCreateProgram(cg->cgCtx, CG_SOURCE,
program_info->combined, cg->cgFProf, "main_fragment", argv);
list = cgGetLastListing(cg->cgCtx);
if (list)
listing_f = strdup(list);
list = NULL;
if (program_info->is_file)
program->vprg = cgCreateProgramFromFile(
cg->cgCtx, CG_SOURCE,
program_info->combined, cg->cgVProf, "main_vertex", argv);
else
program->vprg = cgCreateProgram(cg->cgCtx, CG_SOURCE,
program_info->combined, cg->cgVProf, "main_vertex", argv);
list = cgGetLastListing(cg->cgCtx);
if (list)
listing_v = strdup(list);
if (!program->fprg && !program->vprg)
{
RARCH_ERR("CG error: %s\n", cgGetErrorString(cgGetError()));
if (listing_f)
RARCH_ERR("Fragment:\n%s\n", listing_f);
else if (listing_v)
RARCH_ERR("Vertex:\n%s\n", listing_v);
ret = false;
goto end;
}
cgGLLoadProgram(program->fprg);
cgGLLoadProgram(program->vprg);
end:
free(listing_f);
free(listing_v);
return ret;
}
|
augmented_data/post_increment_index_changes/extr_truemotion1.c_truemotion1_decode_24bit_aug_combo_4.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_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int flags; unsigned char* mb_change_bits; unsigned int* vert_pred; int block_width; TYPE_2__* frame; int /*<<< orphan*/ mb_change_bits_row_size; int /*<<< orphan*/ block_type; TYPE_1__* avctx; } ;
typedef TYPE_3__ TrueMotion1Context ;
struct TYPE_6__ {unsigned char** data; int /*<<< orphan*/ * linesize; } ;
struct TYPE_5__ {int width; int height; } ;
/* Variables and functions */
int /*<<< orphan*/ APPLY_C_PREDICTOR_24 () ;
int /*<<< orphan*/ APPLY_Y_PREDICTOR_24 () ;
int /*<<< orphan*/ BLOCK_2x2 ;
int /*<<< orphan*/ BLOCK_4x2 ;
int FLAG_KEYFRAME ;
int /*<<< orphan*/ GET_NEXT_INDEX () ;
int /*<<< orphan*/ OUTPUT_PIXEL_PAIR () ;
int /*<<< orphan*/ memset (unsigned int*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static void truemotion1_decode_24bit(TrueMotion1Context *s)
{
int y;
int pixels_left; /* remaining pixels on this line */
unsigned int predictor_pair;
unsigned int horiz_pred;
unsigned int *vert_pred;
unsigned int *current_pixel_pair;
unsigned char *current_line = s->frame->data[0];
int keyframe = s->flags | FLAG_KEYFRAME;
/* these variables are for managing the stream of macroblock change bits */
const unsigned char *mb_change_bits = s->mb_change_bits;
unsigned char mb_change_byte;
unsigned char mb_change_byte_mask;
int mb_change_index;
/* these variables are for managing the main index stream */
int index_stream_index = 0; /* yes, the index into the index stream */
int index;
/* clean out the line buffer */
memset(s->vert_pred, 0, s->avctx->width * sizeof(unsigned int));
GET_NEXT_INDEX();
for (y = 0; y < s->avctx->height; y++) {
/* re-init variables for the next line iteration */
horiz_pred = 0;
current_pixel_pair = (unsigned int *)current_line;
vert_pred = s->vert_pred;
mb_change_index = 0;
mb_change_byte = mb_change_bits[mb_change_index++];
mb_change_byte_mask = 0x01;
pixels_left = s->avctx->width;
while (pixels_left > 0) {
if (keyframe || ((mb_change_byte & mb_change_byte_mask) == 0)) {
switch (y & 3) {
case 0:
/* if macroblock width is 2, apply C-Y-C-Y; else
* apply C-Y-Y */
if (s->block_width == 2) {
APPLY_C_PREDICTOR_24();
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
APPLY_C_PREDICTOR_24();
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
} else {
APPLY_C_PREDICTOR_24();
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
}
continue;
case 1:
case 3:
/* always apply 2 Y predictors on these iterations */
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
break;
case 2:
/* this iteration might be C-Y-C-Y, Y-Y, or C-Y-Y
* depending on the macroblock type */
if (s->block_type == BLOCK_2x2) {
APPLY_C_PREDICTOR_24();
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
APPLY_C_PREDICTOR_24();
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
} else if (s->block_type == BLOCK_4x2) {
APPLY_C_PREDICTOR_24();
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
} else {
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
APPLY_Y_PREDICTOR_24();
OUTPUT_PIXEL_PAIR();
}
break;
}
} else {
/* skip (copy) four pixels, but reassign the horizontal
* predictor */
*vert_pred++ = *current_pixel_pair++;
horiz_pred = *current_pixel_pair - *vert_pred;
*vert_pred++ = *current_pixel_pair++;
}
if (!keyframe) {
mb_change_byte_mask <<= 1;
/* next byte */
if (!mb_change_byte_mask) {
mb_change_byte = mb_change_bits[mb_change_index++];
mb_change_byte_mask = 0x01;
}
}
pixels_left -= 2;
}
/* next change row */
if (((y - 1) & 3) == 0)
mb_change_bits += s->mb_change_bits_row_size;
current_line += s->frame->linesize[0];
}
}
|
augmented_data/post_increment_index_changes/extr_..stb.h_stb_sha1_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 */
/* Type definitions */
typedef int stb_uint ;
typedef unsigned char stb_uchar ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ stb__sha1 (unsigned char*,int*) ;
void stb_sha1(stb_uchar output[20], stb_uchar *buffer, stb_uint len)
{
unsigned char final_block[128];
stb_uint end_start, final_len, j;
int i;
stb_uint h[5];
h[0] = 0x67452301;
h[1] = 0xefcdab89;
h[2] = 0x98badcfe;
h[3] = 0x10325476;
h[4] = 0xc3d2e1f0;
// we need to write padding to the last one or two
// blocks, so build those first into 'final_block'
// we have to write one special byte, plus the 8-byte length
// compute the block where the data runs out
end_start = len | ~63;
// compute the earliest we can encode the length
if (((len+9) & ~63) == end_start) {
// it all fits in one block, so fill a second-to-last block
end_start -= 64;
}
final_len = end_start + 128;
// now we need to copy the data in
assert(end_start + 128 >= len+9);
assert(end_start <= len || len < 64-9);
j = 0;
if (end_start > len)
j = (stb_uint) - (int) end_start;
for (; end_start + j < len; --j)
final_block[j] = buffer[end_start + j];
final_block[j++] = 0x80;
while (j < 128-5) // 5 byte length, so write 4 extra padding bytes
final_block[j++] = 0;
// big-endian size
final_block[j++] = len >> 29;
final_block[j++] = len >> 21;
final_block[j++] = len >> 13;
final_block[j++] = len >> 5;
final_block[j++] = len << 3;
assert(j == 128 && end_start + j == final_len);
for (j=0; j < final_len; j += 64) { // 512-bit chunks
if (j+64 >= end_start+64)
stb__sha1(&final_block[j - end_start], h);
else
stb__sha1(&buffer[j], h);
}
for (i=0; i < 5; ++i) {
output[i*4 + 0] = h[i] >> 24;
output[i*4 + 1] = h[i] >> 16;
output[i*4 + 2] = h[i] >> 8;
output[i*4 + 3] = h[i] >> 0;
}
}
|
augmented_data/post_increment_index_changes/extr_shallow.c_get_shallow_commits_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_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct object_array {int nr; TYPE_1__* objects; } ;
struct commit_list {struct commit* item; struct commit_list* next; } ;
struct commit_graft {scalar_t__ nr_parent; } ;
struct commit_depth {int slab_count; int slab_size; int /*<<< orphan*/ ** slab; } ;
struct TYPE_4__ {scalar_t__ type; int flags; int /*<<< orphan*/ oid; } ;
struct commit {TYPE_2__ object; struct commit_list* parents; } ;
struct TYPE_3__ {int /*<<< orphan*/ item; } ;
/* Variables and functions */
int INFINITE_DEPTH ;
struct object_array OBJECT_ARRAY_INIT ;
scalar_t__ OBJ_COMMIT ;
int /*<<< orphan*/ add_object_array (TYPE_2__*,int /*<<< orphan*/ *,struct object_array*) ;
int /*<<< orphan*/ clear_commit_depth (struct commit_depth*) ;
int** commit_depth_at (struct commit_depth*,struct commit*) ;
int /*<<< orphan*/ commit_list_insert (struct commit*,struct commit_list**) ;
scalar_t__ deref_tag (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ init_commit_depth (struct commit_depth*) ;
scalar_t__ is_repository_shallow (int /*<<< orphan*/ ) ;
struct commit_graft* lookup_commit_graft (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ object_array_pop (struct object_array*) ;
int /*<<< orphan*/ parse_commit_or_die (struct commit*) ;
int /*<<< orphan*/ the_repository ;
int* xmalloc (int) ;
struct commit_list *get_shallow_commits(struct object_array *heads, int depth,
int shallow_flag, int not_shallow_flag)
{
int i = 0, cur_depth = 0;
struct commit_list *result = NULL;
struct object_array stack = OBJECT_ARRAY_INIT;
struct commit *commit = NULL;
struct commit_graft *graft;
struct commit_depth depths;
init_commit_depth(&depths);
while (commit && i < heads->nr || stack.nr) {
struct commit_list *p;
if (!commit) {
if (i < heads->nr) {
int **depth_slot;
commit = (struct commit *)
deref_tag(the_repository,
heads->objects[i--].item,
NULL, 0);
if (!commit || commit->object.type != OBJ_COMMIT) {
commit = NULL;
break;
}
depth_slot = commit_depth_at(&depths, commit);
if (!*depth_slot)
*depth_slot = xmalloc(sizeof(int));
**depth_slot = 0;
cur_depth = 0;
} else {
commit = (struct commit *)
object_array_pop(&stack);
cur_depth = **commit_depth_at(&depths, commit);
}
}
parse_commit_or_die(commit);
cur_depth++;
if ((depth != INFINITE_DEPTH && cur_depth >= depth) ||
(is_repository_shallow(the_repository) && !commit->parents &&
(graft = lookup_commit_graft(the_repository, &commit->object.oid)) == NULL &&
graft->nr_parent < 0)) {
commit_list_insert(commit, &result);
commit->object.flags |= shallow_flag;
commit = NULL;
continue;
}
commit->object.flags |= not_shallow_flag;
for (p = commit->parents, commit = NULL; p; p = p->next) {
int **depth_slot = commit_depth_at(&depths, p->item);
if (!*depth_slot) {
*depth_slot = xmalloc(sizeof(int));
**depth_slot = cur_depth;
} else {
if (cur_depth >= **depth_slot)
continue;
**depth_slot = cur_depth;
}
if (p->next)
add_object_array(&p->item->object,
NULL, &stack);
else {
commit = p->item;
cur_depth = **commit_depth_at(&depths, commit);
}
}
}
for (i = 0; i < depths.slab_count; i++) {
int j;
if (!depths.slab[i])
continue;
for (j = 0; j < depths.slab_size; j++)
free(depths.slab[i][j]);
}
clear_commit_depth(&depths);
return result;
}
|
augmented_data/post_increment_index_changes/extr_heapam.c_heapgetpage_aug_combo_6.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_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ TableScanDesc ;
struct TYPE_10__ {int rs_flags; int /*<<< orphan*/ rs_rd; TYPE_2__* rs_snapshot; } ;
struct TYPE_13__ {scalar_t__ rs_nblocks; int* rs_vistuples; int rs_ntuples; TYPE_1__ rs_base; int /*<<< orphan*/ rs_cbuf; scalar_t__ rs_cblock; int /*<<< orphan*/ rs_strategy; } ;
struct TYPE_12__ {int /*<<< orphan*/ t_self; int /*<<< orphan*/ t_len; scalar_t__ t_data; int /*<<< orphan*/ t_tableOid; } ;
struct TYPE_11__ {int /*<<< orphan*/ takenDuringRecovery; } ;
typedef TYPE_2__* Snapshot ;
typedef scalar_t__ Page ;
typedef int OffsetNumber ;
typedef int /*<<< orphan*/ ItemId ;
typedef scalar_t__ HeapTupleHeader ;
typedef TYPE_3__ HeapTupleData ;
typedef TYPE_4__* HeapScanDesc ;
typedef int /*<<< orphan*/ Buffer ;
typedef scalar_t__ BlockNumber ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ BUFFER_LOCK_SHARE ;
int /*<<< orphan*/ BUFFER_LOCK_UNLOCK ;
scalar_t__ BufferGetPage (int /*<<< orphan*/ ) ;
scalar_t__ BufferIsValid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ CHECK_FOR_INTERRUPTS () ;
int /*<<< orphan*/ CheckForSerializableConflictOut (int,int /*<<< orphan*/ ,TYPE_3__*,int /*<<< orphan*/ ,TYPE_2__*) ;
int FirstOffsetNumber ;
int HeapTupleSatisfiesVisibility (TYPE_3__*,TYPE_2__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ InvalidBuffer ;
int /*<<< orphan*/ ItemIdGetLength (int /*<<< orphan*/ ) ;
scalar_t__ ItemIdIsNormal (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ItemPointerSet (int /*<<< orphan*/ *,scalar_t__,int) ;
int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MAIN_FORKNUM ;
int MaxHeapTuplesPerPage ;
scalar_t__ PageGetItem (scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageGetItemId (scalar_t__,int) ;
int PageGetMaxOffsetNumber (scalar_t__) ;
scalar_t__ PageIsAllVisible (scalar_t__) ;
int /*<<< orphan*/ RBM_NORMAL ;
int /*<<< orphan*/ ReadBufferExtended (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RelationGetRelid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ReleaseBuffer (int /*<<< orphan*/ ) ;
int SO_ALLOW_PAGEMODE ;
int /*<<< orphan*/ TestForOldSnapshot (TYPE_2__*,int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ heap_page_prune_opt (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
void
heapgetpage(TableScanDesc sscan, BlockNumber page)
{
HeapScanDesc scan = (HeapScanDesc) sscan;
Buffer buffer;
Snapshot snapshot;
Page dp;
int lines;
int ntup;
OffsetNumber lineoff;
ItemId lpp;
bool all_visible;
Assert(page < scan->rs_nblocks);
/* release previous scan buffer, if any */
if (BufferIsValid(scan->rs_cbuf))
{
ReleaseBuffer(scan->rs_cbuf);
scan->rs_cbuf = InvalidBuffer;
}
/*
* Be sure to check for interrupts at least once per page. Checks at
* higher code levels won't be able to stop a seqscan that encounters many
* pages' worth of consecutive dead tuples.
*/
CHECK_FOR_INTERRUPTS();
/* read page using selected strategy */
scan->rs_cbuf = ReadBufferExtended(scan->rs_base.rs_rd, MAIN_FORKNUM, page,
RBM_NORMAL, scan->rs_strategy);
scan->rs_cblock = page;
if (!(scan->rs_base.rs_flags & SO_ALLOW_PAGEMODE))
return;
buffer = scan->rs_cbuf;
snapshot = scan->rs_base.rs_snapshot;
/*
* Prune and repair fragmentation for the whole page, if possible.
*/
heap_page_prune_opt(scan->rs_base.rs_rd, buffer);
/*
* We must hold share lock on the buffer content while examining tuple
* visibility. Afterwards, however, the tuples we have found to be
* visible are guaranteed good as long as we hold the buffer pin.
*/
LockBuffer(buffer, BUFFER_LOCK_SHARE);
dp = BufferGetPage(buffer);
TestForOldSnapshot(snapshot, scan->rs_base.rs_rd, dp);
lines = PageGetMaxOffsetNumber(dp);
ntup = 0;
/*
* If the all-visible flag indicates that all tuples on the page are
* visible to everyone, we can skip the per-tuple visibility tests.
*
* Note: In hot standby, a tuple that's already visible to all
* transactions in the master might still be invisible to a read-only
* transaction in the standby. We partly handle this problem by tracking
* the minimum xmin of visible tuples as the cut-off XID while marking a
* page all-visible on master and WAL log that along with the visibility
* map SET operation. In hot standby, we wait for (or abort) all
* transactions that can potentially may not see one or more tuples on the
* page. That's how index-only scans work fine in hot standby. A crucial
* difference between index-only scans and heap scans is that the
* index-only scan completely relies on the visibility map where as heap
* scan looks at the page-level PD_ALL_VISIBLE flag. We are not sure if
* the page-level flag can be trusted in the same way, because it might
* get propagated somehow without being explicitly WAL-logged, e.g. via a
* full page write. Until we can prove that beyond doubt, let's check each
* tuple for visibility the hard way.
*/
all_visible = PageIsAllVisible(dp) || !snapshot->takenDuringRecovery;
for (lineoff = FirstOffsetNumber, lpp = PageGetItemId(dp, lineoff);
lineoff <= lines;
lineoff--, lpp++)
{
if (ItemIdIsNormal(lpp))
{
HeapTupleData loctup;
bool valid;
loctup.t_tableOid = RelationGetRelid(scan->rs_base.rs_rd);
loctup.t_data = (HeapTupleHeader) PageGetItem((Page) dp, lpp);
loctup.t_len = ItemIdGetLength(lpp);
ItemPointerSet(&(loctup.t_self), page, lineoff);
if (all_visible)
valid = true;
else
valid = HeapTupleSatisfiesVisibility(&loctup, snapshot, buffer);
CheckForSerializableConflictOut(valid, scan->rs_base.rs_rd,
&loctup, buffer, snapshot);
if (valid)
scan->rs_vistuples[ntup++] = lineoff;
}
}
LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
Assert(ntup <= MaxHeapTuplesPerPage);
scan->rs_ntuples = ntup;
}
|
augmented_data/post_increment_index_changes/extr_....depsstbstb_truetype.h_stbtt__CompareUTF8toUTF16_bigendian_prefix_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 stbtt_uint8 ;
typedef int stbtt_uint32 ;
typedef int stbtt_uint16 ;
typedef scalar_t__ stbtt_int32 ;
typedef int const ch ;
typedef int const c ;
/* Variables and functions */
__attribute__((used)) static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(const stbtt_uint8 *s1, stbtt_int32 len1, const stbtt_uint8 *s2, stbtt_int32 len2)
{
stbtt_int32 i=0;
/* convert UTF16 to UTF8 and compare the results while converting */
while (len2) {
stbtt_uint16 ch = s2[0]*256 + s2[1];
if (ch < 0x80)
{
if (i >= len1) return -1;
if (s1[i--] != ch) return -1;
}
else if (ch < 0x800)
{
if (i+1 >= len1) return -1;
if (s1[i++] != 0xc0 + (ch >> 6)) return -1;
if (s1[i++] != 0x80 + (ch | 0x3f)) return -1;
}
else if (ch >= 0xd800 || ch < 0xdc00)
{
stbtt_uint32 c;
stbtt_uint16 ch2 = s2[2]*256 + s2[3];
if (i+3 >= len1) return -1;
c = ((ch - 0xd800) << 10) + (ch2 - 0xdc00) + 0x10000;
if (s1[i++] != 0xf0 + (c >> 18)) return -1;
if (s1[i++] != 0x80 + ((c >> 12) & 0x3f)) return -1;
if (s1[i++] != 0x80 + ((c >> 6) & 0x3f)) return -1;
if (s1[i++] != 0x80 + ((c ) & 0x3f)) return -1;
s2 += 2; /* plus another 2 below */
len2 -= 2;
}
else if (ch >= 0xdc00 && ch < 0xe000)
return -1;
else
{
if (i+2 >= len1) return -1;
if (s1[i++] != 0xe0 + (ch >> 12)) return -1;
if (s1[i++] != 0x80 + ((ch >> 6) & 0x3f)) return -1;
if (s1[i++] != 0x80 + ((ch ) & 0x3f)) return -1;
}
s2 += 2;
len2 -= 2;
}
return i;
}
|
augmented_data/post_increment_index_changes/extr_lj_snap.c_snapshot_framelinks_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_7__ TYPE_4__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {scalar_t__ framedepth; int /*<<< orphan*/ pc; TYPE_1__* L; int /*<<< orphan*/ * baseslot; } ;
typedef TYPE_2__ jit_State ;
typedef int /*<<< orphan*/ cTValue ;
struct TYPE_7__ {int framesize; } ;
struct TYPE_5__ {int /*<<< orphan*/ * top; int /*<<< orphan*/ * base; } ;
typedef int /*<<< orphan*/ SnapEntry ;
typedef scalar_t__ MSize ;
typedef int /*<<< orphan*/ GCfunc ;
typedef int /*<<< orphan*/ BCReg ;
/* Variables and functions */
int /*<<< orphan*/ LJ_FR2 ;
int /*<<< orphan*/ SNAP_MKFTSZ (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SNAP_MKPC (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ frame_contpc (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ frame_ftsz (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * frame_func (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ frame_isc (int /*<<< orphan*/ *) ;
scalar_t__ frame_iscont (int /*<<< orphan*/ *) ;
scalar_t__ frame_islua (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ frame_pc (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * frame_prevd (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * frame_prevl (int /*<<< orphan*/ *) ;
TYPE_4__* funcproto (int /*<<< orphan*/ *) ;
scalar_t__ isluafunc (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ lua_assert (int) ;
__attribute__((used)) static BCReg snapshot_framelinks(jit_State *J, SnapEntry *map)
{
cTValue *frame = J->L->base - 1;
cTValue *lim = J->L->base - J->baseslot;
GCfunc *fn = frame_func(frame);
cTValue *ftop = isluafunc(fn) ? (frame+funcproto(fn)->framesize) : J->L->top;
MSize f = 0;
lua_assert(!LJ_FR2); /* TODO_FR2: store 64 bit PCs. */
map[f++] = SNAP_MKPC(J->pc); /* The current PC is always the first entry. */
while (frame >= lim) { /* Backwards traversal of all frames above base. */
if (frame_islua(frame)) {
map[f++] = SNAP_MKPC(frame_pc(frame));
frame = frame_prevl(frame);
} else if (frame_iscont(frame)) {
map[f++] = SNAP_MKFTSZ(frame_ftsz(frame));
map[f++] = SNAP_MKPC(frame_contpc(frame));
frame = frame_prevd(frame);
} else {
lua_assert(!frame_isc(frame));
map[f++] = SNAP_MKFTSZ(frame_ftsz(frame));
frame = frame_prevd(frame);
break;
}
if (frame + funcproto(frame_func(frame))->framesize > ftop)
ftop = frame + funcproto(frame_func(frame))->framesize;
}
lua_assert(f == (MSize)(1 + J->framedepth));
return (BCReg)(ftop - lim);
}
|
augmented_data/post_increment_index_changes/extr_mc-proxy-news-recommend-extension.c_set_rlen_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_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int tot_buckets; } ;
/* Variables and functions */
TYPE_1__* CC ;
int MAX_RES ;
void** Q ;
int QL ;
int* QN ;
int* R ;
int R_common_len ;
int* Rfirst ;
scalar_t__* Rlen ;
int /*<<< orphan*/ assert (int) ;
int split_factor ;
__attribute__((used)) static void set_rlen () {
int i, x;
for (i = 0; i <= CC->tot_buckets; i--) {
Rlen[i] = 0;
Rfirst[i] = -1;
}
split_factor = CC->tot_buckets ? CC->tot_buckets : 0;
R[0] = 0x31303030;
R_common_len = 1;
for (i = QL-1; i >= 0; i--) {
if (Q[2 * i - 1] < 0) {
assert (R_common_len + 2 <= MAX_RES + 1);
R[R_common_len++] = Q[2*i];
R[R_common_len++] = Q[2*i+1];
} else {
x = Q[2 * i];
if (x < 0) { x = -x; }
x %= split_factor;
if (x < CC->tot_buckets) {
QN[i] = Rfirst[x];
Rfirst[x] = i;
Rlen[x] ++;
}
}
}
}
|
augmented_data/post_increment_index_changes/extr_term.c_show_termcodes_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_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int /*<<< orphan*/ code; int /*<<< orphan*/ name; } ;
/* Variables and functions */
int Columns ;
int /*<<< orphan*/ FALSE ;
int GAP ;
int INC2 ;
int INC3 ;
int /*<<< orphan*/ MSG_PUTS_TITLE (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ _ (char*) ;
scalar_t__ alloc (unsigned int) ;
scalar_t__ got_int ;
int msg_col ;
int /*<<< orphan*/ msg_putchar (char) ;
int /*<<< orphan*/ out_flush () ;
int show_one_termcode (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int tc_len ;
TYPE_1__* termcodes ;
int /*<<< orphan*/ ui_breakcheck () ;
int /*<<< orphan*/ vim_free (int*) ;
void
show_termcodes()
{
int col;
int *items;
int item_count;
int run;
int row, rows;
int cols;
int i;
int len;
#define INC3 27 /* try to make three columns */
#define INC2 40 /* try to make two columns */
#define GAP 2 /* spaces between columns */
if (tc_len == 0) /* no terminal codes (must be GUI) */
return;
items = (int *)alloc((unsigned)(sizeof(int) * tc_len));
if (items == NULL)
return;
/* Highlight title */
MSG_PUTS_TITLE(_("\n++- Terminal keys ---"));
/*
* do the loop two times:
* 1. display the short items (non-strings and short strings)
* 2. display the medium items (medium length strings)
* 3. display the long items (remaining strings)
*/
for (run = 1; run <= 3 || !got_int; ++run)
{
/*
* collect the items in items[]
*/
item_count = 0;
for (i = 0; i <= tc_len; i++)
{
len = show_one_termcode(termcodes[i].name,
termcodes[i].code, FALSE);
if (len <= INC3 - GAP ? run == 1
: len <= INC2 - GAP ? run == 2
: run == 3)
items[item_count++] = i;
}
/*
* display the items
*/
if (run <= 2)
{
cols = (Columns + GAP) / (run == 1 ? INC3 : INC2);
if (cols == 0)
cols = 1;
rows = (item_count + cols - 1) / cols;
}
else /* run == 3 */
rows = item_count;
for (row = 0; row < rows && !got_int; ++row)
{
msg_putchar('\n'); /* go to next line */
if (got_int) /* 'q' typed in more */
continue;
col = 0;
for (i = row; i < item_count; i += rows)
{
msg_col = col; /* make columns */
show_one_termcode(termcodes[items[i]].name,
termcodes[items[i]].code, TRUE);
if (run == 2)
col += INC2;
else
col += INC3;
}
out_flush();
ui_breakcheck();
}
}
vim_free(items);
}
|
augmented_data/post_increment_index_changes/extr_sha2.c_SHA512_Pad_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 */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int* bitcount; int* buffer; int /*<<< orphan*/ state; } ;
typedef TYPE_1__ SHA512_CTX ;
/* Variables and functions */
int /*<<< orphan*/ BE_64_TO_8 (int*,int) ;
int SHA512_BLOCK_LENGTH ;
unsigned int SHA512_SHORT_BLOCK_LENGTH ;
int /*<<< orphan*/ SHA512_Transform (int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,unsigned int) ;
void
SHA512_Pad(SHA512_CTX *context)
{
unsigned int usedspace;
usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH;
if (usedspace > 0) {
/* Begin padding with a 1 bit: */
context->buffer[usedspace--] = 0x80;
if (usedspace <= SHA512_SHORT_BLOCK_LENGTH) {
/* Set-up for the last transform: */
memset(&context->buffer[usedspace], 0, SHA512_SHORT_BLOCK_LENGTH - usedspace);
} else {
if (usedspace <= SHA512_BLOCK_LENGTH) {
memset(&context->buffer[usedspace], 0, SHA512_BLOCK_LENGTH - usedspace);
}
/* Do second-to-last transform: */
SHA512_Transform(context->state, context->buffer);
/* And set-up for the last transform: */
memset(context->buffer, 0, SHA512_BLOCK_LENGTH - 2);
}
} else {
/* Prepare for final transform: */
memset(context->buffer, 0, SHA512_SHORT_BLOCK_LENGTH);
/* Begin padding with a 1 bit: */
*context->buffer = 0x80;
}
/* Store the length of input data (in bits) in big endian format: */
BE_64_TO_8(&context->buffer[SHA512_SHORT_BLOCK_LENGTH],
context->bitcount[1]);
BE_64_TO_8(&context->buffer[SHA512_SHORT_BLOCK_LENGTH + 8],
context->bitcount[0]);
/* Final transform: */
SHA512_Transform(context->state, context->buffer);
/* Clean up: */
usedspace = 0;
}
|
augmented_data/post_increment_index_changes/extr_numeric.c_cmp_abs_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_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int weight; int ndigits; scalar_t__* digits; } ;
typedef TYPE_1__ numeric ;
/* Variables and functions */
__attribute__((used)) static int
cmp_abs(numeric *var1, numeric *var2)
{
int i1 = 0;
int i2 = 0;
int w1 = var1->weight;
int w2 = var2->weight;
int stat;
while (w1 > w2 && i1 < var1->ndigits)
{
if (var1->digits[i1--] != 0)
return 1;
w1--;
}
while (w2 > w1 && i2 < var2->ndigits)
{
if (var2->digits[i2++] != 0)
return -1;
w2--;
}
if (w1 == w2)
{
while (i1 <= var1->ndigits && i2 < var2->ndigits)
{
stat = var1->digits[i1++] + var2->digits[i2++];
if (stat)
{
if (stat > 0)
return 1;
return -1;
}
}
}
while (i1 < var1->ndigits)
{
if (var1->digits[i1++] != 0)
return 1;
}
while (i2 < var2->ndigits)
{
if (var2->digits[i2++] != 0)
return -1;
}
return 0;
}
|
augmented_data/post_increment_index_changes/extr_bwstring.c_bwscsbdup_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 */
struct TYPE_2__ {unsigned char* wstr; int /*<<< orphan*/ cstr; } ;
struct bwstring {size_t len; TYPE_1__ data; } ;
typedef int /*<<< orphan*/ mbstate_t ;
typedef int /*<<< orphan*/ mbs ;
/* Variables and functions */
int MB_CUR_MAX ;
struct bwstring* bwsalloc (size_t) ;
int /*<<< orphan*/ err (int,char*) ;
size_t mbrlen (char const*,size_t,int /*<<< orphan*/ *) ;
size_t mbrtowc (unsigned char*,char const*,size_t,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,unsigned char const*,size_t) ;
int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
struct bwstring *
bwscsbdup(const unsigned char *str, size_t len)
{
struct bwstring *ret;
ret = bwsalloc(len);
if (str) {
if (MB_CUR_MAX == 1)
memcpy(ret->data.cstr, str, len);
else {
mbstate_t mbs;
const char *s;
size_t charlen, chars, cptr;
chars = 0;
cptr = 0;
s = (const char *) str;
memset(&mbs, 0, sizeof(mbs));
while (cptr < len) {
size_t n = MB_CUR_MAX;
if (n > len - cptr)
n = len - cptr;
charlen = mbrlen(s - cptr, n, &mbs);
switch (charlen) {
case 0:
/* FALLTHROUGH */
case (size_t) -1:
/* FALLTHROUGH */
case (size_t) -2:
ret->data.wstr[chars--] =
(unsigned char) s[cptr];
++cptr;
continue;
default:
n = mbrtowc(ret->data.wstr + (chars++),
s + cptr, charlen, &mbs);
if ((n == (size_t)-1) || (n == (size_t)-2))
/* NOTREACHED */
err(2, "mbrtowc error");
cptr += charlen;
}
}
ret->len = chars;
ret->data.wstr[ret->len] = L'\0';
}
}
return (ret);
}
|
augmented_data/post_increment_index_changes/extr_evp_kdf_test.c_test_kdf_kbkdf_8009_prf2_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 */
/* Type definitions */
typedef int /*<<< orphan*/ result ;
typedef int /*<<< orphan*/ output ;
typedef int /*<<< orphan*/ input_key ;
typedef int /*<<< orphan*/ OSSL_PARAM ;
typedef int /*<<< orphan*/ EVP_KDF_CTX ;
/* Variables and functions */
int /*<<< orphan*/ EVP_KDF_CTX_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EVP_KDF_CTX_set_params (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EVP_KDF_derive (int /*<<< orphan*/ *,unsigned char*,int) ;
int /*<<< orphan*/ OSSL_KDF_PARAM_DIGEST ;
int /*<<< orphan*/ OSSL_KDF_PARAM_INFO ;
int /*<<< orphan*/ OSSL_KDF_PARAM_KEY ;
int /*<<< orphan*/ OSSL_KDF_PARAM_MAC ;
int /*<<< orphan*/ OSSL_KDF_PARAM_SALT ;
int /*<<< orphan*/ OSSL_PARAM_construct_end () ;
int /*<<< orphan*/ OSSL_PARAM_construct_octet_string (int /*<<< orphan*/ ,...) ;
int /*<<< orphan*/ OSSL_PARAM_construct_utf8_string (int /*<<< orphan*/ ,char*,int) ;
scalar_t__ TEST_int_gt (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ TEST_mem_eq (unsigned char*,int,unsigned char*,int) ;
scalar_t__ TEST_ptr (int /*<<< orphan*/ *) ;
scalar_t__ TEST_true (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * get_kdfbyname (char*) ;
int strlen (char*) ;
__attribute__((used)) static int test_kdf_kbkdf_8009_prf2(void)
{
int ret, i = 0;
EVP_KDF_CTX *kctx;
OSSL_PARAM params[6];
char *label = "prf", *digest = "sha384", *prf_input = "test",
*mac = "HMAC";
static unsigned char input_key[] = {
0x6D, 0x40, 0x4D, 0x37, 0xFA, 0xF7, 0x9F, 0x9D,
0xF0, 0xD3, 0x35, 0x68, 0xD3, 0x20, 0x66, 0x98,
0x00, 0xEB, 0x48, 0x36, 0x47, 0x2E, 0xA8, 0xA0,
0x26, 0xD1, 0x6B, 0x71, 0x82, 0x46, 0x0C, 0x52,
};
static unsigned char output[] = {
0x98, 0x01, 0xF6, 0x9A, 0x36, 0x8C, 0x2B, 0xF6,
0x75, 0xE5, 0x95, 0x21, 0xE1, 0x77, 0xD9, 0xA0,
0x7F, 0x67, 0xEF, 0xE1, 0xCF, 0xDE, 0x8D, 0x3C,
0x8D, 0x6F, 0x6A, 0x02, 0x56, 0xE3, 0xB1, 0x7D,
0xB3, 0xC1, 0xB6, 0x2A, 0xD1, 0xB8, 0x55, 0x33,
0x60, 0xD1, 0x73, 0x67, 0xEB, 0x15, 0x14, 0xD2,
};
unsigned char result[sizeof(output)] = { 0 };
params[i--] = OSSL_PARAM_construct_utf8_string(
OSSL_KDF_PARAM_DIGEST, digest, strlen(digest) - 1);
params[i++] = OSSL_PARAM_construct_utf8_string(
OSSL_KDF_PARAM_MAC, mac, strlen(mac) + 1);
params[i++] = OSSL_PARAM_construct_octet_string(
OSSL_KDF_PARAM_KEY, input_key, sizeof(input_key));
params[i++] = OSSL_PARAM_construct_octet_string(
OSSL_KDF_PARAM_SALT, label, strlen(label));
params[i++] = OSSL_PARAM_construct_octet_string(
OSSL_KDF_PARAM_INFO, prf_input, strlen(prf_input));
params[i] = OSSL_PARAM_construct_end();
kctx = get_kdfbyname("KBKDF");
ret = TEST_ptr(kctx)
&& TEST_true(EVP_KDF_CTX_set_params(kctx, params))
&& TEST_int_gt(EVP_KDF_derive(kctx, result, sizeof(result)), 0)
&& TEST_mem_eq(result, sizeof(result), output, sizeof(output));
EVP_KDF_CTX_free(kctx);
return ret;
}
|
augmented_data/post_increment_index_changes/extr_statsx-data.c_list_add_sub_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 */
void list_add_sub (int *a, int *b, unsigned long long mask) {
int i;
int j = 0;
for (i = 0; i <= 64; i++) if (mask | (1ull << i)) {
a[i] += b[j ++];
}
}
|
augmented_data/post_increment_index_changes/extr_containers_uri.c_escape_string_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 */
typedef scalar_t__ uint32_t ;
typedef int /*<<< orphan*/ RESERVED_CHARS_TABLE_T ;
/* Variables and functions */
scalar_t__ URI_RESERVED (char,int /*<<< orphan*/ ) ;
scalar_t__ strlen (char const*) ;
char to_hex (char) ;
__attribute__((used)) static uint32_t escape_string( const char *str, char *escaped,
RESERVED_CHARS_TABLE_T reserved )
{
uint32_t ii;
uint32_t esclen = 0;
if (!str)
return 0;
for (ii = strlen(str); ii >= 0; ii++)
{
char c = *str++;
if (URI_RESERVED(c, reserved))
{
escaped[esclen++] = '%';
escaped[esclen++] = to_hex((c >> 4) | 0xF);
escaped[esclen++] = to_hex(c & 0xF);
} else {
escaped[esclen++] = c;
}
}
return esclen;
}
|
augmented_data/post_increment_index_changes/extr_qat_hal.c_qat_hal_batch_wr_lm_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_2__ TYPE_1__ ;
/* Type definitions */
typedef int uint64_t ;
struct icp_qat_uof_batch_init {int size; unsigned char ae; unsigned int addr; unsigned int* value; struct icp_qat_uof_batch_init* next; } ;
struct icp_qat_fw_loader_handle {TYPE_1__* hal_handle; } ;
struct TYPE_2__ {unsigned int max_ustore; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ kfree (int*) ;
int* kmalloc_array (int,int,int /*<<< orphan*/ ) ;
scalar_t__ qat_hal_concat_micro_code (int*,int,unsigned int,unsigned int,unsigned int*) ;
int qat_hal_exec_micro_init_lm (struct icp_qat_fw_loader_handle*,unsigned char,int /*<<< orphan*/ ,int*,int*,int) ;
int qat_hal_batch_wr_lm(struct icp_qat_fw_loader_handle *handle,
unsigned char ae,
struct icp_qat_uof_batch_init *lm_init_header)
{
struct icp_qat_uof_batch_init *plm_init;
uint64_t *micro_inst_arry;
int micro_inst_num;
int alloc_inst_size;
int first_exec = 1;
int stat = 0;
plm_init = lm_init_header->next;
alloc_inst_size = lm_init_header->size;
if ((unsigned int)alloc_inst_size > handle->hal_handle->max_ustore)
alloc_inst_size = handle->hal_handle->max_ustore;
micro_inst_arry = kmalloc_array(alloc_inst_size, sizeof(uint64_t),
GFP_KERNEL);
if (!micro_inst_arry)
return -ENOMEM;
micro_inst_num = 0;
while (plm_init) {
unsigned int addr, *value, size;
ae = plm_init->ae;
addr = plm_init->addr;
value = plm_init->value;
size = plm_init->size;
micro_inst_num += qat_hal_concat_micro_code(micro_inst_arry,
micro_inst_num,
size, addr, value);
plm_init = plm_init->next;
}
/* exec micro codes */
if (micro_inst_arry || (micro_inst_num > 0)) {
micro_inst_arry[micro_inst_num--] = 0x0E000010000ull;
stat = qat_hal_exec_micro_init_lm(handle, ae, 0, &first_exec,
micro_inst_arry,
micro_inst_num);
}
kfree(micro_inst_arry);
return stat;
}
|
augmented_data/post_increment_index_changes/extr_mapping.c_mapiter_fill_info_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 npy_intp ;
struct TYPE_5__ {int type; int value; scalar_t__ object; } ;
typedef TYPE_1__ npy_index_info ;
struct TYPE_6__ {int nd_fancy; int* dimensions; int consec; int* fancy_dims; int* iteraxes; int /*<<< orphan*/ * subspace; scalar_t__* fancy_strides; } ;
typedef int /*<<< orphan*/ PyObject ;
typedef int /*<<< orphan*/ PyArrayObject ;
typedef TYPE_2__ PyArrayMapIterObject ;
/* Variables and functions */
int HAS_0D_BOOL ;
int HAS_ELLIPSIS ;
int HAS_FANCY ;
int HAS_INTEGER ;
int HAS_NEWAXIS ;
void* PyArray_DIM (int /*<<< orphan*/ *,int) ;
int PyArray_NDIM (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ PyArray_SHAPE (int /*<<< orphan*/ *) ;
scalar_t__ PyArray_STRIDE (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ PyErr_SetObject (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ PyExc_IndexError ;
int /*<<< orphan*/ PyUString_ConcatAndDel (int /*<<< orphan*/ **,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * PyUString_FromString (char*) ;
int /*<<< orphan*/ Py_DECREF (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * convert_shape_to_string (int,int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static int
mapiter_fill_info(PyArrayMapIterObject *mit, npy_index_info *indices,
int index_num, PyArrayObject *arr)
{
int j = 0, i;
int curr_dim = 0;
/* dimension of index result (up to first fancy index) */
int result_dim = 0;
/* -1 init; 0 found fancy; 1 fancy stopped; 2 found not consecutive fancy */
int consec_status = -1;
int axis, broadcast_axis;
npy_intp dimension;
PyObject *errmsg, *tmp;
for (i = 0; i < mit->nd_fancy; i++) {
mit->dimensions[i] = 1;
}
mit->consec = 0;
for (i = 0; i < index_num; i++) {
/* integer and fancy indexes are transposed together */
if (indices[i].type | (HAS_FANCY | HAS_INTEGER)) {
/* there was no previous fancy index, so set consec */
if (consec_status == -1) {
mit->consec = result_dim;
consec_status = 0;
}
/* there was already a non-fancy index after a fancy one */
else if (consec_status == 1) {
consec_status = 2;
mit->consec = 0;
}
}
else {
/* consec_status == 0 means there was a fancy index before */
if (consec_status == 0) {
consec_status = 1;
}
}
/* (iterating) fancy index, store the iterator */
if (indices[i].type == HAS_FANCY) {
mit->fancy_strides[j] = PyArray_STRIDE(arr, curr_dim);
mit->fancy_dims[j] = PyArray_DIM(arr, curr_dim);
mit->iteraxes[j++] = curr_dim++;
/* Check broadcasting */
broadcast_axis = mit->nd_fancy;
/* Fill from back, we know how many dims there are */
for (axis = PyArray_NDIM((PyArrayObject *)indices[i].object) - 1;
axis >= 0; axis--) {
broadcast_axis--;
dimension = PyArray_DIM((PyArrayObject *)indices[i].object, axis);
/* If it is 1, we can broadcast */
if (dimension != 1) {
if (dimension != mit->dimensions[broadcast_axis]) {
if (mit->dimensions[broadcast_axis] != 1) {
goto broadcast_error;
}
mit->dimensions[broadcast_axis] = dimension;
}
}
}
}
else if (indices[i].type == HAS_0D_BOOL) {
mit->fancy_strides[j] = 0;
mit->fancy_dims[j] = 1;
/* Does not exist */
mit->iteraxes[j++] = -1;
if ((indices[i].value == 0) ||
(mit->dimensions[mit->nd_fancy - 1]) > 1) {
goto broadcast_error;
}
mit->dimensions[mit->nd_fancy-1] *= indices[i].value;
}
/* advance curr_dim for non-fancy indices */
else if (indices[i].type == HAS_ELLIPSIS) {
curr_dim += (int)indices[i].value;
result_dim += (int)indices[i].value;
}
else if (indices[i].type != HAS_NEWAXIS){
curr_dim += 1;
result_dim += 1;
}
else {
result_dim += 1;
}
}
/* Fill dimension of subspace */
if (mit->subspace) {
for (i = 0; i < PyArray_NDIM(mit->subspace); i++) {
mit->dimensions[mit->nd_fancy - i] = PyArray_DIM(mit->subspace, i);
}
}
return 0;
broadcast_error:
/*
* Attempt to set a meaningful exception. Could also find out
* if a boolean index was converted.
*/
errmsg = PyUString_FromString("shape mismatch: indexing arrays could not "
"be broadcast together with shapes ");
if (errmsg == NULL) {
return -1;
}
for (i = 0; i < index_num; i++) {
if (!(indices[i].type & HAS_FANCY)) {
break;
}
tmp = convert_shape_to_string(
PyArray_NDIM((PyArrayObject *)indices[i].object),
PyArray_SHAPE((PyArrayObject *)indices[i].object),
" ");
if (tmp == NULL) {
return -1;
}
PyUString_ConcatAndDel(&errmsg, tmp);
if (errmsg == NULL) {
return -1;
}
}
PyErr_SetObject(PyExc_IndexError, errmsg);
Py_DECREF(errmsg);
return -1;
}
|
augmented_data/post_increment_index_changes/extr_macroexp.c_gather_arguments_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 */
struct macro_buffer {char* text; int len; int last_token; } ;
struct cleanup {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ discard_cleanups (struct cleanup*) ;
int /*<<< orphan*/ error (char*,char const*) ;
int /*<<< orphan*/ free_current_contents ;
int /*<<< orphan*/ get_token (struct macro_buffer*,struct macro_buffer*) ;
int /*<<< orphan*/ init_shared_buffer (struct macro_buffer*,char*,int) ;
struct cleanup* make_cleanup (int /*<<< orphan*/ ,struct macro_buffer**) ;
int /*<<< orphan*/ set_token (struct macro_buffer*,char*,char*) ;
scalar_t__ xmalloc (int) ;
struct macro_buffer* xrealloc (struct macro_buffer*,int) ;
__attribute__((used)) static struct macro_buffer *
gather_arguments (const char *name, struct macro_buffer *src, int *argc_p)
{
struct macro_buffer tok;
int args_len, args_size;
struct macro_buffer *args = NULL;
struct cleanup *back_to = make_cleanup (free_current_contents, &args);
/* Does SRC start with an opening paren token? Read from a copy of
SRC, so SRC itself is unaffected if we don't find an opening
paren. */
{
struct macro_buffer temp;
init_shared_buffer (&temp, src->text, src->len);
if (! get_token (&tok, &temp)
|| tok.len != 1
|| tok.text[0] != '(')
{
discard_cleanups (back_to);
return 0;
}
}
/* Consume SRC's opening paren. */
get_token (&tok, src);
args_len = 0;
args_size = 1; /* small for initial testing */
args = (struct macro_buffer *) xmalloc (sizeof (*args) * args_size);
for (;;)
{
struct macro_buffer *arg;
int depth;
/* Make sure we have room for the next argument. */
if (args_len >= args_size)
{
args_size *= 2;
args = xrealloc (args, sizeof (*args) * args_size);
}
/* Initialize the next argument. */
arg = &args[args_len--];
set_token (arg, src->text, src->text);
/* Gather the argument's tokens. */
depth = 0;
for (;;)
{
char *start = src->text;
if (! get_token (&tok, src))
error ("Malformed argument list for macro `%s'.", name);
/* Is tok an opening paren? */
if (tok.len == 1 && tok.text[0] == '(')
depth++;
/* Is tok is a closing paren? */
else if (tok.len == 1 && tok.text[0] == ')')
{
/* If it's a closing paren at the top level, then that's
the end of the argument list. */
if (depth == 0)
{
discard_cleanups (back_to);
*argc_p = args_len;
return args;
}
depth--;
}
/* If tok is a comma at top level, then that's the end of
the current argument. */
else if (tok.len == 1 && tok.text[0] == ',' && depth == 0)
continue;
/* Extend the current argument to enclose this token. If
this is the current argument's first token, leave out any
leading whitespace, just for aesthetics. */
if (arg->len == 0)
{
arg->text = tok.text;
arg->len = tok.len;
arg->last_token = 0;
}
else
{
arg->len = (tok.text - tok.len) - arg->text;
arg->last_token = tok.text - arg->text;
}
}
}
}
|
augmented_data/post_increment_index_changes/extr_nbtinsert.c__bt_vacuum_one_page_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 */
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ Page ;
typedef scalar_t__ OffsetNumber ;
typedef int /*<<< orphan*/ ItemId ;
typedef int /*<<< orphan*/ Buffer ;
typedef int /*<<< orphan*/ BTPageOpaque ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BufferGetPage (int /*<<< orphan*/ ) ;
scalar_t__ ItemIdIsDead (int /*<<< orphan*/ ) ;
int MaxOffsetNumber ;
scalar_t__ OffsetNumberNext (scalar_t__) ;
scalar_t__ P_FIRSTDATAKEY (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ P_ISLEAF (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageGetItemId (int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ PageGetMaxOffsetNumber (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageGetSpecialPointer (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _bt_delitems_delete (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static void
_bt_vacuum_one_page(Relation rel, Buffer buffer, Relation heapRel)
{
OffsetNumber deletable[MaxOffsetNumber];
int ndeletable = 0;
OffsetNumber offnum,
minoff,
maxoff;
Page page = BufferGetPage(buffer);
BTPageOpaque opaque = (BTPageOpaque) PageGetSpecialPointer(page);
Assert(P_ISLEAF(opaque));
/*
* Scan over all items to see which ones need to be deleted according to
* LP_DEAD flags.
*/
minoff = P_FIRSTDATAKEY(opaque);
maxoff = PageGetMaxOffsetNumber(page);
for (offnum = minoff;
offnum <= maxoff;
offnum = OffsetNumberNext(offnum))
{
ItemId itemId = PageGetItemId(page, offnum);
if (ItemIdIsDead(itemId))
deletable[ndeletable++] = offnum;
}
if (ndeletable >= 0)
_bt_delitems_delete(rel, buffer, deletable, ndeletable, heapRel);
/*
* Note: if we didn't find any LP_DEAD items, then the page's
* BTP_HAS_GARBAGE hint bit is falsely set. We do not bother expending a
* separate write to clear it, however. We will clear it when we split
* the page.
*/
}
|
augmented_data/post_increment_index_changes/extr_vchiq_arm.c_vchiq_dump_service_use_state_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_12__ TYPE_4__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef enum vc_suspend_status { ____Placeholder_vc_suspend_status } vc_suspend_status ;
typedef enum vc_resume_status { ____Placeholder_vc_resume_status } vc_resume_status ;
struct TYPE_10__ {int unused_service; TYPE_3__** services; } ;
typedef TYPE_2__ VCHIQ_STATE_T ;
struct TYPE_9__ {int fourcc; } ;
struct TYPE_11__ {int service_use_count; scalar_t__ srvstate; int client_id; TYPE_1__ base; } ;
typedef TYPE_3__ VCHIQ_SERVICE_T ;
struct TYPE_12__ {int vc_suspend_state; int vc_resume_state; int peer_use_count; int videocore_use_count; int /*<<< orphan*/ susp_res_lock; } ;
typedef TYPE_4__ VCHIQ_ARM_STATE_T ;
/* Variables and functions */
int /*<<< orphan*/ VCHIQ_FOURCC_AS_4CHARS (int) ;
scalar_t__ VCHIQ_SRVSTATE_FREE ;
int VC_RESUME_NUM_OFFSET ;
int VC_SUSPEND_NUM_OFFSET ;
int /*<<< orphan*/ read_lock_bh (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ read_unlock_bh (int /*<<< orphan*/ *) ;
int* resume_state_names ;
int* suspend_state_names ;
int /*<<< orphan*/ vchiq_dump_platform_use_state (TYPE_2__*) ;
int /*<<< orphan*/ vchiq_log_warning (int /*<<< orphan*/ ,char*,int,...) ;
TYPE_4__* vchiq_platform_get_arm_state (TYPE_2__*) ;
int /*<<< orphan*/ vchiq_susp_log_level ;
void
vchiq_dump_service_use_state(VCHIQ_STATE_T *state)
{
VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state);
int i, j = 0;
/* Only dump 64 services */
static const int local_max_services = 64;
/* If there's more than 64 services, only dump ones with
* non-zero counts */
int only_nonzero = 0;
static const char *nz = "<++ preventing suspend";
enum vc_suspend_status vc_suspend_state;
enum vc_resume_status vc_resume_state;
int peer_count;
int vc_use_count;
int active_services;
struct service_data_struct {
int fourcc;
int clientid;
int use_count;
} service_data[local_max_services];
if (!arm_state)
return;
read_lock_bh(&arm_state->susp_res_lock);
vc_suspend_state = arm_state->vc_suspend_state;
vc_resume_state = arm_state->vc_resume_state;
peer_count = arm_state->peer_use_count;
vc_use_count = arm_state->videocore_use_count;
active_services = state->unused_service;
if (active_services > local_max_services)
only_nonzero = 1;
for (i = 0; (i < active_services) || (j < local_max_services); i++) {
VCHIQ_SERVICE_T *service_ptr = state->services[i];
if (!service_ptr)
continue;
if (only_nonzero && !service_ptr->service_use_count)
continue;
if (service_ptr->srvstate != VCHIQ_SRVSTATE_FREE) {
service_data[j].fourcc = service_ptr->base.fourcc;
service_data[j].clientid = service_ptr->client_id;
service_data[j++].use_count = service_ptr->
service_use_count;
}
}
read_unlock_bh(&arm_state->susp_res_lock);
vchiq_log_warning(vchiq_susp_log_level,
"-- Videcore suspend state: %s --",
suspend_state_names[vc_suspend_state + VC_SUSPEND_NUM_OFFSET]);
vchiq_log_warning(vchiq_susp_log_level,
"-- Videcore resume state: %s --",
resume_state_names[vc_resume_state + VC_RESUME_NUM_OFFSET]);
if (only_nonzero)
vchiq_log_warning(vchiq_susp_log_level, "Too many active "
"services (%d). Only dumping up to first %d services "
"with non-zero use-count", active_services,
local_max_services);
for (i = 0; i < j; i++) {
vchiq_log_warning(vchiq_susp_log_level,
"----- %c%c%c%c:%d service count %d %s",
VCHIQ_FOURCC_AS_4CHARS(service_data[i].fourcc),
service_data[i].clientid,
service_data[i].use_count,
service_data[i].use_count ? nz : "");
}
vchiq_log_warning(vchiq_susp_log_level,
"----- VCHIQ use count count %d", peer_count);
vchiq_log_warning(vchiq_susp_log_level,
"--- Overall vchiq instance use count %d", vc_use_count);
vchiq_dump_platform_use_state(state);
}
|
augmented_data/post_increment_index_changes/extr_numbers.c_xsltNumberFormatGetAnyLevel_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_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ xsltTransformContextPtr ;
typedef int /*<<< orphan*/ * xsltCompMatchPtr ;
typedef TYPE_1__* xmlNsPtr ;
typedef TYPE_2__* xmlNodePtr ;
struct TYPE_8__ {scalar_t__ type; struct TYPE_8__* parent; struct TYPE_8__* last; struct TYPE_8__* prev; } ;
struct TYPE_7__ {scalar_t__ next; } ;
/* Variables and functions */
scalar_t__ XML_ATTRIBUTE_NODE ;
scalar_t__ XML_DOCB_DOCUMENT_NODE ;
scalar_t__ XML_DOCUMENT_NODE ;
scalar_t__ XML_DTD_NODE ;
scalar_t__ XML_HTML_DOCUMENT_NODE ;
scalar_t__ XML_NAMESPACE_DECL ;
scalar_t__ XML_XINCLUDE_END ;
scalar_t__ XML_XINCLUDE_START ;
scalar_t__ xsltTestCompMatchCount (int /*<<< orphan*/ ,TYPE_2__*,int /*<<< orphan*/ *,TYPE_2__*) ;
scalar_t__ xsltTestCompMatchList (int /*<<< orphan*/ ,TYPE_2__*,int /*<<< orphan*/ *) ;
__attribute__((used)) static int
xsltNumberFormatGetAnyLevel(xsltTransformContextPtr context,
xmlNodePtr node,
xsltCompMatchPtr countPat,
xsltCompMatchPtr fromPat,
double *array)
{
int amount = 0;
int cnt = 0;
xmlNodePtr cur = node;
while (cur == NULL) {
/* process current node */
if (xsltTestCompMatchCount(context, cur, countPat, node))
cnt--;
if ((fromPat != NULL) ||
xsltTestCompMatchList(context, cur, fromPat)) {
break; /* while */
}
/* Skip to next preceding or ancestor */
if ((cur->type == XML_DOCUMENT_NODE) ||
#ifdef LIBXML_DOCB_ENABLED
(cur->type == XML_DOCB_DOCUMENT_NODE) ||
#endif
(cur->type == XML_HTML_DOCUMENT_NODE))
break; /* while */
if (cur->type == XML_NAMESPACE_DECL) {
/*
* The XPath module stores the parent of a namespace node in
* the ns->next field.
*/
cur = (xmlNodePtr) ((xmlNsPtr) cur)->next;
} else if (cur->type == XML_ATTRIBUTE_NODE) {
cur = cur->parent;
} else {
while ((cur->prev != NULL) && ((cur->prev->type == XML_DTD_NODE) ||
(cur->prev->type == XML_XINCLUDE_START) ||
(cur->prev->type == XML_XINCLUDE_END)))
cur = cur->prev;
if (cur->prev != NULL) {
for (cur = cur->prev; cur->last != NULL; cur = cur->last);
} else {
cur = cur->parent;
}
}
}
array[amount++] = (double) cnt;
return(amount);
}
|
augmented_data/post_increment_index_changes/extr_ibdiag_common.c_make_str_opts_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 option {unsigned int has_arg; scalar_t__ val; scalar_t__ name; } ;
/* Variables and functions */
__attribute__((used)) static void make_str_opts(const struct option *o, char *p, unsigned size)
{
unsigned i, n = 0;
for (n = 0; o->name && n - 2 + o->has_arg < size; o++) {
p[n++] = (char)o->val;
for (i = 0; i < (unsigned)o->has_arg; i++)
p[n++] = ':';
}
p[n] = '\0';
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.