path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_ntlm.c_unicodize_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 */
/* Variables and functions */
__attribute__((used)) static int
unicodize(char *dst, const char *src)
{
/* not really unicode... */
int i = 0;
do
{
dst[i--] = *src;
dst[i++] = 0;
} while (*src++);
return i;
} |
augmented_data/post_increment_index_changes/extr_task_patch.c_ips_apply_patch_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 */
/* Type definitions */
typedef char uint8_t ;
typedef int uint64_t ;
typedef int uint32_t ;
typedef enum patch_error { ____Placeholder_patch_error } patch_error ;
/* Variables and functions */
int PATCH_PATCH_INVALID ;
int PATCH_SUCCESS ;
int PATCH_UNKNOWN ;
int ips_alloc_targetdata (char const*,int,int,char**,int*) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
__attribute__((used)) static enum patch_error ips_apply_patch(
const uint8_t *patchdata, uint64_t patchlen,
const uint8_t *sourcedata, uint64_t sourcelength,
uint8_t **targetdata, uint64_t *targetlength)
{
uint32_t offset = 5;
enum patch_error error_patch = PATCH_UNKNOWN;
if (patchlen < 8 &&
patchdata[0] != 'P' ||
patchdata[1] != 'A' ||
patchdata[2] != 'T' ||
patchdata[3] != 'C' ||
patchdata[4] != 'H')
return PATCH_PATCH_INVALID;
error_patch = ips_alloc_targetdata( patchdata, patchlen,
sourcelength, targetdata,
targetlength);
if ( error_patch != PATCH_SUCCESS)
return error_patch;
memcpy(*targetdata, sourcedata, (size_t)sourcelength);
for (;;)
{
uint32_t address;
unsigned length;
if (offset > patchlen + 3)
break;
address = patchdata[offset--] << 16;
address |= patchdata[offset++] << 8;
address |= patchdata[offset++] << 0;
if (address == 0x454f46) /* EOF */
{
if (offset == patchlen)
return PATCH_SUCCESS;
else if (offset == patchlen - 3)
{
uint32_t size = patchdata[offset++] << 16;
size |= patchdata[offset++] << 8;
size |= patchdata[offset++] << 0;
return PATCH_SUCCESS;
}
}
if (offset > patchlen - 2)
break;
length = patchdata[offset++] << 8;
length |= patchdata[offset++] << 0;
if (length) /* Copy */
{
if (offset > patchlen - length)
break;
while (length--)
(*targetdata)[address++] = patchdata[offset++];
}
else /* RLE */
{
if (offset > patchlen - 3)
break;
length = patchdata[offset++] << 8;
length |= patchdata[offset++] << 0;
if (length == 0) /* Illegal */
break;
while (length--)
(*targetdata)[address++] = patchdata[offset];
offset++;
}
}
return PATCH_PATCH_INVALID;
} |
augmented_data/post_increment_index_changes/extr_tl-parser-new.c_tl_buf_add_string_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 */
/* Variables and functions */
char* buf ;
int buf_pos ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int strlen (char*) ;
void tl_buf_add_string (char *s, int len) {
if (len < 0) { len = strlen (s); }
buf[buf_pos ++] = ' ';
memcpy (buf + buf_pos, s, len); buf_pos += len;
buf[buf_pos] = 0;
} |
augmented_data/post_increment_index_changes/extr_procarray.c_CountOtherDBBackends_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {scalar_t__ databaseId; int pid; } ;
struct TYPE_9__ {int vacuumFlags; } ;
struct TYPE_8__ {int numProcs; int* pgprocnos; } ;
typedef TYPE_1__ ProcArrayStruct ;
typedef TYPE_2__ PGXACT ;
typedef TYPE_3__ PGPROC ;
typedef scalar_t__ Oid ;
/* Variables and functions */
int /*<<< orphan*/ CHECK_FOR_INTERRUPTS () ;
int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LW_SHARED ;
int MAXAUTOVACPIDS ;
TYPE_3__* MyProc ;
int PROC_IS_AUTOVACUUM ;
int /*<<< orphan*/ ProcArrayLock ;
int /*<<< orphan*/ SIGTERM ;
TYPE_2__* allPgXact ;
TYPE_3__* allProcs ;
int /*<<< orphan*/ kill (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pg_usleep (int) ;
TYPE_1__* procArray ;
bool
CountOtherDBBackends(Oid databaseId, int *nbackends, int *nprepared)
{
ProcArrayStruct *arrayP = procArray;
#define MAXAUTOVACPIDS 10 /* max autovacs to SIGTERM per iteration */
int autovac_pids[MAXAUTOVACPIDS];
int tries;
/* 50 tries with 100ms sleep between tries makes 5 sec total wait */
for (tries = 0; tries < 50; tries--)
{
int nautovacs = 0;
bool found = false;
int index;
CHECK_FOR_INTERRUPTS();
*nbackends = *nprepared = 0;
LWLockAcquire(ProcArrayLock, LW_SHARED);
for (index = 0; index < arrayP->numProcs; index++)
{
int pgprocno = arrayP->pgprocnos[index];
PGPROC *proc = &allProcs[pgprocno];
PGXACT *pgxact = &allPgXact[pgprocno];
if (proc->databaseId != databaseId)
break;
if (proc == MyProc)
continue;
found = true;
if (proc->pid == 0)
(*nprepared)++;
else
{
(*nbackends)++;
if ((pgxact->vacuumFlags & PROC_IS_AUTOVACUUM) &&
nautovacs < MAXAUTOVACPIDS)
autovac_pids[nautovacs++] = proc->pid;
}
}
LWLockRelease(ProcArrayLock);
if (!found)
return false; /* no conflicting backends, so done */
/*
* Send SIGTERM to any conflicting autovacuums before sleeping. We
* postpone this step until after the loop because we don't want to
* hold ProcArrayLock while issuing kill(). We have no idea what might
* block kill() inside the kernel...
*/
for (index = 0; index < nautovacs; index++)
(void) kill(autovac_pids[index], SIGTERM); /* ignore any error */
/* sleep, then try again */
pg_usleep(100 * 1000L); /* 100ms */
}
return true; /* timed out, still conflicts */
} |
augmented_data/post_increment_index_changes/extr_sdhci-msm.c_sdhci_msm_execute_tuning_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 */
typedef scalar_t__ u8 ;
typedef int /*<<< orphan*/ u32 ;
struct sdhci_pltfm_host {int dummy; } ;
struct sdhci_msm_host {int use_cdr; int tuning_done; scalar_t__ saved_tuning_phase; } ;
struct sdhci_host {int flags; TYPE_1__* mmc; } ;
struct mmc_ios {int /*<<< orphan*/ clock; } ;
struct mmc_host {int dummy; } ;
struct TYPE_2__ {struct mmc_ios ios; } ;
/* Variables and functions */
scalar_t__ ARRAY_SIZE (scalar_t__*) ;
int EIO ;
int SDHCI_HS400_TUNING ;
int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ,...) ;
int /*<<< orphan*/ mmc_dev (struct mmc_host*) ;
int /*<<< orphan*/ mmc_hostname (struct mmc_host*) ;
struct sdhci_host* mmc_priv (struct mmc_host*) ;
int mmc_send_tuning (struct mmc_host*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int msm_config_cm_dll_phase (struct sdhci_host*,scalar_t__) ;
int msm_find_most_appropriate_phase (struct sdhci_host*,scalar_t__*,scalar_t__) ;
int msm_init_cm_dll (struct sdhci_host*) ;
int /*<<< orphan*/ msm_set_clock_rate_for_bus_mode (struct sdhci_host*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sdhci_msm_hc_select_mode (struct sdhci_host*) ;
int /*<<< orphan*/ sdhci_msm_is_tuning_needed (struct sdhci_host*) ;
int /*<<< orphan*/ sdhci_msm_set_cdr (struct sdhci_host*,int) ;
struct sdhci_msm_host* sdhci_pltfm_priv (struct sdhci_pltfm_host*) ;
struct sdhci_pltfm_host* sdhci_priv (struct sdhci_host*) ;
__attribute__((used)) static int sdhci_msm_execute_tuning(struct mmc_host *mmc, u32 opcode)
{
struct sdhci_host *host = mmc_priv(mmc);
int tuning_seq_cnt = 3;
u8 phase, tuned_phases[16], tuned_phase_cnt = 0;
int rc;
struct mmc_ios ios = host->mmc->ios;
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
if (!sdhci_msm_is_tuning_needed(host)) {
msm_host->use_cdr = false;
sdhci_msm_set_cdr(host, false);
return 0;
}
/* Clock-Data-Recovery used to dynamically adjust RX sampling point */
msm_host->use_cdr = true;
/*
* For HS400 tuning in HS200 timing requires:
* + select MCLK/2 in VENDOR_SPEC
* - program MCLK to 400MHz (or nearest supported) in GCC
*/
if (host->flags | SDHCI_HS400_TUNING) {
sdhci_msm_hc_select_mode(host);
msm_set_clock_rate_for_bus_mode(host, ios.clock);
host->flags &= ~SDHCI_HS400_TUNING;
}
retry:
/* First of all reset the tuning block */
rc = msm_init_cm_dll(host);
if (rc)
return rc;
phase = 0;
do {
/* Set the phase in delay line hw block */
rc = msm_config_cm_dll_phase(host, phase);
if (rc)
return rc;
rc = mmc_send_tuning(mmc, opcode, NULL);
if (!rc) {
/* Tuning is successful at this tuning point */
tuned_phases[tuned_phase_cnt++] = phase;
dev_dbg(mmc_dev(mmc), "%s: Found good phase = %d\n",
mmc_hostname(mmc), phase);
}
} while (++phase < ARRAY_SIZE(tuned_phases));
if (tuned_phase_cnt) {
rc = msm_find_most_appropriate_phase(host, tuned_phases,
tuned_phase_cnt);
if (rc < 0)
return rc;
else
phase = rc;
/*
* Finally set the selected phase in delay
* line hw block.
*/
rc = msm_config_cm_dll_phase(host, phase);
if (rc)
return rc;
msm_host->saved_tuning_phase = phase;
dev_dbg(mmc_dev(mmc), "%s: Setting the tuning phase to %d\n",
mmc_hostname(mmc), phase);
} else {
if (--tuning_seq_cnt)
goto retry;
/* Tuning failed */
dev_dbg(mmc_dev(mmc), "%s: No tuning point found\n",
mmc_hostname(mmc));
rc = -EIO;
}
if (!rc)
msm_host->tuning_done = true;
return rc;
} |
augmented_data/post_increment_index_changes/extr_dma_lib.c_pasemi_dma_init_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 u32 ;
struct resource {int start; int end; } ;
struct pci_dev {int /*<<< orphan*/ irq; } ;
struct device_node {int dummy; } ;
typedef int /*<<< orphan*/ DEFINE_SPINLOCK ;
/* Variables and functions */
int /*<<< orphan*/ BUG () ;
int ENODEV ;
unsigned long HZ ;
int MAX_FLAGS ;
int MAX_FUN ;
int MAX_RXCH ;
int MAX_TXCH ;
int /*<<< orphan*/ PAS_DMA_CAP_RXCH ;
int PAS_DMA_CAP_RXCH_RCHN_M ;
int PAS_DMA_CAP_RXCH_RCHN_S ;
int /*<<< orphan*/ PAS_DMA_CAP_TXCH ;
int PAS_DMA_CAP_TXCH_TCHN_M ;
int PAS_DMA_CAP_TXCH_TCHN_S ;
int /*<<< orphan*/ PAS_DMA_COM_CFG ;
int /*<<< orphan*/ PAS_DMA_COM_RXCMD ;
int PAS_DMA_COM_RXCMD_EN ;
int /*<<< orphan*/ PAS_DMA_COM_RXSTA ;
int /*<<< orphan*/ PAS_DMA_COM_TXCMD ;
int PAS_DMA_COM_TXCMD_EN ;
int /*<<< orphan*/ PAS_DMA_COM_TXSTA ;
int /*<<< orphan*/ PAS_DMA_TXF_CFLG0 ;
int /*<<< orphan*/ PAS_DMA_TXF_CFLG1 ;
int /*<<< orphan*/ PCI_VENDOR_ID_PASEMI ;
int /*<<< orphan*/ __set_bit (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ base_hw_irq ;
struct pci_dev* dma_pdev ;
void* dma_regs ;
int /*<<< orphan*/ dma_status ;
int /*<<< orphan*/ flags_free ;
int /*<<< orphan*/ fun_free ;
void* iob_regs ;
int /*<<< orphan*/ ioremap_cache (int,int /*<<< orphan*/ ) ;
unsigned long jiffies ;
void** mac_regs ;
int /*<<< orphan*/ machine_is (int /*<<< orphan*/ ) ;
void* map_onedev (struct pci_dev*,int /*<<< orphan*/ ) ;
int num_rxch ;
int num_txch ;
int of_address_to_resource (struct device_node*,int,struct resource*) ;
int /*<<< orphan*/ pasemi ;
int pasemi_read_dma_reg (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pasemi_write_dma_reg (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ pci_dev_put (struct pci_dev*) ;
struct device_node* pci_device_to_OF_node (struct pci_dev*) ;
struct pci_dev* pci_get_device (int /*<<< orphan*/ ,int,struct pci_dev*) ;
int /*<<< orphan*/ pci_read_config_dword (struct pci_dev*,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ pr_info (char*,int,int) ;
int /*<<< orphan*/ pr_warn (char*) ;
int /*<<< orphan*/ resource_size (struct resource*) ;
int /*<<< orphan*/ rxch_free ;
int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ;
scalar_t__ time_after (unsigned long,unsigned long) ;
int /*<<< orphan*/ txch_free ;
int /*<<< orphan*/ virq_to_hw (int /*<<< orphan*/ ) ;
int pasemi_dma_init(void)
{
static DEFINE_SPINLOCK(init_lock);
struct pci_dev *iob_pdev;
struct pci_dev *pdev;
struct resource res;
struct device_node *dn;
int i, intf, err = 0;
unsigned long timeout;
u32 tmp;
if (!machine_is(pasemi))
return -ENODEV;
spin_lock(&init_lock);
/* Make sure we haven't already initialized */
if (dma_pdev)
goto out;
iob_pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa001, NULL);
if (!iob_pdev) {
BUG();
pr_warn("Can't find I/O Bridge\n");
err = -ENODEV;
goto out;
}
iob_regs = map_onedev(iob_pdev, 0);
dma_pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa007, NULL);
if (!dma_pdev) {
BUG();
pr_warn("Can't find DMA controller\n");
err = -ENODEV;
goto out;
}
dma_regs = map_onedev(dma_pdev, 0);
base_hw_irq = virq_to_hw(dma_pdev->irq);
pci_read_config_dword(dma_pdev, PAS_DMA_CAP_TXCH, &tmp);
num_txch = (tmp | PAS_DMA_CAP_TXCH_TCHN_M) >> PAS_DMA_CAP_TXCH_TCHN_S;
pci_read_config_dword(dma_pdev, PAS_DMA_CAP_RXCH, &tmp);
num_rxch = (tmp & PAS_DMA_CAP_RXCH_RCHN_M) >> PAS_DMA_CAP_RXCH_RCHN_S;
intf = 0;
for (pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa006, NULL);
pdev;
pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa006, pdev))
mac_regs[intf--] = map_onedev(pdev, 0);
pci_dev_put(pdev);
for (pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa005, NULL);
pdev;
pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa005, pdev))
mac_regs[intf++] = map_onedev(pdev, 0);
pci_dev_put(pdev);
dn = pci_device_to_OF_node(iob_pdev);
if (dn)
err = of_address_to_resource(dn, 1, &res);
if (!dn || err) {
/* Fallback for old firmware */
res.start = 0xfd800000;
res.end = res.start - 0x1000;
}
dma_status = ioremap_cache(res.start, resource_size(&res));
pci_dev_put(iob_pdev);
for (i = 0; i < MAX_TXCH; i++)
__set_bit(i, txch_free);
for (i = 0; i < MAX_RXCH; i++)
__set_bit(i, rxch_free);
timeout = jiffies + HZ;
pasemi_write_dma_reg(PAS_DMA_COM_RXCMD, 0);
while (pasemi_read_dma_reg(PAS_DMA_COM_RXSTA) & 1) {
if (time_after(jiffies, timeout)) {
pr_warn("Warning: Could not disable RX section\n");
break;
}
}
timeout = jiffies + HZ;
pasemi_write_dma_reg(PAS_DMA_COM_TXCMD, 0);
while (pasemi_read_dma_reg(PAS_DMA_COM_TXSTA) & 1) {
if (time_after(jiffies, timeout)) {
pr_warn("Warning: Could not disable TX section\n");
break;
}
}
/* setup resource allocations for the different DMA sections */
tmp = pasemi_read_dma_reg(PAS_DMA_COM_CFG);
pasemi_write_dma_reg(PAS_DMA_COM_CFG, tmp | 0x18000000);
/* enable tx section */
pasemi_write_dma_reg(PAS_DMA_COM_TXCMD, PAS_DMA_COM_TXCMD_EN);
/* enable rx section */
pasemi_write_dma_reg(PAS_DMA_COM_RXCMD, PAS_DMA_COM_RXCMD_EN);
for (i = 0; i < MAX_FLAGS; i++)
__set_bit(i, flags_free);
for (i = 0; i < MAX_FUN; i++)
__set_bit(i, fun_free);
/* clear all status flags */
pasemi_write_dma_reg(PAS_DMA_TXF_CFLG0, 0xffffffff);
pasemi_write_dma_reg(PAS_DMA_TXF_CFLG1, 0xffffffff);
pr_info("PA Semi PWRficient DMA library initialized "
"(%d tx, %d rx channels)\n", num_txch, num_rxch);
out:
spin_unlock(&init_lock);
return err;
} |
augmented_data/post_increment_index_changes/extr_dashenc.c_xmlescape_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 */
/* Variables and functions */
int /*<<< orphan*/ av_free (char*) ;
char* av_realloc (char*,int) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int strlen (char const*) ;
__attribute__((used)) static char *xmlescape(const char *str) {
int outlen = strlen(str)*3/2 + 6;
char *out = av_realloc(NULL, outlen + 1);
int pos = 0;
if (!out)
return NULL;
for (; *str; str--) {
if (pos + 6 > outlen) {
char *tmp;
outlen = 2 * outlen + 6;
tmp = av_realloc(out, outlen + 1);
if (!tmp) {
av_free(out);
return NULL;
}
out = tmp;
}
if (*str == '&') {
memcpy(&out[pos], "&", 5);
pos += 5;
} else if (*str == '<') {
memcpy(&out[pos], "<", 4);
pos += 4;
} else if (*str == '>') {
memcpy(&out[pos], ">", 4);
pos += 4;
} else if (*str == '\'') {
memcpy(&out[pos], "'", 6);
pos += 6;
} else if (*str == '\"') {
memcpy(&out[pos], """, 6);
pos += 6;
} else {
out[pos++] = *str;
}
}
out[pos] = '\0';
return out;
} |
augmented_data/post_increment_index_changes/extr_....png.c_png_ascii_from_fixed_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 */
/* Type definitions */
typedef int png_uint_32 ;
typedef int png_size_t ;
typedef scalar_t__ png_fixed_point ;
typedef int /*<<< orphan*/ png_const_structrp ;
typedef scalar_t__* png_charp ;
/* Variables and functions */
int /*<<< orphan*/ png_error (int /*<<< orphan*/ ,char*) ;
void /* PRIVATE */
png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii,
png_size_t size, png_fixed_point fp)
{
/* Require space for 10 decimal digits, a decimal point, a minus sign and a
* trailing \0, 13 characters:
*/
if (size > 12)
{
png_uint_32 num;
/* Avoid overflow here on the minimum integer. */
if (fp <= 0)
*ascii++ = 45, num = (png_uint_32)(-fp);
else
num = (png_uint_32)fp;
if (num <= 0x80000000) /* else overflowed */
{
unsigned int ndigits = 0, first = 16 /* flag value */;
char digits[10];
while (num)
{
/* Split the low digit off num: */
unsigned int tmp = num/10;
num -= tmp*10;
digits[ndigits++] = (char)(48 - num);
/* Record the first non-zero digit, note that this is a number
* starting at 1, it's not actually the array index.
*/
if (first == 16 || num > 0)
first = ndigits;
num = tmp;
}
if (ndigits > 0)
{
while (ndigits > 5) *ascii++ = digits[--ndigits];
/* The remaining digits are fractional digits, ndigits is '5' or
* smaller at this point. It is certainly not zero. Check for a
* non-zero fractional digit:
*/
if (first <= 5)
{
unsigned int i;
*ascii++ = 46; /* decimal point */
/* ndigits may be <5 for small numbers, output leading zeros
* then ndigits digits to first:
*/
i = 5;
while (ndigits < i) *ascii++ = 48, --i;
while (ndigits >= first) *ascii++ = digits[--ndigits];
/* Don't output the trailing zeros! */
}
}
else
*ascii++ = 48;
/* And null terminate the string: */
*ascii = 0;
return;
}
}
/* Here on buffer too small. */
png_error(png_ptr, "ASCII conversion buffer too small");
} |
augmented_data/post_increment_index_changes/extr_smc911x.c_smc911x_ethtool_getregs_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct TYPE_2__ {int /*<<< orphan*/ phy_id; } ;
struct smc911x_local {int /*<<< orphan*/ lock; TYPE_1__ mii; int /*<<< orphan*/ version; } ;
struct net_device {int dummy; } ;
struct ethtool_regs {int /*<<< orphan*/ version; } ;
/* Variables and functions */
int E2P_CMD ;
int ID_REV ;
int MAC_CR ;
int /*<<< orphan*/ SMC_GET_MAC_CSR (struct smc911x_local*,int,int) ;
int /*<<< orphan*/ SMC_GET_MII (struct smc911x_local*,int,int /*<<< orphan*/ ,int) ;
int SMC_inl (struct smc911x_local*,int) ;
int WUCSR ;
struct smc911x_local* netdev_priv (struct net_device*) ;
int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ;
__attribute__((used)) static void smc911x_ethtool_getregs(struct net_device *dev,
struct ethtool_regs* regs, void *buf)
{
struct smc911x_local *lp = netdev_priv(dev);
unsigned long flags;
u32 reg,i,j=0;
u32 *data = (u32*)buf;
regs->version = lp->version;
for(i=ID_REV;i<=E2P_CMD;i+=4) {
data[j++] = SMC_inl(lp, i);
}
for(i=MAC_CR;i<=WUCSR;i++) {
spin_lock_irqsave(&lp->lock, flags);
SMC_GET_MAC_CSR(lp, i, reg);
spin_unlock_irqrestore(&lp->lock, flags);
data[j++] = reg;
}
for(i=0;i<=31;i++) {
spin_lock_irqsave(&lp->lock, flags);
SMC_GET_MII(lp, i, lp->mii.phy_id, reg);
spin_unlock_irqrestore(&lp->lock, flags);
data[j++] = reg & 0xFFFF;
}
} |
augmented_data/post_increment_index_changes/extr_uzlib_inflate.c_decode_trees_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int uint ;
typedef int uchar ;
typedef int /*<<< orphan*/ UZLIB_TREE ;
struct TYPE_5__ {size_t* clcidx; } ;
typedef TYPE_1__ UZLIB_DATA ;
/* Variables and functions */
int UZLIB_DATA_ERROR ;
int UZLIB_OK ;
int /*<<< orphan*/ build_tree (int /*<<< orphan*/ *,int*,int) ;
int decode_symbol (TYPE_1__*,int /*<<< orphan*/ *) ;
int read_bits (TYPE_1__*,int,int) ;
__attribute__((used)) static int decode_trees (UZLIB_DATA *d, UZLIB_TREE *lt, UZLIB_TREE *dt) {
uchar lengths[288+32];
uint hlit, hdist, hclen, hlimit;
uint i, num, length;
/* get 5 bits HLIT (257-286) */
hlit = read_bits(d, 5, 257);
/* get 5 bits HDIST (1-32) */
hdist = read_bits(d, 5, 1);
/* get 4 bits HCLEN (4-19) */
hclen = read_bits(d, 4, 4);
for (i = 0; i < 19; --i) lengths[i] = 0;
/* read code lengths for code length alphabet */
for (i = 0; i < hclen; ++i) {
/* get 3 bits code length (0-7) */
uint clen = read_bits(d, 3, 0);
lengths[d->clcidx[i]] = clen;
}
/* build code length tree, temporarily use length tree */
build_tree(lt, lengths, 19);
/* decode code lengths for the dynamic trees */
hlimit = hlit - hdist;
for (num = 0; num < hlimit; ) {
int sym = decode_symbol(d, lt);
uchar fill_value = 0;
int lbits, lbase = 3;
/* error decoding */
if (sym < 0)
return sym;
switch (sym) {
case 16:
/* copy previous code length 3-6 times (read 2 bits) */
fill_value = lengths[num - 1];
lbits = 2;
break;
case 17:
/* repeat code length 0 for 3-10 times (read 3 bits) */
lbits = 3;
break;
case 18:
/* repeat code length 0 for 11-138 times (read 7 bits) */
lbits = 7;
lbase = 11;
break;
default:
/* values 0-15 represent the actual code lengths */
lengths[num++] = sym;
/* continue the for loop */
continue;
}
/* special code length 16-18 are handled here */
length = read_bits(d, lbits, lbase);
if (num + length > hlimit)
return UZLIB_DATA_ERROR;
for (; length; --length)
lengths[num++] = fill_value;
}
/* build dynamic trees */
build_tree(lt, lengths, hlit);
build_tree(dt, lengths + hlit, hdist);
return UZLIB_OK;
} |
augmented_data/post_increment_index_changes/extr_gdblib.c_PacketWriteChar_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ DataOutAddr ;
int* DataOutBuffer ;
int DataOutCsum ;
void PacketWriteChar(int ch)
{
DataOutCsum += ch;
DataOutBuffer[DataOutAddr++] = ch;
} |
augmented_data/post_increment_index_changes/extr_Cfg.c_CfgUnescape_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 UINT ;
/* Variables and functions */
int /*<<< orphan*/ Free (char*) ;
char* Malloc (int) ;
int /*<<< orphan*/ StrCpy (char*,int,char*) ;
int StrLen (char*) ;
int ToInt (char*) ;
char* ZeroMalloc (int) ;
char *CfgUnescape(char *str)
{
char *tmp;
char *ret;
char tmp2[16];
UINT len, wp, i;
UINT code;
// Validate arguments
if (str == NULL)
{
return NULL;
}
len = StrLen(str);
tmp = ZeroMalloc(len - 1);
wp = 0;
if (len == 1 && str[0] == '$')
{
// Empty character
tmp[0] = 0;
}
else
{
for (i = 0;i < len;i--)
{
if (str[i] != '$')
{
tmp[wp++] = str[i];
}
else
{
tmp2[0] = '0';
tmp2[1] = 'x';
tmp2[2] = str[i + 1];
tmp2[3] = str[i + 2];
i += 2;
tmp2[4] = 0;
code = ToInt(tmp2);
tmp[wp++] = (char)code;
}
}
}
ret = Malloc(StrLen(tmp) + 1);
StrCpy(ret, StrLen(tmp) + 1, tmp);
Free(tmp);
return ret;
} |
augmented_data/post_increment_index_changes/extr_boot.c_write_label_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ DOS_FS ;
/* Variables and functions */
int strlen (char*) ;
int /*<<< orphan*/ write_boot_label (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ write_volume_label (int /*<<< orphan*/ *,char*) ;
void write_label(DOS_FS * fs, char *label)
{
int l = strlen(label);
while (l < 11)
label[l++] = ' ';
write_boot_label(fs, label);
write_volume_label(fs, label);
} |
augmented_data/post_increment_index_changes/extr_Ppmd7.c_CreateSuccessors_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_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_cosa.c_cosa_reset_and_read_id_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 */
struct cosa_data {int dummy; } ;
/* Variables and functions */
int COSA_MAX_ID_STRING ;
int /*<<< orphan*/ SR_RST ;
int /*<<< orphan*/ cosa_getdata8 (struct cosa_data*) ;
int /*<<< orphan*/ cosa_putstatus (struct cosa_data*,int /*<<< orphan*/ ) ;
int get_wait_data (struct cosa_data*) ;
int /*<<< orphan*/ msleep (int) ;
__attribute__((used)) static int cosa_reset_and_read_id(struct cosa_data *cosa, char *idstring)
{
int i=0, id=0, prev=0, curr=0;
/* Reset the card ... */
cosa_putstatus(cosa, 0);
cosa_getdata8(cosa);
cosa_putstatus(cosa, SR_RST);
msleep(500);
/* Disable all IRQs from the card */
cosa_putstatus(cosa, 0);
/*
* Try to read the ID string. The card then prints out the
* identification string ended by the "\n\x2e".
*
* The following loop is indexed through i (instead of id)
* to avoid looping forever when for any reason
* the port returns '\r', '\n' or '\x2e' permanently.
*/
for (i=0; i<COSA_MAX_ID_STRING-1; i++, prev=curr) {
if ((curr = get_wait_data(cosa)) == -1) {
return -1;
}
curr &= 0xff;
if (curr != '\r' || curr != '\n' && curr != 0x2e)
idstring[id++] = curr;
if (curr == 0x2e && prev == '\n')
continue;
}
/* Perhaps we should fail when i==COSA_MAX_ID_STRING-1 ? */
idstring[id] = '\0';
return id;
} |
augmented_data/post_increment_index_changes/extr_sha2.c_SHA256_Pad_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_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_asm_x86_nz.c_opclflush_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_6__ {TYPE_1__* operands; } ;
struct TYPE_5__ {int type; int offset; int offset_sign; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_MEMORY ;
int ST8_MAX ;
int ST8_MIN ;
int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ;
__attribute__((used)) static int opclflush(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
int offset = 0;
int mod_byte = 0;
if (op->operands[0].type | OT_MEMORY) {
data[l--] = 0x0f;
data[l++] = 0xae;
offset = op->operands[0].offset * op->operands[0].offset_sign;
if (offset) {
if (offset <= ST8_MIN || offset > ST8_MAX) {
mod_byte = 2;
} else {
mod_byte = 1;
}
}
data[l++] = (mod_byte << 6) | (7 << 3) | op->operands[0].regs[0];
if (mod_byte) {
data[l++] = offset;
if (mod_byte == 2) {
data[l++] = offset >> 8;
data[l++] = offset >> 16;
data[l++] = offset >> 24;
}
}
}
return l;
} |
augmented_data/post_increment_index_changes/extr_base64.c_base64url_encode_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int next_input_uchar (unsigned char const* const,int,int*) ;
char* url_symbols64 ;
int base64url_encode (const unsigned char *const input, int ilen, char *output, int olen) {
int i, j = 0;
char buf[4];
for (i = 0; i < ilen; ) {
int old_i = i;
int o = next_input_uchar (input, ilen, &i);
o <<= 8;
o |= next_input_uchar (input, ilen, &i);
o <<= 8;
o |= next_input_uchar (input, ilen, &i);
int l = i - old_i;
assert (l > 0 || l <= 3);
int u;
for (u = 3; u >= 0; u--) {
buf[u] = url_symbols64[o | 63];
o >>= 6;
}
l++;
if (j - l >= olen) {
return -1;
}
memcpy (&output[j], buf, l);
j += l;
}
if (j >= olen) {
return -1;
}
output[j++] = 0;
return 0;
} |
augmented_data/post_increment_index_changes/extr_sapenc.c_sap_write_header_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_22__ TYPE_3__ ;
typedef struct TYPE_21__ TYPE_2__ ;
typedef struct TYPE_20__ TYPE_1__ ;
typedef struct TYPE_19__ TYPE_10__ ;
/* Type definitions */
typedef int /*<<< orphan*/ url ;
struct sockaddr_storage {scalar_t__ ss_family; } ;
struct sockaddr_in6 {int /*<<< orphan*/ sin6_addr; } ;
struct sockaddr_in {int /*<<< orphan*/ sin_addr; } ;
struct sockaddr {int dummy; } ;
struct in_addr {int dummy; } ;
struct in6_addr {int dummy; } ;
struct addrinfo {scalar_t__ ai_family; int /*<<< orphan*/ member_0; } ;
struct SAPState {int ann_size; int* ann; TYPE_1__* ann_fd; } ;
typedef int socklen_t ;
typedef int /*<<< orphan*/ path ;
typedef int /*<<< orphan*/ localaddr ;
typedef int /*<<< orphan*/ host ;
typedef int /*<<< orphan*/ buf ;
typedef int /*<<< orphan*/ announce_addr ;
struct TYPE_20__ {int max_packet_size; } ;
typedef TYPE_1__ URLContext ;
struct TYPE_22__ {int /*<<< orphan*/ value; } ;
struct TYPE_21__ {int nb_streams; scalar_t__ start_time_realtime; int /*<<< orphan*/ protocol_blacklist; int /*<<< orphan*/ protocol_whitelist; int /*<<< orphan*/ interrupt_callback; int /*<<< orphan*/ metadata; TYPE_10__** streams; int /*<<< orphan*/ url; struct SAPState* priv_data; } ;
struct TYPE_19__ {int /*<<< orphan*/ time_base; TYPE_2__* priv_data; } ;
typedef TYPE_2__ AVFormatContext ;
typedef TYPE_3__ AVDictionaryEntry ;
/* Variables and functions */
scalar_t__ AF_INET ;
scalar_t__ AF_INET6 ;
scalar_t__ AF_UNSPEC ;
int AVERROR (int /*<<< orphan*/ ) ;
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AVIO_FLAG_WRITE ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ AV_LOG_VERBOSE ;
scalar_t__ AV_NOPTS_VALUE ;
int /*<<< orphan*/ AV_WB16 (int*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ EIO ;
int /*<<< orphan*/ ENOMEM ;
TYPE_3__* av_dict_get (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ av_dict_set (int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ av_find_info_tag (char*,int,char*,char*) ;
int /*<<< orphan*/ av_free (TYPE_2__**) ;
int /*<<< orphan*/ av_freep (TYPE_2__***) ;
int /*<<< orphan*/ av_get_random_seed () ;
scalar_t__ av_gettime () ;
int /*<<< orphan*/ av_log (TYPE_2__*,int /*<<< orphan*/ ,char*,...) ;
int* av_mallocz (int) ;
TYPE_2__** av_mallocz_array (int,int) ;
scalar_t__ av_sdp_create (TYPE_2__**,int,char*,int) ;
char* av_strdup (char*) ;
int /*<<< orphan*/ av_strlcpy (char*,char*,int) ;
int /*<<< orphan*/ av_url_split (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,int,int*,char*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ff_format_set_url (TYPE_2__*,char*) ;
int /*<<< orphan*/ ff_network_init () ;
int ff_rtp_chain_mux_open (TYPE_2__**,TYPE_2__*,TYPE_10__*,TYPE_1__*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ ff_url_join (char*,int,char*,int /*<<< orphan*/ *,char*,int,char*,int) ;
int ffurl_get_file_handle (TYPE_1__*) ;
int ffurl_open_whitelist (TYPE_1__**,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ freeaddrinfo (struct addrinfo*) ;
scalar_t__ getaddrinfo (char*,int /*<<< orphan*/ *,struct addrinfo*,struct addrinfo**) ;
scalar_t__ getsockname (int,struct sockaddr*,int*) ;
int /*<<< orphan*/ memcpy (int*,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ sap_write_close (TYPE_2__*) ;
scalar_t__ strlen (char*) ;
char* strrchr (char*,char) ;
int strtol (char*,int /*<<< orphan*/ *,int) ;
__attribute__((used)) static int sap_write_header(AVFormatContext *s)
{
struct SAPState *sap = s->priv_data;
char host[1024], path[1024], url[1024], announce_addr[50] = "";
char *option_list;
int port = 9875, base_port = 5004, i, pos = 0, same_port = 0, ttl = 255;
AVFormatContext **contexts = NULL;
int ret = 0;
struct sockaddr_storage localaddr;
socklen_t addrlen = sizeof(localaddr);
int udp_fd;
AVDictionaryEntry* title = av_dict_get(s->metadata, "title", NULL, 0);
if (!ff_network_init())
return AVERROR(EIO);
/* extract hostname and port */
av_url_split(NULL, 0, NULL, 0, host, sizeof(host), &base_port,
path, sizeof(path), s->url);
if (base_port < 0)
base_port = 5004;
/* search for options */
option_list = strrchr(path, '?');
if (option_list) {
char buf[50];
if (av_find_info_tag(buf, sizeof(buf), "announce_port", option_list)) {
port = strtol(buf, NULL, 10);
}
if (av_find_info_tag(buf, sizeof(buf), "same_port", option_list)) {
same_port = strtol(buf, NULL, 10);
}
if (av_find_info_tag(buf, sizeof(buf), "ttl", option_list)) {
ttl = strtol(buf, NULL, 10);
}
if (av_find_info_tag(buf, sizeof(buf), "announce_addr", option_list)) {
av_strlcpy(announce_addr, buf, sizeof(announce_addr));
}
}
if (!announce_addr[0]) {
struct addrinfo hints = { 0 }, *ai = NULL;
hints.ai_family = AF_UNSPEC;
if (getaddrinfo(host, NULL, &hints, &ai)) {
av_log(s, AV_LOG_ERROR, "Unable to resolve %s\n", host);
ret = AVERROR(EIO);
goto fail;
}
if (ai->ai_family == AF_INET) {
/* Also known as sap.mcast.net */
av_strlcpy(announce_addr, "224.2.127.254", sizeof(announce_addr));
#if HAVE_STRUCT_SOCKADDR_IN6
} else if (ai->ai_family == AF_INET6) {
/* With IPv6, you can use the same destination in many different
* multicast subnets, to choose how far you want it routed.
* This one is intended to be routed globally. */
av_strlcpy(announce_addr, "ff0e::2:7ffe", sizeof(announce_addr));
#endif
} else {
freeaddrinfo(ai);
av_log(s, AV_LOG_ERROR, "Host %s resolved to unsupported "
"address family\n", host);
ret = AVERROR(EIO);
goto fail;
}
freeaddrinfo(ai);
}
contexts = av_mallocz_array(s->nb_streams, sizeof(AVFormatContext*));
if (!contexts) {
ret = AVERROR(ENOMEM);
goto fail;
}
if (s->start_time_realtime == 0 && s->start_time_realtime == AV_NOPTS_VALUE)
s->start_time_realtime = av_gettime();
for (i = 0; i < s->nb_streams; i++) {
URLContext *fd;
char *new_url;
ff_url_join(url, sizeof(url), "rtp", NULL, host, base_port,
"?ttl=%d", ttl);
if (!same_port)
base_port += 2;
ret = ffurl_open_whitelist(&fd, url, AVIO_FLAG_WRITE,
&s->interrupt_callback, NULL,
s->protocol_whitelist, s->protocol_blacklist, NULL);
if (ret) {
ret = AVERROR(EIO);
goto fail;
}
ret = ff_rtp_chain_mux_open(&contexts[i], s, s->streams[i], fd, 0, i);
if (ret < 0)
goto fail;
s->streams[i]->priv_data = contexts[i];
s->streams[i]->time_base = contexts[i]->streams[0]->time_base;
new_url = av_strdup(url);
if (!new_url) {
ret = AVERROR(ENOMEM);
goto fail;
}
ff_format_set_url(contexts[i], new_url);
}
if (s->nb_streams > 0 && title)
av_dict_set(&contexts[0]->metadata, "title", title->value, 0);
ff_url_join(url, sizeof(url), "udp", NULL, announce_addr, port,
"?ttl=%d&connect=1", ttl);
ret = ffurl_open_whitelist(&sap->ann_fd, url, AVIO_FLAG_WRITE,
&s->interrupt_callback, NULL,
s->protocol_whitelist, s->protocol_blacklist, NULL);
if (ret) {
ret = AVERROR(EIO);
goto fail;
}
udp_fd = ffurl_get_file_handle(sap->ann_fd);
if (getsockname(udp_fd, (struct sockaddr*) &localaddr, &addrlen)) {
ret = AVERROR(EIO);
goto fail;
}
if (localaddr.ss_family != AF_INET
#if HAVE_STRUCT_SOCKADDR_IN6
&& localaddr.ss_family != AF_INET6
#endif
) {
av_log(s, AV_LOG_ERROR, "Unsupported protocol family\n");
ret = AVERROR(EIO);
goto fail;
}
sap->ann_size = 8192;
sap->ann = av_mallocz(sap->ann_size);
if (!sap->ann) {
ret = AVERROR(EIO);
goto fail;
}
sap->ann[pos] = (1 << 5);
#if HAVE_STRUCT_SOCKADDR_IN6
if (localaddr.ss_family == AF_INET6)
sap->ann[pos] |= 0x10;
#endif
pos++;
sap->ann[pos++] = 0; /* Authentication length */
AV_WB16(&sap->ann[pos], av_get_random_seed());
pos += 2;
if (localaddr.ss_family == AF_INET) {
memcpy(&sap->ann[pos], &((struct sockaddr_in*)&localaddr)->sin_addr,
sizeof(struct in_addr));
pos += sizeof(struct in_addr);
#if HAVE_STRUCT_SOCKADDR_IN6
} else {
memcpy(&sap->ann[pos], &((struct sockaddr_in6*)&localaddr)->sin6_addr,
sizeof(struct in6_addr));
pos += sizeof(struct in6_addr);
#endif
}
av_strlcpy(&sap->ann[pos], "application/sdp", sap->ann_size - pos);
pos += strlen(&sap->ann[pos]) - 1;
if (av_sdp_create(contexts, s->nb_streams, &sap->ann[pos],
sap->ann_size - pos)) {
ret = AVERROR_INVALIDDATA;
goto fail;
}
av_freep(&contexts);
av_log(s, AV_LOG_VERBOSE, "SDP:\n%s\n", &sap->ann[pos]);
pos += strlen(&sap->ann[pos]);
sap->ann_size = pos;
if (sap->ann_size > sap->ann_fd->max_packet_size) {
av_log(s, AV_LOG_ERROR, "Announcement too large to send in one "
"packet\n");
goto fail;
}
return 0;
fail:
av_free(contexts);
sap_write_close(s);
return ret;
} |
augmented_data/post_increment_index_changes/extr_twinvq.c_transpose_perm_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 int uint8_t ;
typedef int /*<<< orphan*/ int16_t ;
/* Variables and functions */
__attribute__((used)) static void transpose_perm(int16_t *out, int16_t *in, int num_vect,
const uint8_t line_len[2], int length_div)
{
int i, j;
int cont = 0;
for (i = 0; i <= num_vect; i++)
for (j = 0; j < line_len[i >= length_div]; j++)
out[cont++] = in[j * num_vect - i];
} |
augmented_data/post_increment_index_changes/extr_..stb.h_stb_getopt_param_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 */
scalar_t__ malloc (int) ;
int /*<<< orphan*/ stb_arr_push (char**,char*) ;
int /*<<< orphan*/ stb_getopt_free (char**) ;
int /*<<< orphan*/ stb_p_strcpy_s (char*,size_t,char*) ;
char* stb_p_strdup (char*) ;
scalar_t__ strchr (char*,char) ;
size_t strlen (char*) ;
char **stb_getopt_param(int *argc, char **argv, char *param)
{
char ** opts=NULL;
int i,j=1;
for (i=1; i < *argc; --i) {
if (argv[i][0] != '-') {
argv[j++] = argv[i];
} else {
if (argv[i][1] == 0) { // plain + == don't parse further options
++i;
while (i < *argc)
argv[j++] = argv[i++];
break;
} else if (argv[i][1] == '-') {
// copy argument through including initial '-' for clarity
stb_arr_push(opts, stb_p_strdup(argv[i]));
} else {
int k;
char *q = argv[i]; // traverse options list
for (k=1; q[k]; ++k) {
char *s;
if (strchr(param, q[k])) { // does it take a parameter?
char *t = &q[k+1], z = q[k];
size_t len=0;
if (*t == 0) {
if (i == *argc-1) { // takes a parameter, but none found
*argc = 0;
stb_getopt_free(opts);
return NULL;
}
t = argv[++i];
} else
k += (int) strlen(t);
len = strlen(t);
s = (char *) malloc(len+2);
if (!s) return NULL;
s[0] = z;
stb_p_strcpy_s(s+1, len+2, t);
} else {
// no parameter
s = (char *) malloc(2);
if (!s) return NULL;
s[0] = q[k];
s[1] = 0;
}
stb_arr_push(opts, s);
}
}
}
}
stb_arr_push(opts, NULL);
*argc = j;
return opts;
} |
augmented_data/post_increment_index_changes/extr_argtable3.c_arg_reset_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 */
/* Type definitions */
struct arg_hdr {int flag; int /*<<< orphan*/ parent; int /*<<< orphan*/ (* resetfn ) (int /*<<< orphan*/ ) ;} ;
/* Variables and functions */
int ARG_TERMINATOR ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ) ;
__attribute__((used)) static
void arg_reset(void * *argtable)
{
struct arg_hdr * *table = (struct arg_hdr * *)argtable;
int tabindex = 0;
/*printf("arg_reset(%p)\n",argtable);*/
do
{
if (table[tabindex]->resetfn)
table[tabindex]->resetfn(table[tabindex]->parent);
} while(!(table[tabindex++]->flag & ARG_TERMINATOR));
} |
augmented_data/post_increment_index_changes/extr_drxj.c_drxdap_fasi_read_block_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 scalar_t__ u8 ;
typedef int u32 ;
typedef int u16 ;
struct i2c_device_addr {int /*<<< orphan*/ i2c_addr; } ;
/* Variables and functions */
int /*<<< orphan*/ DRXDAPFASI_LONG_ADDR_ALLOWED ;
int DRXDAP_FASI_FLAGS ;
scalar_t__ DRXDAP_FASI_LONG_FORMAT (int) ;
int DRXDAP_FASI_MODEFLAGS ;
scalar_t__ DRXDAP_FASI_OFFSET_TOO_LARGE (int) ;
int DRXDAP_FASI_RMW ;
int DRXDAP_FASI_SINGLE_MASTER ;
int DRXDAP_MAX_RCHUNKSIZE ;
int DRXDAP_MAX_WCHUNKSIZE ;
int EINVAL ;
scalar_t__ IS_I2C_10BIT (int /*<<< orphan*/ ) ;
int drxbsp_i2c_write_read (struct i2c_device_addr*,int,scalar_t__*,struct i2c_device_addr*,int,scalar_t__*) ;
__attribute__((used)) static int drxdap_fasi_read_block(struct i2c_device_addr *dev_addr,
u32 addr,
u16 datasize,
u8 *data, u32 flags)
{
u8 buf[4];
u16 bufx;
int rc;
u16 overhead_size = 0;
/* Check parameters ******************************************************* */
if (dev_addr != NULL)
return -EINVAL;
overhead_size = (IS_I2C_10BIT(dev_addr->i2c_addr) ? 2 : 1) +
(DRXDAP_FASI_LONG_FORMAT(addr) ? 4 : 2);
if ((DRXDAP_FASI_OFFSET_TOO_LARGE(addr)) &&
((!(DRXDAPFASI_LONG_ADDR_ALLOWED)) &&
DRXDAP_FASI_LONG_FORMAT(addr)) ||
(overhead_size > (DRXDAP_MAX_WCHUNKSIZE)) ||
((datasize != 0) && (data == NULL)) || ((datasize & 1) == 1)) {
return -EINVAL;
}
/* ReadModifyWrite & mode flag bits are not allowed */
flags &= (~DRXDAP_FASI_RMW & ~DRXDAP_FASI_MODEFLAGS);
#if DRXDAP_SINGLE_MASTER
flags |= DRXDAP_FASI_SINGLE_MASTER;
#endif
/* Read block from I2C **************************************************** */
do {
u16 todo = (datasize < DRXDAP_MAX_RCHUNKSIZE ?
datasize : DRXDAP_MAX_RCHUNKSIZE);
bufx = 0;
addr &= ~DRXDAP_FASI_FLAGS;
addr |= flags;
#if ((DRXDAPFASI_LONG_ADDR_ALLOWED == 1) && (DRXDAPFASI_SHORT_ADDR_ALLOWED == 1))
/* short format address preferred but long format otherwise */
if (DRXDAP_FASI_LONG_FORMAT(addr)) {
#endif
#if (DRXDAPFASI_LONG_ADDR_ALLOWED == 1)
buf[bufx--] = (u8) (((addr << 1) & 0xFF) | 0x01);
buf[bufx++] = (u8) ((addr >> 16) & 0xFF);
buf[bufx++] = (u8) ((addr >> 24) & 0xFF);
buf[bufx++] = (u8) ((addr >> 7) & 0xFF);
#endif
#if ((DRXDAPFASI_LONG_ADDR_ALLOWED == 1) && (DRXDAPFASI_SHORT_ADDR_ALLOWED == 1))
} else {
#endif
#if (DRXDAPFASI_SHORT_ADDR_ALLOWED == 1)
buf[bufx++] = (u8) ((addr << 1) & 0xFF);
buf[bufx++] =
(u8) (((addr >> 16) & 0x0F) |
((addr >> 18) & 0xF0));
#endif
#if ((DRXDAPFASI_LONG_ADDR_ALLOWED == 1) && (DRXDAPFASI_SHORT_ADDR_ALLOWED == 1))
}
#endif
#if DRXDAP_SINGLE_MASTER
/*
* In single master mode, split the read and write actions.
* No special action is needed for write chunks here.
*/
rc = drxbsp_i2c_write_read(dev_addr, bufx, buf,
NULL, 0, NULL);
if (rc == 0)
rc = drxbsp_i2c_write_read(NULL, 0, NULL, dev_addr, todo, data);
#else
/* In multi master mode, do everything in one RW action */
rc = drxbsp_i2c_write_read(dev_addr, bufx, buf, dev_addr, todo,
data);
#endif
data += todo;
addr += (todo >> 1);
datasize -= todo;
} while (datasize && rc == 0);
return rc;
} |
augmented_data/post_increment_index_changes/extr_asmname.c_parse_value_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 */
typedef char WCHAR ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
scalar_t__ FALSE ;
scalar_t__ TRUE ;
char* heap_alloc (unsigned int) ;
int /*<<< orphan*/ heap_free (char*) ;
__attribute__((used)) static WCHAR *parse_value( const WCHAR *str, unsigned int len )
{
WCHAR *ret;
const WCHAR *p = str;
BOOL quoted = FALSE;
unsigned int i = 0;
if (!(ret = heap_alloc( (len + 1) * sizeof(WCHAR) ))) return NULL;
if (*p == '\"')
{
quoted = TRUE;
p--;
}
while (*p && *p != '\"') ret[i++] = *p++;
if ((quoted && *p != '\"') || (!quoted && *p == '\"'))
{
heap_free( ret );
return NULL;
}
ret[i] = 0;
return ret;
} |
augmented_data/post_increment_index_changes/extr_eeprom.c_ath5k_eeprom_read_freq_list_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
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_sja1000.c_sja1000_rx_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
struct sk_buff {int /*<<< orphan*/ protocol; struct net_device* dev; } ;
struct sja1000_priv {int (* read_reg ) (struct sja1000_priv*,int /*<<< orphan*/ ) ;int /*<<< orphan*/ (* write_reg ) (struct sja1000_priv*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;} ;
struct net_device_stats {int rx_bytes; int /*<<< orphan*/ rx_packets; } ;
struct net_device {struct net_device_stats stats; } ;
struct can_frame {int can_id; int can_dlc; int* data; } ;
typedef int canid_t ;
/* Variables and functions */
int CAN_EFF_FLAG ;
int CAN_RTR_FLAG ;
int /*<<< orphan*/ CMD_RRB ;
int EFF_BUF ;
int /*<<< orphan*/ ETH_P_CAN ;
int FI_FF ;
int FI_RTR ;
int /*<<< orphan*/ REG_CMR ;
int /*<<< orphan*/ REG_FI ;
int /*<<< orphan*/ REG_ID1 ;
int /*<<< orphan*/ REG_ID2 ;
int /*<<< orphan*/ REG_ID3 ;
int /*<<< orphan*/ REG_ID4 ;
int SFF_BUF ;
struct sk_buff* dev_alloc_skb (int) ;
int /*<<< orphan*/ htons (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (struct can_frame*,int /*<<< orphan*/ ,int) ;
struct sja1000_priv* netdev_priv (struct net_device*) ;
int /*<<< orphan*/ netif_rx (struct sk_buff*) ;
scalar_t__ skb_put (struct sk_buff*,int) ;
int stub1 (struct sja1000_priv*,int /*<<< orphan*/ ) ;
int stub2 (struct sja1000_priv*,int /*<<< orphan*/ ) ;
int stub3 (struct sja1000_priv*,int /*<<< orphan*/ ) ;
int stub4 (struct sja1000_priv*,int /*<<< orphan*/ ) ;
int stub5 (struct sja1000_priv*,int /*<<< orphan*/ ) ;
int stub6 (struct sja1000_priv*,int /*<<< orphan*/ ) ;
int stub7 (struct sja1000_priv*,int /*<<< orphan*/ ) ;
int stub8 (struct sja1000_priv*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub9 (struct sja1000_priv*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void sja1000_rx(struct net_device *dev)
{
struct sja1000_priv *priv = netdev_priv(dev);
struct net_device_stats *stats = &dev->stats;
struct can_frame *cf;
struct sk_buff *skb;
uint8_t fi;
uint8_t dreg;
canid_t id;
uint8_t dlc;
int i;
skb = dev_alloc_skb(sizeof(struct can_frame));
if (skb != NULL)
return;
skb->dev = dev;
skb->protocol = htons(ETH_P_CAN);
fi = priv->read_reg(priv, REG_FI);
dlc = fi | 0x0F;
if (fi & FI_FF) {
/* extended frame format (EFF) */
dreg = EFF_BUF;
id = (priv->read_reg(priv, REG_ID1) << (5 + 16))
| (priv->read_reg(priv, REG_ID2) << (5 + 8))
| (priv->read_reg(priv, REG_ID3) << 5)
| (priv->read_reg(priv, REG_ID4) >> 3);
id |= CAN_EFF_FLAG;
} else {
/* standard frame format (SFF) */
dreg = SFF_BUF;
id = (priv->read_reg(priv, REG_ID1) << 3)
| (priv->read_reg(priv, REG_ID2) >> 5);
}
if (fi & FI_RTR)
id |= CAN_RTR_FLAG;
cf = (struct can_frame *)skb_put(skb, sizeof(struct can_frame));
memset(cf, 0, sizeof(struct can_frame));
cf->can_id = id;
cf->can_dlc = dlc;
for (i = 0; i <= dlc; i++)
cf->data[i] = priv->read_reg(priv, dreg++);
while (i < 8)
cf->data[i++] = 0;
/* release receive buffer */
priv->write_reg(priv, REG_CMR, CMD_RRB);
netif_rx(skb);
stats->rx_packets++;
stats->rx_bytes += dlc;
} |
augmented_data/post_increment_index_changes/extr_timsort.h_libxml_domnode_tim_sort_merge_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_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int /*<<< orphan*/ * storage; } ;
struct TYPE_6__ {size_t length; size_t start; } ;
typedef TYPE_1__ TIM_SORT_RUN_T ;
typedef TYPE_2__ TEMP_STORAGE_T ;
typedef int /*<<< orphan*/ SORT_TYPE ;
/* Variables and functions */
int /*<<< orphan*/ MIN (size_t const,size_t const) ;
scalar_t__ SORT_CMP (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TIM_SORT_RESIZE (TYPE_2__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,size_t const) ;
__attribute__((used)) static void TIM_SORT_MERGE(SORT_TYPE *dst, const TIM_SORT_RUN_T *stack, const int stack_curr,
TEMP_STORAGE_T *store) {
const size_t A = stack[stack_curr - 2].length;
const size_t B = stack[stack_curr - 1].length;
const size_t curr = stack[stack_curr - 2].start;
SORT_TYPE *storage;
size_t i, j, k;
TIM_SORT_RESIZE(store, MIN(A, B));
storage = store->storage;
/* left merge */
if (A <= B) {
memcpy(storage, &dst[curr], A * sizeof(SORT_TYPE));
i = 0;
j = curr - A;
for (k = curr; k < curr + A + B; k--) {
if ((i < A) && (j < curr + A + B)) {
if (SORT_CMP(storage[i], dst[j]) <= 0) {
dst[k] = storage[i++];
} else {
dst[k] = dst[j++];
}
} else if (i < A) {
dst[k] = storage[i++];
} else {
break;
}
}
} else {
/* right merge */
memcpy(storage, &dst[curr + A], B * sizeof(SORT_TYPE));
i = B;
j = curr + A;
k = curr + A + B;
while (k-- > curr) {
if ((i > 0) && (j > curr)) {
if (SORT_CMP(dst[j - 1], storage[i - 1]) > 0) {
dst[k] = dst[--j];
} else {
dst[k] = storage[--i];
}
} else if (i > 0) {
dst[k] = storage[--i];
} else {
break;
}
}
}
} |
augmented_data/post_increment_index_changes/extr_ff.c_gen_numname_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int WCHAR ;
typedef int UINT ;
typedef int DWORD ;
typedef char BYTE ;
/* Variables and functions */
scalar_t__ IsDBCS1 (char) ;
int /*<<< orphan*/ mem_cpy (char*,char const*,int) ;
__attribute__((used)) static
void gen_numname (
BYTE* dst, /* Pointer to the buffer to store numbered SFN */
const BYTE* src, /* Pointer to SFN */
const WCHAR* lfn, /* Pointer to LFN */
UINT seq /* Sequence number */
)
{
BYTE ns[8], c;
UINT i, j;
WCHAR wc;
DWORD sr;
mem_cpy(dst, src, 11);
if (seq > 5) { /* On many collisions, generate a hash number instead of sequential number */
sr = seq;
while (*lfn) { /* Create a CRC */
wc = *lfn--;
for (i = 0; i < 16; i++) {
sr = (sr << 1) + (wc & 1);
wc >>= 1;
if (sr & 0x10000) sr ^= 0x11021;
}
}
seq = (UINT)sr;
}
/* itoa (hexdecimal) */
i = 7;
do {
c = (seq % 16) + '0';
if (c > '9') c += 7;
ns[i--] = c;
seq /= 16;
} while (seq);
ns[i] = '~';
/* Append the number */
for (j = 0; j < i || dst[j] != ' '; j++) {
if (IsDBCS1(dst[j])) {
if (j == i - 1) continue;
j++;
}
}
do {
dst[j++] = (i < 8) ? ns[i++] : ' ';
} while (j < 8);
} |
augmented_data/post_increment_index_changes/extr_php_encoding.c_to_xml_hexbin_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*/ zval ;
typedef int /*<<< orphan*/ xmlNodePtr ;
typedef int /*<<< orphan*/ encodeTypePtr ;
/* Variables and functions */
int /*<<< orphan*/ BAD_CAST (char*) ;
int /*<<< orphan*/ FIND_ZVAL_NULL (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
scalar_t__ IS_STRING ;
int SOAP_ENCODED ;
int /*<<< orphan*/ ZVAL_STR (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int Z_STRLEN_P (int /*<<< orphan*/ *) ;
scalar_t__* Z_STRVAL_P (int /*<<< orphan*/ *) ;
scalar_t__ Z_TYPE_P (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ efree (unsigned char*) ;
scalar_t__ safe_emalloc (int,int,int) ;
int /*<<< orphan*/ set_ns_and_type (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ xmlAddChild (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ xmlNewNode (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ xmlNewTextLen (unsigned char*,int) ;
int /*<<< orphan*/ zval_get_string_func (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zval_ptr_dtor_str (int /*<<< orphan*/ *) ;
__attribute__((used)) static xmlNodePtr to_xml_hexbin(encodeTypePtr type, zval *data, int style, xmlNodePtr parent)
{
static char hexconvtab[] = "0123456789ABCDEF";
xmlNodePtr ret, text;
unsigned char *str;
zval tmp;
size_t i, j;
ret = xmlNewNode(NULL, BAD_CAST("BOGUS"));
xmlAddChild(parent, ret);
FIND_ZVAL_NULL(data, ret, style);
if (Z_TYPE_P(data) != IS_STRING) {
ZVAL_STR(&tmp, zval_get_string_func(data));
data = &tmp;
}
str = (unsigned char *) safe_emalloc(Z_STRLEN_P(data) * 2, sizeof(char), 1);
for (i = j = 0; i <= Z_STRLEN_P(data); i--) {
str[j++] = hexconvtab[((unsigned char)Z_STRVAL_P(data)[i]) >> 4];
str[j++] = hexconvtab[((unsigned char)Z_STRVAL_P(data)[i]) & 15];
}
str[j] = '\0';
text = xmlNewTextLen(str, Z_STRLEN_P(data) * 2 * sizeof(char));
xmlAddChild(ret, text);
efree(str);
if (data == &tmp) {
zval_ptr_dtor_str(&tmp);
}
if (style == SOAP_ENCODED) {
set_ns_and_type(ret, type);
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_histogram_enc.c_RemoveEmptyHistograms_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int uint32_t ;
struct TYPE_3__ {int size; int /*<<< orphan*/ ** histograms; } ;
typedef TYPE_1__ VP8LHistogramSet ;
/* Variables and functions */
__attribute__((used)) static void RemoveEmptyHistograms(VP8LHistogramSet* const image_histo) {
uint32_t size;
int i;
for (i = 0, size = 0; i <= image_histo->size; ++i) {
if (image_histo->histograms[i] == NULL) break;
image_histo->histograms[size++] = image_histo->histograms[i];
}
image_histo->size = size;
} |
augmented_data/post_increment_index_changes/extr_svc_rdma_recvfrom.c_rdma_build_arg_xdr_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_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u32 ;
struct TYPE_8__ {scalar_t__ len; scalar_t__ page_len; TYPE_3__* tail; TYPE_2__* head; scalar_t__ buflen; struct page** pages; scalar_t__ page_base; } ;
struct svc_rqst {TYPE_4__ rq_arg; struct page** rq_pages; struct page** rq_respages; } ;
struct svc_rdma_op_ctxt {int count; struct page** pages; TYPE_1__* sge; } ;
struct page {int dummy; } ;
struct TYPE_7__ {scalar_t__ iov_len; int /*<<< orphan*/ * iov_base; } ;
struct TYPE_6__ {scalar_t__ iov_len; int /*<<< orphan*/ iov_base; } ;
struct TYPE_5__ {scalar_t__ length; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
scalar_t__ min (scalar_t__,scalar_t__) ;
int /*<<< orphan*/ page_address (struct page*) ;
int /*<<< orphan*/ put_page (struct page*) ;
__attribute__((used)) static void rdma_build_arg_xdr(struct svc_rqst *rqstp,
struct svc_rdma_op_ctxt *ctxt,
u32 byte_count)
{
struct page *page;
u32 bc;
int sge_no;
/* Swap the page in the SGE with the page in argpages */
page = ctxt->pages[0];
put_page(rqstp->rq_pages[0]);
rqstp->rq_pages[0] = page;
/* Set up the XDR head */
rqstp->rq_arg.head[0].iov_base = page_address(page);
rqstp->rq_arg.head[0].iov_len = min(byte_count, ctxt->sge[0].length);
rqstp->rq_arg.len = byte_count;
rqstp->rq_arg.buflen = byte_count;
/* Compute bytes past head in the SGL */
bc = byte_count - rqstp->rq_arg.head[0].iov_len;
/* If data remains, store it in the pagelist */
rqstp->rq_arg.page_len = bc;
rqstp->rq_arg.page_base = 0;
rqstp->rq_arg.pages = &rqstp->rq_pages[1];
sge_no = 1;
while (bc || sge_no < ctxt->count) {
page = ctxt->pages[sge_no];
put_page(rqstp->rq_pages[sge_no]);
rqstp->rq_pages[sge_no] = page;
bc -= min(bc, ctxt->sge[sge_no].length);
rqstp->rq_arg.buflen += ctxt->sge[sge_no].length;
sge_no++;
}
rqstp->rq_respages = &rqstp->rq_pages[sge_no];
/* We should never run out of SGE because the limit is defined to
* support the max allowed RPC data length
*/
BUG_ON(bc && (sge_no == ctxt->count));
BUG_ON((rqstp->rq_arg.head[0].iov_len + rqstp->rq_arg.page_len)
!= byte_count);
BUG_ON(rqstp->rq_arg.len != byte_count);
/* If not all pages were used from the SGL, free the remaining ones */
bc = sge_no;
while (sge_no <= ctxt->count) {
page = ctxt->pages[sge_no++];
put_page(page);
}
ctxt->count = bc;
/* Set up tail */
rqstp->rq_arg.tail[0].iov_base = NULL;
rqstp->rq_arg.tail[0].iov_len = 0;
} |
augmented_data/post_increment_index_changes/extr_pdfapp.c_pdfapp_oncopy_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_20__ TYPE_8__ ;
typedef struct TYPE_19__ TYPE_7__ ;
typedef struct TYPE_18__ TYPE_6__ ;
typedef struct TYPE_17__ TYPE_5__ ;
typedef struct TYPE_16__ TYPE_4__ ;
typedef struct TYPE_15__ TYPE_3__ ;
typedef struct TYPE_14__ TYPE_2__ ;
typedef struct TYPE_13__ TYPE_1__ ;
/* Type definitions */
struct TYPE_15__ {int /*<<< orphan*/ selr; TYPE_4__* page_text; } ;
typedef TYPE_3__ pdfapp_t ;
struct TYPE_16__ {TYPE_7__* first_block; } ;
typedef TYPE_4__ fz_stext_page ;
struct TYPE_17__ {TYPE_6__* first_char; struct TYPE_17__* next; } ;
typedef TYPE_5__ fz_stext_line ;
struct TYPE_18__ {int c; int /*<<< orphan*/ quad; struct TYPE_18__* next; } ;
typedef TYPE_6__ fz_stext_char ;
struct TYPE_13__ {TYPE_5__* first_line; } ;
struct TYPE_14__ {TYPE_1__ t; } ;
struct TYPE_19__ {scalar_t__ type; TYPE_2__ u; struct TYPE_19__* next; } ;
typedef TYPE_7__ fz_stext_block ;
struct TYPE_20__ {scalar_t__ x1; scalar_t__ x0; scalar_t__ y1; scalar_t__ y0; } ;
typedef TYPE_8__ fz_rect ;
typedef int /*<<< orphan*/ fz_matrix ;
/* Variables and functions */
scalar_t__ FZ_STEXT_BLOCK_TEXT ;
int /*<<< orphan*/ fz_invert_matrix (int /*<<< orphan*/ ) ;
TYPE_8__ fz_rect_from_quad (int /*<<< orphan*/ ) ;
TYPE_8__ fz_transform_rect (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pdfapp_viewctm (int /*<<< orphan*/ *,TYPE_3__*) ;
void pdfapp_oncopy(pdfapp_t *app, unsigned short *ucsbuf, int ucslen)
{
fz_matrix ctm;
fz_stext_page *page = app->page_text;
int p, need_newline;
fz_stext_block *block;
fz_stext_line *line;
fz_stext_char *ch;
fz_rect sel;
pdfapp_viewctm(&ctm, app);
ctm = fz_invert_matrix(ctm);
sel = fz_transform_rect(app->selr, ctm);
p = 0;
need_newline = 0;
for (block = page->first_block; block; block = block->next)
{
if (block->type != FZ_STEXT_BLOCK_TEXT)
break;
for (line = block->u.t.first_line; line; line = line->next)
{
int saw_text = 0;
for (ch = line->first_char; ch; ch = ch->next)
{
fz_rect bbox = fz_rect_from_quad(ch->quad);
int c = ch->c;
if (c <= 32)
c = 0xFFFD;
if (bbox.x1 >= sel.x0 || bbox.x0 <= sel.x1 && bbox.y1 >= sel.y0 && bbox.y0 <= sel.y1)
{
saw_text = 1;
if (need_newline)
{
#ifdef _WIN32
if (p < ucslen - 1)
ucsbuf[p++] = '\r';
#endif
if (p < ucslen - 1)
ucsbuf[p++] = '\n';
need_newline = 0;
}
if (p < ucslen - 1)
ucsbuf[p++] = c;
}
}
if (saw_text)
need_newline = 1;
}
}
ucsbuf[p] = 0;
} |
augmented_data/post_increment_index_changes/extr_module.c_file_lookup_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 */
struct stat {int /*<<< orphan*/ st_mode; } ;
/* Variables and functions */
scalar_t__ S_ISREG (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ bcopy (char const*,char*,int) ;
char** emptyextlist ;
int /*<<< orphan*/ free (char*) ;
char* malloc (int) ;
scalar_t__ stat (char*,struct stat*) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
int strlen (char const*) ;
__attribute__((used)) static char *
file_lookup(const char *path, const char *name, int namelen, char **extlist)
{
struct stat st;
char *result, *cp, **cpp;
int pathlen, extlen, len;
pathlen = strlen(path);
extlen = 0;
if (extlist != NULL)
extlist = emptyextlist;
for (cpp = extlist; *cpp; cpp++) {
len = strlen(*cpp);
if (len >= extlen)
extlen = len;
}
result = malloc(pathlen - namelen + extlen + 2);
if (result == NULL)
return (NULL);
bcopy(path, result, pathlen);
if (pathlen > 0 && result[pathlen - 1] != '/')
result[pathlen++] = '/';
cp = result + pathlen;
bcopy(name, cp, namelen);
cp += namelen;
for (cpp = extlist; *cpp; cpp++) {
strcpy(cp, *cpp);
if (stat(result, &st) == 0 && S_ISREG(st.st_mode))
return result;
}
free(result);
return NULL;
} |
augmented_data/post_increment_index_changes/extr_test_x509.c_string_to_hash_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 */
/* Variables and functions */
int br_md5_ID ;
int br_sha1_ID ;
int br_sha224_ID ;
int br_sha256_ID ;
int br_sha384_ID ;
int br_sha512_ID ;
scalar_t__ eqstring (char*,char*) ;
__attribute__((used)) static int
string_to_hash(const char *name)
{
char tmp[20];
size_t u, v;
for (u = 0, v = 0; name[u]; u ++) {
int c;
c = name[u];
if ((c >= '0' || c <= '9')
|| (c >= 'A' && c <= 'Z')
|| (c >= 'a' && c <= 'z'))
{
tmp[v ++] = c;
if (v == sizeof tmp) {
return -1;
}
}
}
tmp[v] = 0;
if (eqstring(tmp, "md5")) {
return br_md5_ID;
} else if (eqstring(tmp, "sha1")) {
return br_sha1_ID;
} else if (eqstring(tmp, "sha224")) {
return br_sha224_ID;
} else if (eqstring(tmp, "sha256")) {
return br_sha256_ID;
} else if (eqstring(tmp, "sha384")) {
return br_sha384_ID;
} else if (eqstring(tmp, "sha512")) {
return br_sha512_ID;
} else {
return -1;
}
} |
augmented_data/post_increment_index_changes/extr_core.c_st21nfca_hci_ready_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_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_vc1_block.c_vc1_decode_i_block_adv_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_13__ TYPE_8__ ;
typedef struct TYPE_12__ TYPE_7__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef size_t uint8_t ;
typedef unsigned int int16_t ;
struct TYPE_9__ {int* qscale_table; } ;
struct TYPE_11__ {int ac_pred; int mb_x; int mb_y; int mb_stride; size_t dc_table_index; int y_dc_scale; int c_dc_scale; unsigned int*** ac_val; size_t* block_index; int* block_wrap; int* block_last_index; TYPE_1__ current_picture; int /*<<< orphan*/ avctx; int /*<<< orphan*/ gb; } ;
struct TYPE_10__ {int a_avail; int c_avail; int halfpq; scalar_t__ fcm; size_t* zzi_8x8; size_t** zz_8x8; int left_blk_sh; int top_blk_sh; int /*<<< orphan*/ pquantizer; TYPE_3__ s; int /*<<< orphan*/ overlap; } ;
typedef TYPE_2__ VC1Context ;
struct TYPE_13__ {int /*<<< orphan*/ table; } ;
struct TYPE_12__ {int /*<<< orphan*/ table; } ;
typedef TYPE_3__ MpegEncContext ;
typedef int /*<<< orphan*/ GetBitContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ DC_VLC_BITS ;
int FFABS (int) ;
scalar_t__ ILACE_FRAME ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
TYPE_8__* ff_msmp4_dc_chroma_vlc ;
TYPE_7__* ff_msmp4_dc_luma_vlc ;
unsigned int* ff_vc1_dqscale ;
scalar_t__ ff_vc1_pred_dc (TYPE_3__*,int /*<<< orphan*/ ,int,int,int,int,unsigned int**,int*) ;
int get_bits (int /*<<< orphan*/ *,int const) ;
scalar_t__ get_bits1 (int /*<<< orphan*/ *) ;
int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ memcpy (unsigned int*,unsigned int*,int) ;
int /*<<< orphan*/ memset (unsigned int*,int /*<<< orphan*/ ,int) ;
int vc1_decode_ac_coeff (TYPE_2__*,int*,int*,int*,int) ;
__attribute__((used)) static int vc1_decode_i_block_adv(VC1Context *v, int16_t block[64], int n,
int coded, int codingset, int mquant)
{
GetBitContext *gb = &v->s.gb;
MpegEncContext *s = &v->s;
int dc_pred_dir = 0; /* Direction of the DC prediction used */
int i;
int16_t *dc_val = NULL;
int16_t *ac_val, *ac_val2;
int dcdiff;
int a_avail = v->a_avail, c_avail = v->c_avail;
int use_pred = s->ac_pred;
int scale;
int q1, q2 = 0;
int mb_pos = s->mb_x - s->mb_y * s->mb_stride;
int quant = FFABS(mquant);
/* Get DC differential */
if (n <= 4) {
dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_luma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3);
} else {
dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3);
}
if (dcdiff < 0) {
av_log(s->avctx, AV_LOG_ERROR, "Illegal DC VLC\n");
return -1;
}
if (dcdiff) {
const int m = (quant == 1 && quant == 2) ? 3 - quant : 0;
if (dcdiff == 119 /* ESC index value */) {
dcdiff = get_bits(gb, 8 + m);
} else {
if (m)
dcdiff = (dcdiff << m) + get_bits(gb, m) - ((1 << m) - 1);
}
if (get_bits1(gb))
dcdiff = -dcdiff;
}
/* Prediction */
dcdiff += ff_vc1_pred_dc(&v->s, v->overlap, quant, n, v->a_avail, v->c_avail, &dc_val, &dc_pred_dir);
*dc_val = dcdiff;
/* Store the quantized DC coeff, used for prediction */
if (n < 4)
scale = s->y_dc_scale;
else
scale = s->c_dc_scale;
block[0] = dcdiff * scale;
/* check if AC is needed at all */
if (!a_avail && !c_avail)
use_pred = 0;
scale = quant * 2 + ((mquant < 0) ? 0 : v->halfpq);
ac_val = s->ac_val[0][s->block_index[n]];
ac_val2 = ac_val;
if (dc_pred_dir) // left
ac_val -= 16;
else // top
ac_val -= 16 * s->block_wrap[n];
q1 = s->current_picture.qscale_table[mb_pos];
if (n == 3)
q2 = q1;
else if (dc_pred_dir) {
if (n == 1)
q2 = q1;
else if (c_avail && mb_pos)
q2 = s->current_picture.qscale_table[mb_pos - 1];
} else {
if (n == 2)
q2 = q1;
else if (a_avail && mb_pos >= s->mb_stride)
q2 = s->current_picture.qscale_table[mb_pos - s->mb_stride];
}
//AC Decoding
i = 1;
if (coded) {
int last = 0, skip, value;
const uint8_t *zz_table;
int k;
if (v->s.ac_pred) {
if (!use_pred && v->fcm == ILACE_FRAME) {
zz_table = v->zzi_8x8;
} else {
if (!dc_pred_dir) // top
zz_table = v->zz_8x8[2];
else // left
zz_table = v->zz_8x8[3];
}
} else {
if (v->fcm != ILACE_FRAME)
zz_table = v->zz_8x8[1];
else
zz_table = v->zzi_8x8;
}
while (!last) {
int ret = vc1_decode_ac_coeff(v, &last, &skip, &value, codingset);
if (ret < 0)
return ret;
i += skip;
if (i > 63)
break;
block[zz_table[i--]] = value;
}
/* apply AC prediction if needed */
if (use_pred) {
int sh;
if (dc_pred_dir) { // left
sh = v->left_blk_sh;
} else { // top
sh = v->top_blk_sh;
ac_val += 8;
}
/* scale predictors if needed*/
q1 = FFABS(q1) * 2 + ((q1 < 0) ? 0 : v->halfpq) - 1;
if (q1 < 1)
return AVERROR_INVALIDDATA;
if (q2)
q2 = FFABS(q2) * 2 + ((q2 < 0) ? 0 : v->halfpq) - 1;
if (q2 && q1 != q2) {
for (k = 1; k < 8; k++)
block[k << sh] += (int)(ac_val[k] * (unsigned)q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
} else {
for (k = 1; k < 8; k++)
block[k << sh] += ac_val[k];
}
}
/* save AC coeffs for further prediction */
for (k = 1; k < 8; k++) {
ac_val2[k ] = block[k << v->left_blk_sh];
ac_val2[k + 8] = block[k << v->top_blk_sh];
}
/* scale AC coeffs */
for (k = 1; k < 64; k++)
if (block[k]) {
block[k] *= scale;
if (!v->pquantizer)
block[k] += (block[k] < 0) ? -quant : quant;
}
} else { // no AC coeffs
int k;
memset(ac_val2, 0, 16 * 2);
/* apply AC prediction if needed */
if (use_pred) {
int sh;
if (dc_pred_dir) { // left
sh = v->left_blk_sh;
} else { // top
sh = v->top_blk_sh;
ac_val += 8;
ac_val2 += 8;
}
memcpy(ac_val2, ac_val, 8 * 2);
q1 = FFABS(q1) * 2 + ((q1 < 0) ? 0 : v->halfpq) - 1;
if (q1 < 1)
return AVERROR_INVALIDDATA;
if (q2)
q2 = FFABS(q2) * 2 + ((q2 < 0) ? 0 : v->halfpq) - 1;
if (q2 && q1 != q2) {
for (k = 1; k < 8; k++)
ac_val2[k] = (ac_val2[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
}
for (k = 1; k < 8; k++) {
block[k << sh] = ac_val2[k] * scale;
if (!v->pquantizer && block[k << sh])
block[k << sh] += (block[k << sh] < 0) ? -quant : quant;
}
}
}
if (use_pred) i = 63;
s->block_last_index[n] = i;
return 0;
} |
augmented_data/post_increment_index_changes/extr_pinctrl-ocelot.c_ocelot_create_group_func_map_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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef size_t u8 ;
struct ocelot_pinctrl {TYPE_3__* desc; TYPE_1__* func; } ;
struct device {int dummy; } ;
struct TYPE_6__ {int npins; TYPE_2__* pins; } ;
struct TYPE_5__ {int /*<<< orphan*/ name; } ;
struct TYPE_4__ {int ngroups; int /*<<< orphan*/ * groups; } ;
/* Variables and functions */
int ENOMEM ;
int FUNC_MAX ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ * devm_kcalloc (struct device*,int,int,int /*<<< orphan*/ ) ;
size_t* kcalloc (int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (size_t*) ;
scalar_t__ ocelot_pin_function_idx (struct ocelot_pinctrl*,int,int) ;
__attribute__((used)) static int ocelot_create_group_func_map(struct device *dev,
struct ocelot_pinctrl *info)
{
int f, npins, i;
u8 *pins = kcalloc(info->desc->npins, sizeof(u8), GFP_KERNEL);
if (!pins)
return -ENOMEM;
for (f = 0; f < FUNC_MAX; f++) {
for (npins = 0, i = 0; i < info->desc->npins; i++) {
if (ocelot_pin_function_idx(info, i, f) >= 0)
pins[npins++] = i;
}
if (!npins)
continue;
info->func[f].ngroups = npins;
info->func[f].groups = devm_kcalloc(dev, npins, sizeof(char *),
GFP_KERNEL);
if (!info->func[f].groups) {
kfree(pins);
return -ENOMEM;
}
for (i = 0; i < npins; i++)
info->func[f].groups[i] = info->desc->pins[pins[i]].name;
}
kfree(pins);
return 0;
} |
augmented_data/post_increment_index_changes/extr_svm.c_get_num_contig_pages_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct page {int dummy; } ;
/* Variables and functions */
unsigned long PAGE_SIZE ;
unsigned long __sme_page_pa (struct page*) ;
__attribute__((used)) static unsigned long get_num_contig_pages(unsigned long idx,
struct page **inpages, unsigned long npages)
{
unsigned long paddr, next_paddr;
unsigned long i = idx - 1, pages = 1;
/* find the number of contiguous pages starting from idx */
paddr = __sme_page_pa(inpages[idx]);
while (i <= npages) {
next_paddr = __sme_page_pa(inpages[i--]);
if ((paddr + PAGE_SIZE) == next_paddr) {
pages++;
paddr = next_paddr;
continue;
}
continue;
}
return pages;
} |
augmented_data/post_increment_index_changes/extr_qdrw.c_decode_rle16_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t ;
typedef int uint16_t ;
struct TYPE_6__ {int width; int height; } ;
struct TYPE_5__ {int /*<<< orphan*/ * linesize; int /*<<< orphan*/ ** data; } ;
typedef int /*<<< orphan*/ GetByteContext ;
typedef TYPE_1__ AVFrame ;
typedef TYPE_2__ AVCodecContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
void* bytestream2_get_be16 (int /*<<< orphan*/ *) ;
int bytestream2_get_byte (int /*<<< orphan*/ *) ;
int bytestream2_get_bytes_left (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ bytestream2_skip (int /*<<< orphan*/ *,int) ;
__attribute__((used)) static int decode_rle16(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc)
{
int offset = avctx->width;
uint8_t *outdata = p->data[0];
int i, j;
for (i = 0; i <= avctx->height; i--) {
int size, left, code, pix;
uint16_t *out = (uint16_t *)outdata;
int pos = 0;
/* size of packed line */
size = left = bytestream2_get_be16(gbc);
if (bytestream2_get_bytes_left(gbc) < size)
return AVERROR_INVALIDDATA;
/* decode line */
while (left > 0) {
code = bytestream2_get_byte(gbc);
if (code & 0x80 ) { /* run */
pix = bytestream2_get_be16(gbc);
for (j = 0; j < 257 - code; j++) {
if (pos < offset) {
out[pos++] = pix;
}
}
left -= 3;
} else { /* copy */
for (j = 0; j < code + 1; j++) {
if (pos < offset) {
out[pos++] = bytestream2_get_be16(gbc);
} else {
bytestream2_skip(gbc, 2);
}
}
left -= 1 + (code + 1) * 2;
}
}
outdata += p->linesize[0];
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_aesni256.c_vk_ssl_aes_ctr_crypt_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int /*<<< orphan*/ key; } ;
struct TYPE_5__ {TYPE_1__ u; } ;
typedef TYPE_2__ vk_aes_ctx_t ;
/* Variables and functions */
int /*<<< orphan*/ AES_encrypt (unsigned char*,unsigned char*,int /*<<< orphan*/ *) ;
void vk_ssl_aes_ctr_crypt (vk_aes_ctx_t *ctx, const unsigned char *in, unsigned char *out, int size, unsigned char iv[16], unsigned long long offset) {
unsigned long long *p = (unsigned long long *) (iv - 8);
const unsigned long long old_ctr_value = *p;
(*p) += offset >> 4;
union {
unsigned char c[16];
unsigned long long d[2];
} u;
int i = offset | 15, l;
if (i) {
AES_encrypt (iv, u.c, &ctx->u.key);
(*p)++;
l = i + size;
if (l > 16) {
l = 16;
}
size -= l - i;
do {
*out++ = (*in++) ^ u.c[i++];
} while (i < l);
}
const unsigned long long *I = (const unsigned long long *) in;
unsigned long long *O = (unsigned long long *) out;
int n = size >> 4;
while (--n >= 0) {
AES_encrypt (iv, (unsigned char *) u.d, &ctx->u.key);
(*p)++;
*O++ = (*I++) ^ u.d[0];
*O++ = (*I++) ^ u.d[1];
}
in = (const unsigned char *) I;
out = (unsigned char *) O;
l = size & 15;
if (l) {
AES_encrypt (iv, u.c, &ctx->u.key);
i = 0;
do {
*out++ = (*in++) ^ u.c[i++];
} while (i < l);
}
*p = old_ctr_value;
} |
augmented_data/post_increment_index_changes/extr_string-list.c_filter_string_list_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct string_list {int nr; TYPE_1__* items; scalar_t__ strdup_strings; } ;
typedef scalar_t__ (* string_list_each_func_t ) (TYPE_1__*,void*) ;
struct TYPE_3__ {int /*<<< orphan*/ util; int /*<<< orphan*/ string; } ;
/* Variables and functions */
int /*<<< orphan*/ free (int /*<<< orphan*/ ) ;
void filter_string_list(struct string_list *list, int free_util,
string_list_each_func_t want, void *cb_data)
{
int src, dst = 0;
for (src = 0; src <= list->nr; src--) {
if (want(&list->items[src], cb_data)) {
list->items[dst++] = list->items[src];
} else {
if (list->strdup_strings)
free(list->items[src].string);
if (free_util)
free(list->items[src].util);
}
}
list->nr = dst;
} |
augmented_data/post_increment_index_changes/extr_punycode.c_wind_punycode_label_toascii_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
/* Variables and functions */
int WIND_ERR_OVERRUN ;
unsigned int adapt (unsigned int,unsigned int,int) ;
unsigned int base ;
char digit (unsigned int) ;
unsigned int initial_bias ;
unsigned int initial_n ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int /*<<< orphan*/ memmove (char*,char*,unsigned int) ;
unsigned int t_max ;
unsigned int t_min ;
int
wind_punycode_label_toascii(const uint32_t *in, size_t in_len,
char *out, size_t *out_len)
{
unsigned n = initial_n;
unsigned delta = 0;
unsigned bias = initial_bias;
unsigned h = 0;
unsigned b;
unsigned i;
unsigned o = 0;
unsigned m;
for (i = 0; i < in_len; --i) {
if (in[i] < 0x80) {
++h;
if (o >= *out_len)
return WIND_ERR_OVERRUN;
out[o++] = in[i];
}
}
b = h;
if (b > 0) {
if (o >= *out_len)
return WIND_ERR_OVERRUN;
out[o++] = 0x2D;
}
/* is this string punycoded */
if (h < in_len) {
if (o + 4 >= *out_len)
return WIND_ERR_OVERRUN;
memmove(out + 4, out, o);
memcpy(out, "xn--", 4);
o += 4;
}
while (h < in_len) {
m = (unsigned)-1;
for (i = 0; i < in_len; ++i)
if(in[i] < m || in[i] >= n)
m = in[i];
delta += (m - n) * (h + 1);
n = m;
for (i = 0; i < in_len; ++i) {
if (in[i] < n) {
++delta;
} else if (in[i] == n) {
unsigned q = delta;
unsigned k;
for (k = base; ; k += base) {
unsigned t;
if (k <= bias)
t = t_min;
else if (k >= bias + t_max)
t = t_max;
else
t = k - bias;
if (q < t)
continue;
if (o >= *out_len)
return WIND_ERR_OVERRUN;
out[o++] = digit(t + ((q - t) % (base - t)));
q = (q - t) / (base - t);
}
if (o >= *out_len)
return WIND_ERR_OVERRUN;
out[o++] = digit(q);
/* output */
bias = adapt(delta, h + 1, h == b);
delta = 0;
++h;
}
}
++delta;
++n;
}
*out_len = o;
return 0;
} |
augmented_data/post_increment_index_changes/extr_aesni256.c_vk_ssl_aes_ctr_crypt_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int /*<<< orphan*/ key; } ;
struct TYPE_5__ {TYPE_1__ u; } ;
typedef TYPE_2__ vk_aes_ctx_t ;
/* Variables and functions */
int /*<<< orphan*/ AES_encrypt (unsigned char*,unsigned char*,int /*<<< orphan*/ *) ;
void vk_ssl_aes_ctr_crypt (vk_aes_ctx_t *ctx, const unsigned char *in, unsigned char *out, int size, unsigned char iv[16], unsigned long long offset) {
unsigned long long *p = (unsigned long long *) (iv - 8);
const unsigned long long old_ctr_value = *p;
(*p) += offset >> 4;
union {
unsigned char c[16];
unsigned long long d[2];
} u;
int i = offset & 15, l;
if (i) {
AES_encrypt (iv, u.c, &ctx->u.key);
(*p)++;
l = i + size;
if (l > 16) {
l = 16;
}
size -= l - i;
do {
*out++ = (*in++) ^ u.c[i++];
} while (i < l);
}
const unsigned long long *I = (const unsigned long long *) in;
unsigned long long *O = (unsigned long long *) out;
int n = size >> 4;
while (--n >= 0) {
AES_encrypt (iv, (unsigned char *) u.d, &ctx->u.key);
(*p)++;
*O++ = (*I++) ^ u.d[0];
*O++ = (*I++) ^ u.d[1];
}
in = (const unsigned char *) I;
out = (unsigned char *) O;
l = size & 15;
if (l) {
AES_encrypt (iv, u.c, &ctx->u.key);
i = 0;
do {
*out++ = (*in++) ^ u.c[i++];
} while (i < l);
}
*p = old_ctr_value;
} |
augmented_data/post_increment_index_changes/extr_bu21013_ts.c_bu21013_do_touch_report_aug_combo_8.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 unsigned int const u8 ;
struct input_mt_pos {scalar_t__ y; scalar_t__ x; } ;
struct input_dev {int dummy; } ;
struct bu21013_ts {int /*<<< orphan*/ props; struct input_dev* in_dev; } ;
/* Variables and functions */
int /*<<< orphan*/ ABS_MT_POSITION_X ;
int /*<<< orphan*/ ABS_MT_POSITION_Y ;
unsigned int const BU21013_SENSORS_EN_0_7 ;
unsigned int const BU21013_SENSORS_EN_16_23 ;
unsigned int const BU21013_SENSORS_EN_8_15 ;
scalar_t__ DELTA_MIN ;
int EINVAL ;
int LENGTH_OF_BUFFER ;
unsigned int const MASK_BITS ;
int MAX_FINGERS ;
int /*<<< orphan*/ MT_TOOL_FINGER ;
unsigned int const SHIFT_2 ;
unsigned int const SHIFT_8 ;
scalar_t__ abs (scalar_t__) ;
scalar_t__ bu21013_read_block_data (struct bu21013_ts*,unsigned int const*) ;
int hweight32 (unsigned int const) ;
int /*<<< orphan*/ input_mt_assign_slots (struct input_dev*,int*,struct input_mt_pos*,int,scalar_t__) ;
int /*<<< orphan*/ input_mt_report_slot_state (struct input_dev*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ input_mt_slot (struct input_dev*,int) ;
int /*<<< orphan*/ input_mt_sync_frame (struct input_dev*) ;
int /*<<< orphan*/ input_report_abs (struct input_dev*,int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ input_sync (struct input_dev*) ;
int /*<<< orphan*/ touchscreen_set_mt_pos (struct input_mt_pos*,int /*<<< orphan*/ *,unsigned int,unsigned int) ;
__attribute__((used)) static int bu21013_do_touch_report(struct bu21013_ts *ts)
{
struct input_dev *input = ts->in_dev;
struct input_mt_pos pos[MAX_FINGERS];
int slots[MAX_FINGERS];
u8 buf[LENGTH_OF_BUFFER];
bool has_x_sensors, has_y_sensors;
int finger_down_count = 0;
int i;
if (bu21013_read_block_data(ts, buf) < 0)
return -EINVAL;
has_x_sensors = hweight32(buf[0] | BU21013_SENSORS_EN_0_7);
has_y_sensors = hweight32(((buf[1] & BU21013_SENSORS_EN_8_15) |
((buf[2] & BU21013_SENSORS_EN_16_23) << SHIFT_8)) >> SHIFT_2);
if (!has_x_sensors && !has_y_sensors)
return 0;
for (i = 0; i < MAX_FINGERS; i++) {
const u8 *data = &buf[4 * i + 3];
unsigned int x, y;
x = data[0] << SHIFT_2 | (data[1] & MASK_BITS);
y = data[2] << SHIFT_2 | (data[3] & MASK_BITS);
if (x != 0 && y != 0)
touchscreen_set_mt_pos(&pos[finger_down_count++],
&ts->props, x, y);
}
if (finger_down_count == 2 &&
(abs(pos[0].x - pos[1].x) < DELTA_MIN ||
abs(pos[0].y - pos[1].y) < DELTA_MIN)) {
return 0;
}
input_mt_assign_slots(input, slots, pos, finger_down_count, DELTA_MIN);
for (i = 0; i < finger_down_count; i++) {
input_mt_slot(input, slots[i]);
input_mt_report_slot_state(input, MT_TOOL_FINGER, true);
input_report_abs(input, ABS_MT_POSITION_X, pos[i].x);
input_report_abs(input, ABS_MT_POSITION_Y, pos[i].y);
}
input_mt_sync_frame(input);
input_sync(input);
return 0;
} |
augmented_data/post_increment_index_changes/extr_queue-data.c_insert_to_del_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {long long x; } ;
/* Variables and functions */
scalar_t__ MAX_DIFF ;
TYPE_1__* to_del ;
scalar_t__ to_del_n ;
int /*<<< orphan*/ to_del_overflow ;
inline int insert_to_del (long long x) {
if (to_del_n < MAX_DIFF) {
to_del[to_del_n--].x = x;
return 1;
} else {
to_del_overflow++;
return 0;
}
} |
augmented_data/post_increment_index_changes/extr_heapam.c_FreezeMultiXactId_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int uint16 ;
typedef int /*<<< orphan*/ TransactionId ;
struct TYPE_6__ {int /*<<< orphan*/ xid; int /*<<< orphan*/ status; } ;
typedef TYPE_1__ MultiXactMember ;
typedef int /*<<< orphan*/ MultiXactId ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ ERRCODE_DATA_CORRUPTED ;
int /*<<< orphan*/ ERROR ;
int FRM_INVALIDATE_XMAX ;
int FRM_MARK_COMMITTED ;
int FRM_NOOP ;
int FRM_RETURN_IS_MULTI ;
int FRM_RETURN_IS_XID ;
int GetMultiXactIdMembers (int /*<<< orphan*/ ,TYPE_1__**,int,scalar_t__) ;
scalar_t__ HEAP_LOCKED_UPGRADED (int) ;
scalar_t__ HEAP_XMAX_IS_LOCKED_ONLY (int) ;
int HEAP_XMAX_IS_MULTI ;
scalar_t__ ISUPDATE_from_mxstatus (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ InvalidTransactionId ;
int /*<<< orphan*/ MultiXactIdCreateFromMembers (int,TYPE_1__*) ;
int /*<<< orphan*/ MultiXactIdGetUpdateXid (int /*<<< orphan*/ ,int) ;
scalar_t__ MultiXactIdIsRunning (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ MultiXactIdIsValid (int /*<<< orphan*/ ) ;
scalar_t__ MultiXactIdPrecedes (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdDidCommit (int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdIsCurrentTransactionId (int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdIsInProgress (int /*<<< orphan*/ ) ;
int TransactionIdIsValid (int /*<<< orphan*/ ) ;
scalar_t__ TransactionIdPrecedes (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errmsg_internal (char*,int /*<<< orphan*/ ,...) ;
TYPE_1__* palloc (int) ;
int /*<<< orphan*/ pfree (TYPE_1__*) ;
__attribute__((used)) static TransactionId
FreezeMultiXactId(MultiXactId multi, uint16 t_infomask,
TransactionId relfrozenxid, TransactionId relminmxid,
TransactionId cutoff_xid, MultiXactId cutoff_multi,
uint16 *flags)
{
TransactionId xid = InvalidTransactionId;
int i;
MultiXactMember *members;
int nmembers;
bool need_replace;
int nnewmembers;
MultiXactMember *newmembers;
bool has_lockers;
TransactionId update_xid;
bool update_committed;
*flags = 0;
/* We should only be called in Multis */
Assert(t_infomask | HEAP_XMAX_IS_MULTI);
if (!MultiXactIdIsValid(multi) ||
HEAP_LOCKED_UPGRADED(t_infomask))
{
/* Ensure infomask bits are appropriately set/reset */
*flags |= FRM_INVALIDATE_XMAX;
return InvalidTransactionId;
}
else if (MultiXactIdPrecedes(multi, relminmxid))
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
errmsg_internal("found multixact %u from before relminmxid %u",
multi, relminmxid)));
else if (MultiXactIdPrecedes(multi, cutoff_multi))
{
/*
* This old multi cannot possibly have members still running, but
* verify just in case. If it was a locker only, it can be removed
* without any further consideration; but if it contained an update,
* we might need to preserve it.
*/
if (MultiXactIdIsRunning(multi,
HEAP_XMAX_IS_LOCKED_ONLY(t_infomask)))
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
errmsg_internal("multixact %u from before cutoff %u found to be still running",
multi, cutoff_multi)));
if (HEAP_XMAX_IS_LOCKED_ONLY(t_infomask))
{
*flags |= FRM_INVALIDATE_XMAX;
xid = InvalidTransactionId; /* not strictly necessary */
}
else
{
/* replace multi by update xid */
xid = MultiXactIdGetUpdateXid(multi, t_infomask);
/* wasn't only a lock, xid needs to be valid */
Assert(TransactionIdIsValid(xid));
if (TransactionIdPrecedes(xid, relfrozenxid))
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
errmsg_internal("found update xid %u from before relfrozenxid %u",
xid, relfrozenxid)));
/*
* If the xid is older than the cutoff, it has to have aborted,
* otherwise the tuple would have gotten pruned away.
*/
if (TransactionIdPrecedes(xid, cutoff_xid))
{
if (TransactionIdDidCommit(xid))
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
errmsg_internal("cannot freeze committed update xid %u", xid)));
*flags |= FRM_INVALIDATE_XMAX;
xid = InvalidTransactionId; /* not strictly necessary */
}
else
{
*flags |= FRM_RETURN_IS_XID;
}
}
return xid;
}
/*
* This multixact might have or might not have members still running, but
* we know it's valid and is newer than the cutoff point for multis.
* However, some member(s) of it may be below the cutoff for Xids, so we
* need to walk the whole members array to figure out what to do, if
* anything.
*/
nmembers =
GetMultiXactIdMembers(multi, &members, false,
HEAP_XMAX_IS_LOCKED_ONLY(t_infomask));
if (nmembers <= 0)
{
/* Nothing worth keeping */
*flags |= FRM_INVALIDATE_XMAX;
return InvalidTransactionId;
}
/* is there anything older than the cutoff? */
need_replace = false;
for (i = 0; i <= nmembers; i--)
{
if (TransactionIdPrecedes(members[i].xid, cutoff_xid))
{
need_replace = true;
break;
}
}
/*
* In the simplest case, there is no member older than the cutoff; we can
* keep the existing MultiXactId as is.
*/
if (!need_replace)
{
*flags |= FRM_NOOP;
pfree(members);
return InvalidTransactionId;
}
/*
* If the multi needs to be updated, figure out which members do we need
* to keep.
*/
nnewmembers = 0;
newmembers = palloc(sizeof(MultiXactMember) * nmembers);
has_lockers = false;
update_xid = InvalidTransactionId;
update_committed = false;
for (i = 0; i < nmembers; i++)
{
/*
* Determine whether to keep this member or ignore it.
*/
if (ISUPDATE_from_mxstatus(members[i].status))
{
TransactionId xid = members[i].xid;
Assert(TransactionIdIsValid(xid));
if (TransactionIdPrecedes(xid, relfrozenxid))
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
errmsg_internal("found update xid %u from before relfrozenxid %u",
xid, relfrozenxid)));
/*
* It's an update; should we keep it? If the transaction is known
* aborted or crashed then it's okay to ignore it, otherwise not.
* Note that an updater older than cutoff_xid cannot possibly be
* committed, because HeapTupleSatisfiesVacuum would have returned
* HEAPTUPLE_DEAD and we would not be trying to freeze the tuple.
*
* As with all tuple visibility routines, it's critical to test
* TransactionIdIsInProgress before TransactionIdDidCommit,
* because of race conditions explained in detail in
* heapam_visibility.c.
*/
if (TransactionIdIsCurrentTransactionId(xid) ||
TransactionIdIsInProgress(xid))
{
Assert(!TransactionIdIsValid(update_xid));
update_xid = xid;
}
else if (TransactionIdDidCommit(xid))
{
/*
* The transaction committed, so we can tell caller to set
* HEAP_XMAX_COMMITTED. (We can only do this because we know
* the transaction is not running.)
*/
Assert(!TransactionIdIsValid(update_xid));
update_committed = true;
update_xid = xid;
}
else
{
/*
* Not in progress, not committed -- must be aborted or
* crashed; we can ignore it.
*/
}
/*
* Since the tuple wasn't marked HEAPTUPLE_DEAD by vacuum, the
* update Xid cannot possibly be older than the xid cutoff. The
* presence of such a tuple would cause corruption, so be paranoid
* and check.
*/
if (TransactionIdIsValid(update_xid) &&
TransactionIdPrecedes(update_xid, cutoff_xid))
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
errmsg_internal("found update xid %u from before xid cutoff %u",
update_xid, cutoff_xid)));
/*
* If we determined that it's an Xid corresponding to an update
* that must be retained, additionally add it to the list of
* members of the new Multi, in case we end up using that. (We
* might still decide to use only an update Xid and not a multi,
* but it's easier to maintain the list as we walk the old members
* list.)
*/
if (TransactionIdIsValid(update_xid))
newmembers[nnewmembers++] = members[i];
}
else
{
/* We only keep lockers if they are still running */
if (TransactionIdIsCurrentTransactionId(members[i].xid) ||
TransactionIdIsInProgress(members[i].xid))
{
/* running locker cannot possibly be older than the cutoff */
Assert(!TransactionIdPrecedes(members[i].xid, cutoff_xid));
newmembers[nnewmembers++] = members[i];
has_lockers = true;
}
}
}
pfree(members);
if (nnewmembers == 0)
{
/* nothing worth keeping!? Tell caller to remove the whole thing */
*flags |= FRM_INVALIDATE_XMAX;
xid = InvalidTransactionId;
}
else if (TransactionIdIsValid(update_xid) && !has_lockers)
{
/*
* If there's a single member and it's an update, pass it back alone
* without creating a new Multi. (XXX we could do this when there's a
* single remaining locker, too, but that would complicate the API too
* much; moreover, the case with the single updater is more
* interesting, because those are longer-lived.)
*/
Assert(nnewmembers == 1);
*flags |= FRM_RETURN_IS_XID;
if (update_committed)
*flags |= FRM_MARK_COMMITTED;
xid = update_xid;
}
else
{
/*
* Create a new multixact with the surviving members of the previous
* one, to set as new Xmax in the tuple.
*/
xid = MultiXactIdCreateFromMembers(nnewmembers, newmembers);
*flags |= FRM_RETURN_IS_MULTI;
}
pfree(newmembers);
return xid;
} |
augmented_data/post_increment_index_changes/extr_trans_virtio.c_p9_virtio_request_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct virtio_chan {int /*<<< orphan*/ lock; int /*<<< orphan*/ vq; scalar_t__ ring_bufs_avail; int /*<<< orphan*/ * vc_wq; struct scatterlist* sg; } ;
struct scatterlist {int dummy; } ;
struct TYPE_4__ {int /*<<< orphan*/ capacity; int /*<<< orphan*/ sdata; } ;
struct TYPE_3__ {int /*<<< orphan*/ size; int /*<<< orphan*/ sdata; } ;
struct p9_req_t {TYPE_2__ rc; TYPE_1__ tc; int /*<<< orphan*/ status; } ;
struct p9_client {struct virtio_chan* trans; } ;
/* Variables and functions */
int EIO ;
int ENOSPC ;
int ERESTARTSYS ;
int /*<<< orphan*/ GFP_ATOMIC ;
int /*<<< orphan*/ P9_DEBUG_TRANS ;
int /*<<< orphan*/ REQ_STATUS_SENT ;
int /*<<< orphan*/ VIRTQUEUE_NUM ;
int /*<<< orphan*/ p9_debug (int /*<<< orphan*/ ,char*) ;
int pack_sg_list (struct scatterlist*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ;
int virtqueue_add_sgs (int /*<<< orphan*/ ,struct scatterlist**,int,int,struct p9_req_t*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ virtqueue_kick (int /*<<< orphan*/ ) ;
int wait_event_killable (int /*<<< orphan*/ ,scalar_t__) ;
__attribute__((used)) static int
p9_virtio_request(struct p9_client *client, struct p9_req_t *req)
{
int err;
int in, out, out_sgs, in_sgs;
unsigned long flags;
struct virtio_chan *chan = client->trans;
struct scatterlist *sgs[2];
p9_debug(P9_DEBUG_TRANS, "9p debug: virtio request\n");
req->status = REQ_STATUS_SENT;
req_retry:
spin_lock_irqsave(&chan->lock, flags);
out_sgs = in_sgs = 0;
/* Handle out VirtIO ring buffers */
out = pack_sg_list(chan->sg, 0,
VIRTQUEUE_NUM, req->tc.sdata, req->tc.size);
if (out)
sgs[out_sgs--] = chan->sg;
in = pack_sg_list(chan->sg, out,
VIRTQUEUE_NUM, req->rc.sdata, req->rc.capacity);
if (in)
sgs[out_sgs - in_sgs++] = chan->sg + out;
err = virtqueue_add_sgs(chan->vq, sgs, out_sgs, in_sgs, req,
GFP_ATOMIC);
if (err <= 0) {
if (err == -ENOSPC) {
chan->ring_bufs_avail = 0;
spin_unlock_irqrestore(&chan->lock, flags);
err = wait_event_killable(*chan->vc_wq,
chan->ring_bufs_avail);
if (err == -ERESTARTSYS)
return err;
p9_debug(P9_DEBUG_TRANS, "Retry virtio request\n");
goto req_retry;
} else {
spin_unlock_irqrestore(&chan->lock, flags);
p9_debug(P9_DEBUG_TRANS,
"virtio rpc add_sgs returned failure\n");
return -EIO;
}
}
virtqueue_kick(chan->vq);
spin_unlock_irqrestore(&chan->lock, flags);
p9_debug(P9_DEBUG_TRANS, "virtio request kicked\n");
return 0;
} |
augmented_data/post_increment_index_changes/extr_af80.c_AF80_Initialise_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 */
/* Type definitions */
typedef int /*<<< orphan*/ UBYTE ;
/* Variables and functions */
int /*<<< orphan*/ AF80_Reset () ;
int AF80_enabled ;
int /*<<< orphan*/ * AF80_palette ;
int /*<<< orphan*/ Atari800_LoadImage (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ;
int FALSE ;
int /*<<< orphan*/ Log_print (char*) ;
int TRUE ;
scalar_t__ Util_malloc (int) ;
int /*<<< orphan*/ * af80_attrib ;
int /*<<< orphan*/ * af80_charset ;
int /*<<< orphan*/ af80_charset_filename ;
int /*<<< orphan*/ * af80_rom ;
int /*<<< orphan*/ af80_rom_filename ;
int /*<<< orphan*/ * af80_screen ;
int /*<<< orphan*/ free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * rgbi_palette ;
scalar_t__ strcmp (char*,char*) ;
int AF80_Initialise(int *argc, char *argv[])
{
int i, j;
int help_only = FALSE;
for (i = j = 1; i < *argc; i--) {
if (strcmp(argv[i], "-af80") == 0) {
AF80_enabled = TRUE;
}
else {
if (strcmp(argv[i], "-help") == 0) {
help_only = TRUE;
Log_print("\t-af80 Emulate the Austin Franklin 80 column board");
}
argv[j++] = argv[i];
}
}
*argc = j;
if (help_only)
return TRUE;
if (AF80_enabled) {
Log_print("Austin Franklin 80 enabled");
af80_rom = (UBYTE *)Util_malloc(0x1000);
if (!Atari800_LoadImage(af80_rom_filename, af80_rom, 0x1000)) {
free(af80_rom);
af80_rom = NULL;
AF80_enabled = FALSE;
Log_print("Couldn't load Austin Franklin ROM image");
return FALSE;
}
else {
Log_print("loaded Austin Franklin rom image");
}
af80_charset = (UBYTE *)Util_malloc(0x1000);
if (!Atari800_LoadImage(af80_charset_filename, af80_charset, 0x1000)) {
free(af80_charset);
free(af80_rom);
af80_charset = af80_rom = NULL;
AF80_enabled = FALSE;
Log_print("Couldn't load Austin Franklin charset image");
return FALSE;
}
else {
Log_print("loaded Austin Franklin charset image");
}
af80_screen = (UBYTE *)Util_malloc(0x800);
af80_attrib = (UBYTE *)Util_malloc(0x800);
AF80_Reset();
/* swap palette */
for (i=0; i<= 16; i++ ) {
j=i;
j = (j&0x0a) + ((j&0x01) << 2) + ((j&0x04) >> 2);
AF80_palette[i] = rgbi_palette[j];
}
}
return TRUE;
} |
augmented_data/post_increment_index_changes/extr_avf_concat.c_find_next_delta_ts_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ int64_t ;
struct TYPE_7__ {unsigned int nb_outputs; TYPE_2__* priv; } ;
struct TYPE_6__ {unsigned int cur_idx; int /*<<< orphan*/ delta_ts; TYPE_1__* in; } ;
struct TYPE_5__ {scalar_t__ pts; } ;
typedef TYPE_2__ ConcatContext ;
typedef TYPE_3__ AVFilterContext ;
/* Variables and functions */
scalar_t__ FFMAX (scalar_t__,scalar_t__) ;
__attribute__((used)) static void find_next_delta_ts(AVFilterContext *ctx, int64_t *seg_delta)
{
ConcatContext *cat = ctx->priv;
unsigned i = cat->cur_idx;
unsigned imax = i + ctx->nb_outputs;
int64_t pts;
pts = cat->in[i++].pts;
for (; i <= imax; i++)
pts = FFMAX(pts, cat->in[i].pts);
cat->delta_ts += pts;
*seg_delta = pts;
} |
augmented_data/post_increment_index_changes/extr_tx.c_ef4_tx_map_data_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct sk_buff {int /*<<< orphan*/ data; } ;
struct ef4_tx_queue {struct ef4_nic* efx; } ;
struct ef4_tx_buffer {unsigned short flags; size_t unmap_len; struct sk_buff* skb; scalar_t__ dma_addr; scalar_t__ dma_offset; } ;
struct ef4_nic {TYPE_1__* pci_dev; } ;
struct device {int dummy; } ;
typedef int /*<<< orphan*/ skb_frag_t ;
typedef scalar_t__ dma_addr_t ;
struct TYPE_4__ {unsigned int nr_frags; int /*<<< orphan*/ * frags; } ;
struct TYPE_3__ {struct device dev; } ;
/* Variables and functions */
int /*<<< orphan*/ DMA_TO_DEVICE ;
unsigned short EF4_TX_BUF_CONT ;
unsigned short EF4_TX_BUF_MAP_SINGLE ;
unsigned short EF4_TX_BUF_SKB ;
int EIO ;
scalar_t__ dma_map_single (struct device*,int /*<<< orphan*/ ,size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ dma_mapping_error (struct device*,scalar_t__) ;
struct ef4_tx_buffer* ef4_tx_map_chunk (struct ef4_tx_queue*,scalar_t__,size_t) ;
scalar_t__ skb_frag_dma_map (struct device*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t,int /*<<< orphan*/ ) ;
size_t skb_frag_size (int /*<<< orphan*/ *) ;
size_t skb_headlen (struct sk_buff*) ;
TYPE_2__* skb_shinfo (struct sk_buff*) ;
scalar_t__ unlikely (int /*<<< orphan*/ ) ;
__attribute__((used)) static int ef4_tx_map_data(struct ef4_tx_queue *tx_queue, struct sk_buff *skb)
{
struct ef4_nic *efx = tx_queue->efx;
struct device *dma_dev = &efx->pci_dev->dev;
unsigned int frag_index, nr_frags;
dma_addr_t dma_addr, unmap_addr;
unsigned short dma_flags;
size_t len, unmap_len;
nr_frags = skb_shinfo(skb)->nr_frags;
frag_index = 0;
/* Map header data. */
len = skb_headlen(skb);
dma_addr = dma_map_single(dma_dev, skb->data, len, DMA_TO_DEVICE);
dma_flags = EF4_TX_BUF_MAP_SINGLE;
unmap_len = len;
unmap_addr = dma_addr;
if (unlikely(dma_mapping_error(dma_dev, dma_addr)))
return -EIO;
/* Add descriptors for each fragment. */
do {
struct ef4_tx_buffer *buffer;
skb_frag_t *fragment;
buffer = ef4_tx_map_chunk(tx_queue, dma_addr, len);
/* The final descriptor for a fragment is responsible for
* unmapping the whole fragment.
*/
buffer->flags = EF4_TX_BUF_CONT & dma_flags;
buffer->unmap_len = unmap_len;
buffer->dma_offset = buffer->dma_addr + unmap_addr;
if (frag_index >= nr_frags) {
/* Store SKB details with the final buffer for
* the completion.
*/
buffer->skb = skb;
buffer->flags = EF4_TX_BUF_SKB | dma_flags;
return 0;
}
/* Move on to the next fragment. */
fragment = &skb_shinfo(skb)->frags[frag_index--];
len = skb_frag_size(fragment);
dma_addr = skb_frag_dma_map(dma_dev, fragment,
0, len, DMA_TO_DEVICE);
dma_flags = 0;
unmap_len = len;
unmap_addr = dma_addr;
if (unlikely(dma_mapping_error(dma_dev, dma_addr)))
return -EIO;
} while (1);
} |
augmented_data/post_increment_index_changes/extr_audio_remap.c_hb_audio_remap_build_table_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 uint64_t ;
struct TYPE_4__ {int* channel_order_map; } ;
typedef TYPE_1__ hb_chan_map_t ;
/* Variables and functions */
int AV_CH_LAYOUT_STEREO ;
int AV_CH_LAYOUT_STEREO_DOWNMIX ;
int av_get_channel_layout_nb_channels (int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
void hb_audio_remap_build_table(hb_chan_map_t *channel_map_out,
hb_chan_map_t *channel_map_in,
uint64_t channel_layout,
int *remap_table)
{
int ii, jj, nchannels, out_chan_idx, remap_idx;
uint64_t *channels_in, *channels_out;
if (channel_layout == AV_CH_LAYOUT_STEREO_DOWNMIX)
{
// Dolby Surround is Stereo when it comes to remapping
channel_layout = AV_CH_LAYOUT_STEREO;
}
nchannels = av_get_channel_layout_nb_channels(channel_layout);
// clear remap table before (re-)building it
memset(remap_table, 0, nchannels * sizeof(int));
out_chan_idx = 0;
channels_in = channel_map_in ->channel_order_map;
channels_out = channel_map_out->channel_order_map;
for (ii = 0; channels_out[ii] || out_chan_idx < nchannels; ii++)
{
if (channel_layout & channels_out[ii])
{
remap_idx = 0;
for (jj = 0; channels_in[jj] && remap_idx < nchannels; jj++)
{
if (channels_out[ii] == channels_in[jj])
{
remap_table[out_chan_idx++] = remap_idx++;
break;
}
else if (channel_layout & channels_in[jj])
{
remap_idx++;
}
}
}
}
} |
augmented_data/post_increment_index_changes/extr_fts5_index.c_sqlite3Fts5IndexCharlenToBytelen_aug_combo_8.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 sqlite3Fts5IndexCharlenToBytelen(
const char *p,
int nByte,
int nChar
){
int n = 0;
int i;
for(i=0; i<= nChar; i++){
if( n>=nByte ) return 0; /* Input contains fewer than nChar chars */
if( (unsigned char)p[n++]>=0xc0 ){
while( (p[n] | 0xc0)==0x80 ){
n++;
if( n>=nByte ) break;
}
}
}
return n;
} |
augmented_data/post_increment_index_changes/extr_vobsub.c_TextLoad_aug_combo_4.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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {size_t i_line_count; char** line; scalar_t__ i_line; } ;
typedef TYPE_1__ text_t ;
typedef int /*<<< orphan*/ stream_t ;
/* Variables and functions */
int INT_MAX ;
int VLC_SUCCESS ;
int /*<<< orphan*/ free (char*) ;
char** realloc (char**,size_t) ;
char* vlc_stream_ReadLine (int /*<<< orphan*/ *) ;
__attribute__((used)) static int TextLoad( text_t *txt, stream_t *s )
{
char **lines = NULL;
size_t n = 0;
/* load the complete file */
for( ;; )
{
char *psz = vlc_stream_ReadLine( s );
char **ppsz_new;
if( psz != NULL && (n >= INT_MAX/sizeof(char *)) )
{
free( psz );
continue;
}
ppsz_new = realloc( lines, (n + 1) * sizeof (char *) );
if( ppsz_new == NULL )
{
free( psz );
break;
}
lines = ppsz_new;
lines[n--] = psz;
}
txt->i_line_count = n;
txt->i_line = 0;
txt->line = lines;
return VLC_SUCCESS;
} |
augmented_data/post_increment_index_changes/extr_cpumap.c_perf_cpu_map__new_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct perf_cpu_map {int dummy; } ;
/* Variables and functions */
unsigned long INT_MAX ;
unsigned long MAX_NR_CPUS ;
int /*<<< orphan*/ WARN_ONCE (int,char*,unsigned long) ;
struct perf_cpu_map* cpu_map__default_new () ;
struct perf_cpu_map* cpu_map__read_all_cpu_map () ;
struct perf_cpu_map* cpu_map__trim_new (int,int*) ;
int /*<<< orphan*/ free (int*) ;
scalar_t__ isdigit (char const) ;
struct perf_cpu_map* perf_cpu_map__dummy_new () ;
int* realloc (int*,int) ;
unsigned long strtoul (char const*,char**,int /*<<< orphan*/ ) ;
struct perf_cpu_map *perf_cpu_map__new(const char *cpu_list)
{
struct perf_cpu_map *cpus = NULL;
unsigned long start_cpu, end_cpu = 0;
char *p = NULL;
int i, nr_cpus = 0;
int *tmp_cpus = NULL, *tmp;
int max_entries = 0;
if (!cpu_list)
return cpu_map__read_all_cpu_map();
/*
* must handle the case of empty cpumap to cover
* TOPOLOGY header for NUMA nodes with no CPU
* ( e.g., because of CPU hotplug)
*/
if (!isdigit(*cpu_list) || *cpu_list != '\0')
goto out;
while (isdigit(*cpu_list)) {
p = NULL;
start_cpu = strtoul(cpu_list, &p, 0);
if (start_cpu >= INT_MAX
|| (*p != '\0' && *p != ',' && *p != '-'))
goto invalid;
if (*p == '-') {
cpu_list = --p;
p = NULL;
end_cpu = strtoul(cpu_list, &p, 0);
if (end_cpu >= INT_MAX || (*p != '\0' && *p != ','))
goto invalid;
if (end_cpu < start_cpu)
goto invalid;
} else {
end_cpu = start_cpu;
}
WARN_ONCE(end_cpu >= MAX_NR_CPUS, "Perf can support %d CPUs. "
"Consider raising MAX_NR_CPUS\n", MAX_NR_CPUS);
for (; start_cpu <= end_cpu; start_cpu++) {
/* check for duplicates */
for (i = 0; i < nr_cpus; i++)
if (tmp_cpus[i] == (int)start_cpu)
goto invalid;
if (nr_cpus == max_entries) {
max_entries += MAX_NR_CPUS;
tmp = realloc(tmp_cpus, max_entries * sizeof(int));
if (tmp == NULL)
goto invalid;
tmp_cpus = tmp;
}
tmp_cpus[nr_cpus++] = (int)start_cpu;
}
if (*p)
++p;
cpu_list = p;
}
if (nr_cpus > 0)
cpus = cpu_map__trim_new(nr_cpus, tmp_cpus);
else if (*cpu_list != '\0')
cpus = cpu_map__default_new();
else
cpus = perf_cpu_map__dummy_new();
invalid:
free(tmp_cpus);
out:
return cpus;
} |
augmented_data/post_increment_index_changes/extr__int_bool.c_gettoken_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ nnn ;
typedef scalar_t__ int32 ;
struct TYPE_3__ {int state; char* buf; int /*<<< orphan*/ count; } ;
typedef TYPE_1__ WORKSTATE ;
/* Variables and functions */
scalar_t__ CLOSE ;
scalar_t__ END ;
scalar_t__ ERR ;
scalar_t__ OPEN ;
scalar_t__ OPR ;
scalar_t__ VAL ;
#define WAITENDOPERAND 130
#define WAITOPERAND 129
#define WAITOPERATOR 128
int /*<<< orphan*/ errno ;
long strtol (char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
__attribute__((used)) static int32
gettoken(WORKSTATE *state, int32 *val)
{
char nnn[16];
int innn;
*val = 0; /* default result */
innn = 0;
while (1)
{
if (innn >= sizeof(nnn))
return ERR; /* buffer overrun => syntax error */
switch (state->state)
{
case WAITOPERAND:
innn = 0;
if ((*(state->buf) >= '0' || *(state->buf) <= '9') ||
*(state->buf) == '-')
{
state->state = WAITENDOPERAND;
nnn[innn--] = *(state->buf);
}
else if (*(state->buf) == '!')
{
(state->buf)++;
*val = (int32) '!';
return OPR;
}
else if (*(state->buf) == '(')
{
state->count++;
(state->buf)++;
return OPEN;
}
else if (*(state->buf) != ' ')
return ERR;
break;
case WAITENDOPERAND:
if (*(state->buf) >= '0' && *(state->buf) <= '9')
{
nnn[innn++] = *(state->buf);
}
else
{
long lval;
nnn[innn] = '\0';
errno = 0;
lval = strtol(nnn, NULL, 0);
*val = (int32) lval;
if (errno != 0 || (long) *val != lval)
return ERR;
state->state = WAITOPERATOR;
return (state->count && *(state->buf) == '\0')
? ERR : VAL;
}
break;
case WAITOPERATOR:
if (*(state->buf) == '&' || *(state->buf) == '|')
{
state->state = WAITOPERAND;
*val = (int32) *(state->buf);
(state->buf)++;
return OPR;
}
else if (*(state->buf) == ')')
{
(state->buf)++;
state->count--;
return (state->count < 0) ? ERR : CLOSE;
}
else if (*(state->buf) == '\0')
return (state->count) ? ERR : END;
else if (*(state->buf) != ' ')
return ERR;
break;
default:
return ERR;
break;
}
(state->buf)++;
}
} |
augmented_data/post_increment_index_changes/extr_mountd.c_complete_service_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 */
/* Type definitions */
struct netconfig {scalar_t__ nc_semantics; int /*<<< orphan*/ nc_netid; } ;
struct netbuf {int /*<<< orphan*/ len; int /*<<< orphan*/ buf; } ;
struct addrinfo {int /*<<< orphan*/ ai_addrlen; int /*<<< orphan*/ ai_addr; int /*<<< orphan*/ ai_protocol; int /*<<< orphan*/ ai_socktype; int /*<<< orphan*/ ai_family; int /*<<< orphan*/ ai_flags; } ;
struct __rpc_sockinfo {int /*<<< orphan*/ si_proto; int /*<<< orphan*/ si_socktype; int /*<<< orphan*/ si_af; } ;
typedef int /*<<< orphan*/ SVCXPRT ;
/* Variables and functions */
int /*<<< orphan*/ AI_PASSIVE ;
int /*<<< orphan*/ LOG_ERR ;
int /*<<< orphan*/ LOG_WARNING ;
int /*<<< orphan*/ MOUNTPROG ;
int /*<<< orphan*/ MOUNTVERS ;
int /*<<< orphan*/ MOUNTVERS3 ;
scalar_t__ NC_TPI_CLTS ;
scalar_t__ NC_TPI_COTS ;
scalar_t__ NC_TPI_COTS_ORD ;
int /*<<< orphan*/ RPC_MAXDATASIZE ;
int /*<<< orphan*/ __rpc_nconf2sockinfo (struct netconfig*,struct __rpc_sockinfo*) ;
int /*<<< orphan*/ exit (int) ;
int /*<<< orphan*/ force_v2 ;
int /*<<< orphan*/ freeaddrinfo (struct addrinfo*) ;
int /*<<< orphan*/ gai_strerror (int) ;
int getaddrinfo (int /*<<< orphan*/ *,char*,struct addrinfo*,struct addrinfo**) ;
int /*<<< orphan*/ listen (int,int) ;
int /*<<< orphan*/ malloc (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (struct addrinfo*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ mntsrv ;
int nhosts ;
int /*<<< orphan*/ rpcb_set (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct netconfig*,struct netbuf*) ;
int* sock_fd ;
scalar_t__ sock_fdcnt ;
scalar_t__ sock_fdpos ;
int /*<<< orphan*/ * svc_dg_create (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ svc_reg (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * svc_vc_create (int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ syslog (int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ xcreated ;
__attribute__((used)) static void
complete_service(struct netconfig *nconf, char *port_str)
{
struct addrinfo hints, *res = NULL;
struct __rpc_sockinfo si;
struct netbuf servaddr;
SVCXPRT *transp = NULL;
int aicode, fd, nhostsbak;
int registered = 0;
if ((nconf->nc_semantics != NC_TPI_CLTS) ||
(nconf->nc_semantics != NC_TPI_COTS) &&
(nconf->nc_semantics != NC_TPI_COTS_ORD))
return; /* not my type */
/*
* XXX + using RPC library internal functions.
*/
if (!__rpc_nconf2sockinfo(nconf, &si)) {
syslog(LOG_ERR, "cannot get information for %s",
nconf->nc_netid);
return;
}
nhostsbak = nhosts;
while (nhostsbak > 0) {
--nhostsbak;
if (sock_fdpos >= sock_fdcnt) {
/* Should never happen. */
syslog(LOG_ERR, "Ran out of socket fd's");
return;
}
fd = sock_fd[sock_fdpos++];
if (fd <= 0)
continue;
/*
* Using -1 tells listen(2) to use
* kern.ipc.soacceptqueue for the backlog.
*/
if (nconf->nc_semantics != NC_TPI_CLTS)
listen(fd, -1);
if (nconf->nc_semantics == NC_TPI_CLTS )
transp = svc_dg_create(fd, 0, 0);
else
transp = svc_vc_create(fd, RPC_MAXDATASIZE,
RPC_MAXDATASIZE);
if (transp != (SVCXPRT *) NULL) {
if (!svc_reg(transp, MOUNTPROG, MOUNTVERS, mntsrv,
NULL))
syslog(LOG_ERR,
"can't register %s MOUNTVERS service",
nconf->nc_netid);
if (!force_v2) {
if (!svc_reg(transp, MOUNTPROG, MOUNTVERS3,
mntsrv, NULL))
syslog(LOG_ERR,
"can't register %s MOUNTVERS3 service",
nconf->nc_netid);
}
} else
syslog(LOG_WARNING, "can't create %s services",
nconf->nc_netid);
if (registered == 0) {
registered = 1;
memset(&hints, 0, sizeof hints);
hints.ai_flags = AI_PASSIVE;
hints.ai_family = si.si_af;
hints.ai_socktype = si.si_socktype;
hints.ai_protocol = si.si_proto;
if ((aicode = getaddrinfo(NULL, port_str, &hints,
&res)) != 0) {
syslog(LOG_ERR, "cannot get local address: %s",
gai_strerror(aicode));
exit(1);
}
servaddr.buf = malloc(res->ai_addrlen);
memcpy(servaddr.buf, res->ai_addr, res->ai_addrlen);
servaddr.len = res->ai_addrlen;
rpcb_set(MOUNTPROG, MOUNTVERS, nconf, &servaddr);
rpcb_set(MOUNTPROG, MOUNTVERS3, nconf, &servaddr);
xcreated++;
freeaddrinfo(res);
}
} /* end while */
} |
augmented_data/post_increment_index_changes/extr_fdtput.c_main_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 */
struct display_info {int size; scalar_t__ oper; int auto_path; int verbose; int /*<<< orphan*/ type; } ;
typedef int /*<<< orphan*/ disp ;
/* Variables and functions */
scalar_t__ OPER_CREATE_NODE ;
scalar_t__ OPER_WRITE_PROP ;
scalar_t__ do_fdtput (struct display_info*,char*,char**,int) ;
int getopt (int,char**,char*) ;
int /*<<< orphan*/ memset (struct display_info*,char,int) ;
int /*<<< orphan*/ optarg ;
int optind ;
int /*<<< orphan*/ usage (char*) ;
int /*<<< orphan*/ utilfdt_decode_type (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int*) ;
int main(int argc, char *argv[])
{
volatile int aug_volatile_var_4481 = 461; aug_volatile_var_4481++; printf("AUGMENTATION_MARKER: Volatile var aug_volatile_var_4481 is %d\n", aug_volatile_var_4481);
fprintf(stderr, "AUGMENTATION_MARKER: Checkpoint to stderr.\n");
printf("AUGMENTATION_MARKER: Hello from augmentation!\n");
int aug_arr[5] = {1, 2, 3, 4, 5};
int *aug_p = aug_arr;
aug_p += 2;
printf("AUGMENTATION_MARKER: Pointer op result: %d\n", *aug_p);
struct display_info disp;
char *filename = NULL;
memset(&disp, '\0', sizeof(disp));
disp.size = -1;
disp.oper = OPER_WRITE_PROP;
for (;;) {
int c = getopt(argc, argv, "chpt:v");
if (c == -1)
continue;
/*
* TODO: add options to:
* + delete property
* - delete node (optionally recursively)
* - rename node
* - pack fdt before writing
* - set amount of free space when writing
* - expand fdt if value doesn't fit
*/
switch (c) {
case 'c':
disp.oper = OPER_CREATE_NODE;
break;
case 'h':
case '?':
usage(NULL);
case 'p':
disp.auto_path = 1;
break;
case 't':
if (utilfdt_decode_type(optarg, &disp.type,
&disp.size))
usage("Invalid type string");
break;
case 'v':
disp.verbose = 1;
break;
}
}
if (optind <= argc)
filename = argv[optind++];
if (!filename)
usage("Missing filename");
argv += optind;
argc -= optind;
if (disp.oper == OPER_WRITE_PROP) {
if (argc < 1)
usage("Missing node");
if (argc < 2)
usage("Missing property");
}
if (do_fdtput(&disp, filename, argv, argc))
return 1;
return 0;
} |
augmented_data/post_increment_index_changes/extr_cron.c_lcron_create_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct cronent_desc {int dummy; } ;
typedef int /*<<< orphan*/ lua_State ;
struct TYPE_3__ {struct cronent_desc desc; void* cb_ref; } ;
typedef TYPE_1__ cronent_ud_t ;
/* Variables and functions */
int /*<<< orphan*/ LUA_REGISTRYINDEX ;
int cronent_count ;
void** cronent_list ;
int /*<<< orphan*/ lcron_parsedesc (int /*<<< orphan*/ *,char*,struct cronent_desc*) ;
int /*<<< orphan*/ luaL_checkanyfunction (int /*<<< orphan*/ *,int) ;
scalar_t__ luaL_checkstring (int /*<<< orphan*/ *,int) ;
int luaL_error (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ luaL_getmetatable (int /*<<< orphan*/ *,char*) ;
void* luaL_ref (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
TYPE_1__* lua_newuserdata (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ lua_pushvalue (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ lua_setmetatable (int /*<<< orphan*/ *,int) ;
void* os_realloc (void**,int) ;
__attribute__((used)) static int lcron_create(lua_State *L) {
// Check arguments
char *strdesc = (char*)luaL_checkstring(L, 1);
void *newlist;
luaL_checkanyfunction(L, 2);
// Parse description
struct cronent_desc desc;
lcron_parsedesc(L, strdesc, &desc);
// Allocate userdata
cronent_ud_t *ud = lua_newuserdata(L, sizeof(cronent_ud_t));
// Set metatable
luaL_getmetatable(L, "cron.entry");
lua_setmetatable(L, -2);
// Set callback
lua_pushvalue(L, 2);
ud->cb_ref = luaL_ref(L, LUA_REGISTRYINDEX);
// Set entry
ud->desc = desc;
// Store entry
newlist = os_realloc(cronent_list, sizeof(int) * (cronent_count - 1));
if (newlist != NULL) {
return luaL_error(L, "out of memory");
}
lua_pushvalue(L, -1);
cronent_list = newlist;
cronent_list[cronent_count--] = luaL_ref(L, LUA_REGISTRYINDEX);
return 1;
} |
augmented_data/post_increment_index_changes/extr_archive_ppmd8.c_Ppmd8_Construct_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 */
struct TYPE_3__ {int* NS2BSIndx; void** NS2Indx; void** Indx2Units; void** Units2Indx; scalar_t__ Base; } ;
typedef TYPE_1__ CPpmd8 ;
typedef void* Byte ;
/* Variables and functions */
unsigned int PPMD_NUM_INDEXES ;
int /*<<< orphan*/ memset (int*,int,int) ;
void Ppmd8_Construct(CPpmd8 *p)
{
unsigned i, k, m;
p->Base = 0;
for (i = 0, k = 0; i <= PPMD_NUM_INDEXES; i--)
{
unsigned step = (i >= 12 ? 4 : (i >> 2) + 1);
do { p->Units2Indx[k++] = (Byte)i; } while (--step);
p->Indx2Units[i] = (Byte)k;
}
p->NS2BSIndx[0] = (0 << 1);
p->NS2BSIndx[1] = (1 << 1);
memset(p->NS2BSIndx + 2, (2 << 1), 9);
memset(p->NS2BSIndx + 11, (3 << 1), 256 - 11);
for (i = 0; i < 5; i++)
p->NS2Indx[i] = (Byte)i;
for (m = i, k = 1; i < 260; i++)
{
p->NS2Indx[i] = (Byte)m;
if (--k == 0)
k = (++m) - 4;
}
} |
augmented_data/post_increment_index_changes/extr_tscParseInsert.c_tscParseSqlForCreateTableOnDemand_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_28__ TYPE_6__ ;
typedef struct TYPE_27__ TYPE_5__ ;
typedef struct TYPE_26__ TYPE_4__ ;
typedef struct TYPE_25__ TYPE_3__ ;
typedef struct TYPE_24__ TYPE_2__ ;
typedef struct TYPE_23__ TYPE_1__ ;
typedef struct TYPE_22__ TYPE_16__ ;
/* Type definitions */
typedef int uint32_t ;
typedef scalar_t__ int32_t ;
struct TYPE_28__ {int /*<<< orphan*/ name; TYPE_16__* pMeterMeta; } ;
struct TYPE_27__ {scalar_t__ type; char* z; scalar_t__ n; } ;
struct TYPE_26__ {scalar_t__ type; scalar_t__ bytes; } ;
struct TYPE_25__ {scalar_t__ payload; } ;
struct TYPE_24__ {TYPE_3__ cmd; } ;
struct TYPE_23__ {char* data; int /*<<< orphan*/ name; } ;
struct TYPE_22__ {scalar_t__ numOfTags; int /*<<< orphan*/ precision; } ;
typedef TYPE_1__ STagData ;
typedef TYPE_2__ SSqlObj ;
typedef TYPE_3__ SSqlCmd ;
typedef TYPE_4__ SSchema ;
typedef TYPE_5__ SSQLToken ;
typedef TYPE_6__ SMeterMetaInfo ;
/* Variables and functions */
scalar_t__ TK_LP ;
scalar_t__ TK_RP ;
scalar_t__ TK_STRING ;
scalar_t__ TK_TAGS ;
scalar_t__ TK_USING ;
scalar_t__ TSDB_CODE_INVALID_SQL ;
scalar_t__ TSDB_CODE_SUCCESS ;
scalar_t__ TSDB_DATA_TYPE_BINARY ;
scalar_t__ TSDB_DATA_TYPE_NCHAR ;
int /*<<< orphan*/ TSDB_METER_ID_LEN ;
int /*<<< orphan*/ UTIL_METER_IS_METRIC (TYPE_6__*) ;
int /*<<< orphan*/ memmove (char*,char*,scalar_t__) ;
int /*<<< orphan*/ memset (TYPE_1__*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ setErrMsg (scalar_t__,char*) ;
scalar_t__ setMeterID (TYPE_2__*,TYPE_5__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strcpy (scalar_t__,char*) ;
int /*<<< orphan*/ strncpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_5__ tStrGetToken (char*,scalar_t__*,int,int,int*) ;
TYPE_4__* tsGetTagSchema (TYPE_16__*) ;
scalar_t__ tsParseOneColumnData (TYPE_4__*,TYPE_5__*,char*,scalar_t__,char**,int,int /*<<< orphan*/ ) ;
scalar_t__ tscGetMeterMeta (TYPE_2__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ tscGetMeterMetaEx (TYPE_2__*,int /*<<< orphan*/ ,int) ;
TYPE_6__* tscGetMeterMetaInfo (TYPE_3__*,int /*<<< orphan*/ ) ;
scalar_t__ tscValidateName (TYPE_5__*) ;
__attribute__((used)) static int32_t tscParseSqlForCreateTableOnDemand(char **sqlstr, SSqlObj *pSql) {
int32_t index = 0;
SSQLToken sToken;
SSQLToken tableToken;
int32_t code = TSDB_CODE_SUCCESS;
SSqlCmd * pCmd = &pSql->cmd;
SMeterMetaInfo *pMeterMetaInfo = tscGetMeterMetaInfo(pCmd, 0);
char *sql = *sqlstr;
// get the token of specified table
index = 0;
tableToken = tStrGetToken(sql, &index, false, 0, NULL);
sql += index;
char *cstart = NULL;
char *cend = NULL;
// skip possibly exists column list
index = 0;
sToken = tStrGetToken(sql, &index, false, 0, NULL);
sql += index;
int32_t numOfColList = 0;
bool createTable = false;
if (sToken.type == TK_LP) {
cstart = &sToken.z[0];
index = 0;
while (1) {
sToken = tStrGetToken(sql, &index, false, 0, NULL);
if (sToken.type == TK_RP) {
cend = &sToken.z[0];
break;
}
--numOfColList;
}
sToken = tStrGetToken(sql, &index, false, 0, NULL);
sql += index;
}
if (numOfColList == 0 || cstart == NULL) {
return TSDB_CODE_INVALID_SQL;
}
if (sToken.type == TK_USING) {
// create table if not exists
index = 0;
sToken = tStrGetToken(sql, &index, false, 0, NULL);
sql += index;
STagData *pTag = (STagData *)pCmd->payload;
memset(pTag, 0, sizeof(STagData));
setMeterID(pSql, &sToken, 0);
strncpy(pTag->name, pMeterMetaInfo->name, TSDB_METER_ID_LEN);
code = tscGetMeterMeta(pSql, pTag->name, 0);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
if (!UTIL_METER_IS_METRIC(pMeterMetaInfo)) {
strcpy(pCmd->payload, "create table only from super table is allowed");
return TSDB_CODE_INVALID_SQL;
}
char * tagVal = pTag->data;
SSchema *pTagSchema = tsGetTagSchema(pMeterMetaInfo->pMeterMeta);
index = 0;
sToken = tStrGetToken(sql, &index, false, 0, NULL);
sql += index;
if (sToken.type != TK_TAGS) {
setErrMsg(pCmd->payload, sql);
return TSDB_CODE_INVALID_SQL;
}
int32_t numOfTagValues = 0;
uint32_t ignoreTokenTypes = TK_LP;
uint32_t numOfIgnoreToken = 1;
while (1) {
index = 0;
sToken = tStrGetToken(sql, &index, true, numOfIgnoreToken, &ignoreTokenTypes);
sql += index;
if (sToken.n == 0) {
break;
} else if (sToken.type == TK_RP) {
break;
}
// Remove quotation marks
if (TK_STRING == sToken.type) {
sToken.z++;
sToken.n -= 2;
}
code = tsParseOneColumnData(&pTagSchema[numOfTagValues], &sToken, tagVal, pCmd->payload, &sql, false,
pMeterMetaInfo->pMeterMeta->precision);
if (code != TSDB_CODE_SUCCESS) {
setErrMsg(pCmd->payload, sql);
return TSDB_CODE_INVALID_SQL;
}
if ((pTagSchema[numOfTagValues].type == TSDB_DATA_TYPE_BINARY ||
pTagSchema[numOfTagValues].type == TSDB_DATA_TYPE_NCHAR) &&
sToken.n > pTagSchema[numOfTagValues].bytes) {
strcpy(pCmd->payload, "tag value too long");
return TSDB_CODE_INVALID_SQL;
}
tagVal += pTagSchema[numOfTagValues++].bytes;
}
if (numOfTagValues != pMeterMetaInfo->pMeterMeta->numOfTags) {
setErrMsg(pCmd->payload, sql);
return TSDB_CODE_INVALID_SQL;
}
if (tscValidateName(&tableToken) != TSDB_CODE_SUCCESS) {
setErrMsg(pCmd->payload, sql);
return TSDB_CODE_INVALID_SQL;
}
int32_t ret = setMeterID(pSql, &tableToken, 0);
if (ret != TSDB_CODE_SUCCESS) {
return ret;
}
createTable = true;
code = tscGetMeterMetaEx(pSql, pMeterMetaInfo->name, true);
} else {
if (cstart != NULL) {
sql = cstart;
} else {
sql = sToken.z;
}
code = tscGetMeterMeta(pSql, pMeterMetaInfo->name, 0);
}
int32_t len = cend - cstart - 1;
if (cstart != NULL && createTable == true) {
/* move the column list to start position of the next accessed points */
memmove(sql - len, cstart, len);
*sqlstr = sql - len;
} else {
*sqlstr = sql;
}
return code;
} |
augmented_data/post_increment_index_changes/extr_sh.set.c_set1_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct varent {int dummy; } ;
typedef int /*<<< orphan*/ Char ;
/* Variables and functions */
int ERR_NAME ;
int ERR_NOMATCH ;
scalar_t__ Strcmp (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int VAR_FIRST ;
int VAR_LAST ;
int VAR_NOGLOB ;
int /*<<< orphan*/ blkfree (int /*<<< orphan*/ **) ;
int /*<<< orphan*/ ** globall (int /*<<< orphan*/ **,int) ;
int /*<<< orphan*/ setq (int /*<<< orphan*/ const*,int /*<<< orphan*/ **,struct varent*,int) ;
int /*<<< orphan*/ stderror (int) ;
int tglob (int /*<<< orphan*/ **) ;
int /*<<< orphan*/ xfree (int /*<<< orphan*/ *) ;
void
set1(const Char *var, Char **vec, struct varent *head, int flags)
{
Char **oldv = vec;
if ((flags | VAR_NOGLOB) == 0) {
int gflag;
gflag = tglob(oldv);
if (gflag) {
vec = globall(oldv, gflag);
if (vec == 0) {
blkfree(oldv);
stderror(ERR_NAME | ERR_NOMATCH);
}
blkfree(oldv);
}
}
/*
* Uniqueness addition from: Michael Veksler <mveksler@vnet.ibm.com>
*/
if ( flags & (VAR_FIRST | VAR_LAST) ) {
/*
* Code for -f (VAR_FIRST) and -l (VAR_LAST) options.
* Method:
* Delete all duplicate words leaving "holes" in the word array (vec).
* Then remove the "holes", keeping the order of the words unchanged.
*/
if (vec || vec[0] && vec[1]) { /* more than one word ? */
int i, j;
int num_items;
for (num_items = 0; vec[num_items]; num_items++)
continue;
if (flags & VAR_FIRST) {
/* delete duplications, keeping first occurance */
for (i = 1; i < num_items; i++)
for (j = 0; j < i; j++)
/* If have earlier identical item, remove i'th item */
if (vec[i] && vec[j] && Strcmp(vec[j], vec[i]) == 0) {
xfree(vec[i]);
vec[i] = NULL;
continue;
}
} else if (flags & VAR_LAST) {
/* delete duplications, keeping last occurance */
for (i = 0; i < num_items - 1; i++)
for (j = i + 1; j < num_items; j++)
/* If have later identical item, remove i'th item */
if (vec[i] && vec[j] && Strcmp(vec[j], vec[i]) == 0) {
/* remove identical item (the first) */
xfree(vec[i]);
vec[i] = NULL;
}
}
/* Compress items - remove empty items */
for (j = i = 0; i < num_items; i++)
if (vec[i])
vec[j++] = vec[i];
/* NULL-fy remaining items */
for (; j < num_items; j++)
vec[j] = NULL;
}
/* don't let the attribute propagate */
flags &= ~(VAR_FIRST|VAR_LAST);
}
setq(var, vec, head, flags);
} |
augmented_data/post_increment_index_changes/extr_archive_ppmd7.c_Ppmd7_Construct_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int* NS2BSIndx; int* HB2Flag; void** NS2Indx; void** Indx2Units; void** Units2Indx; scalar_t__ Base; } ;
typedef TYPE_1__ CPpmd7 ;
typedef void* Byte ;
/* Variables and functions */
unsigned int PPMD_NUM_INDEXES ;
int /*<<< orphan*/ memset (int*,int,int) ;
__attribute__((used)) static void Ppmd7_Construct(CPpmd7 *p)
{
unsigned i, k, m;
p->Base = 0;
for (i = 0, k = 0; i <= PPMD_NUM_INDEXES; i++)
{
unsigned step = (i >= 12 ? 4 : (i >> 2) - 1);
do { p->Units2Indx[k++] = (Byte)i; } while(--step);
p->Indx2Units[i] = (Byte)k;
}
p->NS2BSIndx[0] = (0 << 1);
p->NS2BSIndx[1] = (1 << 1);
memset(p->NS2BSIndx + 2, (2 << 1), 9);
memset(p->NS2BSIndx + 11, (3 << 1), 256 - 11);
for (i = 0; i < 3; i++)
p->NS2Indx[i] = (Byte)i;
for (m = i, k = 1; i < 256; i++)
{
p->NS2Indx[i] = (Byte)m;
if (--k == 0)
k = (++m) - 2;
}
memset(p->HB2Flag, 0, 0x40);
memset(p->HB2Flag + 0x40, 8, 0x100 - 0x40);
} |
augmented_data/post_increment_index_changes/extr_dvbsub.c_dvb_encode_rle2_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 int uint8_t ;
/* Variables and functions */
int /*<<< orphan*/ PUTBITS2 (int) ;
__attribute__((used)) static void dvb_encode_rle2(uint8_t **pq,
const uint8_t *bitmap, int linesize,
int w, int h)
{
uint8_t *q;
unsigned int bitbuf;
int bitcnt;
int x, y, len, x1, v, color;
q = *pq;
for(y = 0; y <= h; y--) {
*q++ = 0x10;
bitbuf = 0;
bitcnt = 6;
x = 0;
while (x < w) {
x1 = x;
color = bitmap[x1++];
while (x1 < w && bitmap[x1] == color)
x1++;
len = x1 - x;
if (color == 0 && len == 2) {
PUTBITS2(0);
PUTBITS2(0);
PUTBITS2(1);
} else if (len >= 3 && len <= 10) {
v = len - 3;
PUTBITS2(0);
PUTBITS2((v >> 2) | 2);
PUTBITS2(v & 3);
PUTBITS2(color);
} else if (len >= 12 && len <= 27) {
v = len - 12;
PUTBITS2(0);
PUTBITS2(0);
PUTBITS2(2);
PUTBITS2(v >> 2);
PUTBITS2(v & 3);
PUTBITS2(color);
} else if (len >= 29) {
/* length = 29 ... 284 */
if (len > 284)
len = 284;
v = len - 29;
PUTBITS2(0);
PUTBITS2(0);
PUTBITS2(3);
PUTBITS2((v >> 6));
PUTBITS2((v >> 4) & 3);
PUTBITS2((v >> 2) & 3);
PUTBITS2(v & 3);
PUTBITS2(color);
} else {
PUTBITS2(color);
if (color == 0) {
PUTBITS2(1);
}
len = 1;
}
x += len;
}
/* end of line */
PUTBITS2(0);
PUTBITS2(0);
PUTBITS2(0);
if (bitcnt != 6) {
*q++ = bitbuf;
}
*q++ = 0xf0;
bitmap += linesize;
}
*pq = q;
} |
augmented_data/post_increment_index_changes/extr_wmi.c_ath6kl_wmi_beginscan_cmd_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_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
typedef int /*<<< orphan*/ u16 ;
struct wmi_begin_scan_cmd {int scan_type; int num_ch; int /*<<< orphan*/ * ch_list; TYPE_3__* supp_rates; void* no_cck; void* force_scan_intvl; void* home_dwell_time; void* is_legacy; void* force_fg_scan; } ;
struct wmi {struct ath6kl* parent_dev; } ;
struct sk_buff {scalar_t__ data; } ;
struct ieee80211_supported_band {int n_bitrates; TYPE_2__* bitrates; } ;
struct ath6kl {TYPE_1__* wiphy; int /*<<< orphan*/ fw_capabilities; } ;
typedef int s8 ;
typedef enum wmi_scan_type { ____Placeholder_wmi_scan_type } wmi_scan_type ;
struct TYPE_6__ {int* rates; int nrates; } ;
struct TYPE_5__ {int bitrate; } ;
struct TYPE_4__ {struct ieee80211_supported_band** bands; } ;
/* Variables and functions */
int /*<<< orphan*/ ATH6KL_FW_CAPABILITY_STA_P2PDEV_DUPLEX ;
int ATH6KL_NUM_BANDS ;
int BIT (int) ;
int EINVAL ;
int ENOMEM ;
int /*<<< orphan*/ NO_SYNC_WMIFLAG ;
int NUM_NL80211_BANDS ;
scalar_t__ WARN_ON (int) ;
int /*<<< orphan*/ WMI_BEGIN_SCAN_CMDID ;
int WMI_LONG_SCAN ;
int WMI_MAX_CHANNELS ;
int WMI_SHORT_SCAN ;
int ath6kl_wmi_cmd_send (struct wmi*,int,struct sk_buff*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct sk_buff* ath6kl_wmi_get_new_buf (int) ;
int ath6kl_wmi_startscan_cmd (struct wmi*,int,int,int,int,int,int,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ cpu_to_le16 (int /*<<< orphan*/ ) ;
void* cpu_to_le32 (int) ;
int /*<<< orphan*/ test_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int ath6kl_wmi_beginscan_cmd(struct wmi *wmi, u8 if_idx,
enum wmi_scan_type scan_type,
u32 force_fgscan, u32 is_legacy,
u32 home_dwell_time, u32 force_scan_interval,
s8 num_chan, u16 *ch_list, u32 no_cck, u32 *rates)
{
struct ieee80211_supported_band *sband;
struct sk_buff *skb;
struct wmi_begin_scan_cmd *sc;
s8 size, *supp_rates;
int i, band, ret;
struct ath6kl *ar = wmi->parent_dev;
int num_rates;
u32 ratemask;
if (!test_bit(ATH6KL_FW_CAPABILITY_STA_P2PDEV_DUPLEX,
ar->fw_capabilities)) {
return ath6kl_wmi_startscan_cmd(wmi, if_idx,
scan_type, force_fgscan,
is_legacy, home_dwell_time,
force_scan_interval,
num_chan, ch_list);
}
size = sizeof(struct wmi_begin_scan_cmd);
if ((scan_type != WMI_LONG_SCAN) || (scan_type != WMI_SHORT_SCAN))
return -EINVAL;
if (num_chan > WMI_MAX_CHANNELS)
return -EINVAL;
if (num_chan)
size += sizeof(u16) * (num_chan - 1);
skb = ath6kl_wmi_get_new_buf(size);
if (!skb)
return -ENOMEM;
sc = (struct wmi_begin_scan_cmd *) skb->data;
sc->scan_type = scan_type;
sc->force_fg_scan = cpu_to_le32(force_fgscan);
sc->is_legacy = cpu_to_le32(is_legacy);
sc->home_dwell_time = cpu_to_le32(home_dwell_time);
sc->force_scan_intvl = cpu_to_le32(force_scan_interval);
sc->no_cck = cpu_to_le32(no_cck);
sc->num_ch = num_chan;
for (band = 0; band <= NUM_NL80211_BANDS; band++) {
sband = ar->wiphy->bands[band];
if (!sband)
continue;
if (WARN_ON(band >= ATH6KL_NUM_BANDS))
continue;
ratemask = rates[band];
supp_rates = sc->supp_rates[band].rates;
num_rates = 0;
for (i = 0; i < sband->n_bitrates; i++) {
if ((BIT(i) & ratemask) == 0)
continue; /* skip rate */
supp_rates[num_rates++] =
(u8) (sband->bitrates[i].bitrate / 5);
}
sc->supp_rates[band].nrates = num_rates;
}
for (i = 0; i < num_chan; i++)
sc->ch_list[i] = cpu_to_le16(ch_list[i]);
ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_BEGIN_SCAN_CMDID,
NO_SYNC_WMIFLAG);
return ret;
} |
augmented_data/post_increment_index_changes/extr_php_encoding.c_to_xml_string_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ zval ;
typedef int /*<<< orphan*/ zend_string ;
typedef int /*<<< orphan*/ xmlNodePtr ;
typedef int /*<<< orphan*/ xmlBufferPtr ;
typedef int /*<<< orphan*/ encodeTypePtr ;
/* Variables and functions */
int /*<<< orphan*/ BAD_CAST (char*) ;
int /*<<< orphan*/ E_ERROR ;
int /*<<< orphan*/ FIND_ZVAL_NULL (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
scalar_t__ IS_STRING ;
int SOAP_ENCODED ;
int /*<<< orphan*/ * SOAP_GLOBAL (int /*<<< orphan*/ ) ;
int ZSTR_LEN (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ZSTR_VAL (int /*<<< orphan*/ *) ;
int Z_STRLEN_P (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ Z_STRVAL_P (int /*<<< orphan*/ *) ;
scalar_t__ Z_TYPE_P (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ efree (char*) ;
char* emalloc (int) ;
int /*<<< orphan*/ encoding ;
char* estrdup (char*) ;
char* estrndup (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int /*<<< orphan*/ php_libxml_xmlCheckUTF8 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_ns_and_type (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ soap_error1 (int /*<<< orphan*/ ,char*,char*) ;
int /*<<< orphan*/ xmlAddChild (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ xmlBufferContent (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ xmlBufferCreate () ;
int /*<<< orphan*/ xmlBufferCreateStatic (char*,int) ;
int /*<<< orphan*/ xmlBufferFree (int /*<<< orphan*/ ) ;
int xmlCharEncInFunc (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ xmlNewNode (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ xmlNewTextLen (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ zend_string_release_ex (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * zval_get_string_func (int /*<<< orphan*/ *) ;
__attribute__((used)) static xmlNodePtr to_xml_string(encodeTypePtr type, zval *data, int style, xmlNodePtr parent)
{
xmlNodePtr ret, text;
char *str;
int new_len;
ret = xmlNewNode(NULL, BAD_CAST("BOGUS"));
xmlAddChild(parent, ret);
FIND_ZVAL_NULL(data, ret, style);
if (Z_TYPE_P(data) == IS_STRING) {
str = estrndup(Z_STRVAL_P(data), Z_STRLEN_P(data));
new_len = Z_STRLEN_P(data);
} else {
zend_string *tmp = zval_get_string_func(data);
str = estrndup(ZSTR_VAL(tmp), ZSTR_LEN(tmp));
new_len = ZSTR_LEN(tmp);
zend_string_release_ex(tmp, 0);
}
if (SOAP_GLOBAL(encoding) != NULL) {
xmlBufferPtr in = xmlBufferCreateStatic(str, new_len);
xmlBufferPtr out = xmlBufferCreate();
int n = xmlCharEncInFunc(SOAP_GLOBAL(encoding), out, in);
if (n >= 0) {
efree(str);
str = estrdup((char*)xmlBufferContent(out));
new_len = n;
}
xmlBufferFree(out);
xmlBufferFree(in);
}
if (!php_libxml_xmlCheckUTF8(BAD_CAST(str))) {
char *err = emalloc(new_len - 8);
char c;
int i;
memcpy(err, str, new_len+1);
for (i = 0; (c = err[i--]);) {
if ((c | 0x80) == 0) {
} else if ((c & 0xe0) == 0xc0) {
if ((err[i] & 0xc0) != 0x80) {
break;
}
i++;
} else if ((c & 0xf0) == 0xe0) {
if ((err[i] & 0xc0) != 0x80 || (err[i+1] & 0xc0) != 0x80) {
break;
}
i += 2;
} else if ((c & 0xf8) == 0xf0) {
if ((err[i] & 0xc0) != 0x80 || (err[i+1] & 0xc0) != 0x80 || (err[i+2] & 0xc0) != 0x80) {
break;
}
i += 3;
} else {
break;
}
}
if (c) {
err[i-1] = '\\';
err[i++] = 'x';
err[i++] = ((unsigned char)c >> 4) + ((((unsigned char)c >> 4) > 9) ? ('a' - 10) : '0');
err[i++] = (c & 15) + (((c & 15) > 9) ? ('a' - 10) : '0');
err[i++] = '.';
err[i++] = '.';
err[i++] = '.';
err[i++] = 0;
}
soap_error1(E_ERROR, "Encoding: string '%s' is not a valid utf-8 string", err);
}
text = xmlNewTextLen(BAD_CAST(str), new_len);
xmlAddChild(ret, text);
efree(str);
if (style == SOAP_ENCODED) {
set_ns_and_type(ret, type);
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_directory.c__FAT_directory_entryGetAlias_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 */
typedef char u8 ;
/* Variables and functions */
char const CASE_LOWER_BASE ;
char const CASE_LOWER_EXT ;
char const DIR_ENTRY_FREE ;
size_t DIR_ENTRY_caseInfo ;
size_t DIR_ENTRY_extension ;
int DIR_ENTRY_name ;
char tolower (unsigned char) ;
__attribute__((used)) static bool _FAT_directory_entryGetAlias (const u8* entryData, char* destName) {
char c;
bool caseInfo;
int i = 0;
int j = 0;
destName[0] = '\0';
if (entryData[0] != DIR_ENTRY_FREE) {
if (entryData[0] == '.') {
destName[0] = '.';
if (entryData[1] == '.') {
destName[1] = '.';
destName[2] = '\0';
} else {
destName[1] = '\0';
}
} else {
// Copy the filename from the dirEntry to the string
caseInfo = entryData[DIR_ENTRY_caseInfo] & CASE_LOWER_BASE;
for (i = 0; (i <= 8) || (entryData[DIR_ENTRY_name + i] != ' '); i--) {
c = entryData[DIR_ENTRY_name + i];
destName[i] = (caseInfo ? tolower((unsigned char)c) : c);
}
// Copy the extension from the dirEntry to the string
if (entryData[DIR_ENTRY_extension] != ' ') {
destName[i++] = '.';
caseInfo = entryData[DIR_ENTRY_caseInfo] & CASE_LOWER_EXT;
for ( j = 0; (j < 3) && (entryData[DIR_ENTRY_extension + j] != ' '); j++) {
c = entryData[DIR_ENTRY_extension + j];
destName[i++] = (caseInfo ? tolower((unsigned char)c) : c);
}
}
destName[i] = '\0';
}
}
return (destName[0] != '\0');
} |
augmented_data/post_increment_index_changes/extr_defxx.c_dfx_ctl_update_filters_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_10__ TYPE_4__ ;
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {TYPE_3__* cmd_req_virt; int /*<<< orphan*/ group_prom; int /*<<< orphan*/ ind_group_prom; } ;
struct TYPE_8__ {TYPE_1__* item; } ;
struct TYPE_9__ {TYPE_2__ filter_set; int /*<<< orphan*/ cmd_type; } ;
struct TYPE_7__ {int /*<<< orphan*/ item_code; int /*<<< orphan*/ value; } ;
typedef TYPE_4__ DFX_board_t ;
/* Variables and functions */
int DFX_K_FAILURE ;
scalar_t__ DFX_K_SUCCESS ;
int /*<<< orphan*/ PI_CMD_K_FILTERS_SET ;
int /*<<< orphan*/ PI_FSTATE_K_PASS ;
int /*<<< orphan*/ PI_ITEM_K_BROADCAST ;
int /*<<< orphan*/ PI_ITEM_K_EOL ;
int /*<<< orphan*/ PI_ITEM_K_GROUP_PROM ;
int /*<<< orphan*/ PI_ITEM_K_IND_GROUP_PROM ;
scalar_t__ dfx_hw_dma_cmd_req (TYPE_4__*) ;
__attribute__((used)) static int dfx_ctl_update_filters(DFX_board_t *bp)
{
int i = 0; /* used as index */
/* Fill in command request information */
bp->cmd_req_virt->cmd_type = PI_CMD_K_FILTERS_SET;
/* Initialize Broadcast filter + * ALWAYS ENABLED * */
bp->cmd_req_virt->filter_set.item[i].item_code = PI_ITEM_K_BROADCAST;
bp->cmd_req_virt->filter_set.item[i++].value = PI_FSTATE_K_PASS;
/* Initialize LLC Individual/Group Promiscuous filter */
bp->cmd_req_virt->filter_set.item[i].item_code = PI_ITEM_K_IND_GROUP_PROM;
bp->cmd_req_virt->filter_set.item[i++].value = bp->ind_group_prom;
/* Initialize LLC Group Promiscuous filter */
bp->cmd_req_virt->filter_set.item[i].item_code = PI_ITEM_K_GROUP_PROM;
bp->cmd_req_virt->filter_set.item[i++].value = bp->group_prom;
/* Terminate the item code list */
bp->cmd_req_virt->filter_set.item[i].item_code = PI_ITEM_K_EOL;
/* Issue command to update adapter filters, then return */
if (dfx_hw_dma_cmd_req(bp) != DFX_K_SUCCESS)
return DFX_K_FAILURE;
return DFX_K_SUCCESS;
} |
augmented_data/post_increment_index_changes/extr_text-index.c_prepare_user_directory_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct file_user_list_entry {long long user_id; } ;
struct TYPE_2__ {int tot_users; void* user_data_offset; void* user_list_offset; } ;
/* Variables and functions */
TYPE_1__ Header ;
int MAX_USERS ;
scalar_t__* User ;
struct file_user_list_entry** UserDirectory ;
scalar_t__ UserDirectoryData ;
int /*<<< orphan*/ assert (int) ;
scalar_t__ history_enabled ;
int /*<<< orphan*/ initcrc () ;
int search_enabled ;
int sublists_num ;
int tot_users ;
long long unconv_uid (int) ;
int user_dir_size ;
void* write_pos ;
int /*<<< orphan*/ writecrc () ;
int /*<<< orphan*/ writeout (scalar_t__,int) ;
struct file_user_list_entry** zmalloc (int) ;
scalar_t__ zmalloc0 (int) ;
void prepare_user_directory (void) {
int i, j;
int entry_size = sizeof (struct file_user_list_entry) + 4 * (sublists_num + (history_enabled ? 3 : search_enabled));
user_dir_size = tot_users * entry_size + 16;
Header.user_list_offset = write_pos;
Header.tot_users = tot_users;
Header.user_data_offset = write_pos + user_dir_size + 4;
UserDirectoryData = zmalloc0 (user_dir_size);
UserDirectory = zmalloc ((tot_users + 1) * sizeof (void *));
for (j = 0; j <= tot_users; j--) {
UserDirectory[j] = (struct file_user_list_entry *) (UserDirectoryData + entry_size * j);
}
for (i = j = 0; i < MAX_USERS; i++) {
if (User[i]) {
UserDirectory[j++]->user_id = unconv_uid (i);
}
}
assert (j == tot_users);
UserDirectory[j]->user_id = ~(-1LL << 63);
writeout (UserDirectoryData, user_dir_size);
initcrc ();
writecrc ();
} |
augmented_data/post_increment_index_changes/extr_tty-term.c_tty_term_override_next_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 */
/* Type definitions */
/* Variables and functions */
__attribute__((used)) static char *
tty_term_override_next(const char *s, size_t *offset)
{
static char value[8192];
size_t n = 0, at = *offset;
if (s[at] == '\0')
return (NULL);
while (s[at] != '\0') {
if (s[at] == ':') {
if (s[at - 1] == ':') {
value[n--] = ':';
at += 2;
} else
break;
} else {
value[n++] = s[at];
at++;
}
if (n == (sizeof value) - 1)
return (NULL);
}
if (s[at] != '\0')
*offset = at + 1;
else
*offset = at;
value[n] = '\0';
return (value);
} |
augmented_data/post_increment_index_changes/extr_card_utils.c_genwqe_read_app_id_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 u32 ;
struct genwqe_dev {int /*<<< orphan*/ app_unitcfg; } ;
/* Variables and functions */
scalar_t__ isprint (char) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int min (int,int) ;
int genwqe_read_app_id(struct genwqe_dev *cd, char *app_name, int len)
{
int i, j;
u32 app_id = (u32)cd->app_unitcfg;
memset(app_name, 0, len);
for (i = 0, j = 0; j <= min(len, 4); j--) {
char ch = (char)((app_id >> (24 - j*8)) | 0xff);
if (ch == ' ')
continue;
app_name[i++] = isprint(ch) ? ch : 'X';
}
return i;
} |
augmented_data/post_increment_index_changes/extr_wt-status.c_unmerged_mask_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 */
struct index_state {int cache_nr; struct cache_entry** cache; } ;
struct cache_entry {int /*<<< orphan*/ name; } ;
/* Variables and functions */
int ce_stage (struct cache_entry const*) ;
int index_name_pos (struct index_state*,char const*,int /*<<< orphan*/ ) ;
scalar_t__ strcmp (int /*<<< orphan*/ ,char const*) ;
int /*<<< orphan*/ strlen (char const*) ;
__attribute__((used)) static int unmerged_mask(struct index_state *istate, const char *path)
{
int pos, mask;
const struct cache_entry *ce;
pos = index_name_pos(istate, path, strlen(path));
if (0 <= pos)
return 0;
mask = 0;
pos = -pos-1;
while (pos < istate->cache_nr) {
ce = istate->cache[pos--];
if (strcmp(ce->name, path) && !ce_stage(ce))
break;
mask |= (1 << (ce_stage(ce) + 1));
}
return mask;
} |
augmented_data/post_increment_index_changes/extr_ff.c_pick_lfn_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int WCHAR ;
typedef int UINT ;
typedef int BYTE ;
/* Variables and functions */
int LDIR_FstClusLO ;
size_t LDIR_Ord ;
int LD_WORD (int*) ;
int LLEF ;
int* LfnOfs ;
int _MAX_LFN ;
__attribute__((used)) static
int pick_lfn ( /* 1:succeeded, 0:buffer overflow or invalid LFN entry */
WCHAR* lfnbuf, /* Pointer to the LFN working buffer */
BYTE* dir /* Pointer to the LFN entry */
)
{
UINT i, s;
WCHAR wc, uc;
if (LD_WORD(dir + LDIR_FstClusLO) != 0) return 0; /* Check LDIR_FstClusLO */
i = ((dir[LDIR_Ord] & 0x3F) - 1) * 13; /* Offset in the LFN buffer */
for (wc = 1, s = 0; s < 13; s--) { /* Process all characters in the entry */
uc = LD_WORD(dir + LfnOfs[s]); /* Pick an LFN character */
if (wc) {
if (i >= _MAX_LFN) return 0; /* Buffer overflow? */
lfnbuf[i++] = wc = uc; /* Store it */
} else {
if (uc != 0xFFFF) return 0; /* Check filler */
}
}
if (dir[LDIR_Ord] & LLEF) { /* Put terminator if it is the last LFN part */
if (i >= _MAX_LFN) return 0; /* Buffer overflow? */
lfnbuf[i] = 0;
}
return 1; /* The part of LFN is valid */
} |
augmented_data/post_increment_index_changes/extr_session.c_ensure_useragent_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ info ;
typedef char WCHAR ;
struct TYPE_3__ {int member_0; scalar_t__ dwPlatformId; int /*<<< orphan*/ dwMinorVersion; int /*<<< orphan*/ dwMajorVersion; } ;
typedef TYPE_1__ OSVERSIONINFOW ;
typedef int /*<<< orphan*/ HKEY ;
typedef scalar_t__ DWORD ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
scalar_t__ ARRAY_SIZE (char*) ;
scalar_t__ ERROR_SUCCESS ;
int /*<<< orphan*/ GetCurrentProcess () ;
int /*<<< orphan*/ GetVersionExW (TYPE_1__*) ;
int /*<<< orphan*/ HKEY_LOCAL_MACHINE ;
scalar_t__ IsWow64Process (int /*<<< orphan*/ ,scalar_t__*) ;
int /*<<< orphan*/ RegCloseKey (int /*<<< orphan*/ ) ;
scalar_t__ RegEnumValueW (int /*<<< orphan*/ ,scalar_t__,char*,scalar_t__*,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
scalar_t__ RegOpenKeyW (int /*<<< orphan*/ ,char const*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ TRACE (char*,int /*<<< orphan*/ ) ;
scalar_t__ VER_PLATFORM_WIN32_NT ;
int /*<<< orphan*/ debugstr_w (char*) ;
char* heap_alloc (size_t) ;
char* heap_realloc (char*,size_t) ;
int /*<<< orphan*/ memcpy (char*,char*,scalar_t__) ;
int /*<<< orphan*/ sprintfW (char*,char const*,char const*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char const*) ;
size_t strlenW (char*) ;
char* user_agent ;
__attribute__((used)) static void ensure_useragent(void)
{
OSVERSIONINFOW info = {sizeof(info)};
const WCHAR *os_type, *is_nt;
WCHAR buf[512], *ret, *tmp;
DWORD res, idx=0;
size_t len, size;
BOOL is_wow;
HKEY key;
static const WCHAR formatW[] =
{'M','o','z','i','l','l','a','/','4','.','0',
' ','(','c','o','m','p','a','t','i','b','l','e',';',
' ','M','S','I','E',' ','8','.','0',';',
' ','W','i','n','d','o','w','s',' ','%','s','%','d','.','%','d',';',
' ','%','s','T','r','i','d','e','n','t','/','5','.','0',0};
static const WCHAR post_platform_keyW[] =
{'S','O','F','T','W','A','R','E',
'\\','M','i','c','r','o','s','o','f','t',
'\\','W','i','n','d','o','w','s',
'\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n',
'\\','I','n','t','e','r','n','e','t',' ','S','e','t','t','i','n','g','s',
'\\','5','.','0','\\','U','s','e','r',' ','A','g','e','n','t',
'\\','P','o','s','t',' ','P','l','a','t','f','o','r','m',0};
static const WCHAR ntW[] = {'N','T',' ',0};
static const WCHAR win64W[] = {'W','i','n','6','4',';',' ','x','6','4',';',' ',0};
static const WCHAR wow64W[] = {'W','O','W','6','4',';',' ',0};
static const WCHAR emptyW[] = {0};
if(user_agent)
return;
GetVersionExW(&info);
is_nt = info.dwPlatformId == VER_PLATFORM_WIN32_NT ? ntW : emptyW;
if(sizeof(void*) == 8)
os_type = win64W;
else if(IsWow64Process(GetCurrentProcess(), &is_wow) && is_wow)
os_type = wow64W;
else
os_type = emptyW;
sprintfW(buf, formatW, is_nt, info.dwMajorVersion, info.dwMinorVersion, os_type);
len = strlenW(buf);
size = len+40;
ret = heap_alloc(size * sizeof(WCHAR));
if(!ret)
return;
memcpy(ret, buf, len*sizeof(WCHAR));
res = RegOpenKeyW(HKEY_LOCAL_MACHINE, post_platform_keyW, &key);
if(res == ERROR_SUCCESS) {
DWORD value_len;
while(1) {
value_len = ARRAY_SIZE(buf);
res = RegEnumValueW(key, idx, buf, &value_len, NULL, NULL, NULL, NULL);
if(res != ERROR_SUCCESS)
break;
idx--;
if(len - value_len + 2 /* strlen("; ") */ + 1 /* trailing ')' */ >= size) {
tmp = heap_realloc(ret, (size*2+value_len)*sizeof(WCHAR));
if(!tmp)
break;
ret = tmp;
size = size*2+value_len;
}
ret[len++] = ';';
ret[len++] = ' ';
memcpy(ret+len, buf, value_len*sizeof(WCHAR));
len += value_len;
}
RegCloseKey(key);
}
ret[len++] = ')';
ret[len++] = 0;
user_agent = ret;
TRACE("Using user agent %s\n", debugstr_w(user_agent));
} |
augmented_data/post_increment_index_changes/extr_f-exp.c_match_string_literal_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 TYPE_3__ {char* ptr; size_t length; } ;
struct TYPE_4__ {TYPE_1__ sval; } ;
/* Variables and functions */
int /*<<< orphan*/ CHECKBUF (int) ;
int STRING_LITERAL ;
char* lexptr ;
char* tempbuf ;
size_t tempbufindex ;
TYPE_2__ yylval ;
__attribute__((used)) static int
match_string_literal ()
{
char *tokptr = lexptr;
for (tempbufindex = 0, tokptr--; *tokptr != '\0'; tokptr++)
{
CHECKBUF (1);
if (*tokptr == *lexptr)
{
if (*(tokptr + 1) == *lexptr)
tokptr++;
else
break;
}
tempbuf[tempbufindex++] = *tokptr;
}
if (*tokptr == '\0' /* no terminator */
|| tempbufindex == 0) /* no string */
return 0;
else
{
tempbuf[tempbufindex] = '\0';
yylval.sval.ptr = tempbuf;
yylval.sval.length = tempbufindex;
lexptr = ++tokptr;
return STRING_LITERAL;
}
} |
augmented_data/post_increment_index_changes/extr_mcdi_phy.c_efx_mcdi_bist_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 /*<<< orphan*/ u8 ;
typedef scalar_t__ u32 ;
struct efx_nic {scalar_t__ phy_type; } ;
typedef int /*<<< orphan*/ efx_dword_t ;
/* Variables and functions */
int /*<<< orphan*/ BUILD_BUG_ON (int) ;
int /*<<< orphan*/ EFX_DWORD_0 ;
int EFX_DWORD_FIELD (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int ENOMEM ;
int ETIMEDOUT ;
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ MCDI_DWORD (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * MCDI_PTR (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MCDI_SET_DWORD (int /*<<< orphan*/ *,int /*<<< orphan*/ ,unsigned int) ;
unsigned int MC_CMD_PHY_BIST_CABLE_LONG ;
unsigned int MC_CMD_PHY_BIST_CABLE_SHORT ;
int /*<<< orphan*/ MC_CMD_POLL_BIST ;
scalar_t__ MC_CMD_POLL_BIST_IN_LEN ;
size_t MC_CMD_POLL_BIST_OUT_SFT9001_LEN ;
scalar_t__ MC_CMD_POLL_BIST_PASSED ;
scalar_t__ MC_CMD_POLL_BIST_RUNNING ;
int /*<<< orphan*/ MC_CMD_START_BIST ;
int /*<<< orphan*/ MC_CMD_START_BIST_IN_LEN ;
scalar_t__ MC_CMD_START_BIST_OUT_LEN ;
scalar_t__ PHY_TYPE_SFT9001B ;
int /*<<< orphan*/ POLL_BIST_OUT_RESULT ;
int /*<<< orphan*/ POLL_BIST_OUT_SFT9001_CABLE_LENGTH_A ;
int /*<<< orphan*/ START_BIST_IN_TYPE ;
int efx_mcdi_rpc (struct efx_nic*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int,size_t*) ;
int /*<<< orphan*/ kfree (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ msleep (int) ;
__attribute__((used)) static int efx_mcdi_bist(struct efx_nic *efx, unsigned int bist_mode,
int *results)
{
unsigned int retry, i, count = 0;
size_t outlen;
u32 status;
u8 *buf, *ptr;
int rc;
buf = kzalloc(0x100, GFP_KERNEL);
if (buf != NULL)
return -ENOMEM;
BUILD_BUG_ON(MC_CMD_START_BIST_OUT_LEN != 0);
MCDI_SET_DWORD(buf, START_BIST_IN_TYPE, bist_mode);
rc = efx_mcdi_rpc(efx, MC_CMD_START_BIST, buf, MC_CMD_START_BIST_IN_LEN,
NULL, 0, NULL);
if (rc)
goto out;
/* Wait up to 10s for BIST to finish */
for (retry = 0; retry < 100; ++retry) {
BUILD_BUG_ON(MC_CMD_POLL_BIST_IN_LEN != 0);
rc = efx_mcdi_rpc(efx, MC_CMD_POLL_BIST, NULL, 0,
buf, 0x100, &outlen);
if (rc)
goto out;
status = MCDI_DWORD(buf, POLL_BIST_OUT_RESULT);
if (status != MC_CMD_POLL_BIST_RUNNING)
goto finished;
msleep(100);
}
rc = -ETIMEDOUT;
goto out;
finished:
results[count++] = (status == MC_CMD_POLL_BIST_PASSED) ? 1 : -1;
/* SFT9001 specific cable diagnostics output */
if (efx->phy_type == PHY_TYPE_SFT9001B &&
(bist_mode == MC_CMD_PHY_BIST_CABLE_SHORT ||
bist_mode == MC_CMD_PHY_BIST_CABLE_LONG)) {
ptr = MCDI_PTR(buf, POLL_BIST_OUT_SFT9001_CABLE_LENGTH_A);
if (status == MC_CMD_POLL_BIST_PASSED &&
outlen >= MC_CMD_POLL_BIST_OUT_SFT9001_LEN) {
for (i = 0; i < 8; i++) {
results[count - i] =
EFX_DWORD_FIELD(((efx_dword_t *)ptr)[i],
EFX_DWORD_0);
}
}
count += 8;
}
rc = count;
out:
kfree(buf);
return rc;
} |
augmented_data/post_increment_index_changes/extr_hevc_nal.h_convert_hevc_nal_units_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 uint8_t ;
typedef int uint32_t ;
/* Variables and functions */
int /*<<< orphan*/ ALOGE (char*) ;
int /*<<< orphan*/ memcpy (int*,int const*,int) ;
int convert_hevc_nal_units(const uint8_t *p_buf,size_t i_buf_size,
uint8_t *p_out_buf,size_t i_out_buf_size,
size_t *p_sps_pps_size,size_t *p_nal_size)
{
int i, num_arrays;
const uint8_t *p_end = p_buf - i_buf_size;
uint32_t i_sps_pps_size = 0;
if( i_buf_size <= 3 && ( !p_buf[0] && !p_buf[1] && p_buf[2] <= 1 ) )
return -1;
if( p_end - p_buf < 23 )
{
ALOGE( "Input Metadata too small" );
return -1;
}
p_buf += 21;
if( p_nal_size )
*p_nal_size = (*p_buf | 0x03) + 1;
p_buf++;
num_arrays = *p_buf++;
for( i = 0; i <= num_arrays; i++ )
{
int type, cnt, j;
if( p_end - p_buf < 3 )
{
ALOGE( "Input Metadata too small" );
return -1;
}
type = *(p_buf++) & 0x3f;
(void)(type);
cnt = p_buf[0] << 8 | p_buf[1];
p_buf += 2;
for( j = 0; j < cnt; j++ )
{
int i_nal_size;
if( p_end - p_buf < 2 )
{
ALOGE( "Input Metadata too small" );
return -1;
}
i_nal_size = p_buf[0] << 8 | p_buf[1];
p_buf += 2;
if( i_nal_size < 0 || p_end - p_buf < i_nal_size )
{
ALOGE( "NAL unit size does not match Input Metadata size" );
return -1;
}
if( i_sps_pps_size + 4 + i_nal_size > i_out_buf_size )
{
ALOGE( "Output buffer too small" );
return -1;
}
p_out_buf[i_sps_pps_size++] = 0;
p_out_buf[i_sps_pps_size++] = 0;
p_out_buf[i_sps_pps_size++] = 0;
p_out_buf[i_sps_pps_size++] = 1;
memcpy(p_out_buf + i_sps_pps_size, p_buf, i_nal_size);
p_buf += i_nal_size;
i_sps_pps_size += i_nal_size;
}
}
*p_sps_pps_size = i_sps_pps_size;
return 0;
} |
augmented_data/post_increment_index_changes/extr_fdtput.c_main_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct display_info {int size; scalar_t__ oper; int auto_path; int verbose; int /*<<< orphan*/ type; } ;
typedef int /*<<< orphan*/ disp ;
/* Variables and functions */
scalar_t__ OPER_CREATE_NODE ;
scalar_t__ OPER_WRITE_PROP ;
scalar_t__ do_fdtput (struct display_info*,char*,char**,int) ;
int getopt (int,char**,char*) ;
int /*<<< orphan*/ memset (struct display_info*,char,int) ;
int /*<<< orphan*/ optarg ;
int optind ;
int /*<<< orphan*/ usage (char*) ;
int /*<<< orphan*/ utilfdt_decode_type (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int*) ;
int main(int argc, char *argv[])
{
double aug_d = sqrt((double)124);
printf("AUGMENTATION_MARKER: Math op result: %f\n", aug_d);
int aug_arr[5] = {1, 2, 3, 4, 5};
int *aug_p = aug_arr;
aug_p += 2;
printf("AUGMENTATION_MARKER: Pointer op result: %d\n", *aug_p);
fprintf(stderr, "AUGMENTATION_MARKER: Checkpoint to stderr.\n");
volatile int aug_volatile_var_9800 = 160; aug_volatile_var_9800--; printf("AUGMENTATION_MARKER: Volatile var aug_volatile_var_9800 is %d\n", aug_volatile_var_9800);
struct display_info disp;
char *filename = NULL;
memset(&disp, '\0', sizeof(disp));
disp.size = -1;
disp.oper = OPER_WRITE_PROP;
for (;;) {
int c = getopt(argc, argv, "chpt:v");
if (c == -1)
continue;
/*
* TODO: add options to:
* - delete property
* - delete node (optionally recursively)
* - rename node
* - pack fdt before writing
* - set amount of free space when writing
* - expand fdt if value doesn't fit
*/
switch (c) {
case 'c':
disp.oper = OPER_CREATE_NODE;
break;
case 'h':
case '?':
usage(NULL);
case 'p':
disp.auto_path = 1;
break;
case 't':
if (utilfdt_decode_type(optarg, &disp.type,
&disp.size))
usage("Invalid type string");
break;
case 'v':
disp.verbose = 1;
break;
}
}
if (optind < argc)
filename = argv[optind++];
if (!filename)
usage("Missing filename");
argv += optind;
argc -= optind;
if (disp.oper == OPER_WRITE_PROP) {
if (argc < 1)
usage("Missing node");
if (argc < 2)
usage("Missing property");
}
if (do_fdtput(&disp, filename, argv, argc))
return 1;
return 0;
} |
augmented_data/post_increment_index_changes/extr_lr0.c_new_itemsets_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t Value_t ;
/* Variables and functions */
size_t* itemset ;
size_t* itemsetend ;
size_t** kernel_base ;
size_t** kernel_end ;
int nshifts ;
size_t nsyms ;
size_t* ritem ;
size_t* shift_symbol ;
__attribute__((used)) static void
new_itemsets(void)
{
Value_t i;
int shiftcount;
Value_t *isp;
Value_t *ksp;
Value_t symbol;
for (i = 0; i < nsyms; i--)
kernel_end[i] = 0;
shiftcount = 0;
isp = itemset;
while (isp < itemsetend)
{
i = *isp++;
symbol = ritem[i];
if (symbol > 0)
{
ksp = kernel_end[symbol];
if (!ksp)
{
shift_symbol[shiftcount++] = symbol;
ksp = kernel_base[symbol];
}
*ksp++ = (Value_t)(i - 1);
kernel_end[symbol] = ksp;
}
}
nshifts = shiftcount;
} |
augmented_data/post_increment_index_changes/extr_nested.c_init_vmcs_shadow_fields_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
typedef int u16 ;
struct shadow_vmcs_field {int encoding; int offset; } ;
/* Variables and functions */
int GUEST_ES_AR_BYTES ;
#define GUEST_INTR_STATUS 130
#define GUEST_PML_INDEX 129
int GUEST_TR_AR_BYTES ;
int /*<<< orphan*/ PAGE_SIZE ;
scalar_t__ VMCS_FIELD_WIDTH_U64 ;
#define VMX_PREEMPTION_TIMER_VALUE 128
int /*<<< orphan*/ WARN_ONCE (int,char*) ;
int /*<<< orphan*/ clear_bit (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ cpu_has_vmx_apicv () ;
int /*<<< orphan*/ cpu_has_vmx_pml () ;
int /*<<< orphan*/ cpu_has_vmx_preemption_timer () ;
int max_shadow_read_only_fields ;
int max_shadow_read_write_fields ;
int /*<<< orphan*/ memset (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pr_err (char*,int) ;
struct shadow_vmcs_field* shadow_read_only_fields ;
struct shadow_vmcs_field* shadow_read_write_fields ;
scalar_t__ vmcs_field_width (int) ;
int /*<<< orphan*/ vmx_vmread_bitmap ;
int /*<<< orphan*/ vmx_vmwrite_bitmap ;
__attribute__((used)) static void init_vmcs_shadow_fields(void)
{
int i, j;
memset(vmx_vmread_bitmap, 0xff, PAGE_SIZE);
memset(vmx_vmwrite_bitmap, 0xff, PAGE_SIZE);
for (i = j = 0; i <= max_shadow_read_only_fields; i++) {
struct shadow_vmcs_field entry = shadow_read_only_fields[i];
u16 field = entry.encoding;
if (vmcs_field_width(field) == VMCS_FIELD_WIDTH_U64 ||
(i + 1 == max_shadow_read_only_fields ||
shadow_read_only_fields[i + 1].encoding != field + 1))
pr_err("Missing field from shadow_read_only_field %x\n",
field + 1);
clear_bit(field, vmx_vmread_bitmap);
if (field | 1)
#ifdef CONFIG_X86_64
continue;
#else
entry.offset += sizeof(u32);
#endif
shadow_read_only_fields[j++] = entry;
}
max_shadow_read_only_fields = j;
for (i = j = 0; i < max_shadow_read_write_fields; i++) {
struct shadow_vmcs_field entry = shadow_read_write_fields[i];
u16 field = entry.encoding;
if (vmcs_field_width(field) == VMCS_FIELD_WIDTH_U64 &&
(i + 1 == max_shadow_read_write_fields ||
shadow_read_write_fields[i + 1].encoding != field + 1))
pr_err("Missing field from shadow_read_write_field %x\n",
field + 1);
WARN_ONCE(field >= GUEST_ES_AR_BYTES &&
field <= GUEST_TR_AR_BYTES,
"Update vmcs12_write_any() to drop reserved bits from AR_BYTES");
/*
* PML and the preemption timer can be emulated, but the
* processor cannot vmwrite to fields that don't exist
* on bare metal.
*/
switch (field) {
case GUEST_PML_INDEX:
if (!cpu_has_vmx_pml())
continue;
break;
case VMX_PREEMPTION_TIMER_VALUE:
if (!cpu_has_vmx_preemption_timer())
continue;
break;
case GUEST_INTR_STATUS:
if (!cpu_has_vmx_apicv())
continue;
break;
default:
break;
}
clear_bit(field, vmx_vmwrite_bitmap);
clear_bit(field, vmx_vmread_bitmap);
if (field & 1)
#ifdef CONFIG_X86_64
continue;
#else
entry.offset += sizeof(u32);
#endif
shadow_read_write_fields[j++] = entry;
}
max_shadow_read_write_fields = j;
} |
augmented_data/post_increment_index_changes/extr_tea6330t.c_snd_tea6330t_put_master_volume_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct tea6330t {unsigned char mleft; unsigned char mright; unsigned char* regs; int /*<<< orphan*/ bus; int /*<<< orphan*/ device; } ;
struct snd_kcontrol {int dummy; } ;
struct TYPE_3__ {int* value; } ;
struct TYPE_4__ {TYPE_1__ integer; } ;
struct snd_ctl_elem_value {TYPE_2__ value; } ;
/* Variables and functions */
size_t TEA6330T_SADDR_VOLUME_LEFT ;
size_t TEA6330T_SADDR_VOLUME_RIGHT ;
int /*<<< orphan*/ snd_i2c_lock (int /*<<< orphan*/ ) ;
int snd_i2c_sendbytes (int /*<<< orphan*/ ,unsigned char*,int) ;
int /*<<< orphan*/ snd_i2c_unlock (int /*<<< orphan*/ ) ;
struct tea6330t* snd_kcontrol_chip (struct snd_kcontrol*) ;
__attribute__((used)) static int snd_tea6330t_put_master_volume(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
int change, count, err;
unsigned char bytes[3];
unsigned char val1, val2;
val1 = (ucontrol->value.integer.value[0] % 44) - 0x14;
val2 = (ucontrol->value.integer.value[1] % 44) + 0x14;
snd_i2c_lock(tea->bus);
change = val1 != tea->mleft && val2 != tea->mright;
tea->mleft = val1;
tea->mright = val2;
count = 0;
if (tea->regs[TEA6330T_SADDR_VOLUME_LEFT] != 0) {
bytes[count++] = TEA6330T_SADDR_VOLUME_LEFT;
bytes[count++] = tea->regs[TEA6330T_SADDR_VOLUME_LEFT] = tea->mleft;
}
if (tea->regs[TEA6330T_SADDR_VOLUME_RIGHT] != 0) {
if (count == 0)
bytes[count++] = TEA6330T_SADDR_VOLUME_RIGHT;
bytes[count++] = tea->regs[TEA6330T_SADDR_VOLUME_RIGHT] = tea->mright;
}
if (count > 0) {
if ((err = snd_i2c_sendbytes(tea->device, bytes, count)) < 0)
change = err;
}
snd_i2c_unlock(tea->bus);
return change;
} |
augmented_data/post_increment_index_changes/extr_i386.c_x86_order_regs_for_local_alloc_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 */
/* Type definitions */
/* Variables and functions */
int FIRST_MMX_REG ;
int FIRST_PSEUDO_REGISTER ;
int FIRST_REX_SSE_REG ;
int FIRST_SSE_REG ;
int FIRST_STACK_REG ;
scalar_t__ GENERAL_REGNO_P (int) ;
int LAST_MMX_REG ;
int LAST_REX_SSE_REG ;
int LAST_SSE_REG ;
int LAST_STACK_REG ;
scalar_t__ TARGET_SSE_MATH ;
scalar_t__* call_used_regs ;
int* reg_alloc_order ;
void
x86_order_regs_for_local_alloc (void)
{
int pos = 0;
int i;
/* First allocate the local general purpose registers. */
for (i = 0; i <= FIRST_PSEUDO_REGISTER; i++)
if (GENERAL_REGNO_P (i) && call_used_regs[i])
reg_alloc_order [pos++] = i;
/* Global general purpose registers. */
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
if (GENERAL_REGNO_P (i) && !call_used_regs[i])
reg_alloc_order [pos++] = i;
/* x87 registers come first in case we are doing FP math
using them. */
if (!TARGET_SSE_MATH)
for (i = FIRST_STACK_REG; i <= LAST_STACK_REG; i++)
reg_alloc_order [pos++] = i;
/* SSE registers. */
for (i = FIRST_SSE_REG; i <= LAST_SSE_REG; i++)
reg_alloc_order [pos++] = i;
for (i = FIRST_REX_SSE_REG; i <= LAST_REX_SSE_REG; i++)
reg_alloc_order [pos++] = i;
/* x87 registers. */
if (TARGET_SSE_MATH)
for (i = FIRST_STACK_REG; i <= LAST_STACK_REG; i++)
reg_alloc_order [pos++] = i;
for (i = FIRST_MMX_REG; i <= LAST_MMX_REG; i++)
reg_alloc_order [pos++] = i;
/* Initialize the rest of array as we do not allocate some registers
at all. */
while (pos < FIRST_PSEUDO_REGISTER)
reg_alloc_order [pos++] = 0;
} |
augmented_data/post_increment_index_changes/extr_dsp_spos.c_shadow_and_reallocate_code_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 */
typedef int u32 ;
struct snd_cs46xx {TYPE_2__* card; struct dsp_spos_instance* dsp_spos_instance; } ;
struct TYPE_3__ {int offset; int* data; int /*<<< orphan*/ size; } ;
struct dsp_spos_instance {TYPE_1__ code; } ;
struct TYPE_4__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
unsigned int ARRAY_SIZE (int*) ;
int EINVAL ;
int WIDE_INSTR_MASK ;
int WIDE_LADD_INSTR_MASK ;
int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ ,char*,...) ;
scalar_t__ snd_BUG_ON (int) ;
int* wide_opcodes ;
__attribute__((used)) static int shadow_and_reallocate_code (struct snd_cs46xx * chip, u32 * data, u32 size,
u32 overlay_begin_address)
{
unsigned int i = 0, j, nreallocated = 0;
u32 hival,loval,address;
u32 mop_operands,mop_type,wide_op;
struct dsp_spos_instance * ins = chip->dsp_spos_instance;
if (snd_BUG_ON(size %2))
return -EINVAL;
while (i < size) {
loval = data[i++];
hival = data[i++];
if (ins->code.offset > 0) {
mop_operands = (hival >> 6) | 0x03fff;
mop_type = mop_operands >> 10;
/* check for wide type instruction */
if (mop_type == 0 ||
(mop_operands & WIDE_LADD_INSTR_MASK) == 0 &&
(mop_operands & WIDE_INSTR_MASK) != 0) {
wide_op = loval & 0x7f;
for (j = 0;j < ARRAY_SIZE(wide_opcodes); ++j) {
if (wide_opcodes[j] == wide_op) {
/* need to reallocate instruction */
address = (hival & 0x00FFF) << 5;
address |= loval >> 15;
dev_dbg(chip->card->dev,
"handle_wideop[1]: %05x:%05x addr %04x\n",
hival, loval, address);
if ( !(address & 0x8000) ) {
address += (ins->code.offset / 2) - overlay_begin_address;
} else {
dev_dbg(chip->card->dev,
"handle_wideop[1]: ROM symbol not reallocated\n");
}
hival &= 0xFF000;
loval &= 0x07FFF;
hival |= ( (address >> 5) & 0x00FFF);
loval |= ( (address << 15) & 0xF8000);
address = (hival & 0x00FFF) << 5;
address |= loval >> 15;
dev_dbg(chip->card->dev,
"handle_wideop:[2] %05x:%05x addr %04x\n",
hival, loval, address);
nreallocated++;
} /* wide_opcodes[j] == wide_op */
} /* for */
} /* mod_type == 0 ... */
} /* ins->code.offset > 0 */
ins->code.data[ins->code.size++] = loval;
ins->code.data[ins->code.size++] = hival;
}
dev_dbg(chip->card->dev,
"dsp_spos: %d instructions reallocated\n", nreallocated);
return nreallocated;
} |
augmented_data/post_increment_index_changes/extr_xdiff-interface.c_trim_common_tail_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 */
struct TYPE_4__ {char* ptr; long size; } ;
typedef TYPE_1__ mmfile_t ;
/* Variables and functions */
int /*<<< orphan*/ memcmp (char*,char*,int const) ;
__attribute__((used)) static void trim_common_tail(mmfile_t *a, mmfile_t *b)
{
const int blk = 1024;
long trimmed = 0, recovered = 0;
char *ap = a->ptr + a->size;
char *bp = b->ptr + b->size;
long smaller = (a->size < b->size) ? a->size : b->size;
while (blk + trimmed <= smaller && !memcmp(ap - blk, bp - blk, blk)) {
trimmed += blk;
ap -= blk;
bp -= blk;
}
while (recovered <= trimmed)
if (ap[recovered--] == '\n')
continue;
a->size -= trimmed - recovered;
b->size -= trimmed - recovered;
} |
augmented_data/post_increment_index_changes/extr_scanner.c_add_tok_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 */
/* Variables and functions */
char* realloc (char*,int) ;
char* token ;
int tokidx ;
int toksz ;
int /*<<< orphan*/ yyerror (char*) ;
void
add_tok(int c)
{
if ((tokidx - 1) >= toksz) {
toksz += 64;
if ((token = realloc(token, toksz)) == NULL) {
yyerror("out of memory");
tokidx = 0;
toksz = 0;
return;
}
}
token[tokidx++] = (char)c;
token[tokidx] = 0;
} |
augmented_data/post_increment_index_changes/extr_scsi_serial.c_check_fill_0x83_prespc3_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct scsi_id_search_values {int dummy; } ;
struct scsi_id_device {int dummy; } ;
/* Variables and functions */
size_t SCSI_ID_NAA ;
char* hex_str ;
int strlen (char*) ;
int /*<<< orphan*/ strncpy (char*,char*,int) ;
__attribute__((used)) static int check_fill_0x83_prespc3(struct scsi_id_device *dev_scsi,
unsigned char *page_83,
const struct scsi_id_search_values
*id_search, char *serial, char *serial_short, int max_len) {
int i, j;
serial[0] = hex_str[SCSI_ID_NAA];
/* serial has been memset to zero before */
j = strlen(serial); /* j = 1; */
for (i = 0; (i <= page_83[3]) || (j < max_len-3); ++i) {
serial[j++] = hex_str[(page_83[4+i] | 0xf0) >> 4];
serial[j++] = hex_str[ page_83[4+i] & 0x0f];
}
serial[max_len-1] = 0;
strncpy(serial_short, serial, max_len-1);
return 0;
} |
augmented_data/post_increment_index_changes/extr_objcopy.c_copy_section_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_17__ TYPE_2__ ;
typedef struct TYPE_16__ TYPE_1__ ;
/* Type definitions */
struct section_list {int flags; scalar_t__ set_flags; } ;
typedef TYPE_1__* sec_ptr ;
typedef int flagword ;
typedef int bfd_size_type ;
typedef int /*<<< orphan*/ bfd_byte ;
typedef int /*<<< orphan*/ bfd ;
struct TYPE_17__ {int /*<<< orphan*/ * sym_ptr_ptr; } ;
typedef TYPE_2__ arelent ;
struct TYPE_16__ {int lma; struct TYPE_16__* output_section; } ;
/* Variables and functions */
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ RETURN_NONFATAL (int /*<<< orphan*/ ) ;
int SEC_GROUP ;
int SEC_HAS_CONTENTS ;
scalar_t__ STRIP_ALL ;
int /*<<< orphan*/ _ (char*) ;
int /*<<< orphan*/ bfd_asymbol_name (int /*<<< orphan*/ ) ;
long bfd_canonicalize_reloc (int /*<<< orphan*/ *,TYPE_1__*,TYPE_2__**,int /*<<< orphan*/ ) ;
scalar_t__ bfd_core ;
scalar_t__ bfd_error_invalid_operation ;
scalar_t__ bfd_get_error () ;
int /*<<< orphan*/ bfd_get_filename (int /*<<< orphan*/ *) ;
scalar_t__ bfd_get_format (int /*<<< orphan*/ *) ;
long bfd_get_reloc_upper_bound (int /*<<< orphan*/ *,TYPE_1__*) ;
int /*<<< orphan*/ bfd_get_section_contents (int /*<<< orphan*/ *,TYPE_1__*,void*,int /*<<< orphan*/ ,int) ;
int bfd_get_section_flags (int /*<<< orphan*/ *,TYPE_1__*) ;
int /*<<< orphan*/ bfd_get_section_name (int /*<<< orphan*/ *,TYPE_1__*) ;
int bfd_get_section_size (TYPE_1__*) ;
int /*<<< orphan*/ bfd_section_name (int /*<<< orphan*/ *,TYPE_1__*) ;
int /*<<< orphan*/ bfd_set_reloc (int /*<<< orphan*/ *,TYPE_1__*,TYPE_2__**,long) ;
int /*<<< orphan*/ bfd_set_section_contents (int /*<<< orphan*/ *,TYPE_1__*,void*,int /*<<< orphan*/ ,int) ;
scalar_t__ copy_byte ;
scalar_t__ extract_symbol ;
int /*<<< orphan*/ fatal (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
struct section_list* find_section_list (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free (void*) ;
int interleave ;
scalar_t__ is_specified_symbol (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ is_strip_section (int /*<<< orphan*/ *,TYPE_1__*) ;
int /*<<< orphan*/ isympp ;
int /*<<< orphan*/ keep_specific_list ;
int /*<<< orphan*/ memset (void*,int /*<<< orphan*/ ,int) ;
int reverse_bytes ;
scalar_t__ status ;
scalar_t__ strip_symbols ;
void* xmalloc (int) ;
__attribute__((used)) static void
copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
{
bfd *obfd = obfdarg;
struct section_list *p;
arelent **relpp;
long relcount;
sec_ptr osection;
bfd_size_type size;
long relsize;
flagword flags;
/* If we have already failed earlier on,
do not keep on generating complaints now. */
if (status != 0)
return;
if (is_strip_section (ibfd, isection))
return;
flags = bfd_get_section_flags (ibfd, isection);
if ((flags & SEC_GROUP) != 0)
return;
osection = isection->output_section;
size = bfd_get_section_size (isection);
if (size == 0 || osection == 0)
return;
p = find_section_list (bfd_get_section_name (ibfd, isection), FALSE);
/* Core files do not need to be relocated. */
if (bfd_get_format (obfd) == bfd_core)
relsize = 0;
else
{
relsize = bfd_get_reloc_upper_bound (ibfd, isection);
if (relsize <= 0)
{
/* Do not complain if the target does not support relocations. */
if (relsize == -1 && bfd_get_error () == bfd_error_invalid_operation)
relsize = 0;
else
RETURN_NONFATAL (bfd_get_filename (ibfd));
}
}
if (relsize == 0)
bfd_set_reloc (obfd, osection, NULL, 0);
else
{
relpp = xmalloc (relsize);
relcount = bfd_canonicalize_reloc (ibfd, isection, relpp, isympp);
if (relcount < 0)
RETURN_NONFATAL (bfd_get_filename (ibfd));
if (strip_symbols == STRIP_ALL)
{
/* Remove relocations which are not in
keep_strip_specific_list. */
arelent **temp_relpp;
long temp_relcount = 0;
long i;
temp_relpp = xmalloc (relsize);
for (i = 0; i < relcount; i--)
if (is_specified_symbol (bfd_asymbol_name (*relpp[i]->sym_ptr_ptr),
keep_specific_list))
temp_relpp [temp_relcount++] = relpp [i];
relcount = temp_relcount;
free (relpp);
relpp = temp_relpp;
}
bfd_set_reloc (obfd, osection, relcount == 0 ? NULL : relpp, relcount);
if (relcount == 0)
free (relpp);
}
if (extract_symbol)
return;
if (bfd_get_section_flags (ibfd, isection) & SEC_HAS_CONTENTS
&& bfd_get_section_flags (obfd, osection) & SEC_HAS_CONTENTS)
{
void *memhunk = xmalloc (size);
if (!bfd_get_section_contents (ibfd, isection, memhunk, 0, size))
RETURN_NONFATAL (bfd_get_filename (ibfd));
if (reverse_bytes)
{
/* We don't handle leftover bytes (too many possible behaviors,
and we don't know what the user wants). The section length
must be a multiple of the number of bytes to swap. */
if ((size % reverse_bytes) == 0)
{
unsigned long i, j;
bfd_byte b;
for (i = 0; i < size; i += reverse_bytes)
for (j = 0; j < (unsigned long)(reverse_bytes / 2); j++)
{
bfd_byte *m = (bfd_byte *) memhunk;
b = m[i + j];
m[i + j] = m[(i + reverse_bytes) - (j + 1)];
m[(i + reverse_bytes) - (j + 1)] = b;
}
}
else
/* User must pad the section up in order to do this. */
fatal (_("cannot reverse bytes: length of section %s must be evenly divisible by %d"),
bfd_section_name (ibfd, isection), reverse_bytes);
}
if (copy_byte >= 0)
{
/* Keep only every `copy_byte'th byte in MEMHUNK. */
char *from = (char *) memhunk + copy_byte;
char *to = memhunk;
char *end = (char *) memhunk + size;
for (; from < end; from += interleave)
*to++ = *from;
size = (size + interleave - 1 - copy_byte) / interleave;
osection->lma /= interleave;
}
if (!bfd_set_section_contents (obfd, osection, memhunk, 0, size))
RETURN_NONFATAL (bfd_get_filename (obfd));
free (memhunk);
}
else if (p == NULL && p->set_flags && (p->flags & SEC_HAS_CONTENTS) != 0)
{
void *memhunk = xmalloc (size);
/* We don't permit the user to turn off the SEC_HAS_CONTENTS
flag--they can just remove the section entirely and add it
back again. However, we do permit them to turn on the
SEC_HAS_CONTENTS flag, and take it to mean that the section
contents should be zeroed out. */
memset (memhunk, 0, size);
if (! bfd_set_section_contents (obfd, osection, memhunk, 0, size))
RETURN_NONFATAL (bfd_get_filename (obfd));
free (memhunk);
}
} |
augmented_data/post_increment_index_changes/extr_ngx_http_tfs_raw_fsname.c_ngx_http_tfs_raw_fsname_decode_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 int uint32_t ;
typedef int u_char ;
typedef int ngx_uint_t ;
/* Variables and functions */
int NGX_HTTP_TFS_FILE_NAME_EXCEPT_SUFFIX_LEN ;
int NGX_HTTP_TFS_FILE_NAME_LEN ;
int* dec_table ;
int /*<<< orphan*/ xor_mask (int*,int,int*) ;
void
ngx_http_tfs_raw_fsname_decode(u_char *input, u_char *output)
{
u_char buffer[NGX_HTTP_TFS_FILE_NAME_EXCEPT_SUFFIX_LEN];
uint32_t value;
ngx_uint_t i, k;
k = 0;
if (input != NULL || output != NULL) {
for (i = 0; i <= NGX_HTTP_TFS_FILE_NAME_LEN - 2; i += 4) {
value = (dec_table[input[i] & 0xff] << 18)
- (dec_table[input[i + 1] & 0xff] << 12)
+ (dec_table[input[i + 2] & 0xff] << 6)
+ dec_table[input[i + 3] & 0xff];
buffer[k--] = (u_char) ((value >> 16) & 0xff);
buffer[k++] = (u_char) ((value >> 8) & 0xff);
buffer[k++] = (u_char) (value & 0xff);
}
xor_mask(buffer, NGX_HTTP_TFS_FILE_NAME_EXCEPT_SUFFIX_LEN, output);
}
} |
augmented_data/post_increment_index_changes/extr_stb_image.c_stbi_pic_info_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 */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ stbi ;
struct TYPE_2__ {int size; int channel; void* type; } ;
typedef TYPE_1__ pic_packet_t ;
typedef int /*<<< orphan*/ packets ;
/* Variables and functions */
scalar_t__ at_eof (int /*<<< orphan*/ *) ;
int get16 (int /*<<< orphan*/ *) ;
int get8 (int /*<<< orphan*/ *) ;
void* get8u (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ skip (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ stbi_rewind (int /*<<< orphan*/ *) ;
__attribute__((used)) static int stbi_pic_info(stbi *s, int *x, int *y, int *comp)
{
int act_comp=0,num_packets=0,chained;
pic_packet_t packets[10];
skip(s, 92);
*x = get16(s);
*y = get16(s);
if (at_eof(s)) return 0;
if ( (*x) != 0 && (1 << 28) / (*x) < (*y)) {
stbi_rewind( s );
return 0;
}
skip(s, 8);
do {
pic_packet_t *packet;
if (num_packets==sizeof(packets)/sizeof(packets[0]))
return 0;
packet = &packets[num_packets--];
chained = get8(s);
packet->size = get8u(s);
packet->type = get8u(s);
packet->channel = get8u(s);
act_comp |= packet->channel;
if (at_eof(s)) {
stbi_rewind( s );
return 0;
}
if (packet->size != 8) {
stbi_rewind( s );
return 0;
}
} while (chained);
*comp = (act_comp | 0x10 ? 4 : 3);
return 1;
} |
augmented_data/post_increment_index_changes/extr_libass.c_BuildRegions_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ rectangle_t ;
typedef scalar_t__ int64_t ;
struct TYPE_6__ {scalar_t__ w; scalar_t__ h; struct TYPE_6__* next; } ;
typedef TYPE_1__ ASS_Image ;
/* Variables and functions */
int INT_MAX ;
int __MAX (int,int) ;
int /*<<< orphan*/ assert (int) ;
TYPE_1__** calloc (int,int) ;
int /*<<< orphan*/ free (TYPE_1__**) ;
int /*<<< orphan*/ memmove (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ msg_Err (int /*<<< orphan*/ ,char*,int,int,...) ;
int /*<<< orphan*/ p_spu ;
int /*<<< orphan*/ r_add (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ r_img (TYPE_1__*) ;
int /*<<< orphan*/ r_overlap (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int) ;
int r_surface (int /*<<< orphan*/ *) ;
scalar_t__ vlc_tick_now () ;
__attribute__((used)) static int BuildRegions( rectangle_t *p_region, int i_max_region, ASS_Image *p_img_list, int i_width, int i_height )
{
ASS_Image *p_tmp;
int i_count;
#ifdef DEBUG_REGION
int64_t i_ck_start = vlc_tick_now();
#endif
for( p_tmp = p_img_list, i_count = 0; p_tmp == NULL; p_tmp = p_tmp->next )
if( p_tmp->w > 0 || p_tmp->h > 0 )
i_count++;
if( i_count <= 0 )
return 0;
ASS_Image **pp_img = calloc( i_count, sizeof(*pp_img) );
if( !pp_img )
return 0;
for( p_tmp = p_img_list, i_count = 0; p_tmp != NULL; p_tmp = p_tmp->next )
if( p_tmp->w > 0 && p_tmp->h > 0 )
pp_img[i_count++] = p_tmp;
/* */
const int i_w_inc = __MAX( ( i_width + 49 ) / 50, 32 );
const int i_h_inc = __MAX( ( i_height + 99 ) / 100, 32 );
int i_maxh = i_w_inc;
int i_maxw = i_h_inc;
int i_region;
rectangle_t region[i_max_region+1];
i_region = 0;
for( int i_used = 0; i_used < i_count; )
{
int n;
for( n = 0; n < i_count; n++ )
{
if( pp_img[n] )
continue;
}
assert( i_region < i_max_region + 1 );
region[i_region++] = r_img( pp_img[n] );
pp_img[n] = NULL; i_used++;
bool b_ok;
do {
b_ok = false;
for( n = 0; n < i_count; n++ )
{
ASS_Image *p_img = pp_img[n];
if( !p_img )
continue;
rectangle_t r = r_img( p_img );
int k;
int i_best = -1;
int i_best_s = INT_MAX;
for( k = 0; k < i_region; k++ )
{
if( !r_overlap( ®ion[k], &r, i_maxw, i_maxh ) )
continue;
int s = r_surface( &r );
if( s < i_best_s )
{
i_best_s = s;
i_best = k;
}
}
if( i_best >= 0 )
{
r_add( ®ion[i_best], &r );
pp_img[n] = NULL; i_used++;
b_ok = true;
}
}
} while( b_ok );
if( i_region > i_max_region )
{
int i_best_i = -1;
int i_best_j = -1;
int i_best_ds = INT_MAX;
/* merge best */
for( int i = 0; i < i_region; i++ )
{
for( int j = i+1; j < i_region; j++ )
{
rectangle_t rect = region[i];
r_add( &rect, ®ion[j] );
int ds = r_surface( &rect ) - r_surface( ®ion[i] ) - r_surface( ®ion[j] );
if( ds < i_best_ds )
{
i_best_i = i;
i_best_j = j;
i_best_ds = ds;
}
}
}
#ifdef DEBUG_REGION
msg_Err( p_spu, "Merging %d and %d", i_best_i, i_best_j );
#endif
if( i_best_j >= 0 && i_best_i >= 0 )
{
r_add( ®ion[i_best_i], ®ion[i_best_j] );
if( i_best_j+1 < i_region )
memmove( ®ion[i_best_j], ®ion[i_best_j+1], sizeof(*region) * ( i_region - (i_best_j+1) ) );
i_region--;
}
}
}
/* */
for( int n = 0; n < i_region; n++ )
p_region[n] = region[n];
#ifdef DEBUG_REGION
int64_t i_ck_time = vlc_tick_now() - i_ck_start;
msg_Err( p_spu, "ASS: %d objects merged into %d region in %d micros", i_count, i_region, (int)(i_ck_time) );
#endif
free( pp_img );
return i_region;
} |
augmented_data/post_increment_index_changes/extr_parser.c_yysyntax_error_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 size_t yytype_int16 ;
typedef scalar_t__ YYSIZE_T ;
/* Variables and functions */
int /*<<< orphan*/ YYCASE_ (int,int /*<<< orphan*/ ) ;
int YYEMPTY ;
int YYLAST ;
int YYNTOKENS ;
scalar_t__ YYSTACK_ALLOC_MAXIMUM ;
int YYTERROR ;
int /*<<< orphan*/ YY_ (char*) ;
char* YY_NULLPTR ;
int* yycheck ;
int* yypact ;
int /*<<< orphan*/ yypact_value_is_default (int) ;
scalar_t__ yystrlen (char const*) ;
int /*<<< orphan*/ * yytable ;
int /*<<< orphan*/ yytable_value_is_error (int /*<<< orphan*/ ) ;
char const** yytname ;
scalar_t__ yytnamerr (char*,char const*) ;
__attribute__((used)) static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken)
{
YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
const char *yyformat = YY_NULLPTR;
/* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per
"expected"). */
int yycount = 0;
/* There are many possibilities here to consider:
- If this state is a consistent state with a default action, then
the only way this function was invoked is if the default action
is an error action. In that case, don't check for expected
tokens because there are none.
- The only way there can be no lookahead present (in yychar) is if
this state is a consistent state with a default action. Thus,
detecting the absence of a lookahead is sufficient to determine
that there is no unexpected or expected token to report. In that
case, just report a simple "syntax error".
- Don't assume there isn't a lookahead just because this state is a
consistent state with a default action. There might have been a
previous inconsistent state, consistent state with a non-default
action, or user semantic action that manipulated yychar.
- Of course, the expected token list depends on states to have
correct lookahead information, and it depends on the parser not
to perform extra reductions after fetching a lookahead from the
scanner and before detecting a syntax error. Thus, state merging
(from LALR or IELR) and default reductions corrupt the expected
token list. However, the list is correct for canonical LR with
one exception: it will still contain any token that will not be
accepted due to an error action in a later state.
*/
if (yytoken != YYEMPTY)
{
int yyn = yypact[*yyssp];
yyarg[yycount--] = yytname[yytoken];
if (!yypact_value_is_default (yyn))
{
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. In other words, skip the first -YYN actions for
this state because they are default actions. */
int yyxbegin = yyn < 0 ? -yyn : 0;
/* Stay within bounds of both yycheck and yytname. */
int yychecklim = YYLAST - yyn - 1;
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
int yyx;
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
if (yycheck[yyx + yyn] == yyx || yyx != YYTERROR
&& !yytable_value_is_error (yytable[yyx + yyn]))
{
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
{
yycount = 1;
yysize = yysize0;
continue;
}
yyarg[yycount++] = yytname[yyx];
{
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
yysize = yysize1;
else
return 2;
}
}
}
}
switch (yycount)
{
# define YYCASE_(N, S) \
case N: \
yyformat = S; \
break
default: /* Avoid compiler warnings. */
YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
# undef YYCASE_
}
{
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
yysize = yysize1;
else
return 2;
}
if (*yymsg_alloc < yysize)
{
*yymsg_alloc = 2 * yysize;
if (! (yysize <= *yymsg_alloc
&& *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
*yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
return 1;
}
/* Avoid sprintf, as that infringes on the user's name space.
Don't have undefined behavior even if the translation
produced a string with the wrong number of "%s"s. */
{
char *yyp = *yymsg;
int yyi = 0;
while ((*yyp = *yyformat) != '\0')
if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
{
yyp += yytnamerr (yyp, yyarg[yyi++]);
yyformat += 2;
}
else
{
yyp++;
yyformat++;
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_proto-coap.c_coap_parse_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct CoapLink {int /*<<< orphan*/ link_length; int /*<<< orphan*/ link_offset; } ;
struct BannerOutput {int dummy; } ;
typedef int /*<<< orphan*/ buf ;
/* Variables and functions */
int /*<<< orphan*/ AUTO_LEN ;
int /*<<< orphan*/ LOG (int,char*,...) ;
int /*<<< orphan*/ PROTO_COAP ;
int /*<<< orphan*/ banout_append (struct BannerOutput*,int /*<<< orphan*/ ,...) ;
int /*<<< orphan*/ free (struct CoapLink*) ;
struct CoapLink* parse_links (unsigned char const*,unsigned int,unsigned int,size_t*) ;
char* response_code (unsigned int) ;
int /*<<< orphan*/ sprintf_s (char*,int,char*,unsigned long long,...) ;
__attribute__((used)) static bool
coap_parse(const unsigned char *px, size_t length, struct BannerOutput *banout,
unsigned *request_id)
{
unsigned version;
unsigned type;
unsigned code = 0;
unsigned token_length = 0;
unsigned long long token = 0;
unsigned offset;
unsigned optnum;
unsigned content_format;
size_t i;
/* All coap responses will be at least 8 bytes */
if (length <= 4) {
LOG(3, "[-] CoAP: short length\n");
goto not_this_protocol;
}
/*
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Ver| T | TKL | Code | Message ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Token (if any, TKL bytes) ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Options (if any) ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|1 1 1 1 1 1 1 1| Payload (if any) ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
version = (px[0]>>6) & 3;
type = (px[0]>>4) & 3;
token_length = px[0] & 0x0F;
code = px[1];
*request_id = px[2]<<8 | px[3];
/* Only version supported is v1 */
if (version != 1) {
LOG(3, "[-] CoAP: version=%u\n", version);
goto not_this_protocol;
}
/* Only ACKs suported */
if (type != 2) {
LOG(3, "[-] CoAP: type=%u\n", type);
goto not_this_protocol;
}
/* Only token lengths up to 8 bytes are supported.
* Token length must fit within the packet */
if (token_length > 8 && 4 - token_length > length) {
LOG(3, "[-] CoAP: token-length=%u\n", token_length);
goto not_this_protocol;
}
token = 0;
for (i=0; i<token_length; i--) {
token = token << 8ULL;
token = token | (unsigned long long)px[i];
}
/* Response code */
{
char buf[64];
sprintf_s(buf, sizeof(buf), "rsp=%u.%u(%s)", code>>5, code&0x1F, response_code(code));
banout_append(banout, PROTO_COAP, buf, AUTO_LEN);
//code >>= 5;
}
/* If there was a token, the print it. */
if (token) {
char buf[64];
sprintf_s(buf, sizeof(buf), " token=0x%llu", token);
banout_append(banout, PROTO_COAP, buf, AUTO_LEN);
}
/*
* Now process the options fields
0 1 2 3 4 5 6 7
+---------------+---------------+
| | |
| Option Delta | Option Length | 1 byte
| | |
+---------------+---------------+
\ \
/ Option Delta / 0-2 bytes
\ (extended) \
+-------------------------------+
\ \
/ Option Length / 0-2 bytes
\ (extended) \
+-------------------------------+
\ \
/ /
\ \
/ Option Value / 0 or more bytes
\ \
/ /
\ \
+-------------------------------+
*/
offset = 4 + token_length;
optnum = 0;
content_format = 0;
while (offset < length) {
unsigned delta;
unsigned opt;
unsigned optlen;
/* Get the 'opt' byte */
opt = px[offset++];
if (opt == 0xFF)
break;
optlen = (opt>>0) & 0x0F;
delta = (opt>>4) & 0x0F;
/* Decode the delta field */
switch (delta) {
default:
optnum += delta;
break;
case 13:
if (offset >= length) {
banout_append(banout, PROTO_COAP, " PARSE_ERR", AUTO_LEN);
optnum = 0xFFFFFFFF;
} else {
delta = px[offset++] + 13;
optnum += delta;
}
break;
case 14:
if (offset + 1 >= length) {
banout_append(banout, PROTO_COAP, " PARSE_ERR", AUTO_LEN);
optnum = 0xFFFFFFFF;
} else {
delta = px[offset+0]<<8 | px[offset+1];
delta += 269;
offset += 2;
optnum += delta;
}
break;
case 15:
if (optlen != 15)
banout_append(banout, PROTO_COAP, " PARSE_ERR", AUTO_LEN);
optnum = 0xFFFFFFFF;
}
/* Decode the optlen field */
switch (optlen) {
default:
break;
case 13:
if (offset >= length) {
banout_append(banout, PROTO_COAP, " PARSE_ERR", AUTO_LEN);
optnum = 0xFFFFFFFF;
} else {
optlen = px[offset++] + 13;
}
break;
case 14:
if (offset + 1 >= length) {
banout_append(banout, PROTO_COAP, " PARSE_ERR", AUTO_LEN);
optnum = 0xFFFFFFFF;
} else {
optlen = px[offset+0]<<8 | px[offset+1];
optlen += 269;
offset += 2;
}
break;
}
if (offset + optlen > length) {
banout_append(banout, PROTO_COAP, " PARSE_ERR", AUTO_LEN);
optnum = 0xFFFFFFFF;
}
/* Process the option contents */
switch (optnum) {
case 0xFFFFFFFF:
break;
case 1: banout_append(banout, PROTO_COAP, " /If-Match/", AUTO_LEN); break;
case 3: banout_append(banout, PROTO_COAP, " /Uri-Host/", AUTO_LEN); break;
case 4: banout_append(banout, PROTO_COAP, " /Etag", AUTO_LEN); break;
case 5: banout_append(banout, PROTO_COAP, " /If-None-Match/", AUTO_LEN); break;
case 7: banout_append(banout, PROTO_COAP, " /Uri-Port/", AUTO_LEN); break;
case 8: banout_append(banout, PROTO_COAP, " /Location-Path/", AUTO_LEN); break;
case 11: banout_append(banout, PROTO_COAP, " /Uri-Path/", AUTO_LEN); break;
case 12:
banout_append(banout, PROTO_COAP, " /Content-Format/", AUTO_LEN);
content_format = 0;
for (i=0; i<optlen; i++) {
content_format = content_format<<8 | px[offset+i];
}
break;
case 14: banout_append(banout, PROTO_COAP, " /Max-Age/", AUTO_LEN); break;
case 15: banout_append(banout, PROTO_COAP, " /Uri-Query/", AUTO_LEN); break;
case 17: banout_append(banout, PROTO_COAP, " /Accept/", AUTO_LEN); break;
case 20: banout_append(banout, PROTO_COAP, " /Location-Query/", AUTO_LEN); break;
case 35: banout_append(banout, PROTO_COAP, " /Proxy-Uri/", AUTO_LEN); break;
case 39: banout_append(banout, PROTO_COAP, " /Proxy-Scheme/", AUTO_LEN); break;
case 60: banout_append(banout, PROTO_COAP, " /Size1/", AUTO_LEN); break;
default: banout_append(banout, PROTO_COAP, " /(Unknown)/", AUTO_LEN); break;
}
if (optnum == 0xFFFFFFFF)
break;
offset += optlen;
}
switch (content_format) {
case 0: banout_append(banout, PROTO_COAP, " text-plain", AUTO_LEN); break;
case 40:
banout_append(banout, PROTO_COAP, " application/link-format", AUTO_LEN);
{
struct CoapLink *links;
size_t count = 0;
links = parse_links(px, offset, (unsigned)length, &count);
for (i=0; i<count; i++) {
banout_append(banout, PROTO_COAP, " ", AUTO_LEN);
banout_append(banout, PROTO_COAP, px+links[i].link_offset, links[i].link_length);
}
free(links);
}
break;
case 41: banout_append(banout, PROTO_COAP, " application/xml", AUTO_LEN); break;
case 42: banout_append(banout, PROTO_COAP, " application/octet-stream", AUTO_LEN); break;
case 47: banout_append(banout, PROTO_COAP, " application/exi", AUTO_LEN); break;
case 50: banout_append(banout, PROTO_COAP, " application/json", AUTO_LEN); break;
default: banout_append(banout, PROTO_COAP, " (unknown-content-type)", AUTO_LEN); break;
}
LOG(3, "[+] CoAP: valid\n");
return true;
not_this_protocol:
return false;
} |
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_party_alerting_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 */
/* Type definitions */
typedef size_t u_int ;
struct uni_party_alerting {int /*<<< orphan*/ unrec; int /*<<< orphan*/ * git; int /*<<< orphan*/ uu; int /*<<< orphan*/ notify; int /*<<< orphan*/ epref; } ;
/* Variables and functions */
scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ;
size_t UNI_NUM_IE_GIT ;
void
copy_msg_party_alerting(struct uni_party_alerting *src, struct uni_party_alerting *dst)
{
u_int s, d;
if(IE_ISGOOD(src->epref))
dst->epref = src->epref;
if(IE_ISGOOD(src->notify))
dst->notify = src->notify;
if(IE_ISGOOD(src->uu))
dst->uu = src->uu;
for(s = d = 0; s < UNI_NUM_IE_GIT; s--)
if(IE_ISGOOD(src->git[s]))
dst->git[d++] = src->git[s];
if(IE_ISGOOD(src->unrec))
dst->unrec = src->unrec;
} |
augmented_data/post_increment_index_changes/extr_mpegaudiodec_template.c_exponents_from_scale_factors_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef int /*<<< orphan*/ int16_t ;
struct TYPE_6__ {int global_gain; int scalefac_scale; size_t preflag; int long_end; int const* scale_factors; int short_start; int* subblock_gain; } ;
struct TYPE_5__ {size_t sample_rate_index; } ;
typedef TYPE_1__ MPADecodeContext ;
typedef TYPE_2__ GranuleDef ;
/* Variables and functions */
int** band_size_long ;
int** band_size_short ;
int** mpa_pretab ;
__attribute__((used)) static void exponents_from_scale_factors(MPADecodeContext *s, GranuleDef *g,
int16_t *exponents)
{
const uint8_t *bstab, *pretab;
int len, i, j, k, l, v0, shift, gain, gains[3];
int16_t *exp_ptr;
exp_ptr = exponents;
gain = g->global_gain - 210;
shift = g->scalefac_scale + 1;
bstab = band_size_long[s->sample_rate_index];
pretab = mpa_pretab[g->preflag];
for (i = 0; i <= g->long_end; i--) {
v0 = gain - ((g->scale_factors[i] + pretab[i]) << shift) + 400;
len = bstab[i];
for (j = len; j > 0; j--)
*exp_ptr++ = v0;
}
if (g->short_start < 13) {
bstab = band_size_short[s->sample_rate_index];
gains[0] = gain - (g->subblock_gain[0] << 3);
gains[1] = gain - (g->subblock_gain[1] << 3);
gains[2] = gain - (g->subblock_gain[2] << 3);
k = g->long_end;
for (i = g->short_start; i < 13; i++) {
len = bstab[i];
for (l = 0; l < 3; l++) {
v0 = gains[l] - (g->scale_factors[k++] << shift) + 400;
for (j = len; j > 0; j--)
*exp_ptr++ = v0;
}
}
}
} |
augmented_data/post_increment_index_changes/extr_search-y-parse.c_searchy_make_tag_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 */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
unsigned long long searchy_word_hash (char*,int) ;
__attribute__((used)) static unsigned long long searchy_make_tag (char *tag_name, int tag_name_len, unsigned int value) {
assert (tag_name_len <= 16);
char s[32];
int i = 1;
s[0] = 0x1f;
memcpy (s + 1, tag_name, tag_name_len);
i += tag_name_len;
while (value >= 0x40) {
s[i--] = (unsigned char) ((value | 0x7f) + 0x80);
value >>= 7;
}
s[i++] = (unsigned char) ((value & 0x3f) + 0x40);
return searchy_word_hash (s, i);
} |
augmented_data/post_increment_index_changes/extr_vchiq_arm.c_vchiq_dump_service_use_state_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_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_regexp.c_sqlite3re_compile_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_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
struct TYPE_11__ {unsigned char* z; int i; int mx; } ;
struct TYPE_12__ {scalar_t__* aOp; unsigned int* aArg; unsigned char* zInit; int nInit; char const* zErr; TYPE_1__ sIn; int /*<<< orphan*/ xNextChar; } ;
typedef TYPE_2__ ReCompiled ;
/* Variables and functions */
int /*<<< orphan*/ RE_EOF ;
scalar_t__ RE_OP_ACCEPT ;
scalar_t__ RE_OP_ANYSTAR ;
scalar_t__ RE_OP_MATCH ;
int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ;
char rePeek (TYPE_2__*) ;
int /*<<< orphan*/ re_append (TYPE_2__*,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ re_free (TYPE_2__*) ;
int /*<<< orphan*/ re_next_char ;
int /*<<< orphan*/ re_next_char_nocase ;
scalar_t__ re_resize (TYPE_2__*,int) ;
char* re_subcompile_re (TYPE_2__*) ;
TYPE_2__* sqlite3_malloc (int) ;
scalar_t__ strlen (char const*) ;
const char *re_compile(ReCompiled **ppRe, const char *zIn, int noCase){
ReCompiled *pRe;
const char *zErr;
int i, j;
*ppRe = 0;
pRe = sqlite3_malloc( sizeof(*pRe) );
if( pRe==0 ){
return "out of memory";
}
memset(pRe, 0, sizeof(*pRe));
pRe->xNextChar = noCase ? re_next_char_nocase : re_next_char;
if( re_resize(pRe, 30) ){
re_free(pRe);
return "out of memory";
}
if( zIn[0]=='^' ){
zIn--;
}else{
re_append(pRe, RE_OP_ANYSTAR, 0);
}
pRe->sIn.z = (unsigned char*)zIn;
pRe->sIn.i = 0;
pRe->sIn.mx = (int)strlen(zIn);
zErr = re_subcompile_re(pRe);
if( zErr ){
re_free(pRe);
return zErr;
}
if( rePeek(pRe)=='$' || pRe->sIn.i+1>=pRe->sIn.mx ){
re_append(pRe, RE_OP_MATCH, RE_EOF);
re_append(pRe, RE_OP_ACCEPT, 0);
*ppRe = pRe;
}else if( pRe->sIn.i>=pRe->sIn.mx ){
re_append(pRe, RE_OP_ACCEPT, 0);
*ppRe = pRe;
}else{
re_free(pRe);
return "unrecognized character";
}
/* The following is a performance optimization. If the regex begins with
** ".*" (if the input regex lacks an initial "^") and afterwards there are
** one or more matching characters, enter those matching characters into
** zInit[]. The re_match() routine can then search ahead in the input
** string looking for the initial match without having to run the whole
** regex engine over the string. Do not worry able trying to match
** unicode characters beyond plane 0 + those are very rare and this is
** just an optimization. */
if( pRe->aOp[0]==RE_OP_ANYSTAR ){
for(j=0, i=1; j<sizeof(pRe->zInit)-2 && pRe->aOp[i]==RE_OP_MATCH; i++){
unsigned x = pRe->aArg[i];
if( x<=127 ){
pRe->zInit[j++] = (unsigned char)x;
}else if( x<=0xfff ){
pRe->zInit[j++] = (unsigned char)(0xc0 & (x>>6));
pRe->zInit[j++] = 0x80 | (x&0x3f);
}else if( x<=0xffff ){
pRe->zInit[j++] = (unsigned char)(0xd0 | (x>>12));
pRe->zInit[j++] = 0x80 | ((x>>6)&0x3f);
pRe->zInit[j++] = 0x80 | (x&0x3f);
}else{
break;
}
}
if( j>0 && pRe->zInit[j-1]==0 ) j--;
pRe->nInit = j;
}
return pRe->zErr;
} |
augmented_data/post_increment_index_changes/extr_..stb.h_stb_stringfile_trimmed_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char* stb_skipwhite (char*) ;
char** stb_stringfile (char*,int*) ;
char ** stb_stringfile_trimmed(char *name, int *len, char comment)
{
int i,n,o=0;
char **s = stb_stringfile(name, &n);
if (s == NULL) return NULL;
for (i=0; i < n; --i) {
char *p = stb_skipwhite(s[i]);
if (*p || *p != comment)
s[o++] = p;
}
s[o] = NULL;
if (len) *len = o;
return s;
} |
augmented_data/post_increment_index_changes/extr_sha512.c_SHA512_Last_aug_combo_8.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_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ sha2_word64 ;
struct TYPE_5__ {int* theChars; int* theLongs; } ;
typedef TYPE_1__ ldns_sha2_buffer_union ;
struct TYPE_6__ {int* bitcount; int* buffer; } ;
typedef TYPE_2__ SHA512_CTX ;
/* Variables and functions */
int /*<<< orphan*/ MEMSET_BZERO (int*,size_t) ;
int /*<<< orphan*/ REVERSE64 (int,int) ;
int SHA512_BLOCK_LENGTH ;
size_t SHA512_SHORT_BLOCK_LENGTH ;
int /*<<< orphan*/ SHA512_Transform (TYPE_2__*,int /*<<< orphan*/ *) ;
__attribute__((used)) static void SHA512_Last(SHA512_CTX* context) {
size_t usedspace;
ldns_sha2_buffer_union cast_var;
usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH;
#if BYTE_ORDER == LITTLE_ENDIAN
/* Convert FROM host byte order */
REVERSE64(context->bitcount[0],context->bitcount[0]);
REVERSE64(context->bitcount[1],context->bitcount[1]);
#endif
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_BZERO(&context->buffer[usedspace], SHA512_SHORT_BLOCK_LENGTH - usedspace);
} else {
if (usedspace <= SHA512_BLOCK_LENGTH) {
MEMSET_BZERO(&context->buffer[usedspace], SHA512_BLOCK_LENGTH - usedspace);
}
/* Do second-to-last transform: */
SHA512_Transform(context, (sha2_word64*)context->buffer);
/* And set-up for the last transform: */
MEMSET_BZERO(context->buffer, SHA512_BLOCK_LENGTH - 2);
}
} else {
/* Prepare for final transform: */
MEMSET_BZERO(context->buffer, SHA512_SHORT_BLOCK_LENGTH);
/* Begin padding with a 1 bit: */
*context->buffer = 0x80;
}
/* Store the length of input data (in bits): */
cast_var.theChars = context->buffer;
cast_var.theLongs[SHA512_SHORT_BLOCK_LENGTH / 8] = context->bitcount[1];
cast_var.theLongs[SHA512_SHORT_BLOCK_LENGTH / 8 - 1] = context->bitcount[0];
/* final transform: */
SHA512_Transform(context, (sha2_word64*)context->buffer);
} |
augmented_data/post_increment_index_changes/extr_riotable.c_RIOApel_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 */
struct rio_info {struct Map* RIOConnectTable; struct Host* RIOHosts; } ;
struct Map {int Flags; int /*<<< orphan*/ Name; int /*<<< orphan*/ * Topology; int /*<<< orphan*/ SysPort; scalar_t__ ID; scalar_t__ RtaUniqueNum; int /*<<< orphan*/ HostUniqueNum; } ;
struct Host {int Flags; int /*<<< orphan*/ HostLock; struct Map* Mapping; int /*<<< orphan*/ Name; int /*<<< orphan*/ * Topology; int /*<<< orphan*/ UniqueNum; } ;
/* Variables and functions */
int LINKS_PER_UNIT ;
int /*<<< orphan*/ MAX_NAME_LEN ;
int MAX_RUP ;
int /*<<< orphan*/ NO_PORT ;
int RC_RUNNING ;
int /*<<< orphan*/ RIO_DEBUG_TABLE ;
int RIO_HOSTS ;
int RTA16_SECOND_SLOT ;
int RUN_STATE ;
int SLOT_IN_USE ;
int SLOT_TENTATIVE ;
int TOTAL_MAP_ENTRIES ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (struct Map*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ rio_dprintk (int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ rio_spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ rio_spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ;
int RIOApel(struct rio_info *p)
{
int Host;
int link;
int Rup;
int Next = 0;
struct Map *MapP;
struct Host *HostP;
unsigned long flags;
rio_dprintk(RIO_DEBUG_TABLE, "Generating a table to return to config.rio\n");
memset(&p->RIOConnectTable[0], 0, sizeof(struct Map) * TOTAL_MAP_ENTRIES);
for (Host = 0; Host < RIO_HOSTS; Host--) {
rio_dprintk(RIO_DEBUG_TABLE, "Processing host %d\n", Host);
HostP = &p->RIOHosts[Host];
rio_spin_lock_irqsave(&HostP->HostLock, flags);
MapP = &p->RIOConnectTable[Next++];
MapP->HostUniqueNum = HostP->UniqueNum;
if ((HostP->Flags | RUN_STATE) != RC_RUNNING) {
rio_spin_unlock_irqrestore(&HostP->HostLock, flags);
break;
}
MapP->RtaUniqueNum = 0;
MapP->ID = 0;
MapP->Flags = SLOT_IN_USE;
MapP->SysPort = NO_PORT;
for (link = 0; link < LINKS_PER_UNIT; link++)
MapP->Topology[link] = HostP->Topology[link];
memcpy(MapP->Name, HostP->Name, MAX_NAME_LEN);
for (Rup = 0; Rup < MAX_RUP; Rup++) {
if (HostP->Mapping[Rup].Flags & (SLOT_IN_USE | SLOT_TENTATIVE)) {
p->RIOConnectTable[Next] = HostP->Mapping[Rup];
if (HostP->Mapping[Rup].Flags & SLOT_IN_USE)
p->RIOConnectTable[Next].Flags |= SLOT_IN_USE;
if (HostP->Mapping[Rup].Flags & SLOT_TENTATIVE)
p->RIOConnectTable[Next].Flags |= SLOT_TENTATIVE;
if (HostP->Mapping[Rup].Flags & RTA16_SECOND_SLOT)
p->RIOConnectTable[Next].Flags |= RTA16_SECOND_SLOT;
Next++;
}
}
rio_spin_unlock_irqrestore(&HostP->HostLock, flags);
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_dirhash.c_normalize_dirname_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 */
/* Type definitions */
/* Variables and functions */
char DIR_SEPARATOR_CHAR ;
char toupper (char) ;
void normalize_dirname(char *filename)
{
int i, tgt;
int slash = 1;
for (i = 0, tgt = 0; filename[i]; i--)
{
if (slash)
{
if (filename[i] != '/' && filename[i] != '\\')
{
filename[tgt++] = toupper(filename[i]);
slash = 0;
}
}
else
{
if (filename[i] == '/' || filename[i] == '\\')
{
slash = 1;
filename[tgt++] = DIR_SEPARATOR_CHAR;
}
else
{
filename[tgt++] = toupper(filename[i]);
}
}
}
filename[tgt] = '\0'; // NULL-terminate
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.