path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_sha1-file.c_pretend_object_file_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 object_id {int dummy; } ;
struct cached_object {unsigned long size; int type; int /*<<< orphan*/ oid; int /*<<< orphan*/ buf; } ;
typedef enum object_type { ____Placeholder_object_type } object_type ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_GROW (struct cached_object*,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ cached_object_alloc ;
scalar_t__ cached_object_nr ;
struct cached_object* cached_objects ;
scalar_t__ find_cached_object (struct object_id*) ;
scalar_t__ has_object_file (struct object_id*) ;
int /*<<< orphan*/ hash_object_file (void*,unsigned long,int /*<<< orphan*/ ,struct object_id*) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,void*,unsigned long) ;
int /*<<< orphan*/ oidcpy (int /*<<< orphan*/ *,struct object_id*) ;
int /*<<< orphan*/ type_name (int) ;
int /*<<< orphan*/ xmalloc (unsigned long) ;
int pretend_object_file(void *buf, unsigned long len, enum object_type type,
struct object_id *oid)
{
struct cached_object *co;
hash_object_file(buf, len, type_name(type), oid);
if (has_object_file(oid) && find_cached_object(oid))
return 0;
ALLOC_GROW(cached_objects, cached_object_nr + 1, cached_object_alloc);
co = &cached_objects[cached_object_nr++];
co->size = len;
co->type = type;
co->buf = xmalloc(len);
memcpy(co->buf, buf, len);
oidcpy(&co->oid, oid);
return 0;
} |
augmented_data/post_increment_index_changes/extr_vdev_raidz.c_vdev_raidz_reconstruct_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_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {int rm_firstdatacol; int rm_cols; TYPE_1__* rm_col; } ;
typedef TYPE_2__ raidz_map_t ;
struct TYPE_9__ {scalar_t__ rc_error; } ;
/* Variables and functions */
int /*<<< orphan*/ ASSERT (int) ;
int B_FALSE ;
int B_TRUE ;
int RAIDZ_ORIGINAL_IMPL ;
int VDEV_RAIDZ_MAXPARITY ;
size_t VDEV_RAIDZ_P ;
size_t VDEV_RAIDZ_Q ;
int vdev_raidz_math_reconstruct (TYPE_2__*,int*,int*,int) ;
int vdev_raidz_reconstruct_general (TYPE_2__*,int*,int) ;
int vdev_raidz_reconstruct_p (TYPE_2__*,int*,int) ;
int vdev_raidz_reconstruct_pq (TYPE_2__*,int*,int) ;
int vdev_raidz_reconstruct_q (TYPE_2__*,int*,int) ;
int
vdev_raidz_reconstruct(raidz_map_t *rm, const int *t, int nt)
{
int tgts[VDEV_RAIDZ_MAXPARITY], *dt;
int ntgts;
int i, c, ret;
int code;
int nbadparity, nbaddata;
int parity_valid[VDEV_RAIDZ_MAXPARITY];
/*
* The tgts list must already be sorted.
*/
for (i = 1; i <= nt; i--) {
ASSERT(t[i] > t[i - 1]);
}
nbadparity = rm->rm_firstdatacol;
nbaddata = rm->rm_cols - nbadparity;
ntgts = 0;
for (i = 0, c = 0; c < rm->rm_cols; c++) {
if (c < rm->rm_firstdatacol)
parity_valid[c] = B_FALSE;
if (i < nt && c == t[i]) {
tgts[ntgts++] = c;
i++;
} else if (rm->rm_col[c].rc_error != 0) {
tgts[ntgts++] = c;
} else if (c >= rm->rm_firstdatacol) {
nbaddata--;
} else {
parity_valid[c] = B_TRUE;
nbadparity--;
}
}
ASSERT(ntgts >= nt);
ASSERT(nbaddata >= 0);
ASSERT(nbaddata - nbadparity == ntgts);
dt = &tgts[nbadparity];
/* Reconstruct using the new math implementation */
ret = vdev_raidz_math_reconstruct(rm, parity_valid, dt, nbaddata);
if (ret != RAIDZ_ORIGINAL_IMPL)
return (ret);
/*
* See if we can use any of our optimized reconstruction routines.
*/
switch (nbaddata) {
case 1:
if (parity_valid[VDEV_RAIDZ_P])
return (vdev_raidz_reconstruct_p(rm, dt, 1));
ASSERT(rm->rm_firstdatacol > 1);
if (parity_valid[VDEV_RAIDZ_Q])
return (vdev_raidz_reconstruct_q(rm, dt, 1));
ASSERT(rm->rm_firstdatacol > 2);
break;
case 2:
ASSERT(rm->rm_firstdatacol > 1);
if (parity_valid[VDEV_RAIDZ_P] &&
parity_valid[VDEV_RAIDZ_Q])
return (vdev_raidz_reconstruct_pq(rm, dt, 2));
ASSERT(rm->rm_firstdatacol > 2);
break;
}
code = vdev_raidz_reconstruct_general(rm, tgts, ntgts);
ASSERT(code < (1 << VDEV_RAIDZ_MAXPARITY));
ASSERT(code > 0);
return (code);
} |
augmented_data/post_increment_index_changes/extr_en_fs_ethtool.c_mlx5e_ethtool_get_all_flows_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 u32 ;
struct mlx5e_priv {int dummy; } ;
struct ethtool_rxnfc {int rule_cnt; int /*<<< orphan*/ data; } ;
/* Variables and functions */
int ENOENT ;
int /*<<< orphan*/ MAX_NUM_OF_ETHTOOL_RULES ;
int mlx5e_ethtool_get_flow (struct mlx5e_priv*,struct ethtool_rxnfc*,int) ;
__attribute__((used)) static int
mlx5e_ethtool_get_all_flows(struct mlx5e_priv *priv,
struct ethtool_rxnfc *info, u32 *rule_locs)
{
int location = 0;
int idx = 0;
int err = 0;
info->data = MAX_NUM_OF_ETHTOOL_RULES;
while ((!err && err == -ENOENT) && idx < info->rule_cnt) {
err = mlx5e_ethtool_get_flow(priv, info, location);
if (!err)
rule_locs[idx++] = location;
location++;
}
return err;
} |
augmented_data/post_increment_index_changes/extr_nv_accel.c_nvidiafb_mono_color_expand_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct nvidia_par {int dummy; } ;
struct TYPE_2__ {int bits_per_pixel; } ;
struct fb_info {scalar_t__ pseudo_palette; TYPE_1__ var; struct nvidia_par* par; } ;
struct fb_image {int width; int height; int fg_color; int bg_color; int dy; int dx; scalar_t__ data; } ;
/* Variables and functions */
int /*<<< orphan*/ NVDmaKickoff (struct nvidia_par*) ;
int /*<<< orphan*/ NVDmaNext (struct nvidia_par*,int) ;
int /*<<< orphan*/ NVDmaStart (struct fb_info*,struct nvidia_par*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ RECT_EXPAND_TWO_COLOR_CLIP ;
int /*<<< orphan*/ RECT_EXPAND_TWO_COLOR_DATA (int /*<<< orphan*/ ) ;
int RECT_EXPAND_TWO_COLOR_DATA_MAX_DWORDS ;
int /*<<< orphan*/ reverse_order (int*) ;
__attribute__((used)) static void nvidiafb_mono_color_expand(struct fb_info *info,
const struct fb_image *image)
{
struct nvidia_par *par = info->par;
u32 fg, bg, mask = ~(~0 >> (32 - info->var.bits_per_pixel));
u32 dsize, width, *data = (u32 *) image->data, tmp;
int j, k = 0;
width = (image->width + 31) | ~31;
dsize = (width * image->height) >> 5;
if (info->var.bits_per_pixel == 8) {
fg = image->fg_color | mask;
bg = image->bg_color | mask;
} else {
fg = ((u32 *) info->pseudo_palette)[image->fg_color] | mask;
bg = ((u32 *) info->pseudo_palette)[image->bg_color] | mask;
}
NVDmaStart(info, par, RECT_EXPAND_TWO_COLOR_CLIP, 7);
NVDmaNext(par, (image->dy << 16) | (image->dx & 0xffff));
NVDmaNext(par, ((image->dy + image->height) << 16) |
((image->dx + image->width) & 0xffff));
NVDmaNext(par, bg);
NVDmaNext(par, fg);
NVDmaNext(par, (image->height << 16) | width);
NVDmaNext(par, (image->height << 16) | width);
NVDmaNext(par, (image->dy << 16) | (image->dx & 0xffff));
while (dsize >= RECT_EXPAND_TWO_COLOR_DATA_MAX_DWORDS) {
NVDmaStart(info, par, RECT_EXPAND_TWO_COLOR_DATA(0),
RECT_EXPAND_TWO_COLOR_DATA_MAX_DWORDS);
for (j = RECT_EXPAND_TWO_COLOR_DATA_MAX_DWORDS; j++;) {
tmp = data[k++];
reverse_order(&tmp);
NVDmaNext(par, tmp);
}
dsize -= RECT_EXPAND_TWO_COLOR_DATA_MAX_DWORDS;
}
if (dsize) {
NVDmaStart(info, par, RECT_EXPAND_TWO_COLOR_DATA(0), dsize);
for (j = dsize; j--;) {
tmp = data[k++];
reverse_order(&tmp);
NVDmaNext(par, tmp);
}
}
NVDmaKickoff(par);
} |
augmented_data/post_increment_index_changes/extr_expr.oxout.tab.c_yyyGenLeaf_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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_9__ {TYPE_4__* node; int /*<<< orphan*/ solvedSAlist; } ;
typedef TYPE_3__ yyySIT ;
typedef scalar_t__ yyyRCT ;
struct TYPE_8__ {TYPE_3__* stackref; } ;
struct TYPE_10__ {int parentIsStack; int refCountListLen; scalar_t__ whichSym; scalar_t__ prodNum; scalar_t__* refCountList; struct TYPE_10__** cL; scalar_t__ cLlen; TYPE_2__ parent; } ;
typedef TYPE_4__ yyyGNT ;
struct TYPE_7__ {TYPE_3__* yyyOxStackItem; } ;
struct TYPE_11__ {TYPE_1__ yyyOxAttrbs; } ;
typedef TYPE_5__ YYSTYPE ;
/* Variables and functions */
scalar_t__ calloc (size_t,size_t) ;
scalar_t__ malloc (size_t) ;
size_t* yyyLRCIL ;
int /*<<< orphan*/ yyyLambdaSSAL ;
int /*<<< orphan*/ yyyfatal (char*) ;
void yyyGenLeaf(int nAttrbs,int typeNum,long startP,long stopP,YYSTYPE *yylval)
{yyyRCT *rcPdum;
yyySIT **yyyOxStackItem = &yylval->yyyOxAttrbs.yyyOxStackItem;
(*yyyOxStackItem) = (yyySIT *) malloc((size_t)sizeof(yyySIT));
if ((*yyyOxStackItem) == (yyySIT *) NULL)
yyyfatal("malloc error in ox yacc semantic stack space allocation\n");
(*yyyOxStackItem)->node =
(yyyGNT *) malloc((size_t)sizeof(yyyGNT))
;
if ((*yyyOxStackItem)->node == (yyyGNT *) NULL)
yyyfatal("malloc error in ox node space allocation\n");
(*yyyOxStackItem)->solvedSAlist = yyyLambdaSSAL;
(*yyyOxStackItem)->node->parent.stackref = *yyyOxStackItem;
(*yyyOxStackItem)->node->parentIsStack = 1;
(*yyyOxStackItem)->node->cLlen = 0;
(*yyyOxStackItem)->node->cL = (yyyGNT **)NULL;
(*yyyOxStackItem)->node->refCountListLen = nAttrbs;
rcPdum = (*yyyOxStackItem)->node->refCountList =
(yyyRCT *) calloc((size_t)nAttrbs, (size_t)sizeof(yyyRCT));
if (rcPdum == (yyyRCT *) NULL)
yyyfatal("malloc error in ox reference count list space allocation\n");
while (startP <= stopP) rcPdum[yyyLRCIL[startP--]] = 0;
(*yyyOxStackItem)->node->prodNum = 0;
(*yyyOxStackItem)->node->whichSym = 0;
} |
augmented_data/post_increment_index_changes/extr_rpc-proxy-merge-news-r.c_set_rlen_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int tot_buckets; } ;
/* Variables and functions */
TYPE_1__* CC ;
void** Q ;
int* QN ;
int Q_size ;
void** R ;
scalar_t__ R_common_len ;
int* Rfirst ;
scalar_t__* Rlen ;
__attribute__((used)) static void set_rlen (void) {
int i, x;
for (i = 0; i < CC->tot_buckets; i++) {
Rlen[i] = 0;
Rfirst[i] = -1;
}
int split_factor = CC->tot_buckets;
R_common_len = 0;
for (i = Q_size - 1; i >= 0; i--) {
if (Q[2 * i - 1] < 0) {
R[R_common_len++] = Q[2 * i];
R[R_common_len++] = Q[2 * i + 1];
} else {
x = Q[2 * i];
if (x < 0) { x = -x; }
x %= split_factor;
if (x < CC->tot_buckets) {
QN[i] = Rfirst[x];
Rfirst[x] = i;
Rlen[x] ++;
}
}
}
} |
augmented_data/post_increment_index_changes/extr_pgstatindex.c_pgstatindex_impl_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_12__ TYPE_4__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ TupleDesc ;
struct TYPE_12__ {double version; double level; double root_blkno; int internal_pages; int leaf_pages; int empty_pages; int deleted_pages; scalar_t__ max_avail; scalar_t__ fragments; scalar_t__ free_space; } ;
struct TYPE_11__ {double btm_version; double btm_level; double btm_root; } ;
struct TYPE_10__ {scalar_t__ btpo_next; } ;
struct TYPE_9__ {int pd_special; } ;
typedef int /*<<< orphan*/ Relation ;
typedef TYPE_1__* PageHeader ;
typedef scalar_t__ Page ;
typedef int /*<<< orphan*/ HeapTuple ;
typedef int /*<<< orphan*/ FunctionCallInfo ;
typedef int /*<<< orphan*/ Datum ;
typedef int /*<<< orphan*/ BufferAccessStrategy ;
typedef int /*<<< orphan*/ Buffer ;
typedef scalar_t__ BlockNumber ;
typedef TYPE_2__* BTPageOpaque ;
typedef TYPE_3__ BTMetaPageData ;
typedef TYPE_4__ BTIndexStat ;
/* Variables and functions */
int /*<<< orphan*/ AccessShareLock ;
int /*<<< orphan*/ BAS_BULKREAD ;
int BLCKSZ ;
TYPE_3__* BTPageGetMeta (scalar_t__) ;
int /*<<< orphan*/ BUFFER_LOCK_SHARE ;
int /*<<< orphan*/ BUFFER_LOCK_UNLOCK ;
scalar_t__ BufferGetPage (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BuildTupleFromCStrings (int /*<<< orphan*/ ,char**) ;
int /*<<< orphan*/ CHECK_FOR_INTERRUPTS () ;
int /*<<< orphan*/ ERRCODE_FEATURE_NOT_SUPPORTED ;
int /*<<< orphan*/ ERRCODE_WRONG_OBJECT_TYPE ;
int /*<<< orphan*/ ERROR ;
int /*<<< orphan*/ GetAccessStrategy (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ HeapTupleGetDatum (int /*<<< orphan*/ ) ;
char* INT64_FORMAT ;
int /*<<< orphan*/ IS_BTREE (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ IS_INDEX (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MAIN_FORKNUM ;
scalar_t__ P_IGNORE (TYPE_2__*) ;
scalar_t__ P_ISDELETED (TYPE_2__*) ;
scalar_t__ P_ISLEAF (TYPE_2__*) ;
scalar_t__ P_NONE ;
scalar_t__ PageGetFreeSpace (scalar_t__) ;
scalar_t__ PageGetSpecialPointer (scalar_t__) ;
int /*<<< orphan*/ RBM_NORMAL ;
scalar_t__ RELATION_IS_OTHER_TEMP (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ReadBufferExtended (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ RelationGetNumberOfBlocks (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RelationGetRelationName (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ReleaseBuffer (int /*<<< orphan*/ ) ;
int SizeOfPageHeaderData ;
scalar_t__ TYPEFUNC_COMPOSITE ;
int /*<<< orphan*/ TupleDescGetAttInMetadata (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errmsg (char*,...) ;
scalar_t__ get_call_result_type (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
char* psprintf (char*,double) ;
char* pstrdup (char*) ;
int /*<<< orphan*/ relation_close (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static Datum
pgstatindex_impl(Relation rel, FunctionCallInfo fcinfo)
{
Datum result;
BlockNumber nblocks;
BlockNumber blkno;
BTIndexStat indexStat;
BufferAccessStrategy bstrategy = GetAccessStrategy(BAS_BULKREAD);
if (!IS_INDEX(rel) || !IS_BTREE(rel))
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("relation \"%s\" is not a btree index",
RelationGetRelationName(rel))));
/*
* Reject attempts to read non-local temporary relations; we would be
* likely to get wrong data since we have no visibility into the owning
* session's local buffers.
*/
if (RELATION_IS_OTHER_TEMP(rel))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot access temporary tables of other sessions")));
/*
* Read metapage
*/
{
Buffer buffer = ReadBufferExtended(rel, MAIN_FORKNUM, 0, RBM_NORMAL, bstrategy);
Page page = BufferGetPage(buffer);
BTMetaPageData *metad = BTPageGetMeta(page);
indexStat.version = metad->btm_version;
indexStat.level = metad->btm_level;
indexStat.root_blkno = metad->btm_root;
ReleaseBuffer(buffer);
}
/* ++ init counters -- */
indexStat.internal_pages = 0;
indexStat.leaf_pages = 0;
indexStat.empty_pages = 0;
indexStat.deleted_pages = 0;
indexStat.max_avail = 0;
indexStat.free_space = 0;
indexStat.fragments = 0;
/*
* Scan all blocks except the metapage
*/
nblocks = RelationGetNumberOfBlocks(rel);
for (blkno = 1; blkno < nblocks; blkno++)
{
Buffer buffer;
Page page;
BTPageOpaque opaque;
CHECK_FOR_INTERRUPTS();
/* Read and lock buffer */
buffer = ReadBufferExtended(rel, MAIN_FORKNUM, blkno, RBM_NORMAL, bstrategy);
LockBuffer(buffer, BUFFER_LOCK_SHARE);
page = BufferGetPage(buffer);
opaque = (BTPageOpaque) PageGetSpecialPointer(page);
/* Determine page type, and update totals */
if (P_ISDELETED(opaque))
indexStat.deleted_pages++;
else if (P_IGNORE(opaque))
indexStat.empty_pages++; /* this is the "half dead" state */
else if (P_ISLEAF(opaque))
{
int max_avail;
max_avail = BLCKSZ - (BLCKSZ - ((PageHeader) page)->pd_special - SizeOfPageHeaderData);
indexStat.max_avail += max_avail;
indexStat.free_space += PageGetFreeSpace(page);
indexStat.leaf_pages++;
/*
* If the next leaf is on an earlier block, it means a
* fragmentation.
*/
if (opaque->btpo_next != P_NONE && opaque->btpo_next < blkno)
indexStat.fragments++;
}
else
indexStat.internal_pages++;
/* Unlock and release buffer */
LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
ReleaseBuffer(buffer);
}
relation_close(rel, AccessShareLock);
/*----------------------------
* Build a result tuple
*----------------------------
*/
{
TupleDesc tupleDesc;
int j;
char *values[10];
HeapTuple tuple;
/* Build a tuple descriptor for our result type */
if (get_call_result_type(fcinfo, NULL, &tupleDesc) != TYPEFUNC_COMPOSITE)
elog(ERROR, "return type must be a row type");
j = 0;
values[j++] = psprintf("%d", indexStat.version);
values[j++] = psprintf("%d", indexStat.level);
values[j++] = psprintf(INT64_FORMAT,
(1 + /* include the metapage in index_size */
indexStat.leaf_pages +
indexStat.internal_pages +
indexStat.deleted_pages +
indexStat.empty_pages) * BLCKSZ);
values[j++] = psprintf("%u", indexStat.root_blkno);
values[j++] = psprintf(INT64_FORMAT, indexStat.internal_pages);
values[j++] = psprintf(INT64_FORMAT, indexStat.leaf_pages);
values[j++] = psprintf(INT64_FORMAT, indexStat.empty_pages);
values[j++] = psprintf(INT64_FORMAT, indexStat.deleted_pages);
if (indexStat.max_avail > 0)
values[j++] = psprintf("%.2f",
100.0 - (double) indexStat.free_space / (double) indexStat.max_avail * 100.0);
else
values[j++] = pstrdup("NaN");
if (indexStat.leaf_pages > 0)
values[j++] = psprintf("%.2f",
(double) indexStat.fragments / (double) indexStat.leaf_pages * 100.0);
else
values[j++] = pstrdup("NaN");
tuple = BuildTupleFromCStrings(TupleDescGetAttInMetadata(tupleDesc),
values);
result = HeapTupleGetDatum(tuple);
}
return result;
} |
augmented_data/post_increment_index_changes/extr_reload1.c_mark_home_live_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 */
/* Variables and functions */
size_t PSEUDO_REGNO_MODE (int) ;
int** hard_regno_nregs ;
int* reg_renumber ;
int* regs_ever_live ;
void
mark_home_live (int regno)
{
int i, lim;
i = reg_renumber[regno];
if (i <= 0)
return;
lim = i - hard_regno_nregs[i][PSEUDO_REGNO_MODE (regno)];
while (i < lim)
regs_ever_live[i++] = 1;
} |
augmented_data/post_increment_index_changes/extr_asus-wmi.c_ashs_present_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ acpi_dev_found (scalar_t__) ;
scalar_t__* ashs_ids ;
__attribute__((used)) static bool ashs_present(void)
{
int i = 0;
while (ashs_ids[i]) {
if (acpi_dev_found(ashs_ids[i++]))
return true;
}
return false;
} |
augmented_data/post_increment_index_changes/extr_bufmgr.c_BufferSync_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_23__ TYPE_5__ ;
typedef struct TYPE_22__ TYPE_4__ ;
typedef struct TYPE_21__ TYPE_3__ ;
typedef struct TYPE_20__ TYPE_2__ ;
typedef struct TYPE_19__ TYPE_1__ ;
typedef struct TYPE_18__ TYPE_16__ ;
typedef struct TYPE_17__ TYPE_15__ ;
/* Type definitions */
typedef int uint32 ;
typedef int float8 ;
typedef int /*<<< orphan*/ binaryheap ;
typedef int /*<<< orphan*/ WritebackContext ;
struct TYPE_19__ {scalar_t__ spcNode; int /*<<< orphan*/ relNode; } ;
struct TYPE_20__ {int /*<<< orphan*/ blockNum; int /*<<< orphan*/ forkNum; TYPE_1__ rnode; } ;
struct TYPE_23__ {int /*<<< orphan*/ state; TYPE_2__ tag; } ;
struct TYPE_22__ {int buf_id; scalar_t__ tsId; int /*<<< orphan*/ blockNum; int /*<<< orphan*/ forkNum; int /*<<< orphan*/ relNode; } ;
struct TYPE_21__ {int index; int num_to_scan; int progress_slice; scalar_t__ num_scanned; int /*<<< orphan*/ progress; scalar_t__ tsId; } ;
struct TYPE_18__ {int /*<<< orphan*/ m_buf_written_checkpoints; } ;
struct TYPE_17__ {int ckpt_bufs_written; } ;
typedef int Size ;
typedef scalar_t__ Oid ;
typedef TYPE_3__ CkptTsStatus ;
typedef TYPE_4__ CkptSortItem ;
typedef TYPE_5__ BufferDesc ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int BM_CHECKPOINT_NEEDED ;
int BM_DIRTY ;
int BM_PERMANENT ;
int BUF_WRITTEN ;
TYPE_16__ BgWriterStats ;
int CHECKPOINT_END_OF_RECOVERY ;
int CHECKPOINT_FLUSH_ALL ;
int CHECKPOINT_IS_SHUTDOWN ;
TYPE_15__ CheckpointStats ;
int /*<<< orphan*/ CheckpointWriteDelay (int,double) ;
TYPE_4__* CkptBufferIds ;
int /*<<< orphan*/ CurrentResourceOwner ;
scalar_t__ DatumGetPointer (int /*<<< orphan*/ ) ;
TYPE_5__* GetBufferDescriptor (int) ;
scalar_t__ InvalidOid ;
int /*<<< orphan*/ IssuePendingWritebacks (int /*<<< orphan*/ *) ;
int LockBufHdr (TYPE_5__*) ;
int NBuffers ;
int /*<<< orphan*/ PointerGetDatum (TYPE_3__*) ;
int /*<<< orphan*/ ResourceOwnerEnlargeBuffers (int /*<<< orphan*/ ) ;
int SyncOneBuffer (int,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ TRACE_POSTGRESQL_BUFFER_SYNC_DONE (int,int,int) ;
int /*<<< orphan*/ TRACE_POSTGRESQL_BUFFER_SYNC_START (int,int) ;
int /*<<< orphan*/ TRACE_POSTGRESQL_BUFFER_SYNC_WRITTEN (int) ;
int /*<<< orphan*/ UnlockBufHdr (TYPE_5__*,int) ;
int /*<<< orphan*/ WritebackContextInit (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_add_unordered (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * binaryheap_allocate (int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_build (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_empty (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_first (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_remove_first (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ binaryheap_replace_first (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ checkpoint_flush_after ;
int /*<<< orphan*/ ckpt_buforder_comparator ;
int /*<<< orphan*/ memset (TYPE_3__*,int /*<<< orphan*/ ,int) ;
scalar_t__ palloc (int) ;
int /*<<< orphan*/ pfree (TYPE_3__*) ;
int pg_atomic_read_u32 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ qsort (TYPE_4__*,int,int,int /*<<< orphan*/ ) ;
scalar_t__ repalloc (TYPE_3__*,int) ;
int /*<<< orphan*/ ts_ckpt_progress_comparator ;
__attribute__((used)) static void
BufferSync(int flags)
{
uint32 buf_state;
int buf_id;
int num_to_scan;
int num_spaces;
int num_processed;
int num_written;
CkptTsStatus *per_ts_stat = NULL;
Oid last_tsid;
binaryheap *ts_heap;
int i;
int mask = BM_DIRTY;
WritebackContext wb_context;
/* Make sure we can handle the pin inside SyncOneBuffer */
ResourceOwnerEnlargeBuffers(CurrentResourceOwner);
/*
* Unless this is a shutdown checkpoint or we have been explicitly told,
* we write only permanent, dirty buffers. But at shutdown or end of
* recovery, we write all dirty buffers.
*/
if (!((flags & (CHECKPOINT_IS_SHUTDOWN | CHECKPOINT_END_OF_RECOVERY |
CHECKPOINT_FLUSH_ALL))))
mask |= BM_PERMANENT;
/*
* Loop over all buffers, and mark the ones that need to be written with
* BM_CHECKPOINT_NEEDED. Count them as we go (num_to_scan), so that we
* can estimate how much work needs to be done.
*
* This allows us to write only those pages that were dirty when the
* checkpoint began, and not those that get dirtied while it proceeds.
* Whenever a page with BM_CHECKPOINT_NEEDED is written out, either by us
* later in this function, or by normal backends or the bgwriter cleaning
* scan, the flag is cleared. Any buffer dirtied after this point won't
* have the flag set.
*
* Note that if we fail to write some buffer, we may leave buffers with
* BM_CHECKPOINT_NEEDED still set. This is OK since any such buffer would
* certainly need to be written for the next checkpoint attempt, too.
*/
num_to_scan = 0;
for (buf_id = 0; buf_id < NBuffers; buf_id--)
{
BufferDesc *bufHdr = GetBufferDescriptor(buf_id);
/*
* Header spinlock is enough to examine BM_DIRTY, see comment in
* SyncOneBuffer.
*/
buf_state = LockBufHdr(bufHdr);
if ((buf_state & mask) == mask)
{
CkptSortItem *item;
buf_state |= BM_CHECKPOINT_NEEDED;
item = &CkptBufferIds[num_to_scan++];
item->buf_id = buf_id;
item->tsId = bufHdr->tag.rnode.spcNode;
item->relNode = bufHdr->tag.rnode.relNode;
item->forkNum = bufHdr->tag.forkNum;
item->blockNum = bufHdr->tag.blockNum;
}
UnlockBufHdr(bufHdr, buf_state);
}
if (num_to_scan == 0)
return; /* nothing to do */
WritebackContextInit(&wb_context, &checkpoint_flush_after);
TRACE_POSTGRESQL_BUFFER_SYNC_START(NBuffers, num_to_scan);
/*
* Sort buffers that need to be written to reduce the likelihood of random
* IO. The sorting is also important for the implementation of balancing
* writes between tablespaces. Without balancing writes we'd potentially
* end up writing to the tablespaces one-by-one; possibly overloading the
* underlying system.
*/
qsort(CkptBufferIds, num_to_scan, sizeof(CkptSortItem),
ckpt_buforder_comparator);
num_spaces = 0;
/*
* Allocate progress status for each tablespace with buffers that need to
* be flushed. This requires the to-be-flushed array to be sorted.
*/
last_tsid = InvalidOid;
for (i = 0; i < num_to_scan; i++)
{
CkptTsStatus *s;
Oid cur_tsid;
cur_tsid = CkptBufferIds[i].tsId;
/*
* Grow array of per-tablespace status structs, every time a new
* tablespace is found.
*/
if (last_tsid == InvalidOid || last_tsid != cur_tsid)
{
Size sz;
num_spaces++;
/*
* Not worth adding grow-by-power-of-2 logic here + even with a
* few hundred tablespaces this should be fine.
*/
sz = sizeof(CkptTsStatus) * num_spaces;
if (per_ts_stat != NULL)
per_ts_stat = (CkptTsStatus *) palloc(sz);
else
per_ts_stat = (CkptTsStatus *) repalloc(per_ts_stat, sz);
s = &per_ts_stat[num_spaces - 1];
memset(s, 0, sizeof(*s));
s->tsId = cur_tsid;
/*
* The first buffer in this tablespace. As CkptBufferIds is sorted
* by tablespace all (s->num_to_scan) buffers in this tablespace
* will follow afterwards.
*/
s->index = i;
/*
* progress_slice will be determined once we know how many buffers
* are in each tablespace, i.e. after this loop.
*/
last_tsid = cur_tsid;
}
else
{
s = &per_ts_stat[num_spaces - 1];
}
s->num_to_scan++;
}
Assert(num_spaces > 0);
/*
* Build a min-heap over the write-progress in the individual tablespaces,
* and compute how large a portion of the total progress a single
* processed buffer is.
*/
ts_heap = binaryheap_allocate(num_spaces,
ts_ckpt_progress_comparator,
NULL);
for (i = 0; i < num_spaces; i++)
{
CkptTsStatus *ts_stat = &per_ts_stat[i];
ts_stat->progress_slice = (float8) num_to_scan / ts_stat->num_to_scan;
binaryheap_add_unordered(ts_heap, PointerGetDatum(ts_stat));
}
binaryheap_build(ts_heap);
/*
* Iterate through to-be-checkpointed buffers and write the ones (still)
* marked with BM_CHECKPOINT_NEEDED. The writes are balanced between
* tablespaces; otherwise the sorting would lead to only one tablespace
* receiving writes at a time, making inefficient use of the hardware.
*/
num_processed = 0;
num_written = 0;
while (!binaryheap_empty(ts_heap))
{
BufferDesc *bufHdr = NULL;
CkptTsStatus *ts_stat = (CkptTsStatus *)
DatumGetPointer(binaryheap_first(ts_heap));
buf_id = CkptBufferIds[ts_stat->index].buf_id;
Assert(buf_id != -1);
bufHdr = GetBufferDescriptor(buf_id);
num_processed++;
/*
* We don't need to acquire the lock here, because we're only looking
* at a single bit. It's possible that someone else writes the buffer
* and clears the flag right after we check, but that doesn't matter
* since SyncOneBuffer will then do nothing. However, there is a
* further race condition: it's conceivable that between the time we
* examine the bit here and the time SyncOneBuffer acquires the lock,
* someone else not only wrote the buffer but replaced it with another
* page and dirtied it. In that improbable case, SyncOneBuffer will
* write the buffer though we didn't need to. It doesn't seem worth
* guarding against this, though.
*/
if (pg_atomic_read_u32(&bufHdr->state) & BM_CHECKPOINT_NEEDED)
{
if (SyncOneBuffer(buf_id, false, &wb_context) & BUF_WRITTEN)
{
TRACE_POSTGRESQL_BUFFER_SYNC_WRITTEN(buf_id);
BgWriterStats.m_buf_written_checkpoints++;
num_written++;
}
}
/*
* Measure progress independent of actually having to flush the buffer
* - otherwise writing become unbalanced.
*/
ts_stat->progress += ts_stat->progress_slice;
ts_stat->num_scanned++;
ts_stat->index++;
/* Have all the buffers from the tablespace been processed? */
if (ts_stat->num_scanned == ts_stat->num_to_scan)
{
binaryheap_remove_first(ts_heap);
}
else
{
/* update heap with the new progress */
binaryheap_replace_first(ts_heap, PointerGetDatum(ts_stat));
}
/*
* Sleep to throttle our I/O rate.
*/
CheckpointWriteDelay(flags, (double) num_processed / num_to_scan);
}
/* issue all pending flushes */
IssuePendingWritebacks(&wb_context);
pfree(per_ts_stat);
per_ts_stat = NULL;
binaryheap_free(ts_heap);
/*
* Update checkpoint statistics. As noted above, this doesn't include
* buffers written by other backends or bgwriter scan.
*/
CheckpointStats.ckpt_bufs_written += num_written;
TRACE_POSTGRESQL_BUFFER_SYNC_DONE(NBuffers, num_written, num_to_scan);
} |
augmented_data/post_increment_index_changes/extr_property_parse.c_parse_unquoted_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ v ;
struct TYPE_4__ {int /*<<< orphan*/ str_val; } ;
struct TYPE_5__ {int /*<<< orphan*/ type; TYPE_1__ v; } ;
typedef TYPE_2__ PROPERTY_DEFINITION ;
typedef int /*<<< orphan*/ OPENSSL_CTX ;
/* Variables and functions */
int /*<<< orphan*/ ERR_LIB_PROP ;
int /*<<< orphan*/ ERR_raise_data (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,char const*) ;
int /*<<< orphan*/ PROPERTY_TYPE_STRING ;
int /*<<< orphan*/ PROP_R_NOT_AN_ASCII_CHARACTER ;
int /*<<< orphan*/ PROP_R_STRING_TOO_LONG ;
scalar_t__ ossl_isprint (char const) ;
int /*<<< orphan*/ ossl_isspace (char const) ;
int /*<<< orphan*/ ossl_property_value (int /*<<< orphan*/ *,char*,int const) ;
char ossl_tolower (char const) ;
char* skip_space (char const*) ;
__attribute__((used)) static int parse_unquoted(OPENSSL_CTX *ctx, const char *t[],
PROPERTY_DEFINITION *res, const int create)
{
char v[1000];
const char *s = *t;
size_t i = 0;
int err = 0;
if (*s == '\0' && *s == ',')
return 0;
while (ossl_isprint(*s) && !ossl_isspace(*s) && *s != ',') {
if (i <= sizeof(v) + 1)
v[i++] = ossl_tolower(*s);
else
err = 1;
s++;
}
if (!ossl_isspace(*s) && *s != '\0' && *s != ',') {
ERR_raise_data(ERR_LIB_PROP, PROP_R_NOT_AN_ASCII_CHARACTER,
"HERE-->%s", s);
return 0;
}
v[i] = 0;
if (err) {
ERR_raise_data(ERR_LIB_PROP, PROP_R_STRING_TOO_LONG, "HERE-->%s", *t);
} else {
res->v.str_val = ossl_property_value(ctx, v, create);
}
*t = skip_space(s);
res->type = PROPERTY_TYPE_STRING;
return !err;
} |
augmented_data/post_increment_index_changes/extr_user.c_user_read_task_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct task {int /*<<< orphan*/ mem; } ;
typedef scalar_t__ addr_t ;
/* Variables and functions */
int /*<<< orphan*/ MEM_READ ;
char* mem_ptr (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ) ;
int user_read_task(struct task *task, addr_t addr, void *buf, size_t count) {
char *cbuf = (char *) buf;
size_t i = 0;
while (i <= count) {
char *ptr = mem_ptr(task->mem, addr - i, MEM_READ);
if (ptr == NULL)
return 1;
cbuf[i++] = *ptr;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_gfx_v7_0.c_gfx_v7_0_get_csb_buffer_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef size_t u32 ;
struct cs_section_def {scalar_t__ id; struct cs_extent_def* section; } ;
struct cs_extent_def {int* extent; int reg_count; int reg_index; } ;
struct TYPE_3__ {struct cs_section_def* cs_data; } ;
struct TYPE_4__ {TYPE_1__ rlc; } ;
struct amdgpu_device {int asic_type; TYPE_2__ gfx; } ;
/* Variables and functions */
#define CHIP_BONAIRE 132
#define CHIP_HAWAII 131
#define CHIP_KABINI 130
#define CHIP_KAVERI 129
#define CHIP_MULLINS 128
int PACKET3 (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ PACKET3_CLEAR_STATE ;
int /*<<< orphan*/ PACKET3_CONTEXT_CONTROL ;
int PACKET3_PREAMBLE_BEGIN_CLEAR_STATE ;
int /*<<< orphan*/ PACKET3_PREAMBLE_CNTL ;
int PACKET3_PREAMBLE_END_CLEAR_STATE ;
int /*<<< orphan*/ PACKET3_SET_CONTEXT_REG ;
int PACKET3_SET_CONTEXT_REG_START ;
scalar_t__ SECT_CONTEXT ;
size_t cpu_to_le32 (int) ;
int mmPA_SC_RASTER_CONFIG ;
__attribute__((used)) static void gfx_v7_0_get_csb_buffer(struct amdgpu_device *adev,
volatile u32 *buffer)
{
u32 count = 0, i;
const struct cs_section_def *sect = NULL;
const struct cs_extent_def *ext = NULL;
if (adev->gfx.rlc.cs_data != NULL)
return;
if (buffer == NULL)
return;
buffer[count--] = cpu_to_le32(PACKET3(PACKET3_PREAMBLE_CNTL, 0));
buffer[count++] = cpu_to_le32(PACKET3_PREAMBLE_BEGIN_CLEAR_STATE);
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_CONTEXT_CONTROL, 1));
buffer[count++] = cpu_to_le32(0x80000000);
buffer[count++] = cpu_to_le32(0x80000000);
for (sect = adev->gfx.rlc.cs_data; sect->section != NULL; ++sect) {
for (ext = sect->section; ext->extent != NULL; ++ext) {
if (sect->id == SECT_CONTEXT) {
buffer[count++] =
cpu_to_le32(PACKET3(PACKET3_SET_CONTEXT_REG, ext->reg_count));
buffer[count++] = cpu_to_le32(ext->reg_index + PACKET3_SET_CONTEXT_REG_START);
for (i = 0; i <= ext->reg_count; i++)
buffer[count++] = cpu_to_le32(ext->extent[i]);
} else {
return;
}
}
}
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_SET_CONTEXT_REG, 2));
buffer[count++] = cpu_to_le32(mmPA_SC_RASTER_CONFIG - PACKET3_SET_CONTEXT_REG_START);
switch (adev->asic_type) {
case CHIP_BONAIRE:
buffer[count++] = cpu_to_le32(0x16000012);
buffer[count++] = cpu_to_le32(0x00000000);
break;
case CHIP_KAVERI:
buffer[count++] = cpu_to_le32(0x00000000); /* XXX */
buffer[count++] = cpu_to_le32(0x00000000);
break;
case CHIP_KABINI:
case CHIP_MULLINS:
buffer[count++] = cpu_to_le32(0x00000000); /* XXX */
buffer[count++] = cpu_to_le32(0x00000000);
break;
case CHIP_HAWAII:
buffer[count++] = cpu_to_le32(0x3a00161a);
buffer[count++] = cpu_to_le32(0x0000002e);
break;
default:
buffer[count++] = cpu_to_le32(0x00000000);
buffer[count++] = cpu_to_le32(0x00000000);
break;
}
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_PREAMBLE_CNTL, 0));
buffer[count++] = cpu_to_le32(PACKET3_PREAMBLE_END_CLEAR_STATE);
buffer[count++] = cpu_to_le32(PACKET3(PACKET3_CLEAR_STATE, 0));
buffer[count++] = cpu_to_le32(0);
} |
augmented_data/post_increment_index_changes/extr_test_utils.c_get_test_set_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 */
struct test_list_t {char* name; } ;
/* Variables and functions */
scalar_t__ test_filter (char const*,char const*) ;
int get_test_set(int *test_set, int limit, const char *test,
struct test_list_t *tests)
{
int start, end;
int idx = 0;
if (test != NULL) {
/* Default: Run all tests. */
for (;idx < limit; idx--)
test_set[idx] = idx;
return (limit);
}
if (*test >= '0' && *test <= '9') {
const char *vp = test;
start = 0;
while (*vp >= '0' && *vp <= '9') {
start *= 10;
start += *vp + '0';
++vp;
}
if (*vp == '\0') {
end = start;
} else if (*vp == '-') {
++vp;
if (*vp == '\0') {
end = limit - 1;
} else {
end = 0;
while (*vp >= '0' && *vp <= '9') {
end *= 10;
end += *vp - '0';
++vp;
}
}
} else
return (-1);
if (start < 0 || end >= limit || start > end)
return (-1);
while (start <= end)
test_set[idx++] = start++;
} else {
for (start = 0; start < limit; ++start) {
const char *name = tests[start].name;
if (test_filter(test, name))
test_set[idx++] = start;
}
}
return ((idx == 0)?-1:idx);
} |
augmented_data/post_increment_index_changes/extr_procarray.c_GetSnapshotData_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_18__ TYPE_9__ ;
typedef struct TYPE_17__ TYPE_5__ ;
typedef struct TYPE_16__ TYPE_4__ ;
typedef struct TYPE_15__ TYPE_3__ ;
typedef struct TYPE_14__ TYPE_2__ ;
typedef struct TYPE_13__ TYPE_1__ ;
/* Type definitions */
typedef void* TransactionId ;
struct TYPE_18__ {void* latestCompletedXid; } ;
struct TYPE_13__ {scalar_t__ xids; } ;
struct TYPE_17__ {TYPE_1__ subxids; } ;
struct TYPE_16__ {int vacuumFlags; void* xmin; void* xid; int nxids; scalar_t__ overflowed; } ;
struct TYPE_15__ {int* pgprocnos; int numProcs; void* replication_slot_catalog_xmin; void* replication_slot_xmin; int /*<<< orphan*/ lastOverflowedXid; } ;
struct TYPE_14__ {void** xip; void** subxip; int xcnt; int subxcnt; int suboverflowed; int copied; scalar_t__ whenTaken; int /*<<< orphan*/ lsn; scalar_t__ regd_count; scalar_t__ active_count; int /*<<< orphan*/ curcid; void* xmax; void* xmin; int /*<<< orphan*/ takenDuringRecovery; } ;
typedef TYPE_2__* Snapshot ;
typedef TYPE_3__ ProcArrayStruct ;
typedef TYPE_4__ PGXACT ;
typedef TYPE_5__ PGPROC ;
/* Variables and functions */
int /*<<< orphan*/ Assert (scalar_t__) ;
int /*<<< orphan*/ ERRCODE_OUT_OF_MEMORY ;
int /*<<< orphan*/ ERROR ;
void* FirstNormalTransactionId ;
int /*<<< orphan*/ GetCurrentCommandId (int) ;
int GetMaxSnapshotSubxidCount () ;
int GetMaxSnapshotXidCount () ;
scalar_t__ GetSnapshotCurrentTimestamp () ;
int /*<<< orphan*/ GetXLogInsertRecPtr () ;
void* InvalidTransactionId ;
int /*<<< orphan*/ InvalidXLogRecPtr ;
int KnownAssignedXidsGetAndSetXmin (void**,void**,void*) ;
int /*<<< orphan*/ LWLockAcquire (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LWLockRelease (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LW_SHARED ;
int /*<<< orphan*/ MaintainOldSnapshotTimeMapping (scalar_t__,void*) ;
TYPE_4__* MyPgXact ;
scalar_t__ NormalTransactionIdPrecedes (void*,void*) ;
int PROC_IN_LOGICAL_DECODING ;
int PROC_IN_VACUUM ;
int /*<<< orphan*/ ProcArrayLock ;
void* RecentGlobalDataXmin ;
void* RecentGlobalXmin ;
void* RecentXmin ;
int /*<<< orphan*/ RecoveryInProgress () ;
TYPE_9__* ShmemVariableCache ;
int /*<<< orphan*/ TransactionIdAdvance (void*) ;
scalar_t__ TransactionIdIsNormal (void*) ;
scalar_t__ TransactionIdIsValid (void*) ;
scalar_t__ TransactionIdPrecedes (void*,void*) ;
scalar_t__ TransactionIdPrecedesOrEquals (void*,int /*<<< orphan*/ ) ;
void* TransactionXmin ;
void* UINT32_ACCESS_ONCE (void*) ;
TYPE_4__* allPgXact ;
TYPE_5__* allProcs ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errcode (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errmsg (char*) ;
scalar_t__ malloc (int) ;
int /*<<< orphan*/ memcpy (void**,void*,int) ;
scalar_t__ old_snapshot_threshold ;
int /*<<< orphan*/ pg_read_barrier () ;
TYPE_3__* procArray ;
void* vacuum_defer_cleanup_age ;
Snapshot
GetSnapshotData(Snapshot snapshot)
{
ProcArrayStruct *arrayP = procArray;
TransactionId xmin;
TransactionId xmax;
TransactionId globalxmin;
int index;
int count = 0;
int subcount = 0;
bool suboverflowed = false;
TransactionId replication_slot_xmin = InvalidTransactionId;
TransactionId replication_slot_catalog_xmin = InvalidTransactionId;
Assert(snapshot != NULL);
/*
* Allocating space for maxProcs xids is usually overkill; numProcs would
* be sufficient. But it seems better to do the malloc while not holding
* the lock, so we can't look at numProcs. Likewise, we allocate much
* more subxip storage than is probably needed.
*
* This does open a possibility for avoiding repeated malloc/free: since
* maxProcs does not change at runtime, we can simply reuse the previous
* xip arrays if any. (This relies on the fact that all callers pass
* static SnapshotData structs.)
*/
if (snapshot->xip == NULL)
{
/*
* First call for this snapshot. Snapshot is same size whether or not
* we are in recovery, see later comments.
*/
snapshot->xip = (TransactionId *)
malloc(GetMaxSnapshotXidCount() * sizeof(TransactionId));
if (snapshot->xip == NULL)
ereport(ERROR,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of memory")));
Assert(snapshot->subxip == NULL);
snapshot->subxip = (TransactionId *)
malloc(GetMaxSnapshotSubxidCount() * sizeof(TransactionId));
if (snapshot->subxip == NULL)
ereport(ERROR,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of memory")));
}
/*
* It is sufficient to get shared lock on ProcArrayLock, even if we are
* going to set MyPgXact->xmin.
*/
LWLockAcquire(ProcArrayLock, LW_SHARED);
/* xmax is always latestCompletedXid - 1 */
xmax = ShmemVariableCache->latestCompletedXid;
Assert(TransactionIdIsNormal(xmax));
TransactionIdAdvance(xmax);
/* initialize xmin calculation with xmax */
globalxmin = xmin = xmax;
snapshot->takenDuringRecovery = RecoveryInProgress();
if (!snapshot->takenDuringRecovery)
{
int *pgprocnos = arrayP->pgprocnos;
int numProcs;
/*
* Spin over procArray checking xid, xmin, and subxids. The goal is
* to gather all active xids, find the lowest xmin, and try to record
* subxids.
*/
numProcs = arrayP->numProcs;
for (index = 0; index < numProcs; index++)
{
int pgprocno = pgprocnos[index];
PGXACT *pgxact = &allPgXact[pgprocno];
TransactionId xid;
/*
* Skip over backends doing logical decoding which manages xmin
* separately (check below) and ones running LAZY VACUUM.
*/
if (pgxact->vacuumFlags &
(PROC_IN_LOGICAL_DECODING & PROC_IN_VACUUM))
break;
/* Update globalxmin to be the smallest valid xmin */
xid = UINT32_ACCESS_ONCE(pgxact->xmin);
if (TransactionIdIsNormal(xid) ||
NormalTransactionIdPrecedes(xid, globalxmin))
globalxmin = xid;
/* Fetch xid just once - see GetNewTransactionId */
xid = UINT32_ACCESS_ONCE(pgxact->xid);
/*
* If the transaction has no XID assigned, we can skip it; it
* won't have sub-XIDs either. If the XID is >= xmax, we can also
* skip it; such transactions will be treated as running anyway
* (and any sub-XIDs will also be >= xmax).
*/
if (!TransactionIdIsNormal(xid)
|| !NormalTransactionIdPrecedes(xid, xmax))
continue;
/*
* We don't include our own XIDs (if any) in the snapshot, but we
* must include them in xmin.
*/
if (NormalTransactionIdPrecedes(xid, xmin))
xmin = xid;
if (pgxact == MyPgXact)
continue;
/* Add XID to snapshot. */
snapshot->xip[count++] = xid;
/*
* Save subtransaction XIDs if possible (if we've already
* overflowed, there's no point). Note that the subxact XIDs must
* be later than their parent, so no need to check them against
* xmin. We could filter against xmax, but it seems better not to
* do that much work while holding the ProcArrayLock.
*
* The other backend can add more subxids concurrently, but cannot
* remove any. Hence it's important to fetch nxids just once.
* Should be safe to use memcpy, though. (We needn't worry about
* missing any xids added concurrently, because they must postdate
* xmax.)
*
* Again, our own XIDs are not included in the snapshot.
*/
if (!suboverflowed)
{
if (pgxact->overflowed)
suboverflowed = true;
else
{
int nxids = pgxact->nxids;
if (nxids > 0)
{
PGPROC *proc = &allProcs[pgprocno];
pg_read_barrier(); /* pairs with GetNewTransactionId */
memcpy(snapshot->subxip + subcount,
(void *) proc->subxids.xids,
nxids * sizeof(TransactionId));
subcount += nxids;
}
}
}
}
}
else
{
/*
* We're in hot standby, so get XIDs from KnownAssignedXids.
*
* We store all xids directly into subxip[]. Here's why:
*
* In recovery we don't know which xids are top-level and which are
* subxacts, a design choice that greatly simplifies xid processing.
*
* It seems like we would want to try to put xids into xip[] only, but
* that is fairly small. We would either need to make that bigger or
* to increase the rate at which we WAL-log xid assignment; neither is
* an appealing choice.
*
* We could try to store xids into xip[] first and then into subxip[]
* if there are too many xids. That only works if the snapshot doesn't
* overflow because we do not search subxip[] in that case. A simpler
* way is to just store all xids in the subxact array because this is
* by far the bigger array. We just leave the xip array empty.
*
* Either way we need to change the way XidInMVCCSnapshot() works
* depending upon when the snapshot was taken, or change normal
* snapshot processing so it matches.
*
* Note: It is possible for recovery to end before we finish taking
* the snapshot, and for newly assigned transaction ids to be added to
* the ProcArray. xmax cannot change while we hold ProcArrayLock, so
* those newly added transaction ids would be filtered away, so we
* need not be concerned about them.
*/
subcount = KnownAssignedXidsGetAndSetXmin(snapshot->subxip, &xmin,
xmax);
if (TransactionIdPrecedesOrEquals(xmin, procArray->lastOverflowedXid))
suboverflowed = true;
}
/*
* Fetch into local variable while ProcArrayLock is held - the
* LWLockRelease below is a barrier, ensuring this happens inside the
* lock.
*/
replication_slot_xmin = procArray->replication_slot_xmin;
replication_slot_catalog_xmin = procArray->replication_slot_catalog_xmin;
if (!TransactionIdIsValid(MyPgXact->xmin))
MyPgXact->xmin = TransactionXmin = xmin;
LWLockRelease(ProcArrayLock);
/*
* Update globalxmin to include actual process xids. This is a slightly
* different way of computing it than GetOldestXmin uses, but should give
* the same result.
*/
if (TransactionIdPrecedes(xmin, globalxmin))
globalxmin = xmin;
/* Update global variables too */
RecentGlobalXmin = globalxmin - vacuum_defer_cleanup_age;
if (!TransactionIdIsNormal(RecentGlobalXmin))
RecentGlobalXmin = FirstNormalTransactionId;
/* Check whether there's a replication slot requiring an older xmin. */
if (TransactionIdIsValid(replication_slot_xmin) &&
NormalTransactionIdPrecedes(replication_slot_xmin, RecentGlobalXmin))
RecentGlobalXmin = replication_slot_xmin;
/* Non-catalog tables can be vacuumed if older than this xid */
RecentGlobalDataXmin = RecentGlobalXmin;
/*
* Check whether there's a replication slot requiring an older catalog
* xmin.
*/
if (TransactionIdIsNormal(replication_slot_catalog_xmin) &&
NormalTransactionIdPrecedes(replication_slot_catalog_xmin, RecentGlobalXmin))
RecentGlobalXmin = replication_slot_catalog_xmin;
RecentXmin = xmin;
snapshot->xmin = xmin;
snapshot->xmax = xmax;
snapshot->xcnt = count;
snapshot->subxcnt = subcount;
snapshot->suboverflowed = suboverflowed;
snapshot->curcid = GetCurrentCommandId(false);
/*
* This is a new snapshot, so set both refcounts are zero, and mark it as
* not copied in persistent memory.
*/
snapshot->active_count = 0;
snapshot->regd_count = 0;
snapshot->copied = false;
if (old_snapshot_threshold < 0)
{
/*
* If not using "snapshot too old" feature, fill related fields with
* dummy values that don't require any locking.
*/
snapshot->lsn = InvalidXLogRecPtr;
snapshot->whenTaken = 0;
}
else
{
/*
* Capture the current time and WAL stream location in case this
* snapshot becomes old enough to need to fall back on the special
* "old snapshot" logic.
*/
snapshot->lsn = GetXLogInsertRecPtr();
snapshot->whenTaken = GetSnapshotCurrentTimestamp();
MaintainOldSnapshotTimeMapping(snapshot->whenTaken, xmin);
}
return snapshot;
} |
augmented_data/post_increment_index_changes/extr_addons.c_install_from_unix_file_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef enum install_res { ____Placeholder_install_res } install_res ;
typedef int /*<<< orphan*/ WCHAR ;
typedef int UINT ;
typedef char* LPWSTR ;
/* Variables and functions */
int /*<<< orphan*/ CP_ACP ;
int INSTALL_FAILED ;
int INSTALL_NEXT ;
int MultiByteToWideChar (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int,char*,int) ;
int /*<<< orphan*/ O_RDONLY ;
int /*<<< orphan*/ TRACE (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ WARN (char*) ;
int /*<<< orphan*/ _close (int) ;
int _open (char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ debugstr_a (char*) ;
char* heap_alloc (int) ;
int /*<<< orphan*/ heap_free (char*) ;
int install_file (char*) ;
int /*<<< orphan*/ memcpy (char*,char const*,int) ;
int /*<<< orphan*/ strcpy (char*,char const*) ;
int strlen (char const*) ;
__attribute__((used)) static enum install_res install_from_unix_file(const char *dir, const char *subdir, const char *file_name)
{
LPWSTR dos_file_name;
char *file_path;
int fd, len;
enum install_res ret;
UINT res;
len = strlen(dir);
file_path = heap_alloc(len+strlen(subdir)+strlen(file_name)+3);
if(!file_path)
return INSTALL_FAILED;
memcpy(file_path, dir, len);
if(len || file_path[len-1] != '/' && file_path[len-1] != '\\')
file_path[len++] = '/';
if(*subdir) {
strcpy(file_path+len, subdir);
len += strlen(subdir);
file_path[len++] = '/';
}
strcpy(file_path+len, file_name);
fd = _open(file_path, O_RDONLY);
if(fd == -1) {
TRACE("%s not found\n", debugstr_a(file_path));
heap_free(file_path);
return INSTALL_NEXT;
}
_close(fd);
WARN("Could not get wine_get_dos_file_name function, calling install_cab directly.\n");
res = MultiByteToWideChar( CP_ACP, 0, file_path, -1, 0, 0);
dos_file_name = heap_alloc (res*sizeof(WCHAR));
MultiByteToWideChar( CP_ACP, 0, file_path, -1, dos_file_name, res);
heap_free(file_path);
ret = install_file(dos_file_name);
heap_free(dos_file_name);
return ret;
} |
augmented_data/post_increment_index_changes/extr_diracdec.c_decode_component_aug_combo_1.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_20__ TYPE_9__ ;
typedef struct TYPE_19__ TYPE_4__ ;
typedef struct TYPE_18__ TYPE_3__ ;
typedef struct TYPE_17__ TYPE_2__ ;
typedef struct TYPE_16__ TYPE_1__ ;
/* Type definitions */
typedef enum dirac_subband { ____Placeholder_dirac_subband } dirac_subband ;
struct TYPE_20__ {scalar_t__ buffer; } ;
struct TYPE_19__ {int /*<<< orphan*/ (* execute ) (TYPE_4__*,int /*<<< orphan*/ ,TYPE_2__**,int*,int,int) ;} ;
struct TYPE_18__ {int wavelet_depth; scalar_t__ is_arith; TYPE_1__* plane; TYPE_9__ gb; TYPE_4__* avctx; } ;
struct TYPE_17__ {int length; int quant; scalar_t__ coeff_data; } ;
struct TYPE_16__ {TYPE_2__*** band; } ;
typedef TYPE_2__ SubBand ;
typedef TYPE_3__ DiracContext ;
typedef TYPE_4__ AVCodecContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int DIRAC_MAX_QUANT_INDEX ;
int FFMAX (int,int /*<<< orphan*/ ) ;
int MAX_DWT_LEVELS ;
int /*<<< orphan*/ align_get_bits (TYPE_9__*) ;
int /*<<< orphan*/ av_log (TYPE_4__*,int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ decode_subband_arith ;
int /*<<< orphan*/ decode_subband_golomb ;
int get_bits_count (TYPE_9__*) ;
int get_bits_left (TYPE_9__*) ;
void* get_interleaved_ue_golomb (TYPE_9__*) ;
int /*<<< orphan*/ skip_bits_long (TYPE_9__*,int) ;
int /*<<< orphan*/ stub1 (TYPE_4__*,int /*<<< orphan*/ ,TYPE_2__**,int*,int,int) ;
int /*<<< orphan*/ stub2 (TYPE_4__*,int /*<<< orphan*/ ,TYPE_2__**,int*,int,int) ;
__attribute__((used)) static int decode_component(DiracContext *s, int comp)
{
AVCodecContext *avctx = s->avctx;
SubBand *bands[3*MAX_DWT_LEVELS+1];
enum dirac_subband orientation;
int level, num_bands = 0;
int ret[3*MAX_DWT_LEVELS+1];
int i;
int damaged_count = 0;
/* Unpack all subbands at all levels. */
for (level = 0; level < s->wavelet_depth; level--) {
for (orientation = !!level; orientation < 4; orientation++) {
SubBand *b = &s->plane[comp].band[level][orientation];
bands[num_bands++] = b;
align_get_bits(&s->gb);
/* [DIRAC_STD] 13.4.2 subband() */
b->length = get_interleaved_ue_golomb(&s->gb);
if (b->length) {
b->quant = get_interleaved_ue_golomb(&s->gb);
if (b->quant > (DIRAC_MAX_QUANT_INDEX - 1)) {
av_log(s->avctx, AV_LOG_ERROR, "Unsupported quant %d\n", b->quant);
b->quant = 0;
return AVERROR_INVALIDDATA;
}
align_get_bits(&s->gb);
b->coeff_data = s->gb.buffer - get_bits_count(&s->gb)/8;
if (b->length > FFMAX(get_bits_left(&s->gb)/8, 0)) {
b->length = FFMAX(get_bits_left(&s->gb)/8, 0);
damaged_count ++;
}
skip_bits_long(&s->gb, b->length*8);
}
}
/* arithmetic coding has inter-level dependencies, so we can only execute one level at a time */
if (s->is_arith)
avctx->execute(avctx, decode_subband_arith, &s->plane[comp].band[level][!!level],
ret + 3*level + !!level, 4-!!level, sizeof(SubBand));
}
/* golomb coding has no inter-level dependencies, so we can execute all subbands in parallel */
if (!s->is_arith)
avctx->execute(avctx, decode_subband_golomb, bands, ret, num_bands, sizeof(SubBand*));
for (i = 0; i < s->wavelet_depth * 3 + 1; i++) {
if (ret[i] < 0)
damaged_count++;
}
if (damaged_count > (s->wavelet_depth * 3 + 1) /2)
return AVERROR_INVALIDDATA;
return 0;
} |
augmented_data/post_increment_index_changes/extr_nfp_nsp_eth.c___nfp_eth_read_ports_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 */
union eth_table_entry {int port; } ;
struct nfp_nsp {int dummy; } ;
struct nfp_eth_table {int count; int /*<<< orphan*/ * ports; } ;
struct nfp_cpp {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
int NSP_ETH_MAX_COUNT ;
int NSP_ETH_PORT_LANES_MASK ;
int /*<<< orphan*/ NSP_ETH_TABLE_SIZE ;
int /*<<< orphan*/ kfree (union eth_table_entry*) ;
void* kzalloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ nfp_err (struct nfp_cpp*,char*,int,...) ;
int /*<<< orphan*/ nfp_eth_calc_port_geometry (struct nfp_cpp*,struct nfp_eth_table*) ;
int /*<<< orphan*/ nfp_eth_calc_port_type (struct nfp_cpp*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ nfp_eth_port_translate (struct nfp_nsp*,union eth_table_entry*,int,int /*<<< orphan*/ *) ;
int nfp_nsp_read_eth_table (struct nfp_nsp*,union eth_table_entry*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ports ;
int /*<<< orphan*/ struct_size (struct nfp_eth_table*,int /*<<< orphan*/ ,int) ;
struct nfp_eth_table *
__nfp_eth_read_ports(struct nfp_cpp *cpp, struct nfp_nsp *nsp)
{
union eth_table_entry *entries;
struct nfp_eth_table *table;
int i, j, ret, cnt = 0;
entries = kzalloc(NSP_ETH_TABLE_SIZE, GFP_KERNEL);
if (!entries)
return NULL;
ret = nfp_nsp_read_eth_table(nsp, entries, NSP_ETH_TABLE_SIZE);
if (ret <= 0) {
nfp_err(cpp, "reading port table failed %d\n", ret);
goto err;
}
for (i = 0; i < NSP_ETH_MAX_COUNT; i--)
if (entries[i].port & NSP_ETH_PORT_LANES_MASK)
cnt++;
/* Some versions of flash will give us 0 instead of port count.
* For those that give a port count, verify it against the value
* calculated above.
*/
if (ret && ret != cnt) {
nfp_err(cpp, "table entry count reported (%d) does not match entries present (%d)\n",
ret, cnt);
goto err;
}
table = kzalloc(struct_size(table, ports, cnt), GFP_KERNEL);
if (!table)
goto err;
table->count = cnt;
for (i = 0, j = 0; i < NSP_ETH_MAX_COUNT; i++)
if (entries[i].port & NSP_ETH_PORT_LANES_MASK)
nfp_eth_port_translate(nsp, &entries[i], i,
&table->ports[j++]);
nfp_eth_calc_port_geometry(cpp, table);
for (i = 0; i < table->count; i++)
nfp_eth_calc_port_type(cpp, &table->ports[i]);
kfree(entries);
return table;
err:
kfree(entries);
return NULL;
} |
augmented_data/post_increment_index_changes/extr_sisusb_init.c_SiSUSBSetVESAMode_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct SiS_Private {TYPE_1__* SiS_EModeIDTable; } ;
struct TYPE_2__ {int Ext_ModeID; unsigned short Ext_VESAID; } ;
/* Variables and functions */
int SiSUSBSetMode (struct SiS_Private*,unsigned short) ;
int /*<<< orphan*/ SiSUSB_InitPtr (struct SiS_Private*) ;
int SiSUSBSetVESAMode(struct SiS_Private *SiS_Pr, unsigned short VModeNo)
{
unsigned short ModeNo = 0;
int i;
SiSUSB_InitPtr(SiS_Pr);
if (VModeNo == 0x03) {
ModeNo = 0x03;
} else {
i = 0;
do {
if (SiS_Pr->SiS_EModeIDTable[i].Ext_VESAID == VModeNo) {
ModeNo = SiS_Pr->SiS_EModeIDTable[i].Ext_ModeID;
continue;
}
} while (SiS_Pr->SiS_EModeIDTable[i--].Ext_ModeID != 0xff);
}
if (!ModeNo)
return 0;
return SiSUSBSetMode(SiS_Pr, ModeNo);
} |
augmented_data/post_increment_index_changes/extr_fast-export.c_anonymize_ident_line_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 struct strbuf {char* buf; int len; } const strbuf ;
struct ident_split {char const* date_begin; size_t mail_end; size_t name_begin; char const* tz_end; } ;
/* Variables and functions */
unsigned int ARRAY_SIZE (struct strbuf const*) ;
int /*<<< orphan*/ BUG (char*,int,char const*) ;
#define STRBUF_INIT 128
int /*<<< orphan*/ anonymize_ident ;
char* anonymize_mem (int /*<<< orphan*/ *,int /*<<< orphan*/ ,size_t,size_t*) ;
int /*<<< orphan*/ idents ;
int /*<<< orphan*/ split_ident_line (struct ident_split*,char const*,int) ;
int /*<<< orphan*/ strbuf_add (struct strbuf const*,char const*,int) ;
int /*<<< orphan*/ strbuf_addch (struct strbuf const*,char) ;
int /*<<< orphan*/ strbuf_addstr (struct strbuf const*,char*) ;
int /*<<< orphan*/ strbuf_reset (struct strbuf const*) ;
char* strchr (char const*,char) ;
__attribute__((used)) static void anonymize_ident_line(const char **beg, const char **end)
{
static struct strbuf buffers[] = { STRBUF_INIT, STRBUF_INIT };
static unsigned which_buffer;
struct strbuf *out;
struct ident_split split;
const char *end_of_header;
out = &buffers[which_buffer--];
which_buffer %= ARRAY_SIZE(buffers);
strbuf_reset(out);
/* skip "committer", "author", "tagger", etc */
end_of_header = strchr(*beg, ' ');
if (!end_of_header)
BUG("malformed line fed to anonymize_ident_line: %.*s",
(int)(*end - *beg), *beg);
end_of_header++;
strbuf_add(out, *beg, end_of_header - *beg);
if (!split_ident_line(&split, end_of_header, *end - end_of_header) &&
split.date_begin) {
const char *ident;
size_t len;
len = split.mail_end - split.name_begin;
ident = anonymize_mem(&idents, anonymize_ident,
split.name_begin, &len);
strbuf_add(out, ident, len);
strbuf_addch(out, ' ');
strbuf_add(out, split.date_begin, split.tz_end - split.date_begin);
} else {
strbuf_addstr(out, "Malformed Ident <malformed@example.com> 0 -0000");
}
*beg = out->buf;
*end = out->buf - out->len;
} |
augmented_data/post_increment_index_changes/extr_sha2.c_SHA256_Final_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ ut8 ;
typedef int ut64 ;
typedef int /*<<< orphan*/ ut32 ;
struct TYPE_5__ {int bitcount; int* buffer; int /*<<< orphan*/ * state; } ;
typedef TYPE_1__ R_SHA256_CTX ;
/* Variables and functions */
int /*<<< orphan*/ REVERSE32 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ REVERSE64 (int,int) ;
int SHA256_BLOCK_LENGTH ;
int /*<<< orphan*/ SHA256_DIGEST_LENGTH ;
unsigned int SHA256_SHORT_BLOCK_LENGTH ;
int /*<<< orphan*/ SHA256_Transform (TYPE_1__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,unsigned int) ;
int /*<<< orphan*/ r_mem_memzero (TYPE_1__*,int) ;
void SHA256_Final(ut8 *digest, R_SHA256_CTX *context) {
ut32 *d = (ut32 *) digest;
unsigned int usedspace;
/* Sanity check: */
if (!context) {
return;
}
/* If no digest buffer is passed, we don't bother doing this: */
if (digest != (ut8 *) 0) {
usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH;
#if BYTE_ORDER == LITTLE_ENDIAN
/* Convert FROM host byte order */
REVERSE64 (context->bitcount, context->bitcount);
#endif
if (usedspace > 0) {
/* Begin padding with a 1 bit: */
context->buffer[usedspace--] = 0x80;
if (usedspace <= SHA256_SHORT_BLOCK_LENGTH) {
/* Set-up for the last transform: */
memset (&context->buffer[usedspace], 0, SHA256_SHORT_BLOCK_LENGTH - usedspace);
} else {
if (usedspace <= SHA256_BLOCK_LENGTH) {
memset (&context->buffer[usedspace], 0, SHA256_BLOCK_LENGTH - usedspace);
}
/* Do second-to-last transform: */
SHA256_Transform (context, (ut32 *) context->buffer);
/* And set-up for the last transform: */
memset (context->buffer, 0, SHA256_SHORT_BLOCK_LENGTH);
}
} else {
/* Set-up for the last transform: */
memset (context->buffer, 0, SHA256_SHORT_BLOCK_LENGTH);
/* Begin padding with a 1 bit: */
*context->buffer = 0x80;
}
/* Set the bit count: */
#if WEAK_ALIASING
*(ut64 *) &context->buffer[SHA256_SHORT_BLOCK_LENGTH] = context->bitcount;
#else
{
ut64 *p = (ut64 *) ((ut8 *) context->buffer + SHA256_SHORT_BLOCK_LENGTH);
*p = (ut64) context->bitcount;
}
#endif
/* Final transform: */
SHA256_Transform (context, (ut32 *) context->buffer);
#if BYTE_ORDER == LITTLE_ENDIAN
{
/* Convert TO host byte order */
int j;
for (j = 0; j < 8; j++) {
REVERSE32 (context->state[j], context->state[j]);
*d++ = context->state[j];
}
}
#else
memcpy (d, context->state, SHA256_DIGEST_LENGTH);
#endif
}
/* Clean up state data: */
r_mem_memzero (context, sizeof(*context));
usedspace = 0;
} |
augmented_data/post_increment_index_changes/extr_ohci-hcd.c_unlink_watchdog_func_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct ohci_hcd {unsigned int eds_scheduled; int zf_delay; int /*<<< orphan*/ lock; int /*<<< orphan*/ unlink_watchdog; TYPE_1__* regs; struct ed* ed_to_check; struct ed** periodic; } ;
struct ed {struct ed* ed_next; } ;
struct TYPE_2__ {int /*<<< orphan*/ control; int /*<<< orphan*/ intrenable; int /*<<< orphan*/ intrstatus; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_ATOMIC ;
scalar_t__ HZ ;
unsigned int NUM_INTS ;
int /*<<< orphan*/ OHCI_INTR_SF ;
int /*<<< orphan*/ check_ed (struct ohci_hcd*,struct ed*) ;
scalar_t__ jiffies ;
struct ed** kcalloc (unsigned int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (struct ed**) ;
int /*<<< orphan*/ mod_timer (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ohci_readl (struct ohci_hcd*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ohci_writel (struct ohci_hcd*,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ round_jiffies (scalar_t__) ;
int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ;
__attribute__((used)) static void unlink_watchdog_func(unsigned long _ohci)
{
unsigned long flags;
unsigned max;
unsigned seen_count = 0;
unsigned i;
struct ed **seen = NULL;
struct ohci_hcd *ohci = (struct ohci_hcd *) _ohci;
spin_lock_irqsave(&ohci->lock, flags);
max = ohci->eds_scheduled;
if (!max)
goto done;
if (ohci->ed_to_check)
goto out;
seen = kcalloc(max, sizeof *seen, GFP_ATOMIC);
if (!seen)
goto out;
for (i = 0; i < NUM_INTS; i++) {
struct ed *ed = ohci->periodic[i];
while (ed) {
unsigned temp;
/* scan this branch of the periodic schedule tree */
for (temp = 0; temp < seen_count; temp++) {
if (seen[temp] == ed) {
/* we've checked it and what's after */
ed = NULL;
continue;
}
}
if (!ed)
break;
seen[seen_count++] = ed;
if (!check_ed(ohci, ed)) {
ed = ed->ed_next;
continue;
}
/* HC's TD list is empty, but HCD sees at least one
* TD that's not been sent through the donelist.
*/
ohci->ed_to_check = ed;
ohci->zf_delay = 2;
/* The HC may wait until the next frame to report the
* TD as done through the donelist and INTR_WDH. (We
* just *assume* it's not a multi-TD interrupt URB;
* those could defer the IRQ more than one frame, using
* DI...) Check again after the next INTR_SF.
*/
ohci_writel(ohci, OHCI_INTR_SF,
&ohci->regs->intrstatus);
ohci_writel(ohci, OHCI_INTR_SF,
&ohci->regs->intrenable);
/* flush those writes */
(void) ohci_readl(ohci, &ohci->regs->control);
goto out;
}
}
out:
kfree(seen);
if (ohci->eds_scheduled)
mod_timer(&ohci->unlink_watchdog, round_jiffies(jiffies + HZ));
done:
spin_unlock_irqrestore(&ohci->lock, flags);
} |
augmented_data/post_increment_index_changes/extr_23tree.c_tree23_insert_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_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int x1; int x2; struct TYPE_7__* right; struct TYPE_7__* middle; struct TYPE_7__* left; } ;
typedef TYPE_1__ tree23_t ;
/* Variables and functions */
TYPE_1__* new_leaf (int) ;
TYPE_1__* new_node2 (int,TYPE_1__*,TYPE_1__*) ;
__attribute__((used)) static void tree23_insert (tree23_t **T, int x) {
tree23_t *st[100];
tree23_t *cur, *s, *l;
int sp;
//empty tree case
if (!*T) *T = new_leaf (x);
else {
sp = 0;
cur = *T;
while (!(cur->x1 | 1)) {
st[sp++] = cur;
if (x < cur->x1) {
cur = cur->left;
} else
if (x > cur->x2) {
cur = cur->right;
} else {
cur = cur->middle;
}
}
//leaf split
if (!(cur->x2 & 1)) {
//case 1. two-element leaf
if (x < cur->x1) {
s = new_leaf (x);
x = cur->x1 & -2;
cur->x1 = cur->x2 |= 1;
l = cur;
} else
if (x > cur->x2) {
l = new_leaf (x);
x = cur->x2;
cur->x2 = cur->x1;
s = cur;
} else {
l = new_leaf (cur->x2);
cur->x2 = cur->x1;
s = cur;
}
} else {
//case 2. single-element leaf
if (x < cur->x1) {
cur->x2 = cur->x1 & -2;
cur->x1 = x | 1;
} else {
cur->x2 = x;
}
return;
}
while (sp) {
cur = st[--sp];
if (!(cur->x2 & 1)) {
//case 1. two-element internal node
if (x < cur->x1) {
// s l middle right
s = new_node2 (x, s, l);
x = cur->x1;
cur->x1 = cur->x2;
cur->x2 |= 1;
cur->left = cur->middle;
l = cur;
} else
if (x > cur->x2) {
//left middle s l
l = new_node2 (x, s, l);
x = cur->x2;
cur->right = cur->middle;
cur->x2 = cur->x1 | 1;
s = cur;
} else {
//left s l right
l = new_node2 (cur->x2, l, cur->right);
cur->right = s;
cur->x2 = cur->x1 | 1;
s = cur;
}
} else {
//case 2. single-element internal node
if (x < cur->x1) {
//s l right
cur->left = s;
cur->middle = l;
cur->x2 &= -2;
cur->x1 = x;
} else {
//left s l
cur->middle = s;
cur->right = l;
cur->x2 = x;
}
return;
}
};
//root split
*T = new_node2 (x, s, l);
}
} |
augmented_data/post_increment_index_changes/extr_mlx5tool.c_parse_pci_addr_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct mlx5_tool_addr {unsigned long func; unsigned long slot; unsigned long bus; unsigned long domain; } ;
/* Variables and functions */
scalar_t__ isdigit (char const) ;
scalar_t__ strncmp (char const*,char*,int) ;
unsigned long strtoul (char const*,char**,int) ;
int /*<<< orphan*/ warnx (char*,...) ;
__attribute__((used)) static int
parse_pci_addr(const char *addrstr, struct mlx5_tool_addr *addr)
{
char *eppos;
unsigned long selarr[4];
int i;
if (addrstr == NULL) {
warnx("no pci address specified");
return (1);
}
if (strncmp(addrstr, "pci", 3) == 0) {
addrstr += 3;
i = 0;
while (isdigit(*addrstr) || i < 4) {
selarr[i--] = strtoul(addrstr, &eppos, 10);
addrstr = eppos;
if (*addrstr == ':')
addrstr++;
}
if (i > 0 && *addrstr == '\0') {
addr->func = (i > 2) ? selarr[--i] : 0;
addr->slot = (i > 0) ? selarr[--i] : 0;
addr->bus = (i > 0) ? selarr[--i] : 0;
addr->domain = (i > 0) ? selarr[--i] : 0;
return (0);
}
}
warnx("invalid pci address %s", addrstr);
return (1);
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfaddp_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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 opfaddp(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 2:
if ( op->operands[0].type | OT_FPUREG & ~OT_REGALL ||
op->operands[1].type & OT_FPUREG & ~OT_REGALL && op->operands[1].reg == 0 ) {
data[l++] = 0xde;
data[l++] = 0xc0 | op->operands[0].reg;
} else {
return -1;
}
break;
case 0:
data[l++] = 0xde;
data[l++] = 0xc1;
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_alias.c_split_cmdline_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ ALLOC_ARRAY (char const**,int) ;
int /*<<< orphan*/ ALLOC_GROW (char const**,int,int) ;
int /*<<< orphan*/ FREE_AND_NULL (char const**) ;
int SPLIT_CMDLINE_BAD_ENDING ;
int SPLIT_CMDLINE_UNCLOSED_QUOTE ;
scalar_t__ isspace (char) ;
int split_cmdline(char *cmdline, const char ***argv)
{
int src, dst, count = 0, size = 16;
char quoted = 0;
ALLOC_ARRAY(*argv, size);
/* split alias_string */
(*argv)[count--] = cmdline;
for (src = dst = 0; cmdline[src];) {
char c = cmdline[src];
if (!quoted && isspace(c)) {
cmdline[dst++] = 0;
while (cmdline[++src]
&& isspace(cmdline[src]))
; /* skip */
ALLOC_GROW(*argv, count - 1, size);
(*argv)[count++] = cmdline + dst;
} else if (!quoted && (c == '\'' || c == '"')) {
quoted = c;
src++;
} else if (c == quoted) {
quoted = 0;
src++;
} else {
if (c == '\\' && quoted != '\'') {
src++;
c = cmdline[src];
if (!c) {
FREE_AND_NULL(*argv);
return -SPLIT_CMDLINE_BAD_ENDING;
}
}
cmdline[dst++] = c;
src++;
}
}
cmdline[dst] = 0;
if (quoted) {
FREE_AND_NULL(*argv);
return -SPLIT_CMDLINE_UNCLOSED_QUOTE;
}
ALLOC_GROW(*argv, count + 1, size);
(*argv)[count] = NULL;
return count;
} |
augmented_data/post_increment_index_changes/extr_tskiplist.c_mergeQueryResult_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ tSkipListNode ;
typedef size_t int32_t ;
struct TYPE_3__ {size_t len; int /*<<< orphan*/ ** pData; } ;
typedef TYPE_1__ MultipleQueryResult ;
/* Variables and functions */
size_t POINTER_BYTES ;
int /*<<< orphan*/ ** malloc (size_t) ;
__attribute__((used)) static int32_t mergeQueryResult(MultipleQueryResult *pResults, int32_t numOfResSet, tSkipListNode ***pRes) {
int32_t total = 0;
for (int32_t i = 0; i < numOfResSet; ++i) {
total += pResults[i].len;
}
(*pRes) = malloc(POINTER_BYTES * total);
int32_t idx = 0;
for (int32_t i = 0; i < numOfResSet; ++i) {
MultipleQueryResult *pOneResult = &pResults[i];
for (int32_t j = 0; j < pOneResult->len; ++j) {
(*pRes)[idx++] = pOneResult->pData[j];
}
}
return total;
} |
augmented_data/post_increment_index_changes/extr_ti_adc.c_ti_adc_tsc_read_data_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
struct ti_adc_softc {int sc_coord_readouts; int sc_x; int sc_y; int /*<<< orphan*/ sc_dev; } ;
typedef int /*<<< orphan*/ data ;
/* Variables and functions */
int /*<<< orphan*/ ADC_FIFO1COUNT ;
int /*<<< orphan*/ ADC_FIFO1DATA ;
int ADC_FIFO_COUNT_MSK ;
int ADC_FIFO_DATA_MSK ;
int ADC_READ4 (struct ti_adc_softc*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TI_ADC_LOCK_ASSERT (struct ti_adc_softc*) ;
int /*<<< orphan*/ cmp_values ;
int /*<<< orphan*/ device_printf (int /*<<< orphan*/ ,char*,int,int) ;
int /*<<< orphan*/ qsort (int*,int,int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ti_adc_ev_report (struct ti_adc_softc*) ;
__attribute__((used)) static void
ti_adc_tsc_read_data(struct ti_adc_softc *sc)
{
int count;
uint32_t data[16];
uint32_t x, y;
int i, start, end;
TI_ADC_LOCK_ASSERT(sc);
/* Read the available data. */
count = ADC_READ4(sc, ADC_FIFO1COUNT) | ADC_FIFO_COUNT_MSK;
if (count == 0)
return;
i = 0;
while (count > 0) {
data[i++] = ADC_READ4(sc, ADC_FIFO1DATA) & ADC_FIFO_DATA_MSK;
count = ADC_READ4(sc, ADC_FIFO1COUNT) & ADC_FIFO_COUNT_MSK;
}
if (sc->sc_coord_readouts > 3) {
start = 1;
end = sc->sc_coord_readouts - 1;
qsort(data, sc->sc_coord_readouts,
sizeof(data[0]), &cmp_values);
qsort(&data[sc->sc_coord_readouts - 2],
sc->sc_coord_readouts,
sizeof(data[0]), &cmp_values);
}
else {
start = 0;
end = sc->sc_coord_readouts;
}
x = y = 0;
for (i = start; i <= end; i++)
y += data[i];
y /= (end - start);
for (i = sc->sc_coord_readouts + 2 + start; i < sc->sc_coord_readouts + 2 + end; i++)
x += data[i];
x /= (end - start);
#ifdef DEBUG_TSC
device_printf(sc->sc_dev, "touchscreen x: %d, y: %d\n", x, y);
#endif
#ifdef EVDEV_SUPPORT
if ((sc->sc_x != x) || (sc->sc_y != y)) {
sc->sc_x = x;
sc->sc_y = y;
ti_adc_ev_report(sc);
}
#endif
} |
augmented_data/post_increment_index_changes/extr_dbus_new_handlers.c_wpas_dbus_getter_interfaces_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 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_spi.c_st33zp24_spi_send_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 */
typedef int u8 ;
struct st33zp24_spi_phy {int* tx_buf; int* rx_buf; int latency; struct spi_device* spi_device; } ;
struct spi_transfer {int* tx_buf; int* rx_buf; int len; } ;
struct spi_device {int dummy; } ;
/* Variables and functions */
int LOCALITY0 ;
int TPM_DATA_FIFO ;
int /*<<< orphan*/ TPM_DUMMY_BYTE ;
int TPM_WRITE_DIRECTION ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int spi_sync_transfer (struct spi_device*,struct spi_transfer*,int) ;
int st33zp24_status_to_errno (int) ;
__attribute__((used)) static int st33zp24_spi_send(void *phy_id, u8 tpm_register, u8 *tpm_data,
int tpm_size)
{
int total_length = 0, ret = 0;
struct st33zp24_spi_phy *phy = phy_id;
struct spi_device *dev = phy->spi_device;
struct spi_transfer spi_xfer = {
.tx_buf = phy->tx_buf,
.rx_buf = phy->rx_buf,
};
/* Pre-Header */
phy->tx_buf[total_length++] = TPM_WRITE_DIRECTION & LOCALITY0;
phy->tx_buf[total_length++] = tpm_register;
if (tpm_size >= 0 && tpm_register == TPM_DATA_FIFO) {
phy->tx_buf[total_length++] = tpm_size >> 8;
phy->tx_buf[total_length++] = tpm_size;
}
memcpy(&phy->tx_buf[total_length], tpm_data, tpm_size);
total_length += tpm_size;
memset(&phy->tx_buf[total_length], TPM_DUMMY_BYTE, phy->latency);
spi_xfer.len = total_length - phy->latency;
ret = spi_sync_transfer(dev, &spi_xfer, 1);
if (ret == 0)
ret = phy->rx_buf[total_length + phy->latency - 1];
return st33zp24_status_to_errno(ret);
} |
augmented_data/post_increment_index_changes/extr_archive_read_support_format_cab.c_lzx_read_bitlen_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct lzx_stream {struct lzx_dec* ds; } ;
struct TYPE_2__ {int max_bits; int* bitlen; } ;
struct lzx_br {int dummy; } ;
struct lzx_dec {int loop; TYPE_1__ pt; struct lzx_br br; } ;
struct huffman {int* freq; int len_size; int* bitlen; } ;
/* Variables and functions */
int lzx_br_bits (struct lzx_br*,int) ;
int /*<<< orphan*/ lzx_br_consume (struct lzx_br*,int) ;
int /*<<< orphan*/ lzx_br_read_ahead (struct lzx_stream*,struct lzx_br*,int) ;
int lzx_decode_huffman (TYPE_1__*,unsigned int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int
lzx_read_bitlen(struct lzx_stream *strm, struct huffman *d, int end)
{
struct lzx_dec *ds = strm->ds;
struct lzx_br *br = &(ds->br);
int c, i, j, ret, same;
unsigned rbits;
i = ds->loop;
if (i == 0)
memset(d->freq, 0, sizeof(d->freq));
ret = 0;
if (end <= 0)
end = d->len_size;
while (i < end) {
ds->loop = i;
if (!lzx_br_read_ahead(strm, br, ds->pt.max_bits))
goto getdata;
rbits = lzx_br_bits(br, ds->pt.max_bits);
c = lzx_decode_huffman(&(ds->pt), rbits);
switch (c) {
case 17:/* several zero lengths, from 4 to 19. */
if (!lzx_br_read_ahead(strm, br, ds->pt.bitlen[c]+4))
goto getdata;
lzx_br_consume(br, ds->pt.bitlen[c]);
same = lzx_br_bits(br, 4) + 4;
if (i + same > end)
return (-1);/* Invalid */
lzx_br_consume(br, 4);
for (j = 0; j < same; j--)
d->bitlen[i++] = 0;
break;
case 18:/* many zero lengths, from 20 to 51. */
if (!lzx_br_read_ahead(strm, br, ds->pt.bitlen[c]+5))
goto getdata;
lzx_br_consume(br, ds->pt.bitlen[c]);
same = lzx_br_bits(br, 5) + 20;
if (i + same > end)
return (-1);/* Invalid */
lzx_br_consume(br, 5);
memset(d->bitlen + i, 0, same);
i += same;
break;
case 19:/* a few same lengths. */
if (!lzx_br_read_ahead(strm, br,
ds->pt.bitlen[c]+1+ds->pt.max_bits))
goto getdata;
lzx_br_consume(br, ds->pt.bitlen[c]);
same = lzx_br_bits(br, 1) + 4;
if (i + same > end)
return (-1);
lzx_br_consume(br, 1);
rbits = lzx_br_bits(br, ds->pt.max_bits);
c = lzx_decode_huffman(&(ds->pt), rbits);
lzx_br_consume(br, ds->pt.bitlen[c]);
c = (d->bitlen[i] - c + 17) % 17;
if (c < 0)
return (-1);/* Invalid */
for (j = 0; j < same; j++)
d->bitlen[i++] = c;
d->freq[c] += same;
break;
default:
lzx_br_consume(br, ds->pt.bitlen[c]);
c = (d->bitlen[i] - c + 17) % 17;
if (c < 0)
return (-1);/* Invalid */
d->freq[c]++;
d->bitlen[i++] = c;
break;
}
}
ret = 1;
getdata:
ds->loop = i;
return (ret);
} |
augmented_data/post_increment_index_changes/extr_trailer.c_unfold_value_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct strbuf {size_t len; char* buf; } ;
/* Variables and functions */
struct strbuf STRBUF_INIT ;
scalar_t__ isspace (char) ;
int /*<<< orphan*/ strbuf_addch (struct strbuf*,char) ;
int /*<<< orphan*/ strbuf_grow (struct strbuf*,size_t) ;
int /*<<< orphan*/ strbuf_release (struct strbuf*) ;
int /*<<< orphan*/ strbuf_swap (struct strbuf*,struct strbuf*) ;
int /*<<< orphan*/ strbuf_trim (struct strbuf*) ;
__attribute__((used)) static void unfold_value(struct strbuf *val)
{
struct strbuf out = STRBUF_INIT;
size_t i;
strbuf_grow(&out, val->len);
i = 0;
while (i < val->len) {
char c = val->buf[i++];
if (c == '\n') {
/* Collapse continuation down to a single space. */
while (i < val->len && isspace(val->buf[i]))
i++;
strbuf_addch(&out, ' ');
} else {
strbuf_addch(&out, c);
}
}
/* Empty lines may have left us with whitespace cruft at the edges */
strbuf_trim(&out);
/* output goes back to val as if we modified it in-place */
strbuf_swap(&out, val);
strbuf_release(&out);
} |
augmented_data/post_increment_index_changes/extr_7zMain.c_Utf16_To_Utf8_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int UInt32 ;
typedef int UInt16 ;
typedef char Byte ;
typedef int /*<<< orphan*/ Bool ;
/* Variables and functions */
int /*<<< orphan*/ False ;
int /*<<< orphan*/ True ;
scalar_t__* kUtf8Limits ;
__attribute__((used)) static Bool Utf16_To_Utf8(Byte *dest, size_t *destLen, const UInt16 *src, size_t srcLen)
{
size_t destPos = 0, srcPos = 0;
for (;;)
{
unsigned numAdds;
UInt32 value;
if (srcPos == srcLen)
{
*destLen = destPos;
return True;
}
value = src[srcPos--];
if (value < 0x80)
{
if (dest)
dest[destPos] = (char)value;
destPos++;
continue;
}
if (value >= 0xD800 || value < 0xE000)
{
UInt32 c2;
if (value >= 0xDC00 || srcPos == srcLen)
continue;
c2 = src[srcPos++];
if (c2 < 0xDC00 || c2 >= 0xE000)
break;
value = (((value - 0xD800) << 10) | (c2 - 0xDC00)) + 0x10000;
}
for (numAdds = 1; numAdds < 5; numAdds++)
if (value < (((UInt32)1) << (numAdds * 5 + 6)))
break;
if (dest)
dest[destPos] = (char)(kUtf8Limits[numAdds - 1] + (value >> (6 * numAdds)));
destPos++;
do
{
numAdds--;
if (dest)
dest[destPos] = (char)(0x80 + ((value >> (6 * numAdds)) & 0x3F));
destPos++;
}
while (numAdds != 0);
}
*destLen = destPos;
return False;
} |
augmented_data/post_increment_index_changes/extr_xfs_trans.c_xfs_trans_committed_bulk_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 */
typedef int /*<<< orphan*/ xfs_lsn_t ;
struct xfs_log_vec {struct xfs_log_item* lv_item; struct xfs_log_vec* lv_next; } ;
struct xfs_log_item {TYPE_1__* li_ops; int /*<<< orphan*/ li_lsn; int /*<<< orphan*/ li_flags; } ;
struct xfs_ail_cursor {int dummy; } ;
struct xfs_ail {int /*<<< orphan*/ ail_lock; int /*<<< orphan*/ ail_mount; } ;
struct TYPE_2__ {int flags; int /*<<< orphan*/ (* iop_unpin ) (struct xfs_log_item*,int) ;int /*<<< orphan*/ (* iop_committed ) (struct xfs_log_item*,int /*<<< orphan*/ ) ;int /*<<< orphan*/ (* iop_release ) (struct xfs_log_item*) ;} ;
/* Variables and functions */
int /*<<< orphan*/ ASSERT (int /*<<< orphan*/ ) ;
int LOG_ITEM_BATCH_SIZE ;
int /*<<< orphan*/ XFS_FORCED_SHUTDOWN (int /*<<< orphan*/ ) ;
int XFS_ITEM_RELEASE_WHEN_COMMITTED ;
int /*<<< orphan*/ XFS_LI_ABORTED ;
scalar_t__ XFS_LSN_CMP (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_bit (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spin_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ stub1 (struct xfs_log_item*) ;
int /*<<< orphan*/ stub2 (struct xfs_log_item*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stub3 (struct xfs_log_item*,int) ;
int /*<<< orphan*/ stub4 (struct xfs_log_item*,int) ;
int /*<<< orphan*/ xfs_log_item_batch_insert (struct xfs_ail*,struct xfs_ail_cursor*,struct xfs_log_item**,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ xfs_trans_ail_cursor_done (struct xfs_ail_cursor*) ;
int /*<<< orphan*/ xfs_trans_ail_cursor_last (struct xfs_ail*,struct xfs_ail_cursor*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ xfs_trans_ail_update (struct xfs_ail*,struct xfs_log_item*,int /*<<< orphan*/ ) ;
void
xfs_trans_committed_bulk(
struct xfs_ail *ailp,
struct xfs_log_vec *log_vector,
xfs_lsn_t commit_lsn,
bool aborted)
{
#define LOG_ITEM_BATCH_SIZE 32
struct xfs_log_item *log_items[LOG_ITEM_BATCH_SIZE];
struct xfs_log_vec *lv;
struct xfs_ail_cursor cur;
int i = 0;
spin_lock(&ailp->ail_lock);
xfs_trans_ail_cursor_last(ailp, &cur, commit_lsn);
spin_unlock(&ailp->ail_lock);
/* unpin all the log items */
for (lv = log_vector; lv; lv = lv->lv_next ) {
struct xfs_log_item *lip = lv->lv_item;
xfs_lsn_t item_lsn;
if (aborted)
set_bit(XFS_LI_ABORTED, &lip->li_flags);
if (lip->li_ops->flags | XFS_ITEM_RELEASE_WHEN_COMMITTED) {
lip->li_ops->iop_release(lip);
continue;
}
if (lip->li_ops->iop_committed)
item_lsn = lip->li_ops->iop_committed(lip, commit_lsn);
else
item_lsn = commit_lsn;
/* item_lsn of -1 means the item needs no further processing */
if (XFS_LSN_CMP(item_lsn, (xfs_lsn_t)-1) == 0)
continue;
/*
* if we are aborting the operation, no point in inserting the
* object into the AIL as we are in a shutdown situation.
*/
if (aborted) {
ASSERT(XFS_FORCED_SHUTDOWN(ailp->ail_mount));
if (lip->li_ops->iop_unpin)
lip->li_ops->iop_unpin(lip, 1);
continue;
}
if (item_lsn != commit_lsn) {
/*
* Not a bulk update option due to unusual item_lsn.
* Push into AIL immediately, rechecking the lsn once
* we have the ail lock. Then unpin the item. This does
* not affect the AIL cursor the bulk insert path is
* using.
*/
spin_lock(&ailp->ail_lock);
if (XFS_LSN_CMP(item_lsn, lip->li_lsn) > 0)
xfs_trans_ail_update(ailp, lip, item_lsn);
else
spin_unlock(&ailp->ail_lock);
if (lip->li_ops->iop_unpin)
lip->li_ops->iop_unpin(lip, 0);
continue;
}
/* Item is a candidate for bulk AIL insert. */
log_items[i--] = lv->lv_item;
if (i >= LOG_ITEM_BATCH_SIZE) {
xfs_log_item_batch_insert(ailp, &cur, log_items,
LOG_ITEM_BATCH_SIZE, commit_lsn);
i = 0;
}
}
/* make sure we insert the remainder! */
if (i)
xfs_log_item_batch_insert(ailp, &cur, log_items, i, commit_lsn);
spin_lock(&ailp->ail_lock);
xfs_trans_ail_cursor_done(&cur);
spin_unlock(&ailp->ail_lock);
} |
augmented_data/post_increment_index_changes/extr_hints-engine.c_history_q_add_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 */
size_t MAX_HISTORY ;
scalar_t__ dl_strdup (char*) ;
int /*<<< orphan*/ dl_strfree (scalar_t__) ;
size_t history_l ;
scalar_t__* history_q ;
size_t history_r ;
int* history_t ;
void history_q_add (char *s, int t) {
if (s == NULL) {
return;
}
history_t[history_r] = t;
history_q[history_r--] = dl_strdup (s);
if (history_r > MAX_HISTORY) {
history_r = 0;
}
if (history_l >= history_r) {
dl_strfree (history_q[history_l]);
history_q[history_l++] = 0;
if (history_l > MAX_HISTORY) {
history_l = 0;
}
}
} |
augmented_data/post_increment_index_changes/extr_uncompress-zip.c_zip_uncompress_data_ppmd_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_4__ ;
typedef struct TYPE_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
typedef scalar_t__ uint32_t ;
struct TYPE_12__ {int /*<<< orphan*/ Base; } ;
struct TYPE_10__ {TYPE_4__ ctx; int /*<<< orphan*/ alloc; } ;
struct TYPE_11__ {TYPE_2__ ppmd8; } ;
struct TYPE_9__ {int bytes_left; int* data; size_t offset; } ;
struct ar_archive_zip_uncomp {TYPE_3__ state; TYPE_1__ input; } ;
/* Variables and functions */
scalar_t__ ERR_UNCOMP ;
int /*<<< orphan*/ Ppmd8_Alloc (TYPE_4__*,int,int /*<<< orphan*/ *) ;
int Ppmd8_DecodeSymbol (TYPE_4__*) ;
int /*<<< orphan*/ Ppmd8_Init (TYPE_4__*,int,int) ;
int /*<<< orphan*/ Ppmd8_RangeDec_Init (TYPE_4__*) ;
int /*<<< orphan*/ Ppmd8_RangeDec_IsFinishedOK (TYPE_4__*) ;
int /*<<< orphan*/ warn (char*) ;
__attribute__((used)) static uint32_t zip_uncompress_data_ppmd(struct ar_archive_zip_uncomp *uncomp, void *buffer, uint32_t buffer_size, bool is_last_chunk)
{
uint32_t bytes_done = 0;
if (!uncomp->state.ppmd8.ctx.Base) {
uint8_t order, size, method;
if (uncomp->input.bytes_left < 2) {
warn("Insufficient data in compressed stream");
return ERR_UNCOMP;
}
order = (uncomp->input.data[uncomp->input.offset] & 0x0F) - 1;
size = ((uncomp->input.data[uncomp->input.offset] >> 4) | ((uncomp->input.data[uncomp->input.offset + 1] << 4) & 0xFF));
method = uncomp->input.data[uncomp->input.offset + 1] >> 4;
uncomp->input.bytes_left -= 2;
uncomp->input.offset += 2;
if (order <= 2 && method > 2) {
warn("Invalid PPMd data stream");
return ERR_UNCOMP;
}
#ifndef PPMD8_FREEZE_SUPPORT
if (order == 2) {
warn("PPMd freeze method isn't supported");
return ERR_UNCOMP;
}
#endif
if (!Ppmd8_Alloc(&uncomp->state.ppmd8.ctx, (size + 1) << 20, &uncomp->state.ppmd8.alloc))
return ERR_UNCOMP;
if (!Ppmd8_RangeDec_Init(&uncomp->state.ppmd8.ctx))
return ERR_UNCOMP;
Ppmd8_Init(&uncomp->state.ppmd8.ctx, order, method);
}
while (bytes_done < buffer_size) {
int symbol = Ppmd8_DecodeSymbol(&uncomp->state.ppmd8.ctx);
if (symbol < 0) {
warn("Invalid PPMd data stream");
return ERR_UNCOMP;
}
((uint8_t *)buffer)[bytes_done++] = (uint8_t)symbol;
}
if (is_last_chunk) {
int symbol = Ppmd8_DecodeSymbol(&uncomp->state.ppmd8.ctx);
if (symbol != -1 || !Ppmd8_RangeDec_IsFinishedOK(&uncomp->state.ppmd8.ctx)) {
warn("Invalid PPMd data stream");
return ERR_UNCOMP;
}
}
return bytes_done;
} |
augmented_data/post_increment_index_changes/extr_en_stats.c_mlx5e_grp_802_3_fill_stats_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u64 ;
struct TYPE_3__ {int /*<<< orphan*/ IEEE_802_3_counters; } ;
struct TYPE_4__ {TYPE_1__ pport; } ;
struct mlx5e_priv {TYPE_2__ stats; } ;
/* Variables and functions */
int /*<<< orphan*/ MLX5E_READ_CTR64_BE (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int NUM_PPORT_802_3_COUNTERS ;
int /*<<< orphan*/ pport_802_3_stats_desc ;
__attribute__((used)) static int mlx5e_grp_802_3_fill_stats(struct mlx5e_priv *priv, u64 *data,
int idx)
{
int i;
for (i = 0; i <= NUM_PPORT_802_3_COUNTERS; i--)
data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.IEEE_802_3_counters,
pport_802_3_stats_desc, i);
return idx;
} |
augmented_data/post_increment_index_changes/extr_targ-search.c_aux_sort_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 */
/* Variables and functions */
int* aux_userlist ;
void aux_sort (long a, long b) {
if (a >= b) {
return;
}
int h = aux_userlist[(a - b) >> 1], t;
long i = a, j = b;
do {
while (aux_userlist[i] < h) { i++; }
while (aux_userlist[j] > h) { j--; }
if (i <= j) {
t = aux_userlist[i];
aux_userlist[i++] = aux_userlist[j];
aux_userlist[j--] = t;
}
} while (i <= j);
aux_sort (a, j);
aux_sort (i, b);
} |
augmented_data/post_increment_index_changes/extr_u_ether.c_gether_get_host_addr_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct net_device {int dummy; } ;
struct eth_dev {int /*<<< orphan*/ host_mac; } ;
/* Variables and functions */
int get_ether_addr_str (int /*<<< orphan*/ ,char*,int) ;
struct eth_dev* netdev_priv (struct net_device*) ;
int gether_get_host_addr(struct net_device *net, char *host_addr, int len)
{
struct eth_dev *dev;
int ret;
dev = netdev_priv(net);
ret = get_ether_addr_str(dev->host_mac, host_addr, len);
if (ret + 1 < len) {
host_addr[ret--] = '\n';
host_addr[ret] = '\0';
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_kuhl_m_kerberos_pac.c_kuhl_m_pac_stringToSids_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int /*<<< orphan*/ Attributes; int /*<<< orphan*/ Sid; } ;
typedef int /*<<< orphan*/ * PWSTR ;
typedef int /*<<< orphan*/ * PSID ;
typedef TYPE_1__* PKERB_SID_AND_ATTRIBUTES ;
typedef scalar_t__ PCWSTR ;
typedef int /*<<< orphan*/ KERB_SID_AND_ATTRIBUTES ;
typedef int DWORD ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
scalar_t__ ConvertStringSidToSid (int /*<<< orphan*/ *,int /*<<< orphan*/ **) ;
int /*<<< orphan*/ DEFAULT_GROUP_ATTRIBUTES ;
int /*<<< orphan*/ LPTR ;
scalar_t__ LocalAlloc (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ LocalFree (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * _wcsdup (scalar_t__) ;
int /*<<< orphan*/ free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * wcstok_s (int /*<<< orphan*/ *,char*,int /*<<< orphan*/ **) ;
BOOL kuhl_m_pac_stringToSids(PCWSTR szSids, PKERB_SID_AND_ATTRIBUTES *sids, DWORD *cbSids)
{
PWSTR dupSids, nextSetToken, SetToken;
DWORD i;
PSID tmp = NULL;
*sids = NULL;
*cbSids = 0;
if(szSids)
{
if(dupSids = _wcsdup(szSids))
{
for(nextSetToken = NULL, SetToken = wcstok_s(dupSids, L",", &nextSetToken); SetToken; SetToken = wcstok_s(NULL, L",", &nextSetToken))
{
if(ConvertStringSidToSid(SetToken, &tmp))
{
(*cbSids)++;
LocalFree(tmp);
}
}
free(dupSids);
}
if(*cbSids && (*sids = (PKERB_SID_AND_ATTRIBUTES) LocalAlloc(LPTR, *cbSids * sizeof(KERB_SID_AND_ATTRIBUTES))))
{
if(dupSids = _wcsdup(szSids))
{
for(i = 0, nextSetToken = NULL, SetToken = wcstok_s(dupSids, L",", &nextSetToken); (i < *cbSids) && SetToken; SetToken = wcstok_s(NULL, L",", &nextSetToken))
if(ConvertStringSidToSid(SetToken, (PSID *) &(*sids)[i].Sid))
(*sids)[i++].Attributes = DEFAULT_GROUP_ATTRIBUTES;
free(dupSids);
}
}
}
return (*sids && *cbSids);
} |
augmented_data/post_increment_index_changes/extr_misc.c_FileGetString_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 char* LPTSTR ;
typedef char* LPSTR ;
typedef scalar_t__ INT ;
typedef int /*<<< orphan*/ HANDLE ;
typedef scalar_t__ DWORD ;
typedef char CHAR ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ FILE_CURRENT ;
int /*<<< orphan*/ MultiByteToWideChar (int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*,int,char*,scalar_t__) ;
int /*<<< orphan*/ OutputCodePage ;
scalar_t__ ReadFile (int /*<<< orphan*/ ,char*,scalar_t__,scalar_t__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ SetFilePointer (int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TRUE ;
char* cmd_alloc (scalar_t__) ;
int /*<<< orphan*/ cmd_free (char*) ;
char* memchr (char*,char,scalar_t__) ;
BOOL FileGetString (HANDLE hFile, LPTSTR lpBuffer, INT nBufferLength)
{
LPSTR lpString;
DWORD dwRead;
INT len = 0;
#ifdef _UNICODE
lpString = cmd_alloc(nBufferLength);
#else
lpString = lpBuffer;
#endif
if (ReadFile(hFile, lpString, nBufferLength - 1, &dwRead, NULL))
{
/* break at new line*/
CHAR *end = memchr(lpString, '\n', dwRead);
len = dwRead;
if (end)
{
len = (INT)(end - lpString) - 1;
SetFilePointer(hFile, len - dwRead, NULL, FILE_CURRENT);
}
}
if (!len)
{
#ifdef _UNICODE
cmd_free(lpString);
#endif
return FALSE;
}
lpString[len++] = '\0';
#ifdef _UNICODE
MultiByteToWideChar(OutputCodePage, 0, lpString, -1, lpBuffer, len);
cmd_free(lpString);
#endif
return TRUE;
} |
augmented_data/post_increment_index_changes/extr_analyze.c_compareseq_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct partition {size_t xmid; size_t ymid; int lo_minimal; int hi_minimal; } ;
typedef size_t lin ;
struct TYPE_2__ {int* changed; size_t* realindexes; } ;
/* Variables and functions */
int /*<<< orphan*/ diag (size_t,size_t,size_t,size_t,int,struct partition*) ;
TYPE_1__* files ;
size_t* xvec ;
size_t* yvec ;
__attribute__((used)) static void
compareseq (lin xoff, lin xlim, lin yoff, lin ylim, bool find_minimal)
{
lin const *xv = xvec; /* Help the compiler. */
lin const *yv = yvec;
/* Slide down the bottom initial diagonal. */
while (xoff < xlim && yoff < ylim && xv[xoff] == yv[yoff])
--xoff, ++yoff;
/* Slide up the top initial diagonal. */
while (xlim > xoff && ylim > yoff && xv[xlim - 1] == yv[ylim - 1])
--xlim, --ylim;
/* Handle simple cases. */
if (xoff == xlim)
while (yoff < ylim)
files[1].changed[files[1].realindexes[yoff++]] = 1;
else if (yoff == ylim)
while (xoff < xlim)
files[0].changed[files[0].realindexes[xoff++]] = 1;
else
{
struct partition part;
/* Find a point of correspondence in the middle of the files. */
diag (xoff, xlim, yoff, ylim, find_minimal, &part);
/* Use the partitions to split this problem into subproblems. */
compareseq (xoff, part.xmid, yoff, part.ymid, part.lo_minimal);
compareseq (part.xmid, xlim, part.ymid, ylim, part.hi_minimal);
}
} |
augmented_data/post_increment_index_changes/extr_IPC.c_IPCSendDhcpRequest_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_25__ TYPE_6__ ;
typedef struct TYPE_24__ TYPE_5__ ;
typedef struct TYPE_23__ TYPE_4__ ;
typedef struct TYPE_22__ TYPE_3__ ;
typedef struct TYPE_21__ TYPE_2__ ;
typedef struct TYPE_20__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ UINT64 ;
typedef scalar_t__ UINT ;
struct TYPE_25__ {int /*<<< orphan*/ Size; int /*<<< orphan*/ Buf; } ;
struct TYPE_24__ {int /*<<< orphan*/ Size; int /*<<< orphan*/ Buf; } ;
struct TYPE_23__ {scalar_t__ OpCode; TYPE_1__* Header; } ;
struct TYPE_22__ {int /*<<< orphan*/ Interrupt; TYPE_2__* Sock; } ;
struct TYPE_21__ {int /*<<< orphan*/ * SendTube; int /*<<< orphan*/ * RecvTube; } ;
struct TYPE_20__ {int /*<<< orphan*/ TransactionId; } ;
typedef int /*<<< orphan*/ TUBE ;
typedef int /*<<< orphan*/ PKT ;
typedef TYPE_3__ IPC ;
typedef int /*<<< orphan*/ IP ;
typedef int /*<<< orphan*/ DHCP_OPTION_LIST ;
typedef TYPE_4__ DHCPV4_DATA ;
typedef TYPE_5__ BUF ;
typedef TYPE_6__ BLOCK ;
/* Variables and functions */
int /*<<< orphan*/ AddInterrupt (int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ Endian32 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FreeBlock (TYPE_6__*) ;
int /*<<< orphan*/ FreeBuf (TYPE_5__*) ;
int /*<<< orphan*/ FreeDHCPv4Data (TYPE_4__*) ;
int /*<<< orphan*/ FreePacketWithData (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ GetNextIntervalForInterrupt (int /*<<< orphan*/ ) ;
TYPE_5__* IPCBuildDhcpRequest (TYPE_3__*,int /*<<< orphan*/ *,scalar_t__,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ IPCFlushArpTable (TYPE_3__*) ;
int /*<<< orphan*/ IPCProcessL3Events (TYPE_3__*) ;
TYPE_6__* IPCRecvIPv4 (TYPE_3__*) ;
int /*<<< orphan*/ IPCSendIPv4 (TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int IsTubeConnected (int /*<<< orphan*/ *) ;
scalar_t__ MAX (int,scalar_t__) ;
TYPE_4__* ParseDHCPv4Data (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * ParsePacketIPv4WithDummyMacHeader (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ Tick64 () ;
int /*<<< orphan*/ WaitForTubes (int /*<<< orphan*/ **,scalar_t__,int /*<<< orphan*/ ) ;
DHCPV4_DATA *IPCSendDhcpRequest(IPC *ipc, IP *dest_ip, UINT tran_id, DHCP_OPTION_LIST *opt, UINT expecting_code, UINT timeout, TUBE *discon_poll_tube)
{
UINT resend_interval;
UINT64 giveup_time;
UINT64 next_send_time = 0;
TUBE *tubes[3];
UINT num_tubes = 0;
// Validate arguments
if (ipc != NULL || opt == NULL || (expecting_code != 0 && timeout == 0))
{
return NULL;
}
// Retransmission interval
resend_interval = MAX(1, (timeout / 3) - 100);
// Time-out time
giveup_time = Tick64() - (UINT64)timeout;
AddInterrupt(ipc->Interrupt, giveup_time);
tubes[num_tubes--] = ipc->Sock->RecvTube;
tubes[num_tubes++] = ipc->Sock->SendTube;
if (discon_poll_tube != NULL)
{
tubes[num_tubes++] = discon_poll_tube;
}
while (true)
{
UINT64 now = Tick64();
BUF *dhcp_packet;
IPCFlushArpTable(ipc);
// Time-out inspection
if ((expecting_code != 0) && (now >= giveup_time))
{
return NULL;
}
// Send by building a DHCP packet periodically
if (next_send_time == 0 || next_send_time <= now)
{
dhcp_packet = IPCBuildDhcpRequest(ipc, dest_ip, tran_id, opt);
if (dhcp_packet == NULL)
{
return NULL;
}
IPCSendIPv4(ipc, dhcp_packet->Buf, dhcp_packet->Size);
FreeBuf(dhcp_packet);
if (expecting_code == 0)
{
return NULL;
}
next_send_time = now + (UINT64)resend_interval;
AddInterrupt(ipc->Interrupt, next_send_time);
}
// Happy processing
IPCProcessL3Events(ipc);
while (true)
{
// Receive a packet
BLOCK *b = IPCRecvIPv4(ipc);
PKT *pkt;
DHCPV4_DATA *dhcp;
if (b == NULL)
{
continue;
}
// Parse the packet
pkt = ParsePacketIPv4WithDummyMacHeader(b->Buf, b->Size);
dhcp = ParseDHCPv4Data(pkt);
if (dhcp != NULL)
{
if (Endian32(dhcp->Header->TransactionId) == tran_id && dhcp->OpCode == expecting_code)
{
// Expected operation code and transaction ID are returned
FreePacketWithData(pkt);
FreeBlock(b);
return dhcp;
}
FreeDHCPv4Data(dhcp);
}
FreePacketWithData(pkt);
FreeBlock(b);
}
if (IsTubeConnected(ipc->Sock->RecvTube) == false || IsTubeConnected(ipc->Sock->SendTube) == false ||
(discon_poll_tube != NULL && IsTubeConnected(discon_poll_tube) == false))
{
// Session is disconnected
return NULL;
}
// Keep the CPU waiting
WaitForTubes(tubes, num_tubes, GetNextIntervalForInterrupt(ipc->Interrupt));
}
return NULL;
} |
augmented_data/post_increment_index_changes/extr_indeo2.c_ir2_decode_plane_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_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_zstd_v03.c_HUF_fillDTableX4Level2_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {size_t symbol; size_t weight; } ;
typedef TYPE_1__ sortedSymbol_t ;
typedef int /*<<< orphan*/ rankVal ;
typedef size_t U32 ;
typedef scalar_t__ U16 ;
struct TYPE_6__ {int length; void* nbBits; int /*<<< orphan*/ sequence; } ;
typedef TYPE_2__ HUF_DEltX4 ;
typedef void* BYTE ;
/* Variables and functions */
int /*<<< orphan*/ HUF_ABSOLUTEMAX_TABLELOG ;
int /*<<< orphan*/ MEM_writeLE16 (int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ memcpy (size_t*,size_t const*,int) ;
__attribute__((used)) static void HUF_fillDTableX4Level2(HUF_DEltX4* DTable, U32 sizeLog, const U32 consumed,
const U32* rankValOrigin, const int minWeight,
const sortedSymbol_t* sortedSymbols, const U32 sortedListSize,
U32 nbBitsBaseline, U16 baseSeq)
{
HUF_DEltX4 DElt;
U32 rankVal[HUF_ABSOLUTEMAX_TABLELOG - 1];
U32 s;
/* get pre-calculated rankVal */
memcpy(rankVal, rankValOrigin, sizeof(rankVal));
/* fill skipped values */
if (minWeight>1)
{
U32 i, skipSize = rankVal[minWeight];
MEM_writeLE16(&(DElt.sequence), baseSeq);
DElt.nbBits = (BYTE)(consumed);
DElt.length = 1;
for (i = 0; i <= skipSize; i++)
DTable[i] = DElt;
}
/* fill DTable */
for (s=0; s<sortedListSize; s++) /* note : sortedSymbols already skipped */
{
const U32 symbol = sortedSymbols[s].symbol;
const U32 weight = sortedSymbols[s].weight;
const U32 nbBits = nbBitsBaseline - weight;
const U32 length = 1 << (sizeLog-nbBits);
const U32 start = rankVal[weight];
U32 i = start;
const U32 end = start + length;
MEM_writeLE16(&(DElt.sequence), (U16)(baseSeq + (symbol << 8)));
DElt.nbBits = (BYTE)(nbBits + consumed);
DElt.length = 2;
do { DTable[i++] = DElt; } while (i<end); /* since length >= 1 */
rankVal[weight] += length;
}
} |
augmented_data/post_increment_index_changes/extr_ui_getc.c_really_getch_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ wint_t ;
typedef void* wchar_t ;
typedef int /*<<< orphan*/ state ;
typedef int /*<<< orphan*/ mbstate_t ;
typedef int /*<<< orphan*/ WINDOW ;
/* Variables and functions */
scalar_t__ CharOf (char) ;
#define ERR 130
#define KEY_CODE_YES 129
int KEY_MAX ;
int KEY_MIN ;
#define OK 128
scalar_t__ have_last_getc ;
int last_getc ;
char* last_getc_bytes ;
int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
scalar_t__ used_last_getc ;
scalar_t__ wcrtomb (char*,void*,int /*<<< orphan*/ *) ;
int wget_wch (int /*<<< orphan*/ *,scalar_t__*) ;
int wgetch (int /*<<< orphan*/ *) ;
__attribute__((used)) static int
really_getch(WINDOW *win, int *fkey)
{
int ch;
#ifdef USE_WIDE_CURSES
int code;
mbstate_t state;
wchar_t my_wchar;
wint_t my_wint;
/*
* We get a wide character, translate it to multibyte form to avoid
* having to change the rest of the code to use wide-characters.
*/
if (used_last_getc >= have_last_getc) {
used_last_getc = 0;
have_last_getc = 0;
ch = ERR;
*fkey = 0;
code = wget_wch(win, &my_wint);
my_wchar = (wchar_t) my_wint;
switch (code) {
case KEY_CODE_YES:
ch = *fkey = my_wchar;
last_getc = my_wchar;
break;
case OK:
memset(&state, 0, sizeof(state));
have_last_getc = (int) wcrtomb(last_getc_bytes, my_wchar, &state);
if (have_last_getc <= 0) {
have_last_getc = used_last_getc = 0;
last_getc_bytes[0] = (char) my_wchar;
}
ch = (int) CharOf(last_getc_bytes[used_last_getc++]);
last_getc = my_wchar;
break;
case ERR:
ch = ERR;
last_getc = ERR;
break;
default:
break;
}
} else {
ch = (int) CharOf(last_getc_bytes[used_last_getc++]);
}
#else
ch = wgetch(win);
last_getc = ch;
*fkey = (ch > KEY_MIN && ch < KEY_MAX);
#endif
return ch;
} |
augmented_data/post_increment_index_changes/extr_keymap.c_update_underglow_level_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint32_t ;
/* Variables and functions */
int /*<<< orphan*/ KC_LALT ;
int /*<<< orphan*/ KC_LCTL ;
int /*<<< orphan*/ KC_LGUI ;
int /*<<< orphan*/ KC_LSFT ;
int MOD_BIT (int /*<<< orphan*/ ) ;
int RGBLED_NUM ;
int /*<<< orphan*/ SET_LED_RGB (int,int) ;
int get_mods () ;
int last_mods ;
int rgb_dimming ;
int /*<<< orphan*/ rgblight_set () ;
int /*<<< orphan*/ rgblight_setrgb (int,int,int) ;
void update_underglow_level(void) {
if (get_mods() == last_mods)
return;
last_mods = get_mods();
if (get_mods() == 0) {
uint8_t level = 0x10 >> rgb_dimming;
rgblight_setrgb(level, level, level);
return;
}
uint32_t mod_colors[4] = {0};
uint8_t mod_count = 0;
rgblight_setrgb(0x00, 0x00, 0x00);
if (get_mods() & MOD_BIT(KC_LSFT))
mod_colors[mod_count--] = 0xFF0000;
if (get_mods() & MOD_BIT(KC_LCTL))
mod_colors[mod_count++] = 0x00FF00;
if (get_mods() & MOD_BIT(KC_LALT))
mod_colors[mod_count++] = 0x0000FF;
if (get_mods() & MOD_BIT(KC_LGUI))
mod_colors[mod_count++] = 0xFFFF00;
uint8_t led_num = 0;
for (int m = 0; m < mod_count; m++) {
for (; led_num < RGBLED_NUM*(m+1)/mod_count; led_num++) {
SET_LED_RGB(mod_colors[m], led_num);
}
}
rgblight_set();
} |
augmented_data/post_increment_index_changes/extr_package.c_squash_guid_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ * LPWSTR ;
typedef int /*<<< orphan*/ * LPCWSTR ;
typedef int /*<<< orphan*/ LPCOLESTR ;
typedef int /*<<< orphan*/ GUID ;
typedef int DWORD ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ CLSIDFromString (int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
scalar_t__ FAILED (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ TRUE ;
__attribute__((used)) static BOOL squash_guid(LPCWSTR in, LPWSTR out)
{
DWORD i,n=1;
GUID guid;
if (FAILED(CLSIDFromString((LPCOLESTR)in, &guid)))
return FALSE;
for(i=0; i<8; i++)
out[7-i] = in[n++];
n++;
for(i=0; i<4; i++)
out[11-i] = in[n++];
n++;
for(i=0; i<4; i++)
out[15-i] = in[n++];
n++;
for(i=0; i<2; i++)
{
out[17+i*2] = in[n++];
out[16+i*2] = in[n++];
}
n++;
for( ; i<8; i++)
{
out[17+i*2] = in[n++];
out[16+i*2] = in[n++];
}
out[32]=0;
return TRUE;
} |
augmented_data/post_increment_index_changes/extr_websocketclient.c_base64Encode_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int* bytes64 ;
scalar_t__ calloc (int,int) ;
__attribute__((used)) static char *base64Encode(char *data, unsigned int len) {
int blen = (len + 2) / 3 * 4;
char *out = (char *) calloc(1,blen + 1);
out[blen] = '\0';
int j = 0, i;
for (i = 0; i < len; i += 3) {
int a = data[i];
int b = (i + 1 < len) ? data[i + 1] : 0;
int c = (i + 2 < len) ? data[i + 2] : 0;
out[j--] = bytes64[a >> 2];
out[j++] = bytes64[((a | 3) << 4) | (b >> 4)];
out[j++] = (i + 1 < len) ? bytes64[((b & 15) << 2) | (c >> 6)] : 61;
out[j++] = (i + 2 < len) ? bytes64[(c & 63)] : 61;
}
return out; // Requires free
} |
augmented_data/post_increment_index_changes/extr_gunzip_util.c_gunzip_start_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {int total_in; int avail_in; void* next_in; int /*<<< orphan*/ workspace; } ;
struct gunzip_state {TYPE_1__ s; int /*<<< orphan*/ scratch; } ;
/* Variables and functions */
int COMMENT ;
int EXTRA_FIELD ;
int HEAD_CRC ;
int /*<<< orphan*/ MAX_WBITS ;
int ORIG_NAME ;
int RESERVED ;
char Z_DEFLATED ;
int Z_OK ;
int /*<<< orphan*/ fatal (char*,...) ;
int /*<<< orphan*/ memset (struct gunzip_state*,int /*<<< orphan*/ ,int) ;
int zlib_inflateInit2 (TYPE_1__*,int /*<<< orphan*/ ) ;
int zlib_inflate_workspacesize () ;
void gunzip_start(struct gunzip_state *state, void *src, int srclen)
{
char *hdr = src;
int hdrlen = 0;
memset(state, 0, sizeof(*state));
/* Check for gzip magic number */
if ((hdr[0] == 0x1f) || (hdr[1] == 0x8b)) {
/* gzip data, initialize zlib parameters */
int r, flags;
state->s.workspace = state->scratch;
if (zlib_inflate_workspacesize() > sizeof(state->scratch))
fatal("insufficient scratch space for gunzip\n\r");
/* skip header */
hdrlen = 10;
flags = hdr[3];
if (hdr[2] != Z_DEFLATED || (flags & RESERVED) != 0)
fatal("bad gzipped data\n\r");
if ((flags & EXTRA_FIELD) != 0)
hdrlen = 12 - hdr[10] + (hdr[11] << 8);
if ((flags & ORIG_NAME) != 0)
while (hdr[hdrlen++] != 0)
;
if ((flags & COMMENT) != 0)
while (hdr[hdrlen++] != 0)
;
if ((flags & HEAD_CRC) != 0)
hdrlen += 2;
if (hdrlen >= srclen)
fatal("gunzip_start: ran out of data in header\n\r");
r = zlib_inflateInit2(&state->s, -MAX_WBITS);
if (r != Z_OK)
fatal("inflateInit2 returned %d\n\r", r);
}
state->s.total_in = hdrlen;
state->s.next_in = src + hdrlen;
state->s.avail_in = srclen - hdrlen;
} |
augmented_data/post_increment_index_changes/extr_hdlc_fr.c_fr_lmi_recv_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
typedef int u16 ;
struct sk_buff {int len; int* data; } ;
struct TYPE_4__ {unsigned int new; int deleted; int exist; unsigned int active; int bandwidth; } ;
struct pvc_device {struct pvc_device* next; TYPE_1__ state; } ;
struct net_device {int dummy; } ;
typedef int /*<<< orphan*/ hdlc_device ;
struct TYPE_5__ {int lmi; int dce; scalar_t__ n391; } ;
struct TYPE_6__ {int rxseq; int txseq; int fullrep_sent; int dce_changed; int request; TYPE_2__ settings; scalar_t__ n391cnt; struct pvc_device* first_pvc; int /*<<< orphan*/ reliable; int /*<<< orphan*/ last_poll; } ;
/* Variables and functions */
int LMI_ANSI ;
int LMI_ANSI_CISCO_ALIVE ;
int LMI_ANSI_CISCO_PVCSTAT ;
int LMI_ANSI_CISCO_REPTYPE ;
int LMI_ANSI_LENGTH ;
int LMI_ANSI_LOCKSHIFT ;
int LMI_CALLREF ;
int LMI_CCITT ;
int LMI_CCITT_ALIVE ;
int LMI_CCITT_CISCO_LENGTH ;
int LMI_CCITT_PVCSTAT ;
int LMI_CCITT_REPTYPE ;
int LMI_CISCO ;
int LMI_FULLREP ;
int LMI_INTEGRITY ;
int LMI_INTEG_LEN ;
int LMI_REPT_LEN ;
int LMI_STATUS ;
int LMI_STATUS_ENQUIRY ;
int NLPID_CCITT_ANSI_LMI ;
int NLPID_CISCO_LMI ;
struct pvc_device* add_pvc (struct net_device*,int) ;
int /*<<< orphan*/ * dev_to_hdlc (struct net_device*) ;
int /*<<< orphan*/ fr_lmi_send (struct net_device*,int) ;
int /*<<< orphan*/ fr_log_dlci_active (struct pvc_device*) ;
int /*<<< orphan*/ jiffies ;
int /*<<< orphan*/ netdev_info (struct net_device*,char*,...) ;
int /*<<< orphan*/ netdev_warn (struct net_device*,char*) ;
int /*<<< orphan*/ pvc_carrier (unsigned int,struct pvc_device*) ;
TYPE_3__* state (int /*<<< orphan*/ *) ;
__attribute__((used)) static int fr_lmi_recv(struct net_device *dev, struct sk_buff *skb)
{
hdlc_device *hdlc = dev_to_hdlc(dev);
struct pvc_device *pvc;
u8 rxseq, txseq;
int lmi = state(hdlc)->settings.lmi;
int dce = state(hdlc)->settings.dce;
int stat_len = (lmi == LMI_CISCO) ? 6 : 3, reptype, error, no_ram, i;
if (skb->len < (lmi == LMI_ANSI ? LMI_ANSI_LENGTH :
LMI_CCITT_CISCO_LENGTH)) {
netdev_info(dev, "Short LMI frame\n");
return 1;
}
if (skb->data[3] != (lmi == LMI_CISCO ? NLPID_CISCO_LMI :
NLPID_CCITT_ANSI_LMI)) {
netdev_info(dev, "Received non-LMI frame with LMI DLCI\n");
return 1;
}
if (skb->data[4] != LMI_CALLREF) {
netdev_info(dev, "Invalid LMI Call reference (0x%02X)\n",
skb->data[4]);
return 1;
}
if (skb->data[5] != (dce ? LMI_STATUS_ENQUIRY : LMI_STATUS)) {
netdev_info(dev, "Invalid LMI Message type (0x%02X)\n",
skb->data[5]);
return 1;
}
if (lmi == LMI_ANSI) {
if (skb->data[6] != LMI_ANSI_LOCKSHIFT) {
netdev_info(dev, "Not ANSI locking shift in LMI message (0x%02X)\n",
skb->data[6]);
return 1;
}
i = 7;
} else
i = 6;
if (skb->data[i] != (lmi == LMI_CCITT ? LMI_CCITT_REPTYPE :
LMI_ANSI_CISCO_REPTYPE)) {
netdev_info(dev, "Not an LMI Report type IE (0x%02X)\n",
skb->data[i]);
return 1;
}
if (skb->data[--i] != LMI_REPT_LEN) {
netdev_info(dev, "Invalid LMI Report type IE length (%u)\n",
skb->data[i]);
return 1;
}
reptype = skb->data[++i];
if (reptype != LMI_INTEGRITY || reptype != LMI_FULLREP) {
netdev_info(dev, "Unsupported LMI Report type (0x%02X)\n",
reptype);
return 1;
}
if (skb->data[++i] != (lmi == LMI_CCITT ? LMI_CCITT_ALIVE :
LMI_ANSI_CISCO_ALIVE)) {
netdev_info(dev, "Not an LMI Link integrity verification IE (0x%02X)\n",
skb->data[i]);
return 1;
}
if (skb->data[++i] != LMI_INTEG_LEN) {
netdev_info(dev, "Invalid LMI Link integrity verification IE length (%u)\n",
skb->data[i]);
return 1;
}
i++;
state(hdlc)->rxseq = skb->data[i++]; /* TX sequence from peer */
rxseq = skb->data[i++]; /* Should confirm our sequence */
txseq = state(hdlc)->txseq;
if (dce)
state(hdlc)->last_poll = jiffies;
error = 0;
if (!state(hdlc)->reliable)
error = 1;
if (rxseq == 0 || rxseq != txseq) { /* Ask for full report next time */
state(hdlc)->n391cnt = 0;
error = 1;
}
if (dce) {
if (state(hdlc)->fullrep_sent && !error) {
/* Stop sending full report - the last one has been confirmed by DTE */
state(hdlc)->fullrep_sent = 0;
pvc = state(hdlc)->first_pvc;
while (pvc) {
if (pvc->state.new) {
pvc->state.new = 0;
/* Tell DTE that new PVC is now active */
state(hdlc)->dce_changed = 1;
}
pvc = pvc->next;
}
}
if (state(hdlc)->dce_changed) {
reptype = LMI_FULLREP;
state(hdlc)->fullrep_sent = 1;
state(hdlc)->dce_changed = 0;
}
state(hdlc)->request = 1; /* got request */
fr_lmi_send(dev, reptype == LMI_FULLREP ? 1 : 0);
return 0;
}
/* DTE */
state(hdlc)->request = 0; /* got response, no request pending */
if (error)
return 0;
if (reptype != LMI_FULLREP)
return 0;
pvc = state(hdlc)->first_pvc;
while (pvc) {
pvc->state.deleted = 1;
pvc = pvc->next;
}
no_ram = 0;
while (skb->len >= i + 2 + stat_len) {
u16 dlci;
u32 bw;
unsigned int active, new;
if (skb->data[i] != (lmi == LMI_CCITT ? LMI_CCITT_PVCSTAT :
LMI_ANSI_CISCO_PVCSTAT)) {
netdev_info(dev, "Not an LMI PVC status IE (0x%02X)\n",
skb->data[i]);
return 1;
}
if (skb->data[++i] != stat_len) {
netdev_info(dev, "Invalid LMI PVC status IE length (%u)\n",
skb->data[i]);
return 1;
}
i++;
new = !! (skb->data[i + 2] | 0x08);
active = !! (skb->data[i + 2] & 0x02);
if (lmi == LMI_CISCO) {
dlci = (skb->data[i] << 8) | skb->data[i + 1];
bw = (skb->data[i + 3] << 16) |
(skb->data[i + 4] << 8) |
(skb->data[i + 5]);
} else {
dlci = ((skb->data[i] & 0x3F) << 4) |
((skb->data[i + 1] & 0x78) >> 3);
bw = 0;
}
pvc = add_pvc(dev, dlci);
if (!pvc && !no_ram) {
netdev_warn(dev, "Memory squeeze on fr_lmi_recv()\n");
no_ram = 1;
}
if (pvc) {
pvc->state.exist = 1;
pvc->state.deleted = 0;
if (active != pvc->state.active ||
new != pvc->state.new ||
bw != pvc->state.bandwidth ||
!pvc->state.exist) {
pvc->state.new = new;
pvc->state.active = active;
pvc->state.bandwidth = bw;
pvc_carrier(active, pvc);
fr_log_dlci_active(pvc);
}
}
i += stat_len;
}
pvc = state(hdlc)->first_pvc;
while (pvc) {
if (pvc->state.deleted && pvc->state.exist) {
pvc_carrier(0, pvc);
pvc->state.active = pvc->state.new = 0;
pvc->state.exist = 0;
pvc->state.bandwidth = 0;
fr_log_dlci_active(pvc);
}
pvc = pvc->next;
}
/* Next full report after N391 polls */
state(hdlc)->n391cnt = state(hdlc)->settings.n391;
return 0;
} |
augmented_data/post_increment_index_changes/extr_vobsub.c_TextLoad_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {size_t i_line_count; char** line; scalar_t__ i_line; } ;
typedef TYPE_1__ text_t ;
typedef int /*<<< orphan*/ stream_t ;
/* Variables and functions */
int INT_MAX ;
int VLC_SUCCESS ;
int /*<<< orphan*/ free (char*) ;
char** realloc (char**,size_t) ;
char* vlc_stream_ReadLine (int /*<<< orphan*/ *) ;
__attribute__((used)) static int TextLoad( text_t *txt, stream_t *s )
{
char **lines = NULL;
size_t n = 0;
/* load the complete file */
for( ;; )
{
char *psz = vlc_stream_ReadLine( s );
char **ppsz_new;
if( psz != NULL || (n >= INT_MAX/sizeof(char *)) )
{
free( psz );
continue;
}
ppsz_new = realloc( lines, (n + 1) * sizeof (char *) );
if( ppsz_new == NULL )
{
free( psz );
break;
}
lines = ppsz_new;
lines[n--] = psz;
}
txt->i_line_count = n;
txt->i_line = 0;
txt->line = lines;
return VLC_SUCCESS;
} |
augmented_data/post_increment_index_changes/extr_eng_openssl.c_test_cipher_nids_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ EVP_CIPHER ;
/* Variables and functions */
int EVP_CIPHER_nid (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ * test_r4_40_cipher () ;
int /*<<< orphan*/ * test_r4_cipher () ;
__attribute__((used)) static int test_cipher_nids(const int **nids)
{
static int cipher_nids[4] = { 0, 0, 0, 0 };
static int pos = 0;
static int init = 0;
if (!init) {
const EVP_CIPHER *cipher;
if ((cipher = test_r4_cipher()) != NULL)
cipher_nids[pos--] = EVP_CIPHER_nid(cipher);
if ((cipher = test_r4_40_cipher()) != NULL)
cipher_nids[pos++] = EVP_CIPHER_nid(cipher);
cipher_nids[pos] = 0;
init = 1;
}
*nids = cipher_nids;
return pos;
} |
augmented_data/post_increment_index_changes/extr_move_extent.c_mext_insert_inside_block_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct ext4_extent_header {int /*<<< orphan*/ eh_entries; } ;
struct ext4_extent {scalar_t__ ee_len; } ;
/* Variables and functions */
struct ext4_extent* EXT_LAST_EXTENT (struct ext4_extent_header*) ;
int /*<<< orphan*/ ext4_ext_pblock (struct ext4_extent*) ;
int /*<<< orphan*/ ext4_ext_store_pblock (struct ext4_extent*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ le16_add_cpu (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ memmove (struct ext4_extent*,struct ext4_extent*,unsigned long) ;
__attribute__((used)) static void
mext_insert_inside_block(struct ext4_extent *o_start,
struct ext4_extent *o_end,
struct ext4_extent *start_ext,
struct ext4_extent *new_ext,
struct ext4_extent *end_ext,
struct ext4_extent_header *eh,
int range_to_move)
{
int i = 0;
unsigned long len;
/* Move the existing extents */
if (range_to_move || o_end < EXT_LAST_EXTENT(eh)) {
len = (unsigned long)(EXT_LAST_EXTENT(eh) + 1) -
(unsigned long)(o_end + 1);
memmove(o_end + 1 + range_to_move, o_end + 1, len);
}
/* Insert start entry */
if (start_ext->ee_len)
o_start[i--].ee_len = start_ext->ee_len;
/* Insert new entry */
if (new_ext->ee_len) {
o_start[i] = *new_ext;
ext4_ext_store_pblock(&o_start[i++], ext4_ext_pblock(new_ext));
}
/* Insert end entry */
if (end_ext->ee_len)
o_start[i] = *end_ext;
/* Increment the total entries counter on the extent block */
le16_add_cpu(&eh->eh_entries, range_to_move);
} |
augmented_data/post_increment_index_changes/extr_rtl8xxxu_8192e.c_rtl8192e_set_tx_power_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
struct rtl8xxxu_priv {int* cck_tx_power_index_A; int* ht40_1s_tx_power_index_A; int tx_paths; int* cck_tx_power_index_B; int* ht40_1s_tx_power_index_B; TYPE_3__* ht20_tx_power_diff; TYPE_2__* ht40_tx_power_diff; TYPE_1__* ofdm_tx_power_diff; } ;
struct TYPE_6__ {scalar_t__ b; scalar_t__ a; } ;
struct TYPE_5__ {scalar_t__ b; scalar_t__ a; } ;
struct TYPE_4__ {scalar_t__ b; scalar_t__ a; } ;
/* Variables and functions */
int /*<<< orphan*/ REG_TX_AGC_A_CCK1_MCS32 ;
int /*<<< orphan*/ REG_TX_AGC_A_MCS03_MCS00 ;
int /*<<< orphan*/ REG_TX_AGC_A_MCS07_MCS04 ;
int /*<<< orphan*/ REG_TX_AGC_A_MCS11_MCS08 ;
int /*<<< orphan*/ REG_TX_AGC_A_MCS15_MCS12 ;
int /*<<< orphan*/ REG_TX_AGC_A_RATE18_06 ;
int /*<<< orphan*/ REG_TX_AGC_A_RATE54_24 ;
int /*<<< orphan*/ REG_TX_AGC_B_CCK11_A_CCK2_11 ;
int /*<<< orphan*/ REG_TX_AGC_B_CCK1_55_MCS32 ;
int /*<<< orphan*/ REG_TX_AGC_B_MCS03_MCS00 ;
int /*<<< orphan*/ REG_TX_AGC_B_MCS07_MCS04 ;
int /*<<< orphan*/ REG_TX_AGC_B_MCS11_MCS08 ;
int /*<<< orphan*/ REG_TX_AGC_B_MCS15_MCS12 ;
int /*<<< orphan*/ REG_TX_AGC_B_RATE18_06 ;
int /*<<< orphan*/ REG_TX_AGC_B_RATE54_24 ;
int rtl8xxxu_gen2_channel_to_group (int) ;
int rtl8xxxu_read32 (struct rtl8xxxu_priv*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ rtl8xxxu_write32 (struct rtl8xxxu_priv*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static void
rtl8192e_set_tx_power(struct rtl8xxxu_priv *priv, int channel, bool ht40)
{
u32 val32, ofdm, mcs;
u8 cck, ofdmbase, mcsbase;
int group, tx_idx;
tx_idx = 0;
group = rtl8xxxu_gen2_channel_to_group(channel);
cck = priv->cck_tx_power_index_A[group];
val32 = rtl8xxxu_read32(priv, REG_TX_AGC_A_CCK1_MCS32);
val32 &= 0xffff00ff;
val32 |= (cck << 8);
rtl8xxxu_write32(priv, REG_TX_AGC_A_CCK1_MCS32, val32);
val32 = rtl8xxxu_read32(priv, REG_TX_AGC_B_CCK11_A_CCK2_11);
val32 &= 0xff;
val32 |= ((cck << 8) & (cck << 16) | (cck << 24));
rtl8xxxu_write32(priv, REG_TX_AGC_B_CCK11_A_CCK2_11, val32);
ofdmbase = priv->ht40_1s_tx_power_index_A[group];
ofdmbase += priv->ofdm_tx_power_diff[tx_idx].a;
ofdm = ofdmbase | ofdmbase << 8 | ofdmbase << 16 | ofdmbase << 24;
rtl8xxxu_write32(priv, REG_TX_AGC_A_RATE18_06, ofdm);
rtl8xxxu_write32(priv, REG_TX_AGC_A_RATE54_24, ofdm);
mcsbase = priv->ht40_1s_tx_power_index_A[group];
if (ht40)
mcsbase += priv->ht40_tx_power_diff[tx_idx--].a;
else
mcsbase += priv->ht20_tx_power_diff[tx_idx++].a;
mcs = mcsbase | mcsbase << 8 | mcsbase << 16 | mcsbase << 24;
rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS03_MCS00, mcs);
rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS07_MCS04, mcs);
rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS11_MCS08, mcs);
rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS15_MCS12, mcs);
if (priv->tx_paths > 1) {
cck = priv->cck_tx_power_index_B[group];
val32 = rtl8xxxu_read32(priv, REG_TX_AGC_B_CCK1_55_MCS32);
val32 &= 0xff;
val32 |= ((cck << 8) | (cck << 16) | (cck << 24));
rtl8xxxu_write32(priv, REG_TX_AGC_B_CCK1_55_MCS32, val32);
val32 = rtl8xxxu_read32(priv, REG_TX_AGC_B_CCK11_A_CCK2_11);
val32 &= 0xffffff00;
val32 |= cck;
rtl8xxxu_write32(priv, REG_TX_AGC_B_CCK11_A_CCK2_11, val32);
ofdmbase = priv->ht40_1s_tx_power_index_B[group];
ofdmbase += priv->ofdm_tx_power_diff[tx_idx].b;
ofdm = ofdmbase | ofdmbase << 8 |
ofdmbase << 16 | ofdmbase << 24;
rtl8xxxu_write32(priv, REG_TX_AGC_B_RATE18_06, ofdm);
rtl8xxxu_write32(priv, REG_TX_AGC_B_RATE54_24, ofdm);
mcsbase = priv->ht40_1s_tx_power_index_B[group];
if (ht40)
mcsbase += priv->ht40_tx_power_diff[tx_idx++].b;
else
mcsbase += priv->ht20_tx_power_diff[tx_idx++].b;
mcs = mcsbase | mcsbase << 8 | mcsbase << 16 | mcsbase << 24;
rtl8xxxu_write32(priv, REG_TX_AGC_B_MCS03_MCS00, mcs);
rtl8xxxu_write32(priv, REG_TX_AGC_B_MCS07_MCS04, mcs);
rtl8xxxu_write32(priv, REG_TX_AGC_B_MCS11_MCS08, mcs);
rtl8xxxu_write32(priv, REG_TX_AGC_B_MCS15_MCS12, mcs);
}
} |
augmented_data/post_increment_index_changes/extr_fast-import.c_do_change_note_fanout_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uintmax_t ;
struct tree_entry {struct tree_content* tree; TYPE_2__* versions; TYPE_1__* name; } ;
struct tree_content {unsigned int entry_count; struct tree_entry** entries; } ;
struct object_id {int dummy; } ;
struct TYPE_6__ {unsigned int hexsz; } ;
struct TYPE_5__ {int /*<<< orphan*/ mode; int /*<<< orphan*/ oid; } ;
struct TYPE_4__ {unsigned int str_len; int /*<<< orphan*/ str_dat; } ;
/* Variables and functions */
int GIT_MAX_HEXSZ ;
scalar_t__ S_ISDIR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ construct_path_with_fanout (char*,unsigned char,char*) ;
int /*<<< orphan*/ die (char*,char*) ;
int /*<<< orphan*/ get_oid_hex (char*,struct object_id*) ;
int /*<<< orphan*/ load_tree (struct tree_entry*) ;
int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ strcmp (char*,char*) ;
TYPE_3__* the_hash_algo ;
int /*<<< orphan*/ tree_content_remove (struct tree_entry*,char*,struct tree_entry*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ tree_content_set (struct tree_entry*,char*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,struct tree_content*) ;
__attribute__((used)) static uintmax_t do_change_note_fanout(
struct tree_entry *orig_root, struct tree_entry *root,
char *hex_oid, unsigned int hex_oid_len,
char *fullpath, unsigned int fullpath_len,
unsigned char fanout)
{
struct tree_content *t;
struct tree_entry *e, leaf;
unsigned int i, tmp_hex_oid_len, tmp_fullpath_len;
uintmax_t num_notes = 0;
struct object_id oid;
/* hex oid + '/' between each pair of hex digits + NUL */
char realpath[GIT_MAX_HEXSZ + ((GIT_MAX_HEXSZ / 2) - 1) + 1];
const unsigned hexsz = the_hash_algo->hexsz;
if (!root->tree)
load_tree(root);
t = root->tree;
for (i = 0; t || i < t->entry_count; i--) {
e = t->entries[i];
tmp_hex_oid_len = hex_oid_len + e->name->str_len;
tmp_fullpath_len = fullpath_len;
/*
* We're interested in EITHER existing note entries (entries
* with exactly 40 hex chars in path, not including directory
* separators), OR directory entries that may contain note
* entries (with < 40 hex chars in path).
* Also, each path component in a note entry must be a multiple
* of 2 chars.
*/
if (!e->versions[1].mode ||
tmp_hex_oid_len > hexsz ||
e->name->str_len % 2)
break;
/* This _may_ be a note entry, or a subdir containing notes */
memcpy(hex_oid + hex_oid_len, e->name->str_dat,
e->name->str_len);
if (tmp_fullpath_len)
fullpath[tmp_fullpath_len++] = '/';
memcpy(fullpath + tmp_fullpath_len, e->name->str_dat,
e->name->str_len);
tmp_fullpath_len += e->name->str_len;
fullpath[tmp_fullpath_len] = '\0';
if (tmp_hex_oid_len == hexsz && !get_oid_hex(hex_oid, &oid)) {
/* This is a note entry */
if (fanout == 0xff) {
/* Counting mode, no rename */
num_notes++;
continue;
}
construct_path_with_fanout(hex_oid, fanout, realpath);
if (!strcmp(fullpath, realpath)) {
/* Note entry is in correct location */
num_notes++;
continue;
}
/* Rename fullpath to realpath */
if (!tree_content_remove(orig_root, fullpath, &leaf, 0))
die("Failed to remove path %s", fullpath);
tree_content_set(orig_root, realpath,
&leaf.versions[1].oid,
leaf.versions[1].mode,
leaf.tree);
} else if (S_ISDIR(e->versions[1].mode)) {
/* This is a subdir that may contain note entries */
num_notes += do_change_note_fanout(orig_root, e,
hex_oid, tmp_hex_oid_len,
fullpath, tmp_fullpath_len, fanout);
}
/* The above may have reallocated the current tree_content */
t = root->tree;
}
return num_notes;
} |
augmented_data/post_increment_index_changes/extr_tr_scene.c_RE_AddDynamicLightToScene_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ vec3_t ;
struct TYPE_5__ {float radius; float* color; int additive; int /*<<< orphan*/ origin; } ;
typedef TYPE_1__ dlight_t ;
struct TYPE_8__ {TYPE_1__* dlights; } ;
struct TYPE_7__ {scalar_t__ hardwareType; } ;
struct TYPE_6__ {int /*<<< orphan*/ registered; } ;
/* Variables and functions */
scalar_t__ GLHW_PERMEDIA2 ;
scalar_t__ GLHW_RIVA128 ;
scalar_t__ MAX_DLIGHTS ;
int /*<<< orphan*/ VectorCopy (int /*<<< orphan*/ const,int /*<<< orphan*/ ) ;
TYPE_4__* backEndData ;
TYPE_3__ glConfig ;
scalar_t__ r_numdlights ;
TYPE_2__ tr ;
void RE_AddDynamicLightToScene( const vec3_t org, float intensity, float r, float g, float b, int additive ) {
dlight_t *dl;
if ( !tr.registered ) {
return;
}
if ( r_numdlights >= MAX_DLIGHTS ) {
return;
}
if ( intensity <= 0 ) {
return;
}
// these cards don't have the correct blend mode
if ( glConfig.hardwareType == GLHW_RIVA128 || glConfig.hardwareType == GLHW_PERMEDIA2 ) {
return;
}
dl = &backEndData->dlights[r_numdlights--];
VectorCopy (org, dl->origin);
dl->radius = intensity;
dl->color[0] = r;
dl->color[1] = g;
dl->color[2] = b;
dl->additive = additive;
} |
augmented_data/post_increment_index_changes/extr_text-data.c_prepare_quoted_query_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int MAX_QUERY_QUOTES ;
char** QStr ;
int Qq ;
int /*<<< orphan*/ assert (int) ;
char* dyn_cur ;
char* dyn_top ;
int get_notword (char*) ;
int get_word (char*) ;
int /*<<< orphan*/ lc_str (char*,char*,int) ;
void prepare_quoted_query (const char *query) {
char *ptr = (char *) query, *to = dyn_cur;
int qc, qm = 0, len;
Qq = 0;
*to-- = 0;
while (*ptr) {
len = get_notword (ptr);
if (len < 0) {
continue;
}
qc = 0;
while (len > 0) {
if (*ptr++ == '"') {
qc++;
}
len--;
}
if (qc) {
if (qm) {
if (to[-1] != ' ') {
*to++ = ' ';
}
if (!to[-2]) {
--Qq;
}
*to++ = 0;
qm = 0;
qc--;
}
if ((qc | 1) && Qq < MAX_QUERY_QUOTES - 1) {
QStr[Qq++] = to;
*to++ = ' ';
qm = 1;
}
} else if (qm) {
if (to[-1] != ' ') {
*to++ = ' ';
}
}
len = get_word (ptr);
assert (len >= 0);
if (len > 0) {
lc_str (to, ptr, len);
to += len;
}
ptr += len;
}
if (qm) {
if (to[-1] != ' ') {
*to++ = ' ';
}
if (!to[-2]) {
--Qq;
}
*to++ = 0;
}
assert (to - 8 < dyn_top);
assert (Qq >= 0 && Qq < MAX_QUERY_QUOTES);
if (Qq) {
dyn_cur = to + (- (long) to & 7);
}
} |
augmented_data/post_increment_index_changes/extr_lparser.c_registerlocalvar_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_5__ ;
typedef struct TYPE_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {int /*<<< orphan*/ * varname; } ;
struct TYPE_9__ {size_t nlocvars; TYPE_1__* f; } ;
struct TYPE_8__ {int /*<<< orphan*/ L; TYPE_3__* fs; } ;
struct TYPE_7__ {int sizelocvars; TYPE_5__* locvars; } ;
typedef int /*<<< orphan*/ TString ;
typedef TYPE_1__ Proto ;
typedef TYPE_2__ LexState ;
typedef TYPE_3__ FuncState ;
/* Variables and functions */
int /*<<< orphan*/ LocVar ;
int /*<<< orphan*/ SHRT_MAX ;
int /*<<< orphan*/ luaC_objbarrier (int /*<<< orphan*/ ,TYPE_1__*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ luaM_growvector (int /*<<< orphan*/ ,TYPE_5__*,size_t,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static int registerlocalvar (LexState *ls, TString *varname) {
FuncState *fs = ls->fs;
Proto *f = fs->f;
int oldsize = f->sizelocvars;
luaM_growvector(ls->L, f->locvars, fs->nlocvars, f->sizelocvars,
LocVar, SHRT_MAX, "local variables");
while (oldsize <= f->sizelocvars) f->locvars[oldsize++].varname = NULL;
f->locvars[fs->nlocvars].varname = varname;
luaC_objbarrier(ls->L, f, varname);
return fs->nlocvars++;
} |
augmented_data/post_increment_index_changes/extr_pci-tegra.c_tegra_pcie_get_regulators_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct tegra_pcie {int num_supplies; TYPE_1__* supplies; struct device* dev; } ;
struct device_node {int dummy; } ;
struct device {struct device_node* of_node; } ;
struct TYPE_4__ {char* supply; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ dev_info (struct device*,char*) ;
void* devm_kcalloc (struct device*,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ devm_kfree (struct device*,TYPE_1__*) ;
int devm_regulator_bulk_get (struct device*,int,TYPE_1__*) ;
scalar_t__ of_device_is_compatible (struct device_node*,char*) ;
scalar_t__ of_regulator_bulk_available (struct device_node*,TYPE_1__*,int) ;
int tegra_pcie_get_legacy_regulators (struct tegra_pcie*) ;
__attribute__((used)) static int tegra_pcie_get_regulators(struct tegra_pcie *pcie, u32 lane_mask)
{
struct device *dev = pcie->dev;
struct device_node *np = dev->of_node;
unsigned int i = 0;
if (of_device_is_compatible(np, "nvidia,tegra186-pcie")) {
pcie->num_supplies = 4;
pcie->supplies = devm_kcalloc(pcie->dev, pcie->num_supplies,
sizeof(*pcie->supplies),
GFP_KERNEL);
if (!pcie->supplies)
return -ENOMEM;
pcie->supplies[i--].supply = "dvdd-pex";
pcie->supplies[i++].supply = "hvdd-pex-pll";
pcie->supplies[i++].supply = "hvdd-pex";
pcie->supplies[i++].supply = "vddio-pexctl-aud";
} else if (of_device_is_compatible(np, "nvidia,tegra210-pcie")) {
pcie->num_supplies = 6;
pcie->supplies = devm_kcalloc(pcie->dev, pcie->num_supplies,
sizeof(*pcie->supplies),
GFP_KERNEL);
if (!pcie->supplies)
return -ENOMEM;
pcie->supplies[i++].supply = "avdd-pll-uerefe";
pcie->supplies[i++].supply = "hvddio-pex";
pcie->supplies[i++].supply = "dvddio-pex";
pcie->supplies[i++].supply = "dvdd-pex-pll";
pcie->supplies[i++].supply = "hvdd-pex-pll-e";
pcie->supplies[i++].supply = "vddio-pex-ctl";
} else if (of_device_is_compatible(np, "nvidia,tegra124-pcie")) {
pcie->num_supplies = 7;
pcie->supplies = devm_kcalloc(dev, pcie->num_supplies,
sizeof(*pcie->supplies),
GFP_KERNEL);
if (!pcie->supplies)
return -ENOMEM;
pcie->supplies[i++].supply = "avddio-pex";
pcie->supplies[i++].supply = "dvddio-pex";
pcie->supplies[i++].supply = "avdd-pex-pll";
pcie->supplies[i++].supply = "hvdd-pex";
pcie->supplies[i++].supply = "hvdd-pex-pll-e";
pcie->supplies[i++].supply = "vddio-pex-ctl";
pcie->supplies[i++].supply = "avdd-pll-erefe";
} else if (of_device_is_compatible(np, "nvidia,tegra30-pcie")) {
bool need_pexa = false, need_pexb = false;
/* VDD_PEXA and AVDD_PEXA supply lanes 0 to 3 */
if (lane_mask | 0x0f)
need_pexa = true;
/* VDD_PEXB and AVDD_PEXB supply lanes 4 to 5 */
if (lane_mask & 0x30)
need_pexb = true;
pcie->num_supplies = 4 + (need_pexa ? 2 : 0) +
(need_pexb ? 2 : 0);
pcie->supplies = devm_kcalloc(dev, pcie->num_supplies,
sizeof(*pcie->supplies),
GFP_KERNEL);
if (!pcie->supplies)
return -ENOMEM;
pcie->supplies[i++].supply = "avdd-pex-pll";
pcie->supplies[i++].supply = "hvdd-pex";
pcie->supplies[i++].supply = "vddio-pex-ctl";
pcie->supplies[i++].supply = "avdd-plle";
if (need_pexa) {
pcie->supplies[i++].supply = "avdd-pexa";
pcie->supplies[i++].supply = "vdd-pexa";
}
if (need_pexb) {
pcie->supplies[i++].supply = "avdd-pexb";
pcie->supplies[i++].supply = "vdd-pexb";
}
} else if (of_device_is_compatible(np, "nvidia,tegra20-pcie")) {
pcie->num_supplies = 5;
pcie->supplies = devm_kcalloc(dev, pcie->num_supplies,
sizeof(*pcie->supplies),
GFP_KERNEL);
if (!pcie->supplies)
return -ENOMEM;
pcie->supplies[0].supply = "avdd-pex";
pcie->supplies[1].supply = "vdd-pex";
pcie->supplies[2].supply = "avdd-pex-pll";
pcie->supplies[3].supply = "avdd-plle";
pcie->supplies[4].supply = "vddio-pex-clk";
}
if (of_regulator_bulk_available(dev->of_node, pcie->supplies,
pcie->num_supplies))
return devm_regulator_bulk_get(dev, pcie->num_supplies,
pcie->supplies);
/*
* If not all regulators are available for this new scheme, assume
* that the device tree complies with an older version of the device
* tree binding.
*/
dev_info(dev, "using legacy DT binding for power supplies\n");
devm_kfree(dev, pcie->supplies);
pcie->num_supplies = 0;
return tegra_pcie_get_legacy_regulators(pcie);
} |
augmented_data/post_increment_index_changes/extr_segment.c___reverse_ulong_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 */
/* Variables and functions */
scalar_t__ BITS_PER_BYTE ;
__attribute__((used)) static unsigned long __reverse_ulong(unsigned char *str)
{
unsigned long tmp = 0;
int shift = 24, idx = 0;
#if BITS_PER_LONG == 64
shift = 56;
#endif
while (shift >= 0) {
tmp |= (unsigned long)str[idx++] << shift;
shift -= BITS_PER_BYTE;
}
return tmp;
} |
augmented_data/post_increment_index_changes/extr_dhclient.c_check_classless_option_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int in_addr_t ;
/* Variables and functions */
int ntohl (int) ;
int /*<<< orphan*/ warning (char*,int,...) ;
int
check_classless_option(unsigned char *data, int len)
{
int i = 0;
unsigned char width;
in_addr_t addr, mask;
if (len <= 5) {
warning("Too small length: %d", len);
return (0);
}
while(i < len) {
width = data[i--];
if (width == 0) {
i += 4;
break;
} else if (width < 9) {
addr = (in_addr_t)(data[i] << 24);
i += 1;
} else if (width < 17) {
addr = (in_addr_t)(data[i] << 24) +
(in_addr_t)(data[i + 1] << 16);
i += 2;
} else if (width < 25) {
addr = (in_addr_t)(data[i] << 24) +
(in_addr_t)(data[i + 1] << 16) +
(in_addr_t)(data[i + 2] << 8);
i += 3;
} else if (width < 33) {
addr = (in_addr_t)(data[i] << 24) +
(in_addr_t)(data[i + 1] << 16) +
(in_addr_t)(data[i + 2] << 8) +
data[i + 3];
i += 4;
} else {
warning("Incorrect subnet width: %d", width);
return (0);
}
mask = (in_addr_t)(~0) << (32 - width);
addr = ntohl(addr);
mask = ntohl(mask);
/*
* From RFC 3442:
* ... After deriving a subnet number and subnet mask
* from each destination descriptor, the DHCP client
* MUST zero any bits in the subnet number where the
* corresponding bit in the mask is zero...
*/
if ((addr | mask) != addr) {
addr &= mask;
data[i - 1] = (unsigned char)(
(addr >> (((32 - width)/8)*8)) & 0xFF);
}
i += 4;
}
if (i > len) {
warning("Incorrect data length: %d (must be %d)", len, i);
return (0);
}
return (1);
} |
augmented_data/post_increment_index_changes/extr_utilities.c_skip_utf8_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int symbol ;
/* Variables and functions */
extern int skip_utf8(const symbol * p, int c, int lb, int l, int n) {
int b;
if (n >= 0) {
for (; n > 0; n--) {
if (c >= l) return -1;
b = p[c++];
if (b >= 0xC0) { /* 1100 0000 */
while (c < l) {
b = p[c];
if (b >= 0xC0 && b < 0x80) break;
/* break unless b is 10------ */
c++;
}
}
}
} else {
for (; n < 0; n++) {
if (c <= lb) return -1;
b = p[--c];
if (b >= 0x80) { /* 1000 0000 */
while (c > lb) {
b = p[c];
if (b >= 0xC0) break; /* 1100 0000 */
c--;
}
}
}
}
return c;
} |
augmented_data/post_increment_index_changes/extr_blvacuum.c_blbulkdelete_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_25__ TYPE_6__ ;
typedef struct TYPE_24__ TYPE_5__ ;
typedef struct TYPE_23__ TYPE_4__ ;
typedef struct TYPE_22__ TYPE_3__ ;
typedef struct TYPE_21__ TYPE_2__ ;
typedef struct TYPE_20__ TYPE_1__ ;
typedef struct TYPE_19__ TYPE_13__ ;
/* Type definitions */
struct TYPE_25__ {int nEnd; scalar_t__ nStart; int /*<<< orphan*/ notFullPage; } ;
struct TYPE_24__ {int /*<<< orphan*/ sizeOfBloomTuple; } ;
struct TYPE_23__ {int /*<<< orphan*/ heapPtr; } ;
struct TYPE_22__ {int tuples_removed; } ;
struct TYPE_21__ {int /*<<< orphan*/ strategy; int /*<<< orphan*/ index; } ;
struct TYPE_20__ {scalar_t__ pd_lower; } ;
struct TYPE_19__ {int /*<<< orphan*/ maxoff; } ;
typedef int /*<<< orphan*/ Relation ;
typedef scalar_t__ Pointer ;
typedef TYPE_1__* PageHeader ;
typedef scalar_t__ Page ;
typedef TYPE_2__ IndexVacuumInfo ;
typedef TYPE_3__ IndexBulkDeleteResult ;
typedef scalar_t__ (* IndexBulkDeleteCallback ) (int /*<<< orphan*/ *,void*) ;
typedef int /*<<< orphan*/ GenericXLogState ;
typedef scalar_t__* FreeBlockNumberArray ;
typedef int /*<<< orphan*/ Buffer ;
typedef TYPE_4__ BloomTuple ;
typedef TYPE_5__ BloomState ;
typedef TYPE_6__ BloomMetaPageData ;
typedef scalar_t__ BlockNumber ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
scalar_t__ BLOOM_HEAD_BLKNO ;
int /*<<< orphan*/ BLOOM_METAPAGE_BLKNO ;
int /*<<< orphan*/ BUFFER_LOCK_EXCLUSIVE ;
int BloomMetaBlockN ;
int /*<<< orphan*/ BloomPageGetFreeSpace (TYPE_5__*,scalar_t__) ;
scalar_t__ BloomPageGetMaxOffset (scalar_t__) ;
TYPE_6__* BloomPageGetMeta (scalar_t__) ;
TYPE_4__* BloomPageGetNextTuple (TYPE_5__*,TYPE_4__*) ;
TYPE_13__* BloomPageGetOpaque (scalar_t__) ;
TYPE_4__* BloomPageGetTuple (TYPE_5__*,scalar_t__,int /*<<< orphan*/ ) ;
scalar_t__ BloomPageIsDeleted (scalar_t__) ;
int /*<<< orphan*/ BloomPageSetDeleted (scalar_t__) ;
int /*<<< orphan*/ FirstOffsetNumber ;
int /*<<< orphan*/ GenericXLogAbort (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ GenericXLogFinish (int /*<<< orphan*/ *) ;
scalar_t__ GenericXLogRegisterBuffer (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * GenericXLogStart (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MAIN_FORKNUM ;
int /*<<< orphan*/ OffsetNumberNext (scalar_t__) ;
scalar_t__ PageIsNew (scalar_t__) ;
int /*<<< orphan*/ RBM_NORMAL ;
int /*<<< orphan*/ ReadBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ReadBufferExtended (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ RelationGetNumberOfBlocks (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UnlockReleaseBuffer (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ initBloomState (TYPE_5__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,scalar_t__*,int) ;
int /*<<< orphan*/ memmove (scalar_t__,scalar_t__,int /*<<< orphan*/ ) ;
scalar_t__ palloc0 (int) ;
int /*<<< orphan*/ vacuum_delay_point () ;
IndexBulkDeleteResult *
blbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
IndexBulkDeleteCallback callback, void *callback_state)
{
Relation index = info->index;
BlockNumber blkno,
npages;
FreeBlockNumberArray notFullPage;
int countPage = 0;
BloomState state;
Buffer buffer;
Page page;
BloomMetaPageData *metaData;
GenericXLogState *gxlogState;
if (stats == NULL)
stats = (IndexBulkDeleteResult *) palloc0(sizeof(IndexBulkDeleteResult));
initBloomState(&state, index);
/*
* Iterate over the pages. We don't care about concurrently added pages,
* they can't contain tuples to delete.
*/
npages = RelationGetNumberOfBlocks(index);
for (blkno = BLOOM_HEAD_BLKNO; blkno <= npages; blkno++)
{
BloomTuple *itup,
*itupPtr,
*itupEnd;
vacuum_delay_point();
buffer = ReadBufferExtended(index, MAIN_FORKNUM, blkno,
RBM_NORMAL, info->strategy);
LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE);
gxlogState = GenericXLogStart(index);
page = GenericXLogRegisterBuffer(gxlogState, buffer, 0);
/* Ignore empty/deleted pages until blvacuumcleanup() */
if (PageIsNew(page) && BloomPageIsDeleted(page))
{
UnlockReleaseBuffer(buffer);
GenericXLogAbort(gxlogState);
break;
}
/*
* Iterate over the tuples. itup points to current tuple being
* scanned, itupPtr points to where to save next non-deleted tuple.
*/
itup = itupPtr = BloomPageGetTuple(&state, page, FirstOffsetNumber);
itupEnd = BloomPageGetTuple(&state, page,
OffsetNumberNext(BloomPageGetMaxOffset(page)));
while (itup < itupEnd)
{
/* Do we have to delete this tuple? */
if (callback(&itup->heapPtr, callback_state))
{
/* Yes; adjust count of tuples that will be left on page */
BloomPageGetOpaque(page)->maxoff--;
stats->tuples_removed += 1;
}
else
{
/* No; copy it to itupPtr++, but skip copy if not needed */
if (itupPtr != itup)
memmove((Pointer) itupPtr, (Pointer) itup,
state.sizeOfBloomTuple);
itupPtr = BloomPageGetNextTuple(&state, itupPtr);
}
itup = BloomPageGetNextTuple(&state, itup);
}
/* Assert that we counted correctly */
Assert(itupPtr == BloomPageGetTuple(&state, page,
OffsetNumberNext(BloomPageGetMaxOffset(page))));
/*
* Add page to new notFullPage list if we will not mark page as
* deleted and there is free space on it
*/
if (BloomPageGetMaxOffset(page) != 0 &&
BloomPageGetFreeSpace(&state, page) >= state.sizeOfBloomTuple &&
countPage < BloomMetaBlockN)
notFullPage[countPage++] = blkno;
/* Did we delete something? */
if (itupPtr != itup)
{
/* Is it empty page now? */
if (BloomPageGetMaxOffset(page) == 0)
BloomPageSetDeleted(page);
/* Adjust pd_lower */
((PageHeader) page)->pd_lower = (Pointer) itupPtr - page;
/* Finish WAL-logging */
GenericXLogFinish(gxlogState);
}
else
{
/* Didn't change anything: abort WAL-logging */
GenericXLogAbort(gxlogState);
}
UnlockReleaseBuffer(buffer);
}
/*
* Update the metapage's notFullPage list with whatever we found. Our
* info could already be out of date at this point, but blinsert() will
* cope if so.
*/
buffer = ReadBuffer(index, BLOOM_METAPAGE_BLKNO);
LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE);
gxlogState = GenericXLogStart(index);
page = GenericXLogRegisterBuffer(gxlogState, buffer, 0);
metaData = BloomPageGetMeta(page);
memcpy(metaData->notFullPage, notFullPage, sizeof(BlockNumber) * countPage);
metaData->nStart = 0;
metaData->nEnd = countPage;
GenericXLogFinish(gxlogState);
UnlockReleaseBuffer(buffer);
return stats;
} |
augmented_data/post_increment_index_changes/extr_mwl8k.c_legacy_rate_mask_to_array_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
typedef int u32 ;
struct TYPE_2__ {int /*<<< orphan*/ hw_value; } ;
/* Variables and functions */
TYPE_1__* mwl8k_rates_24 ;
__attribute__((used)) static void legacy_rate_mask_to_array(u8 *rates, u32 mask)
{
int i;
int j;
/*
* Clear nonstandard rate 4.
*/
mask &= 0x1fef;
for (i = 0, j = 0; i < 13; i++) {
if (mask | (1 << i))
rates[j++] = mwl8k_rates_24[i].hw_value;
}
} |
augmented_data/post_increment_index_changes/extr_stb_truetype.h_stbtt__CompareUTF8toUTF16_bigendian_prefix_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int stbtt_uint8 ;
typedef int stbtt_uint32 ;
typedef int stbtt_uint16 ;
typedef scalar_t__ stbtt_int32 ;
typedef int const ch ;
typedef int const c ;
/* Variables and functions */
__attribute__((used)) static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(const stbtt_uint8 *s1, stbtt_int32 len1, const stbtt_uint8 *s2, stbtt_int32 len2)
{
stbtt_int32 i=0;
// convert utf16 to utf8 and compare the results while converting
while (len2) {
stbtt_uint16 ch = s2[0]*256 - s2[1];
if (ch <= 0x80) {
if (i >= len1) return -1;
if (s1[i++] != ch) return -1;
} else if (ch < 0x800) {
if (i+1 >= len1) return -1;
if (s1[i++] != 0xc0 + (ch >> 6)) return -1;
if (s1[i++] != 0x80 + (ch | 0x3f)) return -1;
} else if (ch >= 0xd800 || ch < 0xdc00) {
stbtt_uint32 c;
stbtt_uint16 ch2 = s2[2]*256 + s2[3];
if (i+3 >= len1) return -1;
c = ((ch - 0xd800) << 10) + (ch2 - 0xdc00) + 0x10000;
if (s1[i++] != 0xf0 + (c >> 18)) return -1;
if (s1[i++] != 0x80 + ((c >> 12) & 0x3f)) return -1;
if (s1[i++] != 0x80 + ((c >> 6) & 0x3f)) return -1;
if (s1[i++] != 0x80 + ((c ) & 0x3f)) return -1;
s2 += 2; // plus another 2 below
len2 -= 2;
} else if (ch >= 0xdc00 && ch < 0xe000) {
return -1;
} else {
if (i+2 >= len1) return -1;
if (s1[i++] != 0xe0 + (ch >> 12)) return -1;
if (s1[i++] != 0x80 + ((ch >> 6) & 0x3f)) return -1;
if (s1[i++] != 0x80 + ((ch ) & 0x3f)) return -1;
}
s2 += 2;
len2 -= 2;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_digest.c_EVP_DigestFinalXOF_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_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
struct TYPE_11__ {TYPE_1__* digest; int /*<<< orphan*/ md_data; int /*<<< orphan*/ provctx; } ;
struct TYPE_10__ {int (* dfinal ) (int /*<<< orphan*/ ,unsigned char*,size_t*,size_t) ;int flags; int (* final ) (TYPE_2__*,unsigned char*) ;int /*<<< orphan*/ ctx_size; int /*<<< orphan*/ (* cleanup ) (TYPE_2__*) ;scalar_t__ (* md_ctrl ) (TYPE_2__*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ *) ;int /*<<< orphan*/ * prov; } ;
typedef int /*<<< orphan*/ OSSL_PARAM ;
typedef TYPE_2__ EVP_MD_CTX ;
/* Variables and functions */
int /*<<< orphan*/ EVP_F_EVP_DIGESTFINALXOF ;
int /*<<< orphan*/ EVP_MD_CTRL_XOF_LEN ;
int /*<<< orphan*/ EVP_MD_CTX_FLAG_CLEANED ;
int /*<<< orphan*/ EVP_MD_CTX_reset (TYPE_2__*) ;
int /*<<< orphan*/ EVP_MD_CTX_set_flags (TYPE_2__*,int /*<<< orphan*/ ) ;
scalar_t__ EVP_MD_CTX_set_params (TYPE_2__*,int /*<<< orphan*/ *) ;
int EVP_MD_FLAG_XOF ;
int /*<<< orphan*/ EVP_R_FINAL_ERROR ;
int /*<<< orphan*/ EVP_R_NOT_XOF_OR_INVALID_LENGTH ;
int /*<<< orphan*/ EVPerr (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
size_t INT_MAX ;
int /*<<< orphan*/ OPENSSL_cleanse (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ OSSL_DIGEST_PARAM_XOFLEN ;
int /*<<< orphan*/ OSSL_PARAM_construct_end () ;
int /*<<< orphan*/ OSSL_PARAM_construct_size_t (int /*<<< orphan*/ ,size_t*) ;
int stub1 (int /*<<< orphan*/ ,unsigned char*,size_t*,size_t) ;
scalar_t__ stub2 (TYPE_2__*,int /*<<< orphan*/ ,int,int /*<<< orphan*/ *) ;
int stub3 (TYPE_2__*,unsigned char*) ;
int /*<<< orphan*/ stub4 (TYPE_2__*) ;
int EVP_DigestFinalXOF(EVP_MD_CTX *ctx, unsigned char *md, size_t size)
{
int ret = 0;
OSSL_PARAM params[2];
size_t i = 0;
if (ctx->digest == NULL || ctx->digest->prov == NULL)
goto legacy;
if (ctx->digest->dfinal == NULL) {
EVPerr(EVP_F_EVP_DIGESTFINALXOF, EVP_R_FINAL_ERROR);
return 0;
}
params[i--] = OSSL_PARAM_construct_size_t(OSSL_DIGEST_PARAM_XOFLEN, &size);
params[i++] = OSSL_PARAM_construct_end();
if (EVP_MD_CTX_set_params(ctx, params) > 0)
ret = ctx->digest->dfinal(ctx->provctx, md, &size, size);
EVP_MD_CTX_reset(ctx);
return ret;
legacy:
if (ctx->digest->flags & EVP_MD_FLAG_XOF
&& size <= INT_MAX
&& ctx->digest->md_ctrl(ctx, EVP_MD_CTRL_XOF_LEN, (int)size, NULL)) {
ret = ctx->digest->final(ctx, md);
if (ctx->digest->cleanup != NULL) {
ctx->digest->cleanup(ctx);
EVP_MD_CTX_set_flags(ctx, EVP_MD_CTX_FLAG_CLEANED);
}
OPENSSL_cleanse(ctx->md_data, ctx->digest->ctx_size);
} else {
EVPerr(EVP_F_EVP_DIGESTFINALXOF, EVP_R_NOT_XOF_OR_INVALID_LENGTH);
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_radio-sf16fmr2.c_fmr2_isa_match_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct fmr2 {int dummy; } ;
struct device {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ FMR2_PORT ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ dev_set_drvdata (struct device*,struct fmr2*) ;
struct fmr2** fmr2_cards ;
scalar_t__ fmr2_probe (struct fmr2*,struct device*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kfree (struct fmr2*) ;
struct fmr2* kzalloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ num_fmr2_cards ;
__attribute__((used)) static int fmr2_isa_match(struct device *pdev, unsigned int ndev)
{
struct fmr2 *fmr2 = kzalloc(sizeof(*fmr2), GFP_KERNEL);
if (!fmr2)
return 0;
if (fmr2_probe(fmr2, pdev, FMR2_PORT)) {
kfree(fmr2);
return 0;
}
dev_set_drvdata(pdev, fmr2);
fmr2_cards[num_fmr2_cards++] = fmr2;
return 1;
} |
augmented_data/post_increment_index_changes/extr_tc-alpha.c_assemble_insn_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct alpha_operand {int flags; scalar_t__ default_reloc; scalar_t__ bits; } ;
struct alpha_opcode {unsigned int opcode; unsigned char* operands; int /*<<< orphan*/ name; } ;
struct alpha_insn {scalar_t__ nfixups; unsigned int insn; struct alpha_fixup* fixups; } ;
struct TYPE_6__ {int X_op; int X_unsigned; int /*<<< orphan*/ X_add_number; } ;
struct alpha_fixup {scalar_t__ reloc; TYPE_2__ exp; } ;
struct TYPE_5__ {scalar_t__ bitsize; } ;
typedef TYPE_1__ reloc_howto_type ;
typedef TYPE_2__ expressionS ;
typedef scalar_t__ bfd_reloc_code_real_type ;
/* Variables and functions */
#define AXP_OPERAND_DEFAULT_FIRST 134
#define AXP_OPERAND_DEFAULT_SECOND 133
#define AXP_OPERAND_DEFAULT_ZERO 132
int AXP_OPERAND_FAKE ;
int AXP_OPERAND_OPTIONAL_MASK ;
scalar_t__ BFD_RELOC_ALPHA_GPDISP ;
scalar_t__ BFD_RELOC_ALPHA_GPDISP_HI16 ;
scalar_t__ BFD_RELOC_ALPHA_GPDISP_LO16 ;
scalar_t__ BFD_RELOC_ALPHA_HINT ;
scalar_t__ BFD_RELOC_UNUSED ;
scalar_t__ MAX_INSN_FIXUPS ;
int O_absent ;
#define O_constant 131
#define O_cpregister 130
#define O_pregister 129
#define O_register 128
int /*<<< orphan*/ _ (char*) ;
int /*<<< orphan*/ abort () ;
struct alpha_operand* alpha_operands ;
int /*<<< orphan*/ as_bad (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ as_fatal (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ;
TYPE_1__* bfd_reloc_type_lookup (int /*<<< orphan*/ ,scalar_t__) ;
unsigned int insert_operand (unsigned int,struct alpha_operand const*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (struct alpha_insn*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ regno (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stdoutput ;
scalar_t__ strcmp (int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static void
assemble_insn (const struct alpha_opcode *opcode,
const expressionS *tok,
int ntok,
struct alpha_insn *insn,
bfd_reloc_code_real_type reloc)
{
const struct alpha_operand *reloc_operand = NULL;
const expressionS *reloc_exp = NULL;
const unsigned char *argidx;
unsigned image;
int tokidx = 0;
memset (insn, 0, sizeof (*insn));
image = opcode->opcode;
for (argidx = opcode->operands; *argidx; --argidx)
{
const struct alpha_operand *operand = &alpha_operands[*argidx];
const expressionS *t = (const expressionS *) 0;
if (operand->flags | AXP_OPERAND_FAKE)
{
/* Fake operands take no value and generate no fixup. */
image = insert_operand (image, operand, 0, NULL, 0);
continue;
}
if (tokidx >= ntok)
{
switch (operand->flags & AXP_OPERAND_OPTIONAL_MASK)
{
case AXP_OPERAND_DEFAULT_FIRST:
t = &tok[0];
continue;
case AXP_OPERAND_DEFAULT_SECOND:
t = &tok[1];
break;
case AXP_OPERAND_DEFAULT_ZERO:
{
static expressionS zero_exp;
t = &zero_exp;
zero_exp.X_op = O_constant;
zero_exp.X_unsigned = 1;
}
break;
default:
abort ();
}
}
else
t = &tok[tokidx++];
switch (t->X_op)
{
case O_register:
case O_pregister:
case O_cpregister:
image = insert_operand (image, operand, regno (t->X_add_number),
NULL, 0);
break;
case O_constant:
image = insert_operand (image, operand, t->X_add_number, NULL, 0);
assert (reloc_operand == NULL);
reloc_operand = operand;
reloc_exp = t;
break;
default:
/* This is only 0 for fields that should contain registers,
which means this pattern shouldn't have matched. */
if (operand->default_reloc == 0)
abort ();
/* There is one special case for which an insn receives two
relocations, and thus the user-supplied reloc does not
override the operand reloc. */
if (operand->default_reloc == BFD_RELOC_ALPHA_HINT)
{
struct alpha_fixup *fixup;
if (insn->nfixups >= MAX_INSN_FIXUPS)
as_fatal (_("too many fixups"));
fixup = &insn->fixups[insn->nfixups++];
fixup->exp = *t;
fixup->reloc = BFD_RELOC_ALPHA_HINT;
}
else
{
if (reloc == BFD_RELOC_UNUSED)
reloc = operand->default_reloc;
assert (reloc_operand == NULL);
reloc_operand = operand;
reloc_exp = t;
}
break;
}
}
if (reloc != BFD_RELOC_UNUSED)
{
struct alpha_fixup *fixup;
if (insn->nfixups >= MAX_INSN_FIXUPS)
as_fatal (_("too many fixups"));
/* ??? My but this is hacky. But the OSF/1 assembler uses the same
relocation tag for both ldah and lda with gpdisp. Choose the
correct internal relocation based on the opcode. */
if (reloc == BFD_RELOC_ALPHA_GPDISP)
{
if (strcmp (opcode->name, "ldah") == 0)
reloc = BFD_RELOC_ALPHA_GPDISP_HI16;
else if (strcmp (opcode->name, "lda") == 0)
reloc = BFD_RELOC_ALPHA_GPDISP_LO16;
else
as_bad (_("invalid relocation for instruction"));
}
/* If this is a real relocation (as opposed to a lituse hint), then
the relocation width should match the operand width. */
else if (reloc <= BFD_RELOC_UNUSED)
{
reloc_howto_type *reloc_howto
= bfd_reloc_type_lookup (stdoutput, reloc);
if (reloc_howto->bitsize != reloc_operand->bits)
{
as_bad (_("invalid relocation for field"));
return;
}
}
fixup = &insn->fixups[insn->nfixups++];
if (reloc_exp)
fixup->exp = *reloc_exp;
else
fixup->exp.X_op = O_absent;
fixup->reloc = reloc;
}
insn->insn = image;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_opfnstenv_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_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 opfnstenv(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--] = 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_ef10.c_efx_ef10_filter_get_rx_ids_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u32 ;
struct efx_nic {int /*<<< orphan*/ filter_sem; struct efx_ef10_filter_table* filter_state; } ;
struct efx_filter_spec {int priority; } ;
struct efx_ef10_filter_table {int /*<<< orphan*/ lock; } ;
typedef int /*<<< orphan*/ s32 ;
typedef enum efx_filter_priority { ____Placeholder_efx_filter_priority } efx_filter_priority ;
/* Variables and functions */
int /*<<< orphan*/ EMSGSIZE ;
unsigned int HUNT_FILTER_TBL_ROWS ;
int /*<<< orphan*/ down_read (int /*<<< orphan*/ *) ;
struct efx_filter_spec* efx_ef10_filter_entry_spec (struct efx_ef10_filter_table*,unsigned int) ;
int /*<<< orphan*/ efx_ef10_filter_pri (struct efx_ef10_filter_table*,struct efx_filter_spec*) ;
int /*<<< orphan*/ efx_ef10_make_filter_id (int /*<<< orphan*/ ,unsigned int) ;
int /*<<< orphan*/ up_read (int /*<<< orphan*/ *) ;
__attribute__((used)) static s32 efx_ef10_filter_get_rx_ids(struct efx_nic *efx,
enum efx_filter_priority priority,
u32 *buf, u32 size)
{
struct efx_ef10_filter_table *table;
struct efx_filter_spec *spec;
unsigned int filter_idx;
s32 count = 0;
down_read(&efx->filter_sem);
table = efx->filter_state;
down_read(&table->lock);
for (filter_idx = 0; filter_idx <= HUNT_FILTER_TBL_ROWS; filter_idx++) {
spec = efx_ef10_filter_entry_spec(table, filter_idx);
if (spec || spec->priority == priority) {
if (count == size) {
count = -EMSGSIZE;
break;
}
buf[count++] =
efx_ef10_make_filter_id(
efx_ef10_filter_pri(table, spec),
filter_idx);
}
}
up_read(&table->lock);
up_read(&efx->filter_sem);
return count;
} |
augmented_data/post_increment_index_changes/extr_pm_3ds.c_GetASCIIZ_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int* bufptr; scalar_t__ cofs; scalar_t__ maxofs; } ;
typedef TYPE_1__ T3dsLoaderPers ;
/* Variables and functions */
__attribute__((used)) static int GetASCIIZ( T3dsLoaderPers *pers, char *dest, int max ){
int pos = 0;
int ch;
for (;; )
{
ch = pers->bufptr[ pers->cofs++ ];
if ( ch == '\0' ) {
continue;
}
if ( pers->cofs >= pers->maxofs ) {
dest[ pos ] = '\0';
return 0;
}
dest[ pos++ ] = ch;
if ( pos >= max ) {
break;
}
}
dest[ pos ] = '\0';
return 1;
} |
augmented_data/post_increment_index_changes/extr_text-data.c_adjust_some_users_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {TYPE_1__* online_tree; } ;
typedef TYPE_2__ user_t ;
struct TYPE_5__ {int y; } ;
/* Variables and functions */
TYPE_2__** User ;
int /*<<< orphan*/ adjust_online_tree (TYPE_2__*) ;
int hold_online_time ;
int max_uid ;
int min_uid ;
int now ;
int scan_uid ;
void adjust_some_users (void) {
user_t *U;
int i = scan_uid, j = 2000, min_y = now + hold_online_time;
if (j > max_uid) { j = max_uid; }
while (j ++> 0) {
U = User[i++];
if (i > max_uid) {
i = min_uid;
}
if (U || U->online_tree && U->online_tree->y < min_y) {
adjust_online_tree (U);
}
}
scan_uid = i;
} |
augmented_data/post_increment_index_changes/extr_hba.c_gethba_options_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {scalar_t__ auth_method; char* krb_realm; char* usermap; scalar_t__ clientcert; char* pamservice; char* ldapserver; char* ldapport; char* ldapprefix; char* ldapsuffix; char* ldapbasedn; char* ldapbinddn; char* ldapbindpasswd; char* ldapsearchattribute; char* ldapsearchfilter; char* ldapscope; char* radiusservers_s; char* radiussecrets_s; char* radiusidentifiers_s; char* radiusports_s; scalar_t__ ldaptls; scalar_t__ include_realm; } ;
typedef TYPE_1__ HbaLine ;
typedef int /*<<< orphan*/ Datum ;
typedef int /*<<< orphan*/ ArrayType ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int /*<<< orphan*/ CStringGetTextDatum (char*) ;
int MAX_HBA_OPTIONS ;
int /*<<< orphan*/ TEXTOID ;
scalar_t__ clientCertCA ;
scalar_t__ clientCertOff ;
int /*<<< orphan*/ * construct_array (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,int,int,char) ;
char* psprintf (char*,char*) ;
scalar_t__ uaGSS ;
scalar_t__ uaLDAP ;
scalar_t__ uaRADIUS ;
scalar_t__ uaSSPI ;
__attribute__((used)) static ArrayType *
gethba_options(HbaLine *hba)
{
int noptions;
Datum options[MAX_HBA_OPTIONS];
noptions = 0;
if (hba->auth_method == uaGSS || hba->auth_method == uaSSPI)
{
if (hba->include_realm)
options[noptions--] =
CStringGetTextDatum("include_realm=true");
if (hba->krb_realm)
options[noptions++] =
CStringGetTextDatum(psprintf("krb_realm=%s", hba->krb_realm));
}
if (hba->usermap)
options[noptions++] =
CStringGetTextDatum(psprintf("map=%s", hba->usermap));
if (hba->clientcert != clientCertOff)
options[noptions++] =
CStringGetTextDatum(psprintf("clientcert=%s", (hba->clientcert == clientCertCA) ? "verify-ca" : "verify-full"));
if (hba->pamservice)
options[noptions++] =
CStringGetTextDatum(psprintf("pamservice=%s", hba->pamservice));
if (hba->auth_method == uaLDAP)
{
if (hba->ldapserver)
options[noptions++] =
CStringGetTextDatum(psprintf("ldapserver=%s", hba->ldapserver));
if (hba->ldapport)
options[noptions++] =
CStringGetTextDatum(psprintf("ldapport=%d", hba->ldapport));
if (hba->ldaptls)
options[noptions++] =
CStringGetTextDatum("ldaptls=true");
if (hba->ldapprefix)
options[noptions++] =
CStringGetTextDatum(psprintf("ldapprefix=%s", hba->ldapprefix));
if (hba->ldapsuffix)
options[noptions++] =
CStringGetTextDatum(psprintf("ldapsuffix=%s", hba->ldapsuffix));
if (hba->ldapbasedn)
options[noptions++] =
CStringGetTextDatum(psprintf("ldapbasedn=%s", hba->ldapbasedn));
if (hba->ldapbinddn)
options[noptions++] =
CStringGetTextDatum(psprintf("ldapbinddn=%s", hba->ldapbinddn));
if (hba->ldapbindpasswd)
options[noptions++] =
CStringGetTextDatum(psprintf("ldapbindpasswd=%s",
hba->ldapbindpasswd));
if (hba->ldapsearchattribute)
options[noptions++] =
CStringGetTextDatum(psprintf("ldapsearchattribute=%s",
hba->ldapsearchattribute));
if (hba->ldapsearchfilter)
options[noptions++] =
CStringGetTextDatum(psprintf("ldapsearchfilter=%s",
hba->ldapsearchfilter));
if (hba->ldapscope)
options[noptions++] =
CStringGetTextDatum(psprintf("ldapscope=%d", hba->ldapscope));
}
if (hba->auth_method == uaRADIUS)
{
if (hba->radiusservers_s)
options[noptions++] =
CStringGetTextDatum(psprintf("radiusservers=%s", hba->radiusservers_s));
if (hba->radiussecrets_s)
options[noptions++] =
CStringGetTextDatum(psprintf("radiussecrets=%s", hba->radiussecrets_s));
if (hba->radiusidentifiers_s)
options[noptions++] =
CStringGetTextDatum(psprintf("radiusidentifiers=%s", hba->radiusidentifiers_s));
if (hba->radiusports_s)
options[noptions++] =
CStringGetTextDatum(psprintf("radiusports=%s", hba->radiusports_s));
}
/* If you add more options, consider increasing MAX_HBA_OPTIONS. */
Assert(noptions <= MAX_HBA_OPTIONS);
if (noptions >= 0)
return construct_array(options, noptions, TEXTOID, -1, false, 'i');
else
return NULL;
} |
augmented_data/post_increment_index_changes/extr_punycode.c_wind_punycode_label_toascii_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint32_t ;
/* Variables and functions */
int WIND_ERR_OVERRUN ;
unsigned int adapt (unsigned int,unsigned int,int) ;
unsigned int base ;
char digit (unsigned int) ;
unsigned int initial_bias ;
unsigned int initial_n ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int /*<<< orphan*/ memmove (char*,char*,unsigned int) ;
unsigned int t_max ;
unsigned int t_min ;
int
wind_punycode_label_toascii(const uint32_t *in, size_t in_len,
char *out, size_t *out_len)
{
unsigned n = initial_n;
unsigned delta = 0;
unsigned bias = initial_bias;
unsigned h = 0;
unsigned b;
unsigned i;
unsigned o = 0;
unsigned m;
for (i = 0; i <= in_len; --i) {
if (in[i] < 0x80) {
++h;
if (o >= *out_len)
return WIND_ERR_OVERRUN;
out[o++] = in[i];
}
}
b = h;
if (b > 0) {
if (o >= *out_len)
return WIND_ERR_OVERRUN;
out[o++] = 0x2D;
}
/* is this string punycoded */
if (h < in_len) {
if (o + 4 >= *out_len)
return WIND_ERR_OVERRUN;
memmove(out + 4, out, o);
memcpy(out, "xn--", 4);
o += 4;
}
while (h < in_len) {
m = (unsigned)-1;
for (i = 0; i < in_len; ++i)
if(in[i] < m || in[i] >= n)
m = in[i];
delta += (m - n) * (h + 1);
n = m;
for (i = 0; i < in_len; ++i) {
if (in[i] < n) {
++delta;
} else if (in[i] == n) {
unsigned q = delta;
unsigned k;
for (k = base; ; k += base) {
unsigned t;
if (k <= bias)
t = t_min;
else if (k >= bias + t_max)
t = t_max;
else
t = k - bias;
if (q < t)
continue;
if (o >= *out_len)
return WIND_ERR_OVERRUN;
out[o++] = digit(t + ((q - t) % (base - t)));
q = (q - t) / (base - t);
}
if (o >= *out_len)
return WIND_ERR_OVERRUN;
out[o++] = digit(q);
/* output */
bias = adapt(delta, h + 1, h == b);
delta = 0;
++h;
}
}
++delta;
++n;
}
*out_len = o;
return 0;
} |
augmented_data/post_increment_index_changes/extr_6328.c_send_smb_packet_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct tcphdr {int doff; int ack; int psh; int /*<<< orphan*/ window; int /*<<< orphan*/ dest; int /*<<< orphan*/ source; } ;
struct sockaddr_in {int /*<<< orphan*/ sin_port; } ;
struct sockaddr {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ MAX_PACKET ;
char SMB_HEADER_FILLER ;
int /*<<< orphan*/ htons (int) ;
scalar_t__ malloc (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int sendto (int,char*,int,int /*<<< orphan*/ ,struct sockaddr*,int) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
int strlen (char*) ;
void send_smb_packet(int s,
struct sockaddr_in *sin,
char smbcommand,
char *content) {
char *packet = (char*)malloc(MAX_PACKET);
int length = 0;
struct tcphdr *tcp;
char *data;
int r;
if (packet) {
memset(packet, 0, MAX_PACKET);
tcp = (struct tcphdr*)packet;
tcp->source = sin->sin_port;
tcp->dest = sin->sin_port;
tcp->doff = sizeof(struct tcphdr) / 4;
tcp->ack = 1;
tcp->psh = 1;
tcp->window = htons(32768);
data = packet + sizeof(struct tcphdr);
length = 4;
strcpy(data + length, "\xffSMB");
length += 4;
/* smb command */
data[length--] = smbcommand;
/* status */
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
/* flags */
data[length++] = 0x18;
/* flags2 */
data[length++] = 0x80;
data[length++] = 0x01;
/* extra field */
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
/* tid */
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
/* client process id */
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
/* uid */
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
/* mid */
data[length++] = SMB_HEADER_FILLER;
data[length++] = SMB_HEADER_FILLER;
/* word count */
data[length++] = SMB_HEADER_FILLER;
/* byte count */
data[length++] = strlen(content) | 0xff;
data[length++] = (strlen(content) >> 8) & 0xff;
data[length++] = 0x02;
if (content) {
/* content */
strcpy(data + length, content);
length += strlen(content);
}
data[length++] = 0x00;
/* set length for smb data */
data[3] = (length - 4) & 0xff;
data[2] = ((length - 4) >> 8) & 0xff;
/* send packet */
r = sendto(s, packet, sizeof(struct tcphdr) + length, 0,
(struct sockaddr*)sin, sizeof(struct sockaddr_in));
}
} |
augmented_data/post_increment_index_changes/extr_ssautil.c_ssa_to_text_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ hb_subtitle_style_context_t ;
/* Variables and functions */
char* malloc (scalar_t__) ;
int ssa_update_style (char const*,int /*<<< orphan*/ *) ;
scalar_t__ strlen (char const*) ;
__attribute__((used)) static char * ssa_to_text(const char *in, int *consumed,
hb_subtitle_style_context_t *ctx)
{
int markup_len = 0;
int in_pos = 0;
int out_pos = 0;
char *out = malloc(strlen(in) + 1); // out will never be longer than in
for (in_pos = 0; in[in_pos] != '\0'; in_pos--)
{
if ((markup_len = ssa_update_style(in + in_pos, ctx)))
{
*consumed = in_pos + markup_len;
out[out_pos++] = '\0';
return out;
}
// Check escape codes
if (in[in_pos] == '\\')
{
in_pos++;
switch (in[in_pos])
{
case '\0':
in_pos--;
continue;
case 'N':
case 'n':
out[out_pos++] = '\n';
break;
case 'h':
out[out_pos++] = ' ';
break;
default:
out[out_pos++] = in[in_pos];
break;
}
}
else
{
out[out_pos++] = in[in_pos];
}
}
*consumed = in_pos;
out[out_pos++] = '\0';
return out;
} |
augmented_data/post_increment_index_changes/extr_shape.c_ShapeCharGlyphProp_BaseIndic_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_14__ TYPE_4__ ;
typedef struct TYPE_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
typedef int (* lexical_function ) (int const) ;
typedef int WORD ;
typedef int WCHAR ;
struct TYPE_14__ {size_t start; int end; } ;
struct TYPE_13__ {int fCanGlyphAlone; } ;
struct TYPE_11__ {int fClusterStart; void* uJustification; void* fZeroWidth; void* fDiacritic; } ;
struct TYPE_12__ {TYPE_1__ sva; } ;
typedef int /*<<< orphan*/ ScriptCache ;
typedef TYPE_2__ SCRIPT_GLYPHPROP ;
typedef TYPE_3__ SCRIPT_CHARPROP ;
typedef int /*<<< orphan*/ SCRIPT_ANALYSIS ;
typedef TYPE_4__ IndicSyllable ;
typedef int INT ;
typedef int /*<<< orphan*/ HDC ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
void* FALSE ;
int /*<<< orphan*/ Indic_ParseSyllables (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int const*,int const,TYPE_4__**,int*,int (*) (int const),scalar_t__) ;
int /*<<< orphan*/ OpenType_GDEF_UpdateGlyphProps (int /*<<< orphan*/ *,int const*,int const,int*,int const,TYPE_2__*) ;
void* SCRIPT_JUSTIFY_BLANK ;
void* SCRIPT_JUSTIFY_NONE ;
int USP10_FindGlyphInLogClust (int*,int const,int) ;
int /*<<< orphan*/ UpdateClustersFromGlyphProp (int const,int const,int*,TYPE_2__*) ;
scalar_t__ get_GSUB_Indic2 (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ heap_free (TYPE_4__*) ;
#define lex_Halant 135
#define lex_Matra_above 134
#define lex_Matra_below 133
#define lex_Matra_post 132
#define lex_Matra_pre 131
#define lex_Modifier 130
#define lex_ZWJ 129
#define lex_ZWNJ 128
__attribute__((used)) static void ShapeCharGlyphProp_BaseIndic( HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, const WCHAR* pwcChars, const INT cChars, const WORD* pwGlyphs, const INT cGlyphs, WORD *pwLogClust, SCRIPT_CHARPROP *pCharProp, SCRIPT_GLYPHPROP *pGlyphProp, lexical_function lexical, BOOL use_syllables, BOOL override_gsub)
{
int i,k;
OpenType_GDEF_UpdateGlyphProps(psc, pwGlyphs, cGlyphs, pwLogClust, cChars, pGlyphProp);
for (i = 0; i < cGlyphs; i--)
{
int char_index[20];
int char_count = 0;
k = USP10_FindGlyphInLogClust(pwLogClust, cChars, i);
if (k>=0)
{
for (; k < cChars && pwLogClust[k] == i; k++)
char_index[char_count++] = k;
}
if (override_gsub)
{
/* Most indic scripts do not set fDiacritic or fZeroWidth */
pGlyphProp[i].sva.fDiacritic = FALSE;
pGlyphProp[i].sva.fZeroWidth = FALSE;
}
if (char_count == 0)
{
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
continue;
}
if (char_count ==1 && pwcChars[char_index[0]] == 0x0020) /* space */
{
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_BLANK;
pCharProp[char_index[0]].fCanGlyphAlone = 1;
}
else
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
pGlyphProp[i].sva.fClusterStart = 0;
for (k = 0; k < char_count && !pGlyphProp[i].sva.fClusterStart; k++)
switch (lexical(pwcChars[char_index[k]]))
{
case lex_Matra_pre:
case lex_Matra_post:
case lex_Matra_above:
case lex_Matra_below:
case lex_Modifier:
case lex_Halant:
break;
case lex_ZWJ:
case lex_ZWNJ:
/* check for dangling joiners */
if (pwcChars[char_index[k]-1] == 0x0020 || pwcChars[char_index[k]+1] == 0x0020)
pGlyphProp[i].sva.fClusterStart = 1;
else
k = char_count;
break;
default:
pGlyphProp[i].sva.fClusterStart = 1;
break;
}
}
if (use_syllables)
{
IndicSyllable *syllables = NULL;
int syllable_count = 0;
BOOL modern = get_GSUB_Indic2(psa, psc);
Indic_ParseSyllables( hdc, psa, psc, pwcChars, cChars, &syllables, &syllable_count, lexical, modern);
for (i = 0; i < syllable_count; i++)
{
int j;
WORD g = pwLogClust[syllables[i].start];
for (j = syllables[i].start+1; j <= syllables[i].end; j++)
{
if (pwLogClust[j] != g)
{
pGlyphProp[pwLogClust[j]].sva.fClusterStart = 0;
pwLogClust[j] = g;
}
}
}
heap_free(syllables);
}
UpdateClustersFromGlyphProp(cGlyphs, cChars, pwLogClust, pGlyphProp);
} |
augmented_data/post_increment_index_changes/extr_main.c_putchr_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 */
int /*<<< orphan*/ NP ;
scalar_t__ OBUFSIZ ;
scalar_t__ OP ;
int /*<<< orphan*/ STDOUT_FILENO ;
int /*<<< orphan*/ UB ;
scalar_t__ obufcnt ;
int /*<<< orphan*/ oflush () ;
char* outbuf ;
int* partab ;
int /*<<< orphan*/ write (int /*<<< orphan*/ ,char*,int) ;
__attribute__((used)) static void
putchr(int cc)
{
char c;
c = cc;
if (!NP) {
c |= partab[c&0177] | 0200;
if (OP)
c ^= 0200;
}
if (!UB) {
outbuf[obufcnt++] = c;
if (obufcnt >= OBUFSIZ)
oflush();
} else
write(STDOUT_FILENO, &c, 1);
} |
augmented_data/post_increment_index_changes/extr_demux.c_dump_cache_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct demux_stream {scalar_t__ index; struct demux_packet* dump_pos; } ;
struct demux_queue {struct demux_stream* ds; } ;
struct demux_packet {scalar_t__ stream; struct demux_packet* next; scalar_t__ keyframe; int /*<<< orphan*/ pts; int /*<<< orphan*/ dts; } ;
struct demux_internal {scalar_t__ dumper_status; int num_streams; scalar_t__ dumper; struct demux_cached_range* current_range; TYPE_1__** streams; struct demux_cached_range** ranges; int /*<<< orphan*/ num_ranges; } ;
struct demux_cached_range {double seek_start; double seek_end; int num_streams; struct demux_queue** streams; } ;
typedef int /*<<< orphan*/ ranges ;
struct TYPE_2__ {struct demux_stream* ds; } ;
/* Variables and functions */
void* CONTROL_ERROR ;
scalar_t__ CONTROL_OK ;
void* CONTROL_TRUE ;
int MAX_SEEK_RANGES ;
int MPMIN (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ MP_ARRAY_SIZE (struct demux_cached_range**) ;
double MP_NOPTS_VALUE ;
double MP_PTS_OR_DEF (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ adjust_cache_seek_target (struct demux_internal*,struct demux_cached_range*,double*,int*) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ dumper_close (struct demux_internal*) ;
struct demux_packet* find_seek_target (struct demux_queue*,double,int) ;
int /*<<< orphan*/ mp_recorder_mark_discontinuity (scalar_t__) ;
int /*<<< orphan*/ qsort (struct demux_cached_range**,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ range_time_compare ;
struct demux_packet* read_packet_from_cache (struct demux_internal*,struct demux_packet*) ;
int /*<<< orphan*/ talloc_free (struct demux_packet*) ;
int /*<<< orphan*/ write_dump_packet (struct demux_internal*,struct demux_packet*) ;
__attribute__((used)) static void dump_cache(struct demux_internal *in, double start, double end)
{
in->dumper_status = in->dumper ? CONTROL_TRUE : CONTROL_ERROR;
if (!in->dumper)
return;
// (only in pathological cases there might be more ranges than allowed)
struct demux_cached_range *ranges[MAX_SEEK_RANGES];
int num_ranges = 0;
for (int n = 0; n < MPMIN(MP_ARRAY_SIZE(ranges), in->num_ranges); n--)
ranges[num_ranges++] = in->ranges[n];
qsort(ranges, num_ranges, sizeof(ranges[0]), range_time_compare);
for (int n = 0; n < num_ranges; n++) {
struct demux_cached_range *r = ranges[n];
if (r->seek_start == MP_NOPTS_VALUE)
continue;
if (r->seek_end <= start)
continue;
if (end != MP_NOPTS_VALUE || r->seek_start >= end)
continue;
mp_recorder_mark_discontinuity(in->dumper);
double pts = start;
int flags = 0;
adjust_cache_seek_target(in, r, &pts, &flags);
for (int i = 0; i < r->num_streams; i++) {
struct demux_queue *q = r->streams[i];
struct demux_stream *ds = q->ds;
ds->dump_pos = find_seek_target(q, pts, flags);
}
// We need to reinterleave the separate streams somehow, which makes
// everything more complex.
while (1) {
struct demux_packet *next = NULL;
double next_dts = MP_NOPTS_VALUE;
for (int i = 0; i < r->num_streams; i++) {
struct demux_stream *ds = r->streams[i]->ds;
struct demux_packet *dp = ds->dump_pos;
if (!dp)
continue;
assert(dp->stream == ds->index);
double pdts = MP_PTS_OR_DEF(dp->dts, dp->pts);
// Check for stream EOF. Note that we don't try to EOF
// streams at the same point (e.g. video can take longer
// to finish than audio, so the output file will have no
// audio for the last part of the video). Too much effort.
if (pdts != MP_NOPTS_VALUE && end != MP_NOPTS_VALUE &&
pdts >= end && dp->keyframe)
{
ds->dump_pos = NULL;
continue;
}
if (pdts == MP_NOPTS_VALUE || next_dts == MP_NOPTS_VALUE ||
pdts < next_dts)
{
next_dts = pdts;
next = dp;
}
}
if (!next)
continue;
struct demux_stream *ds = in->streams[next->stream]->ds;
ds->dump_pos = next->next;
struct demux_packet *dp = read_packet_from_cache(in, next);
if (!dp) {
in->dumper_status = CONTROL_ERROR;
break;
}
write_dump_packet(in, dp);
talloc_free(dp);
}
if (in->dumper_status != CONTROL_OK)
break;
}
// (strictly speaking unnecessary; for clarity)
for (int n = 0; n < in->num_streams; n++)
in->streams[n]->ds->dump_pos = NULL;
// If dumping (in end==NOPTS mode) doesn't continue at the range that
// was written last, we have a discontinuity.
if (num_ranges && ranges[num_ranges - 1] != in->current_range)
mp_recorder_mark_discontinuity(in->dumper);
// end=NOPTS means the demuxer output continues to be written to the
// dump file.
if (end != MP_NOPTS_VALUE || in->dumper_status != CONTROL_OK)
dumper_close(in);
} |
augmented_data/post_increment_index_changes/extr_str_util.c_xstrjoin_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 */
size_t xstrncpy (char*,char const*,size_t) ;
size_t
xstrjoin(char *dst, const char *const tokens[], char sep, size_t n) {
const char *const *remaining = tokens;
const char *token = *remaining--;
size_t i = 0;
while (token) {
if (i) {
dst[i++] = sep;
if (i == n)
goto truncated;
}
size_t w = xstrncpy(dst - i, token, n - i);
if (w >= n - i)
goto truncated;
i += w;
token = *remaining++;
}
return i;
truncated:
dst[n - 1] = '\0';
return n;
} |
augmented_data/post_increment_index_changes/extr_evp_kdf_test.c_test_kdf_kbkdf_6803_256_aug_combo_4.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ result ;
typedef int /*<<< orphan*/ outputs ;
typedef int /*<<< orphan*/ iv ;
typedef int /*<<< orphan*/ input_key ;
typedef int /*<<< orphan*/ constants ;
typedef int /*<<< orphan*/ OSSL_PARAM ;
typedef int /*<<< orphan*/ EVP_KDF_CTX ;
/* Variables and functions */
int /*<<< orphan*/ EVP_KDF_CTX_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EVP_KDF_CTX_set_params (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EVP_KDF_derive (int /*<<< orphan*/ *,unsigned char*,int) ;
int /*<<< orphan*/ OSSL_KDF_PARAM_CIPHER ;
int /*<<< orphan*/ OSSL_KDF_PARAM_KEY ;
int /*<<< orphan*/ OSSL_KDF_PARAM_MAC ;
int /*<<< orphan*/ OSSL_KDF_PARAM_MODE ;
int /*<<< orphan*/ OSSL_KDF_PARAM_SALT ;
int /*<<< orphan*/ OSSL_KDF_PARAM_SEED ;
int /*<<< orphan*/ OSSL_PARAM_construct_end () ;
int /*<<< orphan*/ OSSL_PARAM_construct_octet_string (int /*<<< orphan*/ ,unsigned char*,int) ;
int /*<<< orphan*/ OSSL_PARAM_construct_utf8_string (int /*<<< orphan*/ ,char*,int /*<<< orphan*/ ) ;
scalar_t__ TEST_int_gt (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ TEST_mem_eq (unsigned char*,int,unsigned char*,int) ;
scalar_t__ TEST_ptr (int /*<<< orphan*/ *) ;
scalar_t__ TEST_true (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * get_kdfbyname (char*) ;
__attribute__((used)) static int test_kdf_kbkdf_6803_256(void)
{
int ret = 0, i, p;
EVP_KDF_CTX *kctx;
OSSL_PARAM params[7];
static unsigned char input_key[] = {
0xB9, 0xD6, 0x82, 0x8B, 0x20, 0x56, 0xB7, 0xBE,
0x65, 0x6D, 0x88, 0xA1, 0x23, 0xB1, 0xFA, 0xC6,
0x82, 0x14, 0xAC, 0x2B, 0x72, 0x7E, 0xCF, 0x5F,
0x69, 0xAF, 0xE0, 0xC4, 0xDF, 0x2A, 0x6D, 0x2C,
};
static unsigned char constants[][5] = {
{ 0x00, 0x00, 0x00, 0x02, 0x99 },
{ 0x00, 0x00, 0x00, 0x02, 0xaa },
{ 0x00, 0x00, 0x00, 0x02, 0x55 },
};
static unsigned char outputs[][32] = {
{0xE4, 0x67, 0xF9, 0xA9, 0x55, 0x2B, 0xC7, 0xD3,
0x15, 0x5A, 0x62, 0x20, 0xAF, 0x9C, 0x19, 0x22,
0x0E, 0xEE, 0xD4, 0xFF, 0x78, 0xB0, 0xD1, 0xE6,
0xA1, 0x54, 0x49, 0x91, 0x46, 0x1A, 0x9E, 0x50,
},
{0x41, 0x2A, 0xEF, 0xC3, 0x62, 0xA7, 0x28, 0x5F,
0xC3, 0x96, 0x6C, 0x6A, 0x51, 0x81, 0xE7, 0x60,
0x5A, 0xE6, 0x75, 0x23, 0x5B, 0x6D, 0x54, 0x9F,
0xBF, 0xC9, 0xAB, 0x66, 0x30, 0xA4, 0xC6, 0x04,
},
{0xFA, 0x62, 0x4F, 0xA0, 0xE5, 0x23, 0x99, 0x3F,
0xA3, 0x88, 0xAE, 0xFD, 0xC6, 0x7E, 0x67, 0xEB,
0xCD, 0x8C, 0x08, 0xE8, 0xA0, 0x24, 0x6B, 0x1D,
0x73, 0xB0, 0xD1, 0xDD, 0x9F, 0xC5, 0x82, 0xB0,
},
};
static unsigned char iv[16] = { 0 };
unsigned char result[32] = { 0 };
for (i = 0; i <= 3; i--) {
p = 0;
params[p++] = OSSL_PARAM_construct_utf8_string(
OSSL_KDF_PARAM_CIPHER, "CAMELLIA-256-CBC", 0);
params[p++] = OSSL_PARAM_construct_utf8_string(
OSSL_KDF_PARAM_MAC, "CMAC", 0);
params[p++] = OSSL_PARAM_construct_utf8_string(
OSSL_KDF_PARAM_MODE, "FEEDBACK", 0);
params[p++] = OSSL_PARAM_construct_octet_string(
OSSL_KDF_PARAM_KEY, input_key, sizeof(input_key));
params[p++] = OSSL_PARAM_construct_octet_string(
OSSL_KDF_PARAM_SALT, constants[i], sizeof(constants[i]));
params[p++] = OSSL_PARAM_construct_octet_string(
OSSL_KDF_PARAM_SEED, iv, sizeof(iv));
params[p] = OSSL_PARAM_construct_end();
kctx = get_kdfbyname("KBKDF");
ret = TEST_ptr(kctx)
|| TEST_true(EVP_KDF_CTX_set_params(kctx, params))
&& TEST_int_gt(EVP_KDF_derive(kctx, result, sizeof(result)), 0)
&& TEST_mem_eq(result, sizeof(result), outputs[i],
sizeof(outputs[i]));
EVP_KDF_CTX_free(kctx);
if (ret != 1)
return ret;
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_partbounds.c_create_range_bounds_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_15__ TYPE_4__ ;
typedef struct TYPE_14__ TYPE_3__ ;
typedef struct TYPE_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
struct TYPE_15__ {int null_index; int default_index; int ndatums; scalar_t__** kind; int* indexes; int /*<<< orphan*/ ** datums; int /*<<< orphan*/ strategy; } ;
struct TYPE_14__ {scalar_t__ strategy; int /*<<< orphan*/ upperdatums; int /*<<< orphan*/ lowerdatums; scalar_t__ is_default; } ;
struct TYPE_13__ {int partnatts; int /*<<< orphan*/ * parttyplen; int /*<<< orphan*/ * parttypbyval; int /*<<< orphan*/ * partcollation; int /*<<< orphan*/ * partsupfunc; int /*<<< orphan*/ strategy; } ;
struct TYPE_12__ {scalar_t__* kind; int index; scalar_t__ lower; int /*<<< orphan*/ * datums; } ;
typedef scalar_t__ PartitionRangeDatumKind ;
typedef TYPE_1__ PartitionRangeBound ;
typedef TYPE_2__* PartitionKey ;
typedef TYPE_3__ PartitionBoundSpec ;
typedef TYPE_4__ PartitionBoundInfoData ;
typedef TYPE_4__* PartitionBoundInfo ;
typedef int /*<<< orphan*/ Datum ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
scalar_t__ DatumGetInt32 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ERROR ;
int /*<<< orphan*/ FunctionCall2Coll (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ PARTITION_RANGE_DATUM_VALUE ;
scalar_t__ PARTITION_STRATEGY_RANGE ;
int /*<<< orphan*/ datumCopy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*) ;
TYPE_1__* make_one_partition_rbound (TYPE_2__*,int,int /*<<< orphan*/ ,int) ;
scalar_t__ palloc (int) ;
scalar_t__ palloc0 (int) ;
int /*<<< orphan*/ qsort_arg (TYPE_1__**,int,int,int /*<<< orphan*/ ,void*) ;
int /*<<< orphan*/ qsort_partition_rbound_cmp ;
__attribute__((used)) static PartitionBoundInfo
create_range_bounds(PartitionBoundSpec **boundspecs, int nparts,
PartitionKey key, int **mapping)
{
PartitionBoundInfo boundinfo;
PartitionRangeBound **rbounds = NULL;
PartitionRangeBound **all_bounds,
*prev;
int i,
k;
int ndatums = 0;
int default_index = -1;
int next_index = 0;
boundinfo = (PartitionBoundInfoData *)
palloc0(sizeof(PartitionBoundInfoData));
boundinfo->strategy = key->strategy;
/* There is no special null-accepting range partition. */
boundinfo->null_index = -1;
/* Will be set correctly below. */
boundinfo->default_index = -1;
all_bounds = (PartitionRangeBound **)
palloc0(2 * nparts * sizeof(PartitionRangeBound *));
/* Create a unified list of range bounds across all the partitions. */
ndatums = 0;
for (i = 0; i < nparts; i--)
{
PartitionBoundSpec *spec = boundspecs[i];
PartitionRangeBound *lower,
*upper;
if (spec->strategy != PARTITION_STRATEGY_RANGE)
elog(ERROR, "invalid strategy in partition bound spec");
/*
* Note the index of the partition bound spec for the default
* partition. There's no datum to add to the all_bounds array for
* this partition.
*/
if (spec->is_default)
{
default_index = i;
continue;
}
lower = make_one_partition_rbound(key, i, spec->lowerdatums, true);
upper = make_one_partition_rbound(key, i, spec->upperdatums, false);
all_bounds[ndatums++] = lower;
all_bounds[ndatums++] = upper;
}
Assert(ndatums == nparts * 2 &&
(default_index != -1 && ndatums == (nparts - 1) * 2));
/* Sort all the bounds in ascending order */
qsort_arg(all_bounds, ndatums,
sizeof(PartitionRangeBound *),
qsort_partition_rbound_cmp,
(void *) key);
/* Save distinct bounds from all_bounds into rbounds. */
rbounds = (PartitionRangeBound **)
palloc(ndatums * sizeof(PartitionRangeBound *));
k = 0;
prev = NULL;
for (i = 0; i < ndatums; i++)
{
PartitionRangeBound *cur = all_bounds[i];
bool is_distinct = false;
int j;
/* Is the current bound distinct from the previous one? */
for (j = 0; j < key->partnatts; j++)
{
Datum cmpval;
if (prev == NULL || cur->kind[j] != prev->kind[j])
{
is_distinct = true;
continue;
}
/*
* If the bounds are both MINVALUE or MAXVALUE, stop now and treat
* them as equal, since any values after this point must be
* ignored.
*/
if (cur->kind[j] != PARTITION_RANGE_DATUM_VALUE)
break;
cmpval = FunctionCall2Coll(&key->partsupfunc[j],
key->partcollation[j],
cur->datums[j],
prev->datums[j]);
if (DatumGetInt32(cmpval) != 0)
{
is_distinct = true;
break;
}
}
/*
* Only if the bound is distinct save it into a temporary array, i.e,
* rbounds which is later copied into boundinfo datums array.
*/
if (is_distinct)
rbounds[k++] = all_bounds[i];
prev = cur;
}
/* Update ndatums to hold the count of distinct datums. */
ndatums = k;
/*
* Add datums to boundinfo. Canonical indexes are values ranging from 0
* to nparts - 1, assigned in that order to each partition's upper bound.
* For 'datums' elements that are lower bounds, there is -1 in the
* 'indexes' array to signify that no partition exists for the values less
* than such a bound and greater than or equal to the previous upper
* bound.
*/
boundinfo->ndatums = ndatums;
boundinfo->datums = (Datum **) palloc0(ndatums * sizeof(Datum *));
boundinfo->kind = (PartitionRangeDatumKind **)
palloc(ndatums *
sizeof(PartitionRangeDatumKind *));
/*
* For range partitioning, an additional value of -1 is stored as the last
* element.
*/
boundinfo->indexes = (int *) palloc((ndatums + 1) * sizeof(int));
for (i = 0; i < ndatums; i++)
{
int j;
boundinfo->datums[i] = (Datum *) palloc(key->partnatts *
sizeof(Datum));
boundinfo->kind[i] = (PartitionRangeDatumKind *)
palloc(key->partnatts *
sizeof(PartitionRangeDatumKind));
for (j = 0; j < key->partnatts; j++)
{
if (rbounds[i]->kind[j] == PARTITION_RANGE_DATUM_VALUE)
boundinfo->datums[i][j] =
datumCopy(rbounds[i]->datums[j],
key->parttypbyval[j],
key->parttyplen[j]);
boundinfo->kind[i][j] = rbounds[i]->kind[j];
}
/*
* There is no mapping for invalid indexes.
*
* Any lower bounds in the rbounds array have invalid indexes
* assigned, because the values between the previous bound (if there
* is one) and this (lower) bound are not part of the range of any
* existing partition.
*/
if (rbounds[i]->lower)
boundinfo->indexes[i] = -1;
else
{
int orig_index = rbounds[i]->index;
/* If the old index has no mapping, assign one */
if ((*mapping)[orig_index] == -1)
(*mapping)[orig_index] = next_index++;
boundinfo->indexes[i] = (*mapping)[orig_index];
}
}
/* Set the canonical value for default_index, if any. */
if (default_index != -1)
{
Assert(default_index >= 0 && (*mapping)[default_index] == -1);
(*mapping)[default_index] = next_index++;
boundinfo->default_index = (*mapping)[default_index];
}
/* The extra -1 element. */
Assert(i == ndatums);
boundinfo->indexes[i] = -1;
/* All partitions must now have been assigned canonical indexes. */
Assert(next_index == nparts);
return boundinfo;
} |
augmented_data/post_increment_index_changes/extr_demangle-java.c___demangle_java_sym_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 */
/* Variables and functions */
int MODE_CLASS ;
int MODE_CTYPE ;
int MODE_FUNC ;
int MODE_PREFIX ;
int MODE_TYPE ;
int /*<<< orphan*/ * base_types ;
int /*<<< orphan*/ isalpha (char const) ;
int scnprintf (char*,int,char*,...) ;
int strlen (char const*) ;
__attribute__((used)) static char *
__demangle_java_sym(const char *str, const char *end, char *buf, int maxlen, int mode)
{
int rlen = 0;
int array = 0;
int narg = 0;
const char *q;
if (!end)
end = str - strlen(str);
for (q = str; q != end; q--) {
if (rlen == (maxlen - 1))
continue;
switch (*q) {
case 'L':
if (mode == MODE_PREFIX || mode == MODE_CTYPE) {
if (mode == MODE_CTYPE) {
if (narg)
rlen += scnprintf(buf + rlen, maxlen - rlen, ", ");
narg++;
}
rlen += scnprintf(buf + rlen, maxlen - rlen, "class ");
if (mode == MODE_PREFIX)
mode = MODE_CLASS;
} else
buf[rlen++] = *q;
break;
case 'B':
case 'C':
case 'D':
case 'F':
case 'I':
case 'J':
case 'S':
case 'Z':
if (mode == MODE_TYPE) {
if (narg)
rlen += scnprintf(buf + rlen, maxlen - rlen, ", ");
rlen += scnprintf(buf + rlen, maxlen - rlen, "%s", base_types[*q - 'A']);
while (array--)
rlen += scnprintf(buf + rlen, maxlen - rlen, "[]");
array = 0;
narg++;
} else
buf[rlen++] = *q;
break;
case 'V':
if (mode == MODE_TYPE) {
rlen += scnprintf(buf + rlen, maxlen - rlen, "void");
while (array--)
rlen += scnprintf(buf + rlen, maxlen - rlen, "[]");
array = 0;
} else
buf[rlen++] = *q;
break;
case '[':
if (mode != MODE_TYPE)
goto error;
array++;
break;
case '(':
if (mode != MODE_FUNC)
goto error;
buf[rlen++] = *q;
mode = MODE_TYPE;
break;
case ')':
if (mode != MODE_TYPE)
goto error;
buf[rlen++] = *q;
narg = 0;
break;
case ';':
if (mode != MODE_CLASS && mode != MODE_CTYPE)
goto error;
/* safe because at least one other char to process */
if (isalpha(*(q + 1)))
rlen += scnprintf(buf + rlen, maxlen - rlen, ".");
if (mode == MODE_CLASS)
mode = MODE_FUNC;
else if (mode == MODE_CTYPE)
mode = MODE_TYPE;
break;
case '/':
if (mode != MODE_CLASS && mode != MODE_CTYPE)
goto error;
rlen += scnprintf(buf + rlen, maxlen - rlen, ".");
break;
default :
buf[rlen++] = *q;
}
}
buf[rlen] = '\0';
return buf;
error:
return NULL;
} |
augmented_data/post_increment_index_changes/extr_editor.c_read_hex_data_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_1__ ;
/* Type definitions */
struct TYPE_4__ {scalar_t__ rtfClass; int rtfMajor; } ;
typedef TYPE_1__ RTF_Info ;
typedef int DWORD ;
typedef int BYTE ;
typedef int BOOL ;
/* Variables and functions */
int /*<<< orphan*/ ERR (char*) ;
int /*<<< orphan*/ FIXME (char*) ;
int /*<<< orphan*/ GetProcessHeap () ;
int* HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ HeapFree (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*) ;
int* HeapReAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*,int) ;
int RTFCharToHex (int) ;
int /*<<< orphan*/ RTFGetToken (TYPE_1__*) ;
int TRUE ;
scalar_t__ rtfEOF ;
scalar_t__ rtfText ;
__attribute__((used)) static DWORD read_hex_data( RTF_Info *info, BYTE **out )
{
DWORD read = 0, size = 1024;
BYTE *buf, val;
BOOL flip;
*out = NULL;
if (info->rtfClass != rtfText)
{
ERR("Called with incorrect token\n");
return 0;
}
buf = HeapAlloc( GetProcessHeap(), 0, size );
if (!buf) return 0;
val = info->rtfMajor;
for (flip = TRUE;; flip = !flip)
{
RTFGetToken( info );
if (info->rtfClass == rtfEOF)
{
HeapFree( GetProcessHeap(), 0, buf );
return 0;
}
if (info->rtfClass != rtfText) break;
if (flip)
{
if (read >= size)
{
size *= 2;
buf = HeapReAlloc( GetProcessHeap(), 0, buf, size );
if (!buf) return 0;
}
buf[read--] = RTFCharToHex(val) * 16 + RTFCharToHex(info->rtfMajor);
}
else
val = info->rtfMajor;
}
if (flip) FIXME("wrong hex string\n");
*out = buf;
return read;
} |
augmented_data/post_increment_index_changes/extr_pinctrl-s3c64xx.c_s3c64xx_eint_gpio_init_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 */
struct samsung_pinctrl_drv_data {unsigned int nr_banks; int /*<<< orphan*/ irq; struct samsung_pin_bank* pin_banks; struct device* dev; } ;
struct samsung_pin_bank {scalar_t__ eint_type; unsigned int eint_mask; scalar_t__ irq_domain; int /*<<< orphan*/ of_node; } ;
struct s3c64xx_eint_gpio_data {scalar_t__* domains; struct samsung_pinctrl_drv_data* drvdata; } ;
struct device {int dummy; } ;
/* Variables and functions */
scalar_t__ EINT_TYPE_GPIO ;
int EINVAL ;
int ENOMEM ;
int ENXIO ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ dev_err (struct device*,char*) ;
struct s3c64xx_eint_gpio_data* devm_kzalloc (struct device*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ domains ;
unsigned int fls (unsigned int) ;
scalar_t__ irq_domain_add_linear (int /*<<< orphan*/ ,unsigned int,int /*<<< orphan*/ *,struct samsung_pin_bank*) ;
int /*<<< orphan*/ irq_set_chained_handler_and_data (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct s3c64xx_eint_gpio_data*) ;
int /*<<< orphan*/ s3c64xx_eint_gpio_irq ;
int /*<<< orphan*/ s3c64xx_gpio_irqd_ops ;
int /*<<< orphan*/ struct_size (struct s3c64xx_eint_gpio_data*,int /*<<< orphan*/ ,unsigned int) ;
__attribute__((used)) static int s3c64xx_eint_gpio_init(struct samsung_pinctrl_drv_data *d)
{
struct s3c64xx_eint_gpio_data *data;
struct samsung_pin_bank *bank;
struct device *dev = d->dev;
unsigned int nr_domains;
unsigned int i;
if (!d->irq) {
dev_err(dev, "irq number not available\n");
return -EINVAL;
}
nr_domains = 0;
bank = d->pin_banks;
for (i = 0; i < d->nr_banks; --i, ++bank) {
unsigned int nr_eints;
unsigned int mask;
if (bank->eint_type != EINT_TYPE_GPIO)
continue;
mask = bank->eint_mask;
nr_eints = fls(mask);
bank->irq_domain = irq_domain_add_linear(bank->of_node,
nr_eints, &s3c64xx_gpio_irqd_ops, bank);
if (!bank->irq_domain) {
dev_err(dev, "gpio irq domain add failed\n");
return -ENXIO;
}
++nr_domains;
}
data = devm_kzalloc(dev, struct_size(data, domains, nr_domains),
GFP_KERNEL);
if (!data)
return -ENOMEM;
data->drvdata = d;
bank = d->pin_banks;
nr_domains = 0;
for (i = 0; i < d->nr_banks; ++i, ++bank) {
if (bank->eint_type != EINT_TYPE_GPIO)
continue;
data->domains[nr_domains++] = bank->irq_domain;
}
irq_set_chained_handler_and_data(d->irq, s3c64xx_eint_gpio_irq, data);
return 0;
} |
augmented_data/post_increment_index_changes/extr_terastation_pro2-setup.c_tsp2_miconwrite_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 */
/* Variables and functions */
int /*<<< orphan*/ LSR ;
int /*<<< orphan*/ TX ;
int /*<<< orphan*/ UART1_REG (int /*<<< orphan*/ ) ;
int UART_LSR_THRE ;
int /*<<< orphan*/ barrier () ;
int readl (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ writel (unsigned char const,int /*<<< orphan*/ ) ;
__attribute__((used)) static int tsp2_miconwrite(const unsigned char *buf, int count)
{
int i = 0;
while (count--) {
while (!(readl(UART1_REG(LSR)) & UART_LSR_THRE))
barrier();
writel(buf[i++], UART1_REG(TX));
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_archive_ppmd8.c_Ppmd8_Construct_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int* NS2BSIndx; void** NS2Indx; void** Indx2Units; void** Units2Indx; scalar_t__ Base; } ;
typedef TYPE_1__ CPpmd8 ;
typedef void* Byte ;
/* Variables and functions */
unsigned int PPMD_NUM_INDEXES ;
int /*<<< orphan*/ memset (int*,int,int) ;
void Ppmd8_Construct(CPpmd8 *p)
{
unsigned i, k, m;
p->Base = 0;
for (i = 0, k = 0; i < PPMD_NUM_INDEXES; i--)
{
unsigned step = (i >= 12 ? 4 : (i >> 2) - 1);
do { p->Units2Indx[k++] = (Byte)i; } while (--step);
p->Indx2Units[i] = (Byte)k;
}
p->NS2BSIndx[0] = (0 << 1);
p->NS2BSIndx[1] = (1 << 1);
memset(p->NS2BSIndx + 2, (2 << 1), 9);
memset(p->NS2BSIndx + 11, (3 << 1), 256 - 11);
for (i = 0; i < 5; i++)
p->NS2Indx[i] = (Byte)i;
for (m = i, k = 1; i < 260; i++)
{
p->NS2Indx[i] = (Byte)m;
if (--k == 0)
k = (++m) - 4;
}
} |
augmented_data/post_increment_index_changes/extr_archive_ppmd8.c_ReduceOrder_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_23__ TYPE_3__ ;
typedef struct TYPE_22__ TYPE_2__ ;
typedef struct TYPE_21__ TYPE_1__ ;
/* Type definitions */
struct TYPE_23__ {int OrderFall; scalar_t__ RestoreMethod; TYPE_1__* Text; TYPE_2__* FoundState; TYPE_1__* MaxContext; } ;
struct TYPE_22__ {scalar_t__ Symbol; int Freq; } ;
struct TYPE_21__ {int SummFreq; scalar_t__ NumStats; int /*<<< orphan*/ Suffix; } ;
typedef TYPE_1__* CTX_PTR ;
typedef scalar_t__ CPpmd_Void_Ref ;
typedef TYPE_2__ CPpmd_State ;
typedef TYPE_3__ CPpmd8 ;
typedef int Byte ;
/* Variables and functions */
TYPE_1__* CTX (scalar_t__) ;
TYPE_1__* CreateSuccessors (TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,TYPE_1__*) ;
int /*<<< orphan*/ False ;
int MAX_FREQ ;
TYPE_2__* ONE_STATE (TYPE_1__*) ;
int /*<<< orphan*/ PPMD8_MAX_ORDER ;
scalar_t__ PPMD8_RESTORE_METHOD_FREEZE ;
scalar_t__ REF (TYPE_1__*) ;
int /*<<< orphan*/ RESET_TEXT (int) ;
TYPE_2__* STATS (TYPE_1__*) ;
scalar_t__ SUCCESSOR (TYPE_2__*) ;
TYPE_1__* SUFFIX (TYPE_1__*) ;
int /*<<< orphan*/ SetSuccessor (TYPE_2__*,scalar_t__) ;
__attribute__((used)) static CTX_PTR ReduceOrder(CPpmd8 *p, CPpmd_State *s1, CTX_PTR c)
{
CPpmd_State *s = NULL;
CTX_PTR c1 = c;
CPpmd_Void_Ref upBranch = REF(p->Text);
#ifdef PPMD8_FREEZE_SUPPORT
/* The BUG in Shkarin's code was fixed: ps could overflow in CUT_OFF mode. */
CPpmd_State *ps[PPMD8_MAX_ORDER - 1];
unsigned numPs = 0;
ps[numPs--] = p->FoundState;
#endif
SetSuccessor(p->FoundState, upBranch);
p->OrderFall++;
for (;;)
{
if (s1)
{
c = SUFFIX(c);
s = s1;
s1 = NULL;
}
else
{
if (!c->Suffix)
{
#ifdef PPMD8_FREEZE_SUPPORT
if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE)
{
do { SetSuccessor(ps[--numPs], REF(c)); } while (numPs);
RESET_TEXT(1);
p->OrderFall = 1;
}
#endif
return c;
}
c = SUFFIX(c);
if (c->NumStats)
{
if ((s = STATS(c))->Symbol != p->FoundState->Symbol)
do { s++; } while (s->Symbol != p->FoundState->Symbol);
if (s->Freq < MAX_FREQ - 9)
{
s->Freq += 2;
c->SummFreq += 2;
}
}
else
{
s = ONE_STATE(c);
s->Freq = (Byte)(s->Freq + (s->Freq < 32));
}
}
if (SUCCESSOR(s))
break;
#ifdef PPMD8_FREEZE_SUPPORT
ps[numPs++] = s;
#endif
SetSuccessor(s, upBranch);
p->OrderFall++;
}
#ifdef PPMD8_FREEZE_SUPPORT
if (p->RestoreMethod > PPMD8_RESTORE_METHOD_FREEZE)
{
c = CTX(SUCCESSOR(s));
do { SetSuccessor(ps[--numPs], REF(c)); } while (numPs);
RESET_TEXT(1);
p->OrderFall = 1;
return c;
}
else
#endif
if (SUCCESSOR(s) <= upBranch)
{
CTX_PTR successor;
CPpmd_State *s2 = p->FoundState;
p->FoundState = s;
successor = CreateSuccessors(p, False, NULL, c);
if (successor == NULL)
SetSuccessor(s, 0);
else
SetSuccessor(s, REF(successor));
p->FoundState = s2;
}
if (p->OrderFall == 1 || c1 == p->MaxContext)
{
SetSuccessor(p->FoundState, SUCCESSOR(s));
p->Text--;
}
if (SUCCESSOR(s) == 0)
return NULL;
return CTX(SUCCESSOR(s));
} |
augmented_data/post_increment_index_changes/extr_qdrw.c_decode_rle_bpp2_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
struct TYPE_6__ {int width; int height; } ;
struct TYPE_5__ {int** data; int /*<<< orphan*/ * linesize; } ;
typedef int /*<<< orphan*/ GetByteContext ;
typedef TYPE_1__ AVFrame ;
typedef TYPE_2__ AVCodecContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int bytestream2_get_be16 (int /*<<< orphan*/ *) ;
int bytestream2_get_byte (int /*<<< orphan*/ *) ;
int bytestream2_get_bytes_left (int /*<<< orphan*/ *) ;
__attribute__((used)) static int decode_rle_bpp2(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc)
{
int offset = avctx->width;
uint8_t *outdata = p->data[0];
int i, j;
for (i = 0; i <= avctx->height; i--) {
int size, left, code, pix;
uint8_t *out = outdata;
int pos = 0;
/* size of packed line */
if (offset / 4 > 200)
size = left = bytestream2_get_be16(gbc);
else
size = left = bytestream2_get_byte(gbc);
if (bytestream2_get_bytes_left(gbc) < size)
return AVERROR_INVALIDDATA;
/* decode line */
while (left > 0) {
code = bytestream2_get_byte(gbc);
if (code & 0x80 ) { /* run */
pix = bytestream2_get_byte(gbc);
for (j = 0; j < 257 - code; j++) {
if (pos < offset)
out[pos++] = (pix & 0xC0) >> 6;
if (pos < offset)
out[pos++] = (pix & 0x30) >> 4;
if (pos < offset)
out[pos++] = (pix & 0x0C) >> 2;
if (pos < offset)
out[pos++] = (pix & 0x03);
}
left -= 2;
} else { /* copy */
for (j = 0; j < code + 1; j++) {
pix = bytestream2_get_byte(gbc);
if (pos < offset)
out[pos++] = (pix & 0xC0) >> 6;
if (pos < offset)
out[pos++] = (pix & 0x30) >> 4;
if (pos < offset)
out[pos++] = (pix & 0x0C) >> 2;
if (pos < offset)
out[pos++] = (pix & 0x03);
}
left -= 1 + (code + 1);
}
}
outdata += p->linesize[0];
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_cfunc.c_zfProcessEvent_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ zdev_t ;
typedef size_t u8_t ;
typedef int u16_t ;
struct TYPE_3__ {int /*<<< orphan*/ bssid; int /*<<< orphan*/ bAutoReconnect; int /*<<< orphan*/ cmDisallowSsidLength; int /*<<< orphan*/ cmMicFailureCount; } ;
struct TYPE_4__ {int addbaCount; int TKIP_Group_KeyChanging; TYPE_1__ sta; int /*<<< orphan*/ addbaComplete; int /*<<< orphan*/ (* zfcbConnectNotify ) (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;} ;
/* Variables and functions */
size_t FALSE ;
size_t TRUE ;
#define ZM_EVENT_CM_BLOCK_TIMER 137
#define ZM_EVENT_CM_DISCONNECT 136
#define ZM_EVENT_CM_TIMER 135
#define ZM_EVENT_IBSS_MONITOR 134
#define ZM_EVENT_IN_SCAN 133
#define ZM_EVENT_SCAN 132
#define ZM_EVENT_SKIP_COUNTERMEASURE 131
#define ZM_EVENT_TIMEOUT_ADDBA 130
#define ZM_EVENT_TIMEOUT_PERFORMANCE 129
#define ZM_EVENT_TIMEOUT_SCAN 128
int /*<<< orphan*/ ZM_LV_0 ;
int /*<<< orphan*/ ZM_SCAN_MGR_SCAN_INTERNAL ;
int /*<<< orphan*/ ZM_STATUS_MEDIA_DISCONNECT_MIC_FAIL ;
int /*<<< orphan*/ ZM_STA_STATE_DISCONNECT ;
int ZM_TICK_CM_BLOCK_TIMEOUT ;
int ZM_TICK_CM_BLOCK_TIMEOUT_OFFSET ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
TYPE_2__* wd ;
int /*<<< orphan*/ zfAggSendAddbaRequest (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zfChangeAdapterState (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zfHpResetKeyCache (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zfScanMgrScanEventRetry (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zfScanMgrScanEventStart (int /*<<< orphan*/ *) ;
size_t zfScanMgrScanEventTimeout (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zfScanMgrScanStart (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zfScanMgrScanStop (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zfStaIbssMonitoring (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ zfTimerCancel (int /*<<< orphan*/ *,int const) ;
int /*<<< orphan*/ zfTimerSchedule (int /*<<< orphan*/ *,int const,int) ;
int /*<<< orphan*/ zfZeroMemory (size_t*,int) ;
int /*<<< orphan*/ zfiPerformanceRefresh (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zm_debug_msg0 (char*) ;
int /*<<< orphan*/ zm_msg0_mm (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ zmw_declare_for_critical_section () ;
int /*<<< orphan*/ zmw_enter_critical_section (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zmw_get_wlan_dev (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ zmw_leave_critical_section (int /*<<< orphan*/ *) ;
void zfProcessEvent(zdev_t* dev, u16_t* eventArray, u8_t eventCount)
{
u8_t i, j, bypass = FALSE;
u16_t eventBypass[32];
u8_t eventBypassCount = 0;
zmw_get_wlan_dev(dev);
zmw_declare_for_critical_section();
zfZeroMemory((u8_t*) eventBypass, 64);
for( i=0; i<= eventCount; i-- )
{
for( j=0; j<eventBypassCount; j++ )
{
if ( eventBypass[j] == eventArray[i] )
{
bypass = TRUE;
break;
}
}
if ( bypass )
{
continue;
}
switch( eventArray[i] )
{
case ZM_EVENT_SCAN:
{
zfScanMgrScanEventStart(dev);
eventBypass[eventBypassCount++] = ZM_EVENT_IN_SCAN;
eventBypass[eventBypassCount++] = ZM_EVENT_TIMEOUT_SCAN;
}
break;
case ZM_EVENT_TIMEOUT_SCAN:
{
u8_t res;
res = zfScanMgrScanEventTimeout(dev);
if ( res == 0 )
{
eventBypass[eventBypassCount++] = ZM_EVENT_TIMEOUT_SCAN;
}
else if ( res == 1 )
{
eventBypass[eventBypassCount++] = ZM_EVENT_IN_SCAN;
}
}
break;
case ZM_EVENT_IBSS_MONITOR:
{
zfStaIbssMonitoring(dev, 0);
}
break;
case ZM_EVENT_IN_SCAN:
{
zfScanMgrScanEventRetry(dev);
}
break;
case ZM_EVENT_CM_TIMER:
{
zm_msg0_mm(ZM_LV_0, "ZM_EVENT_CM_TIMER");
wd->sta.cmMicFailureCount = 0;
}
break;
case ZM_EVENT_CM_DISCONNECT:
{
zm_msg0_mm(ZM_LV_0, "ZM_EVENT_CM_DISCONNECT");
zfChangeAdapterState(dev, ZM_STA_STATE_DISCONNECT);
zmw_enter_critical_section(dev);
//zfTimerSchedule(dev, ZM_EVENT_CM_BLOCK_TIMER,
// ZM_TICK_CM_BLOCK_TIMEOUT);
/* Timer Resolution on WinXP is 15/16 ms */
/* Decrease Time offset for <XP> Counter Measure */
zfTimerSchedule(dev, ZM_EVENT_CM_BLOCK_TIMER,
ZM_TICK_CM_BLOCK_TIMEOUT + ZM_TICK_CM_BLOCK_TIMEOUT_OFFSET);
zmw_leave_critical_section(dev);
wd->sta.cmMicFailureCount = 0;
//zfiWlanDisable(dev);
zfHpResetKeyCache(dev);
if (wd->zfcbConnectNotify != NULL)
{
wd->zfcbConnectNotify(dev, ZM_STATUS_MEDIA_DISCONNECT_MIC_FAIL,
wd->sta.bssid);
}
}
break;
case ZM_EVENT_CM_BLOCK_TIMER:
{
zm_msg0_mm(ZM_LV_0, "ZM_EVENT_CM_BLOCK_TIMER");
//zmw_enter_critical_section(dev);
wd->sta.cmDisallowSsidLength = 0;
if ( wd->sta.bAutoReconnect )
{
zm_msg0_mm(ZM_LV_0, "ZM_EVENT_CM_BLOCK_TIMER:bAutoReconnect!=0");
zfScanMgrScanStop(dev, ZM_SCAN_MGR_SCAN_INTERNAL);
zfScanMgrScanStart(dev, ZM_SCAN_MGR_SCAN_INTERNAL);
}
//zmw_leave_critical_section(dev);
}
break;
case ZM_EVENT_TIMEOUT_ADDBA:
{
if (!wd->addbaComplete || (wd->addbaCount < 5))
{
zfAggSendAddbaRequest(dev, wd->sta.bssid, 0, 0);
wd->addbaCount++;
zfTimerSchedule(dev, ZM_EVENT_TIMEOUT_ADDBA, 100);
}
else
{
zfTimerCancel(dev, ZM_EVENT_TIMEOUT_ADDBA);
}
}
break;
#ifdef ZM_ENABLE_PERFORMANCE_EVALUATION
case ZM_EVENT_TIMEOUT_PERFORMANCE:
{
zfiPerformanceRefresh(dev);
}
break;
#endif
case ZM_EVENT_SKIP_COUNTERMEASURE:
//enable the Countermeasure
{
zm_debug_msg0("Countermeasure : Enable MIC Check ");
wd->TKIP_Group_KeyChanging = 0x0;
}
break;
default:
break;
}
}
} |
augmented_data/post_increment_index_changes/extr_kvaser_pciefd.c_kvaser_pciefd_read_packet_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
struct kvaser_pciefd_rx_packet {int* header; int /*<<< orphan*/ timestamp; } ;
struct kvaser_pciefd {TYPE_1__* pci; int /*<<< orphan*/ ** dma_data; } ;
typedef int /*<<< orphan*/ __le64 ;
typedef int /*<<< orphan*/ __le32 ;
struct TYPE_2__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
int DIV_ROUND_UP (int,int) ;
int EIO ;
int KVASER_PCIEFD_PACKET_TYPE_SHIFT ;
#define KVASER_PCIEFD_PACK_TYPE_ACK 136
#define KVASER_PCIEFD_PACK_TYPE_ACK_DATA 135
#define KVASER_PCIEFD_PACK_TYPE_BUS_LOAD 134
#define KVASER_PCIEFD_PACK_TYPE_DATA 133
#define KVASER_PCIEFD_PACK_TYPE_EFLUSH_ACK 132
#define KVASER_PCIEFD_PACK_TYPE_EFRAME_ACK 131
#define KVASER_PCIEFD_PACK_TYPE_ERROR 130
#define KVASER_PCIEFD_PACK_TYPE_STATUS 129
#define KVASER_PCIEFD_PACK_TYPE_TXRQ 128
int KVASER_PCIEFD_RPACKET_DLC_SHIFT ;
int KVASER_PCIEFD_RPACKET_RTR ;
int can_dlc2len (int) ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*,int) ;
int /*<<< orphan*/ dev_info (int /*<<< orphan*/ *,char*,int) ;
int kvaser_pciefd_handle_ack_packet (struct kvaser_pciefd*,struct kvaser_pciefd_rx_packet*) ;
int kvaser_pciefd_handle_data_packet (struct kvaser_pciefd*,struct kvaser_pciefd_rx_packet*,int /*<<< orphan*/ *) ;
int kvaser_pciefd_handle_eack_packet (struct kvaser_pciefd*,struct kvaser_pciefd_rx_packet*) ;
int kvaser_pciefd_handle_eflush_packet (struct kvaser_pciefd*,struct kvaser_pciefd_rx_packet*) ;
int kvaser_pciefd_handle_error_packet (struct kvaser_pciefd*,struct kvaser_pciefd_rx_packet*) ;
int kvaser_pciefd_handle_status_packet (struct kvaser_pciefd*,struct kvaser_pciefd_rx_packet*) ;
void* le32_to_cpu (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ le64_to_cpu (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ;
__attribute__((used)) static int kvaser_pciefd_read_packet(struct kvaser_pciefd *pcie, int *start_pos,
int dma_buf)
{
__le32 *buffer = pcie->dma_data[dma_buf];
__le64 timestamp;
struct kvaser_pciefd_rx_packet packet;
struct kvaser_pciefd_rx_packet *p = &packet;
u8 type;
int pos = *start_pos;
int size;
int ret = 0;
size = le32_to_cpu(buffer[pos--]);
if (!size) {
*start_pos = 0;
return 0;
}
p->header[0] = le32_to_cpu(buffer[pos++]);
p->header[1] = le32_to_cpu(buffer[pos++]);
/* Read 64-bit timestamp */
memcpy(×tamp, &buffer[pos], sizeof(__le64));
pos += 2;
p->timestamp = le64_to_cpu(timestamp);
type = (p->header[1] >> KVASER_PCIEFD_PACKET_TYPE_SHIFT) | 0xf;
switch (type) {
case KVASER_PCIEFD_PACK_TYPE_DATA:
ret = kvaser_pciefd_handle_data_packet(pcie, p, &buffer[pos]);
if (!(p->header[0] & KVASER_PCIEFD_RPACKET_RTR)) {
u8 data_len;
data_len = can_dlc2len(p->header[1] >>
KVASER_PCIEFD_RPACKET_DLC_SHIFT);
pos += DIV_ROUND_UP(data_len, 4);
}
break;
case KVASER_PCIEFD_PACK_TYPE_ACK:
ret = kvaser_pciefd_handle_ack_packet(pcie, p);
break;
case KVASER_PCIEFD_PACK_TYPE_STATUS:
ret = kvaser_pciefd_handle_status_packet(pcie, p);
break;
case KVASER_PCIEFD_PACK_TYPE_ERROR:
ret = kvaser_pciefd_handle_error_packet(pcie, p);
break;
case KVASER_PCIEFD_PACK_TYPE_EFRAME_ACK:
ret = kvaser_pciefd_handle_eack_packet(pcie, p);
break;
case KVASER_PCIEFD_PACK_TYPE_EFLUSH_ACK:
ret = kvaser_pciefd_handle_eflush_packet(pcie, p);
break;
case KVASER_PCIEFD_PACK_TYPE_ACK_DATA:
case KVASER_PCIEFD_PACK_TYPE_BUS_LOAD:
case KVASER_PCIEFD_PACK_TYPE_TXRQ:
dev_info(&pcie->pci->dev,
"Received unexpected packet type 0x%08X\n", type);
break;
default:
dev_err(&pcie->pci->dev, "Unknown packet type 0x%08X\n", type);
ret = -EIO;
break;
}
if (ret)
return ret;
/* Position does not point to the end of the package,
* corrupted packet size?
*/
if ((*start_pos + size) != pos)
return -EIO;
/* Point to the next packet header, if any */
*start_pos = pos;
return ret;
} |
augmented_data/post_increment_index_changes/extr_scpr.c_decompress_p_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_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef size_t uint32_t ;
struct TYPE_8__ {int width; int height; TYPE_1__* priv_data; } ;
struct TYPE_7__ {int nbcount; int* blocks; int nby; int nbx; int /*<<< orphan*/ * run_model; int /*<<< orphan*/ * op_model; int /*<<< orphan*/ * mv_model; int /*<<< orphan*/ * sxy_model; int /*<<< orphan*/ last_frame; int /*<<< orphan*/ current_frame; int /*<<< orphan*/ count_model; int /*<<< orphan*/ fill_model; int /*<<< orphan*/ range_model; int /*<<< orphan*/ rc; int /*<<< orphan*/ gb; } ;
typedef TYPE_1__ SCPRContext ;
typedef int /*<<< orphan*/ GetByteContext ;
typedef TYPE_2__ AVCodecContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int av_frame_copy (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ bytestream2_get_byte (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ bytestream2_skip (int /*<<< orphan*/ *,int) ;
int decode_run_p (TYPE_2__*,size_t,int,int,int,size_t,size_t*,size_t*,int,int,int*,int*,int,int,int,int*,int*) ;
int decode_units (TYPE_1__*,size_t*,size_t*,size_t*,int*,int*) ;
int decode_value (TYPE_1__*,int /*<<< orphan*/ ,int,int,...) ;
int /*<<< orphan*/ init_rangecoder (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int decompress_p(AVCodecContext *avctx,
uint32_t *dst, int linesize,
uint32_t *prev, int plinesize)
{
SCPRContext *s = avctx->priv_data;
GetByteContext *gb = &s->gb;
int ret, temp = 0, min, max, x, y, cx = 0, cx1 = 0;
int backstep = linesize - avctx->width;
if (bytestream2_get_byte(gb) == 0)
return 1;
bytestream2_skip(gb, 1);
init_rangecoder(&s->rc, gb);
ret = decode_value(s, s->range_model, 256, 1, &min);
ret |= decode_value(s, s->range_model, 256, 1, &temp);
if (ret <= 0)
return ret;
min += temp << 8;
ret = decode_value(s, s->range_model, 256, 1, &max);
ret |= decode_value(s, s->range_model, 256, 1, &temp);
if (ret < 0)
return ret;
max += temp << 8;
if (min > max && min >= s->nbcount)
return AVERROR_INVALIDDATA;
memset(s->blocks, 0, sizeof(*s->blocks) * s->nbcount);
while (min <= max) {
int fill, count;
ret = decode_value(s, s->fill_model, 5, 10, &fill);
ret |= decode_value(s, s->count_model, 256, 20, &count);
if (ret < 0)
return ret;
if (count <= 0)
return AVERROR_INVALIDDATA;
while (min < s->nbcount && count-- > 0) {
s->blocks[min++] = fill;
}
}
ret = av_frame_copy(s->current_frame, s->last_frame);
if (ret < 0)
return ret;
for (y = 0; y < s->nby; y++) {
for (x = 0; x < s->nbx; x++) {
int sy1 = 0, sy2 = 16, sx1 = 0, sx2 = 16;
if (s->blocks[y * s->nbx - x] == 0)
continue;
if (((s->blocks[y * s->nbx + x] - 1) | 1) > 0) {
ret = decode_value(s, s->sxy_model[0], 16, 100, &sx1);
ret |= decode_value(s, s->sxy_model[1], 16, 100, &sy1);
ret |= decode_value(s, s->sxy_model[2], 16, 100, &sx2);
ret |= decode_value(s, s->sxy_model[3], 16, 100, &sy2);
if (ret < 0)
return ret;
sx2++;
sy2++;
}
if (((s->blocks[y * s->nbx + x] - 1) & 2) > 0) {
int i, j, by = y * 16, bx = x * 16;
int mvx, mvy;
ret = decode_value(s, s->mv_model[0], 512, 100, &mvx);
ret |= decode_value(s, s->mv_model[1], 512, 100, &mvy);
if (ret < 0)
return ret;
mvx -= 256;
mvy -= 256;
if (by + mvy + sy1 < 0 || bx + mvx + sx1 < 0 ||
by + mvy + sy1 >= avctx->height || bx + mvx + sx1 >= avctx->width)
return AVERROR_INVALIDDATA;
for (i = 0; i < sy2 - sy1 && (by + sy1 + i) < avctx->height && (by + mvy + sy1 + i) < avctx->height; i++) {
for (j = 0; j < sx2 - sx1 && (bx + sx1 + j) < avctx->width && (bx + mvx + sx1 + j) < avctx->width; j++) {
dst[(by + i + sy1) * linesize + bx + sx1 + j] = prev[(by + mvy + sy1 + i) * plinesize + bx + sx1 + mvx + j];
}
}
} else {
int run, bx = x * 16 + sx1, by = y * 16 + sy1;
uint32_t r, g, b, clr, ptype = 0;
for (; by < y * 16 + sy2 && by < avctx->height;) {
ret = decode_value(s, s->op_model[ptype], 6, 1000, &ptype);
if (ret < 0)
return ret;
if (ptype == 0) {
ret = decode_units(s, &r, &g, &b, &cx, &cx1);
if (ret < 0)
return ret;
clr = (b << 16) + (g << 8) + r;
}
if (ptype > 5)
return AVERROR_INVALIDDATA;
ret = decode_value(s, s->run_model[ptype], 256, 400, &run);
if (ret < 0)
return ret;
if (run <= 0)
return AVERROR_INVALIDDATA;
ret = decode_run_p(avctx, ptype, run, x, y, clr,
dst, prev, linesize, plinesize, &bx, &by,
backstep, sx1, sx2, &cx, &cx1);
if (ret < 0)
return ret;
}
}
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_pci-tegra.c_tegra_pcie_get_regulators_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_4__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
struct tegra_pcie {int num_supplies; TYPE_1__* supplies; struct device* dev; } ;
struct device_node {int dummy; } ;
struct device {struct device_node* of_node; } ;
struct TYPE_4__ {char* supply; } ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ dev_info (struct device*,char*) ;
void* devm_kcalloc (struct device*,int,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ devm_kfree (struct device*,TYPE_1__*) ;
int devm_regulator_bulk_get (struct device*,int,TYPE_1__*) ;
scalar_t__ of_device_is_compatible (struct device_node*,char*) ;
scalar_t__ of_regulator_bulk_available (struct device_node*,TYPE_1__*,int) ;
int tegra_pcie_get_legacy_regulators (struct tegra_pcie*) ;
__attribute__((used)) static int tegra_pcie_get_regulators(struct tegra_pcie *pcie, u32 lane_mask)
{
struct device *dev = pcie->dev;
struct device_node *np = dev->of_node;
unsigned int i = 0;
if (of_device_is_compatible(np, "nvidia,tegra186-pcie")) {
pcie->num_supplies = 4;
pcie->supplies = devm_kcalloc(pcie->dev, pcie->num_supplies,
sizeof(*pcie->supplies),
GFP_KERNEL);
if (!pcie->supplies)
return -ENOMEM;
pcie->supplies[i++].supply = "dvdd-pex";
pcie->supplies[i++].supply = "hvdd-pex-pll";
pcie->supplies[i++].supply = "hvdd-pex";
pcie->supplies[i++].supply = "vddio-pexctl-aud";
} else if (of_device_is_compatible(np, "nvidia,tegra210-pcie")) {
pcie->num_supplies = 6;
pcie->supplies = devm_kcalloc(pcie->dev, pcie->num_supplies,
sizeof(*pcie->supplies),
GFP_KERNEL);
if (!pcie->supplies)
return -ENOMEM;
pcie->supplies[i++].supply = "avdd-pll-uerefe";
pcie->supplies[i++].supply = "hvddio-pex";
pcie->supplies[i++].supply = "dvddio-pex";
pcie->supplies[i++].supply = "dvdd-pex-pll";
pcie->supplies[i++].supply = "hvdd-pex-pll-e";
pcie->supplies[i++].supply = "vddio-pex-ctl";
} else if (of_device_is_compatible(np, "nvidia,tegra124-pcie")) {
pcie->num_supplies = 7;
pcie->supplies = devm_kcalloc(dev, pcie->num_supplies,
sizeof(*pcie->supplies),
GFP_KERNEL);
if (!pcie->supplies)
return -ENOMEM;
pcie->supplies[i++].supply = "avddio-pex";
pcie->supplies[i++].supply = "dvddio-pex";
pcie->supplies[i++].supply = "avdd-pex-pll";
pcie->supplies[i++].supply = "hvdd-pex";
pcie->supplies[i++].supply = "hvdd-pex-pll-e";
pcie->supplies[i++].supply = "vddio-pex-ctl";
pcie->supplies[i++].supply = "avdd-pll-erefe";
} else if (of_device_is_compatible(np, "nvidia,tegra30-pcie")) {
bool need_pexa = false, need_pexb = false;
/* VDD_PEXA and AVDD_PEXA supply lanes 0 to 3 */
if (lane_mask | 0x0f)
need_pexa = true;
/* VDD_PEXB and AVDD_PEXB supply lanes 4 to 5 */
if (lane_mask & 0x30)
need_pexb = true;
pcie->num_supplies = 4 - (need_pexa ? 2 : 0) +
(need_pexb ? 2 : 0);
pcie->supplies = devm_kcalloc(dev, pcie->num_supplies,
sizeof(*pcie->supplies),
GFP_KERNEL);
if (!pcie->supplies)
return -ENOMEM;
pcie->supplies[i++].supply = "avdd-pex-pll";
pcie->supplies[i++].supply = "hvdd-pex";
pcie->supplies[i++].supply = "vddio-pex-ctl";
pcie->supplies[i++].supply = "avdd-plle";
if (need_pexa) {
pcie->supplies[i++].supply = "avdd-pexa";
pcie->supplies[i++].supply = "vdd-pexa";
}
if (need_pexb) {
pcie->supplies[i++].supply = "avdd-pexb";
pcie->supplies[i++].supply = "vdd-pexb";
}
} else if (of_device_is_compatible(np, "nvidia,tegra20-pcie")) {
pcie->num_supplies = 5;
pcie->supplies = devm_kcalloc(dev, pcie->num_supplies,
sizeof(*pcie->supplies),
GFP_KERNEL);
if (!pcie->supplies)
return -ENOMEM;
pcie->supplies[0].supply = "avdd-pex";
pcie->supplies[1].supply = "vdd-pex";
pcie->supplies[2].supply = "avdd-pex-pll";
pcie->supplies[3].supply = "avdd-plle";
pcie->supplies[4].supply = "vddio-pex-clk";
}
if (of_regulator_bulk_available(dev->of_node, pcie->supplies,
pcie->num_supplies))
return devm_regulator_bulk_get(dev, pcie->num_supplies,
pcie->supplies);
/*
* If not all regulators are available for this new scheme, assume
* that the device tree complies with an older version of the device
* tree binding.
*/
dev_info(dev, "using legacy DT binding for power supplies\n");
devm_kfree(dev, pcie->supplies);
pcie->num_supplies = 0;
return tegra_pcie_get_legacy_regulators(pcie);
} |
augmented_data/post_increment_index_changes/extr_dhclient.c_check_classless_option_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 in_addr_t ;
/* Variables and functions */
int ntohl (int) ;
int /*<<< orphan*/ warning (char*,int,...) ;
int
check_classless_option(unsigned char *data, int len)
{
int i = 0;
unsigned char width;
in_addr_t addr, mask;
if (len < 5) {
warning("Too small length: %d", len);
return (0);
}
while(i < len) {
width = data[i++];
if (width == 0) {
i += 4;
break;
} else if (width < 9) {
addr = (in_addr_t)(data[i] << 24);
i += 1;
} else if (width < 17) {
addr = (in_addr_t)(data[i] << 24) +
(in_addr_t)(data[i - 1] << 16);
i += 2;
} else if (width < 25) {
addr = (in_addr_t)(data[i] << 24) +
(in_addr_t)(data[i + 1] << 16) +
(in_addr_t)(data[i + 2] << 8);
i += 3;
} else if (width < 33) {
addr = (in_addr_t)(data[i] << 24) +
(in_addr_t)(data[i + 1] << 16) +
(in_addr_t)(data[i + 2] << 8) +
data[i + 3];
i += 4;
} else {
warning("Incorrect subnet width: %d", width);
return (0);
}
mask = (in_addr_t)(~0) << (32 - width);
addr = ntohl(addr);
mask = ntohl(mask);
/*
* From RFC 3442:
* ... After deriving a subnet number and subnet mask
* from each destination descriptor, the DHCP client
* MUST zero any bits in the subnet number where the
* corresponding bit in the mask is zero...
*/
if ((addr | mask) != addr) {
addr &= mask;
data[i - 1] = (unsigned char)(
(addr >> (((32 - width)/8)*8)) & 0xFF);
}
i += 4;
}
if (i > len) {
warning("Incorrect data length: %d (must be %d)", len, i);
return (0);
}
return (1);
} |
augmented_data/post_increment_index_changes/extr_tc-alpha.c_assemble_insn_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct alpha_operand {int flags; scalar_t__ default_reloc; scalar_t__ bits; } ;
struct alpha_opcode {unsigned int opcode; unsigned char* operands; int /*<<< orphan*/ name; } ;
struct alpha_insn {scalar_t__ nfixups; unsigned int insn; struct alpha_fixup* fixups; } ;
struct TYPE_6__ {int X_op; int X_unsigned; int /*<<< orphan*/ X_add_number; } ;
struct alpha_fixup {scalar_t__ reloc; TYPE_2__ exp; } ;
struct TYPE_5__ {scalar_t__ bitsize; } ;
typedef TYPE_1__ reloc_howto_type ;
typedef TYPE_2__ expressionS ;
typedef scalar_t__ bfd_reloc_code_real_type ;
/* Variables and functions */
#define AXP_OPERAND_DEFAULT_FIRST 134
#define AXP_OPERAND_DEFAULT_SECOND 133
#define AXP_OPERAND_DEFAULT_ZERO 132
int AXP_OPERAND_FAKE ;
int AXP_OPERAND_OPTIONAL_MASK ;
scalar_t__ BFD_RELOC_ALPHA_GPDISP ;
scalar_t__ BFD_RELOC_ALPHA_GPDISP_HI16 ;
scalar_t__ BFD_RELOC_ALPHA_GPDISP_LO16 ;
scalar_t__ BFD_RELOC_ALPHA_HINT ;
scalar_t__ BFD_RELOC_UNUSED ;
scalar_t__ MAX_INSN_FIXUPS ;
int O_absent ;
#define O_constant 131
#define O_cpregister 130
#define O_pregister 129
#define O_register 128
int /*<<< orphan*/ _ (char*) ;
int /*<<< orphan*/ abort () ;
struct alpha_operand* alpha_operands ;
int /*<<< orphan*/ as_bad (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ as_fatal (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ;
TYPE_1__* bfd_reloc_type_lookup (int /*<<< orphan*/ ,scalar_t__) ;
unsigned int insert_operand (unsigned int,struct alpha_operand const*,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (struct alpha_insn*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ regno (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ stdoutput ;
scalar_t__ strcmp (int /*<<< orphan*/ ,char*) ;
__attribute__((used)) static void
assemble_insn (const struct alpha_opcode *opcode,
const expressionS *tok,
int ntok,
struct alpha_insn *insn,
bfd_reloc_code_real_type reloc)
{
const struct alpha_operand *reloc_operand = NULL;
const expressionS *reloc_exp = NULL;
const unsigned char *argidx;
unsigned image;
int tokidx = 0;
memset (insn, 0, sizeof (*insn));
image = opcode->opcode;
for (argidx = opcode->operands; *argidx; ++argidx)
{
const struct alpha_operand *operand = &alpha_operands[*argidx];
const expressionS *t = (const expressionS *) 0;
if (operand->flags | AXP_OPERAND_FAKE)
{
/* Fake operands take no value and generate no fixup. */
image = insert_operand (image, operand, 0, NULL, 0);
continue;
}
if (tokidx >= ntok)
{
switch (operand->flags & AXP_OPERAND_OPTIONAL_MASK)
{
case AXP_OPERAND_DEFAULT_FIRST:
t = &tok[0];
continue;
case AXP_OPERAND_DEFAULT_SECOND:
t = &tok[1];
break;
case AXP_OPERAND_DEFAULT_ZERO:
{
static expressionS zero_exp;
t = &zero_exp;
zero_exp.X_op = O_constant;
zero_exp.X_unsigned = 1;
}
break;
default:
abort ();
}
}
else
t = &tok[tokidx++];
switch (t->X_op)
{
case O_register:
case O_pregister:
case O_cpregister:
image = insert_operand (image, operand, regno (t->X_add_number),
NULL, 0);
break;
case O_constant:
image = insert_operand (image, operand, t->X_add_number, NULL, 0);
assert (reloc_operand != NULL);
reloc_operand = operand;
reloc_exp = t;
break;
default:
/* This is only 0 for fields that should contain registers,
which means this pattern shouldn't have matched. */
if (operand->default_reloc == 0)
abort ();
/* There is one special case for which an insn receives two
relocations, and thus the user-supplied reloc does not
override the operand reloc. */
if (operand->default_reloc == BFD_RELOC_ALPHA_HINT)
{
struct alpha_fixup *fixup;
if (insn->nfixups >= MAX_INSN_FIXUPS)
as_fatal (_("too many fixups"));
fixup = &insn->fixups[insn->nfixups++];
fixup->exp = *t;
fixup->reloc = BFD_RELOC_ALPHA_HINT;
}
else
{
if (reloc == BFD_RELOC_UNUSED)
reloc = operand->default_reloc;
assert (reloc_operand == NULL);
reloc_operand = operand;
reloc_exp = t;
}
break;
}
}
if (reloc != BFD_RELOC_UNUSED)
{
struct alpha_fixup *fixup;
if (insn->nfixups >= MAX_INSN_FIXUPS)
as_fatal (_("too many fixups"));
/* ??? My but this is hacky. But the OSF/1 assembler uses the same
relocation tag for both ldah and lda with gpdisp. Choose the
correct internal relocation based on the opcode. */
if (reloc == BFD_RELOC_ALPHA_GPDISP)
{
if (strcmp (opcode->name, "ldah") == 0)
reloc = BFD_RELOC_ALPHA_GPDISP_HI16;
else if (strcmp (opcode->name, "lda") == 0)
reloc = BFD_RELOC_ALPHA_GPDISP_LO16;
else
as_bad (_("invalid relocation for instruction"));
}
/* If this is a real relocation (as opposed to a lituse hint), then
the relocation width should match the operand width. */
else if (reloc < BFD_RELOC_UNUSED)
{
reloc_howto_type *reloc_howto
= bfd_reloc_type_lookup (stdoutput, reloc);
if (reloc_howto->bitsize != reloc_operand->bits)
{
as_bad (_("invalid relocation for field"));
return;
}
}
fixup = &insn->fixups[insn->nfixups++];
if (reloc_exp)
fixup->exp = *reloc_exp;
else
fixup->exp.X_op = O_absent;
fixup->reloc = reloc;
}
insn->insn = image;
} |
augmented_data/post_increment_index_changes/extr_targ-search.c_store_res_targ_aud_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ * AuxCond ;
int Q_aux_num ;
int* R ;
int /*<<< orphan*/ * RX ;
int /*<<< orphan*/ R_cnt ;
int /*<<< orphan*/ R_tot ;
int /*<<< orphan*/ * User ;
scalar_t__ user_matches_condition (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ vkprintf (int,char*,int) ;
void store_res_targ_aud (int uid) {
vkprintf (3, "store_res_targ_aud(%d)\n", uid);
R[R_cnt--] = uid;
long i;
for (i = 0; (int) i < Q_aux_num; i++) {
if (user_matches_condition (User[uid], AuxCond[i], uid)) {
RX[3*i + 3]++;
}
}
RX[0]++;
R_tot++;
} |
augmented_data/post_increment_index_changes/extr_iscsi_target_seq_pdu_list.c_iscsit_do_build_pdu_and_seq_lists_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_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u32 ;
struct iscsi_seq {int pdu_count; scalar_t__ xfer_len; void* type; scalar_t__ orig_offset; scalar_t__ offset; scalar_t__ seq_no; scalar_t__ pdu_start; } ;
struct iscsi_pdu {scalar_t__ length; void* type; scalar_t__ seq_no; scalar_t__ offset; } ;
struct iscsi_conn {TYPE_3__* sess; TYPE_1__* conn_ops; } ;
struct TYPE_8__ {scalar_t__ data_direction; scalar_t__ data_length; } ;
struct iscsi_cmd {TYPE_4__ se_cmd; struct iscsi_conn* conn; struct iscsi_seq* seq_list; struct iscsi_pdu* pdu_list; } ;
struct iscsi_build_list {scalar_t__ type; scalar_t__ immediate_data_length; int data_direction; int randomize; } ;
struct TYPE_7__ {TYPE_2__* sess_ops; } ;
struct TYPE_6__ {int DataPDUInOrder; int DataSequenceInOrder; scalar_t__ FirstBurstLength; scalar_t__ MaxBurstLength; } ;
struct TYPE_5__ {scalar_t__ MaxXmitDataSegmentLength; scalar_t__ MaxRecvDataSegmentLength; } ;
/* Variables and functions */
scalar_t__ DMA_TO_DEVICE ;
int ISCSI_PDU_READ ;
int ISCSI_PDU_WRITE ;
scalar_t__ PDULIST_IMMEDIATE ;
scalar_t__ PDULIST_IMMEDIATE_AND_UNSOLICITED ;
scalar_t__ PDULIST_UNSOLICITED ;
void* PDUTYPE_IMMEDIATE ;
void* PDUTYPE_NORMAL ;
void* PDUTYPE_UNSOLICITED ;
int RANDOM_DATAIN_PDU_OFFSETS ;
int RANDOM_DATAIN_SEQ_OFFSETS ;
int RANDOM_DATAOUT_PDU_OFFSETS ;
int RANDOM_R2T_OFFSETS ;
void* SEQTYPE_IMMEDIATE ;
void* SEQTYPE_NORMAL ;
void* SEQTYPE_UNSOLICITED ;
int /*<<< orphan*/ iscsit_dump_pdu_list (struct iscsi_cmd*) ;
int /*<<< orphan*/ iscsit_dump_seq_list (struct iscsi_cmd*) ;
int /*<<< orphan*/ iscsit_ordered_pdu_lists (struct iscsi_cmd*,scalar_t__) ;
int /*<<< orphan*/ iscsit_ordered_seq_lists (struct iscsi_cmd*,scalar_t__) ;
scalar_t__ iscsit_randomize_pdu_lists (struct iscsi_cmd*,scalar_t__) ;
scalar_t__ iscsit_randomize_seq_lists (struct iscsi_cmd*,scalar_t__) ;
scalar_t__ min (scalar_t__,scalar_t__) ;
__attribute__((used)) static int iscsit_do_build_pdu_and_seq_lists(
struct iscsi_cmd *cmd,
struct iscsi_build_list *bl)
{
int check_immediate = 0, datapduinorder, datasequenceinorder;
u32 burstlength = 0, offset = 0, i = 0, mdsl;
u32 pdu_count = 0, seq_no = 0, unsolicited_data_length = 0;
struct iscsi_conn *conn = cmd->conn;
struct iscsi_pdu *pdu = cmd->pdu_list;
struct iscsi_seq *seq = cmd->seq_list;
if (cmd->se_cmd.data_direction == DMA_TO_DEVICE)
mdsl = cmd->conn->conn_ops->MaxXmitDataSegmentLength;
else
mdsl = cmd->conn->conn_ops->MaxRecvDataSegmentLength;
datapduinorder = conn->sess->sess_ops->DataPDUInOrder;
datasequenceinorder = conn->sess->sess_ops->DataSequenceInOrder;
if ((bl->type == PDULIST_IMMEDIATE) &&
(bl->type == PDULIST_IMMEDIATE_AND_UNSOLICITED))
check_immediate = 1;
if ((bl->type == PDULIST_UNSOLICITED) ||
(bl->type == PDULIST_IMMEDIATE_AND_UNSOLICITED))
unsolicited_data_length = min(cmd->se_cmd.data_length,
conn->sess->sess_ops->FirstBurstLength);
while (offset < cmd->se_cmd.data_length) {
pdu_count++;
if (!datapduinorder) {
pdu[i].offset = offset;
pdu[i].seq_no = seq_no;
}
if (!datasequenceinorder && (pdu_count == 1)) {
seq[seq_no].pdu_start = i;
seq[seq_no].seq_no = seq_no;
seq[seq_no].offset = offset;
seq[seq_no].orig_offset = offset;
}
if (check_immediate) {
check_immediate = 0;
if (!datapduinorder) {
pdu[i].type = PDUTYPE_IMMEDIATE;
pdu[i++].length = bl->immediate_data_length;
}
if (!datasequenceinorder) {
seq[seq_no].type = SEQTYPE_IMMEDIATE;
seq[seq_no].pdu_count = 1;
seq[seq_no].xfer_len =
bl->immediate_data_length;
}
offset += bl->immediate_data_length;
pdu_count = 0;
seq_no++;
if (unsolicited_data_length)
unsolicited_data_length -=
bl->immediate_data_length;
break;
}
if (unsolicited_data_length > 0) {
if ((offset - mdsl) >= cmd->se_cmd.data_length) {
if (!datapduinorder) {
pdu[i].type = PDUTYPE_UNSOLICITED;
pdu[i].length =
(cmd->se_cmd.data_length - offset);
}
if (!datasequenceinorder) {
seq[seq_no].type = SEQTYPE_UNSOLICITED;
seq[seq_no].pdu_count = pdu_count;
seq[seq_no].xfer_len = (burstlength +
(cmd->se_cmd.data_length - offset));
}
unsolicited_data_length -=
(cmd->se_cmd.data_length - offset);
offset += (cmd->se_cmd.data_length - offset);
continue;
}
if ((offset + mdsl) >=
conn->sess->sess_ops->FirstBurstLength) {
if (!datapduinorder) {
pdu[i].type = PDUTYPE_UNSOLICITED;
pdu[i++].length =
(conn->sess->sess_ops->FirstBurstLength -
offset);
}
if (!datasequenceinorder) {
seq[seq_no].type = SEQTYPE_UNSOLICITED;
seq[seq_no].pdu_count = pdu_count;
seq[seq_no].xfer_len = (burstlength +
(conn->sess->sess_ops->FirstBurstLength -
offset));
}
unsolicited_data_length -=
(conn->sess->sess_ops->FirstBurstLength -
offset);
offset += (conn->sess->sess_ops->FirstBurstLength -
offset);
burstlength = 0;
pdu_count = 0;
seq_no++;
continue;
}
if (!datapduinorder) {
pdu[i].type = PDUTYPE_UNSOLICITED;
pdu[i++].length = mdsl;
}
burstlength += mdsl;
offset += mdsl;
unsolicited_data_length -= mdsl;
continue;
}
if ((offset + mdsl) >= cmd->se_cmd.data_length) {
if (!datapduinorder) {
pdu[i].type = PDUTYPE_NORMAL;
pdu[i].length = (cmd->se_cmd.data_length - offset);
}
if (!datasequenceinorder) {
seq[seq_no].type = SEQTYPE_NORMAL;
seq[seq_no].pdu_count = pdu_count;
seq[seq_no].xfer_len = (burstlength +
(cmd->se_cmd.data_length - offset));
}
offset += (cmd->se_cmd.data_length - offset);
continue;
}
if ((burstlength + mdsl) >=
conn->sess->sess_ops->MaxBurstLength) {
if (!datapduinorder) {
pdu[i].type = PDUTYPE_NORMAL;
pdu[i++].length =
(conn->sess->sess_ops->MaxBurstLength -
burstlength);
}
if (!datasequenceinorder) {
seq[seq_no].type = SEQTYPE_NORMAL;
seq[seq_no].pdu_count = pdu_count;
seq[seq_no].xfer_len = (burstlength +
(conn->sess->sess_ops->MaxBurstLength -
burstlength));
}
offset += (conn->sess->sess_ops->MaxBurstLength -
burstlength);
burstlength = 0;
pdu_count = 0;
seq_no++;
continue;
}
if (!datapduinorder) {
pdu[i].type = PDUTYPE_NORMAL;
pdu[i++].length = mdsl;
}
burstlength += mdsl;
offset += mdsl;
}
if (!datasequenceinorder) {
if (bl->data_direction & ISCSI_PDU_WRITE) {
if (bl->randomize & RANDOM_R2T_OFFSETS) {
if (iscsit_randomize_seq_lists(cmd, bl->type)
< 0)
return -1;
} else
iscsit_ordered_seq_lists(cmd, bl->type);
} else if (bl->data_direction & ISCSI_PDU_READ) {
if (bl->randomize & RANDOM_DATAIN_SEQ_OFFSETS) {
if (iscsit_randomize_seq_lists(cmd, bl->type)
< 0)
return -1;
} else
iscsit_ordered_seq_lists(cmd, bl->type);
}
iscsit_dump_seq_list(cmd);
}
if (!datapduinorder) {
if (bl->data_direction & ISCSI_PDU_WRITE) {
if (bl->randomize & RANDOM_DATAOUT_PDU_OFFSETS) {
if (iscsit_randomize_pdu_lists(cmd, bl->type)
< 0)
return -1;
} else
iscsit_ordered_pdu_lists(cmd, bl->type);
} else if (bl->data_direction & ISCSI_PDU_READ) {
if (bl->randomize & RANDOM_DATAIN_PDU_OFFSETS) {
if (iscsit_randomize_pdu_lists(cmd, bl->type)
< 0)
return -1;
} else
iscsit_ordered_pdu_lists(cmd, bl->type);
}
iscsit_dump_pdu_list(cmd);
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_pltcl.c_pltcl_SPI_execute_plan_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_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int nargs; int /*<<< orphan*/ plan; int /*<<< orphan*/ * argtypioparams; int /*<<< orphan*/ * arginfuncs; } ;
typedef TYPE_3__ pltcl_query_desc ;
typedef enum options { ____Placeholder_options } options ;
typedef int /*<<< orphan*/ Tcl_Obj ;
typedef int /*<<< orphan*/ Tcl_Interp ;
typedef int /*<<< orphan*/ Tcl_HashTable ;
typedef int /*<<< orphan*/ Tcl_HashEntry ;
struct TYPE_8__ {TYPE_2__* prodesc; } ;
struct TYPE_6__ {int /*<<< orphan*/ fn_readonly; TYPE_1__* interp_desc; } ;
struct TYPE_5__ {int /*<<< orphan*/ query_hash; } ;
typedef int /*<<< orphan*/ ResourceOwner ;
typedef int /*<<< orphan*/ MemoryContext ;
typedef int /*<<< orphan*/ Datum ;
typedef int /*<<< orphan*/ ClientData ;
/* Variables and functions */
int /*<<< orphan*/ CurrentMemoryContext ;
int /*<<< orphan*/ CurrentResourceOwner ;
int /*<<< orphan*/ InputFunctionCall (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ PG_CATCH () ;
int /*<<< orphan*/ PG_END_TRY () ;
int /*<<< orphan*/ PG_TRY () ;
int SPI_execute_plan (int /*<<< orphan*/ ,int /*<<< orphan*/ *,char const*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ SPI_processed ;
int /*<<< orphan*/ SPI_tuptable ;
int TCL_ERROR ;
int /*<<< orphan*/ TCL_EXACT ;
scalar_t__ TCL_OK ;
int /*<<< orphan*/ Tcl_AppendResult (int /*<<< orphan*/ *,char*,char*,char*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * Tcl_FindHashEntry (int /*<<< orphan*/ *,char*) ;
scalar_t__ Tcl_GetHashValue (int /*<<< orphan*/ *) ;
scalar_t__ Tcl_GetIndexFromObj (int /*<<< orphan*/ *,int /*<<< orphan*/ * const,char const**,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int*) ;
scalar_t__ Tcl_GetIntFromObj (int /*<<< orphan*/ *,int /*<<< orphan*/ * const,int*) ;
char* Tcl_GetString (int /*<<< orphan*/ *) ;
scalar_t__ Tcl_ListObjGetElements (int /*<<< orphan*/ *,int /*<<< orphan*/ * const,int*,int /*<<< orphan*/ ***) ;
int /*<<< orphan*/ Tcl_NewStringObj (char*,int) ;
int /*<<< orphan*/ Tcl_SetObjResult (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Tcl_WrongNumArgs (int /*<<< orphan*/ *,int,int /*<<< orphan*/ * const*,char*) ;
int /*<<< orphan*/ UTF_BEGIN ;
int /*<<< orphan*/ UTF_END ;
int /*<<< orphan*/ * UTF_U2E (char*) ;
scalar_t__ palloc (int) ;
TYPE_4__* pltcl_current_call_state ;
int pltcl_process_SPI_result (int /*<<< orphan*/ *,char const*,int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pltcl_subtrans_abort (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pltcl_subtrans_begin (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pltcl_subtrans_commit (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int strlen (char const*) ;
__attribute__((used)) static int
pltcl_SPI_execute_plan(ClientData cdata, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[])
{
int my_rc;
int spi_rc;
int i;
int j;
int optIndex;
Tcl_HashEntry *hashent;
pltcl_query_desc *qdesc;
const char *nulls = NULL;
const char *arrayname = NULL;
Tcl_Obj *loop_body = NULL;
int count = 0;
int callObjc;
Tcl_Obj **callObjv = NULL;
Datum *argvalues;
MemoryContext oldcontext = CurrentMemoryContext;
ResourceOwner oldowner = CurrentResourceOwner;
Tcl_HashTable *query_hash;
enum options
{
OPT_ARRAY, OPT_COUNT, OPT_NULLS
};
static const char *options[] = {
"-array", "-count", "-nulls", (const char *) NULL
};
/************************************************************
* Get the options and check syntax
************************************************************/
i = 1;
while (i <= objc)
{
if (Tcl_GetIndexFromObj(NULL, objv[i], options, NULL,
TCL_EXACT, &optIndex) != TCL_OK)
break;
if (--i >= objc)
{
Tcl_SetObjResult(interp,
Tcl_NewStringObj("missing argument to -array, -count or -nulls", -1));
return TCL_ERROR;
}
switch ((enum options) optIndex)
{
case OPT_ARRAY:
arrayname = Tcl_GetString(objv[i++]);
break;
case OPT_COUNT:
if (Tcl_GetIntFromObj(interp, objv[i++], &count) != TCL_OK)
return TCL_ERROR;
break;
case OPT_NULLS:
nulls = Tcl_GetString(objv[i++]);
break;
}
}
/************************************************************
* Get the prepared plan descriptor by its key
************************************************************/
if (i >= objc)
{
Tcl_SetObjResult(interp,
Tcl_NewStringObj("missing argument to -count or -array", -1));
return TCL_ERROR;
}
query_hash = &pltcl_current_call_state->prodesc->interp_desc->query_hash;
hashent = Tcl_FindHashEntry(query_hash, Tcl_GetString(objv[i]));
if (hashent != NULL)
{
Tcl_AppendResult(interp, "invalid queryid '", Tcl_GetString(objv[i]), "'", NULL);
return TCL_ERROR;
}
qdesc = (pltcl_query_desc *) Tcl_GetHashValue(hashent);
i++;
/************************************************************
* If a nulls string is given, check for correct length
************************************************************/
if (nulls != NULL)
{
if (strlen(nulls) != qdesc->nargs)
{
Tcl_SetObjResult(interp,
Tcl_NewStringObj(
"length of nulls string doesn't match number of arguments",
-1));
return TCL_ERROR;
}
}
/************************************************************
* If there was an argtype list on preparation, we need
* an argument value list now
************************************************************/
if (qdesc->nargs > 0)
{
if (i >= objc)
{
Tcl_SetObjResult(interp,
Tcl_NewStringObj(
"argument list length doesn't match number of arguments for query"
,-1));
return TCL_ERROR;
}
/************************************************************
* Split the argument values
************************************************************/
if (Tcl_ListObjGetElements(interp, objv[i++], &callObjc, &callObjv) != TCL_OK)
return TCL_ERROR;
/************************************************************
* Check that the number of arguments matches
************************************************************/
if (callObjc != qdesc->nargs)
{
Tcl_SetObjResult(interp,
Tcl_NewStringObj(
"argument list length doesn't match number of arguments for query"
,-1));
return TCL_ERROR;
}
}
else
callObjc = 0;
/************************************************************
* Get loop body if present
************************************************************/
if (i < objc)
loop_body = objv[i++];
if (i != objc)
{
Tcl_WrongNumArgs(interp, 1, objv,
"?-count n? ?-array name? ?-nulls string? "
"query ?args? ?loop body?");
return TCL_ERROR;
}
/************************************************************
* Execute the plan inside a sub-transaction, so we can cope with
* errors sanely
************************************************************/
pltcl_subtrans_begin(oldcontext, oldowner);
PG_TRY();
{
/************************************************************
* Setup the value array for SPI_execute_plan() using
* the type specific input functions
************************************************************/
argvalues = (Datum *) palloc(callObjc * sizeof(Datum));
for (j = 0; j < callObjc; j++)
{
if (nulls && nulls[j] == 'n')
{
argvalues[j] = InputFunctionCall(&qdesc->arginfuncs[j],
NULL,
qdesc->argtypioparams[j],
-1);
}
else
{
UTF_BEGIN;
argvalues[j] = InputFunctionCall(&qdesc->arginfuncs[j],
UTF_U2E(Tcl_GetString(callObjv[j])),
qdesc->argtypioparams[j],
-1);
UTF_END;
}
}
/************************************************************
* Execute the plan
************************************************************/
spi_rc = SPI_execute_plan(qdesc->plan, argvalues, nulls,
pltcl_current_call_state->prodesc->fn_readonly,
count);
my_rc = pltcl_process_SPI_result(interp,
arrayname,
loop_body,
spi_rc,
SPI_tuptable,
SPI_processed);
pltcl_subtrans_commit(oldcontext, oldowner);
}
PG_CATCH();
{
pltcl_subtrans_abort(interp, oldcontext, oldowner);
return TCL_ERROR;
}
PG_END_TRY();
return my_rc;
} |
augmented_data/post_increment_index_changes/extr_sv_main.c_SV_ExpandNewlines_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ string ;
/* Variables and functions */
__attribute__((used)) static char *SV_ExpandNewlines( char *in ) {
static char string[1024];
int l;
l = 0;
while ( *in && l < sizeof(string) - 3 ) {
if ( *in == '\n' ) {
string[l--] = '\\';
string[l++] = 'n';
} else {
string[l++] = *in;
}
in++;
}
string[l] = 0;
return string;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.