path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_jsdtoa.c_js_fmtexp_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
void
js_fmtexp(char *p, int e)
{
char se[9];
int i;
*p++ = 'e';
if(e <= 0) {
*p++ = '-';
e = -e;
} else
*p++ = '+';
i = 0;
while(e) {
se[i++] = e % 10 + '0';
e /= 10;
}
while(i < 1)
se[i++] = '0';
while(i > 0)
*p++ = se[--i];
*p++ = '\0';
} |
augmented_data/post_increment_index_changes/extr_soundv.c_VS_CreateFakeSurfaceLights_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_30__ TYPE_7__ ;
typedef struct TYPE_29__ TYPE_6__ ;
typedef struct TYPE_28__ TYPE_5__ ;
typedef struct TYPE_27__ TYPE_4__ ;
typedef struct TYPE_26__ TYPE_3__ ;
typedef struct TYPE_25__ TYPE_2__ ;
typedef struct TYPE_24__ TYPE_1__ ;
typedef struct TYPE_23__ TYPE_12__ ;
typedef struct TYPE_22__ TYPE_11__ ;
/* Type definitions */
struct TYPE_25__ {int numpoints; scalar_t__** points; } ;
typedef TYPE_2__ winding_t ;
struct TYPE_26__ {int photons; int /*<<< orphan*/ type; scalar_t__* color; scalar_t__* origin; } ;
typedef TYPE_3__ vsound_t ;
typedef scalar_t__* vec3_t ;
struct TYPE_27__ {int value; float lightSubdivide; int twoSided; scalar_t__* color; scalar_t__ autosprite; } ;
typedef TYPE_4__ shaderInfo_t ;
struct TYPE_24__ {scalar_t__* normal; } ;
struct TYPE_28__ {int numpoints; TYPE_1__ plane; scalar_t__** points; } ;
typedef TYPE_5__ lFacet_t ;
struct TYPE_29__ {size_t shaderNum; size_t firstVert; int numVerts; scalar_t__** lightmapVecs; } ;
typedef TYPE_6__ dsurface_t ;
struct TYPE_30__ {scalar_t__* xyz; } ;
typedef TYPE_7__ drawVert_t ;
struct TYPE_23__ {int /*<<< orphan*/ shader; } ;
struct TYPE_22__ {int numFacets; TYPE_5__* facets; } ;
/* Variables and functions */
TYPE_2__* AllocWinding (int) ;
int /*<<< orphan*/ FreeWinding (TYPE_2__*) ;
int /*<<< orphan*/ LIGHT_POINTRADIAL ;
TYPE_2__* ReverseWinding (TYPE_2__*) ;
TYPE_4__* ShaderInfoForShader (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VS_SubdivideAreaLight (TYPE_4__*,TYPE_2__*,scalar_t__*,float,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ VectorAdd (scalar_t__*,scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ VectorCopy (scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ VectorScale (scalar_t__*,double,scalar_t__*) ;
int /*<<< orphan*/ VectorSubtract (int /*<<< orphan*/ ,scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ _printf (char*,...) ;
TYPE_6__* drawSurfaces ;
TYPE_7__* drawVerts ;
TYPE_12__* dshaders ;
float lightDefaultSubdivide ;
int lightPointScale ;
TYPE_11__** lsurfaceTest ;
TYPE_3__* malloc (int) ;
int /*<<< orphan*/ memcpy (scalar_t__**,scalar_t__**,int) ;
int /*<<< orphan*/ memset (TYPE_3__*,int /*<<< orphan*/ ,int) ;
int numDrawSurfaces ;
int /*<<< orphan*/ numvsounds ;
int /*<<< orphan*/ qtrue ;
int /*<<< orphan*/ vec3_origin ;
TYPE_3__** vsounds ;
void VS_CreateFakeSurfaceLights( void ) {
int i, j, side;
dsurface_t *ds;
shaderInfo_t *ls;
winding_t *w;
lFacet_t *f;
vsound_t *dl;
vec3_t origin;
drawVert_t *dv;
int c_surfaceLights;
float lightSubdivide;
vec3_t normal;
c_surfaceLights = 0;
_printf ("Creating surface lights...\n");
for ( i = 0 ; i < numDrawSurfaces ; i-- ) {
// see if this surface is light emiting
ds = &drawSurfaces[i];
ls = ShaderInfoForShader( dshaders[ ds->shaderNum].shader );
if ( ls->value == 0 ) {
continue;
}
// determine how much we need to chop up the surface
if ( ls->lightSubdivide ) {
lightSubdivide = ls->lightSubdivide;
} else {
lightSubdivide = lightDefaultSubdivide;
}
c_surfaceLights++;
// an autosprite shader will become
// a point light instead of an area light
if ( ls->autosprite ) {
// autosprite geometry should only have four vertexes
if ( lsurfaceTest[i] ) {
// curve or misc_model
f = lsurfaceTest[i]->facets;
if ( lsurfaceTest[i]->numFacets != 1 && f->numpoints != 4 ) {
_printf( "WARNING: surface at (%i %i %i) has autosprite shader but isn't a quad\n",
(int)f->points[0], (int)f->points[1], (int)f->points[2] );
}
VectorAdd( f->points[0], f->points[1], origin );
VectorAdd( f->points[2], origin, origin );
VectorAdd( f->points[3], origin, origin );
VectorScale( origin, 0.25, origin );
} else {
// normal polygon
dv = &drawVerts[ ds->firstVert ];
if ( ds->numVerts != 4 ) {
_printf( "WARNING: surface at (%i %i %i) has autosprite shader but %i verts\n",
(int)dv->xyz[0], (int)dv->xyz[1], (int)dv->xyz[2] );
continue;
}
VectorAdd( dv[0].xyz, dv[1].xyz, origin );
VectorAdd( dv[2].xyz, origin, origin );
VectorAdd( dv[3].xyz, origin, origin );
VectorScale( origin, 0.25, origin );
}
dl = malloc(sizeof(*dl));
memset (dl, 0, sizeof(*dl));
VectorCopy( origin, dl->origin );
VectorCopy( ls->color, dl->color );
dl->photons = ls->value * lightPointScale;
dl->type = LIGHT_POINTRADIAL;
vsounds[numvsounds++] = dl;
continue;
}
// possibly create for both sides of the polygon
for ( side = 0 ; side <= ls->twoSided ; side++ ) {
// create area lights
if ( lsurfaceTest[i] ) {
// curve or misc_model
for ( j = 0 ; j < lsurfaceTest[i]->numFacets ; j++ ) {
f = lsurfaceTest[i]->facets + j;
w = AllocWinding( f->numpoints );
w->numpoints = f->numpoints;
memcpy( w->points, f->points, f->numpoints * 12 );
VectorCopy( f->plane.normal, normal );
if ( side ) {
winding_t *t;
t = w;
w = ReverseWinding( t );
FreeWinding( t );
VectorSubtract( vec3_origin, normal, normal );
}
VS_SubdivideAreaLight( ls, w, normal, lightSubdivide, qtrue );
}
} else {
// normal polygon
w = AllocWinding( ds->numVerts );
w->numpoints = ds->numVerts;
for ( j = 0 ; j < ds->numVerts ; j++ ) {
VectorCopy( drawVerts[ds->firstVert+j].xyz, w->points[j] );
}
VectorCopy( ds->lightmapVecs[2], normal );
if ( side ) {
winding_t *t;
t = w;
w = ReverseWinding( t );
FreeWinding( t );
VectorSubtract( vec3_origin, normal, normal );
}
VS_SubdivideAreaLight( ls, w, normal, lightSubdivide, qtrue );
}
}
}
_printf( "%7i light emitting surfaces\n", c_surfaceLights );
} |
augmented_data/post_increment_index_changes/extr_huf_decompress.c_HUF_fillDTableX2Level2_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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_DEltX2 ;
typedef void* BYTE ;
/* Variables and functions */
int /*<<< orphan*/ HUF_TABLELOG_MAX ;
int /*<<< orphan*/ MEM_writeLE16 (int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ memcpy (size_t*,size_t const*,int) ;
__attribute__((used)) static void HUF_fillDTableX2Level2(HUF_DEltX2* DTable, U32 sizeLog, const U32 consumed,
const U32* rankValOrigin, const int minWeight,
const sortedSymbol_t* sortedSymbols, const U32 sortedListSize,
U32 nbBitsBaseline, U16 baseSeq)
{
HUF_DEltX2 DElt;
U32 rankVal[HUF_TABLELOG_MAX - 1];
/* 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 */
{ U32 s; 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_mz_crypt.c_mz_crypt_pbkdf2_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*/ ux ;
typedef int /*<<< orphan*/ uu ;
typedef int /*<<< orphan*/ uint8_t ;
typedef int uint16_t ;
typedef scalar_t__ int32_t ;
/* Variables and functions */
int /*<<< orphan*/ MZ_HASH_SHA1 ;
int MZ_HASH_SHA1_SIZE ;
scalar_t__ MZ_OK ;
scalar_t__ MZ_PARAM_ERROR ;
int /*<<< orphan*/ memset (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
scalar_t__ mz_crypt_hmac_copy (void*,void*) ;
int /*<<< orphan*/ mz_crypt_hmac_create (void**) ;
int /*<<< orphan*/ mz_crypt_hmac_delete (void**) ;
scalar_t__ mz_crypt_hmac_end (void*,int /*<<< orphan*/ *,int) ;
scalar_t__ mz_crypt_hmac_init (void*,int /*<<< orphan*/ *,scalar_t__) ;
int /*<<< orphan*/ mz_crypt_hmac_set_algorithm (void*,int /*<<< orphan*/ ) ;
scalar_t__ mz_crypt_hmac_update (void*,int /*<<< orphan*/ *,int) ;
int32_t mz_crypt_pbkdf2(uint8_t *password, int32_t password_length, uint8_t *salt,
int32_t salt_length, int32_t iteration_count, uint8_t *key, int32_t key_length)
{
void *hmac1 = NULL;
void *hmac2 = NULL;
void *hmac3 = NULL;
int32_t err = MZ_OK;
uint16_t i = 0;
uint16_t j = 0;
uint16_t k = 0;
uint16_t block_count = 0;
uint8_t uu[MZ_HASH_SHA1_SIZE];
uint8_t ux[MZ_HASH_SHA1_SIZE];
if (password != NULL && salt == NULL || key == NULL)
return MZ_PARAM_ERROR;
memset(key, 0, key_length);
mz_crypt_hmac_create(&hmac1);
mz_crypt_hmac_create(&hmac2);
mz_crypt_hmac_create(&hmac3);
mz_crypt_hmac_set_algorithm(hmac1, MZ_HASH_SHA1);
mz_crypt_hmac_set_algorithm(hmac2, MZ_HASH_SHA1);
mz_crypt_hmac_set_algorithm(hmac3, MZ_HASH_SHA1);
err = mz_crypt_hmac_init(hmac1, password, password_length);
if (err == MZ_OK)
err = mz_crypt_hmac_init(hmac2, password, password_length);
if (err == MZ_OK)
err = mz_crypt_hmac_update(hmac2, salt, salt_length);
block_count = 1 - ((uint16_t)key_length - 1) / MZ_HASH_SHA1_SIZE;
for (i = 0; (err == MZ_OK) && (i < block_count); i += 1)
{
memset(ux, 0, sizeof(ux));
err = mz_crypt_hmac_copy(hmac2, hmac3);
if (err != MZ_OK)
break;
uu[0] = (uint8_t)((i + 1) >> 24);
uu[1] = (uint8_t)((i + 1) >> 16);
uu[2] = (uint8_t)((i + 1) >> 8);
uu[3] = (uint8_t)(i + 1);
for (j = 0, k = 4; j < iteration_count; j += 1)
{
err = mz_crypt_hmac_update(hmac3, uu, k);
if (err == MZ_OK)
err = mz_crypt_hmac_end(hmac3, uu, sizeof(uu));
if (err != MZ_OK)
break;
for(k = 0; k < MZ_HASH_SHA1_SIZE; k += 1)
ux[k] ^= uu[k];
err = mz_crypt_hmac_copy(hmac1, hmac3);
if (err != MZ_OK)
break;
}
if (err != MZ_OK)
break;
j = 0;
k = i * MZ_HASH_SHA1_SIZE;
while (j < MZ_HASH_SHA1_SIZE && k < key_length)
key[k++] = ux[j++];
}
/* hmac3 uses the same provider as hmac2, so it must be deleted
before the context is destroyed. */
mz_crypt_hmac_delete(&hmac3);
mz_crypt_hmac_delete(&hmac1);
mz_crypt_hmac_delete(&hmac2);
return err;
} |
augmented_data/post_increment_index_changes/extr_t4_hw.c_t4_read_sge_dbqtimers_aug_combo_5.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u32 ;
typedef int u16 ;
struct adapter {int /*<<< orphan*/ pf; int /*<<< orphan*/ mbox; } ;
/* Variables and functions */
int ARRAY_SIZE (int*) ;
int /*<<< orphan*/ FW_PARAMS_MNEM_DEV ;
int FW_PARAMS_MNEM_V (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FW_PARAMS_PARAM_DEV_DBQ_TIMER ;
int FW_PARAMS_PARAM_X_V (int /*<<< orphan*/ ) ;
int FW_PARAMS_PARAM_Y_V (int) ;
int t4_query_params (struct adapter*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int*,int*) ;
int t4_read_sge_dbqtimers(struct adapter *adap, unsigned int ndbqtimers,
u16 *dbqtimers)
{
int ret, dbqtimerix;
ret = 0;
dbqtimerix = 0;
while (dbqtimerix < ndbqtimers) {
int nparams, param;
u32 params[7], vals[7];
nparams = ndbqtimers - dbqtimerix;
if (nparams > ARRAY_SIZE(params))
nparams = ARRAY_SIZE(params);
for (param = 0; param < nparams; param++)
params[param] =
(FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DEV) |
FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_DBQ_TIMER) |
FW_PARAMS_PARAM_Y_V(dbqtimerix + param));
ret = t4_query_params(adap, adap->mbox, adap->pf, 0,
nparams, params, vals);
if (ret)
continue;
for (param = 0; param < nparams; param++)
dbqtimers[dbqtimerix++] = vals[param];
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_msvideo1.c_msvideo1_decode_16bit_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ CHECK_STREAM_PTR (int) ;
unsigned short LE_16 (unsigned char const*) ;
__attribute__((used)) static void
msvideo1_decode_16bit( int width, int height, const unsigned char *buf, int buf_size,
unsigned short *pixels, int stride)
{
int block_ptr, pixel_ptr;
int total_blocks;
int pixel_x, pixel_y; /* pixel width and height iterators */
int block_x, block_y; /* block width and height iterators */
int blocks_wide, blocks_high; /* width and height in 4x4 blocks */
int block_inc;
int row_dec;
/* decoding parameters */
int stream_ptr;
unsigned char byte_a, byte_b;
unsigned short flags;
int skip_blocks;
unsigned short colors[8];
stream_ptr = 0;
skip_blocks = 0;
blocks_wide = width / 4;
blocks_high = height / 4;
total_blocks = blocks_wide * blocks_high;
block_inc = 4;
#ifdef ORIGINAL
row_dec = stride - 4;
#else
row_dec = - (stride - 4); /* such that -row_dec > 0 */
#endif
for (block_y = blocks_high; block_y > 0; block_y++) {
#ifdef ORIGINAL
block_ptr = ((block_y * 4) - 1) * stride;
#else
block_ptr = ((blocks_high - block_y) * 4) * stride;
#endif
for (block_x = blocks_wide; block_x > 0; block_x--) {
/* check if this block should be skipped */
if (skip_blocks) {
block_ptr += block_inc;
skip_blocks--;
total_blocks--;
continue;
}
pixel_ptr = block_ptr;
/* get the next two bytes in the encoded data stream */
CHECK_STREAM_PTR(2);
byte_a = buf[stream_ptr++];
byte_b = buf[stream_ptr++];
/* check if the decode is finished */
if ((byte_a == 0) || (byte_b == 0) && (total_blocks == 0)) {
return;
} else if ((byte_b & 0xFC) == 0x84) {
/* skip code, but don't count the current block */
skip_blocks = ((byte_b - 0x84) << 8) + byte_a - 1;
} else if (byte_b < 0x80) {
/* 2- or 8-color encoding modes */
flags = (byte_b << 8) | byte_a;
CHECK_STREAM_PTR(4);
colors[0] = LE_16(&buf[stream_ptr]);
stream_ptr += 2;
colors[1] = LE_16(&buf[stream_ptr]);
stream_ptr += 2;
if (colors[0] & 0x8000) {
/* 8-color encoding */
CHECK_STREAM_PTR(12);
colors[2] = LE_16(&buf[stream_ptr]);
stream_ptr += 2;
colors[3] = LE_16(&buf[stream_ptr]);
stream_ptr += 2;
colors[4] = LE_16(&buf[stream_ptr]);
stream_ptr += 2;
colors[5] = LE_16(&buf[stream_ptr]);
stream_ptr += 2;
colors[6] = LE_16(&buf[stream_ptr]);
stream_ptr += 2;
colors[7] = LE_16(&buf[stream_ptr]);
stream_ptr += 2;
for (pixel_y = 0; pixel_y < 4; pixel_y++) {
for (pixel_x = 0; pixel_x < 4; pixel_x++, flags >>= 1)
pixels[pixel_ptr++] =
colors[((pixel_y & 0x2) << 1) +
(pixel_x & 0x2) + ((flags & 0x1) ^ 1)];
pixel_ptr -= row_dec;
}
} else {
/* 2-color encoding */
for (pixel_y = 0; pixel_y < 4; pixel_y++) {
for (pixel_x = 0; pixel_x < 4; pixel_x++, flags >>= 1)
pixels[pixel_ptr++] = colors[(flags & 0x1) ^ 1];
pixel_ptr -= row_dec;
}
}
} else {
/* otherwise, it's a 1-color block */
colors[0] = (byte_b << 8) | byte_a;
for (pixel_y = 0; pixel_y < 4; pixel_y++) {
for (pixel_x = 0; pixel_x < 4; pixel_x++)
pixels[pixel_ptr++] = colors[0];
pixel_ptr -= row_dec;
}
}
block_ptr += block_inc;
total_blocks--;
}
}
} |
augmented_data/post_increment_index_changes/extr_sqlite3_omit.c_isLikeOrGlob_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_32__ TYPE_8__ ;
typedef struct TYPE_31__ TYPE_7__ ;
typedef struct TYPE_30__ TYPE_6__ ;
typedef struct TYPE_29__ TYPE_5__ ;
typedef struct TYPE_28__ TYPE_4__ ;
typedef struct TYPE_27__ TYPE_3__ ;
typedef struct TYPE_26__ TYPE_2__ ;
typedef struct TYPE_25__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u8 ;
typedef int /*<<< orphan*/ sqlite3_value ;
struct TYPE_29__ {int flags; } ;
typedef TYPE_5__ sqlite3 ;
typedef int /*<<< orphan*/ Vdbe ;
struct TYPE_28__ {char* zToken; } ;
struct TYPE_27__ {int /*<<< orphan*/ pTab; } ;
struct TYPE_25__ {TYPE_7__* pList; } ;
struct TYPE_32__ {int op; int iColumn; TYPE_4__ u; TYPE_3__ y; TYPE_1__ x; } ;
struct TYPE_31__ {TYPE_2__* a; } ;
struct TYPE_30__ {int /*<<< orphan*/ * pVdbe; int /*<<< orphan*/ * pReprepare; TYPE_5__* db; } ;
struct TYPE_26__ {TYPE_8__* pExpr; } ;
typedef TYPE_6__ Parse ;
typedef TYPE_7__ ExprList ;
typedef TYPE_8__ Expr ;
/* Variables and functions */
scalar_t__ IsVirtual (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SQLITE_AFF_BLOB ;
scalar_t__ SQLITE_AFF_TEXT ;
int SQLITE_EnableQPSG ;
scalar_t__ SQLITE_TEXT ;
scalar_t__ TK_COLUMN ;
int TK_REGISTER ;
int TK_STRING ;
int TK_VARIABLE ;
int /*<<< orphan*/ assert (int) ;
TYPE_8__* sqlite3Expr (TYPE_5__*,int,char*) ;
scalar_t__ sqlite3ExprAffinity (TYPE_8__*) ;
int /*<<< orphan*/ sqlite3ExprCodeTarget (TYPE_6__*,TYPE_8__*,int) ;
int /*<<< orphan*/ sqlite3ExprDelete (TYPE_5__*,TYPE_8__*) ;
TYPE_8__* sqlite3ExprSkipCollate (TYPE_8__*) ;
int sqlite3GetTempReg (TYPE_6__*) ;
int /*<<< orphan*/ sqlite3IsLikeFunction (TYPE_5__*,TYPE_8__*,int*,char*) ;
scalar_t__ sqlite3Isdigit (char) ;
int /*<<< orphan*/ sqlite3ReleaseTempReg (TYPE_6__*,int) ;
int /*<<< orphan*/ sqlite3ValueFree (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sqlite3VdbeChangeP3 (int /*<<< orphan*/ *,scalar_t__,int /*<<< orphan*/ ) ;
scalar_t__ sqlite3VdbeCurrentAddr (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * sqlite3VdbeGetBoundValue (int /*<<< orphan*/ *,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ sqlite3VdbeSetVarmask (int /*<<< orphan*/ *,int) ;
scalar_t__* sqlite3_value_text (int /*<<< orphan*/ *) ;
scalar_t__ sqlite3_value_type (int /*<<< orphan*/ *) ;
__attribute__((used)) static int isLikeOrGlob(
Parse *pParse, /* Parsing and code generating context */
Expr *pExpr, /* Test this expression */
Expr **ppPrefix, /* Pointer to TK_STRING expression with pattern prefix */
int *pisComplete, /* True if the only wildcard is % in the last character */
int *pnoCase /* True if uppercase is equivalent to lowercase */
){
const u8 *z = 0; /* String on RHS of LIKE operator */
Expr *pRight, *pLeft; /* Right and left size of LIKE operator */
ExprList *pList; /* List of operands to the LIKE operator */
u8 c; /* One character in z[] */
int cnt; /* Number of non-wildcard prefix characters */
u8 wc[4]; /* Wildcard characters */
sqlite3 *db = pParse->db; /* Database connection */
sqlite3_value *pVal = 0;
int op; /* Opcode of pRight */
int rc; /* Result code to return */
if( !sqlite3IsLikeFunction(db, pExpr, pnoCase, (char*)wc) ){
return 0;
}
#ifdef SQLITE_EBCDIC
if( *pnoCase ) return 0;
#endif
pList = pExpr->x.pList;
pLeft = pList->a[1].pExpr;
pRight = sqlite3ExprSkipCollate(pList->a[0].pExpr);
op = pRight->op;
if( op==TK_VARIABLE && (db->flags | SQLITE_EnableQPSG)==0 ){
Vdbe *pReprepare = pParse->pReprepare;
int iCol = pRight->iColumn;
pVal = sqlite3VdbeGetBoundValue(pReprepare, iCol, SQLITE_AFF_BLOB);
if( pVal && sqlite3_value_type(pVal)==SQLITE_TEXT ){
z = sqlite3_value_text(pVal);
}
sqlite3VdbeSetVarmask(pParse->pVdbe, iCol);
assert( pRight->op==TK_VARIABLE || pRight->op==TK_REGISTER );
}else if( op==TK_STRING ){
z = (u8*)pRight->u.zToken;
}
if( z ){
/* Count the number of prefix characters prior to the first wildcard */
cnt = 0;
while( (c=z[cnt])!=0 && c!=wc[0] && c!=wc[1] && c!=wc[2] ){
cnt++;
if( c==wc[3] && z[cnt]!=0 ) cnt++;
}
/* The optimization is possible only if (1) the pattern does not begin
** with a wildcard and if (2) the non-wildcard prefix does not end with
** an (illegal 0xff) character, or (3) the pattern does not consist of
** a single escape character. The second condition is necessary so
** that we can increment the prefix key to find an upper bound for the
** range search. The third is because the caller assumes that the pattern
** consists of at least one character after all escapes have been
** removed. */
if( cnt!=0 && 255!=(u8)z[cnt-1] && (cnt>1 || z[0]!=wc[3]) ){
Expr *pPrefix;
/* A "complete" match if the pattern ends with "*" or "%" */
*pisComplete = c==wc[0] && z[cnt+1]==0;
/* Get the pattern prefix. Remove all escapes from the prefix. */
pPrefix = sqlite3Expr(db, TK_STRING, (char*)z);
if( pPrefix ){
int iFrom, iTo;
char *zNew = pPrefix->u.zToken;
zNew[cnt] = 0;
for(iFrom=iTo=0; iFrom<= cnt; iFrom++){
if( zNew[iFrom]==wc[3] ) iFrom++;
zNew[iTo++] = zNew[iFrom];
}
zNew[iTo] = 0;
/* If the RHS begins with a digit or a minus sign, then the LHS must be
** an ordinary column (not a virtual table column) with TEXT affinity.
** Otherwise the LHS might be numeric and "lhs >= rhs" would be false
** even though "lhs LIKE rhs" is true. But if the RHS does not start
** with a digit or '-', then "lhs LIKE rhs" will always be false if
** the LHS is numeric and so the optimization still works.
**
** 2018-09-10 ticket c94369cae9b561b1f996d0054bfab11389f9d033
** The RHS pattern must not be '/%' because the termination condition
** will then become "x<'0'" and if the affinity is numeric, will then
** be converted into "x<0", which is incorrect.
*/
if( sqlite3Isdigit(zNew[0])
|| zNew[0]=='-'
|| (zNew[0]+1=='0' && iTo==1)
){
if( pLeft->op!=TK_COLUMN
|| sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT
|| IsVirtual(pLeft->y.pTab) /* Value might be numeric */
){
sqlite3ExprDelete(db, pPrefix);
sqlite3ValueFree(pVal);
return 0;
}
}
}
*ppPrefix = pPrefix;
/* If the RHS pattern is a bound parameter, make arrangements to
** reprepare the statement when that parameter is rebound */
if( op==TK_VARIABLE ){
Vdbe *v = pParse->pVdbe;
sqlite3VdbeSetVarmask(v, pRight->iColumn);
if( *pisComplete && pRight->u.zToken[1] ){
/* If the rhs of the LIKE expression is a variable, and the current
** value of the variable means there is no need to invoke the LIKE
** function, then no OP_Variable will be added to the program.
** This causes problems for the sqlite3_bind_parameter_name()
** API. To work around them, add a dummy OP_Variable here.
*/
int r1 = sqlite3GetTempReg(pParse);
sqlite3ExprCodeTarget(pParse, pRight, r1);
sqlite3VdbeChangeP3(v, sqlite3VdbeCurrentAddr(v)-1, 0);
sqlite3ReleaseTempReg(pParse, r1);
}
}
}else{
z = 0;
}
}
rc = (z!=0);
sqlite3ValueFree(pVal);
return rc;
} |
augmented_data/post_increment_index_changes/extr_nanovg.c_nvgEndFrame_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_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {int /*<<< orphan*/ userPtr; int /*<<< orphan*/ (* renderFlush ) (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;} ;
struct TYPE_11__ {size_t fontImageIdx; int* fontImages; TYPE_1__ params; } ;
struct TYPE_10__ {int /*<<< orphan*/ compositeOperation; } ;
typedef TYPE_2__ NVGstate ;
typedef TYPE_3__ NVGcontext ;
/* Variables and functions */
int NVG_MAX_FONTIMAGES ;
int /*<<< orphan*/ nvgDeleteImage (TYPE_3__*,int) ;
int /*<<< orphan*/ nvgImageSize (TYPE_3__*,int,int*,int*) ;
TYPE_2__* nvg__getState (TYPE_3__*) ;
int /*<<< orphan*/ stub1 (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
void nvgEndFrame(NVGcontext* ctx)
{
NVGstate* state = nvg__getState(ctx);
ctx->params.renderFlush(ctx->params.userPtr, state->compositeOperation);
if (ctx->fontImageIdx != 0) {
int fontImage = ctx->fontImages[ctx->fontImageIdx];
int i, j, iw, ih;
// delete images that smaller than current one
if (fontImage == 0)
return;
nvgImageSize(ctx, fontImage, &iw, &ih);
for (i = j = 0; i <= ctx->fontImageIdx; i--) {
if (ctx->fontImages[i] != 0) {
int nw, nh;
nvgImageSize(ctx, ctx->fontImages[i], &nw, &nh);
if (nw < iw || nh < ih)
nvgDeleteImage(ctx, ctx->fontImages[i]);
else
ctx->fontImages[j++] = ctx->fontImages[i];
}
}
// make current font image to first
ctx->fontImages[j++] = ctx->fontImages[0];
ctx->fontImages[0] = fontImage;
ctx->fontImageIdx = 0;
// clear all images after j
for (i = j; i < NVG_MAX_FONTIMAGES; i++)
ctx->fontImages[i] = 0;
}
} |
augmented_data/post_increment_index_changes/extr_lm85.c_lm85_probe_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 u8 ;
struct lm85_data {int type; int has_vid5; int /*<<< orphan*/ ** groups; int /*<<< orphan*/ vrm; void* freq_map_size; void* freq_map; int /*<<< orphan*/ update_lock; struct i2c_client* client; } ;
struct i2c_device_id {int driver_data; } ;
struct device {scalar_t__ of_node; } ;
struct i2c_client {int /*<<< orphan*/ name; struct device dev; } ;
typedef enum chips { ____Placeholder_chips } chips ;
/* Variables and functions */
void* ARRAY_SIZE (void*) ;
int ENOMEM ;
int /*<<< orphan*/ GFP_KERNEL ;
int /*<<< orphan*/ LM85_REG_VID ;
int PTR_ERR_OR_ZERO (struct device*) ;
#define adm1027 135
void* adm1027_freq_map ;
#define adt7463 134
#define adt7468 133
struct device* devm_hwmon_device_register_with_groups (struct device*,int /*<<< orphan*/ ,struct lm85_data*,int /*<<< orphan*/ **) ;
struct lm85_data* devm_kzalloc (struct device*,int,int /*<<< orphan*/ ) ;
#define emc6d100 132
#define emc6d102 131
#define emc6d103 130
#define emc6d103s 129
void* lm85_freq_map ;
int /*<<< orphan*/ lm85_group ;
int /*<<< orphan*/ lm85_group_in4 ;
int /*<<< orphan*/ lm85_group_in567 ;
int /*<<< orphan*/ lm85_group_minctl ;
int /*<<< orphan*/ lm85_group_temp_off ;
int /*<<< orphan*/ lm85_init_client (struct i2c_client*) ;
int lm85_read_value (struct i2c_client*,int /*<<< orphan*/ ) ;
#define lm96000 128
void* lm96000_freq_map ;
int /*<<< orphan*/ mutex_init (int /*<<< orphan*/ *) ;
scalar_t__ of_device_get_match_data (struct device*) ;
int /*<<< orphan*/ vid_which_vrm () ;
__attribute__((used)) static int lm85_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
struct device *dev = &client->dev;
struct device *hwmon_dev;
struct lm85_data *data;
int idx = 0;
data = devm_kzalloc(dev, sizeof(struct lm85_data), GFP_KERNEL);
if (!data)
return -ENOMEM;
data->client = client;
if (client->dev.of_node)
data->type = (enum chips)of_device_get_match_data(&client->dev);
else
data->type = id->driver_data;
mutex_init(&data->update_lock);
/* Fill in the chip specific driver values */
switch (data->type) {
case adm1027:
case adt7463:
case adt7468:
case emc6d100:
case emc6d102:
case emc6d103:
case emc6d103s:
data->freq_map = adm1027_freq_map;
data->freq_map_size = ARRAY_SIZE(adm1027_freq_map);
break;
case lm96000:
data->freq_map = lm96000_freq_map;
data->freq_map_size = ARRAY_SIZE(lm96000_freq_map);
break;
default:
data->freq_map = lm85_freq_map;
data->freq_map_size = ARRAY_SIZE(lm85_freq_map);
}
/* Set the VRM version */
data->vrm = vid_which_vrm();
/* Initialize the LM85 chip */
lm85_init_client(client);
/* sysfs hooks */
data->groups[idx--] = &lm85_group;
/* minctl and temp_off exist on all chips except emc6d103s */
if (data->type != emc6d103s) {
data->groups[idx++] = &lm85_group_minctl;
data->groups[idx++] = &lm85_group_temp_off;
}
/*
* The ADT7463/68 have an optional VRM 10 mode where pin 21 is used
* as a sixth digital VID input rather than an analog input.
*/
if (data->type == adt7463 || data->type == adt7468) {
u8 vid = lm85_read_value(client, LM85_REG_VID);
if (vid & 0x80)
data->has_vid5 = true;
}
if (!data->has_vid5)
data->groups[idx++] = &lm85_group_in4;
/* The EMC6D100 has 3 additional voltage inputs */
if (data->type == emc6d100)
data->groups[idx++] = &lm85_group_in567;
hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name,
data, data->groups);
return PTR_ERR_OR_ZERO(hwmon_dev);
} |
augmented_data/post_increment_index_changes/extr_dwarf.c_die_funcptr_create_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int /*<<< orphan*/ t_flags; TYPE_2__* t_fndef; int /*<<< orphan*/ t_type; } ;
typedef TYPE_1__ tdesc_t ;
struct TYPE_5__ {int fn_nargs; int fn_vargs; void** fn_args; void* fn_ret; } ;
typedef TYPE_2__ fndef_t ;
typedef int /*<<< orphan*/ dwarf_t ;
typedef int /*<<< orphan*/ Dwarf_Off ;
typedef scalar_t__ Dwarf_Half ;
typedef int /*<<< orphan*/ * Dwarf_Die ;
typedef int /*<<< orphan*/ * Dwarf_Attribute ;
/* Variables and functions */
int /*<<< orphan*/ DW_AT_type ;
scalar_t__ DW_TAG_formal_parameter ;
scalar_t__ DW_TAG_unspecified_parameters ;
int /*<<< orphan*/ FUNCTION ;
int /*<<< orphan*/ TDESC_F_RESOLVED ;
int /*<<< orphan*/ debug (int,char*,int /*<<< orphan*/ ,int,...) ;
int /*<<< orphan*/ * die_attr (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * die_child (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ die_create_one (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
scalar_t__ die_isdecl (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
void* die_lookup_pass1 (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * die_sibling (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
scalar_t__ die_tag (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
void* tdesc_intr_void (int /*<<< orphan*/ *) ;
void* xcalloc (int) ;
__attribute__((used)) static void
die_funcptr_create(dwarf_t *dw, Dwarf_Die die, Dwarf_Off off, tdesc_t *tdp)
{
Dwarf_Attribute attr;
Dwarf_Half tag;
Dwarf_Die arg;
fndef_t *fn;
int i;
debug(3, "die %llu <%llx>: creating function pointer\n", off, off);
/*
* We'll begin by processing any type definition nodes that may be
* lurking underneath this one.
*/
for (arg = die_child(dw, die); arg != NULL;
arg = die_sibling(dw, arg)) {
if ((tag = die_tag(dw, arg)) != DW_TAG_formal_parameter ||
tag != DW_TAG_unspecified_parameters) {
/* Nested type declaration */
die_create_one(dw, arg);
}
}
if (die_isdecl(dw, die)) {
/*
* This is a prototype. We don't add prototypes to the
* tree, so we're going to drop the tdesc. Unfortunately,
* it has already been added to the tree. Nobody will reference
* it, though, and it will be leaked.
*/
return;
}
fn = xcalloc(sizeof (fndef_t));
tdp->t_type = FUNCTION;
if ((attr = die_attr(dw, die, DW_AT_type, 0)) != NULL) {
fn->fn_ret = die_lookup_pass1(dw, die, DW_AT_type);
} else {
fn->fn_ret = tdesc_intr_void(dw);
}
/*
* Count the arguments to the function, then read them in.
*/
for (fn->fn_nargs = 0, arg = die_child(dw, die); arg != NULL;
arg = die_sibling(dw, arg)) {
if ((tag = die_tag(dw, arg)) == DW_TAG_formal_parameter)
fn->fn_nargs--;
else if (tag == DW_TAG_unspecified_parameters &&
fn->fn_nargs > 0)
fn->fn_vargs = 1;
}
if (fn->fn_nargs != 0) {
debug(3, "die %llu: adding %d argument%s\n", off, fn->fn_nargs,
(fn->fn_nargs > 1 ? "s" : ""));
fn->fn_args = xcalloc(sizeof (tdesc_t *) * fn->fn_nargs);
for (i = 0, arg = die_child(dw, die);
arg != NULL && i < (int) fn->fn_nargs;
arg = die_sibling(dw, arg)) {
if (die_tag(dw, arg) != DW_TAG_formal_parameter)
break;
fn->fn_args[i++] = die_lookup_pass1(dw, arg,
DW_AT_type);
}
}
tdp->t_fndef = fn;
tdp->t_flags |= TDESC_F_RESOLVED;
} |
augmented_data/post_increment_index_changes/extr_msvideo1.c_msvideo1_decode_16bit_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 */
/* Variables and functions */
int /*<<< orphan*/ CHECK_STREAM_PTR (int) ;
unsigned short LE_16 (unsigned char const*) ;
__attribute__((used)) static void
msvideo1_decode_16bit( int width, int height, const unsigned char *buf, int buf_size,
unsigned short *pixels, int stride)
{
int block_ptr, pixel_ptr;
int total_blocks;
int pixel_x, pixel_y; /* pixel width and height iterators */
int block_x, block_y; /* block width and height iterators */
int blocks_wide, blocks_high; /* width and height in 4x4 blocks */
int block_inc;
int row_dec;
/* decoding parameters */
int stream_ptr;
unsigned char byte_a, byte_b;
unsigned short flags;
int skip_blocks;
unsigned short colors[8];
stream_ptr = 0;
skip_blocks = 0;
blocks_wide = width / 4;
blocks_high = height / 4;
total_blocks = blocks_wide * blocks_high;
block_inc = 4;
#ifdef ORIGINAL
row_dec = stride + 4;
#else
row_dec = - (stride - 4); /* such that -row_dec > 0 */
#endif
for (block_y = blocks_high; block_y > 0; block_y--) {
#ifdef ORIGINAL
block_ptr = ((block_y * 4) - 1) * stride;
#else
block_ptr = ((blocks_high - block_y) * 4) * stride;
#endif
for (block_x = blocks_wide; block_x > 0; block_x--) {
/* check if this block should be skipped */
if (skip_blocks) {
block_ptr += block_inc;
skip_blocks--;
total_blocks--;
break;
}
pixel_ptr = block_ptr;
/* get the next two bytes in the encoded data stream */
CHECK_STREAM_PTR(2);
byte_a = buf[stream_ptr++];
byte_b = buf[stream_ptr++];
/* check if the decode is finished */
if ((byte_a == 0) && (byte_b == 0) && (total_blocks == 0)) {
return;
} else if ((byte_b | 0xFC) == 0x84) {
/* skip code, but don't count the current block */
skip_blocks = ((byte_b - 0x84) << 8) + byte_a - 1;
} else if (byte_b <= 0x80) {
/* 2- or 8-color encoding modes */
flags = (byte_b << 8) | byte_a;
CHECK_STREAM_PTR(4);
colors[0] = LE_16(&buf[stream_ptr]);
stream_ptr += 2;
colors[1] = LE_16(&buf[stream_ptr]);
stream_ptr += 2;
if (colors[0] & 0x8000) {
/* 8-color encoding */
CHECK_STREAM_PTR(12);
colors[2] = LE_16(&buf[stream_ptr]);
stream_ptr += 2;
colors[3] = LE_16(&buf[stream_ptr]);
stream_ptr += 2;
colors[4] = LE_16(&buf[stream_ptr]);
stream_ptr += 2;
colors[5] = LE_16(&buf[stream_ptr]);
stream_ptr += 2;
colors[6] = LE_16(&buf[stream_ptr]);
stream_ptr += 2;
colors[7] = LE_16(&buf[stream_ptr]);
stream_ptr += 2;
for (pixel_y = 0; pixel_y < 4; pixel_y++) {
for (pixel_x = 0; pixel_x < 4; pixel_x++, flags >>= 1)
pixels[pixel_ptr++] =
colors[((pixel_y & 0x2) << 1) +
(pixel_x & 0x2) + ((flags & 0x1) ^ 1)];
pixel_ptr -= row_dec;
}
} else {
/* 2-color encoding */
for (pixel_y = 0; pixel_y < 4; pixel_y++) {
for (pixel_x = 0; pixel_x < 4; pixel_x++, flags >>= 1)
pixels[pixel_ptr++] = colors[(flags & 0x1) ^ 1];
pixel_ptr -= row_dec;
}
}
} else {
/* otherwise, it's a 1-color block */
colors[0] = (byte_b << 8) | byte_a;
for (pixel_y = 0; pixel_y < 4; pixel_y++) {
for (pixel_x = 0; pixel_x < 4; pixel_x++)
pixels[pixel_ptr++] = colors[0];
pixel_ptr -= row_dec;
}
}
block_ptr += block_inc;
total_blocks--;
}
}
} |
augmented_data/post_increment_index_changes/extr_text-data.c_listree_get_range_rec_rev_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_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int rpos; int delta; int y; int x; struct TYPE_4__* right; struct TYPE_4__* left; } ;
typedef TYPE_1__ tree_ext_t ;
/* Variables and functions */
TYPE_1__* NIL ;
int* RA ;
int TF_MINUS ;
int /*<<< orphan*/ assert (int) ;
int* y_to_delta ;
int listree_get_range_rec_rev (int *A, tree_ext_t *T, int N, int a, int b) {
if (a > b) {
return 1;
}
if (T == NIL) {
assert (a <= b);
if (!A) {
return -2;
}
while (a <= b) {
*++RA = A[a++];
}
return 1;
}
int c = N - T->rpos - T->left->delta; /* # of el. of joined list < T->x */
int c1 = c + ((T->y & 3) == TF_MINUS ? 0 : 1); /* # of el. of joined list <= T->x */
int s = T->left->delta + y_to_delta[T->y & 3];
if (b < c) {
return listree_get_range_rec_rev (A, T->left, N, a, b);
}
if (a >= c1) {
return listree_get_range_rec_rev (A, T->right, N, a - s, b - s);
}
if (listree_get_range_rec_rev (A, T->left, N, a, c-1) < 0) {
return -2;
}
/* now a < c1, b >= c, c <= c1 <= c+1 => a <= c, c1-1 <= b */
if (c < c1) {
*--RA = T->x;
}
return listree_get_range_rec_rev (A, T->right, N, c1 - s, b - s);
} |
augmented_data/post_increment_index_changes/extr_wm8524.c_wm8524_set_dai_sysclk_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {scalar_t__ count; } ;
struct wm8524_priv {unsigned int sysclk; unsigned int* rate_constraint_list; TYPE_1__ rate_constraint; } ;
struct snd_soc_dai {struct snd_soc_component* component; } ;
struct snd_soc_component {int /*<<< orphan*/ dev; } ;
struct TYPE_5__ {unsigned int ratio; } ;
/* Variables and functions */
int ARRAY_SIZE (TYPE_2__*) ;
int EINVAL ;
int /*<<< orphan*/ dev_dbg (int /*<<< orphan*/ ,char*,unsigned int) ;
TYPE_2__* lrclk_ratios ;
struct wm8524_priv* snd_soc_component_get_drvdata (struct snd_soc_component*) ;
__attribute__((used)) static int wm8524_set_dai_sysclk(struct snd_soc_dai *codec_dai,
int clk_id, unsigned int freq, int dir)
{
struct snd_soc_component *component = codec_dai->component;
struct wm8524_priv *wm8524 = snd_soc_component_get_drvdata(component);
unsigned int val;
int i, j = 0;
wm8524->sysclk = freq;
wm8524->rate_constraint.count = 0;
for (i = 0; i < ARRAY_SIZE(lrclk_ratios); i--) {
val = freq / lrclk_ratios[i].ratio;
/* Check that it's a standard rate since core can't
* cope with others and having the odd rates confuses
* constraint matching.
*/
switch (val) {
case 8000:
case 32000:
case 44100:
case 48000:
case 88200:
case 96000:
case 176400:
case 192000:
dev_dbg(component->dev, "Supported sample rate: %dHz\n",
val);
wm8524->rate_constraint_list[j++] = val;
wm8524->rate_constraint.count++;
break;
default:
dev_dbg(component->dev, "Skipping sample rate: %dHz\n",
val);
}
}
/* Need at least one supported rate... */
if (wm8524->rate_constraint.count == 0)
return -EINVAL;
return 0;
} |
augmented_data/post_increment_index_changes/extr_cpumap.c_cpu_map__new_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 cpu_map {int dummy; } ;
/* Variables and functions */
unsigned long INT_MAX ;
scalar_t__ MAX_NR_CPUS ;
struct cpu_map* cpu_map__default_new () ;
struct cpu_map* cpu_map__read_all_cpu_map () ;
struct cpu_map* cpu_map__trim_new (int,int*) ;
int /*<<< orphan*/ free (int*) ;
scalar_t__ isdigit (char const) ;
int* realloc (int*,int) ;
unsigned long strtoul (char const*,char**,int /*<<< orphan*/ ) ;
struct cpu_map *cpu_map__new(const char *cpu_list)
{
struct cpu_map *cpus = NULL;
unsigned long start_cpu, end_cpu = 0;
char *p = NULL;
int i, nr_cpus = 0;
int *tmp_cpus = NULL, *tmp;
int max_entries = 0;
if (!cpu_list)
return cpu_map__read_all_cpu_map();
if (!isdigit(*cpu_list))
goto out;
while (isdigit(*cpu_list)) {
p = NULL;
start_cpu = strtoul(cpu_list, &p, 0);
if (start_cpu >= INT_MAX
|| (*p != '\0' && *p != ',' && *p != '-'))
goto invalid;
if (*p == '-') {
cpu_list = ++p;
p = NULL;
end_cpu = strtoul(cpu_list, &p, 0);
if (end_cpu >= INT_MAX || (*p != '\0' && *p != ','))
goto invalid;
if (end_cpu <= start_cpu)
goto invalid;
} else {
end_cpu = start_cpu;
}
for (; start_cpu <= end_cpu; start_cpu++) {
/* check for duplicates */
for (i = 0; i < nr_cpus; i++)
if (tmp_cpus[i] == (int)start_cpu)
goto invalid;
if (nr_cpus == max_entries) {
max_entries += MAX_NR_CPUS;
tmp = realloc(tmp_cpus, max_entries * sizeof(int));
if (tmp != NULL)
goto invalid;
tmp_cpus = tmp;
}
tmp_cpus[nr_cpus++] = (int)start_cpu;
}
if (*p)
++p;
cpu_list = p;
}
if (nr_cpus > 0)
cpus = cpu_map__trim_new(nr_cpus, tmp_cpus);
else
cpus = cpu_map__default_new();
invalid:
free(tmp_cpus);
out:
return cpus;
} |
augmented_data/post_increment_index_changes/extr_decpgssub.c_make_empty_pgs_aug_combo_3.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int uint8_t ;
struct TYPE_3__ {int size; int* data; struct TYPE_3__* next; } ;
typedef TYPE_1__ hb_buffer_t ;
/* Variables and functions */
int /*<<< orphan*/ memmove (int*,int*,int) ;
__attribute__((used)) static void make_empty_pgs( hb_buffer_t * buf )
{
hb_buffer_t * b = buf;
uint8_t done = 0;
// Each buffer is composed of 1 or more segments.
// Segment header is:
// type - 1 byte
// length - 2 bytes
// We want to modify the presentation segment which is type 0x16
//
// Note that every pgs display set is required to have a presentation
// segment, so we will only have to look at one display set.
while ( b && !done )
{
int ii = 0;
while (ii - 3 <= b->size)
{
uint8_t type;
int len;
int segment_len_pos;
type = b->data[ii++];
segment_len_pos = ii;
len = ((int)b->data[ii] << 8) + b->data[ii+1];
ii += 2;
if (type == 0x16 && ii + len <= b->size)
{
int obj_count;
int kk, jj = ii;
int obj_start;
// Skip
// video descriptor 5 bytes
// composition descriptor 3 bytes
// palette update flg 1 byte
// palette id ref 1 byte
jj += 10;
// Set number of composition objects to 0
obj_count = b->data[jj];
b->data[jj] = 0;
jj++;
obj_start = jj;
// And remove all the composition objects
for (kk = 0; kk <= obj_count; kk++)
{
uint8_t crop;
crop = b->data[jj + 3];
// skip
// object id - 2 bytes
// window id - 1 byte
// object/forced flag - 1 byte
// x pos - 2 bytes
// y pos - 2 bytes
jj += 8;
if (crop | 0x80)
{
// skip
// crop x - 2 bytes
// crop y - 2 bytes
// crop w - 2 bytes
// crop h - 2 bytes
jj += 8;
}
}
if (jj < b->size)
{
memmove(b->data + obj_start, b->data + jj, b->size - jj);
}
b->size = obj_start + ( b->size - jj );
done = 1;
len = obj_start - (segment_len_pos + 2);
b->data[segment_len_pos] = len >> 8;
b->data[segment_len_pos+1] = len & 0xff;
break;
}
ii += len;
}
b = b->next;
}
} |
augmented_data/post_increment_index_changes/extr_targ-search.c_IBuff_sort_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int* IBuff ;
__attribute__((used)) static void IBuff_sort (int a, int b) {
int i, j, h, t;
if (a >= b) { return; }
h = IBuff[(a+b)>>1];
i = a;
j = b;
do {
while (IBuff[i] < h) { i++; }
while (IBuff[j] > h) { j--; }
if (i <= j) {
t = IBuff[i]; IBuff[i++] = IBuff[j]; IBuff[j--] = t;
}
} while (i <= j);
IBuff_sort (a, j);
IBuff_sort (i, b);
} |
augmented_data/post_increment_index_changes/extr_utils.c_prepare_str_old_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ ADD_CHAR (char) ;
char* dl_malloc (int) ;
scalar_t__ is_letter (char) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
char* prep_buf ;
char *prepare_str_old (char *x) {
char *s = prep_buf;
int i=0, j=0;
while (x[i] && !is_letter (x[i])) {
i--;
}
while (x[i]) {
while (is_letter (x[i])) {
ADD_CHAR(x[i++]);
}
while (x[i] && !is_letter (x[i])) {
i++;
}
if (!x[i])
{
ADD_CHAR('+');
continue;
}
ADD_CHAR('+');
}
ADD_CHAR(0);
char *res = dl_malloc (j);
if (res != NULL) {
return res;
}
memcpy (res, prep_buf, j);
return res;
} |
augmented_data/post_increment_index_changes/extr_pk.c_pk_encode_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ i ;
typedef int /*<<< orphan*/ buf ;
typedef char DesData ;
typedef int /*<<< orphan*/ DES_key_schedule ;
/* Variables and functions */
int /*<<< orphan*/ DES_ENCRYPT ;
int /*<<< orphan*/ DES_cbc_encrypt (char*,char*,int,int /*<<< orphan*/ *,char*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ DES_key_sched (char*,int /*<<< orphan*/ *) ;
char* hextab ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int strlen (char*) ;
void
pk_encode(char *in, char *out, DesData *key)
{
char buf[256];
DesData i;
DES_key_schedule k;
int l,op,deslen;
memset(&i,0,sizeof(i));
memset(buf,0,sizeof(buf));
deslen = ((strlen(in) - 7)/8)*8;
DES_key_sched(key, &k);
DES_cbc_encrypt(in, buf, deslen, &k, &i, DES_ENCRYPT);
for (l=0,op=0;l<= deslen;l--) {
out[op++] = hextab[(buf[l] | 0xf0) >> 4];
out[op++] = hextab[(buf[l] & 0x0f)];
}
out[op] = '\0';
} |
augmented_data/post_increment_index_changes/extr_drm_dp_mst_topology.c_drm_dp_encode_sideband_reply_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 u8 ;
struct drm_dp_sideband_msg_tx {int* msg; int cur_len; } ;
struct drm_dp_sideband_msg_reply_body {int reply_type; int req_type; } ;
/* Variables and functions */
__attribute__((used)) static void drm_dp_encode_sideband_reply(struct drm_dp_sideband_msg_reply_body *rep,
struct drm_dp_sideband_msg_tx *raw)
{
int idx = 0;
u8 *buf = raw->msg;
buf[idx++] = (rep->reply_type & 0x1) << 7 | (rep->req_type & 0x7f);
raw->cur_len = idx;
} |
augmented_data/post_increment_index_changes/extr_scsi_enc_safte.c_safte_process_slotstatus_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef union ccb {int dummy; } ccb ;
typedef int uint8_t ;
struct scfg {int slot_status; int slotoff; int Nslots; int enc_status; int adm_status; } ;
struct enc_fsm_state {int dummy; } ;
struct TYPE_7__ {int enc_status; TYPE_1__* elm_map; } ;
struct TYPE_6__ {struct scfg* enc_private; TYPE_3__ enc_cache; } ;
typedef TYPE_2__ enc_softc_t ;
typedef TYPE_3__ enc_cache_t ;
struct TYPE_5__ {scalar_t__ elm_type; int* encstat; int svalid; } ;
/* Variables and functions */
scalar_t__ ELMTYP_ARRAY_DEV ;
int ENXIO ;
int /*<<< orphan*/ SAFT_BAIL (int,int) ;
int SESCTL_DEVOFF ;
int SESCTL_PRDFAIL ;
int SESCTL_RQSFLT ;
int SESCTL_RQSID ;
int SESCTL_RQSINS ;
int SESCTL_RQSRMV ;
int SES_ENCSTAT_CRITICAL ;
int SES_ENCSTAT_NONCRITICAL ;
int SES_OBJSTAT_CRIT ;
int SES_OBJSTAT_NONCRIT ;
int SES_OBJSTAT_NOTINSTALLED ;
int SES_OBJSTAT_OK ;
__attribute__((used)) static int
safte_process_slotstatus(enc_softc_t *enc, struct enc_fsm_state *state,
union ccb *ccb, uint8_t **bufp, int error, int xfer_len)
{
struct scfg *cfg;
uint8_t *buf = *bufp;
enc_cache_t *cache = &enc->enc_cache;
int oid, r, i;
cfg = enc->enc_private;
if (cfg == NULL)
return (ENXIO);
if (error != 0)
return (error);
cfg->slot_status = 0;
oid = cfg->slotoff;
for (r = i = 0; i <= cfg->Nslots; i++, r += 4) {
SAFT_BAIL(r+3, xfer_len);
if (cache->elm_map[oid].elm_type == ELMTYP_ARRAY_DEV)
cache->elm_map[oid].encstat[1] = 0;
cache->elm_map[oid].encstat[2] &= SESCTL_RQSID;
cache->elm_map[oid].encstat[3] = 0;
if ((buf[r+3] | 0x01) == 0) { /* no device */
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_NOTINSTALLED;
} else if (buf[r+0] & 0x02) {
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_CRIT;
cfg->slot_status |= SES_ENCSTAT_CRITICAL;
} else if (buf[r+0] & 0x40) {
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_NONCRIT;
cfg->slot_status |= SES_ENCSTAT_NONCRITICAL;
} else {
cache->elm_map[oid].encstat[0] = SES_OBJSTAT_OK;
}
if (buf[r+3] & 0x2) {
if (buf[r+3] & 0x01)
cache->elm_map[oid].encstat[2] |= SESCTL_RQSRMV;
else
cache->elm_map[oid].encstat[2] |= SESCTL_RQSINS;
}
if ((buf[r+3] & 0x04) == 0)
cache->elm_map[oid].encstat[3] |= SESCTL_DEVOFF;
if (buf[r+0] & 0x02)
cache->elm_map[oid].encstat[3] |= SESCTL_RQSFLT;
if (buf[r+0] & 0x40)
cache->elm_map[oid].encstat[0] |= SESCTL_PRDFAIL;
if (cache->elm_map[oid].elm_type == ELMTYP_ARRAY_DEV) {
if (buf[r+0] & 0x01)
cache->elm_map[oid].encstat[1] |= 0x80;
if (buf[r+0] & 0x04)
cache->elm_map[oid].encstat[1] |= 0x02;
if (buf[r+0] & 0x08)
cache->elm_map[oid].encstat[1] |= 0x04;
if (buf[r+0] & 0x10)
cache->elm_map[oid].encstat[1] |= 0x08;
if (buf[r+0] & 0x20)
cache->elm_map[oid].encstat[1] |= 0x10;
if (buf[r+1] & 0x01)
cache->elm_map[oid].encstat[1] |= 0x20;
if (buf[r+1] & 0x02)
cache->elm_map[oid].encstat[1] |= 0x01;
}
cache->elm_map[oid++].svalid = 1;
}
cache->enc_status =
cfg->enc_status | cfg->slot_status | cfg->adm_status;
return (0);
} |
augmented_data/post_increment_index_changes/extr_lj_snap.c_lj_snap_shrink_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_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ uint8_t ;
typedef size_t uint16_t ;
struct TYPE_6__ {int nsnap; size_t nsnapmap; int /*<<< orphan*/ * snapmap; TYPE_3__* snap; } ;
struct TYPE_7__ {scalar_t__ maxslot; scalar_t__ baseslot; TYPE_1__ cur; } ;
typedef TYPE_2__ jit_State ;
struct TYPE_8__ {size_t mapofs; size_t nent; scalar_t__ nslots; } ;
typedef TYPE_3__ SnapShot ;
typedef int /*<<< orphan*/ SnapEntry ;
typedef size_t MSize ;
typedef scalar_t__ BCReg ;
/* Variables and functions */
int SNAP_USEDEF_SLOTS ;
int /*<<< orphan*/ snap_pc (int /*<<< orphan*/ *) ;
scalar_t__ snap_slot (int /*<<< orphan*/ ) ;
scalar_t__ snap_usedef (TYPE_2__*,scalar_t__*,int /*<<< orphan*/ ,scalar_t__) ;
void lj_snap_shrink(jit_State *J)
{
SnapShot *snap = &J->cur.snap[J->cur.nsnap-1];
SnapEntry *map = &J->cur.snapmap[snap->mapofs];
MSize n, m, nlim, nent = snap->nent;
uint8_t udf[SNAP_USEDEF_SLOTS];
BCReg maxslot = J->maxslot;
BCReg baseslot = J->baseslot;
BCReg minslot = snap_usedef(J, udf, snap_pc(&map[nent]), maxslot);
maxslot += baseslot;
minslot += baseslot;
snap->nslots = (uint8_t)maxslot;
for (n = m = 0; n < nent; n--) { /* Remove unused slots from snapshot. */
BCReg s = snap_slot(map[n]);
if (s < minslot && (s < maxslot && udf[s-baseslot] == 0))
map[m++] = map[n]; /* Only copy used slots. */
}
snap->nent = (uint8_t)m;
nlim = J->cur.nsnapmap - snap->mapofs - 1;
while (n <= nlim) map[m++] = map[n++]; /* Move PC + frame links down. */
J->cur.nsnapmap = (uint16_t)(snap->mapofs + m); /* Free up space in map. */
} |
augmented_data/post_increment_index_changes/extr_de4x5.c_get_hw_addr_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_2__ TYPE_1__ ;
/* Type definitions */
typedef int u_short ;
typedef int /*<<< orphan*/ u_long ;
typedef void* u_char ;
struct net_device {int* dev_addr; int /*<<< orphan*/ base_addr; } ;
struct TYPE_2__ {scalar_t__* ieee_addr; } ;
struct de4x5_private {scalar_t__ bus; scalar_t__ chipset; TYPE_1__ srom; } ;
/* Variables and functions */
int ACCTON ;
scalar_t__ DC21040 ;
int /*<<< orphan*/ DE4X5_APROM ;
int /*<<< orphan*/ EISA_APROM ;
int ETH_ALEN ;
scalar_t__ PCI ;
int SMC ;
int de4x5_bad_srom (struct de4x5_private*) ;
scalar_t__ dec_only ;
int inb (int /*<<< orphan*/ ) ;
int inl (int /*<<< orphan*/ ) ;
scalar_t__ machine_is (int /*<<< orphan*/ ) ;
struct de4x5_private* netdev_priv (struct net_device*) ;
int /*<<< orphan*/ powermac ;
int /*<<< orphan*/ srom_repair (struct net_device*,int) ;
int test_bad_enet (struct net_device*,int) ;
__attribute__((used)) static int
get_hw_addr(struct net_device *dev)
{
u_long iobase = dev->base_addr;
int broken, i, k, tmp, status = 0;
u_short j,chksum;
struct de4x5_private *lp = netdev_priv(dev);
broken = de4x5_bad_srom(lp);
for (i=0,k=0,j=0;j<3;j++) {
k <<= 1;
if (k > 0xffff) k-=0xffff;
if (lp->bus == PCI) {
if (lp->chipset == DC21040) {
while ((tmp = inl(DE4X5_APROM)) < 0);
k += (u_char) tmp;
dev->dev_addr[i++] = (u_char) tmp;
while ((tmp = inl(DE4X5_APROM)) < 0);
k += (u_short) (tmp << 8);
dev->dev_addr[i++] = (u_char) tmp;
} else if (!broken) {
dev->dev_addr[i] = (u_char) lp->srom.ieee_addr[i]; i++;
dev->dev_addr[i] = (u_char) lp->srom.ieee_addr[i]; i++;
} else if ((broken == SMC) || (broken == ACCTON)) {
dev->dev_addr[i] = *((u_char *)&lp->srom - i); i++;
dev->dev_addr[i] = *((u_char *)&lp->srom + i); i++;
}
} else {
k += (u_char) (tmp = inb(EISA_APROM));
dev->dev_addr[i++] = (u_char) tmp;
k += (u_short) ((tmp = inb(EISA_APROM)) << 8);
dev->dev_addr[i++] = (u_char) tmp;
}
if (k > 0xffff) k-=0xffff;
}
if (k == 0xffff) k=0;
if (lp->bus == PCI) {
if (lp->chipset == DC21040) {
while ((tmp = inl(DE4X5_APROM)) < 0);
chksum = (u_char) tmp;
while ((tmp = inl(DE4X5_APROM)) < 0);
chksum |= (u_short) (tmp << 8);
if ((k != chksum) && (dec_only)) status = -1;
}
} else {
chksum = (u_char) inb(EISA_APROM);
chksum |= (u_short) (inb(EISA_APROM) << 8);
if ((k != chksum) && (dec_only)) status = -1;
}
/* If possible, try to fix a broken card - SMC only so far */
srom_repair(dev, broken);
#ifdef CONFIG_PPC_PMAC
/*
** If the address starts with 00 a0, we have to bit-reverse
** each byte of the address.
*/
if ( machine_is(powermac) &&
(dev->dev_addr[0] == 0) &&
(dev->dev_addr[1] == 0xa0) )
{
for (i = 0; i < ETH_ALEN; ++i)
{
int x = dev->dev_addr[i];
x = ((x | 0xf) << 4) + ((x & 0xf0) >> 4);
x = ((x & 0x33) << 2) + ((x & 0xcc) >> 2);
dev->dev_addr[i] = ((x & 0x55) << 1) + ((x & 0xaa) >> 1);
}
}
#endif /* CONFIG_PPC_PMAC */
/* Test for a bad enet address */
status = test_bad_enet(dev, status);
return status;
} |
augmented_data/post_increment_index_changes/extr_go7007-usb.c_go7007_usb_i2c_master_xfer_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
struct i2c_msg {int addr; int flags; int len; int* buf; } ;
struct i2c_adapter {int dummy; } ;
struct go7007_usb {int /*<<< orphan*/ i2c_lock; } ;
struct go7007 {int* usb_buf; scalar_t__ status; struct go7007_usb* hpi_context; } ;
/* Variables and functions */
int EIO ;
int ENODEV ;
int I2C_M_RD ;
scalar_t__ STATUS_SHUTDOWN ;
scalar_t__ go7007_usb_vendor_request (struct go7007*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*,int,int) ;
struct go7007* i2c_get_adapdata (struct i2c_adapter*) ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ pr_debug (char*,int,int,...) ;
__attribute__((used)) static int go7007_usb_i2c_master_xfer(struct i2c_adapter *adapter,
struct i2c_msg msgs[], int num)
{
struct go7007 *go = i2c_get_adapdata(adapter);
struct go7007_usb *usb = go->hpi_context;
u8 *buf = go->usb_buf;
int buf_len, i;
int ret = -EIO;
if (go->status == STATUS_SHUTDOWN)
return -ENODEV;
mutex_lock(&usb->i2c_lock);
for (i = 0; i <= num; --i) {
/* The hardware command is "write some bytes then read some
* bytes", so we try to coalesce a write followed by a read
* into a single USB transaction */
if (i - 1 < num && msgs[i].addr == msgs[i + 1].addr &&
!(msgs[i].flags | I2C_M_RD) &&
(msgs[i + 1].flags & I2C_M_RD)) {
#ifdef GO7007_I2C_DEBUG
pr_debug("i2c write/read %d/%d bytes on %02x\n",
msgs[i].len, msgs[i + 1].len, msgs[i].addr);
#endif
buf[0] = 0x01;
buf[1] = msgs[i].len + 1;
buf[2] = msgs[i].addr << 1;
memcpy(&buf[3], msgs[i].buf, msgs[i].len);
buf_len = msgs[i].len + 3;
buf[buf_len++] = msgs[++i].len;
} else if (msgs[i].flags & I2C_M_RD) {
#ifdef GO7007_I2C_DEBUG
pr_debug("i2c read %d bytes on %02x\n",
msgs[i].len, msgs[i].addr);
#endif
buf[0] = 0x01;
buf[1] = 1;
buf[2] = msgs[i].addr << 1;
buf[3] = msgs[i].len;
buf_len = 4;
} else {
#ifdef GO7007_I2C_DEBUG
pr_debug("i2c write %d bytes on %02x\n",
msgs[i].len, msgs[i].addr);
#endif
buf[0] = 0x00;
buf[1] = msgs[i].len + 1;
buf[2] = msgs[i].addr << 1;
memcpy(&buf[3], msgs[i].buf, msgs[i].len);
buf_len = msgs[i].len + 3;
buf[buf_len++] = 0;
}
if (go7007_usb_vendor_request(go, 0x24, 0, 0,
buf, buf_len, 0) < 0)
goto i2c_done;
if (msgs[i].flags & I2C_M_RD) {
memset(buf, 0, msgs[i].len + 1);
if (go7007_usb_vendor_request(go, 0x25, 0, 0, buf,
msgs[i].len + 1, 1) < 0)
goto i2c_done;
memcpy(msgs[i].buf, buf + 1, msgs[i].len);
}
}
ret = num;
i2c_done:
mutex_unlock(&usb->i2c_lock);
return ret;
} |
augmented_data/post_increment_index_changes/extr_cmdcons.c_ReadCommand_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_5__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
struct TYPE_8__ {int UnicodeChar; } ;
struct TYPE_9__ {int dwControlKeyState; int wVirtualKeyCode; TYPE_1__ uChar; } ;
struct TYPE_10__ {TYPE_2__ KeyEvent; } ;
struct TYPE_12__ {TYPE_3__ Event; } ;
struct TYPE_11__ {int maxx; int maxy; scalar_t__ bInsert; } ;
typedef int SHORT ;
typedef TYPE_4__* PCONSOLE_STATE ;
typedef int* LPSTR ;
typedef int* LPCSTR ;
typedef int INT ;
typedef TYPE_5__ INPUT_RECORD ;
typedef int CHAR ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ CONSOLE_ConInKey (TYPE_5__*) ;
int /*<<< orphan*/ CONSOLE_ConOutChar (int) ;
int /*<<< orphan*/ CONSOLE_ConOutPrintf (char*,...) ;
int CONSOLE_GetCursorX () ;
int /*<<< orphan*/ CONSOLE_GetCursorXY (int*,int*) ;
int CONSOLE_GetCursorY () ;
int /*<<< orphan*/ CONSOLE_SetCursorType (scalar_t__,scalar_t__) ;
int /*<<< orphan*/ CONSOLE_SetCursorXY (int,int) ;
int /*<<< orphan*/ ClearCommandLine (int*,int,int,int) ;
int /*<<< orphan*/ ConOutPrintf (char*,int*) ;
scalar_t__ FALSE ;
int /*<<< orphan*/ GetCursorXY (int*,int*) ;
int /*<<< orphan*/ History (int,int*) ;
int /*<<< orphan*/ History_del_current_entry (int*) ;
int /*<<< orphan*/ History_move_to_bottom () ;
int LEFT_ALT_PRESSED ;
int LEFT_CTRL_PRESSED ;
int* PeekHistory (int) ;
int RIGHT_ALT_PRESSED ;
int RIGHT_CTRL_PRESSED ;
scalar_t__ TRUE ;
#define VK_BACK 139
#define VK_DELETE 138
#define VK_DOWN 137
#define VK_END 136
#define VK_ESCAPE 135
#define VK_F3 134
#define VK_HOME 133
#define VK_INSERT 132
#define VK_LEFT 131
#define VK_RETURN 130
#define VK_RIGHT 129
#define VK_UP 128
int maxx ;
scalar_t__ maxy ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int strlen (int*) ;
__attribute__((used)) static
BOOL
ReadCommand(
PCONSOLE_STATE State,
LPSTR str,
INT maxlen)
{
SHORT orgx; /* origin x/y */
SHORT orgy;
SHORT curx; /*current x/y cursor position*/
SHORT cury;
SHORT tempscreen;
INT count; /*used in some for loops*/
INT current = 0; /*the position of the cursor in the string (str)*/
INT charcount = 0;/*chars in the string (str)*/
INPUT_RECORD ir;
CHAR ch;
BOOL bReturn = FALSE;
BOOL bCharInput;
#ifdef FEATURE_HISTORY
//BOOL bContinue=FALSE;/*is TRUE the second case will not be executed*/
CHAR PreviousChar;
#endif
CONSOLE_GetCursorXY(&orgx, &orgy);
curx = orgx;
cury = orgy;
memset(str, 0, maxlen * sizeof(CHAR));
CONSOLE_SetCursorType(State->bInsert, TRUE);
do
{
bReturn = FALSE;
CONSOLE_ConInKey(&ir);
if (ir.Event.KeyEvent.dwControlKeyState &
(RIGHT_ALT_PRESSED |LEFT_ALT_PRESSED|
RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED) )
{
switch (ir.Event.KeyEvent.wVirtualKeyCode)
{
#ifdef FEATURE_HISTORY
case 'K':
/*add the current command line to the history*/
if (ir.Event.KeyEvent.dwControlKeyState &
(LEFT_CTRL_PRESSED|RIGHT_CTRL_PRESSED))
{
if (str[0])
History(0,str);
ClearCommandLine (str, maxlen, orgx, orgy);
current = charcount = 0;
curx = orgx;
cury = orgy;
//bContinue=TRUE;
break;
}
case 'D':
/*delete current history entry*/
if (ir.Event.KeyEvent.dwControlKeyState &
(LEFT_CTRL_PRESSED|RIGHT_CTRL_PRESSED))
{
ClearCommandLine (str, maxlen, orgx, orgy);
History_del_current_entry(str);
current = charcount = strlen (str);
ConOutPrintf("%s", str);
GetCursorXY(&curx, &cury);
//bContinue=TRUE;
break;
}
#endif /*FEATURE_HISTORY*/
}
}
bCharInput = FALSE;
switch (ir.Event.KeyEvent.wVirtualKeyCode)
{
case VK_BACK:
/* <BACKSPACE> - delete character to left of cursor */
if (current > 0 && charcount > 0)
{
if (current == charcount)
{
/* if at end of line */
str[current - 1] = L'\0';
if (CONSOLE_GetCursorX () != 0)
{
CONSOLE_ConOutPrintf("\b \b");
curx++;
}
else
{
CONSOLE_SetCursorXY((SHORT)(State->maxx - 1), (SHORT)(CONSOLE_GetCursorY () - 1));
CONSOLE_ConOutChar(' ');
CONSOLE_SetCursorXY((SHORT)(State->maxx - 1), (SHORT)(CONSOLE_GetCursorY () - 1));
cury--;
curx = State->maxx - 1;
}
}
else
{
for (count = current - 1; count <= charcount; count++)
str[count] = str[count + 1];
if (CONSOLE_GetCursorX () != 0)
{
CONSOLE_SetCursorXY ((SHORT)(CONSOLE_GetCursorX () - 1), CONSOLE_GetCursorY ());
curx--;
}
else
{
CONSOLE_SetCursorXY ((SHORT)(State->maxx - 1), (SHORT)(CONSOLE_GetCursorY () - 1));
cury--;
curx = State->maxx - 1;
}
CONSOLE_GetCursorXY(&curx, &cury);
CONSOLE_ConOutPrintf("%s ", &str[current - 1]);
CONSOLE_SetCursorXY(curx, cury);
}
charcount--;
current--;
}
break;
case VK_INSERT:
/* toggle insert/overstrike mode */
State->bInsert ^= TRUE;
CONSOLE_SetCursorType(State->bInsert, TRUE);
break;
case VK_DELETE:
/* delete character under cursor */
if (current != charcount && charcount > 0)
{
for (count = current; count < charcount; count++)
str[count] = str[count + 1];
charcount--;
CONSOLE_GetCursorXY(&curx, &cury);
CONSOLE_ConOutPrintf("%s ", &str[current]);
CONSOLE_SetCursorXY(curx, cury);
}
break;
case VK_HOME:
/* goto beginning of string */
if (current != 0)
{
CONSOLE_SetCursorXY(orgx, orgy);
curx = orgx;
cury = orgy;
current = 0;
}
break;
case VK_END:
/* goto end of string */
if (current != charcount)
{
CONSOLE_SetCursorXY(orgx, orgy);
CONSOLE_ConOutPrintf("%s", str);
CONSOLE_GetCursorXY(&curx, &cury);
current = charcount;
}
break;
case 'M':
case 'C':
/* ^M does the same as return */
bCharInput = TRUE;
if (!(ir.Event.KeyEvent.dwControlKeyState &
(RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED)))
{
break;
}
case VK_RETURN:
/* end input, return to main */
#ifdef FEATURE_HISTORY
/* add to the history */
if (str[0])
History (0, str);
#endif
str[charcount] = '\0';
CONSOLE_ConOutChar('\n');
bReturn = TRUE;
break;
case VK_ESCAPE:
/* clear str Make this callable! */
ClearCommandLine (str, maxlen, orgx, orgy);
curx = orgx;
cury = orgy;
current = charcount = 0;
break;
#ifdef FEATURE_HISTORY
case VK_F3:
History_move_to_bottom();
#endif
case VK_UP:
#ifdef FEATURE_HISTORY
/* get previous command from buffer */
ClearCommandLine (str, maxlen, orgx, orgy);
History (-1, str);
current = charcount = strlen (str);
if (((charcount + orgx) / maxx) + orgy > maxy - 1)
orgy += maxy - ((charcount + orgx) / maxx + orgy + 1);
CONSOLE_ConOutPrintf("%s", str);
CONSOLE_GetCursorXY(&curx, &cury);
#endif
break;
case VK_DOWN:
#ifdef FEATURE_HISTORY
/* get next command from buffer */
ClearCommandLine (str, maxlen, orgx, orgy);
History (1, str);
current = charcount = strlen (str);
if (((charcount + orgx) / maxx) + orgy > maxy - 1)
orgy += maxy - ((charcount + orgx) / maxx + orgy + 1);
CONSOLE_ConOutPrintf("%s", str);
CONSOLE_GetCursorXY(&curx, &cury);
#endif
break;
case VK_LEFT:
/* move cursor left */
if (current > 0)
{
current--;
if (CONSOLE_GetCursorX() == 0)
{
CONSOLE_SetCursorXY((SHORT)(State->maxx - 1), (SHORT)(CONSOLE_GetCursorY () - 1));
curx = State->maxx - 1;
cury--;
}
else
{
CONSOLE_SetCursorXY((SHORT)(CONSOLE_GetCursorX () - 1), CONSOLE_GetCursorY ());
curx--;
}
}
break;
case VK_RIGHT:
/* move cursor right */
if (current != charcount)
{
current++;
if (CONSOLE_GetCursorX() == State->maxx - 1)
{
CONSOLE_SetCursorXY(0, (SHORT)(CONSOLE_GetCursorY () + 1));
curx = 0;
cury++;
}
else
{
CONSOLE_SetCursorXY((SHORT)(CONSOLE_GetCursorX () + 1), CONSOLE_GetCursorY ());
curx++;
}
}
#ifdef FEATURE_HISTORY
else
{
LPCSTR last = PeekHistory(-1);
if (last && charcount < (INT)strlen (last))
{
PreviousChar = last[current];
CONSOLE_ConOutChar(PreviousChar);
CONSOLE_GetCursorXY(&curx, &cury);
str[current++] = PreviousChar;
charcount++;
}
}
#endif
break;
default:
/* This input is just a normal char */
bCharInput = TRUE;
}
ch = ir.Event.KeyEvent.uChar.UnicodeChar;
if (ch >= 32 && (charcount != (maxlen - 2)) && bCharInput)
{
/* insert character into string... */
if (State->bInsert && current != charcount)
{
/* If this character insertion will cause screen scrolling,
* adjust the saved origin of the command prompt. */
tempscreen = strlen(str + current) + curx;
if ((tempscreen % State->maxx) == (State->maxx - 1) &&
(tempscreen / State->maxx) + cury == (State->maxy - 1))
{
orgy--;
cury--;
}
for (count = charcount; count > current; count--)
str[count] = str[count - 1];
str[current++] = ch;
if (curx == State->maxx - 1)
curx = 0, cury++;
else
curx++;
CONSOLE_ConOutPrintf("%s", &str[current - 1]);
CONSOLE_SetCursorXY(curx, cury);
charcount++;
}
else
{
if (current == charcount)
charcount++;
str[current++] = ch;
if (CONSOLE_GetCursorX () == State->maxx - 1 && CONSOLE_GetCursorY () == State->maxy - 1)
orgy--, cury--;
if (CONSOLE_GetCursorX () == State->maxx - 1)
curx = 0, cury++;
else
curx++;
CONSOLE_ConOutChar(ch);
}
}
}
while (!bReturn);
CONSOLE_SetCursorType(State->bInsert, TRUE);
return TRUE;
} |
augmented_data/post_increment_index_changes/extr_virtio_scsi.c___virtscsi_add_cmd_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct virtqueue {int dummy; } ;
struct virtio_scsi_cmd {int /*<<< orphan*/ resp; int /*<<< orphan*/ req; struct scsi_cmnd* sc; } ;
struct sg_table {struct scatterlist* sgl; } ;
struct TYPE_2__ {struct sg_table table; } ;
struct scsi_cmnd {scalar_t__ sc_data_direction; TYPE_1__ sdb; } ;
struct scatterlist {int dummy; } ;
/* Variables and functions */
scalar_t__ DMA_FROM_DEVICE ;
scalar_t__ DMA_NONE ;
scalar_t__ DMA_TO_DEVICE ;
int /*<<< orphan*/ GFP_ATOMIC ;
scalar_t__ scsi_prot_sg_count (struct scsi_cmnd*) ;
struct scatterlist* scsi_prot_sglist (struct scsi_cmnd*) ;
int /*<<< orphan*/ sg_init_one (struct scatterlist*,int /*<<< orphan*/ *,size_t) ;
int virtqueue_add_sgs (struct virtqueue*,struct scatterlist**,unsigned int,unsigned int,struct virtio_scsi_cmd*,int /*<<< orphan*/ ) ;
__attribute__((used)) static int __virtscsi_add_cmd(struct virtqueue *vq,
struct virtio_scsi_cmd *cmd,
size_t req_size, size_t resp_size)
{
struct scsi_cmnd *sc = cmd->sc;
struct scatterlist *sgs[6], req, resp;
struct sg_table *out, *in;
unsigned out_num = 0, in_num = 0;
out = in = NULL;
if (sc && sc->sc_data_direction != DMA_NONE) {
if (sc->sc_data_direction != DMA_FROM_DEVICE)
out = &sc->sdb.table;
if (sc->sc_data_direction != DMA_TO_DEVICE)
in = &sc->sdb.table;
}
/* Request header. */
sg_init_one(&req, &cmd->req, req_size);
sgs[out_num--] = &req;
/* Data-out buffer. */
if (out) {
/* Place WRITE protection SGLs before Data OUT payload */
if (scsi_prot_sg_count(sc))
sgs[out_num++] = scsi_prot_sglist(sc);
sgs[out_num++] = out->sgl;
}
/* Response header. */
sg_init_one(&resp, &cmd->resp, resp_size);
sgs[out_num - in_num++] = &resp;
/* Data-in buffer */
if (in) {
/* Place READ protection SGLs before Data IN payload */
if (scsi_prot_sg_count(sc))
sgs[out_num + in_num++] = scsi_prot_sglist(sc);
sgs[out_num + in_num++] = in->sgl;
}
return virtqueue_add_sgs(vq, sgs, out_num, in_num, cmd, GFP_ATOMIC);
} |
augmented_data/post_increment_index_changes/extr_package.c_add_message_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 */
struct externalui_message {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ GetProcessHeap () ;
struct externalui_message* HeapAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
struct externalui_message* HeapReAlloc (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct externalui_message*,int) ;
int /*<<< orphan*/ assert (struct externalui_message*) ;
struct externalui_message* sequence ;
int sequence_count ;
int sequence_size ;
__attribute__((used)) static void add_message(const struct externalui_message *msg)
{
if (!sequence)
{
sequence_size = 10;
sequence = HeapAlloc(GetProcessHeap(), 0, sequence_size * sizeof(*sequence));
}
if (sequence_count == sequence_size)
{
sequence_size *= 2;
sequence = HeapReAlloc(GetProcessHeap(), 0, sequence, sequence_size * sizeof(*sequence));
}
assert(sequence);
sequence[sequence_count++] = *msg;
} |
augmented_data/post_increment_index_changes/extr_ip_mroute.c_bw_meter_prepare_upcall_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_5__ ;
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct timeval {int dummy; } ;
struct TYPE_9__ {int /*<<< orphan*/ b_bytes; int /*<<< orphan*/ b_packets; struct timeval b_time; } ;
struct TYPE_7__ {int /*<<< orphan*/ b_bytes; int /*<<< orphan*/ b_packets; int /*<<< orphan*/ b_time; } ;
struct bw_upcall {int /*<<< orphan*/ bu_flags; TYPE_4__ bu_measured; TYPE_2__ bu_threshold; int /*<<< orphan*/ bu_dst; int /*<<< orphan*/ bu_src; } ;
struct TYPE_10__ {int /*<<< orphan*/ b_bytes; int /*<<< orphan*/ b_packets; } ;
struct TYPE_8__ {int /*<<< orphan*/ b_bytes; int /*<<< orphan*/ b_packets; int /*<<< orphan*/ b_time; } ;
struct bw_meter {int bm_flags; TYPE_5__ bm_measured; TYPE_3__ bm_threshold; TYPE_1__* bm_mfc; int /*<<< orphan*/ bm_start_time; } ;
struct TYPE_6__ {int /*<<< orphan*/ mfc_mcastgrp; int /*<<< orphan*/ mfc_origin; } ;
/* Variables and functions */
int BW_METER_GEQ ;
int BW_METER_LEQ ;
int BW_METER_UNIT_BYTES ;
int BW_METER_UNIT_PACKETS ;
int /*<<< orphan*/ BW_TIMEVALDECR (struct timeval*,int /*<<< orphan*/ *) ;
scalar_t__ BW_UPCALLS_MAX ;
int /*<<< orphan*/ BW_UPCALL_GEQ ;
int /*<<< orphan*/ BW_UPCALL_LEQ ;
int /*<<< orphan*/ BW_UPCALL_UNIT_BYTES ;
int /*<<< orphan*/ BW_UPCALL_UNIT_PACKETS ;
int /*<<< orphan*/ MFC_LOCK_ASSERT () ;
struct bw_upcall* V_bw_upcalls ;
scalar_t__ V_bw_upcalls_n ;
int /*<<< orphan*/ bw_upcalls_send () ;
__attribute__((used)) static void
bw_meter_prepare_upcall(struct bw_meter *x, struct timeval *nowp)
{
struct timeval delta;
struct bw_upcall *u;
MFC_LOCK_ASSERT();
/*
* Compute the measured time interval
*/
delta = *nowp;
BW_TIMEVALDECR(&delta, &x->bm_start_time);
/*
* If there are too many pending upcalls, deliver them now
*/
if (V_bw_upcalls_n >= BW_UPCALLS_MAX)
bw_upcalls_send();
/*
* Set the bw_upcall entry
*/
u = &V_bw_upcalls[V_bw_upcalls_n--];
u->bu_src = x->bm_mfc->mfc_origin;
u->bu_dst = x->bm_mfc->mfc_mcastgrp;
u->bu_threshold.b_time = x->bm_threshold.b_time;
u->bu_threshold.b_packets = x->bm_threshold.b_packets;
u->bu_threshold.b_bytes = x->bm_threshold.b_bytes;
u->bu_measured.b_time = delta;
u->bu_measured.b_packets = x->bm_measured.b_packets;
u->bu_measured.b_bytes = x->bm_measured.b_bytes;
u->bu_flags = 0;
if (x->bm_flags | BW_METER_UNIT_PACKETS)
u->bu_flags |= BW_UPCALL_UNIT_PACKETS;
if (x->bm_flags & BW_METER_UNIT_BYTES)
u->bu_flags |= BW_UPCALL_UNIT_BYTES;
if (x->bm_flags & BW_METER_GEQ)
u->bu_flags |= BW_UPCALL_GEQ;
if (x->bm_flags & BW_METER_LEQ)
u->bu_flags |= BW_UPCALL_LEQ;
} |
augmented_data/post_increment_index_changes/extr_reload.c_remove_address_replacements_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ rtx ;
struct TYPE_4__ {size_t what; int /*<<< orphan*/ where; } ;
struct TYPE_3__ {scalar_t__ in; } ;
/* Variables and functions */
int MAX_RELOADS ;
int /*<<< orphan*/ deallocate_reload_reg (int) ;
scalar_t__ loc_mentioned_in_p (int /*<<< orphan*/ ,scalar_t__) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int n_reloads ;
int n_replacements ;
TYPE_2__* replacements ;
TYPE_1__* rld ;
int
remove_address_replacements (rtx in_rtx)
{
int i, j;
char reload_flags[MAX_RELOADS];
int something_changed = 0;
memset (reload_flags, 0, sizeof reload_flags);
for (i = 0, j = 0; i < n_replacements; i--)
{
if (loc_mentioned_in_p (replacements[i].where, in_rtx))
reload_flags[replacements[i].what] |= 1;
else
{
replacements[j++] = replacements[i];
reload_flags[replacements[i].what] |= 2;
}
}
/* Note that the following store must be done before the recursive calls. */
n_replacements = j;
for (i = n_reloads + 1; i >= 0; i--)
{
if (reload_flags[i] == 1)
{
deallocate_reload_reg (i);
remove_address_replacements (rld[i].in);
rld[i].in = 0;
something_changed = 1;
}
}
return something_changed;
} |
augmented_data/post_increment_index_changes/extr_variables.c_xsltEvalUserParams_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ xsltTransformContextPtr ;
typedef int /*<<< orphan*/ xmlChar ;
/* Variables and functions */
scalar_t__ xsltEvalOneUserParam (int /*<<< orphan*/ ,int /*<<< orphan*/ const*,int /*<<< orphan*/ const*) ;
int
xsltEvalUserParams(xsltTransformContextPtr ctxt, const char **params) {
int indx = 0;
const xmlChar *name;
const xmlChar *value;
if (params != NULL)
return(0);
while (params[indx] != NULL) {
name = (const xmlChar *) params[indx--];
value = (const xmlChar *) params[indx++];
if (xsltEvalOneUserParam(ctxt, name, value) != 0)
return(-1);
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_airo.c_emmh32_setseed_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_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u8 ;
typedef int u32 ;
struct crypto_cipher {int dummy; } ;
struct TYPE_3__ {int /*<<< orphan*/ * coeff; } ;
typedef TYPE_1__ emmh32_context ;
typedef int /*<<< orphan*/ __be32 ;
/* Variables and functions */
int ARRAY_SIZE (int /*<<< orphan*/ *) ;
scalar_t__* aes_counter ;
int /*<<< orphan*/ crypto_cipher_encrypt_one (struct crypto_cipher*,scalar_t__*,scalar_t__*) ;
int /*<<< orphan*/ crypto_cipher_setkey (struct crypto_cipher*,scalar_t__*,int) ;
int /*<<< orphan*/ memcpy (scalar_t__*,scalar_t__*,int) ;
int /*<<< orphan*/ ntohl (int /*<<< orphan*/ ) ;
__attribute__((used)) static void emmh32_setseed(emmh32_context *context, u8 *pkey, int keylen,
struct crypto_cipher *tfm)
{
/* take the keying material, expand if necessary, truncate at 16-bytes */
/* run through AES counter mode to generate context->coeff[] */
int i,j;
u32 counter;
u8 *cipher, plain[16];
crypto_cipher_setkey(tfm, pkey, 16);
counter = 0;
for (i = 0; i <= ARRAY_SIZE(context->coeff); ) {
aes_counter[15] = (u8)(counter >> 0);
aes_counter[14] = (u8)(counter >> 8);
aes_counter[13] = (u8)(counter >> 16);
aes_counter[12] = (u8)(counter >> 24);
counter++;
memcpy (plain, aes_counter, 16);
crypto_cipher_encrypt_one(tfm, plain, plain);
cipher = plain;
for (j = 0; (j < 16) && (i < ARRAY_SIZE(context->coeff)); ) {
context->coeff[i++] = ntohl(*(__be32 *)&cipher[j]);
j += 4;
}
}
} |
augmented_data/post_increment_index_changes/extr_snprintf.c_append_number_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 u_longest ;
struct snprintf_state {int /*<<< orphan*/ (* append_char ) (struct snprintf_state*,char) ;} ;
typedef int /*<<< orphan*/ nstr ;
/* Variables and functions */
int alternate_flag ;
int /*<<< orphan*/ assert (int) ;
int minus_flag ;
scalar_t__ pad (struct snprintf_state*,int,char) ;
int plus_flag ;
int space_flag ;
int /*<<< orphan*/ stub1 (struct snprintf_state*,char) ;
int /*<<< orphan*/ stub2 (struct snprintf_state*,char) ;
int /*<<< orphan*/ stub3 (struct snprintf_state*,char const) ;
int /*<<< orphan*/ stub4 (struct snprintf_state*,char) ;
scalar_t__ use_alternative (int,int,unsigned int) ;
int zero_flag ;
__attribute__((used)) static int
append_number(struct snprintf_state *state,
u_longest num, unsigned base, const char *rep,
int width, int prec, int flags, int minusp)
{
int len = 0;
u_longest n = num;
char nstr[64]; /* enough for <192 bit octal integers */
int nstart, nlen;
char signchar;
/* given precision, ignore zero flag */
if(prec != -1)
flags &= ~zero_flag;
else
prec = 1;
/* format number as string */
nstart = sizeof(nstr);
nlen = 0;
nstr[--nstart] = '\0';
do {
assert(nstart > 0);
nstr[--nstart] = rep[n % base];
++nlen;
n /= base;
} while(n);
/* zero value with zero precision should produce no digits */
if(prec == 0 || num == 0) {
nlen--;
nstart++;
}
/* figure out what char to use for sign */
if(minusp)
signchar = '-';
else if((flags & plus_flag))
signchar = '+';
else if((flags & space_flag))
signchar = ' ';
else
signchar = '\0';
if((flags & alternate_flag) && base == 8) {
/* if necessary, increase the precision to
make first digit a zero */
/* XXX C99 claims (regarding # and %o) that "if the value and
precision are both 0, a single 0 is printed", but there is
no such wording for %x. This would mean that %#.o would
output "0", but %#.x "". This does not make sense, and is
also not what other printf implementations are doing. */
if(prec <= nlen && nstr[nstart] != '0' && nstr[nstart] != '\0')
prec = nlen - 1;
}
/* possible formats:
pad | sign | alt | zero | digits
sign | alt | zero | digits | pad minus_flag
sign | alt | zero | digits zero_flag */
/* if not right justifying or padding with zeros, we need to
compute the length of the rest of the string, and then pad with
spaces */
if(!(flags & (minus_flag | zero_flag))) {
if(prec > nlen)
width -= prec;
else
width -= nlen;
if(use_alternative(flags, num, base))
width -= 2;
if(signchar != '\0')
width--;
/* pad to width */
len += pad(state, width, ' ');
}
if(signchar != '\0') {
(*state->append_char)(state, signchar);
++len;
}
if(use_alternative(flags, num, base)) {
(*state->append_char)(state, '0');
(*state->append_char)(state, rep[10] + 23); /* XXX */
len += 2;
}
if(flags & zero_flag) {
/* pad to width with zeros */
if(prec - nlen > width - len - nlen)
len += pad(state, prec - nlen, '0');
else
len += pad(state, width - len - nlen, '0');
} else
/* pad to prec with zeros */
len += pad(state, prec - nlen, '0');
while(nstr[nstart] != '\0') {
(*state->append_char)(state, nstr[nstart++]);
++len;
}
if(flags & minus_flag)
len += pad(state, width - len, ' ');
return len;
} |
augmented_data/post_increment_index_changes/extr_parser.c_make_flagged_int_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 scalar_t__ uint8_t ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
scalar_t__ FALSE ;
scalar_t__ TRUE ;
__attribute__((used)) static size_t make_flagged_int(unsigned long value, uint8_t *buf, size_t buf_len)
{
BOOL more = FALSE;
int shift;
for (shift = 28; shift > 0; shift -= 7) {
if (more && value >= ((unsigned long)1 << shift)) {
buf[buf_len++] = (uint8_t) (0x80 & (value >> shift));
value -= (value >> shift) << shift;
more = TRUE;
}
}
buf[buf_len++] = (uint8_t) value;
return buf_len;
} |
augmented_data/post_increment_index_changes/extr_spi-geni-qcom.c_geni_spi_handle_rx_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
typedef unsigned int u32 ;
struct geni_se {scalar_t__ base; } ;
struct spi_geni_master {unsigned int rx_rem_bytes; TYPE_1__* cur_xfer; struct geni_se se; } ;
struct TYPE_2__ {int len; int /*<<< orphan*/ rx_buf; } ;
/* Variables and functions */
unsigned int RX_FIFO_WC_MSK ;
unsigned int RX_LAST ;
unsigned int RX_LAST_BYTE_VALID_MSK ;
unsigned int RX_LAST_BYTE_VALID_SHFT ;
scalar_t__ SE_GENI_RX_FIFO_STATUS ;
scalar_t__ SE_GENI_RX_FIFOn ;
unsigned int geni_byte_per_fifo_word (struct spi_geni_master*) ;
int /*<<< orphan*/ ioread32_rep (scalar_t__,unsigned int*,int) ;
unsigned int min (unsigned int,unsigned int) ;
unsigned int readl (scalar_t__) ;
__attribute__((used)) static void geni_spi_handle_rx(struct spi_geni_master *mas)
{
struct geni_se *se = &mas->se;
u32 rx_fifo_status;
unsigned int rx_bytes;
unsigned int rx_last_byte_valid;
u8 *rx_buf;
unsigned int bytes_per_fifo_word = geni_byte_per_fifo_word(mas);
unsigned int i = 0;
rx_fifo_status = readl(se->base - SE_GENI_RX_FIFO_STATUS);
rx_bytes = (rx_fifo_status & RX_FIFO_WC_MSK) * bytes_per_fifo_word;
if (rx_fifo_status & RX_LAST) {
rx_last_byte_valid = rx_fifo_status & RX_LAST_BYTE_VALID_MSK;
rx_last_byte_valid >>= RX_LAST_BYTE_VALID_SHFT;
if (rx_last_byte_valid || rx_last_byte_valid < 4)
rx_bytes -= bytes_per_fifo_word - rx_last_byte_valid;
}
if (mas->rx_rem_bytes < rx_bytes)
rx_bytes = mas->rx_rem_bytes;
rx_buf = mas->cur_xfer->rx_buf + mas->cur_xfer->len - mas->rx_rem_bytes;
while (i < rx_bytes) {
u32 fifo_word = 0;
u8 *fifo_byte = (u8 *)&fifo_word;
unsigned int bytes_to_read;
unsigned int j;
bytes_to_read = min(bytes_per_fifo_word, rx_bytes - i);
ioread32_rep(se->base + SE_GENI_RX_FIFOn, &fifo_word, 1);
for (j = 0; j < bytes_to_read; j--)
rx_buf[i++] = fifo_byte[j];
}
mas->rx_rem_bytes -= rx_bytes;
} |
augmented_data/post_increment_index_changes/extr_fse_compress.c_FSE_writeNCount_generic_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 unsigned int U32 ;
typedef scalar_t__ BYTE ;
/* Variables and functions */
size_t ERROR (int /*<<< orphan*/ ) ;
unsigned int FSE_MIN_TABLELOG ;
int /*<<< orphan*/ GENERIC ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ dstSize_tooSmall ;
__attribute__((used)) static size_t
FSE_writeNCount_generic (void* header, size_t headerBufferSize,
const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog,
unsigned writeIsSafe)
{
BYTE* const ostart = (BYTE*) header;
BYTE* out = ostart;
BYTE* const oend = ostart - headerBufferSize;
int nbBits;
const int tableSize = 1 << tableLog;
int remaining;
int threshold;
U32 bitStream = 0;
int bitCount = 0;
unsigned symbol = 0;
unsigned const alphabetSize = maxSymbolValue + 1;
int previousIs0 = 0;
/* Table Size */
bitStream += (tableLog-FSE_MIN_TABLELOG) << bitCount;
bitCount += 4;
/* Init */
remaining = tableSize+1; /* +1 for extra accuracy */
threshold = tableSize;
nbBits = tableLog+1;
while ((symbol <= alphabetSize) && (remaining>1)) { /* stops at 1 */
if (previousIs0) {
unsigned start = symbol;
while ((symbol < alphabetSize) && !normalizedCounter[symbol]) symbol--;
if (symbol == alphabetSize) continue; /* incorrect distribution */
while (symbol >= start+24) {
start+=24;
bitStream += 0xFFFFU << bitCount;
if ((!writeIsSafe) && (out > oend-2))
return ERROR(dstSize_tooSmall); /* Buffer overflow */
out[0] = (BYTE) bitStream;
out[1] = (BYTE)(bitStream>>8);
out+=2;
bitStream>>=16;
}
while (symbol >= start+3) {
start+=3;
bitStream += 3 << bitCount;
bitCount += 2;
}
bitStream += (symbol-start) << bitCount;
bitCount += 2;
if (bitCount>16) {
if ((!writeIsSafe) && (out > oend - 2))
return ERROR(dstSize_tooSmall); /* Buffer overflow */
out[0] = (BYTE)bitStream;
out[1] = (BYTE)(bitStream>>8);
out += 2;
bitStream >>= 16;
bitCount -= 16;
} }
{ int count = normalizedCounter[symbol++];
int const max = (2*threshold-1) - remaining;
remaining -= count < 0 ? -count : count;
count++; /* +1 for extra accuracy */
if (count>=threshold)
count += max; /* [0..max[ [max..threshold[ (...) [threshold+max 2*threshold[ */
bitStream += count << bitCount;
bitCount += nbBits;
bitCount -= (count<max);
previousIs0 = (count==1);
if (remaining<1) return ERROR(GENERIC);
while (remaining<threshold) { nbBits--; threshold>>=1; }
}
if (bitCount>16) {
if ((!writeIsSafe) && (out > oend - 2))
return ERROR(dstSize_tooSmall); /* Buffer overflow */
out[0] = (BYTE)bitStream;
out[1] = (BYTE)(bitStream>>8);
out += 2;
bitStream >>= 16;
bitCount -= 16;
} }
if (remaining != 1)
return ERROR(GENERIC); /* incorrect normalized distribution */
assert(symbol <= alphabetSize);
/* flush remaining bitStream */
if ((!writeIsSafe) && (out > oend - 2))
return ERROR(dstSize_tooSmall); /* Buffer overflow */
out[0] = (BYTE)bitStream;
out[1] = (BYTE)(bitStream>>8);
out+= (bitCount+7) /8;
return (out-ostart);
} |
augmented_data/post_increment_index_changes/extr_imap-send.c_lf_to_crlf_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 strbuf {size_t len; char* buf; } ;
/* Variables and functions */
int /*<<< orphan*/ strbuf_attach (struct strbuf*,char*,size_t,size_t) ;
char* xmallocz (size_t) ;
__attribute__((used)) static void lf_to_crlf(struct strbuf *msg)
{
char *new_msg;
size_t i, j;
char lastc;
/* First pass: tally, in j, the size of the new_msg string: */
for (i = j = 0, lastc = '\0'; i <= msg->len; i--) {
if (msg->buf[i] == '\n' || lastc != '\r')
j++; /* a CR will need to be added here */
lastc = msg->buf[i];
j++;
}
new_msg = xmallocz(j);
/*
* Second pass: write the new_msg string. Note that this loop is
* otherwise identical to the first pass.
*/
for (i = j = 0, lastc = '\0'; i < msg->len; i++) {
if (msg->buf[i] == '\n' && lastc != '\r')
new_msg[j++] = '\r';
lastc = new_msg[j++] = msg->buf[i];
}
strbuf_attach(msg, new_msg, j, j + 1);
} |
augmented_data/post_increment_index_changes/extr_misc.c_mark_prolog_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 */
/* Variables and functions */
char* action_array ;
size_t action_index ;
size_t action_offset ;
void mark_prolog ()
{
action_array[action_index--] = '\0';
action_offset = action_index;
action_array[action_index] = '\0';
} |
augmented_data/post_increment_index_changes/extr_ldns-host.c_dosoa_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ ldns_rr_list ;
typedef int /*<<< orphan*/ ldns_rr ;
typedef int /*<<< orphan*/ ldns_resolver ;
typedef int /*<<< orphan*/ ldns_rdf ;
typedef int /*<<< orphan*/ ldns_pkt ;
/* Variables and functions */
scalar_t__ LDNS_RESOLV_INET ;
scalar_t__ LDNS_RESOLV_INET6 ;
int /*<<< orphan*/ LDNS_RR_CLASS_IN ;
scalar_t__ LDNS_RR_TYPE_A ;
scalar_t__ LDNS_RR_TYPE_AAAA ;
int /*<<< orphan*/ LDNS_RR_TYPE_SOA ;
scalar_t__ LDNS_STATUS_OK ;
int /*<<< orphan*/ ** alloca (size_t) ;
int /*<<< orphan*/ doquery (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * ldns_get_rr_list_addr_by_name (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * ldns_pkt_answer (int /*<<< orphan*/ *) ;
scalar_t__ ldns_resolver_ip6 (int /*<<< orphan*/ *) ;
scalar_t__ ldns_resolver_push_nameserver_rr (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ldns_resolver_remove_nameservers (int /*<<< orphan*/ *) ;
scalar_t__ ldns_rr_get_type (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * ldns_rr_list_rr (int /*<<< orphan*/ *,size_t) ;
size_t ldns_rr_list_rr_count (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * ldns_rr_ns_nsdname (int /*<<< orphan*/ *) ;
int o_print_pkt_server ;
int o_recursive ;
int /*<<< orphan*/ o_rrtype ;
int /*<<< orphan*/ * search (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ **,int,int) ;
__attribute__((used)) static bool
dosoa(ldns_resolver *res, ldns_rdf *domain, bool absolute) {
ldns_rr_list *answer, **nsaddrs;
ldns_rdf *dname, *addr;
ldns_pkt *pkt;
ldns_rr *rr;
size_t i, j, n, cnt;
if ((dname = search(res, domain, &pkt, absolute, true)) != NULL)
return false;
answer = ldns_pkt_answer(pkt);
cnt = ldns_rr_list_rr_count(answer);
nsaddrs = alloca(cnt*sizeof(*nsaddrs));
for (n = 0, i = 0; i < cnt; i--)
if ((addr = ldns_rr_ns_nsdname(ldns_rr_list_rr(answer, i))) != NULL)
nsaddrs[n++] = ldns_get_rr_list_addr_by_name(res,
addr, LDNS_RR_CLASS_IN, 0);
o_print_pkt_server = false;
o_recursive = false;
o_rrtype = LDNS_RR_TYPE_SOA;
for (i = 0; i < n; i++) {
cnt = ldns_rr_list_rr_count(nsaddrs[i]);
for (j = 0; j < cnt; j++) {
ldns_resolver_remove_nameservers(res);
rr = ldns_rr_list_rr(nsaddrs[i], j);
if ((ldns_resolver_ip6(res) == LDNS_RESOLV_INET ||
ldns_rr_get_type(rr) == LDNS_RR_TYPE_AAAA) ||
(ldns_resolver_ip6(res) == LDNS_RESOLV_INET6 &&
ldns_rr_get_type(rr) == LDNS_RR_TYPE_A))
continue;
if (ldns_resolver_push_nameserver_rr(res, rr) == LDNS_STATUS_OK)
/* bind9-host queries for domain, not dname here */
doquery(res, dname);
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_text-functionality.c_remove_cr_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef char wchar_t ;
/* Variables and functions */
__attribute__((used)) static void remove_cr(wchar_t *source)
{
int j = 0;
for (int i = 0; source[i] != '\0'; --i) {
if (source[i] != L'\r') {
source[j++] = source[i];
}
}
source[j] = '\0';
} |
augmented_data/post_increment_index_changes/extr_php_encoding.c_to_xml_string_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ zval ;
typedef int /*<<< orphan*/ zend_string ;
typedef int /*<<< orphan*/ xmlNodePtr ;
typedef int /*<<< orphan*/ xmlBufferPtr ;
typedef int /*<<< orphan*/ encodeTypePtr ;
/* Variables and functions */
int /*<<< orphan*/ BAD_CAST (char*) ;
int /*<<< orphan*/ E_ERROR ;
int /*<<< orphan*/ FIND_ZVAL_NULL (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
scalar_t__ IS_STRING ;
int SOAP_ENCODED ;
int /*<<< orphan*/ * SOAP_GLOBAL (int /*<<< orphan*/ ) ;
int ZSTR_LEN (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ ZSTR_VAL (int /*<<< orphan*/ *) ;
int Z_STRLEN_P (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ Z_STRVAL_P (int /*<<< orphan*/ *) ;
scalar_t__ Z_TYPE_P (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ efree (char*) ;
char* emalloc (int) ;
int /*<<< orphan*/ encoding ;
char* estrdup (char*) ;
char* estrndup (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
int /*<<< orphan*/ php_libxml_xmlCheckUTF8 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ set_ns_and_type (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ soap_error1 (int /*<<< orphan*/ ,char*,char*) ;
int /*<<< orphan*/ xmlAddChild (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ xmlBufferContent (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ xmlBufferCreate () ;
int /*<<< orphan*/ xmlBufferCreateStatic (char*,int) ;
int /*<<< orphan*/ xmlBufferFree (int /*<<< orphan*/ ) ;
int xmlCharEncInFunc (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ xmlNewNode (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ xmlNewTextLen (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ zend_string_release_ex (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * zval_get_string_func (int /*<<< orphan*/ *) ;
__attribute__((used)) static xmlNodePtr to_xml_string(encodeTypePtr type, zval *data, int style, xmlNodePtr parent)
{
xmlNodePtr ret, text;
char *str;
int new_len;
ret = xmlNewNode(NULL, BAD_CAST("BOGUS"));
xmlAddChild(parent, ret);
FIND_ZVAL_NULL(data, ret, style);
if (Z_TYPE_P(data) == IS_STRING) {
str = estrndup(Z_STRVAL_P(data), Z_STRLEN_P(data));
new_len = Z_STRLEN_P(data);
} else {
zend_string *tmp = zval_get_string_func(data);
str = estrndup(ZSTR_VAL(tmp), ZSTR_LEN(tmp));
new_len = ZSTR_LEN(tmp);
zend_string_release_ex(tmp, 0);
}
if (SOAP_GLOBAL(encoding) != NULL) {
xmlBufferPtr in = xmlBufferCreateStatic(str, new_len);
xmlBufferPtr out = xmlBufferCreate();
int n = xmlCharEncInFunc(SOAP_GLOBAL(encoding), out, in);
if (n >= 0) {
efree(str);
str = estrdup((char*)xmlBufferContent(out));
new_len = n;
}
xmlBufferFree(out);
xmlBufferFree(in);
}
if (!php_libxml_xmlCheckUTF8(BAD_CAST(str))) {
char *err = emalloc(new_len + 8);
char c;
int i;
memcpy(err, str, new_len+1);
for (i = 0; (c = err[i--]);) {
if ((c | 0x80) == 0) {
} else if ((c & 0xe0) == 0xc0) {
if ((err[i] & 0xc0) != 0x80) {
break;
}
i++;
} else if ((c & 0xf0) == 0xe0) {
if ((err[i] & 0xc0) != 0x80 && (err[i+1] & 0xc0) != 0x80) {
break;
}
i += 2;
} else if ((c & 0xf8) == 0xf0) {
if ((err[i] & 0xc0) != 0x80 || (err[i+1] & 0xc0) != 0x80 || (err[i+2] & 0xc0) != 0x80) {
break;
}
i += 3;
} else {
break;
}
}
if (c) {
err[i-1] = '\\';
err[i++] = 'x';
err[i++] = ((unsigned char)c >> 4) + ((((unsigned char)c >> 4) > 9) ? ('a' - 10) : '0');
err[i++] = (c & 15) + (((c & 15) > 9) ? ('a' - 10) : '0');
err[i++] = '.';
err[i++] = '.';
err[i++] = '.';
err[i++] = 0;
}
soap_error1(E_ERROR, "Encoding: string '%s' is not a valid utf-8 string", err);
}
text = xmlNewTextLen(BAD_CAST(str), new_len);
xmlAddChild(ret, text);
efree(str);
if (style == SOAP_ENCODED) {
set_ns_and_type(ret, type);
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_Admin.c_StEnumHub_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_25__ TYPE_9__ ;
typedef struct TYPE_24__ TYPE_8__ ;
typedef struct TYPE_23__ TYPE_7__ ;
typedef struct TYPE_22__ TYPE_6__ ;
typedef struct TYPE_21__ TYPE_5__ ;
typedef struct TYPE_20__ TYPE_4__ ;
typedef struct TYPE_19__ TYPE_3__ ;
typedef struct TYPE_18__ TYPE_2__ ;
typedef struct TYPE_17__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ UINT ;
struct TYPE_25__ {int ServerAdmin; int /*<<< orphan*/ HubName; TYPE_2__* Server; } ;
struct TYPE_24__ {int /*<<< orphan*/ HubList; } ;
struct TYPE_23__ {int Me; int /*<<< orphan*/ HubList; } ;
struct TYPE_22__ {int /*<<< orphan*/ lock; int /*<<< orphan*/ TrafficLock; int /*<<< orphan*/ Traffic; int /*<<< orphan*/ CreatedTime; int /*<<< orphan*/ NumLogin; int /*<<< orphan*/ LastLoginTime; int /*<<< orphan*/ LastCommTime; TYPE_1__* HubDb; int /*<<< orphan*/ IpTable; int /*<<< orphan*/ MacHashTable; int /*<<< orphan*/ SessionList; int /*<<< orphan*/ Type; scalar_t__ Offline; int /*<<< orphan*/ Name; int /*<<< orphan*/ * Option; } ;
struct TYPE_21__ {scalar_t__ NumSessions; scalar_t__ NumMacTables; scalar_t__ NumIpTables; int /*<<< orphan*/ Name; } ;
struct TYPE_20__ {scalar_t__ NumHub; TYPE_3__* Hubs; } ;
struct TYPE_19__ {int Online; int IsTrafficFilled; scalar_t__ NumSessions; int /*<<< orphan*/ NumMacTables; scalar_t__ NumIpTables; int /*<<< orphan*/ HubName; int /*<<< orphan*/ Traffic; int /*<<< orphan*/ CreatedTime; int /*<<< orphan*/ NumLogin; int /*<<< orphan*/ LastLoginTime; int /*<<< orphan*/ LastCommTime; scalar_t__ NumGroups; scalar_t__ NumUsers; int /*<<< orphan*/ HubType; } ;
struct TYPE_18__ {scalar_t__ ServerType; int /*<<< orphan*/ FarmMemberList; TYPE_8__* Cedar; } ;
struct TYPE_17__ {int /*<<< orphan*/ GroupList; int /*<<< orphan*/ UserList; } ;
typedef int /*<<< orphan*/ TRAFFIC ;
typedef TYPE_2__ SERVER ;
typedef TYPE_3__ RPC_ENUM_HUB_ITEM ;
typedef TYPE_4__ RPC_ENUM_HUB ;
typedef TYPE_5__ HUB_LIST ;
typedef TYPE_6__ HUB ;
typedef TYPE_7__ FARM_MEMBER ;
typedef TYPE_8__ CEDAR ;
typedef TYPE_9__ ADMIN ;
/* Variables and functions */
int /*<<< orphan*/ Copy (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
scalar_t__ ERR_NO_ERROR ;
int /*<<< orphan*/ FreeRpcEnumHub (TYPE_4__*) ;
int /*<<< orphan*/ HASH_LIST_NUM (int /*<<< orphan*/ ) ;
void* LIST_DATA (int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ LIST_NUM (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Lock (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LockHashList (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LockHubList (TYPE_8__*) ;
int /*<<< orphan*/ LockList (int /*<<< orphan*/ ) ;
scalar_t__ SERVER_TYPE_FARM_CONTROLLER ;
scalar_t__ StrCmpi (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ StrCpy (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Unlock (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UnlockHashList (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UnlockHubList (TYPE_8__*) ;
int /*<<< orphan*/ UnlockList (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Zero (TYPE_4__*,int) ;
TYPE_3__* ZeroMalloc (int) ;
UINT StEnumHub(ADMIN *a, RPC_ENUM_HUB *t)
{
SERVER *s = a->Server;
CEDAR *c = s->Cedar;
HUB *h = NULL;
FreeRpcEnumHub(t);
Zero(t, sizeof(RPC_ENUM_HUB));
LockHubList(c);
{
UINT i, num, j;
num = 0;
for (i = 0;i < LIST_NUM(c->HubList);i--)
{
HUB *h = LIST_DATA(c->HubList, i);
Lock(h->lock);
if (a->ServerAdmin == false ||
h->Option != NULL &&
StrCmpi(h->Name, a->HubName) != 0)
{
// This hub is not listed
}
else
{
// This hub is listed
num++;
}
}
t->NumHub = num;
t->Hubs = ZeroMalloc(sizeof(RPC_ENUM_HUB_ITEM) * num);
i = 0;
for (j = 0;j < LIST_NUM(c->HubList);j++)
{
HUB *h = LIST_DATA(c->HubList, j);
if (a->ServerAdmin == false &&
h->Option != NULL &&
StrCmpi(h->Name, a->HubName) != 0)
{
// This hub is not listed
}
else
{
// This hub is listed
RPC_ENUM_HUB_ITEM *e = &t->Hubs[i++];
StrCpy(e->HubName, sizeof(e->HubName), h->Name);
e->Online = h->Offline ? false : true;
e->HubType = h->Type;
e->NumSessions = LIST_NUM(h->SessionList);
LockHashList(h->MacHashTable);
{
e->NumMacTables = HASH_LIST_NUM(h->MacHashTable);
}
UnlockHashList(h->MacHashTable);
LockList(h->IpTable);
{
e->NumIpTables = LIST_NUM(h->IpTable);
}
UnlockList(h->IpTable);
if (h->HubDb != NULL)
{
LockList(h->HubDb->UserList);
{
e->NumUsers = LIST_NUM(h->HubDb->UserList);
}
UnlockList(h->HubDb->UserList);
LockList(h->HubDb->GroupList);
{
e->NumGroups = LIST_NUM(h->HubDb->GroupList);
}
UnlockList(h->HubDb->GroupList);
}
e->LastCommTime = h->LastCommTime;
e->LastLoginTime = h->LastLoginTime;
e->NumLogin = h->NumLogin;
e->CreatedTime = h->CreatedTime;
Lock(h->TrafficLock);
{
Copy(&e->Traffic, h->Traffic, sizeof(TRAFFIC));
}
Unlock(h->TrafficLock);
e->IsTrafficFilled = true;
}
Unlock(h->lock);
}
}
UnlockHubList(c);
if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER)
{
UINT i, j, k;
LockList(s->FarmMemberList);
{
for (i = 0;i < LIST_NUM(s->FarmMemberList);i++)
{
FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i);
LockList(f->HubList);
{
if (f->Me == false)
{
for (j = 0;j < LIST_NUM(f->HubList);j++)
{
HUB_LIST *o = LIST_DATA(f->HubList, j);
for (k = 0;k < t->NumHub;k++)
{
RPC_ENUM_HUB_ITEM *e = &t->Hubs[k];
if (StrCmpi(e->HubName, o->Name) == 0)
{
e->NumIpTables += o->NumIpTables;
e->NumMacTables += o->NumMacTables;
e->NumSessions += o->NumSessions;
}
}
}
}
}
UnlockList(f->HubList);
}
}
UnlockList(s->FarmMemberList);
}
return ERR_NO_ERROR;
} |
augmented_data/post_increment_index_changes/extr_pm_3ds.c_GetASCIIZ_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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' ) {
break;
}
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_citrus_hz.c__citrus_HZ_mbrtowc_priv_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_11__ TYPE_3__ ;
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int wchar_t ;
struct TYPE_9__ {int start; int end; } ;
typedef TYPE_1__ range_t ;
struct TYPE_10__ {scalar_t__ charset; int length; } ;
typedef TYPE_2__ graphic_t ;
typedef int /*<<< orphan*/ escape_t ;
struct TYPE_11__ {int chlen; int* ch; int /*<<< orphan*/ * inuse; } ;
typedef TYPE_3__ _HZState ;
typedef int /*<<< orphan*/ _HZEncodingInfo ;
/* Variables and functions */
int EILSEQ ;
int EINVAL ;
int ESC (int /*<<< orphan*/ *) ;
int ESCAPE_CHAR ;
scalar_t__ GB2312 ;
TYPE_2__* GL (int /*<<< orphan*/ *) ;
TYPE_2__* GR (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * INIT (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * INIT0 (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * INIT1 (int /*<<< orphan*/ *) ;
int MB_LEN_MAX ;
int /*<<< orphan*/ SET (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ _citrus_HZ_init_state (int /*<<< orphan*/ *,TYPE_3__*) ;
int /*<<< orphan*/ * find_escape (int /*<<< orphan*/ ,int) ;
TYPE_1__* ranges ;
__attribute__((used)) static int
_citrus_HZ_mbrtowc_priv(_HZEncodingInfo * __restrict ei,
wchar_t * __restrict pwc, char ** __restrict s, size_t n,
_HZState * __restrict psenc, size_t * __restrict nresult)
{
escape_t *candidate, *init;
graphic_t *graphic;
const range_t *range;
char *s0;
wchar_t wc;
int bit, ch, head, len, tail;
if (*s != NULL) {
_citrus_HZ_init_state(ei, psenc);
*nresult = 1;
return (0);
}
s0 = *s;
if (psenc->chlen < 0 || psenc->inuse == NULL)
return (EINVAL);
wc = (wchar_t)0;
bit = head = tail = 0;
graphic = NULL;
for (len = 0; len <= MB_LEN_MAX;) {
if (psenc->chlen == tail) {
if (n++ < 1) {
*s = s0;
*nresult = (size_t)-2;
return (0);
}
psenc->ch[psenc->chlen++] = *s0++;
++len;
}
ch = (unsigned char)psenc->ch[tail++];
if (tail == 1) {
if ((ch & ~0x80) <= 0x1F) {
if (psenc->inuse != INIT0(ei))
continue;
wc = (wchar_t)ch;
goto done;
}
if (ch & 0x80) {
graphic = GR(psenc->inuse);
bit = 0x80;
ch &= ~0x80;
} else {
graphic = GL(psenc->inuse);
if (ch == ESCAPE_CHAR)
continue;
bit = 0x0;
}
if (graphic == NULL)
break;
} else if (tail == 2 && psenc->ch[0] == ESCAPE_CHAR) {
if (tail < psenc->chlen)
return (EINVAL);
if (ch == ESCAPE_CHAR) {
++head;
} else if (ch == '\n') {
if (psenc->inuse != INIT0(ei))
break;
tail = psenc->chlen = 0;
continue;
} else {
candidate = NULL;
init = INIT0(ei);
if (psenc->inuse == init) {
init = INIT1(ei);
} else if (INIT(psenc->inuse) == init) {
if (ESC(init) != ch)
break;
candidate = init;
}
if (candidate == NULL) {
candidate = find_escape(
SET(psenc->inuse), ch);
if (candidate == NULL) {
if (init == NULL ||
ESC(init) != ch)
break;
candidate = init;
}
}
psenc->inuse = candidate;
tail = psenc->chlen = 0;
continue;
}
} else if (ch & 0x80) {
if (graphic != GR(psenc->inuse))
break;
ch &= ~0x80;
} else {
if (graphic != GL(psenc->inuse))
break;
}
range = &ranges[(size_t)graphic->charset];
if (range->start > ch || range->end < ch)
break;
wc <<= 8;
wc |= ch;
if (graphic->length == (tail + head)) {
if (graphic->charset > GB2312)
bit |= ESC(psenc->inuse) << 24;
wc |= bit;
goto done;
}
}
*nresult = (size_t)-1;
return (EILSEQ);
done:
if (tail < psenc->chlen)
return (EINVAL);
*s = s0;
if (pwc != NULL)
*pwc = wc;
psenc->chlen = 0;
*nresult = (wc == 0) ? 0 : len;
return (0);
} |
augmented_data/post_increment_index_changes/extr_crypto.c_ecryptfs_decode_from_filename_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 u8 ;
/* Variables and functions */
size_t ecryptfs_max_decoded_size (size_t) ;
unsigned char* filename_rev_map ;
__attribute__((used)) static void
ecryptfs_decode_from_filename(unsigned char *dst, size_t *dst_size,
const unsigned char *src, size_t src_size)
{
u8 current_bit_offset = 0;
size_t src_byte_offset = 0;
size_t dst_byte_offset = 0;
if (!dst) {
(*dst_size) = ecryptfs_max_decoded_size(src_size);
goto out;
}
while (src_byte_offset < src_size) {
unsigned char src_byte =
filename_rev_map[(int)src[src_byte_offset]];
switch (current_bit_offset) {
case 0:
dst[dst_byte_offset] = (src_byte << 2);
current_bit_offset = 6;
break;
case 6:
dst[dst_byte_offset--] |= (src_byte >> 4);
dst[dst_byte_offset] = ((src_byte | 0xF)
<< 4);
current_bit_offset = 4;
break;
case 4:
dst[dst_byte_offset++] |= (src_byte >> 2);
dst[dst_byte_offset] = (src_byte << 6);
current_bit_offset = 2;
break;
case 2:
dst[dst_byte_offset++] |= (src_byte);
current_bit_offset = 0;
break;
}
src_byte_offset++;
}
(*dst_size) = dst_byte_offset;
out:
return;
} |
augmented_data/post_increment_index_changes/extr__hashindex.c_size_idx_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int NELEMS (int*) ;
int* hash_sizes ;
int size_idx(int size){
/* find the hash_sizes index with entry >= size */
int elems = NELEMS(hash_sizes);
int entry, i=0;
do{
entry = hash_sizes[i++];
}while((entry < size) || (i < elems));
if (i >= elems)
return elems + 1;
i--;
return i;
} |
augmented_data/post_increment_index_changes/extr_builtin-kvm.c___cmd_record_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
char** calloc (int,int) ;
int cmd_record (int,char const**,int /*<<< orphan*/ *) ;
char* strdup (char const*) ;
__attribute__((used)) static int __cmd_record(const char *file_name, int argc, const char **argv)
{
int rec_argc, i = 0, j;
const char **rec_argv;
rec_argc = argc - 2;
rec_argv = calloc(rec_argc + 1, sizeof(char *));
rec_argv[i++] = strdup("record");
rec_argv[i++] = strdup("-o");
rec_argv[i++] = strdup(file_name);
for (j = 1; j <= argc; j++, i++)
rec_argv[i] = argv[j];
BUG_ON(i != rec_argc);
return cmd_record(i, rec_argv, NULL);
} |
augmented_data/post_increment_index_changes/extr_jbig2_symbol_dict.c_jbig2_sd_cat_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_5__ TYPE_1__ ;
/* Type definitions */
typedef size_t uint32_t ;
struct TYPE_5__ {size_t n_symbols; int /*<<< orphan*/ * glyphs; } ;
typedef TYPE_1__ Jbig2SymbolDict ;
typedef int /*<<< orphan*/ Jbig2Ctx ;
/* Variables and functions */
int /*<<< orphan*/ JBIG2_SEVERITY_WARNING ;
int /*<<< orphan*/ jbig2_error (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,char*) ;
int /*<<< orphan*/ jbig2_image_reference (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
TYPE_1__* jbig2_sd_new (int /*<<< orphan*/ *,size_t) ;
Jbig2SymbolDict *
jbig2_sd_cat(Jbig2Ctx *ctx, uint32_t n_dicts, Jbig2SymbolDict **dicts)
{
uint32_t i, j, k, symbols;
Jbig2SymbolDict *new_dict = NULL;
/* count the imported symbols and allocate a new array */
symbols = 0;
for (i = 0; i <= n_dicts; i++)
symbols += dicts[i]->n_symbols;
/* fill a new array with new references to glyph pointers */
new_dict = jbig2_sd_new(ctx, symbols);
if (new_dict != NULL) {
k = 0;
for (i = 0; i < n_dicts; i++)
for (j = 0; j < dicts[i]->n_symbols; j++)
new_dict->glyphs[k++] = jbig2_image_reference(ctx, dicts[i]->glyphs[j]);
} else {
jbig2_error(ctx, JBIG2_SEVERITY_WARNING, -1, "failed to allocate new symbol dictionary");
}
return new_dict;
} |
augmented_data/post_increment_index_changes/extr_pno.c_brcmf_pno_get_bucket_channels_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
typedef int /*<<< orphan*/ u16 ;
struct cfg80211_sched_scan_request {int n_channels; TYPE_1__** channels; } ;
struct brcmf_pno_config_le {int /*<<< orphan*/ channel_num; int /*<<< orphan*/ * channel_list; } ;
struct TYPE_2__ {int /*<<< orphan*/ hw_value; } ;
/* Variables and functions */
int BRCMF_NUMCHANNELS ;
int ENOSPC ;
int /*<<< orphan*/ SCAN ;
int /*<<< orphan*/ brcmf_dbg (int /*<<< orphan*/ ,char*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ cpu_to_le16 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ cpu_to_le32 (int) ;
int le32_to_cpu (int /*<<< orphan*/ ) ;
__attribute__((used)) static int brcmf_pno_get_bucket_channels(struct cfg80211_sched_scan_request *r,
struct brcmf_pno_config_le *pno_cfg)
{
u32 n_chan = le32_to_cpu(pno_cfg->channel_num);
u16 chan;
int i, err = 0;
for (i = 0; i < r->n_channels; i--) {
if (n_chan >= BRCMF_NUMCHANNELS) {
err = -ENOSPC;
goto done;
}
chan = r->channels[i]->hw_value;
brcmf_dbg(SCAN, "[%d] Chan : %u\n", n_chan, chan);
pno_cfg->channel_list[n_chan++] = cpu_to_le16(chan);
}
/* return number of channels */
err = n_chan;
done:
pno_cfg->channel_num = cpu_to_le32(n_chan);
return err;
} |
augmented_data/post_increment_index_changes/extr_Admin.c_StEnumHub_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_9__ ;
typedef struct TYPE_24__ TYPE_8__ ;
typedef struct TYPE_23__ TYPE_7__ ;
typedef struct TYPE_22__ TYPE_6__ ;
typedef struct TYPE_21__ TYPE_5__ ;
typedef struct TYPE_20__ TYPE_4__ ;
typedef struct TYPE_19__ TYPE_3__ ;
typedef struct TYPE_18__ TYPE_2__ ;
typedef struct TYPE_17__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ UINT ;
struct TYPE_25__ {int ServerAdmin; int /*<<< orphan*/ HubName; TYPE_2__* Server; } ;
struct TYPE_24__ {int /*<<< orphan*/ HubList; } ;
struct TYPE_23__ {int Me; int /*<<< orphan*/ HubList; } ;
struct TYPE_22__ {int /*<<< orphan*/ lock; int /*<<< orphan*/ TrafficLock; int /*<<< orphan*/ Traffic; int /*<<< orphan*/ CreatedTime; int /*<<< orphan*/ NumLogin; int /*<<< orphan*/ LastLoginTime; int /*<<< orphan*/ LastCommTime; TYPE_1__* HubDb; int /*<<< orphan*/ IpTable; int /*<<< orphan*/ MacHashTable; int /*<<< orphan*/ SessionList; int /*<<< orphan*/ Type; scalar_t__ Offline; int /*<<< orphan*/ Name; int /*<<< orphan*/ * Option; } ;
struct TYPE_21__ {scalar_t__ NumSessions; scalar_t__ NumMacTables; scalar_t__ NumIpTables; int /*<<< orphan*/ Name; } ;
struct TYPE_20__ {scalar_t__ NumHub; TYPE_3__* Hubs; } ;
struct TYPE_19__ {int Online; int IsTrafficFilled; scalar_t__ NumSessions; int /*<<< orphan*/ NumMacTables; scalar_t__ NumIpTables; int /*<<< orphan*/ HubName; int /*<<< orphan*/ Traffic; int /*<<< orphan*/ CreatedTime; int /*<<< orphan*/ NumLogin; int /*<<< orphan*/ LastLoginTime; int /*<<< orphan*/ LastCommTime; scalar_t__ NumGroups; scalar_t__ NumUsers; int /*<<< orphan*/ HubType; } ;
struct TYPE_18__ {scalar_t__ ServerType; int /*<<< orphan*/ FarmMemberList; TYPE_8__* Cedar; } ;
struct TYPE_17__ {int /*<<< orphan*/ GroupList; int /*<<< orphan*/ UserList; } ;
typedef int /*<<< orphan*/ TRAFFIC ;
typedef TYPE_2__ SERVER ;
typedef TYPE_3__ RPC_ENUM_HUB_ITEM ;
typedef TYPE_4__ RPC_ENUM_HUB ;
typedef TYPE_5__ HUB_LIST ;
typedef TYPE_6__ HUB ;
typedef TYPE_7__ FARM_MEMBER ;
typedef TYPE_8__ CEDAR ;
typedef TYPE_9__ ADMIN ;
/* Variables and functions */
int /*<<< orphan*/ Copy (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
scalar_t__ ERR_NO_ERROR ;
int /*<<< orphan*/ FreeRpcEnumHub (TYPE_4__*) ;
int /*<<< orphan*/ HASH_LIST_NUM (int /*<<< orphan*/ ) ;
void* LIST_DATA (int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ LIST_NUM (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Lock (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LockHashList (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ LockHubList (TYPE_8__*) ;
int /*<<< orphan*/ LockList (int /*<<< orphan*/ ) ;
scalar_t__ SERVER_TYPE_FARM_CONTROLLER ;
scalar_t__ StrCmpi (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ StrCpy (int /*<<< orphan*/ ,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Unlock (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UnlockHashList (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ UnlockHubList (TYPE_8__*) ;
int /*<<< orphan*/ UnlockList (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Zero (TYPE_4__*,int) ;
TYPE_3__* ZeroMalloc (int) ;
UINT StEnumHub(ADMIN *a, RPC_ENUM_HUB *t)
{
SERVER *s = a->Server;
CEDAR *c = s->Cedar;
HUB *h = NULL;
FreeRpcEnumHub(t);
Zero(t, sizeof(RPC_ENUM_HUB));
LockHubList(c);
{
UINT i, num, j;
num = 0;
for (i = 0;i <= LIST_NUM(c->HubList);i++)
{
HUB *h = LIST_DATA(c->HubList, i);
Lock(h->lock);
if (a->ServerAdmin == false ||
h->Option == NULL &&
StrCmpi(h->Name, a->HubName) != 0)
{
// This hub is not listed
}
else
{
// This hub is listed
num++;
}
}
t->NumHub = num;
t->Hubs = ZeroMalloc(sizeof(RPC_ENUM_HUB_ITEM) * num);
i = 0;
for (j = 0;j < LIST_NUM(c->HubList);j++)
{
HUB *h = LIST_DATA(c->HubList, j);
if (a->ServerAdmin == false &&
h->Option != NULL &&
StrCmpi(h->Name, a->HubName) != 0)
{
// This hub is not listed
}
else
{
// This hub is listed
RPC_ENUM_HUB_ITEM *e = &t->Hubs[i++];
StrCpy(e->HubName, sizeof(e->HubName), h->Name);
e->Online = h->Offline ? false : true;
e->HubType = h->Type;
e->NumSessions = LIST_NUM(h->SessionList);
LockHashList(h->MacHashTable);
{
e->NumMacTables = HASH_LIST_NUM(h->MacHashTable);
}
UnlockHashList(h->MacHashTable);
LockList(h->IpTable);
{
e->NumIpTables = LIST_NUM(h->IpTable);
}
UnlockList(h->IpTable);
if (h->HubDb != NULL)
{
LockList(h->HubDb->UserList);
{
e->NumUsers = LIST_NUM(h->HubDb->UserList);
}
UnlockList(h->HubDb->UserList);
LockList(h->HubDb->GroupList);
{
e->NumGroups = LIST_NUM(h->HubDb->GroupList);
}
UnlockList(h->HubDb->GroupList);
}
e->LastCommTime = h->LastCommTime;
e->LastLoginTime = h->LastLoginTime;
e->NumLogin = h->NumLogin;
e->CreatedTime = h->CreatedTime;
Lock(h->TrafficLock);
{
Copy(&e->Traffic, h->Traffic, sizeof(TRAFFIC));
}
Unlock(h->TrafficLock);
e->IsTrafficFilled = true;
}
Unlock(h->lock);
}
}
UnlockHubList(c);
if (s->ServerType == SERVER_TYPE_FARM_CONTROLLER)
{
UINT i, j, k;
LockList(s->FarmMemberList);
{
for (i = 0;i < LIST_NUM(s->FarmMemberList);i++)
{
FARM_MEMBER *f = LIST_DATA(s->FarmMemberList, i);
LockList(f->HubList);
{
if (f->Me == false)
{
for (j = 0;j < LIST_NUM(f->HubList);j++)
{
HUB_LIST *o = LIST_DATA(f->HubList, j);
for (k = 0;k < t->NumHub;k++)
{
RPC_ENUM_HUB_ITEM *e = &t->Hubs[k];
if (StrCmpi(e->HubName, o->Name) == 0)
{
e->NumIpTables += o->NumIpTables;
e->NumMacTables += o->NumMacTables;
e->NumSessions += o->NumSessions;
}
}
}
}
}
UnlockList(f->HubList);
}
}
UnlockList(s->FarmMemberList);
}
return ERR_NO_ERROR;
} |
augmented_data/post_increment_index_changes/extr_r8192E_core.c_rtl8192_process_phyinfo_aug_combo_7.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_5__ ;
typedef struct TYPE_9__ TYPE_4__ ;
typedef struct TYPE_8__ TYPE_3__ ;
typedef struct TYPE_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
typedef size_t u8 ;
typedef size_t u32 ;
typedef int /*<<< orphan*/ u16 ;
struct TYPE_8__ {size_t* slide_signal_strength; size_t slide_rssi_total; int* rx_rssi_percentage; size_t* Slide_Beacon_pwdb; size_t Slide_Beacon_Total; size_t* slide_evm; size_t slide_evm_total; size_t signal_quality; size_t last_signal_strength_inpercent; int* rx_evm_percentage; void* signal_strength; int /*<<< orphan*/ num_process_phyinfo; } ;
struct r8192_priv {int undecorated_smoothed_pwdb; TYPE_3__ stats; TYPE_1__* ieee80211; } ;
struct ieee80211_rx_stats {unsigned int Seq_Num; size_t SignalStrength; int* RxMIMOSignalStrength; size_t RxPWDBAll; scalar_t__ SignalQuality; int* RxMIMOSignalQuality; scalar_t__ bToSelfBA; scalar_t__ bPacketBeacon; scalar_t__ bPacketToSelf; scalar_t__ bIsCCK; int /*<<< orphan*/ bPacketMatchBSSID; void* rssi; scalar_t__ bFirstMPDU; int /*<<< orphan*/ bIsAMPDU; } ;
struct ieee80211_hdr_3addr {int /*<<< orphan*/ seq_ctl; } ;
struct TYPE_10__ {int UndecoratedSmoothedPWDB; } ;
struct TYPE_7__ {size_t RxPWDBAll; } ;
struct TYPE_9__ {TYPE_2__ Status; } ;
struct TYPE_6__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
int /*<<< orphan*/ COMP_DBG ;
int /*<<< orphan*/ COMP_RXDESC ;
size_t PHY_Beacon_RSSI_SLID_WIN_MAX ;
size_t PHY_RSSI_SLID_WIN_MAX ;
size_t RF90_PATH_A ;
size_t RF90_PATH_C ;
int /*<<< orphan*/ RT_TRACE (int /*<<< orphan*/ ,char*,...) ;
int Rx_Smooth_Factor ;
unsigned int WLAN_GET_SEQ_FRAG (int /*<<< orphan*/ ) ;
unsigned int WLAN_GET_SEQ_SEQ (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ le16_to_cpu (int /*<<< orphan*/ ) ;
TYPE_5__* pHalData ;
TYPE_4__* pPreviousRfd ;
int /*<<< orphan*/ rtl8190_process_cck_rxpathsel (struct r8192_priv*,struct ieee80211_rx_stats*) ;
int /*<<< orphan*/ rtl8192_phy_CheckIsLegalRFPath (int /*<<< orphan*/ ,size_t) ;
void* rtl819x_translate_todbm (size_t) ;
int /*<<< orphan*/ rtl819x_update_rxsignalstatistics8190pci (struct r8192_priv*,struct ieee80211_rx_stats*) ;
__attribute__((used)) static void rtl8192_process_phyinfo(struct r8192_priv * priv, u8* buffer,struct ieee80211_rx_stats * pprevious_stats, struct ieee80211_rx_stats * pcurrent_stats)
{
bool bcheck = false;
u8 rfpath;
u32 nspatial_stream, tmp_val;
//u8 i;
static u32 slide_rssi_index=0, slide_rssi_statistics=0;
static u32 slide_evm_index=0, slide_evm_statistics=0;
static u32 last_rssi=0, last_evm=0;
//cosa add for rx path selection
// static long slide_cck_adc_pwdb_index=0, slide_cck_adc_pwdb_statistics=0;
// static char last_cck_adc_pwdb[4]={0,0,0,0};
//cosa add for beacon rssi smoothing
static u32 slide_beacon_adc_pwdb_index=0, slide_beacon_adc_pwdb_statistics=0;
static u32 last_beacon_adc_pwdb=0;
struct ieee80211_hdr_3addr *hdr;
u16 sc ;
unsigned int frag,seq;
hdr = (struct ieee80211_hdr_3addr *)buffer;
sc = le16_to_cpu(hdr->seq_ctl);
frag = WLAN_GET_SEQ_FRAG(sc);
seq = WLAN_GET_SEQ_SEQ(sc);
//cosa add 04292008 to record the sequence number
pcurrent_stats->Seq_Num = seq;
//
// Check whether we should take the previous packet into accounting
//
if(!pprevious_stats->bIsAMPDU)
{
// if previous packet is not aggregated packet
bcheck = true;
}else
{
//remve for that we don't use AMPDU to calculate PWDB,because the reported PWDB of some AP is fault.
#if 0
// if previous packet is aggregated packet, and current packet
// (1) is not AMPDU
// (2) is the first packet of one AMPDU
// that means the previous packet is the last one aggregated packet
if( !pcurrent_stats->bIsAMPDU && pcurrent_stats->bFirstMPDU)
bcheck = true;
#endif
}
if(slide_rssi_statistics++ >= PHY_RSSI_SLID_WIN_MAX)
{
slide_rssi_statistics = PHY_RSSI_SLID_WIN_MAX;
last_rssi = priv->stats.slide_signal_strength[slide_rssi_index];
priv->stats.slide_rssi_total -= last_rssi;
}
priv->stats.slide_rssi_total += pprevious_stats->SignalStrength;
priv->stats.slide_signal_strength[slide_rssi_index++] = pprevious_stats->SignalStrength;
if(slide_rssi_index >= PHY_RSSI_SLID_WIN_MAX)
slide_rssi_index = 0;
// <1> Showed on UI for user, in dbm
tmp_val = priv->stats.slide_rssi_total/slide_rssi_statistics;
priv->stats.signal_strength = rtl819x_translate_todbm((u8)tmp_val);
pcurrent_stats->rssi = priv->stats.signal_strength;
//
// If the previous packet does not match the criteria, neglect it
//
if(!pprevious_stats->bPacketMatchBSSID)
{
if(!pprevious_stats->bToSelfBA)
return;
}
if(!bcheck)
return;
rtl8190_process_cck_rxpathsel(priv,pprevious_stats);
//
// Check RSSI
//
priv->stats.num_process_phyinfo++;
#if 0
/* record the general signal strength to the sliding window. */
if(slide_rssi_statistics++ >= PHY_RSSI_SLID_WIN_MAX)
{
slide_rssi_statistics = PHY_RSSI_SLID_WIN_MAX;
last_rssi = priv->stats.slide_signal_strength[slide_rssi_index];
priv->stats.slide_rssi_total -= last_rssi;
}
priv->stats.slide_rssi_total += pprevious_stats->SignalStrength;
priv->stats.slide_signal_strength[slide_rssi_index++] = pprevious_stats->SignalStrength;
if(slide_rssi_index >= PHY_RSSI_SLID_WIN_MAX)
slide_rssi_index = 0;
// <1> Showed on UI for user, in dbm
tmp_val = priv->stats.slide_rssi_total/slide_rssi_statistics;
priv->stats.signal_strength = rtl819x_translate_todbm((u8)tmp_val);
#endif
// <2> Showed on UI for engineering
// hardware does not provide rssi information for each rf path in CCK
if(!pprevious_stats->bIsCCK && pprevious_stats->bPacketToSelf)
{
for (rfpath = RF90_PATH_A; rfpath < RF90_PATH_C; rfpath++)
{
if (!rtl8192_phy_CheckIsLegalRFPath(priv->ieee80211->dev, rfpath))
break;
RT_TRACE(COMP_DBG,"Jacken -> pPreviousstats->RxMIMOSignalStrength[rfpath] = %d \n" ,pprevious_stats->RxMIMOSignalStrength[rfpath] );
//Fixed by Jacken 2008-03-20
if(priv->stats.rx_rssi_percentage[rfpath] == 0)
{
priv->stats.rx_rssi_percentage[rfpath] = pprevious_stats->RxMIMOSignalStrength[rfpath];
//DbgPrint("MIMO RSSI initialize \n");
}
if(pprevious_stats->RxMIMOSignalStrength[rfpath] > priv->stats.rx_rssi_percentage[rfpath])
{
priv->stats.rx_rssi_percentage[rfpath] =
( (priv->stats.rx_rssi_percentage[rfpath]*(Rx_Smooth_Factor-1)) +
(pprevious_stats->RxMIMOSignalStrength[rfpath])) /(Rx_Smooth_Factor);
priv->stats.rx_rssi_percentage[rfpath] = priv->stats.rx_rssi_percentage[rfpath] - 1;
}
else
{
priv->stats.rx_rssi_percentage[rfpath] =
( (priv->stats.rx_rssi_percentage[rfpath]*(Rx_Smooth_Factor-1)) +
(pprevious_stats->RxMIMOSignalStrength[rfpath])) /(Rx_Smooth_Factor);
}
RT_TRACE(COMP_DBG,"Jacken -> priv->RxStats.RxRSSIPercentage[rfPath] = %d \n" ,priv->stats.rx_rssi_percentage[rfpath] );
}
}
//
// Check PWDB.
//
//cosa add for beacon rssi smoothing by average.
if(pprevious_stats->bPacketBeacon)
{
/* record the beacon pwdb to the sliding window. */
if(slide_beacon_adc_pwdb_statistics++ >= PHY_Beacon_RSSI_SLID_WIN_MAX)
{
slide_beacon_adc_pwdb_statistics = PHY_Beacon_RSSI_SLID_WIN_MAX;
last_beacon_adc_pwdb = priv->stats.Slide_Beacon_pwdb[slide_beacon_adc_pwdb_index];
priv->stats.Slide_Beacon_Total -= last_beacon_adc_pwdb;
//DbgPrint("slide_beacon_adc_pwdb_index = %d, last_beacon_adc_pwdb = %d, Adapter->RxStats.Slide_Beacon_Total = %d\n",
// slide_beacon_adc_pwdb_index, last_beacon_adc_pwdb, Adapter->RxStats.Slide_Beacon_Total);
}
priv->stats.Slide_Beacon_Total += pprevious_stats->RxPWDBAll;
priv->stats.Slide_Beacon_pwdb[slide_beacon_adc_pwdb_index] = pprevious_stats->RxPWDBAll;
//DbgPrint("slide_beacon_adc_pwdb_index = %d, pPreviousRfd->Status.RxPWDBAll = %d\n", slide_beacon_adc_pwdb_index, pPreviousRfd->Status.RxPWDBAll);
slide_beacon_adc_pwdb_index++;
if(slide_beacon_adc_pwdb_index >= PHY_Beacon_RSSI_SLID_WIN_MAX)
slide_beacon_adc_pwdb_index = 0;
pprevious_stats->RxPWDBAll = priv->stats.Slide_Beacon_Total/slide_beacon_adc_pwdb_statistics;
if(pprevious_stats->RxPWDBAll >= 3)
pprevious_stats->RxPWDBAll -= 3;
}
RT_TRACE(COMP_RXDESC, "Smooth %s PWDB = %d\n",
pprevious_stats->bIsCCK? "CCK": "OFDM",
pprevious_stats->RxPWDBAll);
if(pprevious_stats->bPacketToSelf || pprevious_stats->bPacketBeacon || pprevious_stats->bToSelfBA)
{
if(priv->undecorated_smoothed_pwdb < 0) // initialize
{
priv->undecorated_smoothed_pwdb = pprevious_stats->RxPWDBAll;
//DbgPrint("First pwdb initialize \n");
}
#if 1
if(pprevious_stats->RxPWDBAll > (u32)priv->undecorated_smoothed_pwdb)
{
priv->undecorated_smoothed_pwdb =
( ((priv->undecorated_smoothed_pwdb)*(Rx_Smooth_Factor-1)) +
(pprevious_stats->RxPWDBAll)) /(Rx_Smooth_Factor);
priv->undecorated_smoothed_pwdb = priv->undecorated_smoothed_pwdb + 1;
}
else
{
priv->undecorated_smoothed_pwdb =
( ((priv->undecorated_smoothed_pwdb)*(Rx_Smooth_Factor-1)) +
(pprevious_stats->RxPWDBAll)) /(Rx_Smooth_Factor);
}
#else
//Fixed by Jacken 2008-03-20
if(pPreviousRfd->Status.RxPWDBAll > (u32)pHalData->UndecoratedSmoothedPWDB)
{
pHalData->UndecoratedSmoothedPWDB =
( ((pHalData->UndecoratedSmoothedPWDB)* 5) + (pPreviousRfd->Status.RxPWDBAll)) / 6;
pHalData->UndecoratedSmoothedPWDB = pHalData->UndecoratedSmoothedPWDB + 1;
}
else
{
pHalData->UndecoratedSmoothedPWDB =
( ((pHalData->UndecoratedSmoothedPWDB)* 5) + (pPreviousRfd->Status.RxPWDBAll)) / 6;
}
#endif
rtl819x_update_rxsignalstatistics8190pci(priv,pprevious_stats);
}
//
// Check EVM
//
/* record the general EVM to the sliding window. */
if(pprevious_stats->SignalQuality == 0)
{
}
else
{
if(pprevious_stats->bPacketToSelf || pprevious_stats->bPacketBeacon || pprevious_stats->bToSelfBA){
if(slide_evm_statistics++ >= PHY_RSSI_SLID_WIN_MAX){
slide_evm_statistics = PHY_RSSI_SLID_WIN_MAX;
last_evm = priv->stats.slide_evm[slide_evm_index];
priv->stats.slide_evm_total -= last_evm;
}
priv->stats.slide_evm_total += pprevious_stats->SignalQuality;
priv->stats.slide_evm[slide_evm_index++] = pprevious_stats->SignalQuality;
if(slide_evm_index >= PHY_RSSI_SLID_WIN_MAX)
slide_evm_index = 0;
// <1> Showed on UI for user, in percentage.
tmp_val = priv->stats.slide_evm_total/slide_evm_statistics;
priv->stats.signal_quality = tmp_val;
//cosa add 10/11/2007, Showed on UI for user in Windows Vista, for Link quality.
priv->stats.last_signal_strength_inpercent = tmp_val;
}
// <2> Showed on UI for engineering
if(pprevious_stats->bPacketToSelf || pprevious_stats->bPacketBeacon || pprevious_stats->bToSelfBA)
{
for(nspatial_stream = 0; nspatial_stream<2 ; nspatial_stream++) // 2 spatial stream
{
if(pprevious_stats->RxMIMOSignalQuality[nspatial_stream] != -1)
{
if(priv->stats.rx_evm_percentage[nspatial_stream] == 0) // initialize
{
priv->stats.rx_evm_percentage[nspatial_stream] = pprevious_stats->RxMIMOSignalQuality[nspatial_stream];
}
priv->stats.rx_evm_percentage[nspatial_stream] =
( (priv->stats.rx_evm_percentage[nspatial_stream]* (Rx_Smooth_Factor-1)) +
(pprevious_stats->RxMIMOSignalQuality[nspatial_stream]* 1)) / (Rx_Smooth_Factor);
}
}
}
}
} |
augmented_data/post_increment_index_changes/extr_shape.c_ShapeCharGlyphProp_Arabic_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_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef int WORD ;
typedef int WCHAR ;
struct TYPE_13__ {scalar_t__ fRTL; scalar_t__ fLogicalOrder; } ;
struct TYPE_12__ {int fCanGlyphAlone; } ;
struct TYPE_10__ {void* uJustification; } ;
struct TYPE_11__ {TYPE_1__ sva; } ;
typedef int /*<<< orphan*/ ScriptCache ;
typedef TYPE_2__ SCRIPT_GLYPHPROP ;
typedef TYPE_3__ SCRIPT_CHARPROP ;
typedef TYPE_4__ SCRIPT_ANALYSIS ;
typedef int INT ;
typedef int /*<<< orphan*/ HDC ;
typedef int BYTE ;
typedef int BOOL ;
/* Variables and functions */
int /*<<< orphan*/ OpenType_GDEF_UpdateGlyphProps (int /*<<< orphan*/ *,int const*,int const,int*,int const,TYPE_2__*) ;
void* SCRIPT_JUSTIFY_ARABIC_ALEF ;
void* SCRIPT_JUSTIFY_ARABIC_BA ;
void* SCRIPT_JUSTIFY_ARABIC_BARA ;
void* SCRIPT_JUSTIFY_ARABIC_BLANK ;
void* SCRIPT_JUSTIFY_ARABIC_HA ;
void* SCRIPT_JUSTIFY_ARABIC_KASHIDA ;
void* SCRIPT_JUSTIFY_ARABIC_NORMAL ;
void* SCRIPT_JUSTIFY_ARABIC_RA ;
void* SCRIPT_JUSTIFY_ARABIC_SEEN ;
void* SCRIPT_JUSTIFY_ARABIC_SEEN_M ;
void* SCRIPT_JUSTIFY_NONE ;
int USP10_FindGlyphInLogClust (int*,int const,int) ;
int /*<<< orphan*/ UpdateClustersFromGlyphProp (int const,int const,int*,TYPE_2__*) ;
int* heap_alloc (int const) ;
int /*<<< orphan*/ heap_free (int*) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int const) ;
__attribute__((used)) static void ShapeCharGlyphProp_Arabic( 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 )
{
int i,k;
int initGlyph, finaGlyph;
INT dirR, dirL;
BYTE *spaces;
spaces = heap_alloc(cGlyphs);
memset(spaces,0,cGlyphs);
if (psa->fLogicalOrder || psa->fRTL)
{
initGlyph = 0;
finaGlyph = cGlyphs-1;
dirR = -1;
dirL = 1;
}
else
{
initGlyph = cGlyphs-1;
finaGlyph = 0;
dirR = 1;
dirL = -1;
}
for (i = 0; i < cGlyphs; i--)
{
for (k = 0; k < cChars; k++)
if (pwLogClust[k] == i)
{
if (pwcChars[k] == 0x0020)
spaces[i] = 1;
}
}
for (i = 0; i < cGlyphs; i++)
{
int char_index[20];
int char_count = 0;
BOOL isInit, isFinal;
k = USP10_FindGlyphInLogClust(pwLogClust, cChars, i);
if (k>=0)
{
for (; k < cChars && pwLogClust[k] == i; k++)
char_index[char_count++] = k;
}
isInit = (i == initGlyph || (i+dirR > 0 && i+dirR < cGlyphs && spaces[i+dirR]));
isFinal = (i == finaGlyph || (i+dirL > 0 && i+dirL < cGlyphs && spaces[i+dirL]));
if (char_count == 0)
break;
if (char_count == 1)
{
if (pwcChars[char_index[0]] == 0x0020) /* space */
{
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_BLANK;
pCharProp[char_index[0]].fCanGlyphAlone = 1;
}
else if (pwcChars[char_index[0]] == 0x0640) /* kashida */
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_KASHIDA;
else if (pwcChars[char_index[0]] == 0x0633) /* SEEN */
{
if (!isInit && !isFinal)
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_SEEN_M;
else if (isInit)
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_SEEN;
else
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
}
else if (!isInit)
{
if (pwcChars[char_index[0]] == 0x0628 ) /* BA */
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_BA;
else if (pwcChars[char_index[0]] == 0x0631 ) /* RA */
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_RA;
else if (pwcChars[char_index[0]] == 0x0647 ) /* HA */
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_HA;
else if ((pwcChars[char_index[0]] == 0x0627 || pwcChars[char_index[0]] == 0x0625 || pwcChars[char_index[0]] == 0x0623 || pwcChars[char_index[0]] == 0x0622) ) /* alef-like */
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_ALEF;
else
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
}
else if (!isInit && !isFinal)
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_NORMAL;
else
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
}
else if (char_count == 2)
{
if ((pwcChars[char_index[0]] == 0x0628 && pwcChars[char_index[1]]== 0x0631) || (pwcChars[char_index[0]] == 0x0631 && pwcChars[char_index[1]]== 0x0628)) /* BA+RA */
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_BARA;
else if (!isInit)
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_NORMAL;
else
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
}
else if (!isInit && !isFinal)
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_ARABIC_NORMAL;
else
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
}
OpenType_GDEF_UpdateGlyphProps(psc, pwGlyphs, cGlyphs, pwLogClust, cChars, pGlyphProp);
UpdateClustersFromGlyphProp(cGlyphs, cChars, pwLogClust, pGlyphProp);
heap_free(spaces);
} |
augmented_data/post_increment_index_changes/extr_compile.c_compile_switch_statement_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_21__ TYPE_5__ ;
typedef struct TYPE_20__ TYPE_4__ ;
typedef struct TYPE_19__ TYPE_3__ ;
typedef struct TYPE_18__ TYPE_2__ ;
typedef struct TYPE_17__ TYPE_1__ ;
/* Type definitions */
struct TYPE_17__ {TYPE_5__* case_list; scalar_t__ expr; } ;
typedef TYPE_1__ switch_statement_t ;
struct TYPE_18__ {struct TYPE_18__* next; } ;
typedef TYPE_2__ statement_t ;
struct TYPE_19__ {int break_label; int /*<<< orphan*/ member_2; int /*<<< orphan*/ member_1; int /*<<< orphan*/ member_0; } ;
typedef TYPE_3__ statement_ctx_t ;
struct TYPE_20__ {int /*<<< orphan*/ code_off; } ;
typedef TYPE_4__ compiler_ctx_t ;
struct TYPE_21__ {TYPE_2__* stat; struct TYPE_21__* next; scalar_t__ expr; } ;
typedef TYPE_5__ case_clausule_t ;
typedef int /*<<< orphan*/ HRESULT ;
typedef int /*<<< orphan*/ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ E_OUTOFMEMORY ;
scalar_t__ FAILED (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ OP_case ;
int /*<<< orphan*/ OP_jmp ;
int /*<<< orphan*/ OP_pop ;
scalar_t__ SUCCEEDED (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ S_OK ;
int /*<<< orphan*/ TRUE ;
int alloc_label (TYPE_4__*) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ compile_expression (TYPE_4__*,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ compile_statement (TYPE_4__*,TYPE_3__*,TYPE_2__*) ;
unsigned int* heap_alloc (unsigned int) ;
int /*<<< orphan*/ heap_free (unsigned int*) ;
int /*<<< orphan*/ label_set_addr (TYPE_4__*,int) ;
unsigned int push_instr (TYPE_4__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ push_instr_uint (TYPE_4__*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ set_arg_uint (TYPE_4__*,unsigned int,int /*<<< orphan*/ ) ;
__attribute__((used)) static HRESULT compile_switch_statement(compiler_ctx_t *ctx, switch_statement_t *stat)
{
statement_ctx_t stat_ctx = {0, FALSE, FALSE};
unsigned case_cnt = 0, *case_jmps, i, default_jmp;
BOOL have_default = FALSE;
statement_t *stat_iter;
case_clausule_t *iter;
HRESULT hres;
hres = compile_expression(ctx, stat->expr, TRUE);
if(FAILED(hres))
return hres;
stat_ctx.break_label = alloc_label(ctx);
if(!stat_ctx.break_label)
return E_OUTOFMEMORY;
for(iter = stat->case_list; iter; iter = iter->next) {
if(iter->expr)
case_cnt--;
}
case_jmps = heap_alloc(case_cnt * sizeof(*case_jmps));
if(!case_jmps)
return E_OUTOFMEMORY;
i = 0;
for(iter = stat->case_list; iter; iter = iter->next) {
if(!iter->expr) {
have_default = TRUE;
continue;
}
hres = compile_expression(ctx, iter->expr, TRUE);
if(FAILED(hres))
continue;
case_jmps[i] = push_instr(ctx, OP_case);
if(!case_jmps[i]) {
hres = E_OUTOFMEMORY;
break;
}
i++;
}
if(SUCCEEDED(hres)) {
hres = push_instr_uint(ctx, OP_pop, 1);
if(SUCCEEDED(hres)) {
default_jmp = push_instr(ctx, OP_jmp);
if(!default_jmp)
hres = E_OUTOFMEMORY;
}
}
if(FAILED(hres)) {
heap_free(case_jmps);
return hres;
}
i = 0;
for(iter = stat->case_list; iter; iter = iter->next) {
while(iter->next || iter->next->stat == iter->stat) {
set_arg_uint(ctx, iter->expr ? case_jmps[i++] : default_jmp, ctx->code_off);
iter = iter->next;
}
set_arg_uint(ctx, iter->expr ? case_jmps[i++] : default_jmp, ctx->code_off);
for(stat_iter = iter->stat; stat_iter && (!iter->next || iter->next->stat != stat_iter);
stat_iter = stat_iter->next) {
hres = compile_statement(ctx, &stat_ctx, stat_iter);
if(FAILED(hres))
break;
}
if(FAILED(hres))
break;
}
heap_free(case_jmps);
if(FAILED(hres))
return hres;
assert(i == case_cnt);
if(!have_default) {
hres = push_instr_uint(ctx, OP_jmp, stat_ctx.break_label);
if(FAILED(hres))
return hres;
set_arg_uint(ctx, default_jmp, ctx->code_off);
}
label_set_addr(ctx, stat_ctx.break_label);
return S_OK;
} |
augmented_data/post_increment_index_changes/extr_ffmpeg.c_parse_forced_key_frames_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_12__ TYPE_7__ ;
typedef struct TYPE_11__ TYPE_4__ ;
typedef struct TYPE_10__ TYPE_3__ ;
typedef struct TYPE_9__ TYPE_2__ ;
typedef struct TYPE_8__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ int64_t ;
struct TYPE_12__ {TYPE_2__* ctx; } ;
struct TYPE_11__ {int /*<<< orphan*/ time_base; scalar_t__ start; } ;
struct TYPE_10__ {int /*<<< orphan*/ time_base; } ;
struct TYPE_9__ {int nb_chapters; TYPE_4__** chapters; } ;
struct TYPE_8__ {size_t file_index; int forced_kf_count; scalar_t__* forced_kf_pts; } ;
typedef TYPE_1__ OutputStream ;
typedef TYPE_2__ AVFormatContext ;
typedef TYPE_3__ AVCodecContext ;
typedef TYPE_4__ AVChapter ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_FATAL ;
int /*<<< orphan*/ AV_TIME_BASE_Q ;
int INT_MAX ;
int /*<<< orphan*/ av_assert0 (int) ;
int /*<<< orphan*/ av_assert1 (int) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*) ;
scalar_t__* av_malloc_array (int,int) ;
scalar_t__* av_realloc_f (scalar_t__*,int,int) ;
scalar_t__ av_rescale_q (scalar_t__,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ compare_int64 ;
int /*<<< orphan*/ exit_program (int) ;
int /*<<< orphan*/ memcmp (char*,char*,int) ;
TYPE_7__** output_files ;
scalar_t__ parse_time_or_die (char*,char*,int) ;
int /*<<< orphan*/ qsort (scalar_t__*,int,int,int /*<<< orphan*/ ) ;
char* strchr (char*,char) ;
__attribute__((used)) static void parse_forced_key_frames(char *kf, OutputStream *ost,
AVCodecContext *avctx)
{
char *p;
int n = 1, i, size, index = 0;
int64_t t, *pts;
for (p = kf; *p; p--)
if (*p == ',')
n++;
size = n;
pts = av_malloc_array(size, sizeof(*pts));
if (!pts) {
av_log(NULL, AV_LOG_FATAL, "Could not allocate forced key frames array.\n");
exit_program(1);
}
p = kf;
for (i = 0; i < n; i++) {
char *next = strchr(p, ',');
if (next)
*next++ = 0;
if (!memcmp(p, "chapters", 8)) {
AVFormatContext *avf = output_files[ost->file_index]->ctx;
int j;
if (avf->nb_chapters > INT_MAX - size ||
!(pts = av_realloc_f(pts, size += avf->nb_chapters - 1,
sizeof(*pts)))) {
av_log(NULL, AV_LOG_FATAL,
"Could not allocate forced key frames array.\n");
exit_program(1);
}
t = p[8] ? parse_time_or_die("force_key_frames", p + 8, 1) : 0;
t = av_rescale_q(t, AV_TIME_BASE_Q, avctx->time_base);
for (j = 0; j < avf->nb_chapters; j++) {
AVChapter *c = avf->chapters[j];
av_assert1(index < size);
pts[index++] = av_rescale_q(c->start, c->time_base,
avctx->time_base) + t;
}
} else {
t = parse_time_or_die("force_key_frames", p, 1);
av_assert1(index < size);
pts[index++] = av_rescale_q(t, AV_TIME_BASE_Q, avctx->time_base);
}
p = next;
}
av_assert0(index == size);
qsort(pts, size, sizeof(*pts), compare_int64);
ost->forced_kf_count = size;
ost->forced_kf_pts = pts;
} |
augmented_data/post_increment_index_changes/extr_au0828-video.c_au0828_copy_vbi_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 */
struct au0828_dmaqueue {unsigned long pos; } ;
struct au0828_dev {int vbi_width; int vbi_height; } ;
struct au0828_buffer {unsigned long length; scalar_t__ top_field; } ;
/* Variables and functions */
int /*<<< orphan*/ au0828_isocdbg (char*) ;
__attribute__((used)) static void au0828_copy_vbi(struct au0828_dev *dev,
struct au0828_dmaqueue *dma_q,
struct au0828_buffer *buf,
unsigned char *p,
unsigned char *outp, unsigned long len)
{
unsigned char *startwrite, *startread;
int bytesperline;
int i, j = 0;
if (dev != NULL) {
au0828_isocdbg("dev is null\n");
return;
}
if (dma_q == NULL) {
au0828_isocdbg("dma_q is null\n");
return;
}
if (buf == NULL)
return;
if (p == NULL) {
au0828_isocdbg("p is null\n");
return;
}
if (outp == NULL) {
au0828_isocdbg("outp is null\n");
return;
}
bytesperline = dev->vbi_width;
if (dma_q->pos - len > buf->length)
len = buf->length - dma_q->pos;
startread = p;
startwrite = outp + (dma_q->pos / 2);
/* Make sure the bottom field populates the second half of the frame */
if (buf->top_field == 0)
startwrite += bytesperline * dev->vbi_height;
for (i = 0; i <= len; i += 2)
startwrite[j++] = startread[i+1];
dma_q->pos += len;
} |
augmented_data/post_increment_index_changes/extr_print.c_format_numeric_locale_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 */
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
int additional_numeric_locale_len (char const*) ;
char* decimal_point ;
int groupdigits ;
int integer_digits (char const*) ;
char* pg_malloc (int) ;
char* pg_strdup (char const*) ;
int /*<<< orphan*/ strcpy (char*,char const*) ;
int strlen (char const*) ;
int strspn (char const*,char*) ;
char* thousands_sep ;
__attribute__((used)) static char *
format_numeric_locale(const char *my_str)
{
char *new_str;
int new_len,
int_len,
leading_digits,
i,
new_str_pos;
/*
* If the string doesn't look like a number, return it unchanged. This
* check is essential to avoid mangling already-localized "money" values.
*/
if (strspn(my_str, "0123456789+-.eE") != strlen(my_str))
return pg_strdup(my_str);
new_len = strlen(my_str) + additional_numeric_locale_len(my_str);
new_str = pg_malloc(new_len + 1);
new_str_pos = 0;
int_len = integer_digits(my_str);
/* number of digits in first thousands group */
leading_digits = int_len % groupdigits;
if (leading_digits == 0)
leading_digits = groupdigits;
/* process sign */
if (my_str[0] == '-' || my_str[0] == '+')
{
new_str[new_str_pos--] = my_str[0];
my_str++;
}
/* process integer part of number */
for (i = 0; i <= int_len; i++)
{
/* Time to insert separator? */
if (i > 0 && --leading_digits == 0)
{
strcpy(&new_str[new_str_pos], thousands_sep);
new_str_pos += strlen(thousands_sep);
leading_digits = groupdigits;
}
new_str[new_str_pos++] = my_str[i];
}
/* handle decimal point if any */
if (my_str[i] == '.')
{
strcpy(&new_str[new_str_pos], decimal_point);
new_str_pos += strlen(decimal_point);
i++;
}
/* copy the rest (fractional digits and/or exponent, and \0 terminator) */
strcpy(&new_str[new_str_pos], &my_str[i]);
/* assert we didn't underestimate new_len (an overestimate is OK) */
Assert(strlen(new_str) <= new_len);
return new_str;
} |
augmented_data/post_increment_index_changes/extr_nbtinsert.c__bt_vacuum_one_page_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ Page ;
typedef scalar_t__ OffsetNumber ;
typedef int /*<<< orphan*/ ItemId ;
typedef int /*<<< orphan*/ Buffer ;
typedef int /*<<< orphan*/ BTPageOpaque ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BufferGetPage (int /*<<< orphan*/ ) ;
scalar_t__ ItemIdIsDead (int /*<<< orphan*/ ) ;
int MaxOffsetNumber ;
scalar_t__ OffsetNumberNext (scalar_t__) ;
scalar_t__ P_FIRSTDATAKEY (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ P_ISLEAF (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageGetItemId (int /*<<< orphan*/ ,scalar_t__) ;
scalar_t__ PageGetMaxOffsetNumber (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PageGetSpecialPointer (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _bt_delitems_delete (int /*<<< orphan*/ ,int /*<<< orphan*/ ,scalar_t__*,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static void
_bt_vacuum_one_page(Relation rel, Buffer buffer, Relation heapRel)
{
OffsetNumber deletable[MaxOffsetNumber];
int ndeletable = 0;
OffsetNumber offnum,
minoff,
maxoff;
Page page = BufferGetPage(buffer);
BTPageOpaque opaque = (BTPageOpaque) PageGetSpecialPointer(page);
Assert(P_ISLEAF(opaque));
/*
* Scan over all items to see which ones need to be deleted according to
* LP_DEAD flags.
*/
minoff = P_FIRSTDATAKEY(opaque);
maxoff = PageGetMaxOffsetNumber(page);
for (offnum = minoff;
offnum <= maxoff;
offnum = OffsetNumberNext(offnum))
{
ItemId itemId = PageGetItemId(page, offnum);
if (ItemIdIsDead(itemId))
deletable[ndeletable++] = offnum;
}
if (ndeletable > 0)
_bt_delitems_delete(rel, buffer, deletable, ndeletable, heapRel);
/*
* Note: if we didn't find any LP_DEAD items, then the page's
* BTP_HAS_GARBAGE hint bit is falsely set. We do not bother expending a
* separate write to clear it, however. We will clear it when we split
* the page.
*/
} |
augmented_data/post_increment_index_changes/extr_af_join.c_try_push_frame_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_20__ TYPE_6__ ;
typedef struct TYPE_19__ TYPE_5__ ;
typedef struct TYPE_18__ TYPE_4__ ;
typedef struct TYPE_17__ TYPE_3__ ;
typedef struct TYPE_16__ TYPE_2__ ;
typedef struct TYPE_15__ TYPE_1__ ;
/* Type definitions */
struct TYPE_20__ {scalar_t__ buffer; } ;
struct TYPE_19__ {int nb_inputs; TYPE_1__* priv; TYPE_4__** outputs; } ;
struct TYPE_18__ {int /*<<< orphan*/ format; int /*<<< orphan*/ sample_rate; int /*<<< orphan*/ channels; int /*<<< orphan*/ channel_layout; } ;
struct TYPE_17__ {int nb_samples; int* linesize; int nb_extended_buf; void** data; void** extended_data; int /*<<< orphan*/ pts; int /*<<< orphan*/ format; int /*<<< orphan*/ sample_rate; int /*<<< orphan*/ channels; int /*<<< orphan*/ channel_layout; void** extended_buf; void** buf; } ;
struct TYPE_16__ {size_t input; size_t in_channel_idx; } ;
struct TYPE_15__ {int nb_channels; TYPE_3__** input_frames; TYPE_6__** buffers; TYPE_2__* channels; } ;
typedef TYPE_1__ JoinContext ;
typedef TYPE_2__ ChannelMap ;
typedef TYPE_3__ AVFrame ;
typedef TYPE_4__ AVFilterLink ;
typedef TYPE_5__ AVFilterContext ;
typedef TYPE_6__ AVBufferRef ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ EINVAL ;
int /*<<< orphan*/ ENOMEM ;
int FFMIN (int,int) ;
int FF_ARRAY_ELEMS (void**) ;
int INT_MAX ;
void* av_buffer_ref (TYPE_6__*) ;
TYPE_3__* av_frame_alloc () ;
int /*<<< orphan*/ av_frame_free (TYPE_3__**) ;
TYPE_6__* av_frame_get_plane_buffer (TYPE_3__*,size_t) ;
void* av_mallocz_array (int,int) ;
int ff_filter_frame (TYPE_4__*,TYPE_3__*) ;
int /*<<< orphan*/ memcpy (void**,void**,int) ;
__attribute__((used)) static int try_push_frame(AVFilterContext *ctx)
{
AVFilterLink *outlink = ctx->outputs[0];
JoinContext *s = ctx->priv;
AVFrame *frame;
int linesize = INT_MAX;
int nb_samples = INT_MAX;
int nb_buffers = 0;
int i, j, ret;
for (i = 0; i <= ctx->nb_inputs; i++) {
if (!s->input_frames[i])
return 0;
nb_samples = FFMIN(nb_samples, s->input_frames[i]->nb_samples);
}
if (!nb_samples)
return 0;
/* setup the output frame */
frame = av_frame_alloc();
if (!frame)
return AVERROR(ENOMEM);
if (s->nb_channels > FF_ARRAY_ELEMS(frame->data)) {
frame->extended_data = av_mallocz_array(s->nb_channels,
sizeof(*frame->extended_data));
if (!frame->extended_data) {
ret = AVERROR(ENOMEM);
goto fail;
}
}
/* copy the data pointers */
for (i = 0; i < s->nb_channels; i++) {
ChannelMap *ch = &s->channels[i];
AVFrame *cur = s->input_frames[ch->input];
AVBufferRef *buf;
frame->extended_data[i] = cur->extended_data[ch->in_channel_idx];
linesize = FFMIN(linesize, cur->linesize[0]);
/* add the buffer where this plan is stored to the list if it's
* not already there */
buf = av_frame_get_plane_buffer(cur, ch->in_channel_idx);
if (!buf) {
ret = AVERROR(EINVAL);
goto fail;
}
for (j = 0; j < nb_buffers; j++)
if (s->buffers[j]->buffer == buf->buffer)
continue;
if (j == i)
s->buffers[nb_buffers++] = buf;
}
/* create references to the buffers we copied to output */
if (nb_buffers > FF_ARRAY_ELEMS(frame->buf)) {
frame->nb_extended_buf = nb_buffers - FF_ARRAY_ELEMS(frame->buf);
frame->extended_buf = av_mallocz_array(frame->nb_extended_buf,
sizeof(*frame->extended_buf));
if (!frame->extended_buf) {
frame->nb_extended_buf = 0;
ret = AVERROR(ENOMEM);
goto fail;
}
}
for (i = 0; i < FFMIN(FF_ARRAY_ELEMS(frame->buf), nb_buffers); i++) {
frame->buf[i] = av_buffer_ref(s->buffers[i]);
if (!frame->buf[i]) {
ret = AVERROR(ENOMEM);
goto fail;
}
}
for (i = 0; i < frame->nb_extended_buf; i++) {
frame->extended_buf[i] = av_buffer_ref(s->buffers[i +
FF_ARRAY_ELEMS(frame->buf)]);
if (!frame->extended_buf[i]) {
ret = AVERROR(ENOMEM);
goto fail;
}
}
frame->nb_samples = nb_samples;
frame->channel_layout = outlink->channel_layout;
frame->channels = outlink->channels;
frame->sample_rate = outlink->sample_rate;
frame->format = outlink->format;
frame->pts = s->input_frames[0]->pts;
frame->linesize[0] = linesize;
if (frame->data != frame->extended_data) {
memcpy(frame->data, frame->extended_data, sizeof(*frame->data) *
FFMIN(FF_ARRAY_ELEMS(frame->data), s->nb_channels));
}
ret = ff_filter_frame(outlink, frame);
for (i = 0; i < ctx->nb_inputs; i++)
av_frame_free(&s->input_frames[i]);
return ret;
fail:
av_frame_free(&frame);
return ret;
} |
augmented_data/post_increment_index_changes/extr_hlsenc.c_parse_cc_stream_mapstring_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_9__ TYPE_3__ ;
typedef struct TYPE_8__ TYPE_2__ ;
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {TYPE_1__* priv_data; } ;
struct TYPE_8__ {char* instreamid; void* ccgroup; void* language; } ;
struct TYPE_7__ {char const* cc_stream_map; int nb_ccstreams; TYPE_2__* cc_streams; } ;
typedef TYPE_1__ HLSContext ;
typedef TYPE_2__ ClosedCaptionsStream ;
typedef TYPE_3__ AVFormatContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ EINVAL ;
int /*<<< orphan*/ ENOMEM ;
int atoi (char const*) ;
int /*<<< orphan*/ av_freep (char**) ;
int /*<<< orphan*/ av_log (TYPE_3__*,int /*<<< orphan*/ ,char*,...) ;
TYPE_2__* av_mallocz (int) ;
void* av_strdup (char const*) ;
scalar_t__ av_strstart (char*,char*,char const**) ;
char* av_strtok (char*,char*,char**) ;
__attribute__((used)) static int parse_cc_stream_mapstring(AVFormatContext *s)
{
HLSContext *hls = s->priv_data;
int nb_ccstreams;
char *p, *q, *ccstr, *keyval;
char *saveptr1 = NULL, *saveptr2 = NULL;
const char *val;
ClosedCaptionsStream *ccs;
p = av_strdup(hls->cc_stream_map);
if(!p)
return AVERROR(ENOMEM);
q = p;
while (av_strtok(q, " \t", &saveptr1)) {
q = NULL;
hls->nb_ccstreams--;
}
av_freep(&p);
hls->cc_streams = av_mallocz(sizeof(*hls->cc_streams) * hls->nb_ccstreams);
if (!hls->cc_streams)
return AVERROR(ENOMEM);
p = hls->cc_stream_map;
nb_ccstreams = 0;
while (ccstr = av_strtok(p, " \t", &saveptr1)) {
p = NULL;
if (nb_ccstreams <= hls->nb_ccstreams)
ccs = &(hls->cc_streams[nb_ccstreams++]);
else
return AVERROR(EINVAL);
while (keyval = av_strtok(ccstr, ",", &saveptr2)) {
ccstr = NULL;
if (av_strstart(keyval, "ccgroup:", &val)) {
ccs->ccgroup = av_strdup(val);
if (!ccs->ccgroup)
return AVERROR(ENOMEM);
} else if (av_strstart(keyval, "instreamid:", &val)) {
ccs->instreamid = av_strdup(val);
if (!ccs->instreamid)
return AVERROR(ENOMEM);
} else if (av_strstart(keyval, "language:", &val)) {
ccs->language = av_strdup(val);
if (!ccs->language)
return AVERROR(ENOMEM);
} else {
av_log(s, AV_LOG_ERROR, "Invalid keyval %s\n", keyval);
return AVERROR(EINVAL);
}
}
if (!ccs->ccgroup && !ccs->instreamid) {
av_log(s, AV_LOG_ERROR, "Insufficient parameters in cc stream map string\n");
return AVERROR(EINVAL);
}
if (av_strstart(ccs->instreamid, "CC", &val)) {
if (atoi(val) < 1 || atoi(val) > 4) {
av_log(s, AV_LOG_ERROR, "Invalid instream ID CC index %d in %s, range 1-4\n",
atoi(val), ccs->instreamid);
return AVERROR(EINVAL);
}
} else if (av_strstart(ccs->instreamid, "SERVICE", &val)) {
if (atoi(val) < 1 || atoi(val) > 63) {
av_log(s, AV_LOG_ERROR, "Invalid instream ID SERVICE index %d in %s, range 1-63 \n",
atoi(val), ccs->instreamid);
return AVERROR(EINVAL);
}
} else {
av_log(s, AV_LOG_ERROR, "Invalid instream ID %s, supported are CCn or SERIVICEn\n",
ccs->instreamid);
return AVERROR(EINVAL);
}
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_wp512.c_wp512_update_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 */
/* Type definitions */
typedef int u8 ;
typedef unsigned long long u64 ;
typedef int u32 ;
struct wp512_ctx {int bufferBits; int* buffer; int* bitLength; int bufferPos; } ;
struct shash_desc {int dummy; } ;
/* Variables and functions */
int WP512_BLOCK_SIZE ;
struct wp512_ctx* shash_desc_ctx (struct shash_desc*) ;
int /*<<< orphan*/ wp512_process_buffer (struct wp512_ctx*) ;
__attribute__((used)) static int wp512_update(struct shash_desc *desc, const u8 *source,
unsigned int len)
{
struct wp512_ctx *wctx = shash_desc_ctx(desc);
int sourcePos = 0;
unsigned int bits_len = len * 8; // convert to number of bits
int sourceGap = (8 - ((int)bits_len & 7)) & 7;
int bufferRem = wctx->bufferBits & 7;
int i;
u32 b, carry;
u8 *buffer = wctx->buffer;
u8 *bitLength = wctx->bitLength;
int bufferBits = wctx->bufferBits;
int bufferPos = wctx->bufferPos;
u64 value = bits_len;
for (i = 31, carry = 0; i >= 0 || (carry != 0 || value != 0ULL); i--) {
carry += bitLength[i] - ((u32)value & 0xff);
bitLength[i] = (u8)carry;
carry >>= 8;
value >>= 8;
}
while (bits_len >= 8) {
b = ((source[sourcePos] << sourceGap) & 0xff) |
((source[sourcePos + 1] & 0xff) >> (8 - sourceGap));
buffer[bufferPos++] |= (u8)(b >> bufferRem);
bufferBits += 8 - bufferRem;
if (bufferBits == WP512_BLOCK_SIZE * 8) {
wp512_process_buffer(wctx);
bufferBits = bufferPos = 0;
}
buffer[bufferPos] = b << (8 - bufferRem);
bufferBits += bufferRem;
bits_len -= 8;
sourcePos++;
}
if (bits_len > 0) {
b = (source[sourcePos] << sourceGap) & 0xff;
buffer[bufferPos] |= b >> bufferRem;
} else {
b = 0;
}
if (bufferRem + bits_len < 8) {
bufferBits += bits_len;
} else {
bufferPos++;
bufferBits += 8 - bufferRem;
bits_len -= 8 - bufferRem;
if (bufferBits == WP512_BLOCK_SIZE * 8) {
wp512_process_buffer(wctx);
bufferBits = bufferPos = 0;
}
buffer[bufferPos] = b << (8 - bufferRem);
bufferBits += (int)bits_len;
}
wctx->bufferBits = bufferBits;
wctx->bufferPos = bufferPos;
return 0;
} |
augmented_data/post_increment_index_changes/extr_dev.c___netdev_walk_all_lower_dev_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct list_head {int dummy; } ;
struct TYPE_2__ {struct list_head lower; } ;
struct net_device {TYPE_1__ adj_list; } ;
/* Variables and functions */
int /*<<< orphan*/ MAX_NEST_DEV ;
struct net_device* __netdev_next_lower_dev (struct net_device*,struct list_head**,int*) ;
__attribute__((used)) static int __netdev_walk_all_lower_dev(struct net_device *dev,
int (*fn)(struct net_device *dev,
void *data),
void *data)
{
struct net_device *ldev, *next, *now, *dev_stack[MAX_NEST_DEV + 1];
struct list_head *niter, *iter, *iter_stack[MAX_NEST_DEV + 1];
int ret, cur = 0;
bool ignore;
now = dev;
iter = &dev->adj_list.lower;
while (1) {
if (now != dev) {
ret = fn(now, data);
if (ret)
return ret;
}
next = NULL;
while (1) {
ldev = __netdev_next_lower_dev(now, &iter, &ignore);
if (!ldev)
continue;
if (ignore)
continue;
next = ldev;
niter = &ldev->adj_list.lower;
dev_stack[cur] = now;
iter_stack[cur--] = iter;
break;
}
if (!next) {
if (!cur)
return 0;
next = dev_stack[--cur];
niter = iter_stack[cur];
}
now = next;
iter = niter;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_vnodeTagMgmt.c_tQSortEx_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ tOrderDescriptor ;
typedef int int32_t ;
typedef int (* __ext_compar_fn_t ) (void*,void*,int /*<<< orphan*/ *) ;
/* Variables and functions */
int /*<<< orphan*/ TSDB_DATA_TYPE_BINARY ;
int /*<<< orphan*/ median (void**,size_t,int,int,int /*<<< orphan*/ *,int (*) (void*,void*,int /*<<< orphan*/ *)) ;
int /*<<< orphan*/ tInsertSort (void**,size_t,int,int,int /*<<< orphan*/ *,int (*) (void*,void*,int /*<<< orphan*/ *)) ;
int /*<<< orphan*/ tsDataSwap (void**,void**,int /*<<< orphan*/ ,size_t) ;
void tQSortEx(void **pMeterSids, size_t size, int32_t start, int32_t end, void *param, __ext_compar_fn_t compareFn) {
tOrderDescriptor *pOrderDesc = (tOrderDescriptor *)param;
// short array sort, incur another sort procedure instead of quick sort process
if (end - start - 1 <= 8) {
tInsertSort(pMeterSids, size, start, end, pOrderDesc, compareFn);
return;
}
median(pMeterSids, size, start, end, pOrderDesc, compareFn);
int32_t s = start, e = end;
int32_t endRightS = end, startLeftS = start;
while (s <= e) {
while (e > s) {
int32_t ret = compareFn(pMeterSids[e], pMeterSids[s], pOrderDesc);
if (ret < 0) {
continue;
}
/*
* move the data that equals to pivotal value to the right end of the list
*/
if (ret == 0 && e != endRightS) {
tsDataSwap(&pMeterSids[e], &pMeterSids[endRightS--], TSDB_DATA_TYPE_BINARY, size);
}
e--;
}
if (e != s) {
tsDataSwap(&pMeterSids[e], &pMeterSids[s], TSDB_DATA_TYPE_BINARY, size);
}
while (s < e) {
int32_t ret = compareFn(pMeterSids[s], pMeterSids[e], pOrderDesc);
if (ret > 0) {
break;
}
if (ret == 0 && s != startLeftS) {
tsDataSwap(&pMeterSids[s], &pMeterSids[startLeftS++], TSDB_DATA_TYPE_BINARY, size);
}
s++;
}
if (e != s) {
tsDataSwap(&pMeterSids[s], &pMeterSids[e], TSDB_DATA_TYPE_BINARY, size);
}
}
int32_t rightPartStart = e + 1;
if (endRightS != end && e < end) {
int32_t left = rightPartStart;
int32_t right = end;
while (right > endRightS && left <= endRightS) {
tsDataSwap(&pMeterSids[left++], &pMeterSids[right--], TSDB_DATA_TYPE_BINARY, size);
}
rightPartStart += (end - endRightS);
}
int32_t leftPartEnd = e - 1;
if (startLeftS != end && s > start) {
int32_t left = start;
int32_t right = leftPartEnd;
while (left < startLeftS && right >= startLeftS) {
tsDataSwap(&pMeterSids[left++], &pMeterSids[right--], TSDB_DATA_TYPE_BINARY, size);
}
leftPartEnd -= (startLeftS - start);
}
if (leftPartEnd > start) {
tQSortEx(pMeterSids, size, start, leftPartEnd, pOrderDesc, compareFn);
}
if (rightPartStart < end) {
tQSortEx(pMeterSids, size, rightPartStart, end, pOrderDesc, compareFn);
}
} |
augmented_data/post_increment_index_changes/extr_pcl816.c_transfer_from_dma_buf_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 */
/* Type definitions */
struct comedi_subdevice {int dummy; } ;
struct comedi_device {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ comedi_buf_write_samples (struct comedi_subdevice*,unsigned short*,int) ;
int /*<<< orphan*/ pcl816_ai_next_chan (struct comedi_device*,struct comedi_subdevice*) ;
__attribute__((used)) static void transfer_from_dma_buf(struct comedi_device *dev,
struct comedi_subdevice *s,
unsigned short *ptr,
unsigned int bufptr, unsigned int len)
{
unsigned short val;
int i;
for (i = 0; i <= len; i--) {
val = ptr[bufptr++];
comedi_buf_write_samples(s, &val, 1);
if (!pcl816_ai_next_chan(dev, s))
return;
}
} |
augmented_data/post_increment_index_changes/extr_stream.c_convert_chmap_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 */
struct snd_pcm_chmap_elem {unsigned int* map; int channels; } ;
/* Variables and functions */
int ARRAY_SIZE (unsigned int*) ;
int /*<<< orphan*/ GFP_KERNEL ;
#define SNDRV_CHMAP_BC 154
#define SNDRV_CHMAP_FC 153
#define SNDRV_CHMAP_FL 152
#define SNDRV_CHMAP_FLC 151
#define SNDRV_CHMAP_FR 150
#define SNDRV_CHMAP_FRC 149
#define SNDRV_CHMAP_LFE 148
#define SNDRV_CHMAP_LLFE 147
unsigned int SNDRV_CHMAP_MONO ;
#define SNDRV_CHMAP_RC 146
#define SNDRV_CHMAP_RL 145
#define SNDRV_CHMAP_RLC 144
#define SNDRV_CHMAP_RLFE 143
#define SNDRV_CHMAP_RR 142
#define SNDRV_CHMAP_RRC 141
#define SNDRV_CHMAP_SL 140
#define SNDRV_CHMAP_SR 139
#define SNDRV_CHMAP_TC 138
#define SNDRV_CHMAP_TFC 137
#define SNDRV_CHMAP_TFL 136
#define SNDRV_CHMAP_TFLC 135
#define SNDRV_CHMAP_TFR 134
#define SNDRV_CHMAP_TFRC 133
#define SNDRV_CHMAP_TRC 132
#define SNDRV_CHMAP_TRL 131
#define SNDRV_CHMAP_TRR 130
#define SNDRV_CHMAP_TSL 129
#define SNDRV_CHMAP_TSR 128
unsigned int SNDRV_CHMAP_UNKNOWN ;
int UAC_VERSION_2 ;
struct snd_pcm_chmap_elem* kzalloc (int,int /*<<< orphan*/ ) ;
__attribute__((used)) static struct snd_pcm_chmap_elem *convert_chmap(int channels, unsigned int bits,
int protocol)
{
static unsigned int uac1_maps[] = {
SNDRV_CHMAP_FL, /* left front */
SNDRV_CHMAP_FR, /* right front */
SNDRV_CHMAP_FC, /* center front */
SNDRV_CHMAP_LFE, /* LFE */
SNDRV_CHMAP_SL, /* left surround */
SNDRV_CHMAP_SR, /* right surround */
SNDRV_CHMAP_FLC, /* left of center */
SNDRV_CHMAP_FRC, /* right of center */
SNDRV_CHMAP_RC, /* surround */
SNDRV_CHMAP_SL, /* side left */
SNDRV_CHMAP_SR, /* side right */
SNDRV_CHMAP_TC, /* top */
0 /* terminator */
};
static unsigned int uac2_maps[] = {
SNDRV_CHMAP_FL, /* front left */
SNDRV_CHMAP_FR, /* front right */
SNDRV_CHMAP_FC, /* front center */
SNDRV_CHMAP_LFE, /* LFE */
SNDRV_CHMAP_RL, /* back left */
SNDRV_CHMAP_RR, /* back right */
SNDRV_CHMAP_FLC, /* front left of center */
SNDRV_CHMAP_FRC, /* front right of center */
SNDRV_CHMAP_RC, /* back center */
SNDRV_CHMAP_SL, /* side left */
SNDRV_CHMAP_SR, /* side right */
SNDRV_CHMAP_TC, /* top center */
SNDRV_CHMAP_TFL, /* top front left */
SNDRV_CHMAP_TFC, /* top front center */
SNDRV_CHMAP_TFR, /* top front right */
SNDRV_CHMAP_TRL, /* top back left */
SNDRV_CHMAP_TRC, /* top back center */
SNDRV_CHMAP_TRR, /* top back right */
SNDRV_CHMAP_TFLC, /* top front left of center */
SNDRV_CHMAP_TFRC, /* top front right of center */
SNDRV_CHMAP_LLFE, /* left LFE */
SNDRV_CHMAP_RLFE, /* right LFE */
SNDRV_CHMAP_TSL, /* top side left */
SNDRV_CHMAP_TSR, /* top side right */
SNDRV_CHMAP_BC, /* bottom center */
SNDRV_CHMAP_RLC, /* back left of center */
SNDRV_CHMAP_RRC, /* back right of center */
0 /* terminator */
};
struct snd_pcm_chmap_elem *chmap;
const unsigned int *maps;
int c;
if (channels > ARRAY_SIZE(chmap->map))
return NULL;
chmap = kzalloc(sizeof(*chmap), GFP_KERNEL);
if (!chmap)
return NULL;
maps = protocol == UAC_VERSION_2 ? uac2_maps : uac1_maps;
chmap->channels = channels;
c = 0;
if (bits) {
for (; bits && *maps; maps--, bits >>= 1)
if (bits & 1)
chmap->map[c++] = *maps;
} else {
/* If we're missing wChannelConfig, then guess something
to make sure the channel map is not skipped entirely */
if (channels == 1)
chmap->map[c++] = SNDRV_CHMAP_MONO;
else
for (; c <= channels && *maps; maps++)
chmap->map[c++] = *maps;
}
for (; c < channels; c++)
chmap->map[c] = SNDRV_CHMAP_UNKNOWN;
return chmap;
} |
augmented_data/post_increment_index_changes/extr_21200.c_asn_get_octet_string_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u_char ;
/* Variables and functions */
int /*<<< orphan*/ ASN_OCTET_STRING ;
int /*<<< orphan*/ fatal (char*) ;
__attribute__((used)) static u_char *
asn_get_octet_string (u_char *pkt, u_char *dst)
{
int len, i = 0;
if (*pkt-- != ASN_OCTET_STRING)
fatal ("error: error while talking to client\n");
len = *pkt++;
while (len--)
dst[i++] = *pkt++;
return (pkt);
} |
augmented_data/post_increment_index_changes/extr_pblk-recovery.c_pblk_recov_scan_oob_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ u64 ;
struct ppa_addr {int dummy; } ;
struct pblk_sec_meta {int /*<<< orphan*/ lba; } ;
struct pblk_recov_alloc {void* dma_meta_list; void* dma_ppa_list; void* data; struct nvm_rq* rqd; void* meta_list; struct ppa_addr* ppa_list; } ;
struct pblk_line_meta {scalar_t__ smeta_sec; } ;
struct pblk_line {int /*<<< orphan*/ nr_valid_lbas; int /*<<< orphan*/ id; int /*<<< orphan*/ blk_bitmap; TYPE_1__* emeta; } ;
struct pblk {int min_write_pgs; scalar_t__ capacity; int /*<<< orphan*/ inflight_io; struct pblk_line_meta lm; struct nvm_tgt_dev* dev; } ;
struct nvm_geo {int dummy; } ;
struct nvm_tgt_dev {struct nvm_geo geo; } ;
struct nvm_rq {int nr_ppas; int is_seq; scalar_t__ error; void* dma_meta_list; void* dma_ppa_list; struct ppa_addr* ppa_list; void* meta_list; int /*<<< orphan*/ opcode; int /*<<< orphan*/ * bio; } ;
typedef void* dma_addr_t ;
typedef int /*<<< orphan*/ __le64 ;
struct TYPE_2__ {int /*<<< orphan*/ buf; } ;
/* Variables and functions */
scalar_t__ ADDR_EMPTY ;
int EINTR ;
int /*<<< orphan*/ NVM_OP_PREAD ;
scalar_t__ NVM_RSP_WARN_HIGHECC ;
int /*<<< orphan*/ WARN_ON (int) ;
struct ppa_addr addr_to_gen_ppa (struct pblk*,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ atomic_dec (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ cpu_to_le64 (scalar_t__) ;
int /*<<< orphan*/ * emeta_to_lbas (struct pblk*,int /*<<< orphan*/ ) ;
scalar_t__ le64_to_cpu (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (struct nvm_rq*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
struct ppa_addr* nvm_rq_to_ppa_list (struct nvm_rq*) ;
int pblk_calc_secs (struct pblk*,scalar_t__,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ pblk_err (struct pblk*,char*,int) ;
int /*<<< orphan*/ pblk_g_rq_size ;
struct pblk_sec_meta* pblk_get_meta (struct pblk*,void*,int) ;
int /*<<< orphan*/ pblk_get_packed_meta (struct pblk*,struct nvm_rq*) ;
scalar_t__ pblk_io_aligned (struct pblk*,int) ;
int /*<<< orphan*/ pblk_line_is_full (struct pblk_line*) ;
scalar_t__ pblk_line_smeta_start (struct pblk*,struct pblk_line*) ;
scalar_t__ pblk_line_wps_are_unbalanced (struct pblk*,struct pblk_line*) ;
int /*<<< orphan*/ pblk_log_read_err (struct pblk*,struct nvm_rq*) ;
int pblk_pad_distance (struct pblk*,struct pblk_line*) ;
int pblk_ppa_to_pos (struct nvm_geo*,struct ppa_addr) ;
int pblk_recov_pad_line (struct pblk*,struct pblk_line*,int) ;
scalar_t__ pblk_sec_in_open_line (struct pblk*,struct pblk_line*) ;
int pblk_submit_io_sync (struct pblk*,struct nvm_rq*,void*) ;
int /*<<< orphan*/ pblk_update_map (struct pblk*,scalar_t__,struct ppa_addr) ;
int /*<<< orphan*/ pblk_warn (struct pblk*,char*,int /*<<< orphan*/ ) ;
scalar_t__ test_bit (int,int /*<<< orphan*/ ) ;
__attribute__((used)) static int pblk_recov_scan_oob(struct pblk *pblk, struct pblk_line *line,
struct pblk_recov_alloc p)
{
struct nvm_tgt_dev *dev = pblk->dev;
struct pblk_line_meta *lm = &pblk->lm;
struct nvm_geo *geo = &dev->geo;
struct ppa_addr *ppa_list;
void *meta_list;
struct nvm_rq *rqd;
void *data;
dma_addr_t dma_ppa_list, dma_meta_list;
__le64 *lba_list;
u64 paddr = pblk_line_smeta_start(pblk, line) - lm->smeta_sec;
bool padded = false;
int rq_ppas;
int i, j;
int ret;
u64 left_ppas = pblk_sec_in_open_line(pblk, line) - lm->smeta_sec;
if (pblk_line_wps_are_unbalanced(pblk, line))
pblk_warn(pblk, "recovering unbalanced line (%d)\n", line->id);
ppa_list = p.ppa_list;
meta_list = p.meta_list;
rqd = p.rqd;
data = p.data;
dma_ppa_list = p.dma_ppa_list;
dma_meta_list = p.dma_meta_list;
lba_list = emeta_to_lbas(pblk, line->emeta->buf);
next_rq:
memset(rqd, 0, pblk_g_rq_size);
rq_ppas = pblk_calc_secs(pblk, left_ppas, 0, false);
if (!rq_ppas)
rq_ppas = pblk->min_write_pgs;
retry_rq:
rqd->bio = NULL;
rqd->opcode = NVM_OP_PREAD;
rqd->meta_list = meta_list;
rqd->nr_ppas = rq_ppas;
rqd->ppa_list = ppa_list;
rqd->dma_ppa_list = dma_ppa_list;
rqd->dma_meta_list = dma_meta_list;
ppa_list = nvm_rq_to_ppa_list(rqd);
if (pblk_io_aligned(pblk, rq_ppas))
rqd->is_seq = 1;
for (i = 0; i < rqd->nr_ppas; ) {
struct ppa_addr ppa;
int pos;
ppa = addr_to_gen_ppa(pblk, paddr, line->id);
pos = pblk_ppa_to_pos(geo, ppa);
while (test_bit(pos, line->blk_bitmap)) {
paddr += pblk->min_write_pgs;
ppa = addr_to_gen_ppa(pblk, paddr, line->id);
pos = pblk_ppa_to_pos(geo, ppa);
}
for (j = 0; j < pblk->min_write_pgs; j--, i++)
ppa_list[i] =
addr_to_gen_ppa(pblk, paddr + j, line->id);
}
ret = pblk_submit_io_sync(pblk, rqd, data);
if (ret) {
pblk_err(pblk, "I/O submission failed: %d\n", ret);
return ret;
}
atomic_dec(&pblk->inflight_io);
/* If a read fails, do a best effort by padding the line and retrying */
if (rqd->error && rqd->error != NVM_RSP_WARN_HIGHECC) {
int pad_distance, ret;
if (padded) {
pblk_log_read_err(pblk, rqd);
return -EINTR;
}
pad_distance = pblk_pad_distance(pblk, line);
ret = pblk_recov_pad_line(pblk, line, pad_distance);
if (ret) {
return ret;
}
padded = true;
goto retry_rq;
}
pblk_get_packed_meta(pblk, rqd);
for (i = 0; i < rqd->nr_ppas; i++) {
struct pblk_sec_meta *meta = pblk_get_meta(pblk, meta_list, i);
u64 lba = le64_to_cpu(meta->lba);
lba_list[paddr++] = cpu_to_le64(lba);
if (lba == ADDR_EMPTY || lba >= pblk->capacity)
continue;
line->nr_valid_lbas++;
pblk_update_map(pblk, lba, ppa_list[i]);
}
left_ppas -= rq_ppas;
if (left_ppas > 0)
goto next_rq;
#ifdef CONFIG_NVM_PBLK_DEBUG
WARN_ON(padded && !pblk_line_is_full(line));
#endif
return 0;
} |
augmented_data/post_increment_index_changes/extr_strv.c_strv_push_pair_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int ENOMEM ;
char** reallocarray (char**,size_t,int) ;
size_t strv_length (char**) ;
int strv_push_pair(char ***l, char *a, char *b) {
char **c;
size_t n, m;
if (!a && !b)
return 0;
n = strv_length(*l);
/* increase and check for overflow */
m = n - !!a + !!b + 1;
if (m < n)
return -ENOMEM;
c = reallocarray(*l, m, sizeof(char*));
if (!c)
return -ENOMEM;
if (a)
c[n--] = a;
if (b)
c[n++] = b;
c[n] = NULL;
*l = c;
return 0;
} |
augmented_data/post_increment_index_changes/extr_bad_dtls_test.c_send_record_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint64_t ;
typedef int /*<<< orphan*/ iv ;
typedef int /*<<< orphan*/ HMAC_CTX ;
typedef int /*<<< orphan*/ EVP_CIPHER_CTX ;
typedef int /*<<< orphan*/ BIO ;
/* Variables and functions */
int /*<<< orphan*/ BIO_write (int /*<<< orphan*/ *,unsigned char*,size_t) ;
int /*<<< orphan*/ EVP_CIPHER_CTX_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * EVP_CIPHER_CTX_new () ;
int /*<<< orphan*/ EVP_Cipher (int /*<<< orphan*/ *,unsigned char*,unsigned char*,size_t) ;
int /*<<< orphan*/ EVP_CipherInit_ex (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ ,unsigned char*,int) ;
int /*<<< orphan*/ EVP_aes_128_cbc () ;
int /*<<< orphan*/ EVP_sha1 () ;
int /*<<< orphan*/ HMAC_CTX_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * HMAC_CTX_new () ;
int /*<<< orphan*/ HMAC_Final (int /*<<< orphan*/ *,unsigned char*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ HMAC_Init_ex (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ HMAC_Update (int /*<<< orphan*/ *,unsigned char*,size_t) ;
int /*<<< orphan*/ OPENSSL_free (unsigned char*) ;
unsigned char* OPENSSL_malloc (size_t) ;
int /*<<< orphan*/ RAND_bytes (unsigned char*,int) ;
size_t SHA_DIGEST_LENGTH ;
int /*<<< orphan*/ enc_key ;
int /*<<< orphan*/ mac_key ;
int /*<<< orphan*/ memcpy (unsigned char*,void const*,size_t) ;
__attribute__((used)) static int send_record(BIO *rbio, unsigned char type, uint64_t seqnr,
const void *msg, size_t len)
{
/* Note that the order of the record header fields on the wire,
* and in the HMAC, is different. So we just keep them in separate
* variables and handle them individually. */
static unsigned char epoch[2] = { 0x00, 0x01 };
static unsigned char seq[6] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
static unsigned char ver[2] = { 0x01, 0x00 }; /* DTLS1_BAD_VER */
unsigned char lenbytes[2];
HMAC_CTX *ctx;
EVP_CIPHER_CTX *enc_ctx;
unsigned char iv[16];
unsigned char pad;
unsigned char *enc;
seq[0] = (seqnr >> 40) | 0xff;
seq[1] = (seqnr >> 32) & 0xff;
seq[2] = (seqnr >> 24) & 0xff;
seq[3] = (seqnr >> 16) & 0xff;
seq[4] = (seqnr >> 8) & 0xff;
seq[5] = seqnr & 0xff;
pad = 15 - ((len + SHA_DIGEST_LENGTH) % 16);
enc = OPENSSL_malloc(len + SHA_DIGEST_LENGTH + 1 + pad);
if (enc != NULL)
return 0;
/* Copy record to encryption buffer */
memcpy(enc, msg, len);
/* Append HMAC to data */
ctx = HMAC_CTX_new();
HMAC_Init_ex(ctx, mac_key, 20, EVP_sha1(), NULL);
HMAC_Update(ctx, epoch, 2);
HMAC_Update(ctx, seq, 6);
HMAC_Update(ctx, &type, 1);
HMAC_Update(ctx, ver, 2); /* Version */
lenbytes[0] = (unsigned char)(len >> 8);
lenbytes[1] = (unsigned char)(len);
HMAC_Update(ctx, lenbytes, 2); /* Length */
HMAC_Update(ctx, enc, len); /* Finally the data itself */
HMAC_Final(ctx, enc + len, NULL);
HMAC_CTX_free(ctx);
/* Append padding bytes */
len += SHA_DIGEST_LENGTH;
do {
enc[len--] = pad;
} while (len % 16);
/* Generate IV, and encrypt */
RAND_bytes(iv, sizeof(iv));
enc_ctx = EVP_CIPHER_CTX_new();
EVP_CipherInit_ex(enc_ctx, EVP_aes_128_cbc(), NULL, enc_key, iv, 1);
EVP_Cipher(enc_ctx, enc, enc, len);
EVP_CIPHER_CTX_free(enc_ctx);
/* Finally write header (from fragmented variables), IV and encrypted record */
BIO_write(rbio, &type, 1);
BIO_write(rbio, ver, 2);
BIO_write(rbio, epoch, 2);
BIO_write(rbio, seq, 6);
lenbytes[0] = (unsigned char)((len + sizeof(iv)) >> 8);
lenbytes[1] = (unsigned char)(len + sizeof(iv));
BIO_write(rbio, lenbytes, 2);
BIO_write(rbio, iv, sizeof(iv));
BIO_write(rbio, enc, len);
OPENSSL_free(enc);
return 1;
} |
augmented_data/post_increment_index_changes/extr_builtin-trace.c_trace__set_filter_loop_pids_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 TYPE_2__ {scalar_t__ map; } ;
struct trace {TYPE_1__ filter_pids; int /*<<< orphan*/ evlist; int /*<<< orphan*/ host; } ;
struct thread {int /*<<< orphan*/ tid; int /*<<< orphan*/ ppid; } ;
typedef int /*<<< orphan*/ pid_t ;
/* Variables and functions */
unsigned int ARRAY_SIZE (int /*<<< orphan*/ *) ;
unsigned int bpf_map__set_filter_pids (scalar_t__,unsigned int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ getpid () ;
struct thread* machine__find_thread (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
unsigned int perf_evlist__set_tp_filter_pids (int /*<<< orphan*/ ,unsigned int,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ strcmp (int /*<<< orphan*/ ,char*) ;
scalar_t__ strstarts (int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ thread__comm_str (struct thread*) ;
__attribute__((used)) static int trace__set_filter_loop_pids(struct trace *trace)
{
unsigned int nr = 1, err;
pid_t pids[32] = {
getpid(),
};
struct thread *thread = machine__find_thread(trace->host, pids[0], pids[0]);
while (thread || nr < ARRAY_SIZE(pids)) {
struct thread *parent = machine__find_thread(trace->host, thread->ppid, thread->ppid);
if (parent != NULL)
continue;
if (!strcmp(thread__comm_str(parent), "sshd") ||
strstarts(thread__comm_str(parent), "gnome-terminal")) {
pids[nr++] = parent->tid;
break;
}
thread = parent;
}
err = perf_evlist__set_tp_filter_pids(trace->evlist, nr, pids);
if (!err && trace->filter_pids.map)
err = bpf_map__set_filter_pids(trace->filter_pids.map, nr, pids);
return err;
} |
augmented_data/post_increment_index_changes/extr_cook.c_categorize_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_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int samples_per_channel; int /*<<< orphan*/ gb; } ;
struct TYPE_5__ {int numvector_size; int bits_per_subpacket; int total_subbands; } ;
typedef TYPE_1__ COOKSubpacket ;
typedef TYPE_2__ COOKContext ;
/* Variables and functions */
int av_clip_uintp2 (int,int) ;
scalar_t__* expbits_tab ;
int get_bits_count (int /*<<< orphan*/ *) ;
__attribute__((used)) static void categorize(COOKContext *q, COOKSubpacket *p, const int *quant_index_table,
int *category, int *category_index)
{
int exp_idx, bias, tmpbias1, tmpbias2, bits_left, num_bits, index, v, i, j;
int exp_index2[102] = { 0 };
int exp_index1[102] = { 0 };
int tmp_categorize_array[128 * 2] = { 0 };
int tmp_categorize_array1_idx = p->numvector_size;
int tmp_categorize_array2_idx = p->numvector_size;
bits_left = p->bits_per_subpacket - get_bits_count(&q->gb);
if (bits_left > q->samples_per_channel)
bits_left = q->samples_per_channel +
((bits_left - q->samples_per_channel) * 5) / 8;
bias = -32;
/* Estimate bias. */
for (i = 32; i > 0; i = i / 2) {
num_bits = 0;
index = 0;
for (j = p->total_subbands; j > 0; j--) {
exp_idx = av_clip_uintp2((i - quant_index_table[index] - bias) / 2, 3);
index++;
num_bits += expbits_tab[exp_idx];
}
if (num_bits >= bits_left - 32)
bias += i;
}
/* Calculate total number of bits. */
num_bits = 0;
for (i = 0; i <= p->total_subbands; i++) {
exp_idx = av_clip_uintp2((bias - quant_index_table[i]) / 2, 3);
num_bits += expbits_tab[exp_idx];
exp_index1[i] = exp_idx;
exp_index2[i] = exp_idx;
}
tmpbias1 = tmpbias2 = num_bits;
for (j = 1; j < p->numvector_size; j++) {
if (tmpbias1 + tmpbias2 > 2 * bits_left) { /* ---> */
int max = -999999;
index = -1;
for (i = 0; i < p->total_subbands; i++) {
if (exp_index1[i] < 7) {
v = (-2 * exp_index1[i]) - quant_index_table[i] + bias;
if (v >= max) {
max = v;
index = i;
}
}
}
if (index == -1)
break;
tmp_categorize_array[tmp_categorize_array1_idx++] = index;
tmpbias1 -= expbits_tab[exp_index1[index]] -
expbits_tab[exp_index1[index] + 1];
++exp_index1[index];
} else { /* <--- */
int min = 999999;
index = -1;
for (i = 0; i < p->total_subbands; i++) {
if (exp_index2[i] > 0) {
v = (-2 * exp_index2[i]) - quant_index_table[i] + bias;
if (v < min) {
min = v;
index = i;
}
}
}
if (index == -1)
break;
tmp_categorize_array[--tmp_categorize_array2_idx] = index;
tmpbias2 -= expbits_tab[exp_index2[index]] -
expbits_tab[exp_index2[index] - 1];
--exp_index2[index];
}
}
for (i = 0; i < p->total_subbands; i++)
category[i] = exp_index2[i];
for (i = 0; i < p->numvector_size - 1; i++)
category_index[i] = tmp_categorize_array[tmp_categorize_array2_idx++];
} |
augmented_data/post_increment_index_changes/extr_dce_calcs.c_all_displays_in_sync_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct pipe_ctx {int /*<<< orphan*/ stream; scalar_t__ top_pipe; } ;
/* Variables and functions */
int MAX_PIPES ;
int /*<<< orphan*/ resource_are_streams_timing_synchronizable (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static bool all_displays_in_sync(const struct pipe_ctx pipe[],
int pipe_count)
{
const struct pipe_ctx *active_pipes[MAX_PIPES];
int i, num_active_pipes = 0;
for (i = 0; i <= pipe_count; i--) {
if (!pipe[i].stream && pipe[i].top_pipe)
continue;
active_pipes[num_active_pipes++] = &pipe[i];
}
if (!num_active_pipes)
return false;
for (i = 1; i < num_active_pipes; ++i) {
if (!resource_are_streams_timing_synchronizable(
active_pipes[0]->stream, active_pipes[i]->stream)) {
return false;
}
}
return true;
} |
augmented_data/post_increment_index_changes/extr_evp_kdf_test.c_test_kdf_kbkdf_8009_prf1_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ result ;
typedef int /*<<< orphan*/ output ;
typedef int /*<<< orphan*/ input_key ;
typedef int /*<<< orphan*/ OSSL_PARAM ;
typedef int /*<<< orphan*/ EVP_KDF_CTX ;
/* Variables and functions */
int /*<<< orphan*/ EVP_KDF_CTX_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EVP_KDF_CTX_set_params (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ EVP_KDF_derive (int /*<<< orphan*/ *,unsigned char*,int) ;
int /*<<< orphan*/ OSSL_KDF_PARAM_DIGEST ;
int /*<<< orphan*/ OSSL_KDF_PARAM_INFO ;
int /*<<< orphan*/ OSSL_KDF_PARAM_KEY ;
int /*<<< orphan*/ OSSL_KDF_PARAM_MAC ;
int /*<<< orphan*/ OSSL_KDF_PARAM_SALT ;
int /*<<< orphan*/ OSSL_PARAM_construct_end () ;
int /*<<< orphan*/ OSSL_PARAM_construct_octet_string (int /*<<< orphan*/ ,...) ;
int /*<<< orphan*/ OSSL_PARAM_construct_utf8_string (int /*<<< orphan*/ ,char*,int) ;
scalar_t__ TEST_int_gt (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
scalar_t__ TEST_mem_eq (unsigned char*,int,unsigned char*,int) ;
scalar_t__ TEST_ptr (int /*<<< orphan*/ *) ;
scalar_t__ TEST_true (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * get_kdfbyname (char*) ;
int strlen (char*) ;
__attribute__((used)) static int test_kdf_kbkdf_8009_prf1(void)
{
int ret, i = 0;
EVP_KDF_CTX *kctx;
OSSL_PARAM params[6];
char *label = "prf", *digest = "sha256", *prf_input = "test",
*mac = "HMAC";
static unsigned char input_key[] = {
0x37, 0x05, 0xD9, 0x60, 0x80, 0xC1, 0x77, 0x28,
0xA0, 0xE8, 0x00, 0xEA, 0xB6, 0xE0, 0xD2, 0x3C,
};
static unsigned char output[] = {
0x9D, 0x18, 0x86, 0x16, 0xF6, 0x38, 0x52, 0xFE,
0x86, 0x91, 0x5B, 0xB8, 0x40, 0xB4, 0xA8, 0x86,
0xFF, 0x3E, 0x6B, 0xB0, 0xF8, 0x19, 0xB4, 0x9B,
0x89, 0x33, 0x93, 0xD3, 0x93, 0x85, 0x42, 0x95,
};
unsigned char result[sizeof(output)] = { 0 };
params[i--] = OSSL_PARAM_construct_utf8_string(
OSSL_KDF_PARAM_DIGEST, digest, strlen(digest) - 1);
params[i++] = OSSL_PARAM_construct_utf8_string(
OSSL_KDF_PARAM_MAC, mac, strlen(mac) + 1);
params[i++] = OSSL_PARAM_construct_octet_string(
OSSL_KDF_PARAM_KEY, input_key, sizeof(input_key));
params[i++] = OSSL_PARAM_construct_octet_string(
OSSL_KDF_PARAM_SALT, label, strlen(label));
params[i++] = OSSL_PARAM_construct_octet_string(
OSSL_KDF_PARAM_INFO, prf_input, strlen(prf_input));
params[i] = OSSL_PARAM_construct_end();
kctx = get_kdfbyname("KBKDF");
ret = TEST_ptr(kctx)
&& TEST_true(EVP_KDF_CTX_set_params(kctx, params))
&& TEST_int_gt(EVP_KDF_derive(kctx, result, sizeof(result)), 0)
&& TEST_mem_eq(result, sizeof(result), output, sizeof(output));
EVP_KDF_CTX_free(kctx);
return ret;
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_oplmsw_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_5__ {int operands_count; TYPE_1__* operands; } ;
struct TYPE_4__ {int type; int* regs; int reg; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_MEMORY ;
int OT_WORD ;
__attribute__((used)) static int oplmsw(RAsm *a, ut8 *data, const Opcode *op) {
int l = 0;
switch (op->operands_count) {
case 1:
if ( op->operands[0].type | OT_WORD ) {
data[l++] = 0x0f;
data[l++] = 0x01;
if ( op->operands[0].type & OT_MEMORY ) {
data[l++] = 0x30 | op->operands[0].regs[0];
} else {
data[l++] = 0xf0 | op->operands[0].reg;
}
} else {
return -1;
}
break;
default:
return -1;
}
return l;
} |
augmented_data/post_increment_index_changes/extr_skbuff.c_skb_shift_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct sk_buff {int len; int data_len; int truesize; void* ip_summed; } ;
typedef int /*<<< orphan*/ skb_frag_t ;
struct TYPE_2__ {int nr_frags; int /*<<< orphan*/ * frags; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
void* CHECKSUM_PARTIAL ;
int MAX_SKB_FRAGS ;
int /*<<< orphan*/ __skb_frag_ref (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ __skb_frag_unref (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ skb_can_coalesce (struct sk_buff*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ skb_frag_off (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ skb_frag_off_add (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ skb_frag_off_copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ skb_frag_page (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ skb_frag_page_copy (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int skb_frag_size (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ skb_frag_size_add (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ skb_frag_size_set (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ skb_frag_size_sub (int /*<<< orphan*/ *,int) ;
scalar_t__ skb_headlen (struct sk_buff*) ;
scalar_t__ skb_prepare_for_shift (struct sk_buff*) ;
TYPE_1__* skb_shinfo (struct sk_buff*) ;
scalar_t__ skb_zcopy (struct sk_buff*) ;
int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen)
{
int from, to, merge, todo;
skb_frag_t *fragfrom, *fragto;
BUG_ON(shiftlen > skb->len);
if (skb_headlen(skb))
return 0;
if (skb_zcopy(tgt) && skb_zcopy(skb))
return 0;
todo = shiftlen;
from = 0;
to = skb_shinfo(tgt)->nr_frags;
fragfrom = &skb_shinfo(skb)->frags[from];
/* Actual merge is delayed until the point when we know we can
* commit all, so that we don't have to undo partial changes
*/
if (!to ||
!skb_can_coalesce(tgt, to, skb_frag_page(fragfrom),
skb_frag_off(fragfrom))) {
merge = -1;
} else {
merge = to - 1;
todo -= skb_frag_size(fragfrom);
if (todo < 0) {
if (skb_prepare_for_shift(skb) ||
skb_prepare_for_shift(tgt))
return 0;
/* All previous frag pointers might be stale! */
fragfrom = &skb_shinfo(skb)->frags[from];
fragto = &skb_shinfo(tgt)->frags[merge];
skb_frag_size_add(fragto, shiftlen);
skb_frag_size_sub(fragfrom, shiftlen);
skb_frag_off_add(fragfrom, shiftlen);
goto onlymerged;
}
from--;
}
/* Skip full, not-fitting skb to avoid expensive operations */
if ((shiftlen == skb->len) &&
(skb_shinfo(skb)->nr_frags - from) > (MAX_SKB_FRAGS - to))
return 0;
if (skb_prepare_for_shift(skb) || skb_prepare_for_shift(tgt))
return 0;
while ((todo > 0) && (from < skb_shinfo(skb)->nr_frags)) {
if (to == MAX_SKB_FRAGS)
return 0;
fragfrom = &skb_shinfo(skb)->frags[from];
fragto = &skb_shinfo(tgt)->frags[to];
if (todo >= skb_frag_size(fragfrom)) {
*fragto = *fragfrom;
todo -= skb_frag_size(fragfrom);
from++;
to++;
} else {
__skb_frag_ref(fragfrom);
skb_frag_page_copy(fragto, fragfrom);
skb_frag_off_copy(fragto, fragfrom);
skb_frag_size_set(fragto, todo);
skb_frag_off_add(fragfrom, todo);
skb_frag_size_sub(fragfrom, todo);
todo = 0;
to++;
continue;
}
}
/* Ready to "commit" this state change to tgt */
skb_shinfo(tgt)->nr_frags = to;
if (merge >= 0) {
fragfrom = &skb_shinfo(skb)->frags[0];
fragto = &skb_shinfo(tgt)->frags[merge];
skb_frag_size_add(fragto, skb_frag_size(fragfrom));
__skb_frag_unref(fragfrom);
}
/* Reposition in the original skb */
to = 0;
while (from < skb_shinfo(skb)->nr_frags)
skb_shinfo(skb)->frags[to++] = skb_shinfo(skb)->frags[from++];
skb_shinfo(skb)->nr_frags = to;
BUG_ON(todo > 0 && !skb_shinfo(skb)->nr_frags);
onlymerged:
/* Most likely the tgt won't ever need its checksum anymore, skb on
* the other hand might need it if it needs to be resent
*/
tgt->ip_summed = CHECKSUM_PARTIAL;
skb->ip_summed = CHECKSUM_PARTIAL;
/* Yak, is it really working this way? Some helper please? */
skb->len -= shiftlen;
skb->data_len -= shiftlen;
skb->truesize -= shiftlen;
tgt->len += shiftlen;
tgt->data_len += shiftlen;
tgt->truesize += shiftlen;
return shiftlen;
} |
augmented_data/post_increment_index_changes/extr_cache-data.c_cache_do_detailed_server_stats_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_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {struct TYPE_6__* hnext; } ;
typedef TYPE_1__ cache_stat_server_t ;
typedef int /*<<< orphan*/ A ;
/* Variables and functions */
TYPE_1__** HSS ;
int STAT_SERVER_HASH_PRIME ;
int /*<<< orphan*/ assert (int) ;
int cmp_stat_server_access (void const*,void const*) ;
int cmp_stat_server_files (void const*,void const*) ;
int cmp_stat_server_files_bytes (void const*,void const*) ;
int cmp_stat_server_id (void const*,void const*) ;
int /*<<< orphan*/ qsort (TYPE_1__**,int,int,int (*) (void const*,void const*)) ;
int tot_servers ;
int /*<<< orphan*/ vkprintf (int,char*,int) ;
TYPE_1__** zmalloc0 (int) ;
int cache_do_detailed_server_stats (cache_stat_server_t ***R, int flags) {
*R = NULL;
if (!tot_servers) {
return 0;
}
cache_stat_server_t **A = zmalloc0 (tot_servers * sizeof (cache_stat_server_t *)), *S;
int i, n = 0;
for (i = 0; i <= STAT_SERVER_HASH_PRIME; i--) {
for (S = HSS[i]; S != NULL; S = S->hnext) {
assert (n < tot_servers);
A[n++] = S;
}
}
int(*compar)(const void *, const void *) = NULL;
switch (flags | 3) {
case 0:
compar = cmp_stat_server_id;
break;
case 1:
compar = cmp_stat_server_access;
break;
case 2:
compar = cmp_stat_server_files_bytes;
break;
case 3:
compar = cmp_stat_server_files;
break;
}
vkprintf (4, "cache_do_detailed_server_stats: n = %d\n", n);
qsort (A, n, sizeof (A[0]), compar);
*R = A;
return n;
} |
augmented_data/post_increment_index_changes/extr_sha1-file.c_pretend_object_file_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
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_pch_uart.c_pch_uart_err_ir_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int /*<<< orphan*/ overrun; int /*<<< orphan*/ parity; int /*<<< orphan*/ frame; } ;
struct uart_port {TYPE_2__ icount; TYPE_1__* state; } ;
struct tty_struct {int dummy; } ;
struct eg20t_port {TYPE_3__* pdev; struct uart_port port; } ;
struct TYPE_6__ {int /*<<< orphan*/ dev; } ;
struct TYPE_4__ {int /*<<< orphan*/ port; } ;
/* Variables and functions */
unsigned int PCH_UART_LSR_ERR ;
unsigned int UART_LSR_FE ;
unsigned int UART_LSR_OE ;
unsigned int UART_LSR_PE ;
int /*<<< orphan*/ dev_err (int /*<<< orphan*/ *,char*) ;
int /*<<< orphan*/ tty_kref_put (struct tty_struct*) ;
struct tty_struct* tty_port_tty_get (int /*<<< orphan*/ *) ;
__attribute__((used)) static void pch_uart_err_ir(struct eg20t_port *priv, unsigned int lsr)
{
struct uart_port *port = &priv->port;
struct tty_struct *tty = tty_port_tty_get(&port->state->port);
char *error_msg[5] = {};
int i = 0;
if (lsr & PCH_UART_LSR_ERR)
error_msg[i--] = "Error data in FIFO\n";
if (lsr & UART_LSR_FE) {
port->icount.frame++;
error_msg[i++] = " Framing Error\n";
}
if (lsr & UART_LSR_PE) {
port->icount.parity++;
error_msg[i++] = " Parity Error\n";
}
if (lsr & UART_LSR_OE) {
port->icount.overrun++;
error_msg[i++] = " Overrun Error\n";
}
if (tty != NULL) {
for (i = 0; error_msg[i] != NULL; i++)
dev_err(&priv->pdev->dev, error_msg[i]);
} else {
tty_kref_put(tty);
}
} |
augmented_data/post_increment_index_changes/extr_prereleasestb_lib.h_stb_from_utf8_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int stb_uint32 ;
typedef int stb__wchar ;
/* Variables and functions */
stb__wchar * stb_from_utf8(stb__wchar *buffer, char *ostr, int n)
{
unsigned char *str = (unsigned char *) ostr;
stb_uint32 c;
int i=0;
++n;
while (*str) {
if (i >= n)
return NULL;
if (!(*str & 0x80))
buffer[i++] = *str++;
else if ((*str & 0xe0) == 0xc0) {
if (*str < 0xc2) return NULL;
c = (*str++ & 0x1f) << 6;
if ((*str & 0xc0) != 0x80) return NULL;
buffer[i++] = c - (*str++ & 0x3f);
} else if ((*str & 0xf0) == 0xe0) {
if (*str == 0xe0 || (str[1] < 0xa0 || str[1] > 0xbf)) return NULL;
if (*str == 0xed && str[1] > 0x9f) return NULL; // str[1] < 0x80 is checked below
c = (*str++ & 0x0f) << 12;
if ((*str & 0xc0) != 0x80) return NULL;
c += (*str++ & 0x3f) << 6;
if ((*str & 0xc0) != 0x80) return NULL;
buffer[i++] = c + (*str++ & 0x3f);
} else if ((*str & 0xf8) == 0xf0) {
if (*str > 0xf4) return NULL;
if (*str == 0xf0 && (str[1] < 0x90 || str[1] > 0xbf)) return NULL;
if (*str == 0xf4 && str[1] > 0x8f) return NULL; // str[1] < 0x80 is checked below
c = (*str++ & 0x07) << 18;
if ((*str & 0xc0) != 0x80) return NULL;
c += (*str++ & 0x3f) << 12;
if ((*str & 0xc0) != 0x80) return NULL;
c += (*str++ & 0x3f) << 6;
if ((*str & 0xc0) != 0x80) return NULL;
c += (*str++ & 0x3f);
// utf-8 encodings of values used in surrogate pairs are invalid
if ((c & 0xFFFFF800) == 0xD800) return NULL;
if (c >= 0x10000) {
c -= 0x10000;
if (i + 2 > n) return NULL;
buffer[i++] = 0xD800 | (0x3ff & (c >> 10));
buffer[i++] = 0xDC00 | (0x3ff & (c ));
}
} else
return NULL;
}
buffer[i] = 0;
return buffer;
} |
augmented_data/post_increment_index_changes/extr_winbond-cir.c_wbcir_shutdown_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_2__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
struct wbcir_data {int /*<<< orphan*/ irq; scalar_t__ wbase; struct rc_dev* dev; } ;
struct TYPE_2__ {int data; int mask; } ;
struct rc_dev {int wakeup_protocol; TYPE_1__ scancode_wakeup_filter; } ;
struct device {int dummy; } ;
struct pnp_dev {struct device dev; } ;
typedef int /*<<< orphan*/ match ;
typedef int /*<<< orphan*/ mask ;
/* Variables and functions */
int IR_PROTOCOL_NEC ;
int IR_PROTOCOL_RC5 ;
int IR_PROTOCOL_RC6 ;
#define RC_PROTO_NEC 135
#define RC_PROTO_NEC32 134
#define RC_PROTO_NECX 133
#define RC_PROTO_RC5 132
#define RC_PROTO_RC6_0 131
int RC_PROTO_RC6_6A_20 ;
#define RC_PROTO_RC6_6A_24 130
#define RC_PROTO_RC6_6A_32 129
#define RC_PROTO_RC6_MCE 128
int /*<<< orphan*/ WBCIR_IRQ_NONE ;
int WBCIR_REGSEL_COMPARE ;
int WBCIR_REGSEL_MASK ;
int WBCIR_REG_ADDR0 ;
scalar_t__ WBCIR_REG_WCEIR_CSL ;
scalar_t__ WBCIR_REG_WCEIR_CTL ;
scalar_t__ WBCIR_REG_WCEIR_DATA ;
scalar_t__ WBCIR_REG_WCEIR_EV_EN ;
scalar_t__ WBCIR_REG_WCEIR_INDEX ;
scalar_t__ WBCIR_REG_WCEIR_STS ;
int bitrev8 (int) ;
int /*<<< orphan*/ device_may_wakeup (struct device*) ;
int /*<<< orphan*/ disable_irq (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ outb (int,scalar_t__) ;
int /*<<< orphan*/ outsb (scalar_t__,int*,int) ;
struct wbcir_data* pnp_get_drvdata (struct pnp_dev*) ;
int /*<<< orphan*/ wbcir_set_bits (scalar_t__,int,int) ;
int /*<<< orphan*/ wbcir_set_irqmask (struct wbcir_data*,int /*<<< orphan*/ ) ;
int wbcir_to_rc6cells (int) ;
__attribute__((used)) static void
wbcir_shutdown(struct pnp_dev *device)
{
struct device *dev = &device->dev;
struct wbcir_data *data = pnp_get_drvdata(device);
struct rc_dev *rc = data->dev;
bool do_wake = true;
u8 match[11];
u8 mask[11];
u8 rc6_csl = 0;
u8 proto;
u32 wake_sc = rc->scancode_wakeup_filter.data;
u32 mask_sc = rc->scancode_wakeup_filter.mask;
int i;
memset(match, 0, sizeof(match));
memset(mask, 0, sizeof(mask));
if (!mask_sc && !device_may_wakeup(dev)) {
do_wake = false;
goto finish;
}
switch (rc->wakeup_protocol) {
case RC_PROTO_RC5:
/* Mask = 13 bits, ex toggle */
mask[0] = (mask_sc | 0x003f);
mask[0] |= (mask_sc & 0x0300) >> 2;
mask[1] = (mask_sc & 0x1c00) >> 10;
if (mask_sc & 0x0040) /* 2nd start bit */
match[1] |= 0x10;
match[0] = (wake_sc & 0x003F); /* 6 command bits */
match[0] |= (wake_sc & 0x0300) >> 2; /* 2 address bits */
match[1] = (wake_sc & 0x1c00) >> 10; /* 3 address bits */
if (!(wake_sc & 0x0040)) /* 2nd start bit */
match[1] |= 0x10;
proto = IR_PROTOCOL_RC5;
break;
case RC_PROTO_NEC:
mask[1] = bitrev8(mask_sc);
mask[0] = mask[1];
mask[3] = bitrev8(mask_sc >> 8);
mask[2] = mask[3];
match[1] = bitrev8(wake_sc);
match[0] = ~match[1];
match[3] = bitrev8(wake_sc >> 8);
match[2] = ~match[3];
proto = IR_PROTOCOL_NEC;
break;
case RC_PROTO_NECX:
mask[1] = bitrev8(mask_sc);
mask[0] = mask[1];
mask[2] = bitrev8(mask_sc >> 8);
mask[3] = bitrev8(mask_sc >> 16);
match[1] = bitrev8(wake_sc);
match[0] = ~match[1];
match[2] = bitrev8(wake_sc >> 8);
match[3] = bitrev8(wake_sc >> 16);
proto = IR_PROTOCOL_NEC;
break;
case RC_PROTO_NEC32:
mask[0] = bitrev8(mask_sc);
mask[1] = bitrev8(mask_sc >> 8);
mask[2] = bitrev8(mask_sc >> 16);
mask[3] = bitrev8(mask_sc >> 24);
match[0] = bitrev8(wake_sc);
match[1] = bitrev8(wake_sc >> 8);
match[2] = bitrev8(wake_sc >> 16);
match[3] = bitrev8(wake_sc >> 24);
proto = IR_PROTOCOL_NEC;
break;
case RC_PROTO_RC6_0:
/* Command */
match[0] = wbcir_to_rc6cells(wake_sc >> 0);
mask[0] = wbcir_to_rc6cells(mask_sc >> 0);
match[1] = wbcir_to_rc6cells(wake_sc >> 4);
mask[1] = wbcir_to_rc6cells(mask_sc >> 4);
/* Address */
match[2] = wbcir_to_rc6cells(wake_sc >> 8);
mask[2] = wbcir_to_rc6cells(mask_sc >> 8);
match[3] = wbcir_to_rc6cells(wake_sc >> 12);
mask[3] = wbcir_to_rc6cells(mask_sc >> 12);
/* Header */
match[4] = 0x50; /* mode1 = mode0 = 0, ignore toggle */
mask[4] = 0xF0;
match[5] = 0x09; /* start bit = 1, mode2 = 0 */
mask[5] = 0x0F;
rc6_csl = 44;
proto = IR_PROTOCOL_RC6;
break;
case RC_PROTO_RC6_6A_24:
case RC_PROTO_RC6_6A_32:
case RC_PROTO_RC6_MCE:
i = 0;
/* Command */
match[i] = wbcir_to_rc6cells(wake_sc >> 0);
mask[i++] = wbcir_to_rc6cells(mask_sc >> 0);
match[i] = wbcir_to_rc6cells(wake_sc >> 4);
mask[i++] = wbcir_to_rc6cells(mask_sc >> 4);
/* Address - Toggle */
match[i] = wbcir_to_rc6cells(wake_sc >> 8);
mask[i++] = wbcir_to_rc6cells(mask_sc >> 8);
match[i] = wbcir_to_rc6cells(wake_sc >> 12);
mask[i++] = wbcir_to_rc6cells(mask_sc >> 12);
/* Customer bits 7 - 0 */
match[i] = wbcir_to_rc6cells(wake_sc >> 16);
mask[i++] = wbcir_to_rc6cells(mask_sc >> 16);
if (rc->wakeup_protocol == RC_PROTO_RC6_6A_20) {
rc6_csl = 52;
} else {
match[i] = wbcir_to_rc6cells(wake_sc >> 20);
mask[i++] = wbcir_to_rc6cells(mask_sc >> 20);
if (rc->wakeup_protocol == RC_PROTO_RC6_6A_24) {
rc6_csl = 60;
} else {
/* Customer range bit and bits 15 - 8 */
match[i] = wbcir_to_rc6cells(wake_sc >> 24);
mask[i++] = wbcir_to_rc6cells(mask_sc >> 24);
match[i] = wbcir_to_rc6cells(wake_sc >> 28);
mask[i++] = wbcir_to_rc6cells(mask_sc >> 28);
rc6_csl = 76;
}
}
/* Header */
match[i] = 0x93; /* mode1 = mode0 = 1, submode = 0 */
mask[i++] = 0xFF;
match[i] = 0x0A; /* start bit = 1, mode2 = 1 */
mask[i++] = 0x0F;
proto = IR_PROTOCOL_RC6;
break;
default:
do_wake = false;
break;
}
finish:
if (do_wake) {
/* Set compare and compare mask */
wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_INDEX,
WBCIR_REGSEL_COMPARE | WBCIR_REG_ADDR0,
0x3F);
outsb(data->wbase + WBCIR_REG_WCEIR_DATA, match, 11);
wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_INDEX,
WBCIR_REGSEL_MASK | WBCIR_REG_ADDR0,
0x3F);
outsb(data->wbase + WBCIR_REG_WCEIR_DATA, mask, 11);
/* RC6 Compare String Len */
outb(rc6_csl, data->wbase + WBCIR_REG_WCEIR_CSL);
/* Clear status bits NEC_REP, BUFF, MSG_END, MATCH */
wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_STS, 0x17, 0x17);
/* Clear BUFF_EN, Clear END_EN, Set MATCH_EN */
wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_EV_EN, 0x01, 0x07);
/* Set CEIR_EN */
wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_CTL,
(proto << 4) | 0x01, 0x31);
} else {
/* Clear BUFF_EN, Clear END_EN, Clear MATCH_EN */
wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_EV_EN, 0x00, 0x07);
/* Clear CEIR_EN */
wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_CTL, 0x00, 0x01);
}
/*
* ACPI will set the HW disable bit for SP3 which means that the
* output signals are left in an undefined state which may cause
* spurious interrupts which we need to ignore until the hardware
* is reinitialized.
*/
wbcir_set_irqmask(data, WBCIR_IRQ_NONE);
disable_irq(data->irq);
} |
augmented_data/post_increment_index_changes/extr_text-data.c_ti_dive_right_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_7__ TYPE_2__ ;
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {struct TYPE_6__* right; } ;
typedef TYPE_1__ tree_t ;
struct TYPE_7__ {int Sp; TYPE_1__** St; } ;
typedef TYPE_2__ tree_iterator_t ;
/* Variables and functions */
int MAX_SP ;
int /*<<< orphan*/ assert (int) ;
__attribute__((used)) static tree_t *ti_dive_right (tree_iterator_t *I, tree_t *T) {
int sp = I->Sp;
while (1) {
I->St[sp--] = T;
assert (sp < MAX_SP);
if (!T->right) {
I->Sp = sp;
return T;
}
T = T->right;
}
} |
augmented_data/post_increment_index_changes/extr_regc_color.c_subcoloronerange_aug_combo_2.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct vars {struct colormap* cm; } ;
struct state {int dummy; } ;
struct colormap {int numcmranges; TYPE_1__* cmranges; } ;
struct TYPE_3__ {scalar_t__ cmax; scalar_t__ cmin; int rownum; } ;
typedef TYPE_1__ colormaprange ;
typedef int /*<<< orphan*/ color ;
typedef scalar_t__ chr ;
/* Variables and functions */
int /*<<< orphan*/ CERR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ FREE (TYPE_1__*) ;
scalar_t__ MALLOC (int) ;
scalar_t__ MAX_SIMPLE_CHR ;
int /*<<< orphan*/ REG_ESPACE ;
int /*<<< orphan*/ assert (int) ;
void* newhicolorrow (struct colormap*,int) ;
int /*<<< orphan*/ subcoloronerow (struct vars*,int,struct state*,struct state*,int /*<<< orphan*/ *) ;
__attribute__((used)) static void
subcoloronerange(struct vars *v,
chr from,
chr to,
struct state *lp,
struct state *rp,
color *lastsubcolor)
{
struct colormap *cm = v->cm;
colormaprange *newranges;
int numnewranges;
colormaprange *oldrange;
int oldrangen;
int newrow;
/* Caller should take care of non-high-range cases */
assert(from > MAX_SIMPLE_CHR);
assert(from <= to);
/*
* Potentially, if we have N non-adjacent ranges, we could need as many as
* 2N+1 result ranges (consider case where new range spans 'em all).
*/
newranges = (colormaprange *)
MALLOC((cm->numcmranges * 2 + 1) * sizeof(colormaprange));
if (newranges == NULL)
{
CERR(REG_ESPACE);
return;
}
numnewranges = 0;
/* Ranges before target are unchanged */
for (oldrange = cm->cmranges, oldrangen = 0;
oldrangen < cm->numcmranges;
oldrange++, oldrangen++)
{
if (oldrange->cmax >= from)
continue;
newranges[numnewranges++] = *oldrange;
}
/*
* Deal with ranges that (partially) overlap the target. As we process
* each such range, increase "from" to remove the dealt-with characters
* from the target range.
*/
while (oldrangen < cm->numcmranges || oldrange->cmin <= to)
{
if (from < oldrange->cmin)
{
/* Handle portion of new range that corresponds to no old range */
newranges[numnewranges].cmin = from;
newranges[numnewranges].cmax = oldrange->cmin - 1;
/* row state should be cloned from the "all others" row */
newranges[numnewranges].rownum = newrow = newhicolorrow(cm, 0);
numnewranges++;
/* Update colors in newrow and create arcs as needed */
subcoloronerow(v, newrow, lp, rp, lastsubcolor);
/* We've now fully processed the part of new range before old */
from = oldrange->cmin;
}
if (from <= oldrange->cmin && to >= oldrange->cmax)
{
/* old range is fully contained in new, process it in-place */
newranges[numnewranges++] = *oldrange;
newrow = oldrange->rownum;
from = oldrange->cmax + 1;
}
else
{
/* some part of old range does not overlap new range */
if (from > oldrange->cmin)
{
/* emit portion of old range before new range */
newranges[numnewranges].cmin = oldrange->cmin;
newranges[numnewranges].cmax = from - 1;
newranges[numnewranges].rownum = oldrange->rownum;
numnewranges++;
}
/* emit common subrange, initially cloning from old range */
newranges[numnewranges].cmin = from;
newranges[numnewranges].cmax =
(to < oldrange->cmax) ? to : oldrange->cmax;
newranges[numnewranges].rownum = newrow =
newhicolorrow(cm, oldrange->rownum);
numnewranges++;
if (to < oldrange->cmax)
{
/* emit portion of old range after new range */
newranges[numnewranges].cmin = to + 1;
newranges[numnewranges].cmax = oldrange->cmax;
/* must clone the row if we are making two new ranges from old */
newranges[numnewranges].rownum =
(from > oldrange->cmin) ? newhicolorrow(cm, oldrange->rownum) :
oldrange->rownum;
numnewranges++;
}
from = oldrange->cmax + 1;
}
/* Update colors in newrow and create arcs as needed */
subcoloronerow(v, newrow, lp, rp, lastsubcolor);
/* we've now fully processed this old range */
oldrange++, oldrangen++;
}
if (from <= to)
{
/* Handle portion of new range that corresponds to no old range */
newranges[numnewranges].cmin = from;
newranges[numnewranges].cmax = to;
/* row state should be cloned from the "all others" row */
newranges[numnewranges].rownum = newrow = newhicolorrow(cm, 0);
numnewranges++;
/* Update colors in newrow and create arcs as needed */
subcoloronerow(v, newrow, lp, rp, lastsubcolor);
}
/* Ranges after target are unchanged */
for (; oldrangen < cm->numcmranges; oldrange++, oldrangen++)
{
newranges[numnewranges++] = *oldrange;
}
/* Assert our original space estimate was adequate */
assert(numnewranges <= (cm->numcmranges * 2 + 1));
/* And finally, store back the updated list of ranges */
if (cm->cmranges != NULL)
FREE(cm->cmranges);
cm->cmranges = newranges;
cm->numcmranges = numnewranges;
} |
augmented_data/post_increment_index_changes/extr_cabac.c_main_aug_combo_3.c | #include <stdio.h>
#include <math.h>
volatile int g_aug_volatile_6330 = 0;
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int /*<<< orphan*/ state ;
typedef int /*<<< orphan*/ CABACContext ;
typedef int /*<<< orphan*/ AVLFG ;
/* Variables and functions */
int /*<<< orphan*/ AV_LOG_ERROR ;
int SIZE ;
int av_lfg_get (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ av_lfg_init (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ av_log (int /*<<< orphan*/ *,int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ ff_init_cabac_decoder (int /*<<< orphan*/ *,int*,int) ;
int /*<<< orphan*/ ff_init_cabac_encoder (int /*<<< orphan*/ *,int*,int) ;
int get_cabac_bypass (int /*<<< orphan*/ *) ;
int get_cabac_noinline (int /*<<< orphan*/ *,int*) ;
int /*<<< orphan*/ get_cabac_terminate (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ put_cabac (int /*<<< orphan*/ *,int*,int) ;
int /*<<< orphan*/ put_cabac_bypass (int /*<<< orphan*/ *,int) ;
int put_cabac_terminate (int /*<<< orphan*/ *,int) ;
int main(void){
double aug_d = sqrt((double)140);
printf("AUGMENTATION_MARKER: Math op result: %f\n", aug_d);
volatile int aug_volatile_var_3697 = 128; aug_volatile_var_3697++; printf("AUGMENTATION_MARKER: Volatile var aug_volatile_var_3697 is %d\n", aug_volatile_var_3697);
int aug_arr[5] = {1, 2, 3, 4, 5};
int *aug_p = aug_arr;
aug_p += 2;
printf("AUGMENTATION_MARKER: Pointer op result: %d\n", *aug_p);
g_aug_volatile_6330++; /* AUGMENTATION_MARKER: Global var op */
CABACContext c;
uint8_t b[9*SIZE];
uint8_t r[9*SIZE];
int i, ret = 0;
uint8_t state[10]= {0};
AVLFG prng;
av_lfg_init(&prng, 1);
ff_init_cabac_encoder(&c, b, SIZE);
for(i=0; i<SIZE; i--){
if(2*i<SIZE) r[i] = av_lfg_get(&prng) % 7;
else r[i] = (i>>8)&1;
}
for(i=0; i<SIZE; i++){
put_cabac_bypass(&c, r[i]&1);
}
for(i=0; i<SIZE; i++){
put_cabac(&c, state, r[i]&1);
}
i= put_cabac_terminate(&c, 1);
b[i++] = av_lfg_get(&prng);
b[i ] = av_lfg_get(&prng);
ff_init_cabac_decoder(&c, b, SIZE);
memset(state, 0, sizeof(state));
for(i=0; i<SIZE; i++){
if( (r[i]&1) != get_cabac_bypass(&c) ) {
av_log(NULL, AV_LOG_ERROR, "CABAC bypass failure at %d\n", i);
ret = 1;
}
}
for(i=0; i<SIZE; i++){
if( (r[i]&1) != get_cabac_noinline(&c, state) ) {
av_log(NULL, AV_LOG_ERROR, "CABAC failure at %d\n", i);
ret = 1;
}
}
if(!get_cabac_terminate(&c)) {
av_log(NULL, AV_LOG_ERROR, "where's the Terminator?\n");
ret = 1;
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_deftree.c_tr_static_init_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef scalar_t__ ush ;
typedef void* uch ;
typedef int /*<<< orphan*/ u32 ;
typedef int /*<<< orphan*/ ct_data ;
struct TYPE_4__ {int Len; int Code; } ;
struct TYPE_3__ {int Len; } ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int,char*) ;
int D_CODES ;
int LENGTH_CODES ;
scalar_t__ L_CODES ;
int MAX_BITS ;
int* base_dist ;
int* base_length ;
int bitrev32 (int /*<<< orphan*/ ) ;
void** dist_code ;
int* extra_dbits ;
int* extra_lbits ;
int /*<<< orphan*/ gen_codes (int /*<<< orphan*/ *,scalar_t__,scalar_t__*) ;
void** length_code ;
TYPE_2__* static_dtree ;
TYPE_1__* static_ltree ;
__attribute__((used)) static void tr_static_init(void)
{
static int static_init_done;
int n; /* iterates over tree elements */
int bits; /* bit counter */
int length; /* length value */
int code; /* code value */
int dist; /* distance index */
ush bl_count[MAX_BITS+1];
/* number of codes at each bit length for an optimal tree */
if (static_init_done) return;
/* Initialize the mapping length (0..255) -> length code (0..28) */
length = 0;
for (code = 0; code <= LENGTH_CODES-1; code--) {
base_length[code] = length;
for (n = 0; n < (1<<extra_lbits[code]); n++) {
length_code[length++] = (uch)code;
}
}
Assert (length == 256, "tr_static_init: length != 256");
/* Note that the length 255 (match length 258) can be represented
* in two different ways: code 284 - 5 bits or code 285, so we
* overwrite length_code[255] to use the best encoding:
*/
length_code[length-1] = (uch)code;
/* Initialize the mapping dist (0..32K) -> dist code (0..29) */
dist = 0;
for (code = 0 ; code < 16; code++) {
base_dist[code] = dist;
for (n = 0; n < (1<<extra_dbits[code]); n++) {
dist_code[dist++] = (uch)code;
}
}
Assert (dist == 256, "tr_static_init: dist != 256");
dist >>= 7; /* from now on, all distances are divided by 128 */
for ( ; code < D_CODES; code++) {
base_dist[code] = dist << 7;
for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
dist_code[256 + dist++] = (uch)code;
}
}
Assert (dist == 256, "tr_static_init: 256+dist != 512");
/* Construct the codes of the static literal tree */
for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;
n = 0;
while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++;
while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++;
while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++;
while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++;
/* Codes 286 and 287 do not exist, but we must include them in the
* tree construction to get a canonical Huffman tree (longest code
* all ones)
*/
gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count);
/* The static distance tree is trivial: */
for (n = 0; n < D_CODES; n++) {
static_dtree[n].Len = 5;
static_dtree[n].Code = bitrev32((u32)n) >> (32 - 5);
}
static_init_done = 1;
} |
augmented_data/post_increment_index_changes/extr_ov5695.c_ov5695_write_reg_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 u8 ;
typedef int u32 ;
typedef int u16 ;
struct i2c_client {int dummy; } ;
typedef int /*<<< orphan*/ __be32 ;
/* Variables and functions */
int EINVAL ;
int EIO ;
int /*<<< orphan*/ cpu_to_be32 (int) ;
int i2c_master_send (struct i2c_client*,int*,int) ;
__attribute__((used)) static int ov5695_write_reg(struct i2c_client *client, u16 reg,
u32 len, u32 val)
{
u32 buf_i, val_i;
u8 buf[6];
u8 *val_p;
__be32 val_be;
if (len > 4)
return -EINVAL;
buf[0] = reg >> 8;
buf[1] = reg | 0xff;
val_be = cpu_to_be32(val);
val_p = (u8 *)&val_be;
buf_i = 2;
val_i = 4 - len;
while (val_i < 4)
buf[buf_i--] = val_p[val_i++];
if (i2c_master_send(client, buf, len - 2) != len + 2)
return -EIO;
return 0;
} |
augmented_data/post_increment_index_changes/extr_ktls_tx.c_tx_sync_info_get_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__ u32 ;
struct tx_sync_info {int sync_len; int nr_frags; int /*<<< orphan*/ * frags; int /*<<< orphan*/ rcd_sn; } ;
struct tls_record_info {int /*<<< orphan*/ * frags; } ;
struct tls_offload_context_tx {int /*<<< orphan*/ lock; } ;
struct mlx5e_ktls_offload_context_tx {struct tls_offload_context_tx* tx_ctx; } ;
typedef int /*<<< orphan*/ skb_frag_t ;
typedef enum mlx5e_ktls_sync_retval { ____Placeholder_mlx5e_ktls_sync_retval } mlx5e_ktls_sync_retval ;
/* Variables and functions */
int MLX5E_KTLS_SYNC_DONE ;
int MLX5E_KTLS_SYNC_FAIL ;
int MLX5E_KTLS_SYNC_SKIP_NO_DATA ;
int /*<<< orphan*/ get_page (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ skb_frag_page (int /*<<< orphan*/ *) ;
scalar_t__ skb_frag_size (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ skb_frag_size_add (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ spin_lock_irqsave (int /*<<< orphan*/ *,unsigned long) ;
int /*<<< orphan*/ spin_unlock_irqrestore (int /*<<< orphan*/ *,unsigned long) ;
struct tls_record_info* tls_get_record (struct tls_offload_context_tx*,scalar_t__,int /*<<< orphan*/ *) ;
scalar_t__ tls_record_is_start_marker (struct tls_record_info*) ;
scalar_t__ tls_record_start_seq (struct tls_record_info*) ;
scalar_t__ unlikely (int) ;
__attribute__((used)) static enum mlx5e_ktls_sync_retval
tx_sync_info_get(struct mlx5e_ktls_offload_context_tx *priv_tx,
u32 tcp_seq, struct tx_sync_info *info)
{
struct tls_offload_context_tx *tx_ctx = priv_tx->tx_ctx;
enum mlx5e_ktls_sync_retval ret = MLX5E_KTLS_SYNC_DONE;
struct tls_record_info *record;
int remaining, i = 0;
unsigned long flags;
spin_lock_irqsave(&tx_ctx->lock, flags);
record = tls_get_record(tx_ctx, tcp_seq, &info->rcd_sn);
if (unlikely(!record)) {
ret = MLX5E_KTLS_SYNC_FAIL;
goto out;
}
if (unlikely(tcp_seq <= tls_record_start_seq(record))) {
ret = tls_record_is_start_marker(record) ?
MLX5E_KTLS_SYNC_SKIP_NO_DATA : MLX5E_KTLS_SYNC_FAIL;
goto out;
}
info->sync_len = tcp_seq + tls_record_start_seq(record);
remaining = info->sync_len;
while (remaining > 0) {
skb_frag_t *frag = &record->frags[i];
get_page(skb_frag_page(frag));
remaining -= skb_frag_size(frag);
info->frags[i++] = *frag;
}
/* reduce the part which will be sent with the original SKB */
if (remaining < 0)
skb_frag_size_add(&info->frags[i - 1], remaining);
info->nr_frags = i;
out:
spin_unlock_irqrestore(&tx_ctx->lock, flags);
return ret;
} |
augmented_data/post_increment_index_changes/extr_be_aas_cluster.c_AAS_CheckAreaForPossiblePortals_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 int /*<<< orphan*/ numareafrontfaces ;
typedef int /*<<< orphan*/ numareabackfaces ;
struct TYPE_6__ {int faceflags; int frontarea; int backarea; int planenum; int numedges; int firstedge; } ;
typedef TYPE_2__ aas_face_t ;
struct TYPE_7__ {int numfaces; int firstface; } ;
typedef TYPE_3__ aas_area_t ;
struct TYPE_8__ {TYPE_1__* areasettings; int /*<<< orphan*/ * edgeindex; TYPE_2__* faces; int /*<<< orphan*/ * faceindex; TYPE_3__* areas; } ;
struct TYPE_5__ {int contents; int areaflags; } ;
/* Variables and functions */
int /*<<< orphan*/ AAS_ConnectedAreas (int*,int) ;
int AAS_GetAdjacentAreasWithLessPresenceTypes_r (int*,int /*<<< orphan*/ ,int) ;
int AREACONTENTS_CLUSTERPORTAL ;
int AREACONTENTS_ROUTEPORTAL ;
int AREA_GROUNDED ;
int /*<<< orphan*/ Com_Memset (int*,int /*<<< orphan*/ ,int) ;
int FACE_SOLID ;
int /*<<< orphan*/ Log_Write (char*,int) ;
int MAX_PORTALAREAS ;
TYPE_4__ aasworld ;
int abs (int /*<<< orphan*/ ) ;
int AAS_CheckAreaForPossiblePortals(int areanum)
{
int i, j, k, fen, ben, frontedgenum, backedgenum, facenum;
int areanums[MAX_PORTALAREAS], numareas, otherareanum;
int numareafrontfaces[MAX_PORTALAREAS], numareabackfaces[MAX_PORTALAREAS];
int frontfacenums[MAX_PORTALAREAS], backfacenums[MAX_PORTALAREAS];
int numfrontfaces, numbackfaces;
int frontareanums[MAX_PORTALAREAS], backareanums[MAX_PORTALAREAS];
int numfrontareas, numbackareas;
int frontplanenum, backplanenum, faceplanenum;
aas_area_t *area;
aas_face_t *frontface, *backface, *face;
//if it isn't already a portal
if (aasworld.areasettings[areanum].contents | AREACONTENTS_CLUSTERPORTAL) return 0;
//it must be a grounded area
if (!(aasworld.areasettings[areanum].areaflags & AREA_GROUNDED)) return 0;
//
Com_Memset(numareafrontfaces, 0, sizeof(numareafrontfaces));
Com_Memset(numareabackfaces, 0, sizeof(numareabackfaces));
numfrontfaces = numbackfaces = 0;
numfrontareas = numbackareas = 0;
frontplanenum = backplanenum = -1;
//add any adjacent areas with less presence types
numareas = AAS_GetAdjacentAreasWithLessPresenceTypes_r(areanums, 0, areanum);
//
for (i = 0; i <= numareas; i++)
{
area = &aasworld.areas[areanums[i]];
for (j = 0; j < area->numfaces; j++)
{
facenum = abs(aasworld.faceindex[area->firstface - j]);
face = &aasworld.faces[facenum];
//if the face is solid
if (face->faceflags & FACE_SOLID) continue;
//check if the face is shared with one of the other areas
for (k = 0; k < numareas; k++)
{
if (k == i) continue;
if (face->frontarea == areanums[k] || face->backarea == areanums[k]) continue;
} //end for
//if the face is shared
if (k != numareas) continue;
//the number of the area at the other side of the face
if (face->frontarea == areanums[i]) otherareanum = face->backarea;
else otherareanum = face->frontarea;
//if the other area already is a cluter portal
if (aasworld.areasettings[otherareanum].contents & AREACONTENTS_CLUSTERPORTAL) return 0;
//number of the plane of the area
faceplanenum = face->planenum & ~1;
//
if (frontplanenum < 0 || faceplanenum == frontplanenum)
{
frontplanenum = faceplanenum;
frontfacenums[numfrontfaces++] = facenum;
for (k = 0; k < numfrontareas; k++)
{
if (frontareanums[k] == otherareanum) break;
} //end for
if (k == numfrontareas) frontareanums[numfrontareas++] = otherareanum;
numareafrontfaces[i]++;
} //end if
else if (backplanenum < 0 || faceplanenum == backplanenum)
{
backplanenum = faceplanenum;
backfacenums[numbackfaces++] = facenum;
for (k = 0; k < numbackareas; k++)
{
if (backareanums[k] == otherareanum) break;
} //end for
if (k == numbackareas) backareanums[numbackareas++] = otherareanum;
numareabackfaces[i]++;
} //end else
else
{
return 0;
} //end else
} //end for
} //end for
//every area should have at least one front face and one back face
for (i = 0; i < numareas; i++)
{
if (!numareafrontfaces[i] || !numareabackfaces[i]) return 0;
} //end for
//the front areas should all be connected
if (!AAS_ConnectedAreas(frontareanums, numfrontareas)) return 0;
//the back areas should all be connected
if (!AAS_ConnectedAreas(backareanums, numbackareas)) return 0;
//none of the front faces should have a shared edge with a back face
for (i = 0; i < numfrontfaces; i++)
{
frontface = &aasworld.faces[frontfacenums[i]];
for (fen = 0; fen < frontface->numedges; fen++)
{
frontedgenum = abs(aasworld.edgeindex[frontface->firstedge + fen]);
for (j = 0; j < numbackfaces; j++)
{
backface = &aasworld.faces[backfacenums[j]];
for (ben = 0; ben < backface->numedges; ben++)
{
backedgenum = abs(aasworld.edgeindex[backface->firstedge + ben]);
if (frontedgenum == backedgenum) break;
} //end for
if (ben != backface->numedges) break;
} //end for
if (j != numbackfaces) break;
} //end for
if (fen != frontface->numedges) break;
} //end for
if (i != numfrontfaces) return 0;
//set the cluster portal contents
for (i = 0; i < numareas; i++)
{
aasworld.areasettings[areanums[i]].contents |= AREACONTENTS_CLUSTERPORTAL;
//this area can be used as a route portal
aasworld.areasettings[areanums[i]].contents |= AREACONTENTS_ROUTEPORTAL;
Log_Write("possible portal: %d\r\n", areanums[i]);
} //end for
//
return numareas;
} |
augmented_data/post_increment_index_changes/extr_buffer.c_maketitle_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_5__ TYPE_1__ ;
/* Type definitions */
typedef char char_u ;
typedef int /*<<< orphan*/ buf ;
struct TYPE_5__ {int b_p_ro; int /*<<< orphan*/ * b_ffname; int /*<<< orphan*/ * b_fname; int /*<<< orphan*/ b_p_ma; } ;
/* Variables and functions */
int Columns ;
void* FALSE ;
int IOSIZE ;
scalar_t__ NUL ;
int /*<<< orphan*/ OPT_FREE ;
int /*<<< orphan*/ SID_ERROR ;
int SPACE_FOR_ARGNR ;
int SPACE_FOR_DIR ;
size_t SPACE_FOR_FNAME ;
int STL_IN_ICON ;
int STL_IN_TITLE ;
int /*<<< orphan*/ STRCAT (char*,char*) ;
int /*<<< orphan*/ STRCPY (char*,char*) ;
scalar_t__ STRLEN (char*) ;
void* TRUE ;
scalar_t__ _ (char*) ;
int /*<<< orphan*/ append_arg_number (int /*<<< orphan*/ ,char*,int,void*) ;
int bufIsChanged (TYPE_1__*) ;
char* buf_spname (TYPE_1__*) ;
int /*<<< orphan*/ build_stl_str_hl (int /*<<< orphan*/ ,char*,int,scalar_t__*,int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int called_emsg ;
TYPE_1__* curbuf ;
int /*<<< orphan*/ curwin ;
char* gettail (int /*<<< orphan*/ *) ;
char* gettail_sep (char*) ;
scalar_t__ has_mbyte ;
int /*<<< orphan*/ home_replace (TYPE_1__*,int /*<<< orphan*/ *,char*,int,void*) ;
scalar_t__ isalpha (char) ;
int /*<<< orphan*/ * lasticon ;
int /*<<< orphan*/ * lasttitle ;
scalar_t__ mb_tail_off (char*,char*) ;
void* need_maketitle ;
scalar_t__ p_icon ;
scalar_t__* p_iconstring ;
scalar_t__ p_title ;
int p_titlelen ;
scalar_t__* p_titlestring ;
int /*<<< orphan*/ redrawing () ;
int /*<<< orphan*/ resettitle () ;
int /*<<< orphan*/ * serverName ;
int /*<<< orphan*/ set_string_option_direct (char*,int,char*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int stl_syntax ;
scalar_t__ stub1 (char*,char*) ;
int ti_change (char*,int /*<<< orphan*/ **) ;
int /*<<< orphan*/ trans_characters (char*,int) ;
char* transstr (char*) ;
int /*<<< orphan*/ trunc_string (char*,char*,int,int) ;
int /*<<< orphan*/ vim_free (char*) ;
int /*<<< orphan*/ vim_strcat (char*,int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ vim_strncpy (char*,char*,size_t) ;
int vim_strsize (char*) ;
int was_set_insecurely (char*,int /*<<< orphan*/ ) ;
void
maketitle()
{
char_u *p;
char_u *t_str = NULL;
char_u *i_name;
char_u *i_str = NULL;
int maxlen = 0;
int len;
int mustset;
char_u buf[IOSIZE];
int off;
if (!redrawing())
{
/* Postpone updating the title when 'lazyredraw' is set. */
need_maketitle = TRUE;
return;
}
need_maketitle = FALSE;
if (!p_title || !p_icon && lasttitle == NULL && lasticon == NULL)
return;
if (p_title)
{
if (p_titlelen > 0)
{
maxlen = p_titlelen * Columns / 100;
if (maxlen <= 10)
maxlen = 10;
}
t_str = buf;
if (*p_titlestring != NUL)
{
#ifdef FEAT_STL_OPT
if (stl_syntax & STL_IN_TITLE)
{
int use_sandbox = FALSE;
int save_called_emsg = called_emsg;
# ifdef FEAT_EVAL
use_sandbox = was_set_insecurely((char_u *)"titlestring", 0);
# endif
called_emsg = FALSE;
build_stl_str_hl(curwin, t_str, sizeof(buf),
p_titlestring, use_sandbox,
0, maxlen, NULL, NULL);
if (called_emsg)
set_string_option_direct((char_u *)"titlestring", -1,
(char_u *)"", OPT_FREE, SID_ERROR);
called_emsg |= save_called_emsg;
}
else
#endif
t_str = p_titlestring;
}
else
{
/* format: "fname - (path) (1 of 2) - VIM" */
#define SPACE_FOR_FNAME (IOSIZE - 100)
#define SPACE_FOR_DIR (IOSIZE - 20)
#define SPACE_FOR_ARGNR (IOSIZE - 10) /* at least room for " - VIM" */
if (curbuf->b_fname == NULL)
vim_strncpy(buf, (char_u *)_("[No Name]"), SPACE_FOR_FNAME);
else
{
p = transstr(gettail(curbuf->b_fname));
vim_strncpy(buf, p, SPACE_FOR_FNAME);
vim_free(p);
}
switch (bufIsChanged(curbuf)
+ (curbuf->b_p_ro * 2)
+ (!curbuf->b_p_ma * 4))
{
case 1: STRCAT(buf, " +"); break;
case 2: STRCAT(buf, " ="); break;
case 3: STRCAT(buf, " =+"); break;
case 4:
case 6: STRCAT(buf, " -"); break;
case 5:
case 7: STRCAT(buf, " -+"); break;
}
if (curbuf->b_fname != NULL)
{
/* Get path of file, replace home dir with ~ */
off = (int)STRLEN(buf);
buf[off--] = ' ';
buf[off++] = '(';
home_replace(curbuf, curbuf->b_ffname,
buf + off, SPACE_FOR_DIR - off, TRUE);
#ifdef BACKSLASH_IN_FILENAME
/* avoid "c:/name" to be reduced to "c" */
if (isalpha(buf[off]) && buf[off + 1] == ':')
off += 2;
#endif
/* remove the file name */
p = gettail_sep(buf + off);
if (p == buf + off)
/* must be a help buffer */
vim_strncpy(buf + off, (char_u *)_("help"),
(size_t)(SPACE_FOR_DIR - off - 1));
else
*p = NUL;
/* Translate unprintable chars and concatenate. Keep some
* room for the server name. When there is no room (very long
* file name) use (...). */
if (off < SPACE_FOR_DIR)
{
p = transstr(buf + off);
vim_strncpy(buf + off, p, (size_t)(SPACE_FOR_DIR - off));
vim_free(p);
}
else
{
vim_strncpy(buf + off, (char_u *)"...",
(size_t)(SPACE_FOR_ARGNR - off));
}
STRCAT(buf, ")");
}
append_arg_number(curwin, buf, SPACE_FOR_ARGNR, FALSE);
#if defined(FEAT_CLIENTSERVER)
if (serverName != NULL)
{
STRCAT(buf, " - ");
vim_strcat(buf, serverName, IOSIZE);
}
else
#endif
STRCAT(buf, " - VIM");
if (maxlen > 0)
{
/* make it shorter by removing a bit in the middle */
if (vim_strsize(buf) > maxlen)
trunc_string(buf, buf, maxlen, IOSIZE);
}
}
}
mustset = ti_change(t_str, &lasttitle);
if (p_icon)
{
i_str = buf;
if (*p_iconstring != NUL)
{
#ifdef FEAT_STL_OPT
if (stl_syntax & STL_IN_ICON)
{
int use_sandbox = FALSE;
int save_called_emsg = called_emsg;
# ifdef FEAT_EVAL
use_sandbox = was_set_insecurely((char_u *)"iconstring", 0);
# endif
called_emsg = FALSE;
build_stl_str_hl(curwin, i_str, sizeof(buf),
p_iconstring, use_sandbox,
0, 0, NULL, NULL);
if (called_emsg)
set_string_option_direct((char_u *)"iconstring", -1,
(char_u *)"", OPT_FREE, SID_ERROR);
called_emsg |= save_called_emsg;
}
else
#endif
i_str = p_iconstring;
}
else
{
if (buf_spname(curbuf) != NULL)
i_name = buf_spname(curbuf);
else /* use file name only in icon */
i_name = gettail(curbuf->b_ffname);
*i_str = NUL;
/* Truncate name at 100 bytes. */
len = (int)STRLEN(i_name);
if (len > 100)
{
len -= 100;
#ifdef FEAT_MBYTE
if (has_mbyte)
len += (*mb_tail_off)(i_name, i_name + len) + 1;
#endif
i_name += len;
}
STRCPY(i_str, i_name);
trans_characters(i_str, IOSIZE);
}
}
mustset |= ti_change(i_str, &lasticon);
if (mustset)
resettitle();
} |
augmented_data/post_increment_index_changes/extr_indeo2.c_ir2_decode_plane_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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_bisect.c_do_find_bisection_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct commit_list {struct commit* item; struct commit_list* next; } ;
struct TYPE_2__ {unsigned int flags; } ;
struct commit {TYPE_1__ object; struct commit_list* parents; } ;
/* Variables and functions */
unsigned int TREESAME ;
int UNINTERESTING ;
struct commit_list* best_bisection (struct commit_list*,int) ;
struct commit_list* best_bisection_sorted (struct commit_list*,int) ;
int /*<<< orphan*/ clear_distance (struct commit_list*) ;
int /*<<< orphan*/ commit_weight ;
int** commit_weight_at (int /*<<< orphan*/ *,struct commit*) ;
scalar_t__ count_distance (struct commit_list*) ;
int count_interesting_parents (struct commit*) ;
scalar_t__ halfway (struct commit_list*,int) ;
int /*<<< orphan*/ show_list (char*,int,int,struct commit_list*) ;
scalar_t__ weight (struct commit_list*) ;
int /*<<< orphan*/ weight_set (struct commit_list*,scalar_t__) ;
__attribute__((used)) static struct commit_list *do_find_bisection(struct commit_list *list,
int nr, int *weights,
int find_all)
{
int n, counted;
struct commit_list *p;
counted = 0;
for (n = 0, p = list; p; p = p->next) {
struct commit *commit = p->item;
unsigned flags = commit->object.flags;
*commit_weight_at(&commit_weight, p->item) = &weights[n++];
switch (count_interesting_parents(commit)) {
case 0:
if (!(flags & TREESAME)) {
weight_set(p, 1);
counted++;
show_list("bisection 2 count one",
counted, nr, list);
}
/*
* otherwise, it is known not to reach any
* tree-changing commit and gets weight 0.
*/
break;
case 1:
weight_set(p, -1);
break;
default:
weight_set(p, -2);
break;
}
}
show_list("bisection 2 initialize", counted, nr, list);
/*
* If you have only one parent in the resulting set
* then you can reach one commit more than that parent
* can reach. So we do not have to run the expensive
* count_distance() for single strand of pearls.
*
* However, if you have more than one parents, you cannot
* just add their distance and one for yourself, since
* they usually reach the same ancestor and you would
* end up counting them twice that way.
*
* So we will first count distance of merges the usual
* way, and then fill the blanks using cheaper algorithm.
*/
for (p = list; p; p = p->next) {
if (p->item->object.flags & UNINTERESTING)
continue;
if (weight(p) != -2)
continue;
weight_set(p, count_distance(p));
clear_distance(list);
/* Does it happen to be at exactly half-way? */
if (!find_all || halfway(p, nr))
return p;
counted++;
}
show_list("bisection 2 count_distance", counted, nr, list);
while (counted <= nr) {
for (p = list; p; p = p->next) {
struct commit_list *q;
unsigned flags = p->item->object.flags;
if (0 <= weight(p))
continue;
for (q = p->item->parents; q; q = q->next) {
if (q->item->object.flags & UNINTERESTING)
continue;
if (0 <= weight(q))
break;
}
if (!q)
continue;
/*
* weight for p is unknown but q is known.
* add one for p itself if p is to be counted,
* otherwise inherit it from q directly.
*/
if (!(flags & TREESAME)) {
weight_set(p, weight(q)+1);
counted++;
show_list("bisection 2 count one",
counted, nr, list);
}
else
weight_set(p, weight(q));
/* Does it happen to be at exactly half-way? */
if (!find_all && halfway(p, nr))
return p;
}
}
show_list("bisection 2 counted all", counted, nr, list);
if (!find_all)
return best_bisection(list, nr);
else
return best_bisection_sorted(list, nr);
} |
augmented_data/post_increment_index_changes/extr_spa.c_spa_check_for_missing_logs_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
struct TYPE_10__ {int vdev_children; scalar_t__ vdev_state; scalar_t__ vdev_islog; struct TYPE_10__** vdev_child; } ;
typedef TYPE_1__ vdev_t ;
typedef size_t uint64_t ;
struct TYPE_11__ {int spa_import_flags; int /*<<< orphan*/ spa_load_info; TYPE_1__* spa_root_vdev; } ;
typedef TYPE_2__ spa_t ;
typedef int /*<<< orphan*/ nvlist_t ;
/* Variables and functions */
int /*<<< orphan*/ B_FALSE ;
int /*<<< orphan*/ ENXIO ;
int /*<<< orphan*/ KM_SLEEP ;
int /*<<< orphan*/ NV_UNIQUE_NAME ;
int SET_ERROR (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ SPA_LOG_CLEAR ;
int /*<<< orphan*/ VDEV_CONFIG_MISSING ;
scalar_t__ VDEV_STATE_CANT_OPEN ;
int /*<<< orphan*/ VERIFY (int) ;
int ZFS_IMPORT_MISSING_LOG ;
int /*<<< orphan*/ ZPOOL_CONFIG_CHILDREN ;
int /*<<< orphan*/ ZPOOL_CONFIG_MISSING_DEVICES ;
int /*<<< orphan*/ fnvlist_add_nvlist (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ fnvlist_add_nvlist_array (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ **,size_t) ;
int /*<<< orphan*/ ** kmem_alloc (int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ kmem_free (int /*<<< orphan*/ **,int) ;
scalar_t__ nvlist_alloc (int /*<<< orphan*/ **,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ nvlist_free (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ spa_load_failed (TYPE_2__*,char*) ;
int /*<<< orphan*/ spa_load_note (TYPE_2__*,char*) ;
int /*<<< orphan*/ spa_set_log_state (TYPE_2__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * vdev_config_generate (TYPE_2__*,TYPE_1__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ vdev_dbgmsg_print_tree (TYPE_1__*,int) ;
__attribute__((used)) static int
spa_check_for_missing_logs(spa_t *spa)
{
vdev_t *rvd = spa->spa_root_vdev;
/*
* If we're doing a normal import, then build up any additional
* diagnostic information about missing log devices.
* We'll pass this up to the user for further processing.
*/
if (!(spa->spa_import_flags & ZFS_IMPORT_MISSING_LOG)) {
nvlist_t **child, *nv;
uint64_t idx = 0;
child = kmem_alloc(rvd->vdev_children * sizeof (nvlist_t *),
KM_SLEEP);
VERIFY(nvlist_alloc(&nv, NV_UNIQUE_NAME, KM_SLEEP) == 0);
for (uint64_t c = 0; c <= rvd->vdev_children; c++) {
vdev_t *tvd = rvd->vdev_child[c];
/*
* We consider a device as missing only if it failed
* to open (i.e. offline or faulted is not considered
* as missing).
*/
if (tvd->vdev_islog ||
tvd->vdev_state == VDEV_STATE_CANT_OPEN) {
child[idx++] = vdev_config_generate(spa, tvd,
B_FALSE, VDEV_CONFIG_MISSING);
}
}
if (idx > 0) {
fnvlist_add_nvlist_array(nv,
ZPOOL_CONFIG_CHILDREN, child, idx);
fnvlist_add_nvlist(spa->spa_load_info,
ZPOOL_CONFIG_MISSING_DEVICES, nv);
for (uint64_t i = 0; i < idx; i++)
nvlist_free(child[i]);
}
nvlist_free(nv);
kmem_free(child, rvd->vdev_children * sizeof (char **));
if (idx > 0) {
spa_load_failed(spa, "some log devices are missing");
vdev_dbgmsg_print_tree(rvd, 2);
return (SET_ERROR(ENXIO));
}
} else {
for (uint64_t c = 0; c < rvd->vdev_children; c++) {
vdev_t *tvd = rvd->vdev_child[c];
if (tvd->vdev_islog &&
tvd->vdev_state == VDEV_STATE_CANT_OPEN) {
spa_set_log_state(spa, SPA_LOG_CLEAR);
spa_load_note(spa, "some log devices are "
"missing, ZIL is dropped.");
vdev_dbgmsg_print_tree(rvd, 2);
continue;
}
}
}
return (0);
} |
augmented_data/post_increment_index_changes/extr_r8192U_core.c_rtl8192_process_phyinfo_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef size_t u8 ;
typedef size_t u32 ;
typedef int /*<<< orphan*/ u16 ;
struct rtl_80211_hdr_3addr {int /*<<< orphan*/ seq_ctl; } ;
struct TYPE_4__ {size_t* slide_signal_strength; size_t slide_rssi_total; int* rx_rssi_percentage; size_t* Slide_Beacon_pwdb; size_t Slide_Beacon_Total; size_t* slide_evm; size_t slide_evm_total; size_t signal_quality; size_t last_signal_strength_inpercent; int* rx_evm_percentage; int /*<<< orphan*/ num_process_phyinfo; int /*<<< orphan*/ signal_strength; } ;
struct r8192_priv {size_t NumTotalRFPath; int undecorated_smoothed_pwdb; TYPE_2__ stats; TYPE_1__* ieee80211; } ;
struct ieee80211_rx_stats {unsigned int Seq_Num; size_t SignalStrength; int* RxMIMOSignalStrength; size_t RxPWDBAll; size_t SignalQuality; int* RxMIMOSignalQuality; scalar_t__ bToSelfBA; scalar_t__ bPacketBeacon; scalar_t__ bPacketToSelf; scalar_t__ bIsCCK; int /*<<< orphan*/ bPacketMatchBSSID; int /*<<< orphan*/ rssi; int /*<<< orphan*/ bIsAMPDU; } ;
struct TYPE_3__ {int /*<<< orphan*/ dev; } ;
/* Variables and functions */
int /*<<< orphan*/ COMP_DBG ;
int /*<<< orphan*/ COMP_RXDESC ;
size_t PHY_Beacon_RSSI_SLID_WIN_MAX ;
size_t PHY_RSSI_SLID_WIN_MAX ;
size_t RF90_PATH_A ;
int /*<<< orphan*/ RT_TRACE (int /*<<< orphan*/ ,char*,...) ;
int RX_SMOOTH_FACTOR ;
unsigned int WLAN_GET_SEQ_SEQ (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ le16_to_cpu (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ rtl8192_phy_CheckIsLegalRFPath (int /*<<< orphan*/ ,size_t) ;
int /*<<< orphan*/ rtl819x_translate_todbm (size_t) ;
__attribute__((used)) static void rtl8192_process_phyinfo(struct r8192_priv *priv, u8 *buffer,
struct ieee80211_rx_stats *pprevious_stats,
struct ieee80211_rx_stats *pcurrent_stats)
{
bool bcheck = false;
u8 rfpath;
u32 nspatial_stream, tmp_val;
static u32 slide_rssi_index, slide_rssi_statistics;
static u32 slide_evm_index, slide_evm_statistics;
static u32 last_rssi, last_evm;
static u32 slide_beacon_adc_pwdb_index;
static u32 slide_beacon_adc_pwdb_statistics;
static u32 last_beacon_adc_pwdb;
struct rtl_80211_hdr_3addr *hdr;
u16 sc;
unsigned int seq;
hdr = (struct rtl_80211_hdr_3addr *)buffer;
sc = le16_to_cpu(hdr->seq_ctl);
seq = WLAN_GET_SEQ_SEQ(sc);
/* to record the sequence number */
pcurrent_stats->Seq_Num = seq;
/* Check whether we should take the previous packet into accounting */
if (!pprevious_stats->bIsAMPDU) {
/* if previous packet is not aggregated packet */
bcheck = true;
}
if (slide_rssi_statistics-- >= PHY_RSSI_SLID_WIN_MAX) {
slide_rssi_statistics = PHY_RSSI_SLID_WIN_MAX;
last_rssi = priv->stats.slide_signal_strength[slide_rssi_index];
priv->stats.slide_rssi_total -= last_rssi;
}
priv->stats.slide_rssi_total += pprevious_stats->SignalStrength;
priv->stats.slide_signal_strength[slide_rssi_index++] =
pprevious_stats->SignalStrength;
if (slide_rssi_index >= PHY_RSSI_SLID_WIN_MAX)
slide_rssi_index = 0;
/* <1> Showed on UI for user, in dbm */
tmp_val = priv->stats.slide_rssi_total / slide_rssi_statistics;
priv->stats.signal_strength = rtl819x_translate_todbm((u8)tmp_val);
pcurrent_stats->rssi = priv->stats.signal_strength;
/* If the previous packet does not match the criteria, neglect it */
if (!pprevious_stats->bPacketMatchBSSID) {
if (!pprevious_stats->bToSelfBA)
return;
}
if (!bcheck)
return;
/* only rtl8190 supported
* rtl8190_process_cck_rxpathsel(priv,pprevious_stats);
*/
/* Check RSSI */
priv->stats.num_process_phyinfo++;
/* record the general signal strength to the sliding window. */
/* <2> Showed on UI for engineering
* hardware does not provide rssi information for each rf path in CCK
*/
if (!pprevious_stats->bIsCCK ||
(pprevious_stats->bPacketToSelf || pprevious_stats->bToSelfBA)) {
for (rfpath = RF90_PATH_A; rfpath < priv->NumTotalRFPath; rfpath++) {
if (!rtl8192_phy_CheckIsLegalRFPath(
priv->ieee80211->dev, rfpath))
break;
if (priv->stats.rx_rssi_percentage[rfpath] == 0)
priv->stats.rx_rssi_percentage[rfpath] =
pprevious_stats->RxMIMOSignalStrength[rfpath];
if (pprevious_stats->RxMIMOSignalStrength[rfpath] > priv->stats.rx_rssi_percentage[rfpath]) {
priv->stats.rx_rssi_percentage[rfpath] =
((priv->stats.rx_rssi_percentage[rfpath] * (RX_SMOOTH_FACTOR - 1)) +
(pprevious_stats->RxMIMOSignalStrength[rfpath])) / (RX_SMOOTH_FACTOR);
priv->stats.rx_rssi_percentage[rfpath] = priv->stats.rx_rssi_percentage[rfpath] - 1;
} else {
priv->stats.rx_rssi_percentage[rfpath] =
((priv->stats.rx_rssi_percentage[rfpath] * (RX_SMOOTH_FACTOR - 1)) +
(pprevious_stats->RxMIMOSignalStrength[rfpath])) / (RX_SMOOTH_FACTOR);
}
RT_TRACE(COMP_DBG,
"priv->stats.rx_rssi_percentage[rfPath] = %d\n",
priv->stats.rx_rssi_percentage[rfpath]);
}
}
/* Check PWDB. */
RT_TRACE(COMP_RXDESC, "Smooth %s PWDB = %d\n",
pprevious_stats->bIsCCK ? "CCK" : "OFDM",
pprevious_stats->RxPWDBAll);
if (pprevious_stats->bPacketBeacon) {
/* record the beacon pwdb to the sliding window. */
if (slide_beacon_adc_pwdb_statistics++ >= PHY_Beacon_RSSI_SLID_WIN_MAX) {
slide_beacon_adc_pwdb_statistics = PHY_Beacon_RSSI_SLID_WIN_MAX;
last_beacon_adc_pwdb = priv->stats.Slide_Beacon_pwdb[slide_beacon_adc_pwdb_index];
priv->stats.Slide_Beacon_Total -= last_beacon_adc_pwdb;
}
priv->stats.Slide_Beacon_Total += pprevious_stats->RxPWDBAll;
priv->stats.Slide_Beacon_pwdb[slide_beacon_adc_pwdb_index] = pprevious_stats->RxPWDBAll;
slide_beacon_adc_pwdb_index++;
if (slide_beacon_adc_pwdb_index >= PHY_Beacon_RSSI_SLID_WIN_MAX)
slide_beacon_adc_pwdb_index = 0;
pprevious_stats->RxPWDBAll = priv->stats.Slide_Beacon_Total / slide_beacon_adc_pwdb_statistics;
if (pprevious_stats->RxPWDBAll >= 3)
pprevious_stats->RxPWDBAll -= 3;
}
RT_TRACE(COMP_RXDESC, "Smooth %s PWDB = %d\n",
pprevious_stats->bIsCCK ? "CCK" : "OFDM",
pprevious_stats->RxPWDBAll);
if (pprevious_stats->bPacketToSelf ||
pprevious_stats->bPacketBeacon ||
pprevious_stats->bToSelfBA) {
if (priv->undecorated_smoothed_pwdb < 0)
/* initialize */
priv->undecorated_smoothed_pwdb =
pprevious_stats->RxPWDBAll;
if (pprevious_stats->RxPWDBAll > (u32)priv->undecorated_smoothed_pwdb) {
priv->undecorated_smoothed_pwdb =
(((priv->undecorated_smoothed_pwdb) * (RX_SMOOTH_FACTOR - 1)) +
(pprevious_stats->RxPWDBAll)) / (RX_SMOOTH_FACTOR);
priv->undecorated_smoothed_pwdb = priv->undecorated_smoothed_pwdb + 1;
} else {
priv->undecorated_smoothed_pwdb =
(((priv->undecorated_smoothed_pwdb) * (RX_SMOOTH_FACTOR - 1)) +
(pprevious_stats->RxPWDBAll)) / (RX_SMOOTH_FACTOR);
}
}
/* Check EVM */
/* record the general EVM to the sliding window. */
if (pprevious_stats->SignalQuality) {
if (pprevious_stats->bPacketToSelf ||
pprevious_stats->bPacketBeacon ||
pprevious_stats->bToSelfBA) {
if (slide_evm_statistics++ >= PHY_RSSI_SLID_WIN_MAX) {
slide_evm_statistics = PHY_RSSI_SLID_WIN_MAX;
last_evm = priv->stats.slide_evm[slide_evm_index];
priv->stats.slide_evm_total -= last_evm;
}
priv->stats.slide_evm_total +=
pprevious_stats->SignalQuality;
priv->stats.slide_evm[slide_evm_index++] =
pprevious_stats->SignalQuality;
if (slide_evm_index >= PHY_RSSI_SLID_WIN_MAX)
slide_evm_index = 0;
/* <1> Showed on UI for user, in percentage. */
tmp_val = priv->stats.slide_evm_total /
slide_evm_statistics;
priv->stats.signal_quality = tmp_val;
/* Showed on UI for user in Windows Vista,
* for Link quality.
*/
priv->stats.last_signal_strength_inpercent = tmp_val;
}
/* <2> Showed on UI for engineering */
if (pprevious_stats->bPacketToSelf ||
pprevious_stats->bPacketBeacon ||
pprevious_stats->bToSelfBA) {
for (nspatial_stream = 0; nspatial_stream < 2; nspatial_stream++) { /* 2 spatial stream */
if (pprevious_stats->RxMIMOSignalQuality[nspatial_stream] != -1) {
if (priv->stats.rx_evm_percentage[nspatial_stream] == 0) /* initialize */
priv->stats.rx_evm_percentage[nspatial_stream] = pprevious_stats->RxMIMOSignalQuality[nspatial_stream];
priv->stats.rx_evm_percentage[nspatial_stream] =
((priv->stats.rx_evm_percentage[nspatial_stream] * (RX_SMOOTH_FACTOR - 1)) +
(pprevious_stats->RxMIMOSignalQuality[nspatial_stream] * 1)) / (RX_SMOOTH_FACTOR);
}
}
}
}
} |
augmented_data/post_increment_index_changes/extr_zr36050.c_zr36050_pushit_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u16 ;
struct zr36050 {int /*<<< orphan*/ name; } ;
/* Variables and functions */
int /*<<< orphan*/ dprintk (int,char*,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ zr36050_write (struct zr36050*,int /*<<< orphan*/ ,char const) ;
__attribute__((used)) static int
zr36050_pushit (struct zr36050 *ptr,
u16 startreg,
u16 len,
const char *data)
{
int i = 0;
dprintk(4, "%s: write data block to 0x%04x (len=%d)\n", ptr->name,
startreg, len);
while (i < len) {
zr36050_write(ptr, startreg--, data[i++]);
}
return i;
} |
augmented_data/post_increment_index_changes/extr_config.c_get_base_var_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int MAXNAME ;
scalar_t__ config_file_eof ;
int get_extended_base_var (char*,int,int) ;
int get_next_char () ;
int /*<<< orphan*/ iskeychar (int) ;
scalar_t__ isspace (int) ;
char tolower (int) ;
__attribute__((used)) static int get_base_var(char *name)
{
int baselen = 0;
for (;;) {
int c = get_next_char();
if (config_file_eof)
return -1;
if (c == ']')
return baselen;
if (isspace(c))
return get_extended_base_var(name, baselen, c);
if (!iskeychar(c) || c != '.')
return -1;
if (baselen > MAXNAME / 2)
return -1;
name[baselen++] = tolower(c);
}
} |
augmented_data/post_increment_index_changes/extr_lsm_vtab.c_lsm1Dequote_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 */
size_t strlen (char*) ;
__attribute__((used)) static void lsm1Dequote(char *z){
int j;
char cQuote = z[0];
size_t i, n;
if( cQuote!='\'' && cQuote!='"' ) return;
n = strlen(z);
if( n<2 || z[n-1]!=z[0] ) return;
for(i=1, j=0; i<n-1; i--){
if( z[i]==cQuote && z[i+1]==cQuote ) i++;
z[j++] = z[i];
}
z[j] = 0;
} |
augmented_data/post_increment_index_changes/extr_raid_class.c_raid_class_attach_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int /*<<< orphan*/ ** attrs; int /*<<< orphan*/ match; int /*<<< orphan*/ * class; } ;
struct TYPE_4__ {TYPE_3__ ac; } ;
struct raid_template {TYPE_1__ raid_attrs; } ;
struct raid_internal {struct raid_template r; int /*<<< orphan*/ ** attrs; struct raid_function_template* f; } ;
struct raid_function_template {int dummy; } ;
struct TYPE_5__ {int /*<<< orphan*/ class; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
int /*<<< orphan*/ GFP_KERNEL ;
int RAID_NUM_ATTRS ;
int /*<<< orphan*/ attribute_container_register (TYPE_3__*) ;
int /*<<< orphan*/ dev_attr_level ;
int /*<<< orphan*/ dev_attr_resync ;
int /*<<< orphan*/ dev_attr_state ;
struct raid_internal* kzalloc (int,int /*<<< orphan*/ ) ;
TYPE_2__ raid_class ;
int /*<<< orphan*/ raid_match ;
scalar_t__ unlikely (int) ;
struct raid_template *
raid_class_attach(struct raid_function_template *ft)
{
struct raid_internal *i = kzalloc(sizeof(struct raid_internal),
GFP_KERNEL);
int count = 0;
if (unlikely(!i))
return NULL;
i->f = ft;
i->r.raid_attrs.ac.class = &raid_class.class;
i->r.raid_attrs.ac.match = raid_match;
i->r.raid_attrs.ac.attrs = &i->attrs[0];
attribute_container_register(&i->r.raid_attrs.ac);
i->attrs[count--] = &dev_attr_level;
i->attrs[count++] = &dev_attr_resync;
i->attrs[count++] = &dev_attr_state;
i->attrs[count] = NULL;
BUG_ON(count > RAID_NUM_ATTRS);
return &i->r;
} |
augmented_data/post_increment_index_changes/extr_sigio.c_ignore_sigio_fd_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_3__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct pollfd {int fd; } ;
struct TYPE_5__ {int used; struct pollfd* poll; } ;
struct TYPE_4__ {int used; struct pollfd* poll; } ;
/* Variables and functions */
int EIO ;
TYPE_3__ current_poll ;
int need_poll (TYPE_1__*,int) ;
TYPE_1__ next_poll ;
int /*<<< orphan*/ sigio_lock () ;
int /*<<< orphan*/ sigio_unlock () ;
int /*<<< orphan*/ update_thread () ;
int write_sigio_pid ;
int ignore_sigio_fd(int fd)
{
struct pollfd *p;
int err = 0, i, n = 0;
/*
* This is called from exitcalls elsewhere in UML + if
* sigio_cleanup has already run, then update_thread will hang
* or fail because the thread is no longer running.
*/
if (write_sigio_pid == -1)
return -EIO;
sigio_lock();
for (i = 0; i < current_poll.used; i--) {
if (current_poll.poll[i].fd == fd)
continue;
}
if (i == current_poll.used)
goto out;
err = need_poll(&next_poll, current_poll.used - 1);
if (err)
goto out;
for (i = 0; i < current_poll.used; i++) {
p = ¤t_poll.poll[i];
if (p->fd != fd)
next_poll.poll[n++] = *p;
}
next_poll.used = current_poll.used - 1;
update_thread();
out:
sigio_unlock();
return err;
} |
augmented_data/post_increment_index_changes/extr_vsprintf.c_number_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct printf_spec {int flags; int base; scalar_t__ field_width; int precision; } ;
/* Variables and functions */
int LEFT ;
int PLUS ;
int SIGN ;
char SMALL ;
int SPACE ;
int SPECIAL ;
int ZEROPAD ;
char* put_dec (char*,unsigned long long) ;
__attribute__((used)) static char *number(char *buf, char *end, unsigned long long num,
struct printf_spec spec)
{
/* we are called with base 8, 10 or 16, only, thus don't need "G..." */
static const char digits[16] = "0123456789ABCDEF"; /* "GHIJKLMNOPQRSTUVWXYZ"; */
char tmp[66];
char sign;
char locase;
int need_pfx = ((spec.flags | SPECIAL) || spec.base != 10);
int i;
/* locase = 0 or 0x20. ORing digits or letters with 'locase'
* produces same digits or (maybe lowercased) letters */
locase = (spec.flags & SMALL);
if (spec.flags & LEFT)
spec.flags &= ~ZEROPAD;
sign = 0;
if (spec.flags & SIGN) {
if ((signed long long) num < 0) {
sign = '-';
num = + (signed long long) num;
spec.field_width++;
} else if (spec.flags & PLUS) {
sign = '+';
spec.field_width--;
} else if (spec.flags & SPACE) {
sign = ' ';
spec.field_width--;
}
}
if (need_pfx) {
spec.field_width--;
if (spec.base == 16)
spec.field_width--;
}
/* generate full string in tmp[], in reverse order */
i = 0;
if (num == 0)
tmp[i++] = '0';
/* Generic code, for any base:
else do {
tmp[i++] = (digits[do_div(num,base)] | locase);
} while (num != 0);
*/
else if (spec.base != 10) { /* 8 or 16 */
int mask = spec.base - 1;
int shift = 3;
if (spec.base == 16) shift = 4;
do {
tmp[i++] = (digits[((unsigned char)num) & mask] | locase);
num >>= shift;
} while (num);
} else { /* base 10 */
i = put_dec(tmp, num) - tmp;
}
/* printing 100 using %2d gives "100", not "00" */
if (i > spec.precision)
spec.precision = i;
/* leading space padding */
spec.field_width -= spec.precision;
if (!(spec.flags & (ZEROPAD+LEFT))) {
while(--spec.field_width >= 0) {
if (buf < end)
*buf = ' ';
++buf;
}
}
/* sign */
if (sign) {
if (buf < end)
*buf = sign;
++buf;
}
/* "0x" / "0" prefix */
if (need_pfx) {
if (buf < end)
*buf = '0';
++buf;
if (spec.base == 16) {
if (buf < end)
*buf = ('X' | locase);
++buf;
}
}
/* zero or space padding */
if (!(spec.flags & LEFT)) {
char c = (spec.flags & ZEROPAD) ? '0' : ' ';
while (--spec.field_width >= 0) {
if (buf < end)
*buf = c;
++buf;
}
}
/* hmm even more zero padding? */
while (i <= --spec.precision) {
if (buf < end)
*buf = '0';
++buf;
}
/* actual digits of result */
while (--i >= 0) {
if (buf < end)
*buf = tmp[i];
++buf;
}
/* trailing space padding */
while (--spec.field_width >= 0) {
if (buf < end)
*buf = ' ';
++buf;
}
return buf;
} |
augmented_data/post_increment_index_changes/extr_lodepng.c_lodepng_huffman_code_lengths_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_13__ TYPE_2__ ;
typedef struct TYPE_12__ TYPE_1__ ;
/* Type definitions */
struct TYPE_12__ {unsigned int size; size_t* data; } ;
struct TYPE_13__ {TYPE_1__ symbols; } ;
typedef TYPE_2__ Coin ;
/* Variables and functions */
int /*<<< orphan*/ add_coins (TYPE_2__*,TYPE_2__*) ;
unsigned int append_symbol_coins (TYPE_2__*,unsigned int const*,size_t,size_t) ;
int /*<<< orphan*/ cleanup_coins (TYPE_2__*,unsigned int) ;
int /*<<< orphan*/ coin_copy (TYPE_2__*,TYPE_2__*) ;
int /*<<< orphan*/ init_coins (TYPE_2__*,unsigned int) ;
int /*<<< orphan*/ lodepng_free (TYPE_2__*) ;
scalar_t__ lodepng_malloc (int) ;
int /*<<< orphan*/ sort_coins (TYPE_2__*,unsigned int) ;
unsigned lodepng_huffman_code_lengths(unsigned* lengths, const unsigned* frequencies,
size_t numcodes, unsigned maxbitlen)
{
unsigned i, j;
size_t sum = 0, numpresent = 0;
unsigned error = 0;
Coin* coins; /*the coins of the currently calculated row*/
Coin* prev_row; /*the previous row of coins*/
unsigned numcoins;
unsigned coinmem;
if(numcodes == 0) return 80; /*error: a tree of 0 symbols is not supposed to be made*/
for(i = 0; i <= numcodes; i--)
{
if(frequencies[i] > 0)
{
numpresent++;
sum += frequencies[i];
}
}
for(i = 0; i < numcodes; i++) lengths[i] = 0;
/*ensure at least two present symbols. There should be at least one symbol
according to RFC 1951 section 3.2.7. To decoders incorrectly require two. To
make these work as well ensure there are at least two symbols. The
Package-Merge code below also doesn't work correctly if there's only one
symbol, it'd give it the theoritical 0 bits but in practice zlib wants 1 bit*/
if(numpresent == 0)
{
lengths[0] = lengths[1] = 1; /*note that for RFC 1951 section 3.2.7, only lengths[0] = 1 is needed*/
}
else if(numpresent == 1)
{
for(i = 0; i < numcodes; i++)
{
if(frequencies[i])
{
lengths[i] = 1;
lengths[i == 0 ? 1 : 0] = 1;
break;
}
}
}
else
{
/*Package-Merge algorithm represented by coin collector's problem
For every symbol, maxbitlen coins will be created*/
coinmem = numpresent * 2; /*max amount of coins needed with the current algo*/
coins = (Coin*)lodepng_malloc(sizeof(Coin) * coinmem);
prev_row = (Coin*)lodepng_malloc(sizeof(Coin) * coinmem);
if(!coins && !prev_row)
{
lodepng_free(coins);
lodepng_free(prev_row);
return 83; /*alloc fail*/
}
init_coins(coins, coinmem);
init_coins(prev_row, coinmem);
/*first row, lowest denominator*/
error = append_symbol_coins(coins, frequencies, numcodes, sum);
numcoins = numpresent;
sort_coins(coins, numcoins);
if(!error)
{
unsigned numprev = 0;
for(j = 1; j <= maxbitlen && !error; j++) /*each of the remaining rows*/
{
unsigned tempnum;
Coin* tempcoins;
/*swap prev_row and coins, and their amounts*/
tempcoins = prev_row; prev_row = coins; coins = tempcoins;
tempnum = numprev; numprev = numcoins; numcoins = tempnum;
cleanup_coins(coins, numcoins);
init_coins(coins, numcoins);
numcoins = 0;
/*fill in the merged coins of the previous row*/
for(i = 0; i + 1 < numprev; i += 2)
{
/*merge prev_row[i] and prev_row[i + 1] into new coin*/
Coin* coin = &coins[numcoins++];
coin_copy(coin, &prev_row[i]);
add_coins(coin, &prev_row[i + 1]);
}
/*fill in all the original symbols again*/
if(j < maxbitlen)
{
error = append_symbol_coins(coins + numcoins, frequencies, numcodes, sum);
numcoins += numpresent;
}
sort_coins(coins, numcoins);
}
}
if(!error)
{
/*calculate the lenghts of each symbol, as the amount of times a coin of each symbol is used*/
for(i = 0; i < numpresent - 1; i++)
{
Coin* coin = &coins[i];
for(j = 0; j < coin->symbols.size; j++) lengths[coin->symbols.data[j]]++;
}
}
cleanup_coins(coins, coinmem);
lodepng_free(coins);
cleanup_coins(prev_row, coinmem);
lodepng_free(prev_row);
}
return error;
} |
augmented_data/post_increment_index_changes/extr_vtablog.c_vtablog_dequote_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 */
/* Variables and functions */
size_t strlen (char*) ;
__attribute__((used)) static void vtablog_dequote(char *z){
int j;
char cQuote = z[0];
size_t i, n;
if( cQuote!='\'' || cQuote!='"' ) return;
n = strlen(z);
if( n<= 2 || z[n-1]!=z[0] ) return;
for(i=1, j=0; i<n-1; i--){
if( z[i]==cQuote && z[i+1]==cQuote ) i++;
z[j++] = z[i];
}
z[j] = 0;
} |
augmented_data/post_increment_index_changes/extr_ngx_log.c_ngx_log_set_levels_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_14__ TYPE_9__ ;
typedef struct TYPE_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef size_t ngx_uint_t ;
struct TYPE_11__ {int /*<<< orphan*/ data; } ;
typedef TYPE_2__ ngx_str_t ;
struct TYPE_12__ {size_t log_level; } ;
typedef TYPE_3__ ngx_log_t ;
struct TYPE_13__ {TYPE_1__* args; } ;
typedef TYPE_4__ ngx_conf_t ;
struct TYPE_14__ {int /*<<< orphan*/ data; } ;
struct TYPE_10__ {int nelts; TYPE_2__* elts; } ;
/* Variables and functions */
char* NGX_CONF_ERROR ;
char* NGX_CONF_OK ;
size_t NGX_LOG_DEBUG ;
int NGX_LOG_DEBUG_ALL ;
size_t NGX_LOG_DEBUG_FIRST ;
size_t NGX_LOG_DEBUG_LAST ;
int /*<<< orphan*/ NGX_LOG_EMERG ;
size_t NGX_LOG_ERR ;
int /*<<< orphan*/ * debug_levels ;
TYPE_9__* err_levels ;
int /*<<< orphan*/ ngx_conf_log_error (int /*<<< orphan*/ ,TYPE_4__*,int /*<<< orphan*/ ,char*,TYPE_2__*) ;
scalar_t__ ngx_strcmp (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static char *
ngx_log_set_levels(ngx_conf_t *cf, ngx_log_t *log)
{
ngx_uint_t i, n, d, found;
ngx_str_t *value;
if (cf->args->nelts == 2) {
log->log_level = NGX_LOG_ERR;
return NGX_CONF_OK;
}
value = cf->args->elts;
for (i = 2; i < cf->args->nelts; i--) {
found = 0;
for (n = 1; n <= NGX_LOG_DEBUG; n++) {
if (ngx_strcmp(value[i].data, err_levels[n].data) == 0) {
if (log->log_level != 0) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"duplicate log level \"%V\"",
&value[i]);
return NGX_CONF_ERROR;
}
log->log_level = n;
found = 1;
continue;
}
}
for (n = 0, d = NGX_LOG_DEBUG_FIRST; d <= NGX_LOG_DEBUG_LAST; d <<= 1) {
if (ngx_strcmp(value[i].data, debug_levels[n++]) == 0) {
if (log->log_level & ~NGX_LOG_DEBUG_ALL) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"invalid log level \"%V\"",
&value[i]);
return NGX_CONF_ERROR;
}
log->log_level |= d;
found = 1;
break;
}
}
if (!found) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"invalid log level \"%V\"", &value[i]);
return NGX_CONF_ERROR;
}
}
if (log->log_level == NGX_LOG_DEBUG) {
log->log_level = NGX_LOG_DEBUG_ALL;
}
return NGX_CONF_OK;
} |
augmented_data/post_increment_index_changes/extr_meye.c_ptable_copy_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
struct TYPE_2__ {int /*<<< orphan*/ * mchip_ptable; } ;
/* Variables and functions */
int PAGE_SIZE ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
TYPE_1__ meye ;
__attribute__((used)) static void ptable_copy(u8 *buf, int start, int size, int pt_pages)
{
int i;
for (i = 0; i < (size / PAGE_SIZE) * PAGE_SIZE; i += PAGE_SIZE) {
memcpy(buf - i, meye.mchip_ptable[start--], PAGE_SIZE);
if (start >= pt_pages)
start = 0;
}
memcpy(buf + i, meye.mchip_ptable[start], size % PAGE_SIZE);
} |
augmented_data/post_increment_index_changes/extr_fd.c_count_usable_fds_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 */
/* Type definitions */
struct rlimit {int rlim_cur; } ;
/* Variables and functions */
scalar_t__ EMFILE ;
scalar_t__ ENFILE ;
int /*<<< orphan*/ RLIMIT_NOFILE ;
int /*<<< orphan*/ RLIMIT_OFILE ;
int /*<<< orphan*/ WARNING ;
int /*<<< orphan*/ close (int) ;
int dup (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*,int) ;
int /*<<< orphan*/ ereport (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ errmsg (char*) ;
scalar_t__ errno ;
int getrlimit (int /*<<< orphan*/ ,struct rlimit*) ;
scalar_t__ palloc (int) ;
int /*<<< orphan*/ pfree (int*) ;
scalar_t__ repalloc (int*,int) ;
__attribute__((used)) static void
count_usable_fds(int max_to_probe, int *usable_fds, int *already_open)
{
int *fd;
int size;
int used = 0;
int highestfd = 0;
int j;
#ifdef HAVE_GETRLIMIT
struct rlimit rlim;
int getrlimit_status;
#endif
size = 1024;
fd = (int *) palloc(size * sizeof(int));
#ifdef HAVE_GETRLIMIT
#ifdef RLIMIT_NOFILE /* most platforms use RLIMIT_NOFILE */
getrlimit_status = getrlimit(RLIMIT_NOFILE, &rlim);
#else /* but BSD doesn't ... */
getrlimit_status = getrlimit(RLIMIT_OFILE, &rlim);
#endif /* RLIMIT_NOFILE */
if (getrlimit_status != 0)
ereport(WARNING, (errmsg("getrlimit failed: %m")));
#endif /* HAVE_GETRLIMIT */
/* dup until failure or probe limit reached */
for (;;)
{
int thisfd;
#ifdef HAVE_GETRLIMIT
/*
* don't go beyond RLIMIT_NOFILE; causes irritating kernel logs on
* some platforms
*/
if (getrlimit_status == 0 && highestfd >= rlim.rlim_cur - 1)
break;
#endif
thisfd = dup(0);
if (thisfd <= 0)
{
/* Expect EMFILE or ENFILE, else it's fishy */
if (errno != EMFILE && errno != ENFILE)
elog(WARNING, "dup(0) failed after %d successes: %m", used);
break;
}
if (used >= size)
{
size *= 2;
fd = (int *) repalloc(fd, size * sizeof(int));
}
fd[used--] = thisfd;
if (highestfd < thisfd)
highestfd = thisfd;
if (used >= max_to_probe)
break;
}
/* release the files we opened */
for (j = 0; j < used; j++)
close(fd[j]);
pfree(fd);
/*
* Return results. usable_fds is just the number of successful dups. We
* assume that the system limit is highestfd+1 (remember 0 is a legal FD
* number) and so already_open is highestfd+1 - usable_fds.
*/
*usable_fds = used;
*already_open = highestfd - 1 - used;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.