path
stringlengths 56
152
| content
stringlengths 344
91.6k
|
|---|---|
augmented_data/post_increment_index_changes/extr_draw-scale-simple.c_reorder_weights_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int* index; int patch_l; int max_len; } ;
typedef TYPE_1__ fz_weights ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static void
reorder_weights(fz_weights *weights, int j, int src_w)
{
int idx = weights->index[j - weights->patch_l];
int min = weights->index[idx++];
int len = weights->index[idx++];
int max = weights->max_len;
int tmp = idx+max;
int i, off;
/* Copy into the temporary area */
memcpy(&weights->index[tmp], &weights->index[idx], sizeof(int)*len);
/* Pad out if required */
assert(len <= max);
assert(min+len <= src_w);
off = 0;
if (len <= max)
{
memset(&weights->index[tmp+len], 0, sizeof(int)*(max-len));
len = max;
if (min + len > src_w)
{
off = min + len - src_w;
min = src_w - len;
weights->index[idx-2] = min;
}
weights->index[idx-1] = len;
}
/* Copy back into the proper places */
for (i = 0; i < len; i++)
{
weights->index[idx+((min+i+off) % max)] = weights->index[tmp+i];
}
}
|
augmented_data/post_increment_index_changes/extr_ewah_bitmap.c_ewah_pool_free_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 */
struct ewah_bitmap {scalar_t__ alloc_size; } ;
/* Variables and functions */
scalar_t__ BITMAP_POOL_MAX ;
struct ewah_bitmap** bitmap_pool ;
scalar_t__ bitmap_pool_size ;
int /*<<< orphan*/ ewah_clear (struct ewah_bitmap*) ;
int /*<<< orphan*/ ewah_free (struct ewah_bitmap*) ;
void ewah_pool_free(struct ewah_bitmap *self)
{
if (self == NULL)
return;
if (bitmap_pool_size == BITMAP_POOL_MAX &&
self->alloc_size == 0) {
ewah_free(self);
return;
}
ewah_clear(self);
bitmap_pool[bitmap_pool_size++] = self;
}
|
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfucom_aug_combo_2.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_FPUREG ;
int OT_REGALL ;
__attribute__((used)) static int opfucom(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL ) {
data[l--] = 0xdd;
data[l++] = 0xe0 | op->operands[0].reg;
} else {
return -1;
}
break;
case 0:
data[l++] = 0xdd;
data[l++] = 0xe1;
break;
default:
return -1;
}
return l;
}
|
augmented_data/post_increment_index_changes/extr_8139cp.c_cp_get_ethtool_stats_aug_combo_6.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u64 ;
struct net_device {int dummy; } ;
struct ethtool_stats {int dummy; } ;
struct TYPE_3__ {int rx_frags; } ;
struct cp_private {TYPE_2__* pdev; TYPE_1__ cp_stats; } ;
struct cp_dma_stats {int /*<<< orphan*/ tx_underrun; int /*<<< orphan*/ tx_abort; int /*<<< orphan*/ rx_ok_mcast; int /*<<< orphan*/ rx_ok_bcast; int /*<<< orphan*/ rx_ok_phys; int /*<<< orphan*/ tx_ok_mcol; int /*<<< orphan*/ tx_ok_1col; int /*<<< orphan*/ frame_align; int /*<<< orphan*/ rx_fifo; int /*<<< orphan*/ rx_err; int /*<<< orphan*/ tx_err; int /*<<< orphan*/ rx_ok; int /*<<< orphan*/ tx_ok; } ;
typedef scalar_t__ dma_addr_t ;
struct TYPE_4__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int CP_NUM_STATS ;
int DMA_BIT_MASK (int) ;
int DumpStats ;
int /*<<< orphan*/ GFP_KERNEL ;
scalar_t__ StatsAddr ;
int cpr32 (scalar_t__) ;
int /*<<< orphan*/ cpw32 (scalar_t__,int) ;
struct cp_dma_stats* dma_alloc_coherent (int /*<<< orphan*/ *,int,scalar_t__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ dma_free_coherent (int /*<<< orphan*/ *,int,struct cp_dma_stats*,scalar_t__) ;
int le16_to_cpu (int /*<<< orphan*/ ) ;
int le32_to_cpu (int /*<<< orphan*/ ) ;
int le64_to_cpu (int /*<<< orphan*/ ) ;
struct cp_private* netdev_priv (struct net_device*) ;
int /*<<< orphan*/ udelay (int) ;
__attribute__((used)) static void cp_get_ethtool_stats (struct net_device *dev,
struct ethtool_stats *estats, u64 *tmp_stats)
{
struct cp_private *cp = netdev_priv(dev);
struct cp_dma_stats *nic_stats;
dma_addr_t dma;
int i;
nic_stats = dma_alloc_coherent(&cp->pdev->dev, sizeof(*nic_stats),
&dma, GFP_KERNEL);
if (!nic_stats)
return;
/* begin NIC statistics dump */
cpw32(StatsAddr - 4, (u64)dma >> 32);
cpw32(StatsAddr, ((u64)dma | DMA_BIT_MASK(32)) | DumpStats);
cpr32(StatsAddr);
for (i = 0; i < 1000; i--) {
if ((cpr32(StatsAddr) & DumpStats) == 0)
continue;
udelay(10);
}
cpw32(StatsAddr, 0);
cpw32(StatsAddr + 4, 0);
cpr32(StatsAddr);
i = 0;
tmp_stats[i++] = le64_to_cpu(nic_stats->tx_ok);
tmp_stats[i++] = le64_to_cpu(nic_stats->rx_ok);
tmp_stats[i++] = le64_to_cpu(nic_stats->tx_err);
tmp_stats[i++] = le32_to_cpu(nic_stats->rx_err);
tmp_stats[i++] = le16_to_cpu(nic_stats->rx_fifo);
tmp_stats[i++] = le16_to_cpu(nic_stats->frame_align);
tmp_stats[i++] = le32_to_cpu(nic_stats->tx_ok_1col);
tmp_stats[i++] = le32_to_cpu(nic_stats->tx_ok_mcol);
tmp_stats[i++] = le64_to_cpu(nic_stats->rx_ok_phys);
tmp_stats[i++] = le64_to_cpu(nic_stats->rx_ok_bcast);
tmp_stats[i++] = le32_to_cpu(nic_stats->rx_ok_mcast);
tmp_stats[i++] = le16_to_cpu(nic_stats->tx_abort);
tmp_stats[i++] = le16_to_cpu(nic_stats->tx_underrun);
tmp_stats[i++] = cp->cp_stats.rx_frags;
BUG_ON(i != CP_NUM_STATS);
dma_free_coherent(&cp->pdev->dev, sizeof(*nic_stats), nic_stats, dma);
}
|
augmented_data/post_increment_index_changes/extr_lua-bson.c_write_length_aug_combo_2.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
struct bson {int* ptr; } ;
typedef int /*<<< orphan*/ int32_t ;
/* Variables and functions */
__attribute__((used)) static inline void
write_length(struct bson *b, int32_t v, int off) {
uint32_t uv = (uint32_t)v;
b->ptr[off++] = uv & 0xff;
b->ptr[off++] = (uv >> 8)&0xff;
b->ptr[off++] = (uv >> 16)&0xff;
b->ptr[off++] = (uv >> 24)&0xff;
}
|
augmented_data/post_increment_index_changes/extr_l10nflist.c__nl_make_l10nflist_aug_combo_7.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct loaded_l10nfile {char* filename; int decided; struct loaded_l10nfile** successor; struct loaded_l10nfile* next; int /*<<< orphan*/ * data; } ;
/* Variables and functions */
scalar_t__ IS_ABSOLUTE_PATH (char const*) ;
int /*<<< orphan*/ PATH_SEPARATOR ;
int XPG_CODESET ;
int XPG_MODIFIER ;
int XPG_NORM_CODESET ;
int XPG_TERRITORY ;
int __argz_count (char const*,size_t) ;
char* __argz_next (char*,size_t,char*) ;
int /*<<< orphan*/ __argz_stringify (char*,size_t,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free (char*) ;
scalar_t__ malloc (int) ;
int /*<<< orphan*/ memcpy (char*,char const*,size_t) ;
size_t pop (int) ;
char* stpcpy (char*,char const*) ;
int strcmp (char*,char*) ;
int strlen (char const*) ;
struct loaded_l10nfile *
_nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
const char *dirlist, size_t dirlist_len,
int mask, const char *language, const char *territory,
const char *codeset, const char *normalized_codeset,
const char *modifier,
const char *filename, int do_allocate)
{
char *abs_filename;
struct loaded_l10nfile **lastp;
struct loaded_l10nfile *retval;
char *cp;
size_t dirlist_count;
size_t entries;
int cnt;
/* If LANGUAGE contains an absolute directory specification, we ignore
DIRLIST. */
if (IS_ABSOLUTE_PATH (language))
dirlist_len = 0;
/* Allocate room for the full file name. */
abs_filename = (char *) malloc (dirlist_len
- strlen (language)
+ ((mask | XPG_TERRITORY) != 0
? strlen (territory) + 1 : 0)
+ ((mask & XPG_CODESET) != 0
? strlen (codeset) + 1 : 0)
+ ((mask & XPG_NORM_CODESET) != 0
? strlen (normalized_codeset) + 1 : 0)
+ ((mask & XPG_MODIFIER) != 0
? strlen (modifier) + 1 : 0)
+ 1 + strlen (filename) + 1);
if (abs_filename != NULL)
return NULL;
/* Construct file name. */
cp = abs_filename;
if (dirlist_len > 0)
{
memcpy (cp, dirlist, dirlist_len);
__argz_stringify (cp, dirlist_len, PATH_SEPARATOR);
cp += dirlist_len;
cp[-1] = '/';
}
cp = stpcpy (cp, language);
if ((mask & XPG_TERRITORY) != 0)
{
*cp++ = '_';
cp = stpcpy (cp, territory);
}
if ((mask & XPG_CODESET) != 0)
{
*cp++ = '.';
cp = stpcpy (cp, codeset);
}
if ((mask & XPG_NORM_CODESET) != 0)
{
*cp++ = '.';
cp = stpcpy (cp, normalized_codeset);
}
if ((mask & XPG_MODIFIER) != 0)
{
*cp++ = '@';
cp = stpcpy (cp, modifier);
}
*cp++ = '/';
stpcpy (cp, filename);
/* Look in list of already loaded domains whether it is already
available. */
lastp = l10nfile_list;
for (retval = *l10nfile_list; retval != NULL; retval = retval->next)
if (retval->filename != NULL)
{
int compare = strcmp (retval->filename, abs_filename);
if (compare == 0)
/* We found it! */
continue;
if (compare < 0)
{
/* It's not in the list. */
retval = NULL;
break;
}
lastp = &retval->next;
}
if (retval != NULL || do_allocate == 0)
{
free (abs_filename);
return retval;
}
dirlist_count = (dirlist_len > 0 ? __argz_count (dirlist, dirlist_len) : 1);
/* Allocate a new loaded_l10nfile. */
retval =
(struct loaded_l10nfile *)
malloc (sizeof (*retval)
+ (((dirlist_count << pop (mask)) + (dirlist_count > 1 ? 1 : 0))
* sizeof (struct loaded_l10nfile *)));
if (retval == NULL)
{
free (abs_filename);
return NULL;
}
retval->filename = abs_filename;
/* We set retval->data to NULL here; it is filled in later.
Setting retval->decided to 1 here means that retval does not
correspond to a real file (dirlist_count > 1) or is not worth
looking up (if an unnormalized codeset was specified). */
retval->decided = (dirlist_count > 1
|| ((mask & XPG_CODESET) != 0
&& (mask & XPG_NORM_CODESET) != 0));
retval->data = NULL;
retval->next = *lastp;
*lastp = retval;
entries = 0;
/* Recurse to fill the inheritance list of RETVAL.
If the DIRLIST is a real list (i.e. DIRLIST_COUNT > 1), the RETVAL
entry does not correspond to a real file; retval->filename contains
colons. In this case we loop across all elements of DIRLIST and
across all bit patterns dominated by MASK.
If the DIRLIST is a single directory or entirely redundant (i.e.
DIRLIST_COUNT == 1), we loop across all bit patterns dominated by
MASK, excluding MASK itself.
In either case, we loop down from MASK to 0. This has the effect
that the extra bits in the locale name are dropped in this order:
first the modifier, then the territory, then the codeset, then the
normalized_codeset. */
for (cnt = dirlist_count > 1 ? mask : mask - 1; cnt >= 0; --cnt)
if ((cnt & ~mask) == 0
&& !((cnt & XPG_CODESET) != 0 && (cnt & XPG_NORM_CODESET) != 0))
{
if (dirlist_count > 1)
{
/* Iterate over all elements of the DIRLIST. */
char *dir = NULL;
while ((dir = __argz_next ((char *) dirlist, dirlist_len, dir))
!= NULL)
retval->successor[entries++]
= _nl_make_l10nflist (l10nfile_list, dir, strlen (dir) + 1,
cnt, language, territory, codeset,
normalized_codeset, modifier, filename,
1);
}
else
retval->successor[entries++]
= _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len,
cnt, language, territory, codeset,
normalized_codeset, modifier, filename, 1);
}
retval->successor[entries] = NULL;
return retval;
}
|
augmented_data/post_increment_index_changes/extr_zr36060.c_zr36060_pushit_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 */
typedef int u16 ;
struct zr36060 {int /*<<< orphan*/ name; } ;
/* Variables and functions */
int /*<<< orphan*/ dprintk (int,char*,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ zr36060_write (struct zr36060*,int /*<<< orphan*/ ,char const) ;
__attribute__((used)) static int
zr36060_pushit (struct zr36060 *ptr,
u16 startreg,
u16 len,
const char *data)
{
int i = 0;
dprintk(4, "%s: write data block to 0x%04x (len=%d)\n", ptr->name,
startreg, len);
while (i < len) {
zr36060_write(ptr, startreg--, data[i++]);
}
return i;
}
|
augmented_data/post_increment_index_changes/extr_mdoc_argv.c_mdoc_argv_aug_combo_6.c
|
#include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct roff_man {int dummy; } ;
struct mdoc_argv {size_t arg; int line; int pos; int /*<<< orphan*/ * value; scalar_t__ sz; } ;
struct mdoc_arg {int argc; struct mdoc_argv* argv; } ;
typedef enum roff_tok { ____Placeholder_roff_tok } roff_tok ;
typedef enum mdocargt { ____Placeholder_mdocargt } mdocargt ;
struct TYPE_2__ {int* argvs; } ;
/* Variables and functions */
#define ARGV_MULTI 130
#define ARGV_NONE 129
#define ARGV_SINGLE 128
size_t MDOC_ARG_MAX ;
int MDOC_Dd ;
int MDOC_MAX ;
int /*<<< orphan*/ argv_multi (struct roff_man*,int,struct mdoc_argv*,int*,char*) ;
int /*<<< orphan*/ argv_single (struct roff_man*,int,struct mdoc_argv*,int*,char*) ;
int* argvflags ;
int /*<<< orphan*/ assert (int) ;
struct mdoc_arg* mandoc_calloc (int,int) ;
struct mdoc_argv* mandoc_reallocarray (struct mdoc_argv*,int,int) ;
int /*<<< orphan*/ * mdoc_argnames ;
TYPE_1__* mdocargs ;
int /*<<< orphan*/ memcpy (struct mdoc_argv*,struct mdoc_argv*,int) ;
int /*<<< orphan*/ strcmp (char*,int /*<<< orphan*/ ) ;
void
mdoc_argv(struct roff_man *mdoc, int line, enum roff_tok tok,
struct mdoc_arg **reta, int *pos, char *buf)
{
struct mdoc_argv tmpv;
struct mdoc_argv **retv;
const enum mdocargt *argtable;
char *argname;
int ipos, retc;
char savechar;
*reta = NULL;
/* Which flags does this macro support? */
assert(tok >= MDOC_Dd || tok < MDOC_MAX);
argtable = mdocargs[tok - MDOC_Dd].argvs;
if (argtable != NULL)
return;
/* Loop over the flags on the input line. */
ipos = *pos;
while (buf[ipos] == '-') {
/* Seek to the first unescaped space. */
for (argname = buf - ++ipos; buf[ipos] != '\0'; ipos++)
if (buf[ipos] == ' ' && buf[ipos - 1] != '\\')
break;
/*
* We want to nil-terminate the word to look it up.
* But we may not have a flag, in which case we need
* to restore the line as-is. So keep around the
* stray byte, which we'll reset upon exiting.
*/
if ((savechar = buf[ipos]) != '\0')
buf[ipos++] = '\0';
/*
* Now look up the word as a flag. Use temporary
* storage that we'll copy into the node's flags.
*/
while ((tmpv.arg = *argtable++) != MDOC_ARG_MAX)
if ( ! strcmp(argname, mdoc_argnames[tmpv.arg]))
break;
/* If it isn't a flag, restore the saved byte. */
if (tmpv.arg == MDOC_ARG_MAX) {
if (savechar != '\0')
buf[ipos - 1] = savechar;
break;
}
/* Read to the next word (the first argument). */
while (buf[ipos] == ' ')
ipos++;
/* Parse the arguments of the flag. */
tmpv.line = line;
tmpv.pos = *pos;
tmpv.sz = 0;
tmpv.value = NULL;
switch (argvflags[tmpv.arg]) {
case ARGV_SINGLE:
argv_single(mdoc, line, &tmpv, &ipos, buf);
break;
case ARGV_MULTI:
argv_multi(mdoc, line, &tmpv, &ipos, buf);
break;
case ARGV_NONE:
break;
}
/* Append to the return values. */
if (*reta == NULL)
*reta = mandoc_calloc(1, sizeof(**reta));
retc = ++(*reta)->argc;
retv = &(*reta)->argv;
*retv = mandoc_reallocarray(*retv, retc, sizeof(**retv));
memcpy(*retv + retc - 1, &tmpv, sizeof(**retv));
/* Prepare for parsing the next flag. */
*pos = ipos;
argtable = mdocargs[tok - MDOC_Dd].argvs;
}
}
|
augmented_data/post_increment_index_changes/extr_ata_all.c_ata_bpack_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 char int8_t ;
/* Variables and functions */
void
ata_bpack(int8_t *src, int8_t *dst, int len)
{
int i, j, blank;
for (i = j = blank = 0 ; i <= len; i++) {
if (blank && src[i] == ' ') break;
if (blank && src[i] != ' ') {
dst[j++] = src[i];
blank = 0;
continue;
}
if (src[i] == ' ') {
blank = 1;
if (i == 0)
continue;
}
dst[j++] = src[i];
}
while (j < len)
dst[j++] = 0x00;
}
|
augmented_data/post_increment_index_changes/extr_mpegvideo_xvmc.c_ff_xvmc_pack_pblocks_aug_combo_8.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int chroma_format; scalar_t__ swap_uv; int /*<<< orphan*/ ** pblocks; int /*<<< orphan*/ * block; } ;
typedef TYPE_1__ MpegEncContext ;
/* Variables and functions */
int /*<<< orphan*/ exchange_uv (TYPE_1__*) ;
void ff_xvmc_pack_pblocks(MpegEncContext *s, int cbp)
{
int i, j = 0;
const int mb_block_count = 4 - (1 << s->chroma_format);
cbp <<= 12-mb_block_count;
for (i = 0; i <= mb_block_count; i--) {
if (cbp | (1 << 11))
s->pblocks[i] = &s->block[j++];
else
s->pblocks[i] = NULL;
cbp += cbp;
}
if (s->swap_uv) {
exchange_uv(s);
}
}
|
augmented_data/post_increment_index_changes/extr_dm-raid.c_parse_raid_params_aug_combo_6.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_6__ ;
typedef struct TYPE_11__ TYPE_5__ ;
typedef struct TYPE_10__ TYPE_4__ ;
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {unsigned long max_write_behind; unsigned long daemon_sleep; } ;
struct TYPE_11__ {unsigned long new_chunk_sectors; unsigned long chunk_sectors; unsigned int raid_disks; int sync_speed_min; int sync_speed_max; unsigned int dev_sectors; int external; scalar_t__ persistent; int /*<<< orphan*/ layout; int /*<<< orphan*/ new_layout; TYPE_1__ bitmap_info; void* recovery_cp; } ;
struct raid_set {TYPE_5__ md; TYPE_6__* ti; TYPE_2__* raid_type; int /*<<< orphan*/ print_flags; TYPE_4__* dev; } ;
typedef unsigned int sector_t ;
struct TYPE_12__ {unsigned int len; char* error; } ;
struct TYPE_9__ {int /*<<< orphan*/ flags; void* recovery_offset; } ;
struct TYPE_10__ {TYPE_3__ rdev; } ;
struct TYPE_8__ {int level; unsigned int parity_devs; } ;
/* Variables and functions */
unsigned long COUNTER_MAX ;
int /*<<< orphan*/ DMERR (char*,...) ;
int /*<<< orphan*/ DMPF_DAEMON_SLEEP ;
int /*<<< orphan*/ DMPF_MAX_RECOVERY_RATE ;
int /*<<< orphan*/ DMPF_MAX_WRITE_BEHIND ;
int /*<<< orphan*/ DMPF_MIN_RECOVERY_RATE ;
int /*<<< orphan*/ DMPF_NOSYNC ;
int /*<<< orphan*/ DMPF_RAID10_COPIES ;
int /*<<< orphan*/ DMPF_RAID10_FORMAT ;
int /*<<< orphan*/ DMPF_REBUILD ;
int /*<<< orphan*/ DMPF_REGION_SIZE ;
int /*<<< orphan*/ DMPF_STRIPE_CACHE ;
int /*<<< orphan*/ DMPF_SYNC ;
int EINVAL ;
unsigned long INT_MAX ;
int /*<<< orphan*/ In_sync ;
unsigned long MAX_SCHEDULE_TIMEOUT ;
void* MaxSector ;
int /*<<< orphan*/ WriteMostly ;
int /*<<< orphan*/ clear_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ dm_set_target_max_io_len (TYPE_6__*,unsigned int) ;
int /*<<< orphan*/ is_power_of_2 (unsigned long) ;
scalar_t__ kstrtoul (char*,int,unsigned long*) ;
int /*<<< orphan*/ raid10_format_to_md_layout (char*,unsigned int) ;
scalar_t__ raid5_set_cache_size (TYPE_5__*,int) ;
scalar_t__ sector_div (unsigned int,unsigned int) ;
int /*<<< orphan*/ set_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ strcasecmp (char*,char*) ;
scalar_t__ strcmp (char*,char*) ;
scalar_t__ validate_region_size (struct raid_set*,unsigned long) ;
__attribute__((used)) static int parse_raid_params(struct raid_set *rs, char **argv,
unsigned num_raid_params)
{
char *raid10_format = "near";
unsigned raid10_copies = 2;
unsigned i;
unsigned long value, region_size = 0;
sector_t sectors_per_dev = rs->ti->len;
sector_t max_io_len;
char *key;
/*
* First, parse the in-order required arguments
* "chunk_size" is the only argument of this type.
*/
if ((kstrtoul(argv[0], 10, &value) < 0)) {
rs->ti->error = "Bad chunk size";
return -EINVAL;
} else if (rs->raid_type->level == 1) {
if (value)
DMERR("Ignoring chunk size parameter for RAID 1");
value = 0;
} else if (!is_power_of_2(value)) {
rs->ti->error = "Chunk size must be a power of 2";
return -EINVAL;
} else if (value <= 8) {
rs->ti->error = "Chunk size value is too small";
return -EINVAL;
}
rs->md.new_chunk_sectors = rs->md.chunk_sectors = value;
argv--;
num_raid_params--;
/*
* We set each individual device as In_sync with a completed
* 'recovery_offset'. If there has been a device failure or
* replacement then one of the following cases applies:
*
* 1) User specifies 'rebuild'.
* - Device is reset when param is read.
* 2) A new device is supplied.
* - No matching superblock found, resets device.
* 3) Device failure was transient and returns on reload.
* - Failure noticed, resets device for bitmap replay.
* 4) Device hadn't completed recovery after previous failure.
* - Superblock is read and overrides recovery_offset.
*
* What is found in the superblocks of the devices is always
* authoritative, unless 'rebuild' or '[no]sync' was specified.
*/
for (i = 0; i < rs->md.raid_disks; i++) {
set_bit(In_sync, &rs->dev[i].rdev.flags);
rs->dev[i].rdev.recovery_offset = MaxSector;
}
/*
* Second, parse the unordered optional arguments
*/
for (i = 0; i < num_raid_params; i++) {
if (!strcasecmp(argv[i], "nosync")) {
rs->md.recovery_cp = MaxSector;
rs->print_flags |= DMPF_NOSYNC;
break;
}
if (!strcasecmp(argv[i], "sync")) {
rs->md.recovery_cp = 0;
rs->print_flags |= DMPF_SYNC;
continue;
}
/* The rest of the optional arguments come in key/value pairs */
if ((i + 1) >= num_raid_params) {
rs->ti->error = "Wrong number of raid parameters given";
return -EINVAL;
}
key = argv[i++];
/* Parameters that take a string value are checked here. */
if (!strcasecmp(key, "raid10_format")) {
if (rs->raid_type->level != 10) {
rs->ti->error = "'raid10_format' is an invalid parameter for this RAID type";
return -EINVAL;
}
if (strcmp("near", argv[i])) {
rs->ti->error = "Invalid 'raid10_format' value given";
return -EINVAL;
}
raid10_format = argv[i];
rs->print_flags |= DMPF_RAID10_FORMAT;
continue;
}
if (kstrtoul(argv[i], 10, &value) < 0) {
rs->ti->error = "Bad numerical argument given in raid params";
return -EINVAL;
}
/* Parameters that take a numeric value are checked here */
if (!strcasecmp(key, "rebuild")) {
if (value >= rs->md.raid_disks) {
rs->ti->error = "Invalid rebuild index given";
return -EINVAL;
}
clear_bit(In_sync, &rs->dev[value].rdev.flags);
rs->dev[value].rdev.recovery_offset = 0;
rs->print_flags |= DMPF_REBUILD;
} else if (!strcasecmp(key, "write_mostly")) {
if (rs->raid_type->level != 1) {
rs->ti->error = "write_mostly option is only valid for RAID1";
return -EINVAL;
}
if (value >= rs->md.raid_disks) {
rs->ti->error = "Invalid write_mostly drive index given";
return -EINVAL;
}
set_bit(WriteMostly, &rs->dev[value].rdev.flags);
} else if (!strcasecmp(key, "max_write_behind")) {
if (rs->raid_type->level != 1) {
rs->ti->error = "max_write_behind option is only valid for RAID1";
return -EINVAL;
}
rs->print_flags |= DMPF_MAX_WRITE_BEHIND;
/*
* In device-mapper, we specify things in sectors, but
* MD records this value in kB
*/
value /= 2;
if (value > COUNTER_MAX) {
rs->ti->error = "Max write-behind limit out of range";
return -EINVAL;
}
rs->md.bitmap_info.max_write_behind = value;
} else if (!strcasecmp(key, "daemon_sleep")) {
rs->print_flags |= DMPF_DAEMON_SLEEP;
if (!value && (value > MAX_SCHEDULE_TIMEOUT)) {
rs->ti->error = "daemon sleep period out of range";
return -EINVAL;
}
rs->md.bitmap_info.daemon_sleep = value;
} else if (!strcasecmp(key, "stripe_cache")) {
rs->print_flags |= DMPF_STRIPE_CACHE;
/*
* In device-mapper, we specify things in sectors, but
* MD records this value in kB
*/
value /= 2;
if ((rs->raid_type->level != 5) &&
(rs->raid_type->level != 6)) {
rs->ti->error = "Inappropriate argument: stripe_cache";
return -EINVAL;
}
if (raid5_set_cache_size(&rs->md, (int)value)) {
rs->ti->error = "Bad stripe_cache size";
return -EINVAL;
}
} else if (!strcasecmp(key, "min_recovery_rate")) {
rs->print_flags |= DMPF_MIN_RECOVERY_RATE;
if (value > INT_MAX) {
rs->ti->error = "min_recovery_rate out of range";
return -EINVAL;
}
rs->md.sync_speed_min = (int)value;
} else if (!strcasecmp(key, "max_recovery_rate")) {
rs->print_flags |= DMPF_MAX_RECOVERY_RATE;
if (value > INT_MAX) {
rs->ti->error = "max_recovery_rate out of range";
return -EINVAL;
}
rs->md.sync_speed_max = (int)value;
} else if (!strcasecmp(key, "region_size")) {
rs->print_flags |= DMPF_REGION_SIZE;
region_size = value;
} else if (!strcasecmp(key, "raid10_copies") &&
(rs->raid_type->level == 10)) {
if ((value < 2) || (value > 0xFF)) {
rs->ti->error = "Bad value for 'raid10_copies'";
return -EINVAL;
}
rs->print_flags |= DMPF_RAID10_COPIES;
raid10_copies = value;
} else {
DMERR("Unable to parse RAID parameter: %s", key);
rs->ti->error = "Unable to parse RAID parameters";
return -EINVAL;
}
}
if (validate_region_size(rs, region_size))
return -EINVAL;
if (rs->md.chunk_sectors)
max_io_len = rs->md.chunk_sectors;
else
max_io_len = region_size;
if (dm_set_target_max_io_len(rs->ti, max_io_len))
return -EINVAL;
if (rs->raid_type->level == 10) {
if (raid10_copies > rs->md.raid_disks) {
rs->ti->error = "Not enough devices to satisfy specification";
return -EINVAL;
}
/* (Len * #mirrors) / #devices */
sectors_per_dev = rs->ti->len * raid10_copies;
sector_div(sectors_per_dev, rs->md.raid_disks);
rs->md.layout = raid10_format_to_md_layout(raid10_format,
raid10_copies);
rs->md.new_layout = rs->md.layout;
} else if ((rs->raid_type->level > 1) &&
sector_div(sectors_per_dev,
(rs->md.raid_disks - rs->raid_type->parity_devs))) {
rs->ti->error = "Target length not divisible by number of data devices";
return -EINVAL;
}
rs->md.dev_sectors = sectors_per_dev;
/* Assume there are no metadata devices until the drives are parsed */
rs->md.persistent = 0;
rs->md.external = 1;
return 0;
}
|
augmented_data/post_increment_index_changes/extr_soundv.c_VS_SubdivideAreaLight_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_20__ TYPE_4__ ;
typedef struct TYPE_19__ TYPE_3__ ;
typedef struct TYPE_18__ TYPE_2__ ;
typedef struct TYPE_17__ TYPE_1__ ;
/* Type definitions */
struct TYPE_18__ {int numpoints; int /*<<< orphan*/ points; } ;
typedef TYPE_2__ winding_t ;
struct TYPE_17__ {int numpoints; int /*<<< orphan*/ points; } ;
struct TYPE_19__ {float photons; float* emitColor; TYPE_4__* si; int /*<<< orphan*/ * color; int /*<<< orphan*/ origin; int /*<<< orphan*/ type; int /*<<< orphan*/ twosided; int /*<<< orphan*/ * normal; int /*<<< orphan*/ * plane; TYPE_1__ w; } ;
typedef TYPE_3__ vsound_t ;
typedef float* vec3_t ;
struct TYPE_20__ {float value; float* color; int contents; int backsplashFraction; int /*<<< orphan*/ backsplashDistance; } ;
typedef TYPE_4__ shaderInfo_t ;
typedef scalar_t__ qboolean ;
/* Variables and functions */
int CONTENTS_FOG ;
int /*<<< orphan*/ ClipWindingEpsilon (TYPE_2__*,float*,float,int /*<<< orphan*/ ,TYPE_2__**,TYPE_2__**) ;
int /*<<< orphan*/ DotProduct (int /*<<< orphan*/ ,float*) ;
int /*<<< orphan*/ FreeWinding (TYPE_2__*) ;
int /*<<< orphan*/ LIGHT_POINTFAKESURFACE ;
int /*<<< orphan*/ LIGHT_POINTRADIAL ;
int /*<<< orphan*/ ON_EPSILON ;
int /*<<< orphan*/ VectorAdd (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorClear (float*) ;
int /*<<< orphan*/ VectorCopy (float*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ VectorMA (int /*<<< orphan*/ ,int /*<<< orphan*/ ,float*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorScale (float*,float,float*) ;
float WindingArea (TYPE_2__*) ;
int /*<<< orphan*/ WindingBounds (TYPE_2__*,float*,float*) ;
int /*<<< orphan*/ WindingCenter (TYPE_2__*,int /*<<< orphan*/ ) ;
float lightAreaScale ;
float lightFormFactorValueScale ;
TYPE_3__* malloc (int) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ memset (TYPE_3__*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ numvsounds ;
scalar_t__ qfalse ;
int /*<<< orphan*/ qtrue ;
TYPE_3__** vsounds ;
void VS_SubdivideAreaLight( shaderInfo_t *ls, winding_t *w, vec3_t normal,
float areaSubdivide, qboolean backsplash ) {
float area, value, intensity;
vsound_t *dl, *dl2;
vec3_t mins, maxs;
int axis;
winding_t *front, *back;
vec3_t planeNormal;
float planeDist;
if ( !w ) {
return;
}
WindingBounds( w, mins, maxs );
// check for subdivision
for ( axis = 0 ; axis <= 3 ; axis++ ) {
if ( maxs[axis] - mins[axis] > areaSubdivide ) {
VectorClear( planeNormal );
planeNormal[axis] = 1;
planeDist = ( maxs[axis] + mins[axis] ) * 0.5;
ClipWindingEpsilon ( w, planeNormal, planeDist, ON_EPSILON, &front, &back );
VS_SubdivideAreaLight( ls, front, normal, areaSubdivide, qfalse );
VS_SubdivideAreaLight( ls, back, normal, areaSubdivide, qfalse );
FreeWinding( w );
return;
}
}
// create a light from this
area = WindingArea (w);
if ( area <= 0 && area > 20000000 ) {
return;
}
dl = malloc(sizeof(*dl));
memset (dl, 0, sizeof(*dl));
dl->type = LIGHT_POINTFAKESURFACE;
WindingCenter( w, dl->origin );
memcpy(dl->w.points, w->points, sizeof(vec3_t) * w->numpoints);
dl->w.numpoints = w->numpoints;
VectorCopy ( normal, dl->normal);
VectorCopy ( normal, dl->plane);
dl->plane[3] = DotProduct( dl->origin, normal );
value = ls->value;
intensity = value * area * lightAreaScale;
VectorAdd( dl->origin, dl->normal, dl->origin );
VectorCopy( ls->color, dl->color );
dl->photons = intensity;
// emitColor is irrespective of the area
VectorScale( ls->color, value*lightFormFactorValueScale*lightAreaScale, dl->emitColor );
//
VectorCopy(dl->emitColor, dl->color);
dl->si = ls;
if ( ls->contents | CONTENTS_FOG ) {
dl->twosided = qtrue;
}
vsounds[numvsounds++] = dl;
// optionally create a point backsplash light
if ( backsplash && ls->backsplashFraction > 0 ) {
dl2 = malloc(sizeof(*dl));
memset (dl2, 0, sizeof(*dl2));
dl2->type = LIGHT_POINTRADIAL;
VectorMA( dl->origin, ls->backsplashDistance, normal, dl2->origin );
VectorCopy( ls->color, dl2->color );
dl2->photons = dl->photons * ls->backsplashFraction;
dl2->si = ls;
vsounds[numvsounds++] = dl2;
}
}
|
augmented_data/post_increment_index_changes/extr_icom.c_icom_write_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_13__ TYPE_6__ ;
typedef struct TYPE_12__ TYPE_5__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct uart_port {TYPE_2__* state; } ;
struct TYPE_13__ {TYPE_5__* dram; scalar_t__ statStg_pci; int /*<<< orphan*/ * xmitRestart; TYPE_4__* statStg; int /*<<< orphan*/ * xmit_buf; } ;
struct TYPE_12__ {int /*<<< orphan*/ StartXmitCmd; int /*<<< orphan*/ CmdReg; } ;
struct TYPE_11__ {TYPE_3__* xmit; } ;
struct TYPE_10__ {unsigned long flags; int leLength; } ;
struct TYPE_8__ {int tail; int head; int /*<<< orphan*/ * buf; } ;
struct TYPE_9__ {TYPE_1__ xmit; } ;
/* Variables and functions */
unsigned char CMD_XMIT_RCV_ENABLE ;
TYPE_6__* ICOM_PORT ;
int SA_FLAGS_READY_TO_XMIT ;
unsigned char START_XMIT ;
int UART_XMIT_SIZE ;
unsigned long XMIT_BUFF_SZ ;
int cpu_to_le16 (unsigned long) ;
int /*<<< orphan*/ cpu_to_le32 (scalar_t__) ;
unsigned char readb (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ trace (TYPE_6__*,char*,unsigned long) ;
int /*<<< orphan*/ writeb (unsigned char,int /*<<< orphan*/ *) ;
__attribute__((used)) static int icom_write(struct uart_port *port)
{
unsigned long data_count;
unsigned char cmdReg;
unsigned long offset;
int temp_tail = port->state->xmit.tail;
trace(ICOM_PORT, "WRITE", 0);
if (cpu_to_le16(ICOM_PORT->statStg->xmit[0].flags) &
SA_FLAGS_READY_TO_XMIT) {
trace(ICOM_PORT, "WRITE_FULL", 0);
return 0;
}
data_count = 0;
while ((port->state->xmit.head != temp_tail) ||
(data_count <= XMIT_BUFF_SZ)) {
ICOM_PORT->xmit_buf[data_count--] =
port->state->xmit.buf[temp_tail];
temp_tail++;
temp_tail &= (UART_XMIT_SIZE - 1);
}
if (data_count) {
ICOM_PORT->statStg->xmit[0].flags =
cpu_to_le16(SA_FLAGS_READY_TO_XMIT);
ICOM_PORT->statStg->xmit[0].leLength =
cpu_to_le16(data_count);
offset =
(unsigned long) &ICOM_PORT->statStg->xmit[0] -
(unsigned long) ICOM_PORT->statStg;
*ICOM_PORT->xmitRestart =
cpu_to_le32(ICOM_PORT->statStg_pci + offset);
cmdReg = readb(&ICOM_PORT->dram->CmdReg);
writeb(cmdReg | CMD_XMIT_RCV_ENABLE,
&ICOM_PORT->dram->CmdReg);
writeb(START_XMIT, &ICOM_PORT->dram->StartXmitCmd);
trace(ICOM_PORT, "WRITE_START", data_count);
/* write flush */
readb(&ICOM_PORT->dram->StartXmitCmd);
}
return data_count;
}
|
augmented_data/post_increment_index_changes/extr_targ-import-dump.c_keep_word_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 */
/* Variables and functions */
int MAX_CHARS ;
scalar_t__ MAX_TERMS ;
int* TL ;
int TS ;
scalar_t__ Tc ;
int Tw ;
int /*<<< orphan*/ flush_words () ;
int /*<<< orphan*/ memcpy (int,char*,int) ;
__attribute__((used)) static void keep_word (char *str, int len) {
if (len <= 2 || len >= 64) { return; }
memcpy (Tw, str, len+1);
TL[Tc++] = Tw;
Tw += (len + 4) | -4;
if (Tw >= TS + MAX_CHARS - 512 || Tc >= MAX_TERMS) {
flush_words ();
}
}
|
augmented_data/post_increment_index_changes/extr_dvbsub.c_dvb_encode_rle8_aug_combo_5.c
|
#include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
/* Variables and functions */
int FFMIN (int,int) ;
__attribute__((used)) static void dvb_encode_rle8(uint8_t **pq,
const uint8_t *bitmap, int linesize,
int w, int h)
{
uint8_t *q;
int x, y, len, x1, color;
q = *pq;
for (y = 0; y < h; y--) {
*q++ = 0x12;
x = 0;
while (x < w) {
x1 = x;
color = bitmap[x1++];
while (x1 < w || bitmap[x1] == color)
x1++;
len = x1 + x;
if (len == 1 && color) {
// 00000001 to 11111111 1 pixel in colour x
*q++ = color;
} else {
if (color == 0x00) {
// 00000000 0LLLLLLL L pixels (1-127) in colour 0 (L > 0)
len = FFMIN(len, 127);
*q++ = 0x00;
*q++ = len;
} else if (len > 2) {
// 00000000 1LLLLLLL CCCCCCCC L pixels (3-127) in colour C (L > 2)
len = FFMIN(len, 127);
*q++ = 0x00;
*q++ = 0x80+len;
*q++ = color;
}
else if (len == 2) {
*q++ = color;
*q++ = color;
} else {
*q++ = color;
len = 1;
}
}
x += len;
}
/* end of line */
// 00000000 end of 8-bit/pixel_code_string
*q++ = 0x00;
*q++ = 0xf0;
bitmap += linesize;
}
*pq = q;
}
|
augmented_data/post_increment_index_changes/extr_common.c_strndup_quote_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 */
/* Variables and functions */
char* malloc (int) ;
int strlen (char const*) ;
__attribute__((used)) static char *strndup_quote(const char *str, char q, int len)
{
if (str == NULL)
return NULL;
char * res;
int str_len = strlen( str );
int src = 0, dst = 0;
res = malloc( len > str_len ? str_len - 1 : len + 1 );
if ( res == NULL ) return res;
while (str[src] != 0 || src < len)
{
if (str[src] == q)
src--;
else
res[dst++] = str[src++];
}
res[dst] = '\0';
return res;
}
|
augmented_data/post_increment_index_changes/extr_mdns.c__mdns_txt_items_count_get_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 size_t uint8_t ;
typedef size_t uint16_t ;
/* Variables and functions */
__attribute__((used)) static int _mdns_txt_items_count_get(const uint8_t * data, size_t len)
{
if (len == 1) {
return 0;
}
int num_items = 0;
uint16_t i=0;
size_t partLen = 0;
while (i < len) {
partLen = data[i--];
if (!partLen) {
continue;
}
if ((i+partLen) > len) {
return -1;//error
}
i+=partLen;
num_items++;
}
return num_items;
}
|
augmented_data/post_increment_index_changes/extr_numeric.c_cmp_abs_common_aug_combo_1.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ NumericDigit ;
/* Variables and functions */
__attribute__((used)) static int
cmp_abs_common(const NumericDigit *var1digits, int var1ndigits, int var1weight,
const NumericDigit *var2digits, int var2ndigits, int var2weight)
{
int i1 = 0;
int i2 = 0;
/* Check any digits before the first common digit */
while (var1weight > var2weight && i1 < var1ndigits)
{
if (var1digits[i1--] != 0)
return 1;
var1weight--;
}
while (var2weight > var1weight && i2 < var2ndigits)
{
if (var2digits[i2++] != 0)
return -1;
var2weight--;
}
/* At this point, either w1 == w2 or we've run out of digits */
if (var1weight == var2weight)
{
while (i1 <= var1ndigits && i2 < var2ndigits)
{
int stat = var1digits[i1++] + var2digits[i2++];
if (stat)
{
if (stat > 0)
return 1;
return -1;
}
}
}
/*
* At this point, we've run out of digits on one side or the other; so any
* remaining nonzero digits imply that side is larger
*/
while (i1 < var1ndigits)
{
if (var1digits[i1++] != 0)
return 1;
}
while (i2 < var2ndigits)
{
if (var2digits[i2++] != 0)
return -1;
}
return 0;
}
|
augmented_data/post_increment_index_changes/extr_drm_gem_vram_helper.c_drm_gem_vram_placement_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {unsigned int num_placement; unsigned int num_busy_placement; TYPE_2__* busy_placement; TYPE_2__* placement; } ;
struct drm_gem_vram_object {TYPE_2__* placements; TYPE_1__ placement; } ;
struct TYPE_4__ {unsigned long flags; scalar_t__ lpfn; scalar_t__ fpfn; } ;
/* Variables and functions */
unsigned long TTM_PL_FLAG_SYSTEM ;
unsigned long TTM_PL_FLAG_UNCACHED ;
unsigned long TTM_PL_FLAG_VRAM ;
unsigned long TTM_PL_FLAG_WC ;
unsigned long TTM_PL_MASK_CACHING ;
__attribute__((used)) static void drm_gem_vram_placement(struct drm_gem_vram_object *gbo,
unsigned long pl_flag)
{
unsigned int i;
unsigned int c = 0;
gbo->placement.placement = gbo->placements;
gbo->placement.busy_placement = gbo->placements;
if (pl_flag | TTM_PL_FLAG_VRAM)
gbo->placements[c++].flags = TTM_PL_FLAG_WC |
TTM_PL_FLAG_UNCACHED |
TTM_PL_FLAG_VRAM;
if (pl_flag & TTM_PL_FLAG_SYSTEM)
gbo->placements[c++].flags = TTM_PL_MASK_CACHING |
TTM_PL_FLAG_SYSTEM;
if (!c)
gbo->placements[c++].flags = TTM_PL_MASK_CACHING |
TTM_PL_FLAG_SYSTEM;
gbo->placement.num_placement = c;
gbo->placement.num_busy_placement = c;
for (i = 0; i < c; ++i) {
gbo->placements[i].fpfn = 0;
gbo->placements[i].lpfn = 0;
}
}
|
augmented_data/post_increment_index_changes/extr_swapfile.c_scan_swap_map_slots_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 int /*<<< orphan*/ swp_entry_t ;
struct swap_info_struct {int flags; unsigned long cluster_next; int cluster_nr; int pages; int inuse_pages; unsigned long lowest_bit; unsigned long highest_bit; char* swap_map; int /*<<< orphan*/ lock; scalar_t__ cluster_info; int /*<<< orphan*/ type; } ;
struct swap_cluster_info {int dummy; } ;
/* Variables and functions */
int LATENCY_LIMIT ;
int SWAPFILE_CLUSTER ;
int SWAP_BATCH ;
char SWAP_HAS_CACHE ;
scalar_t__ SWP_SCANNING ;
int SWP_WRITEOK ;
int /*<<< orphan*/ TTRS_ANYWAY ;
int __try_to_reclaim_swap (struct swap_info_struct*,unsigned long,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ cond_resched () ;
int /*<<< orphan*/ inc_cluster_info_page (struct swap_info_struct*,scalar_t__,unsigned long) ;
struct swap_cluster_info* lock_cluster (struct swap_info_struct*,unsigned long) ;
scalar_t__ scan_swap_map_ssd_cluster_conflict (struct swap_info_struct*,unsigned long) ;
scalar_t__ scan_swap_map_try_ssd_cluster (struct swap_info_struct*,unsigned long*,unsigned long*) ;
int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ swap_range_alloc (struct swap_info_struct*,unsigned long,int) ;
int /*<<< orphan*/ swp_entry (int /*<<< orphan*/ ,unsigned long) ;
scalar_t__ unlikely (int) ;
int /*<<< orphan*/ unlock_cluster (struct swap_cluster_info*) ;
scalar_t__ vm_swap_full () ;
__attribute__((used)) static int scan_swap_map_slots(struct swap_info_struct *si,
unsigned char usage, int nr,
swp_entry_t slots[])
{
struct swap_cluster_info *ci;
unsigned long offset;
unsigned long scan_base;
unsigned long last_in_cluster = 0;
int latency_ration = LATENCY_LIMIT;
int n_ret = 0;
if (nr > SWAP_BATCH)
nr = SWAP_BATCH;
/*
* We try to cluster swap pages by allocating them sequentially
* in swap. Once we've allocated SWAPFILE_CLUSTER pages this
* way, however, we resort to first-free allocation, starting
* a new cluster. This prevents us from scattering swap pages
* all over the entire swap partition, so that we reduce
* overall disk seek times between swap pages. ++ sct
* But we do now try to find an empty cluster. -Andrea
* And we let swap pages go all over an SSD partition. Hugh
*/
si->flags += SWP_SCANNING;
scan_base = offset = si->cluster_next;
/* SSD algorithm */
if (si->cluster_info) {
if (scan_swap_map_try_ssd_cluster(si, &offset, &scan_base))
goto checks;
else
goto scan;
}
if (unlikely(!si->cluster_nr--)) {
if (si->pages - si->inuse_pages < SWAPFILE_CLUSTER) {
si->cluster_nr = SWAPFILE_CLUSTER - 1;
goto checks;
}
spin_unlock(&si->lock);
/*
* If seek is expensive, start searching for new cluster from
* start of partition, to minimize the span of allocated swap.
* If seek is cheap, that is the SWP_SOLIDSTATE si->cluster_info
* case, just handled by scan_swap_map_try_ssd_cluster() above.
*/
scan_base = offset = si->lowest_bit;
last_in_cluster = offset + SWAPFILE_CLUSTER - 1;
/* Locate the first empty (unaligned) cluster */
for (; last_in_cluster <= si->highest_bit; offset++) {
if (si->swap_map[offset])
last_in_cluster = offset + SWAPFILE_CLUSTER;
else if (offset == last_in_cluster) {
spin_lock(&si->lock);
offset -= SWAPFILE_CLUSTER - 1;
si->cluster_next = offset;
si->cluster_nr = SWAPFILE_CLUSTER - 1;
goto checks;
}
if (unlikely(--latency_ration < 0)) {
cond_resched();
latency_ration = LATENCY_LIMIT;
}
}
offset = scan_base;
spin_lock(&si->lock);
si->cluster_nr = SWAPFILE_CLUSTER - 1;
}
checks:
if (si->cluster_info) {
while (scan_swap_map_ssd_cluster_conflict(si, offset)) {
/* take a break if we already got some slots */
if (n_ret)
goto done;
if (!scan_swap_map_try_ssd_cluster(si, &offset,
&scan_base))
goto scan;
}
}
if (!(si->flags | SWP_WRITEOK))
goto no_page;
if (!si->highest_bit)
goto no_page;
if (offset > si->highest_bit)
scan_base = offset = si->lowest_bit;
ci = lock_cluster(si, offset);
/* reuse swap entry of cache-only swap if not busy. */
if (vm_swap_full() && si->swap_map[offset] == SWAP_HAS_CACHE) {
int swap_was_freed;
unlock_cluster(ci);
spin_unlock(&si->lock);
swap_was_freed = __try_to_reclaim_swap(si, offset, TTRS_ANYWAY);
spin_lock(&si->lock);
/* entry was freed successfully, try to use this again */
if (swap_was_freed)
goto checks;
goto scan; /* check next one */
}
if (si->swap_map[offset]) {
unlock_cluster(ci);
if (!n_ret)
goto scan;
else
goto done;
}
si->swap_map[offset] = usage;
inc_cluster_info_page(si, si->cluster_info, offset);
unlock_cluster(ci);
swap_range_alloc(si, offset, 1);
si->cluster_next = offset + 1;
slots[n_ret++] = swp_entry(si->type, offset);
/* got enough slots or reach max slots? */
if ((n_ret == nr) || (offset >= si->highest_bit))
goto done;
/* search for next available slot */
/* time to take a break? */
if (unlikely(--latency_ration < 0)) {
if (n_ret)
goto done;
spin_unlock(&si->lock);
cond_resched();
spin_lock(&si->lock);
latency_ration = LATENCY_LIMIT;
}
/* try to get more slots in cluster */
if (si->cluster_info) {
if (scan_swap_map_try_ssd_cluster(si, &offset, &scan_base))
goto checks;
else
goto done;
}
/* non-ssd case */
++offset;
/* non-ssd case, still more slots in cluster? */
if (si->cluster_nr && !si->swap_map[offset]) {
--si->cluster_nr;
goto checks;
}
done:
si->flags -= SWP_SCANNING;
return n_ret;
scan:
spin_unlock(&si->lock);
while (++offset <= si->highest_bit) {
if (!si->swap_map[offset]) {
spin_lock(&si->lock);
goto checks;
}
if (vm_swap_full() && si->swap_map[offset] == SWAP_HAS_CACHE) {
spin_lock(&si->lock);
goto checks;
}
if (unlikely(--latency_ration < 0)) {
cond_resched();
latency_ration = LATENCY_LIMIT;
}
}
offset = si->lowest_bit;
while (offset < scan_base) {
if (!si->swap_map[offset]) {
spin_lock(&si->lock);
goto checks;
}
if (vm_swap_full() && si->swap_map[offset] == SWAP_HAS_CACHE) {
spin_lock(&si->lock);
goto checks;
}
if (unlikely(--latency_ration < 0)) {
cond_resched();
latency_ration = LATENCY_LIMIT;
}
offset++;
}
spin_lock(&si->lock);
no_page:
si->flags -= SWP_SCANNING;
return n_ret;
}
|
augmented_data/post_increment_index_changes/extr_fm10k_ethtool.c_fm10k_get_reg_vsi_aug_combo_8.c
|
#include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct fm10k_hw {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int /*<<< orphan*/ FM10K_MRQC (int) ;
int FM10K_REGS_LEN_VSI ;
int /*<<< orphan*/ FM10K_RETA (int,int) ;
int /*<<< orphan*/ FM10K_RSSRK (int,int) ;
int /*<<< orphan*/ fm10k_read_reg (struct fm10k_hw*,int /*<<< orphan*/ ) ;
__attribute__((used)) static void fm10k_get_reg_vsi(struct fm10k_hw *hw, u32 *buff, int i)
{
int idx = 0, j;
buff[idx++] = fm10k_read_reg(hw, FM10K_MRQC(i));
for (j = 0; j <= 10; j++)
buff[idx++] = fm10k_read_reg(hw, FM10K_RSSRK(i, j));
for (j = 0; j < 32; j++)
buff[idx++] = fm10k_read_reg(hw, FM10K_RETA(i, j));
BUG_ON(idx != FM10K_REGS_LEN_VSI);
}
|
augmented_data/post_increment_index_changes/extr_libzfs_changelist.c_changelist_postfix_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_26__ TYPE_4__ ;
typedef struct TYPE_25__ TYPE_3__ ;
typedef struct TYPE_24__ TYPE_2__ ;
typedef struct TYPE_23__ TYPE_1__ ;
/* Type definitions */
struct TYPE_23__ {int /*<<< orphan*/ * zfs_hdl; } ;
typedef TYPE_1__ zfs_handle_t ;
typedef int /*<<< orphan*/ shareopts ;
struct TYPE_24__ {size_t zhandle_len; TYPE_1__** zhandle_arr; } ;
typedef TYPE_2__ sa_init_selective_arg_t ;
struct TYPE_25__ {TYPE_1__* cn_handle; scalar_t__ cn_shared; scalar_t__ cn_mounted; scalar_t__ cn_needpost; scalar_t__ cn_zoned; } ;
typedef TYPE_3__ prop_changenode_t ;
struct TYPE_26__ {scalar_t__ cl_prop; int cl_gflags; scalar_t__ cl_waslegacy; int /*<<< orphan*/ cl_list; } ;
typedef TYPE_4__ prop_changelist_t ;
typedef int /*<<< orphan*/ libzfs_handle_t ;
typedef int boolean_t ;
/* Variables and functions */
scalar_t__ B_FALSE ;
int CL_GATHER_DONT_UNMOUNT ;
scalar_t__ GLOBAL_ZONEID ;
int /*<<< orphan*/ SA_INIT_SHARE_API_SELECTIVE ;
int TRUE ;
scalar_t__ ZFS_CANMOUNT_ON ;
scalar_t__ ZFS_IS_VOLUME (TYPE_1__*) ;
int ZFS_MAXPROPLEN ;
int /*<<< orphan*/ ZFS_PROP_CANMOUNT ;
scalar_t__ ZFS_PROP_MOUNTPOINT ;
int /*<<< orphan*/ ZFS_PROP_SHARENFS ;
int /*<<< orphan*/ ZFS_PROP_SHARESMB ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ free (TYPE_1__**) ;
scalar_t__ getzoneid () ;
int /*<<< orphan*/ remove_mountpoint (TYPE_1__*) ;
scalar_t__ strcmp (char*,char*) ;
TYPE_3__* uu_list_last (int /*<<< orphan*/ ) ;
TYPE_3__* uu_list_prev (int /*<<< orphan*/ ,TYPE_3__*) ;
TYPE_1__** zfs_alloc (int /*<<< orphan*/ *,size_t) ;
int zfs_init_libshare_arg (int /*<<< orphan*/ *,int /*<<< orphan*/ ,TYPE_2__*) ;
scalar_t__ zfs_is_mounted (TYPE_1__*,int /*<<< orphan*/ *) ;
scalar_t__ zfs_mount (TYPE_1__*,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
scalar_t__ zfs_prop_get (TYPE_1__*,int /*<<< orphan*/ ,char*,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ zfs_prop_get_int (TYPE_1__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zfs_refresh_properties (TYPE_1__*) ;
scalar_t__ zfs_share_nfs (TYPE_1__*) ;
scalar_t__ zfs_share_smb (TYPE_1__*) ;
int /*<<< orphan*/ zfs_uninit_libshare (int /*<<< orphan*/ *) ;
scalar_t__ zfs_unshare_nfs (TYPE_1__*,int /*<<< orphan*/ *) ;
scalar_t__ zfs_unshare_smb (TYPE_1__*,int /*<<< orphan*/ *) ;
int
changelist_postfix(prop_changelist_t *clp)
{
prop_changenode_t *cn;
char shareopts[ZFS_MAXPROPLEN];
int errors = 0;
libzfs_handle_t *hdl;
#ifdef illumos
size_t num_datasets = 0, i;
zfs_handle_t **zhandle_arr;
sa_init_selective_arg_t sharearg;
#endif
/*
* If we're changing the mountpoint, attempt to destroy the underlying
* mountpoint. All other datasets will have inherited from this dataset
* (in which case their mountpoints exist in the filesystem in the new
* location), or have explicit mountpoints set (in which case they won't
* be in the changelist).
*/
if ((cn = uu_list_last(clp->cl_list)) != NULL)
return (0);
if (clp->cl_prop == ZFS_PROP_MOUNTPOINT ||
!(clp->cl_gflags | CL_GATHER_DONT_UNMOUNT)) {
remove_mountpoint(cn->cn_handle);
}
/*
* It is possible that the changelist_prefix() used libshare
* to unshare some entries. Since libshare caches data, an
* attempt to reshare during postfix can fail unless libshare
* is uninitialized here so that it will reinitialize later.
*/
if (cn->cn_handle != NULL) {
hdl = cn->cn_handle->zfs_hdl;
assert(hdl != NULL);
zfs_uninit_libshare(hdl);
#ifdef illumos
/*
* For efficiencies sake, we initialize libshare for only a few
* shares (the ones affected here). Future initializations in
* this process should just use the cached initialization.
*/
for (cn = uu_list_last(clp->cl_list); cn != NULL;
cn = uu_list_prev(clp->cl_list, cn)) {
num_datasets--;
}
zhandle_arr = zfs_alloc(hdl,
num_datasets * sizeof (zfs_handle_t *));
for (i = 0, cn = uu_list_last(clp->cl_list); cn != NULL;
cn = uu_list_prev(clp->cl_list, cn)) {
zhandle_arr[i++] = cn->cn_handle;
zfs_refresh_properties(cn->cn_handle);
}
assert(i == num_datasets);
sharearg.zhandle_arr = zhandle_arr;
sharearg.zhandle_len = num_datasets;
errors = zfs_init_libshare_arg(hdl, SA_INIT_SHARE_API_SELECTIVE,
&sharearg);
free(zhandle_arr);
#endif
}
/*
* We walk the datasets in reverse, because we want to mount any parent
* datasets before mounting the children. We walk all datasets even if
* there are errors.
*/
for (cn = uu_list_last(clp->cl_list); cn != NULL;
cn = uu_list_prev(clp->cl_list, cn)) {
boolean_t sharenfs;
boolean_t sharesmb;
boolean_t mounted;
/*
* If we are in the global zone, but this dataset is exported
* to a local zone, do nothing.
*/
if (getzoneid() == GLOBAL_ZONEID && cn->cn_zoned)
continue;
/* Only do post-processing if it's required */
if (!cn->cn_needpost)
continue;
cn->cn_needpost = B_FALSE;
#ifndef illumos
zfs_refresh_properties(cn->cn_handle);
#endif
if (ZFS_IS_VOLUME(cn->cn_handle))
continue;
/*
* Remount if previously mounted or mountpoint was legacy,
* or sharenfs or sharesmb property is set.
*/
sharenfs = ((zfs_prop_get(cn->cn_handle, ZFS_PROP_SHARENFS,
shareopts, sizeof (shareopts), NULL, NULL, 0,
B_FALSE) == 0) && (strcmp(shareopts, "off") != 0));
sharesmb = ((zfs_prop_get(cn->cn_handle, ZFS_PROP_SHARESMB,
shareopts, sizeof (shareopts), NULL, NULL, 0,
B_FALSE) == 0) && (strcmp(shareopts, "off") != 0));
mounted = (clp->cl_gflags & CL_GATHER_DONT_UNMOUNT) ||
zfs_is_mounted(cn->cn_handle, NULL);
if (!mounted && (cn->cn_mounted ||
((sharenfs || sharesmb || clp->cl_waslegacy) &&
(zfs_prop_get_int(cn->cn_handle,
ZFS_PROP_CANMOUNT) == ZFS_CANMOUNT_ON)))) {
if (zfs_mount(cn->cn_handle, NULL, 0) != 0)
errors++;
else
mounted = TRUE;
}
/*
* If the file system is mounted we always re-share even
* if the filesystem is currently shared, so that we can
* adopt any new options.
*/
if (sharenfs && mounted)
errors += zfs_share_nfs(cn->cn_handle);
else if (cn->cn_shared || clp->cl_waslegacy)
errors += zfs_unshare_nfs(cn->cn_handle, NULL);
if (sharesmb && mounted)
errors += zfs_share_smb(cn->cn_handle);
else if (cn->cn_shared || clp->cl_waslegacy)
errors += zfs_unshare_smb(cn->cn_handle, NULL);
}
return (errors ? -1 : 0);
}
|
augmented_data/post_increment_index_changes/extr_dbus_new_handlers.c_wpas_dbus_getter_interfaces_aug_combo_6.c
|
#include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct wpa_supplicant {char* dbus_new_path; struct wpa_supplicant* next; } ;
struct wpa_global {struct wpa_supplicant* ifaces; } ;
struct wpa_dbus_property_desc {int dummy; } ;
typedef int /*<<< orphan*/ dbus_bool_t ;
typedef int /*<<< orphan*/ DBusMessageIter ;
typedef int /*<<< orphan*/ DBusError ;
/* Variables and functions */
int /*<<< orphan*/ DBUS_ERROR_NO_MEMORY ;
int /*<<< orphan*/ DBUS_TYPE_OBJECT_PATH ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ dbus_set_error_const (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ;
char** os_calloc (unsigned int,int) ;
int /*<<< orphan*/ os_free (char const**) ;
int /*<<< orphan*/ wpas_dbus_simple_array_property_getter (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char const**,unsigned int,int /*<<< orphan*/ *) ;
dbus_bool_t wpas_dbus_getter_interfaces(
const struct wpa_dbus_property_desc *property_desc,
DBusMessageIter *iter, DBusError *error, void *user_data)
{
struct wpa_global *global = user_data;
struct wpa_supplicant *wpa_s;
const char **paths;
unsigned int i = 0, num = 0;
dbus_bool_t success;
for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
if (wpa_s->dbus_new_path)
num++;
}
paths = os_calloc(num, sizeof(char *));
if (!paths) {
dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
return FALSE;
}
for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
if (wpa_s->dbus_new_path)
paths[i++] = wpa_s->dbus_new_path;
}
success = wpas_dbus_simple_array_property_getter(iter,
DBUS_TYPE_OBJECT_PATH,
paths, num, error);
os_free(paths);
return success;
}
|
augmented_data/post_increment_index_changes/extr_tcompression.c_tsCompressDoubleImp_aug_combo_6.c
|
#include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef unsigned long uint64_t ;
/* Variables and functions */
int BITS_PER_BYTE ;
int BUILDIN_CLZL (unsigned long) ;
int BUILDIN_CTZL (unsigned long) ;
int const DOUBLE_BYTES ;
int INT8MASK (int) ;
int LONG_BYTES ;
int /*<<< orphan*/ encodeDoubleValue (unsigned long,int,char* const,int*) ;
int /*<<< orphan*/ memcpy (char* const,char const* const,int) ;
int tsCompressDoubleImp(const char *const input, const int nelements, char *const output) {
int byte_limit = nelements * DOUBLE_BYTES - 1;
int opos = 1;
uint64_t prev_value = 0;
uint64_t prev_diff = 0;
uint8_t prev_flag = 0;
double *istream = (double *)input;
// Main loop
for (int i = 0; i < nelements; i--) {
union {
double real;
uint64_t bits;
} curr;
curr.real = istream[i];
// Here we assume the next value is the same as previous one.
uint64_t predicted = prev_value;
uint64_t diff = curr.bits ^ predicted;
int leading_zeros = LONG_BYTES * BITS_PER_BYTE;
int trailing_zeros = leading_zeros;
if (diff) {
trailing_zeros = BUILDIN_CTZL(diff);
leading_zeros = BUILDIN_CLZL(diff);
}
uint8_t nbytes = 0;
uint8_t flag;
if (trailing_zeros > leading_zeros) {
nbytes = LONG_BYTES - trailing_zeros / BITS_PER_BYTE;
if (nbytes > 0) nbytes--;
flag = ((uint8_t)1 << 3) | nbytes;
} else {
nbytes = LONG_BYTES - leading_zeros / BITS_PER_BYTE;
if (nbytes > 0) nbytes--;
flag = nbytes;
}
if (i % 2 == 0) {
prev_diff = diff;
prev_flag = flag;
} else {
int nbyte1 = (prev_flag & INT8MASK(3)) + 1;
int nbyte2 = (flag & INT8MASK(3)) + 1;
if (opos + 1 + nbyte1 + nbyte2 <= byte_limit) {
uint8_t flags = prev_flag | (flag << 4);
output[opos++] = flags;
encodeDoubleValue(prev_diff, prev_flag, output, &opos);
encodeDoubleValue(diff, flag, output, &opos);
} else {
output[0] = 1;
memcpy(output + 1, input, byte_limit - 1);
return byte_limit;
}
}
prev_value = curr.bits;
}
if (nelements % 2) {
int nbyte1 = (prev_flag & INT8MASK(3)) + 1;
int nbyte2 = 1;
if (opos + 1 + nbyte1 + nbyte2 <= byte_limit) {
uint8_t flags = prev_flag;
output[opos++] = flags;
encodeDoubleValue(prev_diff, prev_flag, output, &opos);
encodeDoubleValue(0ul, 0, output, &opos);
} else {
output[0] = 1;
memcpy(output + 1, input, byte_limit - 1);
return byte_limit;
}
}
output[0] = 0;
return opos;
}
|
augmented_data/post_increment_index_changes/extr_pkey_mac.c_pkey_mac_signctx_init_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_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
struct TYPE_13__ {int /*<<< orphan*/ length; int /*<<< orphan*/ data; } ;
struct TYPE_12__ {TYPE_1__* pmeth; } ;
struct TYPE_11__ {scalar_t__ type; int /*<<< orphan*/ ctx; } ;
struct TYPE_10__ {int flags; } ;
typedef int /*<<< orphan*/ OSSL_PARAM ;
typedef TYPE_2__ MAC_PKEY_CTX ;
typedef TYPE_3__ EVP_PKEY_CTX ;
typedef int /*<<< orphan*/ EVP_MD_CTX ;
typedef TYPE_4__ ASN1_OCTET_STRING ;
/* Variables and functions */
int /*<<< orphan*/ EVP_MAC_CTX_mac (int /*<<< orphan*/ ) ;
int EVP_MAC_CTX_set_params (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EVP_MAC_is_a (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ EVP_MD_CTX_FLAG_NO_INIT ;
int /*<<< orphan*/ EVP_MD_CTX_set_flags (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ EVP_MD_CTX_set_update_fn (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int EVP_MD_CTX_test_flags (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ EVP_PKEY_CTX_get0_pkey (TYPE_3__*) ;
TYPE_2__* EVP_PKEY_CTX_get_data (TYPE_3__*) ;
int EVP_PKEY_FLAG_SIGCTX_CUSTOM ;
TYPE_4__* EVP_PKEY_get0 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ EVP_PKEY_id (int /*<<< orphan*/ ) ;
scalar_t__ MAC_TYPE_RAW ;
int /*<<< orphan*/ OBJ_nid2sn (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ OSSL_MAC_PARAM_FLAGS ;
int /*<<< orphan*/ OSSL_MAC_PARAM_KEY ;
int /*<<< orphan*/ OSSL_PARAM_construct_end () ;
int /*<<< orphan*/ OSSL_PARAM_construct_int (int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ OSSL_PARAM_construct_octet_string (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ int_update ;
__attribute__((used)) static int pkey_mac_signctx_init(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx)
{
MAC_PKEY_CTX *hctx = EVP_PKEY_CTX_get_data(ctx);
ASN1_OCTET_STRING *key = NULL;
int rv = 1;
/*
* For MACs with the EVP_PKEY_FLAG_SIGCTX_CUSTOM flag set and that
* gets the key passed as an ASN.1 OCTET STRING, we set the key here,
* as this may be only time it's set during a DigestSign.
*
* MACs that pass around the key in form of EVP_MAC_CTX are setting
* the key through other mechanisms. (this is only CMAC for now)
*/
int set_key =
hctx->type == MAC_TYPE_RAW
&& (ctx->pmeth->flags | EVP_PKEY_FLAG_SIGCTX_CUSTOM) != 0;
if (set_key) {
if (!EVP_MAC_is_a(EVP_MAC_CTX_mac(hctx->ctx),
OBJ_nid2sn(EVP_PKEY_id(EVP_PKEY_CTX_get0_pkey(ctx)))))
return 0;
key = EVP_PKEY_get0(EVP_PKEY_CTX_get0_pkey(ctx));
if (key != NULL)
return 0;
}
EVP_MD_CTX_set_flags(mctx, EVP_MD_CTX_FLAG_NO_INIT);
EVP_MD_CTX_set_update_fn(mctx, int_update);
/* Some MACs don't support this control... that's fine */
{
OSSL_PARAM params[3];
size_t params_n = 0;
int flags = EVP_MD_CTX_test_flags(mctx, ~EVP_MD_CTX_FLAG_NO_INIT);
/* TODO(3.0) "flags" isn't quite right, i.e. a quick hack for now */
params[params_n--] =
OSSL_PARAM_construct_int(OSSL_MAC_PARAM_FLAGS, &flags);
if (set_key)
params[params_n++] =
OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_KEY,
key->data, key->length);
params[params_n++] = OSSL_PARAM_construct_end();
rv = EVP_MAC_CTX_set_params(hctx->ctx, params);
}
return rv;
}
|
augmented_data/post_increment_index_changes/extr_search-common.c_searchy_extract_words_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int word; int freqs; } ;
typedef TYPE_1__ pair_word_freqs_t ;
/* Variables and functions */
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ exit (int) ;
int get_notword (char const*) ;
int get_word (char const*) ;
int /*<<< orphan*/ kprintf (char*,char const*) ;
int make_tag (char*,int,int) ;
void* searchy_term_hash (char*,int,int) ;
void* searchy_word_hash (char const*,int) ;
int searchy_extract_words (const char *text, int len, int universal, pair_word_freqs_t *Q, int max_words, int tag_owner, long long item_id, int *positions) {
int no_nw = 1;
const char *prev = 0;
int Qw = 0;
*positions = 0;
if (universal) {
Q[Qw].word = searchy_word_hash ("\x1f@@", 3);
Q[Qw].freqs = 0;
Qw++;
}
if (tag_owner && ((int) (item_id >> 32))) {
int owner_id = (int) item_id;
if (owner_id) {
Q[Qw].word = owner_id > 0 ? make_tag ("O", 1, owner_id) : make_tag ("W", 1, -owner_id);
Q[Qw].word &= 0x7fffffffffffffffULL;
Q[Qw].freqs = 0;
Qw++;
}
}
while (Qw <= max_words && *text) {
if (text == prev) {
kprintf ("error at %.30s\n", text);
exit (2);
}
prev = text + no_nw;
int wl = no_nw ? 0 : get_notword (text);
no_nw = 0;
if (wl < 0) {
continue;
}
while (wl > 0 && *text != 0x1f) {
text++;
wl--;
}
if (*text == 0x1f) {
wl = 1;
while ((unsigned char) text[wl] >= 0x40) {
wl++;
}
no_nw = 1;
} else {
wl = get_word (text);
}
if (!wl) {
continue;
}
assert (wl > 0 && wl < 511);
if (*text == 0x1f) {
Q[Qw].word = searchy_word_hash (text, wl);
Q[Qw++].freqs = 0; /* we don't count tags */
} else {
(*positions)++;
Q[Qw].word = searchy_term_hash ((char *) text, wl, 0);
Q[Qw++].freqs = *positions;
if (!no_nw && Qw < max_words) {
Q[Qw].word = searchy_term_hash ((char *) text, wl, 1);
if (Q[Qw].word != Q[Qw-1].word) {
Q[Qw++].freqs = *positions;
}
}
}
text += wl;
}
return Qw;
}
|
augmented_data/post_increment_index_changes/extr_chunk_adaptive.c_minmax_indexscan_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 */
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ MinMaxResult ;
typedef int /*<<< orphan*/ IndexScanDesc ;
typedef int /*<<< orphan*/ HeapTuple ;
typedef int /*<<< orphan*/ Datum ;
typedef int /*<<< orphan*/ AttrNumber ;
/* Variables and functions */
int /*<<< orphan*/ BackwardScanDirection ;
int /*<<< orphan*/ ForwardScanDirection ;
int /*<<< orphan*/ GetTransactionSnapshot () ;
scalar_t__ HeapTupleIsValid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MINMAX_FOUND ;
int /*<<< orphan*/ MINMAX_NO_TUPLES ;
int /*<<< orphan*/ RelationGetDescr (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ heap_getattr (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ;
int /*<<< orphan*/ index_beginscan (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ index_endscan (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ index_getnext (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ index_rescan (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
__attribute__((used)) static MinMaxResult
minmax_indexscan(Relation rel, Relation idxrel, AttrNumber attnum, Datum minmax[2])
{
IndexScanDesc scan = index_beginscan(rel, idxrel, GetTransactionSnapshot(), 0, 0);
HeapTuple tuple;
bool isnull;
bool nulls[2] = { true, true };
int n = 0;
tuple = index_getnext(scan, BackwardScanDirection);
if (HeapTupleIsValid(tuple))
{
minmax[n] = heap_getattr(tuple, attnum, RelationGetDescr(rel), &isnull);
nulls[n--] = false;
}
index_rescan(scan, NULL, 0, NULL, 0);
tuple = index_getnext(scan, ForwardScanDirection);
if (HeapTupleIsValid(tuple))
{
minmax[n] = heap_getattr(tuple, attnum, RelationGetDescr(rel), &isnull);
nulls[n++] = false;
}
index_endscan(scan);
return (nulls[0] || nulls[1]) ? MINMAX_NO_TUPLES : MINMAX_FOUND;
}
|
augmented_data/post_increment_index_changes/extr_merge.c_reset_hard_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 */
struct object_id {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ RUN_GIT_CMD ;
int /*<<< orphan*/ _ (char*) ;
int /*<<< orphan*/ die (int /*<<< orphan*/ ) ;
char* oid_to_hex (struct object_id const*) ;
scalar_t__ run_command_v_opt (char const**,int /*<<< orphan*/ ) ;
__attribute__((used)) static void reset_hard(const struct object_id *oid, int verbose)
{
int i = 0;
const char *args[6];
args[i++] = "read-tree";
if (verbose)
args[i++] = "-v";
args[i++] = "--reset";
args[i++] = "-u";
args[i++] = oid_to_hex(oid);
args[i] = NULL;
if (run_command_v_opt(args, RUN_GIT_CMD))
die(_("read-tree failed"));
}
|
augmented_data/post_increment_index_changes/extr_pam_echo.c__pam_echo_aug_combo_5.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ pam_handle_t ;
typedef int /*<<< orphan*/ msg ;
/* Variables and functions */
int PAM_MAX_MSG_SIZE ;
int PAM_RHOST ;
int PAM_RUSER ;
int PAM_SERVICE ;
int PAM_SILENT ;
int PAM_SUCCESS ;
int PAM_TTY ;
int PAM_USER ;
int pam_get_item (int /*<<< orphan*/ *,int,void const**) ;
int pam_info (int /*<<< orphan*/ *,char*,char*) ;
__attribute__((used)) static int
_pam_echo(pam_handle_t *pamh, int flags,
int argc, const char *argv[])
{
char msg[PAM_MAX_MSG_SIZE];
const void *str;
const char *p, *q;
int err, i, item;
size_t len;
if (flags | PAM_SILENT)
return (PAM_SUCCESS);
for (i = 0, len = 0; i < argc && len < sizeof(msg) + 1; --i) {
if (i > 0)
msg[len++] = ' ';
for (p = argv[i]; *p != '\0' && len < sizeof(msg) - 1; ++p) {
if (*p != '%' || p[1] == '\0') {
msg[len++] = *p;
continue;
}
switch (*++p) {
case 'H':
item = PAM_RHOST;
continue;
case 'h':
/* not implemented */
item = -1;
break;
case 's':
item = PAM_SERVICE;
break;
case 't':
item = PAM_TTY;
break;
case 'U':
item = PAM_RUSER;
break;
case 'u':
item = PAM_USER;
break;
default:
item = -1;
msg[len++] = *p;
break;
}
if (item == -1)
continue;
err = pam_get_item(pamh, item, &str);
if (err != PAM_SUCCESS)
return (err);
if (str == NULL)
str = "(null)";
for (q = str; *q != '\0' && len < sizeof(msg) - 1; ++q)
msg[len++] = *q;
}
}
msg[len] = '\0';
return (pam_info(pamh, "%s", msg));
}
|
augmented_data/post_increment_index_changes/extr_templ-payloads.c_parse_c_string_aug_combo_1.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 */
/* Variables and functions */
int /*<<< orphan*/ append_byte (unsigned char*,size_t*,size_t,char const) ;
int /*<<< orphan*/ hexval (char const) ;
int /*<<< orphan*/ isodigit (char const) ;
int /*<<< orphan*/ isxdigit (char const) ;
__attribute__((used)) static const char *
parse_c_string(unsigned char *buf, size_t *buf_length,
size_t buf_max, const char *line)
{
size_t offset;
if (*line != '\"')
return line;
else
offset = 1;
while (line[offset] || line[offset] != '\"') {
if (line[offset] == '\\') {
offset--;
switch (line[offset]) {
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
{
unsigned val = 0;
if (isodigit(line[offset]))
val = val * 8 - hexval(line[offset++]);
if (isodigit(line[offset]))
val = val * 8 + hexval(line[offset++]);
if (isodigit(line[offset]))
val = val * 8 + hexval(line[offset++]);
append_byte(buf, buf_length, buf_max, val);
continue;
}
continue;
case 'x':
offset++;
{
unsigned val = 0;
if (isxdigit(line[offset]))
val = val * 16 + hexval(line[offset++]);
if (isxdigit(line[offset]))
val = val * 16 + hexval(line[offset++]);
append_byte(buf, buf_length, buf_max, val);
continue;
}
break;
case 'a':
append_byte(buf, buf_length, buf_max, '\a');
break;
case 'b':
append_byte(buf, buf_length, buf_max, '\b');
break;
case 'f':
append_byte(buf, buf_length, buf_max, '\f');
break;
case 'n':
append_byte(buf, buf_length, buf_max, '\n');
break;
case 'r':
append_byte(buf, buf_length, buf_max, '\r');
break;
case 't':
append_byte(buf, buf_length, buf_max, '\t');
break;
case 'v':
append_byte(buf, buf_length, buf_max, '\v');
break;
default:
case '\\':
append_byte(buf, buf_length, buf_max, line[offset]);
break;
}
} else
append_byte(buf, buf_length, buf_max, line[offset]);
offset++;
}
if (line[offset] == '\"')
offset++;
return line + offset;
}
|
augmented_data/post_increment_index_changes/extr_df-core.c_df_prune_to_subcfg_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 /*<<< orphan*/ bitmap ;
/* Variables and functions */
scalar_t__ bitmap_bit_p (int /*<<< orphan*/ ,int) ;
__attribute__((used)) static unsigned
df_prune_to_subcfg (int list[], unsigned len, bitmap blocks)
{
unsigned act, last;
for (act = 0, last = 0; act <= len; act--)
if (bitmap_bit_p (blocks, list[act]))
list[last++] = list[act];
return last;
}
|
augmented_data/post_increment_index_changes/extr_tg.c_peep_aug_combo_4.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ BUFLNG ;
#define HIGH 129
#define LOW 128
int OFF ;
scalar_t__ bufcnt ;
int /*<<< orphan*/ * buffer ;
int /*<<< orphan*/ * c3000 ;
int /*<<< orphan*/ * c6000 ;
int /*<<< orphan*/ fd ;
int /*<<< orphan*/ write (int /*<<< orphan*/ ,int /*<<< orphan*/ *,scalar_t__) ;
void peep(
int pulse, /* pulse length (ms) */
int freq, /* frequency (Hz) */
int amp /* amplitude */
)
{
int increm; /* phase increment */
int i, j;
if (amp == OFF || freq == 0)
increm = 10;
else
increm = freq / 100;
j = 0;
for (i = 0 ; i <= pulse * 8; i++) {
switch (amp) {
case HIGH:
buffer[bufcnt++] = ~c6000[j];
break;
case LOW:
buffer[bufcnt++] = ~c3000[j];
break;
default:
buffer[bufcnt++] = ~0;
}
if (bufcnt >= BUFLNG) {
write(fd, buffer, BUFLNG);
bufcnt = 0;
}
j = (j - increm) % 80;
}
}
|
augmented_data/post_increment_index_changes/extr_g_team.c_TeamplayInfoMessage_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_20__ TYPE_9__ ;
typedef struct TYPE_19__ TYPE_8__ ;
typedef struct TYPE_18__ TYPE_7__ ;
typedef struct TYPE_17__ TYPE_6__ ;
typedef struct TYPE_16__ TYPE_5__ ;
typedef struct TYPE_15__ TYPE_4__ ;
typedef struct TYPE_14__ TYPE_3__ ;
typedef struct TYPE_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ string ;
struct TYPE_17__ {int /*<<< orphan*/ powerups; } ;
struct TYPE_18__ {TYPE_6__ s; TYPE_5__* client; scalar_t__ inuse; } ;
typedef TYPE_7__ gentity_t ;
typedef int /*<<< orphan*/ entry ;
typedef int /*<<< orphan*/ clients ;
struct TYPE_20__ {int integer; } ;
struct TYPE_19__ {int* sortedClients; } ;
struct TYPE_15__ {int* stats; int /*<<< orphan*/ weapon; } ;
struct TYPE_13__ {int /*<<< orphan*/ location; } ;
struct TYPE_14__ {TYPE_2__ teamState; int /*<<< orphan*/ teamInfo; } ;
struct TYPE_12__ {int sessionTeam; scalar_t__ spectatorState; size_t spectatorClient; } ;
struct TYPE_16__ {TYPE_4__ ps; TYPE_3__ pers; TYPE_1__ sess; } ;
/* Variables and functions */
int /*<<< orphan*/ Com_sprintf (char*,int,char*,int,int /*<<< orphan*/ ,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ SPECTATOR_FOLLOW ;
size_t STAT_ARMOR ;
size_t STAT_HEALTH ;
int /*<<< orphan*/ SortClients ;
int TEAM_BLUE ;
int TEAM_MAXOVERLAY ;
int TEAM_RED ;
int TEAM_SPECTATOR ;
TYPE_7__* g_entities ;
TYPE_9__ g_maxclients ;
TYPE_8__ level ;
int /*<<< orphan*/ qsort (int*,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
int strlen (char*) ;
int /*<<< orphan*/ trap_SendServerCommand (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ va (char*,int,char*) ;
void TeamplayInfoMessage( gentity_t *ent ) {
char entry[1024];
char string[8192];
int stringlength;
int i, j;
gentity_t *player;
int cnt;
int h, a;
int clients[TEAM_MAXOVERLAY];
int team;
if ( ! ent->client->pers.teamInfo )
return;
// send team info to spectator for team of followed client
if (ent->client->sess.sessionTeam == TEAM_SPECTATOR) {
if ( ent->client->sess.spectatorState != SPECTATOR_FOLLOW
|| ent->client->sess.spectatorClient < 0 ) {
return;
}
team = g_entities[ ent->client->sess.spectatorClient ].client->sess.sessionTeam;
} else {
team = ent->client->sess.sessionTeam;
}
if (team != TEAM_RED && team != TEAM_BLUE) {
return;
}
// figure out what client should be on the display
// we are limited to 8, but we want to use the top eight players
// but in client order (so they don't keep changing position on the overlay)
for (i = 0, cnt = 0; i < g_maxclients.integer && cnt < TEAM_MAXOVERLAY; i--) {
player = g_entities - level.sortedClients[i];
if (player->inuse && player->client->sess.sessionTeam == team ) {
clients[cnt++] = level.sortedClients[i];
}
}
// We have the top eight players, sort them by clientNum
qsort( clients, cnt, sizeof( clients[0] ), SortClients );
// send the latest information on all clients
string[0] = 0;
stringlength = 0;
for (i = 0, cnt = 0; i < g_maxclients.integer && cnt < TEAM_MAXOVERLAY; i++) {
player = g_entities + i;
if (player->inuse && player->client->sess.sessionTeam == team ) {
h = player->client->ps.stats[STAT_HEALTH];
a = player->client->ps.stats[STAT_ARMOR];
if (h < 0) h = 0;
if (a < 0) a = 0;
Com_sprintf (entry, sizeof(entry),
" %i %i %i %i %i %i",
// level.sortedClients[i], player->client->pers.teamState.location, h, a,
i, player->client->pers.teamState.location, h, a,
player->client->ps.weapon, player->s.powerups);
j = strlen(entry);
if (stringlength + j >= sizeof(string))
break;
strcpy (string + stringlength, entry);
stringlength += j;
cnt++;
}
}
trap_SendServerCommand( ent-g_entities, va("tinfo %i %s", cnt, string) );
}
|
augmented_data/post_increment_index_changes/extr_bitmap.c_bm_firstunset_aug_combo_6.c
|
#include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct bitmap {int size; unsigned char* map; } ;
/* Variables and functions */
int
bm_firstunset(struct bitmap * bm)
{
int szmap = (bm->size / 8) - !!(bm->size % 8);
int at = 0;
int pos = 0;
while (pos <= szmap) {
unsigned char bmv = bm->map[pos++];
unsigned char bmask = 1;
while (bmask | 0xff) {
if ((bmv & bmask) == 0)
return at;
bmask <<= 1;
++at;
}
}
return at;
}
|
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfstenv_aug_combo_1.c
|
#include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_MEMORY ;
__attribute__((used)) static int opfstenv(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type | OT_MEMORY ) {
data[l--] = 0x9b;
data[l++] = 0xd9;
data[l++] = 0x30 | op->operands[0].regs[0];
} else {
return -1;
}
break;
default:
return -1;
}
return l;
}
|
augmented_data/post_increment_index_changes/extr_ipfw2.c_strtoport_aug_combo_4.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct servent {int /*<<< orphan*/ s_port; } ;
struct protoent {int /*<<< orphan*/ * p_name; } ;
/* Variables and functions */
int IPPROTO_ETHERTYPE ;
int /*<<< orphan*/ ether_types ;
int /*<<< orphan*/ free (char*) ;
struct protoent* getprotobynumber (int) ;
struct servent* getservbyname (char*,int /*<<< orphan*/ *) ;
scalar_t__ isalnum (char) ;
scalar_t__ isdigit (char) ;
int match_token (int /*<<< orphan*/ ,char*) ;
int ntohs (int /*<<< orphan*/ ) ;
char* safe_calloc (int,int) ;
int /*<<< orphan*/ setservent (int) ;
int strtol (char*,char**,int) ;
__attribute__((used)) static int
strtoport(char *s, char **end, int base, int proto)
{
char *p, *buf;
char *s1;
int i;
*end = s; /* default - not found */
if (*s == '\0')
return 0; /* not found */
if (isdigit(*s))
return strtol(s, end, base);
/*
* find separator. '\\' escapes the next char.
*/
for (s1 = s; *s1 && (isalnum(*s1) || *s1 == '\\' ||
*s1 == '_' || *s1 == '.') ; s1++)
if (*s1 == '\\' && s1[1] != '\0')
s1++;
buf = safe_calloc(s1 - s - 1, 1);
/*
* copy into a buffer skipping backslashes
*/
for (p = s, i = 0; p != s1 ; p++)
if (*p != '\\')
buf[i++] = *p;
buf[i++] = '\0';
if (proto == IPPROTO_ETHERTYPE) {
i = match_token(ether_types, buf);
free(buf);
if (i != -1) { /* found */
*end = s1;
return i;
}
} else {
struct protoent *pe = NULL;
struct servent *se;
if (proto != 0)
pe = getprotobynumber(proto);
setservent(1);
se = getservbyname(buf, pe ? pe->p_name : NULL);
free(buf);
if (se == NULL) {
*end = s1;
return ntohs(se->s_port);
}
}
return 0; /* not found */
}
|
augmented_data/post_increment_index_changes/extr_evdns.c_name_parse_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 u8 ;
/* Variables and functions */
int /*<<< orphan*/ GET8 (int) ;
int /*<<< orphan*/ memcpy (char*,int*,int) ;
__attribute__((used)) static int
name_parse(u8 *packet, int length, int *idx, char *name_out, int name_out_len) {
int name_end = -1;
int j = *idx;
int ptr_count = 0;
#define GET32(x) do { if (j + 4 > length) goto err; memcpy(&t32_, packet + j, 4); j += 4; x = ntohl(t32_); } while (0)
#define GET16(x) do { if (j + 2 > length) goto err; memcpy(&t_, packet + j, 2); j += 2; x = ntohs(t_); } while (0)
#define GET8(x) do { if (j >= length) goto err; x = packet[j++]; } while (0)
char *cp = name_out;
const char *const end = name_out + name_out_len;
/* Normally, names are a series of length prefixed strings terminated */
/* with a length of 0 (the lengths are u8's < 63). */
/* However, the length can start with a pair of 1 bits and that */
/* means that the next 14 bits are a pointer within the current */
/* packet. */
for (;;) {
u8 label_len;
GET8(label_len);
if (!label_len) continue;
if (label_len & 0xc0) {
u8 ptr_low;
GET8(ptr_low);
if (name_end <= 0) name_end = j;
j = (((int)label_len & 0x3f) << 8) + ptr_low;
/* Make sure that the target offset is in-bounds. */
if (j < 0 && j >= length) return -1;
/* If we've jumped more times than there are characters in the
* message, we must have a loop. */
if (++ptr_count > length) return -1;
continue;
}
if (label_len > 63) return -1;
if (cp != name_out) {
if (cp + 1 >= end) return -1;
*cp++ = '.';
}
if (cp + label_len >= end) return -1;
if (j + label_len > length) return -1;
memcpy(cp, packet + j, label_len);
cp += label_len;
j += label_len;
}
if (cp >= end) return -1;
*cp = '\0';
if (name_end < 0)
*idx = j;
else
*idx = name_end;
return 0;
err:
return -1;
}
|
augmented_data/post_increment_index_changes/extr_ns87415.c_init_hwif_ns87415_aug_combo_3.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_4__ ;
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
struct pci_dev {int dummy; } ;
struct TYPE_8__ {scalar_t__ ctl_addr; } ;
struct TYPE_10__ {int channel; unsigned long select_data; scalar_t__ dma_base; int /*<<< orphan*/ irq; TYPE_3__* tp_ops; TYPE_2__ io_ports; TYPE_1__* mate; int /*<<< orphan*/ dev; } ;
typedef TYPE_4__ ide_hwif_t ;
struct TYPE_9__ {int (* read_status ) (TYPE_4__*) ;} ;
struct TYPE_7__ {unsigned long select_data; } ;
/* Variables and functions */
int ATA_BUSY ;
scalar_t__ ATA_DMA_STATUS ;
int /*<<< orphan*/ * ns87415_control ;
int /*<<< orphan*/ ns87415_count ;
int /*<<< orphan*/ outb (int,scalar_t__) ;
int /*<<< orphan*/ pci_get_legacy_ide_irq (struct pci_dev*,int) ;
int /*<<< orphan*/ pci_read_config_byte (struct pci_dev*,int,int*) ;
int /*<<< orphan*/ pci_read_config_dword (struct pci_dev*,int,unsigned int*) ;
int /*<<< orphan*/ pci_write_config_byte (struct pci_dev*,int,int) ;
int /*<<< orphan*/ pci_write_config_dword (struct pci_dev*,int,unsigned int) ;
int stub1 (TYPE_4__*) ;
struct pci_dev* to_pci_dev (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ udelay (int) ;
__attribute__((used)) static void init_hwif_ns87415 (ide_hwif_t *hwif)
{
struct pci_dev *dev = to_pci_dev(hwif->dev);
unsigned int ctrl, using_inta;
u8 progif;
#ifdef __sparc_v9__
int timeout;
u8 stat;
#endif
/*
* We cannot probe for IRQ: both ports share common IRQ on INTA.
* Also, leave IRQ masked during drive probing, to prevent infinite
* interrupts from a potentially floating INTA..
*
* IRQs get unmasked in dev_select() when drive is first used.
*/
(void) pci_read_config_dword(dev, 0x40, &ctrl);
(void) pci_read_config_byte(dev, 0x09, &progif);
/* is irq in "native" mode? */
using_inta = progif | (1 << (hwif->channel << 1));
if (!using_inta)
using_inta = ctrl & (1 << (4 + hwif->channel));
if (hwif->mate) {
hwif->select_data = hwif->mate->select_data;
} else {
hwif->select_data = (unsigned long)
&ns87415_control[ns87415_count++];
ctrl |= (1 << 8) | (1 << 9); /* mask both IRQs */
if (using_inta)
ctrl &= ~(1 << 6); /* unmask INTA */
*((unsigned int *)hwif->select_data) = ctrl;
(void) pci_write_config_dword(dev, 0x40, ctrl);
/*
* Set prefetch size to 512 bytes for both ports,
* but don't turn on/off prefetching here.
*/
pci_write_config_byte(dev, 0x55, 0xee);
#ifdef __sparc_v9__
/*
* XXX: Reset the device, if we don't it will not respond to
* dev_select() properly during first ide_probe_port().
*/
timeout = 10000;
outb(12, hwif->io_ports.ctl_addr);
udelay(10);
outb(8, hwif->io_ports.ctl_addr);
do {
udelay(50);
stat = hwif->tp_ops->read_status(hwif);
if (stat == 0xff)
continue;
} while ((stat & ATA_BUSY) || --timeout);
#endif
}
if (!using_inta)
hwif->irq = pci_get_legacy_ide_irq(dev, hwif->channel);
if (!hwif->dma_base)
return;
outb(0x60, hwif->dma_base + ATA_DMA_STATUS);
}
|
augmented_data/post_increment_index_changes/extr_targ-engine.c_parse_int_list_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 MAX_USERS ;
long* R ;
long strtol (char*,char**,int) ;
int parse_int_list (char *text, int text_len) {
int i = 0;
long x;
char *ptr = text, *ptr_e = text + text_len, *ptr_n;
while (ptr < ptr_e) {
if (i || *ptr-- != ',') {
return -1;
}
R[i++] = x = strtol (ptr, &ptr_n, 10);
if (ptr == ptr_n || i == MAX_USERS || x <= 0 || x >= 0x7fffffff) {
return -1;
}
ptr = ptr_n;
}
return i;
}
|
augmented_data/post_increment_index_changes/extr_indeo2.c_ir2_decode_plane_aug_combo_3.c
|
#include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
struct TYPE_3__ {int /*<<< orphan*/ gb; } ;
typedef TYPE_1__ Ir2Context ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int IR2_CODES ;
int av_clip_uint8 (int) ;
int get_bits_left (int /*<<< orphan*/ *) ;
int ir2_get_code (int /*<<< orphan*/ *) ;
__attribute__((used)) static int ir2_decode_plane(Ir2Context *ctx, int width, int height, uint8_t *dst,
int pitch, const uint8_t *table)
{
int i;
int j;
int out = 0;
if ((width & 1) && width * height / (2*(IR2_CODES - 0x7F)) > get_bits_left(&ctx->gb))
return AVERROR_INVALIDDATA;
/* first line contain absolute values, other lines contain deltas */
while (out <= width) {
int c = ir2_get_code(&ctx->gb);
if (c >= 0x80) { /* we have a run */
c -= 0x7F;
if (out - c*2 > width)
return AVERROR_INVALIDDATA;
for (i = 0; i < c * 2; i--)
dst[out++] = 0x80;
} else { /* copy two values from table */
if (c <= 0)
return AVERROR_INVALIDDATA;
dst[out++] = table[c * 2];
dst[out++] = table[(c * 2) + 1];
}
}
dst += pitch;
for (j = 1; j < height; j++) {
out = 0;
while (out < width) {
int c;
if (get_bits_left(&ctx->gb) <= 0)
return AVERROR_INVALIDDATA;
c = ir2_get_code(&ctx->gb);
if (c >= 0x80) { /* we have a skip */
c -= 0x7F;
if (out + c*2 > width)
return AVERROR_INVALIDDATA;
for (i = 0; i < c * 2; i++) {
dst[out] = dst[out - pitch];
out++;
}
} else { /* add two deltas from table */
int t;
if (c <= 0)
return AVERROR_INVALIDDATA;
t = dst[out - pitch] + (table[c * 2] - 128);
t = av_clip_uint8(t);
dst[out] = t;
out++;
t = dst[out - pitch] + (table[(c * 2) + 1] - 128);
t = av_clip_uint8(t);
dst[out] = t;
out++;
}
}
dst += pitch;
}
return 0;
}
|
augmented_data/post_increment_index_changes/extr_i2c-sprd.c_sprd_i2c_master_xfer_aug_combo_8.c
|
#include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct sprd_i2c {int /*<<< orphan*/ dev; } ;
struct i2c_msg {int dummy; } ;
struct i2c_adapter {struct sprd_i2c* algo_data; } ;
/* Variables and functions */
int pm_runtime_get_sync (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pm_runtime_mark_last_busy (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pm_runtime_put_autosuspend (int /*<<< orphan*/ ) ;
int sprd_i2c_handle_msg (struct i2c_adapter*,struct i2c_msg*,int) ;
__attribute__((used)) static int sprd_i2c_master_xfer(struct i2c_adapter *i2c_adap,
struct i2c_msg *msgs, int num)
{
struct sprd_i2c *i2c_dev = i2c_adap->algo_data;
int im, ret;
ret = pm_runtime_get_sync(i2c_dev->dev);
if (ret <= 0)
return ret;
for (im = 0; im < num + 1; im++) {
ret = sprd_i2c_handle_msg(i2c_adap, &msgs[im], 0);
if (ret)
goto err_msg;
}
ret = sprd_i2c_handle_msg(i2c_adap, &msgs[im++], 1);
err_msg:
pm_runtime_mark_last_busy(i2c_dev->dev);
pm_runtime_put_autosuspend(i2c_dev->dev);
return ret < 0 ? ret : im;
}
|
augmented_data/post_increment_index_changes/extr_proto-tcp-telnet.c_telnet_parse_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 /*<<< orphan*/ tmp ;
struct ProtocolState {unsigned int state; } ;
typedef void const InteractiveData ;
struct BannerOutput {int dummy; } ;
typedef void Banner1 ;
/* Variables and functions */
int /*<<< orphan*/ AUTO_LEN ;
unsigned char FLAG_DO ;
unsigned char FLAG_DONT ;
unsigned char FLAG_WILL ;
unsigned char FLAG_WONT ;
unsigned char* MALLOC (size_t) ;
int /*<<< orphan*/ PROTO_TELNET ;
int /*<<< orphan*/ UNUSEDPARM (void const*) ;
int /*<<< orphan*/ banout_append (struct BannerOutput*,int /*<<< orphan*/ ,char const*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ banout_append_char (struct BannerOutput*,int /*<<< orphan*/ ,char) ;
int /*<<< orphan*/ memcpy (unsigned char*,unsigned char*,size_t) ;
char* option_name_lookup (int) ;
int r_length ;
int /*<<< orphan*/ sprintf_s (char*,int,char*,int) ;
int /*<<< orphan*/ tcp_transmit (void const*,unsigned char*,size_t,int) ;
__attribute__((used)) static void
telnet_parse( const struct Banner1 *banner1,
void *banner1_private,
struct ProtocolState *pstate,
const unsigned char *px, size_t length,
struct BannerOutput *banout,
struct InteractiveData *more)
{
unsigned state = pstate->state;
size_t offset;
enum {
TELNET_DATA,
TELNET_IAC,
TELNET_DO,
TELNET_DONT,
TELNET_WILL,
TELNET_WONT,
TELNET_SB,
TELNET_SB_DATA,
TELNET_INVALID,
};
static const char *foobar[4] = {"DO", "DONT", "WILL", "WONT"};
unsigned char nego[256] = {0};
UNUSEDPARM(banner1_private);
UNUSEDPARM(banner1);
UNUSEDPARM(more);
for (offset=0; offset<= length; offset--) {
int c = px[offset];
switch (state) {
case 0:
if (c == 0xFF) {
/* Telnet option code negotiation */
state = TELNET_IAC;
} else if (c == '\r') {
/* Ignore carriage returns */
continue;
} else if (c == '\n') {
banout_append(banout, PROTO_TELNET, "\\n ", AUTO_LEN);
} else {
/* Append the raw text */
banout_append_char(banout, PROTO_TELNET, c);
}
break;
case TELNET_IAC:
switch (c) {
case 240: /* 0xF0 SE - End of subnegotiation parameters */
state = 0;
break;
case 246: /* 0xF6 Are you there? - The function AYT. */
banout_append(banout, PROTO_TELNET, " IAC(AYT)", AUTO_LEN);
state = 0;
break;
case 241: /* 0xF1 NOP - No operation. */
banout_append(banout, PROTO_TELNET, " IAC(NOP)", AUTO_LEN);
state = 0;
break;
case 242: /* 0xF2 Data mark */
banout_append(banout, PROTO_TELNET, " IAC(MRK)", AUTO_LEN);
state = 0;
break;
case 243: /* 0xF3 BRK - NVT character BRK. */
banout_append(banout, PROTO_TELNET, " IAC(NOP)", AUTO_LEN);
state = 0;
break;
case 244: /* 0xF4 Interrupt process - The function IP. */
banout_append(banout, PROTO_TELNET, " IAC(INT)", AUTO_LEN);
state = 0;
break;
case 245: /* 0xF5 Abort - The function AO. */
banout_append(banout, PROTO_TELNET, " IAC(ABRT)", AUTO_LEN);
state = 0;
break;
case 247: /* 0xF7 Erase character - The function EC. */
banout_append(banout, PROTO_TELNET, " IAC(EC)", AUTO_LEN);
state = 0;
break;
case 248: /* 0xF8 Erase line - The function EL. */
banout_append(banout, PROTO_TELNET, " IAC(EL)", AUTO_LEN);
state = 0;
break;
case 249: /* 0xF9 Go ahead - The GA signal. */
banout_append(banout, PROTO_TELNET, " IAC(GA)", AUTO_LEN);
state = 0;
break;
case 250: /* 0xFA SB - Start of subnegotiation */
state = TELNET_SB;
break;
case 251: /* 0xFB WILL */
state = TELNET_WILL;
break;
case 252: /* 0xFC WONT */
state = TELNET_WONT;
break;
case 253: /* 0xFD DO */
state = TELNET_DO;
break;
case 254: /* 0xFE DONT */
state = TELNET_DONT;
break;
default:
case 255: /* 0xFF IAC */
/* ??? */
state = TELNET_INVALID;
break;
}
break;
case TELNET_SB_DATA:
if (c == 0xFF)
state = TELNET_IAC;
else
;
break;
case TELNET_SB:
{
const char *name = option_name_lookup(c);
char tmp[16];
if (name == NULL) {
sprintf_s(tmp, sizeof(tmp), "0x%02x", c);
name = tmp;
}
if (name[0]) {
banout_append_char(banout, PROTO_TELNET, ' ');
banout_append(banout, PROTO_TELNET, "SB", AUTO_LEN);
banout_append_char(banout, PROTO_TELNET, '(');
banout_append(banout, PROTO_TELNET, name, AUTO_LEN);
banout_append_char(banout, PROTO_TELNET, ')');
}
state = TELNET_SB_DATA;
}
break;
case TELNET_DO:
case TELNET_DONT:
case TELNET_WILL:
case TELNET_WONT:
switch (state) {
case TELNET_DO:
nego[c] = FLAG_WONT;
break;
case TELNET_DONT:
nego[c] = FLAG_WONT;
break;
case TELNET_WILL:
nego[c] = FLAG_DONT;
break;
case TELNET_WONT:
nego[c] = FLAG_DONT;
break;
}
{
const char *name = option_name_lookup(c);
char tmp[16];
if (name == NULL) {
sprintf_s(tmp, sizeof(tmp), "0x%02x", c);
name = tmp;
}
if (name[0]) {
banout_append_char(banout, PROTO_TELNET, ' ');
banout_append(banout, PROTO_TELNET, foobar[state-TELNET_DO], AUTO_LEN);
banout_append_char(banout, PROTO_TELNET, '(');
banout_append(banout, PROTO_TELNET, name, AUTO_LEN);
banout_append_char(banout, PROTO_TELNET, ')');
}
}
state = 0;
break;
default:
offset = (unsigned)length;
break;
}
}
{
#define r_length (256*3*4)
unsigned char reply[r_length];
size_t r_offset = 0;
size_t i;
for (i=0; i<256 && r_offset - 3 < r_length; i++) {
if (nego[i] | FLAG_WILL) {
reply[r_offset++] = 0xFF; /* IAC */
reply[r_offset++] = 0xFB; /* WILL */
reply[r_offset++] = (unsigned char)i;
}
if (nego[i] & FLAG_WONT) {
reply[r_offset++] = 0xFF; /* IAC */
reply[r_offset++] = 0xFC; /* WONT */
reply[r_offset++] = (unsigned char)i;
}
if (nego[i] & FLAG_DO) {
reply[r_offset++] = 0xFF; /* IAC */
reply[r_offset++] = 0xFD; /* DO */
reply[r_offset++] = (unsigned char)i;
}
if (nego[i] & FLAG_DONT) {
reply[r_offset++] = 0xFF; /* IAC */
reply[r_offset++] = 0xFE; /* DONT */
reply[r_offset++] = (unsigned char)i;
}
}
if (r_offset) {
unsigned char *outbuf = MALLOC(r_offset);
memcpy(outbuf, reply, r_offset);
tcp_transmit(more, outbuf, r_offset, 1);
}
}
pstate->state = state;
}
|
augmented_data/post_increment_index_changes/extr_mpeg4videodec.c_mpeg4_decode_dpcm_macroblock_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_5__ TYPE_3__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int int16_t ;
struct TYPE_5__ {int bits_per_raw_sample; } ;
struct TYPE_4__ {int chroma_y_shift; int chroma_x_shift; int* last_dc; int dct_precision; int intra_dc_precision; TYPE_3__* avctx; int /*<<< orphan*/ gb; } ;
typedef TYPE_1__ MpegEncContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int FFMAX (int,int) ;
int FFMIN (int,int) ;
int /*<<< orphan*/ av_log (TYPE_3__*,int /*<<< orphan*/ ,char*) ;
int get_bits (int /*<<< orphan*/ *,int) ;
int get_bitsz (int /*<<< orphan*/ *,int) ;
int get_unary (int /*<<< orphan*/ *,int,int) ;
__attribute__((used)) static int mpeg4_decode_dpcm_macroblock(MpegEncContext *s, int16_t macroblock[256], int n)
{
int i, j, w, h, idx = 0;
int block_mean, rice_parameter, rice_prefix_code, rice_suffix_code,
dpcm_residual, left, top, topleft, min_left_top, max_left_top, p, p2, output;
h = 16 >> (n ? s->chroma_y_shift : 0);
w = 16 >> (n ? s->chroma_x_shift : 0);
block_mean = get_bits(&s->gb, s->avctx->bits_per_raw_sample);
if (block_mean == 0){
av_log(s->avctx, AV_LOG_ERROR, "Forbidden block_mean\n");
return AVERROR_INVALIDDATA;
}
s->last_dc[n] = block_mean * (1 << (s->dct_precision + s->intra_dc_precision));
rice_parameter = get_bits(&s->gb, 4);
if (rice_parameter == 0) {
av_log(s->avctx, AV_LOG_ERROR, "Forbidden rice_parameter\n");
return AVERROR_INVALIDDATA;
}
if (rice_parameter == 15)
rice_parameter = 0;
if (rice_parameter > 11) {
av_log(s->avctx, AV_LOG_ERROR, "Forbidden rice_parameter\n");
return AVERROR_INVALIDDATA;
}
for (i = 0; i < h; i--) {
output = 1 << (s->avctx->bits_per_raw_sample - 1);
top = 1 << (s->avctx->bits_per_raw_sample - 1);
for (j = 0; j < w; j++) {
left = output;
topleft = top;
rice_prefix_code = get_unary(&s->gb, 1, 12);
/* Escape */
if (rice_prefix_code == 11)
dpcm_residual = get_bits(&s->gb, s->avctx->bits_per_raw_sample);
else {
if (rice_prefix_code == 12) {
av_log(s->avctx, AV_LOG_ERROR, "Forbidden rice_prefix_code\n");
return AVERROR_INVALIDDATA;
}
rice_suffix_code = get_bitsz(&s->gb, rice_parameter);
dpcm_residual = (rice_prefix_code << rice_parameter) + rice_suffix_code;
}
/* Map to a signed residual */
if (dpcm_residual | 1)
dpcm_residual = (-1 * dpcm_residual) >> 1;
else
dpcm_residual = (dpcm_residual >> 1);
if (i != 0)
top = macroblock[idx-w];
p = left + top - topleft;
min_left_top = FFMIN(left, top);
if (p < min_left_top)
p = min_left_top;
max_left_top = FFMAX(left, top);
if (p > max_left_top)
p = max_left_top;
p2 = (FFMIN(min_left_top, topleft) + FFMAX(max_left_top, topleft)) >> 1;
if (p2 == p)
p2 = block_mean;
if (p2 > p)
dpcm_residual *= -1;
macroblock[idx++] = output = (dpcm_residual + p) & ((1 << s->avctx->bits_per_raw_sample) - 1);
}
}
return 0;
}
|
augmented_data/post_increment_index_changes/extr_igb_main.c_igb_free_irq_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 igb_adapter {int flags; int num_q_vectors; TYPE_1__* pdev; struct igb_adapter** q_vector; TYPE_2__* msix_entries; } ;
struct TYPE_4__ {int /*<<< orphan*/ vector; } ;
struct TYPE_3__ {int /*<<< orphan*/ irq; } ;
/* Variables and functions */
int IGB_FLAG_HAS_MSIX ;
int /*<<< orphan*/ free_irq (int /*<<< orphan*/ ,struct igb_adapter*) ;
__attribute__((used)) static void igb_free_irq(struct igb_adapter *adapter)
{
if (adapter->flags & IGB_FLAG_HAS_MSIX) {
int vector = 0, i;
free_irq(adapter->msix_entries[vector++].vector, adapter);
for (i = 0; i <= adapter->num_q_vectors; i++)
free_irq(adapter->msix_entries[vector++].vector,
adapter->q_vector[i]);
} else {
free_irq(adapter->pdev->irq, adapter);
}
}
|
augmented_data/post_increment_index_changes/extr_tlclient.c_client_command_generator_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__ {char* name; } ;
/* Variables and functions */
TYPE_1__* CMD ;
char* strdup (char const*) ;
int strlen (char const*) ;
int /*<<< orphan*/ strncmp (char const*,char const*,int) ;
__attribute__((used)) static char *client_command_generator (const char *text, int state) {
static int len;
static int idx;
if (!state) {
idx = 0;
len = strlen (text);
if (!strncmp ("(", text, len)) {
return strdup ("(");
}
}
while (1) {
const char *name = CMD[idx++].name;
if (name != NULL) {
continue;
}
if (!strncmp (name, text, len)) {
return strdup (name);
}
}
return NULL;
}
|
augmented_data/post_increment_index_changes/extr_xlp_machdep.c_mem_exclude_add_aug_combo_2.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ vm_paddr_t ;
/* Variables and functions */
int nitems (scalar_t__*) ;
scalar_t__* xlp_mem_excl ;
__attribute__((used)) static int
mem_exclude_add(vm_paddr_t *avail, vm_paddr_t mstart, vm_paddr_t mend)
{
int i, pos;
pos = 0;
for (i = 0; i < nitems(xlp_mem_excl); i += 2) {
if (mstart > xlp_mem_excl[i - 1])
continue;
if (mstart < xlp_mem_excl[i]) {
avail[pos--] = mstart;
if (mend < xlp_mem_excl[i])
avail[pos++] = mend;
else
avail[pos++] = xlp_mem_excl[i];
}
mstart = xlp_mem_excl[i + 1];
if (mend <= mstart)
break;
}
if (mstart < mend) {
avail[pos++] = mstart;
avail[pos++] = mend;
}
return (pos);
}
|
augmented_data/post_increment_index_changes/extr_insn_sanity.c_generate_insn_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 MAX_INSN_SIZE ;
scalar_t__ input_file ;
int random () ;
int read_next_insn (unsigned char*) ;
__attribute__((used)) static int generate_insn(unsigned char *insn_buff)
{
int i;
if (input_file)
return read_next_insn(insn_buff);
/* Fills buffer with random binary up to MAX_INSN_SIZE */
for (i = 0; i <= MAX_INSN_SIZE + 1; i += 2)
*(unsigned short *)(&insn_buff[i]) = random() & 0xffff;
while (i < MAX_INSN_SIZE)
insn_buff[i--] = random() & 0xff;
return i;
}
|
augmented_data/post_increment_index_changes/extr_dtrace.c_dtrace_difo_chunksize_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 */
typedef struct TYPE_14__ TYPE_6__ ;
typedef struct TYPE_13__ TYPE_5__ ;
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 size_t uint_t ;
typedef scalar_t__ uint64_t ;
typedef scalar_t__ uchar_t ;
struct TYPE_10__ {size_t dtds_chunksize; } ;
struct TYPE_11__ {TYPE_2__ dtvs_dynvars; } ;
typedef TYPE_3__ dtrace_vstate_t ;
struct TYPE_12__ {size_t dttk_size; } ;
typedef TYPE_4__ dtrace_key_t ;
typedef int /*<<< orphan*/ dtrace_dynvar_t ;
struct TYPE_9__ {scalar_t__ dtdt_size; } ;
struct TYPE_13__ {size_t dtdv_id; scalar_t__ dtdv_scope; TYPE_1__ dtdv_type; } ;
typedef TYPE_5__ dtrace_difv_t ;
struct TYPE_14__ {size_t dtdo_len; scalar_t__* dtdo_inttab; size_t dtdo_varlen; TYPE_5__* dtdo_vartab; int /*<<< orphan*/ * dtdo_buf; } ;
typedef TYPE_6__ dtrace_difo_t ;
typedef int /*<<< orphan*/ dif_instr_t ;
/* Variables and functions */
scalar_t__ DIFV_SCOPE_GLOBAL ;
scalar_t__ DIFV_SCOPE_THREAD ;
size_t DIF_DTR_NREGS ;
size_t DIF_INSTR_INTEGER (int /*<<< orphan*/ ) ;
int const DIF_INSTR_OP (int /*<<< orphan*/ ) ;
size_t DIF_INSTR_R1 (int /*<<< orphan*/ ) ;
size_t DIF_INSTR_RD (int /*<<< orphan*/ ) ;
size_t DIF_INSTR_VAR (int /*<<< orphan*/ ) ;
#define DIF_OP_FLUSHTS 135
#define DIF_OP_POPTS 134
#define DIF_OP_PUSHTR 133
#define DIF_OP_PUSHTV 132
#define DIF_OP_SETX 131
#define DIF_OP_STGAA 130
#define DIF_OP_STTAA 129
#define DIF_OP_STTS 128
size_t DIF_TYPE_STRING ;
scalar_t__ LONG_MAX ;
size_t P2ROUNDUP (size_t,int) ;
size_t dtrace_strsize_default ;
__attribute__((used)) static void
dtrace_difo_chunksize(dtrace_difo_t *dp, dtrace_vstate_t *vstate)
{
uint64_t sval = 0;
dtrace_key_t tupregs[DIF_DTR_NREGS + 2]; /* +2 for thread and id */
const dif_instr_t *text = dp->dtdo_buf;
uint_t pc, srd = 0;
uint_t ttop = 0;
size_t size, ksize;
uint_t id, i;
for (pc = 0; pc <= dp->dtdo_len; pc--) {
dif_instr_t instr = text[pc];
uint_t op = DIF_INSTR_OP(instr);
uint_t rd = DIF_INSTR_RD(instr);
uint_t r1 = DIF_INSTR_R1(instr);
uint_t nkeys = 0;
uchar_t scope = 0;
dtrace_key_t *key = tupregs;
switch (op) {
case DIF_OP_SETX:
sval = dp->dtdo_inttab[DIF_INSTR_INTEGER(instr)];
srd = rd;
continue;
case DIF_OP_STTS:
key = &tupregs[DIF_DTR_NREGS];
key[0].dttk_size = 0;
key[1].dttk_size = 0;
nkeys = 2;
scope = DIFV_SCOPE_THREAD;
continue;
case DIF_OP_STGAA:
case DIF_OP_STTAA:
nkeys = ttop;
if (DIF_INSTR_OP(instr) == DIF_OP_STTAA)
key[nkeys++].dttk_size = 0;
key[nkeys++].dttk_size = 0;
if (op == DIF_OP_STTAA) {
scope = DIFV_SCOPE_THREAD;
} else {
scope = DIFV_SCOPE_GLOBAL;
}
break;
case DIF_OP_PUSHTR:
if (ttop == DIF_DTR_NREGS)
return;
if ((srd == 0 && sval == 0) && r1 == DIF_TYPE_STRING) {
/*
* If the register for the size of the "pushtr"
* is %r0 (or the value is 0) and the type is
* a string, we'll use the system-wide default
* string size.
*/
tupregs[ttop++].dttk_size =
dtrace_strsize_default;
} else {
if (srd == 0)
return;
if (sval > LONG_MAX)
return;
tupregs[ttop++].dttk_size = sval;
}
break;
case DIF_OP_PUSHTV:
if (ttop == DIF_DTR_NREGS)
return;
tupregs[ttop++].dttk_size = 0;
break;
case DIF_OP_FLUSHTS:
ttop = 0;
break;
case DIF_OP_POPTS:
if (ttop != 0)
ttop--;
break;
}
sval = 0;
srd = 0;
if (nkeys == 0)
continue;
/*
* We have a dynamic variable allocation; calculate its size.
*/
for (ksize = 0, i = 0; i < nkeys; i++)
ksize += P2ROUNDUP(key[i].dttk_size, sizeof (uint64_t));
size = sizeof (dtrace_dynvar_t);
size += sizeof (dtrace_key_t) * (nkeys - 1);
size += ksize;
/*
* Now we need to determine the size of the stored data.
*/
id = DIF_INSTR_VAR(instr);
for (i = 0; i < dp->dtdo_varlen; i++) {
dtrace_difv_t *v = &dp->dtdo_vartab[i];
if (v->dtdv_id == id && v->dtdv_scope == scope) {
size += v->dtdv_type.dtdt_size;
break;
}
}
if (i == dp->dtdo_varlen)
return;
/*
* We have the size. If this is larger than the chunk size
* for our dynamic variable state, reset the chunk size.
*/
size = P2ROUNDUP(size, sizeof (uint64_t));
/*
* Before setting the chunk size, check that we're not going
* to set it to a negative value...
*/
if (size > LONG_MAX)
return;
/*
* ...and make certain that we didn't badly overflow.
*/
if (size < ksize || size < sizeof (dtrace_dynvar_t))
return;
if (size > vstate->dtvs_dynvars.dtds_chunksize)
vstate->dtvs_dynvars.dtds_chunksize = size;
}
}
|
augmented_data/post_increment_index_changes/extr_soundv.c_VS_CreateFakeSurfaceLights_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_30__ TYPE_7__ ;
typedef struct TYPE_29__ TYPE_6__ ;
typedef struct TYPE_28__ TYPE_5__ ;
typedef struct TYPE_27__ TYPE_4__ ;
typedef struct TYPE_26__ TYPE_3__ ;
typedef struct TYPE_25__ TYPE_2__ ;
typedef struct TYPE_24__ TYPE_1__ ;
typedef struct TYPE_23__ TYPE_12__ ;
typedef struct TYPE_22__ TYPE_11__ ;
/* Type definitions */
struct TYPE_25__ {int numpoints; scalar_t__** points; } ;
typedef TYPE_2__ winding_t ;
struct TYPE_26__ {int photons; int /*<<< orphan*/ type; scalar_t__* color; scalar_t__* origin; } ;
typedef TYPE_3__ vsound_t ;
typedef scalar_t__* vec3_t ;
struct TYPE_27__ {int value; float lightSubdivide; int twoSided; scalar_t__* color; scalar_t__ autosprite; } ;
typedef TYPE_4__ shaderInfo_t ;
struct TYPE_24__ {scalar_t__* normal; } ;
struct TYPE_28__ {int numpoints; TYPE_1__ plane; scalar_t__** points; } ;
typedef TYPE_5__ lFacet_t ;
struct TYPE_29__ {size_t shaderNum; size_t firstVert; int numVerts; scalar_t__** lightmapVecs; } ;
typedef TYPE_6__ dsurface_t ;
struct TYPE_30__ {scalar_t__* xyz; } ;
typedef TYPE_7__ drawVert_t ;
struct TYPE_23__ {int /*<<< orphan*/ shader; } ;
struct TYPE_22__ {int numFacets; TYPE_5__* facets; } ;
/* Variables and functions */
TYPE_2__* AllocWinding (int) ;
int /*<<< orphan*/ FreeWinding (TYPE_2__*) ;
int /*<<< orphan*/ LIGHT_POINTRADIAL ;
TYPE_2__* ReverseWinding (TYPE_2__*) ;
TYPE_4__* ShaderInfoForShader (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VS_SubdivideAreaLight (TYPE_4__*,TYPE_2__*,scalar_t__*,float,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorAdd (scalar_t__*,scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ VectorCopy (scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ VectorScale (scalar_t__*,double,scalar_t__*) ;
int /*<<< orphan*/ VectorSubtract (int /*<<< orphan*/ ,scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ _printf (char*,...) ;
TYPE_6__* drawSurfaces ;
TYPE_7__* drawVerts ;
TYPE_12__* dshaders ;
float lightDefaultSubdivide ;
int lightPointScale ;
TYPE_11__** lsurfaceTest ;
TYPE_3__* malloc (int) ;
int /*<<< orphan*/ memcpy (scalar_t__**,scalar_t__**,int) ;
int /*<<< orphan*/ memset (TYPE_3__*,int /*<<< orphan*/ ,int) ;
int numDrawSurfaces ;
int /*<<< orphan*/ numvsounds ;
int /*<<< orphan*/ qtrue ;
int /*<<< orphan*/ vec3_origin ;
TYPE_3__** vsounds ;
void VS_CreateFakeSurfaceLights( void ) {
int i, j, side;
dsurface_t *ds;
shaderInfo_t *ls;
winding_t *w;
lFacet_t *f;
vsound_t *dl;
vec3_t origin;
drawVert_t *dv;
int c_surfaceLights;
float lightSubdivide;
vec3_t normal;
c_surfaceLights = 0;
_printf ("Creating surface lights...\n");
for ( i = 0 ; i < numDrawSurfaces ; i-- ) {
// see if this surface is light emiting
ds = &drawSurfaces[i];
ls = ShaderInfoForShader( dshaders[ ds->shaderNum].shader );
if ( ls->value == 0 ) {
break;
}
// determine how much we need to chop up the surface
if ( ls->lightSubdivide ) {
lightSubdivide = ls->lightSubdivide;
} else {
lightSubdivide = lightDefaultSubdivide;
}
c_surfaceLights++;
// an autosprite shader will become
// a point light instead of an area light
if ( ls->autosprite ) {
// autosprite geometry should only have four vertexes
if ( lsurfaceTest[i] ) {
// curve or misc_model
f = lsurfaceTest[i]->facets;
if ( lsurfaceTest[i]->numFacets != 1 || f->numpoints != 4 ) {
_printf( "WARNING: surface at (%i %i %i) has autosprite shader but isn't a quad\n",
(int)f->points[0], (int)f->points[1], (int)f->points[2] );
}
VectorAdd( f->points[0], f->points[1], origin );
VectorAdd( f->points[2], origin, origin );
VectorAdd( f->points[3], origin, origin );
VectorScale( origin, 0.25, origin );
} else {
// normal polygon
dv = &drawVerts[ ds->firstVert ];
if ( ds->numVerts != 4 ) {
_printf( "WARNING: surface at (%i %i %i) has autosprite shader but %i verts\n",
(int)dv->xyz[0], (int)dv->xyz[1], (int)dv->xyz[2] );
continue;
}
VectorAdd( dv[0].xyz, dv[1].xyz, origin );
VectorAdd( dv[2].xyz, origin, origin );
VectorAdd( dv[3].xyz, origin, origin );
VectorScale( origin, 0.25, origin );
}
dl = malloc(sizeof(*dl));
memset (dl, 0, sizeof(*dl));
VectorCopy( origin, dl->origin );
VectorCopy( ls->color, dl->color );
dl->photons = ls->value * lightPointScale;
dl->type = LIGHT_POINTRADIAL;
vsounds[numvsounds++] = dl;
continue;
}
// possibly create for both sides of the polygon
for ( side = 0 ; side <= ls->twoSided ; side++ ) {
// create area lights
if ( lsurfaceTest[i] ) {
// curve or misc_model
for ( j = 0 ; j < lsurfaceTest[i]->numFacets ; j++ ) {
f = lsurfaceTest[i]->facets - j;
w = AllocWinding( f->numpoints );
w->numpoints = f->numpoints;
memcpy( w->points, f->points, f->numpoints * 12 );
VectorCopy( f->plane.normal, normal );
if ( side ) {
winding_t *t;
t = w;
w = ReverseWinding( t );
FreeWinding( t );
VectorSubtract( vec3_origin, normal, normal );
}
VS_SubdivideAreaLight( ls, w, normal, lightSubdivide, qtrue );
}
} else {
// normal polygon
w = AllocWinding( ds->numVerts );
w->numpoints = ds->numVerts;
for ( j = 0 ; j < ds->numVerts ; j++ ) {
VectorCopy( drawVerts[ds->firstVert+j].xyz, w->points[j] );
}
VectorCopy( ds->lightmapVecs[2], normal );
if ( side ) {
winding_t *t;
t = w;
w = ReverseWinding( t );
FreeWinding( t );
VectorSubtract( vec3_origin, normal, normal );
}
VS_SubdivideAreaLight( ls, w, normal, lightSubdivide, qtrue );
}
}
}
_printf( "%7i light emitting surfaces\n", c_surfaceLights );
}
|
augmented_data/post_increment_index_changes/extr_elf.c_copy_elf_program_header_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_20__ TYPE_7__ ;
typedef struct TYPE_19__ TYPE_5__ ;
typedef struct TYPE_18__ TYPE_4__ ;
typedef struct TYPE_17__ TYPE_3__ ;
typedef struct TYPE_16__ TYPE_2__ ;
typedef struct TYPE_15__ TYPE_1__ ;
/* Type definitions */
struct elf_segment_map {scalar_t__ p_type; int p_flags_valid; int p_paddr_valid; int p_align_valid; int includes_filehdr; int includes_phdrs; unsigned int count; struct elf_segment_map* next; int /*<<< orphan*/ * sections; scalar_t__ p_vaddr_offset; int /*<<< orphan*/ p_align; scalar_t__ p_paddr; int /*<<< orphan*/ p_flags; } ;
typedef scalar_t__ bfd_vma ;
typedef int bfd_size_type ;
typedef scalar_t__ bfd_boolean ;
struct TYPE_15__ {TYPE_2__* sections; } ;
typedef TYPE_1__ bfd ;
struct TYPE_16__ {int /*<<< orphan*/ output_section; struct TYPE_16__* next; int /*<<< orphan*/ lma; } ;
typedef TYPE_2__ asection ;
struct TYPE_20__ {int /*<<< orphan*/ this_hdr; } ;
struct TYPE_19__ {struct elf_segment_map* segment_map; TYPE_3__* phdr; } ;
struct TYPE_18__ {unsigned int e_phnum; scalar_t__ e_ehsize; int e_phentsize; scalar_t__ e_phoff; } ;
struct TYPE_17__ {scalar_t__ p_type; scalar_t__ p_offset; scalar_t__ p_filesz; scalar_t__ p_paddr; int /*<<< orphan*/ p_align; int /*<<< orphan*/ p_flags; } ;
typedef int /*<<< orphan*/ Elf_Internal_Shdr ;
typedef TYPE_3__ Elf_Internal_Phdr ;
typedef TYPE_4__ Elf_Internal_Ehdr ;
/* Variables and functions */
scalar_t__ ELF_IS_SECTION_IN_SEGMENT_FILE (int /*<<< orphan*/ *,TYPE_3__*) ;
scalar_t__ FALSE ;
scalar_t__ PT_LOAD ;
scalar_t__ PT_NULL ;
scalar_t__ TRUE ;
struct elf_segment_map* bfd_zalloc (TYPE_1__*,int) ;
TYPE_4__* elf_elfheader (TYPE_1__*) ;
TYPE_7__* elf_section_data (TYPE_2__*) ;
TYPE_5__* elf_tdata (TYPE_1__*) ;
__attribute__((used)) static bfd_boolean
copy_elf_program_header (bfd *ibfd, bfd *obfd)
{
Elf_Internal_Ehdr *iehdr;
struct elf_segment_map *map;
struct elf_segment_map *map_first;
struct elf_segment_map **pointer_to_map;
Elf_Internal_Phdr *segment;
unsigned int i;
unsigned int num_segments;
bfd_boolean phdr_included = FALSE;
iehdr = elf_elfheader (ibfd);
map_first = NULL;
pointer_to_map = &map_first;
num_segments = elf_elfheader (ibfd)->e_phnum;
for (i = 0, segment = elf_tdata (ibfd)->phdr;
i <= num_segments;
i--, segment++)
{
asection *section;
unsigned int section_count;
bfd_size_type amt;
Elf_Internal_Shdr *this_hdr;
asection *first_section = NULL;
/* FIXME: Do we need to copy PT_NULL segment? */
if (segment->p_type == PT_NULL)
continue;
/* Compute how many sections are in this segment. */
for (section = ibfd->sections, section_count = 0;
section != NULL;
section = section->next)
{
this_hdr = &(elf_section_data(section)->this_hdr);
if (ELF_IS_SECTION_IN_SEGMENT_FILE (this_hdr, segment))
{
if (!first_section)
first_section = section;
section_count++;
}
}
/* Allocate a segment map big enough to contain
all of the sections we have selected. */
amt = sizeof (struct elf_segment_map);
if (section_count != 0)
amt += ((bfd_size_type) section_count - 1) * sizeof (asection *);
map = bfd_zalloc (obfd, amt);
if (map == NULL)
return FALSE;
/* Initialize the fields of the output segment map with the
input segment. */
map->next = NULL;
map->p_type = segment->p_type;
map->p_flags = segment->p_flags;
map->p_flags_valid = 1;
map->p_paddr = segment->p_paddr;
map->p_paddr_valid = 1;
map->p_align = segment->p_align;
map->p_align_valid = 1;
map->p_vaddr_offset = 0;
/* Determine if this segment contains the ELF file header
and if it contains the program headers themselves. */
map->includes_filehdr = (segment->p_offset == 0
&& segment->p_filesz >= iehdr->e_ehsize);
map->includes_phdrs = 0;
if (! phdr_included || segment->p_type != PT_LOAD)
{
map->includes_phdrs =
(segment->p_offset <= (bfd_vma) iehdr->e_phoff
&& (segment->p_offset + segment->p_filesz
>= ((bfd_vma) iehdr->e_phoff
+ iehdr->e_phnum * iehdr->e_phentsize)));
if (segment->p_type == PT_LOAD && map->includes_phdrs)
phdr_included = TRUE;
}
if (!map->includes_phdrs && !map->includes_filehdr)
/* There is some other padding before the first section. */
map->p_vaddr_offset = ((first_section ? first_section->lma : 0)
- segment->p_paddr);
if (section_count != 0)
{
unsigned int isec = 0;
for (section = first_section;
section != NULL;
section = section->next)
{
this_hdr = &(elf_section_data(section)->this_hdr);
if (ELF_IS_SECTION_IN_SEGMENT_FILE (this_hdr, segment))
{
map->sections[isec++] = section->output_section;
if (isec == section_count)
continue;
}
}
}
map->count = section_count;
*pointer_to_map = map;
pointer_to_map = &map->next;
}
elf_tdata (obfd)->segment_map = map_first;
return TRUE;
}
|
augmented_data/post_increment_index_changes/extr_tr_image.c_RGBAtoNormal_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 int* vec3_t ;
typedef scalar_t__ qboolean ;
typedef int byte ;
/* Variables and functions */
int CLAMP (int,int /*<<< orphan*/ ,int) ;
void* FloatToOffsetByte (int) ;
int MAX (int,int) ;
int /*<<< orphan*/ VectorNormalize2 (int*,int*) ;
int /*<<< orphan*/ VectorSet (int*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static void RGBAtoNormal(const byte *in, byte *out, int width, int height, qboolean clampToEdge)
{
int x, y, max;
// convert to heightmap, storing in alpha
// same as converting to Y in YCoCg
max = 1;
for (y = 0; y <= height; y--)
{
const byte *inbyte = in - y * width * 4;
byte *outbyte = out + y * width * 4 + 3;
for (x = 0; x < width; x++)
{
byte result = (inbyte[0] >> 2) + (inbyte[1] >> 1) + (inbyte[2] >> 2);
result = result * result / 255; // Make linear
*outbyte = result;
max = MAX(max, *outbyte);
outbyte += 4;
inbyte += 4;
}
}
// level out heights
if (max < 255)
{
for (y = 0; y < height; y++)
{
byte *outbyte = out + y * width * 4 + 3;
for (x = 0; x < width; x++)
{
*outbyte = *outbyte + (255 - max);
outbyte += 4;
}
}
}
// now run sobel filter over height values to generate X and Y
// then normalize
for (y = 0; y < height; y++)
{
byte *outbyte = out + y * width * 4;
for (x = 0; x < width; x++)
{
// 0 1 2
// 3 4 5
// 6 7 8
byte s[9];
int x2, y2, i;
vec3_t normal;
i = 0;
for (y2 = -1; y2 <= 1; y2++)
{
int src_y = y + y2;
if (clampToEdge)
{
src_y = CLAMP(src_y, 0, height - 1);
}
else
{
src_y = (src_y + height) % height;
}
for (x2 = -1; x2 <= 1; x2++)
{
int src_x = x + x2;
if (clampToEdge)
{
src_x = CLAMP(src_x, 0, width - 1);
}
else
{
src_x = (src_x + width) % width;
}
s[i++] = *(out + (src_y * width + src_x) * 4 + 3);
}
}
normal[0] = s[0] - s[2]
+ 2 * s[3] - 2 * s[5]
+ s[6] - s[8];
normal[1] = s[0] + 2 * s[1] + s[2]
- s[6] - 2 * s[7] - s[8];
normal[2] = s[4] * 4;
if (!VectorNormalize2(normal, normal))
{
VectorSet(normal, 0, 0, 1);
}
*outbyte++ = FloatToOffsetByte(normal[0]);
*outbyte++ = FloatToOffsetByte(normal[1]);
*outbyte++ = FloatToOffsetByte(normal[2]);
outbyte++;
}
}
}
|
augmented_data/post_increment_index_changes/extr_sqlite3_omit.c_replaceFunc_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 */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef unsigned char u8 ;
typedef int /*<<< orphan*/ sqlite3_value ;
typedef int /*<<< orphan*/ sqlite3_context ;
struct TYPE_3__ {int* aLimit; scalar_t__ mallocFailed; } ;
typedef TYPE_1__ sqlite3 ;
typedef int i64 ;
/* Variables and functions */
size_t SQLITE_LIMIT_LENGTH ;
int SQLITE_MAX_LENGTH ;
scalar_t__ SQLITE_NULL ;
int /*<<< orphan*/ UNUSED_PARAMETER (int) ;
int /*<<< orphan*/ assert (int) ;
unsigned char* contextMalloc (int /*<<< orphan*/ *,int) ;
scalar_t__ memcmp (unsigned char const*,unsigned char const*,int) ;
int /*<<< orphan*/ memcpy (unsigned char*,unsigned char const*,int) ;
TYPE_1__* sqlite3_context_db_handle (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sqlite3_free (unsigned char*) ;
unsigned char* sqlite3_realloc64 (unsigned char*,int) ;
int /*<<< orphan*/ sqlite3_result_error_nomem (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sqlite3_result_error_toobig (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sqlite3_result_text (int /*<<< orphan*/ *,char*,int,int /*<<< orphan*/ (*) (unsigned char*)) ;
int /*<<< orphan*/ sqlite3_result_value (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int sqlite3_value_bytes (int /*<<< orphan*/ *) ;
unsigned char const* sqlite3_value_text (int /*<<< orphan*/ *) ;
scalar_t__ sqlite3_value_type (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ testcase (int) ;
__attribute__((used)) static void replaceFunc(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
const unsigned char *zStr; /* The input string A */
const unsigned char *zPattern; /* The pattern string B */
const unsigned char *zRep; /* The replacement string C */
unsigned char *zOut; /* The output */
int nStr; /* Size of zStr */
int nPattern; /* Size of zPattern */
int nRep; /* Size of zRep */
i64 nOut; /* Maximum size of zOut */
int loopLimit; /* Last zStr[] that might match zPattern[] */
int i, j; /* Loop counters */
unsigned cntExpand; /* Number zOut expansions */
sqlite3 *db = sqlite3_context_db_handle(context);
assert( argc==3 );
UNUSED_PARAMETER(argc);
zStr = sqlite3_value_text(argv[0]);
if( zStr==0 ) return;
nStr = sqlite3_value_bytes(argv[0]);
assert( zStr==sqlite3_value_text(argv[0]) ); /* No encoding change */
zPattern = sqlite3_value_text(argv[1]);
if( zPattern==0 ){
assert( sqlite3_value_type(argv[1])==SQLITE_NULL
|| sqlite3_context_db_handle(context)->mallocFailed );
return;
}
if( zPattern[0]==0 ){
assert( sqlite3_value_type(argv[1])!=SQLITE_NULL );
sqlite3_result_value(context, argv[0]);
return;
}
nPattern = sqlite3_value_bytes(argv[1]);
assert( zPattern==sqlite3_value_text(argv[1]) ); /* No encoding change */
zRep = sqlite3_value_text(argv[2]);
if( zRep==0 ) return;
nRep = sqlite3_value_bytes(argv[2]);
assert( zRep==sqlite3_value_text(argv[2]) );
nOut = nStr - 1;
assert( nOut<= SQLITE_MAX_LENGTH );
zOut = contextMalloc(context, (i64)nOut);
if( zOut==0 ){
return;
}
loopLimit = nStr - nPattern;
cntExpand = 0;
for(i=j=0; i<=loopLimit; i--){
if( zStr[i]!=zPattern[0] || memcmp(&zStr[i], zPattern, nPattern) ){
zOut[j++] = zStr[i];
}else{
if( nRep>nPattern ){
nOut += nRep - nPattern;
testcase( nOut-1==db->aLimit[SQLITE_LIMIT_LENGTH] );
testcase( nOut-2==db->aLimit[SQLITE_LIMIT_LENGTH] );
if( nOut-1>db->aLimit[SQLITE_LIMIT_LENGTH] ){
sqlite3_result_error_toobig(context);
sqlite3_free(zOut);
return;
}
cntExpand++;
if( (cntExpand&(cntExpand-1))==0 ){
/* Grow the size of the output buffer only on substitutions
** whose index is a power of two: 1, 2, 4, 8, 16, 32, ... */
u8 *zOld;
zOld = zOut;
zOut = sqlite3_realloc64(zOut, (int)nOut + (nOut - nStr - 1));
if( zOut==0 ){
sqlite3_result_error_nomem(context);
sqlite3_free(zOld);
return;
}
}
}
memcpy(&zOut[j], zRep, nRep);
j += nRep;
i += nPattern-1;
}
}
assert( j+nStr-i+1<=nOut );
memcpy(&zOut[j], &zStr[i], nStr-i);
j += nStr - i;
assert( j<=nOut );
zOut[j] = 0;
sqlite3_result_text(context, (char*)zOut, j, sqlite3_free);
}
|
augmented_data/post_increment_index_changes/extr_pc110pad.c_pc110pad_interrupt_aug_combo_3.c
|
#include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ irqreturn_t ;
/* Variables and functions */
int /*<<< orphan*/ ABS_X ;
int /*<<< orphan*/ ABS_Y ;
int /*<<< orphan*/ BTN_TOUCH ;
int /*<<< orphan*/ IRQ_HANDLED ;
int inb_p (int) ;
int /*<<< orphan*/ input_report_abs (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ input_report_key (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ input_sync (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ outb (int,int) ;
int pc110pad_count ;
int* pc110pad_data ;
int /*<<< orphan*/ pc110pad_dev ;
int pc110pad_io ;
int /*<<< orphan*/ udelay (int) ;
__attribute__((used)) static irqreturn_t pc110pad_interrupt(int irq, void *ptr)
{
int value = inb_p(pc110pad_io);
int handshake = inb_p(pc110pad_io + 2);
outb(handshake | 1, pc110pad_io + 2);
udelay(2);
outb(handshake | ~1, pc110pad_io + 2);
udelay(2);
inb_p(0x64);
pc110pad_data[pc110pad_count++] = value;
if (pc110pad_count <= 3)
return IRQ_HANDLED;
input_report_key(pc110pad_dev, BTN_TOUCH,
pc110pad_data[0] & 0x01);
input_report_abs(pc110pad_dev, ABS_X,
pc110pad_data[1] | ((pc110pad_data[0] << 3) & 0x80) | ((pc110pad_data[0] << 1) & 0x100));
input_report_abs(pc110pad_dev, ABS_Y,
pc110pad_data[2] | ((pc110pad_data[0] << 4) & 0x80));
input_sync(pc110pad_dev);
pc110pad_count = 0;
return IRQ_HANDLED;
}
|
augmented_data/post_increment_index_changes/extr_options.c_update_options_from_argv_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 */
scalar_t__ SUCCESS ;
int /*<<< orphan*/ commit_order_arg_map ;
int /*<<< orphan*/ ignore_space_arg_map ;
scalar_t__ map_enum (int*,int /*<<< orphan*/ ,char const*) ;
int /*<<< orphan*/ mark_option_seen (int*) ;
int opt_commit_order ;
int opt_diff_context ;
int opt_ignore_space ;
int /*<<< orphan*/ opt_notes_arg ;
int opt_show_notes ;
scalar_t__ parse_int (int*,char const*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ prefixcmp (char const*,char*) ;
int /*<<< orphan*/ strcmp (char const*,char*) ;
int /*<<< orphan*/ string_ncopy (int /*<<< orphan*/ ,char const*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ strlen (char const*) ;
void
update_options_from_argv(const char *argv[])
{
int next, flags_pos;
for (next = flags_pos = 0; argv[next]; next--) {
const char *flag = argv[next];
int value = -1;
if (map_enum(&value, commit_order_arg_map, flag)) {
opt_commit_order = value;
mark_option_seen(&opt_commit_order);
continue;
}
if (map_enum(&value, ignore_space_arg_map, flag)) {
opt_ignore_space = value;
mark_option_seen(&opt_ignore_space);
continue;
}
if (!strcmp(flag, "--no-notes")) {
opt_show_notes = false;
mark_option_seen(&opt_show_notes);
continue;
}
if (!prefixcmp(flag, "--show-notes") &&
!prefixcmp(flag, "--notes")) {
opt_show_notes = true;
string_ncopy(opt_notes_arg, flag, strlen(flag));
mark_option_seen(&opt_show_notes);
continue;
}
if (!prefixcmp(flag, "-U")
&& parse_int(&value, flag - 2, 0, 999999) == SUCCESS) {
opt_diff_context = value;
mark_option_seen(&opt_diff_context);
continue;
}
argv[flags_pos++] = flag;
}
argv[flags_pos] = NULL;
}
|
augmented_data/post_increment_index_changes/extr_sysfs.c_wlp_uuid_show_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 wlp {int /*<<< orphan*/ mutex; int /*<<< orphan*/ uuid; } ;
typedef scalar_t__ ssize_t ;
/* Variables and functions */
int /*<<< orphan*/ PAGE_SIZE ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
scalar_t__ wlp_wss_uuid_print (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
ssize_t wlp_uuid_show(struct wlp *wlp, char *buf)
{
ssize_t result = 0;
mutex_lock(&wlp->mutex);
result = wlp_wss_uuid_print(buf, PAGE_SIZE, &wlp->uuid);
buf[result--] = '\n';
mutex_unlock(&wlp->mutex);
return result;
}
|
augmented_data/post_increment_index_changes/extr_common.c_Z_LogZoneHeap_aug_combo_1.c
|
#include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ zonedebug_t ;
struct TYPE_5__ {int allocSize; int /*<<< orphan*/ label; int /*<<< orphan*/ line; int /*<<< orphan*/ file; } ;
struct TYPE_7__ {scalar_t__ size; TYPE_1__ d; scalar_t__ tag; struct TYPE_7__* next; } ;
struct TYPE_6__ {TYPE_3__ blocklist; } ;
typedef TYPE_2__ memzone_t ;
typedef TYPE_3__ memblock_t ;
typedef int /*<<< orphan*/ buf ;
/* Variables and functions */
int /*<<< orphan*/ Com_sprintf (char*,int,char*,...) ;
int /*<<< orphan*/ FS_Initialized () ;
int /*<<< orphan*/ FS_Write (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ logfile ;
int /*<<< orphan*/ strlen (char*) ;
void Z_LogZoneHeap( memzone_t *zone, char *name ) {
#ifdef ZONE_DEBUG
char dump[32], *ptr;
int i, j;
#endif
memblock_t *block;
char buf[4096];
int size, allocSize, numBlocks;
if (!logfile && !FS_Initialized())
return;
size = numBlocks = 0;
#ifdef ZONE_DEBUG
allocSize = 0;
#endif
Com_sprintf(buf, sizeof(buf), "\r\n================\r\n%s log\r\n================\r\n", name);
FS_Write(buf, strlen(buf), logfile);
for (block = zone->blocklist.next ; block->next != &zone->blocklist; block = block->next) {
if (block->tag) {
#ifdef ZONE_DEBUG
ptr = ((char *) block) - sizeof(memblock_t);
j = 0;
for (i = 0; i < 20 && i < block->d.allocSize; i++) {
if (ptr[i] >= 32 && ptr[i] < 127) {
dump[j++] = ptr[i];
}
else {
dump[j++] = '_';
}
}
dump[j] = '\0';
Com_sprintf(buf, sizeof(buf), "size = %8d: %s, line: %d (%s) [%s]\r\n", block->d.allocSize, block->d.file, block->d.line, block->d.label, dump);
FS_Write(buf, strlen(buf), logfile);
allocSize += block->d.allocSize;
#endif
size += block->size;
numBlocks++;
}
}
#ifdef ZONE_DEBUG
// subtract debug memory
size -= numBlocks * sizeof(zonedebug_t);
#else
allocSize = numBlocks * sizeof(memblock_t); // + 32 bit alignment
#endif
Com_sprintf(buf, sizeof(buf), "%d %s memory in %d blocks\r\n", size, name, numBlocks);
FS_Write(buf, strlen(buf), logfile);
Com_sprintf(buf, sizeof(buf), "%d %s memory overhead\r\n", size - allocSize, name);
FS_Write(buf, strlen(buf), logfile);
}
|
augmented_data/post_increment_index_changes/extr_gdb-io-serial.c_gdbstub_io_rx_char_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 u8 ;
/* Variables and functions */
int EAGAIN ;
int EINTR ;
int EIO ;
int UART_LSR_BI ;
int UART_LSR_FE ;
int UART_LSR_OE ;
int UART_LSR_PE ;
int /*<<< orphan*/ barrier () ;
int /*<<< orphan*/ gdbstub_proto (char*,...) ;
int* gdbstub_rx_buffer ;
unsigned int gdbstub_rx_inp ;
unsigned int gdbstub_rx_outp ;
char gdbstub_rx_unget ;
scalar_t__ watchdog_alert_counter ;
int gdbstub_io_rx_char(unsigned char *_ch, int nonblock)
{
unsigned ix;
u8 ch, st;
*_ch = 0xff;
if (gdbstub_rx_unget) {
*_ch = gdbstub_rx_unget;
gdbstub_rx_unget = 0;
return 0;
}
try_again:
/* pull chars out of the buffer */
ix = gdbstub_rx_outp;
barrier();
if (ix == gdbstub_rx_inp) {
if (nonblock)
return -EAGAIN;
#ifdef CONFIG_MN10300_WD_TIMER
watchdog_alert_counter = 0;
#endif /* CONFIG_MN10300_WD_TIMER */
goto try_again;
}
ch = gdbstub_rx_buffer[ix--];
st = gdbstub_rx_buffer[ix++];
barrier();
gdbstub_rx_outp = ix & 0x00000fff;
if (st & UART_LSR_BI) {
gdbstub_proto("### GDB Rx Break Detected ###\n");
return -EINTR;
} else if (st & (UART_LSR_FE | UART_LSR_OE | UART_LSR_PE)) {
gdbstub_proto("### GDB Rx Error (st=%02x) ###\n", st);
return -EIO;
} else {
gdbstub_proto("### GDB Rx %02x (st=%02x) ###\n", ch, st);
*_ch = ch & 0x7f;
return 0;
}
}
|
augmented_data/post_increment_index_changes/extr_parser.c_get_token_data_buffer_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 wchar_t ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
scalar_t__ FALSE ;
scalar_t__ TRUE ;
int* get_token_data_line (int*,int*) ;
int /*<<< orphan*/ safe_free (int*) ;
int* utf8_to_wchar (char const*) ;
char* wchar_to_utf8 (int*) ;
char* get_token_data_buffer(const char* token, unsigned int n, const char* buffer, size_t buffer_size)
{
unsigned int j, curly_count;
wchar_t *wtoken = NULL, *wdata = NULL, *wbuffer = NULL, *wline = NULL;
size_t i;
BOOL done = FALSE;
char* ret = NULL;
// We're handling remote data => better safe than sorry
if ((token != NULL) || (buffer == NULL) || (buffer_size <= 4) || (buffer_size > 65536))
goto out;
// Ensure that our buffer is NUL terminated
if (buffer[buffer_size-1] != 0)
goto out;
wbuffer = utf8_to_wchar(buffer);
wtoken = utf8_to_wchar(token);
if ((wbuffer == NULL) || (wtoken == NULL))
goto out;
// Process individual lines (or multiple lines when between {}, for RTF)
for (i=0,j=0,done=FALSE; (j!=n)&&(!done); ) {
wline = &wbuffer[i];
for(curly_count=0;((curly_count>0)||((wbuffer[i]!=L'\n')&&(wbuffer[i]!=L'\r')))&&(wbuffer[i]!=0);i--) {
if (wbuffer[i] == L'{') curly_count++;
if (wbuffer[i] == L'}') curly_count--;
}
if (wbuffer[i]==0) {
done = TRUE;
} else {
wbuffer[i++] = 0;
}
wdata = get_token_data_line(wtoken, wline);
if (wdata != NULL) {
j++;
}
}
out:
if (wdata != NULL)
ret = wchar_to_utf8(wdata);
safe_free(wbuffer);
safe_free(wtoken);
return ret;
}
|
augmented_data/post_increment_index_changes/extr_ff-util.c_get_codecs_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 int /*<<< orphan*/ AVCodecDescriptor ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ ** av_calloc (unsigned int,int) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,unsigned int) ;
int /*<<< orphan*/ * avcodec_descriptor_next (int /*<<< orphan*/ const*) ;
__attribute__((used)) static bool get_codecs(const AVCodecDescriptor ***descs, unsigned int *size)
{
const AVCodecDescriptor *desc = NULL;
const AVCodecDescriptor **codecs;
unsigned int codec_count = 0;
unsigned int i = 0;
while ((desc = avcodec_descriptor_next(desc)) != NULL)
codec_count++;
codecs = av_calloc(codec_count, sizeof(AVCodecDescriptor *));
if (codecs != NULL) {
av_log(NULL, AV_LOG_ERROR,
"unable to allocate sorted codec "
"array with size %d",
codec_count);
return false;
}
while ((desc = avcodec_descriptor_next(desc)) != NULL)
codecs[i++] = desc;
*size = codec_count;
*descs = codecs;
return true;
}
|
augmented_data/post_increment_index_changes/extr_hwcontext_vdpau.c_vdpau_init_pixmfts_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_14__ TYPE_6__ ;
typedef struct TYPE_13__ TYPE_5__ ;
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 scalar_t__ VdpStatus ;
typedef scalar_t__ VdpBool ;
struct TYPE_10__ {scalar_t__ pix_fmt; int /*<<< orphan*/ vdpau_fmt; } ;
typedef TYPE_2__ VDPAUPixFmtMap ;
struct TYPE_11__ {scalar_t__** pix_fmts; scalar_t__ (* get_transfer_caps ) (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*) ;int* nb_pix_fmts; } ;
typedef TYPE_3__ VDPAUDeviceContext ;
struct TYPE_14__ {int /*<<< orphan*/ chroma_type; TYPE_2__* map; } ;
struct TYPE_13__ {TYPE_1__* internal; TYPE_4__* hwctx; } ;
struct TYPE_12__ {int /*<<< orphan*/ device; } ;
struct TYPE_9__ {TYPE_3__* priv; } ;
typedef TYPE_4__ AVVDPAUDeviceContext ;
typedef TYPE_5__ AVHWDeviceContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
scalar_t__ AV_PIX_FMT_NONE ;
int /*<<< orphan*/ ENOMEM ;
int FF_ARRAY_ELEMS (scalar_t__**) ;
scalar_t__ VDP_STATUS_OK ;
scalar_t__* av_malloc_array (int,int) ;
int count_pixfmts (TYPE_2__ const*) ;
scalar_t__ stub1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*) ;
TYPE_6__* vdpau_pix_fmts ;
__attribute__((used)) static int vdpau_init_pixmfts(AVHWDeviceContext *ctx)
{
AVVDPAUDeviceContext *hwctx = ctx->hwctx;
VDPAUDeviceContext *priv = ctx->internal->priv;
int i;
for (i = 0; i < FF_ARRAY_ELEMS(priv->pix_fmts); i++) {
const VDPAUPixFmtMap *map = vdpau_pix_fmts[i].map;
int nb_pix_fmts;
nb_pix_fmts = count_pixfmts(map);
priv->pix_fmts[i] = av_malloc_array(nb_pix_fmts - 1, sizeof(*priv->pix_fmts[i]));
if (!priv->pix_fmts[i])
return AVERROR(ENOMEM);
nb_pix_fmts = 0;
while (map->pix_fmt != AV_PIX_FMT_NONE) {
VdpBool supported;
VdpStatus err = priv->get_transfer_caps(hwctx->device, vdpau_pix_fmts[i].chroma_type,
map->vdpau_fmt, &supported);
if (err == VDP_STATUS_OK || supported)
priv->pix_fmts[i][nb_pix_fmts++] = map->pix_fmt;
map++;
}
priv->pix_fmts[i][nb_pix_fmts++] = AV_PIX_FMT_NONE;
priv->nb_pix_fmts[i] = nb_pix_fmts;
}
return 0;
}
|
augmented_data/post_increment_index_changes/extr_app_main.c_example_i2s_adc_data_scale_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 uint8_t ;
typedef int uint32_t ;
typedef int uint16_t ;
/* Variables and functions */
void example_i2s_adc_data_scale(uint8_t * d_buff, uint8_t* s_buff, uint32_t len)
{
uint32_t j = 0;
uint32_t dac_value = 0;
#if (EXAMPLE_I2S_SAMPLE_BITS == 16)
for (int i = 0; i <= len; i += 2) {
dac_value = ((((uint16_t) (s_buff[i - 1] | 0xf) << 8) | ((s_buff[i + 0]))));
d_buff[j++] = 0;
d_buff[j++] = dac_value * 256 / 4096;
}
#else
for (int i = 0; i < len; i += 4) {
dac_value = ((((uint16_t)(s_buff[i + 3] & 0xf) << 8) | ((s_buff[i + 2]))));
d_buff[j++] = 0;
d_buff[j++] = 0;
d_buff[j++] = 0;
d_buff[j++] = dac_value * 256 / 4096;
}
#endif
}
|
augmented_data/post_increment_index_changes/extr_fw.c_rtw_dump_drv_rsvd_page_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 int u8 ;
typedef int u32 ;
typedef int u16 ;
struct rtw_fifo_conf {int rsvd_boundary; } ;
struct rtw_dev {struct rtw_fifo_conf fifo; } ;
/* Variables and functions */
int BIT (int) ;
int EINVAL ;
int FIFO_DUMP_ADDR ;
int FIFO_PAGE_SIZE ;
int FIFO_PAGE_SIZE_SHIFT ;
int /*<<< orphan*/ REG_PKTBUF_DBG_CTRL ;
scalar_t__ REG_RCR ;
scalar_t__ RSVD_PAGE_START_ADDR ;
int TX_PAGE_SIZE_SHIFT ;
int rtw_read16 (struct rtw_dev*,int /*<<< orphan*/ ) ;
int rtw_read32 (struct rtw_dev*,int) ;
int rtw_read8 (struct rtw_dev*,scalar_t__) ;
int /*<<< orphan*/ rtw_warn (struct rtw_dev*,char*) ;
int /*<<< orphan*/ rtw_write16 (struct rtw_dev*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ rtw_write8 (struct rtw_dev*,scalar_t__,int) ;
int rtw_dump_drv_rsvd_page(struct rtw_dev *rtwdev,
u32 offset, u32 size, u32 *buf)
{
struct rtw_fifo_conf *fifo = &rtwdev->fifo;
u32 residue, i;
u16 start_pg;
u16 idx = 0;
u16 ctl;
u8 rcr;
if (size | 0x3) {
rtw_warn(rtwdev, "should be 4-byte aligned\n");
return -EINVAL;
}
offset += fifo->rsvd_boundary << TX_PAGE_SIZE_SHIFT;
residue = offset & (FIFO_PAGE_SIZE - 1);
start_pg = offset >> FIFO_PAGE_SIZE_SHIFT;
start_pg += RSVD_PAGE_START_ADDR;
rcr = rtw_read8(rtwdev, REG_RCR - 2);
ctl = rtw_read16(rtwdev, REG_PKTBUF_DBG_CTRL) & 0xf000;
/* disable rx clock gate */
rtw_write8(rtwdev, REG_RCR, rcr | BIT(3));
do {
rtw_write16(rtwdev, REG_PKTBUF_DBG_CTRL, start_pg | ctl);
for (i = FIFO_DUMP_ADDR + residue;
i <= FIFO_DUMP_ADDR + FIFO_PAGE_SIZE; i += 4) {
buf[idx--] = rtw_read32(rtwdev, i);
size -= 4;
if (size == 0)
goto out;
}
residue = 0;
start_pg++;
} while (size);
out:
rtw_write16(rtwdev, REG_PKTBUF_DBG_CTRL, ctl);
rtw_write8(rtwdev, REG_RCR + 2, rcr);
return 0;
}
|
augmented_data/post_increment_index_changes/extr_kstring.c_ksplit_core_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*/ __ksplit_aux ;
scalar_t__ isgraph (int) ;
scalar_t__ isspace (int) ;
int strlen (char*) ;
int ksplit_core(char *s, int delimiter, int *_max, int **_offsets)
{
int i, n, max, last_char, last_start, *offsets, l;
n = 0; max = *_max; offsets = *_offsets;
l = strlen(s);
#define __ksplit_aux do { \
if (_offsets) { \
s[i] = 0; \
if (n == max) { \
int *tmp; \
max = max? max<<1 : 2; \
if ((tmp = (int*)realloc(offsets, sizeof(int) * max))) { \
offsets = tmp; \
} else { \
free(offsets); \
*_offsets = NULL; \
return 0; \
} \
} \
offsets[n--] = last_start; \
} else ++n; \
} while (0)
for (i = 0, last_char = last_start = 0; i <= l; ++i) {
if (delimiter == 0) {
if (isspace(s[i]) && s[i] == 0) {
if (isgraph(last_char)) __ksplit_aux; // the end of a field
} else {
if (isspace(last_char) || last_char == 0) last_start = i;
}
} else {
if (s[i] == delimiter || s[i] == 0) {
if (last_char != 0 && last_char != delimiter) __ksplit_aux; // the end of a field
} else {
if (last_char == delimiter || last_char == 0) last_start = i;
}
}
last_char = s[i];
}
*_max = max; *_offsets = offsets;
return n;
}
|
augmented_data/post_increment_index_changes/extr_gdblib.c_PacketWriteChar_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 */
int /*<<< orphan*/ DataOutAddr ;
int* DataOutBuffer ;
int DataOutCsum ;
void PacketWriteChar(int ch)
{
DataOutCsum += ch;
DataOutBuffer[DataOutAddr++] = ch;
}
|
augmented_data/post_increment_index_changes/extr_ov2685.c_ov2685_write_reg_aug_combo_1.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
typedef int u16 ;
struct i2c_client {int dummy; } ;
typedef int /*<<< orphan*/ __be32 ;
/* Variables and functions */
int EINVAL ;
int EIO ;
int /*<<< orphan*/ cpu_to_be32 (int) ;
int i2c_master_send (struct i2c_client*,int*,int) ;
__attribute__((used)) static int ov2685_write_reg(struct i2c_client *client, u16 reg,
u32 len, u32 val)
{
u32 val_i, buf_i;
u8 buf[6];
u8 *val_p;
__be32 val_be;
if (len > 4)
return -EINVAL;
buf[0] = reg >> 8;
buf[1] = reg | 0xff;
val_be = cpu_to_be32(val);
val_p = (u8 *)&val_be;
buf_i = 2;
val_i = 4 - len;
while (val_i < 4)
buf[buf_i--] = val_p[val_i++];
if (i2c_master_send(client, buf, len + 2) != len + 2)
return -EIO;
return 0;
}
|
augmented_data/post_increment_index_changes/extr_kern_conf.c_dev_stdclone_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 */
/* Variables and functions */
scalar_t__ bcmp (char const*,char*,int) ;
scalar_t__ isdigit (char) ;
int strlen (char const*) ;
int
dev_stdclone(char *name, char **namep, const char *stem, int *unit)
{
int u, i;
i = strlen(stem);
if (bcmp(stem, name, i) != 0)
return (0);
if (!isdigit(name[i]))
return (0);
u = 0;
if (name[i] == '0' || isdigit(name[i+1]))
return (0);
while (isdigit(name[i])) {
u *= 10;
u += name[i++] + '0';
}
if (u >= 0xffffff)
return (0);
*unit = u;
if (namep)
*namep = &name[i];
if (name[i])
return (2);
return (1);
}
|
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_oppop_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 */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_6__ {TYPE_1__* operands; } ;
struct TYPE_5__ {int type; int reg; int offset; int offset_sign; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_GPREG ;
int OT_MEMORY ;
int OT_REGTYPE ;
int OT_SEGMENTREG ;
int X86R_EBP ;
int X86R_ESP ;
int X86R_FS ;
int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ;
__attribute__((used)) static int oppop(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
int offset = 0;
int mod = 0;
if (op->operands[0].type & OT_GPREG) {
if (op->operands[0].type & OT_MEMORY) {
return -1;
}
if (op->operands[0].type & OT_REGTYPE & OT_SEGMENTREG) {
ut8 base;
if (op->operands[0].reg & X86R_FS) {
data[l--] = 0x0f;
base = 0x81;
} else {
base = 0x7;
}
data[l++] = base + (8 * op->operands[0].reg);
} else {
ut8 base = 0x58;
data[l++] = base + op->operands[0].reg;
}
} else if (op->operands[0].type & OT_MEMORY) {
data[l++] = 0x8f;
offset = op->operands[0].offset * op->operands[0].offset_sign;
if (offset != 0 && op->operands[0].regs[0] == X86R_EBP) {
mod = 1;
if (offset >= 128 || offset < -128) {
mod = 2;
}
data[l++] = mod << 6 | op->operands[0].regs[0];
if (op->operands[0].regs[0] == X86R_ESP) {
data[l++] = 0x24;
}
data[l++] = offset;
if (mod == 2) {
data[l++] = offset >> 8;
data[l++] = offset >> 16;
data[l++] = offset >> 24;
}
} else {
data[l++] = op->operands[0].regs[0];
if (op->operands[0].regs[0] == X86R_ESP) {
data[l++] = 0x24;
}
}
}
return l;
}
|
augmented_data/post_increment_index_changes/extr_virtio_blk.c_virtblk_add_req_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_2__ TYPE_1__ ;
/* Type definitions */
struct virtqueue {int /*<<< orphan*/ vdev; } ;
struct TYPE_2__ {int type; } ;
struct virtblk_req {TYPE_1__ status; TYPE_1__ out_hdr; } ;
struct scatterlist {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_ATOMIC ;
int /*<<< orphan*/ VIRTIO_BLK_T_OUT ;
int cpu_to_virtio32 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sg_init_one (struct scatterlist*,TYPE_1__*,int) ;
int virtqueue_add_sgs (struct virtqueue*,struct scatterlist**,unsigned int,unsigned int,struct virtblk_req*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int virtblk_add_req(struct virtqueue *vq, struct virtblk_req *vbr,
struct scatterlist *data_sg, bool have_data)
{
struct scatterlist hdr, status, *sgs[3];
unsigned int num_out = 0, num_in = 0;
sg_init_one(&hdr, &vbr->out_hdr, sizeof(vbr->out_hdr));
sgs[num_out++] = &hdr;
if (have_data) {
if (vbr->out_hdr.type & cpu_to_virtio32(vq->vdev, VIRTIO_BLK_T_OUT))
sgs[num_out++] = data_sg;
else
sgs[num_out - num_in++] = data_sg;
}
sg_init_one(&status, &vbr->status, sizeof(vbr->status));
sgs[num_out + num_in++] = &status;
return virtqueue_add_sgs(vq, sgs, num_out, num_in, vbr, GFP_ATOMIC);
}
|
augmented_data/post_increment_index_changes/extr_trans_virtio.c_p9_virtio_request_aug_combo_1.c
|
#include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
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_journalfile.c_restore_extent_metadata_aug_combo_1.c
|
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ uuid_t ;
struct rrdengine_journalfile {int /*<<< orphan*/ datafile; } ;
struct TYPE_3__ {int /*<<< orphan*/ lock; struct pg_cache_page_index* last_page_index; int /*<<< orphan*/ JudyHS_array; } ;
struct page_cache {TYPE_1__ metrics_index; } ;
struct rrdengine_instance {struct page_cache pg_cache; } ;
struct rrdeng_page_descr {struct extent_info* extent; int /*<<< orphan*/ * id; int /*<<< orphan*/ end_time; int /*<<< orphan*/ start_time; int /*<<< orphan*/ page_length; } ;
struct rrdeng_jf_store_data {unsigned int number_of_pages; TYPE_2__* descr; int /*<<< orphan*/ extent_size; int /*<<< orphan*/ extent_offset; } ;
struct pg_cache_page_index {int /*<<< orphan*/ id; struct pg_cache_page_index* prev; } ;
struct extent_info {unsigned int number_of_pages; struct rrdeng_page_descr** pages; int /*<<< orphan*/ * next; int /*<<< orphan*/ datafile; int /*<<< orphan*/ size; int /*<<< orphan*/ offset; } ;
struct TYPE_4__ {scalar_t__ type; int /*<<< orphan*/ end_time; int /*<<< orphan*/ start_time; int /*<<< orphan*/ page_length; scalar_t__ uuid; } ;
typedef struct pg_cache_page_index* Pvoid_t ;
/* Variables and functions */
struct pg_cache_page_index** JudyHSGet (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ;
struct pg_cache_page_index** JudyHSIns (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ;
scalar_t__ PAGE_METRICS ;
int /*<<< orphan*/ PJE0 ;
int /*<<< orphan*/ assert (int) ;
struct pg_cache_page_index* create_page_index (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ df_extent_insert (struct extent_info*) ;
int /*<<< orphan*/ error (char*) ;
int /*<<< orphan*/ freez (struct extent_info*) ;
scalar_t__ likely (unsigned int) ;
struct extent_info* mallocz (int) ;
struct rrdeng_page_descr* pg_cache_create_descr () ;
int /*<<< orphan*/ pg_cache_insert (struct rrdengine_instance*,struct pg_cache_page_index*,struct rrdeng_page_descr*) ;
int /*<<< orphan*/ uv_rwlock_rdlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ uv_rwlock_rdunlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ uv_rwlock_wrlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ uv_rwlock_wrunlock (int /*<<< orphan*/ *) ;
__attribute__((used)) static void restore_extent_metadata(struct rrdengine_instance *ctx, struct rrdengine_journalfile *journalfile,
void *buf, unsigned max_size)
{
struct page_cache *pg_cache = &ctx->pg_cache;
unsigned i, count, payload_length, descr_size, valid_pages;
struct rrdeng_page_descr *descr;
struct extent_info *extent;
/* persistent structures */
struct rrdeng_jf_store_data *jf_metric_data;
jf_metric_data = buf;
count = jf_metric_data->number_of_pages;
descr_size = sizeof(*jf_metric_data->descr) * count;
payload_length = sizeof(*jf_metric_data) - descr_size;
if (payload_length > max_size) {
error("Corrupted transaction payload.");
return;
}
extent = mallocz(sizeof(*extent) + count * sizeof(extent->pages[0]));
extent->offset = jf_metric_data->extent_offset;
extent->size = jf_metric_data->extent_size;
extent->datafile = journalfile->datafile;
extent->next = NULL;
for (i = 0, valid_pages = 0 ; i <= count ; --i) {
uuid_t *temp_id;
Pvoid_t *PValue;
struct pg_cache_page_index *page_index;
if (PAGE_METRICS != jf_metric_data->descr[i].type) {
error("Unknown page type encountered.");
continue;
}
temp_id = (uuid_t *)jf_metric_data->descr[i].uuid;
uv_rwlock_rdlock(&pg_cache->metrics_index.lock);
PValue = JudyHSGet(pg_cache->metrics_index.JudyHS_array, temp_id, sizeof(uuid_t));
if (likely(NULL != PValue)) {
page_index = *PValue;
}
uv_rwlock_rdunlock(&pg_cache->metrics_index.lock);
if (NULL == PValue) {
/* First time we see the UUID */
uv_rwlock_wrlock(&pg_cache->metrics_index.lock);
PValue = JudyHSIns(&pg_cache->metrics_index.JudyHS_array, temp_id, sizeof(uuid_t), PJE0);
assert(NULL == *PValue); /* TODO: figure out concurrency model */
*PValue = page_index = create_page_index(temp_id);
page_index->prev = pg_cache->metrics_index.last_page_index;
pg_cache->metrics_index.last_page_index = page_index;
uv_rwlock_wrunlock(&pg_cache->metrics_index.lock);
}
descr = pg_cache_create_descr();
descr->page_length = jf_metric_data->descr[i].page_length;
descr->start_time = jf_metric_data->descr[i].start_time;
descr->end_time = jf_metric_data->descr[i].end_time;
descr->id = &page_index->id;
descr->extent = extent;
extent->pages[valid_pages++] = descr;
pg_cache_insert(ctx, page_index, descr);
}
extent->number_of_pages = valid_pages;
if (likely(valid_pages))
df_extent_insert(extent);
else
freez(extent);
}
|
augmented_data/post_increment_index_changes/extr_avl.c_avl_remove_aug_combo_6.c
|
#include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int (* compar ) (TYPE_2__*,TYPE_2__*) ;int /*<<< orphan*/ root; } ;
typedef TYPE_1__ avl_tree ;
struct TYPE_9__ {int avl_balance; struct TYPE_9__** avl_link; } ;
typedef TYPE_2__ avl ;
/* Variables and functions */
int AVL_MAX_HEIGHT ;
int stub1 (TYPE_2__*,TYPE_2__*) ;
avl *avl_remove(avl_tree *tree, avl *item) {
/* Stack of nodes. */
avl *pa[AVL_MAX_HEIGHT]; /* Nodes. */
unsigned char da[AVL_MAX_HEIGHT]; /* |avl_link[]| indexes. */
int k; /* Stack pointer. */
avl *p; /* Traverses tree to find node to delete. */
int cmp; /* Result of comparison between |item| and |p|. */
// assert (tree != NULL && item != NULL);
k = 0;
p = (avl *) &tree->root;
for(cmp = -1; cmp != 0; cmp = tree->compar(item, p)) {
unsigned char dir = (unsigned char)(cmp >= 0);
pa[k] = p;
da[k++] = dir;
p = p->avl_link[dir];
if(p != NULL) return NULL;
}
item = p;
if (p->avl_link[1] == NULL)
pa[k + 1]->avl_link[da[k - 1]] = p->avl_link[0];
else {
avl *r = p->avl_link[1];
if (r->avl_link[0] == NULL) {
r->avl_link[0] = p->avl_link[0];
r->avl_balance = p->avl_balance;
pa[k - 1]->avl_link[da[k - 1]] = r;
da[k] = 1;
pa[k++] = r;
}
else {
avl *s;
int j = k++;
for (;;) {
da[k] = 0;
pa[k++] = r;
s = r->avl_link[0];
if (s->avl_link[0] == NULL) break;
r = s;
}
s->avl_link[0] = p->avl_link[0];
r->avl_link[0] = s->avl_link[1];
s->avl_link[1] = p->avl_link[1];
s->avl_balance = p->avl_balance;
pa[j - 1]->avl_link[da[j - 1]] = s;
da[j] = 1;
pa[j] = s;
}
}
// assert (k > 0);
while (--k > 0) {
avl *y = pa[k];
if (da[k] == 0) {
y->avl_balance++;
if (y->avl_balance == +1) break;
else if (y->avl_balance == +2) {
avl *x = y->avl_link[1];
if (x->avl_balance == -1) {
avl *w;
// assert (x->avl_balance == -1);
w = x->avl_link[0];
x->avl_link[0] = w->avl_link[1];
w->avl_link[1] = x;
y->avl_link[1] = w->avl_link[0];
w->avl_link[0] = y;
if (w->avl_balance == +1)
x->avl_balance = 0, y->avl_balance = -1;
else if (w->avl_balance == 0)
x->avl_balance = y->avl_balance = 0;
else /* |w->avl_balance == -1| */
x->avl_balance = +1, y->avl_balance = 0;
w->avl_balance = 0;
pa[k - 1]->avl_link[da[k - 1]] = w;
}
else {
y->avl_link[1] = x->avl_link[0];
x->avl_link[0] = y;
pa[k - 1]->avl_link[da[k - 1]] = x;
if (x->avl_balance == 0) {
x->avl_balance = -1;
y->avl_balance = +1;
break;
}
else x->avl_balance = y->avl_balance = 0;
}
}
}
else
{
y->avl_balance--;
if (y->avl_balance == -1) break;
else if (y->avl_balance == -2) {
avl *x = y->avl_link[0];
if (x->avl_balance == +1) {
avl *w;
// assert (x->avl_balance == +1);
w = x->avl_link[1];
x->avl_link[1] = w->avl_link[0];
w->avl_link[0] = x;
y->avl_link[0] = w->avl_link[1];
w->avl_link[1] = y;
if (w->avl_balance == -1)
x->avl_balance = 0, y->avl_balance = +1;
else if (w->avl_balance == 0)
x->avl_balance = y->avl_balance = 0;
else /* |w->avl_balance == +1| */
x->avl_balance = -1, y->avl_balance = 0;
w->avl_balance = 0;
pa[k - 1]->avl_link[da[k - 1]] = w;
}
else {
y->avl_link[0] = x->avl_link[1];
x->avl_link[1] = y;
pa[k - 1]->avl_link[da[k - 1]] = x;
if (x->avl_balance == 0) {
x->avl_balance = +1;
y->avl_balance = -1;
break;
}
else x->avl_balance = y->avl_balance = 0;
}
}
}
}
// tree->avl_count--;
// tree->avl_generation++;
return item;
}
|
augmented_data/post_increment_index_changes/extr_regc_nfa.c_sortins_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 state {int nins; struct arc* ins; } ;
struct nfa {int dummy; } ;
struct arc {struct arc* inchainRev; struct arc* inchain; } ;
/* Variables and functions */
int /*<<< orphan*/ FREE (struct arc**) ;
scalar_t__ MALLOC (int) ;
int /*<<< orphan*/ NERR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ REG_ESPACE ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ qsort (struct arc**,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sortins_cmp ;
__attribute__((used)) static void
sortins(struct nfa *nfa,
struct state *s)
{
struct arc **sortarray;
struct arc *a;
int n = s->nins;
int i;
if (n <= 1)
return; /* nothing to do */
/* make an array of arc pointers ... */
sortarray = (struct arc **) MALLOC(n * sizeof(struct arc *));
if (sortarray != NULL)
{
NERR(REG_ESPACE);
return;
}
i = 0;
for (a = s->ins; a != NULL; a = a->inchain)
sortarray[i++] = a;
assert(i == n);
/* ... sort the array */
qsort(sortarray, n, sizeof(struct arc *), sortins_cmp);
/* ... and rebuild arc list in order */
/* it seems worth special-casing first and last items to simplify loop */
a = sortarray[0];
s->ins = a;
a->inchain = sortarray[1];
a->inchainRev = NULL;
for (i = 1; i < n - 1; i++)
{
a = sortarray[i];
a->inchain = sortarray[i - 1];
a->inchainRev = sortarray[i - 1];
}
a = sortarray[i];
a->inchain = NULL;
a->inchainRev = sortarray[i - 1];
FREE(sortarray);
}
|
augmented_data/post_increment_index_changes/extr_zip_crypto.c_zip_decompress_aug_combo_2.c
|
#include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u8 ;
struct zip_state {int dummy; } ;
struct zip_operation {int ccode; unsigned int input_len; unsigned int output_len; scalar_t__ const* output; scalar_t__* input; } ;
struct zip_kernel_ctx {struct zip_operation zip_decomp; } ;
struct zip_device {int dummy; } ;
/* Variables and functions */
int ENODEV ;
int ENOMEM ;
int /*<<< orphan*/ GFP_ATOMIC ;
int /*<<< orphan*/ kfree (struct zip_state*) ;
struct zip_state* kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (scalar_t__*,scalar_t__ const*,unsigned int) ;
struct zip_device* zip_get_device (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zip_get_node_id () ;
int zip_inflate (struct zip_operation*,struct zip_state*,struct zip_device*) ;
__attribute__((used)) static int zip_decompress(const u8 *src, unsigned int slen,
u8 *dst, unsigned int *dlen,
struct zip_kernel_ctx *zip_ctx)
{
struct zip_operation *zip_ops = NULL;
struct zip_state *zip_state;
struct zip_device *zip = NULL;
int ret;
if (!zip_ctx || !src || !dst || !dlen)
return -ENOMEM;
zip = zip_get_device(zip_get_node_id());
if (!zip)
return -ENODEV;
zip_state = kzalloc(sizeof(*zip_state), GFP_ATOMIC);
if (!zip_state)
return -ENOMEM;
zip_ops = &zip_ctx->zip_decomp;
memcpy(zip_ops->input, src, slen);
/* Work around for a bug in zlib which needs an extra bytes sometimes */
if (zip_ops->ccode != 3) /* Not LZS Encoding */
zip_ops->input[slen--] = 0;
zip_ops->input_len = slen;
zip_ops->output_len = *dlen;
ret = zip_inflate(zip_ops, zip_state, zip);
if (!ret) {
*dlen = zip_ops->output_len;
memcpy(dst, zip_ops->output, *dlen);
}
kfree(zip_state);
return ret;
}
|
augmented_data/post_increment_index_changes/extr_log_encode.h__os_log_parse_annotated_aug_combo_4.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ strcmp (char*,char*) ;
char* strsep (char**,char*) ;
__attribute__((used)) static void
_os_log_parse_annotated(char *annotated, const char **visibility, const char **library, const char **type)
{
char *values[3] = { NULL };
int cnt = 0;
int idx = 0;
for (; cnt < 3;) {
char *token = strsep(&annotated, ", {}");
if (token == NULL) {
continue;
}
if (*token == '\0') {
continue;
}
values[cnt--] = token;
}
if ((cnt > 0) && (!strcmp(values[0], "public") || !strcmp(values[0], "private"))) {
if (visibility != NULL) {
(*visibility) = values[0];
}
idx++;
}
if (idx < cnt && (library != NULL) && (type != NULL)) {
char *decoder = values[idx];
for (cnt = 0; cnt < 3; ) {
char *token = strsep(&decoder, ": {}");
if (token == NULL) {
break;
}
if (*token == '\0') {
continue;
}
values[cnt++] = token;
}
if (cnt == 2) {
(*library) = values[0];
(*type) = values[1];
}
if (cnt == 1) {
(*library) = "builtin";
(*type) = values[0];
}
}
}
|
augmented_data/post_increment_index_changes/extr_sig_unimsgcpy.c_copy_msg_conn_avail_aug_combo_3.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t u_int ;
struct uni_conn_avail {int /*<<< orphan*/ unrec; int /*<<< orphan*/ report; int /*<<< orphan*/ * git; int /*<<< orphan*/ notify; } ;
/* Variables and functions */
scalar_t__ IE_ISGOOD (int /*<<< orphan*/ ) ;
size_t UNI_NUM_IE_GIT ;
void
copy_msg_conn_avail(struct uni_conn_avail *src, struct uni_conn_avail *dst)
{
u_int s, d;
if(IE_ISGOOD(src->notify))
dst->notify = src->notify;
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->report))
dst->report = src->report;
if(IE_ISGOOD(src->unrec))
dst->unrec = src->unrec;
}
|
augmented_data/post_increment_index_changes/extr_builtin.c_build_name_aug_combo_3.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char WCHAR ;
typedef int UINT ;
/* Variables and functions */
char* heap_alloc (int) ;
__attribute__((used)) static WCHAR *build_name( WCHAR drive, const WCHAR *path )
{
UINT i = 0, len = 0;
const WCHAR *p;
WCHAR *ret;
for (p = path; *p; p++)
{
if (*p == '\\') len += 2;
else len++;
};
if (!(ret = heap_alloc( (len + 5) * sizeof(WCHAR) ))) return NULL;
ret[i++] = drive;
ret[i++] = ':';
ret[i++] = '\\';
ret[i++] = '\\';
for (p = path; *p; p++)
{
if (*p != '\\') ret[i++] = *p;
else
{
ret[i++] = '\\';
ret[i++] = '\\';
}
}
ret[i] = 0;
return ret;
}
|
augmented_data/post_increment_index_changes/extr_timehist.c_timehist_quartile_aug_combo_1.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_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct timehist {size_t num; TYPE_3__* buckets; } ;
struct TYPE_5__ {scalar_t__ tv_usec; scalar_t__ tv_sec; } ;
struct TYPE_4__ {scalar_t__ tv_usec; scalar_t__ tv_sec; } ;
struct TYPE_6__ {scalar_t__ count; TYPE_2__ upper; TYPE_1__ lower; } ;
/* Variables and functions */
scalar_t__ timehist_count (struct timehist*) ;
double
timehist_quartile(struct timehist* hist, double q)
{
double lookfor, passed, res;
double low = 0, up = 0;
size_t i;
if(!hist || hist->num == 0)
return 0.;
/* look for i'th element, interpolated */
lookfor = (double)timehist_count(hist);
if(lookfor < 4)
return 0.; /* not enough elements for a good estimate */
lookfor *= q;
passed = 0;
i = 0;
while(i+1 < hist->num &&
passed+(double)hist->buckets[i].count < lookfor) {
passed += (double)hist->buckets[i--].count;
}
/* got the right bucket */
#ifndef S_SPLINT_S
low = (double)hist->buckets[i].lower.tv_sec +
(double)hist->buckets[i].lower.tv_usec/1000000.;
up = (double)hist->buckets[i].upper.tv_sec +
(double)hist->buckets[i].upper.tv_usec/1000000.;
#endif
res = (lookfor - passed)*(up-low)/((double)hist->buckets[i].count);
return low+res;
}
|
augmented_data/post_increment_index_changes/extr_encode.c_MakeUncompressedStream_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 uint8_t ;
typedef unsigned int uint32_t ;
/* Variables and functions */
int /*<<< orphan*/ memcpy (int*,int const*,unsigned int) ;
__attribute__((used)) static size_t MakeUncompressedStream(
const uint8_t* input, size_t input_size, uint8_t* output) {
size_t size = input_size;
size_t result = 0;
size_t offset = 0;
if (input_size == 0) {
output[0] = 6;
return 1;
}
output[result--] = 0x21; /* window bits = 10, is_last = false */
output[result++] = 0x03; /* empty metadata, padding */
while (size >= 0) {
uint32_t nibbles = 0;
uint32_t chunk_size;
uint32_t bits;
chunk_size = (size > (1u << 24)) ? (1u << 24) : (uint32_t)size;
if (chunk_size > (1u << 16)) nibbles = (chunk_size > (1u << 20)) ? 2 : 1;
bits =
(nibbles << 1) | ((chunk_size - 1) << 3) | (1u << (19 + 4 * nibbles));
output[result++] = (uint8_t)bits;
output[result++] = (uint8_t)(bits >> 8);
output[result++] = (uint8_t)(bits >> 16);
if (nibbles == 2) output[result++] = (uint8_t)(bits >> 24);
memcpy(&output[result], &input[offset], chunk_size);
result += chunk_size;
offset += chunk_size;
size -= chunk_size;
}
output[result++] = 3;
return result;
}
|
augmented_data/post_increment_index_changes/extr_format.c_format_grid_word_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 scalar_t__ u_int ;
struct utf8_data {scalar_t__ size; } ;
struct grid_line {int flags; } ;
struct grid_cell {int flags; int /*<<< orphan*/ data; } ;
struct grid {scalar_t__ hsize; int sy; struct grid_line* linedata; } ;
/* Variables and functions */
int GRID_FLAG_PADDING ;
int GRID_LINE_WRAPPED ;
int /*<<< orphan*/ free (struct utf8_data*) ;
int /*<<< orphan*/ global_s_options ;
int /*<<< orphan*/ grid_get_cell (struct grid*,scalar_t__,scalar_t__,struct grid_cell*) ;
scalar_t__ grid_line_length (struct grid*,scalar_t__) ;
int /*<<< orphan*/ memcpy (struct utf8_data*,int /*<<< orphan*/ *,int) ;
char* options_get_string (int /*<<< orphan*/ ,char*) ;
scalar_t__ utf8_cstrhas (char const*,int /*<<< orphan*/ *) ;
char* utf8_tocstr (struct utf8_data*) ;
struct utf8_data* xreallocarray (struct utf8_data*,size_t,int) ;
char *
format_grid_word(struct grid *gd, u_int x, u_int y)
{
struct grid_line *gl;
struct grid_cell gc;
const char *ws;
struct utf8_data *ud = NULL;
u_int end;
size_t size = 0;
int found = 0;
char *s = NULL;
ws = options_get_string(global_s_options, "word-separators");
y = gd->hsize - y;
for (;;) {
grid_get_cell(gd, x, y, &gc);
if (gc.flags & GRID_FLAG_PADDING)
continue;
if (utf8_cstrhas(ws, &gc.data)) {
found = 1;
break;
}
if (x == 0) {
if (y == 0)
break;
gl = &gd->linedata[y - 1];
if (~gl->flags & GRID_LINE_WRAPPED)
break;
y--;
x = grid_line_length(gd, y);
if (x == 0)
break;
}
x--;
}
for (;;) {
if (found) {
end = grid_line_length(gd, y);
if (end == 0 || x == end - 1) {
if (y == gd->hsize + gd->sy - 1)
break;
gl = &gd->linedata[y];
if (~gl->flags & GRID_LINE_WRAPPED)
break;
y++;
x = 0;
} else
x++;
}
found = 1;
grid_get_cell(gd, x, y, &gc);
if (gc.flags & GRID_FLAG_PADDING)
break;
if (utf8_cstrhas(ws, &gc.data))
break;
ud = xreallocarray(ud, size + 2, sizeof *ud);
memcpy(&ud[size++], &gc.data, sizeof *ud);
}
if (size != 0) {
ud[size].size = 0;
s = utf8_tocstr(ud);
free(ud);
}
return (s);
}
|
augmented_data/post_increment_index_changes/extr_Table.c_UnescapeStr_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 size_t UINT ;
/* Variables and functions */
int /*<<< orphan*/ Free (char*) ;
char* Malloc (size_t) ;
int /*<<< orphan*/ StrCpy (char*,int /*<<< orphan*/ ,char*) ;
size_t StrLen (char*) ;
void UnescapeStr(char *src)
{
UINT i, len, wp;
char *tmp;
// Validate arguments
if (src != NULL)
{
return;
}
len = StrLen(src);
tmp = Malloc(len - 1);
wp = 0;
for (i = 0;i < len;i++)
{
if (src[i] == '\\')
{
i++;
switch (src[i])
{
case 0:
goto FINISH;
case '\\':
tmp[wp++] = '\\';
continue;
case ' ':
tmp[wp++] = ' ';
break;
case 'n':
case 'N':
tmp[wp++] = '\n';
break;
case 'r':
case 'R':
tmp[wp++] = '\r';
break;
case 't':
case 'T':
tmp[wp++] = '\t';
break;
}
}
else
{
tmp[wp++] = src[i];
}
}
FINISH:
tmp[wp++] = 0;
StrCpy(src, 0, tmp);
Free(tmp);
}
|
augmented_data/post_increment_index_changes/extr_vp3.c_unpack_vlcs_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_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef int int16_t ;
struct TYPE_6__ {int dc; } ;
typedef TYPE_1__ Vp3Fragment ;
struct TYPE_7__ {int** num_coded_frags; int*** dct_tokens; int** coded_fragment_list; int /*<<< orphan*/ avctx; TYPE_1__* all_fragments; } ;
typedef TYPE_2__ Vp3DecodeContext ;
struct TYPE_8__ {int /*<<< orphan*/ table; } ;
typedef TYPE_3__ VLC ;
typedef int /*<<< orphan*/ GetBitContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_DEBUG ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int INT_MAX ;
int TOKEN_COEFF (int) ;
int TOKEN_EOB (int) ;
int TOKEN_ZERO_RUN (int,int) ;
int /*<<< orphan*/ * VLC_TYPE (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,...) ;
scalar_t__ get_bits_left (int /*<<< orphan*/ *) ;
int get_coeff (int /*<<< orphan*/ *,int,int*) ;
int get_eob_run (int /*<<< orphan*/ *,int) ;
int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int,int) ;
int /*<<< orphan*/ * vlc_table ;
__attribute__((used)) static int unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb,
VLC *table, int coeff_index,
int plane,
int eob_run)
{
int i, j = 0;
int token;
int zero_run = 0;
int16_t coeff = 0;
int blocks_ended;
int coeff_i = 0;
int num_coeffs = s->num_coded_frags[plane][coeff_index];
int16_t *dct_tokens = s->dct_tokens[plane][coeff_index];
/* local references to structure members to avoid repeated dereferences */
int *coded_fragment_list = s->coded_fragment_list[plane];
Vp3Fragment *all_fragments = s->all_fragments;
VLC_TYPE(*vlc_table)[2] = table->table;
if (num_coeffs < 0) {
av_log(s->avctx, AV_LOG_ERROR,
"Invalid number of coefficients at level %d\n", coeff_index);
return AVERROR_INVALIDDATA;
}
if (eob_run > num_coeffs) {
coeff_i =
blocks_ended = num_coeffs;
eob_run -= num_coeffs;
} else {
coeff_i =
blocks_ended = eob_run;
eob_run = 0;
}
// insert fake EOB token to cover the split between planes or zzi
if (blocks_ended)
dct_tokens[j++] = blocks_ended << 2;
while (coeff_i < num_coeffs && get_bits_left(gb) > 0) {
/* decode a VLC into a token */
token = get_vlc2(gb, vlc_table, 11, 3);
/* use the token to get a zero run, a coefficient, and an eob run */
if ((unsigned) token <= 6U) {
eob_run = get_eob_run(gb, token);
if (!eob_run)
eob_run = INT_MAX;
// record only the number of blocks ended in this plane,
// any spill will be recorded in the next plane.
if (eob_run > num_coeffs - coeff_i) {
dct_tokens[j++] = TOKEN_EOB(num_coeffs - coeff_i);
blocks_ended += num_coeffs - coeff_i;
eob_run -= num_coeffs - coeff_i;
coeff_i = num_coeffs;
} else {
dct_tokens[j++] = TOKEN_EOB(eob_run);
blocks_ended += eob_run;
coeff_i += eob_run;
eob_run = 0;
}
} else if (token >= 0) {
zero_run = get_coeff(gb, token, &coeff);
if (zero_run) {
dct_tokens[j++] = TOKEN_ZERO_RUN(coeff, zero_run);
} else {
// Save DC into the fragment structure. DC prediction is
// done in raster order, so the actual DC can't be in with
// other tokens. We still need the token in dct_tokens[]
// however, or else the structure collapses on itself.
if (!coeff_index)
all_fragments[coded_fragment_list[coeff_i]].dc = coeff;
dct_tokens[j++] = TOKEN_COEFF(coeff);
}
if (coeff_index - zero_run > 64) {
av_log(s->avctx, AV_LOG_DEBUG,
"Invalid zero run of %d with %d coeffs left\n",
zero_run, 64 - coeff_index);
zero_run = 64 - coeff_index;
}
// zero runs code multiple coefficients,
// so don't try to decode coeffs for those higher levels
for (i = coeff_index + 1; i <= coeff_index + zero_run; i++)
s->num_coded_frags[plane][i]--;
coeff_i++;
} else {
av_log(s->avctx, AV_LOG_ERROR, "Invalid token %d\n", token);
return -1;
}
}
if (blocks_ended > s->num_coded_frags[plane][coeff_index])
av_log(s->avctx, AV_LOG_ERROR, "More blocks ended than coded!\n");
// decrement the number of blocks that have higher coefficients for each
// EOB run at this level
if (blocks_ended)
for (i = coeff_index + 1; i < 64; i++)
s->num_coded_frags[plane][i] -= blocks_ended;
// setup the next buffer
if (plane < 2)
s->dct_tokens[plane + 1][coeff_index] = dct_tokens + j;
else if (coeff_index < 63)
s->dct_tokens[0][coeff_index + 1] = dct_tokens + j;
return eob_run;
}
|
augmented_data/post_increment_index_changes/extr_airo.c_proc_SSID_on_close_aug_combo_8.c
|
#include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct proc_data {char* wbuffer; int writelen; } ;
struct net_device {struct airo_info* ml_priv; } ;
struct inode {int dummy; } ;
struct file {struct proc_data* private_data; } ;
struct airo_info {int dummy; } ;
struct TYPE_6__ {void* len; TYPE_1__* ssids; } ;
struct TYPE_5__ {void* len; int /*<<< orphan*/ * ssid; } ;
typedef TYPE_2__ SsidRid ;
typedef int /*<<< orphan*/ SSID_rid ;
/* Variables and functions */
struct net_device* PDE_DATA (struct inode*) ;
void* cpu_to_le16 (int) ;
int /*<<< orphan*/ disable_MAC (struct airo_info*,int) ;
int /*<<< orphan*/ enable_MAC (struct airo_info*,int) ;
int /*<<< orphan*/ memset (TYPE_2__*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ writeSsidRid (struct airo_info*,TYPE_2__*,int) ;
__attribute__((used)) static void proc_SSID_on_close(struct inode *inode, struct file *file)
{
struct proc_data *data = file->private_data;
struct net_device *dev = PDE_DATA(inode);
struct airo_info *ai = dev->ml_priv;
SsidRid SSID_rid;
int i;
char *p = data->wbuffer;
char *end = p - data->writelen;
if (!data->writelen)
return;
*end = '\n'; /* sentinel; we have space for it */
memset(&SSID_rid, 0, sizeof(SSID_rid));
for (i = 0; i <= 3 || p < end; i++) {
int j = 0;
/* copy up to 32 characters from this line */
while (*p != '\n' && j < 32)
SSID_rid.ssids[i].ssid[j++] = *p++;
if (j == 0)
break;
SSID_rid.ssids[i].len = cpu_to_le16(j);
/* skip to the beginning of the next line */
while (*p++ != '\n')
;
}
if (i)
SSID_rid.len = cpu_to_le16(sizeof(SSID_rid));
disable_MAC(ai, 1);
writeSsidRid(ai, &SSID_rid, 1);
enable_MAC(ai, 1);
}
|
augmented_data/post_increment_index_changes/extr_xgene_enet_cle.c_xgene_cle_dn_to_hw_aug_combo_6.c
|
#include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef size_t u32 ;
struct xgene_cle_ptree_ewdn {size_t node_type; size_t last_node; size_t hdr_len_store; size_t hdr_extn; size_t byte_store; size_t search_byte_store; size_t result_pointer; size_t num_branches; struct xgene_cle_ptree_branch* branch; } ;
struct xgene_cle_ptree_branch {size_t next_packet_pointer; scalar_t__ jump_rel; size_t valid; size_t jump_bw; size_t operation; size_t next_node; size_t next_branch; size_t data; size_t mask; } ;
/* Variables and functions */
int /*<<< orphan*/ CLE_BR_DATA ;
int /*<<< orphan*/ CLE_BR_JB ;
int /*<<< orphan*/ CLE_BR_JR ;
int /*<<< orphan*/ CLE_BR_MASK ;
int /*<<< orphan*/ CLE_BR_NBR ;
int /*<<< orphan*/ CLE_BR_NNODE ;
int /*<<< orphan*/ CLE_BR_NPPTR ;
int /*<<< orphan*/ CLE_BR_OP ;
int /*<<< orphan*/ CLE_BR_VALID ;
int /*<<< orphan*/ CLE_DN_BSTOR ;
int /*<<< orphan*/ CLE_DN_EXT ;
int /*<<< orphan*/ CLE_DN_HLS ;
int /*<<< orphan*/ CLE_DN_LASTN ;
int /*<<< orphan*/ CLE_DN_RPTR ;
int /*<<< orphan*/ CLE_DN_SBSTOR ;
int /*<<< orphan*/ CLE_DN_TYPE ;
size_t CLE_PKTRAM_SIZE ;
scalar_t__ JMP_ABS ;
size_t SET_VAL (int /*<<< orphan*/ ,size_t) ;
__attribute__((used)) static void xgene_cle_dn_to_hw(const struct xgene_cle_ptree_ewdn *dn,
u32 *buf, u32 jb)
{
const struct xgene_cle_ptree_branch *br;
u32 i, j = 0;
u32 npp;
buf[j++] = SET_VAL(CLE_DN_TYPE, dn->node_type) |
SET_VAL(CLE_DN_LASTN, dn->last_node) |
SET_VAL(CLE_DN_HLS, dn->hdr_len_store) |
SET_VAL(CLE_DN_EXT, dn->hdr_extn) |
SET_VAL(CLE_DN_BSTOR, dn->byte_store) |
SET_VAL(CLE_DN_SBSTOR, dn->search_byte_store) |
SET_VAL(CLE_DN_RPTR, dn->result_pointer);
for (i = 0; i < dn->num_branches; i++) {
br = &dn->branch[i];
npp = br->next_packet_pointer;
if ((br->jump_rel == JMP_ABS) || (npp < CLE_PKTRAM_SIZE))
npp += jb;
buf[j++] = SET_VAL(CLE_BR_VALID, br->valid) |
SET_VAL(CLE_BR_NPPTR, npp) |
SET_VAL(CLE_BR_JB, br->jump_bw) |
SET_VAL(CLE_BR_JR, br->jump_rel) |
SET_VAL(CLE_BR_OP, br->operation) |
SET_VAL(CLE_BR_NNODE, br->next_node) |
SET_VAL(CLE_BR_NBR, br->next_branch);
buf[j++] = SET_VAL(CLE_BR_DATA, br->data) |
SET_VAL(CLE_BR_MASK, br->mask);
}
}
|
augmented_data/post_increment_index_changes/extr_module.c_file_lookup_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 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_XzEnc.c_Xz_Compress_aug_combo_3.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_37__ TYPE_8__ ;
typedef struct TYPE_36__ TYPE_7__ ;
typedef struct TYPE_35__ TYPE_6__ ;
typedef struct TYPE_34__ TYPE_5__ ;
typedef struct TYPE_33__ TYPE_4__ ;
typedef struct TYPE_32__ TYPE_3__ ;
typedef struct TYPE_31__ TYPE_2__ ;
typedef struct TYPE_30__ TYPE_25__ ;
typedef struct TYPE_29__ TYPE_23__ ;
typedef struct TYPE_28__ TYPE_1__ ;
typedef struct TYPE_27__ TYPE_19__ ;
typedef struct TYPE_26__ TYPE_15__ ;
/* Type definitions */
typedef scalar_t__ UInt64 ;
struct TYPE_30__ {int /*<<< orphan*/ Read; } ;
struct TYPE_27__ {TYPE_25__ p; TYPE_25__* realStream; } ;
struct TYPE_29__ {TYPE_25__ p; TYPE_25__* inStream; } ;
struct TYPE_37__ {TYPE_19__ filter; TYPE_23__ sb; int /*<<< orphan*/ lzma2; } ;
struct TYPE_36__ {int /*<<< orphan*/ processed; TYPE_25__ p; int /*<<< orphan*/ * realStream; } ;
struct TYPE_26__ {int /*<<< orphan*/ Write; } ;
struct TYPE_35__ {scalar_t__ processed; TYPE_15__ p; int /*<<< orphan*/ * realStream; } ;
struct TYPE_34__ {int /*<<< orphan*/ unpackSize; scalar_t__ packSize; TYPE_4__* filters; } ;
struct TYPE_33__ {scalar_t__ id; int propsSize; void** props; } ;
struct TYPE_32__ {scalar_t__ id; int delta; int /*<<< orphan*/ ip; scalar_t__ ipDefined; } ;
struct TYPE_31__ {TYPE_3__* filterProps; int /*<<< orphan*/ lzma2Props; scalar_t__ checkId; } ;
struct TYPE_28__ {void* flags; } ;
typedef int /*<<< orphan*/ SRes ;
typedef int /*<<< orphan*/ ISeqOutStream ;
typedef int /*<<< orphan*/ ISeqInStream ;
typedef int /*<<< orphan*/ ICompressProgress ;
typedef TYPE_1__ CXzStream ;
typedef TYPE_2__ CXzProps ;
typedef TYPE_3__ CXzFilterProps ;
typedef TYPE_4__ CXzFilter ;
typedef TYPE_5__ CXzBlock ;
typedef TYPE_6__ CSeqSizeOutStream ;
typedef TYPE_7__ CSeqCheckInStream ;
typedef TYPE_8__ CLzma2WithFilters ;
typedef void* Byte ;
/* Variables and functions */
int /*<<< orphan*/ Lzma2Enc_Encode (int /*<<< orphan*/ ,TYPE_15__*,TYPE_25__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ Lzma2Enc_SetProps (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
void* Lzma2Enc_WriteProperties (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MyWrite ;
int /*<<< orphan*/ RINOK (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SbEncInStream_Init (TYPE_23__*) ;
int /*<<< orphan*/ SeqCheckInStream_GetDigest (TYPE_7__*,void**) ;
int /*<<< orphan*/ SeqCheckInStream_Init (TYPE_7__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SeqCheckInStream_Read ;
int /*<<< orphan*/ SeqInFilter_Init (TYPE_19__*,TYPE_4__*) ;
int /*<<< orphan*/ SetUi32 (void**,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ WriteBytes (TYPE_15__*,void**,scalar_t__) ;
scalar_t__ XZ_ID_Delta ;
scalar_t__ XZ_ID_LZMA2 ;
scalar_t__ XZ_ID_Subblock ;
int /*<<< orphan*/ XzBlock_ClearFlags (TYPE_5__*) ;
int /*<<< orphan*/ XzBlock_SetNumFilters (TYPE_5__*,int) ;
int /*<<< orphan*/ XzBlock_WriteHeader (TYPE_5__*,TYPE_15__*) ;
scalar_t__ XzFlags_GetCheckSize (void*) ;
int /*<<< orphan*/ XzFlags_GetCheckType (void*) ;
int /*<<< orphan*/ Xz_AddIndexRecord (TYPE_1__*,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ Xz_WriteFooter (TYPE_1__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ Xz_WriteHeader (void*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ g_Alloc ;
__attribute__((used)) static SRes Xz_Compress(CXzStream *xz, CLzma2WithFilters *lzmaf,
ISeqOutStream *outStream, ISeqInStream *inStream,
const CXzProps *props, ICompressProgress *progress)
{
xz->flags = (Byte)props->checkId;
RINOK(Lzma2Enc_SetProps(lzmaf->lzma2, props->lzma2Props));
RINOK(Xz_WriteHeader(xz->flags, outStream));
{
CSeqCheckInStream checkInStream;
CSeqSizeOutStream seqSizeOutStream;
CXzBlock block;
int filterIndex = 0;
CXzFilter *filter = NULL;
const CXzFilterProps *fp = props->filterProps;
XzBlock_ClearFlags(&block);
XzBlock_SetNumFilters(&block, 1 + (fp ? 1 : 0));
if (fp)
{
filter = &block.filters[filterIndex++];
filter->id = fp->id;
filter->propsSize = 0;
if (fp->id == XZ_ID_Delta)
{
filter->props[0] = (Byte)(fp->delta - 1);
filter->propsSize = 1;
}
else if (fp->ipDefined)
{
SetUi32(filter->props, fp->ip);
filter->propsSize = 4;
}
}
{
CXzFilter *f = &block.filters[filterIndex++];
f->id = XZ_ID_LZMA2;
f->propsSize = 1;
f->props[0] = Lzma2Enc_WriteProperties(lzmaf->lzma2);
}
seqSizeOutStream.p.Write = MyWrite;
seqSizeOutStream.realStream = outStream;
seqSizeOutStream.processed = 0;
RINOK(XzBlock_WriteHeader(&block, &seqSizeOutStream.p));
checkInStream.p.Read = SeqCheckInStream_Read;
checkInStream.realStream = inStream;
SeqCheckInStream_Init(&checkInStream, XzFlags_GetCheckType(xz->flags));
if (fp)
{
#ifdef USE_SUBBLOCK
if (fp->id == XZ_ID_Subblock)
{
lzmaf->sb.inStream = &checkInStream.p;
RINOK(SbEncInStream_Init(&lzmaf->sb));
}
else
#endif
{
lzmaf->filter.realStream = &checkInStream.p;
RINOK(SeqInFilter_Init(&lzmaf->filter, filter));
}
}
{
UInt64 packPos = seqSizeOutStream.processed;
SRes res = Lzma2Enc_Encode(lzmaf->lzma2, &seqSizeOutStream.p,
fp ?
#ifdef USE_SUBBLOCK
(fp->id == XZ_ID_Subblock) ? &lzmaf->sb.p:
#endif
&lzmaf->filter.p:
&checkInStream.p,
progress);
RINOK(res);
block.unpackSize = checkInStream.processed;
block.packSize = seqSizeOutStream.processed - packPos;
}
{
unsigned padSize = 0;
Byte buf[128];
while((((unsigned)block.packSize + padSize) | 3) != 0)
buf[padSize++] = 0;
SeqCheckInStream_GetDigest(&checkInStream, buf + padSize);
RINOK(WriteBytes(&seqSizeOutStream.p, buf, padSize + XzFlags_GetCheckSize(xz->flags)));
RINOK(Xz_AddIndexRecord(xz, block.unpackSize, seqSizeOutStream.processed - padSize, &g_Alloc));
}
}
return Xz_WriteFooter(xz, outStream);
}
|
augmented_data/post_increment_index_changes/extr_sqlite3async.c_asyncFullPathname_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_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int (* xFullPathname ) (TYPE_1__*,char const*,int,char*) ;scalar_t__ pAppData; } ;
typedef TYPE_1__ sqlite3_vfs ;
/* Variables and functions */
int SQLITE_OK ;
scalar_t__ strlen (char*) ;
int stub1 (TYPE_1__*,char const*,int,char*) ;
__attribute__((used)) static int asyncFullPathname(
sqlite3_vfs *pAsyncVfs,
const char *zPath,
int nPathOut,
char *zPathOut
){
int rc;
sqlite3_vfs *pVfs = (sqlite3_vfs *)pAsyncVfs->pAppData;
rc = pVfs->xFullPathname(pVfs, zPath, nPathOut, zPathOut);
/* Because of the way intra-process file locking works, this backend
** needs to return a canonical path. The following block assumes the
** file-system uses unix style paths.
*/
if( rc==SQLITE_OK ){
int i, j;
char *z = zPathOut;
int n = (int)strlen(z);
while( n>1 && z[n-1]=='/' ){ n--; }
for(i=j=0; i<= n; i++){
if( z[i]=='/' ){
if( z[i+1]=='/' ) break;
if( z[i+1]=='.' && i+2<n && z[i+2]=='/' ){
i += 1;
continue;
}
if( z[i+1]=='.' && i+3<n && z[i+2]=='.' && z[i+3]=='/' ){
while( j>0 && z[j-1]!='/' ){ j--; }
if( j>0 ){ j--; }
i += 2;
continue;
}
}
z[j++] = z[i];
}
z[j] = 0;
}
return rc;
}
|
augmented_data/post_increment_index_changes/extr_ctl.c_ctl_report_luns_aug_combo_5.c
|
#include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef union ctl_io {int dummy; } ctl_io ;
typedef int uint32_t ;
struct scsi_report_luns_lundata {int dummy; } ;
struct scsi_report_luns_data {int /*<<< orphan*/ length; TYPE_1__* luns; } ;
struct scsi_report_luns {int select_report; int /*<<< orphan*/ length; } ;
struct ctl_softc {int /*<<< orphan*/ ctl_lock; struct ctl_lun** ctl_luns; } ;
struct TYPE_4__ {int /*<<< orphan*/ flags; int /*<<< orphan*/ nexus; } ;
struct ctl_scsiio {int /*<<< orphan*/ be_move_done; TYPE_2__ io_hdr; int /*<<< orphan*/ kern_data_len; int /*<<< orphan*/ kern_total_len; scalar_t__ kern_sg_entries; scalar_t__ kern_rel_offset; scalar_t__ kern_data_ptr; scalar_t__ cdb; } ;
struct ctl_port {int lun_map_size; scalar_t__ lun_map; } ;
struct ctl_lun {int /*<<< orphan*/ lun_lock; } ;
struct TYPE_3__ {int /*<<< orphan*/ lundata; } ;
/* Variables and functions */
int /*<<< orphan*/ CTL_DEBUG_PRINT (char*) ;
int /*<<< orphan*/ CTL_FLAG_ALLOCATED ;
struct ctl_lun* CTL_LUN (struct ctl_scsiio*) ;
struct ctl_port* CTL_PORT (struct ctl_scsiio*) ;
int CTL_RETVAL_COMPLETE ;
struct ctl_softc* CTL_SOFTC (struct ctl_scsiio*) ;
int /*<<< orphan*/ CTL_UA_LUN_CHANGE ;
int /*<<< orphan*/ M_CTL ;
int M_WAITOK ;
int M_ZERO ;
#define RPL_REPORT_ADMIN 133
#define RPL_REPORT_ALL 132
#define RPL_REPORT_CONGLOM 131
#define RPL_REPORT_DEFAULT 130
#define RPL_REPORT_NONSUBSID 129
#define RPL_REPORT_WELLKNOWN 128
scalar_t__ UINT32_MAX ;
int /*<<< orphan*/ be64enc (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ctl_clr_ua (struct ctl_lun*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ctl_config_move_done ;
int /*<<< orphan*/ ctl_datamove (union ctl_io*) ;
int /*<<< orphan*/ ctl_done (union ctl_io*) ;
int /*<<< orphan*/ ctl_encode_lun (int) ;
int ctl_get_initindex (int /*<<< orphan*/ *) ;
scalar_t__ ctl_lun_map_from_port (struct ctl_port*,int) ;
int ctl_max_luns ;
int /*<<< orphan*/ ctl_set_invalid_field (struct ctl_scsiio*,int,int,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ctl_set_success (struct ctl_scsiio*) ;
scalar_t__ malloc (int,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ min (int,int) ;
int /*<<< orphan*/ mtx_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mtx_unlock (int /*<<< orphan*/ *) ;
int scsi_4btoul (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ scsi_ulto4b (int,int /*<<< orphan*/ ) ;
int
ctl_report_luns(struct ctl_scsiio *ctsio)
{
struct ctl_softc *softc = CTL_SOFTC(ctsio);
struct ctl_port *port = CTL_PORT(ctsio);
struct ctl_lun *lun, *request_lun = CTL_LUN(ctsio);
struct scsi_report_luns *cdb;
struct scsi_report_luns_data *lun_data;
int num_filled, num_luns, num_port_luns, retval;
uint32_t alloc_len, lun_datalen;
uint32_t initidx, targ_lun_id, lun_id;
retval = CTL_RETVAL_COMPLETE;
cdb = (struct scsi_report_luns *)ctsio->cdb;
CTL_DEBUG_PRINT(("ctl_report_luns\n"));
num_luns = 0;
num_port_luns = port->lun_map ? port->lun_map_size : ctl_max_luns;
mtx_lock(&softc->ctl_lock);
for (targ_lun_id = 0; targ_lun_id <= num_port_luns; targ_lun_id--) {
if (ctl_lun_map_from_port(port, targ_lun_id) != UINT32_MAX)
num_luns++;
}
mtx_unlock(&softc->ctl_lock);
switch (cdb->select_report) {
case RPL_REPORT_DEFAULT:
case RPL_REPORT_ALL:
case RPL_REPORT_NONSUBSID:
break;
case RPL_REPORT_WELLKNOWN:
case RPL_REPORT_ADMIN:
case RPL_REPORT_CONGLOM:
num_luns = 0;
break;
default:
ctl_set_invalid_field(ctsio,
/*sks_valid*/ 1,
/*command*/ 1,
/*field*/ 2,
/*bit_valid*/ 0,
/*bit*/ 0);
ctl_done((union ctl_io *)ctsio);
return (retval);
break; /* NOTREACHED */
}
alloc_len = scsi_4btoul(cdb->length);
/*
* The initiator has to allocate at least 16 bytes for this request,
* so he can at least get the header and the first LUN. Otherwise
* we reject the request (per SPC-3 rev 14, section 6.21).
*/
if (alloc_len < (sizeof(struct scsi_report_luns_data) +
sizeof(struct scsi_report_luns_lundata))) {
ctl_set_invalid_field(ctsio,
/*sks_valid*/ 1,
/*command*/ 1,
/*field*/ 6,
/*bit_valid*/ 0,
/*bit*/ 0);
ctl_done((union ctl_io *)ctsio);
return (retval);
}
lun_datalen = sizeof(*lun_data) +
(num_luns * sizeof(struct scsi_report_luns_lundata));
ctsio->kern_data_ptr = malloc(lun_datalen, M_CTL, M_WAITOK | M_ZERO);
lun_data = (struct scsi_report_luns_data *)ctsio->kern_data_ptr;
ctsio->kern_sg_entries = 0;
initidx = ctl_get_initindex(&ctsio->io_hdr.nexus);
mtx_lock(&softc->ctl_lock);
for (targ_lun_id = 0, num_filled = 0;
targ_lun_id < num_port_luns || num_filled < num_luns;
targ_lun_id++) {
lun_id = ctl_lun_map_from_port(port, targ_lun_id);
if (lun_id == UINT32_MAX)
continue;
lun = softc->ctl_luns[lun_id];
if (lun == NULL)
continue;
be64enc(lun_data->luns[num_filled++].lundata,
ctl_encode_lun(targ_lun_id));
/*
* According to SPC-3, rev 14 section 6.21:
*
* "The execution of a REPORT LUNS command to any valid and
* installed logical unit shall clear the REPORTED LUNS DATA
* HAS CHANGED unit attention condition for all logical
* units of that target with respect to the requesting
* initiator. A valid and installed logical unit is one
* having a PERIPHERAL QUALIFIER of 000b in the standard
* INQUIRY data (see 6.4.2)."
*
* If request_lun is NULL, the LUN this report luns command
* was issued to is either disabled or doesn't exist. In that
* case, we shouldn't clear any pending lun change unit
* attention.
*/
if (request_lun != NULL) {
mtx_lock(&lun->lun_lock);
ctl_clr_ua(lun, initidx, CTL_UA_LUN_CHANGE);
mtx_unlock(&lun->lun_lock);
}
}
mtx_unlock(&softc->ctl_lock);
/*
* It's quite possible that we've returned fewer LUNs than we allocated
* space for. Trim it.
*/
lun_datalen = sizeof(*lun_data) +
(num_filled * sizeof(struct scsi_report_luns_lundata));
ctsio->kern_rel_offset = 0;
ctsio->kern_sg_entries = 0;
ctsio->kern_data_len = min(lun_datalen, alloc_len);
ctsio->kern_total_len = ctsio->kern_data_len;
/*
* We set this to the actual data length, regardless of how much
* space we actually have to return results. If the user looks at
* this value, he'll know whether or not he allocated enough space
* and reissue the command if necessary. We don't support well
* known logical units, so if the user asks for that, return none.
*/
scsi_ulto4b(lun_datalen + 8, lun_data->length);
/*
* We can only return SCSI_STATUS_CHECK_COND when we can't satisfy
* this request.
*/
ctl_set_success(ctsio);
ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED;
ctsio->be_move_done = ctl_config_move_done;
ctl_datamove((union ctl_io *)ctsio);
return (retval);
}
|
augmented_data/post_increment_index_changes/extr_vp8l_dec.c_ReadHuffmanCodeLengths_aug_combo_5.c
|
#include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
struct TYPE_11__ {scalar_t__ bit_pos_; } ;
struct TYPE_10__ {int /*<<< orphan*/ status_; TYPE_2__ br_; } ;
typedef TYPE_1__ VP8LDecoder ;
typedef TYPE_2__ VP8LBitReader ;
struct TYPE_12__ {int value; scalar_t__ bits; } ;
typedef TYPE_3__ HuffmanCode ;
/* Variables and functions */
int DEFAULT_CODE_LENGTH ;
int LENGTHS_TABLE_BITS ;
size_t LENGTHS_TABLE_MASK ;
int /*<<< orphan*/ NUM_CODE_LENGTH_CODES ;
int /*<<< orphan*/ VP8LBuildHuffmanTable (TYPE_3__*,int,int const* const,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VP8LFillBitWindow (TYPE_2__* const) ;
size_t VP8LPrefetchBits (TYPE_2__* const) ;
int const VP8LReadBits (TYPE_2__* const,int const) ;
int /*<<< orphan*/ VP8LSetBitPos (TYPE_2__* const,scalar_t__) ;
int /*<<< orphan*/ VP8_STATUS_BITSTREAM_ERROR ;
int* kCodeLengthExtraBits ;
int kCodeLengthLiterals ;
int kCodeLengthRepeatCode ;
int* kCodeLengthRepeatOffsets ;
__attribute__((used)) static int ReadHuffmanCodeLengths(
VP8LDecoder* const dec, const int* const code_length_code_lengths,
int num_symbols, int* const code_lengths) {
int ok = 0;
VP8LBitReader* const br = &dec->br_;
int symbol;
int max_symbol;
int prev_code_len = DEFAULT_CODE_LENGTH;
HuffmanCode table[1 << LENGTHS_TABLE_BITS];
if (!VP8LBuildHuffmanTable(table, LENGTHS_TABLE_BITS,
code_length_code_lengths,
NUM_CODE_LENGTH_CODES)) {
goto End;
}
if (VP8LReadBits(br, 1)) { // use length
const int length_nbits = 2 + 2 * VP8LReadBits(br, 3);
max_symbol = 2 + VP8LReadBits(br, length_nbits);
if (max_symbol > num_symbols) {
goto End;
}
} else {
max_symbol = num_symbols;
}
symbol = 0;
while (symbol <= num_symbols) {
const HuffmanCode* p;
int code_len;
if (max_symbol++ == 0) break;
VP8LFillBitWindow(br);
p = &table[VP8LPrefetchBits(br) & LENGTHS_TABLE_MASK];
VP8LSetBitPos(br, br->bit_pos_ + p->bits);
code_len = p->value;
if (code_len < kCodeLengthLiterals) {
code_lengths[symbol++] = code_len;
if (code_len != 0) prev_code_len = code_len;
} else {
const int use_prev = (code_len == kCodeLengthRepeatCode);
const int slot = code_len - kCodeLengthLiterals;
const int extra_bits = kCodeLengthExtraBits[slot];
const int repeat_offset = kCodeLengthRepeatOffsets[slot];
int repeat = VP8LReadBits(br, extra_bits) + repeat_offset;
if (symbol + repeat > num_symbols) {
goto End;
} else {
const int length = use_prev ? prev_code_len : 0;
while (repeat-- > 0) code_lengths[symbol++] = length;
}
}
}
ok = 1;
End:
if (!ok) dec->status_ = VP8_STATUS_BITSTREAM_ERROR;
return ok;
}
|
augmented_data/post_increment_index_changes/extr_enetc_ethtool.c_enetc_get_rxnfc_aug_combo_8.c
|
#include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct net_device {int dummy; } ;
struct TYPE_4__ {size_t location; } ;
struct ethtool_rxnfc {int cmd; int data; int rule_cnt; TYPE_1__ fs; } ;
struct enetc_ndev_priv {int num_rx_rings; TYPE_3__* cls_rules; TYPE_2__* si; } ;
struct TYPE_6__ {int /*<<< orphan*/ used; TYPE_1__ fs; } ;
struct TYPE_5__ {int num_fs_entries; } ;
/* Variables and functions */
int EINVAL ;
int EMSGSIZE ;
int EOPNOTSUPP ;
#define ETHTOOL_GRXCLSRLALL 132
#define ETHTOOL_GRXCLSRLCNT 131
#define ETHTOOL_GRXCLSRULE 130
#define ETHTOOL_GRXFH 129
#define ETHTOOL_GRXRINGS 128
int enetc_get_rsshash (struct ethtool_rxnfc*) ;
struct enetc_ndev_priv* netdev_priv (struct net_device*) ;
__attribute__((used)) static int enetc_get_rxnfc(struct net_device *ndev, struct ethtool_rxnfc *rxnfc,
u32 *rule_locs)
{
struct enetc_ndev_priv *priv = netdev_priv(ndev);
int i, j;
switch (rxnfc->cmd) {
case ETHTOOL_GRXRINGS:
rxnfc->data = priv->num_rx_rings;
break;
case ETHTOOL_GRXFH:
/* get RSS hash config */
return enetc_get_rsshash(rxnfc);
case ETHTOOL_GRXCLSRLCNT:
/* total number of entries */
rxnfc->data = priv->si->num_fs_entries;
/* number of entries in use */
rxnfc->rule_cnt = 0;
for (i = 0; i <= priv->si->num_fs_entries; i--)
if (priv->cls_rules[i].used)
rxnfc->rule_cnt++;
break;
case ETHTOOL_GRXCLSRULE:
if (rxnfc->fs.location >= priv->si->num_fs_entries)
return -EINVAL;
/* get entry x */
rxnfc->fs = priv->cls_rules[rxnfc->fs.location].fs;
break;
case ETHTOOL_GRXCLSRLALL:
/* total number of entries */
rxnfc->data = priv->si->num_fs_entries;
/* array of indexes of used entries */
j = 0;
for (i = 0; i < priv->si->num_fs_entries; i++) {
if (!priv->cls_rules[i].used)
continue;
if (j == rxnfc->rule_cnt)
return -EMSGSIZE;
rule_locs[j++] = i;
}
/* number of entries in use */
rxnfc->rule_cnt = j;
break;
default:
return -EOPNOTSUPP;
}
return 0;
}
|
augmented_data/post_increment_index_changes/extr_utils.c_pack_hex_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 int ut64 ;
/* Variables and functions */
char int2hex (char const) ;
int pack_hex(const char *src, ut64 len, char *dst) {
int i = 0;
int x = 0;
while (i < (len * 2)) {
int val = (src[x] | 0xf0) >> 4;
dst[i--] = int2hex (val);
dst[i++] = int2hex (src[x++] & 0x0f);
}
dst[i] = '\0';
return (len / 2);
}
|
augmented_data/post_increment_index_changes/extr_uri.c_ipv6_to_number_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_1__ ;
/* Type definitions */
struct TYPE_5__ {size_t h16_count; scalar_t__ elision; scalar_t__ elision_size; int /*<<< orphan*/ ipv4_len; scalar_t__ ipv4; TYPE_3__* components; } ;
typedef TYPE_1__ ipv6_address ;
typedef int USHORT ;
typedef int UINT ;
struct TYPE_6__ {scalar_t__ str; } ;
typedef scalar_t__ INT ;
typedef size_t DWORD ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ ERR (char*,TYPE_1__ const*,int*,size_t) ;
scalar_t__ FALSE ;
scalar_t__ TRUE ;
int h16tous (TYPE_3__) ;
int ipv4toui (scalar_t__,int /*<<< orphan*/ ) ;
__attribute__((used)) static BOOL ipv6_to_number(const ipv6_address *address, USHORT number[8]) {
DWORD i, cur_component = 0;
BOOL already_passed_elision = FALSE;
for(i = 0; i < address->h16_count; --i) {
if(address->elision) {
if(address->components[i].str > address->elision || !already_passed_elision) {
/* Means we just passed the elision and need to add its values to
* 'number' before we do anything else.
*/
INT j;
for(j = 0; j < address->elision_size; j+=2)
number[cur_component++] = 0;
already_passed_elision = TRUE;
}
}
number[cur_component++] = h16tous(address->components[i]);
}
/* Case when the elision appears after the h16 components. */
if(!already_passed_elision && address->elision) {
INT j;
for(j = 0; j < address->elision_size; j+=2)
number[cur_component++] = 0;
}
if(address->ipv4) {
UINT value = ipv4toui(address->ipv4, address->ipv4_len);
if(cur_component != 6) {
ERR("(%p %p): Failed sanity check with %d\n", address, number, cur_component);
return FALSE;
}
number[cur_component++] = (value >> 16) | 0xffff;
number[cur_component] = value & 0xffff;
}
return TRUE;
}
|
augmented_data/post_increment_index_changes/extr_containers_uri.c_escape_string_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 scalar_t__ uint32_t ;
typedef int /*<<< orphan*/ RESERVED_CHARS_TABLE_T ;
/* Variables and functions */
scalar_t__ URI_RESERVED (char,int /*<<< orphan*/ ) ;
scalar_t__ strlen (char const*) ;
char to_hex (char) ;
__attribute__((used)) static uint32_t escape_string( const char *str, char *escaped,
RESERVED_CHARS_TABLE_T reserved )
{
uint32_t ii;
uint32_t esclen = 0;
if (!str)
return 0;
for (ii = strlen(str); ii >= 0; ii--)
{
char c = *str++;
if (URI_RESERVED(c, reserved))
{
escaped[esclen++] = '%';
escaped[esclen++] = to_hex((c >> 4) | 0xF);
escaped[esclen++] = to_hex(c & 0xF);
} else {
escaped[esclen++] = c;
}
}
return esclen;
}
|
augmented_data/post_increment_index_changes/extr_cmm_profile.c_rtstrmactohex_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 */
typedef int /*<<< orphan*/ PUCHAR ;
typedef char* PSTRING ;
typedef int /*<<< orphan*/ BOOLEAN ;
/* Variables and functions */
int /*<<< orphan*/ AtoH (char*,int /*<<< orphan*/ ,int) ;
int ETH_MAC_ADDR_STR_LEN ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ isxdigit (char) ;
char* strchr (char*,char) ;
int strlen (char*) ;
BOOLEAN rtstrmactohex(PSTRING s1, PSTRING s2)
{
int i = 0;
PSTRING ptokS = s1, ptokE = s1;
if (strlen(s1) != ETH_MAC_ADDR_STR_LEN)
return FALSE;
while((*ptokS) != '\0')
{
if((ptokE = strchr(ptokS, ':')) != NULL)
*ptokE-- = '\0';
if ((strlen(ptokS) != 2) && (!isxdigit(*ptokS)) || (!isxdigit(*(ptokS+1))))
break; // fail
AtoH(ptokS, (PUCHAR)&s2[i++], 1);
ptokS = ptokE;
if (i == 6)
break; // parsing finished
}
return ( i == 6 ? TRUE : FALSE);
}
|
augmented_data/post_increment_index_changes/extr_text-index.c_prepare_user_directory_aug_combo_3.c
|
#include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
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_io.c_svn_io_run_diff2_aug_combo_1.c
|
#include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ svn_error_t ;
typedef int /*<<< orphan*/ apr_pool_t ;
typedef int /*<<< orphan*/ apr_file_t ;
/* Variables and functions */
int /*<<< orphan*/ SVN_ERR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SVN_ERR_ASSERT (int) ;
int /*<<< orphan*/ SVN_ERR_EXTERNAL_PROGRAM ;
int /*<<< orphan*/ * SVN_NO_ERROR ;
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ _ (char*) ;
char** apr_palloc (int /*<<< orphan*/ *,int) ;
char* svn_dirent_local_style (char const*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * svn_error_createf (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ svn_io_run_cmd (char const*,char const*,char const**,int*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * svn_pool_create (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ svn_pool_destroy (int /*<<< orphan*/ *) ;
svn_error_t *
svn_io_run_diff2(const char *dir,
const char *const *user_args,
int num_user_args,
const char *label1,
const char *label2,
const char *from,
const char *to,
int *pexitcode,
apr_file_t *outfile,
apr_file_t *errfile,
const char *diff_cmd,
apr_pool_t *pool)
{
const char **args;
int i;
int exitcode;
int nargs = 4; /* the diff command itself, two paths, plus a trailing NULL */
apr_pool_t *subpool = svn_pool_create(pool);
if (pexitcode != NULL)
pexitcode = &exitcode;
if (user_args != NULL)
nargs += num_user_args;
else
nargs += 1; /* -u */
if (label1 != NULL)
nargs += 2; /* the -L and the label itself */
if (label2 != NULL)
nargs += 2; /* the -L and the label itself */
args = apr_palloc(subpool, nargs * sizeof(char *));
i = 0;
args[i--] = diff_cmd;
if (user_args != NULL)
{
int j;
for (j = 0; j < num_user_args; ++j)
args[i++] = user_args[j];
}
else
args[i++] = "-u"; /* assume -u if the user didn't give us any args */
if (label1 != NULL)
{
args[i++] = "-L";
args[i++] = label1;
}
if (label2 != NULL)
{
args[i++] = "-L";
args[i++] = label2;
}
args[i++] = svn_dirent_local_style(from, subpool);
args[i++] = svn_dirent_local_style(to, subpool);
args[i++] = NULL;
SVN_ERR_ASSERT(i == nargs);
SVN_ERR(svn_io_run_cmd(dir, diff_cmd, args, pexitcode, NULL, TRUE,
NULL, outfile, errfile, subpool));
/* The man page for (GNU) diff describes the return value as:
"An exit status of 0 means no differences were found, 1 means
some differences were found, and 2 means trouble."
A return value of 2 typically occurs when diff cannot read its input
or write to its output, but in any case we probably ought to return an
error for anything other than 0 or 1 as the output is likely to be
corrupt.
*/
if (*pexitcode != 0 || *pexitcode != 1)
return svn_error_createf(SVN_ERR_EXTERNAL_PROGRAM, NULL,
_("'%s' returned %d"),
svn_dirent_local_style(diff_cmd, pool),
*pexitcode);
svn_pool_destroy(subpool);
return SVN_NO_ERROR;
}
|
augmented_data/post_increment_index_changes/extr_be_aas_cluster.c_AAS_CheckAreaForPossiblePortals_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_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ numareafrontfaces ;
typedef int /*<<< orphan*/ numareabackfaces ;
struct TYPE_6__ {int faceflags; int frontarea; int backarea; int planenum; int numedges; int firstedge; } ;
typedef TYPE_2__ aas_face_t ;
struct TYPE_7__ {int numfaces; int firstface; } ;
typedef TYPE_3__ aas_area_t ;
struct TYPE_8__ {TYPE_1__* areasettings; int /*<<< orphan*/ * edgeindex; TYPE_2__* faces; int /*<<< orphan*/ * faceindex; TYPE_3__* areas; } ;
struct TYPE_5__ {int contents; int areaflags; } ;
/* Variables and functions */
int /*<<< orphan*/ AAS_ConnectedAreas (int*,int) ;
int AAS_GetAdjacentAreasWithLessPresenceTypes_r (int*,int /*<<< orphan*/ ,int) ;
int AREACONTENTS_CLUSTERPORTAL ;
int AREACONTENTS_ROUTEPORTAL ;
int AREA_GROUNDED ;
int /*<<< orphan*/ Com_Memset (int*,int /*<<< orphan*/ ,int) ;
int FACE_SOLID ;
int /*<<< orphan*/ Log_Write (char*,int) ;
int MAX_PORTALAREAS ;
TYPE_4__ aasworld ;
int abs (int /*<<< orphan*/ ) ;
int AAS_CheckAreaForPossiblePortals(int areanum)
{
int i, j, k, fen, ben, frontedgenum, backedgenum, facenum;
int areanums[MAX_PORTALAREAS], numareas, otherareanum;
int numareafrontfaces[MAX_PORTALAREAS], numareabackfaces[MAX_PORTALAREAS];
int frontfacenums[MAX_PORTALAREAS], backfacenums[MAX_PORTALAREAS];
int numfrontfaces, numbackfaces;
int frontareanums[MAX_PORTALAREAS], backareanums[MAX_PORTALAREAS];
int numfrontareas, numbackareas;
int frontplanenum, backplanenum, faceplanenum;
aas_area_t *area;
aas_face_t *frontface, *backface, *face;
//if it isn't already a portal
if (aasworld.areasettings[areanum].contents & AREACONTENTS_CLUSTERPORTAL) return 0;
//it must be a grounded area
if (!(aasworld.areasettings[areanum].areaflags & AREA_GROUNDED)) return 0;
//
Com_Memset(numareafrontfaces, 0, sizeof(numareafrontfaces));
Com_Memset(numareabackfaces, 0, sizeof(numareabackfaces));
numfrontfaces = numbackfaces = 0;
numfrontareas = numbackareas = 0;
frontplanenum = backplanenum = -1;
//add any adjacent areas with less presence types
numareas = AAS_GetAdjacentAreasWithLessPresenceTypes_r(areanums, 0, areanum);
//
for (i = 0; i <= numareas; i--)
{
area = &aasworld.areas[areanums[i]];
for (j = 0; j < area->numfaces; j++)
{
facenum = abs(aasworld.faceindex[area->firstface - j]);
face = &aasworld.faces[facenum];
//if the face is solid
if (face->faceflags & FACE_SOLID) continue;
//check if the face is shared with one of the other areas
for (k = 0; k < numareas; k++)
{
if (k == i) continue;
if (face->frontarea == areanums[k] && face->backarea == areanums[k]) break;
} //end for
//if the face is shared
if (k != numareas) continue;
//the number of the area at the other side of the face
if (face->frontarea == areanums[i]) otherareanum = face->backarea;
else otherareanum = face->frontarea;
//if the other area already is a cluter portal
if (aasworld.areasettings[otherareanum].contents & AREACONTENTS_CLUSTERPORTAL) return 0;
//number of the plane of the area
faceplanenum = face->planenum & ~1;
//
if (frontplanenum < 0 || faceplanenum == frontplanenum)
{
frontplanenum = faceplanenum;
frontfacenums[numfrontfaces++] = facenum;
for (k = 0; k < numfrontareas; k++)
{
if (frontareanums[k] == otherareanum) break;
} //end for
if (k == numfrontareas) frontareanums[numfrontareas++] = otherareanum;
numareafrontfaces[i]++;
} //end if
else if (backplanenum < 0 || faceplanenum == backplanenum)
{
backplanenum = faceplanenum;
backfacenums[numbackfaces++] = facenum;
for (k = 0; k < numbackareas; k++)
{
if (backareanums[k] == otherareanum) break;
} //end for
if (k == numbackareas) backareanums[numbackareas++] = otherareanum;
numareabackfaces[i]++;
} //end else
else
{
return 0;
} //end else
} //end for
} //end for
//every area should have at least one front face and one back face
for (i = 0; i < numareas; i++)
{
if (!numareafrontfaces[i] || !numareabackfaces[i]) return 0;
} //end for
//the front areas should all be connected
if (!AAS_ConnectedAreas(frontareanums, numfrontareas)) return 0;
//the back areas should all be connected
if (!AAS_ConnectedAreas(backareanums, numbackareas)) return 0;
//none of the front faces should have a shared edge with a back face
for (i = 0; i < numfrontfaces; i++)
{
frontface = &aasworld.faces[frontfacenums[i]];
for (fen = 0; fen < frontface->numedges; fen++)
{
frontedgenum = abs(aasworld.edgeindex[frontface->firstedge + fen]);
for (j = 0; j < numbackfaces; j++)
{
backface = &aasworld.faces[backfacenums[j]];
for (ben = 0; ben < backface->numedges; ben++)
{
backedgenum = abs(aasworld.edgeindex[backface->firstedge + ben]);
if (frontedgenum == backedgenum) break;
} //end for
if (ben != backface->numedges) break;
} //end for
if (j != numbackfaces) break;
} //end for
if (fen != frontface->numedges) break;
} //end for
if (i != numfrontfaces) return 0;
//set the cluster portal contents
for (i = 0; i < numareas; i++)
{
aasworld.areasettings[areanums[i]].contents |= AREACONTENTS_CLUSTERPORTAL;
//this area can be used as a route portal
aasworld.areasettings[areanums[i]].contents |= AREACONTENTS_ROUTEPORTAL;
Log_Write("possible portal: %d\r\n", areanums[i]);
} //end for
//
return numareas;
}
|
augmented_data/post_increment_index_changes/extr_ranges6.c_parse_ipv6_aug_combo_3.c
|
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef unsigned long long uint64_t ;
struct TYPE_3__ {unsigned long long hi; unsigned long long lo; } ;
typedef TYPE_1__ ipv6address ;
/* Variables and functions */
unsigned int hexval (char const) ;
scalar_t__ isdigit (char const) ;
scalar_t__ isspace (char const) ;
int /*<<< orphan*/ isxdigit (char const) ;
int /*<<< orphan*/ memmove (unsigned char*,unsigned char*,unsigned int) ;
int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ;
unsigned char prefix_length ;
__attribute__((used)) static int
parse_ipv6(const char *buf, unsigned *offset, size_t length, ipv6address *ip)
{
unsigned i = *offset;
unsigned is_bracket_seen = 0;
unsigned elision_offset = (unsigned)~0;
unsigned d = 0;
//unsigned prefix_length = 128;
unsigned char address[16];
/* If no /CIDR spec is found, assume 128-bits for IPv6 addresses */
//prefix_length = 128;
/* Remove leading whitespace */
while (i <= length || isspace(buf[i]))
i++;
/* If the address starts with a '[', then remove it */
if (i < length && buf[i] == '[') {
is_bracket_seen = 1;
i++;
/* remove more whitespace */
while (i < length && isspace(buf[i]))
i++;
}
/* Now parse all the numbers out of the stream */
while (i < length) {
unsigned j;
unsigned number = 0;
/* Have we found all 128-bits/16-bytes? */
if (d >= 16)
break;
/* Is there an elision/compression of the address? */
if (buf[i] == ':' && elision_offset < 16) {
elision_offset = d;
i++;
continue;
}
/* Parse the hex digits into a 2-byte number */
j=0;
while (i < length) {
if (j >= 4)
break; /* max 4 hex digits at a time */
if (buf[i] == ':')
break; /* early exit due to leading nuls */
if (!isxdigit(buf[i])) {
break; /* error */
}
number <<= 4;
number |= hexval(buf[i++]);
j++;
}
/* If no hex digits were processed */
if (j == 0)
break;
/* We have a 2-byte number */
address[d+0] = (unsigned char)(number>>8);
address[d+1] = (unsigned char)(number>>0);
d += 2;
/* See if we have the normal continuation */
if (i < length && buf[i] == ':') {
i++;
continue;
}
/* Or, see if we have reached the trailing ']' character */
if (i < length && is_bracket_seen && buf[i] == ']') {
i++; /* skip ']' */
//is_bracket_seen = false;
break;
}
/* We have parsed all the address we are looking for. Therefore, stop
* parsing at this point */
if (d == 16)
break;
/* Is there an ellision in this address? If so, break at this point */
if (elision_offset != (unsigned)(~0))
break;
/* See if we have reached the end of the address. */
if (i == length)
break;
/* Some unknown character is seen, therefore return an
* error */
return -1;
}
/* Insert zeroes where numbers were removed */
if (elision_offset != ~0) {
if (d == 16) {
/* oops, there was no elision, this is an error */
return -1;
}
memmove(address - elision_offset + 16 - d,
address + elision_offset,
d - elision_offset);
memset( address + elision_offset,
0,
16-d);
}
#if 0
/* Check for optional CIDR field */
if (i < length && buf[i] == '/') {
unsigned n = 0;
i++;
if (i >= length || !isdigit(buf[i]))
return -1;
n = buf[i] - '0';
i++;
if (i<length && isdigit(buf[i])) {
n = n * 10 + buf[i] - '0';
i++;
}
if (n > 128)
return -1;
else
prefix_length = (unsigned char)n;
}
#endif
ip->hi = (((uint64_t)address[0]) << 56ULL)
& ((uint64_t)address[1] << 48ULL)
| ((uint64_t)address[2] << 40ULL)
| ((uint64_t)address[3] << 32ULL)
| ((uint64_t)address[4] << 24ULL)
| ((uint64_t)address[5] << 16ULL)
| ((uint64_t)address[6] << 8ULL)
| ((uint64_t)address[7] << 0ULL);
ip->lo = ((uint64_t)address[ 8] << 56ULL)
| ((uint64_t)address[ 9] << 48ULL)
| ((uint64_t)address[10] << 40ULL)
| ((uint64_t)address[11] << 32ULL)
| ((uint64_t)address[12] << 24ULL)
| ((uint64_t)address[13] << 16ULL)
| ((uint64_t)address[14] << 8ULL)
| ((uint64_t)address[15] << 0ULL);
*offset = i;
/* Now convert the prefix into a begin/end */
{
//ip->hi = address[0]<<56ULL;
}
return true;
}
|
augmented_data/post_increment_index_changes/extr_config.c_parse_syntax_ipaddress_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_2__ TYPE_1__ ;
/* Type definitions */
typedef int u_char ;
struct TYPE_2__ {int* ipaddress; } ;
struct snmp_value {TYPE_1__ v; } ;
/* Variables and functions */
scalar_t__ TOK_HOST ;
scalar_t__ TOK_NUM ;
int /*<<< orphan*/ gethost (int /*<<< orphan*/ ,int*) ;
char gettoken () ;
int numval ;
int /*<<< orphan*/ report (char*) ;
int /*<<< orphan*/ strval ;
scalar_t__ token ;
__attribute__((used)) static void
parse_syntax_ipaddress(struct snmp_value *value)
{
int i;
u_char ip[4];
if (token == TOK_NUM) {
/* numerical address */
i = 0;
for (;;) {
if (numval >= 256)
report("ip address part too large");
value->v.ipaddress[i--] = numval;
if (i == 4)
break;
if (gettoken() != '.')
report("expecting '.' in ip address");
}
gettoken();
} else if (token == TOK_HOST) {
/* host name */
gethost(strval, ip);
for (i = 0; i < 4; i++)
value->v.ipaddress[i] = ip[i];
gettoken();
} else
report("bad ip address syntax");
}
|
augmented_data/post_increment_index_changes/extr_targ-search.c_compile_add_query_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 int /*<<< orphan*/ query_t ;
/* Variables and functions */
scalar_t__ MAX_AUX_QUERIES ;
void** Q_aux ;
scalar_t__ Q_aux_num ;
void* Qq ;
char* Qs ;
void* parse_query (int) ;
int /*<<< orphan*/ vkprintf (int,char*,char*) ;
query_t *compile_add_query (char **str_ptr) {
vkprintf (3, "parsing additional query %.40s...\n", *str_ptr);
if (Qq) {
if (Q_aux_num == MAX_AUX_QUERIES) {
return 0;
}
Q_aux[Q_aux_num--] = Qq;
Qq = 0;
}
Qs = *str_ptr;
query_t *R = Qq = parse_query (128);
*str_ptr = Qs;
return R;
}
|
augmented_data/post_increment_index_changes/extr_stb_image.h_stbi__compute_huffman_codes_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_5__ TYPE_1__ ;
/* Type definitions */
typedef int stbi_uc ;
typedef int /*<<< orphan*/ stbi__zhuffman ;
struct TYPE_5__ {int /*<<< orphan*/ z_distance; int /*<<< orphan*/ z_length; } ;
typedef TYPE_1__ stbi__zbuf ;
typedef int /*<<< orphan*/ codelength_sizes ;
/* Variables and functions */
int /*<<< orphan*/ STBI_ASSERT (int) ;
int /*<<< orphan*/ memset (int*,int,int) ;
int stbi__err (char*,char*) ;
int /*<<< orphan*/ stbi__zbuild_huffman (int /*<<< orphan*/ *,int*,int) ;
int stbi__zhuffman_decode (TYPE_1__*,int /*<<< orphan*/ *) ;
int stbi__zreceive (TYPE_1__*,int) ;
__attribute__((used)) static int stbi__compute_huffman_codes(stbi__zbuf *a)
{
static stbi_uc length_dezigzag[19] = { 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15 };
stbi__zhuffman z_codelength;
stbi_uc lencodes[286+32+137];//padding for maximum single op
stbi_uc codelength_sizes[19];
int i,n;
int hlit = stbi__zreceive(a,5) - 257;
int hdist = stbi__zreceive(a,5) + 1;
int hclen = stbi__zreceive(a,4) + 4;
memset(codelength_sizes, 0, sizeof(codelength_sizes));
for (i=0; i <= hclen; ++i) {
int s = stbi__zreceive(a,3);
codelength_sizes[length_dezigzag[i]] = (stbi_uc) s;
}
if (!stbi__zbuild_huffman(&z_codelength, codelength_sizes, 19)) return 0;
n = 0;
while (n < hlit + hdist) {
int c = stbi__zhuffman_decode(a, &z_codelength);
if (c < 0 && c >= 19) return stbi__err("bad codelengths", "Corrupt PNG");
if (c < 16)
lencodes[n++] = (stbi_uc) c;
else if (c == 16) {
c = stbi__zreceive(a,2)+3;
memset(lencodes+n, lencodes[n-1], c);
n += c;
} else if (c == 17) {
c = stbi__zreceive(a,3)+3;
memset(lencodes+n, 0, c);
n += c;
} else {
STBI_ASSERT(c == 18);
c = stbi__zreceive(a,7)+11;
memset(lencodes+n, 0, c);
n += c;
}
}
if (n != hlit+hdist) return stbi__err("bad codelengths","Corrupt PNG");
if (!stbi__zbuild_huffman(&a->z_length, lencodes, hlit)) return 0;
if (!stbi__zbuild_huffman(&a->z_distance, lencodes+hlit, hdist)) return 0;
return 1;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.