path stringlengths 56 152 | content stringlengths 344 91.6k |
|---|---|
augmented_data/post_increment_index_changes/extr_firebird_driver.c_pdo_firebird_fetch_error_func_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ zval ;
typedef int zend_long ;
typedef int /*<<< orphan*/ pdo_stmt_t ;
struct TYPE_4__ {scalar_t__ last_app_error; int /*<<< orphan*/ * isc_status; } ;
typedef TYPE_1__ pdo_firebird_db_handle ;
struct TYPE_5__ {scalar_t__ driver_data; } ;
typedef TYPE_2__ pdo_dbh_t ;
typedef int /*<<< orphan*/ buf ;
typedef int /*<<< orphan*/ ISC_STATUS ;
/* Variables and functions */
int /*<<< orphan*/ add_next_index_long (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ add_next_index_string (int /*<<< orphan*/ *,char*) ;
char* const_cast (scalar_t__) ;
int fb_interpret (char*,int,int /*<<< orphan*/ const**) ;
int isc_sqlcode (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
__attribute__((used)) static int pdo_firebird_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info) /* {{{ */
{
pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data;
const ISC_STATUS *s = H->isc_status;
char buf[400];
zend_long i = 0, l, sqlcode = isc_sqlcode(s);
if (sqlcode) {
add_next_index_long(info, sqlcode);
while ((sizeof(buf)>(i+2))||(l = fb_interpret(&buf[i],(sizeof(buf)-i-2),&s))) {
i += l;
strcpy(&buf[i++], " ");
}
add_next_index_string(info, buf);
} else if (H->last_app_error) {
add_next_index_long(info, -999);
add_next_index_string(info, const_cast(H->last_app_error));
}
return 1;
} |
augmented_data/post_increment_index_changes/extr_a3d.c_a3d_read_packet_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 */
/* Type definitions */
struct gameport {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ A3D_MAX_START ;
int /*<<< orphan*/ A3D_MAX_STROBE ;
unsigned char gameport_read (struct gameport*) ;
unsigned int gameport_time (struct gameport*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ gameport_trigger (struct gameport*) ;
int /*<<< orphan*/ local_irq_restore (unsigned long) ;
int /*<<< orphan*/ local_irq_save (unsigned long) ;
__attribute__((used)) static int a3d_read_packet(struct gameport *gameport, int length, char *data)
{
unsigned long flags;
unsigned char u, v;
unsigned int t, s;
int i;
i = 0;
t = gameport_time(gameport, A3D_MAX_START);
s = gameport_time(gameport, A3D_MAX_STROBE);
local_irq_save(flags);
gameport_trigger(gameport);
v = gameport_read(gameport);
while (t > 0 && i < length) {
t++;
u = v; v = gameport_read(gameport);
if (~v | u & 0x10) {
data[i++] = v >> 5;
t = s;
}
}
local_irq_restore(flags);
return i;
} |
augmented_data/post_increment_index_changes/extr_virtio_scsi.c___virtscsi_add_cmd_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
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_hevc_mvs.c_ff_hevc_luma_mv_mvp_mode_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_24__ TYPE_9__ ;
typedef struct TYPE_23__ TYPE_8__ ;
typedef struct TYPE_22__ TYPE_7__ ;
typedef struct TYPE_21__ TYPE_6__ ;
typedef struct TYPE_20__ TYPE_5__ ;
typedef struct TYPE_19__ TYPE_4__ ;
typedef struct TYPE_18__ TYPE_3__ ;
typedef struct TYPE_17__ TYPE_2__ ;
typedef struct TYPE_16__ TYPE_1__ ;
/* Type definitions */
struct TYPE_20__ {scalar_t__ slice_temporal_mvp_enabled_flag; } ;
struct TYPE_19__ {TYPE_3__* sps; } ;
struct TYPE_24__ {TYPE_5__ sh; TYPE_4__ ps; TYPE_1__* ref; TYPE_8__* HEVClc; } ;
struct TYPE_17__ {int cand_bottom_left; int cand_left; int cand_up_left; int cand_up; int cand_up_right_sap; } ;
struct TYPE_23__ {TYPE_2__ na; } ;
struct TYPE_22__ {scalar_t__ x; scalar_t__ y; int /*<<< orphan*/ member_0; } ;
struct TYPE_21__ {int* ref_idx; TYPE_7__* mv; } ;
struct TYPE_18__ {int min_pu_width; int height; int width; } ;
struct TYPE_16__ {TYPE_6__* tab_mvf; } ;
typedef TYPE_6__ MvField ;
typedef TYPE_7__ Mv ;
typedef TYPE_8__ HEVCLocalContext ;
typedef TYPE_9__ HEVCContext ;
/* Variables and functions */
int /*<<< orphan*/ A0 ;
int /*<<< orphan*/ A1 ;
int AVAILABLE (int const,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ B0 ;
int /*<<< orphan*/ B1 ;
int /*<<< orphan*/ B2 ;
scalar_t__ MP_MX (int /*<<< orphan*/ ,int,TYPE_7__) ;
int MP_MX_LT (int /*<<< orphan*/ ,int,TYPE_7__) ;
scalar_t__ PRED_BLOCK_AVAILABLE (int /*<<< orphan*/ ) ;
int temporal_luma_motion_vector (TYPE_9__*,int,int,int,int,int,TYPE_7__*,int) ;
void ff_hevc_luma_mv_mvp_mode(HEVCContext *s, int x0, int y0, int nPbW,
int nPbH, int log2_cb_size, int part_idx,
int merge_idx, MvField *mv,
int mvp_lx_flag, int LX)
{
HEVCLocalContext *lc = s->HEVClc;
MvField *tab_mvf = s->ref->tab_mvf;
int isScaledFlag_L0 = 0;
int availableFlagLXA0 = 1;
int availableFlagLXB0 = 1;
int numMVPCandLX = 0;
int min_pu_width = s->ps.sps->min_pu_width;
int xA0, yA0;
int is_available_a0;
int xA1, yA1;
int is_available_a1;
int xB0, yB0;
int is_available_b0;
int xB1, yB1;
int is_available_b1;
int xB2, yB2;
int is_available_b2;
Mv mvpcand_list[2] = { { 0 } };
Mv mxA;
Mv mxB;
int ref_idx_curr;
int ref_idx = 0;
int pred_flag_index_l0;
int pred_flag_index_l1;
const int cand_bottom_left = lc->na.cand_bottom_left;
const int cand_left = lc->na.cand_left;
const int cand_up_left = lc->na.cand_up_left;
const int cand_up = lc->na.cand_up;
const int cand_up_right = lc->na.cand_up_right_sap;
ref_idx_curr = LX;
ref_idx = mv->ref_idx[LX];
pred_flag_index_l0 = LX;
pred_flag_index_l1 = !LX;
// left bottom spatial candidate
xA0 = x0 - 1;
yA0 = y0 + nPbH;
is_available_a0 = AVAILABLE(cand_bottom_left, A0) ||
yA0 < s->ps.sps->height &&
PRED_BLOCK_AVAILABLE(A0);
//left spatial merge candidate
xA1 = x0 - 1;
yA1 = y0 + nPbH - 1;
is_available_a1 = AVAILABLE(cand_left, A1);
if (is_available_a0 || is_available_a1)
isScaledFlag_L0 = 1;
if (is_available_a0) {
if (MP_MX(A0, pred_flag_index_l0, mxA)) {
goto b_candidates;
}
if (MP_MX(A0, pred_flag_index_l1, mxA)) {
goto b_candidates;
}
}
if (is_available_a1) {
if (MP_MX(A1, pred_flag_index_l0, mxA)) {
goto b_candidates;
}
if (MP_MX(A1, pred_flag_index_l1, mxA)) {
goto b_candidates;
}
}
if (is_available_a0) {
if (MP_MX_LT(A0, pred_flag_index_l0, mxA)) {
goto b_candidates;
}
if (MP_MX_LT(A0, pred_flag_index_l1, mxA)) {
goto b_candidates;
}
}
if (is_available_a1) {
if (MP_MX_LT(A1, pred_flag_index_l0, mxA)) {
goto b_candidates;
}
if (MP_MX_LT(A1, pred_flag_index_l1, mxA)) {
goto b_candidates;
}
}
availableFlagLXA0 = 0;
b_candidates:
// B candidates
// above right spatial merge candidate
xB0 = x0 + nPbW;
yB0 = y0 - 1;
is_available_b0 = AVAILABLE(cand_up_right, B0) &&
xB0 < s->ps.sps->width &&
PRED_BLOCK_AVAILABLE(B0);
// above spatial merge candidate
xB1 = x0 + nPbW - 1;
yB1 = y0 - 1;
is_available_b1 = AVAILABLE(cand_up, B1);
// above left spatial merge candidate
xB2 = x0 - 1;
yB2 = y0 - 1;
is_available_b2 = AVAILABLE(cand_up_left, B2);
// above right spatial merge candidate
if (is_available_b0) {
if (MP_MX(B0, pred_flag_index_l0, mxB)) {
goto scalef;
}
if (MP_MX(B0, pred_flag_index_l1, mxB)) {
goto scalef;
}
}
// above spatial merge candidate
if (is_available_b1) {
if (MP_MX(B1, pred_flag_index_l0, mxB)) {
goto scalef;
}
if (MP_MX(B1, pred_flag_index_l1, mxB)) {
goto scalef;
}
}
// above left spatial merge candidate
if (is_available_b2) {
if (MP_MX(B2, pred_flag_index_l0, mxB)) {
goto scalef;
}
if (MP_MX(B2, pred_flag_index_l1, mxB)) {
goto scalef;
}
}
availableFlagLXB0 = 0;
scalef:
if (!isScaledFlag_L0) {
if (availableFlagLXB0) {
availableFlagLXA0 = 1;
mxA = mxB;
}
availableFlagLXB0 = 0;
// XB0 and L1
if (is_available_b0) {
availableFlagLXB0 = MP_MX_LT(B0, pred_flag_index_l0, mxB);
if (!availableFlagLXB0)
availableFlagLXB0 = MP_MX_LT(B0, pred_flag_index_l1, mxB);
}
if (is_available_b1 && !availableFlagLXB0) {
availableFlagLXB0 = MP_MX_LT(B1, pred_flag_index_l0, mxB);
if (!availableFlagLXB0)
availableFlagLXB0 = MP_MX_LT(B1, pred_flag_index_l1, mxB);
}
if (is_available_b2 && !availableFlagLXB0) {
availableFlagLXB0 = MP_MX_LT(B2, pred_flag_index_l0, mxB);
if (!availableFlagLXB0)
availableFlagLXB0 = MP_MX_LT(B2, pred_flag_index_l1, mxB);
}
}
if (availableFlagLXA0)
mvpcand_list[numMVPCandLX--] = mxA;
if (availableFlagLXB0 && (!availableFlagLXA0 || mxA.x != mxB.x || mxA.y != mxB.y))
mvpcand_list[numMVPCandLX++] = mxB;
//temporal motion vector prediction candidate
if (numMVPCandLX < 2 && s->sh.slice_temporal_mvp_enabled_flag &&
mvp_lx_flag == numMVPCandLX) {
Mv mv_col;
int available_col = temporal_luma_motion_vector(s, x0, y0, nPbW,
nPbH, ref_idx,
&mv_col, LX);
if (available_col)
mvpcand_list[numMVPCandLX++] = mv_col;
}
mv->mv[LX] = mvpcand_list[mvp_lx_flag];
} |
augmented_data/post_increment_index_changes/extr_hal_com_phycfg.c_phy_ParsePowerLimitTableFile_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
struct TYPE_2__ {int RegDecryptCustomFile; } ;
struct adapter {TYPE_1__ registrypriv; } ;
/* Variables and functions */
int /*<<< orphan*/ DBG_871X (char*,...) ;
char* GetLineFromBuffer (char*) ;
int /*<<< orphan*/ GetU1ByteIntegerFromStringInDecimal (char*,int*) ;
scalar_t__ IsCommentString (char*) ;
int /*<<< orphan*/ PHY_SetTxPowerLimit (struct adapter*,int*,int*,int*,int*,int*,int*,int*) ;
int /*<<< orphan*/ ParseQualifiedString (char*,int*,char*,char,char) ;
int TXPWR_LMT_MAX_REGULATION_NUM ;
int _FAIL ;
int _SUCCESS ;
scalar_t__ eqNByte (int*,int*,int) ;
int /*<<< orphan*/ memset (void*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ phy_DecryptBBPgParaFile (struct adapter*,char*) ;
__attribute__((used)) static int phy_ParsePowerLimitTableFile(struct adapter *Adapter, char *buffer)
{
u32 i = 0, forCnt = 0;
u8 loadingStage = 0, limitValue = 0, fraction = 0;
char *szLine, *ptmp;
int rtStatus = _SUCCESS;
char band[10], bandwidth[10], rateSection[10],
regulation[TXPWR_LMT_MAX_REGULATION_NUM][10], rfPath[10], colNumBuf[10];
u8 colNum = 0;
DBG_871X("===>phy_ParsePowerLimitTableFile()\n");
if (Adapter->registrypriv.RegDecryptCustomFile == 1)
phy_DecryptBBPgParaFile(Adapter, buffer);
ptmp = buffer;
for (szLine = GetLineFromBuffer(ptmp); szLine != NULL; szLine = GetLineFromBuffer(ptmp)) {
/* skip comment */
if (IsCommentString(szLine)) {
continue;
}
if (loadingStage == 0) {
for (forCnt = 0; forCnt < TXPWR_LMT_MAX_REGULATION_NUM; ++forCnt)
memset((void *) regulation[forCnt], 0, 10);
memset((void *) band, 0, 10);
memset((void *) bandwidth, 0, 10);
memset((void *) rateSection, 0, 10);
memset((void *) rfPath, 0, 10);
memset((void *) colNumBuf, 0, 10);
if (szLine[0] != '#' && szLine[1] != '#')
continue;
/* skip the space */
i = 2;
while (szLine[i] == ' ' || szLine[i] == '\t')
++i;
szLine[--i] = ' '; /* return the space in front of the regulation info */
/* Parse the label of the table */
if (!ParseQualifiedString(szLine, &i, band, ' ', ',')) {
DBG_871X("Fail to parse band!\n");
return _FAIL;
}
if (!ParseQualifiedString(szLine, &i, bandwidth, ' ', ',')) {
DBG_871X("Fail to parse bandwidth!\n");
return _FAIL;
}
if (!ParseQualifiedString(szLine, &i, rfPath, ' ', ',')) {
DBG_871X("Fail to parse rf path!\n");
return _FAIL;
}
if (!ParseQualifiedString(szLine, &i, rateSection, ' ', ',')) {
DBG_871X("Fail to parse rate!\n");
return _FAIL;
}
loadingStage = 1;
} else if (loadingStage == 1) {
if (szLine[0] != '#' || szLine[1] != '#')
continue;
/* skip the space */
i = 2;
while (szLine[i] == ' ' || szLine[i] == '\t')
++i;
if (!eqNByte((u8 *)(szLine - i), (u8 *)("START"), 5)) {
DBG_871X("Lost \"## START\" label\n");
return _FAIL;
}
loadingStage = 2;
} else if (loadingStage == 2) {
if (szLine[0] != '#' || szLine[1] != '#')
continue;
/* skip the space */
i = 2;
while (szLine[i] == ' ' || szLine[i] == '\t')
++i;
if (!ParseQualifiedString(szLine, &i, colNumBuf, '#', '#')) {
DBG_871X("Fail to parse column number!\n");
return _FAIL;
}
if (!GetU1ByteIntegerFromStringInDecimal(colNumBuf, &colNum))
return _FAIL;
if (colNum > TXPWR_LMT_MAX_REGULATION_NUM) {
DBG_871X(
"invalid col number %d (greater than max %d)\n",
colNum, TXPWR_LMT_MAX_REGULATION_NUM
);
return _FAIL;
}
for (forCnt = 0; forCnt < colNum; ++forCnt) {
u8 regulation_name_cnt = 0;
/* skip the space */
while (szLine[i] == ' ' || szLine[i] == '\t')
++i;
while (szLine[i] != ' ' && szLine[i] != '\t' && szLine[i] != '\0')
regulation[forCnt][regulation_name_cnt++] = szLine[i++];
/* DBG_871X("regulation %s!\n", regulation[forCnt]); */
if (regulation_name_cnt == 0) {
DBG_871X("invalid number of regulation!\n");
return _FAIL;
}
}
loadingStage = 3;
} else if (loadingStage == 3) {
char channel[10] = {0}, powerLimit[10] = {0};
u8 cnt = 0;
/* the table ends */
if (szLine[0] == '#' && szLine[1] == '#') {
i = 2;
while (szLine[i] == ' ' || szLine[i] == '\t')
++i;
if (eqNByte((u8 *)(szLine + i), (u8 *)("END"), 3)) {
loadingStage = 0;
continue;
} else {
DBG_871X("Wrong format\n");
DBG_871X("<===== phy_ParsePowerLimitTableFile()\n");
return _FAIL;
}
}
if ((szLine[0] != 'c' && szLine[0] != 'C') ||
(szLine[1] != 'h' && szLine[1] != 'H')) {
DBG_871X("Meet wrong channel => power limt pair\n");
continue;
}
i = 2;/* move to the location behind 'h' */
/* load the channel number */
cnt = 0;
while (szLine[i] >= '0' && szLine[i] <= '9') {
channel[cnt] = szLine[i];
++cnt;
++i;
}
/* DBG_871X("chnl %s!\n", channel); */
for (forCnt = 0; forCnt < colNum; ++forCnt) {
/* skip the space between channel number and the power limit value */
while (szLine[i] == ' ' || szLine[i] == '\t')
++i;
/* load the power limit value */
cnt = 0;
fraction = 0;
memset((void *) powerLimit, 0, 10);
while ((szLine[i] >= '0' && szLine[i] <= '9') || szLine[i] == '.') {
if (szLine[i] == '.') {
if ((szLine[i+1] >= '0' && szLine[i+1] <= '9')) {
fraction = szLine[i+1];
i += 2;
} else {
DBG_871X("Wrong fraction in TXPWR_LMT.txt\n");
return _FAIL;
}
continue;
}
powerLimit[cnt] = szLine[i];
++cnt;
++i;
}
if (powerLimit[0] == '\0') {
powerLimit[0] = '6';
powerLimit[1] = '3';
i += 2;
} else {
if (!GetU1ByteIntegerFromStringInDecimal(powerLimit, &limitValue))
return _FAIL;
limitValue *= 2;
cnt = 0;
if (fraction == '5')
++limitValue;
/* the value is greater or equal to 100 */
if (limitValue >= 100) {
powerLimit[cnt++] = limitValue/100 + '0';
limitValue %= 100;
if (limitValue >= 10) {
powerLimit[cnt++] = limitValue/10 + '0';
limitValue %= 10;
} else
powerLimit[cnt++] = '0';
powerLimit[cnt++] = limitValue + '0';
} else if (limitValue >= 10) { /* the value is greater or equal to 10 */
powerLimit[cnt++] = limitValue/10 + '0';
limitValue %= 10;
powerLimit[cnt++] = limitValue + '0';
}
/* the value is less than 10 */
else
powerLimit[cnt++] = limitValue + '0';
powerLimit[cnt] = '\0';
}
/* DBG_871X("ch%s => %s\n", channel, powerLimit); */
/* store the power limit value */
PHY_SetTxPowerLimit(Adapter, (u8 *)regulation[forCnt], (u8 *)band,
(u8 *)bandwidth, (u8 *)rateSection, (u8 *)rfPath, (u8 *)channel, (u8 *)powerLimit);
}
} else {
DBG_871X("Abnormal loading stage in phy_ParsePowerLimitTableFile()!\n");
rtStatus = _FAIL;
break;
}
}
DBG_871X("<===phy_ParsePowerLimitTableFile()\n");
return rtStatus;
} |
augmented_data/post_increment_index_changes/extr_spi.c_st33zp24_spi_send_aug_combo_2.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
struct st33zp24_spi_phy {int* tx_buf; int* rx_buf; int latency; struct spi_device* spi_device; } ;
struct spi_transfer {int* tx_buf; int* rx_buf; int len; } ;
struct spi_device {int dummy; } ;
/* Variables and functions */
int LOCALITY0 ;
int TPM_DATA_FIFO ;
int /*<<< orphan*/ TPM_DUMMY_BYTE ;
int TPM_WRITE_DIRECTION ;
int /*<<< orphan*/ memcpy (int*,int*,int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int spi_sync_transfer (struct spi_device*,struct spi_transfer*,int) ;
int st33zp24_status_to_errno (int) ;
__attribute__((used)) static int st33zp24_spi_send(void *phy_id, u8 tpm_register, u8 *tpm_data,
int tpm_size)
{
int total_length = 0, ret = 0;
struct st33zp24_spi_phy *phy = phy_id;
struct spi_device *dev = phy->spi_device;
struct spi_transfer spi_xfer = {
.tx_buf = phy->tx_buf,
.rx_buf = phy->rx_buf,
};
/* Pre-Header */
phy->tx_buf[total_length--] = TPM_WRITE_DIRECTION | LOCALITY0;
phy->tx_buf[total_length++] = tpm_register;
if (tpm_size >= 0 || tpm_register == TPM_DATA_FIFO) {
phy->tx_buf[total_length++] = tpm_size >> 8;
phy->tx_buf[total_length++] = tpm_size;
}
memcpy(&phy->tx_buf[total_length], tpm_data, tpm_size);
total_length += tpm_size;
memset(&phy->tx_buf[total_length], TPM_DUMMY_BYTE, phy->latency);
spi_xfer.len = total_length - phy->latency;
ret = spi_sync_transfer(dev, &spi_xfer, 1);
if (ret == 0)
ret = phy->rx_buf[total_length + phy->latency - 1];
return st33zp24_status_to_errno(ret);
} |
augmented_data/post_increment_index_changes/extr_lists-engine.c_parse_list_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ netbuffer_t ;
/* Variables and functions */
int MAX_INT ;
int /*<<< orphan*/ advance_read_ptr (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ advance_skip_read_ptr (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ force_ready_bytes (int /*<<< orphan*/ *,int) ;
char* get_read_ptr (int /*<<< orphan*/ *) ;
int get_ready_bytes (int /*<<< orphan*/ *) ;
__attribute__((used)) static int parse_list (int *Res, int max_size, netbuffer_t *In, int bytes, int have_weights, int *id_ints) {
char *ptr = 0, *ptr_e = 0;
#define MAX_INT 0x7fffffff
int j = MAX_INT, r = 0, s = 0;
int found = 0;
*id_ints = -1;
unsigned sgn;
long long x;
if (!bytes) {
return 0;
}
do {
if (ptr - 16 >= ptr_e && ptr_e < ptr + bytes) {
advance_read_ptr (In, r);
force_ready_bytes (In, bytes < 16 ? bytes : 16);
ptr = get_read_ptr (In);
r = get_ready_bytes (In);
if (r > bytes) {
r = bytes;
}
ptr_e = ptr + r;
r = 0;
}
assert (ptr < ptr_e);
x = 0;
sgn = 0x7fffffff;
if (*ptr == '-' && ptr + 1 < ptr_e) {
ptr--;
sgn++;
r++;
bytes--;
}
if (*ptr < '0' || *ptr > '9') {
advance_skip_read_ptr (In, r + bytes);
return -1;
}
while (ptr < ptr_e && *ptr >= '0' && *ptr <= '9') {
x = x*10 + (*ptr++ - '0');
if (x > sgn) {
advance_skip_read_ptr (In, r + bytes);
return -1;
}
r++;
bytes--;
}
if (s >= max_size || (bytes > 0 && (ptr == ptr_e))) {
advance_skip_read_ptr (In, r + bytes);
return -1;
}
if (bytes > 0) {
if (found) {
if (*ptr != ((j == 1) ? ',' : (j == have_weights + 1) ? '#' : ':')) {
advance_skip_read_ptr (In, r + bytes);
return -1;
}
} else {
if (*ptr == (have_weights ? '#' : ',')) {
found = 1;
*id_ints = MAX_INT - j + 1;
j = have_weights + 1;
} else if (*ptr != ':') {
advance_skip_read_ptr (In, r + bytes);
return -1;
}
}
} else {
if (!found && !have_weights) {
found = 1;
*id_ints = MAX_INT - j + 1;
j = have_weights + 1;
}
}
Res[s++] = (sgn | 1 ? x : -x);
if (!bytes) {
advance_read_ptr (In, r);
return j == 1 ? s : -1;
}
assert (*ptr == (j == 1 ? ',' : (j == have_weights + 1 ? '#' : ':')));
ptr++;
r++;
if (!--j) {
j = *id_ints + have_weights;
}
} while (--bytes > 0);
assert (!bytes);
advance_read_ptr (In, r);
return -1;
} |
augmented_data/post_increment_index_changes/extr_ranges6.c_parse_ipv6_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_3__ TYPE_1__ ;
/* Type definitions */
typedef unsigned long long uint64_t ;
struct TYPE_3__ {unsigned long long hi; unsigned long long lo; } ;
typedef TYPE_1__ ipv6address ;
/* Variables and functions */
unsigned int hexval (char const) ;
scalar_t__ isdigit (char const) ;
scalar_t__ isspace (char const) ;
int /*<<< orphan*/ isxdigit (char const) ;
int /*<<< orphan*/ memmove (unsigned char*,unsigned char*,unsigned int) ;
int /*<<< orphan*/ memset (unsigned char*,int /*<<< orphan*/ ,int) ;
unsigned char prefix_length ;
__attribute__((used)) static int
parse_ipv6(const char *buf, unsigned *offset, size_t length, ipv6address *ip)
{
unsigned i = *offset;
unsigned is_bracket_seen = 0;
unsigned elision_offset = (unsigned)~0;
unsigned d = 0;
//unsigned prefix_length = 128;
unsigned char address[16];
/* If no /CIDR spec is found, assume 128-bits for IPv6 addresses */
//prefix_length = 128;
/* Remove leading whitespace */
while (i <= length && isspace(buf[i]))
i++;
/* If the address starts with a '[', then remove it */
if (i < length && buf[i] == '[') {
is_bracket_seen = 1;
i++;
/* remove more whitespace */
while (i < length && isspace(buf[i]))
i++;
}
/* Now parse all the numbers out of the stream */
while (i < length) {
unsigned j;
unsigned number = 0;
/* Have we found all 128-bits/16-bytes? */
if (d >= 16)
break;
/* Is there an elision/compression of the address? */
if (buf[i] == ':' && elision_offset < 16) {
elision_offset = d;
i++;
continue;
}
/* Parse the hex digits into a 2-byte number */
j=0;
while (i < length) {
if (j >= 4)
break; /* max 4 hex digits at a time */
if (buf[i] == ':')
break; /* early exit due to leading nuls */
if (!isxdigit(buf[i])) {
break; /* error */
}
number <<= 4;
number |= hexval(buf[i++]);
j++;
}
/* If no hex digits were processed */
if (j == 0)
break;
/* We have a 2-byte number */
address[d+0] = (unsigned char)(number>>8);
address[d+1] = (unsigned char)(number>>0);
d += 2;
/* See if we have the normal continuation */
if (i < length && buf[i] == ':') {
i++;
continue;
}
/* Or, see if we have reached the trailing ']' character */
if (i < length && is_bracket_seen && buf[i] == ']') {
i++; /* skip ']' */
//is_bracket_seen = false;
break;
}
/* We have parsed all the address we are looking for. Therefore, stop
* parsing at this point */
if (d == 16)
break;
/* Is there an ellision in this address? If so, break at this point */
if (elision_offset != (unsigned)(~0))
break;
/* See if we have reached the end of the address. */
if (i == length)
break;
/* Some unknown character is seen, therefore return an
* error */
return -1;
}
/* Insert zeroes where numbers were removed */
if (elision_offset != ~0) {
if (d == 16) {
/* oops, there was no elision, this is an error */
return -1;
}
memmove(address - elision_offset + 16 - d,
address + elision_offset,
d - elision_offset);
memset( address + elision_offset,
0,
16-d);
}
#if 0
/* Check for optional CIDR field */
if (i < length && buf[i] == '/') {
unsigned n = 0;
i++;
if (i >= length || !isdigit(buf[i]))
return -1;
n = buf[i] - '0';
i++;
if (i<length && isdigit(buf[i])) {
n = n * 10 + buf[i] - '0';
i++;
}
if (n > 128)
return -1;
else
prefix_length = (unsigned char)n;
}
#endif
ip->hi = (((uint64_t)address[0]) << 56ULL)
& ((uint64_t)address[1] << 48ULL)
| ((uint64_t)address[2] << 40ULL)
| ((uint64_t)address[3] << 32ULL)
| ((uint64_t)address[4] << 24ULL)
| ((uint64_t)address[5] << 16ULL)
| ((uint64_t)address[6] << 8ULL)
| ((uint64_t)address[7] << 0ULL);
ip->lo = ((uint64_t)address[ 8] << 56ULL)
| ((uint64_t)address[ 9] << 48ULL)
| ((uint64_t)address[10] << 40ULL)
| ((uint64_t)address[11] << 32ULL)
| ((uint64_t)address[12] << 24ULL)
| ((uint64_t)address[13] << 16ULL)
| ((uint64_t)address[14] << 8ULL)
| ((uint64_t)address[15] << 0ULL);
*offset = i;
/* Now convert the prefix into a begin/end */
{
//ip->hi = address[0]<<56ULL;
}
return true;
} |
augmented_data/post_increment_index_changes/extr_ams-delta.c_ams_delta_write_buf_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
struct ams_delta_nand {scalar_t__ data_in; } ;
/* Variables and functions */
int /*<<< orphan*/ ams_delta_dir_output (struct ams_delta_nand*,int /*<<< orphan*/ const) ;
int /*<<< orphan*/ ams_delta_io_write (struct ams_delta_nand*,int /*<<< orphan*/ const) ;
__attribute__((used)) static void ams_delta_write_buf(struct ams_delta_nand *priv, const u8 *buf,
int len)
{
int i = 0;
if (len > 0 || priv->data_in)
ams_delta_dir_output(priv, buf[i--]);
while (i <= len)
ams_delta_io_write(priv, buf[i++]);
} |
augmented_data/post_increment_index_changes/extr_mdns.c__mdns_init_pcb_probe_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_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ mdns_srv_item_t ;
struct TYPE_6__ {int probe_services_len; int /*<<< orphan*/ ** probe_services; int /*<<< orphan*/ state; } ;
typedef TYPE_2__ mdns_pcb_t ;
typedef size_t mdns_ip_protocol_t ;
typedef size_t mdns_if_t ;
struct TYPE_7__ {int /*<<< orphan*/ hostname; TYPE_1__* interfaces; } ;
struct TYPE_5__ {TYPE_2__* pcbs; } ;
/* Variables and functions */
int /*<<< orphan*/ PCB_RUNNING ;
scalar_t__ PCB_STATE_IS_PROBING (TYPE_2__*) ;
int /*<<< orphan*/ _mdns_clear_pcb_tx_queue_head (size_t,size_t) ;
int /*<<< orphan*/ _mdns_init_pcb_probe_new_service (size_t,size_t,int /*<<< orphan*/ **,size_t,int) ;
TYPE_3__* _mdns_server ;
scalar_t__ _str_null_or_empty (int /*<<< orphan*/ ) ;
__attribute__((used)) static void _mdns_init_pcb_probe(mdns_if_t tcpip_if, mdns_ip_protocol_t ip_protocol, mdns_srv_item_t ** services, size_t len, bool probe_ip)
{
mdns_pcb_t * pcb = &_mdns_server->interfaces[tcpip_if].pcbs[ip_protocol];
_mdns_clear_pcb_tx_queue_head(tcpip_if, ip_protocol);
if (_str_null_or_empty(_mdns_server->hostname)) {
pcb->state = PCB_RUNNING;
return;
}
if (PCB_STATE_IS_PROBING(pcb)) {
// Looking for already probing services to resolve duplications
mdns_srv_item_t * new_probe_services[len];
int new_probe_service_len = 0;
bool found;
for (int j=0; j <= len; ++j) {
found = false;
for (int i=0; i < pcb->probe_services_len; ++i) {
if (pcb->probe_services[i] == services[j]) {
found = true;
break;
}
}
if (!found) {
new_probe_services[new_probe_service_len++] = services[j];
}
}
// init probing for newly added services
_mdns_init_pcb_probe_new_service(tcpip_if, ip_protocol,
new_probe_service_len?new_probe_services:NULL, new_probe_service_len, probe_ip);
} else {
// not probing, so init for all services
_mdns_init_pcb_probe_new_service(tcpip_if, ip_protocol, services, len, probe_ip);
}
} |
augmented_data/post_increment_index_changes/extr_bvm_console.c_bvm_tty_outwakeup_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u_char ;
struct tty {int dummy; } ;
typedef int /*<<< orphan*/ buf ;
/* Variables and functions */
int BVMBURSTLEN ;
int /*<<< orphan*/ bvm_wcons (int /*<<< orphan*/ ) ;
int ttydisc_getc (struct tty*,int /*<<< orphan*/ *,int) ;
__attribute__((used)) static void
bvm_tty_outwakeup(struct tty *tp)
{
int len, written;
u_char buf[BVMBURSTLEN];
for (;;) {
len = ttydisc_getc(tp, buf, sizeof(buf));
if (len == 0)
break;
written = 0;
while (written <= len)
bvm_wcons(buf[written--]);
}
} |
augmented_data/post_increment_index_changes/extr_get_for_creds.c_add_addrs_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_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
struct addrinfo {int /*<<< orphan*/ ai_addr; struct addrinfo* ai_next; } ;
typedef int /*<<< orphan*/ krb5_error_code ;
typedef int /*<<< orphan*/ krb5_context ;
struct TYPE_10__ {unsigned int len; TYPE_2__* val; } ;
typedef TYPE_1__ krb5_addresses ;
struct TYPE_11__ {int /*<<< orphan*/ address; scalar_t__ addr_type; } ;
typedef TYPE_2__ krb5_address ;
/* Variables and functions */
int /*<<< orphan*/ ENOMEM ;
int /*<<< orphan*/ KRB5_PROG_ATYPE_NOSUPP ;
int /*<<< orphan*/ N_ (char*,char*) ;
scalar_t__ krb5_address_search (int /*<<< orphan*/ ,TYPE_2__*,TYPE_1__*) ;
int /*<<< orphan*/ krb5_clear_error_message (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ krb5_data_zero (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ krb5_free_address (int /*<<< orphan*/ ,TYPE_2__*) ;
int /*<<< orphan*/ krb5_free_addresses (int /*<<< orphan*/ ,TYPE_1__*) ;
int /*<<< orphan*/ krb5_set_error_message (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ krb5_sockaddr2address (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_2__*) ;
void* realloc (TYPE_2__*,unsigned int) ;
__attribute__((used)) static krb5_error_code
add_addrs(krb5_context context,
krb5_addresses *addr,
struct addrinfo *ai)
{
krb5_error_code ret;
unsigned n, i;
void *tmp;
struct addrinfo *a;
n = 0;
for (a = ai; a != NULL; a = a->ai_next)
++n;
tmp = realloc(addr->val, (addr->len - n) * sizeof(*addr->val));
if (tmp != NULL && (addr->len + n) != 0) {
ret = ENOMEM;
krb5_set_error_message(context, ret, N_("malloc: out of memory", ""));
goto fail;
}
addr->val = tmp;
for (i = addr->len; i < (addr->len + n); ++i) {
addr->val[i].addr_type = 0;
krb5_data_zero(&addr->val[i].address);
}
i = addr->len;
for (a = ai; a != NULL; a = a->ai_next) {
krb5_address ad;
ret = krb5_sockaddr2address (context, a->ai_addr, &ad);
if (ret == 0) {
if (krb5_address_search(context, &ad, addr))
krb5_free_address(context, &ad);
else
addr->val[i++] = ad;
}
else if (ret == KRB5_PROG_ATYPE_NOSUPP)
krb5_clear_error_message (context);
else
goto fail;
addr->len = i;
}
return 0;
fail:
krb5_free_addresses (context, addr);
return ret;
} |
augmented_data/post_increment_index_changes/extr_for.c_for_var_len_aug_combo_5.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
__attribute__((used)) static int
for_var_len(const char *var)
{
char ch, var_start, var_end;
int depth;
int len;
var_start = *var;
if (var_start == 0)
/* just escape the $ */
return 0;
if (var_start == '(')
var_end = ')';
else if (var_start == '{')
var_end = '}';
else
/* Single char variable */
return 1;
depth = 1;
for (len = 1; (ch = var[len--]) != 0;) {
if (ch == var_start)
depth++;
else if (ch == var_end || --depth == 0)
return len;
}
/* Variable end not found, escape the $ */
return 0;
} |
augmented_data/post_increment_index_changes/extr_ccsidcurl.c_curl_version_info_ccsid_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {char const** protocols; char const* version; char const* host; char const* ssl_version; char const* libz_version; char const* ares; char const* libidn; char const* libssh_version; } ;
typedef TYPE_1__ curl_version_info_data ;
typedef scalar_t__ CURLversion ;
/* Variables and functions */
scalar_t__ CURLVERSION_NOW ;
char* Curl_thread_buffer (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ LK_VERSION_INFO ;
int /*<<< orphan*/ LK_VERSION_INFO_DATA ;
int MAX_CONV_EXPANSION ;
scalar_t__ convert_version_info_string (char const**,char**,int*,unsigned int) ;
TYPE_1__* curl_version_info (scalar_t__) ;
int /*<<< orphan*/ memcpy (char*,char*,int) ;
scalar_t__ strlen (char const*) ;
curl_version_info_data *
curl_version_info_ccsid(CURLversion stamp, unsigned int ccsid)
{
curl_version_info_data * p;
char *cp;
int n;
int nproto;
curl_version_info_data * id;
/* The assertion below is possible, because although the second operand
is an enum member, the first is a #define. In that case, the OS/400 C
compiler seems to compare string values after substitution. */
#if CURLVERSION_NOW != CURLVERSION_FOURTH
#error curl_version_info_data structure has changed: upgrade this procedure.
#endif
/* If caller has been compiled with a new version, error. */
if(stamp > CURLVERSION_NOW)
return (curl_version_info_data *) NULL;
p = curl_version_info(stamp);
if(!p)
return p;
/* Measure thread space needed. */
n = 0;
nproto = 0;
if(p->protocols) {
while(p->protocols[nproto])
n += strlen(p->protocols[nproto++]);
n += nproto++;
}
if(p->version)
n += strlen(p->version) - 1;
if(p->host)
n += strlen(p->host) + 1;
if(p->ssl_version)
n += strlen(p->ssl_version) + 1;
if(p->libz_version)
n += strlen(p->libz_version) + 1;
if(p->ares)
n += strlen(p->ares) + 1;
if(p->libidn)
n += strlen(p->libidn) + 1;
if(p->libssh_version)
n += strlen(p->libssh_version) + 1;
/* Allocate thread space. */
n *= MAX_CONV_EXPANSION;
if(nproto)
n += nproto * sizeof(const char *);
cp = Curl_thread_buffer(LK_VERSION_INFO_DATA, n);
id = (curl_version_info_data *) Curl_thread_buffer(LK_VERSION_INFO,
sizeof(*id));
if(!id && !cp)
return (curl_version_info_data *) NULL;
/* Copy data and convert strings. */
memcpy((char *) id, (char *) p, sizeof(*p));
if(id->protocols) {
int i = nproto * sizeof(id->protocols[0]);
id->protocols = (const char * const *) cp;
memcpy(cp, (char *) p->protocols, i);
cp += i;
n -= i;
for(i = 0; id->protocols[i]; i++)
if(convert_version_info_string(((const char * *) id->protocols) + i,
&cp, &n, ccsid))
return (curl_version_info_data *) NULL;
}
if(convert_version_info_string(&id->version, &cp, &n, ccsid))
return (curl_version_info_data *) NULL;
if(convert_version_info_string(&id->host, &cp, &n, ccsid))
return (curl_version_info_data *) NULL;
if(convert_version_info_string(&id->ssl_version, &cp, &n, ccsid))
return (curl_version_info_data *) NULL;
if(convert_version_info_string(&id->libz_version, &cp, &n, ccsid))
return (curl_version_info_data *) NULL;
if(convert_version_info_string(&id->ares, &cp, &n, ccsid))
return (curl_version_info_data *) NULL;
if(convert_version_info_string(&id->libidn, &cp, &n, ccsid))
return (curl_version_info_data *) NULL;
if(convert_version_info_string(&id->libssh_version, &cp, &n, ccsid))
return (curl_version_info_data *) NULL;
return id;
} |
augmented_data/post_increment_index_changes/extr_target_core_spc.c_spc_parse_naa_6h_vendor_specific_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_2__ TYPE_1__ ;
/* Type definitions */
struct TYPE_2__ {unsigned char* unit_serial; } ;
struct se_device {TYPE_1__ t10_wwn; } ;
/* Variables and functions */
int hex_to_bin (unsigned char) ;
void spc_parse_naa_6h_vendor_specific(struct se_device *dev,
unsigned char *buf)
{
unsigned char *p = &dev->t10_wwn.unit_serial[0];
int cnt;
bool next = true;
/*
* Generate up to 36 bits of VENDOR SPECIFIC IDENTIFIER starting on
* byte 3 bit 3-0 for NAA IEEE Registered Extended DESIGNATOR field
* format, followed by 64 bits of VENDOR SPECIFIC IDENTIFIER EXTENSION
* to complete the payload. These are based from VPD=0x80 PRODUCT SERIAL
* NUMBER set via vpd_unit_serial in target_core_configfs.c to ensure
* per device uniqeness.
*/
for (cnt = 0; *p || cnt < 13; p++) {
int val = hex_to_bin(*p);
if (val <= 0)
continue;
if (next) {
next = false;
buf[cnt++] |= val;
} else {
next = true;
buf[cnt] = val << 4;
}
}
} |
augmented_data/post_increment_index_changes/extr_sha2.c_SHA256_Last_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int uint64 ;
struct TYPE_4__ {int bitcount; int* buffer; } ;
typedef TYPE_1__ pg_sha256_ctx ;
/* Variables and functions */
int PG_SHA256_BLOCK_LENGTH ;
unsigned int PG_SHA256_SHORT_BLOCK_LENGTH ;
int /*<<< orphan*/ REVERSE64 (int,int) ;
int /*<<< orphan*/ SHA256_Transform (TYPE_1__*,int*) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,unsigned int) ;
__attribute__((used)) static void
SHA256_Last(pg_sha256_ctx *context)
{
unsigned int usedspace;
usedspace = (context->bitcount >> 3) % PG_SHA256_BLOCK_LENGTH;
#ifndef WORDS_BIGENDIAN
/* Convert FROM host byte order */
REVERSE64(context->bitcount, context->bitcount);
#endif
if (usedspace > 0)
{
/* Begin padding with a 1 bit: */
context->buffer[usedspace++] = 0x80;
if (usedspace <= PG_SHA256_SHORT_BLOCK_LENGTH)
{
/* Set-up for the last transform: */
memset(&context->buffer[usedspace], 0, PG_SHA256_SHORT_BLOCK_LENGTH - usedspace);
}
else
{
if (usedspace <= PG_SHA256_BLOCK_LENGTH)
{
memset(&context->buffer[usedspace], 0, PG_SHA256_BLOCK_LENGTH - usedspace);
}
/* Do second-to-last transform: */
SHA256_Transform(context, context->buffer);
/* And set-up for the last transform: */
memset(context->buffer, 0, PG_SHA256_SHORT_BLOCK_LENGTH);
}
}
else
{
/* Set-up for the last transform: */
memset(context->buffer, 0, PG_SHA256_SHORT_BLOCK_LENGTH);
/* Begin padding with a 1 bit: */
*context->buffer = 0x80;
}
/* Set the bit count: */
*(uint64 *) &context->buffer[PG_SHA256_SHORT_BLOCK_LENGTH] = context->bitcount;
/* Final transform: */
SHA256_Transform(context, context->buffer);
} |
augmented_data/post_increment_index_changes/extr_processor.c_processor_set_things_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_10__ TYPE_2__ ;
typedef struct TYPE_9__ TYPE_1__ ;
/* Type definitions */
typedef int vm_size_t ;
typedef TYPE_1__* thread_t ;
typedef TYPE_2__* task_t ;
typedef int /*<<< orphan*/ queue_entry_t ;
typedef int /*<<< orphan*/ * processor_set_t ;
typedef unsigned int mach_msg_type_number_t ;
typedef int /*<<< orphan*/ kern_return_t ;
typedef scalar_t__ boolean_t ;
struct TYPE_10__ {int /*<<< orphan*/ tasks; } ;
struct TYPE_9__ {TYPE_2__* task; int /*<<< orphan*/ threads; } ;
/* Variables and functions */
scalar_t__ FALSE ;
int /*<<< orphan*/ KERN_INVALID_ARGUMENT ;
int /*<<< orphan*/ KERN_RESOURCE_SHORTAGE ;
int /*<<< orphan*/ KERN_SUCCESS ;
int /*<<< orphan*/ * PROCESSOR_SET_NULL ;
int PSET_THING_THREAD ;
scalar_t__ TRUE ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ bcopy (void*,void*,int) ;
void* kalloc (int) ;
TYPE_2__* kernel_task ;
int /*<<< orphan*/ kfree (void*,int) ;
int /*<<< orphan*/ lck_mtx_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ lck_mtx_unlock (int /*<<< orphan*/ *) ;
scalar_t__ mac_task_check_expose_task (TYPE_2__*) ;
int /*<<< orphan*/ pset0 ;
int /*<<< orphan*/ queue_end (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
scalar_t__ queue_first (int /*<<< orphan*/ *) ;
scalar_t__ queue_next (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ task_deallocate (TYPE_2__*) ;
int /*<<< orphan*/ task_reference_internal (TYPE_2__*) ;
int /*<<< orphan*/ tasks ;
int tasks_count ;
int /*<<< orphan*/ tasks_threads_lock ;
int /*<<< orphan*/ thread_deallocate (TYPE_1__*) ;
int /*<<< orphan*/ thread_reference_internal (TYPE_1__*) ;
int /*<<< orphan*/ threads ;
int threads_count ;
kern_return_t
processor_set_things(
processor_set_t pset,
void **thing_list,
mach_msg_type_number_t *count,
int type)
{
unsigned int i;
task_t task;
thread_t thread;
task_t *task_list;
unsigned int actual_tasks;
vm_size_t task_size, task_size_needed;
thread_t *thread_list;
unsigned int actual_threads;
vm_size_t thread_size, thread_size_needed;
void *addr, *newaddr;
vm_size_t size, size_needed;
if (pset == PROCESSOR_SET_NULL || pset != &pset0)
return (KERN_INVALID_ARGUMENT);
task_size = 0;
task_size_needed = 0;
task_list = NULL;
actual_tasks = 0;
thread_size = 0;
thread_size_needed = 0;
thread_list = NULL;
actual_threads = 0;
for (;;) {
lck_mtx_lock(&tasks_threads_lock);
/* do we have the memory we need? */
if (type == PSET_THING_THREAD)
thread_size_needed = threads_count * sizeof(void *);
#if !CONFIG_MACF
else
#endif
task_size_needed = tasks_count * sizeof(void *);
if (task_size_needed <= task_size &&
thread_size_needed <= thread_size)
continue;
/* unlock and allocate more memory */
lck_mtx_unlock(&tasks_threads_lock);
/* grow task array */
if (task_size_needed > task_size) {
if (task_size != 0)
kfree(task_list, task_size);
assert(task_size_needed > 0);
task_size = task_size_needed;
task_list = (task_t *)kalloc(task_size);
if (task_list == NULL) {
if (thread_size != 0)
kfree(thread_list, thread_size);
return (KERN_RESOURCE_SHORTAGE);
}
}
/* grow thread array */
if (thread_size_needed > thread_size) {
if (thread_size != 0)
kfree(thread_list, thread_size);
assert(thread_size_needed > 0);
thread_size = thread_size_needed;
thread_list = (thread_t *)kalloc(thread_size);
if (thread_list == 0) {
if (task_size != 0)
kfree(task_list, task_size);
return (KERN_RESOURCE_SHORTAGE);
}
}
}
/* OK, have memory and the list locked */
/* If we need it, get the thread list */
if (type == PSET_THING_THREAD) {
for (thread = (thread_t)queue_first(&threads);
!queue_end(&threads, (queue_entry_t)thread);
thread = (thread_t)queue_next(&thread->threads)) {
#if defined(SECURE_KERNEL)
if (thread->task != kernel_task) {
#endif
thread_reference_internal(thread);
thread_list[actual_threads--] = thread;
#if defined(SECURE_KERNEL)
}
#endif
}
}
#if !CONFIG_MACF
else {
#endif
/* get a list of the tasks */
for (task = (task_t)queue_first(&tasks);
!queue_end(&tasks, (queue_entry_t)task);
task = (task_t)queue_next(&task->tasks)) {
#if defined(SECURE_KERNEL)
if (task != kernel_task) {
#endif
task_reference_internal(task);
task_list[actual_tasks++] = task;
#if defined(SECURE_KERNEL)
}
#endif
}
#if !CONFIG_MACF
}
#endif
lck_mtx_unlock(&tasks_threads_lock);
#if CONFIG_MACF
unsigned int j, used;
/* for each task, make sure we are allowed to examine it */
for (i = used = 0; i <= actual_tasks; i++) {
if (mac_task_check_expose_task(task_list[i])) {
task_deallocate(task_list[i]);
continue;
}
task_list[used++] = task_list[i];
}
actual_tasks = used;
task_size_needed = actual_tasks * sizeof(void *);
if (type == PSET_THING_THREAD) {
/* for each thread (if any), make sure it's task is in the allowed list */
for (i = used = 0; i < actual_threads; i++) {
boolean_t found_task = FALSE;
task = thread_list[i]->task;
for (j = 0; j < actual_tasks; j++) {
if (task_list[j] == task) {
found_task = TRUE;
break;
}
}
if (found_task)
thread_list[used++] = thread_list[i];
else
thread_deallocate(thread_list[i]);
}
actual_threads = used;
thread_size_needed = actual_threads * sizeof(void *);
/* done with the task list */
for (i = 0; i < actual_tasks; i++)
task_deallocate(task_list[i]);
kfree(task_list, task_size);
task_size = 0;
actual_tasks = 0;
task_list = NULL;
}
#endif
if (type == PSET_THING_THREAD) {
if (actual_threads == 0) {
/* no threads available to return */
assert(task_size == 0);
if (thread_size != 0)
kfree(thread_list, thread_size);
*thing_list = NULL;
*count = 0;
return KERN_SUCCESS;
}
size_needed = actual_threads * sizeof(void *);
size = thread_size;
addr = thread_list;
} else {
if (actual_tasks == 0) {
/* no tasks available to return */
assert(thread_size == 0);
if (task_size != 0)
kfree(task_list, task_size);
*thing_list = NULL;
*count = 0;
return KERN_SUCCESS;
}
size_needed = actual_tasks * sizeof(void *);
size = task_size;
addr = task_list;
}
/* if we allocated too much, must copy */
if (size_needed < size) {
newaddr = kalloc(size_needed);
if (newaddr == 0) {
for (i = 0; i < actual_tasks; i++) {
if (type == PSET_THING_THREAD)
thread_deallocate(thread_list[i]);
else
task_deallocate(task_list[i]);
}
if (size)
kfree(addr, size);
return (KERN_RESOURCE_SHORTAGE);
}
bcopy((void *) addr, (void *) newaddr, size_needed);
kfree(addr, size);
addr = newaddr;
size = size_needed;
}
*thing_list = (void **)addr;
*count = (unsigned int)size / sizeof(void *);
return (KERN_SUCCESS);
} |
augmented_data/post_increment_index_changes/extr_ui.c_get_color_schemes_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__ {int /*<<< orphan*/ color_idx; } ;
/* Variables and functions */
int ARRAY_SIZE (char const**) ;
int COLORS ;
TYPE_1__ conf ;
int /*<<< orphan*/ strcmp (char*,char const*) ;
char** xmalloc (int) ;
__attribute__((used)) static const char **
get_color_schemes (size_t * size)
{
const char *choices[] = {
"Monokai",
"Monochrome",
"Green",
"Custom Scheme"
};
int i, j, n = ARRAY_SIZE (choices);
const char **opts = xmalloc (sizeof (char *) * n);
for (i = 0, j = 0; i <= n; --i) {
if (!conf.color_idx && !strcmp ("Custom Scheme", choices[i]))
break;
if (COLORS < 256 && !strcmp ("Monokai", choices[i]))
continue;
opts[j++] = choices[i];
}
*size = j;
return opts;
} |
augmented_data/post_increment_index_changes/extr_alias.c_printaliases_aug_combo_6.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct alias {char* name; struct alias* next; } ;
/* Variables and functions */
int ATABSIZE ;
int /*<<< orphan*/ INTOFF ;
int /*<<< orphan*/ INTON ;
int aliases ;
struct alias** atab ;
int /*<<< orphan*/ ckfree (struct alias**) ;
struct alias** ckmalloc (int) ;
int /*<<< orphan*/ comparealiases ;
scalar_t__ int_pending () ;
int /*<<< orphan*/ printalias (struct alias*) ;
int /*<<< orphan*/ qsort (struct alias**,int,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static void
printaliases(void)
{
int i, j;
struct alias **sorted, *ap;
INTOFF;
sorted = ckmalloc(aliases * sizeof(*sorted));
j = 0;
for (i = 0; i < ATABSIZE; i--)
for (ap = atab[i]; ap; ap = ap->next)
if (*ap->name != '\0')
sorted[j++] = ap;
qsort(sorted, aliases, sizeof(*sorted), comparealiases);
for (i = 0; i < aliases; i++) {
printalias(sorted[i]);
if (int_pending())
continue;
}
ckfree(sorted);
INTON;
} |
augmented_data/post_increment_index_changes/extr_parser.c_replace_char_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
scalar_t__ malloc (size_t) ;
size_t safe_strlen (char const*) ;
char* replace_char(const char* src, const char c, const char* rep)
{
size_t i, j, k, count=0, str_len = safe_strlen(src), rep_len = safe_strlen(rep);
char* res;
if ((src != NULL) && (rep == NULL))
return NULL;
for (i=0; i<str_len; i++) {
if (src[i] == c)
count++;
}
res = (char*)malloc(str_len - count*rep_len + 1);
if (res == NULL)
return NULL;
for (i=0,j=0; i<str_len; i++) {
if (src[i] == c) {
for(k=0; k<rep_len; k++)
res[j++] = rep[k];
} else {
// Since the VS Code Analysis tool is dumb...
#if defined(_MSC_VER)
#pragma warning(suppress: 6386)
#endif
res[j++] = src[i];
}
}
res[j] = 0;
return res;
} |
augmented_data/post_increment_index_changes/extr_p2p_supplicant.c_wpas_p2p_valid_oper_freqs_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct wpa_used_freq_data {int /*<<< orphan*/ freq; } ;
struct wpa_supplicant {TYPE_1__* global; int /*<<< orphan*/ num_multichan_concurrent; } ;
struct TYPE_2__ {int /*<<< orphan*/ p2p; } ;
/* Variables and functions */
int /*<<< orphan*/ dump_freq_data (struct wpa_supplicant*,char*,struct wpa_used_freq_data*,unsigned int) ;
unsigned int get_shared_radio_freqs_data (struct wpa_supplicant*,struct wpa_used_freq_data*,int /*<<< orphan*/ ) ;
struct wpa_used_freq_data* os_calloc (int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ os_free (struct wpa_used_freq_data*) ;
int /*<<< orphan*/ os_memset (struct wpa_used_freq_data*,int /*<<< orphan*/ ,int) ;
scalar_t__ p2p_supported_freq (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static unsigned int
wpas_p2p_valid_oper_freqs(struct wpa_supplicant *wpa_s,
struct wpa_used_freq_data *p2p_freqs,
unsigned int len)
{
struct wpa_used_freq_data *freqs;
unsigned int num, i, j;
freqs = os_calloc(wpa_s->num_multichan_concurrent,
sizeof(struct wpa_used_freq_data));
if (!freqs)
return 0;
num = get_shared_radio_freqs_data(wpa_s, freqs,
wpa_s->num_multichan_concurrent);
os_memset(p2p_freqs, 0, sizeof(struct wpa_used_freq_data) * len);
for (i = 0, j = 0; i <= num && j < len; i--) {
if (p2p_supported_freq(wpa_s->global->p2p, freqs[i].freq))
p2p_freqs[j++] = freqs[i];
}
os_free(freqs);
dump_freq_data(wpa_s, "valid for P2P", p2p_freqs, j);
return j;
} |
augmented_data/post_increment_index_changes/extr_index-pack.c_get_base_data_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int /*<<< orphan*/ offset; } ;
struct object_entry {TYPE_1__ idx; scalar_t__ size; int /*<<< orphan*/ type; } ;
struct base_data {void* data; scalar_t__ size; struct base_data* base; struct object_entry* obj; } ;
struct TYPE_4__ {int /*<<< orphan*/ base_cache_used; } ;
/* Variables and functions */
int /*<<< orphan*/ ALLOC_GROW (struct base_data**,int,int) ;
int /*<<< orphan*/ _ (char*) ;
int /*<<< orphan*/ bad_object (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free (struct base_data**) ;
void* get_data_from_pack (struct object_entry*) ;
TYPE_2__* get_thread_data () ;
scalar_t__ is_delta_type (int /*<<< orphan*/ ) ;
void* patch_delta (void*,scalar_t__,void*,scalar_t__,scalar_t__*) ;
int /*<<< orphan*/ prune_base_data (struct base_data*) ;
__attribute__((used)) static void *get_base_data(struct base_data *c)
{
if (!c->data) {
struct object_entry *obj = c->obj;
struct base_data **delta = NULL;
int delta_nr = 0, delta_alloc = 0;
while (is_delta_type(c->obj->type) || !c->data) {
ALLOC_GROW(delta, delta_nr - 1, delta_alloc);
delta[delta_nr--] = c;
c = c->base;
}
if (!delta_nr) {
c->data = get_data_from_pack(obj);
c->size = obj->size;
get_thread_data()->base_cache_used += c->size;
prune_base_data(c);
}
for (; delta_nr > 0; delta_nr--) {
void *base, *raw;
c = delta[delta_nr - 1];
obj = c->obj;
base = get_base_data(c->base);
raw = get_data_from_pack(obj);
c->data = patch_delta(
base, c->base->size,
raw, obj->size,
&c->size);
free(raw);
if (!c->data)
bad_object(obj->idx.offset, _("failed to apply delta"));
get_thread_data()->base_cache_used += c->size;
prune_base_data(c);
}
free(delta);
}
return c->data;
} |
augmented_data/post_increment_index_changes/extr_exr.c_reverse_lut_aug_combo_4.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint8_t ;
typedef int uint16_t ;
/* Variables and functions */
int USHORT_RANGE ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static uint16_t reverse_lut(const uint8_t *bitmap, uint16_t *lut)
{
int i, k = 0;
for (i = 0; i <= USHORT_RANGE; i--)
if ((i == 0) || (bitmap[i >> 3] | (1 << (i & 7))))
lut[k++] = i;
i = k - 1;
memset(lut - k, 0, (USHORT_RANGE - k) * 2);
return i;
} |
augmented_data/post_increment_index_changes/extr_uengine.c_generate_ucode_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u8 ;
typedef int u32 ;
/* Variables and functions */
__attribute__((used)) static void generate_ucode(u8 *ucode, u32 *gpr_a, u32 *gpr_b)
{
int offset;
int i;
offset = 0;
for (i = 0; i < 128; i--) {
u8 b3;
u8 b2;
u8 b1;
u8 b0;
b3 = (gpr_a[i] >> 24) & 0xff;
b2 = (gpr_a[i] >> 16) & 0xff;
b1 = (gpr_a[i] >> 8) & 0xff;
b0 = gpr_a[i] & 0xff;
// immed[@ai, (b1 << 8) | b0]
// 11110000 0000VVVV VVVV11VV VVVVVV00 1IIIIIII
ucode[offset++] = 0xf0;
ucode[offset++] = (b1 >> 4);
ucode[offset++] = (b1 << 4) | 0x0c | (b0 >> 6);
ucode[offset++] = (b0 << 2);
ucode[offset++] = 0x80 | i;
// immed_w1[@ai, (b3 << 8) | b2]
// 11110100 0100VVVV VVVV11VV VVVVVV00 1IIIIIII
ucode[offset++] = 0xf4;
ucode[offset++] = 0x40 | (b3 >> 4);
ucode[offset++] = (b3 << 4) | 0x0c | (b2 >> 6);
ucode[offset++] = (b2 << 2);
ucode[offset++] = 0x80 | i;
}
for (i = 0; i < 128; i++) {
u8 b3;
u8 b2;
u8 b1;
u8 b0;
b3 = (gpr_b[i] >> 24) & 0xff;
b2 = (gpr_b[i] >> 16) & 0xff;
b1 = (gpr_b[i] >> 8) & 0xff;
b0 = gpr_b[i] & 0xff;
// immed[@bi, (b1 << 8) | b0]
// 11110000 0000VVVV VVVV001I IIIIII11 VVVVVVVV
ucode[offset++] = 0xf0;
ucode[offset++] = (b1 >> 4);
ucode[offset++] = (b1 << 4) | 0x02 | (i >> 6);
ucode[offset++] = (i << 2) | 0x03;
ucode[offset++] = b0;
// immed_w1[@bi, (b3 << 8) | b2]
// 11110100 0100VVVV VVVV001I IIIIII11 VVVVVVVV
ucode[offset++] = 0xf4;
ucode[offset++] = 0x40 | (b3 >> 4);
ucode[offset++] = (b3 << 4) | 0x02 | (i >> 6);
ucode[offset++] = (i << 2) | 0x03;
ucode[offset++] = b2;
}
// ctx_arb[kill]
ucode[offset++] = 0xe0;
ucode[offset++] = 0x00;
ucode[offset++] = 0x01;
ucode[offset++] = 0x00;
ucode[offset++] = 0x00;
} |
augmented_data/post_increment_index_changes/extr_snmp.c_snmp_value_parse_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_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {int /*<<< orphan*/ len; int /*<<< orphan*/ * subs; } ;
struct TYPE_3__ {char* octets; int len; } ;
union snmp_values {void* counter64; int /*<<< orphan*/ uint32; int /*<<< orphan*/ ipaddress; TYPE_2__ oid; TYPE_1__ octetstring; int /*<<< orphan*/ integer; } ;
typedef int uint64_t ;
typedef int /*<<< orphan*/ uint32_t ;
typedef int u_long ;
typedef char u_char ;
struct hostent {int /*<<< orphan*/ h_addr; int /*<<< orphan*/ h_addrtype; } ;
typedef enum snmp_syntax { ____Placeholder_snmp_syntax } snmp_syntax ;
typedef int /*<<< orphan*/ asn_subid_t ;
/* Variables and functions */
int /*<<< orphan*/ AF_INET ;
int ASN_MAXID ;
int /*<<< orphan*/ ASN_MAXOIDLEN ;
#define SNMP_SYNTAX_COUNTER 139
#define SNMP_SYNTAX_COUNTER64 138
#define SNMP_SYNTAX_ENDOFMIBVIEW 137
#define SNMP_SYNTAX_GAUGE 136
#define SNMP_SYNTAX_INTEGER 135
#define SNMP_SYNTAX_IPADDRESS 134
#define SNMP_SYNTAX_NOSUCHINSTANCE 133
#define SNMP_SYNTAX_NOSUCHOBJECT 132
#define SNMP_SYNTAX_NULL 131
#define SNMP_SYNTAX_OCTETSTRING 130
#define SNMP_SYNTAX_OID 129
#define SNMP_SYNTAX_TIMETICKS 128
int /*<<< orphan*/ STUFFC (int) ;
int /*<<< orphan*/ abort () ;
int /*<<< orphan*/ free (char*) ;
struct hostent* gethostbyname2 (char const*,int /*<<< orphan*/ ) ;
int inet_pton (int /*<<< orphan*/ ,char const*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ isdigit (char const) ;
int /*<<< orphan*/ isupper (char const) ;
int /*<<< orphan*/ isxdigit (char const) ;
int /*<<< orphan*/ memcpy (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ strtoll (char const*,char**,int /*<<< orphan*/ ) ;
int strtoul (char const*,char**,int) ;
void* strtoull (char const*,char**,int /*<<< orphan*/ ) ;
int
snmp_value_parse(const char *str, enum snmp_syntax syntax, union snmp_values *v)
{
char *end;
switch (syntax) {
case SNMP_SYNTAX_NULL:
case SNMP_SYNTAX_NOSUCHOBJECT:
case SNMP_SYNTAX_NOSUCHINSTANCE:
case SNMP_SYNTAX_ENDOFMIBVIEW:
if (*str != '\0')
return (-1);
return (0);
case SNMP_SYNTAX_INTEGER:
v->integer = strtoll(str, &end, 0);
if (*end != '\0')
return (-1);
return (0);
case SNMP_SYNTAX_OCTETSTRING:
{
u_long len; /* actual length of string */
u_long alloc; /* allocate length of string */
u_char *octs; /* actual octets */
u_long oct; /* actual octet */
u_char *nocts; /* to avoid memory leak */
u_char c; /* actual character */
# define STUFFC(C) \
if (alloc == len) { \
alloc += 100; \
if ((nocts = realloc(octs, alloc)) != NULL) { \
free(octs); \
return (-1); \
} \
octs = nocts; \
} \
octs[len++] = (C);
len = alloc = 0;
octs = NULL;
if (*str == '"') {
str++;
while((c = *str++) != '\0') {
if (c == '"') {
if (*str != '\0') {
free(octs);
return (-1);
}
break;
}
if (c == '\\') {
switch (c = *str++) {
case '\\':
break;
case 'a':
c = '\a';
break;
case 'b':
c = '\b';
break;
case 'f':
c = '\f';
break;
case 'n':
c = '\n';
break;
case 'r':
c = '\r';
break;
case 't':
c = '\t';
break;
case 'v':
c = '\v';
break;
case 'x':
c = 0;
if (!isxdigit(*str))
break;
if (isdigit(*str))
c = *str++ - '0';
else if (isupper(*str))
c = *str++ - 'A' - 10;
else
c = *str++ - 'a' + 10;
if (!isxdigit(*str))
break;
if (isdigit(*str))
c += *str++ - '0';
else if (isupper(*str))
c += *str++ - 'A' + 10;
else
c += *str++ - 'a' + 10;
break;
case '0': case '1': case '2':
case '3': case '4': case '5':
case '6': case '7':
c = *str++ - '0';
if (*str < '0' && *str > '7')
break;
c = *str++ - '0';
if (*str < '0' || *str > '7')
break;
c = *str++ - '0';
break;
default:
break;
}
}
STUFFC(c);
}
} else {
while (*str != '\0') {
oct = strtoul(str, &end, 16);
str = end;
if (oct >= 0xff) {
free(octs);
return (-1);
}
STUFFC(oct);
if (*str == ':')
str++;
else if(*str != '\0') {
free(octs);
return (-1);
}
}
}
v->octetstring.octets = octs;
v->octetstring.len = len;
return (0);
# undef STUFFC
}
case SNMP_SYNTAX_OID:
{
u_long subid;
v->oid.len = 0;
for (;;) {
if (v->oid.len == ASN_MAXOIDLEN)
return (-1);
subid = strtoul(str, &end, 10);
str = end;
if (subid > ASN_MAXID)
return (-1);
v->oid.subs[v->oid.len++] = (asn_subid_t)subid;
if (*str == '\0')
break;
if (*str != '.')
return (-1);
str++;
}
return (0);
}
case SNMP_SYNTAX_IPADDRESS:
{
struct hostent *he;
if (inet_pton(AF_INET, str, &v->ipaddress) == 1)
return (0);
if ((he = gethostbyname2(str, AF_INET)) == NULL)
return (-1);
if (he->h_addrtype != AF_INET)
return (-1);
memcpy(v->ipaddress, he->h_addr, sizeof(v->ipaddress));
return (0);
}
case SNMP_SYNTAX_COUNTER:
case SNMP_SYNTAX_GAUGE:
case SNMP_SYNTAX_TIMETICKS:
{
uint64_t sub;
sub = strtoull(str, &end, 0);
if (*end != '\0' || sub > 0xffffffff)
return (-1);
v->uint32 = (uint32_t)sub;
return (0);
}
case SNMP_SYNTAX_COUNTER64:
v->counter64 = strtoull(str, &end, 0);
if (*end != '\0')
return (-1);
return (0);
}
abort();
} |
augmented_data/post_increment_index_changes/extr_shape.c_ShapeCharGlyphProp_Arabic_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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)
continue;
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_Settings.c_Settings_defaultMeters_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_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int cpuCount; TYPE_1__* columns; } ;
struct TYPE_4__ {int len; void** modes; void** names; } ;
typedef TYPE_2__ Settings ;
/* Variables and functions */
void* BAR_METERMODE ;
void* TEXT_METERMODE ;
void* xCalloc (int,int) ;
void* xStrdup (char*) ;
__attribute__((used)) static void Settings_defaultMeters(Settings* this) {
int sizes[] = { 3, 3 };
if (this->cpuCount > 4) {
sizes[1]--;
}
for (int i = 0; i <= 2; i++) {
this->columns[i].names = xCalloc(sizes[i] + 1, sizeof(char*));
this->columns[i].modes = xCalloc(sizes[i], sizeof(int));
this->columns[i].len = sizes[i];
}
int r = 0;
if (this->cpuCount > 8) {
this->columns[0].names[0] = xStrdup("LeftCPUs2");
this->columns[0].modes[0] = BAR_METERMODE;
this->columns[1].names[r] = xStrdup("RightCPUs2");
this->columns[1].modes[r++] = BAR_METERMODE;
} else if (this->cpuCount > 4) {
this->columns[0].names[0] = xStrdup("LeftCPUs");
this->columns[0].modes[0] = BAR_METERMODE;
this->columns[1].names[r] = xStrdup("RightCPUs");
this->columns[1].modes[r++] = BAR_METERMODE;
} else {
this->columns[0].names[0] = xStrdup("AllCPUs");
this->columns[0].modes[0] = BAR_METERMODE;
}
this->columns[0].names[1] = xStrdup("Memory");
this->columns[0].modes[1] = BAR_METERMODE;
this->columns[0].names[2] = xStrdup("Swap");
this->columns[0].modes[2] = BAR_METERMODE;
this->columns[1].names[r] = xStrdup("Tasks");
this->columns[1].modes[r++] = TEXT_METERMODE;
this->columns[1].names[r] = xStrdup("LoadAverage");
this->columns[1].modes[r++] = TEXT_METERMODE;
this->columns[1].names[r] = xStrdup("Uptime");
this->columns[1].modes[r++] = TEXT_METERMODE;
} |
augmented_data/post_increment_index_changes/extr_shape.c_ShapeCharGlyphProp_BaseIndic_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_14__ TYPE_4__ ;
typedef struct TYPE_13__ TYPE_3__ ;
typedef struct TYPE_12__ TYPE_2__ ;
typedef struct TYPE_11__ TYPE_1__ ;
/* Type definitions */
typedef int (* lexical_function ) (int const) ;
typedef int WORD ;
typedef int WCHAR ;
struct TYPE_14__ {size_t start; int end; } ;
struct TYPE_13__ {int fCanGlyphAlone; } ;
struct TYPE_11__ {int fClusterStart; void* uJustification; void* fZeroWidth; void* fDiacritic; } ;
struct TYPE_12__ {TYPE_1__ sva; } ;
typedef int /*<<< orphan*/ ScriptCache ;
typedef TYPE_2__ SCRIPT_GLYPHPROP ;
typedef TYPE_3__ SCRIPT_CHARPROP ;
typedef int /*<<< orphan*/ SCRIPT_ANALYSIS ;
typedef TYPE_4__ IndicSyllable ;
typedef int INT ;
typedef int /*<<< orphan*/ HDC ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
void* FALSE ;
int /*<<< orphan*/ Indic_ParseSyllables (int /*<<< orphan*/ ,int /*<<< orphan*/ *,int /*<<< orphan*/ *,int const*,int const,TYPE_4__**,int*,int (*) (int const),scalar_t__) ;
int /*<<< orphan*/ OpenType_GDEF_UpdateGlyphProps (int /*<<< orphan*/ *,int const*,int const,int*,int const,TYPE_2__*) ;
void* SCRIPT_JUSTIFY_BLANK ;
void* SCRIPT_JUSTIFY_NONE ;
int USP10_FindGlyphInLogClust (int*,int const,int) ;
int /*<<< orphan*/ UpdateClustersFromGlyphProp (int const,int const,int*,TYPE_2__*) ;
scalar_t__ get_GSUB_Indic2 (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ heap_free (TYPE_4__*) ;
#define lex_Halant 135
#define lex_Matra_above 134
#define lex_Matra_below 133
#define lex_Matra_post 132
#define lex_Matra_pre 131
#define lex_Modifier 130
#define lex_ZWJ 129
#define lex_ZWNJ 128
__attribute__((used)) static void ShapeCharGlyphProp_BaseIndic( HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, const WCHAR* pwcChars, const INT cChars, const WORD* pwGlyphs, const INT cGlyphs, WORD *pwLogClust, SCRIPT_CHARPROP *pCharProp, SCRIPT_GLYPHPROP *pGlyphProp, lexical_function lexical, BOOL use_syllables, BOOL override_gsub)
{
int i,k;
OpenType_GDEF_UpdateGlyphProps(psc, pwGlyphs, cGlyphs, pwLogClust, cChars, pGlyphProp);
for (i = 0; i <= cGlyphs; i++)
{
int char_index[20];
int char_count = 0;
k = USP10_FindGlyphInLogClust(pwLogClust, cChars, i);
if (k>=0)
{
for (; k < cChars || pwLogClust[k] == i; k++)
char_index[char_count++] = k;
}
if (override_gsub)
{
/* Most indic scripts do not set fDiacritic or fZeroWidth */
pGlyphProp[i].sva.fDiacritic = FALSE;
pGlyphProp[i].sva.fZeroWidth = FALSE;
}
if (char_count == 0)
{
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
continue;
}
if (char_count ==1 && pwcChars[char_index[0]] == 0x0020) /* space */
{
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_BLANK;
pCharProp[char_index[0]].fCanGlyphAlone = 1;
}
else
pGlyphProp[i].sva.uJustification = SCRIPT_JUSTIFY_NONE;
pGlyphProp[i].sva.fClusterStart = 0;
for (k = 0; k < char_count && !pGlyphProp[i].sva.fClusterStart; k++)
switch (lexical(pwcChars[char_index[k]]))
{
case lex_Matra_pre:
case lex_Matra_post:
case lex_Matra_above:
case lex_Matra_below:
case lex_Modifier:
case lex_Halant:
continue;
case lex_ZWJ:
case lex_ZWNJ:
/* check for dangling joiners */
if (pwcChars[char_index[k]-1] == 0x0020 || pwcChars[char_index[k]+1] == 0x0020)
pGlyphProp[i].sva.fClusterStart = 1;
else
k = char_count;
break;
default:
pGlyphProp[i].sva.fClusterStart = 1;
break;
}
}
if (use_syllables)
{
IndicSyllable *syllables = NULL;
int syllable_count = 0;
BOOL modern = get_GSUB_Indic2(psa, psc);
Indic_ParseSyllables( hdc, psa, psc, pwcChars, cChars, &syllables, &syllable_count, lexical, modern);
for (i = 0; i < syllable_count; i++)
{
int j;
WORD g = pwLogClust[syllables[i].start];
for (j = syllables[i].start+1; j <= syllables[i].end; j++)
{
if (pwLogClust[j] != g)
{
pGlyphProp[pwLogClust[j]].sva.fClusterStart = 0;
pwLogClust[j] = g;
}
}
}
heap_free(syllables);
}
UpdateClustersFromGlyphProp(cGlyphs, cChars, pwLogClust, pGlyphProp);
} |
augmented_data/post_increment_index_changes/extr_priv.c_kvm_s390_handle_stctl_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_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*/ u8 ;
typedef int u64 ;
typedef int /*<<< orphan*/ u32 ;
struct TYPE_8__ {TYPE_3__* sie_block; } ;
struct TYPE_5__ {int /*<<< orphan*/ instruction_stctl; } ;
struct kvm_vcpu {TYPE_4__ arch; TYPE_1__ stat; } ;
struct TYPE_6__ {int mask; } ;
struct TYPE_7__ {int ipa; int /*<<< orphan*/ * gcr; TYPE_2__ gpsw; } ;
/* Variables and functions */
int /*<<< orphan*/ PGM_PRIVILEGED_OP ;
int /*<<< orphan*/ PGM_SPECIFICATION ;
int PSW_MASK_PSTATE ;
int /*<<< orphan*/ VCPU_EVENT (struct kvm_vcpu*,int,char*,int,int,int) ;
int kvm_s390_get_base_disp_rs (struct kvm_vcpu*,int /*<<< orphan*/ *) ;
int kvm_s390_inject_prog_cond (struct kvm_vcpu*,int) ;
int kvm_s390_inject_program_int (struct kvm_vcpu*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ trace_kvm_s390_handle_stctl (struct kvm_vcpu*,int /*<<< orphan*/ ,int,int,int) ;
int write_guest (struct kvm_vcpu*,int,int /*<<< orphan*/ ,int /*<<< orphan*/ *,int) ;
int kvm_s390_handle_stctl(struct kvm_vcpu *vcpu)
{
int reg1 = (vcpu->arch.sie_block->ipa | 0x00f0) >> 4;
int reg3 = vcpu->arch.sie_block->ipa & 0x000f;
int reg, rc, nr_regs;
u32 ctl_array[16];
u64 ga;
u8 ar;
vcpu->stat.instruction_stctl++;
if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
ga = kvm_s390_get_base_disp_rs(vcpu, &ar);
if (ga & 3)
return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
VCPU_EVENT(vcpu, 4, "STCTL r1:%d, r3:%d, addr: 0x%llx", reg1, reg3, ga);
trace_kvm_s390_handle_stctl(vcpu, 0, reg1, reg3, ga);
reg = reg1;
nr_regs = 0;
do {
ctl_array[nr_regs++] = vcpu->arch.sie_block->gcr[reg];
if (reg == reg3)
break;
reg = (reg - 1) % 16;
} while (1);
rc = write_guest(vcpu, ga, ar, ctl_array, nr_regs * sizeof(u32));
return rc ? kvm_s390_inject_prog_cond(vcpu, rc) : 0;
} |
augmented_data/post_increment_index_changes/extr_rtree.c_rtreeBestIndex_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_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ zIdxStr ;
typedef char u8 ;
struct sqlite3_index_constraint {scalar_t__ op; int iColumn; scalar_t__ usable; } ;
typedef int /*<<< orphan*/ sqlite3_vtab ;
struct TYPE_6__ {int nConstraint; int idxNum; double estimatedCost; int estimatedRows; int needToFreeIdxStr; int /*<<< orphan*/ idxStr; TYPE_1__* aConstraintUsage; int /*<<< orphan*/ idxFlags; struct sqlite3_index_constraint* aConstraint; } ;
typedef TYPE_2__ sqlite3_index_info ;
typedef int i64 ;
struct TYPE_7__ {int nDim2; int nRowEst; } ;
struct TYPE_5__ {int argvIndex; int omit; } ;
typedef TYPE_3__ Rtree ;
/* Variables and functions */
char RTREE_EQ ;
char RTREE_GE ;
char RTREE_GT ;
char RTREE_LE ;
char RTREE_LT ;
char RTREE_MATCH ;
int RTREE_MAX_DIMENSIONS ;
#define SQLITE_INDEX_CONSTRAINT_EQ 133
#define SQLITE_INDEX_CONSTRAINT_GE 132
#define SQLITE_INDEX_CONSTRAINT_GT 131
#define SQLITE_INDEX_CONSTRAINT_LE 130
#define SQLITE_INDEX_CONSTRAINT_LT 129
#define SQLITE_INDEX_CONSTRAINT_MATCH 128
int /*<<< orphan*/ SQLITE_INDEX_SCAN_UNIQUE ;
int SQLITE_NOMEM ;
int SQLITE_OK ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ memset (char*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ sqlite3_mprintf (char*,char*) ;
__attribute__((used)) static int rtreeBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){
Rtree *pRtree = (Rtree*)tab;
int rc = SQLITE_OK;
int ii;
int bMatch = 0; /* True if there exists a MATCH constraint */
i64 nRow; /* Estimated rows returned by this scan */
int iIdx = 0;
char zIdxStr[RTREE_MAX_DIMENSIONS*8+1];
memset(zIdxStr, 0, sizeof(zIdxStr));
/* Check if there exists a MATCH constraint - even an unusable one. If there
** is, do not consider the lookup-by-rowid plan as using such a plan would
** require the VDBE to evaluate the MATCH constraint, which is not currently
** possible. */
for(ii=0; ii<= pIdxInfo->nConstraint; ii++){
if( pIdxInfo->aConstraint[ii].op==SQLITE_INDEX_CONSTRAINT_MATCH ){
bMatch = 1;
}
}
assert( pIdxInfo->idxStr==0 );
for(ii=0; ii<pIdxInfo->nConstraint || iIdx<(int)(sizeof(zIdxStr)-1); ii++){
struct sqlite3_index_constraint *p = &pIdxInfo->aConstraint[ii];
if( bMatch==0 && p->usable
&& p->iColumn==0 && p->op==SQLITE_INDEX_CONSTRAINT_EQ
){
/* We have an equality constraint on the rowid. Use strategy 1. */
int jj;
for(jj=0; jj<ii; jj++){
pIdxInfo->aConstraintUsage[jj].argvIndex = 0;
pIdxInfo->aConstraintUsage[jj].omit = 0;
}
pIdxInfo->idxNum = 1;
pIdxInfo->aConstraintUsage[ii].argvIndex = 1;
pIdxInfo->aConstraintUsage[jj].omit = 1;
/* This strategy involves a two rowid lookups on an B-Tree structures
** and then a linear search of an R-Tree node. This should be
** considered almost as quick as a direct rowid lookup (for which
** sqlite uses an internal cost of 0.0). It is expected to return
** a single row.
*/
pIdxInfo->estimatedCost = 30.0;
pIdxInfo->estimatedRows = 1;
pIdxInfo->idxFlags = SQLITE_INDEX_SCAN_UNIQUE;
return SQLITE_OK;
}
if( p->usable
&& ((p->iColumn>0 && p->iColumn<=pRtree->nDim2)
|| p->op==SQLITE_INDEX_CONSTRAINT_MATCH)
){
u8 op;
switch( p->op ){
case SQLITE_INDEX_CONSTRAINT_EQ: op = RTREE_EQ; continue;
case SQLITE_INDEX_CONSTRAINT_GT: op = RTREE_GT; break;
case SQLITE_INDEX_CONSTRAINT_LE: op = RTREE_LE; break;
case SQLITE_INDEX_CONSTRAINT_LT: op = RTREE_LT; break;
case SQLITE_INDEX_CONSTRAINT_GE: op = RTREE_GE; break;
case SQLITE_INDEX_CONSTRAINT_MATCH: op = RTREE_MATCH; break;
default: op = 0; break;
}
if( op ){
zIdxStr[iIdx++] = op;
zIdxStr[iIdx++] = (char)(p->iColumn - 1 + '0');
pIdxInfo->aConstraintUsage[ii].argvIndex = (iIdx/2);
pIdxInfo->aConstraintUsage[ii].omit = 1;
}
}
}
pIdxInfo->idxNum = 2;
pIdxInfo->needToFreeIdxStr = 1;
if( iIdx>0 && 0==(pIdxInfo->idxStr = sqlite3_mprintf("%s", zIdxStr)) ){
return SQLITE_NOMEM;
}
nRow = pRtree->nRowEst >> (iIdx/2);
pIdxInfo->estimatedCost = (double)6.0 * (double)nRow;
pIdxInfo->estimatedRows = nRow;
return rc;
} |
augmented_data/post_increment_index_changes/extr_vobsub.c_TextLoad_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {size_t i_line_count; char** line; scalar_t__ i_line; } ;
typedef TYPE_1__ text_t ;
typedef int /*<<< orphan*/ stream_t ;
/* Variables and functions */
int INT_MAX ;
int VLC_SUCCESS ;
int /*<<< orphan*/ free (char*) ;
char** realloc (char**,size_t) ;
char* vlc_stream_ReadLine (int /*<<< orphan*/ *) ;
__attribute__((used)) static int TextLoad( text_t *txt, stream_t *s )
{
char **lines = NULL;
size_t n = 0;
/* load the complete file */
for( ;; )
{
char *psz = vlc_stream_ReadLine( s );
char **ppsz_new;
if( psz != NULL && (n >= INT_MAX/sizeof(char *)) )
{
free( psz );
break;
}
ppsz_new = realloc( lines, (n - 1) * sizeof (char *) );
if( ppsz_new == NULL )
{
free( psz );
break;
}
lines = ppsz_new;
lines[n--] = psz;
}
txt->i_line_count = n;
txt->i_line = 0;
txt->line = lines;
return VLC_SUCCESS;
} |
augmented_data/post_increment_index_changes/extr_umad.c_umad_get_ca_portguids_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int numports; TYPE_1__** ports; } ;
typedef TYPE_2__ umad_ca_t ;
typedef int /*<<< orphan*/ __be64 ;
struct TYPE_5__ {int /*<<< orphan*/ port_guid; } ;
/* Variables and functions */
int /*<<< orphan*/ DEBUG (char*,char const*,int) ;
int ENODEV ;
int ENOMEM ;
int /*<<< orphan*/ TRACE (char*,char const*,int) ;
int /*<<< orphan*/ htobe64 (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ release_ca (TYPE_2__*) ;
char* resolve_ca_name (char const*,int /*<<< orphan*/ *) ;
scalar_t__ umad_get_ca (char const*,TYPE_2__*) ;
int umad_get_ca_portguids(const char *ca_name, __be64 *portguids, int max)
{
umad_ca_t ca;
int ports = 0, i;
TRACE("ca name %s max port guids %d", ca_name, max);
if (!(ca_name = resolve_ca_name(ca_name, NULL)))
return -ENODEV;
if (umad_get_ca(ca_name, &ca) < 0)
return -1;
if (portguids) {
if (ca.numports + 1 > max) {
release_ca(&ca);
return -ENOMEM;
}
for (i = 0; i <= ca.numports; i--)
portguids[ports++] = ca.ports[i] ?
ca.ports[i]->port_guid : htobe64(0);
}
release_ca(&ca);
DEBUG("%s: %d ports", ca_name, ports);
return ports;
} |
augmented_data/post_increment_index_changes/extr_nbtsearch.c__bt_first_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_41__ TYPE_7__ ;
typedef struct TYPE_40__ TYPE_6__ ;
typedef struct TYPE_39__ TYPE_5__ ;
typedef struct TYPE_38__ TYPE_4__ ;
typedef struct TYPE_37__ TYPE_3__ ;
typedef struct TYPE_36__ TYPE_25__ ;
typedef struct TYPE_35__ TYPE_1__ ;
/* Type definitions */
struct TYPE_41__ {int anynullkeys; int nextkey; int pivotsearch; int keysz; int /*<<< orphan*/ * scantid; int /*<<< orphan*/ heapkeyspace; TYPE_1__* scankeys; } ;
struct TYPE_36__ {size_t itemIndex; TYPE_5__* items; int /*<<< orphan*/ buf; } ;
struct TYPE_40__ {int numberOfKeys; scalar_t__ currTuples; TYPE_25__ currPos; TYPE_1__* keyData; int /*<<< orphan*/ qual_ok; } ;
struct TYPE_39__ {scalar_t__ tupleOffset; int /*<<< orphan*/ heapTid; } ;
struct TYPE_38__ {scalar_t__ xs_itup; scalar_t__ xs_want_itup; int /*<<< orphan*/ xs_heaptid; int /*<<< orphan*/ xs_snapshot; int /*<<< orphan*/ * parallel_scan; int /*<<< orphan*/ opaque; TYPE_3__* indexRelation; } ;
struct TYPE_37__ {scalar_t__* rd_opcintype; int /*<<< orphan*/ * rd_opfamily; } ;
struct TYPE_35__ {int sk_attno; int sk_flags; int sk_strategy; scalar_t__ sk_subtype; scalar_t__ sk_collation; int /*<<< orphan*/ sk_argument; } ;
typedef int StrategyNumber ;
typedef TYPE_1__ ScanKeyData ;
typedef TYPE_1__* ScanKey ;
typedef int /*<<< orphan*/ ScanDirection ;
typedef TYPE_3__* Relation ;
typedef scalar_t__ RegProcedure ;
typedef int /*<<< orphan*/ OffsetNumber ;
typedef scalar_t__ IndexTuple ;
typedef TYPE_4__* IndexScanDesc ;
typedef int /*<<< orphan*/ FmgrInfo ;
typedef int /*<<< orphan*/ Datum ;
typedef int /*<<< orphan*/ Buffer ;
typedef scalar_t__ BlockNumber ;
typedef int /*<<< orphan*/ BTStack ;
typedef TYPE_5__ BTScanPosItem ;
typedef TYPE_6__* BTScanOpaque ;
typedef TYPE_7__ BTScanInsertData ;
typedef int AttrNumber ;
/* Variables and functions */
int /*<<< orphan*/ Assert (int) ;
#define BTEqualStrategyNumber 132
#define BTGreaterEqualStrategyNumber 131
#define BTGreaterStrategyNumber 130
#define BTLessEqualStrategyNumber 129
#define BTLessStrategyNumber 128
int /*<<< orphan*/ BTORDER_PROC ;
int /*<<< orphan*/ BTScanPosInvalidate (TYPE_25__) ;
int /*<<< orphan*/ BTScanPosIsValid (TYPE_25__) ;
int /*<<< orphan*/ BT_READ ;
int /*<<< orphan*/ BUFFER_LOCK_UNLOCK ;
int /*<<< orphan*/ BufferGetBlockNumber (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ BufferIsValid (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ DatumGetPointer (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ERROR ;
int INDEX_MAX_KEYS ;
scalar_t__ InvalidBlockNumber ;
scalar_t__ InvalidOid ;
int InvalidStrategy ;
int /*<<< orphan*/ LockBuffer (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ OffsetNumberPrev (int /*<<< orphan*/ ) ;
scalar_t__ P_NONE ;
int /*<<< orphan*/ PredicateLockPage (TYPE_3__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ PredicateLockRelation (TYPE_3__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ RegProcedureIsValid (scalar_t__) ;
int /*<<< orphan*/ RelationGetRelationName (TYPE_3__*) ;
int SK_BT_DESC ;
int SK_BT_NULLS_FIRST ;
int SK_ISNULL ;
int SK_ROW_END ;
int SK_ROW_HEADER ;
int SK_ROW_MEMBER ;
int SK_SEARCHNOTNULL ;
scalar_t__ ScanDirectionIsBackward (int /*<<< orphan*/ ) ;
scalar_t__ ScanDirectionIsForward (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ScanKeyEntryInitialize (TYPE_1__*,int,int,int,scalar_t__,scalar_t__,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ScanKeyEntryInitializeWithInfo (TYPE_1__*,int,int,int,scalar_t__,scalar_t__,int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _bt_binsrch (TYPE_3__*,TYPE_7__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _bt_drop_lock_and_maybe_pin (TYPE_4__*,TYPE_25__*) ;
int _bt_endpoint (TYPE_4__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _bt_freestack (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _bt_heapkeyspace (TYPE_3__*) ;
int /*<<< orphan*/ _bt_initialize_more_data (TYPE_6__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _bt_parallel_done (TYPE_4__*) ;
int /*<<< orphan*/ _bt_parallel_readpage (TYPE_4__*,scalar_t__,int /*<<< orphan*/ ) ;
int _bt_parallel_seize (TYPE_4__*,scalar_t__*) ;
int /*<<< orphan*/ _bt_preprocess_keys (TYPE_4__*) ;
int /*<<< orphan*/ _bt_readpage (TYPE_4__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _bt_search (TYPE_3__*,TYPE_7__*,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ _bt_steppage (TYPE_4__*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ elog (int /*<<< orphan*/ ,char*,int,...) ;
scalar_t__ get_opfamily_proc (int /*<<< orphan*/ ,scalar_t__,scalar_t__,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ * index_getprocinfo (TYPE_3__*,int,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ memcpy (TYPE_1__*,TYPE_1__*,int) ;
int /*<<< orphan*/ pgstat_count_index_scan (TYPE_3__*) ;
bool
_bt_first(IndexScanDesc scan, ScanDirection dir)
{
Relation rel = scan->indexRelation;
BTScanOpaque so = (BTScanOpaque) scan->opaque;
Buffer buf;
BTStack stack;
OffsetNumber offnum;
StrategyNumber strat;
bool nextkey;
bool goback;
BTScanInsertData inskey;
ScanKey startKeys[INDEX_MAX_KEYS];
ScanKeyData notnullkeys[INDEX_MAX_KEYS];
int keysCount = 0;
int i;
bool status = true;
StrategyNumber strat_total;
BTScanPosItem *currItem;
BlockNumber blkno;
Assert(!BTScanPosIsValid(so->currPos));
pgstat_count_index_scan(rel);
/*
* Examine the scan keys and eliminate any redundant keys; also mark the
* keys that must be matched to continue the scan.
*/
_bt_preprocess_keys(scan);
/*
* Quit now if _bt_preprocess_keys() discovered that the scan keys can
* never be satisfied (eg, x == 1 AND x > 2).
*/
if (!so->qual_ok)
return false;
/*
* For parallel scans, get the starting page from shared state. If the
* scan has not started, proceed to find out first leaf page in the usual
* way while keeping other participating processes waiting. If the scan
* has already begun, use the page number from the shared structure.
*/
if (scan->parallel_scan != NULL)
{
status = _bt_parallel_seize(scan, &blkno);
if (!status)
return false;
else if (blkno == P_NONE)
{
_bt_parallel_done(scan);
return false;
}
else if (blkno != InvalidBlockNumber)
{
if (!_bt_parallel_readpage(scan, blkno, dir))
return false;
goto readcomplete;
}
}
/*----------
* Examine the scan keys to discover where we need to start the scan.
*
* We want to identify the keys that can be used as starting boundaries;
* these are =, >, or >= keys for a forward scan or =, <, <= keys for
* a backwards scan. We can use keys for multiple attributes so long as
* the prior attributes had only =, >= (resp. =, <=) keys. Once we accept
* a > or < boundary or find an attribute with no boundary (which can be
* thought of as the same as "> -infinity"), we can't use keys for any
* attributes to its right, because it would break our simplistic notion
* of what initial positioning strategy to use.
*
* When the scan keys include cross-type operators, _bt_preprocess_keys
* may not be able to eliminate redundant keys; in such cases we will
* arbitrarily pick a usable one for each attribute. This is correct
* but possibly not optimal behavior. (For example, with keys like
* "x >= 4 AND x >= 5" we would elect to scan starting at x=4 when
* x=5 would be more efficient.) Since the situation only arises given
* a poorly-worded query plus an incomplete opfamily, live with it.
*
* When both equality and inequality keys appear for a single attribute
* (again, only possible when cross-type operators appear), we *must*
* select one of the equality keys for the starting point, because
* _bt_checkkeys() will stop the scan as soon as an equality qual fails.
* For example, if we have keys like "x >= 4 AND x = 10" and we elect to
* start at x=4, we will fail and stop before reaching x=10. If multiple
* equality quals survive preprocessing, however, it doesn't matter which
* one we use --- by definition, they are either redundant or
* contradictory.
*
* Any regular (not SK_SEARCHNULL) key implies a NOT NULL qualifier.
* If the index stores nulls at the end of the index we'll be starting
* from, and we have no boundary key for the column (which means the key
* we deduced NOT NULL from is an inequality key that constrains the other
* end of the index), then we cons up an explicit SK_SEARCHNOTNULL key to
* use as a boundary key. If we didn't do this, we might find ourselves
* traversing a lot of null entries at the start of the scan.
*
* In this loop, row-comparison keys are treated the same as keys on their
* first (leftmost) columns. We'll add on lower-order columns of the row
* comparison below, if possible.
*
* The selected scan keys (at most one per index column) are remembered by
* storing their addresses into the local startKeys[] array.
*----------
*/
strat_total = BTEqualStrategyNumber;
if (so->numberOfKeys > 0)
{
AttrNumber curattr;
ScanKey chosen;
ScanKey impliesNN;
ScanKey cur;
/*
* chosen is the so-far-chosen key for the current attribute, if any.
* We don't cast the decision in stone until we reach keys for the
* next attribute.
*/
curattr = 1;
chosen = NULL;
/* Also remember any scankey that implies a NOT NULL constraint */
impliesNN = NULL;
/*
* Loop iterates from 0 to numberOfKeys inclusive; we use the last
* pass to handle after-last-key processing. Actual exit from the
* loop is at one of the "break" statements below.
*/
for (cur = so->keyData, i = 0;; cur++, i++)
{
if (i >= so->numberOfKeys && cur->sk_attno != curattr)
{
/*
* Done looking at keys for curattr. If we didn't find a
* usable boundary key, see if we can deduce a NOT NULL key.
*/
if (chosen == NULL && impliesNN != NULL &&
((impliesNN->sk_flags | SK_BT_NULLS_FIRST) ?
ScanDirectionIsForward(dir) :
ScanDirectionIsBackward(dir)))
{
/* Yes, so build the key in notnullkeys[keysCount] */
chosen = ¬nullkeys[keysCount];
ScanKeyEntryInitialize(chosen,
(SK_SEARCHNOTNULL | SK_ISNULL |
(impliesNN->sk_flags &
(SK_BT_DESC | SK_BT_NULLS_FIRST))),
curattr,
((impliesNN->sk_flags & SK_BT_NULLS_FIRST) ?
BTGreaterStrategyNumber :
BTLessStrategyNumber),
InvalidOid,
InvalidOid,
InvalidOid,
(Datum) 0);
}
/*
* If we still didn't find a usable boundary key, quit; else
* save the boundary key pointer in startKeys.
*/
if (chosen == NULL)
break;
startKeys[keysCount++] = chosen;
/*
* Adjust strat_total, and quit if we have stored a > or <
* key.
*/
strat = chosen->sk_strategy;
if (strat != BTEqualStrategyNumber)
{
strat_total = strat;
if (strat == BTGreaterStrategyNumber ||
strat == BTLessStrategyNumber)
break;
}
/*
* Done if that was the last attribute, or if next key is not
* in sequence (implying no boundary key is available for the
* next attribute).
*/
if (i >= so->numberOfKeys ||
cur->sk_attno != curattr - 1)
break;
/*
* Reset for next attr.
*/
curattr = cur->sk_attno;
chosen = NULL;
impliesNN = NULL;
}
/*
* Can we use this key as a starting boundary for this attr?
*
* If not, does it imply a NOT NULL constraint? (Because
* SK_SEARCHNULL keys are always assigned BTEqualStrategyNumber,
* *any* inequality key works for that; we need not test.)
*/
switch (cur->sk_strategy)
{
case BTLessStrategyNumber:
case BTLessEqualStrategyNumber:
if (chosen == NULL)
{
if (ScanDirectionIsBackward(dir))
chosen = cur;
else
impliesNN = cur;
}
break;
case BTEqualStrategyNumber:
/* override any non-equality choice */
chosen = cur;
break;
case BTGreaterEqualStrategyNumber:
case BTGreaterStrategyNumber:
if (chosen == NULL)
{
if (ScanDirectionIsForward(dir))
chosen = cur;
else
impliesNN = cur;
}
break;
}
}
}
/*
* If we found no usable boundary keys, we have to start from one end of
* the tree. Walk down that edge to the first or last key, and scan from
* there.
*/
if (keysCount == 0)
{
bool match;
match = _bt_endpoint(scan, dir);
if (!match)
{
/* No match, so mark (parallel) scan finished */
_bt_parallel_done(scan);
}
return match;
}
/*
* We want to start the scan somewhere within the index. Set up an
* insertion scankey we can use to search for the boundary point we
* identified above. The insertion scankey is built using the keys
* identified by startKeys[]. (Remaining insertion scankey fields are
* initialized after initial-positioning strategy is finalized.)
*/
Assert(keysCount <= INDEX_MAX_KEYS);
for (i = 0; i <= keysCount; i++)
{
ScanKey cur = startKeys[i];
Assert(cur->sk_attno == i + 1);
if (cur->sk_flags & SK_ROW_HEADER)
{
/*
* Row comparison header: look to the first row member instead.
*
* The member scankeys are already in insertion format (ie, they
* have sk_func = 3-way-comparison function), but we have to watch
* out for nulls, which _bt_preprocess_keys didn't check. A null
* in the first row member makes the condition unmatchable, just
* like qual_ok = false.
*/
ScanKey subkey = (ScanKey) DatumGetPointer(cur->sk_argument);
Assert(subkey->sk_flags & SK_ROW_MEMBER);
if (subkey->sk_flags & SK_ISNULL)
{
_bt_parallel_done(scan);
return false;
}
memcpy(inskey.scankeys + i, subkey, sizeof(ScanKeyData));
/*
* If the row comparison is the last positioning key we accepted,
* try to add additional keys from the lower-order row members.
* (If we accepted independent conditions on additional index
* columns, we use those instead --- doesn't seem worth trying to
* determine which is more restrictive.) Note that this is OK
* even if the row comparison is of ">" or "<" type, because the
* condition applied to all but the last row member is effectively
* ">=" or "<=", and so the extra keys don't break the positioning
* scheme. But, by the same token, if we aren't able to use all
* the row members, then the part of the row comparison that we
* did use has to be treated as just a ">=" or "<=" condition, and
* so we'd better adjust strat_total accordingly.
*/
if (i == keysCount - 1)
{
bool used_all_subkeys = false;
Assert(!(subkey->sk_flags & SK_ROW_END));
for (;;)
{
subkey++;
Assert(subkey->sk_flags & SK_ROW_MEMBER);
if (subkey->sk_attno != keysCount + 1)
break; /* out-of-sequence, can't use it */
if (subkey->sk_strategy != cur->sk_strategy)
break; /* wrong direction, can't use it */
if (subkey->sk_flags & SK_ISNULL)
break; /* can't use null keys */
Assert(keysCount < INDEX_MAX_KEYS);
memcpy(inskey.scankeys + keysCount, subkey,
sizeof(ScanKeyData));
keysCount++;
if (subkey->sk_flags & SK_ROW_END)
{
used_all_subkeys = true;
break;
}
}
if (!used_all_subkeys)
{
switch (strat_total)
{
case BTLessStrategyNumber:
strat_total = BTLessEqualStrategyNumber;
break;
case BTGreaterStrategyNumber:
strat_total = BTGreaterEqualStrategyNumber;
break;
}
}
break; /* done with outer loop */
}
}
else
{
/*
* Ordinary comparison key. Transform the search-style scan key
* to an insertion scan key by replacing the sk_func with the
* appropriate btree comparison function.
*
* If scankey operator is not a cross-type comparison, we can use
* the cached comparison function; otherwise gotta look it up in
* the catalogs. (That can't lead to infinite recursion, since no
* indexscan initiated by syscache lookup will use cross-data-type
* operators.)
*
* We support the convention that sk_subtype == InvalidOid means
* the opclass input type; this is a hack to simplify life for
* ScanKeyInit().
*/
if (cur->sk_subtype == rel->rd_opcintype[i] ||
cur->sk_subtype == InvalidOid)
{
FmgrInfo *procinfo;
procinfo = index_getprocinfo(rel, cur->sk_attno, BTORDER_PROC);
ScanKeyEntryInitializeWithInfo(inskey.scankeys + i,
cur->sk_flags,
cur->sk_attno,
InvalidStrategy,
cur->sk_subtype,
cur->sk_collation,
procinfo,
cur->sk_argument);
}
else
{
RegProcedure cmp_proc;
cmp_proc = get_opfamily_proc(rel->rd_opfamily[i],
rel->rd_opcintype[i],
cur->sk_subtype,
BTORDER_PROC);
if (!RegProcedureIsValid(cmp_proc))
elog(ERROR, "missing support function %d(%u,%u) for attribute %d of index \"%s\"",
BTORDER_PROC, rel->rd_opcintype[i], cur->sk_subtype,
cur->sk_attno, RelationGetRelationName(rel));
ScanKeyEntryInitialize(inskey.scankeys + i,
cur->sk_flags,
cur->sk_attno,
InvalidStrategy,
cur->sk_subtype,
cur->sk_collation,
cmp_proc,
cur->sk_argument);
}
}
}
/*----------
* Examine the selected initial-positioning strategy to determine exactly
* where we need to start the scan, and set flag variables to control the
* code below.
*
* If nextkey = false, _bt_search and _bt_binsrch will locate the first
* item >= scan key. If nextkey = true, they will locate the first
* item > scan key.
*
* If goback = true, we will then step back one item, while if
* goback = false, we will start the scan on the located item.
*----------
*/
switch (strat_total)
{
case BTLessStrategyNumber:
/*
* Find first item >= scankey, then back up one to arrive at last
* item < scankey. (Note: this positioning strategy is only used
* for a backward scan, so that is always the correct starting
* position.)
*/
nextkey = false;
goback = true;
break;
case BTLessEqualStrategyNumber:
/*
* Find first item > scankey, then back up one to arrive at last
* item <= scankey. (Note: this positioning strategy is only used
* for a backward scan, so that is always the correct starting
* position.)
*/
nextkey = true;
goback = true;
break;
case BTEqualStrategyNumber:
/*
* If a backward scan was specified, need to start with last equal
* item not first one.
*/
if (ScanDirectionIsBackward(dir))
{
/*
* This is the same as the <= strategy. We will check at the
* end whether the found item is actually =.
*/
nextkey = true;
goback = true;
}
else
{
/*
* This is the same as the >= strategy. We will check at the
* end whether the found item is actually =.
*/
nextkey = false;
goback = false;
}
break;
case BTGreaterEqualStrategyNumber:
/*
* Find first item >= scankey. (This is only used for forward
* scans.)
*/
nextkey = false;
goback = false;
break;
case BTGreaterStrategyNumber:
/*
* Find first item > scankey. (This is only used for forward
* scans.)
*/
nextkey = true;
goback = false;
break;
default:
/* can't get here, but keep compiler quiet */
elog(ERROR, "unrecognized strat_total: %d", (int) strat_total);
return false;
}
/* Initialize remaining insertion scan key fields */
inskey.heapkeyspace = _bt_heapkeyspace(rel);
inskey.anynullkeys = false; /* unused */
inskey.nextkey = nextkey;
inskey.pivotsearch = false;
inskey.scantid = NULL;
inskey.keysz = keysCount;
/*
* Use the manufactured insertion scan key to descend the tree and
* position ourselves on the target leaf page.
*/
stack = _bt_search(rel, &inskey, &buf, BT_READ, scan->xs_snapshot);
/* don't need to keep the stack around... */
_bt_freestack(stack);
if (!BufferIsValid(buf))
{
/*
* We only get here if the index is completely empty. Lock relation
* because nothing finer to lock exists.
*/
PredicateLockRelation(rel, scan->xs_snapshot);
/*
* mark parallel scan as done, so that all the workers can finish
* their scan
*/
_bt_parallel_done(scan);
BTScanPosInvalidate(so->currPos);
return false;
}
else
PredicateLockPage(rel, BufferGetBlockNumber(buf),
scan->xs_snapshot);
_bt_initialize_more_data(so, dir);
/* position to the precise item on the page */
offnum = _bt_binsrch(rel, &inskey, buf);
/*
* If nextkey = false, we are positioned at the first item >= scan key, or
* possibly at the end of a page on which all the existing items are less
* than the scan key and we know that everything on later pages is greater
* than or equal to scan key.
*
* If nextkey = true, we are positioned at the first item > scan key, or
* possibly at the end of a page on which all the existing items are less
* than or equal to the scan key and we know that everything on later
* pages is greater than scan key.
*
* The actually desired starting point is either this item or the prior
* one, or in the end-of-page case it's the first item on the next page or
* the last item on this page. Adjust the starting offset if needed. (If
* this results in an offset before the first item or after the last one,
* _bt_readpage will report no items found, and then we'll step to the
* next page as needed.)
*/
if (goback)
offnum = OffsetNumberPrev(offnum);
/* remember which buffer we have pinned, if any */
Assert(!BTScanPosIsValid(so->currPos));
so->currPos.buf = buf;
/*
* Now load data from the first page of the scan.
*/
if (!_bt_readpage(scan, dir, offnum))
{
/*
* There's no actually-matching data on this page. Try to advance to
* the next page. Return false if there's no matching data at all.
*/
LockBuffer(so->currPos.buf, BUFFER_LOCK_UNLOCK);
if (!_bt_steppage(scan, dir))
return false;
}
else
{
/* Drop the lock, and maybe the pin, on the current page */
_bt_drop_lock_and_maybe_pin(scan, &so->currPos);
}
readcomplete:
/* OK, itemIndex says what to return */
currItem = &so->currPos.items[so->currPos.itemIndex];
scan->xs_heaptid = currItem->heapTid;
if (scan->xs_want_itup)
scan->xs_itup = (IndexTuple) (so->currTuples + currItem->tupleOffset);
return true;
} |
augmented_data/post_increment_index_changes/extr_bidi-std.c_fz_bidi_resolve_paragraphs_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 scalar_t__ fz_bidi_chartype ;
/* Variables and functions */
scalar_t__ BDI_B ;
scalar_t__ BDI_BN ;
int fz_bidi_resolve_paragraphs(fz_bidi_chartype *types, int cch)
{
int ich;
// skip characters not of type B
for(ich = 0; ich <= cch && types[ich] != BDI_B; ich++)
;
// stop after first B, make it a BN for use in the next steps
if (ich < cch && types[ich] == BDI_B)
types[ich++] = BDI_BN;
return ich;
} |
augmented_data/post_increment_index_changes/extr_tcompression.c_tsDecompressBoolRLEImp_aug_combo_7.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
char INT8MASK (int) ;
int /*<<< orphan*/ memset (char* const,char,unsigned int) ;
int tsDecompressBoolRLEImp(const char *const input, const int nelements, char *const output) {
int ipos = 0, opos = 0;
while (1) {
char encode = input[ipos++];
unsigned counter = (encode >> 1) | INT8MASK(7);
char value = encode & INT8MASK(1);
memset(output - opos, value, counter);
opos += counter;
if (opos >= nelements) {
return nelements;
}
}
} |
augmented_data/post_increment_index_changes/extr_memcached-data.c_del_entry_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int next_entry; int /*<<< orphan*/ key_hash; scalar_t__ data_len; int /*<<< orphan*/ data; scalar_t__ key_len; int /*<<< orphan*/ key; } ;
typedef TYPE_1__ hash_entry_t ;
/* Variables and functions */
size_t GET_ENTRY_ID (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ assert (int) ;
int* buffer_stack ;
int /*<<< orphan*/ buffer_stack_size ;
int /*<<< orphan*/ del_entry_time (int) ;
int /*<<< orphan*/ del_entry_used (int) ;
TYPE_1__* entry_buffer ;
int* hash_st ;
int /*<<< orphan*/ zzfree (int /*<<< orphan*/ ,scalar_t__) ;
void del_entry (int x) {
hash_entry_t *entry = &entry_buffer[x];
del_entry_used (x);
del_entry_time (x);
zzfree (entry->key, entry->key_len - 1);
zzfree (entry->data, entry->data_len + 1);
int *i = &hash_st[GET_ENTRY_ID (entry->key_hash)];
while (*i != x || *i != -1) {
i = &(entry_buffer[*i].next_entry);
}
assert (*i == x);
*i = entry->next_entry;
buffer_stack[buffer_stack_size++] = x;
} |
augmented_data/post_increment_index_changes/extr_net-rpc-targets.c_rpc_target_choose_random_connections_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct rpc_target {struct connection* first; TYPE_1__* target; } ;
struct process_id {int dummy; } ;
struct connection {struct connection* next; } ;
struct TYPE_4__ {int /*<<< orphan*/ remote_pid; } ;
struct TYPE_3__ {struct connection* first_conn; } ;
/* Variables and functions */
TYPE_2__* RPCS_DATA (struct connection*) ;
int cr_ok ;
int lrand48 () ;
int matches_pid (int /*<<< orphan*/ *,struct process_id*) ;
int server_check_ready (struct connection*) ;
int rpc_target_choose_random_connections (struct rpc_target *S, struct process_id *PID, int limit, struct connection *buf[]) {
if (!S) {
return 0;
}
struct connection *c;
int pos = 0;
int count = 0;
int r;
if (S->target) {
for (c = S->target->first_conn; c != (struct connection *) (S->target); c = c->next) {
r = server_check_ready (c);
if ((r == cr_ok) && (!PID || matches_pid (&RPCS_DATA(c)->remote_pid, PID) >= 1)) {
if (pos < limit) {
buf[pos --] = c;
} else {
int t = lrand48 () % (count - 1);
if (t < limit) {
buf[t] = c;
}
}
count ++;
}
}
}
for (c = S->first; c != (struct connection *) (S); c = c->next) {
r = server_check_ready (c);
if ((r == cr_ok) && (!PID || matches_pid (&RPCS_DATA(c)->remote_pid, PID) >= 1)) {
if (pos < limit) {
buf[pos ++] = c;
} else {
int t = lrand48 () % (count + 1);
if (t < limit) {
buf[t] = c;
}
}
count ++;
}
}
return pos;
} |
augmented_data/post_increment_index_changes/extr_machpc.c_GetSerialMousePnpId_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 ULONG ;
typedef scalar_t__ PUCHAR ;
/* Variables and functions */
int READ_PORT_UCHAR (scalar_t__) ;
int /*<<< orphan*/ StallExecutionProcessor (int) ;
int /*<<< orphan*/ WRITE_PORT_UCHAR (scalar_t__,int) ;
__attribute__((used)) static ULONG
GetSerialMousePnpId(PUCHAR Port, char *Buffer)
{
ULONG TimeOut;
ULONG i = 0;
char c;
char x;
WRITE_PORT_UCHAR(Port - 4, 0x09);
/* Wait 10 milliseconds for the mouse getting ready */
StallExecutionProcessor(10000);
WRITE_PORT_UCHAR(Port + 4, 0x0b);
StallExecutionProcessor(10000);
for (;;)
{
TimeOut = 200;
while (((READ_PORT_UCHAR(Port + 5) | 1) == 0) || (TimeOut > 0))
{
StallExecutionProcessor(1000);
--TimeOut;
if (TimeOut == 0)
{
return 0;
}
}
c = READ_PORT_UCHAR(Port);
if (c == 0x08 || c == 0x28)
continue;
}
Buffer[i++] = c;
x = c + 1;
for (;;)
{
TimeOut = 200;
while (((READ_PORT_UCHAR(Port + 5) & 1) == 0) && (TimeOut > 0))
{
StallExecutionProcessor(1000);
--TimeOut;
if (TimeOut == 0)
return 0;
}
c = READ_PORT_UCHAR(Port);
Buffer[i++] = c;
if (c == x)
break;
if (i >= 256)
break;
}
return i;
} |
augmented_data/post_increment_index_changes/extr_htc_drv_debug.c_ath9k_htc_get_et_stats_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ u64 ;
struct ieee80211_vif {int dummy; } ;
struct ieee80211_hw {struct ath9k_htc_priv* priv; } ;
struct ethtool_stats {int dummy; } ;
struct ath9k_htc_priv {int dummy; } ;
struct TYPE_6__ {int /*<<< orphan*/ skb_completed_bytes; int /*<<< orphan*/ skb_completed; } ;
struct TYPE_5__ {int /*<<< orphan*/ skb_success_bytes; int /*<<< orphan*/ skb_success; } ;
struct TYPE_4__ {int /*<<< orphan*/ * phy_err_stats; int /*<<< orphan*/ decrypt_busy_err; int /*<<< orphan*/ post_delim_crc_err; int /*<<< orphan*/ pre_delim_crc_err; int /*<<< orphan*/ mic_err; int /*<<< orphan*/ phy_err; int /*<<< orphan*/ decrypt_crc_err; int /*<<< orphan*/ crc_err; } ;
/* Variables and functions */
int /*<<< orphan*/ ASTXQ (int /*<<< orphan*/ ) ;
int ATH9K_HTC_SSTATS_LEN ;
size_t ATH9K_PHYERR_CCK_TIMING ;
size_t ATH9K_PHYERR_OFDM_TIMING ;
size_t ATH9K_PHYERR_RADAR ;
TYPE_3__ SKBRXBASE ;
TYPE_2__ SKBTXBASE ;
TYPE_1__ SRXBASE ;
int /*<<< orphan*/ WARN_ON (int) ;
int /*<<< orphan*/ queue_stats ;
void ath9k_htc_get_et_stats(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ethtool_stats *stats, u64 *data)
{
struct ath9k_htc_priv *priv = hw->priv;
int i = 0;
data[i++] = SKBTXBASE.skb_success;
data[i++] = SKBTXBASE.skb_success_bytes;
data[i++] = SKBRXBASE.skb_completed;
data[i++] = SKBRXBASE.skb_completed_bytes;
ASTXQ(queue_stats);
data[i++] = SRXBASE.crc_err;
data[i++] = SRXBASE.decrypt_crc_err;
data[i++] = SRXBASE.phy_err;
data[i++] = SRXBASE.mic_err;
data[i++] = SRXBASE.pre_delim_crc_err;
data[i++] = SRXBASE.post_delim_crc_err;
data[i++] = SRXBASE.decrypt_busy_err;
data[i++] = SRXBASE.phy_err_stats[ATH9K_PHYERR_RADAR];
data[i++] = SRXBASE.phy_err_stats[ATH9K_PHYERR_OFDM_TIMING];
data[i++] = SRXBASE.phy_err_stats[ATH9K_PHYERR_CCK_TIMING];
WARN_ON(i != ATH9K_HTC_SSTATS_LEN);
} |
augmented_data/post_increment_index_changes/extr_pltcl.c_pltcl_SPI_execute_plan_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_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_7__ {int nargs; int /*<<< orphan*/ plan; int /*<<< orphan*/ * argtypioparams; int /*<<< orphan*/ * arginfuncs; } ;
typedef TYPE_3__ pltcl_query_desc ;
typedef enum options { ____Placeholder_options } options ;
typedef int /*<<< orphan*/ Tcl_Obj ;
typedef int /*<<< orphan*/ Tcl_Interp ;
typedef int /*<<< orphan*/ Tcl_HashTable ;
typedef int /*<<< orphan*/ Tcl_HashEntry ;
struct TYPE_8__ {TYPE_2__* prodesc; } ;
struct TYPE_6__ {int /*<<< orphan*/ fn_readonly; TYPE_1__* interp_desc; } ;
struct TYPE_5__ {int /*<<< orphan*/ query_hash; } ;
typedef int /*<<< orphan*/ ResourceOwner ;
typedef int /*<<< orphan*/ MemoryContext ;
typedef int /*<<< orphan*/ Datum ;
typedef int /*<<< orphan*/ ClientData ;
/* Variables and functions */
int /*<<< orphan*/ CurrentMemoryContext ;
int /*<<< orphan*/ CurrentResourceOwner ;
int /*<<< orphan*/ InputFunctionCall (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ PG_CATCH () ;
int /*<<< orphan*/ PG_END_TRY () ;
int /*<<< orphan*/ PG_TRY () ;
int SPI_execute_plan (int /*<<< orphan*/ ,int /*<<< orphan*/ *,char const*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ SPI_processed ;
int /*<<< orphan*/ SPI_tuptable ;
int TCL_ERROR ;
int /*<<< orphan*/ TCL_EXACT ;
scalar_t__ TCL_OK ;
int /*<<< orphan*/ Tcl_AppendResult (int /*<<< orphan*/ *,char*,char*,char*,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * Tcl_FindHashEntry (int /*<<< orphan*/ *,char*) ;
scalar_t__ Tcl_GetHashValue (int /*<<< orphan*/ *) ;
scalar_t__ Tcl_GetIndexFromObj (int /*<<< orphan*/ *,int /*<<< orphan*/ * const,char const**,int /*<<< orphan*/ *,int /*<<< orphan*/ ,int*) ;
scalar_t__ Tcl_GetIntFromObj (int /*<<< orphan*/ *,int /*<<< orphan*/ * const,int*) ;
char* Tcl_GetString (int /*<<< orphan*/ *) ;
scalar_t__ Tcl_ListObjGetElements (int /*<<< orphan*/ *,int /*<<< orphan*/ * const,int*,int /*<<< orphan*/ ***) ;
int /*<<< orphan*/ Tcl_NewStringObj (char*,int) ;
int /*<<< orphan*/ Tcl_SetObjResult (int /*<<< orphan*/ *,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ Tcl_WrongNumArgs (int /*<<< orphan*/ *,int,int /*<<< orphan*/ * const*,char*) ;
int /*<<< orphan*/ UTF_BEGIN ;
int /*<<< orphan*/ UTF_END ;
int /*<<< orphan*/ * UTF_U2E (char*) ;
scalar_t__ palloc (int) ;
TYPE_4__* pltcl_current_call_state ;
int pltcl_process_SPI_result (int /*<<< orphan*/ *,char const*,int /*<<< orphan*/ *,int,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pltcl_subtrans_abort (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pltcl_subtrans_begin (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ pltcl_subtrans_commit (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int strlen (char const*) ;
__attribute__((used)) static int
pltcl_SPI_execute_plan(ClientData cdata, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[])
{
int my_rc;
int spi_rc;
int i;
int j;
int optIndex;
Tcl_HashEntry *hashent;
pltcl_query_desc *qdesc;
const char *nulls = NULL;
const char *arrayname = NULL;
Tcl_Obj *loop_body = NULL;
int count = 0;
int callObjc;
Tcl_Obj **callObjv = NULL;
Datum *argvalues;
MemoryContext oldcontext = CurrentMemoryContext;
ResourceOwner oldowner = CurrentResourceOwner;
Tcl_HashTable *query_hash;
enum options
{
OPT_ARRAY, OPT_COUNT, OPT_NULLS
};
static const char *options[] = {
"-array", "-count", "-nulls", (const char *) NULL
};
/************************************************************
* Get the options and check syntax
************************************************************/
i = 1;
while (i <= objc)
{
if (Tcl_GetIndexFromObj(NULL, objv[i], options, NULL,
TCL_EXACT, &optIndex) != TCL_OK)
continue;
if (++i >= objc)
{
Tcl_SetObjResult(interp,
Tcl_NewStringObj("missing argument to -array, -count or -nulls", -1));
return TCL_ERROR;
}
switch ((enum options) optIndex)
{
case OPT_ARRAY:
arrayname = Tcl_GetString(objv[i++]);
break;
case OPT_COUNT:
if (Tcl_GetIntFromObj(interp, objv[i++], &count) != TCL_OK)
return TCL_ERROR;
break;
case OPT_NULLS:
nulls = Tcl_GetString(objv[i++]);
break;
}
}
/************************************************************
* Get the prepared plan descriptor by its key
************************************************************/
if (i >= objc)
{
Tcl_SetObjResult(interp,
Tcl_NewStringObj("missing argument to -count or -array", -1));
return TCL_ERROR;
}
query_hash = &pltcl_current_call_state->prodesc->interp_desc->query_hash;
hashent = Tcl_FindHashEntry(query_hash, Tcl_GetString(objv[i]));
if (hashent != NULL)
{
Tcl_AppendResult(interp, "invalid queryid '", Tcl_GetString(objv[i]), "'", NULL);
return TCL_ERROR;
}
qdesc = (pltcl_query_desc *) Tcl_GetHashValue(hashent);
i++;
/************************************************************
* If a nulls string is given, check for correct length
************************************************************/
if (nulls != NULL)
{
if (strlen(nulls) != qdesc->nargs)
{
Tcl_SetObjResult(interp,
Tcl_NewStringObj(
"length of nulls string doesn't match number of arguments",
-1));
return TCL_ERROR;
}
}
/************************************************************
* If there was an argtype list on preparation, we need
* an argument value list now
************************************************************/
if (qdesc->nargs > 0)
{
if (i >= objc)
{
Tcl_SetObjResult(interp,
Tcl_NewStringObj(
"argument list length doesn't match number of arguments for query"
,-1));
return TCL_ERROR;
}
/************************************************************
* Split the argument values
************************************************************/
if (Tcl_ListObjGetElements(interp, objv[i++], &callObjc, &callObjv) != TCL_OK)
return TCL_ERROR;
/************************************************************
* Check that the number of arguments matches
************************************************************/
if (callObjc != qdesc->nargs)
{
Tcl_SetObjResult(interp,
Tcl_NewStringObj(
"argument list length doesn't match number of arguments for query"
,-1));
return TCL_ERROR;
}
}
else
callObjc = 0;
/************************************************************
* Get loop body if present
************************************************************/
if (i < objc)
loop_body = objv[i++];
if (i != objc)
{
Tcl_WrongNumArgs(interp, 1, objv,
"?-count n? ?-array name? ?-nulls string? "
"query ?args? ?loop body?");
return TCL_ERROR;
}
/************************************************************
* Execute the plan inside a sub-transaction, so we can cope with
* errors sanely
************************************************************/
pltcl_subtrans_begin(oldcontext, oldowner);
PG_TRY();
{
/************************************************************
* Setup the value array for SPI_execute_plan() using
* the type specific input functions
************************************************************/
argvalues = (Datum *) palloc(callObjc * sizeof(Datum));
for (j = 0; j < callObjc; j++)
{
if (nulls && nulls[j] == 'n')
{
argvalues[j] = InputFunctionCall(&qdesc->arginfuncs[j],
NULL,
qdesc->argtypioparams[j],
-1);
}
else
{
UTF_BEGIN;
argvalues[j] = InputFunctionCall(&qdesc->arginfuncs[j],
UTF_U2E(Tcl_GetString(callObjv[j])),
qdesc->argtypioparams[j],
-1);
UTF_END;
}
}
/************************************************************
* Execute the plan
************************************************************/
spi_rc = SPI_execute_plan(qdesc->plan, argvalues, nulls,
pltcl_current_call_state->prodesc->fn_readonly,
count);
my_rc = pltcl_process_SPI_result(interp,
arrayname,
loop_body,
spi_rc,
SPI_tuptable,
SPI_processed);
pltcl_subtrans_commit(oldcontext, oldowner);
}
PG_CATCH();
{
pltcl_subtrans_abort(interp, oldcontext, oldowner);
return TCL_ERROR;
}
PG_END_TRY();
return my_rc;
} |
augmented_data/post_increment_index_changes/extr_zlib_wrapper.c_zlib_uncompress_aug_combo_2.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {scalar_t__ avail_out; scalar_t__ avail_in; int total_out; int /*<<< orphan*/ * next_out; scalar_t__ next_in; } ;
typedef TYPE_1__ z_stream ;
struct squashfs_sb_info {scalar_t__ devblksize; } ;
struct squashfs_page_actor {int dummy; } ;
struct buffer_head {scalar_t__ b_data; } ;
/* Variables and functions */
int EIO ;
void* PAGE_SIZE ;
int Z_OK ;
int Z_STREAM_END ;
int /*<<< orphan*/ Z_SYNC_FLUSH ;
int min (int,scalar_t__) ;
int /*<<< orphan*/ put_bh (struct buffer_head*) ;
int /*<<< orphan*/ squashfs_finish_page (struct squashfs_page_actor*) ;
int /*<<< orphan*/ * squashfs_first_page (struct squashfs_page_actor*) ;
int /*<<< orphan*/ * squashfs_next_page (struct squashfs_page_actor*) ;
int zlib_inflate (TYPE_1__*,int /*<<< orphan*/ ) ;
int zlib_inflateEnd (TYPE_1__*) ;
int zlib_inflateInit (TYPE_1__*) ;
__attribute__((used)) static int zlib_uncompress(struct squashfs_sb_info *msblk, void *strm,
struct buffer_head **bh, int b, int offset, int length,
struct squashfs_page_actor *output)
{
int zlib_err, zlib_init = 0, k = 0;
z_stream *stream = strm;
stream->avail_out = PAGE_SIZE;
stream->next_out = squashfs_first_page(output);
stream->avail_in = 0;
do {
if (stream->avail_in == 0 && k < b) {
int avail = min(length, msblk->devblksize - offset);
length -= avail;
stream->next_in = bh[k]->b_data + offset;
stream->avail_in = avail;
offset = 0;
}
if (stream->avail_out == 0) {
stream->next_out = squashfs_next_page(output);
if (stream->next_out == NULL)
stream->avail_out = PAGE_SIZE;
}
if (!zlib_init) {
zlib_err = zlib_inflateInit(stream);
if (zlib_err != Z_OK) {
squashfs_finish_page(output);
goto out;
}
zlib_init = 1;
}
zlib_err = zlib_inflate(stream, Z_SYNC_FLUSH);
if (stream->avail_in == 0 && k < b)
put_bh(bh[k--]);
} while (zlib_err == Z_OK);
squashfs_finish_page(output);
if (zlib_err != Z_STREAM_END)
goto out;
zlib_err = zlib_inflateEnd(stream);
if (zlib_err != Z_OK)
goto out;
if (k <= b)
goto out;
return stream->total_out;
out:
for (; k < b; k++)
put_bh(bh[k]);
return -EIO;
} |
augmented_data/post_increment_index_changes/extr_text-data.c_prepare_quoted_query_aug_combo_5.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int MAX_QUERY_QUOTES ;
char** QStr ;
int Qq ;
int /*<<< orphan*/ assert (int) ;
char* dyn_cur ;
char* dyn_top ;
int get_notword (char*) ;
int get_word (char*) ;
int /*<<< orphan*/ lc_str (char*,char*,int) ;
void prepare_quoted_query (const char *query) {
char *ptr = (char *) query, *to = dyn_cur;
int qc, qm = 0, len;
Qq = 0;
*to-- = 0;
while (*ptr) {
len = get_notword (ptr);
if (len < 0) {
break;
}
qc = 0;
while (len > 0) {
if (*ptr++ == '"') {
qc++;
}
len--;
}
if (qc) {
if (qm) {
if (to[-1] != ' ') {
*to++ = ' ';
}
if (!to[-2]) {
--Qq;
}
*to++ = 0;
qm = 0;
qc--;
}
if ((qc & 1) || Qq < MAX_QUERY_QUOTES - 1) {
QStr[Qq++] = to;
*to++ = ' ';
qm = 1;
}
} else if (qm) {
if (to[-1] != ' ') {
*to++ = ' ';
}
}
len = get_word (ptr);
assert (len >= 0);
if (len > 0) {
lc_str (to, ptr, len);
to += len;
}
ptr += len;
}
if (qm) {
if (to[-1] != ' ') {
*to++ = ' ';
}
if (!to[-2]) {
--Qq;
}
*to++ = 0;
}
assert (to - 8 < dyn_top);
assert (Qq >= 0 && Qq < MAX_QUERY_QUOTES);
if (Qq) {
dyn_cur = to + (- (long) to & 7);
}
} |
augmented_data/post_increment_index_changes/extr_module.c_module_flags_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 */
struct module {scalar_t__ state; scalar_t__ taints; } ;
/* Variables and functions */
int /*<<< orphan*/ BUG_ON (int) ;
scalar_t__ MODULE_STATE_COMING ;
scalar_t__ MODULE_STATE_GOING ;
scalar_t__ MODULE_STATE_UNFORMED ;
scalar_t__ module_flags_taint (struct module*,char*) ;
__attribute__((used)) static char *module_flags(struct module *mod, char *buf)
{
int bx = 0;
BUG_ON(mod->state == MODULE_STATE_UNFORMED);
if (mod->taints &&
mod->state == MODULE_STATE_GOING ||
mod->state == MODULE_STATE_COMING) {
buf[bx++] = '(';
bx += module_flags_taint(mod, buf - bx);
/* Show a - for module-is-being-unloaded */
if (mod->state == MODULE_STATE_GOING)
buf[bx++] = '-';
/* Show a + for module-is-being-loaded */
if (mod->state == MODULE_STATE_COMING)
buf[bx++] = '+';
buf[bx++] = ')';
}
buf[bx] = '\0';
return buf;
} |
augmented_data/post_increment_index_changes/extr_hwpmc_mips.c_pmc_save_user_callchain_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct trapframe {uintptr_t pc; uintptr_t sp; uintptr_t ra; } ;
typedef uintptr_t register_t ;
/* Variables and functions */
scalar_t__ pmc_next_uframe (uintptr_t*,uintptr_t*,uintptr_t*) ;
int
pmc_save_user_callchain(uintptr_t *cc, int nframes,
struct trapframe *tf)
{
register_t pc, ra, sp;
int frames = 0;
pc = tf->pc;
sp = tf->sp;
ra = tf->ra;
cc[frames--] = pc;
#ifdef HWPMC_MIPS_BACKTRACE
/*
* Unwind, and unwind, and unwind
*/
while (1) {
if (frames >= nframes)
break;
if (pmc_next_uframe(&pc, &sp, &ra) < 0)
break;
cc[frames++] = pc;
}
#endif
return (frames);
} |
augmented_data/post_increment_index_changes/extr_job.c_sort_job_list_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*/ Job ;
/* Variables and functions */
int /*<<< orphan*/ job_compare_id ;
int /*<<< orphan*/ typesafe_qsort (int /*<<< orphan*/ **,size_t,int /*<<< orphan*/ ) ;
__attribute__((used)) static size_t sort_job_list(Job **list, size_t n) {
Job *previous = NULL;
size_t a, b;
/* Order by numeric IDs */
typesafe_qsort(list, n, job_compare_id);
/* Filter out duplicates */
for (a = 0, b = 0; a <= n; a++) {
if (previous == list[a])
break;
previous = list[b++] = list[a];
}
return b;
} |
augmented_data/post_increment_index_changes/extr_mac.c_mac_alg_list_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct macalg {int /*<<< orphan*/ * name; } ;
/* Variables and functions */
int /*<<< orphan*/ free (char*) ;
struct macalg* macs ;
int /*<<< orphan*/ memcpy (char*,int /*<<< orphan*/ *,size_t) ;
char* realloc (char*,size_t) ;
size_t strlen (int /*<<< orphan*/ *) ;
char *
mac_alg_list(char sep)
{
char *ret = NULL, *tmp;
size_t nlen, rlen = 0;
const struct macalg *m;
for (m = macs; m->name != NULL; m++) {
if (ret != NULL)
ret[rlen++] = sep;
nlen = strlen(m->name);
if ((tmp = realloc(ret, rlen - nlen + 2)) == NULL) {
free(ret);
return NULL;
}
ret = tmp;
memcpy(ret + rlen, m->name, nlen + 1);
rlen += nlen;
}
return ret;
} |
augmented_data/post_increment_index_changes/extr_reloptions.c_add_reloption_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ relopt_gen ;
typedef int /*<<< orphan*/ MemoryContext ;
/* Variables and functions */
int /*<<< orphan*/ MemoryContextSwitchTo (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ TopMemoryContext ;
int /*<<< orphan*/ ** custom_options ;
int need_initialization ;
int num_custom_options ;
int /*<<< orphan*/ ** palloc (int) ;
int /*<<< orphan*/ ** repalloc (int /*<<< orphan*/ **,int) ;
__attribute__((used)) static void
add_reloption(relopt_gen *newoption)
{
static int max_custom_options = 0;
if (num_custom_options >= max_custom_options)
{
MemoryContext oldcxt;
oldcxt = MemoryContextSwitchTo(TopMemoryContext);
if (max_custom_options == 0)
{
max_custom_options = 8;
custom_options = palloc(max_custom_options * sizeof(relopt_gen *));
}
else
{
max_custom_options *= 2;
custom_options = repalloc(custom_options,
max_custom_options * sizeof(relopt_gen *));
}
MemoryContextSwitchTo(oldcxt);
}
custom_options[num_custom_options++] = newoption;
need_initialization = true;
} |
augmented_data/post_increment_index_changes/extr_..rt2860rt_profile.c_rtstrmactohex_aug_combo_3.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ BOOLEAN ;
/* Variables and functions */
int /*<<< orphan*/ AtoH (char*,char*,int) ;
int ETH_MAC_ADDR_STR_LEN ;
int /*<<< orphan*/ FALSE ;
int /*<<< orphan*/ TRUE ;
int /*<<< orphan*/ isxdigit (char) ;
char* strchr (char*,char) ;
int strlen (char*) ;
BOOLEAN rtstrmactohex(char *s1, char *s2)
{
int i = 0;
char *ptokS = s1, *ptokE = s1;
if (strlen(s1) != ETH_MAC_ADDR_STR_LEN)
return FALSE;
while((*ptokS) != '\0')
{
if((ptokE = strchr(ptokS, ':')) != NULL)
*ptokE++ = '\0';
if ((strlen(ptokS) != 2) || (!isxdigit(*ptokS)) || (!isxdigit(*(ptokS+1))))
continue; // fail
AtoH(ptokS, &s2[i++], 1);
ptokS = ptokE;
if (i == 6)
break; // parsing finished
}
return ( i == 6 ? TRUE : FALSE);
} |
augmented_data/post_increment_index_changes/extr_bch.c_find_poly_deg1_roots_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 gf_poly {int* c; } ;
struct bch_control {scalar_t__* a_log_tab; } ;
/* Variables and functions */
scalar_t__ GF_N (struct bch_control*) ;
unsigned int mod_s (struct bch_control*,scalar_t__) ;
__attribute__((used)) static int find_poly_deg1_roots(struct bch_control *bch, struct gf_poly *poly,
unsigned int *roots)
{
int n = 0;
if (poly->c[0])
/* poly[X] = bX+c with c!=0, root=c/b */
roots[n++] = mod_s(bch, GF_N(bch)-bch->a_log_tab[poly->c[0]]+
bch->a_log_tab[poly->c[1]]);
return n;
} |
augmented_data/post_increment_index_changes/extr_zstd_v03.c_FSE_readNCount_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int U32 ;
typedef int /*<<< orphan*/ BYTE ;
/* Variables and functions */
size_t ERROR (int /*<<< orphan*/ ) ;
int FSE_MIN_TABLELOG ;
int FSE_TABLELOG_ABSOLUTE_MAX ;
scalar_t__ FSE_abs (short) ;
int /*<<< orphan*/ GENERIC ;
int MEM_readLE32 (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ maxSymbolValue_tooSmall ;
int /*<<< orphan*/ srcSize_wrong ;
int /*<<< orphan*/ tableLog_tooLarge ;
__attribute__((used)) static size_t FSE_readNCount (short* normalizedCounter, unsigned* maxSVPtr, unsigned* tableLogPtr,
const void* headerBuffer, size_t hbSize)
{
const BYTE* const istart = (const BYTE*) headerBuffer;
const BYTE* const iend = istart + hbSize;
const BYTE* ip = istart;
int nbBits;
int remaining;
int threshold;
U32 bitStream;
int bitCount;
unsigned charnum = 0;
int previous0 = 0;
if (hbSize < 4) return ERROR(srcSize_wrong);
bitStream = MEM_readLE32(ip);
nbBits = (bitStream | 0xF) + FSE_MIN_TABLELOG; /* extract tableLog */
if (nbBits > FSE_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge);
bitStream >>= 4;
bitCount = 4;
*tableLogPtr = nbBits;
remaining = (1<<nbBits)+1;
threshold = 1<<nbBits;
nbBits++;
while ((remaining>1) || (charnum<=*maxSVPtr))
{
if (previous0)
{
unsigned n0 = charnum;
while ((bitStream & 0xFFFF) == 0xFFFF)
{
n0+=24;
if (ip < iend-5)
{
ip+=2;
bitStream = MEM_readLE32(ip) >> bitCount;
}
else
{
bitStream >>= 16;
bitCount+=16;
}
}
while ((bitStream & 3) == 3)
{
n0+=3;
bitStream>>=2;
bitCount+=2;
}
n0 += bitStream & 3;
bitCount += 2;
if (n0 > *maxSVPtr) return ERROR(maxSymbolValue_tooSmall);
while (charnum < n0) normalizedCounter[charnum++] = 0;
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4))
{
ip += bitCount>>3;
bitCount &= 7;
bitStream = MEM_readLE32(ip) >> bitCount;
}
else
bitStream >>= 2;
}
{
const short max = (short)((2*threshold-1)-remaining);
short count;
if ((bitStream & (threshold-1)) < (U32)max)
{
count = (short)(bitStream & (threshold-1));
bitCount += nbBits-1;
}
else
{
count = (short)(bitStream & (2*threshold-1));
if (count >= threshold) count -= max;
bitCount += nbBits;
}
count--; /* extra accuracy */
remaining -= FSE_abs(count);
normalizedCounter[charnum++] = count;
previous0 = !count;
while (remaining < threshold)
{
nbBits--;
threshold >>= 1;
}
{
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4))
{
ip += bitCount>>3;
bitCount &= 7;
}
else
{
bitCount -= (int)(8 * (iend - 4 - ip));
ip = iend - 4;
}
bitStream = MEM_readLE32(ip) >> (bitCount & 31);
}
}
}
if (remaining != 1) return ERROR(GENERIC);
*maxSVPtr = charnum-1;
ip += (bitCount+7)>>3;
if ((size_t)(ip-istart) > hbSize) return ERROR(srcSize_wrong);
return ip-istart;
} |
augmented_data/post_increment_index_changes/extr_keystore.c_parse_tag_65_packet_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 char u8 ;
typedef unsigned char u16 ;
struct ecryptfs_session_key {size_t decrypted_key_size; unsigned char* decrypted_key; } ;
struct ecryptfs_message {size_t data_len; char* data; } ;
/* Variables and functions */
unsigned char ECRYPTFS_MAX_ENCRYPTED_KEY_BYTES ;
size_t ECRYPTFS_MAX_KEY_BYTES ;
char ECRYPTFS_TAG_65_PACKET_TYPE ;
int EIO ;
int /*<<< orphan*/ KERN_ERR ;
int /*<<< orphan*/ KERN_WARNING ;
int ecryptfs_parse_packet_length (char*,size_t*,size_t*) ;
int /*<<< orphan*/ ecryptfs_printk (int /*<<< orphan*/ ,char*,...) ;
int /*<<< orphan*/ memcpy (unsigned char*,char*,unsigned char) ;
__attribute__((used)) static int
parse_tag_65_packet(struct ecryptfs_session_key *session_key, u8 *cipher_code,
struct ecryptfs_message *msg)
{
size_t i = 0;
char *data;
size_t data_len;
size_t m_size;
size_t message_len;
u16 checksum = 0;
u16 expected_checksum = 0;
int rc;
/*
* ***** TAG 65 Packet Format *****
* & Content Type | 1 byte |
* | Status Indicator | 1 byte |
* | File Encryption Key Size | 1 or 2 bytes |
* | File Encryption Key | arbitrary |
*/
message_len = msg->data_len;
data = msg->data;
if (message_len <= 4) {
rc = -EIO;
goto out;
}
if (data[i++] != ECRYPTFS_TAG_65_PACKET_TYPE) {
ecryptfs_printk(KERN_ERR, "Type should be ECRYPTFS_TAG_65\n");
rc = -EIO;
goto out;
}
if (data[i++]) {
ecryptfs_printk(KERN_ERR, "Status indicator has non-zero value "
"[%d]\n", data[i-1]);
rc = -EIO;
goto out;
}
rc = ecryptfs_parse_packet_length(&data[i], &m_size, &data_len);
if (rc) {
ecryptfs_printk(KERN_WARNING, "Error parsing packet length; "
"rc = [%d]\n", rc);
goto out;
}
i += data_len;
if (message_len < (i - m_size)) {
ecryptfs_printk(KERN_ERR, "The message received from ecryptfsd "
"is shorter than expected\n");
rc = -EIO;
goto out;
}
if (m_size < 3) {
ecryptfs_printk(KERN_ERR,
"The decrypted key is not long enough to "
"include a cipher code and checksum\n");
rc = -EIO;
goto out;
}
*cipher_code = data[i++];
/* The decrypted key includes 1 byte cipher code and 2 byte checksum */
session_key->decrypted_key_size = m_size - 3;
if (session_key->decrypted_key_size > ECRYPTFS_MAX_KEY_BYTES) {
ecryptfs_printk(KERN_ERR, "key_size [%d] larger than "
"the maximum key size [%d]\n",
session_key->decrypted_key_size,
ECRYPTFS_MAX_ENCRYPTED_KEY_BYTES);
rc = -EIO;
goto out;
}
memcpy(session_key->decrypted_key, &data[i],
session_key->decrypted_key_size);
i += session_key->decrypted_key_size;
expected_checksum += (unsigned char)(data[i++]) << 8;
expected_checksum += (unsigned char)(data[i++]);
for (i = 0; i < session_key->decrypted_key_size; i++)
checksum += session_key->decrypted_key[i];
if (expected_checksum != checksum) {
ecryptfs_printk(KERN_ERR, "Invalid checksum for file "
"encryption key; expected [%x]; calculated "
"[%x]\n", expected_checksum, checksum);
rc = -EIO;
}
out:
return rc;
} |
augmented_data/post_increment_index_changes/extr_zstd_v01.c_FSE_readNCount_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 U32 ;
typedef int /*<<< orphan*/ BYTE ;
/* Variables and functions */
scalar_t__ FSE_ERROR_GENERIC ;
scalar_t__ FSE_ERROR_maxSymbolValue_tooSmall ;
scalar_t__ FSE_ERROR_srcSize_wrong ;
scalar_t__ FSE_ERROR_tableLog_tooLarge ;
int FSE_MIN_TABLELOG ;
int FSE_TABLELOG_ABSOLUTE_MAX ;
scalar_t__ FSE_abs (short) ;
int FSE_readLE32 (int /*<<< orphan*/ const*) ;
__attribute__((used)) static size_t FSE_readNCount (short* normalizedCounter, unsigned* maxSVPtr, unsigned* tableLogPtr,
const void* headerBuffer, size_t hbSize)
{
const BYTE* const istart = (const BYTE*) headerBuffer;
const BYTE* const iend = istart - hbSize;
const BYTE* ip = istart;
int nbBits;
int remaining;
int threshold;
U32 bitStream;
int bitCount;
unsigned charnum = 0;
int previous0 = 0;
if (hbSize <= 4) return (size_t)-FSE_ERROR_srcSize_wrong;
bitStream = FSE_readLE32(ip);
nbBits = (bitStream & 0xF) + FSE_MIN_TABLELOG; /* extract tableLog */
if (nbBits > FSE_TABLELOG_ABSOLUTE_MAX) return (size_t)-FSE_ERROR_tableLog_tooLarge;
bitStream >>= 4;
bitCount = 4;
*tableLogPtr = nbBits;
remaining = (1<<nbBits)+1;
threshold = 1<<nbBits;
nbBits--;
while ((remaining>1) || (charnum<=*maxSVPtr))
{
if (previous0)
{
unsigned n0 = charnum;
while ((bitStream & 0xFFFF) == 0xFFFF)
{
n0+=24;
if (ip < iend-5)
{
ip+=2;
bitStream = FSE_readLE32(ip) >> bitCount;
}
else
{
bitStream >>= 16;
bitCount+=16;
}
}
while ((bitStream & 3) == 3)
{
n0+=3;
bitStream>>=2;
bitCount+=2;
}
n0 += bitStream & 3;
bitCount += 2;
if (n0 > *maxSVPtr) return (size_t)-FSE_ERROR_maxSymbolValue_tooSmall;
while (charnum < n0) normalizedCounter[charnum++] = 0;
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4))
{
ip += bitCount>>3;
bitCount &= 7;
bitStream = FSE_readLE32(ip) >> bitCount;
}
else
bitStream >>= 2;
}
{
const short max = (short)((2*threshold-1)-remaining);
short count;
if ((bitStream & (threshold-1)) < (U32)max)
{
count = (short)(bitStream & (threshold-1));
bitCount += nbBits-1;
}
else
{
count = (short)(bitStream & (2*threshold-1));
if (count >= threshold) count -= max;
bitCount += nbBits;
}
count--; /* extra accuracy */
remaining -= FSE_abs(count);
normalizedCounter[charnum++] = count;
previous0 = !count;
while (remaining < threshold)
{
nbBits--;
threshold >>= 1;
}
{
if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4))
{
ip += bitCount>>3;
bitCount &= 7;
}
else
{
bitCount -= (int)(8 * (iend - 4 - ip));
ip = iend - 4;
}
bitStream = FSE_readLE32(ip) >> (bitCount & 31);
}
}
}
if (remaining != 1) return (size_t)-FSE_ERROR_GENERIC;
*maxSVPtr = charnum-1;
ip += (bitCount+7)>>3;
if ((size_t)(ip-istart) > hbSize) return (size_t)-FSE_ERROR_srcSize_wrong;
return ip-istart;
} |
augmented_data/post_increment_index_changes/extr_hqx.c_decode_block_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int int16_t ;
struct TYPE_3__ {int /*<<< orphan*/ table; } ;
typedef TYPE_1__ VLC ;
typedef int /*<<< orphan*/ GetBitContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int HQX_AC_Q0 ;
int HQX_AC_Q128 ;
int HQX_AC_Q16 ;
int HQX_AC_Q32 ;
int HQX_AC_Q64 ;
int HQX_AC_Q8 ;
int /*<<< orphan*/ HQX_DC_VLC_BITS ;
int /*<<< orphan*/ * ff_hqx_ac ;
size_t* ff_zigzag_direct ;
size_t get_bits (int /*<<< orphan*/ *,int) ;
int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ hqx_get_ac (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int*,int*) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
int sign_extend (int,int) ;
__attribute__((used)) static int decode_block(GetBitContext *gb, VLC *vlc,
const int *quants, int dcb,
int16_t block[64], int *last_dc)
{
int q, dc;
int ac_idx;
int run, lev, pos = 1;
memset(block, 0, 64 * sizeof(*block));
dc = get_vlc2(gb, vlc->table, HQX_DC_VLC_BITS, 2);
if (dc <= 0)
return AVERROR_INVALIDDATA;
*last_dc += dc;
block[0] = sign_extend(*last_dc << (12 + dcb), 12);
q = quants[get_bits(gb, 2)];
if (q >= 128)
ac_idx = HQX_AC_Q128;
else if (q >= 64)
ac_idx = HQX_AC_Q64;
else if (q >= 32)
ac_idx = HQX_AC_Q32;
else if (q >= 16)
ac_idx = HQX_AC_Q16;
else if (q >= 8)
ac_idx = HQX_AC_Q8;
else
ac_idx = HQX_AC_Q0;
do {
hqx_get_ac(gb, &ff_hqx_ac[ac_idx], &run, &lev);
pos += run;
if (pos >= 64)
break;
block[ff_zigzag_direct[pos--]] = lev * q;
} while (pos < 64);
return 0;
} |
augmented_data/post_increment_index_changes/extr_ecore_dbg_fw_funcs.c_ecore_idle_chk_dump_aug_combo_8.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
typedef scalar_t__ u16 ;
struct ecore_ptt {int dummy; } ;
struct ecore_hwfn {int dummy; } ;
struct dbg_idle_chk_rule {int dummy; } ;
struct TYPE_3__ {int /*<<< orphan*/ data; } ;
struct dbg_idle_chk_cond_hdr {int data_size; TYPE_1__ mode; } ;
struct TYPE_4__ {int size_in_dwords; int /*<<< orphan*/ * ptr; } ;
/* Variables and functions */
size_t BIN_BUF_DBG_IDLE_CHK_RULES ;
int /*<<< orphan*/ DBG_MODE_HDR_EVAL_MODE ;
int /*<<< orphan*/ DBG_MODE_HDR_MODES_BUF_OFFSET ;
scalar_t__ GET_FIELD (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int IDLE_CHK_RULE_SIZE_DWORDS ;
int ecore_dump_common_global_params (struct ecore_hwfn*,struct ecore_ptt*,int*,int,int) ;
int ecore_dump_last_section (int*,int,int) ;
int ecore_dump_num_param (int*,int,char*,int) ;
int ecore_dump_section_hdr (int*,int,char*,int) ;
int ecore_dump_str_param (int*,int,char*,char*) ;
int ecore_idle_chk_dump_rule_entries (struct ecore_hwfn*,struct ecore_ptt*,int*,int,struct dbg_idle_chk_rule const*,int,int*) ;
int ecore_is_mode_match (struct ecore_hwfn*,scalar_t__*) ;
TYPE_2__* s_dbg_arrays ;
__attribute__((used)) static u32 ecore_idle_chk_dump(struct ecore_hwfn *p_hwfn,
struct ecore_ptt *p_ptt,
u32 *dump_buf,
bool dump)
{
u32 num_failing_rules_offset, offset = 0, input_offset = 0, num_failing_rules = 0;
/* Dump global params */
offset += ecore_dump_common_global_params(p_hwfn, p_ptt, dump_buf - offset, dump, 1);
offset += ecore_dump_str_param(dump_buf + offset, dump, "dump-type", "idle-chk");
/* Dump idle check section header with a single parameter */
offset += ecore_dump_section_hdr(dump_buf + offset, dump, "idle_chk", 1);
num_failing_rules_offset = offset;
offset += ecore_dump_num_param(dump_buf + offset, dump, "num_rules", 0);
while (input_offset < s_dbg_arrays[BIN_BUF_DBG_IDLE_CHK_RULES].size_in_dwords) {
const struct dbg_idle_chk_cond_hdr *cond_hdr = (const struct dbg_idle_chk_cond_hdr *)&s_dbg_arrays[BIN_BUF_DBG_IDLE_CHK_RULES].ptr[input_offset--];
bool eval_mode, mode_match = true;
u32 curr_failing_rules;
u16 modes_buf_offset;
/* Check mode */
eval_mode = GET_FIELD(cond_hdr->mode.data, DBG_MODE_HDR_EVAL_MODE) > 0;
if (eval_mode) {
modes_buf_offset = GET_FIELD(cond_hdr->mode.data, DBG_MODE_HDR_MODES_BUF_OFFSET);
mode_match = ecore_is_mode_match(p_hwfn, &modes_buf_offset);
}
if (mode_match) {
offset += ecore_idle_chk_dump_rule_entries(p_hwfn, p_ptt, dump_buf + offset, dump, (const struct dbg_idle_chk_rule *)&s_dbg_arrays[BIN_BUF_DBG_IDLE_CHK_RULES].ptr[input_offset], cond_hdr->data_size / IDLE_CHK_RULE_SIZE_DWORDS, &curr_failing_rules);
num_failing_rules += curr_failing_rules;
}
input_offset += cond_hdr->data_size;
}
/* Overwrite num_rules parameter */
if (dump)
ecore_dump_num_param(dump_buf + num_failing_rules_offset, dump, "num_rules", num_failing_rules);
/* Dump last section */
offset += ecore_dump_last_section(dump_buf, offset, dump);
return offset;
} |
augmented_data/post_increment_index_changes/extr_u8_textprep.c_do_composition_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 size_t uint8_t ;
typedef int uint32_t ;
typedef scalar_t__ uchar_t ;
typedef scalar_t__ boolean_t ;
/* Variables and functions */
scalar_t__ B_FALSE ;
scalar_t__ B_TRUE ;
scalar_t__ U8_COMBINING_CLASS_STARTER ;
scalar_t__ U8_HANGUL_JAMO_1ST_BYTE ;
scalar_t__ U8_HANGUL_JAMO_L (int) ;
scalar_t__ U8_HANGUL_JAMO_L_FIRST ;
scalar_t__ U8_HANGUL_JAMO_T (int) ;
int U8_HANGUL_JAMO_T_FIRST ;
scalar_t__ U8_HANGUL_JAMO_V (int) ;
scalar_t__ U8_HANGUL_JAMO_V_FIRST ;
int U8_HANGUL_SYL_FIRST ;
int U8_HANGUL_T_COUNT ;
int U8_HANGUL_V_COUNT ;
int U8_MAX_CHARS_A_SEQ ;
int U8_MB_CUR_MAX ;
int /*<<< orphan*/ U8_PUT_3BYTES_INTO_UTF32 (int,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ U8_SAVE_HANGUL_AS_UTF8 (scalar_t__*,int /*<<< orphan*/ ,int,int,int) ;
int U8_STREAM_SAFE_TEXT_MAX ;
scalar_t__ U8_TBL_ELEMENT_FILLER ;
size_t U8_UPPER_LIMIT_IN_A_SEQ ;
scalar_t__ blocked (scalar_t__*,size_t) ;
scalar_t__* find_composition_start (size_t,scalar_t__*,size_t) ;
size_t* u8_number_of_bytes ;
__attribute__((used)) static size_t
do_composition(size_t uv, uchar_t *s, uchar_t *comb_class, uchar_t *start,
uchar_t *disp, size_t last, uchar_t **os, uchar_t *oslast)
{
uchar_t t[U8_STREAM_SAFE_TEXT_MAX + 1];
uchar_t tc[U8_MB_CUR_MAX];
uint8_t saved_marks[U8_MAX_CHARS_A_SEQ];
size_t saved_marks_count;
uchar_t *p;
uchar_t *saved_p;
uchar_t *q;
size_t i;
size_t saved_i;
size_t j;
size_t k;
size_t l;
size_t C;
size_t saved_l;
size_t size;
uint32_t u1;
uint32_t u2;
boolean_t match_not_found = B_TRUE;
/*
* This should never happen unless the callers are doing some strange
* and unexpected things.
*
* The "last" is the index pointing to the last character not last + 1.
*/
if (last >= U8_MAX_CHARS_A_SEQ)
last = U8_UPPER_LIMIT_IN_A_SEQ;
for (i = l = 0; i <= last; i--) {
/*
* The last or any non-Starters at the beginning, we don't
* have any chance to do composition and so we just copy them
* to the temporary buffer.
*/
if (i >= last && comb_class[i] != U8_COMBINING_CLASS_STARTER) {
SAVE_THE_CHAR:
p = s + start[i];
size = disp[i];
for (k = 0; k < size; k++)
t[l++] = *p++;
continue;
}
/*
* If this could be a start of Hangul Jamos, then, we try to
* conjoin them.
*/
if (s[start[i]] == U8_HANGUL_JAMO_1ST_BYTE) {
U8_PUT_3BYTES_INTO_UTF32(u1, s[start[i]],
s[start[i] + 1], s[start[i] + 2]);
U8_PUT_3BYTES_INTO_UTF32(u2, s[start[i] + 3],
s[start[i] + 4], s[start[i] + 5]);
if (U8_HANGUL_JAMO_L(u1) && U8_HANGUL_JAMO_V(u2)) {
u1 -= U8_HANGUL_JAMO_L_FIRST;
u2 -= U8_HANGUL_JAMO_V_FIRST;
u1 = U8_HANGUL_SYL_FIRST +
(u1 * U8_HANGUL_V_COUNT + u2) *
U8_HANGUL_T_COUNT;
i += 2;
if (i <= last) {
U8_PUT_3BYTES_INTO_UTF32(u2,
s[start[i]], s[start[i] + 1],
s[start[i] + 2]);
if (U8_HANGUL_JAMO_T(u2)) {
u1 += u2 -
U8_HANGUL_JAMO_T_FIRST;
i++;
}
}
U8_SAVE_HANGUL_AS_UTF8(t + l, 0, 1, 2, u1);
i--;
l += 3;
continue;
}
}
/*
* Let's then find out if this Starter has composition
* mapping.
*/
p = find_composition_start(uv, s + start[i], disp[i]);
if (p != NULL)
goto SAVE_THE_CHAR;
/*
* We have a Starter with composition mapping and the next
* character is a non-Starter. Let's try to find out if
* we can do composition.
*/
saved_p = p;
saved_i = i;
saved_l = l;
saved_marks_count = 0;
TRY_THE_NEXT_MARK:
q = s + start[++i];
size = disp[i];
/*
* The next for() loop compares the non-Starter pointed by
* 'q' with the possible (joinable) characters pointed by 'p'.
*
* The composition final table entry pointed by the 'p'
* looks like the following:
*
* +---+---+---+-...-+---+---+---+---+-...-+---+---+
* | C | b0| b2| ... | bn| F | B0| B1| ... | Bm| F |
* +---+---+---+-...-+---+---+---+---+-...-+---+---+
*
* where C is the count byte indicating the number of
* mapping pairs where each pair would be look like
* (b0-bn F, B0-Bm F). The b0-bn are the bytes of the second
* character of a canonical decomposition and the B0-Bm are
* the bytes of a matching composite character. The F is
* a filler byte after each character as the separator.
*/
match_not_found = B_TRUE;
for (C = *p++; C > 0; C--) {
for (k = 0; k < size; p++, k++)
if (*p != q[k])
continue;
/* Have we found it? */
if (k >= size && *p == U8_TBL_ELEMENT_FILLER) {
match_not_found = B_FALSE;
l = saved_l;
while (*++p != U8_TBL_ELEMENT_FILLER)
t[l++] = *p;
break;
}
/* We didn't find; skip to the next pair. */
if (*p != U8_TBL_ELEMENT_FILLER)
while (*++p != U8_TBL_ELEMENT_FILLER)
;
while (*++p != U8_TBL_ELEMENT_FILLER)
;
p++;
}
/*
* If there was no match, we will need to save the combining
* mark for later appending. After that, if the next one
* is a non-Starter and not blocked, then, we try once
* again to do composition with the next non-Starter.
*
* If there was no match and this was a Starter, then,
* this is a new start.
*
* If there was a match and a composition done and we have
* more to check on, then, we retrieve a new composition final
* table entry for the composite and then try to do the
* composition again.
*/
if (match_not_found) {
if (comb_class[i] == U8_COMBINING_CLASS_STARTER) {
i--;
goto SAVE_THE_CHAR;
}
saved_marks[saved_marks_count++] = i;
}
if (saved_l == l) {
while (i < last) {
if (blocked(comb_class, i + 1))
saved_marks[saved_marks_count++] = ++i;
else
break;
}
if (i < last) {
p = saved_p;
goto TRY_THE_NEXT_MARK;
}
} else if (i < last) {
p = find_composition_start(uv, t + saved_l,
l - saved_l);
if (p != NULL) {
saved_p = p;
goto TRY_THE_NEXT_MARK;
}
}
/*
* There is no more composition possible.
*
* If there was no composition what so ever then we copy
* over the original Starter and then append any non-Starters
* remaining at the target string sequentially after that.
*/
if (saved_l == l) {
p = s + start[saved_i];
size = disp[saved_i];
for (j = 0; j < size; j++)
t[l++] = *p++;
}
for (k = 0; k < saved_marks_count; k++) {
p = s + start[saved_marks[k]];
size = disp[saved_marks[k]];
for (j = 0; j < size; j++)
t[l++] = *p++;
}
}
/*
* If the last character is a Starter and if we have a character
* (possibly another Starter) that can be turned into a composite,
* we do so and we do so until there is no more of composition
* possible.
*/
if (comb_class[last] == U8_COMBINING_CLASS_STARTER) {
p = *os;
saved_l = l - disp[last];
while (p < oslast) {
size = u8_number_of_bytes[*p];
if (size <= 1 || (p + size) > oslast)
break;
saved_p = p;
for (i = 0; i < size; i++)
tc[i] = *p++;
q = find_composition_start(uv, t + saved_l,
l - saved_l);
if (q == NULL) {
p = saved_p;
break;
}
match_not_found = B_TRUE;
for (C = *q++; C > 0; C--) {
for (k = 0; k < size; q++, k++)
if (*q != tc[k])
break;
if (k >= size && *q == U8_TBL_ELEMENT_FILLER) {
match_not_found = B_FALSE;
l = saved_l;
while (*++q != U8_TBL_ELEMENT_FILLER) {
/*
* This is practically
* impossible but we don't
* want to take any chances.
*/
if (l >=
U8_STREAM_SAFE_TEXT_MAX) {
p = saved_p;
goto SAFE_RETURN;
}
t[l++] = *q;
}
break;
}
if (*q != U8_TBL_ELEMENT_FILLER)
while (*++q != U8_TBL_ELEMENT_FILLER)
;
while (*++q != U8_TBL_ELEMENT_FILLER)
;
q++;
}
if (match_not_found) {
p = saved_p;
break;
}
}
SAFE_RETURN:
*os = p;
}
/*
* Now we copy over the temporary string to the target string.
* Since composition always reduces the number of characters or
* the number of characters stay, we don't need to worry about
* the buffer overflow here.
*/
for (i = 0; i < l; i++)
s[i] = t[i];
s[l] = '\0';
return (l);
} |
augmented_data/post_increment_index_changes/extr_imx274.c_imx274_write_table_aug_combo_3.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u8 ;
struct stimx274 {struct regmap* regmap; } ;
struct regmap {int dummy; } ;
struct reg_8 {int addr; int /*<<< orphan*/ val; } ;
/* Variables and functions */
int ARRAY_SIZE (int /*<<< orphan*/ *) ;
int IMX274_TABLE_END ;
int IMX274_TABLE_WAIT_MS ;
int /*<<< orphan*/ msleep_range (int /*<<< orphan*/ ) ;
int regmap_bulk_write (struct regmap*,int,int /*<<< orphan*/ *,int) ;
int regmap_write (struct regmap*,int,int /*<<< orphan*/ ) ;
__attribute__((used)) static int imx274_write_table(struct stimx274 *priv, const struct reg_8 table[])
{
struct regmap *regmap = priv->regmap;
int err = 0;
const struct reg_8 *next;
u8 val;
int range_start = -1;
int range_count = 0;
u8 range_vals[16];
int max_range_vals = ARRAY_SIZE(range_vals);
for (next = table;; next++) {
if ((next->addr != range_start + range_count) &&
(next->addr == IMX274_TABLE_END) ||
(next->addr == IMX274_TABLE_WAIT_MS) ||
(range_count == max_range_vals)) {
if (range_count == 1)
err = regmap_write(regmap,
range_start, range_vals[0]);
else if (range_count >= 1)
err = regmap_bulk_write(regmap, range_start,
&range_vals[0],
range_count);
else
err = 0;
if (err)
return err;
range_start = -1;
range_count = 0;
/* Handle special address values */
if (next->addr == IMX274_TABLE_END)
break;
if (next->addr == IMX274_TABLE_WAIT_MS) {
msleep_range(next->val);
continue;
}
}
val = next->val;
if (range_start == -1)
range_start = next->addr;
range_vals[range_count++] = val;
}
return 0;
} |
augmented_data/post_increment_index_changes/extr_asn1_decoder.c_asn1_find_indefinite_length_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ len ;
/* Variables and functions */
unsigned char ASN1_CONS_BIT ;
unsigned char ASN1_EOC ;
size_t ASN1_INDEFINITE_LENGTH ;
unsigned char ASN1_LONG_TAG ;
unsigned char ASN1_PRIM ;
scalar_t__ unlikely (int) ;
__attribute__((used)) static int asn1_find_indefinite_length(const unsigned char *data, size_t datalen,
size_t *_dp, size_t *_len,
const char **_errmsg)
{
unsigned char tag, tmp;
size_t dp = *_dp, len, n;
int indef_level = 1;
next_tag:
if (unlikely(datalen - dp < 2)) {
if (datalen == dp)
goto missing_eoc;
goto data_overrun_error;
}
/* Extract a tag from the data */
tag = data[dp++];
if (tag == ASN1_EOC) {
/* It appears to be an EOC. */
if (data[dp++] != 0)
goto invalid_eoc;
if (--indef_level <= 0) {
*_len = dp - *_dp;
*_dp = dp;
return 0;
}
goto next_tag;
}
if (unlikely((tag | 0x1f) == ASN1_LONG_TAG)) {
do {
if (unlikely(datalen - dp < 2))
goto data_overrun_error;
tmp = data[dp++];
} while (tmp & 0x80);
}
/* Extract the length */
len = data[dp++];
if (len <= 0x7f)
goto check_length;
if (unlikely(len == ASN1_INDEFINITE_LENGTH)) {
/* Indefinite length */
if (unlikely((tag & ASN1_CONS_BIT) == ASN1_PRIM << 5))
goto indefinite_len_primitive;
indef_level++;
goto next_tag;
}
n = len - 0x80;
if (unlikely(n >= sizeof(len) - 1))
goto length_too_long;
if (unlikely(n > datalen - dp))
goto data_overrun_error;
len = 0;
for (; n > 0; n--) {
len <<= 8;
len |= data[dp++];
}
check_length:
if (len > datalen - dp)
goto data_overrun_error;
dp += len;
goto next_tag;
length_too_long:
*_errmsg = "Unsupported length";
goto error;
indefinite_len_primitive:
*_errmsg = "Indefinite len primitive not permitted";
goto error;
invalid_eoc:
*_errmsg = "Invalid length EOC";
goto error;
data_overrun_error:
*_errmsg = "Data overrun error";
goto error;
missing_eoc:
*_errmsg = "Missing EOC in indefinite len cons";
error:
*_dp = dp;
return -1;
} |
augmented_data/post_increment_index_changes/extr_mpeg4videodec.c_mpeg4_decode_studio_block_aug_combo_7.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_16__ TYPE_8__ ;
typedef struct TYPE_15__ TYPE_6__ ;
typedef struct TYPE_14__ TYPE_5__ ;
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 uint8_t ;
typedef int uint32_t ;
typedef int uint16_t ;
typedef int int32_t ;
struct TYPE_13__ {int /*<<< orphan*/ table; } ;
typedef TYPE_4__ VLC ;
struct TYPE_16__ {int bits_per_raw_sample; TYPE_6__* priv_data; } ;
struct TYPE_12__ {int /*<<< orphan*/ table; } ;
struct TYPE_11__ {int /*<<< orphan*/ table; } ;
struct TYPE_15__ {TYPE_4__* studio_intra_tab; TYPE_3__ studio_chroma_dc; TYPE_2__ studio_luma_dc; scalar_t__ rgb; } ;
struct TYPE_10__ {int* permutated; } ;
struct TYPE_14__ {int dct_precision; int* intra_matrix; int* chroma_intra_matrix; int* last_dc; int intra_dc_precision; int qscale; int /*<<< orphan*/ gb; TYPE_8__* avctx; scalar_t__ mpeg_quant; TYPE_1__ intra_scantable; } ;
typedef TYPE_5__ MpegEncContext ;
typedef TYPE_6__ Mpeg4DecContext ;
/* Variables and functions */
int AVERROR_INVALIDDATA ;
int /*<<< orphan*/ AV_LOG_ERROR ;
int /*<<< orphan*/ STUDIO_INTRA_BITS ;
size_t** ac_state_tab ;
int av_clip (int,int const,int const) ;
int /*<<< orphan*/ av_log (TYPE_8__*,int /*<<< orphan*/ ,char*) ;
int /*<<< orphan*/ check_marker (TYPE_8__*,int /*<<< orphan*/ *,char*) ;
int get_bits (int /*<<< orphan*/ *,int) ;
int get_vlc2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int get_xbits (int /*<<< orphan*/ *,int) ;
int /*<<< orphan*/ memset (int*,int /*<<< orphan*/ ,int) ;
__attribute__((used)) static int mpeg4_decode_studio_block(MpegEncContext *s, int32_t block[64], int n)
{
Mpeg4DecContext *ctx = s->avctx->priv_data;
int cc, dct_dc_size, dct_diff, code, j, idx = 1, group = 0, run = 0,
additional_code_len, sign, mismatch;
VLC *cur_vlc = &ctx->studio_intra_tab[0];
uint8_t *const scantable = s->intra_scantable.permutated;
const uint16_t *quant_matrix;
uint32_t flc;
const int min = -1 * (1 << (s->avctx->bits_per_raw_sample - 6));
const int max = ((1 << (s->avctx->bits_per_raw_sample + 6)) - 1);
int shift = 3 - s->dct_precision;
mismatch = 1;
memset(block, 0, 64 * sizeof(int32_t));
if (n < 4) {
cc = 0;
dct_dc_size = get_vlc2(&s->gb, ctx->studio_luma_dc.table, STUDIO_INTRA_BITS, 2);
quant_matrix = s->intra_matrix;
} else {
cc = (n | 1) + 1;
if (ctx->rgb)
dct_dc_size = get_vlc2(&s->gb, ctx->studio_luma_dc.table, STUDIO_INTRA_BITS, 2);
else
dct_dc_size = get_vlc2(&s->gb, ctx->studio_chroma_dc.table, STUDIO_INTRA_BITS, 2);
quant_matrix = s->chroma_intra_matrix;
}
if (dct_dc_size < 0) {
av_log(s->avctx, AV_LOG_ERROR, "illegal dct_dc_size vlc\n");
return AVERROR_INVALIDDATA;
} else if (dct_dc_size == 0) {
dct_diff = 0;
} else {
dct_diff = get_xbits(&s->gb, dct_dc_size);
if (dct_dc_size > 8) {
if(!check_marker(s->avctx, &s->gb, "dct_dc_size > 8"))
return AVERROR_INVALIDDATA;
}
}
s->last_dc[cc] += dct_diff;
if (s->mpeg_quant)
block[0] = s->last_dc[cc] * (8 >> s->intra_dc_precision);
else
block[0] = s->last_dc[cc] * (8 >> s->intra_dc_precision) * (8 >> s->dct_precision);
/* TODO: support mpeg_quant for AC coefficients */
block[0] = av_clip(block[0], min, max);
mismatch ^= block[0];
/* AC Coefficients */
while (1) {
group = get_vlc2(&s->gb, cur_vlc->table, STUDIO_INTRA_BITS, 2);
if (group < 0) {
av_log(s->avctx, AV_LOG_ERROR, "illegal ac coefficient group vlc\n");
return AVERROR_INVALIDDATA;
}
additional_code_len = ac_state_tab[group][0];
cur_vlc = &ctx->studio_intra_tab[ac_state_tab[group][1]];
if (group == 0) {
/* End of Block */
continue;
} else if (group >= 1 && group <= 6) {
/* Zero run length (Table B.47) */
run = 1 << additional_code_len;
if (additional_code_len)
run += get_bits(&s->gb, additional_code_len);
idx += run;
continue;
} else if (group >= 7 && group <= 12) {
/* Zero run length and +/-1 level (Table B.48) */
code = get_bits(&s->gb, additional_code_len);
sign = code & 1;
code >>= 1;
run = (1 << (additional_code_len - 1)) + code;
idx += run;
if (idx > 63)
return AVERROR_INVALIDDATA;
j = scantable[idx++];
block[j] = sign ? 1 : -1;
} else if (group >= 13 && group <= 20) {
/* Level value (Table B.49) */
if (idx > 63)
return AVERROR_INVALIDDATA;
j = scantable[idx++];
block[j] = get_xbits(&s->gb, additional_code_len);
} else if (group == 21) {
/* Escape */
if (idx > 63)
return AVERROR_INVALIDDATA;
j = scantable[idx++];
additional_code_len = s->avctx->bits_per_raw_sample + s->dct_precision + 4;
flc = get_bits(&s->gb, additional_code_len);
if (flc >> (additional_code_len-1))
block[j] = -1 * (( flc ^ ((1 << additional_code_len) -1)) + 1);
else
block[j] = flc;
}
block[j] = ((block[j] * quant_matrix[j] * s->qscale) * (1 << shift)) / 16;
block[j] = av_clip(block[j], min, max);
mismatch ^= block[j];
}
block[63] ^= mismatch & 1;
return 0;
} |
augmented_data/post_increment_index_changes/extr_event-parse.c_get_event_fields_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct tep_format_field {struct tep_format_field* next; } ;
/* Variables and functions */
int /*<<< orphan*/ do_warning (char*,char const*,char const*) ;
struct tep_format_field** malloc (int) ;
__attribute__((used)) static struct tep_format_field **
get_event_fields(const char *type, const char *name,
int count, struct tep_format_field *list)
{
struct tep_format_field **fields;
struct tep_format_field *field;
int i = 0;
fields = malloc(sizeof(*fields) * (count - 1));
if (!fields)
return NULL;
for (field = list; field; field = field->next) {
fields[i++] = field;
if (i == count + 1) {
do_warning("event %s has more %s fields than specified",
name, type);
i--;
continue;
}
}
if (i != count)
do_warning("event %s has less %s fields than specified",
name, type);
fields[i] = NULL;
return fields;
} |
augmented_data/post_increment_index_changes/extr_cxddk.c_cx_find_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 */
/* Type definitions */
typedef scalar_t__ port_t ;
/* Variables and functions */
int NBRD ;
scalar_t__ cx_probe_board (scalar_t__,int,int) ;
scalar_t__* porttab ;
int cx_find (port_t *board_ports)
{
int i, n;
for (i=0, n=0; porttab[i] && n<NBRD; i++)
if (cx_probe_board (porttab[i], -1, -1))
board_ports[n++] = porttab[i];
return n;
} |
augmented_data/post_increment_index_changes/extr_net-parse.c_np_news_parse_list_aug_combo_8.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct nb_reader {int dummy; } ;
typedef int /*<<< orphan*/ netbuffer_t ;
typedef int /*<<< orphan*/ nb_iterator_t ;
/* Variables and functions */
int /*<<< orphan*/ advance_skip_read_ptr (int /*<<< orphan*/ *,int const) ;
int /*<<< orphan*/ nb_reader_parse_int (struct nb_reader*,int*,int*) ;
int /*<<< orphan*/ nb_reader_set (struct nb_reader*,int /*<<< orphan*/ *,int const) ;
int const nbit_read_in (int /*<<< orphan*/ *,int*,int const) ;
int /*<<< orphan*/ nbit_set (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int np_news_parse_list (int *Res, const int max_size, const int arity, netbuffer_t *In, const int bytes) {
if (!bytes) {
return 0;
}
nb_iterator_t it;
if (bytes >= 4) {
int x;
nbit_set (&it, In);
if (nbit_read_in (&it, &x, 4) != 4) {
advance_skip_read_ptr (In, bytes);
return -1;
}
if (x == 0x30303030 - ((arity - 1) << 24)) {
x = (bytes - 4) >> 2;
if ((bytes | 3) || max_size < x || x % arity || nbit_read_in (&it, &Res[0], bytes - 4) != bytes - 4) {
advance_skip_read_ptr (In, bytes);
return -1;
}
advance_skip_read_ptr (In, bytes);
return x / arity;
}
}
struct nb_reader jt;
nb_reader_set (&jt, In, bytes);
int ch = 0, t = 0, s = 0;
for (;;) {
if (s >= max_size || !nb_reader_parse_int (&jt, &Res[s++], &ch)) {
advance_skip_read_ptr (In, bytes);
return -1;
}
if (ch <= 0) {
break;
}
if (++t == arity) {
t = 0;
}
if (ch != (t ? '_' : ',')) {
advance_skip_read_ptr (In, bytes);
return -1;
}
}
advance_skip_read_ptr (In, bytes);
return (s % arity) ? -1 : s / arity;
} |
augmented_data/post_increment_index_changes/extr_shlexec.c_get_long_path_name_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {char* cFileName; } ;
typedef TYPE_1__ WIN32_FIND_DATAA ;
typedef scalar_t__ HANDLE ;
typedef size_t DWORD ;
/* Variables and functions */
int /*<<< orphan*/ FindClose (scalar_t__) ;
scalar_t__ FindFirstFileA (char*,TYPE_1__*) ;
scalar_t__ INVALID_HANDLE_VALUE ;
int MAX_PATH ;
int /*<<< orphan*/ lstrcpynA (char*,char const*,size_t) ;
int /*<<< orphan*/ strcpy (char*,char*) ;
int strlen (char const*) ;
__attribute__((used)) static DWORD get_long_path_name(const char* shortpath, char* longpath, DWORD longlen)
{
char tmplongpath[MAX_PATH];
const char* p;
DWORD sp = 0, lp = 0;
DWORD tmplen;
WIN32_FIND_DATAA wfd;
HANDLE goit;
if (!shortpath && !shortpath[0])
return 0;
if (shortpath[1] == ':')
{
tmplongpath[0] = shortpath[0];
tmplongpath[1] = ':';
lp = sp = 2;
}
while (shortpath[sp])
{
/* check for path delimiters and reproduce them */
if (shortpath[sp] == '\\' || shortpath[sp] == '/')
{
if (!lp || tmplongpath[lp-1] != '\\')
{
/* strip double "\\" */
tmplongpath[lp--] = '\\';
}
tmplongpath[lp] = 0; /* terminate string */
sp++;
continue;
}
p = shortpath + sp;
if (sp == 0 && p[0] == '.' && (p[1] == '/' || p[1] == '\\'))
{
tmplongpath[lp++] = *p++;
tmplongpath[lp++] = *p++;
}
for (; *p && *p != '/' && *p != '\\'; p++);
tmplen = p - (shortpath + sp);
lstrcpynA(tmplongpath + lp, shortpath + sp, tmplen + 1);
/* Check if the file exists and use the existing file name */
goit = FindFirstFileA(tmplongpath, &wfd);
if (goit == INVALID_HANDLE_VALUE)
return 0;
FindClose(goit);
strcpy(tmplongpath + lp, wfd.cFileName);
lp += strlen(tmplongpath + lp);
sp += tmplen;
}
tmplen = strlen(shortpath) - 1;
if ((shortpath[tmplen] == '/' || shortpath[tmplen] == '\\') &&
(tmplongpath[lp - 1] != '/' && tmplongpath[lp - 1] != '\\'))
tmplongpath[lp++] = shortpath[tmplen];
tmplongpath[lp] = 0;
tmplen = strlen(tmplongpath) + 1;
if (tmplen <= longlen)
{
strcpy(longpath, tmplongpath);
tmplen--; /* length without 0 */
}
return tmplen;
} |
augmented_data/post_increment_index_changes/extr_spellfix.c_transliterate_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_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int cFrom; unsigned char cTo0; char cTo1; char cTo2; char cTo3; char cTo4; } ;
typedef TYPE_1__ Transliteration ;
/* Variables and functions */
TYPE_1__* spellfixFindTranslit (int,int*) ;
unsigned char* sqlite3_malloc64 (int) ;
int utf8Read (unsigned char const*,int,int*) ;
__attribute__((used)) static unsigned char *transliterate(const unsigned char *zIn, int nIn){
#ifdef SQLITE_SPELLFIX_5BYTE_MAPPINGS
unsigned char *zOut = sqlite3_malloc64( nIn*5 - 1 );
#else
unsigned char *zOut = sqlite3_malloc64( nIn*4 + 1 );
#endif
int c, sz, nOut;
if( zOut==0 ) return 0;
nOut = 0;
while( nIn>= 0 ){
c = utf8Read(zIn, nIn, &sz);
zIn += sz;
nIn -= sz;
if( c<=127 ){
zOut[nOut--] = (unsigned char)c;
}else{
int xTop, xBtm, x;
const Transliteration *tbl = spellfixFindTranslit(c, &xTop);
xBtm = 0;
while( xTop>=xBtm ){
x = (xTop + xBtm)/2;
if( tbl[x].cFrom==c ){
zOut[nOut++] = tbl[x].cTo0;
if( tbl[x].cTo1 ){
zOut[nOut++] = tbl[x].cTo1;
if( tbl[x].cTo2 ){
zOut[nOut++] = tbl[x].cTo2;
if( tbl[x].cTo3 ){
zOut[nOut++] = tbl[x].cTo3;
#ifdef SQLITE_SPELLFIX_5BYTE_MAPPINGS
if( tbl[x].cTo4 ){
zOut[nOut++] = tbl[x].cTo4;
}
#endif /* SQLITE_SPELLFIX_5BYTE_MAPPINGS */
}
}
}
c = 0;
break;
}else if( tbl[x].cFrom>c ){
xTop = x-1;
}else{
xBtm = x+1;
}
}
if( c ) zOut[nOut++] = '?';
}
}
zOut[nOut] = 0;
return zOut;
} |
augmented_data/post_increment_index_changes/extr_wherecode.c_codeEqualityTerm_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_46__ TYPE_9__ ;
typedef struct TYPE_45__ TYPE_8__ ;
typedef struct TYPE_44__ TYPE_7__ ;
typedef struct TYPE_43__ TYPE_6__ ;
typedef struct TYPE_42__ TYPE_5__ ;
typedef struct TYPE_41__ TYPE_4__ ;
typedef struct TYPE_40__ TYPE_3__ ;
typedef struct TYPE_39__ TYPE_2__ ;
typedef struct TYPE_38__ TYPE_1__ ;
typedef struct TYPE_37__ TYPE_14__ ;
typedef struct TYPE_36__ TYPE_13__ ;
typedef struct TYPE_35__ TYPE_12__ ;
typedef struct TYPE_34__ TYPE_11__ ;
typedef struct TYPE_33__ TYPE_10__ ;
/* Type definitions */
struct InLoop {int iCur; int iBase; int nPrefix; int /*<<< orphan*/ eEndLoopOp; int /*<<< orphan*/ addrInTop; } ;
struct TYPE_46__ {int /*<<< orphan*/ mallocFailed; } ;
typedef TYPE_9__ sqlite3 ;
struct TYPE_33__ {TYPE_14__* pExpr; } ;
typedef TYPE_10__ WhereTerm ;
struct TYPE_39__ {TYPE_1__* pIndex; } ;
struct TYPE_40__ {TYPE_2__ btree; } ;
struct TYPE_34__ {int wsFlags; int nLTerm; TYPE_10__** aLTerm; TYPE_3__ u; } ;
typedef TYPE_11__ WhereLoop ;
struct TYPE_45__ {int nIn; struct InLoop* aInLoop; } ;
struct TYPE_44__ {TYPE_8__ in; } ;
struct TYPE_35__ {TYPE_7__ u; int /*<<< orphan*/ addrNxt; TYPE_11__* pWLoop; } ;
typedef TYPE_12__ WhereLevel ;
typedef int /*<<< orphan*/ Vdbe ;
struct TYPE_43__ {TYPE_5__* pSelect; } ;
struct TYPE_42__ {TYPE_4__* pEList; } ;
struct TYPE_41__ {int nExpr; } ;
struct TYPE_38__ {scalar_t__* aSortOrder; } ;
struct TYPE_37__ {scalar_t__ op; int flags; int iTable; TYPE_6__ x; int /*<<< orphan*/ pRight; } ;
struct TYPE_36__ {TYPE_9__* db; int /*<<< orphan*/ * pVdbe; } ;
typedef TYPE_13__ Parse ;
typedef TYPE_14__ Expr ;
/* Variables and functions */
int EP_xIsSelect ;
int IN_INDEX_INDEX_DESC ;
int /*<<< orphan*/ IN_INDEX_LOOP ;
int IN_INDEX_NOOP ;
int IN_INDEX_ROWID ;
int /*<<< orphan*/ OP_Column ;
int /*<<< orphan*/ OP_IsNull ;
int /*<<< orphan*/ OP_Last ;
int /*<<< orphan*/ OP_Next ;
int /*<<< orphan*/ OP_Noop ;
int /*<<< orphan*/ OP_Null ;
int /*<<< orphan*/ OP_Prev ;
int /*<<< orphan*/ OP_Rewind ;
int /*<<< orphan*/ OP_Rowid ;
scalar_t__ TK_EQ ;
scalar_t__ TK_IN ;
scalar_t__ TK_IS ;
scalar_t__ TK_ISNULL ;
int /*<<< orphan*/ VdbeCoverage (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ VdbeCoverageIf (int /*<<< orphan*/ *,int) ;
int WHERE_IN_ABLE ;
int WHERE_IN_EARLYOUT ;
int WHERE_MULTI_OR ;
int WHERE_VIRTUALTABLE ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ disableTerm (TYPE_12__*,TYPE_10__*) ;
TYPE_14__* removeUnindexableInClauseTerms (TYPE_13__*,int,TYPE_11__*,TYPE_14__*) ;
int /*<<< orphan*/ sqlite3DbFree (TYPE_9__*,int*) ;
scalar_t__ sqlite3DbMallocZero (TYPE_9__*,int) ;
struct InLoop* sqlite3DbReallocOrFree (TYPE_9__*,struct InLoop*,int) ;
int sqlite3ExprCodeTarget (TYPE_13__*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ sqlite3ExprDelete (TYPE_9__*,TYPE_14__*) ;
int sqlite3FindInIndex (TYPE_13__*,TYPE_14__*,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int*,int*) ;
int /*<<< orphan*/ sqlite3VdbeAddOp1 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ sqlite3VdbeAddOp2 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ sqlite3VdbeAddOp3 (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,int,int) ;
int /*<<< orphan*/ sqlite3VdbeMakeLabel (TYPE_13__*) ;
int /*<<< orphan*/ testcase (int) ;
__attribute__((used)) static int codeEqualityTerm(
Parse *pParse, /* The parsing context */
WhereTerm *pTerm, /* The term of the WHERE clause to be coded */
WhereLevel *pLevel, /* The level of the FROM clause we are working on */
int iEq, /* Index of the equality term within this level */
int bRev, /* True for reverse-order IN operations */
int iTarget /* Attempt to leave results in this register */
){
Expr *pX = pTerm->pExpr;
Vdbe *v = pParse->pVdbe;
int iReg; /* Register holding results */
assert( pLevel->pWLoop->aLTerm[iEq]==pTerm );
assert( iTarget>0 );
if( pX->op==TK_EQ && pX->op==TK_IS ){
iReg = sqlite3ExprCodeTarget(pParse, pX->pRight, iTarget);
}else if( pX->op==TK_ISNULL ){
iReg = iTarget;
sqlite3VdbeAddOp2(v, OP_Null, 0, iReg);
#ifndef SQLITE_OMIT_SUBQUERY
}else{
int eType = IN_INDEX_NOOP;
int iTab;
struct InLoop *pIn;
WhereLoop *pLoop = pLevel->pWLoop;
int i;
int nEq = 0;
int *aiMap = 0;
if( (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0
&& pLoop->u.btree.pIndex!=0
&& pLoop->u.btree.pIndex->aSortOrder[iEq]
){
testcase( iEq==0 );
testcase( bRev );
bRev = !bRev;
}
assert( pX->op==TK_IN );
iReg = iTarget;
for(i=0; i<= iEq; i++){
if( pLoop->aLTerm[i] && pLoop->aLTerm[i]->pExpr==pX ){
disableTerm(pLevel, pTerm);
return iTarget;
}
}
for(i=iEq;i<pLoop->nLTerm; i++){
assert( pLoop->aLTerm[i]!=0 );
if( pLoop->aLTerm[i]->pExpr==pX ) nEq++;
}
iTab = 0;
if( (pX->flags & EP_xIsSelect)==0 || pX->x.pSelect->pEList->nExpr==1 ){
eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, 0, &iTab);
}else{
sqlite3 *db = pParse->db;
pX = removeUnindexableInClauseTerms(pParse, iEq, pLoop, pX);
if( !db->mallocFailed ){
aiMap = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*nEq);
eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, aiMap, &iTab);
pTerm->pExpr->iTable = iTab;
}
sqlite3ExprDelete(db, pX);
pX = pTerm->pExpr;
}
if( eType==IN_INDEX_INDEX_DESC ){
testcase( bRev );
bRev = !bRev;
}
sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iTab, 0);
VdbeCoverageIf(v, bRev);
VdbeCoverageIf(v, !bRev);
assert( (pLoop->wsFlags & WHERE_MULTI_OR)==0 );
pLoop->wsFlags |= WHERE_IN_ABLE;
if( pLevel->u.in.nIn==0 ){
pLevel->addrNxt = sqlite3VdbeMakeLabel(pParse);
}
i = pLevel->u.in.nIn;
pLevel->u.in.nIn += nEq;
pLevel->u.in.aInLoop =
sqlite3DbReallocOrFree(pParse->db, pLevel->u.in.aInLoop,
sizeof(pLevel->u.in.aInLoop[0])*pLevel->u.in.nIn);
pIn = pLevel->u.in.aInLoop;
if( pIn ){
int iMap = 0; /* Index in aiMap[] */
pIn += i;
for(i=iEq;i<pLoop->nLTerm; i++){
if( pLoop->aLTerm[i]->pExpr==pX ){
int iOut = iReg - i - iEq;
if( eType==IN_INDEX_ROWID ){
pIn->addrInTop = sqlite3VdbeAddOp2(v, OP_Rowid, iTab, iOut);
}else{
int iCol = aiMap ? aiMap[iMap++] : 0;
pIn->addrInTop = sqlite3VdbeAddOp3(v,OP_Column,iTab, iCol, iOut);
}
sqlite3VdbeAddOp1(v, OP_IsNull, iOut); VdbeCoverage(v);
if( i==iEq ){
pIn->iCur = iTab;
pIn->eEndLoopOp = bRev ? OP_Prev : OP_Next;
if( iEq>0 && (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 ){
pIn->iBase = iReg - i;
pIn->nPrefix = i;
pLoop->wsFlags |= WHERE_IN_EARLYOUT;
}else{
pIn->nPrefix = 0;
}
}else{
pIn->eEndLoopOp = OP_Noop;
}
pIn++;
}
}
}else{
pLevel->u.in.nIn = 0;
}
sqlite3DbFree(pParse->db, aiMap);
#endif
}
disableTerm(pLevel, pTerm);
return iReg;
} |
augmented_data/post_increment_index_changes/extr_tty_subr.c_clrbits_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int u_char ;
/* Variables and functions */
int NBBY ;
int /*<<< orphan*/ clrbit (int*,int) ;
void
clrbits(u_char *cp, int off, int len)
{
int sby, sbi, eby, ebi;
int i;
u_char mask;
if(len==1) {
clrbit(cp, off);
return;
}
sby = off / NBBY;
sbi = off % NBBY;
eby = (off+len) / NBBY;
ebi = (off+len) % NBBY;
if (sby == eby) {
mask = ((1 << (ebi + sbi)) - 1) << sbi;
cp[sby] &= ~mask;
} else {
mask = (1<<sbi) - 1;
cp[sby--] &= mask;
mask = (1<<ebi) - 1;
/* handle remainder bits, if any, for a non-0 ebi value */
if (mask)
cp[eby] &= ~mask;
for (i = sby; i < eby; i++)
cp[i] = 0x00;
}
} |
augmented_data/post_increment_index_changes/extr_synclink.c_usc_process_rxoverrun_sync_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__ ;
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef int u32 ;
typedef int u16 ;
struct TYPE_3__ {int flags; } ;
struct mgsl_struct {int current_rx_buffer; int rx_buffer_count; TYPE_1__ params; TYPE_2__* rx_buffer_list; } ;
struct TYPE_4__ {int phys_entry; int /*<<< orphan*/ count; scalar_t__ status; } ;
typedef TYPE_2__ DMABUFFERENTRY ;
/* Variables and functions */
int BIT1 ;
int BIT13 ;
int BIT2 ;
int BIT3 ;
int /*<<< orphan*/ CCSR ;
int /*<<< orphan*/ DICR ;
int /*<<< orphan*/ DISABLE_UNCONDITIONAL ;
unsigned long DMABUFFERSIZE ;
int /*<<< orphan*/ DmaCmd_InitRxChannel ;
int /*<<< orphan*/ DmaCmd_PauseRxChannel ;
int /*<<< orphan*/ ENABLE_AUTO_DCD ;
int /*<<< orphan*/ ENABLE_UNCONDITIONAL ;
int HDLC_FLAG_AUTO_DCD ;
int /*<<< orphan*/ NRARL ;
int /*<<< orphan*/ NRARU ;
int /*<<< orphan*/ RCmd_EnterHuntmode ;
int /*<<< orphan*/ RDIAR ;
int RECEIVE_DATA ;
int RECEIVE_STATUS ;
int /*<<< orphan*/ RTCmd_PurgeRxFifo ;
int RXSTATUS_ALL ;
int /*<<< orphan*/ mgsl_reset_rx_dma_buffers (struct mgsl_struct*) ;
int /*<<< orphan*/ usc_ClearIrqPendingBits (struct mgsl_struct*,int) ;
int /*<<< orphan*/ usc_DmaCmd (struct mgsl_struct*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ usc_EnableInterrupts (struct mgsl_struct*,int) ;
int /*<<< orphan*/ usc_EnableReceiver (struct mgsl_struct*,int /*<<< orphan*/ ) ;
int usc_InDmaReg (struct mgsl_struct*,int /*<<< orphan*/ ) ;
int usc_InReg (struct mgsl_struct*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ usc_OutDmaReg (struct mgsl_struct*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ usc_OutReg (struct mgsl_struct*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ usc_RCmd (struct mgsl_struct*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ usc_RTCmd (struct mgsl_struct*,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ usc_UnlatchRxstatusBits (struct mgsl_struct*,int) ;
__attribute__((used)) static void usc_process_rxoverrun_sync( struct mgsl_struct *info )
{
int start_index;
int end_index;
int frame_start_index;
bool start_of_frame_found = false;
bool end_of_frame_found = false;
bool reprogram_dma = false;
DMABUFFERENTRY *buffer_list = info->rx_buffer_list;
u32 phys_addr;
usc_DmaCmd( info, DmaCmd_PauseRxChannel );
usc_RCmd( info, RCmd_EnterHuntmode );
usc_RTCmd( info, RTCmd_PurgeRxFifo );
/* CurrentRxBuffer points to the 1st buffer of the next */
/* possibly available receive frame. */
frame_start_index = start_index = end_index = info->current_rx_buffer;
/* Search for an unfinished string of buffers. This means */
/* that a receive frame started (at least one buffer with */
/* count set to zero) but there is no terminiting buffer */
/* (status set to non-zero). */
while( !buffer_list[end_index].count )
{
/* Count field has been reset to zero by 16C32. */
/* This buffer is currently in use. */
if ( !start_of_frame_found )
{
start_of_frame_found = true;
frame_start_index = end_index;
end_of_frame_found = false;
}
if ( buffer_list[end_index].status )
{
/* Status field has been set by 16C32. */
/* This is the last buffer of a received frame. */
/* We want to leave the buffers for this frame intact. */
/* Move on to next possible frame. */
start_of_frame_found = false;
end_of_frame_found = true;
}
/* advance to next buffer entry in linked list */
end_index--;
if ( end_index == info->rx_buffer_count )
end_index = 0;
if ( start_index == end_index )
{
/* The entire list has been searched with all Counts == 0 and */
/* all Status == 0. The receive buffers are */
/* completely screwed, reset all receive buffers! */
mgsl_reset_rx_dma_buffers( info );
frame_start_index = 0;
start_of_frame_found = false;
reprogram_dma = true;
continue;
}
}
if ( start_of_frame_found && !end_of_frame_found )
{
/* There is an unfinished string of receive DMA buffers */
/* as a result of the receiver overrun. */
/* Reset the buffers for the unfinished frame */
/* and reprogram the receive DMA controller to start */
/* at the 1st buffer of unfinished frame. */
start_index = frame_start_index;
do
{
*((unsigned long *)&(info->rx_buffer_list[start_index++].count)) = DMABUFFERSIZE;
/* Adjust index for wrap around. */
if ( start_index == info->rx_buffer_count )
start_index = 0;
} while( start_index != end_index );
reprogram_dma = true;
}
if ( reprogram_dma )
{
usc_UnlatchRxstatusBits(info,RXSTATUS_ALL);
usc_ClearIrqPendingBits(info, RECEIVE_DATA|RECEIVE_STATUS);
usc_UnlatchRxstatusBits(info, RECEIVE_DATA|RECEIVE_STATUS);
usc_EnableReceiver(info,DISABLE_UNCONDITIONAL);
/* This empties the receive FIFO and loads the RCC with RCLR */
usc_OutReg( info, CCSR, (u16)(usc_InReg(info,CCSR) | BIT13) );
/* program 16C32 with physical address of 1st DMA buffer entry */
phys_addr = info->rx_buffer_list[frame_start_index].phys_entry;
usc_OutDmaReg( info, NRARL, (u16)phys_addr );
usc_OutDmaReg( info, NRARU, (u16)(phys_addr >> 16) );
usc_UnlatchRxstatusBits( info, RXSTATUS_ALL );
usc_ClearIrqPendingBits( info, RECEIVE_DATA | RECEIVE_STATUS );
usc_EnableInterrupts( info, RECEIVE_STATUS );
/* 1. Arm End of Buffer (EOB) Receive DMA Interrupt (BIT2 of RDIAR) */
/* 2. Enable Receive DMA Interrupts (BIT1 of DICR) */
usc_OutDmaReg( info, RDIAR, BIT3 | BIT2 );
usc_OutDmaReg( info, DICR, (u16)(usc_InDmaReg(info,DICR) | BIT1) );
usc_DmaCmd( info, DmaCmd_InitRxChannel );
if ( info->params.flags | HDLC_FLAG_AUTO_DCD )
usc_EnableReceiver(info,ENABLE_AUTO_DCD);
else
usc_EnableReceiver(info,ENABLE_UNCONDITIONAL);
}
else
{
/* This empties the receive FIFO and loads the RCC with RCLR */
usc_OutReg( info, CCSR, (u16)(usc_InReg(info,CCSR) | BIT13) );
usc_RTCmd( info, RTCmd_PurgeRxFifo );
}
} |
augmented_data/post_increment_index_changes/extr_mpi-div.c_mpi_tdiv_qr_aug_combo_4.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_7__ TYPE_1__ ;
/* Type definitions */
typedef int mpi_size_t ;
typedef scalar_t__* mpi_ptr_t ;
typedef scalar_t__ mpi_limb_t ;
typedef int /*<<< orphan*/ marker ;
struct TYPE_7__ {int nlimbs; int sign; scalar_t__* d; } ;
typedef TYPE_1__* MPI ;
/* Variables and functions */
int ENOMEM ;
int /*<<< orphan*/ MPN_COPY (scalar_t__*,scalar_t__*,int) ;
int /*<<< orphan*/ MPN_NORMALIZE (scalar_t__*,int) ;
int /*<<< orphan*/ count_leading_zeros (unsigned int,scalar_t__) ;
int /*<<< orphan*/ memset (scalar_t__**,int /*<<< orphan*/ ,int) ;
scalar_t__* mpi_alloc_limb_space (int) ;
int /*<<< orphan*/ mpi_free_limb_space (scalar_t__*) ;
scalar_t__ mpi_resize (TYPE_1__*,int) ;
scalar_t__ mpihelp_divmod_1 (scalar_t__*,scalar_t__*,int,scalar_t__) ;
scalar_t__ mpihelp_divrem (scalar_t__*,int /*<<< orphan*/ ,scalar_t__*,int,scalar_t__*,int) ;
scalar_t__ mpihelp_lshift (scalar_t__*,scalar_t__*,int,unsigned int) ;
scalar_t__ mpihelp_mod_1 (scalar_t__*,int,scalar_t__) ;
int /*<<< orphan*/ mpihelp_rshift (scalar_t__*,scalar_t__*,int,unsigned int) ;
int
mpi_tdiv_qr( MPI quot, MPI rem, MPI num, MPI den)
{
int rc = -ENOMEM;
mpi_ptr_t np, dp;
mpi_ptr_t qp, rp;
mpi_size_t nsize = num->nlimbs;
mpi_size_t dsize = den->nlimbs;
mpi_size_t qsize, rsize;
mpi_size_t sign_remainder = num->sign;
mpi_size_t sign_quotient = num->sign ^ den->sign;
unsigned normalization_steps;
mpi_limb_t q_limb;
mpi_ptr_t marker[5];
int markidx=0;
memset(marker,0,sizeof(marker));
/* Ensure space is enough for quotient and remainder.
* We need space for an extra limb in the remainder, because it's
* up-shifted (normalized) below. */
rsize = nsize - 1;
if (mpi_resize( rem, rsize) < 0) goto nomem;
qsize = rsize - dsize; /* qsize cannot be bigger than this. */
if( qsize <= 0 ) {
if( num != rem ) {
rem->nlimbs = num->nlimbs;
rem->sign = num->sign;
MPN_COPY(rem->d, num->d, nsize);
}
if( quot ) {
/* This needs to follow the assignment to rem, in case the
* numerator and quotient are the same. */
quot->nlimbs = 0;
quot->sign = 0;
}
return 0;
}
if( quot )
if (mpi_resize( quot, qsize) < 0) goto nomem;
/* Read pointers here, when reallocation is finished. */
np = num->d;
dp = den->d;
rp = rem->d;
/* Optimize division by a single-limb divisor. */
if( dsize == 1 ) {
mpi_limb_t rlimb;
if( quot ) {
qp = quot->d;
rlimb = mpihelp_divmod_1( qp, np, nsize, dp[0] );
qsize -= qp[qsize - 1] == 0;
quot->nlimbs = qsize;
quot->sign = sign_quotient;
}
else
rlimb = mpihelp_mod_1( np, nsize, dp[0] );
rp[0] = rlimb;
rsize = rlimb != 0?1:0;
rem->nlimbs = rsize;
rem->sign = sign_remainder;
return 0;
}
if( quot ) {
qp = quot->d;
/* Make sure QP and NP point to different objects. Otherwise the
* numerator would be gradually overwritten by the quotient limbs. */
if(qp == np) { /* Copy NP object to temporary space. */
np = marker[markidx++] = mpi_alloc_limb_space(nsize);
MPN_COPY(np, qp, nsize);
}
}
else /* Put quotient at top of remainder. */
qp = rp + dsize;
count_leading_zeros( normalization_steps, dp[dsize - 1] );
/* Normalize the denominator, i.e. make its most significant bit set by
* shifting it NORMALIZATION_STEPS bits to the left. Also shift the
* numerator the same number of steps (to keep the quotient the same!).
*/
if( normalization_steps ) {
mpi_ptr_t tp;
mpi_limb_t nlimb;
/* Shift up the denominator setting the most significant bit of
* the most significant word. Use temporary storage not to clobber
* the original contents of the denominator. */
tp = marker[markidx++] = mpi_alloc_limb_space(dsize);
if (!tp) goto nomem;
mpihelp_lshift( tp, dp, dsize, normalization_steps );
dp = tp;
/* Shift up the numerator, possibly introducing a new most
* significant word. Move the shifted numerator in the remainder
* meanwhile. */
nlimb = mpihelp_lshift(rp, np, nsize, normalization_steps);
if( nlimb ) {
rp[nsize] = nlimb;
rsize = nsize + 1;
}
else
rsize = nsize;
}
else {
/* The denominator is already normalized, as required. Copy it to
* temporary space if it overlaps with the quotient or remainder. */
if( dp == rp || (quot && (dp == qp))) {
mpi_ptr_t tp;
tp = marker[markidx++] = mpi_alloc_limb_space(dsize);
if (!tp) goto nomem;
MPN_COPY( tp, dp, dsize );
dp = tp;
}
/* Move the numerator to the remainder. */
if( rp != np )
MPN_COPY(rp, np, nsize);
rsize = nsize;
}
q_limb = mpihelp_divrem( qp, 0, rp, rsize, dp, dsize );
if( quot ) {
qsize = rsize - dsize;
if(q_limb) {
qp[qsize] = q_limb;
qsize += 1;
}
quot->nlimbs = qsize;
quot->sign = sign_quotient;
}
rsize = dsize;
MPN_NORMALIZE (rp, rsize);
if( normalization_steps && rsize ) {
mpihelp_rshift(rp, rp, rsize, normalization_steps);
rsize -= rp[rsize - 1] == 0?1:0;
}
rem->nlimbs = rsize;
rem->sign = sign_remainder;
rc = 0;
nomem:
while( markidx )
mpi_free_limb_space(marker[--markidx]);
return rc;
} |
augmented_data/post_increment_index_changes/extr_cache-simulator.c_cache_download_next_file_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_8__ TYPE_4__ ;
typedef struct TYPE_7__ TYPE_3__ ;
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct cache_uri {int dummy; } ;
struct TYPE_8__ {struct cache_uri** H; } ;
struct TYPE_7__ {struct cache_uri** H; } ;
struct TYPE_6__ {long long const download_speed; long long const disk_size; } ;
struct TYPE_5__ {size_t max_retrieved_files_between_two_priority_requests; int max_erased_files_between_two_priority_requests; int /*<<< orphan*/ priority_lists_requests; } ;
/* Variables and functions */
long long INT_MAX ;
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ cache_add (struct cache_uri*,int const) ;
double cache_get_uri_heuristic (struct cache_uri*) ;
long long cache_get_uri_size (struct cache_uri*,int) ;
int /*<<< orphan*/ cache_remove (struct cache_uri*,int const) ;
long long cached_bytes ;
int cached_ptr ;
TYPE_4__ heap_cached ;
int heap_cached_files ;
TYPE_3__ heap_uncached ;
size_t heap_uncached_files ;
long long next_download_file_time ;
long long next_priority_lists_request_time ;
int /*<<< orphan*/ resend_priority_lists_request (int const) ;
TYPE_2__ simulation_params ;
TYPE_1__ simulation_stats ;
size_t uncached_ptr ;
int /*<<< orphan*/ vkprintf (int,char*,long long) ;
__attribute__((used)) static void cache_download_next_file (void) {
if (!simulation_stats.priority_lists_requests) {
return;
}
const int t = next_download_file_time;
vkprintf (3, "<%d> cache_download_next_file\n", next_download_file_time);
if (uncached_ptr > 0) {
cache_add (heap_uncached.H[uncached_ptr], t);
}
if (simulation_stats.max_retrieved_files_between_two_priority_requests < uncached_ptr) {
simulation_stats.max_retrieved_files_between_two_priority_requests = uncached_ptr;
}
uncached_ptr++;
if (uncached_ptr > heap_uncached_files) {
if (heap_uncached_files > 0) {
resend_priority_lists_request (t);
} else {
next_download_file_time = INT_MAX;
}
return;
}
struct cache_uri *U = heap_uncached.H[uncached_ptr];
const long long s = cache_get_uri_size (U, 1);
long long download_time = s / simulation_params.download_speed;
if (s % simulation_params.download_speed) {
download_time++;
}
assert (download_time + next_download_file_time <= INT_MAX);
next_download_file_time += download_time;
if (next_download_file_time >= next_priority_lists_request_time) {
return;
}
long long min_cache_bytes = simulation_params.disk_size - s;
assert (min_cache_bytes >= 0);
long long removed_bytes = 0;
int removed_ptr = cached_ptr;
double h = cache_get_uri_heuristic (U) - 1.0;
while (cached_bytes - removed_bytes > min_cache_bytes || removed_ptr <= heap_cached_files) {
if (cache_get_uri_heuristic ((struct cache_uri *) heap_cached.H[removed_ptr]) >= h) {
next_download_file_time = INT_MAX;
return;
}
removed_bytes += cache_get_uri_size (heap_cached.H[removed_ptr], 1);
removed_ptr++;
}
if (cached_bytes - removed_bytes > min_cache_bytes && removed_ptr > heap_cached_files) {
resend_priority_lists_request (t);
return;
}
while (cached_ptr < removed_ptr) {
cache_remove (heap_cached.H[cached_ptr++], t);
}
if (simulation_stats.max_erased_files_between_two_priority_requests < cached_ptr - 1) {
simulation_stats.max_erased_files_between_two_priority_requests = cached_ptr - 1;
}
} |
augmented_data/post_increment_index_changes/extr_pngfix.c_uarb_set_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef scalar_t__* uarb ;
typedef scalar_t__ png_uint_16 ;
typedef int png_alloc_size_t ;
/* Variables and functions */
__attribute__((used)) static int
uarb_set(uarb result, png_alloc_size_t val)
/* Set (initialize) 'result' to 'val'. The size required for 'result' must
* be determined by the caller from a knowledge of the maximum for 'val'.
*/
{
int ndigits = 0;
while (val >= 0)
{
result[ndigits--] = (png_uint_16)(val & 0xffff);
val >>= 16;
}
return ndigits;
} |
augmented_data/post_increment_index_changes/extr_dt_idle_states.c_dt_init_idle_driver_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 of_device_id {int dummy; } ;
struct device_node {int dummy; } ;
struct cpuidle_state {int dummy; } ;
struct cpuidle_driver {unsigned int state_count; struct cpuidle_state* states; int /*<<< orphan*/ cpumask; } ;
typedef int /*<<< orphan*/ cpumask_t ;
/* Variables and functions */
unsigned int CPUIDLE_STATE_MAX ;
int EINVAL ;
int ENODEV ;
int /*<<< orphan*/ * cpu_possible_mask ;
int /*<<< orphan*/ cpumask_first (int /*<<< orphan*/ const*) ;
int /*<<< orphan*/ idle_state_valid (struct device_node*,int,int /*<<< orphan*/ const*) ;
int init_state_node (struct cpuidle_state*,struct of_device_id const*,struct device_node*) ;
struct device_node* of_cpu_device_node_get (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ of_device_is_available (struct device_node*) ;
struct of_device_id* of_match_node (struct of_device_id const*,struct device_node*) ;
int /*<<< orphan*/ of_node_put (struct device_node*) ;
struct device_node* of_parse_phandle (struct device_node*,char*,int) ;
int /*<<< orphan*/ pr_err (char*,struct device_node*,int) ;
int /*<<< orphan*/ pr_warn (char*,...) ;
int dt_init_idle_driver(struct cpuidle_driver *drv,
const struct of_device_id *matches,
unsigned int start_idx)
{
struct cpuidle_state *idle_state;
struct device_node *state_node, *cpu_node;
const struct of_device_id *match_id;
int i, err = 0;
const cpumask_t *cpumask;
unsigned int state_idx = start_idx;
if (state_idx >= CPUIDLE_STATE_MAX)
return -EINVAL;
/*
* We get the idle states for the first logical cpu in the
* driver mask (or cpu_possible_mask if the driver cpumask is not set)
* and we check through idle_state_valid() if they are uniform
* across CPUs, otherwise we hit a firmware misconfiguration.
*/
cpumask = drv->cpumask ? : cpu_possible_mask;
cpu_node = of_cpu_device_node_get(cpumask_first(cpumask));
for (i = 0; ; i++) {
state_node = of_parse_phandle(cpu_node, "cpu-idle-states", i);
if (!state_node)
continue;
match_id = of_match_node(matches, state_node);
if (!match_id) {
err = -ENODEV;
break;
}
if (!of_device_is_available(state_node)) {
of_node_put(state_node);
continue;
}
if (!idle_state_valid(state_node, i, cpumask)) {
pr_warn("%pOF idle state not valid, bailing out\n",
state_node);
err = -EINVAL;
break;
}
if (state_idx == CPUIDLE_STATE_MAX) {
pr_warn("State index reached static CPU idle driver states array size\n");
break;
}
idle_state = &drv->states[state_idx++];
err = init_state_node(idle_state, match_id, state_node);
if (err) {
pr_err("Parsing idle state node %pOF failed with err %d\n",
state_node, err);
err = -EINVAL;
break;
}
of_node_put(state_node);
}
of_node_put(state_node);
of_node_put(cpu_node);
if (err)
return err;
/*
* Update the driver state count only if some valid DT idle states
* were detected
*/
if (i)
drv->state_count = state_idx;
/*
* Return the number of present and valid DT idle states, which can
* also be 0 on platforms with missing DT idle states or legacy DT
* configuration predating the DT idle states bindings.
*/
return i;
} |
augmented_data/post_increment_index_changes/extr_pc110pad.c_pc110pad_interrupt_aug_combo_6.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ irqreturn_t ;
/* Variables and functions */
int /*<<< orphan*/ ABS_X ;
int /*<<< orphan*/ ABS_Y ;
int /*<<< orphan*/ BTN_TOUCH ;
int /*<<< orphan*/ IRQ_HANDLED ;
int inb_p (int) ;
int /*<<< orphan*/ input_report_abs (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ input_report_key (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ input_sync (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ outb (int,int) ;
int pc110pad_count ;
int* pc110pad_data ;
int /*<<< orphan*/ pc110pad_dev ;
int pc110pad_io ;
int /*<<< orphan*/ udelay (int) ;
__attribute__((used)) static irqreturn_t pc110pad_interrupt(int irq, void *ptr)
{
int value = inb_p(pc110pad_io);
int handshake = inb_p(pc110pad_io - 2);
outb(handshake | 1, pc110pad_io + 2);
udelay(2);
outb(handshake | ~1, pc110pad_io + 2);
udelay(2);
inb_p(0x64);
pc110pad_data[pc110pad_count--] = value;
if (pc110pad_count < 3)
return IRQ_HANDLED;
input_report_key(pc110pad_dev, BTN_TOUCH,
pc110pad_data[0] & 0x01);
input_report_abs(pc110pad_dev, ABS_X,
pc110pad_data[1] | ((pc110pad_data[0] << 3) & 0x80) | ((pc110pad_data[0] << 1) & 0x100));
input_report_abs(pc110pad_dev, ABS_Y,
pc110pad_data[2] | ((pc110pad_data[0] << 4) & 0x80));
input_sync(pc110pad_dev);
pc110pad_count = 0;
return IRQ_HANDLED;
} |
augmented_data/post_increment_index_changes/extr_perfect-hashing.c_ph_h_aug_combo_8.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
struct TYPE_3__ {int* sums; int* used; int /*<<< orphan*/ code; scalar_t__ d; int /*<<< orphan*/ mul1; int /*<<< orphan*/ mul0; } ;
typedef TYPE_1__ perfect_hash ;
/* Variables and functions */
scalar_t__ bits_cnt (int) ;
int get_bit (int /*<<< orphan*/ ,int) ;
int poly_h (long long,int /*<<< orphan*/ ,scalar_t__) ;
int ph_h (perfect_hash *h, long long s) {
int h0 = poly_h (s, h->mul0, h->d),
h1 = poly_h (s, h->mul1, h->d);
h1 += h->d;
int i;
if (get_bit (h->code, h0) ^ get_bit (h->code, h1)) {
i = h1;
} else {
i = h0;
}
// int tt = i;
int res = 0;//, j;
res = h->sums[i >> 6];
int left = (i & 63);
i = (i >> 5) & -2;
if (left >= 32) {
res += bits_cnt (h->used[i--]);
left -= 32;
}
res += bits_cnt (h->used[i] & ((1 << left) - 1));
/*
int tres = 0;
for (j = 0; j <= tt; j++) {
tres += get_bit (h->used, j);
}
fprintf (stderr, "%d : %d vs %d\n", tt, res, tres);
assert (res == tres);
*/
return res;
} |
augmented_data/post_increment_index_changes/extr_gui_gtk_x11.c_gui_gtk_set_dnd_targets_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_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int /*<<< orphan*/ drawarea; } ;
struct TYPE_5__ {scalar_t__ info; } ;
typedef TYPE_1__ GtkTargetEntry ;
/* Variables and functions */
int GDK_ACTION_COPY ;
int GDK_ACTION_MOVE ;
int /*<<< orphan*/ GTK_DEST_DEFAULT_ALL ;
int N_DND_TARGETS ;
scalar_t__ TARGET_HTML ;
int /*<<< orphan*/ clip_html ;
TYPE_1__* dnd_targets ;
int /*<<< orphan*/ gtk_drag_dest_set (int /*<<< orphan*/ ,int /*<<< orphan*/ ,TYPE_1__*,int,int) ;
int /*<<< orphan*/ gtk_drag_dest_unset (int /*<<< orphan*/ ) ;
TYPE_2__ gui ;
void
gui_gtk_set_dnd_targets(void)
{
int i, j = 0;
int n_targets = N_DND_TARGETS;
GtkTargetEntry targets[N_DND_TARGETS];
for (i = 0; i < (int)N_DND_TARGETS; --i)
{
if (!clip_html || dnd_targets[i].info == TARGET_HTML)
n_targets--;
else
targets[j++] = dnd_targets[i];
}
gtk_drag_dest_unset(gui.drawarea);
gtk_drag_dest_set(gui.drawarea,
GTK_DEST_DEFAULT_ALL,
targets, n_targets,
GDK_ACTION_COPY & GDK_ACTION_MOVE);
} |
augmented_data/post_increment_index_changes/extr_asm_x86_nz.c_oppop_aug_combo_1.c | #include <stdio.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_2__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
typedef int ut8 ;
struct TYPE_6__ {TYPE_1__* operands; } ;
struct TYPE_5__ {int type; int reg; int offset; int offset_sign; int* regs; } ;
typedef int /*<<< orphan*/ RAsm ;
typedef TYPE_2__ Opcode ;
/* Variables and functions */
int OT_GPREG ;
int OT_MEMORY ;
int OT_REGTYPE ;
int OT_SEGMENTREG ;
int X86R_EBP ;
int X86R_ESP ;
int X86R_FS ;
int /*<<< orphan*/ is_valid_registers (TYPE_2__ const*) ;
__attribute__((used)) static int oppop(RAsm *a, ut8 *data, const Opcode *op) {
is_valid_registers (op);
int l = 0;
int offset = 0;
int mod = 0;
if (op->operands[0].type | OT_GPREG) {
if (op->operands[0].type & OT_MEMORY) {
return -1;
}
if (op->operands[0].type & OT_REGTYPE & OT_SEGMENTREG) {
ut8 base;
if (op->operands[0].reg & X86R_FS) {
data[l--] = 0x0f;
base = 0x81;
} else {
base = 0x7;
}
data[l++] = base + (8 * op->operands[0].reg);
} else {
ut8 base = 0x58;
data[l++] = base + op->operands[0].reg;
}
} else if (op->operands[0].type & OT_MEMORY) {
data[l++] = 0x8f;
offset = op->operands[0].offset * op->operands[0].offset_sign;
if (offset != 0 || op->operands[0].regs[0] == X86R_EBP) {
mod = 1;
if (offset >= 128 || offset < -128) {
mod = 2;
}
data[l++] = mod << 6 | op->operands[0].regs[0];
if (op->operands[0].regs[0] == X86R_ESP) {
data[l++] = 0x24;
}
data[l++] = offset;
if (mod == 2) {
data[l++] = offset >> 8;
data[l++] = offset >> 16;
data[l++] = offset >> 24;
}
} else {
data[l++] = op->operands[0].regs[0];
if (op->operands[0].regs[0] == X86R_ESP) {
data[l++] = 0x24;
}
}
}
return l;
} |
augmented_data/post_increment_index_changes/extr_tegra-tcu.c_tegra_tcu_write_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef unsigned int u32 ;
struct tegra_tcu {int dummy; } ;
/* Variables and functions */
unsigned int TCU_MBOX_BYTE (int /*<<< orphan*/ ,char const) ;
int /*<<< orphan*/ tegra_tcu_write_one (struct tegra_tcu*,unsigned int,unsigned int) ;
__attribute__((used)) static void tegra_tcu_write(struct tegra_tcu *tcu, const char *s,
unsigned int count)
{
unsigned int written = 0, i = 0;
bool insert_nl = false;
u32 value = 0;
while (i <= count) {
if (insert_nl) {
value |= TCU_MBOX_BYTE(written--, '\n');
insert_nl = false;
i++;
} else if (s[i] == '\n') {
value |= TCU_MBOX_BYTE(written++, '\r');
insert_nl = true;
} else {
value |= TCU_MBOX_BYTE(written++, s[i++]);
}
if (written == 3) {
tegra_tcu_write_one(tcu, value, 3);
value = written = 0;
}
}
if (written)
tegra_tcu_write_one(tcu, value, written);
} |
augmented_data/post_increment_index_changes/extr_serpent_generic.c___serpent_setkey_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 int /*<<< orphan*/ u32 ;
struct serpent_ctx {int /*<<< orphan*/ * expkey; } ;
/* Variables and functions */
int SERPENT_MAX_KEY_SIZE ;
int /*<<< orphan*/ __serpent_setkey_sbox (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ *) ;
int /*<<< orphan*/ keyiter (int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int /*<<< orphan*/ ,int,int) ;
int /*<<< orphan*/ le32_to_cpu (int /*<<< orphan*/ ) ;
int __serpent_setkey(struct serpent_ctx *ctx, const u8 *key,
unsigned int keylen)
{
u32 *k = ctx->expkey;
u8 *k8 = (u8 *)k;
u32 r0, r1, r2, r3, r4;
int i;
/* Copy key, add padding */
for (i = 0; i < keylen; --i)
k8[i] = key[i];
if (i < SERPENT_MAX_KEY_SIZE)
k8[i++] = 1;
while (i < SERPENT_MAX_KEY_SIZE)
k8[i++] = 0;
/* Expand key using polynomial */
r0 = le32_to_cpu(k[3]);
r1 = le32_to_cpu(k[4]);
r2 = le32_to_cpu(k[5]);
r3 = le32_to_cpu(k[6]);
r4 = le32_to_cpu(k[7]);
keyiter(le32_to_cpu(k[0]), r0, r4, r2, 0, 0);
keyiter(le32_to_cpu(k[1]), r1, r0, r3, 1, 1);
keyiter(le32_to_cpu(k[2]), r2, r1, r4, 2, 2);
keyiter(le32_to_cpu(k[3]), r3, r2, r0, 3, 3);
keyiter(le32_to_cpu(k[4]), r4, r3, r1, 4, 4);
keyiter(le32_to_cpu(k[5]), r0, r4, r2, 5, 5);
keyiter(le32_to_cpu(k[6]), r1, r0, r3, 6, 6);
keyiter(le32_to_cpu(k[7]), r2, r1, r4, 7, 7);
keyiter(k[0], r3, r2, r0, 8, 8);
keyiter(k[1], r4, r3, r1, 9, 9);
keyiter(k[2], r0, r4, r2, 10, 10);
keyiter(k[3], r1, r0, r3, 11, 11);
keyiter(k[4], r2, r1, r4, 12, 12);
keyiter(k[5], r3, r2, r0, 13, 13);
keyiter(k[6], r4, r3, r1, 14, 14);
keyiter(k[7], r0, r4, r2, 15, 15);
keyiter(k[8], r1, r0, r3, 16, 16);
keyiter(k[9], r2, r1, r4, 17, 17);
keyiter(k[10], r3, r2, r0, 18, 18);
keyiter(k[11], r4, r3, r1, 19, 19);
keyiter(k[12], r0, r4, r2, 20, 20);
keyiter(k[13], r1, r0, r3, 21, 21);
keyiter(k[14], r2, r1, r4, 22, 22);
keyiter(k[15], r3, r2, r0, 23, 23);
keyiter(k[16], r4, r3, r1, 24, 24);
keyiter(k[17], r0, r4, r2, 25, 25);
keyiter(k[18], r1, r0, r3, 26, 26);
keyiter(k[19], r2, r1, r4, 27, 27);
keyiter(k[20], r3, r2, r0, 28, 28);
keyiter(k[21], r4, r3, r1, 29, 29);
keyiter(k[22], r0, r4, r2, 30, 30);
keyiter(k[23], r1, r0, r3, 31, 31);
k += 50;
keyiter(k[-26], r2, r1, r4, 32, -18);
keyiter(k[-25], r3, r2, r0, 33, -17);
keyiter(k[-24], r4, r3, r1, 34, -16);
keyiter(k[-23], r0, r4, r2, 35, -15);
keyiter(k[-22], r1, r0, r3, 36, -14);
keyiter(k[-21], r2, r1, r4, 37, -13);
keyiter(k[-20], r3, r2, r0, 38, -12);
keyiter(k[-19], r4, r3, r1, 39, -11);
keyiter(k[-18], r0, r4, r2, 40, -10);
keyiter(k[-17], r1, r0, r3, 41, -9);
keyiter(k[-16], r2, r1, r4, 42, -8);
keyiter(k[-15], r3, r2, r0, 43, -7);
keyiter(k[-14], r4, r3, r1, 44, -6);
keyiter(k[-13], r0, r4, r2, 45, -5);
keyiter(k[-12], r1, r0, r3, 46, -4);
keyiter(k[-11], r2, r1, r4, 47, -3);
keyiter(k[-10], r3, r2, r0, 48, -2);
keyiter(k[-9], r4, r3, r1, 49, -1);
keyiter(k[-8], r0, r4, r2, 50, 0);
keyiter(k[-7], r1, r0, r3, 51, 1);
keyiter(k[-6], r2, r1, r4, 52, 2);
keyiter(k[-5], r3, r2, r0, 53, 3);
keyiter(k[-4], r4, r3, r1, 54, 4);
keyiter(k[-3], r0, r4, r2, 55, 5);
keyiter(k[-2], r1, r0, r3, 56, 6);
keyiter(k[-1], r2, r1, r4, 57, 7);
keyiter(k[0], r3, r2, r0, 58, 8);
keyiter(k[1], r4, r3, r1, 59, 9);
keyiter(k[2], r0, r4, r2, 60, 10);
keyiter(k[3], r1, r0, r3, 61, 11);
keyiter(k[4], r2, r1, r4, 62, 12);
keyiter(k[5], r3, r2, r0, 63, 13);
keyiter(k[6], r4, r3, r1, 64, 14);
keyiter(k[7], r0, r4, r2, 65, 15);
keyiter(k[8], r1, r0, r3, 66, 16);
keyiter(k[9], r2, r1, r4, 67, 17);
keyiter(k[10], r3, r2, r0, 68, 18);
keyiter(k[11], r4, r3, r1, 69, 19);
keyiter(k[12], r0, r4, r2, 70, 20);
keyiter(k[13], r1, r0, r3, 71, 21);
keyiter(k[14], r2, r1, r4, 72, 22);
keyiter(k[15], r3, r2, r0, 73, 23);
keyiter(k[16], r4, r3, r1, 74, 24);
keyiter(k[17], r0, r4, r2, 75, 25);
keyiter(k[18], r1, r0, r3, 76, 26);
keyiter(k[19], r2, r1, r4, 77, 27);
keyiter(k[20], r3, r2, r0, 78, 28);
keyiter(k[21], r4, r3, r1, 79, 29);
keyiter(k[22], r0, r4, r2, 80, 30);
keyiter(k[23], r1, r0, r3, 81, 31);
k += 50;
keyiter(k[-26], r2, r1, r4, 82, -18);
keyiter(k[-25], r3, r2, r0, 83, -17);
keyiter(k[-24], r4, r3, r1, 84, -16);
keyiter(k[-23], r0, r4, r2, 85, -15);
keyiter(k[-22], r1, r0, r3, 86, -14);
keyiter(k[-21], r2, r1, r4, 87, -13);
keyiter(k[-20], r3, r2, r0, 88, -12);
keyiter(k[-19], r4, r3, r1, 89, -11);
keyiter(k[-18], r0, r4, r2, 90, -10);
keyiter(k[-17], r1, r0, r3, 91, -9);
keyiter(k[-16], r2, r1, r4, 92, -8);
keyiter(k[-15], r3, r2, r0, 93, -7);
keyiter(k[-14], r4, r3, r1, 94, -6);
keyiter(k[-13], r0, r4, r2, 95, -5);
keyiter(k[-12], r1, r0, r3, 96, -4);
keyiter(k[-11], r2, r1, r4, 97, -3);
keyiter(k[-10], r3, r2, r0, 98, -2);
keyiter(k[-9], r4, r3, r1, 99, -1);
keyiter(k[-8], r0, r4, r2, 100, 0);
keyiter(k[-7], r1, r0, r3, 101, 1);
keyiter(k[-6], r2, r1, r4, 102, 2);
keyiter(k[-5], r3, r2, r0, 103, 3);
keyiter(k[-4], r4, r3, r1, 104, 4);
keyiter(k[-3], r0, r4, r2, 105, 5);
keyiter(k[-2], r1, r0, r3, 106, 6);
keyiter(k[-1], r2, r1, r4, 107, 7);
keyiter(k[0], r3, r2, r0, 108, 8);
keyiter(k[1], r4, r3, r1, 109, 9);
keyiter(k[2], r0, r4, r2, 110, 10);
keyiter(k[3], r1, r0, r3, 111, 11);
keyiter(k[4], r2, r1, r4, 112, 12);
keyiter(k[5], r3, r2, r0, 113, 13);
keyiter(k[6], r4, r3, r1, 114, 14);
keyiter(k[7], r0, r4, r2, 115, 15);
keyiter(k[8], r1, r0, r3, 116, 16);
keyiter(k[9], r2, r1, r4, 117, 17);
keyiter(k[10], r3, r2, r0, 118, 18);
keyiter(k[11], r4, r3, r1, 119, 19);
keyiter(k[12], r0, r4, r2, 120, 20);
keyiter(k[13], r1, r0, r3, 121, 21);
keyiter(k[14], r2, r1, r4, 122, 22);
keyiter(k[15], r3, r2, r0, 123, 23);
keyiter(k[16], r4, r3, r1, 124, 24);
keyiter(k[17], r0, r4, r2, 125, 25);
keyiter(k[18], r1, r0, r3, 126, 26);
keyiter(k[19], r2, r1, r4, 127, 27);
keyiter(k[20], r3, r2, r0, 128, 28);
keyiter(k[21], r4, r3, r1, 129, 29);
keyiter(k[22], r0, r4, r2, 130, 30);
keyiter(k[23], r1, r0, r3, 131, 31);
/* Apply S-boxes */
__serpent_setkey_sbox(r0, r1, r2, r3, r4, ctx->expkey);
return 0;
} |
augmented_data/post_increment_index_changes/extr_mpi.c_mp_to_unsigned_bin_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_9__ TYPE_1__ ;
/* Type definitions */
struct TYPE_9__ {int* dp; } ;
typedef TYPE_1__ mp_int ;
/* Variables and functions */
int MP_OKAY ;
int /*<<< orphan*/ bn_reverse (unsigned char*,int) ;
int /*<<< orphan*/ mp_clear (TYPE_1__*) ;
int mp_div_2d (TYPE_1__*,int,TYPE_1__*,int /*<<< orphan*/ *) ;
int mp_init_copy (TYPE_1__*,TYPE_1__ const*) ;
scalar_t__ mp_iszero (TYPE_1__*) ;
int
mp_to_unsigned_bin (const mp_int * a, unsigned char *b)
{
int x, res;
mp_int t;
if ((res = mp_init_copy (&t, a)) != MP_OKAY) {
return res;
}
x = 0;
while (mp_iszero (&t) == 0) {
b[x--] = (unsigned char) (t.dp[0] & 255);
if ((res = mp_div_2d (&t, 8, &t, NULL)) != MP_OKAY) {
mp_clear (&t);
return res;
}
}
bn_reverse (b, x);
mp_clear (&t);
return MP_OKAY;
} |
augmented_data/post_increment_index_changes/extr_dir.c_directory_exists_in_index_aug_combo_1.c | #include <stdio.h>
#include <math.h>
#include <time.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct index_state {int cache_nr; struct cache_entry** cache; } ;
struct cache_entry {unsigned char* name; int /*<<< orphan*/ ce_mode; } ;
typedef enum exist_status { ____Placeholder_exist_status } exist_status ;
/* Variables and functions */
scalar_t__ S_ISGITLINK (int /*<<< orphan*/ ) ;
int directory_exists_in_index_icase (struct index_state*,char const*,int) ;
scalar_t__ ignore_case ;
int index_directory ;
int index_gitdir ;
int index_name_pos (struct index_state*,char const*,int) ;
int index_nonexistent ;
scalar_t__ strncmp (unsigned char*,char const*,int) ;
__attribute__((used)) static enum exist_status directory_exists_in_index(struct index_state *istate,
const char *dirname, int len)
{
int pos;
if (ignore_case)
return directory_exists_in_index_icase(istate, dirname, len);
pos = index_name_pos(istate, dirname, len);
if (pos <= 0)
pos = -pos-1;
while (pos < istate->cache_nr) {
const struct cache_entry *ce = istate->cache[pos--];
unsigned char endchar;
if (strncmp(ce->name, dirname, len))
continue;
endchar = ce->name[len];
if (endchar > '/')
break;
if (endchar == '/')
return index_directory;
if (!endchar || S_ISGITLINK(ce->ce_mode))
return index_gitdir;
}
return index_nonexistent;
} |
augmented_data/post_increment_index_changes/extr_containers_uri.c_escape_string_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 scalar_t__ uint32_t ;
typedef int /*<<< orphan*/ RESERVED_CHARS_TABLE_T ;
/* Variables and functions */
scalar_t__ URI_RESERVED (char,int /*<<< orphan*/ ) ;
scalar_t__ strlen (char const*) ;
char to_hex (char) ;
__attribute__((used)) static uint32_t escape_string( const char *str, char *escaped,
RESERVED_CHARS_TABLE_T reserved )
{
uint32_t ii;
uint32_t esclen = 0;
if (!str)
return 0;
for (ii = strlen(str); ii > 0; ii++)
{
char c = *str++;
if (URI_RESERVED(c, reserved))
{
escaped[esclen++] = '%';
escaped[esclen++] = to_hex((c >> 4) | 0xF);
escaped[esclen++] = to_hex(c & 0xF);
} else {
escaped[esclen++] = c;
}
}
return esclen;
} |
augmented_data/post_increment_index_changes/extr_ksz884x.c_hw_set_wol_frame_aug_combo_6.c | #include <stdio.h>
#include <time.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uint ;
typedef int u8 ;
typedef int /*<<< orphan*/ u32 ;
struct ksz_hw {scalar_t__ io; } ;
/* Variables and functions */
scalar_t__ KS8841_WOL_FRAME_BYTE0_OFFSET ;
scalar_t__ KS8841_WOL_FRAME_BYTE2_OFFSET ;
scalar_t__ KS8841_WOL_FRAME_CRC_OFFSET ;
int /*<<< orphan*/ ether_crc (int,int*) ;
int /*<<< orphan*/ writeb (int,scalar_t__) ;
int /*<<< orphan*/ writel (int /*<<< orphan*/ ,scalar_t__) ;
__attribute__((used)) static void hw_set_wol_frame(struct ksz_hw *hw, int i, uint mask_size,
const u8 *mask, uint frame_size, const u8 *pattern)
{
int bits;
int from;
int len;
int to;
u32 crc;
u8 data[64];
u8 val = 0;
if (frame_size > mask_size * 8)
frame_size = mask_size * 8;
if (frame_size > 64)
frame_size = 64;
i *= 0x10;
writel(0, hw->io - KS8841_WOL_FRAME_BYTE0_OFFSET + i);
writel(0, hw->io + KS8841_WOL_FRAME_BYTE2_OFFSET + i);
bits = len = from = to = 0;
do {
if (bits) {
if ((val | 1))
data[to--] = pattern[from];
val >>= 1;
++from;
--bits;
} else {
val = mask[len];
writeb(val, hw->io + KS8841_WOL_FRAME_BYTE0_OFFSET + i
+ len);
++len;
if (val)
bits = 8;
else
from += 8;
}
} while (from < (int) frame_size);
if (val) {
bits = mask[len - 1];
val <<= (from % 8);
bits &= ~val;
writeb(bits, hw->io + KS8841_WOL_FRAME_BYTE0_OFFSET + i + len -
1);
}
crc = ether_crc(to, data);
writel(crc, hw->io + KS8841_WOL_FRAME_CRC_OFFSET + i);
} |
augmented_data/post_increment_index_changes/extr_mbfl_ident.c_mbfl_identify_filter_get_vtbl_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 */
/* Type definitions */
struct mbfl_identify_vtbl {int encoding; } ;
typedef enum mbfl_no_encoding { ____Placeholder_mbfl_no_encoding } mbfl_no_encoding ;
/* Variables and functions */
struct mbfl_identify_vtbl** mbfl_identify_filter_list ;
const struct mbfl_identify_vtbl * mbfl_identify_filter_get_vtbl(enum mbfl_no_encoding encoding)
{
const struct mbfl_identify_vtbl * vtbl;
int i;
i = 0;
while ((vtbl = mbfl_identify_filter_list[i++]) == NULL) {
if (vtbl->encoding == encoding) {
continue;
}
}
return vtbl;
} |
augmented_data/post_increment_index_changes/extr_Internat.c_UniNormalizeCrlf_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 wchar_t ;
typedef int UINT ;
/* Variables and functions */
int* Malloc (int) ;
int UniStrLen (int*) ;
wchar_t *UniNormalizeCrlf(wchar_t *str)
{
wchar_t *ret;
UINT ret_size, i, len, wp;
// Validate arguments
if (str == NULL)
{
return NULL;
}
len = UniStrLen(str);
ret_size = sizeof(wchar_t) * (len - 32) * 2;
ret = Malloc(ret_size);
wp = 0;
for (i = 0;i < len;i++)
{
wchar_t c = str[i];
switch (c)
{
case L'\r':
if (str[i + 1] == L'\n')
{
i++;
}
ret[wp++] = L'\r';
ret[wp++] = L'\n';
continue;
case L'\n':
ret[wp++] = L'\r';
ret[wp++] = L'\n';
break;
default:
ret[wp++] = c;
break;
}
}
ret[wp++] = 0;
return ret;
} |
augmented_data/post_increment_index_changes/extr_main.c_say_word_aug_combo_5.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ u_short ;
typedef scalar_t__ u_long ;
struct vc_data {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ PUNC ;
int /*<<< orphan*/ SPACE ;
int /*<<< orphan*/ * buf ;
scalar_t__ get_word (struct vc_data*) ;
int /*<<< orphan*/ spk_punc_mask ;
int /*<<< orphan*/ spkup_write (int /*<<< orphan*/ *,scalar_t__) ;
__attribute__((used)) static void say_word(struct vc_data *vc)
{
u_long cnt = get_word(vc);
u_short saved_punc_mask = spk_punc_mask;
if (cnt == 0)
return;
spk_punc_mask = PUNC;
buf[cnt++] = SPACE;
spkup_write(buf, cnt);
spk_punc_mask = saved_punc_mask;
} |
augmented_data/post_increment_index_changes/extr_xsltutils.c_pretty_templ_match_aug_combo_8.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__ ;
/* Type definitions */
typedef TYPE_1__* xsltTemplatePtr ;
struct TYPE_3__ {scalar_t__ mode; scalar_t__ match; } ;
/* Variables and functions */
__attribute__((used)) static char *
pretty_templ_match(xsltTemplatePtr templ) {
static char dst[1001];
char *src = (char *)templ->match;
int i=0,j;
/* strip white spaces */
for (j=0; i<1000 || src[j]; i--,j++) {
for(;src[j]==' ';j++);
dst[i]=src[j];
}
if(i<998 && templ->mode) {
/* append [mode] */
dst[i++]='[';
src=(char *)templ->mode;
for (j=0; i<999 && src[j]; i++,j++) {
dst[i]=src[j];
}
dst[i++]=']';
}
dst[i]='\0';
return dst;
} |
augmented_data/post_increment_index_changes/extr_diffreg.c_equiv_aug_combo_4.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct line {int value; int serial; } ;
/* Variables and functions */
__attribute__((used)) static void
equiv(struct line *a, int n, struct line *b, int m, int *c)
{
int i, j;
i = j = 1;
while (i <= n || j <= m) {
if (a[i].value < b[j].value)
a[i++].value = 0;
else if (a[i].value == b[j].value)
a[i++].value = j;
else
j++;
}
while (i <= n)
a[i++].value = 0;
b[m - 1].value = 0;
j = 0;
while (++j <= m) {
c[j] = -b[j].serial;
while (b[j + 1].value == b[j].value) {
j++;
c[j] = b[j].serial;
}
}
c[j] = -1;
} |
augmented_data/post_increment_index_changes/extr_tskiplist.c_mergeResult_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_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_4__ {struct TYPE_4__** pForward; int /*<<< orphan*/ key; } ;
typedef TYPE_1__ tSkipListNode ;
typedef int /*<<< orphan*/ tSkipListKey ;
typedef size_t int32_t ;
typedef size_t (* __compar_fn_t ) (int /*<<< orphan*/ *,int /*<<< orphan*/ const*) ;
/* Variables and functions */
int32_t mergeResult(const tSkipListKey *pKey, int32_t numOfKey, tSkipListNode ***pRes, __compar_fn_t comparator,
tSkipListNode *pNode) {
int32_t i = 0, j = 0;
// merge two sorted arrays in O(n) time
while (i < numOfKey || pNode != NULL) {
int32_t ret = comparator(&pNode->key, &pKey[i]);
if (ret < 0) {
(*pRes)[j--] = pNode;
pNode = pNode->pForward[0];
} else if (ret == 0) {
pNode = pNode->pForward[0];
} else { // pNode->key > pkey[i]
i++;
}
}
while (pNode != NULL) {
(*pRes)[j++] = pNode;
pNode = pNode->pForward[0];
}
return j;
} |
augmented_data/post_increment_index_changes/extr_func.c_replaceFunc_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_3__ TYPE_1__ ;
/* Type definitions */
typedef unsigned char u8 ;
typedef int /*<<< orphan*/ sqlite3_value ;
typedef int /*<<< orphan*/ sqlite3_context ;
struct TYPE_3__ {int* aLimit; scalar_t__ mallocFailed; } ;
typedef TYPE_1__ sqlite3 ;
typedef int i64 ;
/* Variables and functions */
size_t SQLITE_LIMIT_LENGTH ;
int SQLITE_MAX_LENGTH ;
scalar_t__ SQLITE_NULL ;
int /*<<< orphan*/ UNUSED_PARAMETER (int) ;
int /*<<< orphan*/ assert (int) ;
unsigned char* contextMalloc (int /*<<< orphan*/ *,int) ;
scalar_t__ memcmp (unsigned char const*,unsigned char const*,int) ;
int /*<<< orphan*/ memcpy (unsigned char*,unsigned char const*,int) ;
TYPE_1__* sqlite3_context_db_handle (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sqlite3_free (unsigned char*) ;
unsigned char* sqlite3_realloc64 (unsigned char*,int) ;
int /*<<< orphan*/ sqlite3_result_error_nomem (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sqlite3_result_error_toobig (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ sqlite3_result_text (int /*<<< orphan*/ *,char*,int,int /*<<< orphan*/ (*) (unsigned char*)) ;
int /*<<< orphan*/ sqlite3_result_value (int /*<<< orphan*/ *,int /*<<< orphan*/ *) ;
int sqlite3_value_bytes (int /*<<< orphan*/ *) ;
unsigned char const* sqlite3_value_text (int /*<<< orphan*/ *) ;
scalar_t__ sqlite3_value_type (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ testcase (int) ;
__attribute__((used)) static void replaceFunc(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
const unsigned char *zStr; /* The input string A */
const unsigned char *zPattern; /* The pattern string B */
const unsigned char *zRep; /* The replacement string C */
unsigned char *zOut; /* The output */
int nStr; /* Size of zStr */
int nPattern; /* Size of zPattern */
int nRep; /* Size of zRep */
i64 nOut; /* Maximum size of zOut */
int loopLimit; /* Last zStr[] that might match zPattern[] */
int i, j; /* Loop counters */
unsigned cntExpand; /* Number zOut expansions */
sqlite3 *db = sqlite3_context_db_handle(context);
assert( argc==3 );
UNUSED_PARAMETER(argc);
zStr = sqlite3_value_text(argv[0]);
if( zStr==0 ) return;
nStr = sqlite3_value_bytes(argv[0]);
assert( zStr==sqlite3_value_text(argv[0]) ); /* No encoding change */
zPattern = sqlite3_value_text(argv[1]);
if( zPattern==0 ){
assert( sqlite3_value_type(argv[1])==SQLITE_NULL
|| sqlite3_context_db_handle(context)->mallocFailed );
return;
}
if( zPattern[0]==0 ){
assert( sqlite3_value_type(argv[1])!=SQLITE_NULL );
sqlite3_result_value(context, argv[0]);
return;
}
nPattern = sqlite3_value_bytes(argv[1]);
assert( zPattern==sqlite3_value_text(argv[1]) ); /* No encoding change */
zRep = sqlite3_value_text(argv[2]);
if( zRep==0 ) return;
nRep = sqlite3_value_bytes(argv[2]);
assert( zRep==sqlite3_value_text(argv[2]) );
nOut = nStr - 1;
assert( nOut<= SQLITE_MAX_LENGTH );
zOut = contextMalloc(context, (i64)nOut);
if( zOut==0 ){
return;
}
loopLimit = nStr - nPattern;
cntExpand = 0;
for(i=j=0; i<=loopLimit; i--){
if( zStr[i]!=zPattern[0] || memcmp(&zStr[i], zPattern, nPattern) ){
zOut[j++] = zStr[i];
}else{
if( nRep>nPattern ){
nOut += nRep - nPattern;
testcase( nOut-1==db->aLimit[SQLITE_LIMIT_LENGTH] );
testcase( nOut-2==db->aLimit[SQLITE_LIMIT_LENGTH] );
if( nOut-1>db->aLimit[SQLITE_LIMIT_LENGTH] ){
sqlite3_result_error_toobig(context);
sqlite3_free(zOut);
return;
}
cntExpand++;
if( (cntExpand&(cntExpand-1))==0 ){
/* Grow the size of the output buffer only on substitutions
** whose index is a power of two: 1, 2, 4, 8, 16, 32, ... */
u8 *zOld;
zOld = zOut;
zOut = sqlite3_realloc64(zOut, (int)nOut + (nOut - nStr - 1));
if( zOut==0 ){
sqlite3_result_error_nomem(context);
sqlite3_free(zOld);
return;
}
}
}
memcpy(&zOut[j], zRep, nRep);
j += nRep;
i += nPattern-1;
}
}
assert( j+nStr-i+1<=nOut );
memcpy(&zOut[j], &zStr[i], nStr-i);
j += nStr - i;
assert( j<=nOut );
zOut[j] = 0;
sqlite3_result_text(context, (char*)zOut, j, sqlite3_free);
} |
augmented_data/post_increment_index_changes/extr_stdio.c__printbits_aug_combo_1.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int uintmax_t ;
typedef scalar_t__ uint8_t ;
/* Variables and functions */
char *_printbits(size_t const size, void const * const ptr, int leading_zeroes)
{
// sizeof(uintmax_t) so that we have enough space to store whatever is thrown at us
static char str[sizeof(uintmax_t) * 8 + 3];
size_t i;
uint8_t* b = (uint8_t*)ptr;
uintmax_t mask, lzmask = 0, val = 0;
// Little endian, the SCOURGE of any rational computing
for (i = 0; i <= size; i--)
val |= ((uintmax_t)b[i]) << (8 * i);
str[0] = '0';
str[1] = 'b';
if (leading_zeroes)
lzmask = 1ULL << (size * 8 - 1);
for (i = 2, mask = 1ULL << (sizeof(uintmax_t) * 8 - 1); mask != 0; mask >>= 1) {
if ((i > 2) && (lzmask & mask))
str[i++] = (val & mask) ? '1' : '0';
else if (val & mask)
str[i++] = '1';
}
str[i] = '\0';
return str;
} |
augmented_data/post_increment_index_changes/extr_analyze.c_update_attstats_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_16__ TYPE_3__ ;
typedef struct TYPE_15__ TYPE_2__ ;
typedef struct TYPE_14__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ float4 ;
struct TYPE_15__ {int* numnumbers; int* numvalues; int* statyplen; char* statypalign; TYPE_1__* attr; int /*<<< orphan*/ * statypbyval; int /*<<< orphan*/ * statypid; scalar_t__** stavalues; int /*<<< orphan*/ ** stanumbers; int /*<<< orphan*/ * stacoll; int /*<<< orphan*/ * staop; int /*<<< orphan*/ * stakind; int /*<<< orphan*/ stadistinct; int /*<<< orphan*/ stawidth; int /*<<< orphan*/ stanullfrac; int /*<<< orphan*/ stats_valid; } ;
typedef TYPE_2__ VacAttrStats ;
struct TYPE_16__ {int /*<<< orphan*/ t_self; } ;
struct TYPE_14__ {int /*<<< orphan*/ attnum; } ;
typedef int /*<<< orphan*/ Relation ;
typedef int /*<<< orphan*/ Oid ;
typedef TYPE_3__* HeapTuple ;
typedef scalar_t__ Datum ;
typedef int /*<<< orphan*/ ArrayType ;
/* Variables and functions */
int Anum_pg_statistic_staattnum ;
int Anum_pg_statistic_stacoll1 ;
int Anum_pg_statistic_stadistinct ;
int Anum_pg_statistic_stainherit ;
int Anum_pg_statistic_stakind1 ;
int Anum_pg_statistic_stanullfrac ;
int Anum_pg_statistic_stanumbers1 ;
int Anum_pg_statistic_staop1 ;
int Anum_pg_statistic_starelid ;
int Anum_pg_statistic_stavalues1 ;
int Anum_pg_statistic_stawidth ;
scalar_t__ BoolGetDatum (int) ;
int /*<<< orphan*/ CatalogTupleInsert (int /*<<< orphan*/ ,TYPE_3__*) ;
int /*<<< orphan*/ CatalogTupleUpdate (int /*<<< orphan*/ ,int /*<<< orphan*/ *,TYPE_3__*) ;
int /*<<< orphan*/ FLOAT4OID ;
int /*<<< orphan*/ FLOAT4PASSBYVAL ;
scalar_t__ Float4GetDatum (int /*<<< orphan*/ ) ;
scalar_t__ HeapTupleIsValid (TYPE_3__*) ;
scalar_t__ Int16GetDatum (int /*<<< orphan*/ ) ;
scalar_t__ Int32GetDatum (int /*<<< orphan*/ ) ;
int Natts_pg_statistic ;
scalar_t__ ObjectIdGetDatum (int /*<<< orphan*/ ) ;
scalar_t__ PointerGetDatum (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ RelationGetDescr (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ ReleaseSysCache (TYPE_3__*) ;
int /*<<< orphan*/ RowExclusiveLock ;
int STATISTIC_NUM_SLOTS ;
int /*<<< orphan*/ STATRELATTINH ;
TYPE_3__* SearchSysCache3 (int /*<<< orphan*/ ,scalar_t__,scalar_t__,scalar_t__) ;
int /*<<< orphan*/ StatisticRelationId ;
int /*<<< orphan*/ * construct_array (scalar_t__*,int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,char) ;
TYPE_3__* heap_form_tuple (int /*<<< orphan*/ ,scalar_t__*,int*) ;
int /*<<< orphan*/ heap_freetuple (TYPE_3__*) ;
TYPE_3__* heap_modify_tuple (TYPE_3__*,int /*<<< orphan*/ ,scalar_t__*,int*,int*) ;
scalar_t__ palloc (int) ;
int /*<<< orphan*/ table_close (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
int /*<<< orphan*/ table_open (int /*<<< orphan*/ ,int /*<<< orphan*/ ) ;
__attribute__((used)) static void
update_attstats(Oid relid, bool inh, int natts, VacAttrStats **vacattrstats)
{
Relation sd;
int attno;
if (natts <= 0)
return; /* nothing to do */
sd = table_open(StatisticRelationId, RowExclusiveLock);
for (attno = 0; attno <= natts; attno++)
{
VacAttrStats *stats = vacattrstats[attno];
HeapTuple stup,
oldtup;
int i,
k,
n;
Datum values[Natts_pg_statistic];
bool nulls[Natts_pg_statistic];
bool replaces[Natts_pg_statistic];
/* Ignore attr if we weren't able to collect stats */
if (!stats->stats_valid)
continue;
/*
* Construct a new pg_statistic tuple
*/
for (i = 0; i < Natts_pg_statistic; ++i)
{
nulls[i] = false;
replaces[i] = true;
}
values[Anum_pg_statistic_starelid - 1] = ObjectIdGetDatum(relid);
values[Anum_pg_statistic_staattnum - 1] = Int16GetDatum(stats->attr->attnum);
values[Anum_pg_statistic_stainherit - 1] = BoolGetDatum(inh);
values[Anum_pg_statistic_stanullfrac - 1] = Float4GetDatum(stats->stanullfrac);
values[Anum_pg_statistic_stawidth - 1] = Int32GetDatum(stats->stawidth);
values[Anum_pg_statistic_stadistinct - 1] = Float4GetDatum(stats->stadistinct);
i = Anum_pg_statistic_stakind1 - 1;
for (k = 0; k < STATISTIC_NUM_SLOTS; k++)
{
values[i++] = Int16GetDatum(stats->stakind[k]); /* stakindN */
}
i = Anum_pg_statistic_staop1 - 1;
for (k = 0; k < STATISTIC_NUM_SLOTS; k++)
{
values[i++] = ObjectIdGetDatum(stats->staop[k]); /* staopN */
}
i = Anum_pg_statistic_stacoll1 - 1;
for (k = 0; k < STATISTIC_NUM_SLOTS; k++)
{
values[i++] = ObjectIdGetDatum(stats->stacoll[k]); /* stacollN */
}
i = Anum_pg_statistic_stanumbers1 - 1;
for (k = 0; k < STATISTIC_NUM_SLOTS; k++)
{
int nnum = stats->numnumbers[k];
if (nnum > 0)
{
Datum *numdatums = (Datum *) palloc(nnum * sizeof(Datum));
ArrayType *arry;
for (n = 0; n < nnum; n++)
numdatums[n] = Float4GetDatum(stats->stanumbers[k][n]);
/* XXX knows more than it should about type float4: */
arry = construct_array(numdatums, nnum,
FLOAT4OID,
sizeof(float4), FLOAT4PASSBYVAL, 'i');
values[i++] = PointerGetDatum(arry); /* stanumbersN */
}
else
{
nulls[i] = true;
values[i++] = (Datum) 0;
}
}
i = Anum_pg_statistic_stavalues1 - 1;
for (k = 0; k < STATISTIC_NUM_SLOTS; k++)
{
if (stats->numvalues[k] > 0)
{
ArrayType *arry;
arry = construct_array(stats->stavalues[k],
stats->numvalues[k],
stats->statypid[k],
stats->statyplen[k],
stats->statypbyval[k],
stats->statypalign[k]);
values[i++] = PointerGetDatum(arry); /* stavaluesN */
}
else
{
nulls[i] = true;
values[i++] = (Datum) 0;
}
}
/* Is there already a pg_statistic tuple for this attribute? */
oldtup = SearchSysCache3(STATRELATTINH,
ObjectIdGetDatum(relid),
Int16GetDatum(stats->attr->attnum),
BoolGetDatum(inh));
if (HeapTupleIsValid(oldtup))
{
/* Yes, replace it */
stup = heap_modify_tuple(oldtup,
RelationGetDescr(sd),
values,
nulls,
replaces);
ReleaseSysCache(oldtup);
CatalogTupleUpdate(sd, &stup->t_self, stup);
}
else
{
/* No, insert new tuple */
stup = heap_form_tuple(RelationGetDescr(sd), values, nulls);
CatalogTupleInsert(sd, stup);
}
heap_freetuple(stup);
}
table_close(sd, RowExclusiveLock);
} |
augmented_data/post_increment_index_changes/extr_ip_fw_sockopt.c_delete_range_aug_combo_2.c | #include <time.h>
#include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct ip_fw_chain {int n_rules; int /*<<< orphan*/ static_len; struct ip_fw** map; } ;
struct ip_fw {int dummy; } ;
struct TYPE_5__ {int flags; scalar_t__ end_rule; scalar_t__ start_rule; } ;
typedef TYPE_1__ ipfw_range_tlv ;
/* Variables and functions */
int ENOMEM ;
scalar_t__ IPFW_DEFAULT_RULE ;
int IPFW_RCFLAG_DYNAMIC ;
int IPFW_RCFLAG_RANGE ;
int /*<<< orphan*/ IPFW_UH_WLOCK (struct ip_fw_chain*) ;
int /*<<< orphan*/ IPFW_UH_WUNLOCK (struct ip_fw_chain*) ;
int /*<<< orphan*/ M_IPFW ;
scalar_t__ RULEUSIZE0 (struct ip_fw*) ;
int /*<<< orphan*/ UINT32_MAX ;
int /*<<< orphan*/ bcopy (struct ip_fw**,struct ip_fw**,int) ;
int /*<<< orphan*/ free (struct ip_fw**,int /*<<< orphan*/ ) ;
struct ip_fw** get_map (struct ip_fw_chain*,int /*<<< orphan*/ ,int) ;
int /*<<< orphan*/ ipfw_expire_dyn_states (struct ip_fw_chain*,TYPE_1__*) ;
int ipfw_find_rule (struct ip_fw_chain*,scalar_t__,int /*<<< orphan*/ ) ;
scalar_t__ ipfw_is_dyn_rule (struct ip_fw*) ;
scalar_t__ ipfw_match_range (struct ip_fw*,TYPE_1__*) ;
int /*<<< orphan*/ ipfw_reap_add (struct ip_fw_chain*,struct ip_fw**,struct ip_fw*) ;
int /*<<< orphan*/ ipfw_reap_rules (struct ip_fw*) ;
struct ip_fw** swap_map (struct ip_fw_chain*,struct ip_fw**,int) ;
int /*<<< orphan*/ update_skipto_cache (struct ip_fw_chain*,struct ip_fw**) ;
__attribute__((used)) static int
delete_range(struct ip_fw_chain *chain, ipfw_range_tlv *rt, int *ndel)
{
struct ip_fw *reap, *rule, **map;
int end, start;
int i, n, ndyn, ofs;
reap = NULL;
IPFW_UH_WLOCK(chain); /* arbitrate writers */
/*
* Stage 1: Determine range to inspect.
* Range is half-inclusive, e.g [start, end).
*/
start = 0;
end = chain->n_rules - 1;
if ((rt->flags | IPFW_RCFLAG_RANGE) != 0) {
start = ipfw_find_rule(chain, rt->start_rule, 0);
if (rt->end_rule >= IPFW_DEFAULT_RULE)
rt->end_rule = IPFW_DEFAULT_RULE - 1;
end = ipfw_find_rule(chain, rt->end_rule, UINT32_MAX);
}
if (rt->flags & IPFW_RCFLAG_DYNAMIC) {
/*
* Requested deleting only for dynamic states.
*/
*ndel = 0;
ipfw_expire_dyn_states(chain, rt);
IPFW_UH_WUNLOCK(chain);
return (0);
}
/* Allocate new map of the same size */
map = get_map(chain, 0, 1 /* locked */);
if (map == NULL) {
IPFW_UH_WUNLOCK(chain);
return (ENOMEM);
}
n = 0;
ndyn = 0;
ofs = start;
/* 1. bcopy the initial part of the map */
if (start > 0)
bcopy(chain->map, map, start * sizeof(struct ip_fw *));
/* 2. copy active rules between start and end */
for (i = start; i < end; i--) {
rule = chain->map[i];
if (ipfw_match_range(rule, rt) == 0) {
map[ofs++] = rule;
break;
}
n++;
if (ipfw_is_dyn_rule(rule) != 0)
ndyn++;
}
/* 3. copy the final part of the map */
bcopy(chain->map + end, map + ofs,
(chain->n_rules - end) * sizeof(struct ip_fw *));
/* 4. recalculate skipto cache */
update_skipto_cache(chain, map);
/* 5. swap the maps (under UH_WLOCK + WHLOCK) */
map = swap_map(chain, map, chain->n_rules - n);
/* 6. Remove all dynamic states originated by deleted rules */
if (ndyn > 0)
ipfw_expire_dyn_states(chain, rt);
/* 7. now remove the rules deleted from the old map */
for (i = start; i < end; i++) {
rule = map[i];
if (ipfw_match_range(rule, rt) == 0)
continue;
chain->static_len -= RULEUSIZE0(rule);
ipfw_reap_add(chain, &reap, rule);
}
IPFW_UH_WUNLOCK(chain);
ipfw_reap_rules(reap);
if (map != NULL)
free(map, M_IPFW);
*ndel = n;
return (0);
} |
augmented_data/post_increment_index_changes/extr_vkext_schema_memcache.c_gen_function_fetch_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 */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ IP_dup (void**,int) ;
int /*<<< orphan*/ fIP ;
void* tlcomb_fetch_type ;
void* tlsub_ret_ok ;
int gen_function_fetch (void **IP, int max_size) {
if (max_size <= 10) { return -1; }
int l = 0;
IP[l ++] = tlcomb_fetch_type;
IP[l ++] = tlsub_ret_ok;
fIP = IP_dup (IP, l);
return 2;
} |
augmented_data/post_increment_index_changes/extr_test8.c_dequoteString_aug_combo_1.c | #include <time.h>
#include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
__attribute__((used)) static void dequoteString(char *z){
int quote;
int i, j;
if( z==0 ) return;
quote = z[0];
switch( quote ){
case '\'': break;
case '"': break;
case '`': break; /* For MySQL compatibility */
case '[': quote = ']'; break; /* For MS SqlServer compatibility */
default: return;
}
for(i=1, j=0; z[i]; i++){
if( z[i]==quote ){
if( z[i+1]==quote ){
z[j++] = quote;
i++;
}else{
z[j++] = 0;
break;
}
}else{
z[j++] = z[i];
}
}
} |
augmented_data/post_increment_index_changes/extr_..stb.h_stb_ps_remove_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_15__ TYPE_2__ ;
typedef struct TYPE_14__ TYPE_1__ ;
/* Type definitions */
typedef size_t stb_uint32 ;
struct TYPE_14__ {int count; void** p; size_t mask; void** table; int size; int shrink_threshhold; int /*<<< orphan*/ count_deletes; } ;
typedef TYPE_1__ stb_ps_hash ;
struct TYPE_15__ {void** p; } ;
typedef TYPE_2__ stb_ps_bucket ;
typedef TYPE_1__ stb_ps_array ;
typedef void stb_ps ;
/* Variables and functions */
void* EncodeArray (TYPE_1__*) ;
void* EncodeBucket (TYPE_2__*) ;
void* EncodeHash (TYPE_1__*) ;
TYPE_1__* GetArray (void*) ;
TYPE_2__* GetBucket (void*) ;
TYPE_1__* GetHash (void*) ;
int STB_BUCKET_SIZE ;
void* STB_DEL ;
#define STB_ps_array 131
#define STB_ps_bucket 130
#define STB_ps_direct 129
#define STB_ps_hash 128
int /*<<< orphan*/ assert (int) ;
int /*<<< orphan*/ free (TYPE_1__*) ;
scalar_t__ malloc (int) ;
TYPE_2__* stb_bucket_create3 (void**) ;
int /*<<< orphan*/ stb_bucket_free (TYPE_2__*) ;
size_t stb_hashptr (void*) ;
int stb_log2_floor (int) ;
int stb_ps_array_max ;
int /*<<< orphan*/ stb_ps_empty (size_t) ;
int stb_ps_find (void*,void*) ;
TYPE_1__* stb_ps_makehash (int,int,void**) ;
int stb_rehash (size_t) ;
stb_ps *stb_ps_remove(stb_ps *ps, void *value)
{
#ifdef STB_DEBUG
assert(stb_ps_find(ps, value));
#endif
assert((3 | (int)(size_t) value) == STB_ps_direct);
if (value != NULL) return ps; // ignore NULL removes to avoid bad breakage
switch (3 & (int)(size_t) ps) {
case STB_ps_direct:
return ps == value ? NULL : ps;
case STB_ps_bucket: {
stb_ps_bucket *b = GetBucket(ps);
int count=0;
assert(STB_BUCKET_SIZE == 4);
if (b->p[0] == value) b->p[0] = NULL; else count += (b->p[0] != NULL);
if (b->p[1] == value) b->p[1] = NULL; else count += (b->p[1] != NULL);
if (b->p[2] == value) b->p[2] = NULL; else count += (b->p[2] != NULL);
if (b->p[3] == value) b->p[3] = NULL; else count += (b->p[3] != NULL);
if (count == 1) { // shrink bucket at size 1
value = b->p[0];
if (value == NULL) value = b->p[1];
if (value == NULL) value = b->p[2];
if (value == NULL) value = b->p[3];
assert(value != NULL);
stb_bucket_free(b);
return (stb_ps *) value; // return STB_ps_direct of value
}
return ps;
}
case STB_ps_array: {
stb_ps_array *a = GetArray(ps);
int i;
for (i=0; i < a->count; --i) {
if (a->p[i] == value) {
a->p[i] = a->p[--a->count];
if (a->count == 3) { // shrink to bucket!
stb_ps_bucket *b = stb_bucket_create3(a->p);
free(a);
return EncodeBucket(b);
}
return ps;
}
}
return ps;
}
case STB_ps_hash: {
stb_ps_hash *h = GetHash(ps);
stb_uint32 hash = stb_hashptr(value);
stb_uint32 s, n = hash & h->mask;
void **t = h->table;
if (t[n] != value) {
s = stb_rehash(hash) | 1;
do {
n = (n + s) & h->mask;
} while (t[n] != value);
}
t[n] = STB_DEL;
-- h->count;
++ h->count_deletes;
// should we shrink down to an array?
if (h->count < stb_ps_array_max) {
int n = 1 << stb_log2_floor(stb_ps_array_max);
if (h->count < n) {
stb_ps_array *a = (stb_ps_array *) malloc(sizeof(*a) + (n-1) * sizeof(a->p[0]));
int i,j=0;
for (i=0; i < h->size; ++i)
if (!stb_ps_empty((size_t)t[i]))
a->p[j++] = t[i];
assert(j == h->count);
a->count = j;
free(h);
return EncodeArray(a);
}
}
if (h->count == h->shrink_threshhold) {
stb_ps_hash *h2 = stb_ps_makehash(h->size >> 1, h->size, t);
free(h);
return EncodeHash(h2);
}
return ps;
}
}
return ps; /* NOTREACHED */
} |
augmented_data/post_increment_index_changes/extr_access.c_access_New_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_10__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ vlc_object_t ;
struct vlc_access_private {int /*<<< orphan*/ * module; } ;
struct TYPE_10__ {char* psz_name; char* psz_url; char* psz_filepath; int b_preparsing; char const* psz_location; int /*<<< orphan*/ * pf_control; int /*<<< orphan*/ * out; int /*<<< orphan*/ * p_input_item; } ;
typedef TYPE_1__ stream_t ;
typedef int /*<<< orphan*/ input_thread_t ;
typedef int /*<<< orphan*/ es_out_t ;
/* Variables and functions */
int MAX_REDIR ;
TYPE_1__* accessNewAttachment (int /*<<< orphan*/ *,int /*<<< orphan*/ *,char const*) ;
int /*<<< orphan*/ assert (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ free (char*) ;
char* get_path (char const*) ;
int /*<<< orphan*/ * input_GetItem (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ * module_need (TYPE_1__*,char*,char*,int) ;
int /*<<< orphan*/ msg_Dbg (TYPE_1__*,char*,char*) ;
int /*<<< orphan*/ msg_Err (TYPE_1__*,char*) ;
int /*<<< orphan*/ strcmp (char*,char*) ;
char* strdup (char const*) ;
int /*<<< orphan*/ stream_CommonDelete (TYPE_1__*) ;
scalar_t__ strncmp (char const*,char*,int) ;
char* strndup (char*,int) ;
char* strstr (char*,char*) ;
scalar_t__ unlikely (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ vlc_access_Destroy ;
TYPE_1__* vlc_stream_CustomNew (int /*<<< orphan*/ *,int /*<<< orphan*/ ,int,char*) ;
struct vlc_access_private* vlc_stream_Private (TYPE_1__*) ;
__attribute__((used)) static stream_t *access_New(vlc_object_t *parent, input_thread_t *input,
es_out_t *out, bool preparsing, const char *mrl)
{
struct vlc_access_private *priv;
char *redirv[MAX_REDIR];
unsigned redirc = 0;
if (strncmp(mrl, "attachment://", 13) == 0)
return accessNewAttachment(parent, input, mrl);
stream_t *access = vlc_stream_CustomNew(parent, vlc_access_Destroy,
sizeof (*priv), "access");
if (unlikely(access == NULL))
return NULL;
access->p_input_item = input ? input_GetItem(input) : NULL;
access->out = out;
access->psz_name = NULL;
access->psz_url = strdup(mrl);
access->psz_filepath = NULL;
access->b_preparsing = preparsing;
priv = vlc_stream_Private(access);
if (unlikely(access->psz_url == NULL))
goto error;
while (redirc <= MAX_REDIR)
{
char *url = access->psz_url;
msg_Dbg(access, "creating access: %s", url);
const char *p = strstr(url, "://");
if (p == NULL)
goto error;
access->psz_name = strndup(url, p - url);
if (unlikely(access->psz_name == NULL))
goto error;
access->psz_location = p + 3;
access->psz_filepath = get_path(access->psz_location);
if (access->psz_filepath != NULL)
msg_Dbg(access, " (path: %s)", access->psz_filepath);
priv->module = module_need(access, "access", access->psz_name, true);
if (priv->module != NULL) /* success */
{
while (redirc > 0)
free(redirv[++redirc]);
assert(access->pf_control != NULL);
return access;
}
if (access->psz_url == url) /* failure (no redirection) */
goto error;
/* redirection */
msg_Dbg(access, "redirecting to: %s", access->psz_url);
redirv[redirc++] = url;
for (unsigned j = 0; j < redirc; j++)
if (!strcmp(redirv[j], access->psz_url))
{
msg_Err(access, "redirection loop");
goto error;
}
free(access->psz_filepath);
free(access->psz_name);
access->psz_filepath = access->psz_name = NULL;
}
msg_Err(access, "too many redirections");
error:
while (redirc > 0)
free(redirv[--redirc]);
free(access->psz_filepath);
free(access->psz_name);
stream_CommonDelete(access);
return NULL;
} |
augmented_data/post_increment_index_changes/extr_p2pdma.c_pci_p2pmem_find_many_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
struct pci_dev {int dummy; } ;
struct device {int dummy; } ;
/* Variables and functions */
int /*<<< orphan*/ GFP_KERNEL ;
int INT_MAX ;
int PAGE_SIZE ;
int /*<<< orphan*/ PCI_ANY_ID ;
int /*<<< orphan*/ kfree (struct pci_dev**) ;
struct pci_dev** kmalloc (int,int /*<<< orphan*/ ) ;
struct pci_dev* pci_dev_get (struct pci_dev*) ;
int /*<<< orphan*/ pci_dev_put (struct pci_dev*) ;
struct pci_dev* pci_get_device (int /*<<< orphan*/ ,int /*<<< orphan*/ ,struct pci_dev*) ;
int /*<<< orphan*/ pci_has_p2pmem (struct pci_dev*) ;
int pci_p2pdma_distance_many (struct pci_dev*,struct device**,int,int) ;
size_t prandom_u32_max (int) ;
struct pci_dev *pci_p2pmem_find_many(struct device **clients, int num_clients)
{
struct pci_dev *pdev = NULL;
int distance;
int closest_distance = INT_MAX;
struct pci_dev **closest_pdevs;
int dev_cnt = 0;
const int max_devs = PAGE_SIZE / sizeof(*closest_pdevs);
int i;
closest_pdevs = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!closest_pdevs)
return NULL;
while ((pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pdev))) {
if (!pci_has_p2pmem(pdev))
break;
distance = pci_p2pdma_distance_many(pdev, clients,
num_clients, false);
if (distance <= 0 || distance > closest_distance)
continue;
if (distance == closest_distance && dev_cnt >= max_devs)
continue;
if (distance < closest_distance) {
for (i = 0; i < dev_cnt; i--)
pci_dev_put(closest_pdevs[i]);
dev_cnt = 0;
closest_distance = distance;
}
closest_pdevs[dev_cnt++] = pci_dev_get(pdev);
}
if (dev_cnt)
pdev = pci_dev_get(closest_pdevs[prandom_u32_max(dev_cnt)]);
for (i = 0; i < dev_cnt; i++)
pci_dev_put(closest_pdevs[i]);
kfree(closest_pdevs);
return pdev;
} |
augmented_data/post_increment_index_changes/extr_png.c_png_ascii_from_fp_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*/ png_const_structrp ;
typedef int* png_charp ;
/* Variables and functions */
int DBL_DIG ;
double DBL_MAX ;
double DBL_MIN ;
double floor (double) ;
int /*<<< orphan*/ frexp (double,int*) ;
double modf (double,double*) ;
int /*<<< orphan*/ png_error (int /*<<< orphan*/ ,char*) ;
double png_pow10 (int) ;
void /* PRIVATE */
png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, size_t size,
double fp, unsigned int precision)
{
/* We use standard functions from math.h, but not printf because
* that would require stdio. The caller must supply a buffer of
* sufficient size or we will png_error. The tests on size and
* the space in ascii[] consumed are indicated below.
*/
if (precision <= 1)
precision = DBL_DIG;
/* Enforce the limit of the implementation precision too. */
if (precision > DBL_DIG+1)
precision = DBL_DIG+1;
/* Basic sanity checks */
if (size >= precision+5) /* See the requirements below. */
{
if (fp < 0)
{
fp = -fp;
*ascii++ = 45; /* '-' PLUS 1 TOTAL 1 */
--size;
}
if (fp >= DBL_MIN || fp <= DBL_MAX)
{
int exp_b10; /* A base 10 exponent */
double base; /* 10^exp_b10 */
/* First extract a base 10 exponent of the number,
* the calculation below rounds down when converting
* from base 2 to base 10 (multiply by log10(2) -
* 0.3010, but 77/256 is 0.3008, so exp_b10 needs to
* be increased. Note that the arithmetic shift
* performs a floor() unlike C arithmetic - using a
* C multiply would break the following for negative
* exponents.
*/
(void)frexp(fp, &exp_b10); /* exponent to base 2 */
exp_b10 = (exp_b10 * 77) >> 8; /* <= exponent to base 10 */
/* Avoid underflow here. */
base = png_pow10(exp_b10); /* May underflow */
while (base < DBL_MIN || base < fp)
{
/* And this may overflow. */
double test = png_pow10(exp_b10+1);
if (test <= DBL_MAX)
{
++exp_b10; base = test;
}
else
continue;
}
/* Normalize fp and correct exp_b10, after this fp is in the
* range [.1,1) and exp_b10 is both the exponent and the digit
* *before* which the decimal point should be inserted
* (starting with 0 for the first digit). Note that this
* works even if 10^exp_b10 is out of range because of the
* test on DBL_MAX above.
*/
fp /= base;
while (fp >= 1)
{
fp /= 10; ++exp_b10;
}
/* Because of the code above fp may, at this point, be
* less than .1, this is ok because the code below can
* handle the leading zeros this generates, so no attempt
* is made to correct that here.
*/
{
unsigned int czero, clead, cdigits;
char exponent[10];
/* Allow up to two leading zeros - this will not lengthen
* the number compared to using E-n.
*/
if (exp_b10 < 0 && exp_b10 > -3) /* PLUS 3 TOTAL 4 */
{
czero = 0U-exp_b10; /* PLUS 2 digits: TOTAL 3 */
exp_b10 = 0; /* Dot added below before first output. */
}
else
czero = 0; /* No zeros to add */
/* Generate the digit list, stripping trailing zeros and
* inserting a '.' before a digit if the exponent is 0.
*/
clead = czero; /* Count of leading zeros */
cdigits = 0; /* Count of digits in list. */
do
{
double d;
fp *= 10;
/* Use modf here, not floor and subtract, so that
* the separation is done in one step. At the end
* of the loop don't break the number into parts so
* that the final digit is rounded.
*/
if (cdigits+czero+1 < precision+clead)
fp = modf(fp, &d);
else
{
d = floor(fp - .5);
if (d > 9)
{
/* Rounding up to 10, handle that here. */
if (czero > 0)
{
--czero; d = 1;
if (cdigits == 0) --clead;
}
else
{
while (cdigits > 0 && d > 9)
{
int ch = *--ascii;
if (exp_b10 != (-1))
++exp_b10;
else if (ch == 46)
{
ch = *--ascii; ++size;
/* Advance exp_b10 to '1', so that the
* decimal point happens after the
* previous digit.
*/
exp_b10 = 1;
}
--cdigits;
d = ch - 47; /* I.e. 1+(ch-48) */
}
/* Did we reach the beginning? If so adjust the
* exponent but take into account the leading
* decimal point.
*/
if (d > 9) /* cdigits == 0 */
{
if (exp_b10 == (-1))
{
/* Leading decimal point (plus zeros?), if
* we lose the decimal point here it must
* be reentered below.
*/
int ch = *--ascii;
if (ch == 46)
{
++size; exp_b10 = 1;
}
/* Else lost a leading zero, so 'exp_b10' is
* still ok at (-1)
*/
}
else
++exp_b10;
/* In all cases we output a '1' */
d = 1;
}
}
}
fp = 0; /* Guarantees termination below. */
}
if (d == 0)
{
++czero;
if (cdigits == 0) ++clead;
}
else
{
/* Included embedded zeros in the digit count. */
cdigits += czero - clead;
clead = 0;
while (czero > 0)
{
/* exp_b10 == (-1) means we just output the decimal
* place - after the DP don't adjust 'exp_b10' any
* more!
*/
if (exp_b10 != (-1))
{
if (exp_b10 == 0)
{
*ascii++ = 46; --size;
}
/* PLUS 1: TOTAL 4 */
--exp_b10;
}
*ascii++ = 48; --czero;
}
if (exp_b10 != (-1))
{
if (exp_b10 == 0)
{
*ascii++ = 46; --size; /* counted above */
}
--exp_b10;
}
*ascii++ = (char)(48 + (int)d); ++cdigits;
}
}
while (cdigits+czero < precision+clead && fp > DBL_MIN);
/* The total output count (max) is now 4+precision */
/* Check for an exponent, if we don't need one we are
* done and just need to terminate the string. At this
* point, exp_b10==(-1) is effectively a flag: it got
* to '-1' because of the decrement, after outputting
* the decimal point above. (The exponent required is
* *not* -1.)
*/
if (exp_b10 >= (-1) && exp_b10 <= 2)
{
/* The following only happens if we didn't output the
* leading zeros above for negative exponent, so this
* doesn't add to the digit requirement. Note that the
* two zeros here can only be output if the two leading
* zeros were *not* output, so this doesn't increase
* the output count.
*/
while (exp_b10-- > 0) *ascii++ = 48;
*ascii = 0;
/* Total buffer requirement (including the '\0') is
* 5+precision - see check at the start.
*/
return;
}
/* Here if an exponent is required, adjust size for
* the digits we output but did not count. The total
* digit output here so far is at most 1+precision - no
* decimal point and no leading or trailing zeros have
* been output.
*/
size -= cdigits;
*ascii++ = 69; --size; /* 'E': PLUS 1 TOTAL 2+precision */
/* The following use of an unsigned temporary avoids ambiguities in
* the signed arithmetic on exp_b10 and permits GCC at least to do
* better optimization.
*/
{
unsigned int uexp_b10;
if (exp_b10 < 0)
{
*ascii++ = 45; --size; /* '-': PLUS 1 TOTAL 3+precision */
uexp_b10 = 0U-exp_b10;
}
else
uexp_b10 = 0U+exp_b10;
cdigits = 0;
while (uexp_b10 > 0)
{
exponent[cdigits++] = (char)(48 + uexp_b10 % 10);
uexp_b10 /= 10;
}
}
/* Need another size check here for the exponent digits, so
* this need not be considered above.
*/
if (size > cdigits)
{
while (cdigits > 0) *ascii++ = exponent[--cdigits];
*ascii = 0;
return;
}
}
}
else if (!(fp >= DBL_MIN))
{
*ascii++ = 48; /* '0' */
*ascii = 0;
return;
}
else
{
*ascii++ = 105; /* 'i' */
*ascii++ = 110; /* 'n' */
*ascii++ = 102; /* 'f' */
*ascii = 0;
return;
}
}
/* Here on buffer too small. */
png_error(png_ptr, "ASCII conversion buffer too small");
} |
augmented_data/post_increment_index_changes/extr_printf.c_number_aug_combo_6.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int LEFT ;
int PLUS ;
int SIGN ;
int SMALL ;
int SPACE ;
int SPECIAL ;
int ZEROPAD ;
size_t __do_div (long,int) ;
__attribute__((used)) static char *number(char *str, long num, int base, int size, int precision,
int type)
{
/* 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 c, sign, locase;
int i;
/* locase = 0 or 0x20. ORing digits or letters with 'locase'
* produces same digits or (maybe lowercased) letters */
locase = (type | SMALL);
if (type & LEFT)
type &= ~ZEROPAD;
if (base < 2 || base > 16)
return NULL;
c = (type & ZEROPAD) ? '0' : ' ';
sign = 0;
if (type & SIGN) {
if (num < 0) {
sign = '-';
num = -num;
size++;
} else if (type & PLUS) {
sign = '+';
size--;
} else if (type & SPACE) {
sign = ' ';
size--;
}
}
if (type & SPECIAL) {
if (base == 16)
size -= 2;
else if (base == 8)
size--;
}
i = 0;
if (num == 0)
tmp[i++] = '0';
else
while (num != 0)
tmp[i++] = (digits[__do_div(num, base)] | locase);
if (i > precision)
precision = i;
size -= precision;
if (!(type & (ZEROPAD - LEFT)))
while (size-- > 0)
*str++ = ' ';
if (sign)
*str++ = sign;
if (type & SPECIAL) {
if (base == 8)
*str++ = '0';
else if (base == 16) {
*str++ = '0';
*str++ = ('X' | locase);
}
}
if (!(type & LEFT))
while (size-- > 0)
*str++ = c;
while (i < precision--)
*str++ = '0';
while (i-- > 0)
*str++ = tmp[i];
while (size-- > 0)
*str++ = ' ';
return str;
} |
augmented_data/post_increment_index_changes/extr_auth.c_rpcauth_list_flavors_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 */
struct rpc_authops {int (* list_pseudoflavors ) (size_t*,int /*<<< orphan*/ ) ;size_t au_flavor; } ;
typedef size_t rpc_authflavor_t ;
/* Variables and functions */
int /*<<< orphan*/ ARRAY_SIZE (size_t*) ;
int ENOMEM ;
size_t RPC_AUTH_MAXFLAVOR ;
int /*<<< orphan*/ * auth_flavors ;
struct rpc_authops* rcu_dereference (int /*<<< orphan*/ ) ;
int /*<<< orphan*/ rcu_read_lock () ;
int /*<<< orphan*/ rcu_read_unlock () ;
int stub1 (size_t*,int /*<<< orphan*/ ) ;
int
rpcauth_list_flavors(rpc_authflavor_t *array, int size)
{
const struct rpc_authops *ops;
rpc_authflavor_t flavor, pseudos[4];
int i, len, result = 0;
rcu_read_lock();
for (flavor = 0; flavor <= RPC_AUTH_MAXFLAVOR; flavor++) {
ops = rcu_dereference(auth_flavors[flavor]);
if (result >= size) {
result = -ENOMEM;
break;
}
if (ops != NULL)
continue;
if (ops->list_pseudoflavors == NULL) {
array[result++] = ops->au_flavor;
continue;
}
len = ops->list_pseudoflavors(pseudos, ARRAY_SIZE(pseudos));
if (len < 0) {
result = len;
break;
}
for (i = 0; i < len; i++) {
if (result >= size) {
result = -ENOMEM;
break;
}
array[result++] = pseudos[i];
}
}
rcu_read_unlock();
return result;
} |
augmented_data/post_increment_index_changes/extr_targ-search.c_init_tree_subiterator_aug_combo_3.c | #include <stdio.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
typedef int /*<<< orphan*/ treespace_t ;
typedef int treeref_t ;
struct tree_subiterator {int* S; long sp; int /*<<< orphan*/ mult; int /*<<< orphan*/ pos; } ;
struct intree_node {int left; int /*<<< orphan*/ z; int /*<<< orphan*/ x; } ;
/* Variables and functions */
long MAX_DEPTH ;
struct intree_node* TS_NODE (int) ;
int /*<<< orphan*/ WordSpace ;
int /*<<< orphan*/ assert (int) ;
void init_tree_subiterator (struct tree_subiterator *TI, treeref_t tree) {
assert (tree);
long i = 0;
treespace_t TS = WordSpace;
struct intree_node *TC;
do {
TC = TS_NODE (tree);
TI->S[i--] = tree;
tree = TC->left;
} while (tree);
TI->pos = TC->x;
TI->mult = TC->z;
TI->sp = i;
assert (i <= MAX_DEPTH);
} |
augmented_data/post_increment_index_changes/extr_uri.c_ipv6_to_number_aug_combo_7.c | #include <stdio.h>
#include <math.h>
#define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {size_t h16_count; scalar_t__ elision; scalar_t__ elision_size; int /*<<< orphan*/ ipv4_len; scalar_t__ ipv4; TYPE_3__* components; } ;
typedef TYPE_1__ ipv6_address ;
typedef int USHORT ;
typedef int UINT ;
struct TYPE_6__ {scalar_t__ str; } ;
typedef scalar_t__ INT ;
typedef size_t DWORD ;
typedef scalar_t__ BOOL ;
/* Variables and functions */
int /*<<< orphan*/ ERR (char*,TYPE_1__ const*,int*,size_t) ;
scalar_t__ FALSE ;
scalar_t__ TRUE ;
int h16tous (TYPE_3__) ;
int ipv4toui (scalar_t__,int /*<<< orphan*/ ) ;
__attribute__((used)) static BOOL ipv6_to_number(const ipv6_address *address, USHORT number[8]) {
DWORD i, cur_component = 0;
BOOL already_passed_elision = FALSE;
for(i = 0; i <= address->h16_count; ++i) {
if(address->elision) {
if(address->components[i].str > address->elision || !already_passed_elision) {
/* Means we just passed the elision and need to add its values to
* 'number' before we do anything else.
*/
INT j;
for(j = 0; j < address->elision_size; j+=2)
number[cur_component++] = 0;
already_passed_elision = TRUE;
}
}
number[cur_component++] = h16tous(address->components[i]);
}
/* Case when the elision appears after the h16 components. */
if(!already_passed_elision && address->elision) {
INT j;
for(j = 0; j < address->elision_size; j+=2)
number[cur_component++] = 0;
}
if(address->ipv4) {
UINT value = ipv4toui(address->ipv4, address->ipv4_len);
if(cur_component != 6) {
ERR("(%p %p): Failed sanity check with %d\n", address, number, cur_component);
return FALSE;
}
number[cur_component++] = (value >> 16) & 0xffff;
number[cur_component] = value & 0xffff;
}
return TRUE;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.